提交 6f526f0a 编写于 作者: S Stephen Warren 提交者: Mark Brown

ASoC: WM8903: Disallow all invalid gpio_cfg pdata values

The GPIO registers are 15 bits wide. Hence values, higher than 0x7fff are
not legal GPIO register values. Modify the pdata.gpio_cfg handling code
to reject all illegal values, not just WM8903_GPIO_NO_CONFIG (0x8000). This
will allow the later use of 0xffffffff as an invalid value in future device
tree bindings, meaning "don't touch this GPIO's configuration".
Signed-off-by: NStephen Warren <swarren@nvidia.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 84b315ee
无相关合并请求
...@@ -1936,11 +1936,11 @@ static int wm8903_probe(struct snd_soc_codec *codec) ...@@ -1936,11 +1936,11 @@ static int wm8903_probe(struct snd_soc_codec *codec)
bool mic_gpio = false; bool mic_gpio = false;
for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
if (pdata->gpio_cfg[i] == WM8903_GPIO_NO_CONFIG) if (pdata->gpio_cfg[i] > 0x7fff)
continue; continue;
snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i,
pdata->gpio_cfg[i] & 0xffff); pdata->gpio_cfg[i] & 0x7fff);
val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK) val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK)
>> WM8903_GP1_FN_SHIFT; >> WM8903_GP1_FN_SHIFT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部