Lines Matching +full:ssi +full:-

1 // SPDX-License-Identifier: GPL-2.0
28 /* P1022-specific PMUXCR and DMUXCR bit definitions */
38 #define CCSR_GUTS_DMUXCR_SSI 2 /* DMA controller/channel set to SSI */
56 unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch)); in guts_set_dmuxcr()
58 clrsetbits_be32(&guts->dmuxcr, 3 << shift, device << shift); in guts_set_dmuxcr()
65 * machine_data: machine-specific ASoC device data
85 * This function is used to initialize the board-specific hardware.
97 dev_err(card->dev, "could not map global utilities\n"); in p1022_rdk_machine_probe()
98 return -ENOMEM; in p1022_rdk_machine_probe()
101 /* Enable SSI Tx signal */ in p1022_rdk_machine_probe()
102 clrsetbits_be32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_UART0_I2C1_MASK, in p1022_rdk_machine_probe()
105 /* Enable SSI Rx signal */ in p1022_rdk_machine_probe()
106 clrsetbits_be32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK, in p1022_rdk_machine_probe()
109 /* Enable DMA Channel for SSI */ in p1022_rdk_machine_probe()
110 guts_set_dmuxcr(guts, mdata->dma_id[0], mdata->dma_channel_id[0], in p1022_rdk_machine_probe()
113 guts_set_dmuxcr(guts, mdata->dma_id[1], mdata->dma_channel_id[1], in p1022_rdk_machine_probe()
124 * This function takes board-specific information, like clock frequencies
132 container_of(rtd->card, struct machine_data, card); in p1022_rdk_startup()
133 struct device *dev = rtd->card->dev; in p1022_rdk_startup()
137 ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0), mdata->dai_format); in p1022_rdk_startup()
144 ret = snd_soc_dai_set_pll(asoc_rtd_to_codec(rtd, 0), 0, 0, mdata->clk_frequency, in p1022_rdk_startup()
145 mdata->clk_frequency); in p1022_rdk_startup()
158 * This function is called to remove the sound device for one SSI. We
159 * de-program the DMACR and PMUXCR register.
169 dev_err(card->dev, "could not map global utilities\n"); in p1022_rdk_machine_remove()
170 return -ENOMEM; in p1022_rdk_machine_remove()
174 clrbits32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_UART0_I2C1_MASK); in p1022_rdk_machine_remove()
175 clrbits32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK); in p1022_rdk_machine_remove()
176 guts_set_dmuxcr(guts, mdata->dma_id[0], mdata->dma_channel_id[0], 0); in p1022_rdk_machine_remove()
177 guts_set_dmuxcr(guts, mdata->dma_id[1], mdata->dma_channel_id[1], 0); in p1022_rdk_machine_remove()
194 * Although this is a machine driver, the SSI node is the "master" node with
196 * device for each new SSI node that has a codec attached.
200 struct device *dev = pdev->dev.parent; in p1022_rdk_probe()
201 /* ssi_pdev is the platform device for the SSI node that probed us */ in p1022_rdk_probe()
203 struct device_node *np = ssi_pdev->dev.of_node; in p1022_rdk_probe()
210 /* Find the codec node for this SSI. */ in p1022_rdk_probe()
211 codec_np = of_parse_phandle(np, "codec-handle", 0); in p1022_rdk_probe()
214 return -EINVAL; in p1022_rdk_probe()
219 ret = -ENOMEM; in p1022_rdk_probe()
223 comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL); in p1022_rdk_probe()
225 ret = -ENOMEM; in p1022_rdk_probe()
229 mdata->dai[0].cpus = &comp[0]; in p1022_rdk_probe()
230 mdata->dai[0].codecs = &comp[1]; in p1022_rdk_probe()
231 mdata->dai[0].platforms = &comp[2]; in p1022_rdk_probe()
233 mdata->dai[0].num_cpus = 1; in p1022_rdk_probe()
234 mdata->dai[0].num_codecs = 1; in p1022_rdk_probe()
235 mdata->dai[0].num_platforms = 1; in p1022_rdk_probe()
237 mdata->dai[1].cpus = &comp[3]; in p1022_rdk_probe()
238 mdata->dai[1].codecs = &comp[4]; in p1022_rdk_probe()
239 mdata->dai[1].platforms = &comp[5]; in p1022_rdk_probe()
241 mdata->dai[1].num_cpus = 1; in p1022_rdk_probe()
242 mdata->dai[1].num_codecs = 1; in p1022_rdk_probe()
243 mdata->dai[1].num_platforms = 1; in p1022_rdk_probe()
245 mdata->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev); in p1022_rdk_probe()
246 mdata->dai[0].ops = &p1022_rdk_ops; in p1022_rdk_probe()
249 mdata->dai[0].codecs->of_node = codec_np; in p1022_rdk_probe()
252 * We register two DAIs per SSI, one for playback and the other for in p1022_rdk_probe()
256 memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link)); in p1022_rdk_probe()
259 mdata->dai[0].codecs->dai_name = "wm8960-hifi"; in p1022_rdk_probe()
260 mdata->dai[1].codecs->dai_name = mdata->dai[0].codecs->dai_name; in p1022_rdk_probe()
263 * Configure the SSI for I2S slave mode. Older device trees have in p1022_rdk_probe()
265 * only one way to configure the SSI. in p1022_rdk_probe()
267 mdata->dai_format = SND_SOC_DAIFMT_NB_NF | in p1022_rdk_probe()
269 mdata->codec_clk_direction = SND_SOC_CLOCK_OUT; in p1022_rdk_probe()
270 mdata->cpu_clk_direction = SND_SOC_CLOCK_IN; in p1022_rdk_probe()
273 * In i2s-slave mode, the codec has its own clock source, so we in p1022_rdk_probe()
277 iprop = of_get_property(codec_np, "clock-frequency", NULL); in p1022_rdk_probe()
279 dev_err(&pdev->dev, "codec bus-frequency property is missing or invalid\n"); in p1022_rdk_probe()
280 ret = -EINVAL; in p1022_rdk_probe()
283 mdata->clk_frequency = be32_to_cpup(iprop); in p1022_rdk_probe()
285 if (!mdata->clk_frequency) { in p1022_rdk_probe()
286 dev_err(&pdev->dev, "unknown clock frequency\n"); in p1022_rdk_probe()
287 ret = -EINVAL; in p1022_rdk_probe()
292 mdata->dai[0].platforms->name = mdata->platform_name[0]; in p1022_rdk_probe()
293 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0], in p1022_rdk_probe()
294 &mdata->dma_channel_id[0], in p1022_rdk_probe()
295 &mdata->dma_id[0]); in p1022_rdk_probe()
297 dev_err(&pdev->dev, "missing/invalid playback DMA phandle (ret=%i)\n", in p1022_rdk_probe()
303 mdata->dai[1].platforms->name = mdata->platform_name[1]; in p1022_rdk_probe()
304 ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1], in p1022_rdk_probe()
305 &mdata->dma_channel_id[1], in p1022_rdk_probe()
306 &mdata->dma_id[1]); in p1022_rdk_probe()
308 dev_err(&pdev->dev, "missing/invalid capture DMA phandle (ret=%i)\n", in p1022_rdk_probe()
314 mdata->dai[0].stream_name = "playback"; in p1022_rdk_probe()
315 mdata->dai[1].stream_name = "capture"; in p1022_rdk_probe()
316 mdata->dai[0].name = mdata->dai[0].stream_name; in p1022_rdk_probe()
317 mdata->dai[1].name = mdata->dai[1].stream_name; in p1022_rdk_probe()
319 mdata->card.probe = p1022_rdk_machine_probe; in p1022_rdk_probe()
320 mdata->card.remove = p1022_rdk_machine_remove; in p1022_rdk_probe()
321 mdata->card.name = pdev->name; /* The platform driver name */ in p1022_rdk_probe()
322 mdata->card.owner = THIS_MODULE; in p1022_rdk_probe()
323 mdata->card.dev = &pdev->dev; in p1022_rdk_probe()
324 mdata->card.num_links = 2; in p1022_rdk_probe()
325 mdata->card.dai_link = mdata->dai; in p1022_rdk_probe()
328 ret = snd_soc_register_card(&mdata->card); in p1022_rdk_probe()
330 dev_err(&pdev->dev, "could not register card (ret=%i)\n", ret); in p1022_rdk_probe()
368 .name = "snd-soc-p1022rdk",
383 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); in p1022_rdk_init()
385 pr_err("snd-soc-p1022rdk: missing/invalid global utils node\n"); in p1022_rdk_init()
387 return -EINVAL; in p1022_rdk_init()