From: Baruch Siach <baruch@tkos.co.il>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Thierry Reding <thierry.reding@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pwm@vger.kernel.org, Baruch Siach <baruch@tkos.co.il>,
Sven Auhagen <sven.auhagen@voleatech.de>,
Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
linux-pci@vger.kernel.org,
Gregory Clement <gregory.clement@bootlin.com>,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: [PATCH 1/2] gpio: mvebu: implement get_direction
Date: Thu, 10 Jan 2019 14:26:21 +0200 [thread overview]
Message-ID: <024cc24efa7b99186750f90c91880b29357d379d.1547123182.git.baruch@tkos.co.il> (raw)
struct gpio_chip documentation recommends to always implement this
callback function.
A more concrete motivation is to be able (in combination with
GPIOD_ASIS) to detect whether the bootloader has changed the state of a
GPIO signal.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
drivers/gpio/gpio-mvebu.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 7d5c55494ccd..f97ed32b8beb 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -376,6 +376,16 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
return 0;
}
+static int mvebu_gpio_get_direction(struct gpio_chip *chip, unsigned int pin)
+{
+ struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
+ u32 u;
+
+ regmap_read(mvchip->regs, GPIO_IO_CONF_OFF + mvchip->offset, &u);
+
+ return !!(u & BIT(pin));
+}
+
static int mvebu_gpio_to_irq(struct gpio_chip *chip, unsigned int pin)
{
struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip);
@@ -1130,6 +1140,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
mvchip->chip.parent = &pdev->dev;
mvchip->chip.request = gpiochip_generic_request;
mvchip->chip.free = gpiochip_generic_free;
+ mvchip->chip.get_direction = mvebu_gpio_get_direction;
mvchip->chip.direction_input = mvebu_gpio_direction_input;
mvchip->chip.get = mvebu_gpio_get;
mvchip->chip.direction_output = mvebu_gpio_direction_output;
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-01-10 12:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 12:26 Baruch Siach [this message]
2019-01-10 12:26 ` [PATCH 2/2] PCI: armada8k: don't toggle reset twice Baruch Siach
2019-01-10 12:55 ` Andrew Lunn
2019-01-10 13:05 ` Baruch Siach
2019-01-10 13:19 ` Andrew Lunn
2019-01-10 15:57 ` Baruch Siach
2019-01-13 12:38 ` Baruch Siach
2019-01-13 15:40 ` Andrew Lunn
2019-01-13 18:42 ` Baruch Siach
2019-01-13 23:35 ` Linus Walleij
2019-01-14 7:19 ` Baruch Siach
2019-01-10 15:20 ` [PATCH 1/2] gpio: mvebu: implement get_direction Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=024cc24efa7b99186750f90c91880b29357d379d.1547123182.git.baruch@tkos.co.il \
--to=baruch@tkos.co.il \
--cc=andrew@lunn.ch \
--cc=bgolaszewski@baylibre.com \
--cc=bhelgaas@google.com \
--cc=gregory.clement@bootlin.com \
--cc=jason@lakedaemon.net \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=sven.auhagen@voleatech.de \
--cc=thierry.reding@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).