aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-08-27 10:40:47 -0400
committerMark Brown <broonie@linaro.org>2013-08-27 10:40:47 -0400
commit38f7d75edcf8ced03d03131005ed806bee746699 (patch)
tree1baf728abcc490365f499eef8c1b35b25435da5a /sound/soc/codecs
parentc22cff947a98ecd10c42974a39ced1819e5c868a (diff)
parent34742cb02bd368c1af3349c041d3e4446f7ac6ef (diff)
Merge remote-tracking branch 'asoc/topic/dapm' into asoc-core
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/tlv320aic3x.c52
-rw-r--r--sound/soc/codecs/twl6040.c4
-rw-r--r--sound/soc/codecs/wm8903.c4
-rw-r--r--sound/soc/codecs/wm8994.c4
-rw-r--r--sound/soc/codecs/wm8995.c5
-rw-r--r--sound/soc/codecs/wm_hubs.c8
6 files changed, 23 insertions, 54 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index e5b926883131..fec0db04262d 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -138,8 +138,7 @@ static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = {
138static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, 138static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
139 struct snd_ctl_elem_value *ucontrol) 139 struct snd_ctl_elem_value *ucontrol)
140{ 140{
141 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 141 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
142 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
143 struct soc_mixer_control *mc = 142 struct soc_mixer_control *mc =
144 (struct soc_mixer_control *)kcontrol->private_value; 143 (struct soc_mixer_control *)kcontrol->private_value;
145 unsigned int reg = mc->reg; 144 unsigned int reg = mc->reg;
@@ -147,10 +146,9 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
147 int max = mc->max; 146 int max = mc->max;
148 unsigned int mask = (1 << fls(max)) - 1; 147 unsigned int mask = (1 << fls(max)) - 1;
149 unsigned int invert = mc->invert; 148 unsigned int invert = mc->invert;
150 unsigned short val, val_mask; 149 unsigned short val;
151 int ret; 150 struct snd_soc_dapm_update update;
152 struct snd_soc_dapm_path *path; 151 int connect, change;
153 int found = 0;
154 152
155 val = (ucontrol->value.integer.value[0] & mask); 153 val = (ucontrol->value.integer.value[0] & mask);
156 154
@@ -158,42 +156,26 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
158 if (val) 156 if (val)
159 val = mask; 157 val = mask;
160 158
159 connect = !!val;
160
161 if (invert) 161 if (invert)
162 val = mask - val; 162 val = mask - val;
163 val_mask = mask << shift;
164 val = val << shift;
165
166 mutex_lock(&widget->codec->mutex);
167 163
168 if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { 164 mask <<= shift;
169 /* find dapm widget path assoc with kcontrol */ 165 val <<= shift;
170 list_for_each_entry(path, &widget->dapm->card->paths, list) {
171 if (path->kcontrol != kcontrol)
172 continue;
173 166
174 /* found, now check type */ 167 change = snd_soc_test_bits(codec, val, mask, reg);
175 found = 1; 168 if (change) {
176 if (val) 169 update.kcontrol = kcontrol;
177 /* new connection */ 170 update.reg = reg;
178 path->connect = invert ? 0 : 1; 171 update.mask = mask;
179 else 172 update.val = val;
180 /* old connection must be powered down */
181 path->connect = invert ? 1 : 0;
182 173
183 dapm_mark_dirty(path->source, "tlv320aic3x source"); 174 snd_soc_dapm_mixer_update_power(&codec->dapm, kcontrol, connect,
184 dapm_mark_dirty(path->sink, "tlv320aic3x sink"); 175 &update);
185
186 break;
187 }
188 } 176 }
189 177
190 mutex_unlock(&widget->codec->mutex); 178 return change;
191
192 if (found)
193 snd_soc_dapm_sync(widget->dapm);
194
195 ret = snd_soc_update_bits_locked(widget->codec, reg, val_mask, val);
196 return ret;
197} 179}
198 180
199/* 181/*
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 44621ddc332d..d6c5bf14179a 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -437,9 +437,7 @@ static irqreturn_t twl6040_audio_handler(int irq, void *data)
437static int twl6040_soc_dapm_put_vibra_enum(struct snd_kcontrol *kcontrol, 437static int twl6040_soc_dapm_put_vibra_enum(struct snd_kcontrol *kcontrol,
438 struct snd_ctl_elem_value *ucontrol) 438 struct snd_ctl_elem_value *ucontrol)
439{ 439{
440 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 440 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
441 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
442 struct snd_soc_codec *codec = widget->codec;
443 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 441 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
444 unsigned int val; 442 unsigned int val;
445 443
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index fa24cedee687..eebcb1da3b7b 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -364,9 +364,7 @@ static void wm8903_seq_notifier(struct snd_soc_dapm_context *dapm,
364static int wm8903_class_w_put(struct snd_kcontrol *kcontrol, 364static int wm8903_class_w_put(struct snd_kcontrol *kcontrol,
365 struct snd_ctl_elem_value *ucontrol) 365 struct snd_ctl_elem_value *ucontrol)
366{ 366{
367 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 367 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
368 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
369 struct snd_soc_codec *codec = widget->codec;
370 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); 368 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
371 u16 reg; 369 u16 reg;
372 int ret; 370 int ret;
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index ba832b77c543..eee2a01f2691 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1437,9 +1437,7 @@ SOC_DAPM_SINGLE("AIF1.1 Switch", WM8994_DAC2_RIGHT_MIXER_ROUTING,
1437static int wm8994_put_class_w(struct snd_kcontrol *kcontrol, 1437static int wm8994_put_class_w(struct snd_kcontrol *kcontrol,
1438 struct snd_ctl_elem_value *ucontrol) 1438 struct snd_ctl_elem_value *ucontrol)
1439{ 1439{
1440 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 1440 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
1441 struct snd_soc_dapm_widget *w = wlist->widgets[0];
1442 struct snd_soc_codec *codec = w->codec;
1443 int ret; 1441 int ret;
1444 1442
1445 ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol); 1443 ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol);
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 90a65c427541..da2899e6c401 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -549,12 +549,9 @@ static int check_clk_sys(struct snd_soc_dapm_widget *source,
549static int wm8995_put_class_w(struct snd_kcontrol *kcontrol, 549static int wm8995_put_class_w(struct snd_kcontrol *kcontrol,
550 struct snd_ctl_elem_value *ucontrol) 550 struct snd_ctl_elem_value *ucontrol)
551{ 551{
552 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 552 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
553 struct snd_soc_dapm_widget *w = wlist->widgets[0];
554 struct snd_soc_codec *codec;
555 int ret; 553 int ret;
556 554
557 codec = w->codec;
558 ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol); 555 ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol);
559 wm8995_update_class_w(codec); 556 wm8995_update_class_w(codec);
560 return ret; 557 return ret;
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 2d9e099415a5..8b50e5958de5 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -699,9 +699,7 @@ EXPORT_SYMBOL_GPL(wm_hubs_update_class_w);
699static int class_w_put_volsw(struct snd_kcontrol *kcontrol, 699static int class_w_put_volsw(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol) 700 struct snd_ctl_elem_value *ucontrol)
701{ 701{
702 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 702 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
703 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
704 struct snd_soc_codec *codec = widget->codec;
705 int ret; 703 int ret;
706 704
707 ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol); 705 ret = snd_soc_dapm_put_volsw(kcontrol, ucontrol);
@@ -721,9 +719,7 @@ static int class_w_put_volsw(struct snd_kcontrol *kcontrol,
721static int class_w_put_double(struct snd_kcontrol *kcontrol, 719static int class_w_put_double(struct snd_kcontrol *kcontrol,
722 struct snd_ctl_elem_value *ucontrol) 720 struct snd_ctl_elem_value *ucontrol)
723{ 721{
724 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 722 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
725 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
726 struct snd_soc_codec *codec = widget->codec;
727 int ret; 723 int ret;
728 724
729 ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol); 725 ret = snd_soc_dapm_put_enum_double(kcontrol, ucontrol);