summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXingyu Wu <xingyu.wu@starfivetech.com>2022-08-25 05:36:50 +0300
committerXingyu Wu <xingyu.wu@starfivetech.com>2022-08-30 15:47:43 +0300
commit7f6e856ff292a40a605fd12408a72f16f72c5a05 (patch)
tree40d5cb2a92c7a8b8af17e054510df36d60eb2b24
parent337d8ee4ce89a42b7c4315a6ae1a08f9ca79ff3b (diff)
downloadlinux-7f6e856ff292a40a605fd12408a72f16f72c5a05.tar.xz
sound:dwc:i2s:Support 16bit playback and capture
Add 16bit playing and record but unsupport 8k rate. Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
-rwxr-xr-xsound/soc/dwc/dwc-i2s.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index 88042dd41307..d21ffc678e30 100755
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -255,6 +255,15 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
+ if (params_rate(params) == 8000) {
+ dev_err(dev->dev, "I2S: unsupported 8000 rate with S16_LE, Stereo.\n");
+ return -EINVAL;
+ }
+
+ if (txrx == SNDRV_PCM_STREAM_PLAYBACK)
+ dev->play_dma_data.dt.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ else
+ dev->capture_dma_data.dt.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
config->data_width = 16;
dev->ccr = 0x00;
dev->xfer_resolution = 0x02;
@@ -1018,6 +1027,9 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
dw_i2s_dai->playback.channels_max =
1 << (COMP1_TX_CHANNELS(comp1) + 1);
dw_i2s_dai->playback.formats = formats[idx];
+ for (;idx > 0; idx--)
+ dw_i2s_dai->playback.formats |= formats[idx - 1];
+
dw_i2s_dai->playback.rates = rates;
}
@@ -1032,6 +1044,9 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
dw_i2s_dai->capture.channels_max =
1 << (COMP1_RX_CHANNELS(comp1) + 1);
dw_i2s_dai->capture.formats = formats[idx];
+ for (;idx > 0; idx--)
+ dw_i2s_dai->capture.formats |= formats[idx - 1];
+
dw_i2s_dai->capture.rates = rates;
}