From: Brian Norris <briannorris@chromium.org>
To: Judy Hsiao <judyhsiao@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>, Mark Brown <broonie@kernel.org>,
Jaroslav Kysela <perex@perex.cz>,
Chen-Yu Tsai <wenst@chromium.org>,
alsa-devel@alsa-project.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] ASoC: rockchip: i2s: switch BCLK to GPIO
Date: Fri, 17 Jun 2022 13:46:46 -0700 [thread overview]
Message-ID: <YqzoNqd3Mpv3r2tS@google.com> (raw)
In-Reply-To: <20220617044251.4029697-2-judyhsiao@chromium.org>
Hi,
On Fri, Jun 17, 2022 at 04:42:49AM +0000, Judy Hsiao wrote:
> We discovered that the state of BCLK on, LRCLK off and SD_MODE on
> may cause the speaker melting issue. Removing LRCLK while BCLK
> is present can cause unexpected output behavior including a large
> DC output voltage as described in the Max98357a datasheet.
>
> In order to:
> 1. prevent BCLK from turning on by other component.
> 2. keep BCLK and LRCLK being present at the same time
>
> This patch switches BCLK to GPIO func before LRCLK output, and
> configures BCLK func back during LRCLK is output.
>
> Without this fix, BCLK is turned on 11 ms earlier than LRCK by the
> da7219.
> With this fix, BCLK is turned on only 0.4 ms earlier than LRCK by
> the rockchip codec.
>
> Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
> ---
> sound/soc/rockchip/rockchip_i2s.c | 167 ++++++++++++++++++++++--------
> 1 file changed, 121 insertions(+), 46 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
> index 47a3971a9ce1..5e3cb06377a1 100644
> --- a/sound/soc/rockchip/rockchip_i2s.c
> +++ b/sound/soc/rockchip/rockchip_i2s.c
> @@ -92,39 +122,46 @@ static inline struct rk_i2s_dev *to_info(struct snd_soc_dai *dai)
> return snd_soc_dai_get_drvdata(dai);
> }
>
> -static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on)
> +static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on)
> {
> unsigned int val = 0;
> int retry = 10;
> -
> + int ret = 0;
> +
> spin_lock(&i2s->lock);
> if (on) {
> - regmap_update_bits(i2s->regmap, I2S_DMACR,
> - I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE);
> -
> - regmap_update_bits(i2s->regmap, I2S_XFER,
> - I2S_XFER_TXS_START | I2S_XFER_RXS_START,
> - I2S_XFER_TXS_START | I2S_XFER_RXS_START);
> -
> + ret = regmap_update_bits(i2s->regmap, I2S_DMACR,
> + I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE);
> + if (ret < 0)
> + goto end;
> + ret = regmap_update_bits(i2s->regmap, I2S_XFER,
> + I2S_XFER_TXS_START | I2S_XFER_RXS_START,
> + I2S_XFER_TXS_START | I2S_XFER_RXS_START);
This still isn't how I'd expect the indentation to look, but I think I
will stop complaining about whitespace. Maybe you can either use
'clang-format' (sparingly), or else see what Mark thinks.
> + if (ret < 0)
> + goto end;
> i2s->tx_start = true;
> } else {
> i2s->tx_start = false;
>
...
> static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on)
I didn't think I needed to call this out, because you already got build
bots complaining about this, but...
...did you even compile-test this? You should be making this function
return 'int', not 'void', because you're adding return values below.
> {
> unsigned int val = 0;
> int retry = 10;
> + int ret = 0;
>
...
> +end:
> spin_unlock(&i2s->lock);
> + if (ret < 0)
> + dev_err(i2s->dev, "lrclk update failed\n");
> +
> + return ret;
^^ here.
> }
>
> static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
Aside from those, I think this looks OK to the best of my
(not-very-familiar with sounds/soc/) ability:
Reviewed-by: Brian Norris <briannorris@chromium.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-17 21:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 15:58 [PATCH v2 0/3] ASoC: rockchip: i2s: switch BCLK to GPIO Judy Hsiao
2022-06-16 15:58 ` [PATCH v2 1/3] " Judy Hsiao
2022-06-16 19:03 ` kernel test robot
2022-06-16 20:48 ` Brian Norris
2022-06-17 4:21 ` Judy Hsiao
2022-06-16 15:58 ` [PATCH v2 2/3] arm64: dts: rk3399: " Judy Hsiao
2022-06-16 20:39 ` Brian Norris
2022-06-16 15:58 ` [PATCH v2 3/3] ASoC: dt-bindings: rockchip: Document pinctrl-names for i2s Judy Hsiao
2022-06-16 20:39 ` Brian Norris
2022-06-17 4:42 ` [PATCH v3 0/3] ASoC: rockchip: i2s: switch BCLK to GPIO Judy Hsiao
2022-06-17 4:42 ` [PATCH v3 1/3] " Judy Hsiao
2022-06-17 20:46 ` Brian Norris [this message]
2022-06-17 4:42 ` [PATCH v3 2/3] arm64: dts: rk3399: " Judy Hsiao
2022-06-17 4:42 ` [PATCH v3 3/3] ASoC: dt-bindings: rockchip: Document pinctrl-names for i2s Judy Hsiao
2022-06-17 8:45 ` [PATCH v3 0/3] ASoC: rockchip: i2s: switch BCLK to GPIO 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=YqzoNqd3Mpv3r2tS@google.com \
--to=briannorris@chromium.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=heiko@sntech.de \
--cc=judyhsiao@chromium.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=wenst@chromium.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).