aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/cros_ec_i2c.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-07-09mfd: cros_ec: Use the proper size when looking at the cros_ec_i2c resultDoug Anderson1-3/+12
We know how many bytes the EC should be sending us (which is also the number of bytes transferred) and also how many bytes the EC actually wanted to send to us. When computing the checksum and copying back data let's make sure we take the lesser of the two of those. We'll also complain if the EC tried to send us too many bytes. The EC sending us too few bytes is legit for when we send the EC an invalid command. This is based on similar code in cros_ec_spi. Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: cros_ec: ec_dev->cmd_xfer() returns number of bytes received from ECBill Richardson1-1/+1
When communicating with the EC, the cmd_xfer() function should return the number of bytes it received from the EC, or negative on error. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: cros_ec: Check result code from EC messagesBill Richardson1-5/+3
Just because the host was able to talk to the EC doesn't mean that the EC was happy with what it was told. Errors in communincation are not the same as error messages from the EC itself. This change lets the EC report its errors separately. [dianders: Added common function to cros_ec.c] Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: cros_ec: cleanup: remove unused fields from struct cros_ec_deviceBill Richardson1-1/+0
struct cros_ec_device has a superfluous "name" field. We can get all the debugging info we need from the existing ec_name and phys_name fields, so let's take out the extra field. The printout also has sufficient info in it without explicitly adding the transport. Before this change: cros-ec-spi spi2.0: Chrome EC (SPI) After this change: cros-ec-spi spi2.0: Chrome EC device registered Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: cros_ec: Use struct cros_ec_command to communicate with the ECBill Richardson1-12/+12
This is some internal structure reorganization / renaming to prepare for future patches that will add a userspace API to cros_ec. There should be no visible changes. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-07-09mfd: cros_ec: Tweak struct cros_ec_device for clarityBill Richardson1-2/+2
The members of struct cros_ec_device were improperly commented, and intermixed the private and public sections. This is just cleanup to make it more obvious what goes with what. [dianders: left lock in the structure but gave it the name that will eventually be used.] Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-21mfd: cros ec: i2c: Use consistent function namesThierry Reding1-4/+4
Rename cros_ec_{probe,remove}_i2c() to cros_ec_i2c_{probe,remove}() for consistency. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-04-05mfd: Add ChromeOS EC I2C driverSimon Glass1-0/+201
This uses an I2C bus to talk to the ChromeOS EC. The protocol is defined by the EC and is fairly simple, with a length byte, checksum, command byte and version byte (to permit easy creation of new commands). Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>