diff options
| -rw-r--r-- | sound/soc/soc-core.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3c57f5cf2779..dde4b82ad41d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -3019,9 +3019,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, | |||
| 3019 | unsigned int val, val_mask; | 3019 | unsigned int val, val_mask; |
| 3020 | int ret; | 3020 | int ret; |
| 3021 | 3021 | ||
| 3022 | val = ((ucontrol->value.integer.value[0] + min) & mask); | ||
| 3023 | if (invert) | 3022 | if (invert) |
| 3024 | val = max - val; | 3023 | val = (max - ucontrol->value.integer.value[0]) & mask; |
| 3024 | else | ||
| 3025 | val = ((ucontrol->value.integer.value[0] + min) & mask); | ||
| 3025 | val_mask = mask << shift; | 3026 | val_mask = mask << shift; |
| 3026 | val = val << shift; | 3027 | val = val << shift; |
| 3027 | 3028 | ||
| @@ -3030,9 +3031,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, | |||
| 3030 | return ret; | 3031 | return ret; |
| 3031 | 3032 | ||
| 3032 | if (snd_soc_volsw_is_stereo(mc)) { | 3033 | if (snd_soc_volsw_is_stereo(mc)) { |
| 3033 | val = ((ucontrol->value.integer.value[1] + min) & mask); | ||
| 3034 | if (invert) | 3034 | if (invert) |
| 3035 | val = max - val; | 3035 | val = (max - ucontrol->value.integer.value[1]) & mask; |
| 3036 | else | ||
| 3037 | val = ((ucontrol->value.integer.value[1] + min) & mask); | ||
| 3036 | val_mask = mask << shift; | 3038 | val_mask = mask << shift; |
| 3037 | val = val << shift; | 3039 | val = val << shift; |
| 3038 | 3040 | ||
| @@ -3077,8 +3079,9 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, | |||
| 3077 | if (invert) | 3079 | if (invert) |
| 3078 | ucontrol->value.integer.value[0] = | 3080 | ucontrol->value.integer.value[0] = |
| 3079 | max - ucontrol->value.integer.value[0]; | 3081 | max - ucontrol->value.integer.value[0]; |
| 3080 | ucontrol->value.integer.value[0] = | 3082 | else |
| 3081 | ucontrol->value.integer.value[0] - min; | 3083 | ucontrol->value.integer.value[0] = |
| 3084 | ucontrol->value.integer.value[0] - min; | ||
| 3082 | 3085 | ||
| 3083 | if (snd_soc_volsw_is_stereo(mc)) { | 3086 | if (snd_soc_volsw_is_stereo(mc)) { |
| 3084 | ret = snd_soc_component_read(component, rreg, &val); | 3087 | ret = snd_soc_component_read(component, rreg, &val); |
| @@ -3089,8 +3092,9 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, | |||
| 3089 | if (invert) | 3092 | if (invert) |
| 3090 | ucontrol->value.integer.value[1] = | 3093 | ucontrol->value.integer.value[1] = |
| 3091 | max - ucontrol->value.integer.value[1]; | 3094 | max - ucontrol->value.integer.value[1]; |
| 3092 | ucontrol->value.integer.value[1] = | 3095 | else |
| 3093 | ucontrol->value.integer.value[1] - min; | 3096 | ucontrol->value.integer.value[1] = |
| 3097 | ucontrol->value.integer.value[1] - min; | ||
| 3094 | } | 3098 | } |
| 3095 | 3099 | ||
| 3096 | return 0; | 3100 | return 0; |
