Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1406168 > unrolled thread

[PATCH 3/3] gpio: max77620: use the new open drain callback

Started byLaxman Dewangan <ldewangan@nvidia.com>
First post2016-05-24 15:30 +0200
Last post2016-05-30 17:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] gpio: max77620: use the new open drain callback Laxman Dewangan <ldewangan@nvidia.com> - 2016-05-24 15:30 +0200
    Re: [PATCH 3/3] gpio: max77620: use the new open drain callback Linus Walleij <linus.walleij@linaro.org> - 2016-05-30 17:10 +0200

#1406168 — [PATCH 3/3] gpio: max77620: use the new open drain callback

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-05-24 15:30 +0200
Subject[PATCH 3/3] gpio: max77620: use the new open drain callback
Message-ID<rCkzg-3M3-29@gated-at.bofh.it>
The MAX77620 have a GPIO pins which can act as open drain or
push pull mode. Implement support for controlling this from GPIO
descriptor tables or other hardware descriptions such as
device tree by implementing the .set_single_ended() callback.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/gpio/gpio-max77620.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c
index 0bb6d93..d21d38f 100644
--- a/drivers/gpio/gpio-max77620.c
+++ b/drivers/gpio/gpio-max77620.c
@@ -220,6 +220,28 @@ static void max77620_gpio_set(struct gpio_chip *gc, unsigned int offset,
 		dev_err(mgpio->dev, "CNFG_GPIO_OUT update failed: %d\n", ret);
 }
 
+static int max77620_gpio_set_single_ended(struct gpio_chip *gc,
+					  unsigned int offset,
+					  enum single_ended_mode mode)
+{
+	struct max77620_gpio *mgpio = gpiochip_get_data(gc);
+
+	switch (mode) {
+	case LINE_MODE_OPEN_DRAIN:
+		return regmap_update_bits(mgpio->rmap, GPIO_REG_ADDR(offset),
+					  MAX77620_CNFG_GPIO_DRV_MASK,
+					  MAX77620_CNFG_GPIO_DRV_OPENDRAIN);
+	case LINE_MODE_PUSH_PULL:
+		return regmap_update_bits(mgpio->rmap, GPIO_REG_ADDR(offset),
+					  MAX77620_CNFG_GPIO_DRV_MASK,
+					  MAX77620_CNFG_GPIO_DRV_PUSHPULL);
+	default:
+		break;
+	}
+
+	return -ENOTSUPP;
+}
+
 static int max77620_gpio_to_irq(struct gpio_chip *gc, unsigned int offset)
 {
 	struct max77620_gpio *mgpio = gpiochip_get_data(gc);
@@ -257,6 +279,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
 	mgpio->gpio_chip.get_direction = max77620_gpio_get_direction;
 	mgpio->gpio_chip.set_debounce = max77620_gpio_set_debounce;
 	mgpio->gpio_chip.set = max77620_gpio_set;
+	mgpio->gpio_chip.set_single_ended = max77620_gpio_set_single_ended;
 	mgpio->gpio_chip.to_irq = max77620_gpio_to_irq;
 	mgpio->gpio_chip.ngpio = MAX77620_GPIO_NR;
 	mgpio->gpio_chip.can_sleep = 1;
-- 
2.1.4

[toc] | [next] | [standalone]


#1409191

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-05-30 17:10 +0200
Message-ID<rEwZj-5PN-5@gated-at.bofh.it>
In reply to#1406168
On Tue, May 24, 2016 at 3:13 PM, Laxman Dewangan <ldewangan@nvidia.com> wrote:

> The MAX77620 have a GPIO pins which can act as open drain or
> push pull mode. Implement support for controlling this from GPIO
> descriptor tables or other hardware descriptions such as
> device tree by implementing the .set_single_ended() callback.
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>

Rebased and applied. (Because I didn't apply 2/3)

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web