aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2016-11-02 03:35:58 -0400
committerMark Brown <broonie@kernel.org>2016-11-02 11:55:03 -0400
commite411b0b5eb9b65257a050eac333d181d6e00e2c6 (patch)
tree594c649787b942815021fd13a7db9802089d7619
parent1001354ca34179f3db924eb66672442a173147dc (diff)
ASoC: dapm: Support second register for DAPM control updates
To support double channel shared controls split across 2 registers, one for each channel, we must be able to update both registers together. Add a second set of register fields to struct snd_soc_dapm_update, and update the DAPM control writeback (put) callbacks to support this. For codecs that use custom events which call into DAPM to do updates, also clear struct snd_soc_dapm_update before using it, so the second set of fields remains clean. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/soc-dapm.h4
-rw-r--r--sound/soc/codecs/adau17x1.c2
-rw-r--r--sound/soc/codecs/tlv320aic3x.c2
-rw-r--r--sound/soc/codecs/wm9712.c2
-rw-r--r--sound/soc/codecs/wm9713.c2
-rw-r--r--sound/soc/soc-dapm.c13
6 files changed, 19 insertions, 6 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index f60d755f7ac6..d5f4677776ce 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -615,6 +615,10 @@ struct snd_soc_dapm_update {
615 int reg; 615 int reg;
616 int mask; 616 int mask;
617 int val; 617 int val;
618 int reg2;
619 int mask2;
620 int val2;
621 bool has_second_set;
618}; 622};
619 623
620struct snd_soc_dapm_wcache { 624struct snd_soc_dapm_wcache {
diff --git a/sound/soc/codecs/adau17x1.c b/sound/soc/codecs/adau17x1.c
index 439aa3ff1f99..b36511d965c8 100644
--- a/sound/soc/codecs/adau17x1.c
+++ b/sound/soc/codecs/adau17x1.c
@@ -160,7 +160,7 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol,
160 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 160 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
161 struct adau *adau = snd_soc_codec_get_drvdata(codec); 161 struct adau *adau = snd_soc_codec_get_drvdata(codec);
162 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 162 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
163 struct snd_soc_dapm_update update; 163 struct snd_soc_dapm_update update = { 0 };
164 unsigned int stream = e->shift_l; 164 unsigned int stream = e->shift_l;
165 unsigned int val, change; 165 unsigned int val, change;
166 int reg; 166 int reg;
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 5a8d96ec058c..8877b74b0510 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -157,7 +157,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
157 unsigned int mask = (1 << fls(max)) - 1; 157 unsigned int mask = (1 << fls(max)) - 1;
158 unsigned int invert = mc->invert; 158 unsigned int invert = mc->invert;
159 unsigned short val; 159 unsigned short val;
160 struct snd_soc_dapm_update update; 160 struct snd_soc_dapm_update update = { 0 };
161 int connect, change; 161 int connect, change;
162 162
163 val = (ucontrol->value.integer.value[0] & mask); 163 val = (ucontrol->value.integer.value[0] & mask);
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 557709eac698..85f7c5bb8b82 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -187,7 +187,7 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol,
187 struct soc_mixer_control *mc = 187 struct soc_mixer_control *mc =
188 (struct soc_mixer_control *)kcontrol->private_value; 188 (struct soc_mixer_control *)kcontrol->private_value;
189 unsigned int mixer, mask, shift, old; 189 unsigned int mixer, mask, shift, old;
190 struct snd_soc_dapm_update update; 190 struct snd_soc_dapm_update update = { 0 };
191 bool change; 191 bool change;
192 192
193 mixer = mc->shift >> 8; 193 mixer = mc->shift >> 8;
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index e4301ddb1b84..7e4822185feb 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -231,7 +231,7 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol,
231 struct soc_mixer_control *mc = 231 struct soc_mixer_control *mc =
232 (struct soc_mixer_control *)kcontrol->private_value; 232 (struct soc_mixer_control *)kcontrol->private_value;
233 unsigned int mixer, mask, shift, old; 233 unsigned int mixer, mask, shift, old;
234 struct snd_soc_dapm_update update; 234 struct snd_soc_dapm_update update = { 0 };
235 bool change; 235 bool change;
236 236
237 mixer = mc->shift >> 8; 237 mixer = mc->shift >> 8;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 3bbe32ee4630..32e7af9b93d5 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1626,6 +1626,15 @@ static void dapm_widget_update(struct snd_soc_card *card)
1626 dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n", 1626 dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n",
1627 w->name, ret); 1627 w->name, ret);
1628 1628
1629 if (update->has_second_set) {
1630 ret = soc_dapm_update_bits(w->dapm, update->reg2,
1631 update->mask2, update->val2);
1632 if (ret < 0)
1633 dev_err(w->dapm->dev,
1634 "ASoC: %s DAPM update failed: %d\n",
1635 w->name, ret);
1636 }
1637
1629 for (wi = 0; wi < wlist->num_widgets; wi++) { 1638 for (wi = 0; wi < wlist->num_widgets; wi++) {
1630 w = wlist->widgets[wi]; 1639 w = wlist->widgets[wi];
1631 1640
@@ -3084,7 +3093,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
3084 unsigned int invert = mc->invert; 3093 unsigned int invert = mc->invert;
3085 unsigned int val; 3094 unsigned int val;
3086 int connect, change, reg_change = 0; 3095 int connect, change, reg_change = 0;
3087 struct snd_soc_dapm_update update; 3096 struct snd_soc_dapm_update update = { NULL };
3088 int ret = 0; 3097 int ret = 0;
3089 3098
3090 if (snd_soc_volsw_is_stereo(mc)) 3099 if (snd_soc_volsw_is_stereo(mc))
@@ -3192,7 +3201,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
3192 unsigned int *item = ucontrol->value.enumerated.item; 3201 unsigned int *item = ucontrol->value.enumerated.item;
3193 unsigned int val, change, reg_change = 0; 3202 unsigned int val, change, reg_change = 0;
3194 unsigned int mask; 3203 unsigned int mask;
3195 struct snd_soc_dapm_update update; 3204 struct snd_soc_dapm_update update = { NULL };
3196 int ret = 0; 3205 int ret = 0;
3197 3206
3198 if (item[0] >= e->items) 3207 if (item[0] >= e->items)