From 042e57d59b3e7f44014da23e62911ae9b591953a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 28 Aug 2025 02:21:46 +0000 Subject: [PATCH] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated msiof_update_and_wait() updates reg and waits until the value was updated. But, if the set value was same as current reg value, no update will be happen. Check the value, and ignore waiting if no update. Signed-off-by: Kuninori Morimoto Message-ID: <87h5xsuqx2.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown --- sound/soc/renesas/rcar/msiof.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c index 36d31ab8ac6a5..b7633ed3e3f0c 100644 --- a/sound/soc/renesas/rcar/msiof.c +++ b/sound/soc/renesas/rcar/msiof.c @@ -82,13 +82,18 @@ struct msiof_priv { #define msiof_write(priv, reg, val) iowrite32(val, (priv)->base + reg) #define msiof_status_clear(priv) msiof_write(priv, SISTR, SISTR_ERR) -static void msiof_update(struct msiof_priv *priv, u32 reg, u32 mask, u32 val) +static int msiof_update(struct msiof_priv *priv, u32 reg, u32 mask, u32 val) { u32 old = msiof_read(priv, reg); u32 new = (old & ~mask) | (val & mask); + int updated = false; - if (old != new) + if (old != new) { msiof_write(priv, reg, new); + updated = true; + } + + return updated; } static void msiof_update_and_wait(struct msiof_priv *priv, u32 reg, u32 mask, u32 val, u32 expect) @@ -96,7 +101,9 @@ static void msiof_update_and_wait(struct msiof_priv *priv, u32 reg, u32 mask, u3 u32 data; int ret; - msiof_update(priv, reg, mask, val); + ret = msiof_update(priv, reg, mask, val); + if (!ret) /* no update */ + return; ret = readl_poll_timeout_atomic(priv->base + reg, data, (data & mask) == expect, 1, 128); -- 2.47.3