Message ID | 20190830182830.81627-1-andriy.shevchenko@linux.intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [v2] pwm: pca9685: Fix regression for GPIO use | expand |
On Fri, Aug 30, 2019 at 09:28:30PM +0300, Andy Shevchenko wrote: > The commit e926b12c611c ("pwm: Clear chip_data in pwm_put()") breaks GPIO usage > by actually removing a crucial call to pwm_set_chip_data(), which is being used > as a flag to understand the mode (GPIO vs. PWM) in which pin is currently > working. Now, if once I requested GPIO, I may not be able to free and request > it again. There was another patch from Sven (cc'd) fixing the same issue here: https://lore.kernel.org/patchwork/patch/1084046/ But I don't think it was ever merged anywhere. Maybe you can try it out and give your tested-by? > Fixes: e926b12c611c ("pwm: Clear chip_data in pwm_put()") > Cc: Mika Westerberg <mika.westerberg@linux.intel.com> > Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > v2: drop leftovers in Fixes tag > drivers/pwm/pwm-pca9685.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c > index 168684b02ebc..7cdec56ab3ec 100644 > --- a/drivers/pwm/pwm-pca9685.c > +++ b/drivers/pwm/pwm-pca9685.c > @@ -165,6 +165,7 @@ static void pca9685_pwm_gpio_free(struct gpio_chip *gpio, unsigned int offset) > pm_runtime_put(pca->chip.dev); > mutex_lock(&pca->lock); > pwm = &pca->chip.pwms[offset]; > + pwm_set_chip_data(pwm, NULL); > mutex_unlock(&pca->lock); > } > > -- > 2.23.0.rc1
Hi Andy, On Fri, Sep 13, 2019 at 8:59 AM Mika Westerberg <mika.westerberg@linux.intel.com> wrote: > > There was another patch from Sven (cc'd) fixing the same issue here: > https://lore.kernel.org/patchwork/patch/1084046/ > > But I don't think it was ever merged anywhere. Maybe you can try it out > and give your tested-by? When the issue came up, Mika and I considered restoring the old synchronization. But we suspect that the old synchronization is broken, or has become broken over time. See: https://lkml.org/lkml/2019/6/2/73 The patch above was reviewed by Mika, but could not be merged - there was no-one available to test it out on actual h/w. I did however successfully test the logic. I disconnected the driver from its h/w by giving it a dummy regmap. See: https://lkml.org/lkml/2019/6/6/666 I am of course open to alternative solutions. Sven
diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c index 168684b02ebc..7cdec56ab3ec 100644 --- a/drivers/pwm/pwm-pca9685.c +++ b/drivers/pwm/pwm-pca9685.c @@ -165,6 +165,7 @@ static void pca9685_pwm_gpio_free(struct gpio_chip *gpio, unsigned int offset) pm_runtime_put(pca->chip.dev); mutex_lock(&pca->lock); pwm = &pca->chip.pwms[offset]; + pwm_set_chip_data(pwm, NULL); mutex_unlock(&pca->lock); }
The commit e926b12c611c ("pwm: Clear chip_data in pwm_put()") breaks GPIO usage by actually removing a crucial call to pwm_set_chip_data(), which is being used as a flag to understand the mode (GPIO vs. PWM) in which pin is currently working. Now, if once I requested GPIO, I may not be able to free and request it again. Fixes: e926b12c611c ("pwm: Clear chip_data in pwm_put()") Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- v2: drop leftovers in Fixes tag drivers/pwm/pwm-pca9685.c | 1 + 1 file changed, 1 insertion(+)