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
20 #include <linux/platform_data/asoc-ti-mcbsp.h>
22 #include <asm/mach-types.h>
24 #include "omap-mcbsp.h"
28 RX51_JACK_TVOUT, /* tv-out with stereo output */
45 struct snd_soc_card *card = dapm->card; in rx51_ext_control()
65 snd_soc_dapm_enable_pin_unlocked(dapm, "Ext Spk"); in rx51_ext_control()
67 snd_soc_dapm_disable_pin_unlocked(dapm, "Ext Spk"); in rx51_ext_control()
81 gpiod_set_value(pdata->tvout_selection_gpio, tvout); in rx51_ext_control()
90 struct snd_pcm_runtime *runtime = substream->runtime; in rx51_startup()
92 struct snd_soc_card *card = rtd->card; in rx51_startup()
95 rx51_ext_control(&card->dapm); in rx51_startup()
119 ucontrol->value.enumerated.item[0] = rx51_spk_func; in rx51_get_spk()
129 if (rx51_spk_func == ucontrol->value.enumerated.item[0]) in rx51_set_spk()
132 rx51_spk_func = ucontrol->value.enumerated.item[0]; in rx51_set_spk()
133 rx51_ext_control(&card->dapm); in rx51_set_spk()
141 struct snd_soc_dapm_context *dapm = w->dapm; in rx51_spk_event()
142 struct snd_soc_card *card = dapm->card; in rx51_spk_event()
145 gpiod_set_raw_value_cansleep(pdata->speaker_amp_gpio, in rx51_spk_event()
154 ucontrol->value.enumerated.item[0] = rx51_dmic_func; in rx51_get_input()
164 if (rx51_dmic_func == ucontrol->value.enumerated.item[0]) in rx51_set_input()
167 rx51_dmic_func = ucontrol->value.enumerated.item[0]; in rx51_set_input()
168 rx51_ext_control(&card->dapm); in rx51_set_input()
176 ucontrol->value.enumerated.item[0] = rx51_jack_func; in rx51_get_jack()
186 if (rx51_jack_func == ucontrol->value.enumerated.item[0]) in rx51_set_jack()
189 rx51_jack_func = ucontrol->value.enumerated.item[0]; in rx51_set_jack()
190 rx51_ext_control(&card->dapm); in rx51_set_jack()
199 .name = "jack-detection",
201 .invert = 1,
207 SND_SOC_DAPM_SPK("Ext Spk", rx51_spk_event),
216 {"Ext Spk", NULL, "HPLOUT"},
217 {"Ext Spk", NULL, "HPROUT"},
218 {"Ext Spk", NULL, "HPLCOM"},
219 {"Ext Spk", NULL, "HPRCOM"},
241 "Off", "TV-OUT", "Headphone", "Headset"
263 struct snd_soc_card *card = rtd->card; in rx51_aic34_init()
270 dev_err(card->dev, "Failed to add MCBSP controls\n"); in rx51_aic34_init()
275 err = snd_soc_card_jack_new(rtd->card, "AV Jack", in rx51_aic34_init()
279 dev_err(card->dev, "Failed to add AV Jack\n"); in rx51_aic34_init()
283 rx51_av_jack_gpios[0].gpiod_dev = card->dev; in rx51_aic34_init()
291 dev_err(card->dev, "Failed to add GPIOs\n"); in rx51_aic34_init()
298 /* Digital audio interface glue - connects codec <--> CPU */
300 DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.2")),
301 DAILINK_COMP_ARRAY(COMP_CODEC("tlv320aic3x-codec.2-0018",
302 "tlv320aic3x-hifi")),
303 DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.2")));
319 .dlc = COMP_AUX("tlv320aic3x-codec.2-0019"),
322 .dlc = COMP_AUX("tpa6130a2.2-0060"),
328 .dlc = COMP_CODEC_CONF("tlv320aic3x-codec.2-0019"),
332 .dlc = COMP_CODEC_CONF("tpa6130a2.2-0060"),
339 .name = "RX-51",
360 struct device_node *np = pdev->dev.of_node; in rx51_soc_probe()
364 if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900")) in rx51_soc_probe()
365 return -ENODEV; in rx51_soc_probe()
367 card->dev = &pdev->dev; in rx51_soc_probe()
372 dai_node = of_parse_phandle(np, "nokia,cpu-dai", 0); in rx51_soc_probe()
374 dev_err(&pdev->dev, "McBSP node is not provided\n"); in rx51_soc_probe()
375 return -EINVAL; in rx51_soc_probe()
377 rx51_dai[0].cpus->dai_name = NULL; in rx51_soc_probe()
378 rx51_dai[0].platforms->name = NULL; in rx51_soc_probe()
379 rx51_dai[0].cpus->of_node = dai_node; in rx51_soc_probe()
380 rx51_dai[0].platforms->of_node = dai_node; in rx51_soc_probe()
382 dai_node = of_parse_phandle(np, "nokia,audio-codec", 0); in rx51_soc_probe()
384 dev_err(&pdev->dev, "Codec node is not provided\n"); in rx51_soc_probe()
385 return -EINVAL; in rx51_soc_probe()
387 rx51_dai[0].codecs->name = NULL; in rx51_soc_probe()
388 rx51_dai[0].codecs->of_node = dai_node; in rx51_soc_probe()
390 dai_node = of_parse_phandle(np, "nokia,audio-codec", 1); in rx51_soc_probe()
392 dev_err(&pdev->dev, "Auxiliary Codec node is not provided\n"); in rx51_soc_probe()
393 return -EINVAL; in rx51_soc_probe()
400 dai_node = of_parse_phandle(np, "nokia,headphone-amplifier", 0); in rx51_soc_probe()
402 dev_err(&pdev->dev, "Headphone amplifier node is not provided\n"); in rx51_soc_probe()
403 return -EINVAL; in rx51_soc_probe()
411 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in rx51_soc_probe()
413 return -ENOMEM; in rx51_soc_probe()
417 pdata->tvout_selection_gpio = devm_gpiod_get(card->dev, in rx51_soc_probe()
418 "tvout-selection", in rx51_soc_probe()
420 if (IS_ERR(pdata->tvout_selection_gpio)) { in rx51_soc_probe()
421 dev_err(card->dev, "could not get tvout selection gpio\n"); in rx51_soc_probe()
422 return PTR_ERR(pdata->tvout_selection_gpio); in rx51_soc_probe()
425 pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch", in rx51_soc_probe()
427 if (IS_ERR(pdata->eci_sw_gpio)) { in rx51_soc_probe()
428 dev_err(card->dev, "could not get eci switch gpio\n"); in rx51_soc_probe()
429 return PTR_ERR(pdata->eci_sw_gpio); in rx51_soc_probe()
432 pdata->speaker_amp_gpio = devm_gpiod_get(card->dev, in rx51_soc_probe()
433 "speaker-amplifier", in rx51_soc_probe()
435 if (IS_ERR(pdata->speaker_amp_gpio)) { in rx51_soc_probe()
436 dev_err(card->dev, "could not get speaker enable gpio\n"); in rx51_soc_probe()
437 return PTR_ERR(pdata->speaker_amp_gpio); in rx51_soc_probe()
440 err = devm_snd_soc_register_card(card->dev, card); in rx51_soc_probe()
442 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err); in rx51_soc_probe()
451 { .compatible = "nokia,n900-audio", },
459 .name = "rx51-audio",
468 MODULE_DESCRIPTION("ALSA SoC Nokia RX-51");
470 MODULE_ALIAS("platform:rx51-audio");