Lines Matching +full:global +full:- +full:utilities

1 // SPDX-License-Identifier: GPL-2.0
28 /* P1022-specific PMUXCR and DMUXCR bit definitions */
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()
61 /* There's only one global utilities register */
65 * machine_data: machine-specific ASoC device data
83 * p1022_rdk_machine_probe - initialize the board
86 * This function is used to initialize the board-specific hardware.
100 dev_err(card->dev, "could not map global utilities\n"); in p1022_rdk_machine_probe()
101 return -ENOMEM; in p1022_rdk_machine_probe()
105 clrsetbits_be32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_UART0_I2C1_MASK, in p1022_rdk_machine_probe()
109 clrsetbits_be32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK, in p1022_rdk_machine_probe()
113 guts_set_dmuxcr(guts, mdata->dma_id[0], mdata->dma_channel_id[0], in p1022_rdk_machine_probe()
116 guts_set_dmuxcr(guts, mdata->dma_id[1], mdata->dma_channel_id[1], in p1022_rdk_machine_probe()
125 * p1022_rdk_startup - program the board with various hardware parameters
128 * This function takes board-specific information, like clock frequencies
138 container_of(rtd->card, struct machine_data, card); in p1022_rdk_startup()
139 struct device *dev = rtd->card->dev; in p1022_rdk_startup()
143 ret = snd_soc_dai_set_fmt(snd_soc_rtd_to_codec(rtd, 0), mdata->dai_format); in p1022_rdk_startup()
150 ret = snd_soc_dai_set_pll(snd_soc_rtd_to_codec(rtd, 0), 0, 0, mdata->clk_frequency, in p1022_rdk_startup()
151 mdata->clk_frequency); in p1022_rdk_startup()
162 * p1022_rdk_machine_remove - Remove the sound device
166 * de-program the DMACR and PMUXCR register.
178 dev_err(card->dev, "could not map global utilities\n"); in p1022_rdk_machine_remove()
179 return -ENOMEM; in p1022_rdk_machine_remove()
183 clrbits32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_UART0_I2C1_MASK); in p1022_rdk_machine_remove()
184 clrbits32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK); in p1022_rdk_machine_remove()
185 guts_set_dmuxcr(guts, mdata->dma_id[0], mdata->dma_channel_id[0], 0); in p1022_rdk_machine_remove()
186 guts_set_dmuxcr(guts, mdata->dma_id[1], mdata->dma_channel_id[1], 0); in p1022_rdk_machine_remove()
201 * p1022_rdk_probe - platform probe function for the machine driver
212 struct device *dev = pdev->dev.parent; in p1022_rdk_probe()
215 struct device_node *np = ssi_pdev->dev.of_node; in p1022_rdk_probe()
223 codec_np = of_parse_phandle(np, "codec-handle", 0); in p1022_rdk_probe()
226 return -EINVAL; in p1022_rdk_probe()
231 ret = -ENOMEM; in p1022_rdk_probe()
235 comp = devm_kzalloc(&pdev->dev, 6 * sizeof(*comp), GFP_KERNEL); in p1022_rdk_probe()
237 ret = -ENOMEM; in p1022_rdk_probe()
241 mdata->dai[0].cpus = &comp[0]; in p1022_rdk_probe()
242 mdata->dai[0].codecs = &comp[1]; in p1022_rdk_probe()
243 mdata->dai[0].platforms = &comp[2]; in p1022_rdk_probe()
245 mdata->dai[0].num_cpus = 1; in p1022_rdk_probe()
246 mdata->dai[0].num_codecs = 1; in p1022_rdk_probe()
247 mdata->dai[0].num_platforms = 1; in p1022_rdk_probe()
249 mdata->dai[1].cpus = &comp[3]; in p1022_rdk_probe()
250 mdata->dai[1].codecs = &comp[4]; in p1022_rdk_probe()
251 mdata->dai[1].platforms = &comp[5]; in p1022_rdk_probe()
253 mdata->dai[1].num_cpus = 1; in p1022_rdk_probe()
254 mdata->dai[1].num_codecs = 1; in p1022_rdk_probe()
255 mdata->dai[1].num_platforms = 1; in p1022_rdk_probe()
257 mdata->dai[0].cpus->dai_name = dev_name(&ssi_pdev->dev); in p1022_rdk_probe()
258 mdata->dai[0].ops = &p1022_rdk_ops; in p1022_rdk_probe()
261 mdata->dai[0].codecs->of_node = codec_np; in p1022_rdk_probe()
268 memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link)); in p1022_rdk_probe()
271 mdata->dai[0].codecs->dai_name = "wm8960-hifi"; in p1022_rdk_probe()
272 mdata->dai[1].codecs->dai_name = mdata->dai[0].codecs->dai_name; in p1022_rdk_probe()
279 mdata->dai_format = SND_SOC_DAIFMT_NB_NF | in p1022_rdk_probe()
281 mdata->codec_clk_direction = SND_SOC_CLOCK_OUT; in p1022_rdk_probe()
282 mdata->cpu_clk_direction = SND_SOC_CLOCK_IN; in p1022_rdk_probe()
285 * In i2s-slave mode, the codec has its own clock source, so we in p1022_rdk_probe()
289 iprop = of_get_property(codec_np, "clock-frequency", NULL); in p1022_rdk_probe()
291 dev_err(&pdev->dev, "codec bus-frequency property is missing or invalid\n"); in p1022_rdk_probe()
292 ret = -EINVAL; in p1022_rdk_probe()
295 mdata->clk_frequency = be32_to_cpup(iprop); in p1022_rdk_probe()
297 if (!mdata->clk_frequency) { in p1022_rdk_probe()
298 dev_err(&pdev->dev, "unknown clock frequency\n"); in p1022_rdk_probe()
299 ret = -EINVAL; in p1022_rdk_probe()
304 mdata->dai[0].platforms->name = mdata->platform_name[0]; in p1022_rdk_probe()
305 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0], in p1022_rdk_probe()
306 &mdata->dma_channel_id[0], in p1022_rdk_probe()
307 &mdata->dma_id[0]); in p1022_rdk_probe()
309 dev_err(&pdev->dev, "missing/invalid playback DMA phandle (ret=%i)\n", in p1022_rdk_probe()
315 mdata->dai[1].platforms->name = mdata->platform_name[1]; in p1022_rdk_probe()
316 ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1], in p1022_rdk_probe()
317 &mdata->dma_channel_id[1], in p1022_rdk_probe()
318 &mdata->dma_id[1]); in p1022_rdk_probe()
320 dev_err(&pdev->dev, "missing/invalid capture DMA phandle (ret=%i)\n", in p1022_rdk_probe()
326 mdata->dai[0].stream_name = "playback"; in p1022_rdk_probe()
327 mdata->dai[1].stream_name = "capture"; in p1022_rdk_probe()
328 mdata->dai[0].name = mdata->dai[0].stream_name; in p1022_rdk_probe()
329 mdata->dai[1].name = mdata->dai[1].stream_name; in p1022_rdk_probe()
331 mdata->card.probe = p1022_rdk_machine_probe; in p1022_rdk_probe()
332 mdata->card.remove = p1022_rdk_machine_remove; in p1022_rdk_probe()
333 mdata->card.name = pdev->name; /* The platform driver name */ in p1022_rdk_probe()
334 mdata->card.owner = THIS_MODULE; in p1022_rdk_probe()
335 mdata->card.dev = &pdev->dev; in p1022_rdk_probe()
336 mdata->card.num_links = 2; in p1022_rdk_probe()
337 mdata->card.dai_link = mdata->dai; in p1022_rdk_probe()
340 ret = snd_soc_register_card(&mdata->card); in p1022_rdk_probe()
342 dev_err(&pdev->dev, "could not register card (ret=%i)\n", ret); in p1022_rdk_probe()
356 * p1022_rdk_remove - remove the platform device
379 .name = "snd-soc-p1022rdk",
384 * p1022_rdk_init - machine driver initialization.
395 /* Get the physical address of the global utilities registers */ in p1022_rdk_init()
396 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); in p1022_rdk_init()
398 pr_err("snd-soc-p1022rdk: missing/invalid global utils node\n"); in p1022_rdk_init()
400 return -EINVAL; in p1022_rdk_init()
409 * p1022_rdk_exit - machine driver exit