On 03/06/2015 04:33 PM, Zubair Lutfullah Kakakhel wrote:
The jz4780 and jz4740 have very similar i2s blocks.
The slight difference is in Rx/Tx fifos. And the bitclocks for input/output are different.
This patch adds jz4780 support to the driver
Signed-off-by: Zubair Lutfullah Kakakhel Zubair.Kakakhel@imgtec.com
Looks mostly good. [...]
static inline uint32_t jz4740_i2s_read(const struct jz4740_i2s *i2s, @@ -267,13 +283,22 @@ static int jz4740_i2s_hw_params(struct snd_pcm_substream *substream, ctrl |= JZ_AIC_CTRL_MONO_TO_STEREO; else ctrl &= ~JZ_AIC_CTRL_MONO_TO_STEREO;
div_reg &= ~I2SDIV_DV_MASK;
} else { ctrl &= ~JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK; ctrl |= sample_size << JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET;div_reg |= (div - 1) << I2SDIV_DV_SHIFT;
if (i2s->version >= JZ_I2S_JZ4780) {
div_reg &= ~I2SDIV_IDV_MASK;
div_reg |= (div - 1) << I2SDIV_IDV_SHIFT;
} else {
div_reg &= ~I2SDIV_DV_MASK;
div_reg |= (div - 1) << I2SDIV_DV_SHIFT;
}}
Given that the JZ4780 supports different rates for TX and RX in this configuration you can also remove the symmetric_rates flag from the DAI struct, so applications can actually make use of it.
- div_reg &= ~I2SDIV_DV_MASK;
- div_reg |= (div - 1) << I2SDIV_DV_SHIFT; jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); jz4740_i2s_write(i2s, JZ_REG_AIC_CLK_DIV, div_reg);
[...]
- if (i2s->version >= JZ_I2S_JZ4780)
return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL,
SND_DMAENGINE_PCM_FLAG_NO_RESIDUE);
We should not be adding new users of SND_DMAENGINE_PCM_FLAG_NO_RESIDUE, this is a property of the DMA controller/driver and the DMAengine framework now has the capabilities to report on whether it supports residue reporting or not.