Message ID | 20230902210621.1184693-1-cristian.ciocaltea@collabora.com |
---|---|
Headers | show |
Series | Improve CS35l41 ALSA SoC audio driver | expand |
On Sun, Sep 03, 2023 at 12:06:13AM +0300, Cristian Ciocaltea wrote: > The return code of regmap_multi_reg_write() call related to "MDSYNC > down" sequence is shadowed by the subsequent > wait_for_completion_timeout() invocation, which is expected to time > timeout in case the write operation failed. > > Let cs35l41_global_enable() return the correct error code instead of > -ETIMEDOUT. > > Fixes: f5030564938b ("ALSA: cs35l41: Add shared boost feature") > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- > sound/soc/codecs/cs35l41-lib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c > index 4ec306cd2f47..a018f1d98428 100644 > --- a/sound/soc/codecs/cs35l41-lib.c > +++ b/sound/soc/codecs/cs35l41-lib.c > @@ -1243,7 +1243,7 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4 > cs35l41_mdsync_down_seq[2].def = pwr_ctrl1; > ret = regmap_multi_reg_write(regmap, cs35l41_mdsync_down_seq, > ARRAY_SIZE(cs35l41_mdsync_down_seq)); > - if (!enable) > + if (ret || !enable) > break; Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
On Sun, Sep 03, 2023 at 12:06:14AM +0300, Cristian Ciocaltea wrote: > The return code of regmap_multi_reg_write() call related to "MDSYNC up" > sequence is shadowed by the subsequent regmap_read_poll_timeout() > invocation, which will hit a timeout in case the write operation above > fails. > > Make sure cs35l41_global_enable() returns the correct error code instead > of -ETIMEDOUT. > > Additionally, to be able to distinguish between the timeouts of > wait_for_completion_timeout() and regmap_read_poll_timeout(), print an > error message for the former and return immediately. This also avoids > having to wait unnecessarily for the second time. > > Fixes: f8264c759208 ("ALSA: cs35l41: Poll for Power Up/Down rather than waiting a fixed delay") > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
On Sun, Sep 03, 2023 at 12:06:15AM +0300, Cristian Ciocaltea wrote: > Technically, an interrupt handler can be called before probe() finishes > its execution, hence ensure the pll_lock completion object is always > initialized before being accessed in cs35l41_irq(). > > Fixes: f5030564938b ("ALSA: cs35l41: Add shared boost feature") > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
On Sun, Sep 03, 2023 at 12:06:17AM +0300, Cristian Ciocaltea wrote: > Use a more intuitive name for 'pll_lock' completion, which helps > improving code readability a bit. > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
On Sun, Sep 03, 2023 at 12:06:20AM +0300, Cristian Ciocaltea wrote: > Make use of the recently introduced EXPORT_GPL_DEV_PM_OPS() macro, to > conditionally export the runtime/system PM functions. > > Replace the old SET_{RUNTIME,SYSTEM_SLEEP,NOIRQ_SYSTEM_SLEEP}_PM_OPS() > helpers with their modern alternatives and get rid of the now > unnecessary '__maybe_unused' annotations on all PM functions. > > Additionally, use the pm_ptr() macro to fix the following errors when > building with CONFIG_PM disabled: > > ERROR: modpost: "cs35l41_pm_ops" [sound/soc/codecs/snd-soc-cs35l41-spi.ko] undefined! > ERROR: modpost: "cs35l41_pm_ops" [sound/soc/codecs/snd-soc-cs35l41-i2c.ko] undefined! > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> > --- Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles