[alsa-devel] [PATCH] ASoC: add RT5640 CODEC driver

Bard Liao bardliao at realtek.com
Wed Jun 12 09:56:48 CEST 2013


> On 06/10/2013 11:10 PM, bardliao at realtek.com wrote:
> > From: Bard Liao <bardliao at realtek.com>
> >
> > This patch adds the ALC5640 codec driver.
> 
> > diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
> 
> > +static int rt5640_i2c_probe(struct i2c_client *i2c,
> 
> > +     rt5640->regmap = devm_regmap_init_i2c(i2c, &rt5640_regmap);
> 
> > +     if (rt5640->pdata.ldo1_en) {
> > +             ret = devm_gpio_request_one(&i2c->dev, rt5640->pdata.ldo1_en,
> > +                                         GPIOF_OUT_INIT_HIGH,
> > +                                         "RT5640 LDO1_EN");
> > +             if (ret < 0) {
> > +                     dev_err(&i2c->dev, "Failed to request LDO1_EN %d: %d\n",
> > +                             rt5640->pdata.ldo1_en, ret);
> > +                     return ret;
> > +             }
> > +             msleep(400);
> > +     }
> 
> Oh I see this is the only place ldo1_en is touched. I had assumed you
> were going to add code to turn it off/on based on bias level. That's why
> I had asked you to add that feature, since you'd know any HW
> requirements for doing that. Still, as Mark mentioned, that can
> certainly be added later.

I think we can't turn on/off ldo1_en based on bias level.
Because it will take too long from _BIAS_OFF to _BIAS_ON.
I think we can do it in suspend/resume function.

> 
> One question though: Don't you want to initially enable ldo1_en before
> you create the regmap? At least some regmap_init() calls end up trying
> to read from the device to populate the register cache, and that won't
> work until ldo1_en is active.
> 

Sure, it is better. Thanks for reminding me.


More information about the Alsa-devel mailing list