From: Janusz Uzycki <j.uzycki@elproma.com.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Fabio Estevam <festevam@gmail.com>,
linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
fabio.estevam@freescale.com, linux-gpio@vger.kernel.org,
Janusz Uzycki <j.uzycki@elproma.com.pl>
Subject: [PATCH] gpio: mxs: implement get_direction callback
Date: Fri, 14 Nov 2014 23:27:06 +0100 [thread overview]
Message-ID: <1416004026-9667-1-git-send-email-j.uzycki@elproma.com.pl> (raw)
Function gpiod_get_direction() of gpiolib calls get_direction()
callback. If chip doesn't implement it EINVAL error is returned.
The function doesn't use for returned value shadowed FLAG_IS_OUT
bit of gpio_desc.flags field so the callback is required.
The patch implements the missing callback.
Inspired from arch/arm/mach-at91/gpio.c
Required to get the patch "serial: mxs-auart: enable PPS support" working.
Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
---
Two patches were missed during movements between our internal repos.
The 2/2 patch is required against commits:
f9e42397d79b ("serial: mxs-auart: add interrupts for modem control lines")
36a262782b04 ("serial: mxs-auart: enable PPS support")
I've done build-test for the next only before.
I should have done hardware test also for the next, sorry.
Now it is tested for the next on real hardware too.
---
drivers/gpio/gpio-mxs.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 8ffdd7d..56052c2 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -227,6 +227,18 @@ static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
return irq_find_mapping(port->domain, offset);
}
+static int mxs_gpio_get_direction(struct gpio_chip *gc, unsigned offset)
+{
+ struct bgpio_chip *bgc = to_bgpio_chip(gc);
+ struct mxs_gpio_port *port =
+ container_of(bgc, struct mxs_gpio_port, bgc);
+ u32 mask = 1 << offset;
+ u32 dir;
+
+ dir = readl(port->base + PINCTRL_DOE(port));
+ return !(dir & mask);
+}
+
static struct platform_device_id mxs_gpio_ids[] = {
{
.name = "imx23-gpio",
@@ -320,6 +332,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
goto out_irqdesc_free;
port->bgc.gc.to_irq = mxs_gpio_to_irq;
+ port->bgc.gc.get_direction = mxs_gpio_get_direction;
port->bgc.gc.base = port->id * 32;
err = gpiochip_add(&port->bgc.gc);
--
1.7.11.3
next reply other threads:[~2014-11-14 22:24 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 22:27 Janusz Uzycki [this message]
2014-11-14 23:26 ` [PATCH] gpio: mxs: implement get_direction callback Uwe Kleine-König
2014-11-15 19:29 ` Janusz Użycki
2014-11-16 21:42 ` Uwe Kleine-König
2014-11-16 21:48 ` Uwe Kleine-König
2014-11-16 23:59 ` Janusz Użycki
2014-11-17 1:58 ` Janusz Użycki
2014-11-17 8:28 ` Uwe Kleine-König
2014-11-17 8:38 ` Alexander Shiyan
2014-11-17 8:44 ` Uwe Kleine-König
2014-11-17 8:53 ` Alexander Shiyan
2014-11-17 9:11 ` Janusz Użycki
2014-11-17 9:39 ` Uwe Kleine-König
2014-11-17 9:46 ` Richard Genoud
2014-11-17 9:59 ` Uwe Kleine-König
2014-11-17 10:05 ` Richard Genoud
2014-11-17 14:29 ` Janusz Użycki
2014-11-17 16:14 ` Richard Genoud
2014-11-17 15:53 ` Uwe Kleine-König
2014-11-17 15:58 ` Janusz Użycki
2014-11-17 16:02 ` Uwe Kleine-König
2014-11-17 16:04 ` Richard Genoud
2014-11-17 17:26 ` Janusz Użycki
2014-11-17 10:05 ` Alexander Shiyan
2014-11-17 10:09 ` Russell King - ARM Linux
2014-11-17 10:10 ` Richard Genoud
2014-11-17 10:17 ` Russell King - ARM Linux
2014-11-17 12:40 ` Janusz Użycki
2014-11-17 9:51 ` request an irq without enabling? [Was: Re: [PATCH] gpio: mxs: implement get_direction callback] Uwe Kleine-König
2014-11-17 9:57 ` Richard Genoud
2014-11-17 17:00 ` [PATCH] gpio: mxs: implement get_direction callback Janusz Użycki
2014-11-17 17:07 ` Janusz Użycki
2014-11-17 18:42 ` Uwe Kleine-König
2014-11-17 19:02 ` Janusz Użycki
2014-11-17 22:21 ` Uwe Kleine-König
2014-11-18 9:59 ` Janusz Użycki
2014-11-17 9:26 ` Richard Genoud
2014-11-17 14:45 ` Janusz Użycki
2014-11-17 15:59 ` Uwe Kleine-König
2014-11-17 8:31 ` Richard Genoud
2014-11-17 8:39 ` Uwe Kleine-König
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=1416004026-9667-1-git-send-email-j.uzycki@elproma.com.pl \
--to=j.uzycki@elproma.com.pl \
--cc=fabio.estevam@freescale.com \
--cc=festevam@gmail.com \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-serial@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).