PWM:eCAP: Reconfigure only if frequency has changed
authorAfzal Mohammed <afzal@ti.com>
Wed, 25 Jan 2012 15:28:06 +0000 (20:58 +0530)
committerAfzal Mohammed <afzal@ti.com>
Wed, 25 Jan 2012 15:47:12 +0000 (21:17 +0530)
PWM needs to be reconfigured during cpufreq transition
only if input clock frequency has changed. Change notifier
accrodingly.

This prevents flickering during cpufreq transitions. It is
suspected that as PWM frequency is set to a low value,
reconfiguring PWM is causing flicker observable to naked
eye. Irrespective of this fact, this change removes
unnecessary reconfiguration of PWM.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
drivers/pwm/ecap.c

index 3dd6f6da62058308c3163d1557d24a63a190944b..cc2ed19fbee4531e0f2f8074dc876d8a9e00a769 100644 (file)
@@ -196,9 +196,13 @@ static int ecap_pwm_request(struct pwm_device *p)
 static int ecap_frequency_transition_cb(struct pwm_device *p)
 {
        struct ecap_pwm *ep = to_ecap_pwm(p);
-       unsigned long duty_ns;
+       unsigned long duty_ns, rate;
+
+       rate = clk_get_rate(ep->clk);
+       if (rate == p->tick_hz)
+               return 0;
+       p->tick_hz = rate;
 
-       p->tick_hz = clk_get_rate(ep->clk);
        duty_ns = p->duty_ns;
        if (pwm_is_running(p)) {
                pwm_stop(p);