* [PATCH] pinctrl: bcm2835: Implement get_direction callback
@ 2016-03-28 14:58 ` Stefan Wahren
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Wahren @ 2016-03-28 14:58 UTC (permalink / raw)
To: Linus Walleij, Stephen Warren, Lee Jones, Eric Anholt
Cc: linux-gpio, linux-rpi-kernel, linux-arm-kernel, Stefan Wahren
Implement gpio_chip's get_direction() callback, that lets other
drivers get particular GPIOs direction using gpiod_get_direction().
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 08b1d93..dd8b174 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -342,6 +342,18 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
}
+static int bcm2835_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
+{
+ struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
+ enum bcm2835_fsel fsel = bcm2835_pinctrl_fsel_get(pc, offset);
+
+ /* Alternative function doesn't clearly provide a direction */
+ if (fsel > BCM2835_FSEL_GPIO_OUT)
+ return -EINVAL;
+
+ return (fsel == BCM2835_FSEL_GPIO_IN);
+}
+
static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
@@ -370,6 +382,7 @@ static struct gpio_chip bcm2835_gpio_chip = {
.free = gpiochip_generic_free,
.direction_input = bcm2835_gpio_direction_input,
.direction_output = bcm2835_gpio_direction_output,
+ .get_direction = bcm2835_gpio_get_direction,
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,
.to_irq = bcm2835_gpio_to_irq,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] pinctrl: bcm2835: Implement get_direction callback
@ 2016-03-28 14:58 ` Stefan Wahren
0 siblings, 0 replies; 8+ messages in thread
From: Stefan Wahren @ 2016-03-28 14:58 UTC (permalink / raw)
To: linux-arm-kernel
Implement gpio_chip's get_direction() callback, that lets other
drivers get particular GPIOs direction using gpiod_get_direction().
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 08b1d93..dd8b174 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -342,6 +342,18 @@ static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
}
+static int bcm2835_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
+{
+ struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
+ enum bcm2835_fsel fsel = bcm2835_pinctrl_fsel_get(pc, offset);
+
+ /* Alternative function doesn't clearly provide a direction */
+ if (fsel > BCM2835_FSEL_GPIO_OUT)
+ return -EINVAL;
+
+ return (fsel == BCM2835_FSEL_GPIO_IN);
+}
+
static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
@@ -370,6 +382,7 @@ static struct gpio_chip bcm2835_gpio_chip = {
.free = gpiochip_generic_free,
.direction_input = bcm2835_gpio_direction_input,
.direction_output = bcm2835_gpio_direction_output,
+ .get_direction = bcm2835_gpio_get_direction,
.get = bcm2835_gpio_get,
.set = bcm2835_gpio_set,
.to_irq = bcm2835_gpio_to_irq,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: bcm2835: Implement get_direction callback
2016-03-28 14:58 ` Stefan Wahren
@ 2016-03-28 18:42 ` Eric Anholt
-1 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2016-03-28 18:42 UTC (permalink / raw)
To: Linus Walleij, Stephen Warren, Lee Jones
Cc: linux-gpio, linux-rpi-kernel, linux-arm-kernel, Stefan Wahren
[-- Attachment #1: Type: text/plain, Size: 228 bytes --]
Stefan Wahren <stefan.wahren@i2se.com> writes:
> Implement gpio_chip's get_direction() callback, that lets other
> drivers get particular GPIOs direction using gpiod_get_direction().
Reviewed-by: Eric Anholt <eric@anholt.net>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] pinctrl: bcm2835: Implement get_direction callback
@ 2016-03-28 18:42 ` Eric Anholt
0 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2016-03-28 18:42 UTC (permalink / raw)
To: linux-arm-kernel
Stefan Wahren <stefan.wahren@i2se.com> writes:
> Implement gpio_chip's get_direction() callback, that lets other
> drivers get particular GPIOs direction using gpiod_get_direction().
Reviewed-by: Eric Anholt <eric@anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160328/e2b2a259/attachment.sig>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: bcm2835: Implement get_direction callback
2016-03-28 14:58 ` Stefan Wahren
@ 2016-03-30 14:15 ` Stephen Warren
-1 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2016-03-30 14:15 UTC (permalink / raw)
To: Stefan Wahren, Linus Walleij
Cc: Lee Jones, Eric Anholt, linux-gpio, linux-rpi-kernel, linux-arm-kernel
On 03/28/2016 08:58 AM, Stefan Wahren wrote:
> Implement gpio_chip's get_direction() callback, that lets other
> drivers get particular GPIOs direction using gpiod_get_direction().
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] pinctrl: bcm2835: Implement get_direction callback
@ 2016-03-30 14:15 ` Stephen Warren
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2016-03-30 14:15 UTC (permalink / raw)
To: linux-arm-kernel
On 03/28/2016 08:58 AM, Stefan Wahren wrote:
> Implement gpio_chip's get_direction() callback, that lets other
> drivers get particular GPIOs direction using gpiod_get_direction().
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: bcm2835: Implement get_direction callback
2016-03-28 14:58 ` Stefan Wahren
@ 2016-04-01 12:47 ` Linus Walleij
-1 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2016-04-01 12:47 UTC (permalink / raw)
To: Stefan Wahren
Cc: Stephen Warren, Lee Jones, Eric Anholt, linux-gpio,
linux-rpi-kernel, linux-arm-kernel
On Mon, Mar 28, 2016 at 4:58 PM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> Implement gpio_chip's get_direction() callback, that lets other
> drivers get particular GPIOs direction using gpiod_get_direction().
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Patch applied with the ACKs.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] pinctrl: bcm2835: Implement get_direction callback
@ 2016-04-01 12:47 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2016-04-01 12:47 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 28, 2016 at 4:58 PM, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> Implement gpio_chip's get_direction() callback, that lets other
> drivers get particular GPIOs direction using gpiod_get_direction().
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Patch applied with the ACKs.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-04-01 12:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 14:58 [PATCH] pinctrl: bcm2835: Implement get_direction callback Stefan Wahren
2016-03-28 14:58 ` Stefan Wahren
2016-03-28 18:42 ` Eric Anholt
2016-03-28 18:42 ` Eric Anholt
2016-03-30 14:15 ` Stephen Warren
2016-03-30 14:15 ` Stephen Warren
2016-04-01 12:47 ` Linus Walleij
2016-04-01 12:47 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.