ASoC: add RT5640 CODEC driver
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines · On Tue, Jun 11, 2013 at 01:10:16PM +0800, [email protected] wrote:
Signed-off-by Bard Liao <[email protected]>Signed-off-by Stephen Warren <[email protected]>
I don't think that signoff for Stephen is right...
Review
Quoted 8 lines
(quoted diff) +8
-0+static int rt5640_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); + switch (level) { + case SND_SOC_BIAS_STANDBY: + if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) { + regcache_cache_only(rt5640->regmap, false);
You mark the device cache only in suspend so for symmetry this should really be in _BIAS_OFF, especially since the device is idle_bias_off so it'll be able to power off without a full suspend.
Review
Quoted 11 lines
(quoted diff) +11
-0+ 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); + }
I'd expect to see some handling fo the LDO over suspend but that can be dealt with in a followup as previously discussed. Ideally we'd be able to power off when in _BIAS_OFF too but if it's going to take 400ms to ramp the LDO (which does seem high) that might be an issue.
Quoted 7 lines · Mark Brown
Quoted 2 lines · On Tue, Jun 11, 2013 at 01:10:16PM +0800, [email protected] wrote:
Signed-off-by Bard Liao <[email protected]> Signed-off-by:Stephen Warren <[email protected]>
I don't think that signoff for Stephen is right...
I believe this is based on the patch I sent out a little while back, which obviously included my s-o-b, so this probably makes sense.
Quoted 4 lines
Quoted 4 lines
(quoted diff) +4
-0+static int rt5640_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ switch (level) { + case SND_SOC_BIAS_STANDBY: + if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) { + regcache_cache_only(rt5640->regmap, false);You mark the device cache only in suspend so for symmetry this should really be in
_BIAS_OFF, especially since the device isidle_bias_offso it'll be able to power off without a full suspend.
Actually, we prefer turn off the codec fully ,ie. set the LDO pin to low, only in suspend. Because it need 400 ms when we set the LDO pin to high and reset the codec. So, may I mark the device cache only in suspend and resume?
Quoted 13 lines
Review
Quoted 12 lines
(quoted diff) +11
-0+ 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); + }
Quoted 4 lines
I'd expect to see some handling fo the LDO over suspend but that can be dealt with in a followup as previously discussed. Ideally we'd be able to power off when in
_BIAS_OFFtoo but if it's going to take 400ms to ramp the LDO (which does seem high) that might be an issue.
I think I can't set LDO low in _BIAS_OFF bue to the timing issue. I will handle in suspend.
Quoted 2 lines
------Please consider the environment before printing this e-mail.
Quoted 11 lines · On 06/10/2013 11:10 PM, [email protected] wrote:
From: Bard Liao <[email protected]>
This patch adds the ALC5640 codec driver.
sound/soc/codecs/rt5640.c +3
-0+static int rt5640_i2c_probe (struct i2c_client *i2c, + rt5640->regmap = devm_regmap_init_i2c(i2c, &rt5640_regmap); +if (rt5640->pdata.ldo1_en) {
sound/soc/codecs/rt5640.c
Quoted 10 lines
sound/soc/codecs/rt5640.c +10
-0+ 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.
Quoted 23 lines · On 06/10/2013 11:10 PM, [email protected] wrote:
Quoted 11 lines
From: Bard Liao <[email protected]>
This patch adds the ALC5640 codec driver.
sound/soc/codecs/rt5640.c +3
-0+static int rt5640_i2c_probe (struct i2c_client *i2c, + rt5640->regmap = devm_regmap_init_i2c(i2c, &rt5640_regmap); +if (rt5640->pdata.ldo1_en) {sound/soc/codecs/rt5640.c
Quoted 10 lines
sound/soc/codecs/rt5640.c +10
-0+ 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 ); + }
Quoted 5 lines
Oh I see this is the only place
ldo1_enis 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.
Quoted 6 lines
One question though: Don't you want to initially enable
ldo1_enbefore you create the regmap? At least someregmap_init()calls end up trying to read from the device to populate the register cache, and that won't work untilldo1_enis active.
Sure, it is better. Thanks for reminding me.
Quoted 4 lines · Stephen Warren
One question though: Don't you want to initially enable
ldo1_enbefore you create the regmap? At least someregmap_init()calls end up trying to read from the device to populate the register cache, and that won't work untilldo1_enis active.
They shouldn't if a set of defaults is provided, though if a patch is going to be applied then that'll write to the device.
Stephen Warren
Tested-byQuoted 6 lines · On 06/10/2013 11:10 PM, [email protected] wrote:
From: Bard Liao <[email protected]>
This patch adds the ALC5640 codec driver.
Signed-off-by Bard Liao <[email protected]>Signed-off-by Stephen Warren <[email protected]>
(Oh, I suppose those two lines above should really be swapped)
This time, both headphones /and/ speakers worked for me:-) I haven't tested capture yet though.
Quoted 3 lines · On Tue, Jun 11, 2013 at 01:10:16PM +0800, [email protected] wrote:
From: Bard Liao <[email protected]>
This patch adds the ALC5640 codec driver.
I'll apply this on the basis that there's going to be some followup patches fixing the outstanding issues.