tegra_wm8903.c (cf40a76e7d5874bb25f4404eecc58a2e033af885) | tegra_wm8903.c (58bd2934923b7339e7320b1cbe87f13287c57c31) |
---|---|
1/* 2 * tegra_wm8903.c - Tegra machine ASoC driver for boards using WM8903 codec. 3 * 4 * Author: Stephen Warren <swarren@nvidia.com> 5 * Copyright (C) 2010-2012 - NVIDIA, Inc. 6 * 7 * Based on code copyright/by: 8 * --- 156 unchanged lines hidden (view full) --- 165 166static const struct snd_kcontrol_new tegra_wm8903_controls[] = { 167 SOC_DAPM_PIN_SWITCH("Int Spk"), 168}; 169 170static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) 171{ 172 struct snd_soc_dai *codec_dai = rtd->codec_dai; | 1/* 2 * tegra_wm8903.c - Tegra machine ASoC driver for boards using WM8903 codec. 3 * 4 * Author: Stephen Warren <swarren@nvidia.com> 5 * Copyright (C) 2010-2012 - NVIDIA, Inc. 6 * 7 * Based on code copyright/by: 8 * --- 156 unchanged lines hidden (view full) --- 165 166static const struct snd_kcontrol_new tegra_wm8903_controls[] = { 167 SOC_DAPM_PIN_SWITCH("Int Spk"), 168}; 169 170static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) 171{ 172 struct snd_soc_dai *codec_dai = rtd->codec_dai; |
173 struct snd_soc_codec *codec = codec_dai->codec; | 173 struct snd_soc_component *component = codec_dai->component; |
174 struct snd_soc_card *card = rtd->card; 175 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 176 177 if (gpio_is_valid(machine->gpio_hp_det)) { 178 tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; 179 snd_soc_card_jack_new(rtd->card, "Headphone Jack", 180 SND_JACK_HEADPHONE, &tegra_wm8903_hp_jack, 181 tegra_wm8903_hp_jack_pins, 182 ARRAY_SIZE(tegra_wm8903_hp_jack_pins)); 183 snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, 184 1, 185 &tegra_wm8903_hp_jack_gpio); 186 } 187 188 snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, 189 &tegra_wm8903_mic_jack, 190 tegra_wm8903_mic_jack_pins, 191 ARRAY_SIZE(tegra_wm8903_mic_jack_pins)); | 174 struct snd_soc_card *card = rtd->card; 175 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 176 177 if (gpio_is_valid(machine->gpio_hp_det)) { 178 tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; 179 snd_soc_card_jack_new(rtd->card, "Headphone Jack", 180 SND_JACK_HEADPHONE, &tegra_wm8903_hp_jack, 181 tegra_wm8903_hp_jack_pins, 182 ARRAY_SIZE(tegra_wm8903_hp_jack_pins)); 183 snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack, 184 1, 185 &tegra_wm8903_hp_jack_gpio); 186 } 187 188 snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, 189 &tegra_wm8903_mic_jack, 190 tegra_wm8903_mic_jack_pins, 191 ARRAY_SIZE(tegra_wm8903_mic_jack_pins)); |
192 wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, | 192 wm8903_mic_detect(component, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, |
193 0); 194 195 snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS"); 196 197 return 0; 198} 199 200static int tegra_wm8903_remove(struct snd_soc_card *card) 201{ 202 struct snd_soc_pcm_runtime *rtd = 203 snd_soc_get_pcm_runtime(card, card->dai_link[0].name); 204 struct snd_soc_dai *codec_dai = rtd->codec_dai; | 193 0); 194 195 snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS"); 196 197 return 0; 198} 199 200static int tegra_wm8903_remove(struct snd_soc_card *card) 201{ 202 struct snd_soc_pcm_runtime *rtd = 203 snd_soc_get_pcm_runtime(card, card->dai_link[0].name); 204 struct snd_soc_dai *codec_dai = rtd->codec_dai; |
205 struct snd_soc_codec *codec = codec_dai->codec; | 205 struct snd_soc_component *component = codec_dai->component; |
206 | 206 |
207 wm8903_mic_detect(codec, NULL, 0, 0); | 207 wm8903_mic_detect(component, NULL, 0, 0); |
208 209 return 0; 210} 211 212static struct snd_soc_dai_link tegra_wm8903_dai = { 213 .name = "WM8903", 214 .stream_name = "WM8903 PCM", 215 .codec_dai_name = "wm8903-hifi", --- 175 unchanged lines hidden --- | 208 209 return 0; 210} 211 212static struct snd_soc_dai_link tegra_wm8903_dai = { 213 .name = "WM8903", 214 .stream_name = "WM8903 PCM", 215 .codec_dai_name = "wm8903-hifi", --- 175 unchanged lines hidden --- |