Exemplo n.º 1
0
/*
 * SSI Network Mode or TDM slots configuration.
 * Should only be called when port is inactive (i.e. SSIEN = 0).
 */
static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
				    unsigned int mask, int slots)
{
	u32 stmsk, srmsk, stccr;

	if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI1) {
		if (SSI1_SCR & SSI_SCR_SSIEN)
			return 0;
		stccr = SSI1_STCCR;
	} else {
		if (SSI2_SCR & SSI_SCR_SSIEN)
			return 0;
		stccr = SSI2_STCCR;
	}

	stmsk = srmsk = mask;
	stccr &= ~SSI_STCCR_DC_MASK;
	stccr |= SSI_STCCR_DC(slots - 1);

	if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI1) {
		SSI1_STMSK = stmsk;
		SSI1_SRMSK = srmsk;
		SSI1_SRCCR = SSI1_STCCR = stccr;
	} else {
		SSI2_STMSK = stmsk;
		SSI2_SRMSK = srmsk;
		SSI2_SRCCR = SSI2_STCCR = stccr;
	}

	return 0;
}
Exemplo n.º 2
0
/*
 * SSI Network Mode or TDM slots configuration.
 * Should only be called when port is inactive (i.e. SSIEN = 0).
 */
static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
				unsigned int tx_mask,
				unsigned int rx_mask,
				int slots, int slot_width)
{
	struct imx_ssi *priv = (struct imx_ssi *)cpu_dai->private_data;
	void __iomem *ioaddr = priv->ioaddr;
	u32 stmsk, srmsk, stccr;

	if (__raw_readl(ioaddr + SSI_SCR) & SSI_SCR_SSIEN)
		return 0;
	stccr = __raw_readl(ioaddr + SSI_STCCR);

	stmsk = tx_mask;
	srmsk = rx_mask;
	stccr &= ~SSI_STCCR_DC_MASK;
	stccr |= SSI_STCCR_DC(slots - 1);

	__raw_writel(stmsk, ioaddr + SSI_STMSK);
	__raw_writel(srmsk, ioaddr + SSI_SRMSK);
	__raw_writel(stccr, ioaddr + SSI_STCCR);
	__raw_writel(stccr, ioaddr + SSI_SRCCR);

	return 0;
}
/*
 * SSI Network Mode or TDM slots configuration.
 * Should only be called when port is inactive (i.e. SSIEN = 0).
 */
static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
				    unsigned int mask, int slots)
{
	u32 stmsk, srmsk, stccr;

	if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI1) {
		if (__raw_readl(SSI1_SCR) & SSI_SCR_SSIEN)
			return 0;
		stccr = __raw_readl(SSI1_STCCR);
	} else {
		if (__raw_readl(SSI2_SCR) & SSI_SCR_SSIEN)
			return 0;
		stccr = __raw_readl(SSI2_STCCR);
	}

	stmsk = srmsk = mask;
	stccr &= ~SSI_STCCR_DC_MASK;
	stccr |= SSI_STCCR_DC(slots - 1);

	if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI1) {
		__raw_writel(stmsk, SSI1_STMSK);
		__raw_writel(srmsk, SSI1_SRMSK);
		__raw_writel(stccr, SSI1_STCCR);
		__raw_writel(stccr, SSI1_SRCCR);
	} else {
		__raw_writel(stmsk, SSI2_STMSK);
		__raw_writel(srmsk, SSI2_SRMSK);
		__raw_writel(stccr, SSI2_STCCR);
		__raw_writel(stccr, SSI2_SRCCR);
	}

	return 0;
}