[PATCH v4 1/2] pwm: imx27: fix race condition .apply,.get_state

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Mon Feb 26 00:44:16 PST 2024


Hello,

On Sat, Feb 24, 2024 at 12:29:00PM +0100, Leif Middelschulte wrote:
> From: Leif Middelschulte <Leif.Middelschulte at klsmartin.com>
> 
> With CONFIG_PWM_DEBUG=y after writing a value to the PWMSAR
> register in .apply(), the register is read in .get_state().
> Unless a period completed in the meantime, this read yields the
> previously used duty cycle configuration. As the PWM_DEBUG code
> applies the read out configuration for testing purposes this
> effectively undoes the intended effect by rewriting the previous
> hardware state.
> 
> Note that this change merely implements a sensible heuristic.
> The i.MX has a 4 slot FIFO to configure the duty cycle. This FIFO
> cannot be read back in its entirety. The "write x then read back
> x from hw" semantics are therefore not easily applicable.
> With this change, the .get_state() function tries to wait for some
> stabilization in the FIFO (empty state). In this state it keeps
> applying the last value written to the sample register.
> 
> Signed-off-by: Leif Middelschulte <Leif.Middelschulte at klsmartin.com>

Another few things I noticed only after replying to this patch and
trying to apply #2:

 - Please make sure you have a S-o-b line for the sender (i.e. you with
   your gmail identity).
 - My reply to your klsmartin.com address couldn't be delivered, The MS
   mailserver told: "leif.middelschulte wasn't found at klsmartin.com."
 - Please start a new thread if you send a v5, as applying patches from
   a thread containing many patches is a bit less trivial.
 - Consider using git format-patch's --base parameter to document your
   patch base.

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/20240226/d1a2fa2c/attachment.sig>


More information about the linux-arm-kernel mailing list