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

Stephen Warren swarren at wwwdotorg.org
Tue Jun 11 19:41:49 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.

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.

Anyway, I'll go test this again, and work on the patch to pull the
platform data from DT.


More information about the Alsa-devel mailing list