mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-02-03 17:44:54 +00:00
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>
This commit is contained in:
parent
0f9887d11e
commit
e49b68339e
@ -796,20 +796,14 @@ static int twl6040_get_volsw(struct snd_kcontrol *kcontrol,
|
||||
out = &twl6040_priv->handsfree;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
dev_warn(codec->dev, "%s: Unexpected register: 0x%02x\n",
|
||||
__func__, mc->reg);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (out) {
|
||||
ucontrol->value.integer.value[0] = out->left_vol;
|
||||
ucontrol->value.integer.value[1] = out->right_vol;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* call the appropriate handler depending on the rreg */
|
||||
if (mc->rreg)
|
||||
return snd_soc_get_volsw_2r(kcontrol, ucontrol);
|
||||
else
|
||||
return snd_soc_get_volsw(kcontrol, ucontrol);
|
||||
ucontrol->value.integer.value[0] = out->left_vol;
|
||||
ucontrol->value.integer.value[1] = out->right_vol;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user