summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorViraj Karandikar <vkarandikar@nvidia.com>2011-07-01 17:20:58 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-07-08 22:54:31 -0700
commit80443399b8ffa896d465f3304d0317aa83743ac1 (patch)
tree96f4248065d7b2b584bdfa7133cada304064eac0 /sound
parent6e481f8f1cb49d7600fc5bd4e0f4fdb86d5ca221 (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 846205 Reviewed-on: http://git-master/r/30142 Tested-by: Viraj Karandikar <vkarandikar@nvidia.com> Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com> Reviewed-by: Manjula Gupta <magupta@nvidia.com> Tested-by: Anssi Kalliolahti <akalliolahti@nvidia.com> Reviewed-by: Vijay Mali <vmali@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com> (cherry picked from commit 170ccc20d6227faaf196a920e7812792c305e2ff) Change-Id: Iccf1736c4ba0d273c3c832d563374fc0afc63616 Reviewed-on: http://git-master/r/39374 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@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_max98088.c18
-rw-r--r--sound/soc/tegra/tegra_soc_wm8753.c20
-rw-r--r--sound/soc/tegra/tegra_soc_wm8903.c44
5 files changed, 51 insertions, 42 deletions
diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h
index 361cbc79c3ee..45726cbde45a 100644
--- a/sound/soc/tegra/tegra_soc.h
+++ b/sound/soc/tegra/tegra_soc.h
@@ -85,7 +85,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 90e8679d4dec..180b4a88a856 100644
--- a/sound/soc/tegra/tegra_soc_controls.c
+++ b/sound/soc/tegra/tegra_soc_controls.c
@@ -37,7 +37,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;
@@ -52,7 +52,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;
@@ -60,7 +60,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))
@@ -73,7 +73,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_max98088.c b/sound/soc/tegra/tegra_soc_max98088.c
index 02b6992933fc..03b1f466359b 100644
--- a/sound/soc/tegra/tegra_soc_max98088.c
+++ b/sound/soc/tegra/tegra_soc_max98088.c
@@ -266,10 +266,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");
audio_data->codec_con = new_con;
@@ -334,7 +339,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),
@@ -348,8 +354,8 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"Headphone", NULL, "HPR"},
/* Headset connected to HPL and HPR */
- {"Headset", NULL, "HPL"},
- {"Headset", NULL, "HPR"},
+ {"Headset Out", NULL, "HPL"},
+ {"Headset Out", NULL, "HPR"},
/* Speaker connected to SPKL and SPKR */
{"Int Spk", NULL, "SPKL"},
diff --git a/sound/soc/tegra/tegra_soc_wm8753.c b/sound/soc/tegra/tegra_soc_wm8753.c
index 85647bca9b9e..0e33b09b4fa7 100644
--- a/sound/soc/tegra/tegra_soc_wm8753.c
+++ b/sound/soc/tegra/tegra_soc_wm8753.c
@@ -471,10 +471,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);
@@ -485,7 +490,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),
@@ -504,10 +510,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 f871a814e339..4aeb4418f411 100644
--- a/sound/soc/tegra/tegra_soc_wm8903.c
+++ b/sound/soc/tegra/tegra_soc_wm8903.c
@@ -63,7 +63,6 @@ extern struct wired_jack_conf tegra_wired_jack_conf;
#define ADC_DIGITAL_VOL_9DB 0x1D8
#define ADC_DIGITAL_VOL_12DB 0x1E0
#define ADC_ANALOG_VOLUME 0x1C
-#define DRC_MAX_36DB 0x03
#define SET_REG_VAL(r,m,l,v) (((r)&(~((m)<<(l))))|(((v)&(m))<<(l)))
@@ -128,11 +127,11 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream,
int CtrlReg = 0;
int VolumeCtrlReg = 0;
int SidetoneCtrlReg = 0;
- int SideToneAtenuation = 0;
/* Mic Bias enable */
CtrlReg = MICBIAS_ENA | MICDET_ENA;
snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0, CtrlReg);
+
/* Enable DRC */
CtrlReg = snd_soc_read(codec, WM8903_DRC_0);
CtrlReg |= WM8903_DRC_ENA;
@@ -151,20 +150,12 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream,
CtrlReg |= WM8903_ADC_HPF_ENA;
snd_soc_write(codec, WM8903_ADC_DIGITAL_0, CtrlReg);
+ /* Disable sidetone */
SidetoneCtrlReg = 0;
snd_soc_write(codec, WM8903_DAC_DIGITAL_0, SidetoneCtrlReg);
- SideToneAtenuation = 12 ;
-
- CtrlReg = snd_soc_read(codec, WM8903_DRC_1);
- CtrlReg |= DRC_MAX_36DB;
- snd_soc_write(codec, WM8903_DRC_1, CtrlReg);
-
#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
- snd_soc_write(codec, WM8903_ANALOGUE_LEFT_INPUT_0, 0X7);
- snd_soc_write(codec, WM8903_ANALOGUE_RIGHT_INPUT_0, 0X7);
-
/* Single Ended Mic */
CtrlReg = CM_DISABLED |
SINGLE_ENDED_MODE | IN1L_SEL_N | IN2L_SEL_P;
@@ -172,21 +163,21 @@ static int tegra_hifi_hw_params(struct snd_pcm_substream *substream,
snd_soc_write(codec, WM8903_ANALOGUE_LEFT_INPUT_1, CtrlReg);
snd_soc_write(codec, WM8903_ANALOGUE_RIGHT_INPUT_1, CtrlReg);
- /* replicate mic setting on both channels */
+ /* Duplicate 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 = INL_ENA | INR_ENA;
+ CtrlReg = INL_ENA;
snd_soc_write(codec, WM8903_POWER_MANAGEMENT_0, CtrlReg);
/* Enable ADC */
CtrlReg = snd_soc_read(codec, WM8903_POWER_MANAGEMENT_6);
- CtrlReg |= ADCR_ENA| ADCL_ENA;
+ CtrlReg |= ADCL_ENA;
snd_soc_write(codec, WM8903_POWER_MANAGEMENT_6, CtrlReg);
-#else
+#else
/* Enabling Digital mic as default*/
/* Set GP1_FN as DMIC_LR */
@@ -363,10 +354,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 Out");
+
+ if (new_con & TEGRA_HEADSET_IN)
+ snd_soc_dapm_enable_pin(codec, "Headset In");
else
- snd_soc_dapm_disable_pin(codec, "Headset");
+ snd_soc_dapm_disable_pin(codec, "Headset In");
audio_data->codec_con = new_con;
@@ -430,7 +426,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),
@@ -446,10 +443,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"},
@@ -462,7 +458,7 @@ 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 */
{"IN1L", NULL, "Ext Mic"},