aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Dodd <atd7@cornell.edu>2012-03-25 06:22:26 -0400
committersbrissen <sbrissen@hotmail.com>2014-05-12 07:49:47 -0400
commit969b384e73c87b21b2f50c0c750e7fcf6d1e0fc0 (patch)
tree4b2bcc0d0f04712dc5f85cce1f5cf4270ea4abb9
parenteba4e205b4e3d82ab8dd6bb6855d51d4f214e153 (diff)
downloadkernel_samsung_smdk4412-969b384e73c87b21b2f50c0c750e7fcf6d1e0fc0.zip
kernel_samsung_smdk4412-969b384e73c87b21b2f50c0c750e7fcf6d1e0fc0.tar.gz
kernel_samsung_smdk4412-969b384e73c87b21b2f50c0c750e7fcf6d1e0fc0.tar.bz2
mc1n2: Allow swapping of microphone ADC channels
The SGH-I777 libaudio has the configuration for ADC0[0] and ADC0[1] swapped. When using GT-I9100 libaudio, this results in the microphones being improperly swapped between the main mic and the NR mic near the earpiece. This patch allows the mic channels to be swapped within the driver to deal with incompatible libaudio. It is configurable via CONFIG_SND_SOC_MC1N2_MIC_ADC_SWAP in the defconfig in case the SGH-I777 libaudio becomes available. Change-Id: Id5738369f3614c6ccf710ac02ae96ee65eb4398b
-rw-r--r--sound/soc/codecs/mc1n2/Kconfig10
-rw-r--r--sound/soc/codecs/mc1n2/mcdriver.c23
2 files changed, 31 insertions, 2 deletions
diff --git a/sound/soc/codecs/mc1n2/Kconfig b/sound/soc/codecs/mc1n2/Kconfig
index 2b521c1..91977ee 100644
--- a/sound/soc/codecs/mc1n2/Kconfig
+++ b/sound/soc/codecs/mc1n2/Kconfig
@@ -10,3 +10,13 @@ config SND_SOC_MC1N2_DEBUG
bool "MC-1N2 verbose debug messages while core driver call"
select SND_DEBUG
depends on SND_SOC_MC1N2
+
+config SND_SOC_MC1N2_MIC_ADC_SWAP
+ bool "MC-1N2 Swap microphone ADCs"
+ depends on TARGET_LOCALE_NAATT_TEMP
+ default n
+ help
+ SGH-I777 microphone configuration is swapped compared to GT-I9100.
+ When using I9100 libaudio, this causes the microphones to not
+ work properly in calls. This allows proper microphone operation
+ when SGH-I777 is used with GT-I9100 libaudio.
diff --git a/sound/soc/codecs/mc1n2/mcdriver.c b/sound/soc/codecs/mc1n2/mcdriver.c
index af3cdc3..417d2ba 100644
--- a/sound/soc/codecs/mc1n2/mcdriver.c
+++ b/sound/soc/codecs/mc1n2/mcdriver.c
@@ -37,7 +37,7 @@ static SINT32 update_clock (const MCDRV_CLOCK_INFO* psClockInfo);
static SINT32 switch_clock (const MCDRV_CLKSW_INFO* psClockInfo);
static SINT32 get_path (MCDRV_PATH_INFO* psPathInfo);
-static SINT32 set_path (const MCDRV_PATH_INFO* psPathInfo);
+static SINT32 set_path (MCDRV_PATH_INFO* psPathInfo);
static SINT32 get_volume (MCDRV_VOL_INFO* psVolInfo);
static SINT32 set_volume (const MCDRV_VOL_INFO *psVolInfo);
@@ -762,6 +762,17 @@ static SINT32 switch_clock
return McDevIf_ExecutePacket();
}
+#ifdef CONFIG_SND_SOC_MC1N2_MIC_ADC_SWAP
+void swap_mic_adc_paths(MCDRV_PATH_INFO* psPathInfo)
+{
+ UINT8 temp_state;
+
+ temp_state = psPathInfo->asAdc0[0].abSrcOnOff[0];
+ psPathInfo->asAdc0[0].abSrcOnOff[0] = psPathInfo->asAdc0[1].abSrcOnOff[0];
+ psPathInfo->asAdc0[1].abSrcOnOff[0] = temp_state;
+}
+#endif
+
/****************************************************************************
* get_path
*
@@ -791,6 +802,10 @@ static SINT32 get_path
McResCtrl_GetPathInfoVirtual(psPathInfo);
+#ifdef CONFIG_SND_SOC_MC1N2_MIC_ADC_SWAP
+ swap_mic_adc_paths(psPathInfo);
+#endif
+
return MCDRV_SUCCESS;
}
@@ -809,7 +824,7 @@ static SINT32 get_path
****************************************************************************/
static SINT32 set_path
(
- const MCDRV_PATH_INFO* psPathInfo
+ MCDRV_PATH_INFO* psPathInfo
)
{
SINT32 sdRet = MCDRV_SUCCESS;
@@ -836,6 +851,10 @@ static SINT32 set_path
return sdRet;
}
+#ifdef CONFIG_SND_SOC_MC1N2_MIC_ADC_SWAP
+ swap_mic_adc_paths(psPathInfo);
+#endif
+
McResCtrl_SetPathInfo(psPathInfo);
/* unused analog out volume mute */