Lines Matching +full:micbias +full:- +full:input

1 // SPDX-License-Identifier: GPL-2.0+
4 #include <linux/input-event-codes.h>
99 if (!gpiod_get_value(priv->gpio_headset_detect)) { in headset_det_irq_thread()
102 gpiod_set_value(priv->gpio_earpath_sel, 0); in headset_det_irq_thread()
106 time_left_ms -= 20; in headset_det_irq_thread()
109 /* Temporarily enable micbias and earpath selector */ in headset_det_irq_thread()
110 ret = regulator_enable(priv->reg_headset_micbias); in headset_det_irq_thread()
112 pr_err("%s failed to enable micbias: %d", __func__, ret); in headset_det_irq_thread()
114 gpiod_set_value(priv->gpio_earpath_sel, 1); in headset_det_irq_thread()
116 ret = iio_read_channel_processed(priv->adc, &adc); in headset_det_irq_thread()
128 ret = regulator_disable(priv->reg_headset_micbias); in headset_det_irq_thread()
130 pr_err("%s failed disable micbias: %d", __func__, ret); in headset_det_irq_thread()
134 gpiod_set_value(priv->gpio_earpath_sel, 0); in headset_det_irq_thread()
144 if (gpiod_get_value_cansleep(priv->gpio_headset_key) && in headset_button_check()
163 struct snd_soc_card *card = w->dapm->card; in aries_spk_cfg()
168 rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]); in aries_spk_cfg()
169 component = asoc_rtd_to_codec(rtd, 0)->component; in aries_spk_cfg()
172 * We have an odd setup - the SPKMODE pin is pulled up so in aries_spk_cfg()
198 struct snd_soc_card *card = w->dapm->card; in aries_main_bias()
204 ret = regulator_enable(priv->reg_main_micbias); in aries_main_bias()
207 ret = regulator_disable(priv->reg_main_micbias); in aries_main_bias()
217 struct snd_soc_card *card = w->dapm->card; in aries_headset_bias()
223 ret = regulator_enable(priv->reg_headset_micbias); in aries_headset_bias()
226 ret = regulator_disable(priv->reg_headset_micbias); in aries_headset_bias()
350 ret = devm_extcon_register_notifier(card->dev, in aries_late_probe()
351 priv->usb_extcon, EXTCON_JACK_LINE_OUT, in aries_late_probe()
356 if (extcon_get_state(priv->usb_extcon, in aries_late_probe()
375 irq = gpiod_to_irq(priv->gpio_headset_detect); in aries_late_probe()
377 dev_err(card->dev, "Failed to map headset detect gpio to irq"); in aries_late_probe()
378 return -EINVAL; in aries_late_probe()
381 ret = devm_request_threaded_irq(card->dev, irq, NULL, in aries_late_probe()
386 dev_err(card->dev, "Failed to request headset detect irq"); in aries_late_probe()
391 headset_button_gpio[0].desc = priv->gpio_headset_key; in aries_late_probe()
426 .name = "aries-audio",
462 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif1")),
467 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif2")));
470 DAILINK_COMP_ARRAY(COMP_CPU("bt-sco-pcm")),
471 DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif3")));
525 .compatible = "samsung,fascinate4g-wm8994",
529 .compatible = "samsung,aries-wm8994",
538 struct device_node *np = pdev->dev.of_node; in aries_audio_probe()
540 struct device *dev = &pdev->dev; in aries_audio_probe()
549 return -EINVAL; in aries_audio_probe()
551 card->dev = dev; in aries_audio_probe()
555 return -ENOMEM; in aries_audio_probe()
560 priv->variant = match->data; in aries_audio_probe()
563 if (!priv->variant->has_fm_radio) in aries_audio_probe()
564 card->num_dapm_widgets--; in aries_audio_probe()
566 priv->reg_main_micbias = devm_regulator_get(dev, "main-micbias"); in aries_audio_probe()
567 if (IS_ERR(priv->reg_main_micbias)) { in aries_audio_probe()
568 dev_err(dev, "Failed to get main micbias regulator\n"); in aries_audio_probe()
569 return PTR_ERR(priv->reg_main_micbias); in aries_audio_probe()
572 priv->reg_headset_micbias = devm_regulator_get(dev, "headset-micbias"); in aries_audio_probe()
573 if (IS_ERR(priv->reg_headset_micbias)) { in aries_audio_probe()
574 dev_err(dev, "Failed to get headset micbias regulator\n"); in aries_audio_probe()
575 return PTR_ERR(priv->reg_headset_micbias); in aries_audio_probe()
578 priv->gpio_earpath_sel = devm_gpiod_get(dev, "earpath-sel", in aries_audio_probe()
580 if (IS_ERR(priv->gpio_earpath_sel)) { in aries_audio_probe()
582 return PTR_ERR(priv->gpio_earpath_sel); in aries_audio_probe()
586 priv->usb_extcon = extcon_find_edev_by_node(extcon_np); in aries_audio_probe()
588 if (IS_ERR(priv->usb_extcon)) in aries_audio_probe()
589 return dev_err_probe(dev, PTR_ERR(priv->usb_extcon), in aries_audio_probe()
592 priv->adc = devm_iio_channel_get(dev, "headset-detect"); in aries_audio_probe()
593 if (IS_ERR(priv->adc)) in aries_audio_probe()
594 return dev_err_probe(dev, PTR_ERR(priv->adc), in aries_audio_probe()
597 ret = iio_get_channel_type(priv->adc, &channel_type); in aries_audio_probe()
602 return -EINVAL; in aries_audio_probe()
604 priv->gpio_headset_key = devm_gpiod_get(dev, "headset-key", in aries_audio_probe()
606 if (IS_ERR(priv->gpio_headset_key)) { in aries_audio_probe()
608 return PTR_ERR(priv->gpio_headset_key); in aries_audio_probe()
611 priv->gpio_headset_detect = devm_gpiod_get(dev, in aries_audio_probe()
612 "headset-detect", GPIOD_IN); in aries_audio_probe()
613 if (IS_ERR(priv->gpio_headset_detect)) { in aries_audio_probe()
615 return PTR_ERR(priv->gpio_headset_detect); in aries_audio_probe()
618 /* Update card-name if provided through DT, else use default name */ in aries_audio_probe()
621 ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); in aries_audio_probe()
627 aries_dai[1].dai_fmt = priv->variant->modem_dai_fmt; in aries_audio_probe()
629 cpu = of_get_child_by_name(dev->of_node, "cpu"); in aries_audio_probe()
631 return -EINVAL; in aries_audio_probe()
633 codec = of_get_child_by_name(dev->of_node, "codec"); in aries_audio_probe()
635 ret = -EINVAL; in aries_audio_probe()
640 dai_link->codecs->of_node = of_parse_phandle(codec, in aries_audio_probe()
641 "sound-dai", 0); in aries_audio_probe()
642 if (!dai_link->codecs->of_node) { in aries_audio_probe()
643 ret = -EINVAL; in aries_audio_probe()
649 aries_dai[0].cpus->of_node = of_parse_phandle(cpu, in aries_audio_probe()
650 "sound-dai", 0); in aries_audio_probe()
651 if (!aries_dai[0].cpus->of_node) { in aries_audio_probe()
652 ret = -EINVAL; in aries_audio_probe()
656 aries_dai[0].platforms->of_node = aries_dai[0].cpus->of_node; in aries_audio_probe()
659 aries_dai[2].cpus->of_node = of_parse_phandle(cpu, in aries_audio_probe()
660 "sound-dai", 1); in aries_audio_probe()
661 if (!aries_dai[2].cpus->of_node) { in aries_audio_probe()
662 ret = -EINVAL; in aries_audio_probe()
686 .name = "aries-audio-wm8994",
697 MODULE_ALIAS("platform:aries-audio-wm8994");