Commit 4b58896f authored by Boris Brezillon's avatar Boris Brezillon Committed by Thierry Reding

pwm: Use pwm_get/set_xxx() helpers where appropriate

Use pwm_get/set_xxx() helpers instead of directly accessing the pwm->xxx
field. Doing that will ease adaptation of the PWM framework to support
atomic update.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 459a25af
...@@ -75,7 +75,7 @@ static int crc_pwm_config(struct pwm_chip *c, struct pwm_device *pwm, ...@@ -75,7 +75,7 @@ static int crc_pwm_config(struct pwm_chip *c, struct pwm_device *pwm,
return -EINVAL; return -EINVAL;
} }
if (pwm->period != period_ns) { if (pwm_get_period(pwm) != period_ns) {
int clk_div; int clk_div;
/* changing the clk divisor, need to disable fisrt */ /* changing the clk divisor, need to disable fisrt */
......
...@@ -249,7 +249,7 @@ static int lpc18xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -249,7 +249,7 @@ static int lpc18xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
LPC18XX_PWM_EVSTATEMSK(lpc18xx_data->duty_event), LPC18XX_PWM_EVSTATEMSK(lpc18xx_data->duty_event),
LPC18XX_PWM_EVSTATEMSK_ALL); LPC18XX_PWM_EVSTATEMSK_ALL);
if (pwm->polarity == PWM_POLARITY_NORMAL) { if (pwm_get_polarity(pwm) == PWM_POLARITY_NORMAL) {
set_event = lpc18xx_pwm->period_event; set_event = lpc18xx_pwm->period_event;
clear_event = lpc18xx_data->duty_event; clear_event = lpc18xx_data->duty_event;
res_action = LPC18XX_PWM_RES_SET; res_action = LPC18XX_PWM_RES_SET;
......
...@@ -192,7 +192,7 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, ...@@ -192,7 +192,7 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
load_value, load_value, match_value, match_value); load_value, load_value, match_value, match_value);
omap->pdata->set_pwm(omap->dm_timer, omap->pdata->set_pwm(omap->dm_timer,
pwm->polarity == PWM_POLARITY_INVERSED, pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED,
true, true,
PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE); PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE);
......
...@@ -354,7 +354,8 @@ static int sun4i_pwm_probe(struct platform_device *pdev) ...@@ -354,7 +354,8 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
val = sun4i_pwm_readl(pwm, PWM_CTRL_REG); val = sun4i_pwm_readl(pwm, PWM_CTRL_REG);
for (i = 0; i < pwm->chip.npwm; i++) for (i = 0; i < pwm->chip.npwm; i++)
if (!(val & BIT_CH(PWM_ACT_STATE, i))) if (!(val & BIT_CH(PWM_ACT_STATE, i)))
pwm->chip.pwms[i].polarity = PWM_POLARITY_INVERSED; pwm_set_polarity(&pwm->chip.pwms[i],
PWM_POLARITY_INVERSED);
clk_disable_unprepare(pwm->clk); clk_disable_unprepare(pwm->clk);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment