mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
ASoC: da7219: Fix change notifications for tone generator frequency
commit 08ef484049 upstream.
The tone generator frequency control just returns 0 on successful write,
not a boolean value indicating if there was a change or not. Compare
what was written with the value that was there previously so that
notifications are generated appropriately when the value changes.
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220420133437.569229-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e6e61aab49
commit
f45359824a
|
|
@ -446,7 +446,7 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
|
||||||
struct soc_mixer_control *mixer_ctrl =
|
struct soc_mixer_control *mixer_ctrl =
|
||||||
(struct soc_mixer_control *) kcontrol->private_value;
|
(struct soc_mixer_control *) kcontrol->private_value;
|
||||||
unsigned int reg = mixer_ctrl->reg;
|
unsigned int reg = mixer_ctrl->reg;
|
||||||
__le16 val;
|
__le16 val_new, val_old;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -454,13 +454,19 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
|
||||||
* Therefore we need to convert to little endian here to align with
|
* Therefore we need to convert to little endian here to align with
|
||||||
* HW registers.
|
* HW registers.
|
||||||
*/
|
*/
|
||||||
val = cpu_to_le16(ucontrol->value.integer.value[0]);
|
val_new = cpu_to_le16(ucontrol->value.integer.value[0]);
|
||||||
|
|
||||||
mutex_lock(&da7219->ctrl_lock);
|
mutex_lock(&da7219->ctrl_lock);
|
||||||
ret = regmap_raw_write(da7219->regmap, reg, &val, sizeof(val));
|
ret = regmap_raw_read(da7219->regmap, reg, &val_old, sizeof(val_old));
|
||||||
|
if (ret == 0 && (val_old != val_new))
|
||||||
|
ret = regmap_raw_write(da7219->regmap, reg,
|
||||||
|
&val_new, sizeof(val_new));
|
||||||
mutex_unlock(&da7219->ctrl_lock);
|
mutex_unlock(&da7219->ctrl_lock);
|
||||||
|
|
||||||
return ret;
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return val_old != val_new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user