提交 e49b6833 编写于 作者: P Peter Ujfalusi 提交者: Mark Brown

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: NPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 0f9887d1
...@@ -796,20 +796,14 @@ static int twl6040_get_volsw(struct snd_kcontrol *kcontrol, ...@@ -796,20 +796,14 @@ static int twl6040_get_volsw(struct snd_kcontrol *kcontrol,
out = &twl6040_priv->handsfree; out = &twl6040_priv->handsfree;
break; break;
default: 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 */ ucontrol->value.integer.value[0] = out->left_vol;
if (mc->rreg) ucontrol->value.integer.value[1] = out->right_vol;
return snd_soc_get_volsw_2r(kcontrol, ucontrol); return 0;
else
return snd_soc_get_volsw(kcontrol, ucontrol);
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册