Skip to content

Commit a0c472c

Browse files
Olof Johanssonhsnaves
authored andcommitted
CHROMIUM: ASoC: samsung: HP detect plumbing for snow
This adds HP detect through the external GPIO on Snow. I've hardcoded the GPIO for now since we need to move the whole ASoC configuration to device tree (a la tegra) and will move it to a proper gpio specifier there when we do so. BUG=none TEST=start up, browse youtube, bring up an awesome music video, plug in headphones, rock out. Change-Id: I9b7d1452f43f68f1e17bc8868f1d9c56d09db87b Signed-off-by: Olof Johansson <olofj@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27866 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
1 parent 616cd75 commit a0c472c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sound/soc/samsung/daisy_max98095.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <sound/jack.h>
3131
#include <sound/max98095.h>
3232

33+
#include <mach/gpio.h>
3334

3435
#include "i2s.h"
3536
#include "s3c-i2s-v2.h"
@@ -183,6 +184,19 @@ static struct snd_soc_ops daisy_ops = {
183184
.hw_params = daisy_hw_params,
184185
};
185186

187+
static struct snd_soc_jack daisy_hp_jack;
188+
static struct snd_soc_jack_pin daisy_hp_jack_pins[] = {
189+
{
190+
.pin = "Headphone Jack",
191+
.mask = SND_JACK_HEADPHONE,
192+
},
193+
};
194+
195+
static struct snd_soc_jack_gpio daisy_hp_jack_gpio = {
196+
.name = "headphone detect",
197+
.report = SND_JACK_HEADPHONE,
198+
};
199+
186200
static struct snd_soc_jack daisy_mic_jack;
187201
static struct snd_soc_jack_pin daisy_mic_jack_pins[] = {
188202
{
@@ -198,6 +212,7 @@ static const struct snd_soc_dapm_route daisy_audio_map[] = {
198212

199213
static const struct snd_soc_dapm_widget daisy_dapm_widgets[] = {
200214
SND_SOC_DAPM_MIC("Mic Jack", NULL),
215+
SND_SOC_DAPM_HP("Headphone Jack", NULL),
201216
};
202217

203218
static int daisy_init(struct snd_soc_pcm_runtime *rtd)
@@ -216,6 +231,17 @@ static int daisy_init(struct snd_soc_pcm_runtime *rtd)
216231
ARRAY_SIZE(daisy_mic_jack_pins),
217232
daisy_mic_jack_pins);
218233

234+
/* TODO: Move this to device tree */
235+
if (of_machine_is_compatible("google,snow")) {
236+
daisy_hp_jack_gpio.gpio = EXYNOS5_GPX2(2);
237+
snd_soc_jack_new(codec, "Headphone Jack",
238+
SND_JACK_HEADPHONE, &daisy_hp_jack);
239+
snd_soc_jack_add_pins(&daisy_hp_jack,
240+
ARRAY_SIZE(daisy_hp_jack_pins),
241+
daisy_hp_jack_pins);
242+
snd_soc_jack_add_gpios(&daisy_hp_jack, 1, &daisy_hp_jack_gpio);
243+
}
244+
219245
/* Microphone BIAS is needed to power the analog mic.
220246
* MICBIAS2 is connected to analog mic (MIC3, which is in turn
221247
* connected to MIC2 via 'External MIC') on Daisy.

0 commit comments

Comments
 (0)