31 #include <linux/module.h>
33 #include <linux/slab.h>
44 #include "../codecs/wm8903.h"
48 #define DRV_NAME "tegra-snd-wm8903"
78 while (mclk < 6000000)
83 dev_err(card->
dev,
"Can't configure clocks\n");
90 dev_err(card->
dev,
"codec_dai clock not set\n");
98 .hw_params = tegra_wm8903_hw_params,
105 .pin =
"Headphone Jack",
110 static struct snd_soc_jack_gpio tegra_wm8903_hp_jack_gpio = {
111 .name =
"headphone detect",
113 .debounce_time = 150,
131 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
148 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
167 {
"Headphone Jack",
NULL,
"HPOUTR"},
168 {
"Headphone Jack",
NULL,
"HPOUTL"},
169 {
"Int Spk",
NULL,
"ROP"},
170 {
"Int Spk",
NULL,
"RON"},
171 {
"Int Spk",
NULL,
"LOP"},
172 {
"Int Spk",
NULL,
"LON"},
173 {
"Mic Jack",
NULL,
"MICBIAS"},
174 {
"IN1L",
NULL,
"Mic Jack"},
187 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
191 tegra_wm8903_hp_jack_gpio.gpio = pdata->
gpio_hp_det;
193 &tegra_wm8903_hp_jack);
196 tegra_wm8903_hp_jack_pins);
197 snd_soc_jack_add_gpios(&tegra_wm8903_hp_jack,
199 &tegra_wm8903_hp_jack_gpio);
203 &tegra_wm8903_mic_jack);
206 tegra_wm8903_mic_jack_pins);
215 static int tegra_wm8903_remove(
struct snd_soc_card *card)
228 .stream_name =
"WM8903 PCM",
229 .codec_name =
"wm8903.0-001a",
230 .platform_name =
"tegra20-i2s.0",
231 .cpu_dai_name =
"tegra20-i2s.0",
232 .codec_dai_name =
"wm8903-hifi",
233 .init = tegra_wm8903_init,
234 .ops = &tegra_wm8903_ops,
241 .name =
"tegra-wm8903",
243 .dai_link = &tegra_wm8903_dai,
246 .remove = tegra_wm8903_remove,
248 .controls = tegra_wm8903_controls,
249 .num_controls =
ARRAY_SIZE(tegra_wm8903_controls),
250 .dapm_widgets = tegra_wm8903_dapm_widgets,
251 .num_dapm_widgets =
ARRAY_SIZE(tegra_wm8903_dapm_widgets),
252 .fully_routed =
true,
263 if (!pdev->
dev.platform_data && !pdev->
dev.of_node) {
264 dev_err(&pdev->
dev,
"No platform data supplied\n");
271 dev_err(&pdev->
dev,
"Can't allocate tegra_wm8903 struct\n");
275 pdata = &machine->
pdata;
278 platform_set_drvdata(pdev, card);
279 snd_soc_card_set_drvdata(card, machine);
281 if (pdev->
dev.platform_data) {
282 memcpy(pdata, card->
dev->platform_data,
sizeof(*pdata));
285 "nvidia,spkr-en-gpios", 0);
290 "nvidia,hp-mute-gpios", 0);
295 "nvidia,hp-det-gpios", 0);
300 "nvidia,int-mic-en-gpios", 0);
305 "nvidia,ext-mic-en-gpios", 0);
316 "nvidia,audio-routing");
322 "nvidia,audio-codec", 0);
325 "Property 'nvidia,audio-codec' missing or invalid\n");
332 "nvidia,i2s-controller", 0);
335 "Property 'nvidia,i2s-controller' missing or invalid\n");
352 dev_err(card->
dev,
"cannot get spkr_en gpio\n");
361 dev_err(card->
dev,
"cannot get hp_mute gpio\n");
371 dev_err(card->
dev,
"cannot get int_mic_en gpio\n");
381 dev_err(card->
dev,
"cannot get ext_mic_en gpio\n");
392 dev_err(&pdev->
dev,
"snd_soc_register_card failed (%d)\n",
408 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
410 snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, 1,
411 &tegra_wm8903_hp_jack_gpio);
421 { .compatible =
"nvidia,tegra-audio-wm8903", },
430 .of_match_table = tegra_wm8903_of_match,
432 .probe = tegra_wm8903_driver_probe,