All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
@ 2009-07-03  3:11 Lopez Cruz, Misael
  2009-07-03  4:45 ` Peter Ujfalusi
  0 siblings, 1 reply; 6+ messages in thread
From: Lopez Cruz, Misael @ 2009-07-03  3:11 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org; +Cc: Mark Brown, Peter Ujfalusi

Add "set_tristate" callbacks for HiFi and Voice DAIs.
Machine drivers can enable and disable tristate for each
DAI with "snd_soc_dai_set_tristate" function provided by
SoC core.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
---
 sound/soc/codecs/twl4030.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 6da94ca..ffeb53f 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1849,6 +1849,19 @@ static int twl4030_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
+static int twl4030_set_tristate(struct snd_soc_dai *dai, int tristate)
+{
+	struct snd_soc_codec *codec = dai->codec;
+	u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_VOICE_IF);
+
+	if (tristate)
+		reg |= TWL4030_AIF_TRI_EN;
+	else
+		reg &= ~TWL4030_AIF_TRI_EN;
+
+	return twl4030_write(codec, TWL4030_REG_AUDIO_IF, reg);
+}
+
 /* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R
  * (VTXL, VTXR) for uplink has to be enabled/disabled. */
 static void twl4030_voice_enable(struct snd_soc_codec *codec, int direction,
@@ -2023,6 +2036,19 @@ static int twl4030_voice_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
+static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate)
+{
+	struct snd_soc_codec *codec = dai->codec;
+	u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_VOICE_IF);
+
+	if (tristate)
+		reg |= TWL4030_VIF_TRI_EN;
+	else
+		reg &= ~TWL4030_VIF_TRI_EN;
+
+	return twl4030_write(codec, TWL4030_REG_VOICE_IF, reg);
+}
+
 #define TWL4030_RATES	 (SNDRV_PCM_RATE_8000_48000)
 #define TWL4030_FORMATS	 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE)
 
@@ -2032,6 +2058,7 @@ static struct snd_soc_dai_ops twl4030_dai_ops = {
 	.hw_params	= twl4030_hw_params,
 	.set_sysclk	= twl4030_set_dai_sysclk,
 	.set_fmt	= twl4030_set_dai_fmt,
+	.set_tristate	= twl4030_set_tristate,
 };
 
 static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
@@ -2040,6 +2067,7 @@ static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
 	.hw_params	= twl4030_voice_hw_params,
 	.set_sysclk	= twl4030_voice_set_dai_sysclk,
 	.set_fmt	= twl4030_voice_set_dai_fmt,
+	.set_tristate	= twl4030_voice_set_tristate,
 };
 
 struct snd_soc_dai twl4030_dai[] = {
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
  2009-07-03  3:11 Lopez Cruz, Misael
@ 2009-07-03  4:45 ` Peter Ujfalusi
  2009-07-03  7:09   ` Lopez Cruz, Misael
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2009-07-03  4:45 UTC (permalink / raw)
  To: ext Lopez Cruz, Misael; +Cc: alsa-devel@alsa-project.org, Mark Brown

On Friday 03 July 2009 06:11:40 ext Lopez Cruz, Misael wrote:
> Add "set_tristate" callbacks for HiFi and Voice DAIs.
> Machine drivers can enable and disable tristate for each
> DAI with "snd_soc_dai_set_tristate" function provided by
> SoC core.
>
> Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>

> +static int twl4030_set_tristate(struct snd_soc_dai *dai, int tristate)
> +{
> +	struct snd_soc_codec *codec = dai->codec;
> +	u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_VOICE_IF);

I think you wanted to read the TWL4030_REG_AUDIO_IF register here...

> +
> +	if (tristate)
> +		reg |= TWL4030_AIF_TRI_EN;
> +	else
> +		reg &= ~TWL4030_AIF_TRI_EN;
> +
> +	return twl4030_write(codec, TWL4030_REG_AUDIO_IF, reg);
> +}
> +

-- 
Péter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
  2009-07-03  4:45 ` Peter Ujfalusi
@ 2009-07-03  7:09   ` Lopez Cruz, Misael
  0 siblings, 0 replies; 6+ messages in thread
From: Lopez Cruz, Misael @ 2009-07-03  7:09 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel@alsa-project.org, Mark Brown


> On Friday 03 July 2009 06:11:40 ext Lopez Cruz, Misael wrote:
> > Add "set_tristate" callbacks for HiFi and Voice DAIs.
> > Machine drivers can enable and disable tristate for each DAI with 
> > "snd_soc_dai_set_tristate" function provided by SoC core.
> >
> > Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
> 
> > +static int twl4030_set_tristate(struct snd_soc_dai *dai, int 
> > +tristate) {
> > +	struct snd_soc_codec *codec = dai->codec;
> > +	u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_VOICE_IF);

> I think you wanted to read the TWL4030_REG_AUDIO_IF register here...

Definitively, I meant TWL4030_REG_AUDIO_IF. I'll resend the patch in
some minutes. Thanks for your comment.

-Misa

> > +
> > +	if (tristate)
> > +		reg |= TWL4030_AIF_TRI_EN;
> > +	else
> > +		reg &= ~TWL4030_AIF_TRI_EN;
> > +
> > +	return twl4030_write(codec, TWL4030_REG_AUDIO_IF, reg); }
> > +
> 
> --
> Péter
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
@ 2009-07-03  7:21 Lopez Cruz, Misael
  2009-07-03  8:58 ` Peter Ujfalusi
  0 siblings, 1 reply; 6+ messages in thread
From: Lopez Cruz, Misael @ 2009-07-03  7:21 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org; +Cc: Mark Brown, Peter Ujfalusi

Add "set_tristate" callbacks for HiFi and Voice DAIs.
Machine drivers can enable and disable tristate for each
DAI with "snd_soc_dai_set_tristate" function.

Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
---
 sound/soc/codecs/twl4030.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 6da94ca..818fb37 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -1849,6 +1849,19 @@ static int twl4030_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
+static int twl4030_set_tristate(struct snd_soc_dai *dai, int tristate)
+{
+	struct snd_soc_codec *codec = dai->codec;
+	u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_AUDIO_IF);
+
+	if (tristate)
+		reg |= TWL4030_AIF_TRI_EN;
+	else
+		reg &= ~TWL4030_AIF_TRI_EN;
+
+	return twl4030_write(codec, TWL4030_REG_AUDIO_IF, reg);
+}
+
 /* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R
  * (VTXL, VTXR) for uplink has to be enabled/disabled. */
 static void twl4030_voice_enable(struct snd_soc_codec *codec, int direction,
@@ -2023,6 +2036,19 @@ static int twl4030_voice_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	return 0;
 }
 
+static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate)
+{
+	struct snd_soc_codec *codec = dai->codec;
+	u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_VOICE_IF);
+
+	if (tristate)
+		reg |= TWL4030_VIF_TRI_EN;
+	else
+		reg &= ~TWL4030_VIF_TRI_EN;
+
+	return twl4030_write(codec, TWL4030_REG_VOICE_IF, reg);
+}
+
 #define TWL4030_RATES	 (SNDRV_PCM_RATE_8000_48000)
 #define TWL4030_FORMATS	 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE)
 
@@ -2032,6 +2058,7 @@ static struct snd_soc_dai_ops twl4030_dai_ops = {
 	.hw_params	= twl4030_hw_params,
 	.set_sysclk	= twl4030_set_dai_sysclk,
 	.set_fmt	= twl4030_set_dai_fmt,
+	.set_tristate	= twl4030_set_tristate,
 };
 
 static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
@@ -2040,6 +2067,7 @@ static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
 	.hw_params	= twl4030_voice_hw_params,
 	.set_sysclk	= twl4030_voice_set_dai_sysclk,
 	.set_fmt	= twl4030_voice_set_dai_fmt,
+	.set_tristate	= twl4030_voice_set_tristate,
 };
 
 struct snd_soc_dai twl4030_dai[] = {
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
  2009-07-03  7:21 [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice Lopez Cruz, Misael
@ 2009-07-03  8:58 ` Peter Ujfalusi
  2009-07-03 10:04   ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2009-07-03  8:58 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, ext Lopez Cruz, Misael

On Friday 03 July 2009 10:21:39 ext Lopez Cruz, Misael wrote:
> Add "set_tristate" callbacks for HiFi and Voice DAIs.
> Machine drivers can enable and disable tristate for each
> DAI with "snd_soc_dai_set_tristate" function.
>
> Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>

Thank you,

Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
  2009-07-03  8:58 ` Peter Ujfalusi
@ 2009-07-03 10:04   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2009-07-03 10:04 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: alsa-devel, ext Lopez Cruz, Misael

On Fri, Jul 03, 2009 at 11:58:20AM +0300, Peter Ujfalusi wrote:
> On Friday 03 July 2009 10:21:39 ext Lopez Cruz, Misael wrote:
> > Add "set_tristate" callbacks for HiFi and Voice DAIs.
> > Machine drivers can enable and disable tristate for each
> > DAI with "snd_soc_dai_set_tristate" function.

> > Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>

> Thank you,

> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-03 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-03  7:21 [PATCH] ASoC: TWL4030: Add tristate callbacks for HiFi and Voice Lopez Cruz, Misael
2009-07-03  8:58 ` Peter Ujfalusi
2009-07-03 10:04   ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2009-07-03  3:11 Lopez Cruz, Misael
2009-07-03  4:45 ` Peter Ujfalusi
2009-07-03  7:09   ` Lopez Cruz, Misael

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.