28 #include <linux/module.h>
34 #include <linux/slab.h>
46 #define OMAP44XX_MCPDM_L3_BASE 0x49032000
73 .name =
"Audio playback",
76 .name =
"Audio capture",
91 static void omap_mcpdm_reg_dump(
struct omap_mcpdm *mcpdm)
93 dev_dbg(mcpdm->
dev,
"***********************\n");
100 dev_dbg(mcpdm->
dev,
"IRQENABLE_CLR: 0x%04x\n",
104 dev_dbg(mcpdm->
dev,
"DMAENABLE_SET: 0x%04x\n",
106 dev_dbg(mcpdm->
dev,
"DMAENABLE_CLR: 0x%04x\n",
120 dev_dbg(mcpdm->
dev,
"***********************\n");
123 static void omap_mcpdm_reg_dump(
struct omap_mcpdm *mcpdm) {}
130 static void omap_mcpdm_start(
struct omap_mcpdm *mcpdm)
148 static void omap_mcpdm_stop(
struct omap_mcpdm *mcpdm)
166 static inline int omap_mcpdm_active(
struct omap_mcpdm *mcpdm)
176 static void omap_mcpdm_open_streams(
struct omap_mcpdm *mcpdm)
202 static void omap_mcpdm_close_streams(
struct omap_mcpdm *mcpdm)
234 dev_dbg(mcpdm->
dev,
"DN (playback) FIFO Full\n");
237 dev_dbg(mcpdm->
dev,
"DN (playback) FIFO Empty\n");
240 dev_dbg(mcpdm->
dev,
"DN (playback) write request\n");
243 dev_dbg(mcpdm->
dev,
"UP (capture) FIFO Full\n");
246 dev_dbg(mcpdm->
dev,
"UP (capture) FIFO Empty\n");
249 dev_dbg(mcpdm->
dev,
"UP (capture) write request\n");
257 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
265 omap_mcpdm_open_streams(mcpdm);
269 snd_soc_dai_set_dma_data(dai, substream,
270 &omap_mcpdm_dai_dma_params[substream->
stream]);
278 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
283 if (omap_mcpdm_active(mcpdm)) {
284 omap_mcpdm_stop(mcpdm);
285 omap_mcpdm_close_streams(mcpdm);
296 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
326 dma_data = snd_soc_dai_get_dma_data(dai, substream);
344 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
346 if (!omap_mcpdm_active(mcpdm)) {
347 omap_mcpdm_start(mcpdm);
348 omap_mcpdm_reg_dump(mcpdm);
355 .startup = omap_mcpdm_dai_startup,
356 .shutdown = omap_mcpdm_dai_shutdown,
357 .hw_params = omap_mcpdm_dai_hw_params,
358 .prepare = omap_mcpdm_prepare,
361 static int omap_mcpdm_probe(
struct snd_soc_dai *dai)
363 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
369 pm_runtime_get_sync(mcpdm->
dev);
373 0,
"McPDM", (
void *)mcpdm);
375 pm_runtime_put_sync(mcpdm->
dev);
378 dev_err(mcpdm->
dev,
"Request for IRQ failed\n");
379 pm_runtime_disable(mcpdm->
dev);
388 static int omap_mcpdm_remove(
struct snd_soc_dai *dai)
390 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
393 pm_runtime_disable(mcpdm->
dev);
398 #define OMAP_MCPDM_RATES (SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
399 #define OMAP_MCPDM_FORMATS SNDRV_PCM_FMTBIT_S32_LE
402 .probe = omap_mcpdm_probe,
403 .remove = omap_mcpdm_remove,
420 .ops = &omap_mcpdm_dai_ops,
441 platform_set_drvdata(pdev, mcpdm);
473 resource_size(res),
"McPDM"))
496 static const struct of_device_id omap_mcpdm_of_match[] = {
497 { .compatible =
"ti,omap4-mcpdm", },
504 .name =
"omap-mcpdm",
506 .of_match_table = omap_mcpdm_of_match,
509 .probe = asoc_mcpdm_probe,