diff options
author | Quentin Schulz <quentin.schulz@free-electrons.com> | 2017-12-05 09:46:44 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-12-07 04:07:19 -0500 |
commit | 48e706fbc546d63148a762aadf92f412eefe8b8e (patch) | |
tree | e3311f77fcc0f04d434315ea5095a18b961910c2 /drivers/pinctrl/pinctrl-axp209.c | |
parent | d242e60c7d59fb95a9349d1487cfb3ddf6eebdde (diff) |
pinctrl: axp209: add programmable gpio_status_offset
To prepare for patches that will add support for a new PMIC that has a
different GPIO input status register, add a gpio_status_offset within
axp20x_pctl structure and use it.
Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-axp209.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-axp209.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 17eeb0410a5b..db8e319b6e11 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c | |||
@@ -48,6 +48,7 @@ struct axp20x_pctrl_desc { | |||
48 | u8 ldo_mask; | 48 | u8 ldo_mask; |
49 | /* Stores the pins supporting ADC function. Bit offset is pin number. */ | 49 | /* Stores the pins supporting ADC function. Bit offset is pin number. */ |
50 | u8 adc_mask; | 50 | u8 adc_mask; |
51 | u8 gpio_status_offset; | ||
51 | }; | 52 | }; |
52 | 53 | ||
53 | struct axp20x_pinctrl_function { | 54 | struct axp20x_pinctrl_function { |
@@ -77,6 +78,7 @@ static const struct axp20x_pctrl_desc axp20x_data = { | |||
77 | .npins = ARRAY_SIZE(axp209_pins), | 78 | .npins = ARRAY_SIZE(axp209_pins), |
78 | .ldo_mask = BIT(0) | BIT(1), | 79 | .ldo_mask = BIT(0) | BIT(1), |
79 | .adc_mask = BIT(0) | BIT(1), | 80 | .adc_mask = BIT(0) | BIT(1), |
81 | .gpio_status_offset = 4, | ||
80 | }; | 82 | }; |
81 | 83 | ||
82 | static int axp20x_gpio_get_reg(unsigned int offset) | 84 | static int axp20x_gpio_get_reg(unsigned int offset) |
@@ -108,7 +110,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset) | |||
108 | if (ret) | 110 | if (ret) |
109 | return ret; | 111 | return ret; |
110 | 112 | ||
111 | return !!(val & BIT(offset + 4)); | 113 | return !!(val & BIT(offset + pctl->desc->gpio_status_offset)); |
112 | } | 114 | } |
113 | 115 | ||
114 | static int axp20x_gpio_get_direction(struct gpio_chip *chip, | 116 | static int axp20x_gpio_get_direction(struct gpio_chip *chip, |