summaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome/wilco_ec/mailbox.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-11 18:45:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-11 18:45:29 -0700
commitd7d170a8e357bd9926cc6bfea5c2385c2eac65b2 (patch)
treecb66ba886b0c0b92d3e41ae551b4bc90e219a913 /drivers/platform/chrome/wilco_ec/mailbox.c
parentd06e4156430e7c5eb4f04dabcaa0d9e2fba335e3 (diff)
parent8c3166e17cf10161d2871dfb1d017287c7b79ff1 (diff)
downloadlinux-stable-d7d170a8e357bd9926cc6bfea5c2385c2eac65b2.tar.gz
linux-stable-d7d170a8e357bd9926cc6bfea5c2385c2eac65b2.tar.bz2
linux-stable-d7d170a8e357bd9926cc6bfea5c2385c2eac65b2.zip
Merge tag 'tag-chrome-platform-for-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
Pull chrome platform updates from Benson Leung "CrOS EC: - Add new CrOS ISHTP transport protocol - Add proper documentation for debugfs entries and expose resume and uptime files - Select LPC transport protocol variant at runtime. - Add lid angle sensor driver - Fix oops on suspend/resume for lightbar driver - Set CrOS SPI transport protol in realtime Wilco EC: - Add telemetry char device interface - Add support for event handling - Add new sysfs attributes Misc: - Contains ib-mfd-cros-v5.3 immutable branch from mfd, with cros_ec_commands.h header freshly synced with Chrome OS's EC project" * tag 'tag-chrome-platform-for-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (54 commits) mfd / platform: cros_ec_debugfs: Expose resume result via debugfs platform/chrome: lightbar: Get drvdata from parent in suspend/resume iio: cros_ec: Add lid angle driver platform/chrome: wilco_ec: Add circular buffer as event queue platform/chrome: cros_ec_lpc_mec: Fix kernel-doc comment first line platform/chrome: cros_ec_lpc: Choose Microchip EC at runtime platform/chrome: cros_ec_lpc: Merge cros_ec_lpc and cros_ec_lpc_reg Input: cros_ec_keyb: mask out extra flags in event_type platform/chrome: wilco_ec: Fix unreleased lock in event_read() platform/chrome: cros_ec_debugfs: cros_ec_uptime_fops can be static platform/chrome: cros_ec_debugfs: Add debugfs ABI documentation platform/chrome: cros_ec_debugfs: Fix kernel-doc comment first line platform/chrome: cros_ec_debugfs: Add debugfs entry to retrieve EC uptime mfd: cros_ec: Update I2S API mfd: cros_ec: Add Management API entry points mfd: cros_ec: Add SKU ID and Secure storage API mfd: cros_ec: Add API for rwsig mfd: cros_ec: Add API for Fingerprint support mfd: cros_ec: Add API for Touchpad support mfd: cros_ec: Add API for EC-EC communication ...
Diffstat (limited to 'drivers/platform/chrome/wilco_ec/mailbox.c')
-rw-r--r--drivers/platform/chrome/wilco_ec/mailbox.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c
index 7fb58b487963..ced1f9f3dcee 100644
--- a/drivers/platform/chrome/wilco_ec/mailbox.c
+++ b/drivers/platform/chrome/wilco_ec/mailbox.c
@@ -119,7 +119,6 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec,
struct wilco_ec_response *rs;
u8 checksum;
u8 flag;
- size_t size;
/* Write request header, then data */
cros_ec_lpc_io_bytes_mec(MEC_IO_WRITE, 0, sizeof(*rq), (u8 *)rq);
@@ -148,21 +147,11 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec,
return -EIO;
}
- /*
- * The EC always returns either EC_MAILBOX_DATA_SIZE or
- * EC_MAILBOX_DATA_SIZE_EXTENDED bytes of data, so we need to
- * calculate the checksum on **all** of this data, even if we
- * won't use all of it.
- */
- if (msg->flags & WILCO_EC_FLAG_EXTENDED_DATA)
- size = EC_MAILBOX_DATA_SIZE_EXTENDED;
- else
- size = EC_MAILBOX_DATA_SIZE;
-
/* Read back response */
rs = ec->data_buffer;
checksum = cros_ec_lpc_io_bytes_mec(MEC_IO_READ, 0,
- sizeof(*rs) + size, (u8 *)rs);
+ sizeof(*rs) + EC_MAILBOX_DATA_SIZE,
+ (u8 *)rs);
if (checksum) {
dev_dbg(ec->dev, "bad packet checksum 0x%02x\n", rs->checksum);
return -EBADMSG;
@@ -173,9 +162,9 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec,
return -EBADMSG;
}
- if (rs->data_size != size) {
- dev_dbg(ec->dev, "unexpected packet size (%u != %zu)",
- rs->data_size, size);
+ if (rs->data_size != EC_MAILBOX_DATA_SIZE) {
+ dev_dbg(ec->dev, "unexpected packet size (%u != %u)",
+ rs->data_size, EC_MAILBOX_DATA_SIZE);
return -EMSGSIZE;
}