Skip to content

Commit 5bb3bf2

Browse files
committed
Merge tag 'tag-chrome-platform-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
Pull chrome platform updates from Tzung-Bi Shih: "cros_ec_proto: - Leverage Kunit and add Kunit test cases - Clean-ups - Fix typo cros_ec_commands: - Fix typo - Fix compile errors cros_kbd_led_backlight: - Support OF match - Support EC PWM backend cros_ec: - Always expose the last resume result to fix sleep hang detection on ARM-based chromebooks wilco_ec: - Fix typo cros_ec_typec: - Clean-ups - Use Type-C framework utilities to manage altmode structs" * tag 'tag-chrome-platform-for-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (59 commits) platform/chrome: cros_kunit_util: add default value for `msg->result` platform/chrome: merge Kunit utils and test cases platform/chrome: cros_kbd_led_backlight: fix build warning platform/chrome: cros_ec_proto: add Kunit test for cros_ec_cmd() platform/chrome: cros_ec_proto: add Kunit tests for get_sensor_count platform/chrome: cros_ec_proto: add Kunit tests for check_features platform/chrome: cros_ec_proto: add Kunit tests for get_host_event platform/chrome: cros_ec_proto: add Kunit tests for get_next_event platform/chrome: cros_ec_proto: add Kunit test for cros_ec_map_error() platform/chrome: cros_ec_proto: add Kunit tests for cmd_xfer_status platform/chrome: cros_ec_proto: return -EPROTO if empty payload platform/chrome: cros_ec_proto: add Kunit test for empty payload platform/chrome: cros_ec_proto: return -EAGAIN when retries timed out platform/chrome: cros_ec_proto: change Kunit expectation when timed out platform/chrome: cros_ec_proto: separate cros_ec_wait_until_complete() platform/chrome: cros_ec_proto: separate cros_ec_xfer_command() platform/chrome: cros_ec_proto: add Kunit tests for cros_ec_send_command() platform/chrome: cros_ec_proto: add Kunit tests for cros_ec_cmd_xfer() platform/chrome: cros_ec_proto: add "cros_ec_" prefix to send_command() platform/chrome: cros_ec_typec: Register port altmodes ...
2 parents da8d07a + afef1e1 commit 5bb3bf2

File tree

18 files changed

+3490
-335
lines changed

18 files changed

+3490
-335
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/chrome/google,cros-kbd-led-backlight.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: ChromeOS keyboard backlight LED driver.
8+
9+
maintainers:
10+
- Tzung-Bi Shih <[email protected]>
11+
12+
properties:
13+
compatible:
14+
const: google,cros-kbd-led-backlight
15+
16+
required:
17+
- compatible
18+
19+
additionalProperties: false
20+
21+
examples:
22+
- |
23+
spi0 {
24+
#address-cells = <1>;
25+
#size-cells = <0>;
26+
27+
cros_ec: ec@0 {
28+
compatible = "google,cros-ec-spi";
29+
reg = <0>;
30+
31+
kbd-led-backlight {
32+
compatible = "google,cros-kbd-led-backlight";
33+
};
34+
};
35+
};

Documentation/devicetree/bindings/mfd/google,cros-ec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ properties:
9090
pwm:
9191
$ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
9292

93+
kbd-led-backlight:
94+
$ref: "/schemas/chrome/google,cros-kbd-led-backlight.yaml#"
95+
9396
keyboard-controller:
9497
$ref: "/schemas/input/google,cros-ec-keyb.yaml#"
9598

drivers/mfd/cros_ec_dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ static int ec_device_probe(struct platform_device *pdev)
250250
* The PCHG device cannot be detected by sending EC_FEATURE_GET_CMD, but
251251
* it can be detected by querying the number of peripheral chargers.
252252
*/
253-
retval = cros_ec_command(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0,
254-
&pchg_count, sizeof(pchg_count));
253+
retval = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_PCHG_COUNT, NULL, 0,
254+
&pchg_count, sizeof(pchg_count));
255255
if (retval >= 0 && pchg_count.port_count) {
256256
retval = mfd_add_hotplug_devices(ec->dev,
257257
cros_ec_pchg_cells,

drivers/platform/chrome/Kconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ config CROS_EC_PROTO
139139

140140
config CROS_KBD_LED_BACKLIGHT
141141
tristate "Backlight LED support for Chrome OS keyboards"
142-
depends on LEDS_CLASS && ACPI
142+
depends on LEDS_CLASS && (ACPI || CROS_EC)
143143
help
144144
This option enables support for the keyboard backlight LEDs on
145145
select Chrome OS systems.
@@ -267,4 +267,13 @@ config CHROMEOS_PRIVACY_SCREEN
267267

268268
source "drivers/platform/chrome/wilco_ec/Kconfig"
269269

270+
# Kunit test cases
271+
config CROS_KUNIT
272+
tristate "Kunit tests for ChromeOS" if !KUNIT_ALL_TESTS
273+
depends on KUNIT && CROS_EC
274+
default KUNIT_ALL_TESTS
275+
select CROS_EC_PROTO
276+
help
277+
ChromeOS Kunit tests.
278+
270279
endif # CHROMEOS_PLATFORMS

drivers/platform/chrome/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ obj-$(CONFIG_CROS_USBPD_LOGGER) += cros_usbpd_logger.o
3030
obj-$(CONFIG_CROS_USBPD_NOTIFY) += cros_usbpd_notify.o
3131

3232
obj-$(CONFIG_WILCO_EC) += wilco_ec/
33+
34+
# Kunit test cases
35+
obj-$(CONFIG_CROS_KUNIT) += cros_kunit.o
36+
cros_kunit-objs := cros_kunit_util.o
37+
cros_kunit-objs += cros_ec_proto_test.o

drivers/platform/chrome/cros_ec.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
#include "cros_ec.h"
2121

22-
#define CROS_EC_DEV_EC_INDEX 0
23-
#define CROS_EC_DEV_PD_INDEX 1
24-
2522
static struct cros_ec_platform ec_p = {
2623
.ec_name = CROS_EC_DEV_NAME,
2724
.cmd_offset = EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_EC_INDEX),
@@ -135,16 +132,16 @@ static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
135132
buf.msg.command = EC_CMD_HOST_SLEEP_EVENT;
136133

137134
ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg);
138-
139-
/* For now, report failure to transition to S0ix with a warning. */
135+
/* Report failure to transition to system wide suspend with a warning. */
140136
if (ret >= 0 && ec_dev->host_sleep_v1 &&
141-
(sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME)) {
137+
(sleep_event == HOST_SLEEP_EVENT_S0IX_RESUME ||
138+
sleep_event == HOST_SLEEP_EVENT_S3_RESUME)) {
142139
ec_dev->last_resume_result =
143140
buf.u.resp1.resume_response.sleep_transitions;
144141

145142
WARN_ONCE(buf.u.resp1.resume_response.sleep_transitions &
146143
EC_HOST_RESUME_SLEEP_TIMEOUT,
147-
"EC detected sleep transition timeout. Total slp_s0 transitions: %d",
144+
"EC detected sleep transition timeout. Total sleep transitions: %d",
148145
buf.u.resp1.resume_response.sleep_transitions &
149146
EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK);
150147
}

0 commit comments

Comments
 (0)