]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/pwm/pwm-rockchip.c
Merge tag 'copy-struct-from-user-v5.4-rc4' of gitolite.kernel.org:pub/scm/linux/kerne...
[linux.git] / drivers / pwm / pwm-rockchip.c
index 51b96cb7dd252cc3b2df78a1f11a9e0bc4ceb4fe..73352e6fbccbf4040f1d2b866443f4dc4d75387f 100644 (file)
@@ -90,16 +90,16 @@ static void rockchip_pwm_get_state(struct pwm_chip *chip,
                state->enabled = ((val & enable_conf) == enable_conf) ?
                                 true : false;
 
-       if (pc->data->supports_polarity) {
-               if (!(val & PWM_DUTY_POSITIVE))
-                       state->polarity = PWM_POLARITY_INVERSED;
-       }
+       if (pc->data->supports_polarity && !(val & PWM_DUTY_POSITIVE))
+               state->polarity = PWM_POLARITY_INVERSED;
+       else
+               state->polarity = PWM_POLARITY_NORMAL;
 
        clk_disable(pc->pclk);
 }
 
 static void rockchip_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
-                              struct pwm_state *state)
+                              const struct pwm_state *state)
 {
        struct rockchip_pwm_chip *pc = to_rockchip_pwm_chip(chip);
        unsigned long period, duty;
@@ -183,7 +183,7 @@ static int rockchip_pwm_enable(struct pwm_chip *chip,
 }
 
 static int rockchip_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
-                             struct pwm_state *state)
+                             const struct pwm_state *state)
 {
        struct rockchip_pwm_chip *pc = to_rockchip_pwm_chip(chip);
        struct pwm_state curstate;
@@ -212,12 +212,6 @@ static int rockchip_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
                        goto out;
        }
 
-       /*
-        * Update the state with the real hardware, which can differ a bit
-        * because of period/duty_cycle approximation.
-        */
-       rockchip_pwm_get_state(chip, pwm, state);
-
 out:
        clk_disable(pc->pclk);