mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
chrome platform changes for v5.2
CrOS EC: - Add EC host command support using rpmsg - Add new CrOS USB PD logging driver - Transfer spi messages at high priority - Add support to trace CrOS EC commands - Minor fixes and cleanups in protocol and debugfs Wilco EC: - Standardize Wilco EC mailbox interface - Add h1_gpio status to debugfs -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlzV61YACgkQHwn1ewov 5lgEFw//S7GVmBrFxcqu5wAjF1CW+mOGi3y6nVuTAHanWG/hJGWT+itOwsdDp6c9 TggYgohprz64JAZOPqPCTonV/qbxgsfKrSQRxFDtHH4F1iEUF46fnlsULDKi8VwM Qzj4g4d//ePsOwHOsYVrbJRU2qKyF6Rm2hpOxKfI9u2Dv5fxLFu6fxUhrSq1Inr6 U67j7pxBwOnBtN2A6hMKHZaOUVkSNYT6azSPO3Z2YH0aky2Baxw/LPoRnbCNhwUQ iyneX5+K0wpCz2fpnBF/QSh1QBACeyfrO6HHA+flfaejhShaWttrS36Gar+sdHFN p6eeR1CoEJZbRY79Eetj8Cv5Be1ivVG/SC5JF4O1apAAn87wXLI6AaLG/03ul0vc KOkcjrXMxISRlAUr+OKD0rg3Uo2oI0ht70XMT9DDsCRNDoVHvkDQJNdkWrKq+E1c xL4YeLofZpcEN+Oe/WnwUZtYUdY3qcWs+C4hV+h0L0Ke5xir25DEUfF3j3J/uK2B JEgkTpH8j6YjbGAErBPkTxWt5HE3oWtkK4moPlrfPKfxoSo2eRDvqz68qHsgIn8p WBM+FSr+dQ7qyYDigMKrFSesiBpwCBI4lIgPxkvTxqbubaoZcsABHm3BUGjykXII E5z2qsgRnDrB+uGGDkTvDoR0Kr3U0hGlag7u/N61H86PoiMLUig= =NF5N -----END PGP SIGNATURE----- Merge tag 'tag-chrome-platform-for-v5.2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux Pull chrome platform updates from Benson Leung: "CrOS EC: - Add EC host command support using rpmsg - Add new CrOS USB PD logging driver - Transfer spi messages at high priority - Add support to trace CrOS EC commands - Minor fixes and cleanups in protocol and debugfs Wilco EC: - Standardize Wilco EC mailbox interface - Add h1_gpio status to debugfs" * tag 'tag-chrome-platform-for-v5.2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: platform/chrome: cros_ec_proto: Add trace event to trace EC commands platform/chrome: cros_ec_debugfs: Use cros_ec_cmd_xfer_status helper platform/chrome: cros_ec: Add EC host command support using rpmsg platform/chrome: wilco_ec: Add h1_gpio status to debugfs platform/chrome: wilco_ec: Standardize mailbox interface platform/chrome: cros_ec_proto: check for NULL transfer function platform/chrome: Add CrOS USB PD logging driver platform/chrome: cros_ec_spi: Transfer messages at high priority platform/chrome: cros_ec_debugfs: no need to check return value of debugfs_create functions platform/chrome: cros_ec_debugfs: Remove dev_warn when console log is not supported
This commit is contained in:
commit
47782361ac
14 changed files with 984 additions and 183 deletions
|
|
@ -21,8 +21,20 @@
|
|||
#define EC_CMOS_TOD_WRITE 0x02
|
||||
#define EC_CMOS_TOD_READ 0x08
|
||||
|
||||
/* Message sent to the EC to request the current time. */
|
||||
struct ec_rtc_read_request {
|
||||
u8 command;
|
||||
u8 reserved;
|
||||
u8 param;
|
||||
} __packed;
|
||||
static struct ec_rtc_read_request read_rq = {
|
||||
.command = EC_COMMAND_CMOS,
|
||||
.param = EC_CMOS_TOD_READ,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ec_rtc_read - Format of RTC returned by EC.
|
||||
* struct ec_rtc_read_response - Format of RTC returned by EC.
|
||||
* @reserved: Unused byte
|
||||
* @second: Second value (0..59)
|
||||
* @minute: Minute value (0..59)
|
||||
* @hour: Hour value (0..23)
|
||||
|
|
@ -33,7 +45,8 @@
|
|||
*
|
||||
* All values are presented in binary (not BCD).
|
||||
*/
|
||||
struct ec_rtc_read {
|
||||
struct ec_rtc_read_response {
|
||||
u8 reserved;
|
||||
u8 second;
|
||||
u8 minute;
|
||||
u8 hour;
|
||||
|
|
@ -44,8 +57,10 @@ struct ec_rtc_read {
|
|||
} __packed;
|
||||
|
||||
/**
|
||||
* struct ec_rtc_write - Format of RTC sent to the EC.
|
||||
* @param: EC_CMOS_TOD_WRITE
|
||||
* struct ec_rtc_write_request - Format of RTC sent to the EC.
|
||||
* @command: Always EC_COMMAND_CMOS
|
||||
* @reserved: Unused byte
|
||||
* @param: Always EC_CMOS_TOD_WRITE
|
||||
* @century: Century value (full year / 100)
|
||||
* @year: Year value (full year % 100)
|
||||
* @month: Month value (1..12)
|
||||
|
|
@ -57,7 +72,9 @@ struct ec_rtc_read {
|
|||
*
|
||||
* All values are presented in BCD.
|
||||
*/
|
||||
struct ec_rtc_write {
|
||||
struct ec_rtc_write_request {
|
||||
u8 command;
|
||||
u8 reserved;
|
||||
u8 param;
|
||||
u8 century;
|
||||
u8 year;
|
||||
|
|
@ -72,19 +89,17 @@ struct ec_rtc_write {
|
|||
static int wilco_ec_rtc_read(struct device *dev, struct rtc_time *tm)
|
||||
{
|
||||
struct wilco_ec_device *ec = dev_get_drvdata(dev->parent);
|
||||
u8 param = EC_CMOS_TOD_READ;
|
||||
struct ec_rtc_read rtc;
|
||||
struct wilco_ec_message msg = {
|
||||
.type = WILCO_EC_MSG_LEGACY,
|
||||
.flags = WILCO_EC_FLAG_RAW_RESPONSE,
|
||||
.command = EC_COMMAND_CMOS,
|
||||
.request_data = ¶m,
|
||||
.request_size = sizeof(param),
|
||||
.response_data = &rtc,
|
||||
.response_size = sizeof(rtc),
|
||||
};
|
||||
struct ec_rtc_read_response rtc;
|
||||
struct wilco_ec_message msg;
|
||||
int ret;
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.type = WILCO_EC_MSG_LEGACY;
|
||||
msg.request_data = &read_rq;
|
||||
msg.request_size = sizeof(read_rq);
|
||||
msg.response_data = &rtc;
|
||||
msg.response_size = sizeof(rtc);
|
||||
|
||||
ret = wilco_ec_mailbox(ec, &msg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
@ -106,14 +121,8 @@ static int wilco_ec_rtc_read(struct device *dev, struct rtc_time *tm)
|
|||
static int wilco_ec_rtc_write(struct device *dev, struct rtc_time *tm)
|
||||
{
|
||||
struct wilco_ec_device *ec = dev_get_drvdata(dev->parent);
|
||||
struct ec_rtc_write rtc;
|
||||
struct wilco_ec_message msg = {
|
||||
.type = WILCO_EC_MSG_LEGACY,
|
||||
.flags = WILCO_EC_FLAG_RAW_RESPONSE,
|
||||
.command = EC_COMMAND_CMOS,
|
||||
.request_data = &rtc,
|
||||
.request_size = sizeof(rtc),
|
||||
};
|
||||
struct ec_rtc_write_request rtc;
|
||||
struct wilco_ec_message msg;
|
||||
int year = tm->tm_year + 1900;
|
||||
/*
|
||||
* Convert from 0=Sunday to 0=Saturday for the EC
|
||||
|
|
@ -123,6 +132,7 @@ static int wilco_ec_rtc_write(struct device *dev, struct rtc_time *tm)
|
|||
int wday = tm->tm_wday == 6 ? 0 : tm->tm_wday + 1;
|
||||
int ret;
|
||||
|
||||
rtc.command = EC_COMMAND_CMOS;
|
||||
rtc.param = EC_CMOS_TOD_WRITE;
|
||||
rtc.century = bin2bcd(year / 100);
|
||||
rtc.year = bin2bcd(year % 100);
|
||||
|
|
@ -133,6 +143,11 @@ static int wilco_ec_rtc_write(struct device *dev, struct rtc_time *tm)
|
|||
rtc.second = bin2bcd(tm->tm_sec);
|
||||
rtc.weekday = bin2bcd(wday);
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.type = WILCO_EC_MSG_LEGACY;
|
||||
msg.request_data = &rtc;
|
||||
msg.request_size = sizeof(rtc);
|
||||
|
||||
ret = wilco_ec_mailbox(ec, &msg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue