summaryrefslogtreecommitdiff
path: root/zephyr/projects
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2021-09-10 14:39:16 +0000
committerCommit Bot <commit-bot@chromium.org>2021-09-10 22:35:05 +0000
commit2c0c44bed1d4b866cd33abc6ed29ac6241b32476 (patch)
treed0fc27a7bc01156f959a5f24e6906d153cddf912 /zephyr/projects
parent8b37b17df0b8946763b1da984c64c51418a6b381 (diff)
downloadchrome-ec-2c0c44bed1d4b866cd33abc6ed29ac6241b32476.tar.gz
zephyr: shim: set pwm_led data from device tree
Set up the pwm_leds data from the device tree, gets rid of most static map defines and sets CONFIG_LED_PWM_COUNT automatically. BRANCH=none BUG=b:177452529 TEST=build and run on volteer TEST=compared the built up pwm_leds structure with gdb Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib41faf86ae018f5a1ed8a1c96c4b6ec081e175d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3154256 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
Diffstat (limited to 'zephyr/projects')
-rw-r--r--zephyr/projects/volteer/volteer/include/pwm_map.h3
-rw-r--r--zephyr/projects/volteer/volteer/pwm.dts12
-rw-r--r--zephyr/projects/volteer/volteer/pwm_leds.dts23
-rw-r--r--zephyr/projects/volteer/volteer/zmake.yaml1
4 files changed, 32 insertions, 7 deletions
diff --git a/zephyr/projects/volteer/volteer/include/pwm_map.h b/zephyr/projects/volteer/volteer/include/pwm_map.h
index 2616bad589..67ab70936f 100644
--- a/zephyr/projects/volteer/volteer/include/pwm_map.h
+++ b/zephyr/projects/volteer/volteer/include/pwm_map.h
@@ -16,9 +16,6 @@
* TODO(b/177452529): eliminate the dependency on enum pwm_channel
* and configure this information directly from the device tree.
*/
-#define PWM_CH_LED1_BLUE NAMED_PWM(led1_blue)
-#define PWM_CH_LED2_GREEN NAMED_PWM(led2_green)
-#define PWM_CH_LED3_RED NAMED_PWM(led3_red)
#define PWM_CH_LED4_SIDESEL NAMED_PWM(led3_sidesel)
#define PWM_CH_KBLIGHT NAMED_PWM(kblight)
diff --git a/zephyr/projects/volteer/volteer/pwm.dts b/zephyr/projects/volteer/volteer/pwm.dts
index f8a24840cd..f8a0fef7df 100644
--- a/zephyr/projects/volteer/volteer/pwm.dts
+++ b/zephyr/projects/volteer/volteer/pwm.dts
@@ -7,22 +7,26 @@
named-pwms {
compatible = "named-pwms";
- led1_blue {
+ led1_blue: led1_blue {
+ #pwm-cells = <0>;
pwms = <&pwm2 0 PWM_POLARITY_INVERTED>;
label = "LED1_BLUE";
frequency = <4800>;
};
- led2_green {
+ led2_green: led2_green {
+ #pwm-cells = <0>;
pwms = <&pwm0 0 PWM_POLARITY_INVERTED>;
label = "LED2_GREEN";
frequency = <4800>;
};
- led3_red {
+ led3_red: led3_red {
+ #pwm-cells = <0>;
pwms = <&pwm1 0 PWM_POLARITY_INVERTED>;
label = "LED3_RED";
frequency = <4800>;
};
- led3_sidesel {
+ led3_sidesel: led3_sidesel {
+ #pwm-cells = <0>;
pwms = <&pwm7 0 PWM_POLARITY_INVERTED>;
label = "LED4_SIDESEL";
frequency = <2400>;
diff --git a/zephyr/projects/volteer/volteer/pwm_leds.dts b/zephyr/projects/volteer/volteer/pwm_leds.dts
new file mode 100644
index 0000000000..c89c3f2ef8
--- /dev/null
+++ b/zephyr/projects/volteer/volteer/pwm_leds.dts
@@ -0,0 +1,23 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ pwmleds {
+ compatible = "pwm-leds";
+ pwm_led0: pwm_led_0 {
+ pwms = <&led3_red
+ &led2_green
+ &led1_blue
+ &led3_sidesel
+ >;
+ };
+ };
+
+ cros-pwmleds {
+ compatible = "cros-ec,pwm-leds";
+
+ leds = <&pwm_led0>;
+ };
+};
diff --git a/zephyr/projects/volteer/volteer/zmake.yaml b/zephyr/projects/volteer/volteer/zmake.yaml
index 3f291ce671..a89c0287af 100644
--- a/zephyr/projects/volteer/volteer/zmake.yaml
+++ b/zephyr/projects/volteer/volteer/zmake.yaml
@@ -11,6 +11,7 @@ dts-overlays:
- keyboard.dts
- motionsense.dts
- pwm.dts
+ - pwm_leds.dts
supported-toolchains:
- coreboot-sdk
- zephyr