diff options
author | Wai-Hong Tam <waihong@google.com> | 2021-03-19 14:16:53 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-22 18:23:32 +0000 |
commit | 9b3facc3143c345c666a4fd59815f1883119ec8a (patch) | |
tree | 8408a7c50b2393f86b4730096d9f377811b14bcb /zephyr/projects/trogdor | |
parent | 8adc624080ac8af063e9a18b9b4273826f7aff9d (diff) | |
download | chrome-ec-9b3facc3143c345c666a4fd59815f1883119ec8a.tar.gz |
zephyr: lazor: enable PWM
Enable PWM. Lazor uses PWM 3 and 5 for keyboard backlight and
display backlight.
The display backlight can't be tested yet. The EN pin of the
LED driver IC is connected to an AND gate. One of its input is
an AP's GPIO. Since the AP power sequence is not ready yet, the
IC is disabled.
BUG=b:182398910
BRANCH=None
TEST=Tested on Lazor:
uart:~$ gpioset EN_PP5000_A 1
uart:~$ pwmduty
PWM channels:
0: disabled
1: disabled
uart:~$ pwmduty 0 50 # The keyboard backlight is on
Setting channel 0 to 50
0: 50%
uart:~$ pwmduty 0 30
Setting channel 0 to 30
0: 30%
uart:~$ pwmduty 0 100
Setting channel 0 to 100
0: 100%
uart:~$ pwmduty 0 -1
0: disabled
Change-Id: I73dca658b54fd6d4bd7668e85d60dff915faf671
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776215
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/projects/trogdor')
-rw-r--r-- | zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts | 25 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/include/pwm_map.h | 16 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/prj.conf | 5 |
3 files changed, 46 insertions, 0 deletions
diff --git a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts index 2d517762d0..1f02a06f68 100644 --- a/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts +++ b/zephyr/projects/trogdor/boards/arm/trogdor/trogdor.dts @@ -57,6 +57,21 @@ }; }; + named-pwms { + compatible = "named-pwms"; + + kblight { + pwms = <&pwm3 0 0>; + label = "KBLIGHT"; + frequency = <10000>; + }; + displight { + pwms = <&pwm5 0 0>; + label = "DISPLIGHT"; + frequency = <4800>; + }; + }; + named-adc-channels { compatible = "named-adc-channels"; @@ -135,6 +150,16 @@ clock-frequency = <I2C_BITRATE_FAST>; }; +/* Keyboard backlight */ +&pwm3 { + status = "okay"; +}; + +/* Display backlight */ +&pwm5 { + status = "okay"; +}; + &adc0 { status = "okay"; }; diff --git a/zephyr/projects/trogdor/lazor/include/pwm_map.h b/zephyr/projects/trogdor/lazor/include/pwm_map.h new file mode 100644 index 0000000000..e704b6d6d3 --- /dev/null +++ b/zephyr/projects/trogdor/lazor/include/pwm_map.h @@ -0,0 +1,16 @@ +/* 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. + */ + +#ifndef __ZEPHYR_PWM_MAP_H +#define __ZEPHYR_PWM_MAP_H + +#include <devicetree.h> + +#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/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf index 6973069d8a..a2108308e2 100644 --- a/zephyr/projects/trogdor/lazor/prj.conf +++ b/zephyr/projects/trogdor/lazor/prj.conf @@ -13,6 +13,11 @@ CONFIG_ADC=y CONFIG_ADC_SHELL=n CONFIG_I2C=y +# PWM +CONFIG_PWM=y +CONFIG_PWM_SHELL=n +CONFIG_PLATFORM_EC_PWM=y + # Application Processor is Qualcomm SC7180 CONFIG_AP_ARM_QUALCOMM_SC7180=y |