Lines Matching refs:mcbsp
39 static void omap_mcbsp_dump_reg(struct omap_mcbsp *mcbsp) in omap_mcbsp_dump_reg() argument
41 dev_dbg(mcbsp->dev, "**** McBSP%d regs ****\n", mcbsp->id); in omap_mcbsp_dump_reg()
42 dev_dbg(mcbsp->dev, "DRR2: 0x%04x\n", MCBSP_READ(mcbsp, DRR2)); in omap_mcbsp_dump_reg()
43 dev_dbg(mcbsp->dev, "DRR1: 0x%04x\n", MCBSP_READ(mcbsp, DRR1)); in omap_mcbsp_dump_reg()
44 dev_dbg(mcbsp->dev, "DXR2: 0x%04x\n", MCBSP_READ(mcbsp, DXR2)); in omap_mcbsp_dump_reg()
45 dev_dbg(mcbsp->dev, "DXR1: 0x%04x\n", MCBSP_READ(mcbsp, DXR1)); in omap_mcbsp_dump_reg()
46 dev_dbg(mcbsp->dev, "SPCR2: 0x%04x\n", MCBSP_READ(mcbsp, SPCR2)); in omap_mcbsp_dump_reg()
47 dev_dbg(mcbsp->dev, "SPCR1: 0x%04x\n", MCBSP_READ(mcbsp, SPCR1)); in omap_mcbsp_dump_reg()
48 dev_dbg(mcbsp->dev, "RCR2: 0x%04x\n", MCBSP_READ(mcbsp, RCR2)); in omap_mcbsp_dump_reg()
49 dev_dbg(mcbsp->dev, "RCR1: 0x%04x\n", MCBSP_READ(mcbsp, RCR1)); in omap_mcbsp_dump_reg()
50 dev_dbg(mcbsp->dev, "XCR2: 0x%04x\n", MCBSP_READ(mcbsp, XCR2)); in omap_mcbsp_dump_reg()
51 dev_dbg(mcbsp->dev, "XCR1: 0x%04x\n", MCBSP_READ(mcbsp, XCR1)); in omap_mcbsp_dump_reg()
52 dev_dbg(mcbsp->dev, "SRGR2: 0x%04x\n", MCBSP_READ(mcbsp, SRGR2)); in omap_mcbsp_dump_reg()
53 dev_dbg(mcbsp->dev, "SRGR1: 0x%04x\n", MCBSP_READ(mcbsp, SRGR1)); in omap_mcbsp_dump_reg()
54 dev_dbg(mcbsp->dev, "PCR0: 0x%04x\n", MCBSP_READ(mcbsp, PCR0)); in omap_mcbsp_dump_reg()
55 dev_dbg(mcbsp->dev, "***********************\n"); in omap_mcbsp_dump_reg()
58 static int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id) in omap2_mcbsp_set_clks_src() argument
71 fck_src = clk_get(mcbsp->dev, src); in omap2_mcbsp_set_clks_src()
73 dev_err(mcbsp->dev, "CLKS: could not clk_get() %s\n", src); in omap2_mcbsp_set_clks_src()
77 pm_runtime_put_sync(mcbsp->dev); in omap2_mcbsp_set_clks_src()
79 r = clk_set_parent(mcbsp->fclk, fck_src); in omap2_mcbsp_set_clks_src()
81 dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n", in omap2_mcbsp_set_clks_src()
84 pm_runtime_get_sync(mcbsp->dev); in omap2_mcbsp_set_clks_src()
93 struct omap_mcbsp *mcbsp = data; in omap_mcbsp_irq_handler() local
96 irqst = MCBSP_READ(mcbsp, IRQST); in omap_mcbsp_irq_handler()
97 dev_dbg(mcbsp->dev, "IRQ callback : 0x%x\n", irqst); in omap_mcbsp_irq_handler()
100 dev_err(mcbsp->dev, "RX Frame Sync Error!\n"); in omap_mcbsp_irq_handler()
102 dev_dbg(mcbsp->dev, "RX Frame Sync\n"); in omap_mcbsp_irq_handler()
104 dev_dbg(mcbsp->dev, "RX End Of Frame\n"); in omap_mcbsp_irq_handler()
106 dev_dbg(mcbsp->dev, "RX Buffer Threshold Reached\n"); in omap_mcbsp_irq_handler()
108 dev_err(mcbsp->dev, "RX Buffer Underflow!\n"); in omap_mcbsp_irq_handler()
110 dev_err(mcbsp->dev, "RX Buffer Overflow!\n"); in omap_mcbsp_irq_handler()
113 dev_err(mcbsp->dev, "TX Frame Sync Error!\n"); in omap_mcbsp_irq_handler()
115 dev_dbg(mcbsp->dev, "TX Frame Sync\n"); in omap_mcbsp_irq_handler()
117 dev_dbg(mcbsp->dev, "TX End Of Frame\n"); in omap_mcbsp_irq_handler()
119 dev_dbg(mcbsp->dev, "TX Buffer threshold Reached\n"); in omap_mcbsp_irq_handler()
121 dev_err(mcbsp->dev, "TX Buffer Underflow!\n"); in omap_mcbsp_irq_handler()
123 dev_err(mcbsp->dev, "TX Buffer Overflow!\n"); in omap_mcbsp_irq_handler()
125 dev_dbg(mcbsp->dev, "TX Buffer empty at end of frame\n"); in omap_mcbsp_irq_handler()
127 MCBSP_WRITE(mcbsp, IRQST, irqst); in omap_mcbsp_irq_handler()
134 struct omap_mcbsp *mcbsp = data; in omap_mcbsp_tx_irq_handler() local
137 irqst_spcr2 = MCBSP_READ(mcbsp, SPCR2); in omap_mcbsp_tx_irq_handler()
138 dev_dbg(mcbsp->dev, "TX IRQ callback : 0x%x\n", irqst_spcr2); in omap_mcbsp_tx_irq_handler()
141 dev_err(mcbsp->dev, "TX Frame Sync Error! : 0x%x\n", in omap_mcbsp_tx_irq_handler()
144 MCBSP_WRITE(mcbsp, SPCR2, MCBSP_READ_CACHE(mcbsp, SPCR2)); in omap_mcbsp_tx_irq_handler()
152 struct omap_mcbsp *mcbsp = data; in omap_mcbsp_rx_irq_handler() local
155 irqst_spcr1 = MCBSP_READ(mcbsp, SPCR1); in omap_mcbsp_rx_irq_handler()
156 dev_dbg(mcbsp->dev, "RX IRQ callback : 0x%x\n", irqst_spcr1); in omap_mcbsp_rx_irq_handler()
159 dev_err(mcbsp->dev, "RX Frame Sync Error! : 0x%x\n", in omap_mcbsp_rx_irq_handler()
162 MCBSP_WRITE(mcbsp, SPCR1, MCBSP_READ_CACHE(mcbsp, SPCR1)); in omap_mcbsp_rx_irq_handler()
174 static void omap_mcbsp_config(struct omap_mcbsp *mcbsp, in omap_mcbsp_config() argument
177 dev_dbg(mcbsp->dev, "Configuring McBSP%d phys_base: 0x%08lx\n", in omap_mcbsp_config()
178 mcbsp->id, mcbsp->phys_base); in omap_mcbsp_config()
181 MCBSP_WRITE(mcbsp, SPCR2, config->spcr2); in omap_mcbsp_config()
182 MCBSP_WRITE(mcbsp, SPCR1, config->spcr1); in omap_mcbsp_config()
183 MCBSP_WRITE(mcbsp, RCR2, config->rcr2); in omap_mcbsp_config()
184 MCBSP_WRITE(mcbsp, RCR1, config->rcr1); in omap_mcbsp_config()
185 MCBSP_WRITE(mcbsp, XCR2, config->xcr2); in omap_mcbsp_config()
186 MCBSP_WRITE(mcbsp, XCR1, config->xcr1); in omap_mcbsp_config()
187 MCBSP_WRITE(mcbsp, SRGR2, config->srgr2); in omap_mcbsp_config()
188 MCBSP_WRITE(mcbsp, SRGR1, config->srgr1); in omap_mcbsp_config()
189 MCBSP_WRITE(mcbsp, MCR2, config->mcr2); in omap_mcbsp_config()
190 MCBSP_WRITE(mcbsp, MCR1, config->mcr1); in omap_mcbsp_config()
191 MCBSP_WRITE(mcbsp, PCR0, config->pcr0); in omap_mcbsp_config()
192 if (mcbsp->pdata->has_ccr) { in omap_mcbsp_config()
193 MCBSP_WRITE(mcbsp, XCCR, config->xccr); in omap_mcbsp_config()
194 MCBSP_WRITE(mcbsp, RCCR, config->rccr); in omap_mcbsp_config()
197 if (mcbsp->pdata->has_wakeup) in omap_mcbsp_config()
198 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN); in omap_mcbsp_config()
201 if (mcbsp->irq) in omap_mcbsp_config()
202 MCBSP_WRITE(mcbsp, IRQEN, RSYNCERREN | XSYNCERREN | in omap_mcbsp_config()
214 static int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, in omap_mcbsp_dma_reg_params() argument
220 if (mcbsp->pdata->reg_size == 2) in omap_mcbsp_dma_reg_params()
225 if (mcbsp->pdata->reg_size == 2) in omap_mcbsp_dma_reg_params()
231 return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step; in omap_mcbsp_dma_reg_params()
239 static void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold) in omap_mcbsp_set_tx_threshold() argument
241 if (threshold && threshold <= mcbsp->max_tx_thres) in omap_mcbsp_set_tx_threshold()
242 MCBSP_WRITE(mcbsp, THRSH2, threshold - 1); in omap_mcbsp_set_tx_threshold()
250 static void omap_mcbsp_set_rx_threshold(struct omap_mcbsp *mcbsp, u16 threshold) in omap_mcbsp_set_rx_threshold() argument
252 if (threshold && threshold <= mcbsp->max_rx_thres) in omap_mcbsp_set_rx_threshold()
253 MCBSP_WRITE(mcbsp, THRSH1, threshold - 1); in omap_mcbsp_set_rx_threshold()
259 static u16 omap_mcbsp_get_tx_delay(struct omap_mcbsp *mcbsp) in omap_mcbsp_get_tx_delay() argument
264 buffstat = MCBSP_READ(mcbsp, XBUFFSTAT); in omap_mcbsp_get_tx_delay()
267 return mcbsp->pdata->buffer_size - buffstat; in omap_mcbsp_get_tx_delay()
274 static u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp) in omap_mcbsp_get_rx_delay() argument
279 buffstat = MCBSP_READ(mcbsp, RBUFFSTAT); in omap_mcbsp_get_rx_delay()
281 threshold = MCBSP_READ(mcbsp, THRSH1); in omap_mcbsp_get_rx_delay()
290 static int omap_mcbsp_request(struct omap_mcbsp *mcbsp) in omap_mcbsp_request() argument
295 reg_cache = kzalloc(mcbsp->reg_cache_size, GFP_KERNEL); in omap_mcbsp_request()
299 spin_lock(&mcbsp->lock); in omap_mcbsp_request()
300 if (!mcbsp->free) { in omap_mcbsp_request()
301 dev_err(mcbsp->dev, "McBSP%d is currently in use\n", mcbsp->id); in omap_mcbsp_request()
306 mcbsp->free = false; in omap_mcbsp_request()
307 mcbsp->reg_cache = reg_cache; in omap_mcbsp_request()
308 spin_unlock(&mcbsp->lock); in omap_mcbsp_request()
310 if(mcbsp->pdata->ops && mcbsp->pdata->ops->request) in omap_mcbsp_request()
311 mcbsp->pdata->ops->request(mcbsp->id - 1); in omap_mcbsp_request()
317 MCBSP_WRITE(mcbsp, SPCR1, 0); in omap_mcbsp_request()
318 MCBSP_WRITE(mcbsp, SPCR2, 0); in omap_mcbsp_request()
320 if (mcbsp->irq) { in omap_mcbsp_request()
321 err = request_irq(mcbsp->irq, omap_mcbsp_irq_handler, 0, in omap_mcbsp_request()
322 "McBSP", (void *)mcbsp); in omap_mcbsp_request()
324 dev_err(mcbsp->dev, "Unable to request IRQ\n"); in omap_mcbsp_request()
328 err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler, 0, in omap_mcbsp_request()
329 "McBSP TX", (void *)mcbsp); in omap_mcbsp_request()
331 dev_err(mcbsp->dev, "Unable to request TX IRQ\n"); in omap_mcbsp_request()
335 err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler, 0, in omap_mcbsp_request()
336 "McBSP RX", (void *)mcbsp); in omap_mcbsp_request()
338 dev_err(mcbsp->dev, "Unable to request RX IRQ\n"); in omap_mcbsp_request()
345 free_irq(mcbsp->tx_irq, (void *)mcbsp); in omap_mcbsp_request()
347 if(mcbsp->pdata->ops && mcbsp->pdata->ops->free) in omap_mcbsp_request()
348 mcbsp->pdata->ops->free(mcbsp->id - 1); in omap_mcbsp_request()
351 if (mcbsp->pdata->has_wakeup) in omap_mcbsp_request()
352 MCBSP_WRITE(mcbsp, WAKEUPEN, 0); in omap_mcbsp_request()
354 spin_lock(&mcbsp->lock); in omap_mcbsp_request()
355 mcbsp->free = true; in omap_mcbsp_request()
356 mcbsp->reg_cache = NULL; in omap_mcbsp_request()
358 spin_unlock(&mcbsp->lock); in omap_mcbsp_request()
364 static void omap_mcbsp_free(struct omap_mcbsp *mcbsp) in omap_mcbsp_free() argument
368 if(mcbsp->pdata->ops && mcbsp->pdata->ops->free) in omap_mcbsp_free()
369 mcbsp->pdata->ops->free(mcbsp->id - 1); in omap_mcbsp_free()
372 if (mcbsp->pdata->has_wakeup) in omap_mcbsp_free()
373 MCBSP_WRITE(mcbsp, WAKEUPEN, 0); in omap_mcbsp_free()
376 if (mcbsp->irq) { in omap_mcbsp_free()
377 MCBSP_WRITE(mcbsp, IRQEN, 0); in omap_mcbsp_free()
379 free_irq(mcbsp->irq, (void *)mcbsp); in omap_mcbsp_free()
381 free_irq(mcbsp->rx_irq, (void *)mcbsp); in omap_mcbsp_free()
382 free_irq(mcbsp->tx_irq, (void *)mcbsp); in omap_mcbsp_free()
385 reg_cache = mcbsp->reg_cache; in omap_mcbsp_free()
395 omap2_mcbsp_set_clks_src(mcbsp, MCBSP_CLKS_PRCM_SRC); in omap_mcbsp_free()
397 spin_lock(&mcbsp->lock); in omap_mcbsp_free()
398 if (mcbsp->free) in omap_mcbsp_free()
399 dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id); in omap_mcbsp_free()
401 mcbsp->free = true; in omap_mcbsp_free()
402 mcbsp->reg_cache = NULL; in omap_mcbsp_free()
403 spin_unlock(&mcbsp->lock); in omap_mcbsp_free()
413 static void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int stream) in omap_mcbsp_start() argument
420 if (mcbsp->st_data) in omap_mcbsp_start()
421 omap_mcbsp_st_start(mcbsp); in omap_mcbsp_start()
424 w = MCBSP_READ_CACHE(mcbsp, PCR0); in omap_mcbsp_start()
426 enable_srg = !((MCBSP_READ_CACHE(mcbsp, SPCR2) | in omap_mcbsp_start()
427 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1); in omap_mcbsp_start()
431 w = MCBSP_READ_CACHE(mcbsp, SPCR2); in omap_mcbsp_start()
432 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6)); in omap_mcbsp_start()
437 w = MCBSP_READ_CACHE(mcbsp, SPCR2); in omap_mcbsp_start()
438 MCBSP_WRITE(mcbsp, SPCR2, w | tx); in omap_mcbsp_start()
441 w = MCBSP_READ_CACHE(mcbsp, SPCR1); in omap_mcbsp_start()
442 MCBSP_WRITE(mcbsp, SPCR1, w | rx); in omap_mcbsp_start()
454 w = MCBSP_READ_CACHE(mcbsp, SPCR2); in omap_mcbsp_start()
455 MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7)); in omap_mcbsp_start()
458 if (mcbsp->pdata->has_ccr) { in omap_mcbsp_start()
460 w = MCBSP_READ_CACHE(mcbsp, XCCR); in omap_mcbsp_start()
462 MCBSP_WRITE(mcbsp, XCCR, w); in omap_mcbsp_start()
463 w = MCBSP_READ_CACHE(mcbsp, RCCR); in omap_mcbsp_start()
465 MCBSP_WRITE(mcbsp, RCCR, w); in omap_mcbsp_start()
469 omap_mcbsp_dump_reg(mcbsp); in omap_mcbsp_start()
472 static void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int stream) in omap_mcbsp_stop() argument
481 if (mcbsp->pdata->has_ccr) { in omap_mcbsp_stop()
482 w = MCBSP_READ_CACHE(mcbsp, XCCR); in omap_mcbsp_stop()
484 MCBSP_WRITE(mcbsp, XCCR, w); in omap_mcbsp_stop()
486 w = MCBSP_READ_CACHE(mcbsp, SPCR2); in omap_mcbsp_stop()
487 MCBSP_WRITE(mcbsp, SPCR2, w & ~tx); in omap_mcbsp_stop()
491 if (mcbsp->pdata->has_ccr) { in omap_mcbsp_stop()
492 w = MCBSP_READ_CACHE(mcbsp, RCCR); in omap_mcbsp_stop()
494 MCBSP_WRITE(mcbsp, RCCR, w); in omap_mcbsp_stop()
496 w = MCBSP_READ_CACHE(mcbsp, SPCR1); in omap_mcbsp_stop()
497 MCBSP_WRITE(mcbsp, SPCR1, w & ~rx); in omap_mcbsp_stop()
499 idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) | in omap_mcbsp_stop()
500 MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1); in omap_mcbsp_stop()
504 w = MCBSP_READ_CACHE(mcbsp, SPCR2); in omap_mcbsp_stop()
505 MCBSP_WRITE(mcbsp, SPCR2, w & ~(1 << 6)); in omap_mcbsp_stop()
508 if (mcbsp->st_data) in omap_mcbsp_stop()
509 omap_mcbsp_st_stop(mcbsp); in omap_mcbsp_stop()
512 #define max_thres(m) (mcbsp->pdata->buffer_size)
518 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \
520 return sysfs_emit(buf, "%u\n", mcbsp->prop); \
527 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \
535 if (!valid_threshold(mcbsp, val)) \
538 mcbsp->prop = val; \
554 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); in dma_op_mode_show() local
559 dma_op_mode = mcbsp->dma_op_mode; in dma_op_mode_show()
576 struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); in dma_op_mode_store() local
583 spin_lock_irq(&mcbsp->lock); in dma_op_mode_store()
584 if (!mcbsp->free) { in dma_op_mode_store()
588 mcbsp->dma_op_mode = i; in dma_op_mode_store()
591 spin_unlock_irq(&mcbsp->lock); in dma_op_mode_store()
615 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); in omap_mcbsp_init() local
619 spin_lock_init(&mcbsp->lock); in omap_mcbsp_init()
620 mcbsp->free = true; in omap_mcbsp_init()
626 mcbsp->io_base = devm_ioremap_resource(&pdev->dev, res); in omap_mcbsp_init()
627 if (IS_ERR(mcbsp->io_base)) in omap_mcbsp_init()
628 return PTR_ERR(mcbsp->io_base); in omap_mcbsp_init()
630 mcbsp->phys_base = res->start; in omap_mcbsp_init()
631 mcbsp->reg_cache_size = resource_size(res); in omap_mcbsp_init()
635 mcbsp->phys_dma_base = mcbsp->phys_base; in omap_mcbsp_init()
637 mcbsp->phys_dma_base = res->start; in omap_mcbsp_init()
646 mcbsp->irq = platform_get_irq_byname(pdev, "common"); in omap_mcbsp_init()
647 if (mcbsp->irq == -ENXIO) { in omap_mcbsp_init()
648 mcbsp->tx_irq = platform_get_irq_byname(pdev, "tx"); in omap_mcbsp_init()
650 if (mcbsp->tx_irq == -ENXIO) { in omap_mcbsp_init()
651 mcbsp->irq = platform_get_irq(pdev, 0); in omap_mcbsp_init()
652 mcbsp->tx_irq = 0; in omap_mcbsp_init()
654 mcbsp->rx_irq = platform_get_irq_byname(pdev, "rx"); in omap_mcbsp_init()
655 mcbsp->irq = 0; in omap_mcbsp_init()
665 mcbsp->dma_req[0] = res->start; in omap_mcbsp_init()
666 mcbsp->dma_data[0].filter_data = &mcbsp->dma_req[0]; in omap_mcbsp_init()
673 mcbsp->dma_req[1] = res->start; in omap_mcbsp_init()
674 mcbsp->dma_data[1].filter_data = &mcbsp->dma_req[1]; in omap_mcbsp_init()
676 mcbsp->dma_data[0].filter_data = "tx"; in omap_mcbsp_init()
677 mcbsp->dma_data[1].filter_data = "rx"; in omap_mcbsp_init()
680 mcbsp->dma_data[0].addr = omap_mcbsp_dma_reg_params(mcbsp, in omap_mcbsp_init()
682 mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, in omap_mcbsp_init()
685 mcbsp->fclk = devm_clk_get(&pdev->dev, "fck"); in omap_mcbsp_init()
686 if (IS_ERR(mcbsp->fclk)) { in omap_mcbsp_init()
687 ret = PTR_ERR(mcbsp->fclk); in omap_mcbsp_init()
688 dev_err(mcbsp->dev, "unable to get fck: %d\n", ret); in omap_mcbsp_init()
692 mcbsp->dma_op_mode = MCBSP_DMA_MODE_ELEMENT; in omap_mcbsp_init()
693 if (mcbsp->pdata->buffer_size) { in omap_mcbsp_init()
702 mcbsp->max_tx_thres = max_thres(mcbsp) - 0x10; in omap_mcbsp_init()
703 mcbsp->max_rx_thres = max_thres(mcbsp) - 0x10; in omap_mcbsp_init()
705 ret = devm_device_add_group(mcbsp->dev, &additional_attr_group); in omap_mcbsp_init()
707 dev_err(mcbsp->dev, in omap_mcbsp_init()
725 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_set_threshold() local
729 if (mcbsp->pdata->buffer_size == 0) in omap_mcbsp_set_threshold()
745 omap_mcbsp_set_tx_threshold(mcbsp, words); in omap_mcbsp_set_threshold()
747 omap_mcbsp_set_rx_threshold(mcbsp, words); in omap_mcbsp_set_threshold()
757 struct omap_mcbsp *mcbsp = rule->private; in omap_mcbsp_hwrule_min_buffersize() local
762 size = mcbsp->pdata->buffer_size; in omap_mcbsp_hwrule_min_buffersize()
772 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_startup() local
776 err = omap_mcbsp_request(mcbsp); in omap_mcbsp_dai_startup()
793 if (mcbsp->pdata->buffer_size) { in omap_mcbsp_dai_startup()
803 mcbsp, in omap_mcbsp_dai_startup()
817 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_shutdown() local
822 if (mcbsp->latency[stream2]) in omap_mcbsp_dai_shutdown()
823 cpu_latency_qos_update_request(&mcbsp->pm_qos_req, in omap_mcbsp_dai_shutdown()
824 mcbsp->latency[stream2]); in omap_mcbsp_dai_shutdown()
825 else if (mcbsp->latency[stream1]) in omap_mcbsp_dai_shutdown()
826 cpu_latency_qos_remove_request(&mcbsp->pm_qos_req); in omap_mcbsp_dai_shutdown()
828 mcbsp->latency[stream1] = 0; in omap_mcbsp_dai_shutdown()
831 omap_mcbsp_free(mcbsp); in omap_mcbsp_dai_shutdown()
832 mcbsp->configured = 0; in omap_mcbsp_dai_shutdown()
839 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_prepare() local
840 struct pm_qos_request *pm_qos_req = &mcbsp->pm_qos_req; in omap_mcbsp_dai_prepare()
844 int latency = mcbsp->latency[stream2]; in omap_mcbsp_dai_prepare()
847 if (!latency || mcbsp->latency[stream1] < latency) in omap_mcbsp_dai_prepare()
848 latency = mcbsp->latency[stream1]; in omap_mcbsp_dai_prepare()
861 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_trigger() local
867 mcbsp->active++; in omap_mcbsp_dai_trigger()
868 omap_mcbsp_start(mcbsp, substream->stream); in omap_mcbsp_dai_trigger()
874 omap_mcbsp_stop(mcbsp, substream->stream); in omap_mcbsp_dai_trigger()
875 mcbsp->active--; in omap_mcbsp_dai_trigger()
890 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_delay() local
895 if (mcbsp->pdata->buffer_size == 0) in omap_mcbsp_dai_delay()
899 fifo_use = omap_mcbsp_get_tx_delay(mcbsp); in omap_mcbsp_dai_delay()
901 fifo_use = omap_mcbsp_get_rx_delay(mcbsp); in omap_mcbsp_dai_delay()
917 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_hw_params() local
918 struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; in omap_mcbsp_dai_hw_params()
923 unsigned int buffer_size = mcbsp->pdata->buffer_size; in omap_mcbsp_dai_hw_params()
941 if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) { in omap_mcbsp_dai_hw_params()
947 max_thrsh = mcbsp->max_tx_thres; in omap_mcbsp_dai_hw_params()
949 max_thrsh = mcbsp->max_rx_thres; in omap_mcbsp_dai_hw_params()
975 mcbsp->latency[substream->stream] = latency; in omap_mcbsp_dai_hw_params()
982 if (mcbsp->configured) { in omap_mcbsp_dai_hw_params()
991 format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; in omap_mcbsp_dai_hw_params()
1029 master = mcbsp->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK; in omap_mcbsp_dai_hw_params()
1031 div = mcbsp->clk_div ? mcbsp->clk_div : 1; in omap_mcbsp_dai_hw_params()
1032 framesize = (mcbsp->in_freq / div) / params_rate(params); in omap_mcbsp_dai_hw_params()
1058 omap_mcbsp_config(mcbsp, &mcbsp->cfg_regs); in omap_mcbsp_dai_hw_params()
1059 mcbsp->wlen = wlen; in omap_mcbsp_dai_hw_params()
1060 mcbsp->configured = 1; in omap_mcbsp_dai_hw_params()
1072 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_set_dai_fmt() local
1073 struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; in omap_mcbsp_dai_set_dai_fmt()
1076 if (mcbsp->configured) in omap_mcbsp_dai_set_dai_fmt()
1079 mcbsp->fmt = fmt; in omap_mcbsp_dai_set_dai_fmt()
1085 if (!mcbsp->pdata->has_ccr) { in omap_mcbsp_dai_set_dai_fmt()
1091 if (mcbsp->pdata->has_ccr) { in omap_mcbsp_dai_set_dai_fmt()
1181 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_set_clkdiv() local
1182 struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; in omap_mcbsp_dai_set_clkdiv()
1187 mcbsp->clk_div = div; in omap_mcbsp_dai_set_clkdiv()
1198 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); in omap_mcbsp_dai_set_dai_sysclk() local
1199 struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; in omap_mcbsp_dai_set_dai_sysclk()
1202 if (mcbsp->active) { in omap_mcbsp_dai_set_dai_sysclk()
1203 if (freq == mcbsp->in_freq) in omap_mcbsp_dai_set_dai_sysclk()
1209 mcbsp->in_freq = freq; in omap_mcbsp_dai_set_dai_sysclk()
1222 err = omap2_mcbsp_set_clks_src(mcbsp, in omap_mcbsp_dai_set_dai_sysclk()
1230 err = omap2_mcbsp_set_clks_src(mcbsp, in omap_mcbsp_dai_set_dai_sysclk()
1271 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(dai); in omap_mcbsp_probe() local
1273 pm_runtime_enable(mcbsp->dev); in omap_mcbsp_probe()
1276 &mcbsp->dma_data[SNDRV_PCM_STREAM_PLAYBACK], in omap_mcbsp_probe()
1277 &mcbsp->dma_data[SNDRV_PCM_STREAM_CAPTURE]); in omap_mcbsp_probe()
1284 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(dai); in omap_mcbsp_remove() local
1286 pm_runtime_disable(mcbsp->dev); in omap_mcbsp_remove()
1363 struct omap_mcbsp *mcbsp; in asoc_mcbsp_probe() local
1388 mcbsp = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcbsp), GFP_KERNEL); in asoc_mcbsp_probe()
1389 if (!mcbsp) in asoc_mcbsp_probe()
1392 mcbsp->id = pdev->id; in asoc_mcbsp_probe()
1393 mcbsp->pdata = pdata; in asoc_mcbsp_probe()
1394 mcbsp->dev = &pdev->dev; in asoc_mcbsp_probe()
1395 platform_set_drvdata(pdev, mcbsp); in asoc_mcbsp_probe()
1401 if (mcbsp->pdata->reg_size == 2) { in asoc_mcbsp_probe()
1417 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); in asoc_mcbsp_remove() local
1419 if (mcbsp->pdata->ops && mcbsp->pdata->ops->free) in asoc_mcbsp_remove()
1420 mcbsp->pdata->ops->free(mcbsp->id); in asoc_mcbsp_remove()
1422 if (cpu_latency_qos_request_active(&mcbsp->pm_qos_req)) in asoc_mcbsp_remove()
1423 cpu_latency_qos_remove_request(&mcbsp->pm_qos_req); in asoc_mcbsp_remove()