Skip to contentSkip to conversation

pinctrl: rockchip: Implement .request() and .free() callbacks on the GPIO chips

PATCH In review Axel Lin 3 participants 5 messages Aug 27, 2013 – Aug 29, 2013

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 pinctrl: rockchip: Implement .request() and .free() callbacks on the GPIO chips

Implement .request() and .free() callbacks on the GPIO chips to inform pinctrl when a GPIO is requested or freed.

---
 drivers/pinctrl/pinctrl-rockchip.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/pinctrl/pinctrl-rockchip.c +12 -0
index 64ad0c0..b1337eb 100644
@@ -872,6 +872,16 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
  * GPIO handling
  */
 
+static int rockchip_gpio_request(struct gpio_chip *chip, unsigned offset)
+{
+	return pinctrl_request_gpio(chip->base + offset);
+}
+
+static void rockchip_gpio_free(struct gpio_chip *chip, unsigned offset)
+{
+	pinctrl_free_gpio(chip->base + offset);
+}
+
 static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
 {
 	struct rockchip_pin_bank *bank = gc_to_pin_bank(gc);
@@ -945,6 +955,8 @@ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
 }
 
 static const struct gpio_chip rockchip_gpiolib_chip = {
+	.request = rockchip_gpio_request,
+	.free = rockchip_gpio_free,
 	.set = rockchip_gpio_set,
 	.get = rockchip_gpio_get,
 	.direction_input = rockchip_gpio_direction_input,
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 5 lines · Axel Lin

Implement .request() and .free() callbacks on the GPIO chips to inform pinctrl when a GPIO is requested or freed.

---

Ohhh that will have semantic effects so really need to wait for Heiko's opinion on this one.

BTW: Axel are you working with this system?

Yours,
Linus Walleij

author
#2 lore raw

2013/8/28 Linus Walleij <[email protected]>:

Quoted 5 lines · Axel Lin
Quoted 4 lines

Implement .request() and .free() callbacks on the GPIO chips to inform pinctrl when a GPIO is requested or freed.

Quoted 7 lines
Quoted 2 lines

---

Ohhh that will have semantic effects so really need to wait for Heiko's opinion on this one.

BTW: Axel are you working with this system?

No, I don't have a rockchip platform.

But I'm writting a pinctrl driver for an ARM SoC. So I read a couple pinctrl driver source code for reference.

Regards,
Axel

maintainer Tested-by Acked-by
#3 lore raw
In reply to Linus Walleij

Am Mittwoch, 28. August 2013, 13:25:57 schrieb Linus Walleij:

Quoted 9 lines · Axel Lin
Quoted 5 lines

Implement .request() and .free() callbacks on the GPIO chips to inform pinctrl when a GPIO is requested or freed.

---

Ohhh that will have semantic effects so really need to wait for Heiko's opinion on this one.

I don't see any showstoppers here. Tested it on my machine with gpio-keys without any issues popping up. So

Heiko