diff options
author | Benson Leung <bleung@chromium.org> | 2020-01-10 15:06:16 -0800 |
---|---|---|
committer | Benson Leung <bleung@chromium.org> | 2020-01-10 15:08:35 -0800 |
commit | 3b0bfd33ffb21dff369afaa8b1e4a6f25407ff38 (patch) | |
tree | 6143f6b8089471f37498d862997a3bd0deec307c /drivers/platform/chrome/wilco_ec | |
parent | ffd7263e63fe80a39c1222a6d68e05095ed04d03 (diff) | |
parent | dfb9a8857f4decbba8c2206e8877e1d741ee1b47 (diff) |
Merge branch 'chrome-platform-5.5-fixes' into for-kernelci
Merge dfb9a8857f4d platform/chrome: wilco_ec: Fix keyboard backlight probing
from chrome-platform-5.5-fixes into chrome-platform-5.6 destined branch.
Signed-off-by: Benson Leung <bleung@chromium.org>
Diffstat (limited to 'drivers/platform/chrome/wilco_ec')
-rw-r--r-- | drivers/platform/chrome/wilco_ec/keyboard_leds.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/platform/chrome/wilco_ec/keyboard_leds.c b/drivers/platform/chrome/wilco_ec/keyboard_leds.c index bb0edf51dfda..5731d1b60e28 100644 --- a/drivers/platform/chrome/wilco_ec/keyboard_leds.c +++ b/drivers/platform/chrome/wilco_ec/keyboard_leds.c @@ -73,13 +73,6 @@ static int send_kbbl_msg(struct wilco_ec_device *ec, return ret; } - if (response->status) { - dev_err(ec->dev, - "EC reported failure sending keyboard LEDs command: %d", - response->status); - return -EIO; - } - return 0; } @@ -87,6 +80,7 @@ static int set_kbbl(struct wilco_ec_device *ec, enum led_brightness brightness) { struct wilco_keyboard_leds_msg request; struct wilco_keyboard_leds_msg response; + int ret; memset(&request, 0, sizeof(request)); request.command = WILCO_EC_COMMAND_KBBL; @@ -94,7 +88,18 @@ static int set_kbbl(struct wilco_ec_device *ec, enum led_brightness brightness) request.mode = WILCO_KBBL_MODE_FLAG_PWM; request.percent = brightness; - return send_kbbl_msg(ec, &request, &response); + ret = send_kbbl_msg(ec, &request, &response); + if (ret < 0) + return ret; + + if (response.status) { + dev_err(ec->dev, + "EC reported failure sending keyboard LEDs command: %d", + response.status); + return -EIO; + } + + return 0; } static int kbbl_exist(struct wilco_ec_device *ec, bool *exists) @@ -140,6 +145,13 @@ static int kbbl_init(struct wilco_ec_device *ec) if (ret < 0) return ret; + if (response.status) { + dev_err(ec->dev, + "EC reported failure sending keyboard LEDs command: %d", + response.status); + return -EIO; + } + if (response.mode & WILCO_KBBL_MODE_FLAG_PWM) return response.percent; |