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

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Jan 17 13:43:37 PST 2023


Hello,

On Wed, Dec 14, 2022 at 04:09:08PM +0100, Olivier MOYSAN wrote:
> Hello Uwe,
> 
> On 12/13/22 11:51, Uwe Kleine-König wrote:
> > 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?
> > 
> 
> Yes, the PWM may not be in the default expected state, if the configuration
> has been changed in the bootloader. This is not an actual case today, so
> this patch can wait the next merge window and there is no
> urgency to have it in stable.

Then I'd drop the fixes line.

> > > 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?

I want to come back to this question. I only checked lightly, but I
guess the counter patch needs the same patch.

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/20230117/d52771be/attachment.sig>


More information about the linux-arm-kernel mailing list