Skip to content

Commit 3b0bfd3

Browse files
Merge branch 'chrome-platform-5.5-fixes' into for-kernelci
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>
2 parents ffd7263 + dfb9a88 commit 3b0bfd3

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

‎drivers/platform/chrome/wilco_ec/keyboard_leds.c‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,33 @@ static int send_kbbl_msg(struct wilco_ec_device *ec,
7373
return ret;
7474
}
7575

76-
if (response->status) {
77-
dev_err(ec->dev,
78-
"EC reported failure sending keyboard LEDs command: %d",
79-
response->status);
80-
return -EIO;
81-
}
82-
8376
return 0;
8477
}
8578

8679
static int set_kbbl(struct wilco_ec_device *ec, enum led_brightness brightness)
8780
{
8881
struct wilco_keyboard_leds_msg request;
8982
struct wilco_keyboard_leds_msg response;
83+
int ret;
9084

9185
memset(&request, 0, sizeof(request));
9286
request.command = WILCO_EC_COMMAND_KBBL;
9387
request.subcmd = WILCO_KBBL_SUBCMD_SET_STATE;
9488
request.mode = WILCO_KBBL_MODE_FLAG_PWM;
9589
request.percent = brightness;
9690

97-
return send_kbbl_msg(ec, &request, &response);
91+
ret = send_kbbl_msg(ec, &request, &response);
92+
if (ret < 0)
93+
return ret;
94+
95+
if (response.status) {
96+
dev_err(ec->dev,
97+
"EC reported failure sending keyboard LEDs command: %d",
98+
response.status);
99+
return -EIO;
100+
}
101+
102+
return 0;
98103
}
99104

100105
static int kbbl_exist(struct wilco_ec_device *ec, bool *exists)
@@ -140,6 +145,13 @@ static int kbbl_init(struct wilco_ec_device *ec)
140145
if (ret < 0)
141146
return ret;
142147

148+
if (response.status) {
149+
dev_err(ec->dev,
150+
"EC reported failure sending keyboard LEDs command: %d",
151+
response.status);
152+
return -EIO;
153+
}
154+
143155
if (response.mode & WILCO_KBBL_MODE_FLAG_PWM)
144156
return response.percent;
145157

0 commit comments

Comments
 (0)