Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49c3226c authored by Charles Keepax's avatar Charles Keepax Committed by Greg Kroah-Hartman
Browse files

ASoC: wm_adsp: Return an error on write to a disabled volatile control




[ Upstream commit 67430a39ca7a6af28aade5acb92d43ee257c1014 ]

Volatile controls should only be accessed when the firmware is active,
currently however writes to these controls will succeed, but the data
will be lost, if the firmware is powered down. Update this behaviour such
that an error is returned the same as it is for reads.

Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d86f4ea8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -789,6 +789,9 @@ static int wm_coeff_put(struct snd_kcontrol *kctl,

	mutex_lock(&ctl->dsp->pwr_lock);

	if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
		ret = -EPERM;
	else
		memcpy(ctl->cache, p, ctl->len);

	ctl->set = 1;
@@ -816,6 +819,8 @@ static int wm_coeff_tlv_put(struct snd_kcontrol *kctl,
		ctl->set = 1;
		if (ctl->enabled && ctl->dsp->running)
			ret = wm_coeff_write_control(ctl, ctl->cache, size);
		else if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
			ret = -EPERM;
	}

	mutex_unlock(&ctl->dsp->pwr_lock);