Lines Matching +full:ssc +full:- +full:on

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sam9x5_wm8731 -- SoC audio for AT91SAM9X5-based boards
12 * Based on sam9g20_wm8731.c by:
23 #include <sound/soc-dai.h>
24 #include <sound/soc-dapm.h>
32 #define DRV_NAME "sam9x5-snd-wm8731"
39 * Logic for a wm8731 as connected on a at91sam9x5ek based board.
44 struct device *dev = rtd->dev; in sam9x5_wm8731_init()
61 * Audio paths on at91sam9x5ek board:
63 * |A| ------------> | | ---R----> Headphone Jack
64 * |T| <----\ | WM | ---L--/
65 * |9| ---> CLK <--> | 8731 | <--R----- Line In Jack
66 * |1| <------------ | | <--L--/
75 struct device_node *np = pdev->dev.of_node; in sam9x5_wm8731_driver_probe()
84 dev_err(&pdev->dev, "No device node supplied\n"); in sam9x5_wm8731_driver_probe()
85 return -EINVAL; in sam9x5_wm8731_driver_probe()
88 card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); in sam9x5_wm8731_driver_probe()
89 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in sam9x5_wm8731_driver_probe()
90 dai = devm_kzalloc(&pdev->dev, sizeof(*dai), GFP_KERNEL); in sam9x5_wm8731_driver_probe()
91 comp = devm_kzalloc(&pdev->dev, 3 * sizeof(*comp), GFP_KERNEL); in sam9x5_wm8731_driver_probe()
93 ret = -ENOMEM; in sam9x5_wm8731_driver_probe()
99 card->dev = &pdev->dev; in sam9x5_wm8731_driver_probe()
100 card->owner = THIS_MODULE; in sam9x5_wm8731_driver_probe()
101 card->dai_link = dai; in sam9x5_wm8731_driver_probe()
102 card->num_links = 1; in sam9x5_wm8731_driver_probe()
103 card->dapm_widgets = sam9x5_dapm_widgets; in sam9x5_wm8731_driver_probe()
104 card->num_dapm_widgets = ARRAY_SIZE(sam9x5_dapm_widgets); in sam9x5_wm8731_driver_probe()
106 dai->cpus = &comp[0]; in sam9x5_wm8731_driver_probe()
107 dai->num_cpus = 1; in sam9x5_wm8731_driver_probe()
108 dai->codecs = &comp[1]; in sam9x5_wm8731_driver_probe()
109 dai->num_codecs = 1; in sam9x5_wm8731_driver_probe()
110 dai->platforms = &comp[2]; in sam9x5_wm8731_driver_probe()
111 dai->num_platforms = 1; in sam9x5_wm8731_driver_probe()
113 dai->name = "WM8731"; in sam9x5_wm8731_driver_probe()
114 dai->stream_name = "WM8731 PCM"; in sam9x5_wm8731_driver_probe()
115 dai->codecs->dai_name = "wm8731-hifi"; in sam9x5_wm8731_driver_probe()
116 dai->init = sam9x5_wm8731_init; in sam9x5_wm8731_driver_probe()
117 dai->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF in sam9x5_wm8731_driver_probe()
122 dev_err(&pdev->dev, "atmel,model node missing\n"); in sam9x5_wm8731_driver_probe()
126 ret = snd_soc_of_parse_audio_routing(card, "atmel,audio-routing"); in sam9x5_wm8731_driver_probe()
128 dev_err(&pdev->dev, "atmel,audio-routing node missing\n"); in sam9x5_wm8731_driver_probe()
132 codec_np = of_parse_phandle(np, "atmel,audio-codec", 0); in sam9x5_wm8731_driver_probe()
134 dev_err(&pdev->dev, "atmel,audio-codec node missing\n"); in sam9x5_wm8731_driver_probe()
135 ret = -EINVAL; in sam9x5_wm8731_driver_probe()
139 dai->codecs->of_node = codec_np; in sam9x5_wm8731_driver_probe()
141 cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0); in sam9x5_wm8731_driver_probe()
143 dev_err(&pdev->dev, "atmel,ssc-controller node missing\n"); in sam9x5_wm8731_driver_probe()
144 ret = -EINVAL; in sam9x5_wm8731_driver_probe()
147 dai->cpus->of_node = cpu_np; in sam9x5_wm8731_driver_probe()
148 dai->platforms->of_node = cpu_np; in sam9x5_wm8731_driver_probe()
150 priv->ssc_id = of_alias_get_id(cpu_np, "ssc"); in sam9x5_wm8731_driver_probe()
152 ret = atmel_ssc_set_audio(priv->ssc_id); in sam9x5_wm8731_driver_probe()
154 dev_err(&pdev->dev, "Failed to set SSC %d for audio: %d\n", in sam9x5_wm8731_driver_probe()
155 ret, priv->ssc_id); in sam9x5_wm8731_driver_probe()
159 ret = devm_snd_soc_register_card(&pdev->dev, card); in sam9x5_wm8731_driver_probe()
161 dev_err(&pdev->dev, "Platform device allocation failed\n"); in sam9x5_wm8731_driver_probe()
165 dev_dbg(&pdev->dev, "%s ok\n", __func__); in sam9x5_wm8731_driver_probe()
170 atmel_ssc_put_audio(priv->ssc_id); in sam9x5_wm8731_driver_probe()
182 struct sam9x5_drvdata *priv = card->drvdata; in sam9x5_wm8731_driver_remove()
184 atmel_ssc_put_audio(priv->ssc_id); in sam9x5_wm8731_driver_remove()
188 { .compatible = "atmel,sam9x5-wm8731-audio", },
206 MODULE_DESCRIPTION("ALSA SoC machine driver for AT91SAM9x5 - WM8731");