[alsa-devel] [PATCH 1/2] ASoC: uda134x: add DATA011 register found in codecs family
In UDA1340, UDA1344 and UDA1345 codecs there is one more functional register in part of DATA0 tranfser. For UDA1341 this register coincides with EA register.
Signed-off-by: Vladimir Zapolskiy vzapolskiy@gmail.com --- sound/soc/codecs/uda134x.c | 3 ++- sound/soc/codecs/uda134x.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index b3039b1..e770029 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -57,7 +57,7 @@ static const char uda134x_reg[UDA134X_REGS_NUM] = { /* Extended address registers */ 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, /* Status, data regs */ - 0x00, 0x83, 0x00, 0x40, 0x80, 0x00, + 0x00, 0x83, 0x00, 0x40, 0x80, 0xC0, 0x00, };
/* @@ -116,6 +116,7 @@ static int uda134x_write(struct snd_soc_codec *codec, unsigned int reg, case UDA134X_DATA000: case UDA134X_DATA001: case UDA134X_DATA010: + case UDA134X_DATA011: addr = UDA134X_DATA0_ADDR; break; case UDA134X_DATA1: diff --git a/sound/soc/codecs/uda134x.h b/sound/soc/codecs/uda134x.h index 94f4404..205f03b 100644 --- a/sound/soc/codecs/uda134x.h +++ b/sound/soc/codecs/uda134x.h @@ -23,9 +23,10 @@ #define UDA134X_DATA000 10 #define UDA134X_DATA001 11 #define UDA134X_DATA010 12 -#define UDA134X_DATA1 13 +#define UDA134X_DATA011 13 +#define UDA134X_DATA1 14
-#define UDA134X_REGS_NUM 14 +#define UDA134X_REGS_NUM 15
#define STATUS0_DAIFMT_MASK (~(7<<1)) #define STATUS0_SYSCLK_MASK (~(3<<4))
For UDA1341 codec power control is managed in STATUS1 register, and for all other codecs in DATA011 register.
On initialization ADC/DAC are enabled only for UDA1341, that's why bias_level shall be set to off, otherwise dapm is misinformed about bias_level on startup.
Signed-off-by: Vladimir Zapolskiy vzapolskiy@gmail.com --- sound/soc/codecs/uda134x.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index e770029..0e9a945 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -353,8 +353,13 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: /* ADC, DAC on */ - reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); - uda134x_write(codec, UDA134X_STATUS1, reg | 0x03); + if (pd->model == UDA134X_UDA1341) { + reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); + uda134x_write(codec, UDA134X_STATUS1, reg | 0x03); + } else { + reg = uda134x_read_reg_cache(codec, UDA134X_DATA011); + uda134x_write(codec, UDA134X_DATA011, reg | 0x03); + } break; case SND_SOC_BIAS_PREPARE: /* power on */ @@ -367,8 +372,13 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* ADC, DAC power off */ - reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); - uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03)); + if (pd->model == UDA134X_UDA1341) { + reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); + uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03)); + } else { + reg = uda134x_read_reg_cache(codec, UDA134X_DATA011); + uda134x_write(codec, UDA134X_DATA011, reg & ~(0x03)); + } break; case SND_SOC_BIAS_OFF: /* power off */ @@ -531,9 +541,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) codec->num_dai = 1; codec->read = uda134x_read_reg_cache; codec->write = uda134x_write; -#ifdef POWER_OFF_ON_STANDBY - codec->set_bias_level = uda134x_set_bias_level; -#endif + INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths);
@@ -544,6 +552,13 @@ static int uda134x_soc_probe(struct platform_device *pdev)
uda134x_reset(codec);
+#ifdef POWER_OFF_ON_STANDBY + codec->set_bias_level = uda134x_set_bias_level; + uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); +#else + uda134x_set_bias_level(codec, SND_SOC_BIAS_ON); +#endif + /* register pcms */ ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); if (ret < 0) {
On 24 Jun 2010, at 12:17, Vladimir Zapolskiy wrote:
/* ADC, DAC on */
reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
if (pd->model == UDA134X_UDA1341) {
reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
} else {
reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
uda134x_write(codec, UDA134X_DATA011, reg | 0x03);
}
I'd be more comfortable if these used switch statements. That way any further device specifics will slot in more easily.
Of course, this should really be using DAPM...
@@ -531,9 +541,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) codec->num_dai = 1; codec->read = uda134x_read_reg_cache; codec->write = uda134x_write; -#ifdef POWER_OFF_ON_STANDBY
- codec->set_bias_level = uda134x_set_bias_level;
-#endif
These changes for the bias level configuration look to be unrelated to the addition of the new CODEC and should be split into a separate patch. It'd also be much better to remove this ifdefery, it should be handled via platform data or just done unconditionally.
Hello,
On Thu, Jun 24, 2010 at 3:34 PM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
On 24 Jun 2010, at 12:17, Vladimir Zapolskiy wrote:
/* ADC, DAC on */
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
- if (pd->model == UDA134X_UDA1341) {
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
- } else {
- reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
- uda134x_write(codec, UDA134X_DATA011, reg | 0x03);
- }
I'd be more comfortable if these used switch statements. That way any further device specifics will slot in more easily.
Agree with the comment.
Of course, this should really be using DAPM...
@@ -531,9 +541,7 @@ static int uda134x_soc_probe(struct platform_device *pdev) codec->num_dai = 1; codec->read = uda134x_read_reg_cache; codec->write = uda134x_write; -#ifdef POWER_OFF_ON_STANDBY
- codec->set_bias_level = uda134x_set_bias_level;
-#endif
These changes for the bias level configuration look to be unrelated to the addition of the new CODEC and should be split into a separate patch. It'd also be much better to remove this ifdefery, it should be handled via platform data or just done unconditionally.
I confirm that's actually unrelated, so it should be done in a separate patch.
I dislike the macro here too, I'll replace it with a platform data solution.
Best wishes, Vladimir
For UDA1341 codec power control is managed in STATUS1 register, and for all other codecs in DATA011 register.
Signed-off-by: Vladimir Zapolskiy vzapolskiy@gmail.com --- sound/soc/codecs/uda134x.c | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index e770029..e8066b6 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -353,8 +353,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: /* ADC, DAC on */ - reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); - uda134x_write(codec, UDA134X_STATUS1, reg | 0x03); + switch (pd->model) { + case UDA134X_UDA1340: + case UDA134X_UDA1344: + case UDA134X_UDA1345: + reg = uda134x_read_reg_cache(codec, UDA134X_DATA011); + uda134x_write(codec, UDA134X_DATA011, reg | 0x03); + break; + case UDA134X_UDA1341: + reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); + uda134x_write(codec, UDA134X_STATUS1, reg | 0x03); + break; + default: + printk(KERN_ERR "UDA134X SoC codec: " + "unsupported model %d\n", pd->model); + return -EINVAL; + } break; case SND_SOC_BIAS_PREPARE: /* power on */ @@ -367,8 +381,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* ADC, DAC power off */ - reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); - uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03)); + switch (pd->model) { + case UDA134X_UDA1340: + case UDA134X_UDA1344: + case UDA134X_UDA1345: + reg = uda134x_read_reg_cache(codec, UDA134X_DATA011); + uda134x_write(codec, UDA134X_DATA011, reg & ~(0x03)); + break; + case UDA134X_UDA1341: + reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1); + uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03)); + break; + default: + printk(KERN_ERR "UDA134X SoC codec: " + "unsupported model %d\n", pd->model); + return -EINVAL; + } break; case SND_SOC_BIAS_OFF: /* power off */
Mark, Liam,
do you have more comments about this fix?
On Thu, Jun 24, 2010 at 5:19 PM, Vladimir Zapolskiy vzapolskiy@gmail.com wrote:
For UDA1341 codec power control is managed in STATUS1 register, and for all other codecs in DATA011 register.
Signed-off-by: Vladimir Zapolskiy vzapolskiy@gmail.com
sound/soc/codecs/uda134x.c | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index e770029..e8066b6 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -353,8 +353,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: /* ADC, DAC on */
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
- switch (pd->model) {
- case UDA134X_UDA1340:
- case UDA134X_UDA1344:
- case UDA134X_UDA1345:
- reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
- uda134x_write(codec, UDA134X_DATA011, reg | 0x03);
- break;
- case UDA134X_UDA1341:
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
- break;
- default:
- printk(KERN_ERR "UDA134X SoC codec: "
- "unsupported model %d\n", pd->model);
- return -EINVAL;
- }
break; case SND_SOC_BIAS_PREPARE: /* power on */ @@ -367,8 +381,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* ADC, DAC power off */
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
- switch (pd->model) {
- case UDA134X_UDA1340:
- case UDA134X_UDA1344:
- case UDA134X_UDA1345:
- reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
- uda134x_write(codec, UDA134X_DATA011, reg & ~(0x03));
- break;
- case UDA134X_UDA1341:
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
- break;
- default:
- printk(KERN_ERR "UDA134X SoC codec: "
- "unsupported model %d\n", pd->model);
- return -EINVAL;
- }
break; case SND_SOC_BIAS_OFF: /* power off */ -- 1.7.0.4
Hi all,
would you like to review these two patches with fix for uda134{0,4,5} codecs core power control support?
Thanks in advance, Vladimir
On Thu, Jun 24, 2010 at 5:19 PM, Vladimir Zapolskiy vzapolskiy@gmail.com wrote:
For UDA1341 codec power control is managed in STATUS1 register, and for all other codecs in DATA011 register.
Signed-off-by: Vladimir Zapolskiy vzapolskiy@gmail.com
sound/soc/codecs/uda134x.c | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index e770029..e8066b6 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -353,8 +353,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: /* ADC, DAC on */
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
- switch (pd->model) {
- case UDA134X_UDA1340:
- case UDA134X_UDA1344:
- case UDA134X_UDA1345:
- reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
- uda134x_write(codec, UDA134X_DATA011, reg | 0x03);
- break;
- case UDA134X_UDA1341:
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg | 0x03);
- break;
- default:
- printk(KERN_ERR "UDA134X SoC codec: "
- "unsupported model %d\n", pd->model);
- return -EINVAL;
- }
break; case SND_SOC_BIAS_PREPARE: /* power on */ @@ -367,8 +381,22 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* ADC, DAC power off */
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
- switch (pd->model) {
- case UDA134X_UDA1340:
- case UDA134X_UDA1344:
- case UDA134X_UDA1345:
- reg = uda134x_read_reg_cache(codec, UDA134X_DATA011);
- uda134x_write(codec, UDA134X_DATA011, reg & ~(0x03));
- break;
- case UDA134X_UDA1341:
- reg = uda134x_read_reg_cache(codec, UDA134X_STATUS1);
- uda134x_write(codec, UDA134X_STATUS1, reg & ~(0x03));
- break;
- default:
- printk(KERN_ERR "UDA134X SoC codec: "
- "unsupported model %d\n", pd->model);
- return -EINVAL;
- }
break; case SND_SOC_BIAS_OFF: /* power off */ -- 1.7.0.4
On Mon, Jun 28, 2010 at 09:38:55AM +0400, Vladimir Zapolskiy wrote:
Hi all,
would you like to review these two patches with fix for uda134{0,4,5} codecs core power control support?
Applied both, sorry about the delay - it was due to Liam having poor net access unexpectedly and not being able to review stuff.
Hi Mark,
On Wed, Jun 30, 2010 at 4:58 PM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
On Mon, Jun 28, 2010 at 09:38:55AM +0400, Vladimir Zapolskiy wrote:
Hi all,
would you like to review these two patches with fix for uda134{0,4,5} codecs core power control support?
Applied both, sorry about the delay - it was due to Liam having poor net access unexpectedly and not being able to review stuff.
no problem about delay.
Anyhow in broonie/sound-2.6 tree, branch `for-2.6.36' I can't find applied all 4 sent patches recently, e.g. 2 patchsets with 2 patches each, only the second patchset was applied 5 days ago.
Probably I look at invalid branch?
Thank you, Vladimir
On Wed, Jun 30, 2010 at 05:10:52PM +0400, Vladimir Zapolskiy wrote:
Anyhow in broonie/sound-2.6 tree, branch `for-2.6.36' I can't find applied all 4 sent patches recently, e.g. 2 patchsets with 2 patches each, only the second patchset was applied 5 days ago.
Probably I look at invalid branch?
You need to allow at least a few minutes for the kernel.org system to mirror out the commits after I push them, and I tend to send these mails as soon as I've applied locally rather than when I push stuff out.
On Wed, Jun 30, 2010 at 6:08 PM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
On Wed, Jun 30, 2010 at 05:10:52PM +0400, Vladimir Zapolskiy wrote:
Anyhow in broonie/sound-2.6 tree, branch `for-2.6.36' I can't find applied all 4 sent patches recently, e.g. 2 patchsets with 2 patches each, only the second patchset was applied 5 days ago.
Probably I look at invalid branch?
You need to allow at least a few minutes for the kernel.org system to mirror out the commits after I push them, and I tend to send these mails as soon as I've applied locally rather than when I push stuff out.
Clear for now, thank you a lot.
Vladimir
participants (2)
-
Mark Brown
-
Vladimir Zapolskiy