mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
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 <kuninori.morimoto.gx@renesas.com> Message-ID: <87h5xsuqx2.wl-kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
1b237f190e
commit
042e57d59b
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user