diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-10-05 03:29:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-05 12:10:09 -0400 |
commit | e49b68339ebc7d2e67dc1ae16a4ac6a35fcfc9d5 (patch) | |
tree | 7eb6036750246c16945705d994587f2a1d665310 /sound/soc/codecs/twl6040.c | |
parent | 0f9887d11e7c59ebae5e464f30a6dde788ed9011 (diff) |
ASoC: twl6040: Simplify custom get_volsw callback
The custom get_volsw does not need to call any core get_volsw calls,
since we are returning the shadow values for the gains.
Return -EINVAL in the unlikely event, if the function has been called
for unhandled control. This way we can remove one check in the code.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/twl6040.c')
-rw-r--r-- | sound/soc/codecs/twl6040.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 11f681b15dec..4ad04e3d5c40 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -796,20 +796,14 @@ static int twl6040_get_volsw(struct snd_kcontrol *kcontrol, | |||
796 | out = &twl6040_priv->handsfree; | 796 | out = &twl6040_priv->handsfree; |
797 | break; | 797 | break; |
798 | default: | 798 | default: |
799 | break; | 799 | dev_warn(codec->dev, "%s: Unexpected register: 0x%02x\n", |
800 | } | 800 | __func__, mc->reg); |
801 | 801 | return -EINVAL; | |
802 | if (out) { | ||
803 | ucontrol->value.integer.value[0] = out->left_vol; | ||
804 | ucontrol->value.integer.value[1] = out->right_vol; | ||
805 | return 0; | ||
806 | } | 802 | } |
807 | 803 | ||
808 | /* call the appropriate handler depending on the rreg */ | 804 | ucontrol->value.integer.value[0] = out->left_vol; |
809 | if (mc->rreg) | 805 | ucontrol->value.integer.value[1] = out->right_vol; |
810 | return snd_soc_get_volsw_2r(kcontrol, ucontrol); | 806 | return 0; |
811 | else | ||
812 | return snd_soc_get_volsw(kcontrol, ucontrol); | ||
813 | } | 807 | } |
814 | 808 | ||
815 | /* | 809 | /* |