aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLopez Cruz, Misael <x0052729@ti.com>2009-07-03 03:21:39 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-07-03 06:01:05 -0400
commit6814044324e745e7c55aaf4bd47bdfd9a51d842a (patch)
tree2360bf2ff173ce77f2894e02ea86df5c80937ef4 /sound
parent1b6ebdd7bbdb3fdcab82c8056dbae0c23dbaaf4d (diff)
ASoC: TWL4030: Add tristate callbacks for HiFi and Voice
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> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/twl4030.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 6da94cadd157..818fb37bd7f7 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,
1849 return 0; 1849 return 0;
1850} 1850}
1851 1851
1852static int twl4030_set_tristate(struct snd_soc_dai *dai, int tristate)
1853{
1854 struct snd_soc_codec *codec = dai->codec;
1855 u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_AUDIO_IF);
1856
1857 if (tristate)
1858 reg |= TWL4030_AIF_TRI_EN;
1859 else
1860 reg &= ~TWL4030_AIF_TRI_EN;
1861
1862 return twl4030_write(codec, TWL4030_REG_AUDIO_IF, reg);
1863}
1864
1852/* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R 1865/* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R
1853 * (VTXL, VTXR) for uplink has to be enabled/disabled. */ 1866 * (VTXL, VTXR) for uplink has to be enabled/disabled. */
1854static void twl4030_voice_enable(struct snd_soc_codec *codec, int direction, 1867static 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,
2023 return 0; 2036 return 0;
2024} 2037}
2025 2038
2039static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate)
2040{
2041 struct snd_soc_codec *codec = dai->codec;
2042 u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_VOICE_IF);
2043
2044 if (tristate)
2045 reg |= TWL4030_VIF_TRI_EN;
2046 else
2047 reg &= ~TWL4030_VIF_TRI_EN;
2048
2049 return twl4030_write(codec, TWL4030_REG_VOICE_IF, reg);
2050}
2051
2026#define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000) 2052#define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000)
2027#define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE) 2053#define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE)
2028 2054
@@ -2032,6 +2058,7 @@ static struct snd_soc_dai_ops twl4030_dai_ops = {
2032 .hw_params = twl4030_hw_params, 2058 .hw_params = twl4030_hw_params,
2033 .set_sysclk = twl4030_set_dai_sysclk, 2059 .set_sysclk = twl4030_set_dai_sysclk,
2034 .set_fmt = twl4030_set_dai_fmt, 2060 .set_fmt = twl4030_set_dai_fmt,
2061 .set_tristate = twl4030_set_tristate,
2035}; 2062};
2036 2063
2037static struct snd_soc_dai_ops twl4030_dai_voice_ops = { 2064static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
@@ -2040,6 +2067,7 @@ static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
2040 .hw_params = twl4030_voice_hw_params, 2067 .hw_params = twl4030_voice_hw_params,
2041 .set_sysclk = twl4030_voice_set_dai_sysclk, 2068 .set_sysclk = twl4030_voice_set_dai_sysclk,
2042 .set_fmt = twl4030_voice_set_dai_fmt, 2069 .set_fmt = twl4030_voice_set_dai_fmt,
2070 .set_tristate = twl4030_voice_set_tristate,
2043}; 2071};
2044 2072
2045struct snd_soc_dai twl4030_dai[] = { 2073struct snd_soc_dai twl4030_dai[] = {