Commit 68140443 authored by Lopez Cruz, Misael's avatar Lopez Cruz, Misael Committed by Mark Brown

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: default avatarMisael Lopez Cruz <x0052729@ti.com>
Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 1b6ebdd7
...@@ -1849,6 +1849,19 @@ static int twl4030_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -1849,6 +1849,19 @@ static int twl4030_set_dai_fmt(struct snd_soc_dai *codec_dai,
return 0; 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 /* 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. */ * (VTXL, VTXR) for uplink has to be enabled/disabled. */
static void twl4030_voice_enable(struct snd_soc_codec *codec, int direction, 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, ...@@ -2023,6 +2036,19 @@ static int twl4030_voice_set_dai_fmt(struct snd_soc_dai *codec_dai,
return 0; 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_RATES (SNDRV_PCM_RATE_8000_48000)
#define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE) #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 = { ...@@ -2032,6 +2058,7 @@ static struct snd_soc_dai_ops twl4030_dai_ops = {
.hw_params = twl4030_hw_params, .hw_params = twl4030_hw_params,
.set_sysclk = twl4030_set_dai_sysclk, .set_sysclk = twl4030_set_dai_sysclk,
.set_fmt = twl4030_set_dai_fmt, .set_fmt = twl4030_set_dai_fmt,
.set_tristate = twl4030_set_tristate,
}; };
static struct snd_soc_dai_ops twl4030_dai_voice_ops = { static struct snd_soc_dai_ops twl4030_dai_voice_ops = {
...@@ -2040,6 +2067,7 @@ 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, .hw_params = twl4030_voice_hw_params,
.set_sysclk = twl4030_voice_set_dai_sysclk, .set_sysclk = twl4030_voice_set_dai_sysclk,
.set_fmt = twl4030_voice_set_dai_fmt, .set_fmt = twl4030_voice_set_dai_fmt,
.set_tristate = twl4030_voice_set_tristate,
}; };
struct snd_soc_dai twl4030_dai[] = { struct snd_soc_dai twl4030_dai[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment