[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191128155438.325738-4-paul.kocialkowski@bootlin.com>
Date: Thu, 28 Nov 2019 16:54:36 +0100
From: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To: linux-gpio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Lee Jones <lee.jones@...aro.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Paul Kocialkowski <paul.kocialkowski@...tlin.com>
Subject: [PATCH v4 3/5] gpio: syscon: Add support for a custom get operation
Some drivers might need a custom get operation to match custom
behavior implemented in the set operation.
Add plumbing for supporting that.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
---
drivers/gpio/gpio-syscon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 31f332074d7d..36136b7f3a3b 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -43,6 +43,7 @@ struct syscon_gpio_data {
unsigned int bit_count;
unsigned int dat_bit_offset;
unsigned int dir_bit_offset;
+ int (*get)(struct gpio_chip *chip, unsigned offset);
void (*set)(struct gpio_chip *chip,
unsigned offset, int value);
};
@@ -252,7 +253,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
priv->chip.label = dev_name(dev);
priv->chip.base = -1;
priv->chip.ngpio = priv->data->bit_count;
- priv->chip.get = syscon_gpio_get;
+ priv->chip.get = priv->data->get ? : syscon_gpio_get;
if (priv->data->flags & GPIO_SYSCON_FEAT_IN)
priv->chip.direction_input = syscon_gpio_dir_in;
if (priv->data->flags & GPIO_SYSCON_FEAT_OUT) {
--
2.24.0
Powered by blists - more mailing lists