4921240f79f07e1e287a3a5521a4148c3f596017
[openwrt/openwrt.git] / target / linux / sunxi / patches-4.9 / 0037-pinctrl-sunxi-Fix-PIN_CONFIG_BIAS_PULL_-DOWN-UP-argu.patch
1 From 223dba00b4072efc590c7d648f230db1b44186b9 Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Fri, 11 Nov 2016 17:50:34 +0800
4 Subject: pinctrl: sunxi: Fix PIN_CONFIG_BIAS_PULL_{DOWN,UP} argument
5
6 According to pinconf-generic.h, the argument for
7 PIN_CONFIG_BIAS_PULL_{DOWN,UP} is non-zero if the bias is enabled
8 with a pull up/down resistor, zero if it is directly connected
9 to VDD or ground.
10
11 Since Allwinner hardware uses a weak pull resistor internally,
12 the argument should be 1.
13
14 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
15 Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
16 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
17 ---
18 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
22 +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
23 @@ -291,12 +291,16 @@ static unsigned long *sunxi_pctrl_build_
24
25 if (sunxi_pctrl_has_bias_prop(node)) {
26 int pull = sunxi_pctrl_parse_bias_prop(node);
27 + int arg = 0;
28 if (pull < 0) {
29 ret = pull;
30 goto err_free;
31 }
32
33 - pinconfig[idx++] = pinconf_to_config_packed(pull, 0);
34 + if (pull != PIN_CONFIG_BIAS_DISABLE)
35 + arg = 1; /* hardware uses weak pull resistors */
36 +
37 + pinconfig[idx++] = pinconf_to_config_packed(pull, arg);
38 }
39
40