diff options
author | Stephen Warren <swarren@nvidia.com> | 2011-02-03 15:56:13 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-02-09 07:10:53 -0500 |
commit | f7d3e403d7de06f8a42a7f34950ae972547c6d59 (patch) | |
tree | 1c88ae339f936e96a998d78d5ccf32da887809f9 /sound/soc/tegra/harmony.c | |
parent | 46fdaa3bec1bcaa36759b1f5e5e27245ae465b8f (diff) |
ASoC: Tegra: Harmony: Add headphone jack detection
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/tegra/harmony.c')
-rw-r--r-- | sound/soc/tegra/harmony.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c index 11e2cb825664..fcd316e1c94f 100644 --- a/sound/soc/tegra/harmony.c +++ b/sound/soc/tegra/harmony.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <mach/harmony_audio.h> | 38 | #include <mach/harmony_audio.h> |
39 | 39 | ||
40 | #include <sound/core.h> | 40 | #include <sound/core.h> |
41 | #include <sound/jack.h> | ||
41 | #include <sound/pcm.h> | 42 | #include <sound/pcm.h> |
42 | #include <sound/pcm_params.h> | 43 | #include <sound/pcm_params.h> |
43 | #include <sound/soc.h> | 44 | #include <sound/soc.h> |
@@ -123,6 +124,24 @@ static struct snd_soc_ops harmony_asoc_ops = { | |||
123 | .hw_params = harmony_asoc_hw_params, | 124 | .hw_params = harmony_asoc_hw_params, |
124 | }; | 125 | }; |
125 | 126 | ||
127 | static struct snd_soc_jack harmony_hp_jack; | ||
128 | |||
129 | static struct snd_soc_jack_pin harmony_hp_jack_pins[] = { | ||
130 | { | ||
131 | .pin = "Headphone Jack", | ||
132 | .mask = SND_JACK_HEADPHONE, | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | static struct snd_soc_jack_gpio harmony_hp_jack_gpios[] = { | ||
137 | { | ||
138 | .name = "headphone detect", | ||
139 | .report = SND_JACK_HEADPHONE, | ||
140 | .debounce_time = 150, | ||
141 | .invert = 1, | ||
142 | } | ||
143 | }; | ||
144 | |||
126 | static int harmony_event_int_spk(struct snd_soc_dapm_widget *w, | 145 | static int harmony_event_int_spk(struct snd_soc_dapm_widget *w, |
127 | struct snd_kcontrol *k, int event) | 146 | struct snd_kcontrol *k, int event) |
128 | { | 147 | { |
@@ -178,11 +197,20 @@ static int harmony_asoc_init(struct snd_soc_pcm_runtime *rtd) | |||
178 | snd_soc_dapm_add_routes(dapm, harmony_audio_map, | 197 | snd_soc_dapm_add_routes(dapm, harmony_audio_map, |
179 | ARRAY_SIZE(harmony_audio_map)); | 198 | ARRAY_SIZE(harmony_audio_map)); |
180 | 199 | ||
181 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); | ||
182 | snd_soc_dapm_enable_pin(dapm, "Int Spk"); | 200 | snd_soc_dapm_enable_pin(dapm, "Int Spk"); |
183 | snd_soc_dapm_enable_pin(dapm, "Mic Jack"); | 201 | snd_soc_dapm_enable_pin(dapm, "Mic Jack"); |
184 | snd_soc_dapm_sync(dapm); | 202 | snd_soc_dapm_sync(dapm); |
185 | 203 | ||
204 | harmony_hp_jack_gpios[0].gpio = pdata->gpio_hp_det; | ||
205 | snd_soc_jack_new(codec, "Headphone Jack", SND_JACK_HEADPHONE, | ||
206 | &harmony_hp_jack); | ||
207 | snd_soc_jack_add_pins(&harmony_hp_jack, | ||
208 | ARRAY_SIZE(harmony_hp_jack_pins), | ||
209 | harmony_hp_jack_pins); | ||
210 | snd_soc_jack_add_gpios(&harmony_hp_jack, | ||
211 | ARRAY_SIZE(harmony_hp_jack_gpios), | ||
212 | harmony_hp_jack_gpios); | ||
213 | |||
186 | return 0; | 214 | return 0; |
187 | } | 215 | } |
188 | 216 | ||