[PATCH RESEND 1/2] ASoC: max98927: Handle reset gpio when probing i2c

Alejandro Tafalla atafalla at dnyon.com
Mon Aug 30 00:13:41 CEST 2021


Hello Andy,

On Sun, Aug 29, 2021 at 11:22:35PM +0300, Andy Shevchenko wrote:
> > +       max98927->reset_gpio
> > +               = devm_gpiod_get_optional(&i2c->dev, "reset",
> > GPIOD_OUT_HIGH);
> > +       if (IS_ERR(max98927->reset_gpio)) {
> > +               ret = PTR_ERR(max98927->reset_gpio);
> > +               dev_err(&i2c->dev,
> > +                       "Failed to request GPIO reset pin, error %d\n",
> > ret);
> > +               return ret;
> 
> 
> 
> Spamming logs is not good. Use
> 
> return dev_err_probe(...);
Okay.
 
> > +       }
> > +
> > +       if (max98927->reset_gpio) {
> > +               gpiod_set_value_cansleep(max98927->reset_gpio, 0);
> 
> 
> 
> You may request the pin in a proper state, also with current code you seems
> mishandle the conception of the logical pin level vs. physical one.
Right, i made the mistake of basing off an old driver that use legacy
functions.
 
> > diff --git a/sound/soc/codecs/max98927.h b/sound/soc/codecs/max98927.h
> > index 05f495db914d..5c04bf38e24a 100644
> > --- a/sound/soc/codecs/max98927.h
> > +++ b/sound/soc/codecs/max98927.h
> > @@ -255,6 +255,7 @@ struct max98927_priv {
> >         struct regmap *regmap;
> >         struct snd_soc_component *component;
> >         struct max98927_pdata *pdata;
> 
> 
> 
> > +       struct gpio_desc *reset_gpio;
> 
> 
> Why? Are you using it outside of ->probe()?
No, I'll delete it and use a local variable.

> With Best Regards,
> Andy Shevchenko
Thank you for the feedback, I'll address all the issues in a V2.

Alejandro Tafalla


More information about the Alsa-devel mailing list