On Mon, Apr 24, 2023 at 07:44:02AM +0200, Uwe Kleine-König wrote: > [ Upstream commit 8caa81eb950cb2e9d2d6959b37d853162d197f57 ] > > The driver only supports normal polarity. Complete the implementation of > .get_state() by setting .polarity accordingly. > > This fixes a regression that was possible since commit c73a3107624d > ("pwm: Handle .get_state() failures") which stopped to zero-initialize > the state passed to the .get_state() callback. This was reported at > https://forum.odroid.com/viewtopic.php?f=177&t=46360 . While this was an > unintended side effect, the real issue is the driver's callback not > setting the polarity. > > There is a complicating fact, that the .apply() callback fakes support > for inversed polarity. This is not (and cannot) be matched by > .get_state(). As fixing this isn't easy, only point it out in a comment > to prevent authors of other drivers from copying that approach. > > Fixes: c375bcbaabdb ("pwm: meson: Read the full hardware state in meson_pwm_get_state()") > Reported-by: Munehisa Kamata <kamatam@xxxxxxxxxx> > Acked-by: Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx> > Link: https://lore.kernel.org/r/20230310191405.2606296-1-u.kleine-koenig@xxxxxxxxxxxxxx > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > Signed-off-by: Thierry Reding <thierry.reding@xxxxxxxxx> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> > --- > On Sat, Apr 22, 2023 at 05:32:33PM +0200, gregkh@xxxxxxxxxxxxxxxxxxx wrote: > > @@ -304,6 +310,8 @@ static int meson_pwm_apply(struct pwm_ch > > meson_pwm_enable(meson, pwm); > > } > > > > + state->polarity = PWM_POLARITY_NORMAL; > > + > > This is the wrong function this line was added, see also > https://lore.kernel.org/stable/CA+G9fYuZdBJx8jF2STHzRZ8dw86awZ68OQen6bzgB=H+Z-tPAQ@xxxxxxxxxxxxxx > > Fixed patch below. Thanks for the fixup, now queued up, along with the other backports. greg k-h