Skip to content

Commit

Permalink
ASoC: rockchip: i2s: Support mono capture
Browse files Browse the repository at this point in the history
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: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Matthias Kaehlcke authored and Mark Brown committed Jan 8, 2018
1 parent 4fbd8d1 commit db51707
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/soc/rockchip/rockchip_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
val |= I2S_CHN_4;
break;
case 2:
case 1:
val |= I2S_CHN_2;
break;
default:
Expand Down Expand Up @@ -460,7 +461,7 @@ static struct snd_soc_dai_driver rockchip_i2s_dai = {
},
.capture = {
.stream_name = "Capture",
.channels_min = 2,
.channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = (SNDRV_PCM_FMTBIT_S8 |
Expand Down Expand Up @@ -654,7 +655,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
}

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;
}

Expand Down

0 comments on commit db51707

Please sign in to comment.