Lines Matching +full:usb +full:- +full:aif1

1 // SPDX-License-Identifier: GPL-2.0+
5 #include <linux/input-event-codes.h>
35 /* USB dock */
98 if (!gpiod_get_value(priv->gpio_headset_detect)) { in headset_det_irq_thread()
101 gpiod_set_value(priv->gpio_earpath_sel, 0); in headset_det_irq_thread()
105 time_left_ms -= 20; in headset_det_irq_thread()
109 ret = regulator_enable(priv->reg_headset_micbias); in headset_det_irq_thread()
113 gpiod_set_value(priv->gpio_earpath_sel, 1); in headset_det_irq_thread()
115 ret = iio_read_channel_processed(priv->adc, &adc); in headset_det_irq_thread()
127 ret = regulator_disable(priv->reg_headset_micbias); in headset_det_irq_thread()
133 gpiod_set_value(priv->gpio_earpath_sel, 0); in headset_det_irq_thread()
143 if (gpiod_get_value_cansleep(priv->gpio_headset_key) && in headset_button_check()
162 struct snd_soc_card *card = w->dapm->card; in aries_spk_cfg()
167 rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); in aries_spk_cfg()
168 component = snd_soc_rtd_to_codec(rtd, 0)->component; in aries_spk_cfg()
171 * We have an odd setup - the SPKMODE pin is pulled up so in aries_spk_cfg()
197 struct snd_soc_card *card = w->dapm->card; in aries_main_bias()
203 ret = regulator_enable(priv->reg_main_micbias); in aries_main_bias()
206 ret = regulator_disable(priv->reg_main_micbias); in aries_main_bias()
216 struct snd_soc_card *card = w->dapm->card; in aries_headset_bias()
222 ret = regulator_enable(priv->reg_headset_micbias); in aries_headset_bias()
225 ret = regulator_disable(priv->reg_headset_micbias); in aries_headset_bias()
349 ret = devm_extcon_register_notifier(card->dev, in aries_late_probe()
350 priv->usb_extcon, EXTCON_JACK_LINE_OUT, in aries_late_probe()
355 if (extcon_get_state(priv->usb_extcon, in aries_late_probe()
374 irq = gpiod_to_irq(priv->gpio_headset_detect); in aries_late_probe()
376 dev_err(card->dev, "Failed to map headset detect gpio to irq"); in aries_late_probe()
377 return -EINVAL; in aries_late_probe()
380 ret = devm_request_threaded_irq(card->dev, irq, NULL, in aries_late_probe()
385 dev_err(card->dev, "Failed to request headset detect irq"); in aries_late_probe()
390 headset_button_gpio[0].desc = priv->gpio_headset_key; in aries_late_probe()
425 .name = "aries-audio",
459 SND_SOC_DAILINK_DEFS(aif1,
461 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif1")),
466 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif2")));
469 DAILINK_COMP_ARRAY(COMP_CPU("bt-sco-pcm")),
470 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif3")));
474 .name = "WM8994 AIF1",
479 SND_SOC_DAILINK_REG(aif1),
526 .compatible = "samsung,fascinate4g-wm8994",
530 .compatible = "samsung,aries-wm8994",
539 struct device_node *np = pdev->dev.of_node; in aries_audio_probe()
541 struct device *dev = &pdev->dev; in aries_audio_probe()
550 return -EINVAL; in aries_audio_probe()
552 card->dev = dev; in aries_audio_probe()
556 return -ENOMEM; in aries_audio_probe()
561 priv->variant = match->data; in aries_audio_probe()
564 if (!priv->variant->has_fm_radio) in aries_audio_probe()
565 card->num_dapm_widgets--; in aries_audio_probe()
567 priv->reg_main_micbias = devm_regulator_get(dev, "main-micbias"); in aries_audio_probe()
568 if (IS_ERR(priv->reg_main_micbias)) { in aries_audio_probe()
570 return PTR_ERR(priv->reg_main_micbias); in aries_audio_probe()
573 priv->reg_headset_micbias = devm_regulator_get(dev, "headset-micbias"); in aries_audio_probe()
574 if (IS_ERR(priv->reg_headset_micbias)) { in aries_audio_probe()
576 return PTR_ERR(priv->reg_headset_micbias); in aries_audio_probe()
579 priv->gpio_earpath_sel = devm_gpiod_get(dev, "earpath-sel", in aries_audio_probe()
581 if (IS_ERR(priv->gpio_earpath_sel)) { in aries_audio_probe()
583 return PTR_ERR(priv->gpio_earpath_sel); in aries_audio_probe()
587 priv->usb_extcon = extcon_find_edev_by_node(extcon_np); in aries_audio_probe()
589 if (IS_ERR(priv->usb_extcon)) in aries_audio_probe()
590 return dev_err_probe(dev, PTR_ERR(priv->usb_extcon), in aries_audio_probe()
593 priv->adc = devm_iio_channel_get(dev, "headset-detect"); in aries_audio_probe()
594 if (IS_ERR(priv->adc)) in aries_audio_probe()
595 return dev_err_probe(dev, PTR_ERR(priv->adc), in aries_audio_probe()
598 ret = iio_get_channel_type(priv->adc, &channel_type); in aries_audio_probe()
603 return -EINVAL; in aries_audio_probe()
605 priv->gpio_headset_key = devm_gpiod_get(dev, "headset-key", in aries_audio_probe()
607 if (IS_ERR(priv->gpio_headset_key)) { in aries_audio_probe()
609 return PTR_ERR(priv->gpio_headset_key); in aries_audio_probe()
612 priv->gpio_headset_detect = devm_gpiod_get(dev, in aries_audio_probe()
613 "headset-detect", GPIOD_IN); in aries_audio_probe()
614 if (IS_ERR(priv->gpio_headset_detect)) { in aries_audio_probe()
616 return PTR_ERR(priv->gpio_headset_detect); in aries_audio_probe()
619 /* Update card-name if provided through DT, else use default name */ in aries_audio_probe()
622 ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); in aries_audio_probe()
625 ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); in aries_audio_probe()
632 aries_dai[1].dai_fmt = priv->variant->modem_dai_fmt; in aries_audio_probe()
634 cpu = of_get_child_by_name(dev->of_node, "cpu"); in aries_audio_probe()
636 return -EINVAL; in aries_audio_probe()
638 codec = of_get_child_by_name(dev->of_node, "codec"); in aries_audio_probe()
640 ret = -EINVAL; in aries_audio_probe()
645 dai_link->codecs->of_node = of_parse_phandle(codec, in aries_audio_probe()
646 "sound-dai", 0); in aries_audio_probe()
647 if (!dai_link->codecs->of_node) { in aries_audio_probe()
648 ret = -EINVAL; in aries_audio_probe()
654 aries_dai[0].cpus->of_node = of_parse_phandle(cpu, in aries_audio_probe()
655 "sound-dai", 0); in aries_audio_probe()
656 if (!aries_dai[0].cpus->of_node) { in aries_audio_probe()
657 ret = -EINVAL; in aries_audio_probe()
661 aries_dai[0].platforms->of_node = aries_dai[0].cpus->of_node; in aries_audio_probe()
664 aries_dai[2].cpus->of_node = of_parse_phandle(cpu, in aries_audio_probe()
665 "sound-dai", 1); in aries_audio_probe()
666 if (!aries_dai[2].cpus->of_node) { in aries_audio_probe()
667 ret = -EINVAL; in aries_audio_probe()
691 .name = "aries-audio-wm8994",
702 MODULE_ALIAS("platform:aries-audio-wm8994");