From: mka@chromium.org (Matthias Kaehlcke)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ASoC: rockchip: i2s: Support mono capture
Date: Mon, 8 Jan 2018 16:01:15 -0800 [thread overview]
Message-ID: <20180109000115.GA184703@google.com> (raw)
In-Reply-To: <20180105221242.22083-1-mka@chromium.org>
El Fri, Jan 05, 2018 at 02:12:42PM -0800 Matthias Kaehlcke ha dit:
> 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.
Due to different issues in our audio recording path I couldn't test
this properly, and only looked at the .wav data in audacity, which
appeared to look ok. After putting some of the missing pieces
together and I noticed that mono capture doesn't work as intended,
the recorded audio is slowed down. I think this is because the I2S
controller keeps generating a two-channel stream, however the sound
system interprets it as a monophonic stream because of the channel
configuration.
Not sure if there is a clean solution for this if we can't tell the
hardware to generate a single-channel stream. Any suggestions or do
we have to revert the patch?
Sorry about the mess :(
> ---
> sound/soc/rockchip/rockchip_i2s.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
> index 908211e1d6fc..cc22ab3d10dd 100644
> --- a/sound/soc/rockchip/rockchip_i2s.c
> +++ b/sound/soc/rockchip/rockchip_i2s.c
> @@ -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:
> @@ -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 |
> @@ -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;
> }
>
next prev parent reply other threads:[~2018-01-09 0:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 22:12 [PATCH] ASoC: rockchip: i2s: Support mono capture Matthias Kaehlcke
2018-01-08 12:35 ` Applied "ASoC: rockchip: i2s: Support mono capture" to the asoc tree Mark Brown
2018-01-09 0:01 ` Matthias Kaehlcke [this message]
2018-01-09 16:39 ` [PATCH] ASoC: rockchip: i2s: Support mono capture Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180109000115.GA184703@google.com \
--to=mka@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).