Пример #1
0
/*
 * Should only be called when port is inactive (i.e. SSIEN = 0),
 * although can be called multiple times by upper layers.
 */
static int imx_ssi_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params,
			     struct snd_soc_dai *cpu_dai)
{
	struct imx_ssi *priv = (struct imx_ssi *)cpu_dai->private_data;
	void __iomem *ioaddr = priv->ioaddr;
	int id;

	id = cpu_dai->id;

	/* Tx/Rx config */
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		/* cant change any parameters when SSI is running */
		if ((__raw_readl(ioaddr + SSI_SCR) & SSI_SCR_SSIEN) &&
		    (__raw_readl(ioaddr + SSI_SCR) & SSI_SCR_TE))
			return 0;
		return imx_ssi_hw_tx_params(substream, params, cpu_dai);
	} else {
		/* cant change any parameters when SSI is running */
		if ((__raw_readl(ioaddr + SSI_SCR) & SSI_SCR_SSIEN) &&
		    (__raw_readl(ioaddr + SSI_SCR) & SSI_SCR_RE))
			return 0;
		return imx_ssi_hw_rx_params(substream, params, cpu_dai);
	}
}
Пример #2
0
/*
 * Should only be called when port is inactive (i.e. SSIEN = 0),
 * although can be called multiple times by upper layers.
 */
static int imx_ssi_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params)
{
	struct snd_soc_pcm_link *pcm_link = substream->private_data;
	struct snd_soc_dai *cpu_dai = pcm_link->cpu_dai;
	int id;

	id = cpu_dai->id;

	/* Tx/Rx config */
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		/* cant change any parameters when SSI is running */
		if (id == IMX_DAI_SSI0 || id == IMX_DAI_SSI1) {
			if ((SSI1_SCR & SSI_SCR_SSIEN) &&
			    (SSI1_SCR & SSI_SCR_TE))
				return 0;
		} else {
			if ((SSI2_SCR & SSI_SCR_SSIEN) &&
			    (SSI2_SCR & SSI_SCR_TE))
				return 0;
		}
		return imx_ssi_hw_tx_params(substream, params);
	} else {
		/* cant change any parameters when SSI is running */
		if (id == IMX_DAI_SSI0 || id == IMX_DAI_SSI1) {
			if ((SSI1_SCR & SSI_SCR_SSIEN) &&
			    (SSI1_SCR & SSI_SCR_RE))
				return 0;
		} else {
			if ((SSI2_SCR & SSI_SCR_SSIEN) &&
			    (SSI2_SCR & SSI_SCR_RE))
				return 0;
		}
		return imx_ssi_hw_rx_params(substream, params);
	}
}