[PATCH] pwm: stm32: enforce settings for pwm capture

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Dec 13 02:51:28 PST 2022


Hello Olivier,

[Cc: += William Breathitt Gray, linux-iio at v.k.o]

On Tue, Dec 13, 2022 at 11:27:07AM +0100, Olivier Moysan wrote:
> The PWM capture assumes that the input selector is set to default
> input and that the slave mode is disabled. Force reset state for
> TISEL and SMCR registers to match this requirement.

When does the problem occur? Only if the bootloader changed that
setting? Regarding the urgency: With the current knowledge I'd say this
patch is material for the next merge window. Do you recommend
backporting to stable?

> Note that slave mode disabling is not a pre-requisite by itself
> for capture mode, as hardware supports it for PWM capture.
> However, the current implementation of the driver does not
> allow slave mode for PWM capture. Setting slave mode for PWM
> capture results in wrong capture values.

What is your usecase for PWM capture support? I didn't double check, but
I think you're the first contributor to PWM capture since 2018 (i.e. the
commit you're fixing).

Did you check if the counter subsystem would solve your problems? If it
doesn't I assume William would like to hear about that.

Looking at drivers/counter/stm32-timer-cnt.c it does seem to work in
slave mode, TISEL isn't touched though. So maybe this driver needs a
similar fix?

Apart from that the change looks reasonable:

Acked-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20221213/0873ca84/attachment.sig>


More information about the linux-arm-kernel mailing list