diff options
author | H. Nikolaus Schaller <hns@goldelico.com> | 2013-11-13 16:52:26 +0100 |
---|---|---|
committer | H. Nikolaus Schaller <hns@goldelico.com> | 2013-11-13 16:52:26 +0100 |
commit | 316efe6de49c64b5abccb5a42629dbabf984c702 (patch) | |
tree | 785c305e308f74107afa0c72a0ad2e48ccf94156 /sound | |
parent | b99c8aca196e085eb394e2876b40f75153cb0461 (diff) | |
download | kernel_goldelico_gta04-316efe6de49c64b5abccb5a42629dbabf984c702.zip kernel_goldelico_gta04-316efe6de49c64b5abccb5a42629dbabf984c702.tar.gz kernel_goldelico_gta04-316efe6de49c64b5abccb5a42629dbabf984c702.tar.bz2 |
use twl4030_voice_set_tristate() for tristating the TWL4030 voice PCM
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 8fe46fb..acc66dd 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -162,6 +162,8 @@ struct twl4030_priv { struct twl4030_codec_data *pdata; }; +static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate); + static void twl4030_voice_enable(struct snd_soc_codec *codec, int direction, int enable); /* @@ -446,14 +448,16 @@ static void twl4030_init_chip(struct snd_soc_codec *codec) twl4030_write_reg_cache(codec, TWL4030_REG_ANAMICL, byte); twl4030_codec_enable(codec, 0); - twl4030_write(codec, - TWL4030_VIF_TRI_EN, - TWL4030_REG_VOICE_IF); + { + struct snd_soc_dai dai = { + .codec = codec + }; + twl4030_voice_set_tristate(&dai, 1); + } twl4030_voice_enable(codec, SNDRV_PCM_STREAM_PLAYBACK, 1); twl4030_voice_enable(codec, SNDRV_PCM_STREAM_CAPTURE, 1); printk("TPS Voice IF is tristated\n"); - twl4030_codec_enable(codec, 1); } @@ -956,7 +960,7 @@ static int voice_input_event(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMD: dev_dbg(w->codec->dev, "GSMIN power down"); - break; + break; } return 0; } @@ -972,7 +976,7 @@ static int voice_output_event(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMD: dev_dbg(w->codec->dev, "GSMOUT power down"); - break; + break; } return 0; } @@ -1217,6 +1221,8 @@ static int twl4030_voice_route_get(struct snd_kcontrol *kcontrol, return 0; } +static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate); + static int twl4030_voice_route_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { @@ -1224,27 +1230,33 @@ static int twl4030_voice_route_put(struct snd_kcontrol *kcontrol, struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); dev_dbg(codec->dev, "voice ctl route: %u\n", ucontrol->value.enumerated.item[0]); - if (ucontrol->value.enumerated.item[0] != twl4030->voice_enabled) { + printk("voice ctl route: %u\n", ucontrol->value.enumerated.item[0]); + if (ucontrol->value.enumerated.item[0] != twl4030->voice_enabled) { int powered = twl4030->codec_powered; + struct snd_soc_dai dai = { + .codec = codec + }; twl4030->voice_enabled = ucontrol->value.enumerated.item[0]; - if (powered) + if (powered) twl4030_codec_enable(codec, 0); - + if (twl4030->voice_enabled) { - /* - * need to find a better place for this, + /* + * need to find a better place for this, * disables mcbsp4_dx, so that it can be used by * the twl4030_codec */ + /* set McBSP4-DX to tristate (safe mode) */ omap_mux_set_gpio(OMAP_MUX_MODE7, 154); - twl4030_write(codec, TWL4030_REG_VOICE_IF, + twl4030_voice_set_tristate(&dai, 0); +/* twl4030_write(codec, TWL4030_REG_VOICE_IF, TWL4030_VIF_SLAVE_EN | TWL4030_VIF_DIN_EN | TWL4030_VIF_DOUT_EN | TWL4030_VIF_EN); + */ } else { - twl4030_write(codec, TWL4030_REG_VOICE_IF, - TWL4030_VIF_TRI_EN); - /* - * need to find a better place for this, + twl4030_voice_set_tristate(&dai, 1); + /* + * need to find a better place for this, * enables mcbsp4_dx, so that it can be used by * the mcbsp4 interface */ @@ -1252,7 +1264,7 @@ static int twl4030_voice_route_put(struct snd_kcontrol *kcontrol, } if (powered) twl4030_codec_enable(codec, 1); - return 1; + return 1; } return 0; } @@ -2354,7 +2366,7 @@ 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); - printk("twl4030_voice_set_tristate codec=%p\n", codec); + printk("twl4030_voice_set_tristate codec=%p %d\n", codec, tristate); if (tristate) reg |= TWL4030_VIF_TRI_EN; |