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 <damon.ding@rock-chips.com>
This commit is contained in:
Damon Ding
2025-04-27 16:51:25 +08:00
committed by Tao Huang
parent 46e513f605
commit 31546c56cb
2 changed files with 4 additions and 16 deletions

View File

@@ -1676,18 +1676,8 @@ int rockchip_pwm_set_wave(struct pwm_device *pwm, struct rockchip_pwm_wave_confi
}
}
if (config->duty_table) {
ret = pc->data->funcs.set_wave_table(chip, pwm, config->duty_table,
config->width_mode);
if (ret) {
dev_err(chip->dev, "Failed to set wave duty table for PWM%d\n",
pc->channel_id);
goto err_disable_clk_osc;
}
}
if (config->period_table) {
ret = pc->data->funcs.set_wave_table(chip, pwm, config->period_table,
if (config->wave_table) {
ret = pc->data->funcs.set_wave_table(chip, pwm, config->wave_table,
config->width_mode);
if (ret) {
dev_err(chip->dev, "Failed to set wave period table for PWM%d\n",

View File

@@ -99,8 +99,7 @@ enum rockchip_pwm_wave_update_mode {
/**
* struct rockchip_pwm_wave_config - wave generator config object
* @duty_table: the wave table config of duty
* @period_table: the wave table config of period
* @wave_table: the wave table config
* @clk_src: the clk src selection in wave generator mode
* @mem_clk_src: the memory clk src selection in wave generator mode
* @width_mode: the width mode of wave table
@@ -121,8 +120,7 @@ enum rockchip_pwm_wave_update_mode {
* @middle_hold: the time to stop at middle address
*/
struct rockchip_pwm_wave_config {
struct rockchip_pwm_wave_table *duty_table;
struct rockchip_pwm_wave_table *period_table;
struct rockchip_pwm_wave_table *wave_table;
enum rockchip_pwm_clk_src_sel clk_src;
enum rockchip_pwm_clk_src_sel mem_clk_src;
enum rockchip_pwm_wave_table_width_mode width_mode;