From da8a1e7d22f99698581c32ea08a6c3d0ffab6c57 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 26 Oct 2021 16:40:54 +0000 Subject: zephyr: shim: set PWM displight channel from the device tree This drops the PWM_CH_DISPLIGHT define from the individual board pwm_map, and replaces with a single reference to a named pwm labeled displight. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Fabio Baltieri Change-Id: I17ca620097a4b0fd6907672e340415d1963740a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3245507 Commit-Queue: Keith Short Reviewed-by: Denis Brockus Reviewed-by: Keith Short --- zephyr/Kconfig | 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 | 2 -- zephyr/projects/trogdor/lazor/include/pwm_map.h | 2 -- zephyr/projects/trogdor/trogdor/include/pwm_map.h | 2 -- zephyr/shim/include/config_chip.h | 1 + 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 07f09ae46e..8647c1bfac 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -630,9 +630,9 @@ config PLATFORM_EC_PWM_DISPLIGHT depends on PLATFORM_EC_PWM help Enables display backlight controlled by a PWM signal connected - directly to the EC chipset. The board files must define the C - reference PWM_CH_DISPLIGHT to the PWM channel used for the - display backlight control. + directly to the EC chipset. The board devicetree file must define the + PWM channel used for the display backlight control and assign the + "displight" node label to it. config PLATFORM_EC_RTC bool "Real-time clock (RTC)" diff --git a/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts b/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts index a3d3767063..cdf998c13f 100644 --- a/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts +++ b/zephyr/boards/arm/herobrine_npcx9/herobrine_npcx9.dts @@ -55,7 +55,7 @@ label = "KBLIGHT"; frequency = <10000>; }; - displight { + displight: displight { pwms = <&pwm5 0 0>; label = "DISPLIGHT"; frequency = <4800>; diff --git a/zephyr/boards/arm/trogdor/trogdor.dts b/zephyr/boards/arm/trogdor/trogdor.dts index 29381bf7ce..a13861ad09 100644 --- a/zephyr/boards/arm/trogdor/trogdor.dts +++ b/zephyr/boards/arm/trogdor/trogdor.dts @@ -116,7 +116,7 @@ label = "KBLIGHT"; frequency = <10000>; }; - displight { + displight: displight { pwms = <&pwm5 0 0>; label = "DISPLIGHT"; frequency = <4800>; diff --git a/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h b/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h index a3e5c81010..fa2cd1b651 100644 --- a/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h +++ b/zephyr/projects/herobrine/herobrine_npcx9/include/pwm_map.h @@ -10,6 +10,4 @@ #include "pwm/pwm.h" -#define PWM_CH_DISPLIGHT NAMED_PWM(displight) - #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/projects/trogdor/lazor/include/pwm_map.h b/zephyr/projects/trogdor/lazor/include/pwm_map.h index a3e5c81010..fa2cd1b651 100644 --- a/zephyr/projects/trogdor/lazor/include/pwm_map.h +++ b/zephyr/projects/trogdor/lazor/include/pwm_map.h @@ -10,6 +10,4 @@ #include "pwm/pwm.h" -#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 a3e5c81010..fa2cd1b651 100644 --- a/zephyr/projects/trogdor/trogdor/include/pwm_map.h +++ b/zephyr/projects/trogdor/trogdor/include/pwm_map.h @@ -10,6 +10,4 @@ #include "pwm/pwm.h" -#define PWM_CH_DISPLIGHT NAMED_PWM(displight) - #endif /* __ZEPHYR_PWM_MAP_H */ diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index 74821e55bf..279b255712 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -581,6 +581,7 @@ #undef CONFIG_PWM_DISPLIGHT #ifdef CONFIG_PLATFORM_EC_PWM_DISPLIGHT #define CONFIG_PWM_DISPLIGHT +#define PWM_CH_DISPLIGHT PWM_CHANNEL(DT_NODELABEL(displight)) #endif #undef CONFIG_CPU_PROCHOT_ACTIVE_LOW -- cgit v1.2.1