Lines Matching +full:invert +full:- +full:ext
1 // SPDX-License-Identifier: GPL-2.0-only
3 * rx51.c -- SoC audio for Nokia RX-51
5 * Copyright (C) 2008 - 2009 Nokia Corporation
21 #include <linux/platform_data/asoc-ti-mcbsp.h>
23 #include <asm/mach-types.h>
25 #include "omap-mcbsp.h"
29 RX51_JACK_TVOUT, /* tv-out with stereo output */
47 struct snd_soc_card *card = dapm->card; in rx51_ext_control()
67 snd_soc_dapm_enable_pin_unlocked(dapm, "Ext Spk"); in rx51_ext_control()
69 snd_soc_dapm_disable_pin_unlocked(dapm, "Ext Spk"); in rx51_ext_control()
83 gpiod_set_value(pdata->tvout_selection_gpio, tvout); in rx51_ext_control()
92 struct snd_pcm_runtime *runtime = substream->runtime; in rx51_startup()
94 struct snd_soc_card *card = rtd->card; in rx51_startup()
97 rx51_ext_control(&card->dapm); in rx51_startup()
121 ucontrol->value.enumerated.item[0] = rx51_spk_func; in rx51_get_spk()
131 if (rx51_spk_func == ucontrol->value.enumerated.item[0]) in rx51_set_spk()
134 rx51_spk_func = ucontrol->value.enumerated.item[0]; in rx51_set_spk()
135 rx51_ext_control(&card->dapm); in rx51_set_spk()
143 struct snd_soc_dapm_context *dapm = w->dapm; in rx51_spk_event()
144 struct snd_soc_card *card = dapm->card; in rx51_spk_event()
147 gpiod_set_raw_value_cansleep(pdata->speaker_amp_gpio, in rx51_spk_event()
156 ucontrol->value.enumerated.item[0] = rx51_dmic_func; in rx51_get_input()
166 if (rx51_dmic_func == ucontrol->value.enumerated.item[0]) in rx51_set_input()
169 rx51_dmic_func = ucontrol->value.enumerated.item[0]; in rx51_set_input()
170 rx51_ext_control(&card->dapm); in rx51_set_input()
178 ucontrol->value.enumerated.item[0] = rx51_jack_func; in rx51_get_jack()
188 if (rx51_jack_func == ucontrol->value.enumerated.item[0]) in rx51_set_jack()
191 rx51_jack_func = ucontrol->value.enumerated.item[0]; in rx51_set_jack()
192 rx51_ext_control(&card->dapm); in rx51_set_jack()
201 .name = "avdet-gpio",
203 .invert = 1,
209 SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event),
218 {"Ext Spk", NULL, "HPLOUT"},
219 {"Ext Spk", NULL, "HPROUT"},
220 {"Ext Spk", NULL, "HPLCOM"},
221 {"Ext Spk", NULL, "HPRCOM"},
243 "Off", "TV-OUT", "Headphone", "Headset"
265 struct snd_soc_card *card = rtd->card; in rx51_aic34_init()
273 dev_err(card->dev, "Failed to add MCBSP controls\n"); in rx51_aic34_init()
278 err = snd_soc_card_jack_new(rtd->card, "AV Jack", in rx51_aic34_init()
282 dev_err(card->dev, "Failed to add AV Jack\n"); in rx51_aic34_init()
287 rx51_av_jack_gpios[0].gpio = desc_to_gpio(pdata->jack_detection_gpio); in rx51_aic34_init()
288 devm_gpiod_put(card->dev, pdata->jack_detection_gpio); in rx51_aic34_init()
294 dev_err(card->dev, "Failed to add GPIOs\n"); in rx51_aic34_init()
301 /* Digital audio interface glue - connects codec <--> CPU */
303 DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.2")),
304 DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.2-0018",
305 "tlv320aic3x-hifi")),
306 DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.2")));
322 .dlc = COMP_AUX("tlv320aic3x-codec.2-0019"),
325 .dlc = COMP_AUX("tpa6130a2.2-0060"),
331 .dlc = COMP_CODEC_CONF("tlv320aic3x-codec.2-0019"),
335 .dlc = COMP_CODEC_CONF("tpa6130a2.2-0060"),
342 .name = "RX-51",
363 struct device_node *np = pdev->dev.of_node; in rx51_soc_probe()
367 if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900")) in rx51_soc_probe()
368 return -ENODEV; in rx51_soc_probe()
370 card->dev = &pdev->dev; in rx51_soc_probe()
375 dai_node = of_parse_phandle(np, "nokia,cpu-dai", 0); in rx51_soc_probe()
377 dev_err(&pdev->dev, "McBSP node is not provided\n"); in rx51_soc_probe()
378 return -EINVAL; in rx51_soc_probe()
380 rx51_dai[0].cpus->dai_name = NULL; in rx51_soc_probe()
381 rx51_dai[0].platforms->name = NULL; in rx51_soc_probe()
382 rx51_dai[0].cpus->of_node = dai_node; in rx51_soc_probe()
383 rx51_dai[0].platforms->of_node = dai_node; in rx51_soc_probe()
385 dai_node = of_parse_phandle(np, "nokia,audio-codec", 0); in rx51_soc_probe()
387 dev_err(&pdev->dev, "Codec node is not provided\n"); in rx51_soc_probe()
388 return -EINVAL; in rx51_soc_probe()
390 rx51_dai[0].codecs->name = NULL; in rx51_soc_probe()
391 rx51_dai[0].codecs->of_node = dai_node; in rx51_soc_probe()
393 dai_node = of_parse_phandle(np, "nokia,audio-codec", 1); in rx51_soc_probe()
395 dev_err(&pdev->dev, "Auxiliary Codec node is not provided\n"); in rx51_soc_probe()
396 return -EINVAL; in rx51_soc_probe()
403 dai_node = of_parse_phandle(np, "nokia,headphone-amplifier", 0); in rx51_soc_probe()
405 dev_err(&pdev->dev, "Headphone amplifier node is not provided\n"); in rx51_soc_probe()
406 return -EINVAL; in rx51_soc_probe()
414 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in rx51_soc_probe()
416 return -ENOMEM; in rx51_soc_probe()
420 pdata->tvout_selection_gpio = devm_gpiod_get(card->dev, in rx51_soc_probe()
421 "tvout-selection", in rx51_soc_probe()
423 if (IS_ERR(pdata->tvout_selection_gpio)) { in rx51_soc_probe()
424 dev_err(card->dev, "could not get tvout selection gpio\n"); in rx51_soc_probe()
425 return PTR_ERR(pdata->tvout_selection_gpio); in rx51_soc_probe()
428 pdata->jack_detection_gpio = devm_gpiod_get(card->dev, in rx51_soc_probe()
429 "jack-detection", in rx51_soc_probe()
431 if (IS_ERR(pdata->jack_detection_gpio)) { in rx51_soc_probe()
432 dev_err(card->dev, "could not get jack detection gpio\n"); in rx51_soc_probe()
433 return PTR_ERR(pdata->jack_detection_gpio); in rx51_soc_probe()
436 pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch", in rx51_soc_probe()
438 if (IS_ERR(pdata->eci_sw_gpio)) { in rx51_soc_probe()
439 dev_err(card->dev, "could not get eci switch gpio\n"); in rx51_soc_probe()
440 return PTR_ERR(pdata->eci_sw_gpio); in rx51_soc_probe()
443 pdata->speaker_amp_gpio = devm_gpiod_get(card->dev, in rx51_soc_probe()
444 "speaker-amplifier", in rx51_soc_probe()
446 if (IS_ERR(pdata->speaker_amp_gpio)) { in rx51_soc_probe()
447 dev_err(card->dev, "could not get speaker enable gpio\n"); in rx51_soc_probe()
448 return PTR_ERR(pdata->speaker_amp_gpio); in rx51_soc_probe()
451 err = devm_snd_soc_register_card(card->dev, card); in rx51_soc_probe()
453 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); in rx51_soc_probe()
462 { .compatible = "nokia,n900-audio", },
470 .name = "rx51-audio",
479 MODULE_DESCRIPTION("ALSA SoC Nokia RX-51");
481 MODULE_ALIAS("platform:rx51-audio");