summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-01-18 14:47:52 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-01 19:26:59 +0000
commit194b5d989ae7545107c4fb664e58c17027facd68 (patch)
tree8f1dc59e06aca13b84faca7a7abaf2daf57584ae
parenteedba51b085748157b3f47ce2e0a80aedfb88a5d (diff)
downloadchrome-ec-194b5d989ae7545107c4fb664e58c17027facd68.tar.gz
zephyr: Add keyboard backlight support
Add KConfig options for keyboard backlight support. BUG=b:17760430, b:177851031 BRANCH=none TEST=make buildall, zmake testall TEST=Run "kblight" command on Volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I7da36a7a685285562152e560f3dbe5da1b1ba04f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2636483 Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--zephyr/CMakeLists.txt3
-rw-r--r--zephyr/Kconfig.keyboard24
-rw-r--r--zephyr/shim/include/config_chip.h7
3 files changed, 34 insertions, 0 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index edcfd769b4..20b7c68bbc 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -126,6 +126,9 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042
"${PLATFORM_EC}/common/keyboard_8042.c"
"${PLATFORM_EC}/common/keyboard_8042_sharedlib.c")
+zephyr_sources_ifdef(CONFIG_PLATFORM_EC_PWM_KBLIGHT
+ "${PLATFORM_EC}/common/keyboard_backlight.c"
+ "${PLATFORM_EC}/common/pwm_kblight.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
"${PLATFORM_EC}/common/led_common.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_LED_PWM "${PLATFORM_EC}/common/led_pwm.c")
diff --git a/zephyr/Kconfig.keyboard b/zephyr/Kconfig.keyboard
index 5c4b161148..5faab1f444 100644
--- a/zephyr/Kconfig.keyboard
+++ b/zephyr/Kconfig.keyboard
@@ -63,4 +63,28 @@ config PLATFORM_EC_CONSOLE_CMD_KEYBOARD_8042
kblog - Print or toggle keyboard event log (current disabled)
typematic - Get/set typematic delays
+choice
+ prompt "Keyboard backlight"
+ optional
+ help
+ Enable support for EC control of a keyboard backlight. This enables
+ the "kblight" console command for manual control of the keyboard
+ backlight. This also enables the EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT and
+ EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT host commands for automatic control
+ by the AP.
+
+ TODO: support CONFIG_IO_EXPANDER_IT8801 driver which provides
+ PWM keyboard support.
+
+config PLATFORM_EC_PWM_KBLIGHT
+ bool "PWM keyboard backlight"
+ depends on PLATFORM_EC_PWM
+ help
+ Enables a PWM-controlled keyboard backlight controlled by a PWM signal
+ connected directly to the EC chipset. The board files must define
+ the C reference PWM_CH_KBLIGHT to the PWM channel used for the
+ keyboard backlight control.
+
+endchoice # Keyboard backlight
+
endif # PLATFORM_EC_KEYBOARD
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 168aeb87ee..bf03614453 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -220,6 +220,13 @@ enum battery_type {
#define CONFIG_KEYBOARD_COL2_INVERTED
#endif /* CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED */
+#undef CONFIG_PWM_KBLIGHT
+#undef CONFIG_KEYBOARD_BACKLIGHT
+#ifdef CONFIG_PLATFORM_EC_PWM_KBLIGHT
+#define CONFIG_PWM_KBLIGHT
+#define CONFIG_KEYBOARD_BACKLIGHT
+#endif
+
#undef CONFIG_LED_COMMON
#ifdef CONFIG_PLATFORM_EC_LED_COMMON
#define CONFIG_LED_COMMON