* [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers
@ 2012-01-18 10:48 Wolfram Sang
2012-01-18 10:48 ` [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block Wolfram Sang
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Wolfram Sang @ 2012-01-18 10:48 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Javier Martin, Wolfram Sang, Liam Girdwood
Dividers (such as MDAC) are always needed, independent of the codec
being I2S master or slave. Needed on a custom board where the codec has
to be slave.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
sound/soc/codecs/tlv320aic32x4.c | 102 +++++++++++++++++---------------------
1 files changed, 46 insertions(+), 56 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index eb401ef..3806cb6 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -60,7 +60,6 @@ struct aic32x4_rate_divs {
struct aic32x4_priv {
u32 sysclk;
- s32 master;
u8 page_no;
void *control_data;
u32 power_cfg;
@@ -369,7 +368,6 @@ static int aic32x4_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{
struct snd_soc_codec *codec = codec_dai->codec;
- struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
u8 iface_reg_1;
u8 iface_reg_2;
u8 iface_reg_3;
@@ -384,11 +382,9 @@ static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
/* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM:
- aic32x4->master = 1;
iface_reg_1 |= AIC32X4_BCLKMASTER | AIC32X4_WCLKMASTER;
break;
case SND_SOC_DAIFMT_CBS_CFS:
- aic32x4->master = 0;
break;
default:
printk(KERN_ERR "aic32x4: invalid DAI master/slave interface\n");
@@ -526,64 +522,58 @@ static int aic32x4_mute(struct snd_soc_dai *dai, int mute)
static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
- struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
-
switch (level) {
case SND_SOC_BIAS_ON:
- if (aic32x4->master) {
- /* Switch on PLL */
- snd_soc_update_bits(codec, AIC32X4_PLLPR,
- AIC32X4_PLLEN, AIC32X4_PLLEN);
-
- /* Switch on NDAC Divider */
- snd_soc_update_bits(codec, AIC32X4_NDAC,
- AIC32X4_NDACEN, AIC32X4_NDACEN);
-
- /* Switch on MDAC Divider */
- snd_soc_update_bits(codec, AIC32X4_MDAC,
- AIC32X4_MDACEN, AIC32X4_MDACEN);
-
- /* Switch on NADC Divider */
- snd_soc_update_bits(codec, AIC32X4_NADC,
- AIC32X4_NADCEN, AIC32X4_NADCEN);
-
- /* Switch on MADC Divider */
- snd_soc_update_bits(codec, AIC32X4_MADC,
- AIC32X4_MADCEN, AIC32X4_MADCEN);
-
- /* Switch on BCLK_N Divider */
- snd_soc_update_bits(codec, AIC32X4_BCLKN,
- AIC32X4_BCLKEN, AIC32X4_BCLKEN);
- }
+ /* Switch on PLL */
+ snd_soc_update_bits(codec, AIC32X4_PLLPR,
+ AIC32X4_PLLEN, AIC32X4_PLLEN);
+
+ /* Switch on NDAC Divider */
+ snd_soc_update_bits(codec, AIC32X4_NDAC,
+ AIC32X4_NDACEN, AIC32X4_NDACEN);
+
+ /* Switch on MDAC Divider */
+ snd_soc_update_bits(codec, AIC32X4_MDAC,
+ AIC32X4_MDACEN, AIC32X4_MDACEN);
+
+ /* Switch on NADC Divider */
+ snd_soc_update_bits(codec, AIC32X4_NADC,
+ AIC32X4_NADCEN, AIC32X4_NADCEN);
+
+ /* Switch on MADC Divider */
+ snd_soc_update_bits(codec, AIC32X4_MADC,
+ AIC32X4_MADCEN, AIC32X4_MADCEN);
+
+ /* Switch on BCLK_N Divider */
+ snd_soc_update_bits(codec, AIC32X4_BCLKN,
+ AIC32X4_BCLKEN, AIC32X4_BCLKEN);
break;
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
- if (aic32x4->master) {
- /* Switch off PLL */
- snd_soc_update_bits(codec, AIC32X4_PLLPR,
- AIC32X4_PLLEN, 0);
-
- /* Switch off NDAC Divider */
- snd_soc_update_bits(codec, AIC32X4_NDAC,
- AIC32X4_NDACEN, 0);
-
- /* Switch off MDAC Divider */
- snd_soc_update_bits(codec, AIC32X4_MDAC,
- AIC32X4_MDACEN, 0);
-
- /* Switch off NADC Divider */
- snd_soc_update_bits(codec, AIC32X4_NADC,
- AIC32X4_NADCEN, 0);
-
- /* Switch off MADC Divider */
- snd_soc_update_bits(codec, AIC32X4_MADC,
- AIC32X4_MADCEN, 0);
-
- /* Switch off BCLK_N Divider */
- snd_soc_update_bits(codec, AIC32X4_BCLKN,
- AIC32X4_BCLKEN, 0);
- }
+ /* Switch off PLL */
+ snd_soc_update_bits(codec, AIC32X4_PLLPR,
+ AIC32X4_PLLEN, 0);
+
+ /* Switch off NDAC Divider */
+ snd_soc_update_bits(codec, AIC32X4_NDAC,
+ AIC32X4_NDACEN, 0);
+
+ /* Switch off MDAC Divider */
+ snd_soc_update_bits(codec, AIC32X4_MDAC,
+ AIC32X4_MDACEN, 0);
+
+ /* Switch off NADC Divider */
+ snd_soc_update_bits(codec, AIC32X4_NADC,
+ AIC32X4_NADCEN, 0);
+
+ /* Switch off MADC Divider */
+ snd_soc_update_bits(codec, AIC32X4_MADC,
+ AIC32X4_MADCEN, 0);
+
+ /* Switch off BCLK_N Divider */
+ snd_soc_update_bits(codec, AIC32X4_BCLKN,
+ AIC32X4_BCLKEN, 0);
break;
case SND_SOC_BIAS_OFF:
break;
--
1.7.8.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block
2012-01-18 10:48 [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Wolfram Sang
@ 2012-01-18 10:48 ` Wolfram Sang
2012-01-18 15:29 ` javier Martin
2012-01-18 10:50 ` [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Mark Brown
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2012-01-18 10:48 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Javier Martin, Wolfram Sang, Liam Girdwood
Register LDOCTLEN must always be initialized to clear the analog power
control bit, otherwise the analog block will stay deactivated.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
sound/soc/codecs/tlv320aic32x4.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 3806cb6..372b0b8 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -641,9 +641,11 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
if (aic32x4->power_cfg & AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE) {
snd_soc_write(codec, AIC32X4_PWRCFG, AIC32X4_AVDDWEAKDISABLE);
}
- if (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) {
- snd_soc_write(codec, AIC32X4_LDOCTL, AIC32X4_LDOCTLEN);
- }
+
+ tmp_reg = (aic32x4->power_cfg & AIC32X4_PWR_AIC32X4_LDO_ENABLE) ?
+ AIC32X4_LDOCTLEN : 0;
+ snd_soc_write(codec, AIC32X4_LDOCTL, tmp_reg);
+
tmp_reg = snd_soc_read(codec, AIC32X4_CMMODE);
if (aic32x4->power_cfg & AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36) {
tmp_reg |= AIC32X4_LDOIN_18_36;
--
1.7.8.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers
2012-01-18 10:48 [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Wolfram Sang
2012-01-18 10:48 ` [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block Wolfram Sang
@ 2012-01-18 10:50 ` Mark Brown
2012-01-18 11:14 ` Wolfram Sang
2012-01-18 15:29 ` javier Martin
2012-01-18 17:55 ` Mark Brown
3 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2012-01-18 10:50 UTC (permalink / raw)
To: Wolfram Sang; +Cc: alsa-devel, Javier Martin, Liam Girdwood
On Wed, Jan 18, 2012 at 11:48:58AM +0100, Wolfram Sang wrote:
> + /* Switch on PLL */
> + snd_soc_update_bits(codec, AIC32X4_PLLPR,
> + AIC32X4_PLLEN, AIC32X4_PLLEN);
Looking at this code it looks a lot like these ought to be supplies, not
that that needs to be fixed right now.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers
2012-01-18 10:50 ` [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Mark Brown
@ 2012-01-18 11:14 ` Wolfram Sang
2012-01-18 11:24 ` Mark Brown
0 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2012-01-18 11:14 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Javier Martin, Liam Girdwood
[-- Attachment #1.1: Type: text/plain, Size: 987 bytes --]
On Wed, Jan 18, 2012 at 10:50:54AM +0000, Mark Brown wrote:
> On Wed, Jan 18, 2012 at 11:48:58AM +0100, Wolfram Sang wrote:
>
> > + /* Switch on PLL */
> > + snd_soc_update_bits(codec, AIC32X4_PLLPR,
> > + AIC32X4_PLLEN, AIC32X4_PLLEN);
>
> Looking at this code it looks a lot like these ought to be supplies, not
> that that needs to be fixed right now.
A lot of things need to be fixed in that driver I think. I am still figuring
what incremental set of steps would make sense. Sadly, I am not an ASoC
expert and I won't have endless time for this task, but at least there
is another driver [1] as a working reference. I'll see what I can come
up with in that time, probably reg-caching is next.
Regards,
Wolfram
[1] http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-06/msg07236.html
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers
2012-01-18 11:14 ` Wolfram Sang
@ 2012-01-18 11:24 ` Mark Brown
0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2012-01-18 11:24 UTC (permalink / raw)
To: Wolfram Sang; +Cc: alsa-devel, Javier Martin, Liam Girdwood
On Wed, Jan 18, 2012 at 12:14:24PM +0100, Wolfram Sang wrote:
> expert and I won't have endless time for this task, but at least there
> is another driver [1] as a working reference. I'll see what I can come
> up with in that time, probably reg-caching is next.
If you're going to do that a conversion to regmap would probably be in
order, I'd rather like to remove the ASoC cache code as there doesn't
seem to be a good reason to have two implementations and it's unlikely
that there's anything ASoC specific about register access.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers
2012-01-18 10:48 [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Wolfram Sang
2012-01-18 10:48 ` [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block Wolfram Sang
2012-01-18 10:50 ` [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Mark Brown
@ 2012-01-18 15:29 ` javier Martin
2012-01-18 17:55 ` Mark Brown
3 siblings, 0 replies; 8+ messages in thread
From: javier Martin @ 2012-01-18 15:29 UTC (permalink / raw)
To: Wolfram Sang; +Cc: alsa-devel, Mark Brown, Liam Girdwood
On 18 January 2012 11:48, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Dividers (such as MDAC) are always needed, independent of the codec
> being I2S master or slave. Needed on a custom board where the codec has
> to be slave.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Javier Martin <javier.martin@vista-silicon.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block
2012-01-18 10:48 ` [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block Wolfram Sang
@ 2012-01-18 15:29 ` javier Martin
0 siblings, 0 replies; 8+ messages in thread
From: javier Martin @ 2012-01-18 15:29 UTC (permalink / raw)
To: Wolfram Sang; +Cc: alsa-devel, Mark Brown, Liam Girdwood
On 18 January 2012 11:48, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Register LDOCTLEN must always be initialized to clear the analog power
> control bit, otherwise the analog block will stay deactivated.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Javier Martin <javier.martin@vista-silicon.com>
--
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers
2012-01-18 10:48 [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Wolfram Sang
` (2 preceding siblings ...)
2012-01-18 15:29 ` javier Martin
@ 2012-01-18 17:55 ` Mark Brown
3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2012-01-18 17:55 UTC (permalink / raw)
To: Wolfram Sang; +Cc: alsa-devel, Javier Martin, Liam Girdwood
On Wed, Jan 18, 2012 at 11:48:58AM +0100, Wolfram Sang wrote:
> Dividers (such as MDAC) are always needed, independent of the codec
> being I2S master or slave. Needed on a custom board where the codec has
> to be slave.
Applied both, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-01-18 17:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-18 10:48 [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Wolfram Sang
2012-01-18 10:48 ` [PATCH 2/2] ASoC: tlv320aic32x4: always enable analouge block Wolfram Sang
2012-01-18 15:29 ` javier Martin
2012-01-18 10:50 ` [PATCH 1/2] ASoC: tlv320aic32x4: always enable dividers Mark Brown
2012-01-18 11:14 ` Wolfram Sang
2012-01-18 11:24 ` Mark Brown
2012-01-18 15:29 ` javier Martin
2012-01-18 17:55 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).