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

1 // SPDX-License-Identifier: GPL-2.0-only
3 // Copyright(c) 2021-2022 Intel Corporation
14 #include <sound/soc-acpi.h>
20 #define RT274_CODEC_DAI "rt274-aif1"
30 struct snd_soc_dapm_context *dapm = w->dapm; in avs_rt274_clock_control()
31 struct snd_soc_card *card = dapm->card; in avs_rt274_clock_control()
37 return -EINVAL; in avs_rt274_clock_control()
43 dev_err(codec_dai->dev, "set codec sysclk failed: %d\n", ret); in avs_rt274_clock_control()
55 dev_err(codec_dai->dev, "failed to enable PLL2: %d\n", ret); in avs_rt274_clock_control()
92 struct snd_soc_component *component = codec_dai->component; in avs_rt274_codec_init()
93 struct snd_soc_jack_pin *pins; in avs_rt274_codec_init() local
95 struct snd_soc_card *card = runtime->card; in avs_rt274_codec_init()
101 pins = devm_kmemdup(card->dev, card_headset_pins, sizeof(*pins) * num_pins, GFP_KERNEL); in avs_rt274_codec_init()
102 if (!pins) in avs_rt274_codec_init()
103 return -ENOMEM; in avs_rt274_codec_init()
105 ret = snd_soc_card_jack_new_pins(card, "Headset Jack", SND_JACK_HEADSET, jack, pins, in avs_rt274_codec_init()
115 dev_err(card->dev, "can't set codec pcm format %d\n", ret); in avs_rt274_codec_init()
119 card->dapm.idle_bias_off = true; in avs_rt274_codec_init()
126 snd_soc_component_set_jack(snd_soc_rtd_to_codec(rtd, 0)->component, NULL, NULL); in avs_rt274_codec_exit()
139 rate->min = rate->max = AVS_RT274_BE_FIXUP_RATE; in avs_rt274_be_fixup()
140 channels->min = channels->max = 2; in avs_rt274_be_fixup()
158 return -ENOMEM; in avs_create_dai_link()
160 platform->name = platform_name; in avs_create_dai_link()
162 dl->name = devm_kasprintf(dev, GFP_KERNEL, in avs_create_dai_link()
163 AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot)); in avs_create_dai_link()
164 dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL); in avs_create_dai_link()
165 dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL); in avs_create_dai_link()
166 if (!dl->name || !dl->cpus || !dl->codecs) in avs_create_dai_link()
167 return -ENOMEM; in avs_create_dai_link()
169 dl->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, in avs_create_dai_link()
171 dl->codecs->name = devm_kasprintf(dev, GFP_KERNEL, "i2c-INT34C2:00"); in avs_create_dai_link()
172 dl->codecs->dai_name = devm_kasprintf(dev, GFP_KERNEL, RT274_CODEC_DAI); in avs_create_dai_link()
173 if (!dl->cpus->dai_name || !dl->codecs->name || !dl->codecs->dai_name) in avs_create_dai_link()
174 return -ENOMEM; in avs_create_dai_link()
176 dl->num_cpus = 1; in avs_create_dai_link()
177 dl->num_codecs = 1; in avs_create_dai_link()
178 dl->platforms = platform; in avs_create_dai_link()
179 dl->num_platforms = 1; in avs_create_dai_link()
180 dl->id = 0; in avs_create_dai_link()
181 dl->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS; in avs_create_dai_link()
182 dl->init = avs_rt274_codec_init; in avs_create_dai_link()
183 dl->exit = avs_rt274_codec_exit; in avs_create_dai_link()
184 dl->be_hw_params_fixup = avs_rt274_be_fixup; in avs_create_dai_link()
185 dl->nonatomic = 1; in avs_create_dai_link()
186 dl->no_pcm = 1; in avs_create_dai_link()
187 dl->dpcm_capture = 1; in avs_create_dai_link()
188 dl->dpcm_playback = 1; in avs_create_dai_link()
199 return snd_soc_component_set_jack(codec_dai->component, NULL, NULL); in avs_card_suspend_pre()
207 return snd_soc_component_set_jack(codec_dai->component, jack, NULL); in avs_card_resume_post()
216 struct device *dev = &pdev->dev; in avs_rt274_probe()
221 pname = mach->mach_params.platform; in avs_rt274_probe()
236 return -ENOMEM; in avs_rt274_probe()
238 card->name = "avs_rt274"; in avs_rt274_probe()
239 card->dev = dev; in avs_rt274_probe()
240 card->owner = THIS_MODULE; in avs_rt274_probe()
241 card->suspend_pre = avs_card_suspend_pre; in avs_rt274_probe()
242 card->resume_post = avs_card_resume_post; in avs_rt274_probe()
243 card->dai_link = dai_link; in avs_rt274_probe()
244 card->num_links = 1; in avs_rt274_probe()
245 card->controls = card_controls; in avs_rt274_probe()
246 card->num_controls = ARRAY_SIZE(card_controls); in avs_rt274_probe()
247 card->dapm_widgets = card_widgets; in avs_rt274_probe()
248 card->num_dapm_widgets = ARRAY_SIZE(card_widgets); in avs_rt274_probe()
249 card->dapm_routes = card_base_routes; in avs_rt274_probe()
250 card->num_dapm_routes = ARRAY_SIZE(card_base_routes); in avs_rt274_probe()
251 card->fully_routed = true; in avs_rt274_probe()