Lines Matching +full:spk +full:- +full:fmt
1 // SPDX-License-Identifier: GPL-2.0-only
3 * omap-twl4030.c -- SoC audio for TI SoC based boards with twl4030 codec
5 * Copyright (C) 2012 Texas Instruments Incorporated - https://www.ti.com
20 #include <linux/platform_data/omap-twl4030.h>
29 #include "omap-mcbsp.h"
39 unsigned int fmt; in omap_twl4030_hw_params() local
43 fmt = SND_SOC_DAIFMT_I2S | in omap_twl4030_hw_params()
48 fmt = SND_SOC_DAIFMT_DSP_A | in omap_twl4030_hw_params()
53 return -EINVAL; in omap_twl4030_hw_params()
56 return snd_soc_runtime_set_dai_fmt(rtd, fmt); in omap_twl4030_hw_params()
64 SND_SOC_DAPM_SPK("Earpiece Spk", NULL),
65 SND_SOC_DAPM_SPK("Handsfree Spk", NULL),
67 SND_SOC_DAPM_SPK("Ext Spk", NULL),
68 SND_SOC_DAPM_SPK("Carkit Spk", NULL),
84 {"Handsfree Spk", NULL, "HFL"},
85 {"Handsfree Spk", NULL, "HFR"},
87 {"Ext Spk", NULL, "PREDRIVEL"},
88 {"Ext Spk", NULL, "PREDRIVER"},
90 {"Carkit Spk", NULL, "CARKITL"},
91 {"Carkit Spk", NULL, "CARKITR"},
93 {"Earpiece Spk", NULL, "EARPIECE"},
130 .name = "ti,jack-det",
145 struct snd_soc_card *card = rtd->card; in omap_twl4030_init()
146 struct snd_soc_dapm_context *dapm = &card->dapm; in omap_twl4030_init()
147 struct omap_tw4030_pdata *pdata = dev_get_platdata(card->dev); in omap_twl4030_init()
155 if (of_property_present(card->dev->of_node, "ti,jack-det-gpio")) { in omap_twl4030_init()
156 hs_jack_gpios[0].gpiod_dev = card->dev; in omap_twl4030_init()
159 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack", in omap_twl4030_init()
161 &priv->hs_jack, hs_jack_pins, in omap_twl4030_init()
166 ret = snd_soc_jack_add_gpios(&priv->hs_jack, in omap_twl4030_init()
177 if (!pdata || !pdata->custom_routing) in omap_twl4030_init()
181 twl4030_disconnect_pin(dapm, pdata->has_ear, "Earpiece Spk"); in omap_twl4030_init()
182 twl4030_disconnect_pin(dapm, pdata->has_hf, "Handsfree Spk"); in omap_twl4030_init()
183 twl4030_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone"); in omap_twl4030_init()
184 twl4030_disconnect_pin(dapm, pdata->has_predriv, "Ext Spk"); in omap_twl4030_init()
185 twl4030_disconnect_pin(dapm, pdata->has_carkit, "Carkit Spk"); in omap_twl4030_init()
187 twl4030_disconnect_pin(dapm, pdata->has_mainmic, "Main Mic"); in omap_twl4030_init()
188 twl4030_disconnect_pin(dapm, pdata->has_submic, "Sub Mic"); in omap_twl4030_init()
189 twl4030_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); in omap_twl4030_init()
190 twl4030_disconnect_pin(dapm, pdata->has_carkitmic, "Carkit Mic"); in omap_twl4030_init()
191 twl4030_disconnect_pin(dapm, pdata->has_digimic0, "Digital0 Mic"); in omap_twl4030_init()
192 twl4030_disconnect_pin(dapm, pdata->has_digimic1, "Digital1 Mic"); in omap_twl4030_init()
193 twl4030_disconnect_pin(dapm, pdata->has_linein, "Line In"); in omap_twl4030_init()
198 /* Digital audio interface glue - connects codec <--> CPU */
200 DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.2")),
201 DAILINK_COMP_ARRAY(COMP_CODEC("twl4030-codec", "twl4030-hifi")),
202 DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.2")));
205 DAILINK_COMP_ARRAY(COMP_CPU("omap-mcbsp.3")),
206 DAILINK_COMP_ARRAY(COMP_CODEC("twl4030-codec", "twl4030-voice")),
207 DAILINK_COMP_ARRAY(COMP_PLATFORM("omap-mcbsp.3")));
240 struct omap_tw4030_pdata *pdata = dev_get_platdata(&pdev->dev); in omap_twl4030_probe()
241 struct device_node *node = pdev->dev.of_node; in omap_twl4030_probe()
246 card->dev = &pdev->dev; in omap_twl4030_probe()
248 priv = devm_kzalloc(&pdev->dev, sizeof(struct omap_twl4030), GFP_KERNEL); in omap_twl4030_probe()
250 return -ENOMEM; in omap_twl4030_probe()
257 dev_err(&pdev->dev, "Card name is not provided\n"); in omap_twl4030_probe()
258 return -ENODEV; in omap_twl4030_probe()
263 dev_err(&pdev->dev, "McBSP node is not provided\n"); in omap_twl4030_probe()
264 return -EINVAL; in omap_twl4030_probe()
266 omap_twl4030_dai_links[0].cpus->dai_name = NULL; in omap_twl4030_probe()
267 omap_twl4030_dai_links[0].cpus->of_node = dai_node; in omap_twl4030_probe()
269 omap_twl4030_dai_links[0].platforms->name = NULL; in omap_twl4030_probe()
270 omap_twl4030_dai_links[0].platforms->of_node = dai_node; in omap_twl4030_probe()
272 dai_node = of_parse_phandle(node, "ti,mcbsp-voice", 0); in omap_twl4030_probe()
274 card->num_links = 1; in omap_twl4030_probe()
276 omap_twl4030_dai_links[1].cpus->dai_name = NULL; in omap_twl4030_probe()
277 omap_twl4030_dai_links[1].cpus->of_node = dai_node; in omap_twl4030_probe()
279 omap_twl4030_dai_links[1].platforms->name = NULL; in omap_twl4030_probe()
280 omap_twl4030_dai_links[1].platforms->of_node = dai_node; in omap_twl4030_probe()
284 prop = of_find_property(node, "ti,audio-routing", NULL); in omap_twl4030_probe()
287 "ti,audio-routing"); in omap_twl4030_probe()
291 card->fully_routed = 1; in omap_twl4030_probe()
294 if (pdata->card_name) { in omap_twl4030_probe()
295 card->name = pdata->card_name; in omap_twl4030_probe()
297 dev_err(&pdev->dev, "Card name is not provided\n"); in omap_twl4030_probe()
298 return -ENODEV; in omap_twl4030_probe()
301 if (!pdata->voice_connected) in omap_twl4030_probe()
302 card->num_links = 1; in omap_twl4030_probe()
304 dev_err(&pdev->dev, "Missing pdata\n"); in omap_twl4030_probe()
305 return -ENODEV; in omap_twl4030_probe()
309 ret = devm_snd_soc_register_card(&pdev->dev, card); in omap_twl4030_probe()
311 dev_err(&pdev->dev, "devm_snd_soc_register_card() failed: %d\n", in omap_twl4030_probe()
320 {.compatible = "ti,omap-twl4030", },
327 .name = "omap-twl4030",
339 MODULE_ALIAS("platform:omap-twl4030");