[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211015210730.308946-1-frattaroli.nicolas@gmail.com>
Date: Fri, 15 Oct 2021 23:07:29 +0200
From: Nicolas Frattaroli <frattaroli.nicolas@...il.com>
To: Nicolas Frattaroli <frattaroli.nicolas@...il.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Heiko Stuebner <heiko@...ech.de>
Cc: linux-rockchip@...ts.infradead.org, alsa-devel@...a-project.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: rockchip: i2s-tdm: Fix refcount test
During development of V5 of the i2s-tdm patch series, I replaced
the atomic refcount with a regular integer, as it was only ever
accessed within a spinlock.
Foolishly, I got the semantics of atomic_dec_and_test wrong, which
resulted in a test for 0 actually becoming a test for >0.
The result was that setting the audio frequency broke; switching
from 44100 Hz audio playback to 96000 Hz audio playback would
garble the sound most unpleasantly.
Fix this by checking for --refcount == 0, which is what it should
have been all along.
Fixes: 081068fd6414 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@...il.com>
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 396277eaa417..5d3abbada72a 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -408,7 +408,7 @@ static void rockchip_snd_txrxctrl(struct snd_pcm_substream *substream,
else
rockchip_disable_rde(i2s_tdm->regmap);
- if (--i2s_tdm->refcount) {
+ if (--i2s_tdm->refcount == 0) {
rockchip_snd_xfer_clear(i2s_tdm,
I2S_CLR_TXC | I2S_CLR_RXC);
}
--
2.33.1
Powered by blists - more mailing lists