aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/midas-sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-exynos/midas-sound.c')
-rw-r--r--arch/arm/mach-exynos/midas-sound.c91
1 files changed, 89 insertions, 2 deletions
diff --git a/arch/arm/mach-exynos/midas-sound.c b/arch/arm/mach-exynos/midas-sound.c
index 32ab866..98d1fed 100644
--- a/arch/arm/mach-exynos/midas-sound.c
+++ b/arch/arm/mach-exynos/midas-sound.c
@@ -50,6 +50,12 @@
#include <linux/i2c/si47xx_common.h>
#endif
+#ifdef CONFIG_EXYNOS_SOUND_PLATFORM_DATA
+#include <linux/exynos_audio.h>
+#endif
+#ifdef CONFIG_USE_ADC_DET
+#include <linux/sec_jack.h>
+#endif
#ifdef CONFIG_AUDIENCE_ES305
#include <linux/i2c/es305.h>
@@ -80,6 +86,56 @@ struct si47xx_info {
#define SET_PLATDATA_CODEC(i2c_pd) s3c_i2c4_set_platdata(i2c_pd)
#endif
+#ifdef CONFIG_USE_ADC_DET
+static struct jack_zone midas_jack_zones[] = {
+ {
+ /* adc == 0, unstable zone, default to 3pole if it stays
+ * in this range for 100ms (10ms delays, 10 samples)
+ */
+ .adc_high = 0,
+ .delay_ms = 10,
+ .check_count = 10,
+ .jack_type = SEC_HEADSET_3POLE,
+ },
+ {
+ /* 0 < adc <= 1200, unstable zone, default to 3pole if it stays
+ * in this range for 100ms (10ms delays, 10 samples)
+ */
+ .adc_high = 1200,
+ .delay_ms = 10,
+ .check_count = 10,
+ .jack_type = SEC_HEADSET_3POLE,
+ },
+ {
+ /* 1200 < adc <= 2600, unstable zone, default to 4pole if it
+ * stays in this range for 100ms (10ms delays, 10 samples)
+ */
+ .adc_high = 2600,
+ .delay_ms = 10,
+ .check_count = 10,
+ .jack_type = SEC_HEADSET_4POLE,
+ },
+ {
+ /* 2600 < adc <= 3800, 4 pole zone, default to 4pole if it
+ * stays in this range for 50ms (10ms delays, 5 samples)
+ */
+ .adc_high = 3800,
+ .delay_ms = 10,
+ .check_count = 5,
+ .jack_type = SEC_HEADSET_4POLE,
+ },
+ {
+ /* adc > 3800, unstable zone, default to 3pole if it stays
+ * in this range for two seconds (10ms delays, 200 samples)
+ */
+ .adc_high = 0x7fffffff,
+ .delay_ms = 10,
+ .check_count = 200,
+ .jack_type = SEC_HEADSET_3POLE,
+ },
+};
+#endif
+
static DEFINE_SPINLOCK(midas_snd_spinlock);
void midas_snd_set_mclk(bool on, bool forced)
@@ -205,7 +261,7 @@ static struct wm8994_drc_cfg drc_value[] = {
.regs[4] = 0x0000,
},
#endif
-#if defined(CONFIG_MACH_P4NOTE)
+#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_KONA)
{
.name = "cam rec DRC",
.regs[0] = 0x019B,
@@ -253,6 +309,8 @@ static struct wm8994_pdata wm1811_pdata = {
.micbias = {0x22, 0x22},
#elif defined(CONFIG_MACH_C1_USA_ATT)
.micbias = {0x2f, 0x29},
+#elif defined(CONFIG_MACH_KONA)
+ .micbias = {0x2f, 0x2f},
#else
.micbias = {0x2f, 0x27},
#endif
@@ -273,7 +331,8 @@ static struct wm8994_pdata wm1811_pdata = {
defined(CONFIG_MACH_C1_KOR_KT) || defined(CONFIG_MACH_C1_KOR_LGT) || \
defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_GC1) || \
defined(CONFIG_MACH_C1_USA_ATT) || defined(CONFIG_MACH_T0) || \
- defined(CONFIG_MACH_M3) || defined(CONFIG_MACH_BAFFIN)
+ defined(CONFIG_MACH_M3) || defined(CONFIG_MACH_BAFFIN) || \
+ defined(CONFIG_MACH_KONA)
.lineout2fb = 0,
#else
.lineout2fb = 1,
@@ -435,6 +494,15 @@ static struct i2c_board_info i2c_2mic[] __initdata = {
};
#endif
+#ifdef CONFIG_EXYNOS_SOUND_PLATFORM_DATA
+struct exynos_sound_platform_data midas_sound_pdata __initdata = {
+#ifdef CONFIG_USE_ADC_DET
+ .zones = midas_jack_zones,
+ .num_zones = ARRAY_SIZE(midas_jack_zones),
+#endif
+};
+#endif
+
static struct platform_device *midas_sound_devices[] __initdata = {
#if defined(CONFIG_MACH_C1_KOR_LGT)
#ifdef CONFIG_FM34_WE395
@@ -451,11 +519,25 @@ static struct platform_device *midas_sound_devices[] __initdata = {
void __init midas_sound_init(void)
{
printk(KERN_INFO "Sound: start %s\n", __func__);
+
+#ifdef CONFIG_USE_ADC_DET
+#if defined(CONFIG_MACH_KONA)
+ midas_sound_pdata.use_jackdet_type = 1;
+#else
+ midas_sound_pdata.use_jackdet_type = 0;
+#endif
+#endif
m0_gpio_init();
platform_add_devices(midas_sound_devices,
ARRAY_SIZE(midas_sound_devices));
+
+#ifdef CONFIG_EXYNOS_SOUND_PLATFORM_DATA
+ pr_info("%s: set sound platform data for midas device\n", __func__);
+ if (exynos_sound_set_platform_data(&midas_sound_pdata))
+ pr_err("%s: failed to register sound pdata\n", __func__);
+#endif
#ifdef CONFIG_ARCH_EXYNOS5
#ifndef CONFIG_MACH_P10_LTE_00_BD
@@ -476,6 +558,11 @@ void __init midas_sound_init(void)
i2c_register_board_info(I2C_NUM_CODEC, i2c_wm1811,
ARRAY_SIZE(i2c_wm1811));
+#elif defined(CONFIG_MACH_KONA)
+ SET_PLATDATA_CODEC(NULL);
+ i2c_register_board_info(I2C_NUM_CODEC, i2c_wm1811,
+ ARRAY_SIZE(i2c_wm1811));
+
#else
if (system_rev != 3 && system_rev >= 0) {
SET_PLATDATA_CODEC(NULL);