Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASoC fixes #2

Open
wants to merge 2 commits into
base: wip-ci20-v4.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sound/soc/jz4740/jz4740-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#define JZ4780_AIC_CONF_FIFO_TX_THRESHOLD_MASK \
(0x1f << JZ4780_AIC_CONF_FIFO_TX_THRESHOLD_OFFSET)

#define JZ_AIC_CTRL_CHANNELS_MASK (0x7 << 24)
#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_MASK (0x7 << 19)
#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK (0x7 << 16)
#define JZ_AIC_CTRL_ENABLE_RX_DMA BIT(15)
Expand All @@ -81,6 +82,7 @@
#define JZ_AIC_CTRL_ENABLE_PLAYBACK BIT(1)
#define JZ_AIC_CTRL_ENABLE_CAPTURE BIT(0)

#define JZ_AIC_CTRL_CHANNELS_OFFSET 24
#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_OFFSET 19
#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET 16

Expand All @@ -92,7 +94,7 @@
#define JZ_AIC_I2S_STATUS_BUSY BIT(2)

#define JZ_AIC_CLK_DIV_MASK 0xf
#define I2SDIV_DV_SHIFT 8
#define I2SDIV_DV_SHIFT 0
#define I2SDIV_DV_MASK (0xf << I2SDIV_DV_SHIFT)
#define I2SDIV_IDV_SHIFT 8
#define I2SDIV_IDV_MASK (0xf << I2SDIV_IDV_SHIFT)
Expand Down Expand Up @@ -284,6 +286,12 @@ static int jz4740_i2s_hw_params(struct snd_pcm_substream *substream,
else
ctrl &= ~JZ_AIC_CTRL_MONO_TO_STEREO;

if (i2s->version >= JZ_I2S_JZ4780) {
ctrl &= ~JZ_AIC_CTRL_CHANNELS_MASK;
ctrl |= (params_channels(params) - 1) <<
JZ_AIC_CTRL_CHANNELS_OFFSET;
}

div_reg &= ~I2SDIV_DV_MASK;
div_reg |= (div - 1) << I2SDIV_DV_SHIFT;
} else {
Expand Down