Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1743159

[PATCH v3 04/12] pinctrl: axp209: add programmable gpio_status_offset

From Quentin Schulz <quentin.schulz@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH v3 04/12] pinctrl: axp209: add programmable gpio_status_offset
Date 2017-10-02 14:20 +0200
Message-ID <uw7Rw-7b4-21@gated-at.bofh.it> (permalink)
References <uw7Rv-7b4-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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(-)

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)
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/12] add pinmuxing support for pins in AXP209 and AXP813 PMICs Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 03/12] pinctrl: axp209: rename everything from gpio to pctl Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 04/12] pinctrl: axp209: add programmable gpio_status_offset Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 05/12] pinctrl: axp209: add support for AXP813 GPIOs Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 01/12] pinctrl: move gpio-axp209 to pinctrl Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 11/12] ARM: dtsi: axp81x: add GPIO DT node Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 06/12] mfd: axp20x: add pinctrl cell for AXP813 Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 07/12] ARM: dts: sun8i: a711: include axp81x dtsi Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 08/12] ARM: dts: sun8i: bananapi-m3: include axp81x dtsi Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200
  [PATCH v3 12/12] ARM: dtsi: axp81x: set pinmux for GPIO0/1 when used as LDOs Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-10-02 14:20 +0200

csiph-web