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

Olivier MOYSAN olivier.moysan at foss.st.com
Wed Dec 14 07:09:08 PST 2022


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.

BRs
Olivier

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



More information about the linux-arm-kernel mailing list