• Home
  • Raw
  • Download

Lines Matching +full:spk +full:- +full:mute

1 // SPDX-License-Identifier: GPL-2.0-only
3 * tegra_wm8903.c - Tegra machine ASoC driver for boards using WM8903 codec.
6 * Copyright (C) 2010-2012 - NVIDIA, Inc.
33 #define DRV_NAME "tegra-snd-wm8903"
49 struct snd_soc_card *card = rtd->card; in tegra_wm8903_hw_params()
69 err = tegra_asoc_utils_set_rate(&machine->util_data, srate, mclk); in tegra_wm8903_hw_params()
71 dev_err(card->dev, "Can't configure clocks\n"); in tegra_wm8903_hw_params()
78 dev_err(card->dev, "codec_dai clock not set\n"); in tegra_wm8903_hw_params()
117 struct snd_soc_dapm_context *dapm = w->dapm; in tegra_wm8903_event_int_spk()
118 struct snd_soc_card *card = dapm->card; in tegra_wm8903_event_int_spk()
121 if (!gpio_is_valid(machine->gpio_spkr_en)) in tegra_wm8903_event_int_spk()
124 gpio_set_value_cansleep(machine->gpio_spkr_en, in tegra_wm8903_event_int_spk()
133 struct snd_soc_dapm_context *dapm = w->dapm; in tegra_wm8903_event_hp()
134 struct snd_soc_card *card = dapm->card; in tegra_wm8903_event_hp()
137 if (!gpio_is_valid(machine->gpio_hp_mute)) in tegra_wm8903_event_hp()
140 gpio_set_value_cansleep(machine->gpio_hp_mute, in tegra_wm8903_event_hp()
149 struct snd_soc_dapm_context *dapm = w->dapm; in tegra_wm8903_event_int_mic()
150 struct snd_soc_card *card = dapm->card; in tegra_wm8903_event_int_mic()
153 if (!gpio_is_valid(machine->gpio_int_mic_en)) in tegra_wm8903_event_int_mic()
156 gpio_set_value_cansleep(machine->gpio_int_mic_en, in tegra_wm8903_event_int_mic()
163 SND_SOC_DAPM_SPK("Int Spk", tegra_wm8903_event_int_spk),
170 SOC_DAPM_PIN_SWITCH("Int Spk"),
177 struct snd_soc_component *component = codec_dai->component; in tegra_wm8903_init()
178 struct snd_soc_card *card = rtd->card; in tegra_wm8903_init()
182 if (gpio_is_valid(machine->gpio_hp_det)) { in tegra_wm8903_init()
183 tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det; in tegra_wm8903_init()
184 snd_soc_card_jack_new(rtd->card, "Headphone Jack", in tegra_wm8903_init()
193 if (of_property_read_bool(card->dev->of_node, "nvidia,headset")) in tegra_wm8903_init()
196 snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE, in tegra_wm8903_init()
203 snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS"); in tegra_wm8903_init()
211 snd_soc_get_pcm_runtime(card, &card->dai_link[0]); in tegra_wm8903_remove()
213 struct snd_soc_component *component = codec_dai->component; in tegra_wm8903_remove()
222 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8903-hifi")),
237 .name = "tegra-wm8903",
252 struct device_node *np = pdev->dev.of_node; in tegra_wm8903_driver_probe()
257 machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm8903), in tegra_wm8903_driver_probe()
260 return -ENOMEM; in tegra_wm8903_driver_probe()
262 card->dev = &pdev->dev; in tegra_wm8903_driver_probe()
265 machine->gpio_spkr_en = of_get_named_gpio(np, "nvidia,spkr-en-gpios", in tegra_wm8903_driver_probe()
267 if (machine->gpio_spkr_en == -EPROBE_DEFER) in tegra_wm8903_driver_probe()
268 return -EPROBE_DEFER; in tegra_wm8903_driver_probe()
269 if (gpio_is_valid(machine->gpio_spkr_en)) { in tegra_wm8903_driver_probe()
270 ret = devm_gpio_request_one(&pdev->dev, machine->gpio_spkr_en, in tegra_wm8903_driver_probe()
273 dev_err(card->dev, "cannot get spkr_en gpio\n"); in tegra_wm8903_driver_probe()
278 machine->gpio_hp_mute = of_get_named_gpio(np, "nvidia,hp-mute-gpios", in tegra_wm8903_driver_probe()
280 if (machine->gpio_hp_mute == -EPROBE_DEFER) in tegra_wm8903_driver_probe()
281 return -EPROBE_DEFER; in tegra_wm8903_driver_probe()
282 if (gpio_is_valid(machine->gpio_hp_mute)) { in tegra_wm8903_driver_probe()
283 ret = devm_gpio_request_one(&pdev->dev, machine->gpio_hp_mute, in tegra_wm8903_driver_probe()
286 dev_err(card->dev, "cannot get hp_mute gpio\n"); in tegra_wm8903_driver_probe()
291 machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); in tegra_wm8903_driver_probe()
292 if (machine->gpio_hp_det == -EPROBE_DEFER) in tegra_wm8903_driver_probe()
293 return -EPROBE_DEFER; in tegra_wm8903_driver_probe()
295 machine->gpio_int_mic_en = of_get_named_gpio(np, in tegra_wm8903_driver_probe()
296 "nvidia,int-mic-en-gpios", 0); in tegra_wm8903_driver_probe()
297 if (machine->gpio_int_mic_en == -EPROBE_DEFER) in tegra_wm8903_driver_probe()
298 return -EPROBE_DEFER; in tegra_wm8903_driver_probe()
299 if (gpio_is_valid(machine->gpio_int_mic_en)) { in tegra_wm8903_driver_probe()
300 /* Disable int mic; enable signal is active-high */ in tegra_wm8903_driver_probe()
301 ret = devm_gpio_request_one(&pdev->dev, in tegra_wm8903_driver_probe()
302 machine->gpio_int_mic_en, in tegra_wm8903_driver_probe()
305 dev_err(card->dev, "cannot get int_mic_en gpio\n"); in tegra_wm8903_driver_probe()
310 machine->gpio_ext_mic_en = of_get_named_gpio(np, in tegra_wm8903_driver_probe()
311 "nvidia,ext-mic-en-gpios", 0); in tegra_wm8903_driver_probe()
312 if (machine->gpio_ext_mic_en == -EPROBE_DEFER) in tegra_wm8903_driver_probe()
313 return -EPROBE_DEFER; in tegra_wm8903_driver_probe()
314 if (gpio_is_valid(machine->gpio_ext_mic_en)) { in tegra_wm8903_driver_probe()
315 /* Enable ext mic; enable signal is active-low */ in tegra_wm8903_driver_probe()
316 ret = devm_gpio_request_one(&pdev->dev, in tegra_wm8903_driver_probe()
317 machine->gpio_ext_mic_en, in tegra_wm8903_driver_probe()
320 dev_err(card->dev, "cannot get ext_mic_en gpio\n"); in tegra_wm8903_driver_probe()
329 ret = snd_soc_of_parse_audio_routing(card, "nvidia,audio-routing"); in tegra_wm8903_driver_probe()
333 tegra_wm8903_dai.codecs->of_node = of_parse_phandle(np, in tegra_wm8903_driver_probe()
334 "nvidia,audio-codec", 0); in tegra_wm8903_driver_probe()
335 if (!tegra_wm8903_dai.codecs->of_node) { in tegra_wm8903_driver_probe()
336 dev_err(&pdev->dev, in tegra_wm8903_driver_probe()
337 "Property 'nvidia,audio-codec' missing or invalid\n"); in tegra_wm8903_driver_probe()
338 return -EINVAL; in tegra_wm8903_driver_probe()
341 tegra_wm8903_dai.cpus->of_node = of_parse_phandle(np, in tegra_wm8903_driver_probe()
342 "nvidia,i2s-controller", 0); in tegra_wm8903_driver_probe()
343 if (!tegra_wm8903_dai.cpus->of_node) { in tegra_wm8903_driver_probe()
344 dev_err(&pdev->dev, in tegra_wm8903_driver_probe()
345 "Property 'nvidia,i2s-controller' missing or invalid\n"); in tegra_wm8903_driver_probe()
346 return -EINVAL; in tegra_wm8903_driver_probe()
349 tegra_wm8903_dai.platforms->of_node = tegra_wm8903_dai.cpus->of_node; in tegra_wm8903_driver_probe()
351 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); in tegra_wm8903_driver_probe()
355 ret = devm_snd_soc_register_card(&pdev->dev, card); in tegra_wm8903_driver_probe()
357 dev_err(&pdev->dev, "devm_snd_soc_register_card failed (%d)\n", in tegra_wm8903_driver_probe()
366 { .compatible = "nvidia,tegra-audio-wm8903", },