|
19 | 19 | * Limitations:
|
20 | 20 | * - When PWM is stopped, timer counter gets stopped immediately. This
|
21 | 21 | * doesn't allow the current PWM period to complete and stops abruptly.
|
| 22 | + * - When PWM is running and changing both duty cycle and period, |
| 23 | + * we cannot prevent in software that the output might produce |
| 24 | + * a period with mixed settings. Especially when period/duty_cyle |
| 25 | + * is updated while the pwm pin is high, current pwm period/duty_cycle |
| 26 | + * can get updated as below based on the current timer counter: |
| 27 | + * - period for current cycle = current_period + new period |
| 28 | + * - duty_cycle for current period = current period + new duty_cycle. |
22 | 29 | */
|
23 | 30 |
|
24 | 31 | #include <linux/clk.h>
|
@@ -111,7 +118,6 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
|
111 | 118 | u32 load_value, match_value;
|
112 | 119 | struct clk *fclk;
|
113 | 120 | unsigned long clk_rate;
|
114 |
| - bool timer_active; |
115 | 121 |
|
116 | 122 | dev_dbg(chip->dev, "requested duty cycle: %d ns, period: %d ns\n",
|
117 | 123 | duty_ns, period_ns);
|
@@ -187,25 +193,12 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
|
187 | 193 | load_value = (DM_TIMER_MAX - period_cycles) + 1;
|
188 | 194 | match_value = load_value + duty_cycles - 1;
|
189 | 195 |
|
190 |
| - /* |
191 |
| - * We MUST stop the associated dual-mode timer before attempting to |
192 |
| - * write its registers, but calls to omap_dm_timer_start/stop must |
193 |
| - * be balanced so check if timer is active before calling timer_stop. |
194 |
| - */ |
195 |
| - timer_active = pm_runtime_active(&omap->dm_timer_pdev->dev); |
196 |
| - if (timer_active) |
197 |
| - omap->pdata->stop(omap->dm_timer); |
198 |
| - |
199 | 196 | omap->pdata->set_load(omap->dm_timer, load_value);
|
200 | 197 | omap->pdata->set_match(omap->dm_timer, true, match_value);
|
201 | 198 |
|
202 | 199 | dev_dbg(chip->dev, "load value: %#08x (%d), match value: %#08x (%d)\n",
|
203 | 200 | load_value, load_value, match_value, match_value);
|
204 | 201 |
|
205 |
| - /* If config was called while timer was running it must be reenabled. */ |
206 |
| - if (timer_active) |
207 |
| - pwm_omap_dmtimer_start(omap); |
208 |
| - |
209 | 202 | mutex_unlock(&omap->mutex);
|
210 | 203 |
|
211 | 204 | return 0;
|
|
0 commit comments