Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pwm: stm32: Emit debug output also for corner cases of the rounding callbacks

When you're interested in the actual register settings the driver
chooses or interprets you want to see them also for calls that hit
corner cases.

Make sure that all calls to stm32_pwm_round_waveform_tohw() and
stm32_pwm_round_waveform_fromhw() emit the debug message about the
register settings.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/fe154e79319da5ff4159cdc71201a9d3b395e491.1743844730.git.u.kleine-koenig@baylibre.com
[ukleinek: widen scope of rate in stm32_pwm_round_waveform_fromhw() to fix FTBFS]
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

authored by

Uwe Kleine-König and committed by
Uwe Kleine-König
fa829c1f 4cbeffc4

+6 -7
+6 -7
drivers/pwm/pwm-stm32.c
··· 180 180 181 181 wfhw->ccr = min_t(u64, ccr, wfhw->arr + 1); 182 182 183 + out: 183 184 dev_dbg(&chip->dev, "pwm#%u: %lld/%lld [+%lld] @%lu -> CCER: %08x, PSC: %08x, ARR: %08x, CCR: %08x\n", 184 185 pwm->hwpwm, wf->duty_length_ns, wf->period_length_ns, wf->duty_offset_ns, 185 186 rate, wfhw->ccer, wfhw->psc, wfhw->arr, wfhw->ccr); 186 187 187 - out: 188 188 clk_disable(priv->clk); 189 189 190 190 return ret; ··· 213 213 { 214 214 const struct stm32_pwm_waveform *wfhw = _wfhw; 215 215 struct stm32_pwm *priv = to_stm32_pwm_dev(chip); 216 + unsigned long rate = clk_get_rate(priv->clk); 216 217 unsigned int ch = pwm->hwpwm; 217 218 218 219 if (wfhw->ccer & TIM_CCER_CCxE(ch + 1)) { 219 - unsigned long rate = clk_get_rate(priv->clk); 220 220 u64 ccr_ns; 221 221 222 222 /* The result doesn't overflow for rate >= 15259 */ ··· 236 236 wf->duty_length_ns = ccr_ns; 237 237 wf->duty_offset_ns = 0; 238 238 } 239 - 240 - dev_dbg(&chip->dev, "pwm#%u: CCER: %08x, PSC: %08x, ARR: %08x, CCR: %08x @%lu -> %lld/%lld [+%lld]\n", 241 - pwm->hwpwm, wfhw->ccer, wfhw->psc, wfhw->arr, wfhw->ccr, rate, 242 - wf->duty_length_ns, wf->period_length_ns, wf->duty_offset_ns); 243 - 244 239 } else { 245 240 *wf = (struct pwm_waveform){ 246 241 .period_length_ns = 0, 247 242 }; 248 243 } 244 + 245 + dev_dbg(&chip->dev, "pwm#%u: CCER: %08x, PSC: %08x, ARR: %08x, CCR: %08x @%lu -> %lld/%lld [+%lld]\n", 246 + pwm->hwpwm, wfhw->ccer, wfhw->psc, wfhw->arr, wfhw->ccr, rate, 247 + wf->duty_length_ns, wf->period_length_ns, wf->duty_offset_ns); 249 248 250 249 return 0; 251 250 }