UPSTREAM: pwm: Use pwm_get/set_xxx() helpers where appropriate
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 14 Apr 2016 19:17:22 +0000 (21:17 +0200)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 9 Mar 2017 01:36:59 +0000 (09:36 +0800)
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: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 4b58896f72176b781816a9e14dcea5f755b19b5c)

Change-Id: Ic6bdaf2017bb292ef920604fba86805999cebf0c
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
drivers/pwm/pwm-crc.c
drivers/pwm/pwm-lpc18xx-sct.c
drivers/pwm/pwm-sun4i.c

index 7101c7020bf454700f06ed525adf5a6d8757298e..bd0ebd04856a8a2988162d10cbd5e0204eb4639d 100644 (file)
@@ -75,7 +75,7 @@ static int crc_pwm_config(struct pwm_chip *c, struct pwm_device *pwm,
                return -EINVAL;
        }
 
-       if (pwm->period != period_ns) {
+       if (pwm_get_period(pwm) != period_ns) {
                int clk_div;
 
                /* changing the clk divisor, need to disable fisrt */
index 9163085101bc947b4f4cb8ff2d5ae7a9b8452375..52aba84a784e8aee9797b8470c87858dcb64f68c 100644 (file)
@@ -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_ALL);
 
-       if (pwm->polarity == PWM_POLARITY_NORMAL) {
+       if (pwm_get_polarity(pwm) == PWM_POLARITY_NORMAL) {
                set_event = lpc18xx_pwm->period_event;
                clear_event = lpc18xx_data->duty_event;
                res_action = LPC18XX_PWM_RES_SET;
index 67af9f62361fdc4b712c8adafbe4e331e32af9ae..03a99a53c39e2709247ce64f21629c4ac5181b79 100644 (file)
@@ -354,7 +354,8 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
        val = sun4i_pwm_readl(pwm, PWM_CTRL_REG);
        for (i = 0; i < pwm->chip.npwm; 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);
 
        return 0;