Lines Matching refs:ssc_p
141 struct atmel_ssc_info *ssc_p = dev_id; in atmel_ssc_interrupt() local
147 ssc_sr = (unsigned long)ssc_readl(ssc_p->ssc->regs, SR) in atmel_ssc_interrupt()
148 & (unsigned long)ssc_readl(ssc_p->ssc->regs, IMR); in atmel_ssc_interrupt()
156 for (i = 0; i < ARRAY_SIZE(ssc_p->dma_params); i++) { in atmel_ssc_interrupt()
157 dma_params = ssc_p->dma_params[i]; in atmel_ssc_interrupt()
194 struct atmel_ssc_info *ssc_p = rule->private; in atmel_ssc_hw_rule_rate() local
195 struct ssc_device *ssc = ssc_p->ssc; in atmel_ssc_hw_rule_rate()
212 switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { in atmel_ssc_hw_rule_rate()
214 if ((ssc_p->dir_mask & SSC_DIR_MASK_CAPTURE) in atmel_ssc_hw_rule_rate()
224 if ((ssc_p->dir_mask & SSC_DIR_MASK_PLAYBACK) in atmel_ssc_hw_rule_rate()
235 switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { in atmel_ssc_hw_rule_rate()
237 r.num = ssc_p->mck_rate / mck_div / frame_size; in atmel_ssc_hw_rule_rate()
249 t.max = ssc_p->mck_rate / mck_div / frame_size; in atmel_ssc_hw_rule_rate()
273 struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id]; in atmel_ssc_startup() local
279 ssc_readl(ssc_p->ssc->regs, SR)); in atmel_ssc_startup()
283 clk_enable(ssc_p->ssc->clk); in atmel_ssc_startup()
284 ssc_p->mck_rate = clk_get_rate(ssc_p->ssc->clk); in atmel_ssc_startup()
287 if (!ssc_p->initialized) in atmel_ssc_startup()
288 ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST)); in atmel_ssc_startup()
301 ssc_p, in atmel_ssc_startup()
310 dma_params->ssc = ssc_p->ssc; in atmel_ssc_startup()
313 ssc_p->dma_params[dir] = dma_params; in atmel_ssc_startup()
317 if (ssc_p->dir_mask & dir_mask) in atmel_ssc_startup()
320 ssc_p->dir_mask |= dir_mask; in atmel_ssc_startup()
333 struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id]; in atmel_ssc_shutdown() local
342 dma_params = ssc_p->dma_params[dir]; in atmel_ssc_shutdown()
347 ssc_p->dma_params[dir] = NULL; in atmel_ssc_shutdown()
352 ssc_p->dir_mask &= ~dir_mask; in atmel_ssc_shutdown()
353 if (!ssc_p->dir_mask) { in atmel_ssc_shutdown()
354 if (ssc_p->initialized) { in atmel_ssc_shutdown()
355 free_irq(ssc_p->ssc->irq, ssc_p); in atmel_ssc_shutdown()
356 ssc_p->initialized = 0; in atmel_ssc_shutdown()
360 ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST)); in atmel_ssc_shutdown()
362 ssc_p->cmr_div = ssc_p->tcmr_period = ssc_p->rcmr_period = 0; in atmel_ssc_shutdown()
363 ssc_p->forced_divider = 0; in atmel_ssc_shutdown()
368 clk_disable(ssc_p->ssc->clk); in atmel_ssc_shutdown()
379 struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id]; in atmel_ssc_set_dai_fmt() local
381 ssc_p->daifmt = fmt; in atmel_ssc_set_dai_fmt()
392 struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id]; in atmel_ssc_set_dai_clkdiv() local
401 if (ssc_p->dir_mask != in atmel_ssc_set_dai_clkdiv()
403 ssc_p->cmr_div = div; in atmel_ssc_set_dai_clkdiv()
404 else if (ssc_p->cmr_div == 0) in atmel_ssc_set_dai_clkdiv()
405 ssc_p->cmr_div = div; in atmel_ssc_set_dai_clkdiv()
407 if (div != ssc_p->cmr_div) in atmel_ssc_set_dai_clkdiv()
409 ssc_p->forced_divider |= BIT(ATMEL_SSC_CMR_DIV); in atmel_ssc_set_dai_clkdiv()
413 ssc_p->tcmr_period = div; in atmel_ssc_set_dai_clkdiv()
414 ssc_p->forced_divider |= BIT(ATMEL_SSC_TCMR_PERIOD); in atmel_ssc_set_dai_clkdiv()
418 ssc_p->rcmr_period = div; in atmel_ssc_set_dai_clkdiv()
419 ssc_p->forced_divider |= BIT(ATMEL_SSC_RCMR_PERIOD); in atmel_ssc_set_dai_clkdiv()
430 static int atmel_ssc_cfs(struct atmel_ssc_info *ssc_p) in atmel_ssc_cfs() argument
432 switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { in atmel_ssc_cfs()
441 static int atmel_ssc_cbs(struct atmel_ssc_info *ssc_p) in atmel_ssc_cbs() argument
443 switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { in atmel_ssc_cbs()
460 struct atmel_ssc_info *ssc_p = &ssc_info[id]; in atmel_ssc_hw_params() local
461 struct ssc_device *ssc = ssc_p->ssc; in atmel_ssc_hw_params()
485 cmr_div = ssc_p->cmr_div; in atmel_ssc_hw_params()
486 if (!(ssc_p->forced_divider & BIT(ATMEL_SSC_CMR_DIV)) && in atmel_ssc_hw_params()
487 atmel_ssc_cbs(ssc_p)) { in atmel_ssc_hw_params()
496 cmr_div = DIV_ROUND_CLOSEST(ssc_p->mck_rate, 2 * bclk_rate); in atmel_ssc_hw_params()
503 tcmr_period = ssc_p->tcmr_period; in atmel_ssc_hw_params()
504 rcmr_period = ssc_p->rcmr_period; in atmel_ssc_hw_params()
505 if (atmel_ssc_cfs(ssc_p)) { in atmel_ssc_hw_params()
515 if (!(ssc_p->forced_divider & BIT(ATMEL_SSC_TCMR_PERIOD))) in atmel_ssc_hw_params()
517 if (!(ssc_p->forced_divider & BIT(ATMEL_SSC_RCMR_PERIOD))) in atmel_ssc_hw_params()
521 dma_params = ssc_p->dma_params[dir]; in atmel_ssc_hw_params()
557 switch (ssc_p->daifmt & SND_SOC_DAIFMT_FORMAT_MASK) { in atmel_ssc_hw_params()
596 ssc_p->daifmt); in atmel_ssc_hw_params()
600 if (!atmel_ssc_cfs(ssc_p)) { in atmel_ssc_hw_params()
609 if (atmel_ssc_cbs(ssc_p)) { in atmel_ssc_hw_params()
667 if (!ssc_p->initialized) { in atmel_ssc_hw_params()
668 if (!ssc_p->ssc->pdata->use_dma) { in atmel_ssc_hw_params()
669 ssc_writel(ssc_p->ssc->regs, PDC_RPR, 0); in atmel_ssc_hw_params()
670 ssc_writel(ssc_p->ssc->regs, PDC_RCR, 0); in atmel_ssc_hw_params()
671 ssc_writel(ssc_p->ssc->regs, PDC_RNPR, 0); in atmel_ssc_hw_params()
672 ssc_writel(ssc_p->ssc->regs, PDC_RNCR, 0); in atmel_ssc_hw_params()
674 ssc_writel(ssc_p->ssc->regs, PDC_TPR, 0); in atmel_ssc_hw_params()
675 ssc_writel(ssc_p->ssc->regs, PDC_TCR, 0); in atmel_ssc_hw_params()
676 ssc_writel(ssc_p->ssc->regs, PDC_TNPR, 0); in atmel_ssc_hw_params()
677 ssc_writel(ssc_p->ssc->regs, PDC_TNCR, 0); in atmel_ssc_hw_params()
680 ret = request_irq(ssc_p->ssc->irq, atmel_ssc_interrupt, 0, in atmel_ssc_hw_params()
681 ssc_p->name, ssc_p); in atmel_ssc_hw_params()
686 clk_disable(ssc_p->ssc->clk); in atmel_ssc_hw_params()
690 ssc_p->initialized = 1; in atmel_ssc_hw_params()
694 ssc_writel(ssc_p->ssc->regs, CMR, cmr_div); in atmel_ssc_hw_params()
697 ssc_writel(ssc_p->ssc->regs, RCMR, rcmr); in atmel_ssc_hw_params()
698 ssc_writel(ssc_p->ssc->regs, RFMR, rfmr); in atmel_ssc_hw_params()
701 ssc_writel(ssc_p->ssc->regs, TCMR, tcmr); in atmel_ssc_hw_params()
702 ssc_writel(ssc_p->ssc->regs, TFMR, tfmr); in atmel_ssc_hw_params()
713 struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id]; in atmel_ssc_prepare() local
722 dma_params = ssc_p->dma_params[dir]; in atmel_ssc_prepare()
724 ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable); in atmel_ssc_prepare()
725 ssc_writel(ssc_p->ssc->regs, IDR, dma_params->mask->ssc_error); in atmel_ssc_prepare()
729 ssc_readl(ssc_p->ssc->regs, SR)); in atmel_ssc_prepare()
737 struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id]; in atmel_ssc_trigger() local
746 dma_params = ssc_p->dma_params[dir]; in atmel_ssc_trigger()
752 ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable); in atmel_ssc_trigger()
755 ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable); in atmel_ssc_trigger()
765 struct atmel_ssc_info *ssc_p; in atmel_ssc_suspend() local
771 ssc_p = &ssc_info[pdev->id]; in atmel_ssc_suspend()
774 ssc_p->ssc_state.ssc_sr = ssc_readl(ssc_p->ssc->regs, SR); in atmel_ssc_suspend()
775 ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_TXDIS) | SSC_BIT(CR_RXDIS)); in atmel_ssc_suspend()
778 ssc_p->ssc_state.ssc_imr = ssc_readl(ssc_p->ssc->regs, IMR); in atmel_ssc_suspend()
779 ssc_writel(ssc_p->ssc->regs, IDR, ssc_p->ssc_state.ssc_imr); in atmel_ssc_suspend()
781 ssc_p->ssc_state.ssc_cmr = ssc_readl(ssc_p->ssc->regs, CMR); in atmel_ssc_suspend()
782 ssc_p->ssc_state.ssc_rcmr = ssc_readl(ssc_p->ssc->regs, RCMR); in atmel_ssc_suspend()
783 ssc_p->ssc_state.ssc_rfmr = ssc_readl(ssc_p->ssc->regs, RFMR); in atmel_ssc_suspend()
784 ssc_p->ssc_state.ssc_tcmr = ssc_readl(ssc_p->ssc->regs, TCMR); in atmel_ssc_suspend()
785 ssc_p->ssc_state.ssc_tfmr = ssc_readl(ssc_p->ssc->regs, TFMR); in atmel_ssc_suspend()
794 struct atmel_ssc_info *ssc_p; in atmel_ssc_resume() local
801 ssc_p = &ssc_info[pdev->id]; in atmel_ssc_resume()
804 ssc_writel(ssc_p->ssc->regs, TFMR, ssc_p->ssc_state.ssc_tfmr); in atmel_ssc_resume()
805 ssc_writel(ssc_p->ssc->regs, TCMR, ssc_p->ssc_state.ssc_tcmr); in atmel_ssc_resume()
806 ssc_writel(ssc_p->ssc->regs, RFMR, ssc_p->ssc_state.ssc_rfmr); in atmel_ssc_resume()
807 ssc_writel(ssc_p->ssc->regs, RCMR, ssc_p->ssc_state.ssc_rcmr); in atmel_ssc_resume()
808 ssc_writel(ssc_p->ssc->regs, CMR, ssc_p->ssc_state.ssc_cmr); in atmel_ssc_resume()
811 ssc_writel(ssc_p->ssc->regs, IER, ssc_p->ssc_state.ssc_imr); in atmel_ssc_resume()
816 (ssc_p->ssc_state.ssc_sr & SSC_BIT(SR_RXEN)) ? SSC_BIT(CR_RXEN) : 0; in atmel_ssc_resume()
818 (ssc_p->ssc_state.ssc_sr & SSC_BIT(SR_TXEN)) ? SSC_BIT(CR_TXEN) : 0; in atmel_ssc_resume()
819 ssc_writel(ssc_p->ssc->regs, CR, cr); in atmel_ssc_resume()