diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-dapm.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 846678aa3d35..4cf58911f3b3 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1262,8 +1262,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, | |||
1262 | 1262 | ||
1263 | /* test and update the power status of a mixer or switch widget */ | 1263 | /* test and update the power status of a mixer or switch widget */ |
1264 | static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | 1264 | static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, |
1265 | struct snd_kcontrol *kcontrol, int reg, | 1265 | struct snd_kcontrol *kcontrol, int connect) |
1266 | int val_mask, int val, int invert) | ||
1267 | { | 1266 | { |
1268 | struct snd_soc_dapm_path *path; | 1267 | struct snd_soc_dapm_path *path; |
1269 | int found = 0; | 1268 | int found = 0; |
@@ -1273,9 +1272,6 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | |||
1273 | widget->id != snd_soc_dapm_switch) | 1272 | widget->id != snd_soc_dapm_switch) |
1274 | return -ENODEV; | 1273 | return -ENODEV; |
1275 | 1274 | ||
1276 | if (!snd_soc_test_bits(widget->codec, reg, val_mask, val)) | ||
1277 | return 0; | ||
1278 | |||
1279 | /* find dapm widget path assoc with kcontrol */ | 1275 | /* find dapm widget path assoc with kcontrol */ |
1280 | list_for_each_entry(path, &widget->codec->dapm_paths, list) { | 1276 | list_for_each_entry(path, &widget->codec->dapm_paths, list) { |
1281 | if (path->kcontrol != kcontrol) | 1277 | if (path->kcontrol != kcontrol) |
@@ -1283,12 +1279,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | |||
1283 | 1279 | ||
1284 | /* found, now check type */ | 1280 | /* found, now check type */ |
1285 | found = 1; | 1281 | found = 1; |
1286 | if (val) | 1282 | path->connect = connect; |
1287 | /* new connection */ | ||
1288 | path->connect = invert ? 0:1; | ||
1289 | else | ||
1290 | /* old connection must be powered down */ | ||
1291 | path->connect = invert ? 1:0; | ||
1292 | break; | 1283 | break; |
1293 | } | 1284 | } |
1294 | 1285 | ||
@@ -1695,6 +1686,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
1695 | unsigned int mask = (1 << fls(max)) - 1; | 1686 | unsigned int mask = (1 << fls(max)) - 1; |
1696 | unsigned int invert = mc->invert; | 1687 | unsigned int invert = mc->invert; |
1697 | unsigned int val, val2, val_mask; | 1688 | unsigned int val, val2, val_mask; |
1689 | int connect; | ||
1698 | int ret; | 1690 | int ret; |
1699 | 1691 | ||
1700 | val = (ucontrol->value.integer.value[0] & mask); | 1692 | val = (ucontrol->value.integer.value[0] & mask); |
@@ -1721,7 +1713,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
1721 | return 1; | 1713 | return 1; |
1722 | } | 1714 | } |
1723 | 1715 | ||
1724 | dapm_mixer_update_power(widget, kcontrol, reg, val_mask, val, invert); | 1716 | if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { |
1717 | if (val) | ||
1718 | /* new connection */ | ||
1719 | connect = invert ? 0:1; | ||
1720 | else | ||
1721 | /* old connection must be powered down */ | ||
1722 | connect = invert ? 1:0; | ||
1723 | |||
1724 | dapm_mixer_update_power(widget, kcontrol, connect); | ||
1725 | } | ||
1726 | |||
1725 | if (widget->event) { | 1727 | if (widget->event) { |
1726 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | 1728 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { |
1727 | ret = widget->event(widget, kcontrol, | 1729 | ret = widget->event(widget, kcontrol, |