mcpdm              67 sound/soc/ti/omap-mcpdm.c static inline void omap_mcpdm_write(struct omap_mcpdm *mcpdm, u16 reg, u32 val)
mcpdm              69 sound/soc/ti/omap-mcpdm.c 	writel_relaxed(val, mcpdm->io_base + reg);
mcpdm              72 sound/soc/ti/omap-mcpdm.c static inline int omap_mcpdm_read(struct omap_mcpdm *mcpdm, u16 reg)
mcpdm              74 sound/soc/ti/omap-mcpdm.c 	return readl_relaxed(mcpdm->io_base + reg);
mcpdm              78 sound/soc/ti/omap-mcpdm.c static void omap_mcpdm_reg_dump(struct omap_mcpdm *mcpdm)
mcpdm              80 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "***********************\n");
mcpdm              81 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "IRQSTATUS_RAW:  0x%04x\n",
mcpdm              82 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_IRQSTATUS_RAW));
mcpdm              83 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "IRQSTATUS:  0x%04x\n",
mcpdm              84 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_IRQSTATUS));
mcpdm              85 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "IRQENABLE_SET:  0x%04x\n",
mcpdm              86 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_IRQENABLE_SET));
mcpdm              87 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "IRQENABLE_CLR:  0x%04x\n",
mcpdm              88 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_IRQENABLE_CLR));
mcpdm              89 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "IRQWAKE_EN: 0x%04x\n",
mcpdm              90 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_IRQWAKE_EN));
mcpdm              91 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "DMAENABLE_SET: 0x%04x\n",
mcpdm              92 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_DMAENABLE_SET));
mcpdm              93 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "DMAENABLE_CLR:  0x%04x\n",
mcpdm              94 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_DMAENABLE_CLR));
mcpdm              95 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "DMAWAKEEN:  0x%04x\n",
mcpdm              96 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_DMAWAKEEN));
mcpdm              97 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "CTRL:  0x%04x\n",
mcpdm              98 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL));
mcpdm              99 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "DN_DATA:  0x%04x\n",
mcpdm             100 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_DN_DATA));
mcpdm             101 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "UP_DATA: 0x%04x\n",
mcpdm             102 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_UP_DATA));
mcpdm             103 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "FIFO_CTRL_DN: 0x%04x\n",
mcpdm             104 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_FIFO_CTRL_DN));
mcpdm             105 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "FIFO_CTRL_UP:  0x%04x\n",
mcpdm             106 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_read(mcpdm, MCPDM_REG_FIFO_CTRL_UP));
mcpdm             107 sound/soc/ti/omap-mcpdm.c 	dev_dbg(mcpdm->dev, "***********************\n");
mcpdm             110 sound/soc/ti/omap-mcpdm.c static void omap_mcpdm_reg_dump(struct omap_mcpdm *mcpdm) {}
mcpdm             117 sound/soc/ti/omap-mcpdm.c static void omap_mcpdm_start(struct omap_mcpdm *mcpdm)
mcpdm             119 sound/soc/ti/omap-mcpdm.c 	u32 ctrl = omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL);
mcpdm             120 sound/soc/ti/omap-mcpdm.c 	u32 link_mask = mcpdm->config[0].link_mask | mcpdm->config[1].link_mask;
mcpdm             123 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl);
mcpdm             126 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl);
mcpdm             129 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl);
mcpdm             136 sound/soc/ti/omap-mcpdm.c static void omap_mcpdm_stop(struct omap_mcpdm *mcpdm)
mcpdm             138 sound/soc/ti/omap-mcpdm.c 	u32 ctrl = omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL);
mcpdm             142 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl);
mcpdm             145 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl);
mcpdm             148 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl);
mcpdm             155 sound/soc/ti/omap-mcpdm.c static inline int omap_mcpdm_active(struct omap_mcpdm *mcpdm)
mcpdm             157 sound/soc/ti/omap-mcpdm.c 	return omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL) &
mcpdm             165 sound/soc/ti/omap-mcpdm.c static void omap_mcpdm_open_streams(struct omap_mcpdm *mcpdm)
mcpdm             167 sound/soc/ti/omap-mcpdm.c 	u32 ctrl = omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL);
mcpdm             169 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, ctrl | MCPDM_WD_EN);
mcpdm             171 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_IRQENABLE_SET,
mcpdm             176 sound/soc/ti/omap-mcpdm.c 	if (mcpdm->dn_rx_offset) {
mcpdm             177 sound/soc/ti/omap-mcpdm.c 		u32 dn_offset = mcpdm->dn_rx_offset;
mcpdm             179 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_write(mcpdm, MCPDM_REG_DN_OFFSET, dn_offset);
mcpdm             181 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_write(mcpdm, MCPDM_REG_DN_OFFSET, dn_offset);
mcpdm             184 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_FIFO_CTRL_DN,
mcpdm             185 sound/soc/ti/omap-mcpdm.c 			 mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold);
mcpdm             186 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_FIFO_CTRL_UP,
mcpdm             187 sound/soc/ti/omap-mcpdm.c 			 mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold);
mcpdm             189 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_DMAENABLE_SET,
mcpdm             197 sound/soc/ti/omap-mcpdm.c static void omap_mcpdm_close_streams(struct omap_mcpdm *mcpdm)
mcpdm             200 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_IRQENABLE_CLR,
mcpdm             204 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_DMAENABLE_CLR, MCPDM_DMA_DN_ENABLE);
mcpdm             207 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_IRQENABLE_CLR,
mcpdm             211 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_DMAENABLE_CLR, MCPDM_DMA_UP_ENABLE);
mcpdm             214 sound/soc/ti/omap-mcpdm.c 	if (mcpdm->dn_rx_offset)
mcpdm             215 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_write(mcpdm, MCPDM_REG_DN_OFFSET, 0);
mcpdm             220 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = dev_id;
mcpdm             223 sound/soc/ti/omap-mcpdm.c 	irq_status = omap_mcpdm_read(mcpdm, MCPDM_REG_IRQSTATUS);
mcpdm             226 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_IRQSTATUS, irq_status);
mcpdm             229 sound/soc/ti/omap-mcpdm.c 		dev_dbg(mcpdm->dev, "DN (playback) FIFO Full\n");
mcpdm             232 sound/soc/ti/omap-mcpdm.c 		dev_dbg(mcpdm->dev, "DN (playback) FIFO Empty\n");
mcpdm             235 sound/soc/ti/omap-mcpdm.c 		dev_dbg(mcpdm->dev, "DN (playback) write request\n");
mcpdm             238 sound/soc/ti/omap-mcpdm.c 		dev_dbg(mcpdm->dev, "UP (capture) FIFO Full\n");
mcpdm             241 sound/soc/ti/omap-mcpdm.c 		dev_dbg(mcpdm->dev, "UP (capture) FIFO Empty\n");
mcpdm             244 sound/soc/ti/omap-mcpdm.c 		dev_dbg(mcpdm->dev, "UP (capture) write request\n");
mcpdm             252 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             254 sound/soc/ti/omap-mcpdm.c 	mutex_lock(&mcpdm->mutex);
mcpdm             257 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_open_streams(mcpdm);
mcpdm             259 sound/soc/ti/omap-mcpdm.c 	mutex_unlock(&mcpdm->mutex);
mcpdm             267 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             272 sound/soc/ti/omap-mcpdm.c 	mutex_lock(&mcpdm->mutex);
mcpdm             275 sound/soc/ti/omap-mcpdm.c 		if (omap_mcpdm_active(mcpdm)) {
mcpdm             276 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_stop(mcpdm);
mcpdm             277 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_close_streams(mcpdm);
mcpdm             278 sound/soc/ti/omap-mcpdm.c 			mcpdm->config[0].link_mask = 0;
mcpdm             279 sound/soc/ti/omap-mcpdm.c 			mcpdm->config[1].link_mask = 0;
mcpdm             283 sound/soc/ti/omap-mcpdm.c 	if (mcpdm->latency[stream2])
mcpdm             284 sound/soc/ti/omap-mcpdm.c 		pm_qos_update_request(&mcpdm->pm_qos_req,
mcpdm             285 sound/soc/ti/omap-mcpdm.c 				      mcpdm->latency[stream2]);
mcpdm             286 sound/soc/ti/omap-mcpdm.c 	else if (mcpdm->latency[stream1])
mcpdm             287 sound/soc/ti/omap-mcpdm.c 		pm_qos_remove_request(&mcpdm->pm_qos_req);
mcpdm             289 sound/soc/ti/omap-mcpdm.c 	mcpdm->latency[stream1] = 0;
mcpdm             291 sound/soc/ti/omap-mcpdm.c 	mutex_unlock(&mcpdm->mutex);
mcpdm             298 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             335 sound/soc/ti/omap-mcpdm.c 	threshold = mcpdm->config[stream].threshold;
mcpdm             341 sound/soc/ti/omap-mcpdm.c 		if (!mcpdm->config[!stream].link_mask)
mcpdm             342 sound/soc/ti/omap-mcpdm.c 			mcpdm->config[!stream].link_mask = 0x3;
mcpdm             349 sound/soc/ti/omap-mcpdm.c 		if (!mcpdm->config[!stream].link_mask)
mcpdm             350 sound/soc/ti/omap-mcpdm.c 			mcpdm->config[!stream].link_mask = (0x3 << 3);
mcpdm             360 sound/soc/ti/omap-mcpdm.c 	mcpdm->latency[stream] = latency * USEC_PER_SEC / params_rate(params);
mcpdm             362 sound/soc/ti/omap-mcpdm.c 	if (!mcpdm->latency[stream])
mcpdm             363 sound/soc/ti/omap-mcpdm.c 		mcpdm->latency[stream] = 10;
mcpdm             366 sound/soc/ti/omap-mcpdm.c 	if (mcpdm->config[stream].link_mask &&
mcpdm             367 sound/soc/ti/omap-mcpdm.c 	    mcpdm->config[stream].link_mask != link_mask)
mcpdm             368 sound/soc/ti/omap-mcpdm.c 		mcpdm->restart = true;
mcpdm             370 sound/soc/ti/omap-mcpdm.c 	mcpdm->config[stream].link_mask = link_mask;
mcpdm             378 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             379 sound/soc/ti/omap-mcpdm.c 	struct pm_qos_request *pm_qos_req = &mcpdm->pm_qos_req;
mcpdm             383 sound/soc/ti/omap-mcpdm.c 	int latency = mcpdm->latency[stream2];
mcpdm             386 sound/soc/ti/omap-mcpdm.c 	if (!latency || mcpdm->latency[stream1] < latency)
mcpdm             387 sound/soc/ti/omap-mcpdm.c 		latency = mcpdm->latency[stream1];
mcpdm             394 sound/soc/ti/omap-mcpdm.c 	if (!omap_mcpdm_active(mcpdm)) {
mcpdm             395 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_start(mcpdm);
mcpdm             396 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_reg_dump(mcpdm);
mcpdm             397 sound/soc/ti/omap-mcpdm.c 	} else if (mcpdm->restart) {
mcpdm             398 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_stop(mcpdm);
mcpdm             399 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_start(mcpdm);
mcpdm             400 sound/soc/ti/omap-mcpdm.c 		mcpdm->restart = false;
mcpdm             401 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_reg_dump(mcpdm);
mcpdm             416 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             419 sound/soc/ti/omap-mcpdm.c 	pm_runtime_enable(mcpdm->dev);
mcpdm             422 sound/soc/ti/omap-mcpdm.c 	pm_runtime_get_sync(mcpdm->dev);
mcpdm             423 sound/soc/ti/omap-mcpdm.c 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, 0x00);
mcpdm             425 sound/soc/ti/omap-mcpdm.c 	ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler, 0, "McPDM",
mcpdm             426 sound/soc/ti/omap-mcpdm.c 			  (void *)mcpdm);
mcpdm             428 sound/soc/ti/omap-mcpdm.c 	pm_runtime_put_sync(mcpdm->dev);
mcpdm             431 sound/soc/ti/omap-mcpdm.c 		dev_err(mcpdm->dev, "Request for IRQ failed\n");
mcpdm             432 sound/soc/ti/omap-mcpdm.c 		pm_runtime_disable(mcpdm->dev);
mcpdm             436 sound/soc/ti/omap-mcpdm.c 	mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2;
mcpdm             437 sound/soc/ti/omap-mcpdm.c 	mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold =
mcpdm             441 sound/soc/ti/omap-mcpdm.c 				  &mcpdm->dma_data[SNDRV_PCM_STREAM_PLAYBACK],
mcpdm             442 sound/soc/ti/omap-mcpdm.c 				  &mcpdm->dma_data[SNDRV_PCM_STREAM_CAPTURE]);
mcpdm             449 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             451 sound/soc/ti/omap-mcpdm.c 	free_irq(mcpdm->irq, (void *)mcpdm);
mcpdm             452 sound/soc/ti/omap-mcpdm.c 	pm_runtime_disable(mcpdm->dev);
mcpdm             454 sound/soc/ti/omap-mcpdm.c 	if (pm_qos_request_active(&mcpdm->pm_qos_req))
mcpdm             455 sound/soc/ti/omap-mcpdm.c 		pm_qos_remove_request(&mcpdm->pm_qos_req);
mcpdm             463 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             466 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_stop(mcpdm);
mcpdm             467 sound/soc/ti/omap-mcpdm.c 		omap_mcpdm_close_streams(mcpdm);
mcpdm             470 sound/soc/ti/omap-mcpdm.c 	mcpdm->pm_active_count = 0;
mcpdm             471 sound/soc/ti/omap-mcpdm.c 	while (pm_runtime_active(mcpdm->dev)) {
mcpdm             472 sound/soc/ti/omap-mcpdm.c 		pm_runtime_put_sync(mcpdm->dev);
mcpdm             473 sound/soc/ti/omap-mcpdm.c 		mcpdm->pm_active_count++;
mcpdm             481 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
mcpdm             483 sound/soc/ti/omap-mcpdm.c 	if (mcpdm->pm_active_count) {
mcpdm             484 sound/soc/ti/omap-mcpdm.c 		while (mcpdm->pm_active_count--)
mcpdm             485 sound/soc/ti/omap-mcpdm.c 			pm_runtime_get_sync(mcpdm->dev);
mcpdm             488 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_open_streams(mcpdm);
mcpdm             489 sound/soc/ti/omap-mcpdm.c 			omap_mcpdm_start(mcpdm);
mcpdm             535 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(rtd->cpu_dai);
mcpdm             537 sound/soc/ti/omap-mcpdm.c 	mcpdm->dn_rx_offset = MCPDM_DNOFST_RX1(rx1) | MCPDM_DNOFST_RX2(rx2);
mcpdm             543 sound/soc/ti/omap-mcpdm.c 	struct omap_mcpdm *mcpdm;
mcpdm             547 sound/soc/ti/omap-mcpdm.c 	mcpdm = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcpdm), GFP_KERNEL);
mcpdm             548 sound/soc/ti/omap-mcpdm.c 	if (!mcpdm)
mcpdm             551 sound/soc/ti/omap-mcpdm.c 	platform_set_drvdata(pdev, mcpdm);
mcpdm             553 sound/soc/ti/omap-mcpdm.c 	mutex_init(&mcpdm->mutex);
mcpdm             559 sound/soc/ti/omap-mcpdm.c 	mcpdm->dma_data[0].addr = res->start + MCPDM_REG_DN_DATA;
mcpdm             560 sound/soc/ti/omap-mcpdm.c 	mcpdm->dma_data[1].addr = res->start + MCPDM_REG_UP_DATA;
mcpdm             562 sound/soc/ti/omap-mcpdm.c 	mcpdm->dma_data[0].filter_data = "dn_link";
mcpdm             563 sound/soc/ti/omap-mcpdm.c 	mcpdm->dma_data[1].filter_data = "up_link";
mcpdm             566 sound/soc/ti/omap-mcpdm.c 	mcpdm->io_base = devm_ioremap_resource(&pdev->dev, res);
mcpdm             567 sound/soc/ti/omap-mcpdm.c 	if (IS_ERR(mcpdm->io_base))
mcpdm             568 sound/soc/ti/omap-mcpdm.c 		return PTR_ERR(mcpdm->io_base);
mcpdm             570 sound/soc/ti/omap-mcpdm.c 	mcpdm->irq = platform_get_irq(pdev, 0);
mcpdm             571 sound/soc/ti/omap-mcpdm.c 	if (mcpdm->irq < 0)
mcpdm             572 sound/soc/ti/omap-mcpdm.c 		return mcpdm->irq;
mcpdm             574 sound/soc/ti/omap-mcpdm.c 	mcpdm->dev = &pdev->dev;