Skip to content

Commit

Permalink
Merge branch 'chrome-platform-5.5-fixes' into for-kernelci
Browse files Browse the repository at this point in the history
Merge dfb9a88 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>
  • Loading branch information
Benson Leung committed Jan 10, 2020
2 parents ffd7263 + dfb9a88 commit 3b0bfd3
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions drivers/platform/chrome/wilco_ec/keyboard_leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,33 @@ 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;
}

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;
request.subcmd = WILCO_KBBL_SUBCMD_SET_STATE;
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)
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3b0bfd3

Please sign in to comment.