From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: barebox@lists.infradead.org
Subject: [PATCH 4/4] gpio: dw: add get_direction callback
Date: Sat, 9 Nov 2013 14:24:09 +0100 [thread overview]
Message-ID: <1384003450-21001-5-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1384003450-21001-1-git-send-email-sebastian.hesselbarth@gmail.com>
This adds a callback function to read the current state of a GPIOs
in/out direction.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: barebox@lists.infradead.org
---
drivers/gpio/gpio-dw.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/gpio/gpio-dw.c b/drivers/gpio/gpio-dw.c
index 791488a..6577042 100644
--- a/drivers/gpio/gpio-dw.c
+++ b/drivers/gpio/gpio-dw.c
@@ -90,9 +90,18 @@ static int dw_gpio_direction_output(struct gpio_chip *gc,
return 0;
}
+static int dw_gpio_get_direction(struct gpio_chip *gc, unsigned offset)
+{
+ struct dw_gpio_instance *chip = to_dw_gpio(gc);
+
+ return (readl(chip->regs + DW_GPIO_DDR) & (1 << offset)) ?
+ GPIO_DIR_OUT : GPIO_DIR_IN;
+}
+
static struct gpio_ops imx_gpio_ops = {
.direction_input = dw_gpio_direction_input,
.direction_output = dw_gpio_direction_output,
+ .get_direction = dw_gpio_get_direction,
.get = dw_gpio_get,
.set = dw_gpio_set,
};
--
1.8.4.rc3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-11-09 13:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-09 13:24 [PATCH 0/4] gpiolib debug and led trigger fixes Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 1/4] led: trigger: disable LEDs with trigger before installing it Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 2/4] gpiolib: add get_direction callback Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 3/4] gpiolib: make gpiolib command more verbose Sebastian Hesselbarth
2013-11-11 1:30 ` Alexander Aring
2013-11-11 8:07 ` Sascha Hauer
2013-11-11 8:12 ` Alexander Aring
2013-11-09 13:24 ` Sebastian Hesselbarth [this message]
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=1384003450-21001-5-git-send-email-sebastian.hesselbarth@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=barebox@lists.infradead.org \
/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