From 4a7dc909701766084690d6e1a6dc25d1627ace13 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 26 Oct 2021 16:17:28 +0000 Subject: zephyr: shim: set PWM kblight channel from the device tree This drops the PWM_CH_KBLIGHT define from the individual board pwm_map, and replaces with a single reference to a named pwm labeled kblight. BRANCH=none BUG=b:177452529 TEST=zmake testall TEST=build and run volteer Signed-off-by: Fabio Baltieri Change-Id: Ie474267b8f5d16cad7b8db2d202a5e971e417c1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3245506 Commit-Queue: Keith Short Reviewed-by: Keith Short --- zephyr/Kconfig.keyboard | 6 +++--- zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts | 2 +- zephyr/boards/arm/trogdor/trogdor.dts | 2 +- zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h | 1 - zephyr/projects/npcx_evb/npcx7/include/pwm_map.h | 2 -- zephyr/projects/npcx_evb/npcx7/pwm.dts | 2 +- zephyr/projects/npcx_evb/npcx9/include/pwm_map.h | 2 -- zephyr/projects/npcx_evb/npcx9/pwm.dts | 2 +- zephyr/projects/trogdor/lazor/include/pwm_map.h | 1 - zephyr/projects/trogdor/trogdor/include/pwm_map.h | 1 - zephyr/projects/volteer/volteer/include/pwm_map.h | 7 ------- zephyr/projects/volteer/volteer/pwm.dts | 2 +- zephyr/shim/include/config_chip.h | 1 + 13 files changed, 9 insertions(+), 22 deletions(-) diff --git a/zephyr/Kconfig.keyboard b/zephyr/Kconfig.keyboard index 9ad7fb8316..f95fa43643 100644 --- a/zephyr/Kconfig.keyboard +++ b/zephyr/Kconfig.keyboard @@ -168,9 +168,9 @@ config PLATFORM_EC_PWM_KBLIGHT 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. + connected directly to the EC chipset. The board devicetree file must + define the PWM channel used for the keyboard backlight control and + assign the "kblight" node label to it. endchoice # Keyboard backlight diff --git a/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts b/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts index 34884a8275..a3d3767063 100644 --- a/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts +++ b/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts @@ -50,7 +50,7 @@ named-pwms { compatible = "named-pwms"; - kblight { + kblight: kblight { pwms = <&pwm3 0 0>; label = "KBLIGHT"; frequency = <10000>; diff --git a/zephyr/boards/arm/trogdor/trogdor.dts b/zephyr/boards/arm/trogdor/trogdor.dts index 24fb584ae1..29381bf7ce 100644 --- a/zephyr/boards/arm/trogdor/trogdor.dts +++ b/zephyr/boards/arm/trogdor/trogdor.dts @@ -111,7 +111,7 @@ named-pwms { compatible = "named-pwms"; - kblight { + kblight: kblight { pwms = <&pwm3 0 0>; label = "KBLIGHT"; frequency = <10000>; diff --git a/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h b/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h index e704b6d6d3..a3e5c81010 100644 --- a/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h +++ b/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h @@ -10,7 +10,6 @@ #include "pwm/pwm.h" -#define PWM_CH_KBLIGHT NAMED_PWM(kblight) #define PWM_CH_DISPLIGHT NAMED_PWM(displight) #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h b/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h index 62bf822099..fa2cd1b651 100644 --- a/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h +++ b/zephyr/projects/npcx_evb/npcx7/include/pwm_map.h @@ -10,6 +10,4 @@ #include "pwm/pwm.h" -#define PWM_CH_KBLIGHT NAMED_PWM(kblight) - #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/npcx_evb/npcx7/pwm.dts b/zephyr/projects/npcx_evb/npcx7/pwm.dts index 144b4d96b9..73312f684c 100644 --- a/zephyr/projects/npcx_evb/npcx7/pwm.dts +++ b/zephyr/projects/npcx_evb/npcx7/pwm.dts @@ -12,7 +12,7 @@ label = "FAN"; frequency = <25000>; }; - kblight { + kblight: kblight { pwms = <&pwm2 0 0>; label = "KBLIGHT"; frequency = <10000>; diff --git a/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h b/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h index 62bf822099..fa2cd1b651 100644 --- a/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h +++ b/zephyr/projects/npcx_evb/npcx9/include/pwm_map.h @@ -10,6 +10,4 @@ #include "pwm/pwm.h" -#define PWM_CH_KBLIGHT NAMED_PWM(kblight) - #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/npcx_evb/npcx9/pwm.dts b/zephyr/projects/npcx_evb/npcx9/pwm.dts index 144b4d96b9..73312f684c 100644 --- a/zephyr/projects/npcx_evb/npcx9/pwm.dts +++ b/zephyr/projects/npcx_evb/npcx9/pwm.dts @@ -12,7 +12,7 @@ label = "FAN"; frequency = <25000>; }; - kblight { + kblight: kblight { pwms = <&pwm2 0 0>; label = "KBLIGHT"; frequency = <10000>; diff --git a/zephyr/projects/trogdor/lazor/include/pwm_map.h b/zephyr/projects/trogdor/lazor/include/pwm_map.h index e704b6d6d3..a3e5c81010 100644 --- a/zephyr/projects/trogdor/lazor/include/pwm_map.h +++ b/zephyr/projects/trogdor/lazor/include/pwm_map.h @@ -10,7 +10,6 @@ #include "pwm/pwm.h" -#define PWM_CH_KBLIGHT NAMED_PWM(kblight) #define PWM_CH_DISPLIGHT NAMED_PWM(displight) #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/trogdor/trogdor/include/pwm_map.h b/zephyr/projects/trogdor/trogdor/include/pwm_map.h index e704b6d6d3..a3e5c81010 100644 --- a/zephyr/projects/trogdor/trogdor/include/pwm_map.h +++ b/zephyr/projects/trogdor/trogdor/include/pwm_map.h @@ -10,7 +10,6 @@ #include "pwm/pwm.h" -#define PWM_CH_KBLIGHT NAMED_PWM(kblight) #define PWM_CH_DISPLIGHT NAMED_PWM(displight) #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/volteer/volteer/include/pwm_map.h b/zephyr/projects/volteer/volteer/include/pwm_map.h index 144a4e5710..5cf7377f52 100644 --- a/zephyr/projects/volteer/volteer/include/pwm_map.h +++ b/zephyr/projects/volteer/volteer/include/pwm_map.h @@ -12,11 +12,4 @@ #include "pwm/pwm.h" -/* - * TODO(b/177452529): eliminate the dependency on enum pwm_channel - * and configure this information directly from the device tree. - */ - -#define PWM_CH_KBLIGHT NAMED_PWM(kblight) - #endif /* __ZEPHYR_CHROME_PWM_MAP_H */ diff --git a/zephyr/projects/volteer/volteer/pwm.dts b/zephyr/projects/volteer/volteer/pwm.dts index f8a0fef7df..ec581f2caf 100644 --- a/zephyr/projects/volteer/volteer/pwm.dts +++ b/zephyr/projects/volteer/volteer/pwm.dts @@ -31,7 +31,7 @@ label = "LED4_SIDESEL"; frequency = <2400>; }; - kblight { + kblight: kblight { pwms = <&pwm3 0 0>; label = "KBLIGHT"; frequency = <2400>; diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 4672ac13f9..74821e55bf 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -544,6 +544,7 @@ #ifdef CONFIG_PLATFORM_EC_PWM_KBLIGHT #define CONFIG_PWM_KBLIGHT #define CONFIG_KEYBOARD_BACKLIGHT +#define PWM_CH_KBLIGHT PWM_CHANNEL(DT_NODELABEL(kblight)) #endif #undef CONFIG_LED_COMMON -- cgit v1.2.1