aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 967066873aad..912330b147e0 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2464,23 +2464,20 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
2464 (struct soc_mixer_control *)kcontrol->private_value; 2464 (struct soc_mixer_control *)kcontrol->private_value;
2465 unsigned int reg = mc->reg; 2465 unsigned int reg = mc->reg;
2466 unsigned int shift = mc->shift; 2466 unsigned int shift = mc->shift;
2467 unsigned int rshift = mc->rshift;
2468 int max = mc->max; 2467 int max = mc->max;
2469 unsigned int invert = mc->invert;
2470 unsigned int mask = (1 << fls(max)) - 1; 2468 unsigned int mask = (1 << fls(max)) - 1;
2469 unsigned int invert = mc->invert;
2470
2471 if (snd_soc_volsw_is_stereo(mc))
2472 dev_warn(widget->dapm->dev,
2473 "Control '%s' is stereo, which is not supported\n",
2474 kcontrol->id.name);
2471 2475
2472 ucontrol->value.integer.value[0] = 2476 ucontrol->value.integer.value[0] =
2473 (snd_soc_read(widget->codec, reg) >> shift) & mask; 2477 (snd_soc_read(widget->codec, reg) >> shift) & mask;
2474 if (shift != rshift) 2478 if (invert)
2475 ucontrol->value.integer.value[1] =
2476 (snd_soc_read(widget->codec, reg) >> rshift) & mask;
2477 if (invert) {
2478 ucontrol->value.integer.value[0] = 2479 ucontrol->value.integer.value[0] =
2479 max - ucontrol->value.integer.value[0]; 2480 max - ucontrol->value.integer.value[0];
2480 if (shift != rshift)
2481 ucontrol->value.integer.value[1] =
2482 max - ucontrol->value.integer.value[1];
2483 }
2484 2481
2485 return 0; 2482 return 0;
2486} 2483}
@@ -2514,6 +2511,11 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2514 struct snd_soc_dapm_update update; 2511 struct snd_soc_dapm_update update;
2515 int wi; 2512 int wi;
2516 2513
2514 if (snd_soc_volsw_is_stereo(mc))
2515 dev_warn(widget->dapm->dev,
2516 "Control '%s' is stereo, which is not supported\n",
2517 kcontrol->id.name);
2518
2517 val = (ucontrol->value.integer.value[0] & mask); 2519 val = (ucontrol->value.integer.value[0] & mask);
2518 connect = !!val; 2520 connect = !!val;
2519 2521