diff options
author | Benoît Thébaudeau <[email protected]> | 2012-07-02 13:45:21 +0200 |
---|---|---|
committer | Mark Brown <[email protected]> | 2012-07-03 20:08:29 +0100 |
commit | 32fee7afe763344ef53bbd4e737aa6168a9308aa (patch) | |
tree | 92ae2dff2aee91861cf9bca565ef5438d6076ce5 | |
parent | 890255e704826a20caec54dcec1926316baf4263 (diff) |
ASoC: dapm: Fix dapm_set_path_status() connect
dapm_set_path_status() sets connect incorrectly in the case max > 1 with invert.
In that case, the raw disconnect value should be max, which corresponds to the
userspace value 0.
This use case currently does not appear upstream, but it could break
SOC_DAPM_SINGLE() or SOC_DAPM_SINGLE_TLV() elsewhere or in the future.
This patch completes commit 3a9abe8.
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: <[email protected]>
Signed-off-by: Benoît Thébaudeau <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
-rw-r--r-- | sound/soc/soc-dapm.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 89eae93445cf..5be4f9a2edb8 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -321,11 +321,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, val = soc_widget_read(w, reg); val = (val >> shift) & mask; + if (invert) + val = max - val; - if ((invert && !val) || (!invert && val)) - p->connect = 1; - else - p->connect = 0; + p->connect = !!val; } break; case snd_soc_dapm_mux: { |