Lines Matching +full:aif1 +full:- +full:pins

1 // SPDX-License-Identifier: GPL-2.0-only
3 // Copyright(c) 2021-2022 Intel Corporation
21 #include <sound/soc-acpi.h>
22 #include "../../common/soc-intel-quirks.h"
30 #define AVS_RT5682_CODEC_DAI_NAME "rt5682-aif1"
37 avs_rt5682_quirk = (unsigned long)id->driver_data; in avs_rt5682_quirk_cb()
75 /* HP jack connectors - unknown if we have jack detect */
96 struct snd_soc_component *component = snd_soc_rtd_to_codec(runtime, 0)->component; in avs_rt5682_codec_init()
97 struct snd_soc_card *card = runtime->card; in avs_rt5682_codec_init()
98 struct snd_soc_jack_pin *pins; in avs_rt5682_codec_init() local
105 pins = devm_kmemdup(card->dev, card_jack_pins, sizeof(*pins) * num_pins, GFP_KERNEL); in avs_rt5682_codec_init()
106 if (!pins) in avs_rt5682_codec_init()
107 return -ENOMEM; in avs_rt5682_codec_init()
119 pins, num_pins); in avs_rt5682_codec_init()
121 dev_err(card->dev, "Headset Jack creation failed: %d\n", ret); in avs_rt5682_codec_init()
125 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); in avs_rt5682_codec_init()
126 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); in avs_rt5682_codec_init()
127 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); in avs_rt5682_codec_init()
128 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); in avs_rt5682_codec_init()
132 dev_err(card->dev, "Headset Jack call-back failed: %d\n", ret); in avs_rt5682_codec_init()
141 snd_soc_component_set_jack(snd_soc_rtd_to_codec(rtd, 0)->component, NULL, NULL); in avs_rt5682_codec_exit()
167 dev_err(runtime->dev, "Set PLL failed: %d\n", ret); in avs_rt5682_hw_params()
171 dev_err(runtime->dev, "Set sysclk failed: %d\n", ret); in avs_rt5682_hw_params()
176 dev_err(runtime->dev, "Set TDM slot failed: %d\n", ret); in avs_rt5682_hw_params()
196 rate->min = rate->max = 48000; in avs_rt5682_be_fixup()
197 channels->min = channels->max = 2; in avs_rt5682_be_fixup()
215 return -ENOMEM; in avs_create_dai_link()
217 platform->name = platform_name; in avs_create_dai_link()
219 dl->name = devm_kasprintf(dev, GFP_KERNEL, in avs_create_dai_link()
220 AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); in avs_create_dai_link()
221 dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); in avs_create_dai_link()
222 dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); in avs_create_dai_link()
223 if (!dl->name || !dl->cpus || !dl->codecs) in avs_create_dai_link()
224 return -ENOMEM; in avs_create_dai_link()
226 dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in avs_create_dai_link()
228 dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-10EC5682:00"); in avs_create_dai_link()
229 dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, AVS_RT5682_CODEC_DAI_NAME); in avs_create_dai_link()
230 if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) in avs_create_dai_link()
231 return -ENOMEM; in avs_create_dai_link()
233 dl->num_cpus = 1; in avs_create_dai_link()
234 dl->num_codecs = 1; in avs_create_dai_link()
235 dl->platforms = platform; in avs_create_dai_link()
236 dl->num_platforms = 1; in avs_create_dai_link()
237 dl->id = 0; in avs_create_dai_link()
238 dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; in avs_create_dai_link()
239 dl->init = avs_rt5682_codec_init; in avs_create_dai_link()
240 dl->exit = avs_rt5682_codec_exit; in avs_create_dai_link()
241 dl->be_hw_params_fixup = avs_rt5682_be_fixup; in avs_create_dai_link()
242 dl->ops = &avs_rt5682_ops; in avs_create_dai_link()
243 dl->nonatomic = 1; in avs_create_dai_link()
244 dl->no_pcm = 1; in avs_create_dai_link()
245 dl->dpcm_capture = 1; in avs_create_dai_link()
246 dl->dpcm_playback = 1; in avs_create_dai_link()
257 return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); in avs_card_suspend_pre()
265 return snd_soc_component_set_jack(codec_dai->component, jack, NULL); in avs_card_resume_post()
274 struct device *dev = &pdev->dev; in avs_rt5682_probe()
278 if (pdev->id_entry && pdev->id_entry->driver_data) in avs_rt5682_probe()
279 avs_rt5682_quirk = (unsigned long)pdev->id_entry->driver_data; in avs_rt5682_probe()
285 pname = mach->mach_params.platform; in avs_rt5682_probe()
300 return -ENOMEM; in avs_rt5682_probe()
302 card->name = "avs_rt5682"; in avs_rt5682_probe()
303 card->dev = dev; in avs_rt5682_probe()
304 card->owner = THIS_MODULE; in avs_rt5682_probe()
305 card->suspend_pre = avs_card_suspend_pre; in avs_rt5682_probe()
306 card->resume_post = avs_card_resume_post; in avs_rt5682_probe()
307 card->dai_link = dai_link; in avs_rt5682_probe()
308 card->num_links = 1; in avs_rt5682_probe()
309 card->controls = card_controls; in avs_rt5682_probe()
310 card->num_controls = ARRAY_SIZE(card_controls); in avs_rt5682_probe()
311 card->dapm_widgets = card_widgets; in avs_rt5682_probe()
312 card->num_dapm_widgets = ARRAY_SIZE(card_widgets); in avs_rt5682_probe()
313 card->dapm_routes = card_base_routes; in avs_rt5682_probe()
314 card->num_dapm_routes = ARRAY_SIZE(card_base_routes); in avs_rt5682_probe()
315 card->fully_routed = true; in avs_rt5682_probe()