diff options
author | Tommy Chung <tommy.chung@quanta.corp-partner.google.com> | 2022-01-24 19:36:35 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-01-29 07:02:34 +0000 |
commit | cffba6a3d33a7f0df60ed95e2bb48c016b7e9f5c (patch) | |
tree | bb4664552d7d783ec1ed6ddd4fd9f442611defc4 /board/dojo | |
parent | 635978cff9e7536a508a606a240b75f3e492da95 (diff) | |
download | chrome-ec-cffba6a3d33a7f0df60ed95e2bb48c016b7e9f5c.tar.gz |
cherry: Move PWM config to board level
BUG=none
BRANCH=cherry
TEST=make BOARD=cherry, dojo, tomato
Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Change-Id: I74918f310c472848320b93a3dac6f89860bd14af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3411515
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/dojo')
-rw-r--r-- | board/dojo/board.c | 36 | ||||
-rw-r--r-- | board/dojo/board.h | 8 |
2 files changed, 44 insertions, 0 deletions
diff --git a/board/dojo/board.c b/board/dojo/board.c index 1c7ed8b22f..4de9b9d89a 100644 --- a/board/dojo/board.c +++ b/board/dojo/board.c @@ -159,6 +159,42 @@ static void board_update_motion_sensor_config(void) } } +/* PWM */ + +/* + * PWM channels. Must be in the exactly same order as in enum pwm_channel. + * There total three 16 bits clock prescaler registers for all pwm channels, + * so use the same frequency and prescaler register setting is required if + * number of pwm channel greater than three. + */ +const struct pwm_t pwm_channels[] = { + [PWM_CH_LED1] = { + .channel = 0, + .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW, + .freq_hz = 324, /* maximum supported frequency */ + .pcfsr_sel = PWM_PRESCALER_C4, + }, + [PWM_CH_LED2] = { + .channel = 1, + .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW, + .freq_hz = 324, /* maximum supported frequency */ + .pcfsr_sel = PWM_PRESCALER_C4, + }, + [PWM_CH_LED3] = { + .channel = 2, + .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW, + .freq_hz = 324, /* maximum supported frequency */ + .pcfsr_sel = PWM_PRESCALER_C4, + }, + [PWM_CH_KBLIGHT] = { + .channel = 3, + .flags = PWM_CONFIG_DSLEEP, + .freq_hz = 10000, /* SYV226 supports 10~100kHz */ + .pcfsr_sel = PWM_PRESCALER_C6, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); + /* Initialize board. */ static void board_init(void) { diff --git a/board/dojo/board.h b/board/dojo/board.h index 50c03923bc..2104f23e28 100644 --- a/board/dojo/board.h +++ b/board/dojo/board.h @@ -100,6 +100,14 @@ enum sensor_id { SENSOR_COUNT, }; +enum pwm_channel { + PWM_CH_LED1, + PWM_CH_LED2, + PWM_CH_LED3, + PWM_CH_KBLIGHT, + PWM_CH_COUNT, +}; + int board_accel_force_mode_mask(void); #endif /* !__ASSEMBLER__ */ |