Lines Matching +full:platform +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0
5 #include <dt-bindings/sound/qcom,q6afe.h>
8 #include <linux/input-event-codes.h>
30 struct device_node *platform = NULL; in qcom_snd_parse_of() local
32 struct device *dev = card->dev; in qcom_snd_parse_of()
39 if (ret == 0 && !card->name) in qcom_snd_parse_of()
43 dev_err(dev, "Error parsing card name: %d\n", ret); in qcom_snd_parse_of()
47 if (of_property_read_bool(dev->of_node, "widgets")) { in qcom_snd_parse_of()
54 if (of_property_read_bool(dev->of_node, "audio-routing")) { in qcom_snd_parse_of()
55 ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); in qcom_snd_parse_of()
60 if (of_property_read_bool(dev->of_node, "qcom,audio-routing")) { in qcom_snd_parse_of()
61 ret = snd_soc_of_parse_audio_routing(card, "qcom,audio-routing"); in qcom_snd_parse_of()
66 ret = snd_soc_of_parse_pin_switches(card, "pin-switches"); in qcom_snd_parse_of()
70 ret = snd_soc_of_parse_aux_devs(card, "aux-devs"); in qcom_snd_parse_of()
75 num_links = of_get_available_child_count(dev->of_node); in qcom_snd_parse_of()
78 card->dai_link = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL); in qcom_snd_parse_of()
79 if (!card->dai_link) in qcom_snd_parse_of()
80 return -ENOMEM; in qcom_snd_parse_of()
82 card->num_links = num_links; in qcom_snd_parse_of()
83 link = card->dai_link; in qcom_snd_parse_of()
85 for_each_available_child_of_node(dev->of_node, np) { in qcom_snd_parse_of()
88 ret = -ENOMEM; in qcom_snd_parse_of()
92 link->cpus = &dlc[0]; in qcom_snd_parse_of()
93 link->platforms = &dlc[1]; in qcom_snd_parse_of()
95 link->num_cpus = 1; in qcom_snd_parse_of()
96 link->num_platforms = 1; in qcom_snd_parse_of()
98 ret = of_property_read_string(np, "link-name", &link->name); in qcom_snd_parse_of()
100 dev_err(card->dev, "error getting codec dai_link name\n"); in qcom_snd_parse_of()
105 platform = of_get_child_by_name(np, "platform"); in qcom_snd_parse_of()
109 dev_err(dev, "%s: Can't find cpu DT node\n", link->name); in qcom_snd_parse_of()
110 ret = -EINVAL; in qcom_snd_parse_of()
114 ret = snd_soc_of_get_dlc(cpu, &args, link->cpus, 0); in qcom_snd_parse_of()
116 dev_err_probe(card->dev, ret, in qcom_snd_parse_of()
117 "%s: error getting cpu dai name\n", link->name); in qcom_snd_parse_of()
121 link->id = args.args[0]; in qcom_snd_parse_of()
123 if (platform) { in qcom_snd_parse_of()
124 link->platforms->of_node = of_parse_phandle(platform, in qcom_snd_parse_of()
125 "sound-dai", in qcom_snd_parse_of()
127 if (!link->platforms->of_node) { in qcom_snd_parse_of()
128 dev_err(card->dev, "%s: platform dai not found\n", link->name); in qcom_snd_parse_of()
129 ret = -EINVAL; in qcom_snd_parse_of()
133 link->platforms->of_node = link->cpus->of_node; in qcom_snd_parse_of()
139 dev_err_probe(card->dev, ret, in qcom_snd_parse_of()
140 "%s: codec dai not found\n", link->name); in qcom_snd_parse_of()
144 if (platform) { in qcom_snd_parse_of()
146 link->no_pcm = 1; in qcom_snd_parse_of()
147 link->ignore_pmdown_time = 1; in qcom_snd_parse_of()
151 link->codecs = &snd_soc_dummy_dlc; in qcom_snd_parse_of()
152 link->num_codecs = 1; in qcom_snd_parse_of()
153 link->dynamic = 1; in qcom_snd_parse_of()
156 if (platform || !codec) { in qcom_snd_parse_of()
158 link->ignore_suspend = 1; in qcom_snd_parse_of()
159 link->nonatomic = 1; in qcom_snd_parse_of()
162 link->stream_name = link->name; in qcom_snd_parse_of()
167 of_node_put(platform); in qcom_snd_parse_of()
170 if (!card->dapm_widgets) { in qcom_snd_parse_of()
171 card->dapm_widgets = qcom_jack_snd_widgets; in qcom_snd_parse_of()
172 card->num_dapm_widgets = ARRAY_SIZE(qcom_jack_snd_widgets); in qcom_snd_parse_of()
179 of_node_put(platform); in qcom_snd_parse_of()
203 struct snd_soc_card *card = rtd->card; in qcom_snd_wcd_jack_setup()
217 dev_err(card->dev, "Unable to add Headphone Jack\n"); in qcom_snd_wcd_jack_setup()
221 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); in qcom_snd_wcd_jack_setup()
222 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); in qcom_snd_wcd_jack_setup()
223 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); in qcom_snd_wcd_jack_setup()
224 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); in qcom_snd_wcd_jack_setup()
228 switch (cpu_dai->id) { in qcom_snd_wcd_jack_setup()
234 rval = snd_soc_component_set_jack(codec_dai->component, in qcom_snd_wcd_jack_setup()
236 if (rval != 0 && rval != -ENOTSUPP) { in qcom_snd_wcd_jack_setup()
237 dev_warn(card->dev, "Failed to set jack: %d\n", rval); in qcom_snd_wcd_jack_setup()
256 struct snd_soc_card *card = rtd->card; in qcom_snd_dp_jack_setup()
266 rval = snd_soc_component_set_jack(codec_dai->component, dp_jack, NULL); in qcom_snd_dp_jack_setup()
267 if (rval != 0 && rval != -ENOTSUPP) { in qcom_snd_dp_jack_setup()
268 dev_warn(card->dev, "Failed to set jack: %d\n", rval); in qcom_snd_dp_jack_setup()