Commit c56f4b24 authored by Simon Trimmer's avatar Simon Trimmer Committed by Mark Brown

firmware: cs_dsp: cs_dsp_coeff_write_ctrl() should report changed

ALSA callers need to know whether there was a change to the value so
that they can report a control write change correctly.
Signed-off-by: default avatarSimon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165811.3014472-2-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9abf2313
...@@ -752,7 +752,7 @@ static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl, ...@@ -752,7 +752,7 @@ static int cs_dsp_coeff_write_ctrl_raw(struct cs_dsp_coeff_ctl *ctl,
* *
* Must be called with pwr_lock held. * Must be called with pwr_lock held.
* *
* Return: Zero for success, a negative number on error. * Return: < 0 on error, 1 when the control value changed and 0 when it has not.
*/ */
int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl,
unsigned int off, const void *buf, size_t len) unsigned int off, const void *buf, size_t len)
...@@ -767,16 +767,23 @@ int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl, ...@@ -767,16 +767,23 @@ int cs_dsp_coeff_write_ctrl(struct cs_dsp_coeff_ctl *ctl,
if (len + off * sizeof(u32) > ctl->len) if (len + off * sizeof(u32) > ctl->len)
return -EINVAL; return -EINVAL;
if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) {
ret = -EPERM; ret = -EPERM;
else if (buf != ctl->cache) } else if (buf != ctl->cache) {
if (memcmp(ctl->cache + off * sizeof(u32), buf, len))
memcpy(ctl->cache + off * sizeof(u32), buf, len); memcpy(ctl->cache + off * sizeof(u32), buf, len);
else
return 0;
}
ctl->set = 1; ctl->set = 1;
if (ctl->enabled && ctl->dsp->running) if (ctl->enabled && ctl->dsp->running)
ret = cs_dsp_coeff_write_ctrl_raw(ctl, off, buf, len); ret = cs_dsp_coeff_write_ctrl_raw(ctl, off, buf, len);
if (ret < 0)
return ret; return ret;
return 1;
} }
EXPORT_SYMBOL_GPL(cs_dsp_coeff_write_ctrl); EXPORT_SYMBOL_GPL(cs_dsp_coeff_write_ctrl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment