aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2018-02-05 06:38:17 -0500
committerMark Brown <broonie@kernel.org>2018-02-12 04:34:49 -0500
commit04ff40a983e864b586f189b4c3503b6f61263643 (patch)
treec0a0b18bac110004ce3662fb77a1304df839d0af
parent7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff)
ASoC: wm_adsp: Don't init cache from DSP memory if control is write-only
For controls marked write-only don't initialize the cache from the content of the DSP memory. We stil need the cache for any new data that is written to this control, and we need to return something for a read of the ALSA control because most user-side code assumes all ALSA controls are readable. The cache is already created zero- filled so the only change needed is to skip populating it from DSP memory if the control isn't readable. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/wm_adsp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 66e32f5d2917..0060aeb63a9f 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1237,9 +1237,16 @@ static int wm_coeff_init_control_caches(struct wm_adsp *dsp)
1237 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE) 1237 if (ctl->flags & WMFW_CTL_FLAG_VOLATILE)
1238 continue; 1238 continue;
1239 1239
1240 ret = wm_coeff_read_control(ctl, ctl->cache, ctl->len); 1240 /*
1241 if (ret < 0) 1241 * For readable controls populate the cache from the DSP memory.
1242 return ret; 1242 * For non-readable controls the cache was zero-filled when
1243 * created so we don't need to do anything.
1244 */
1245 if (!ctl->flags || (ctl->flags & WMFW_CTL_FLAG_READABLE)) {
1246 ret = wm_coeff_read_control(ctl, ctl->cache, ctl->len);
1247 if (ret < 0)
1248 return ret;
1249 }
1243 } 1250 }
1244 1251
1245 return 0; 1252 return 0;