aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung/m3_wm1811.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/samsung/m3_wm1811.c')
-rw-r--r--sound/soc/samsung/m3_wm1811.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/sound/soc/samsung/m3_wm1811.c b/sound/soc/samsung/m3_wm1811.c
index 949f7d7..6e933c3 100644
--- a/sound/soc/samsung/m3_wm1811.c
+++ b/sound/soc/samsung/m3_wm1811.c
@@ -32,6 +32,7 @@
#include <linux/mfd/wm8994/core.h>
#include <linux/mfd/wm8994/registers.h>
#include <linux/mfd/wm8994/pdata.h>
+#include <linux/mfd/wm8994/gpio.h>
#if defined(CONFIG_SND_USE_MUIC_SWITCH)
#include <linux/mfd/max77693-private.h>
@@ -338,7 +339,7 @@ static void m3_micd_set_rate(struct snd_soc_codec *codec)
WM8958_MICD_RATE_MASK, val);
}
-static void m3_micdet(u16 status, void *data)
+static void m3_mic_id(void *data, u16 status)
{
struct wm1811_machine_priv *wm1811 = data;
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(wm1811->codec);
@@ -414,25 +415,6 @@ static void m3_micdet(u16 status, void *data)
}
}
}
-
- /* Report short circuit as a button */
- if (wm8994->jack_mic) {
- report = 0;
- if (status & WM1811_JACKDET_BTN0)
- report |= SND_JACK_BTN_0;
-
- if (status & WM1811_JACKDET_BTN1)
- report |= SND_JACK_BTN_1;
-
- if (status & WM1811_JACKDET_BTN2)
- report |= SND_JACK_BTN_2;
-
- dev_dbg(wm1811->codec->dev, "Detected Button: %08x (%08X)\n",
- report, status);
-
- snd_soc_jack_report(wm8994->micdet[0].jack, report,
- wm8994->btn_mask);
- }
}
static int m3_wm1811_aif1_hw_params(struct snd_pcm_substream *substream,
@@ -915,12 +897,12 @@ static int m3_wm1811_init_paiftx(struct snd_soc_pcm_runtime *rtd)
dev_err(codec->dev, "Failed to set KEY_MEDIA: %d\n", ret);
ret = snd_jack_set_key(wm1811->jack.jack, SND_JACK_BTN_1,
- KEY_VOLUMEDOWN);
+ KEY_VOLUMEUP);
if (ret < 0)
dev_err(codec->dev, "Failed to set KEY_VOLUMEUP: %d\n", ret);
ret = snd_jack_set_key(wm1811->jack.jack, SND_JACK_BTN_2,
- KEY_VOLUMEUP);
+ KEY_VOLUMEDOWN);
if (ret < 0)
dev_err(codec->dev, "Failed to set KEY_VOLUMEDOWN: %d\n", ret);
@@ -928,8 +910,8 @@ static int m3_wm1811_init_paiftx(struct snd_soc_pcm_runtime *rtd)
if (wm8994->revision > 1) {
dev_info(codec->dev, "wm1811: Rev %c support mic detection\n",
'A' + wm8994->revision);
- ret = wm8958_mic_detect(codec, &wm1811->jack, m3_micdet,
- wm1811);
+ ret = wm8958_mic_detect(codec, &wm1811->jack, NULL,
+ NULL, m3_mic_id, wm1811);
if (ret < 0)
dev_err(codec->dev, "Failed start detection: %d\n",
@@ -1131,6 +1113,7 @@ static int m3_card_resume_post(struct snd_soc_card *card)
{
struct snd_soc_codec *codec = card->rtd->codec;
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
+ int reg = 0;
#ifdef CONFIG_SND_USE_LINEOUT_SWITCH
if (lineout_mode == 1 &&
@@ -1141,6 +1124,11 @@ static int m3_card_resume_post(struct snd_soc_card *card)
gpio_set_value(GPIO_VPS_SOUND_EN, 1);
}
#endif
+ reg = snd_soc_read(codec, WM8994_GPIO_1);
+ if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_IRQ) {
+ dev_err(codec->dev, "%s: GPIO1 type 0x%x\n", __func__, reg);
+ snd_soc_write(codec, WM8994_GPIO_1, WM8994_GP_FN_IRQ);
+ }
#ifdef CONFIG_SEC_DEV_JACK
snd_soc_dapm_force_enable_pin(&codec->dapm, "AIF1CLK");
#endif