Lines Matching +full:headset +full:- +full:detect
1 // SPDX-License-Identifier: GPL-2.0-only
3 // Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
21 #include <sound/soc-acpi.h>
22 #include "../../common/soc-intel-quirks.h"
35 avs_rt5682_quirk = (unsigned long)id->driver_data; in avs_rt5682_quirk_cb()
64 SOC_DAPM_PIN_SWITCH("Headset Mic"),
69 SND_SOC_DAPM_MIC("Headset Mic", NULL),
73 /* HP jack connectors - unknown if we have jack detect */
78 { "IN1P", NULL, "Headset Mic" },
83 struct snd_soc_component *component = asoc_rtd_to_codec(runtime, 0)->component; in avs_rt5682_codec_init()
85 struct snd_soc_card *card = runtime->card; in avs_rt5682_codec_init()
98 * Headset buttons map to the google Reference headset. in avs_rt5682_codec_init()
101 ret = snd_soc_card_jack_new(card, "Headset", SND_JACK_HEADSET | SND_JACK_BTN_0 | in avs_rt5682_codec_init()
104 dev_err(card->dev, "Headset Jack creation failed: %d\n", ret); in avs_rt5682_codec_init()
108 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); in avs_rt5682_codec_init()
109 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); in avs_rt5682_codec_init()
110 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); in avs_rt5682_codec_init()
111 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); in avs_rt5682_codec_init()
115 dev_err(card->dev, "Headset Jack call-back failed: %d\n", ret); in avs_rt5682_codec_init()
145 dev_err(runtime->dev, "snd_soc_dai_set_pll err = %d\n", ret); in avs_rt5682_hw_params()
150 dev_err(runtime->dev, "snd_soc_dai_set_sysclk err = %d\n", ret); in avs_rt5682_hw_params()
155 dev_err(runtime->dev, "set TDM slot err:%d\n", ret); in avs_rt5682_hw_params()
175 return -ENOMEM; in avs_create_dai_link()
177 platform->name = platform_name; in avs_create_dai_link()
179 dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec", ssp_port); in avs_create_dai_link()
180 dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); in avs_create_dai_link()
181 dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); in avs_create_dai_link()
182 if (!dl->name || !dl->cpus || !dl->codecs) in avs_create_dai_link()
183 return -ENOMEM; in avs_create_dai_link()
185 dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", ssp_port); in avs_create_dai_link()
186 dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5682:00"); in avs_create_dai_link()
187 dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, "rt5682-aif1"); in avs_create_dai_link()
188 if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) in avs_create_dai_link()
189 return -ENOMEM; in avs_create_dai_link()
191 dl->num_cpus = 1; in avs_create_dai_link()
192 dl->num_codecs = 1; in avs_create_dai_link()
193 dl->platforms = platform; in avs_create_dai_link()
194 dl->num_platforms = 1; in avs_create_dai_link()
195 dl->id = 0; in avs_create_dai_link()
196 dl->init = avs_rt5682_codec_init; in avs_create_dai_link()
197 dl->ops = &avs_rt5682_ops; in avs_create_dai_link()
198 dl->nonatomic = 1; in avs_create_dai_link()
199 dl->no_pcm = 1; in avs_create_dai_link()
200 dl->dpcm_capture = 1; in avs_create_dai_link()
201 dl->dpcm_playback = 1; in avs_create_dai_link()
218 return -ENOMEM; in avs_create_dapm_routes()
226 return -ENOMEM; in avs_create_dapm_routes()
232 return -ENOMEM; in avs_create_dapm_routes()
273 struct device *dev = &pdev->dev; in avs_rt5682_probe()
277 if (pdev->id_entry && pdev->id_entry->driver_data) in avs_rt5682_probe()
278 avs_rt5682_quirk = (unsigned long)pdev->id_entry->driver_data; in avs_rt5682_probe()
284 pname = mach->mach_params.platform; in avs_rt5682_probe()
285 ssp_port = __ffs(mach->mach_params.i2s_link_mask); in avs_rt5682_probe()
302 return -ENOMEM; in avs_rt5682_probe()
304 card->name = "avs_rt5682"; in avs_rt5682_probe()
305 card->dev = dev; in avs_rt5682_probe()
306 card->owner = THIS_MODULE; in avs_rt5682_probe()
307 card->remove = avs_card_remove; in avs_rt5682_probe()
308 card->suspend_pre = avs_card_suspend_pre; in avs_rt5682_probe()
309 card->resume_post = avs_card_resume_post; in avs_rt5682_probe()
310 card->dai_link = dai_link; in avs_rt5682_probe()
311 card->num_links = 1; in avs_rt5682_probe()
312 card->controls = card_controls; in avs_rt5682_probe()
313 card->num_controls = ARRAY_SIZE(card_controls); in avs_rt5682_probe()
314 card->dapm_widgets = card_widgets; in avs_rt5682_probe()
315 card->num_dapm_widgets = ARRAY_SIZE(card_widgets); in avs_rt5682_probe()
316 card->dapm_routes = routes; in avs_rt5682_probe()
317 card->num_dapm_routes = num_routes; in avs_rt5682_probe()
318 card->fully_routed = true; in avs_rt5682_probe()