diff options
author | Simon Glass <sjg@chromium.org> | 2015-10-18 21:17:14 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-11-19 20:13:40 -0700 |
commit | 745009c4d081a9fb5504ce3e97b39e92cbe77ef4 (patch) | |
tree | 695ac969565a22a06a78303185a117f4cc345507 /drivers/misc | |
parent | 66877b0f5fc96906d70f1264b3b8102d2156360f (diff) | |
download | u-boot-745009c4d081a9fb5504ce3e97b39e92cbe77ef4.tar.gz |
cros_ec: Use udevice instead of cros_ec_dev for keyboard functions
In preparation for converting the cros_ec keyboard driver to driver model,
adjust the cros_ec functions it will use to use a normal struct udevice.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/cros_ec.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index ba36795c65..e3229efed0 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -358,9 +358,11 @@ static int ec_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, return len; } -int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan) +int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan) { - if (ec_command(dev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan, + struct cros_ec_dev *cdev = dev_get_uclass_priv(dev); + + if (ec_command(cdev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan, sizeof(scan->data)) != sizeof(scan->data)) return -1; @@ -549,13 +551,15 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd, return 0; } -int cros_ec_interrupt_pending(struct cros_ec_dev *dev) +int cros_ec_interrupt_pending(struct udevice *dev) { + struct cros_ec_dev *cdev = dev_get_uclass_priv(dev); + /* no interrupt support : always poll */ - if (!dm_gpio_is_valid(&dev->ec_int)) + if (!dm_gpio_is_valid(&cdev->ec_int)) return -ENOENT; - return dm_gpio_get_value(&dev->ec_int); + return dm_gpio_get_value(&cdev->ec_int); } int cros_ec_info(struct cros_ec_dev *dev, struct ec_response_mkbp_info *info) |