Message ID | 20171002120854.5212-5-quentin.schulz@free-electrons.com |
---|---|
State | New |
Headers | show |
Series | [v3,01/12] pinctrl: move gpio-axp209 to pinctrl | expand |
On Mon, Oct 02, 2017 at 12:08:46PM +0000, Quentin Schulz wrote: > 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> Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 3ddeba45feed..17146496b22a 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -45,6 +45,7 @@ struct axp20x_pctrl_desc { unsigned int ldo_mask; /* Stores the pins supporting ADC function. Bit offset is pin number. */ unsigned int adc_mask; + unsigned int gpio_status_offset; }; struct axp20x_pinctrl_function { @@ -74,6 +75,7 @@ static const struct axp20x_pctrl_desc axp20x_data = { .npins = ARRAY_SIZE(axp209_pins), .ldo_mask = BIT(0) | BIT(1), .adc_mask = BIT(0) | BIT(1), + .gpio_status_offset = 4, }; static int axp20x_gpio_get_reg(unsigned offset) @@ -105,7 +107,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset) if (ret) return ret; - return !!(val & BIT(offset + 4)); + return !!(val & BIT(offset + pctl->desc->gpio_status_offset)); } static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned 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> --- drivers/pinctrl/pinctrl-axp209.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html