• Home
  • Raw
  • Download

Lines Matching +full:headset +full:- +full:detect

2  * omap-abe-twl6040.c  --  SoC audio for TI OMAP based boards with ABE and
19 * 02110-1301 USA
34 #include "omap-dmic.h"
35 #include "omap-mcpdm.h"
41 int jack_detection; /* board can detect jack events */
50 struct snd_soc_pcm_runtime *rtd = substream->private_data; in omap_abe_hw_params()
51 struct snd_soc_dai *codec_dai = rtd->codec_dai; in omap_abe_hw_params()
52 struct snd_soc_card *card = rtd->card; in omap_abe_hw_params()
57 clk_id = twl6040_get_clk_id(codec_dai->component); in omap_abe_hw_params()
59 freq = priv->mclk_freq; in omap_abe_hw_params()
63 return -EINVAL; in omap_abe_hw_params()
82 struct snd_soc_pcm_runtime *rtd = substream->private_data; in omap_abe_dmic_hw_params()
83 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; in omap_abe_dmic_hw_params()
105 /* Headset jack */
108 /*Headset jack detection DAPM pins */
111 .pin = "Headset Mic",
115 .pin = "Headset Stereophone",
123 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
130 SND_SOC_DAPM_MIC("Headset Mic", NULL),
141 {"Headset Stereophone", NULL, "HSOL"},
142 {"Headset Stereophone", NULL, "HSOR"},
156 {"HSMIC", NULL, "Headset Mic"},
157 {"Headset Mic", NULL, "Headset Mic Bias"},
171 struct snd_soc_component *component = rtd->codec_dai->component; in omap_abe_twl6040_init()
172 struct snd_soc_card *card = rtd->card; in omap_abe_twl6040_init()
185 /* Headset jack detection only if it is supported */ in omap_abe_twl6040_init()
186 if (priv->jack_detection) { in omap_abe_twl6040_init()
187 ret = snd_soc_card_jack_new(rtd->card, "Headset Jack", in omap_abe_twl6040_init()
207 struct snd_soc_dapm_context *dapm = &rtd->card->dapm; in omap_abe_dmic_init()
215 struct device_node *node = pdev->dev.of_node; in omap_abe_probe()
223 dev_err(&pdev->dev, "of node is missing.\n"); in omap_abe_probe()
224 return -ENODEV; in omap_abe_probe()
227 priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL); in omap_abe_probe()
229 return -ENOMEM; in omap_abe_probe()
231 card = &priv->card; in omap_abe_probe()
232 card->dev = &pdev->dev; in omap_abe_probe()
233 card->owner = THIS_MODULE; in omap_abe_probe()
234 card->dapm_widgets = twl6040_dapm_widgets; in omap_abe_probe()
235 card->num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets); in omap_abe_probe()
236 card->dapm_routes = audio_map; in omap_abe_probe()
237 card->num_dapm_routes = ARRAY_SIZE(audio_map); in omap_abe_probe()
240 dev_err(&pdev->dev, "Card name is not provided\n"); in omap_abe_probe()
241 return -ENODEV; in omap_abe_probe()
244 ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing"); in omap_abe_probe()
246 dev_err(&pdev->dev, "Error while parsing DAPM routing\n"); in omap_abe_probe()
252 dev_err(&pdev->dev, "McPDM node is not provided\n"); in omap_abe_probe()
253 return -EINVAL; in omap_abe_probe()
256 priv->dai_links[0].name = "DMIC"; in omap_abe_probe()
257 priv->dai_links[0].stream_name = "TWL6040"; in omap_abe_probe()
258 priv->dai_links[0].cpu_of_node = dai_node; in omap_abe_probe()
259 priv->dai_links[0].platform_of_node = dai_node; in omap_abe_probe()
260 priv->dai_links[0].codec_dai_name = "twl6040-legacy"; in omap_abe_probe()
261 priv->dai_links[0].codec_name = "twl6040-codec"; in omap_abe_probe()
262 priv->dai_links[0].init = omap_abe_twl6040_init; in omap_abe_probe()
263 priv->dai_links[0].ops = &omap_abe_ops; in omap_abe_probe()
268 priv->dai_links[1].name = "TWL6040"; in omap_abe_probe()
269 priv->dai_links[1].stream_name = "DMIC Capture"; in omap_abe_probe()
270 priv->dai_links[1].cpu_of_node = dai_node; in omap_abe_probe()
271 priv->dai_links[1].platform_of_node = dai_node; in omap_abe_probe()
272 priv->dai_links[1].codec_dai_name = "dmic-hifi"; in omap_abe_probe()
273 priv->dai_links[1].codec_name = "dmic-codec"; in omap_abe_probe()
274 priv->dai_links[1].init = omap_abe_dmic_init; in omap_abe_probe()
275 priv->dai_links[1].ops = &omap_abe_dmic_ops; in omap_abe_probe()
280 priv->jack_detection = of_property_read_bool(node, "ti,jack-detection"); in omap_abe_probe()
281 of_property_read_u32(node, "ti,mclk-freq", &priv->mclk_freq); in omap_abe_probe()
282 if (!priv->mclk_freq) { in omap_abe_probe()
283 dev_err(&pdev->dev, "MCLK frequency not provided\n"); in omap_abe_probe()
284 return -EINVAL; in omap_abe_probe()
287 card->fully_routed = 1; in omap_abe_probe()
289 if (!priv->mclk_freq) { in omap_abe_probe()
290 dev_err(&pdev->dev, "MCLK frequency missing\n"); in omap_abe_probe()
291 return -ENODEV; in omap_abe_probe()
294 card->dai_link = priv->dai_links; in omap_abe_probe()
295 card->num_links = num_links; in omap_abe_probe()
299 ret = devm_snd_soc_register_card(&pdev->dev, card); in omap_abe_probe()
301 dev_err(&pdev->dev, "devm_snd_soc_register_card() failed: %d\n", in omap_abe_probe()
308 {.compatible = "ti,abe-twl6040", },
315 .name = "omap-abe-twl6040",
326 dmic_codec_dev = platform_device_register_simple("dmic-codec", -1, NULL, in omap_abe_init()
329 pr_err("%s: dmic-codec device registration failed\n", __func__); in omap_abe_init()
353 MODULE_ALIAS("platform:omap-abe-twl6040");