summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/da7219.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-05-04 15:30:32 +0100
committerMark Brown <broonie@kernel.org>2022-05-04 15:30:32 +0100
commitc0b38be14f1d843c29edc763d3df3cc741a2bf10 (patch)
tree7b4923fbd72134f891faa6866246e16b8a4b30dc /sound/soc/codecs/da7219.c
parent55d2a66cfec6a4196243940f754f5b34dd2106bf (diff)
parenta962890a5a3cce903ff7c7a19fadee63ed9efdc7 (diff)
downloadlinux-c0b38be14f1d843c29edc763d3df3cc741a2bf10.tar.bz2
ASoC: Pull in fixes
Cleanups for the dmaengine code build on top of current fixes.
Diffstat (limited to 'sound/soc/codecs/da7219.c')
-rw-r--r--sound/soc/codecs/da7219.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index a28d3601b932..7fdef38ed8cd 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -446,7 +446,7 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
struct soc_mixer_control *mixer_ctrl =
(struct soc_mixer_control *) kcontrol->private_value;
unsigned int reg = mixer_ctrl->reg;
- __le16 val;
+ __le16 val_new, val_old;
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
* 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);
- 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);
- return ret;
+ if (ret < 0)
+ return ret;
+
+ return val_old != val_new;
}