aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2013-05-28 07:01:50 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-28 10:34:26 -0400
commit0c2e3f3420bb790a4e5bc14d3d50a722964ad73e (patch)
tree4df579ffa46187b53928d1772a40bf1d7af05c87
parent9dbce04402e33e362e3e946c437bc70b8102a95d (diff)
ASoC: wm_adsp: Ensure set controls are synced on each boot
Rename `dirty' to `set' as it is a bit more descriptive. A set control is any control that has been set by the user. We need to ensure that everytime we boot the DSP we sync out any controls that were set. We could at some point start keeping track of the default values of the controls to suppress some of the device I/O. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/wm_adsp.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index d715c8ede772..ddba3fea39eb 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -242,7 +242,7 @@ struct wm_coeff_ctl {
242 struct list_head list; 242 struct list_head list;
243 void *cache; 243 void *cache;
244 size_t len; 244 size_t len;
245 unsigned int dirty:1; 245 unsigned int set:1;
246 struct snd_kcontrol *kcontrol; 246 struct snd_kcontrol *kcontrol;
247}; 247};
248 248
@@ -424,7 +424,7 @@ static int wm_coeff_put(struct snd_kcontrol *kcontrol,
424 memcpy(ctl->cache, p, ctl->len); 424 memcpy(ctl->cache, p, ctl->len);
425 425
426 if (!ctl->enabled) { 426 if (!ctl->enabled) {
427 ctl->dirty = 1; 427 ctl->set = 1;
428 return 0; 428 return 0;
429 } 429 }
430 430
@@ -760,7 +760,7 @@ static int wm_coeff_init_control_caches(struct wm_coeff *wm_coeff)
760 760
761 list_for_each_entry(ctl, &wm_coeff->ctl_list, 761 list_for_each_entry(ctl, &wm_coeff->ctl_list,
762 list) { 762 list) {
763 if (!ctl->enabled || ctl->dirty) 763 if (!ctl->enabled || ctl->set)
764 continue; 764 continue;
765 ret = wm_coeff_read_control(ctl->kcontrol, 765 ret = wm_coeff_read_control(ctl->kcontrol,
766 ctl->cache, 766 ctl->cache,
@@ -781,13 +781,12 @@ static int wm_coeff_sync_controls(struct wm_coeff *wm_coeff)
781 list) { 781 list) {
782 if (!ctl->enabled) 782 if (!ctl->enabled)
783 continue; 783 continue;
784 if (ctl->dirty) { 784 if (ctl->set) {
785 ret = wm_coeff_write_control(ctl->kcontrol, 785 ret = wm_coeff_write_control(ctl->kcontrol,
786 ctl->cache, 786 ctl->cache,
787 ctl->len); 787 ctl->len);
788 if (ret < 0) 788 if (ret < 0)
789 return ret; 789 return ret;
790 ctl->dirty = 0;
791 } 790 }
792 } 791 }
793 792
@@ -864,7 +863,7 @@ static int wm_adsp_create_control(struct snd_soc_codec *codec,
864 goto err_ctl; 863 goto err_ctl;
865 } 864 }
866 ctl->enabled = 1; 865 ctl->enabled = 1;
867 ctl->dirty = 0; 866 ctl->set = 0;
868 ctl->ops.xget = wm_coeff_get; 867 ctl->ops.xget = wm_coeff_get;
869 ctl->ops.xput = wm_coeff_put; 868 ctl->ops.xput = wm_coeff_put;
870 ctl->card = codec->card->snd_card; 869 ctl->card = codec->card->snd_card;
@@ -1434,12 +1433,12 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
1434 if (ret != 0) 1433 if (ret != 0)
1435 goto err; 1434 goto err;
1436 1435
1437 /* Initialize caches for enabled and non-dirty controls */ 1436 /* Initialize caches for enabled and unset controls */
1438 ret = wm_coeff_init_control_caches(dsp->wm_coeff); 1437 ret = wm_coeff_init_control_caches(dsp->wm_coeff);
1439 if (ret != 0) 1438 if (ret != 0)
1440 goto err; 1439 goto err;
1441 1440
1442 /* Sync dirty controls */ 1441 /* Sync set controls */
1443 ret = wm_coeff_sync_controls(dsp->wm_coeff); 1442 ret = wm_coeff_sync_controls(dsp->wm_coeff);
1444 if (ret != 0) 1443 if (ret != 0)
1445 goto err; 1444 goto err;
@@ -1591,12 +1590,12 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
1591 if (ret != 0) 1590 if (ret != 0)
1592 goto err; 1591 goto err;
1593 1592
1594 /* Initialize caches for enabled and non-dirty controls */ 1593 /* Initialize caches for enabled and unset controls */
1595 ret = wm_coeff_init_control_caches(dsp->wm_coeff); 1594 ret = wm_coeff_init_control_caches(dsp->wm_coeff);
1596 if (ret != 0) 1595 if (ret != 0)
1597 goto err; 1596 goto err;
1598 1597
1599 /* Sync dirty controls */ 1598 /* Sync set controls */
1600 ret = wm_coeff_sync_controls(dsp->wm_coeff); 1599 ret = wm_coeff_sync_controls(dsp->wm_coeff);
1601 if (ret != 0) 1600 if (ret != 0)
1602 goto err; 1601 goto err;