summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorViraj Karandikar <vkarandikar@nvidia.com>2011-05-03 11:03:56 +0530
committerYuhao Ding <yding@nvidia.com>2011-06-14 13:58:31 -0700
commit8cbceb052ae1d741b9577cbf0759af861a573cb7 (patch)
tree4b1a6d4af4af91042d59f1e1c27bf6638a4974f2 /sound
parentf90f89842113edc4b045950b5ee660ad46a033e9 (diff)
ASOC: tegra: Correct DAPM routes for Headset and Int mic
Split Headset to Headset Out and Headset In Use IN1L for Int mic and Headset (for WM8903) Remove unused variables and warning Bug 816278 Bug 830213 Bug:836150 Reviewed-on: http://git-master/r/30142 (cherry picked from commit 170ccc20d6227faaf196a920e7812792c305e2ff) Change-Id: I97a149df932c07b365eb21502be7e386c94e1c06 Reviewed-on: http://git-master/r/36077 Tested-by: Sanjay Singh Chauhan <schauhan@nvidia.com> Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_soc.h3
-rw-r--r--sound/soc/tegra/tegra_soc_controls.c8
-rw-r--r--sound/soc/tegra/tegra_soc_wm8753.c20
-rw-r--r--sound/soc/tegra/tegra_soc_wm8903.c37
4 files changed, 40 insertions, 28 deletions
diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h
index 238497aacb2c..58e12fb872ab 100644
--- a/sound/soc/tegra/tegra_soc.h
+++ b/sound/soc/tegra/tegra_soc.h
@@ -88,7 +88,8 @@
#define TEGRA_INT_MIC 0x10
#define TEGRA_EXT_MIC 0x20
#define TEGRA_LINEIN 0x40
-#define TEGRA_HEADSET 0x80
+#define TEGRA_HEADSET_OUT 0x80
+#define TEGRA_HEADSET_IN 0x100
struct tegra_dma_channel;
diff --git a/sound/soc/tegra/tegra_soc_controls.c b/sound/soc/tegra/tegra_soc_controls.c
index 138fac279f47..1e103b9d1118 100644
--- a/sound/soc/tegra/tegra_soc_controls.c
+++ b/sound/soc/tegra/tegra_soc_controls.c
@@ -35,7 +35,7 @@ static void tegra_audio_route(struct tegra_audio_data* audio_data,
if (play_device_new != audio_data->play_device) {
codec_con &= ~(TEGRA_HEADPHONE | TEGRA_LINEOUT |
- TEGRA_SPK | TEGRA_EAR_SPK | TEGRA_HEADSET);
+ TEGRA_SPK | TEGRA_EAR_SPK | TEGRA_HEADSET_OUT);
if (play_device_new & TEGRA_AUDIO_DEVICE_OUT_HEADPHONE)
codec_con |= TEGRA_HEADPHONE;
@@ -50,7 +50,7 @@ static void tegra_audio_route(struct tegra_audio_data* audio_data,
codec_con |= TEGRA_EAR_SPK;
if (play_device_new & TEGRA_AUDIO_DEVICE_OUT_HEADSET)
- codec_con |= TEGRA_HEADSET;
+ codec_con |= TEGRA_HEADSET_OUT;
tegra_ext_control(audio_data->codec, codec_con);
audio_data->play_device = play_device_new;
@@ -58,7 +58,7 @@ static void tegra_audio_route(struct tegra_audio_data* audio_data,
if (capture_device_new != audio_data->capture_device) {
codec_con &= ~(TEGRA_INT_MIC | TEGRA_EXT_MIC |
- TEGRA_LINEIN | TEGRA_HEADSET);
+ TEGRA_LINEIN | TEGRA_HEADSET_IN);
if (capture_device_new & (TEGRA_AUDIO_DEVICE_IN_BUILTIN_MIC |
TEGRA_AUDIO_DEVICE_IN_BACK_MIC))
@@ -71,7 +71,7 @@ static void tegra_audio_route(struct tegra_audio_data* audio_data,
codec_con |= TEGRA_LINEIN;
if (capture_device_new & TEGRA_AUDIO_DEVICE_IN_HEADSET)
- codec_con |= TEGRA_HEADSET;
+ codec_con |= TEGRA_HEADSET_IN;
tegra_ext_control(audio_data->codec, codec_con);
audio_data->capture_device = capture_device_new;
diff --git a/sound/soc/tegra/tegra_soc_wm8753.c b/sound/soc/tegra/tegra_soc_wm8753.c
index b285e6f82b33..b8abf99dd87b 100644
--- a/sound/soc/tegra/tegra_soc_wm8753.c
+++ b/sound/soc/tegra/tegra_soc_wm8753.c
@@ -470,10 +470,15 @@ void tegra_ext_control(struct snd_soc_codec *codec, int new_con)
else
snd_soc_dapm_disable_pin(codec, "Linein");
- if (new_con & TEGRA_HEADSET)
- snd_soc_dapm_enable_pin(codec, "Headset");
+ if (new_con & TEGRA_HEADSET_OUT)
+ snd_soc_dapm_enable_pin(codec, "Headset Out");
else
- snd_soc_dapm_disable_pin(codec, "Headset");
+ snd_soc_dapm_disable_pin(codec, "Headset Out");
+
+ if (new_con & TEGRA_HEADSET_IN)
+ snd_soc_dapm_enable_pin(codec, "Headset In");
+ else
+ snd_soc_dapm_disable_pin(codec, "Headset In");
/* signal a DAPM event */
snd_soc_dapm_sync(codec);
@@ -484,7 +489,8 @@ void tegra_ext_control(struct snd_soc_codec *codec, int new_con)
static const struct snd_soc_dapm_widget tegra_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_HP("EarPiece", NULL),
- SND_SOC_DAPM_HP("Headset", NULL),
+ SND_SOC_DAPM_HP("Headset Out", NULL),
+ SND_SOC_DAPM_MIC("Headset In", NULL),
SND_SOC_DAPM_SPK("Int Spk", NULL),
SND_SOC_DAPM_MIC("Ext Mic", NULL),
SND_SOC_DAPM_MIC("Int Mic", NULL),
@@ -503,10 +509,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"EarPiece", NULL, "LOUT2"},
/* headset Jack */
- {"Headset", NULL, "ROUT1"},
- {"Headset", NULL, "LOUT1"},
+ {"Headset Out", NULL, "ROUT1"},
+ {"Headset Out", NULL, "LOUT1"},
{"MIC1", NULL, "Mic Bias"},
- {"Mic Bias", NULL, "Headset"},
+ {"Mic Bias", NULL, "Headset In"},
/* build-in speaker */
{"Int Spk", NULL, "ROUT1"},
diff --git a/sound/soc/tegra/tegra_soc_wm8903.c b/sound/soc/tegra/tegra_soc_wm8903.c
index efad1e607e9d..1c3ed544ddd5 100644
--- a/sound/soc/tegra/tegra_soc_wm8903.c
+++ b/sound/soc/tegra/tegra_soc_wm8903.c
@@ -179,7 +179,6 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream,
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) {
int CtrlReg = 0;
int VolumeCtrlReg = 0;
- int SidetoneCtrlReg = 0;
snd_soc_write(codec, WM8903_ANALOGUE_LEFT_INPUT_0, 0X7);
snd_soc_write(codec, WM8903_ANALOGUE_RIGHT_INPUT_0, 0X7);
@@ -203,23 +202,24 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream,
VolumeCtrlReg);
snd_soc_write(codec, WM8903_ANALOGUE_RIGHT_INPUT_0,
VolumeCtrlReg);
- /* replicate mic setting on both channels */
+ /* Left ADC data on both channels */
CtrlReg = snd_soc_read(codec, WM8903_AUDIO_INTERFACE_0);
CtrlReg = SET_REG_VAL(CtrlReg, 0x1, B06_AIF_ADCR, 0x0);
CtrlReg = SET_REG_VAL(CtrlReg, 0x1, B06_AIF_ADCL, 0x0);
snd_soc_write(codec, WM8903_AUDIO_INTERFACE_0, CtrlReg);
/* Enable analog inputs */
- CtrlReg = (0x1<<B01_INL_ENA) | (0x1<<B00_INR_ENA);
+ CtrlReg = (0x1<<B01_INL_ENA);
snd_soc_write(codec, WM8903_POWER_MANAGEMENT_0, CtrlReg);
/* ADC Settings */
CtrlReg = snd_soc_read(codec, WM8903_ADC_DIGITAL_0);
CtrlReg |= (0x1<<B04_ADC_HPF_ENA);
snd_soc_write(codec, WM8903_ADC_DIGITAL_0, CtrlReg);
- SidetoneCtrlReg = 0;
- snd_soc_write(codec, R20_SIDETONE_CTRL, SidetoneCtrlReg);
+ /* Disable sidetone */
+ CtrlReg = 0;
+ snd_soc_write(codec, R20_SIDETONE_CTRL, CtrlReg);
/* Enable ADC */
CtrlReg = snd_soc_read(codec, WM8903_POWER_MANAGEMENT_6);
- CtrlReg |= (0x1<<B00_ADCR_ENA)|(0x1<<B01_ADCL_ENA);
+ CtrlReg |= (0x1<<B01_ADCL_ENA);
snd_soc_write(codec, WM8903_POWER_MANAGEMENT_6, CtrlReg);
CtrlReg = snd_soc_read(codec, R29_DRC_1);
CtrlReg |= 0x3; /*mic volume 18 db */
@@ -383,10 +383,15 @@ void tegra_ext_control(struct snd_soc_codec *codec, int new_con)
else
snd_soc_dapm_disable_pin(codec, "Linein");
- if (new_con & TEGRA_HEADSET)
- snd_soc_dapm_enable_pin(codec, "Headset");
+ if (new_con & TEGRA_HEADSET_OUT)
+ snd_soc_dapm_enable_pin(codec, "Headset Out");
else
- snd_soc_dapm_disable_pin(codec, "Headset");
+ snd_soc_dapm_disable_pin(codec, "Headset Out");
+
+ if (new_con & TEGRA_HEADSET_IN)
+ snd_soc_dapm_enable_pin(codec, "Headset In");
+ else
+ snd_soc_dapm_disable_pin(codec, "Headset In");
/* signal a DAPM event */
snd_soc_dapm_sync(codec);
@@ -448,7 +453,8 @@ static int tegra_dapm_event_ext_mic(struct snd_soc_dapm_widget* w,
/*tegra machine dapm widgets */
static const struct snd_soc_dapm_widget tegra_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
- SND_SOC_DAPM_HP("Headset", NULL),
+ SND_SOC_DAPM_HP("Headset Out", NULL),
+ SND_SOC_DAPM_MIC("Headset In", NULL),
SND_SOC_DAPM_SPK("Lineout", NULL),
SND_SOC_DAPM_SPK("Int Spk", tegra_dapm_event_int_spk),
SND_SOC_DAPM_MIC("Ext Mic", tegra_dapm_event_ext_mic),
@@ -464,10 +470,9 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"Headphone", NULL, "HPOUTL"},
/* headset Jack - in = micin, out = HPOUT*/
- {"Headset", NULL, "HPOUTR"},
- {"Headset", NULL, "HPOUTL"},
- {"IN1L", NULL, "Headset"},
- {"IN1R", NULL, "Headset"},
+ {"Headset Out", NULL, "HPOUTR"},
+ {"Headset Out", NULL, "HPOUTL"},
+ {"IN1L", NULL, "Headset In"},
/* lineout connected to LINEOUTR and LINEOUTL */
{"Lineout", NULL, "LINEOUTR"},
@@ -480,9 +485,9 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"Int Spk", NULL, "LOP"},
/* internal mic is mono */
- {"IN1R", NULL, "Int Mic"},
+ {"IN1L", NULL, "Int Mic"},
- /* external mic is stero */
+ /* external mic is stereo */
{"IN1L", NULL, "Ext Mic"},
{"IN1R", NULL, "Ext Mic"},