Lines Matching +full:headset +full:- +full:detect

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