未验证 提交 db51707b 编写于 作者: M Matthias Kaehlcke 提交者: Mark Brown

ASoC: rockchip: i2s: Support mono capture

The Rockchip I2S controller only allows to configure even numbers of
capture channels. It is still possible to capture monophonic audio by
using dual-channel mode and ignoring the 'data' from the second
channel.
Signed-off-by: NMatthias Kaehlcke <mka@chromium.org>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 4fbd8d19
...@@ -328,6 +328,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -328,6 +328,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
val |= I2S_CHN_4; val |= I2S_CHN_4;
break; break;
case 2: case 2:
case 1:
val |= I2S_CHN_2; val |= I2S_CHN_2;
break; break;
default: default:
...@@ -460,7 +461,7 @@ static struct snd_soc_dai_driver rockchip_i2s_dai = { ...@@ -460,7 +461,7 @@ static struct snd_soc_dai_driver rockchip_i2s_dai = {
}, },
.capture = { .capture = {
.stream_name = "Capture", .stream_name = "Capture",
.channels_min = 2, .channels_min = 1,
.channels_max = 2, .channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000, .rates = SNDRV_PCM_RATE_8000_192000,
.formats = (SNDRV_PCM_FMTBIT_S8 | .formats = (SNDRV_PCM_FMTBIT_S8 |
...@@ -654,7 +655,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev) ...@@ -654,7 +655,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
} }
if (!of_property_read_u32(node, "rockchip,capture-channels", &val)) { if (!of_property_read_u32(node, "rockchip,capture-channels", &val)) {
if (val >= 2 && val <= 8) if (val >= 1 && val <= 8)
soc_dai->capture.channels_max = val; soc_dai->capture.channels_max = val;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册