Skip to content

Commit 31546c5

Browse files
Damon Dingrkhuangtao
authored andcommitted
pwm: rockchip: simplify to one wave_table configuration instead of duty_table and period_table
For wave mode, the duty and period share memory to update, so it is sufficient to config &rockchip_pwm_wave_config.wave_table and set &rockchip_pwm_wave_config.duty_*/&rockchip_pwm_wave_config.period_* for the update of duty and period. Change-Id: Ide133377991a9a6c2c26c4de4cb91040f6a7eadd Signed-off-by: Damon Ding <[email protected]>
1 parent 46e513f commit 31546c5

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

drivers/pwm/pwm-rockchip.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,18 +1676,8 @@ int rockchip_pwm_set_wave(struct pwm_device *pwm, struct rockchip_pwm_wave_confi
16761676
}
16771677
}
16781678

1679-
if (config->duty_table) {
1680-
ret = pc->data->funcs.set_wave_table(chip, pwm, config->duty_table,
1681-
config->width_mode);
1682-
if (ret) {
1683-
dev_err(chip->dev, "Failed to set wave duty table for PWM%d\n",
1684-
pc->channel_id);
1685-
goto err_disable_clk_osc;
1686-
}
1687-
}
1688-
1689-
if (config->period_table) {
1690-
ret = pc->data->funcs.set_wave_table(chip, pwm, config->period_table,
1679+
if (config->wave_table) {
1680+
ret = pc->data->funcs.set_wave_table(chip, pwm, config->wave_table,
16911681
config->width_mode);
16921682
if (ret) {
16931683
dev_err(chip->dev, "Failed to set wave period table for PWM%d\n",

include/linux/pwm-rockchip.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ enum rockchip_pwm_wave_update_mode {
9999

100100
/**
101101
* struct rockchip_pwm_wave_config - wave generator config object
102-
* @duty_table: the wave table config of duty
103-
* @period_table: the wave table config of period
102+
* @wave_table: the wave table config
104103
* @clk_src: the clk src selection in wave generator mode
105104
* @mem_clk_src: the memory clk src selection in wave generator mode
106105
* @width_mode: the width mode of wave table
@@ -121,8 +120,7 @@ enum rockchip_pwm_wave_update_mode {
121120
* @middle_hold: the time to stop at middle address
122121
*/
123122
struct rockchip_pwm_wave_config {
124-
struct rockchip_pwm_wave_table *duty_table;
125-
struct rockchip_pwm_wave_table *period_table;
123+
struct rockchip_pwm_wave_table *wave_table;
126124
enum rockchip_pwm_clk_src_sel clk_src;
127125
enum rockchip_pwm_clk_src_sel mem_clk_src;
128126
enum rockchip_pwm_wave_table_width_mode width_mode;

0 commit comments

Comments
 (0)