Lines Matching +full:headset +full:- +full:detect
1 // SPDX-License-Identifier: GPL-2.0+
4 #include <linux/input-event-codes.h>
62 /* Headset jack */
70 .pin = "Headset Mic",
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()
110 ret = regulator_enable(priv->reg_headset_micbias); 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()
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()
247 SND_SOC_DAPM_MIC("Headset Mic", 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()
363 ret = snd_soc_card_jack_new_pins(card, "Headset", 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")));
527 .compatible = "samsung,fascinate4g-wm8994",
531 .compatible = "samsung,aries-wm8994",
540 struct device_node *np = pdev->dev.of_node; in aries_audio_probe()
542 struct device *dev = &pdev->dev; in aries_audio_probe()
551 return -EINVAL; in aries_audio_probe()
553 card->dev = dev; in aries_audio_probe()
557 return -ENOMEM; in aries_audio_probe()
562 priv->variant = match->data; in aries_audio_probe()
565 if (!priv->variant->has_fm_radio) in aries_audio_probe()
566 card->num_dapm_widgets--; in aries_audio_probe()
568 priv->reg_main_micbias = devm_regulator_get(dev, "main-micbias"); in aries_audio_probe()
569 if (IS_ERR(priv->reg_main_micbias)) { in aries_audio_probe()
571 return PTR_ERR(priv->reg_main_micbias); in aries_audio_probe()
574 priv->reg_headset_micbias = devm_regulator_get(dev, "headset-micbias"); in aries_audio_probe()
575 if (IS_ERR(priv->reg_headset_micbias)) { in aries_audio_probe()
576 dev_err(dev, "Failed to get headset micbias regulator\n"); in aries_audio_probe()
577 return PTR_ERR(priv->reg_headset_micbias); in aries_audio_probe()
580 priv->gpio_earpath_sel = devm_gpiod_get(dev, "earpath-sel", in aries_audio_probe()
582 if (IS_ERR(priv->gpio_earpath_sel)) { in aries_audio_probe()
584 return PTR_ERR(priv->gpio_earpath_sel); in aries_audio_probe()
588 priv->usb_extcon = extcon_find_edev_by_node(extcon_np); in aries_audio_probe()
590 if (IS_ERR(priv->usb_extcon)) in aries_audio_probe()
591 return dev_err_probe(dev, PTR_ERR(priv->usb_extcon), in aries_audio_probe()
594 priv->adc = devm_iio_channel_get(dev, "headset-detect"); in aries_audio_probe()
595 if (IS_ERR(priv->adc)) in aries_audio_probe()
596 return dev_err_probe(dev, PTR_ERR(priv->adc), in aries_audio_probe()
599 ret = iio_get_channel_type(priv->adc, &channel_type); in aries_audio_probe()
604 return -EINVAL; in aries_audio_probe()
606 priv->gpio_headset_key = devm_gpiod_get(dev, "headset-key", in aries_audio_probe()
608 if (IS_ERR(priv->gpio_headset_key)) { in aries_audio_probe()
609 dev_err(dev, "Failed to get headset key gpio"); in aries_audio_probe()
610 return PTR_ERR(priv->gpio_headset_key); in aries_audio_probe()
613 priv->gpio_headset_detect = devm_gpiod_get(dev, in aries_audio_probe()
614 "headset-detect", GPIOD_IN); in aries_audio_probe()
615 if (IS_ERR(priv->gpio_headset_detect)) { in aries_audio_probe()
616 dev_err(dev, "Failed to get headset detect gpio"); in aries_audio_probe()
617 return PTR_ERR(priv->gpio_headset_detect); in aries_audio_probe()
620 /* Update card-name if provided through DT, else use default name */ in aries_audio_probe()
623 ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); in aries_audio_probe()
626 ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); in aries_audio_probe()
633 aries_dai[1].dai_fmt = priv->variant->modem_dai_fmt; in aries_audio_probe()
635 cpu = of_get_child_by_name(dev->of_node, "cpu"); in aries_audio_probe()
637 return -EINVAL; in aries_audio_probe()
639 codec = of_get_child_by_name(dev->of_node, "codec"); in aries_audio_probe()
641 ret = -EINVAL; in aries_audio_probe()
646 dai_link->codecs->of_node = of_parse_phandle(codec, in aries_audio_probe()
647 "sound-dai", 0); in aries_audio_probe()
648 if (!dai_link->codecs->of_node) { in aries_audio_probe()
649 ret = -EINVAL; in aries_audio_probe()
655 aries_dai[0].cpus->of_node = of_parse_phandle(cpu, in aries_audio_probe()
656 "sound-dai", 0); in aries_audio_probe()
657 if (!aries_dai[0].cpus->of_node) { in aries_audio_probe()
658 ret = -EINVAL; in aries_audio_probe()
662 aries_dai[0].platforms->of_node = aries_dai[0].cpus->of_node; in aries_audio_probe()
665 aries_dai[2].cpus->of_node = of_parse_phandle(cpu, in aries_audio_probe()
666 "sound-dai", 1); in aries_audio_probe()
667 if (!aries_dai[2].cpus->of_node) { in aries_audio_probe()
668 ret = -EINVAL; in aries_audio_probe()
692 .name = "aries-audio-wm8994",
703 MODULE_ALIAS("platform:aries-audio-wm8994");