All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 10:50 ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Maxime Ripard

Hi,

The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
of GPIOs accessible. Some boards use these to control their backlight
or a few LEDs.

There's supposed to be 4 of them, but the fourth one has a different
configuration register scheme, and I couldn't find any board that was
using this GPIO. It will be probably be supported eventually, but
until then, we support only the first 3 GPIOs.

Let me know what you think,
Maxime

Maxime Ripard (4):
  gpio: Add AXP209 GPIO driver
  mfd: axp20x: Add AXP209 GPIO driver to the mfd
  ARM: dt: axp209: Add AXP209 GPIO driver
  ARM: sun5i: chip: Add status LED

 .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++
 arch/arm/boot/dts/axp209.dtsi                      |   6 +
 arch/arm/boot/dts/sun5i-r8-chip.dts                |  10 ++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
 drivers/mfd/axp20x.c                               |   3 +
 7 files changed, 222 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
 create mode 100644 drivers/gpio/gpio-axp209.c

-- 
2.7.2

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 10:50 ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede, Maxime Ripard

Hi,

The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
of GPIOs accessible. Some boards use these to control their backlight
or a few LEDs.

There's supposed to be 4 of them, but the fourth one has a different
configuration register scheme, and I couldn't find any board that was
using this GPIO. It will be probably be supported eventually, but
until then, we support only the first 3 GPIOs.

Let me know what you think,
Maxime

Maxime Ripard (4):
  gpio: Add AXP209 GPIO driver
  mfd: axp20x: Add AXP209 GPIO driver to the mfd
  ARM: dt: axp209: Add AXP209 GPIO driver
  ARM: sun5i: chip: Add status LED

 .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++
 arch/arm/boot/dts/axp209.dtsi                      |   6 +
 arch/arm/boot/dts/sun5i-r8-chip.dts                |  10 ++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
 drivers/mfd/axp20x.c                               |   3 +
 7 files changed, 222 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
 create mode 100644 drivers/gpio/gpio-axp209.c

-- 
2.7.2

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 10:50 ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
of GPIOs accessible. Some boards use these to control their backlight
or a few LEDs.

There's supposed to be 4 of them, but the fourth one has a different
configuration register scheme, and I couldn't find any board that was
using this GPIO. It will be probably be supported eventually, but
until then, we support only the first 3 GPIOs.

Let me know what you think,
Maxime

Maxime Ripard (4):
  gpio: Add AXP209 GPIO driver
  mfd: axp20x: Add AXP209 GPIO driver to the mfd
  ARM: dt: axp209: Add AXP209 GPIO driver
  ARM: sun5i: chip: Add status LED

 .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++
 arch/arm/boot/dts/axp209.dtsi                      |   6 +
 arch/arm/boot/dts/sun5i-r8-chip.dts                |  10 ++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
 drivers/mfd/axp20x.c                               |   3 +
 7 files changed, 222 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
 create mode 100644 drivers/gpio/gpio-axp209.c

-- 
2.7.2

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 1/4] gpio: Add AXP209 GPIO driver
  2016-03-09 10:50 ` Maxime Ripard
  (?)
@ 2016-03-09 10:50     ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Maxime Ripard

The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
control LEDs or backlight.

Add a driver for them

Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
 4 files changed, 203 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
 create mode 100644 drivers/gpio/gpio-axp209.c

diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
new file mode 100644
index 000000000000..a6611304dd3c
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
@@ -0,0 +1,30 @@
+AXP209 GPIO controller
+
+This driver follows the usual GPIO bindings found in
+Documentation/devicetree/bindings/gpio/gpio.txt
+
+Required properties:
+- compatible: Should be "x-powers,axp209-gpio"
+- #gpio-cells: Should be two. The first cell is the pin number and the
+  second is the GPIO flags.
+- gpio-controller: Marks the device node as a GPIO controller.
+
+This node must be a subnode of the axp20x PMIC, documented in
+Documentation/devicetree/bindings/mfd/axp20x.txt
+
+Example:
+
+axp209: pmic@34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	axp_gpio: gpio {
+		compatible = "x-powers,axp209-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+};
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 1118fef45a86..cd5ab93ac197 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -136,6 +136,12 @@ config GPIO_ATH79
 	  Select this option to enable GPIO driver for
 	  Atheros AR71XX/AR724X/AR913X SoC devices.
 
+config GPIO_AXP209
+	tristate "X-Powers AXP209 PMIC GPIO Support"
+	depends on MFD_AXP20X
+	help
+	  Say yes to enable GPIO support for the AXP209 PMIC
+
 config GPIO_BCM_KONA
 	bool "Broadcom Kona GPIO"
 	depends on OF_GPIO && (ARCH_BCM_MOBILE || COMPILE_TEST)
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 6f969df1431a..e9e7fbe80ab7 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
 obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
 obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
 obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+obj-$(CONFIG_GPIO_AXP209)	+= gpio-axp209.o
 obj-$(CONFIG_GPIO_BCM_KONA)	+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BRCMSTB)	+= gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
diff --git a/drivers/gpio/gpio-axp209.c b/drivers/gpio/gpio-axp209.c
new file mode 100644
index 000000000000..822f39faaadf
--- /dev/null
+++ b/drivers/gpio/gpio-axp209.c
@@ -0,0 +1,166 @@
+/*
+ * AXP20x GPIO driver
+ *
+ * Copyright (C) 2016 Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under  the terms of the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_GPIO_FUNCTIONS		0x7
+#define AXP20X_GPIO_FUNCTION_OUT_LOW	0
+#define AXP20X_GPIO_FUNCTION_OUT_HIGH	1
+#define AXP20X_GPIO_FUNCTION_INPUT	2
+
+struct axp20x_gpio {
+	struct gpio_chip	chip;
+	struct regmap		*regmap;
+};
+
+struct axp20x_gpio *to_axp20x_gpio(struct gpio_chip *chip)
+{
+	return container_of(chip, struct axp20x_gpio, chip);
+}
+
+static int axp20x_gpio_get_reg(unsigned offset)
+{
+	switch (offset) {
+	case 0:
+		return AXP20X_GPIO0_CTRL;
+	case 1:
+		return AXP20X_GPIO1_CTRL;
+	case 2:
+		return AXP20X_GPIO2_CTRL;
+	}
+
+	return -EINVAL;
+}
+
+static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	int reg;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	return regmap_update_bits(gpio->regmap, reg,
+				  AXP20X_GPIO_FUNCTIONS,
+				  AXP20X_GPIO_FUNCTION_INPUT);
+}
+
+static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	unsigned int val;
+	int reg, ret;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	ret = regmap_read(gpio->regmap, reg, &val);
+	if (ret)
+		return ret;
+
+	return val & (1 << (offset + 4));
+}
+
+static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset,
+			      int value)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	int reg;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	return regmap_update_bits(gpio->regmap, reg,
+				  AXP20X_GPIO_FUNCTIONS,
+				  value ? AXP20X_GPIO_FUNCTION_OUT_HIGH
+				  : AXP20X_GPIO_FUNCTION_OUT_LOW);
+}
+
+static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
+			    int value)
+{
+	axp20x_gpio_output(chip, offset, value);
+}
+
+static int axp20x_gpio_probe(struct platform_device *pdev)
+{
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+	struct axp20x_gpio *gpio;
+	int ret;
+
+	if (!of_device_is_available(pdev->dev.of_node))
+		return -ENODEV;
+
+	if (!axp20x) {
+		dev_err(&pdev->dev, "Parent drvdata not set\n");
+		return -EINVAL;
+	}
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+
+	gpio->chip.base			= -1;
+	gpio->chip.can_sleep		= true;
+	gpio->chip.dev			= &pdev->dev;
+	gpio->chip.label		= dev_name(&pdev->dev);
+	gpio->chip.owner		= THIS_MODULE;
+	gpio->chip.get			= axp20x_gpio_get;
+	gpio->chip.set			= axp20x_gpio_set;
+	gpio->chip.direction_input	= axp20x_gpio_input;
+	gpio->chip.direction_output	= axp20x_gpio_output;
+	gpio->chip.ngpio		= 3;
+
+	gpio->regmap = axp20x->regmap;
+
+	ret = gpiochip_add(&gpio->chip);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register GPIO chip\n");
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
+
+	return 0;
+}
+
+static const struct of_device_id axp20x_gpio_match[] = {
+	{ .compatible = "x-powers,axp209-gpio" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, axp20x_gpio_match);
+
+static struct platform_driver axp20x_gpio_driver = {
+	.probe		= axp20x_gpio_probe,
+	.driver = {
+		.name		= "axp20x-gpio",
+		.of_match_table	= axp20x_gpio_match,
+	},
+};
+
+module_platform_driver(axp20x_gpio_driver);
+
+MODULE_AUTHOR("Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>");
+MODULE_DESCRIPTION("AXP20x PMIC GPIO driver");
+MODULE_LICENSE("GPL");
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede, Maxime Ripard

The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
control LEDs or backlight.

Add a driver for them

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
 4 files changed, 203 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
 create mode 100644 drivers/gpio/gpio-axp209.c

diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
new file mode 100644
index 000000000000..a6611304dd3c
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
@@ -0,0 +1,30 @@
+AXP209 GPIO controller
+
+This driver follows the usual GPIO bindings found in
+Documentation/devicetree/bindings/gpio/gpio.txt
+
+Required properties:
+- compatible: Should be "x-powers,axp209-gpio"
+- #gpio-cells: Should be two. The first cell is the pin number and the
+  second is the GPIO flags.
+- gpio-controller: Marks the device node as a GPIO controller.
+
+This node must be a subnode of the axp20x PMIC, documented in
+Documentation/devicetree/bindings/mfd/axp20x.txt
+
+Example:
+
+axp209: pmic@34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	axp_gpio: gpio {
+		compatible = "x-powers,axp209-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+};
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 1118fef45a86..cd5ab93ac197 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -136,6 +136,12 @@ config GPIO_ATH79
 	  Select this option to enable GPIO driver for
 	  Atheros AR71XX/AR724X/AR913X SoC devices.
 
+config GPIO_AXP209
+	tristate "X-Powers AXP209 PMIC GPIO Support"
+	depends on MFD_AXP20X
+	help
+	  Say yes to enable GPIO support for the AXP209 PMIC
+
 config GPIO_BCM_KONA
 	bool "Broadcom Kona GPIO"
 	depends on OF_GPIO && (ARCH_BCM_MOBILE || COMPILE_TEST)
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 6f969df1431a..e9e7fbe80ab7 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
 obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
 obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
 obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+obj-$(CONFIG_GPIO_AXP209)	+= gpio-axp209.o
 obj-$(CONFIG_GPIO_BCM_KONA)	+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BRCMSTB)	+= gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
diff --git a/drivers/gpio/gpio-axp209.c b/drivers/gpio/gpio-axp209.c
new file mode 100644
index 000000000000..822f39faaadf
--- /dev/null
+++ b/drivers/gpio/gpio-axp209.c
@@ -0,0 +1,166 @@
+/*
+ * AXP20x GPIO driver
+ *
+ * Copyright (C) 2016 Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under  the terms of the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_GPIO_FUNCTIONS		0x7
+#define AXP20X_GPIO_FUNCTION_OUT_LOW	0
+#define AXP20X_GPIO_FUNCTION_OUT_HIGH	1
+#define AXP20X_GPIO_FUNCTION_INPUT	2
+
+struct axp20x_gpio {
+	struct gpio_chip	chip;
+	struct regmap		*regmap;
+};
+
+struct axp20x_gpio *to_axp20x_gpio(struct gpio_chip *chip)
+{
+	return container_of(chip, struct axp20x_gpio, chip);
+}
+
+static int axp20x_gpio_get_reg(unsigned offset)
+{
+	switch (offset) {
+	case 0:
+		return AXP20X_GPIO0_CTRL;
+	case 1:
+		return AXP20X_GPIO1_CTRL;
+	case 2:
+		return AXP20X_GPIO2_CTRL;
+	}
+
+	return -EINVAL;
+}
+
+static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	int reg;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	return regmap_update_bits(gpio->regmap, reg,
+				  AXP20X_GPIO_FUNCTIONS,
+				  AXP20X_GPIO_FUNCTION_INPUT);
+}
+
+static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	unsigned int val;
+	int reg, ret;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	ret = regmap_read(gpio->regmap, reg, &val);
+	if (ret)
+		return ret;
+
+	return val & (1 << (offset + 4));
+}
+
+static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset,
+			      int value)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	int reg;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	return regmap_update_bits(gpio->regmap, reg,
+				  AXP20X_GPIO_FUNCTIONS,
+				  value ? AXP20X_GPIO_FUNCTION_OUT_HIGH
+				  : AXP20X_GPIO_FUNCTION_OUT_LOW);
+}
+
+static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
+			    int value)
+{
+	axp20x_gpio_output(chip, offset, value);
+}
+
+static int axp20x_gpio_probe(struct platform_device *pdev)
+{
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+	struct axp20x_gpio *gpio;
+	int ret;
+
+	if (!of_device_is_available(pdev->dev.of_node))
+		return -ENODEV;
+
+	if (!axp20x) {
+		dev_err(&pdev->dev, "Parent drvdata not set\n");
+		return -EINVAL;
+	}
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+
+	gpio->chip.base			= -1;
+	gpio->chip.can_sleep		= true;
+	gpio->chip.dev			= &pdev->dev;
+	gpio->chip.label		= dev_name(&pdev->dev);
+	gpio->chip.owner		= THIS_MODULE;
+	gpio->chip.get			= axp20x_gpio_get;
+	gpio->chip.set			= axp20x_gpio_set;
+	gpio->chip.direction_input	= axp20x_gpio_input;
+	gpio->chip.direction_output	= axp20x_gpio_output;
+	gpio->chip.ngpio		= 3;
+
+	gpio->regmap = axp20x->regmap;
+
+	ret = gpiochip_add(&gpio->chip);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register GPIO chip\n");
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
+
+	return 0;
+}
+
+static const struct of_device_id axp20x_gpio_match[] = {
+	{ .compatible = "x-powers,axp209-gpio" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, axp20x_gpio_match);
+
+static struct platform_driver axp20x_gpio_driver = {
+	.probe		= axp20x_gpio_probe,
+	.driver = {
+		.name		= "axp20x-gpio",
+		.of_match_table	= axp20x_gpio_match,
+	},
+};
+
+module_platform_driver(axp20x_gpio_driver);
+
+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
+MODULE_DESCRIPTION("AXP20x PMIC GPIO driver");
+MODULE_LICENSE("GPL");
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
control LEDs or backlight.

Add a driver for them

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
 4 files changed, 203 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
 create mode 100644 drivers/gpio/gpio-axp209.c

diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
new file mode 100644
index 000000000000..a6611304dd3c
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
@@ -0,0 +1,30 @@
+AXP209 GPIO controller
+
+This driver follows the usual GPIO bindings found in
+Documentation/devicetree/bindings/gpio/gpio.txt
+
+Required properties:
+- compatible: Should be "x-powers,axp209-gpio"
+- #gpio-cells: Should be two. The first cell is the pin number and the
+  second is the GPIO flags.
+- gpio-controller: Marks the device node as a GPIO controller.
+
+This node must be a subnode of the axp20x PMIC, documented in
+Documentation/devicetree/bindings/mfd/axp20x.txt
+
+Example:
+
+axp209: pmic at 34 {
+	compatible = "x-powers,axp209";
+	reg = <0x34>;
+	interrupt-parent = <&nmi_intc>;
+	interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+
+	axp_gpio: gpio {
+		compatible = "x-powers,axp209-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+};
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 1118fef45a86..cd5ab93ac197 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -136,6 +136,12 @@ config GPIO_ATH79
 	  Select this option to enable GPIO driver for
 	  Atheros AR71XX/AR724X/AR913X SoC devices.
 
+config GPIO_AXP209
+	tristate "X-Powers AXP209 PMIC GPIO Support"
+	depends on MFD_AXP20X
+	help
+	  Say yes to enable GPIO support for the AXP209 PMIC
+
 config GPIO_BCM_KONA
 	bool "Broadcom Kona GPIO"
 	depends on OF_GPIO && (ARCH_BCM_MOBILE || COMPILE_TEST)
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 6f969df1431a..e9e7fbe80ab7 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
 obj-$(CONFIG_GPIO_AMDPT)	+= gpio-amdpt.o
 obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
 obj-$(CONFIG_GPIO_ATH79)	+= gpio-ath79.o
+obj-$(CONFIG_GPIO_AXP209)	+= gpio-axp209.o
 obj-$(CONFIG_GPIO_BCM_KONA)	+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BRCMSTB)	+= gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
diff --git a/drivers/gpio/gpio-axp209.c b/drivers/gpio/gpio-axp209.c
new file mode 100644
index 000000000000..822f39faaadf
--- /dev/null
+++ b/drivers/gpio/gpio-axp209.c
@@ -0,0 +1,166 @@
+/*
+ * AXP20x GPIO driver
+ *
+ * Copyright (C) 2016 Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under  the terms of the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mfd/axp20x.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define AXP20X_GPIO_FUNCTIONS		0x7
+#define AXP20X_GPIO_FUNCTION_OUT_LOW	0
+#define AXP20X_GPIO_FUNCTION_OUT_HIGH	1
+#define AXP20X_GPIO_FUNCTION_INPUT	2
+
+struct axp20x_gpio {
+	struct gpio_chip	chip;
+	struct regmap		*regmap;
+};
+
+struct axp20x_gpio *to_axp20x_gpio(struct gpio_chip *chip)
+{
+	return container_of(chip, struct axp20x_gpio, chip);
+}
+
+static int axp20x_gpio_get_reg(unsigned offset)
+{
+	switch (offset) {
+	case 0:
+		return AXP20X_GPIO0_CTRL;
+	case 1:
+		return AXP20X_GPIO1_CTRL;
+	case 2:
+		return AXP20X_GPIO2_CTRL;
+	}
+
+	return -EINVAL;
+}
+
+static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	int reg;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	return regmap_update_bits(gpio->regmap, reg,
+				  AXP20X_GPIO_FUNCTIONS,
+				  AXP20X_GPIO_FUNCTION_INPUT);
+}
+
+static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	unsigned int val;
+	int reg, ret;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	ret = regmap_read(gpio->regmap, reg, &val);
+	if (ret)
+		return ret;
+
+	return val & (1 << (offset + 4));
+}
+
+static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset,
+			      int value)
+{
+	struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
+	int reg;
+
+	reg = axp20x_gpio_get_reg(offset);
+	if (reg < 0)
+		return reg;
+
+	return regmap_update_bits(gpio->regmap, reg,
+				  AXP20X_GPIO_FUNCTIONS,
+				  value ? AXP20X_GPIO_FUNCTION_OUT_HIGH
+				  : AXP20X_GPIO_FUNCTION_OUT_LOW);
+}
+
+static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset,
+			    int value)
+{
+	axp20x_gpio_output(chip, offset, value);
+}
+
+static int axp20x_gpio_probe(struct platform_device *pdev)
+{
+	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+	struct axp20x_gpio *gpio;
+	int ret;
+
+	if (!of_device_is_available(pdev->dev.of_node))
+		return -ENODEV;
+
+	if (!axp20x) {
+		dev_err(&pdev->dev, "Parent drvdata not set\n");
+		return -EINVAL;
+	}
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+
+	gpio->chip.base			= -1;
+	gpio->chip.can_sleep		= true;
+	gpio->chip.dev			= &pdev->dev;
+	gpio->chip.label		= dev_name(&pdev->dev);
+	gpio->chip.owner		= THIS_MODULE;
+	gpio->chip.get			= axp20x_gpio_get;
+	gpio->chip.set			= axp20x_gpio_set;
+	gpio->chip.direction_input	= axp20x_gpio_input;
+	gpio->chip.direction_output	= axp20x_gpio_output;
+	gpio->chip.ngpio		= 3;
+
+	gpio->regmap = axp20x->regmap;
+
+	ret = gpiochip_add(&gpio->chip);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register GPIO chip\n");
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
+
+	return 0;
+}
+
+static const struct of_device_id axp20x_gpio_match[] = {
+	{ .compatible = "x-powers,axp209-gpio" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, axp20x_gpio_match);
+
+static struct platform_driver axp20x_gpio_driver = {
+	.probe		= axp20x_gpio_probe,
+	.driver = {
+		.name		= "axp20x-gpio",
+		.of_match_table	= axp20x_gpio_match,
+	},
+};
+
+module_platform_driver(axp20x_gpio_driver);
+
+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
+MODULE_DESCRIPTION("AXP20x PMIC GPIO driver");
+MODULE_LICENSE("GPL");
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
  2016-03-09 10:50 ` Maxime Ripard
  (?)
@ 2016-03-09 10:50     ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Maxime Ripard

Now that we have a GPIO driver for the AXP209, we can add it to our MFD.

Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index a57d6e940610..89518ee3be33 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -430,6 +430,9 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 static struct mfd_cell axp20x_cells[] = {
 	{
+		.name		= "axp20x-gpio",
+		.of_compatible	= "x-powers,axp209-gpio",
+	}, {
 		.name		= "axp20x-pek",
 		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
 		.resources	= axp20x_pek_resources,
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede, Maxime Ripard

Now that we have a GPIO driver for the AXP209, we can add it to our MFD.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index a57d6e940610..89518ee3be33 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -430,6 +430,9 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 static struct mfd_cell axp20x_cells[] = {
 	{
+		.name		= "axp20x-gpio",
+		.of_compatible	= "x-powers,axp209-gpio",
+	}, {
 		.name		= "axp20x-pek",
 		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
 		.resources	= axp20x_pek_resources,
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

Now that we have a GPIO driver for the AXP209, we can add it to our MFD.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index a57d6e940610..89518ee3be33 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -430,6 +430,9 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
 
 static struct mfd_cell axp20x_cells[] = {
 	{
+		.name		= "axp20x-gpio",
+		.of_compatible	= "x-powers,axp209-gpio",
+	}, {
 		.name		= "axp20x-pek",
 		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
 		.resources	= axp20x_pek_resources,
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver
  2016-03-09 10:50 ` Maxime Ripard
  (?)
@ 2016-03-09 10:50     ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Maxime Ripard

Add the AXP209 GPIO node to our AXP209 DTSI so that boards can use it.

Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 arch/arm/boot/dts/axp209.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi
index 051ab3ba9a65..5430054f7c60 100644
--- a/arch/arm/boot/dts/axp209.dtsi
+++ b/arch/arm/boot/dts/axp209.dtsi
@@ -53,6 +53,12 @@
 	interrupt-controller;
 	#interrupt-cells = <1>;
 
+	axp_gpio: gpio {
+		compatible = "x-powers,axp209-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+
 	regulators {
 		/* Default work frequency for buck regulators */
 		x-powers,dcdc-freq = <1500>;
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede, Maxime Ripard

Add the AXP209 GPIO node to our AXP209 DTSI so that boards can use it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/boot/dts/axp209.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi
index 051ab3ba9a65..5430054f7c60 100644
--- a/arch/arm/boot/dts/axp209.dtsi
+++ b/arch/arm/boot/dts/axp209.dtsi
@@ -53,6 +53,12 @@
 	interrupt-controller;
 	#interrupt-cells = <1>;
 
+	axp_gpio: gpio {
+		compatible = "x-powers,axp209-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+
 	regulators {
 		/* Default work frequency for buck regulators */
 		x-powers,dcdc-freq = <1500>;
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

Add the AXP209 GPIO node to our AXP209 DTSI so that boards can use it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/boot/dts/axp209.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi
index 051ab3ba9a65..5430054f7c60 100644
--- a/arch/arm/boot/dts/axp209.dtsi
+++ b/arch/arm/boot/dts/axp209.dtsi
@@ -53,6 +53,12 @@
 	interrupt-controller;
 	#interrupt-cells = <1>;
 
+	axp_gpio: gpio {
+		compatible = "x-powers,axp209-gpio";
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
+
 	regulators {
 		/* Default work frequency for buck regulators */
 		x-powers,dcdc-freq = <1500>;
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 4/4] ARM: sun5i: chip: Add status LED
  2016-03-09 10:50 ` Maxime Ripard
  (?)
@ 2016-03-09 10:50     ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Maxime Ripard

The CHIP has a status LED connected to one of the AXP GPIOs. Add the
gpio-leds node to be able to use the proper LED framework to control it.

Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 arch/arm/boot/dts/sun5i-r8-chip.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts
index f6898c6b84d4..9a54df81ece7 100644
--- a/arch/arm/boot/dts/sun5i-r8-chip.dts
+++ b/arch/arm/boot/dts/sun5i-r8-chip.dts
@@ -64,6 +64,16 @@
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		status {
+			label = "chip:white:status";
+			gpios = <&axp_gpio 2 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
+		};
+	};
 };
 
 &codec {
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 4/4] ARM: sun5i: chip: Add status LED
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede, Maxime Ripard

The CHIP has a status LED connected to one of the AXP GPIOs. Add the
gpio-leds node to be able to use the proper LED framework to control it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/boot/dts/sun5i-r8-chip.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts
index f6898c6b84d4..9a54df81ece7 100644
--- a/arch/arm/boot/dts/sun5i-r8-chip.dts
+++ b/arch/arm/boot/dts/sun5i-r8-chip.dts
@@ -64,6 +64,16 @@
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		status {
+			label = "chip:white:status";
+			gpios = <&axp_gpio 2 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
+		};
+	};
 };
 
 &codec {
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* [PATCH 4/4] ARM: sun5i: chip: Add status LED
@ 2016-03-09 10:50     ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

The CHIP has a status LED connected to one of the AXP GPIOs. Add the
gpio-leds node to be able to use the proper LED framework to control it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 arch/arm/boot/dts/sun5i-r8-chip.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts
index f6898c6b84d4..9a54df81ece7 100644
--- a/arch/arm/boot/dts/sun5i-r8-chip.dts
+++ b/arch/arm/boot/dts/sun5i-r8-chip.dts
@@ -64,6 +64,16 @@
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		status {
+			label = "chip:white:status";
+			gpios = <&axp_gpio 2 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
+		};
+	};
 };
 
 &codec {
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 63+ messages in thread

* Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-09 10:50 ` Maxime Ripard
@ 2016-03-09 12:17   ` Hans de Goede
  -1 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-09 12:17 UTC (permalink / raw)
  To: Maxime Ripard, Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi

Hi,

On 09-03-16 11:50, Maxime Ripard wrote:
> Hi,
>
> The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> of GPIOs accessible. Some boards use these to control their backlight
> or a few LEDs.

Thanks for working on this, but IMHO this cannot go upstream like this,
the gpio pins on the axp pmics need a pinctrl driver, not a gpio
driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
an additional low-noise ldo (so as a regulator), or as an adc input.

I've been working on gsl1680 touchscreen support lately and on at least
a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
controller. Now these use an axp223 pmic, but nothing is stopping
someone from doing something similar with an axp209 and I think it
would be best to support this from day one, rather then hope we can
retro-fit this later without breaking dts.

> There's supposed to be 4 of them, but the fourth one has a different
> configuration register scheme, and I couldn't find any board that was
> using this GPIO. It will be probably be supported eventually, but
> until then, we support only the first 3 GPIOs.

He he, this matches what I've done in u-boot, the 4th gpio indeed
is somewhat funky (and the docs are not quite clear on how it works
exactly IIRC), leaving it out for now indeed seems for the best.

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 12:17   ` Hans de Goede
  0 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-09 12:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 09-03-16 11:50, Maxime Ripard wrote:
> Hi,
>
> The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> of GPIOs accessible. Some boards use these to control their backlight
> or a few LEDs.

Thanks for working on this, but IMHO this cannot go upstream like this,
the gpio pins on the axp pmics need a pinctrl driver, not a gpio
driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
an additional low-noise ldo (so as a regulator), or as an adc input.

I've been working on gsl1680 touchscreen support lately and on at least
a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
controller. Now these use an axp223 pmic, but nothing is stopping
someone from doing something similar with an axp209 and I think it
would be best to support this from day one, rather then hope we can
retro-fit this later without breaking dts.

> There's supposed to be 4 of them, but the fourth one has a different
> configuration register scheme, and I couldn't find any board that was
> using this GPIO. It will be probably be supported eventually, but
> until then, we support only the first 3 GPIOs.

He he, this matches what I've done in u-boot, the 4th gpio indeed
is somewhat funky (and the docs are not quite clear on how it works
exactly IIRC), leaving it out for now indeed seems for the best.

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-09 13:07         ` kbuild test robot
  -1 siblings, 0 replies; 63+ messages in thread
From: kbuild test robot @ 2016-03-09 13:07 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg, Linus Walleij, Alexandre Courbot,
	Lee Jones, Chen-Yu Tsai, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede, Maxime Ripard

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

Hi Maxime,

[auto build test ERROR on gpio/for-next]
[also build test ERROR on next-20160309]
[cannot apply to v4.5-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Maxime-Ripard/Add-AXP209-GPIO-driver/20160309-190907
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpio/gpio-axp209.c: In function 'axp20x_gpio_probe':
>> drivers/gpio/gpio-axp209.c:126:12: error: 'struct gpio_chip' has no member named 'dev'
     gpio->chip.dev   = &pdev->dev;
               ^

vim +126 drivers/gpio/gpio-axp209.c

   120		gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
   121		if (!gpio)
   122			return -ENOMEM;
   123	
   124		gpio->chip.base			= -1;
   125		gpio->chip.can_sleep		= true;
 > 126		gpio->chip.dev			= &pdev->dev;
   127		gpio->chip.label		= dev_name(&pdev->dev);
   128		gpio->chip.owner		= THIS_MODULE;
   129		gpio->chip.get			= axp20x_gpio_get;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 53561 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-09 13:07         ` kbuild test robot
  0 siblings, 0 replies; 63+ messages in thread
From: kbuild test robot @ 2016-03-09 13:07 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: kbuild-all, Linus Walleij, Alexandre Courbot, Lee Jones,
	Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-gpio,
	linux-kernel, linux-sunxi, Hans de Goede, Maxime Ripard

[-- Attachment #1: Type: text/plain, Size: 1361 bytes --]

Hi Maxime,

[auto build test ERROR on gpio/for-next]
[also build test ERROR on next-20160309]
[cannot apply to v4.5-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Maxime-Ripard/Add-AXP209-GPIO-driver/20160309-190907
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpio/gpio-axp209.c: In function 'axp20x_gpio_probe':
>> drivers/gpio/gpio-axp209.c:126:12: error: 'struct gpio_chip' has no member named 'dev'
     gpio->chip.dev   = &pdev->dev;
               ^

vim +126 drivers/gpio/gpio-axp209.c

   120		gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
   121		if (!gpio)
   122			return -ENOMEM;
   123	
   124		gpio->chip.base			= -1;
   125		gpio->chip.can_sleep		= true;
 > 126		gpio->chip.dev			= &pdev->dev;
   127		gpio->chip.label		= dev_name(&pdev->dev);
   128		gpio->chip.owner		= THIS_MODULE;
   129		gpio->chip.get			= axp20x_gpio_get;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 53561 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-09 13:07         ` kbuild test robot
  0 siblings, 0 replies; 63+ messages in thread
From: kbuild test robot @ 2016-03-09 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Maxime,

[auto build test ERROR on gpio/for-next]
[also build test ERROR on next-20160309]
[cannot apply to v4.5-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Maxime-Ripard/Add-AXP209-GPIO-driver/20160309-190907
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpio/gpio-axp209.c: In function 'axp20x_gpio_probe':
>> drivers/gpio/gpio-axp209.c:126:12: error: 'struct gpio_chip' has no member named 'dev'
     gpio->chip.dev   = &pdev->dev;
               ^

vim +126 drivers/gpio/gpio-axp209.c

   120		gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
   121		if (!gpio)
   122			return -ENOMEM;
   123	
   124		gpio->chip.base			= -1;
   125		gpio->chip.can_sleep		= true;
 > 126		gpio->chip.dev			= &pdev->dev;
   127		gpio->chip.label		= dev_name(&pdev->dev);
   128		gpio->chip.owner		= THIS_MODULE;
   129		gpio->chip.get			= axp20x_gpio_get;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 53561 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160309/62f43fa8/attachment-0001.obj>

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-09 13:20         ` Peter Korsgaard
  -1 siblings, 0 replies; 63+ messages in thread
From: Peter Korsgaard @ 2016-03-09 13:20 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

>>>>> "Maxime" == Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> writes:

 > The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
 > control LEDs or backlight.

Do you find 3 'a bunch'? ;)

 > +static int axp20x_gpio_probe(struct platform_device *pdev)
 > +{
 > +	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 > +	struct axp20x_gpio *gpio;
 > +	int ret;
 > +
 > +	if (!of_device_is_available(pdev->dev.of_node))
 > +		return -ENODEV;
 > +
 > +	if (!axp20x) {
 > +		dev_err(&pdev->dev, "Parent drvdata not set\n");
 > +		return -EINVAL;
 > +	}
 > +
 > +	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
 > +	if (!gpio)
 > +		return -ENOMEM;
 > +
 > +	gpio->chip.base			= -1;
 > +	gpio->chip.can_sleep		= true;
 > +	gpio->chip.dev			= &pdev->dev;
 > +	gpio->chip.label		= dev_name(&pdev->dev);
 > +	gpio->chip.owner		= THIS_MODULE;
 > +	gpio->chip.get			= axp20x_gpio_get;
 > +	gpio->chip.set			= axp20x_gpio_set;
 > +	gpio->chip.direction_input	= axp20x_gpio_input;
 > +	gpio->chip.direction_output	= axp20x_gpio_output;
 > +	gpio->chip.ngpio		= 3;
 > +
 > +	gpio->regmap = axp20x->regmap;

This could just use dev_get_regmap(pdev.dev->parent, NULL) instead of
fiddling in the parent driver data.

 > +
 > +	ret = gpiochip_add(&gpio->chip);
 > +	if (ret) {
 > +		dev_err(&pdev->dev, "Failed to register GPIO chip\n");
 > +		return ret;
 > +	}
 > +
 > +	dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");

Any reason to be so noisy?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-09 13:20         ` Peter Korsgaard
  0 siblings, 0 replies; 63+ messages in thread
From: Peter Korsgaard @ 2016-03-09 13:20 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede

>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:

 > The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
 > control LEDs or backlight.

Do you find 3 'a bunch'? ;)

 > +static int axp20x_gpio_probe(struct platform_device *pdev)
 > +{
 > +	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 > +	struct axp20x_gpio *gpio;
 > +	int ret;
 > +
 > +	if (!of_device_is_available(pdev->dev.of_node))
 > +		return -ENODEV;
 > +
 > +	if (!axp20x) {
 > +		dev_err(&pdev->dev, "Parent drvdata not set\n");
 > +		return -EINVAL;
 > +	}
 > +
 > +	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
 > +	if (!gpio)
 > +		return -ENOMEM;
 > +
 > +	gpio->chip.base			= -1;
 > +	gpio->chip.can_sleep		= true;
 > +	gpio->chip.dev			= &pdev->dev;
 > +	gpio->chip.label		= dev_name(&pdev->dev);
 > +	gpio->chip.owner		= THIS_MODULE;
 > +	gpio->chip.get			= axp20x_gpio_get;
 > +	gpio->chip.set			= axp20x_gpio_set;
 > +	gpio->chip.direction_input	= axp20x_gpio_input;
 > +	gpio->chip.direction_output	= axp20x_gpio_output;
 > +	gpio->chip.ngpio		= 3;
 > +
 > +	gpio->regmap = axp20x->regmap;

This could just use dev_get_regmap(pdev.dev->parent, NULL) instead of
fiddling in the parent driver data.

 > +
 > +	ret = gpiochip_add(&gpio->chip);
 > +	if (ret) {
 > +		dev_err(&pdev->dev, "Failed to register GPIO chip\n");
 > +		return ret;
 > +	}
 > +
 > +	dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");

Any reason to be so noisy?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-09 13:20         ` Peter Korsgaard
  0 siblings, 0 replies; 63+ messages in thread
From: Peter Korsgaard @ 2016-03-09 13:20 UTC (permalink / raw)
  To: linux-arm-kernel

>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:

 > The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
 > control LEDs or backlight.

Do you find 3 'a bunch'? ;)

 > +static int axp20x_gpio_probe(struct platform_device *pdev)
 > +{
 > +	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 > +	struct axp20x_gpio *gpio;
 > +	int ret;
 > +
 > +	if (!of_device_is_available(pdev->dev.of_node))
 > +		return -ENODEV;
 > +
 > +	if (!axp20x) {
 > +		dev_err(&pdev->dev, "Parent drvdata not set\n");
 > +		return -EINVAL;
 > +	}
 > +
 > +	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
 > +	if (!gpio)
 > +		return -ENOMEM;
 > +
 > +	gpio->chip.base			= -1;
 > +	gpio->chip.can_sleep		= true;
 > +	gpio->chip.dev			= &pdev->dev;
 > +	gpio->chip.label		= dev_name(&pdev->dev);
 > +	gpio->chip.owner		= THIS_MODULE;
 > +	gpio->chip.get			= axp20x_gpio_get;
 > +	gpio->chip.set			= axp20x_gpio_set;
 > +	gpio->chip.direction_input	= axp20x_gpio_input;
 > +	gpio->chip.direction_output	= axp20x_gpio_output;
 > +	gpio->chip.ngpio		= 3;
 > +
 > +	gpio->regmap = axp20x->regmap;

This could just use dev_get_regmap(pdev.dev->parent, NULL) instead of
fiddling in the parent driver data.

 > +
 > +	ret = gpiochip_add(&gpio->chip);
 > +	if (ret) {
 > +		dev_err(&pdev->dev, "Failed to register GPIO chip\n");
 > +		return ret;
 > +	}
 > +
 > +	dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");

Any reason to be so noisy?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-09 12:17   ` Hans de Goede
  (?)
@ 2016-03-09 15:28       ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 15:28 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]

Hi,

On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 09-03-16 11:50, Maxime Ripard wrote:
> >Hi,
> >
> >The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> >of GPIOs accessible. Some boards use these to control their backlight
> >or a few LEDs.
> 
> Thanks for working on this, but IMHO this cannot go upstream like this,
> the gpio pins on the axp pmics need a pinctrl driver, not a gpio
> driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
> an additional low-noise ldo (so as a regulator), or as an adc input.

Eventually, yes, it needs both. But they don't even have to be the
same driver, since they provide two different features. The only
reason we have that construct in the pio case is because they share
the same address space, but in the AXP case, the regmap and our mfd
take care of that already.

> I've been working on gsl1680 touchscreen support lately and on at least
> a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
> controller.

Yeah, the AXP209 also has an ADC connected to these pins.

> Now these use an axp223 pmic, but nothing is stopping someone from
> doing something similar with an axp209 and I think it would be best
> to support this from day one, rather then hope we can retro-fit this
> later without breaking dts.

I considered that, but I don't see how it would break the DT later. If
someone wants to enable say the ADC, he will of course have to add the
pinctrl driver, and the pinctrl handles, but the old DT will only
reference the gpio driver directly, which would still be something
that would work.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 15:28       ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 15:28 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 1806 bytes --]

Hi,

On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 09-03-16 11:50, Maxime Ripard wrote:
> >Hi,
> >
> >The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> >of GPIOs accessible. Some boards use these to control their backlight
> >or a few LEDs.
> 
> Thanks for working on this, but IMHO this cannot go upstream like this,
> the gpio pins on the axp pmics need a pinctrl driver, not a gpio
> driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
> an additional low-noise ldo (so as a regulator), or as an adc input.

Eventually, yes, it needs both. But they don't even have to be the
same driver, since they provide two different features. The only
reason we have that construct in the pio case is because they share
the same address space, but in the AXP case, the regmap and our mfd
take care of that already.

> I've been working on gsl1680 touchscreen support lately and on at least
> a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
> controller.

Yeah, the AXP209 also has an ADC connected to these pins.

> Now these use an axp223 pmic, but nothing is stopping someone from
> doing something similar with an axp209 and I think it would be best
> to support this from day one, rather then hope we can retro-fit this
> later without breaking dts.

I considered that, but I don't see how it would break the DT later. If
someone wants to enable say the ADC, he will of course have to add the
pinctrl driver, and the pinctrl handles, but the old DT will only
reference the gpio driver directly, which would still be something
that would work.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 15:28       ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-09 15:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 09-03-16 11:50, Maxime Ripard wrote:
> >Hi,
> >
> >The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> >of GPIOs accessible. Some boards use these to control their backlight
> >or a few LEDs.
> 
> Thanks for working on this, but IMHO this cannot go upstream like this,
> the gpio pins on the axp pmics need a pinctrl driver, not a gpio
> driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
> an additional low-noise ldo (so as a regulator), or as an adc input.

Eventually, yes, it needs both. But they don't even have to be the
same driver, since they provide two different features. The only
reason we have that construct in the pio case is because they share
the same address space, but in the AXP case, the regmap and our mfd
take care of that already.

> I've been working on gsl1680 touchscreen support lately and on at least
> a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
> controller.

Yeah, the AXP209 also has an ADC connected to these pins.

> Now these use an axp223 pmic, but nothing is stopping someone from
> doing something similar with an axp209 and I think it would be best
> to support this from day one, rather then hope we can retro-fit this
> later without breaking dts.

I considered that, but I don't see how it would break the DT later. If
someone wants to enable say the ADC, he will of course have to add the
pinctrl driver, and the pinctrl handles, but the old DT will only
reference the gpio driver directly, which would still be something
that would work.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160309/60776cb9/attachment.sig>

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-09 15:28       ` Maxime Ripard
@ 2016-03-09 15:44         ` Hans de Goede
  -1 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-09 15:44 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi

Hi,

On 09-03-16 16:28, Maxime Ripard wrote:
> Hi,
>
> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 09-03-16 11:50, Maxime Ripard wrote:
>>> Hi,
>>>
>>> The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
>>> of GPIOs accessible. Some boards use these to control their backlight
>>> or a few LEDs.
>>
>> Thanks for working on this, but IMHO this cannot go upstream like this,
>> the gpio pins on the axp pmics need a pinctrl driver, not a gpio
>> driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
>> an additional low-noise ldo (so as a regulator), or as an adc input.
>
> Eventually, yes, it needs both. But they don't even have to be the
> same driver, since they provide two different features. The only
> reason we have that construct in the pio case is because they share
> the same address space, but in the AXP case, the regmap and our mfd
> take care of that already.

Hmm, so your suggesting to have mfd instantiate 2 platform devices
for this, a gpio and a pinctrl device, each with their own
driver. Yes that would work, but I'm a bit worried about the 2
racing or some such since they both will end up touching
bit 0-2 of register 0x90 / 0x92, more-over since they are both
touching the exact same bits I've the feeling that this really
should be one driver.

I guess that in a proper written dts we either use pinctrl to enable
a special function, or gpio, but still.

>> I've been working on gsl1680 touchscreen support lately and on at least
>> a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
>> controller.
>
> Yeah, the AXP209 also has an ADC connected to these pins.
>
>> Now these use an axp223 pmic, but nothing is stopping someone from
>> doing something similar with an axp209 and I think it would be best
>> to support this from day one, rather then hope we can retro-fit this
>> later without breaking dts.
>
> I considered that, but I don't see how it would break the DT later. If
> someone wants to enable say the ADC, he will of course have to add the
> pinctrl driver, and the pinctrl handles, but the old DT will only
> reference the gpio driver directly, which would still be something
> that would work.

I was assuming we would use one mfd-child(-platform)-device for this,
not two. I guess that with 2 devices you're right and there should
not be any problem, still as said it feels wrong-ish to have 2 drivers
poking bits 0-2 of reg 0x90 / reg 0x92.

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-09 15:44         ` Hans de Goede
  0 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-09 15:44 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 09-03-16 16:28, Maxime Ripard wrote:
> Hi,
>
> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 09-03-16 11:50, Maxime Ripard wrote:
>>> Hi,
>>>
>>> The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
>>> of GPIOs accessible. Some boards use these to control their backlight
>>> or a few LEDs.
>>
>> Thanks for working on this, but IMHO this cannot go upstream like this,
>> the gpio pins on the axp pmics need a pinctrl driver, not a gpio
>> driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
>> an additional low-noise ldo (so as a regulator), or as an adc input.
>
> Eventually, yes, it needs both. But they don't even have to be the
> same driver, since they provide two different features. The only
> reason we have that construct in the pio case is because they share
> the same address space, but in the AXP case, the regmap and our mfd
> take care of that already.

Hmm, so your suggesting to have mfd instantiate 2 platform devices
for this, a gpio and a pinctrl device, each with their own
driver. Yes that would work, but I'm a bit worried about the 2
racing or some such since they both will end up touching
bit 0-2 of register 0x90 / 0x92, more-over since they are both
touching the exact same bits I've the feeling that this really
should be one driver.

I guess that in a proper written dts we either use pinctrl to enable
a special function, or gpio, but still.

>> I've been working on gsl1680 touchscreen support lately and on at least
>> a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
>> controller.
>
> Yeah, the AXP209 also has an ADC connected to these pins.
>
>> Now these use an axp223 pmic, but nothing is stopping someone from
>> doing something similar with an axp209 and I think it would be best
>> to support this from day one, rather then hope we can retro-fit this
>> later without breaking dts.
>
> I considered that, but I don't see how it would break the DT later. If
> someone wants to enable say the ADC, he will of course have to add the
> pinctrl driver, and the pinctrl handles, but the old DT will only
> reference the gpio driver directly, which would still be something
> that would work.

I was assuming we would use one mfd-child(-platform)-device for this,
not two. I guess that with 2 devices you're right and there should
not be any problem, still as said it feels wrong-ish to have 2 drivers
poking bits 0-2 of reg 0x90 / reg 0x92.

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-16  9:56         ` Linus Walleij
  -1 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16  9:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi, Hans de Goede

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
>
> Add a driver for them
>
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

OK...

> +++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt

Some people insist that bindings be sent separately from the
drivers but I don't care. Especially not for this simple binding.

> +AXP209 GPIO controller

Write something more about the hardware here. For example the
quite obvious fact that it is part of an bigger MFD device.
In some cases people put all the bindings inside a single
file in bindings/mfd/*, follow Lee's recommendation here, I have
no strong opinion.

> +axp209: pmic@34 {
> +       compatible = "x-powers,axp209";

Doesn't this need "simple-mfd" if the GPIO subdriver shall
probe properly?

> +       reg = <0x34>;
> +       interrupt-parent = <&nmi_intc>;
> +       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +       interrupt-controller;
> +       #interrupt-cells = <1>;
> +
> +       axp_gpio: gpio {
> +               compatible = "x-powers,axp209-gpio";
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +       };
> +};

(...)
> +++ b/drivers/gpio/gpio-axp209.c
(...)
> +#include <linux/device.h>
> +#include <linux/gpio.h>

Should only need <linux/gpio/driver.h>

> +struct axp20x_gpio *to_axp20x_gpio(struct gpio_chip *chip)
> +{
> +       return container_of(chip, struct axp20x_gpio, chip);
> +}

No. Use devm_gpiochip_add_data() and gpiochip_get_data()
to get the pointer back.

> +static int axp20x_gpio_get_reg(unsigned offset)
> +{
> +       switch (offset) {
> +       case 0:
> +               return AXP20X_GPIO0_CTRL;
> +       case 1:
> +               return AXP20X_GPIO1_CTRL;
> +       case 2:
> +               return AXP20X_GPIO2_CTRL;
> +       }
> +
> +       return -EINVAL;
> +}

Can't you just:

static u8 regs[] = {AXP20X_GPIO0_CTRL, AXP20X_GPIO1_CTRL, AXP20X_GPIO2_CTRL};

static int axp20x_gpio_get_reg(unsigned offset)
{
    if (offset >= ARRAY_SIZE(regs))
        return -EINVAL;
    return regs[offset];
}

> +static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
> +{
> +       struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
> +       unsigned int val;
> +       int reg, ret;
> +
> +       reg = axp20x_gpio_get_reg(offset);
> +       if (reg < 0)
> +               return reg;
> +
> +       ret = regmap_read(gpio->regmap, reg, &val);
> +       if (ret)
> +               return ret;
> +
> +       return val & (1 << (offset + 4));

This doesn't clamp to [0,1]. Please do this instead:

#include <linux/bitops.h>

return !!(val & BIT(offset+4));

> +static int axp20x_gpio_probe(struct platform_device *pdev)
> +{
> +       struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> +       struct axp20x_gpio *gpio;
> +       int ret;
> +
> +       if (!of_device_is_available(pdev->dev.of_node))
> +               return -ENODEV;
> +
> +       if (!axp20x) {
> +               dev_err(&pdev->dev, "Parent drvdata not set\n");
> +               return -EINVAL;
> +       }
> +
> +       gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> +       if (!gpio)
> +               return -ENOMEM;
> +
> +       gpio->chip.base                 = -1;
> +       gpio->chip.can_sleep            = true;
> +       gpio->chip.dev                  = &pdev->dev;

This is renamed .parent upstream, ick use latest kernel as base for
your patches ;)

> +       gpio->chip.label                = dev_name(&pdev->dev);
> +       gpio->chip.owner                = THIS_MODULE;
> +       gpio->chip.get                  = axp20x_gpio_get;
> +       gpio->chip.set                  = axp20x_gpio_set;
> +       gpio->chip.direction_input      = axp20x_gpio_input;
> +       gpio->chip.direction_output     = axp20x_gpio_output;
> +       gpio->chip.ngpio                = 3;
> +
> +       gpio->regmap = axp20x->regmap;
> +
> +       ret = gpiochip_add(&gpio->chip);

devm_gpiochip_add_data() as mentioned.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-16  9:56         ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16  9:56 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Lee Jones, Chen-Yu Tsai, devicetree,
	linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi,
	Hans de Goede

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
>
> Add a driver for them
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

OK...

> +++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt

Some people insist that bindings be sent separately from the
drivers but I don't care. Especially not for this simple binding.

> +AXP209 GPIO controller

Write something more about the hardware here. For example the
quite obvious fact that it is part of an bigger MFD device.
In some cases people put all the bindings inside a single
file in bindings/mfd/*, follow Lee's recommendation here, I have
no strong opinion.

> +axp209: pmic@34 {
> +       compatible = "x-powers,axp209";

Doesn't this need "simple-mfd" if the GPIO subdriver shall
probe properly?

> +       reg = <0x34>;
> +       interrupt-parent = <&nmi_intc>;
> +       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +       interrupt-controller;
> +       #interrupt-cells = <1>;
> +
> +       axp_gpio: gpio {
> +               compatible = "x-powers,axp209-gpio";
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +       };
> +};

(...)
> +++ b/drivers/gpio/gpio-axp209.c
(...)
> +#include <linux/device.h>
> +#include <linux/gpio.h>

Should only need <linux/gpio/driver.h>

> +struct axp20x_gpio *to_axp20x_gpio(struct gpio_chip *chip)
> +{
> +       return container_of(chip, struct axp20x_gpio, chip);
> +}

No. Use devm_gpiochip_add_data() and gpiochip_get_data()
to get the pointer back.

> +static int axp20x_gpio_get_reg(unsigned offset)
> +{
> +       switch (offset) {
> +       case 0:
> +               return AXP20X_GPIO0_CTRL;
> +       case 1:
> +               return AXP20X_GPIO1_CTRL;
> +       case 2:
> +               return AXP20X_GPIO2_CTRL;
> +       }
> +
> +       return -EINVAL;
> +}

Can't you just:

static u8 regs[] = {AXP20X_GPIO0_CTRL, AXP20X_GPIO1_CTRL, AXP20X_GPIO2_CTRL};

static int axp20x_gpio_get_reg(unsigned offset)
{
    if (offset >= ARRAY_SIZE(regs))
        return -EINVAL;
    return regs[offset];
}

> +static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
> +{
> +       struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
> +       unsigned int val;
> +       int reg, ret;
> +
> +       reg = axp20x_gpio_get_reg(offset);
> +       if (reg < 0)
> +               return reg;
> +
> +       ret = regmap_read(gpio->regmap, reg, &val);
> +       if (ret)
> +               return ret;
> +
> +       return val & (1 << (offset + 4));

This doesn't clamp to [0,1]. Please do this instead:

#include <linux/bitops.h>

return !!(val & BIT(offset+4));

> +static int axp20x_gpio_probe(struct platform_device *pdev)
> +{
> +       struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> +       struct axp20x_gpio *gpio;
> +       int ret;
> +
> +       if (!of_device_is_available(pdev->dev.of_node))
> +               return -ENODEV;
> +
> +       if (!axp20x) {
> +               dev_err(&pdev->dev, "Parent drvdata not set\n");
> +               return -EINVAL;
> +       }
> +
> +       gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> +       if (!gpio)
> +               return -ENOMEM;
> +
> +       gpio->chip.base                 = -1;
> +       gpio->chip.can_sleep            = true;
> +       gpio->chip.dev                  = &pdev->dev;

This is renamed .parent upstream, ick use latest kernel as base for
your patches ;)

> +       gpio->chip.label                = dev_name(&pdev->dev);
> +       gpio->chip.owner                = THIS_MODULE;
> +       gpio->chip.get                  = axp20x_gpio_get;
> +       gpio->chip.set                  = axp20x_gpio_set;
> +       gpio->chip.direction_input      = axp20x_gpio_input;
> +       gpio->chip.direction_output     = axp20x_gpio_output;
> +       gpio->chip.ngpio                = 3;
> +
> +       gpio->regmap = axp20x->regmap;
> +
> +       ret = gpiochip_add(&gpio->chip);

devm_gpiochip_add_data() as mentioned.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-16  9:56         ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16  9:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
>
> Add a driver for them
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

OK...

> +++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt

Some people insist that bindings be sent separately from the
drivers but I don't care. Especially not for this simple binding.

> +AXP209 GPIO controller

Write something more about the hardware here. For example the
quite obvious fact that it is part of an bigger MFD device.
In some cases people put all the bindings inside a single
file in bindings/mfd/*, follow Lee's recommendation here, I have
no strong opinion.

> +axp209: pmic at 34 {
> +       compatible = "x-powers,axp209";

Doesn't this need "simple-mfd" if the GPIO subdriver shall
probe properly?

> +       reg = <0x34>;
> +       interrupt-parent = <&nmi_intc>;
> +       interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +       interrupt-controller;
> +       #interrupt-cells = <1>;
> +
> +       axp_gpio: gpio {
> +               compatible = "x-powers,axp209-gpio";
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +       };
> +};

(...)
> +++ b/drivers/gpio/gpio-axp209.c
(...)
> +#include <linux/device.h>
> +#include <linux/gpio.h>

Should only need <linux/gpio/driver.h>

> +struct axp20x_gpio *to_axp20x_gpio(struct gpio_chip *chip)
> +{
> +       return container_of(chip, struct axp20x_gpio, chip);
> +}

No. Use devm_gpiochip_add_data() and gpiochip_get_data()
to get the pointer back.

> +static int axp20x_gpio_get_reg(unsigned offset)
> +{
> +       switch (offset) {
> +       case 0:
> +               return AXP20X_GPIO0_CTRL;
> +       case 1:
> +               return AXP20X_GPIO1_CTRL;
> +       case 2:
> +               return AXP20X_GPIO2_CTRL;
> +       }
> +
> +       return -EINVAL;
> +}

Can't you just:

static u8 regs[] = {AXP20X_GPIO0_CTRL, AXP20X_GPIO1_CTRL, AXP20X_GPIO2_CTRL};

static int axp20x_gpio_get_reg(unsigned offset)
{
    if (offset >= ARRAY_SIZE(regs))
        return -EINVAL;
    return regs[offset];
}

> +static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset)
> +{
> +       struct axp20x_gpio *gpio = to_axp20x_gpio(chip);
> +       unsigned int val;
> +       int reg, ret;
> +
> +       reg = axp20x_gpio_get_reg(offset);
> +       if (reg < 0)
> +               return reg;
> +
> +       ret = regmap_read(gpio->regmap, reg, &val);
> +       if (ret)
> +               return ret;
> +
> +       return val & (1 << (offset + 4));

This doesn't clamp to [0,1]. Please do this instead:

#include <linux/bitops.h>

return !!(val & BIT(offset+4));

> +static int axp20x_gpio_probe(struct platform_device *pdev)
> +{
> +       struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> +       struct axp20x_gpio *gpio;
> +       int ret;
> +
> +       if (!of_device_is_available(pdev->dev.of_node))
> +               return -ENODEV;
> +
> +       if (!axp20x) {
> +               dev_err(&pdev->dev, "Parent drvdata not set\n");
> +               return -EINVAL;
> +       }
> +
> +       gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> +       if (!gpio)
> +               return -ENOMEM;
> +
> +       gpio->chip.base                 = -1;
> +       gpio->chip.can_sleep            = true;
> +       gpio->chip.dev                  = &pdev->dev;

This is renamed .parent upstream, ick use latest kernel as base for
your patches ;)

> +       gpio->chip.label                = dev_name(&pdev->dev);
> +       gpio->chip.owner                = THIS_MODULE;
> +       gpio->chip.get                  = axp20x_gpio_get;
> +       gpio->chip.set                  = axp20x_gpio_set;
> +       gpio->chip.direction_input      = axp20x_gpio_input;
> +       gpio->chip.direction_output     = axp20x_gpio_output;
> +       gpio->chip.ngpio                = 3;
> +
> +       gpio->regmap = axp20x->regmap;
> +
> +       ret = gpiochip_add(&gpio->chip);

devm_gpiochip_add_data() as mentioned.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] [PATCH 1/4] gpio: Add AXP209 GPIO driver
  2016-03-09 13:20         ` Peter Korsgaard
  (?)
@ 2016-03-16  9:57             ` Linus Walleij
  -1 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16  9:57 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Maxime Ripard, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi, Hans de Goede

On Wed, Mar 9, 2016 at 2:20 PM, Peter Korsgaard <peter-+2lRwdCCLRT2eFz/2MeuCQ@public.gmane.org> wrote:
>>>>>> "Maxime" == Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> writes:

>  > +    dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
>
> Any reason to be so noisy?

The GPIO maintainer likes boasty drivers.

I don't understand people who are dmesg minimalists, I want to
have positive indications that things work in there, not just bad news
about what went wrong.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-16  9:57             ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16  9:57 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Maxime Ripard, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede

On Wed, Mar 9, 2016 at 2:20 PM, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:

>  > +    dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
>
> Any reason to be so noisy?

The GPIO maintainer likes boasty drivers.

I don't understand people who are dmesg minimalists, I want to
have positive indications that things work in there, not just bad news
about what went wrong.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-16  9:57             ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 9, 2016 at 2:20 PM, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Maxime" == Maxime Ripard <maxime.ripard@free-electrons.com> writes:

>  > +    dev_info(&pdev->dev, "AXP209 GPIO driver loaded\n");
>
> Any reason to be so noisy?

The GPIO maintainer likes boasty drivers.

I don't understand people who are dmesg minimalists, I want to
have positive indications that things work in there, not just bad news
about what went wrong.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-16 10:03         ` Linus Walleij
  -1 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:03 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi, Hans de Goede

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
>
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
(...)
> +               .name           = "axp20x-gpio",
> +               .of_compatible  = "x-powers,axp209-gpio",

Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Professor X must be behind this X-powers X men.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-16 10:03         ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:03 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Lee Jones, Chen-Yu Tsai, devicetree,
	linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi,
	Hans de Goede

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
(...)
> +               .name           = "axp20x-gpio",
> +               .of_compatible  = "x-powers,axp209-gpio",

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Professor X must be behind this X-powers X men.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-16 10:03         ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
(...)
> +               .name           = "axp20x-gpio",
> +               .of_compatible  = "x-powers,axp209-gpio",

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Professor X must be behind this X-powers X men.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-16 10:04         ` Linus Walleij
  -1 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi, Hans de Goede

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> Add the AXP209 GPIO node to our AXP209 DTSI so that boards can use it.
>
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver
@ 2016-03-16 10:04         ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:04 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Alexandre Courbot, Lee Jones, Chen-Yu Tsai, devicetree,
	linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi,
	Hans de Goede

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> Add the AXP209 GPIO node to our AXP209 DTSI so that boards can use it.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver
@ 2016-03-16 10:04         ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 9, 2016 at 11:50 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> Add the AXP209 GPIO node to our AXP209 DTSI so that boards can use it.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-09 15:44         ` Hans de Goede
  (?)
@ 2016-03-16 10:10             ` Linus Walleij
  -1 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:10 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Maxime Ripard, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-sunxi

On Wed, Mar 9, 2016 at 4:44 PM, Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:

>> Eventually, yes, it needs both. But they don't even have to be the
>> same driver, since they provide two different features. The only
>> reason we have that construct in the pio case is because they share
>> the same address space, but in the AXP case, the regmap and our mfd
>> take care of that already.
>
> Hmm, so your suggesting to have mfd instantiate 2 platform devices
> for this, a gpio and a pinctrl device, each with their own
> driver. Yes that would work, but I'm a bit worried about the 2
> racing or some such since they both will end up touching
> bit 0-2 of register 0x90 / 0x92, more-over since they are both
> touching the exact same bits I've the feeling that this really
> should be one driver.

We can put the driver in drivers/pinctrl/pinctrl-axp209.c from day
one, add in comments stating that it only implements GPIO
for now and that the GPIO portion must call
pinctrl_request_gpio() and the pin controller must implement
.gpio_request_enable() the day it is added so the GPIOs do
not conflict with other use of the pins.

Requireing a huge slew of upfront code is a bit hard on simple
drivers I think.

Also we have the solution in drivers/mfd/stmpe.c that just add
a simple mux code when pins on mixsigs or simple expanders
can just mux some two-three different functions, then I think
pin control may be a bit too thick overhead. (Not sure where
the limit is though.)

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-16 10:10             ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:10 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Maxime Ripard, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi

On Wed, Mar 9, 2016 at 4:44 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:

>> Eventually, yes, it needs both. But they don't even have to be the
>> same driver, since they provide two different features. The only
>> reason we have that construct in the pio case is because they share
>> the same address space, but in the AXP case, the regmap and our mfd
>> take care of that already.
>
> Hmm, so your suggesting to have mfd instantiate 2 platform devices
> for this, a gpio and a pinctrl device, each with their own
> driver. Yes that would work, but I'm a bit worried about the 2
> racing or some such since they both will end up touching
> bit 0-2 of register 0x90 / 0x92, more-over since they are both
> touching the exact same bits I've the feeling that this really
> should be one driver.

We can put the driver in drivers/pinctrl/pinctrl-axp209.c from day
one, add in comments stating that it only implements GPIO
for now and that the GPIO portion must call
pinctrl_request_gpio() and the pin controller must implement
.gpio_request_enable() the day it is added so the GPIOs do
not conflict with other use of the pins.

Requireing a huge slew of upfront code is a bit hard on simple
drivers I think.

Also we have the solution in drivers/mfd/stmpe.c that just add
a simple mux code when pins on mixsigs or simple expanders
can just mux some two-three different functions, then I think
pin control may be a bit too thick overhead. (Not sure where
the limit is though.)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-16 10:10             ` Linus Walleij
  0 siblings, 0 replies; 63+ messages in thread
From: Linus Walleij @ 2016-03-16 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 9, 2016 at 4:44 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:

>> Eventually, yes, it needs both. But they don't even have to be the
>> same driver, since they provide two different features. The only
>> reason we have that construct in the pio case is because they share
>> the same address space, but in the AXP case, the regmap and our mfd
>> take care of that already.
>
> Hmm, so your suggesting to have mfd instantiate 2 platform devices
> for this, a gpio and a pinctrl device, each with their own
> driver. Yes that would work, but I'm a bit worried about the 2
> racing or some such since they both will end up touching
> bit 0-2 of register 0x90 / 0x92, more-over since they are both
> touching the exact same bits I've the feeling that this really
> should be one driver.

We can put the driver in drivers/pinctrl/pinctrl-axp209.c from day
one, add in comments stating that it only implements GPIO
for now and that the GPIO portion must call
pinctrl_request_gpio() and the pin controller must implement
.gpio_request_enable() the day it is added so the GPIOs do
not conflict with other use of the pins.

Requireing a huge slew of upfront code is a bit hard on simple
drivers I think.

Also we have the solution in drivers/mfd/stmpe.c that just add
a simple mux code when pins on mixsigs or simple expanders
can just mux some two-three different functions, then I think
pin control may be a bit too thick overhead. (Not sure where
the limit is though.)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-16 10:10             ` Linus Walleij
  (?)
@ 2016-03-16 10:38               ` Hans de Goede
  -1 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-16 10:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Ripard, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi

Hi,

On 16-03-16 11:10, Linus Walleij wrote:
> On Wed, Mar 9, 2016 at 4:44 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>>> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>
>>> Eventually, yes, it needs both. But they don't even have to be the
>>> same driver, since they provide two different features. The only
>>> reason we have that construct in the pio case is because they share
>>> the same address space, but in the AXP case, the regmap and our mfd
>>> take care of that already.
>>
>> Hmm, so your suggesting to have mfd instantiate 2 platform devices
>> for this, a gpio and a pinctrl device, each with their own
>> driver. Yes that would work, but I'm a bit worried about the 2
>> racing or some such since they both will end up touching
>> bit 0-2 of register 0x90 / 0x92, more-over since they are both
>> touching the exact same bits I've the feeling that this really
>> should be one driver.
>
> We can put the driver in drivers/pinctrl/pinctrl-axp209.c from day
> one, add in comments stating that it only implements GPIO
> for now and that the GPIO portion must call
> pinctrl_request_gpio() and the pin controller must implement
> .gpio_request_enable() the day it is added so the GPIOs do
> not conflict with other use of the pins.
>
> Requireing a huge slew of upfront code is a bit hard on simple
> drivers I think.
>
> Also we have the solution in drivers/mfd/stmpe.c that just add
> a simple mux code when pins on mixsigs or simple expanders
> can just mux some two-three different functions, then I think
> pin control may be a bit too thick overhead. (Not sure where
> the limit is though.)

I actually found out this weekend, that we already have
a problem here. Regulator on/off is implemented as
2 mux settings, just like gpio high/low/input are mux settings:

On the axp209 the gpio pin mux bit table looks like this:

000: low output
001: output (3.3V)
010: universal input function
011: low noise LDO5
100: ADC input
1XX: floating

And on the axp221 / axp223:

000: output low
001: output high (3.3V)
010: input
011: LDOIO0 off
100: LDOIO0 on
1XX: floating

Note the LDOIO0 off / LDOIO0 on being 2 different mux
settings, and then existing axp20x regulator driver for
LD05 / LDOIO0 actually already implements regulator on / off
by changing the mux for both axp209 and axp22x.

This results in the following potentially happening.

0) kernel boots

1) The gpio driver is in use for these pins, sets the pin
to say output low

2) kernel is ready to start init, calls the regulators
subsys late_init call, which disables any unused regulators,
this results in the mux getting set to 7 (axp209) resp
4 (axp22x), and the gpio is no longer driven low as
the intend of the driver using the pin was.

So we really need either some coordination here, or a way
to tell the regulator-driver to not register ldo5 / ldoio#
at all, so that the regulator-core won't try to turn them
off changing the mux.

I've submitted a patch series this weekend which allows
putting "status = disabled" in regulator child-dts-nodes, which
will then result in not registering a regulator at all,
which would fix that. But that series has not received any
feedback yet...

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-16 10:38               ` Hans de Goede
  0 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-16 10:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Maxime Ripard, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi

Hi,

On 16-03-16 11:10, Linus Walleij wrote:
> On Wed, Mar 9, 2016 at 4:44 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>>> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>
>>> Eventually, yes, it needs both. But they don't even have to be the
>>> same driver, since they provide two different features. The only
>>> reason we have that construct in the pio case is because they share
>>> the same address space, but in the AXP case, the regmap and our mfd
>>> take care of that already.
>>
>> Hmm, so your suggesting to have mfd instantiate 2 platform devices
>> for this, a gpio and a pinctrl device, each with their own
>> driver. Yes that would work, but I'm a bit worried about the 2
>> racing or some such since they both will end up touching
>> bit 0-2 of register 0x90 / 0x92, more-over since they are both
>> touching the exact same bits I've the feeling that this really
>> should be one driver.
>
> We can put the driver in drivers/pinctrl/pinctrl-axp209.c from day
> one, add in comments stating that it only implements GPIO
> for now and that the GPIO portion must call
> pinctrl_request_gpio() and the pin controller must implement
> .gpio_request_enable() the day it is added so the GPIOs do
> not conflict with other use of the pins.
>
> Requireing a huge slew of upfront code is a bit hard on simple
> drivers I think.
>
> Also we have the solution in drivers/mfd/stmpe.c that just add
> a simple mux code when pins on mixsigs or simple expanders
> can just mux some two-three different functions, then I think
> pin control may be a bit too thick overhead. (Not sure where
> the limit is though.)

I actually found out this weekend, that we already have
a problem here. Regulator on/off is implemented as
2 mux settings, just like gpio high/low/input are mux settings:

On the axp209 the gpio pin mux bit table looks like this:

000: low output
001: output (3.3V)
010: universal input function
011: low noise LDO5
100: ADC input
1XX: floating

And on the axp221 / axp223:

000: output low
001: output high (3.3V)
010: input
011: LDOIO0 off
100: LDOIO0 on
1XX: floating

Note the LDOIO0 off / LDOIO0 on being 2 different mux
settings, and then existing axp20x regulator driver for
LD05 / LDOIO0 actually already implements regulator on / off
by changing the mux for both axp209 and axp22x.

This results in the following potentially happening.

0) kernel boots

1) The gpio driver is in use for these pins, sets the pin
to say output low

2) kernel is ready to start init, calls the regulators
subsys late_init call, which disables any unused regulators,
this results in the mux getting set to 7 (axp209) resp
4 (axp22x), and the gpio is no longer driven low as
the intend of the driver using the pin was.

So we really need either some coordination here, or a way
to tell the regulator-driver to not register ldo5 / ldoio#
at all, so that the regulator-core won't try to turn them
off changing the mux.

I've submitted a patch series this weekend which allows
putting "status = disabled" in regulator child-dts-nodes, which
will then result in not registering a regulator at all,
which would fix that. But that series has not received any
feedback yet...

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-16 10:38               ` Hans de Goede
  0 siblings, 0 replies; 63+ messages in thread
From: Hans de Goede @ 2016-03-16 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 16-03-16 11:10, Linus Walleij wrote:
> On Wed, Mar 9, 2016 at 4:44 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>>> On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>
>>> Eventually, yes, it needs both. But they don't even have to be the
>>> same driver, since they provide two different features. The only
>>> reason we have that construct in the pio case is because they share
>>> the same address space, but in the AXP case, the regmap and our mfd
>>> take care of that already.
>>
>> Hmm, so your suggesting to have mfd instantiate 2 platform devices
>> for this, a gpio and a pinctrl device, each with their own
>> driver. Yes that would work, but I'm a bit worried about the 2
>> racing or some such since they both will end up touching
>> bit 0-2 of register 0x90 / 0x92, more-over since they are both
>> touching the exact same bits I've the feeling that this really
>> should be one driver.
>
> We can put the driver in drivers/pinctrl/pinctrl-axp209.c from day
> one, add in comments stating that it only implements GPIO
> for now and that the GPIO portion must call
> pinctrl_request_gpio() and the pin controller must implement
> .gpio_request_enable() the day it is added so the GPIOs do
> not conflict with other use of the pins.
>
> Requireing a huge slew of upfront code is a bit hard on simple
> drivers I think.
>
> Also we have the solution in drivers/mfd/stmpe.c that just add
> a simple mux code when pins on mixsigs or simple expanders
> can just mux some two-three different functions, then I think
> pin control may be a bit too thick overhead. (Not sure where
> the limit is though.)

I actually found out this weekend, that we already have
a problem here. Regulator on/off is implemented as
2 mux settings, just like gpio high/low/input are mux settings:

On the axp209 the gpio pin mux bit table looks like this:

000: low output
001: output (3.3V)
010: universal input function
011: low noise LDO5
100: ADC input
1XX: floating

And on the axp221 / axp223:

000: output low
001: output high (3.3V)
010: input
011: LDOIO0 off
100: LDOIO0 on
1XX: floating

Note the LDOIO0 off / LDOIO0 on being 2 different mux
settings, and then existing axp20x regulator driver for
LD05 / LDOIO0 actually already implements regulator on / off
by changing the mux for both axp209 and axp22x.

This results in the following potentially happening.

0) kernel boots

1) The gpio driver is in use for these pins, sets the pin
to say output low

2) kernel is ready to start init, calls the regulators
subsys late_init call, which disables any unused regulators,
this results in the mux getting set to 7 (axp209) resp
4 (axp22x), and the gpio is no longer driven low as
the intend of the driver using the pin was.

So we really need either some coordination here, or a way
to tell the regulator-driver to not register ldo5 / ldoio#
at all, so that the regulator-core won't try to turn them
off changing the mux.

I've submitted a patch series this weekend which allows
putting "status = disabled" in regulator child-dts-nodes, which
will then result in not registering a regulator at all,
which would fix that. But that series has not received any
feedback yet...

Regards,

Hans

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-17 19:10         ` Rob Herring
  -1 siblings, 0 replies; 63+ messages in thread
From: Rob Herring @ 2016-03-17 19:10 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

On Wed, Mar 09, 2016 at 11:50:11AM +0100, Maxime Ripard wrote:
> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
> 
> Add a driver for them
> 
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

>  drivers/gpio/Kconfig                               |   6 +
>  drivers/gpio/Makefile                              |   1 +
>  drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
>  4 files changed, 203 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
>  create mode 100644 drivers/gpio/gpio-axp209.c

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-17 19:10         ` Rob Herring
  0 siblings, 0 replies; 63+ messages in thread
From: Rob Herring @ 2016-03-17 19:10 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi, Hans de Goede

On Wed, Mar 09, 2016 at 11:50:11AM +0100, Maxime Ripard wrote:
> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
> 
> Add a driver for them
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/gpio/Kconfig                               |   6 +
>  drivers/gpio/Makefile                              |   1 +
>  drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
>  4 files changed, 203 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
>  create mode 100644 drivers/gpio/gpio-axp209.c

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 1/4] gpio: Add AXP209 GPIO driver
@ 2016-03-17 19:10         ` Rob Herring
  0 siblings, 0 replies; 63+ messages in thread
From: Rob Herring @ 2016-03-17 19:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 09, 2016 at 11:50:11AM +0100, Maxime Ripard wrote:
> The AXP209 PMIC has a bunch of GPIOs accessible, that are usually used to
> control LEDs or backlight.
> 
> Add a driver for them
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  .../devicetree/bindings/gpio/gpio-axp209.txt       |  30 ++++

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/gpio/Kconfig                               |   6 +
>  drivers/gpio/Makefile                              |   1 +
>  drivers/gpio/gpio-axp209.c                         | 166 +++++++++++++++++++++
>  4 files changed, 203 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-axp209.txt
>  create mode 100644 drivers/gpio/gpio-axp209.c

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
  2016-03-09 10:50     ` Maxime Ripard
  (?)
@ 2016-03-21 11:54         ` Lee Jones
  -1 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-03-21 11:54 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

On Wed, 09 Mar 2016, Maxime Ripard wrote:

> Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  drivers/mfd/axp20x.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index a57d6e940610..89518ee3be33 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -430,6 +430,9 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
>  
>  static struct mfd_cell axp20x_cells[] = {
>  	{
> +		.name		= "axp20x-gpio",
> +		.of_compatible	= "x-powers,axp209-gpio",
> +	}, {
>  		.name		= "axp20x-pek",
>  		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
>  		.resources	= axp20x_pek_resources,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-21 11:54         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-03-21 11:54 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Chen-Yu Tsai, devicetree,
	linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi,
	Hans de Goede

On Wed, 09 Mar 2016, Maxime Ripard wrote:

> Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/mfd/axp20x.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index a57d6e940610..89518ee3be33 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -430,6 +430,9 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
>  
>  static struct mfd_cell axp20x_cells[] = {
>  	{
> +		.name		= "axp20x-gpio",
> +		.of_compatible	= "x-powers,axp209-gpio",
> +	}, {
>  		.name		= "axp20x-pek",
>  		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
>  		.resources	= axp20x_pek_resources,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-21 11:54         ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-03-21 11:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 09 Mar 2016, Maxime Ripard wrote:

> Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/mfd/axp20x.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index a57d6e940610..89518ee3be33 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -430,6 +430,9 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
>  
>  static struct mfd_cell axp20x_cells[] = {
>  	{
> +		.name		= "axp20x-gpio",
> +		.of_compatible	= "x-powers,axp209-gpio",
> +	}, {
>  		.name		= "axp20x-pek",
>  		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
>  		.resources	= axp20x_pek_resources,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-09 15:44         ` Hans de Goede
@ 2016-03-22  7:22           ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-22  7:22 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Linus Walleij, Alexandre Courbot, Lee Jones, Chen-Yu Tsai,
	devicetree, linux-arm-kernel, linux-gpio, linux-kernel,
	linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 3379 bytes --]

Hi,

On Wed, Mar 09, 2016 at 04:44:01PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 09-03-16 16:28, Maxime Ripard wrote:
> >Hi,
> >
> >On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
> >>Hi,
> >>
> >>On 09-03-16 11:50, Maxime Ripard wrote:
> >>>Hi,
> >>>
> >>>The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> >>>of GPIOs accessible. Some boards use these to control their backlight
> >>>or a few LEDs.
> >>
> >>Thanks for working on this, but IMHO this cannot go upstream like this,
> >>the gpio pins on the axp pmics need a pinctrl driver, not a gpio
> >>driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
> >>an additional low-noise ldo (so as a regulator), or as an adc input.
> >
> >Eventually, yes, it needs both. But they don't even have to be the
> >same driver, since they provide two different features. The only
> >reason we have that construct in the pio case is because they share
> >the same address space, but in the AXP case, the regmap and our mfd
> >take care of that already.
> 
> Hmm, so your suggesting to have mfd instantiate 2 platform devices
> for this, a gpio and a pinctrl device, each with their own
> driver. Yes that would work, but I'm a bit worried about the 2
> racing or some such since they both will end up touching
> bit 0-2 of register 0x90 / 0x92, more-over since they are both
> touching the exact same bits I've the feeling that this really
> should be one driver.

I don't think that's an issue. We basically have two cases here:
either we have a driver using the pin or not.

If we have a driver using it, then pinctrl will make sure we have an
exclusive use of the pin, before the gpio is requested and we start
changing that value. If not, then no one cares anyway.

> 
> I guess that in a proper written dts we either use pinctrl to enable
> a special function, or gpio, but still.
> 
> >>I've been working on gsl1680 touchscreen support lately and on at least
> >>a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
> >>controller.
> >
> >Yeah, the AXP209 also has an ADC connected to these pins.
> >
> >>Now these use an axp223 pmic, but nothing is stopping someone from
> >>doing something similar with an axp209 and I think it would be best
> >>to support this from day one, rather then hope we can retro-fit this
> >>later without breaking dts.
> >
> >I considered that, but I don't see how it would break the DT later. If
> >someone wants to enable say the ADC, he will of course have to add the
> >pinctrl driver, and the pinctrl handles, but the old DT will only
> >reference the gpio driver directly, which would still be something
> >that would work.
> 
> I was assuming we would use one mfd-child(-platform)-device for this,
> not two. I guess that with 2 devices you're right and there should
> not be any problem, still as said it feels wrong-ish to have 2 drivers
> poking bits 0-2 of reg 0x90 / reg 0x92.

Note that the PIO is built on the same model and it works, while we
have 3 drivers in one. The only reason why we have everything linked
to the same device is because we have to share the address space, but
regmap takes care of that here.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-22  7:22           ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-22  7:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Mar 09, 2016 at 04:44:01PM +0100, Hans de Goede wrote:
> Hi,
> 
> On 09-03-16 16:28, Maxime Ripard wrote:
> >Hi,
> >
> >On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
> >>Hi,
> >>
> >>On 09-03-16 11:50, Maxime Ripard wrote:
> >>>Hi,
> >>>
> >>>The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
> >>>of GPIOs accessible. Some boards use these to control their backlight
> >>>or a few LEDs.
> >>
> >>Thanks for working on this, but IMHO this cannot go upstream like this,
> >>the gpio pins on the axp pmics need a pinctrl driver, not a gpio
> >>driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
> >>an additional low-noise ldo (so as a regulator), or as an adc input.
> >
> >Eventually, yes, it needs both. But they don't even have to be the
> >same driver, since they provide two different features. The only
> >reason we have that construct in the pio case is because they share
> >the same address space, but in the AXP case, the regmap and our mfd
> >take care of that already.
> 
> Hmm, so your suggesting to have mfd instantiate 2 platform devices
> for this, a gpio and a pinctrl device, each with their own
> driver. Yes that would work, but I'm a bit worried about the 2
> racing or some such since they both will end up touching
> bit 0-2 of register 0x90 / 0x92, more-over since they are both
> touching the exact same bits I've the feeling that this really
> should be one driver.

I don't think that's an issue. We basically have two cases here:
either we have a driver using the pin or not.

If we have a driver using it, then pinctrl will make sure we have an
exclusive use of the pin, before the gpio is requested and we start
changing that value. If not, then no one cares anyway.

> 
> I guess that in a proper written dts we either use pinctrl to enable
> a special function, or gpio, but still.
> 
> >>I've been working on gsl1680 touchscreen support lately and on at least
> >>a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
> >>controller.
> >
> >Yeah, the AXP209 also has an ADC connected to these pins.
> >
> >>Now these use an axp223 pmic, but nothing is stopping someone from
> >>doing something similar with an axp209 and I think it would be best
> >>to support this from day one, rather then hope we can retro-fit this
> >>later without breaking dts.
> >
> >I considered that, but I don't see how it would break the DT later. If
> >someone wants to enable say the ADC, he will of course have to add the
> >pinctrl driver, and the pinctrl handles, but the old DT will only
> >reference the gpio driver directly, which would still be something
> >that would work.
> 
> I was assuming we would use one mfd-child(-platform)-device for this,
> not two. I guess that with 2 devices you're right and there should
> not be any problem, still as said it feels wrong-ish to have 2 drivers
> poking bits 0-2 of reg 0x90 / reg 0x92.

Note that the PIO is built on the same model and it works, while we
have 3 drivers in one. The only reason why we have everything linked
to the same device is because we have to share the address space, but
regmap takes care of that here.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160322/68957dcb/attachment.sig>

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: Re: [PATCH 0/4] Add AXP209 GPIO driver
  2016-03-22  7:22           ` Maxime Ripard
  (?)
@ 2016-03-22  7:33             ` Chen-Yu Tsai
  -1 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-03-22  7:33 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Hans de Goede, Linus Walleij, Alexandre Courbot, Lee Jones,
	Chen-Yu Tsai, devicetree, linux-arm-kernel,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, linux-kernel, linux-sunxi

Hi,

On Tue, Mar 22, 2016 at 3:22 PM, Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> Hi,
>
> On Wed, Mar 09, 2016 at 04:44:01PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 09-03-16 16:28, Maxime Ripard wrote:
>> >Hi,
>> >
>> >On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>> >>Hi,
>> >>
>> >>On 09-03-16 11:50, Maxime Ripard wrote:
>> >>>Hi,
>> >>>
>> >>>The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
>> >>>of GPIOs accessible. Some boards use these to control their backlight
>> >>>or a few LEDs.
>> >>
>> >>Thanks for working on this, but IMHO this cannot go upstream like this,
>> >>the gpio pins on the axp pmics need a pinctrl driver, not a gpio
>> >>driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
>> >>an additional low-noise ldo (so as a regulator), or as an adc input.
>> >
>> >Eventually, yes, it needs both. But they don't even have to be the
>> >same driver, since they provide two different features. The only
>> >reason we have that construct in the pio case is because they share
>> >the same address space, but in the AXP case, the regmap and our mfd
>> >take care of that already.
>>
>> Hmm, so your suggesting to have mfd instantiate 2 platform devices
>> for this, a gpio and a pinctrl device, each with their own
>> driver. Yes that would work, but I'm a bit worried about the 2
>> racing or some such since they both will end up touching
>> bit 0-2 of register 0x90 / 0x92, more-over since they are both
>> touching the exact same bits I've the feeling that this really
>> should be one driver.
>
> I don't think that's an issue. We basically have two cases here:
> either we have a driver using the pin or not.
>
> If we have a driver using it, then pinctrl will make sure we have an
> exclusive use of the pin, before the gpio is requested and we start
> changing that value. If not, then no one cares anyway.

AFAIK pinctrl binding happens before probe time, and is tied to the
DT. Each driver requesting pins would have to have a separate node.
Seems like there isn't one for the regulators.

Or we'd have to manually configure them for each regulator that needs
them, and list the relevant pinctrl properties under its own node.
One "on" and "off" setting pair for each LDO_IO regulator. We could
then tie the settings to the regulator device, not the underlying
mfd sub-device.

ChenYu

>>
>> I guess that in a proper written dts we either use pinctrl to enable
>> a special function, or gpio, but still.
>>
>> >>I've been working on gsl1680 touchscreen support lately and on at least
>> >>a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
>> >>controller.
>> >
>> >Yeah, the AXP209 also has an ADC connected to these pins.
>> >
>> >>Now these use an axp223 pmic, but nothing is stopping someone from
>> >>doing something similar with an axp209 and I think it would be best
>> >>to support this from day one, rather then hope we can retro-fit this
>> >>later without breaking dts.
>> >
>> >I considered that, but I don't see how it would break the DT later. If
>> >someone wants to enable say the ADC, he will of course have to add the
>> >pinctrl driver, and the pinctrl handles, but the old DT will only
>> >reference the gpio driver directly, which would still be something
>> >that would work.
>>
>> I was assuming we would use one mfd-child(-platform)-device for this,
>> not two. I guess that with 2 devices you're right and there should
>> not be any problem, still as said it feels wrong-ish to have 2 drivers
>> poking bits 0-2 of reg 0x90 / reg 0x92.
>
> Note that the PIO is built on the same model and it works, while we
> have 3 drivers in one. The only reason why we have everything linked
> to the same device is because we have to share the address space, but
> regmap takes care of that here.
>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-22  7:33             ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-03-22  7:33 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Hans de Goede, Linus Walleij, Alexandre Courbot, Lee Jones,
	Chen-Yu Tsai, devicetree, linux-arm-kernel, linux-gpio,
	linux-kernel, linux-sunxi

Hi,

On Tue, Mar 22, 2016 at 3:22 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Wed, Mar 09, 2016 at 04:44:01PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 09-03-16 16:28, Maxime Ripard wrote:
>> >Hi,
>> >
>> >On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>> >>Hi,
>> >>
>> >>On 09-03-16 11:50, Maxime Ripard wrote:
>> >>>Hi,
>> >>>
>> >>>The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
>> >>>of GPIOs accessible. Some boards use these to control their backlight
>> >>>or a few LEDs.
>> >>
>> >>Thanks for working on this, but IMHO this cannot go upstream like this,
>> >>the gpio pins on the axp pmics need a pinctrl driver, not a gpio
>> >>driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
>> >>an additional low-noise ldo (so as a regulator), or as an adc input.
>> >
>> >Eventually, yes, it needs both. But they don't even have to be the
>> >same driver, since they provide two different features. The only
>> >reason we have that construct in the pio case is because they share
>> >the same address space, but in the AXP case, the regmap and our mfd
>> >take care of that already.
>>
>> Hmm, so your suggesting to have mfd instantiate 2 platform devices
>> for this, a gpio and a pinctrl device, each with their own
>> driver. Yes that would work, but I'm a bit worried about the 2
>> racing or some such since they both will end up touching
>> bit 0-2 of register 0x90 / 0x92, more-over since they are both
>> touching the exact same bits I've the feeling that this really
>> should be one driver.
>
> I don't think that's an issue. We basically have two cases here:
> either we have a driver using the pin or not.
>
> If we have a driver using it, then pinctrl will make sure we have an
> exclusive use of the pin, before the gpio is requested and we start
> changing that value. If not, then no one cares anyway.

AFAIK pinctrl binding happens before probe time, and is tied to the
DT. Each driver requesting pins would have to have a separate node.
Seems like there isn't one for the regulators.

Or we'd have to manually configure them for each regulator that needs
them, and list the relevant pinctrl properties under its own node.
One "on" and "off" setting pair for each LDO_IO regulator. We could
then tie the settings to the regulator device, not the underlying
mfd sub-device.

ChenYu

>>
>> I guess that in a proper written dts we either use pinctrl to enable
>> a special function, or gpio, but still.
>>
>> >>I've been working on gsl1680 touchscreen support lately and on at least
>> >>a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
>> >>controller.
>> >
>> >Yeah, the AXP209 also has an ADC connected to these pins.
>> >
>> >>Now these use an axp223 pmic, but nothing is stopping someone from
>> >>doing something similar with an axp209 and I think it would be best
>> >>to support this from day one, rather then hope we can retro-fit this
>> >>later without breaking dts.
>> >
>> >I considered that, but I don't see how it would break the DT later. If
>> >someone wants to enable say the ADC, he will of course have to add the
>> >pinctrl driver, and the pinctrl handles, but the old DT will only
>> >reference the gpio driver directly, which would still be something
>> >that would work.
>>
>> I was assuming we would use one mfd-child(-platform)-device for this,
>> not two. I guess that with 2 devices you're right and there should
>> not be any problem, still as said it feels wrong-ish to have 2 drivers
>> poking bits 0-2 of reg 0x90 / reg 0x92.
>
> Note that the PIO is built on the same model and it works, while we
> have 3 drivers in one. The only reason why we have everything linked
> to the same device is because we have to share the address space, but
> regmap takes care of that here.
>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver
@ 2016-03-22  7:33             ` Chen-Yu Tsai
  0 siblings, 0 replies; 63+ messages in thread
From: Chen-Yu Tsai @ 2016-03-22  7:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Tue, Mar 22, 2016 at 3:22 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Wed, Mar 09, 2016 at 04:44:01PM +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 09-03-16 16:28, Maxime Ripard wrote:
>> >Hi,
>> >
>> >On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote:
>> >>Hi,
>> >>
>> >>On 09-03-16 11:50, Maxime Ripard wrote:
>> >>>Hi,
>> >>>
>> >>>The axp209 PMIC used in combination to some Allwinner SoCs has a bunch
>> >>>of GPIOs accessible. Some boards use these to control their backlight
>> >>>or a few LEDs.
>> >>
>> >>Thanks for working on this, but IMHO this cannot go upstream like this,
>> >>the gpio pins on the axp pmics need a pinctrl driver, not a gpio
>> >>driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output
>> >>an additional low-noise ldo (so as a regulator), or as an adc input.
>> >
>> >Eventually, yes, it needs both. But they don't even have to be the
>> >same driver, since they provide two different features. The only
>> >reason we have that construct in the pio case is because they share
>> >the same address space, but in the AXP case, the regmap and our mfd
>> >take care of that already.
>>
>> Hmm, so your suggesting to have mfd instantiate 2 platform devices
>> for this, a gpio and a pinctrl device, each with their own
>> driver. Yes that would work, but I'm a bit worried about the 2
>> racing or some such since they both will end up touching
>> bit 0-2 of register 0x90 / 0x92, more-over since they are both
>> touching the exact same bits I've the feeling that this really
>> should be one driver.
>
> I don't think that's an issue. We basically have two cases here:
> either we have a driver using the pin or not.
>
> If we have a driver using it, then pinctrl will make sure we have an
> exclusive use of the pin, before the gpio is requested and we start
> changing that value. If not, then no one cares anyway.

AFAIK pinctrl binding happens before probe time, and is tied to the
DT. Each driver requesting pins would have to have a separate node.
Seems like there isn't one for the regulators.

Or we'd have to manually configure them for each regulator that needs
them, and list the relevant pinctrl properties under its own node.
One "on" and "off" setting pair for each LDO_IO regulator. We could
then tie the settings to the regulator device, not the underlying
mfd sub-device.

ChenYu

>>
>> I guess that in a proper written dts we either use pinctrl to enable
>> a special function, or gpio, but still.
>>
>> >>I've been working on gsl1680 touchscreen support lately and on at least
>> >>a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen
>> >>controller.
>> >
>> >Yeah, the AXP209 also has an ADC connected to these pins.
>> >
>> >>Now these use an axp223 pmic, but nothing is stopping someone from
>> >>doing something similar with an axp209 and I think it would be best
>> >>to support this from day one, rather then hope we can retro-fit this
>> >>later without breaking dts.
>> >
>> >I considered that, but I don't see how it would break the DT later. If
>> >someone wants to enable say the ADC, he will of course have to add the
>> >pinctrl driver, and the pinctrl handles, but the old DT will only
>> >reference the gpio driver directly, which would still be something
>> >that would work.
>>
>> I was assuming we would use one mfd-child(-platform)-device for this,
>> not two. I guess that with 2 devices you're right and there should
>> not be any problem, still as said it feels wrong-ish to have 2 drivers
>> poking bits 0-2 of reg 0x90 / reg 0x92.
>
> Note that the PIO is built on the same model and it works, while we
> have 3 drivers in one. The only reason why we have everything linked
> to the same device is because we have to share the address space, but
> regmap takes care of that here.
>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
  2016-03-21 11:54         ` Lee Jones
  (?)
@ 2016-03-29  9:58           ` Maxime Ripard
  -1 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-29  9:58 UTC (permalink / raw)
  To: Lee Jones
  Cc: Linus Walleij, Alexandre Courbot, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

Hi Lee,

On Mon, Mar 21, 2016 at 11:54:10AM +0000, Lee Jones wrote:
> On Wed, 09 Mar 2016, Maxime Ripard wrote:
> 
> > Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > ---
> >  drivers/mfd/axp20x.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Applied, thanks.

There's still some discussions about the whole design of the driver,
can you drop that patch for now?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-29  9:58           ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-29  9:58 UTC (permalink / raw)
  To: Lee Jones
  Cc: Linus Walleij, Alexandre Courbot, Chen-Yu Tsai, devicetree,
	linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi,
	Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

Hi Lee,

On Mon, Mar 21, 2016 at 11:54:10AM +0000, Lee Jones wrote:
> On Wed, 09 Mar 2016, Maxime Ripard wrote:
> 
> > Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/mfd/axp20x.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Applied, thanks.

There's still some discussions about the whole design of the driver,
can you drop that patch for now?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-29  9:58           ` Maxime Ripard
  0 siblings, 0 replies; 63+ messages in thread
From: Maxime Ripard @ 2016-03-29  9:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Lee,

On Mon, Mar 21, 2016 at 11:54:10AM +0000, Lee Jones wrote:
> On Wed, 09 Mar 2016, Maxime Ripard wrote:
> 
> > Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> > 
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/mfd/axp20x.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Applied, thanks.

There's still some discussions about the whole design of the driver,
can you drop that patch for now?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160329/f10cc88c/attachment.sig>

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
  2016-03-29  9:58           ` Maxime Ripard
  (?)
@ 2016-03-29 10:10             ` Lee Jones
  -1 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-03-29 10:10 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Chen-Yu Tsai,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede

On Tue, 29 Mar 2016, Maxime Ripard wrote:

> Hi Lee,
> 
> On Mon, Mar 21, 2016 at 11:54:10AM +0000, Lee Jones wrote:
> > On Wed, 09 Mar 2016, Maxime Ripard wrote:
> > 
> > > Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> > > 
> > > Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > > ---
> > >  drivers/mfd/axp20x.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > 
> > Applied, thanks.
> 
> There's still some discussions about the whole design of the driver,
> can you drop that patch for now?

Sure.  Done.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 63+ messages in thread

* Re: [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-29 10:10             ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-03-29 10:10 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Linus Walleij, Alexandre Courbot, Chen-Yu Tsai, devicetree,
	linux-arm-kernel, linux-gpio, linux-kernel, linux-sunxi,
	Hans de Goede

On Tue, 29 Mar 2016, Maxime Ripard wrote:

> Hi Lee,
> 
> On Mon, Mar 21, 2016 at 11:54:10AM +0000, Lee Jones wrote:
> > On Wed, 09 Mar 2016, Maxime Ripard wrote:
> > 
> > > Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> > > 
> > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > ---
> > >  drivers/mfd/axp20x.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > 
> > Applied, thanks.
> 
> There's still some discussions about the whole design of the driver,
> can you drop that patch for now?

Sure.  Done.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 63+ messages in thread

* [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd
@ 2016-03-29 10:10             ` Lee Jones
  0 siblings, 0 replies; 63+ messages in thread
From: Lee Jones @ 2016-03-29 10:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 29 Mar 2016, Maxime Ripard wrote:

> Hi Lee,
> 
> On Mon, Mar 21, 2016 at 11:54:10AM +0000, Lee Jones wrote:
> > On Wed, 09 Mar 2016, Maxime Ripard wrote:
> > 
> > > Now that we have a GPIO driver for the AXP209, we can add it to our MFD.
> > > 
> > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > ---
> > >  drivers/mfd/axp20x.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > 
> > Applied, thanks.
> 
> There's still some discussions about the whole design of the driver,
> can you drop that patch for now?

Sure.  Done.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 63+ messages in thread

end of thread, other threads:[~2016-03-29 10:10 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 10:50 [PATCH 0/4] Add AXP209 GPIO driver Maxime Ripard
2016-03-09 10:50 ` Maxime Ripard
2016-03-09 10:50 ` Maxime Ripard
     [not found] ` <1457520614-32239-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-09 10:50   ` [PATCH 1/4] gpio: " Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
     [not found]     ` <1457520614-32239-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-09 13:07       ` kbuild test robot
2016-03-09 13:07         ` kbuild test robot
2016-03-09 13:07         ` kbuild test robot
2016-03-09 13:20       ` Peter Korsgaard
2016-03-09 13:20         ` [linux-sunxi] " Peter Korsgaard
2016-03-09 13:20         ` Peter Korsgaard
     [not found]         ` <87io0v23fz.fsf-D6SC8u56vOOJDPpyT6T3/w@public.gmane.org>
2016-03-16  9:57           ` Linus Walleij
2016-03-16  9:57             ` Linus Walleij
2016-03-16  9:57             ` Linus Walleij
2016-03-16  9:56       ` Linus Walleij
2016-03-16  9:56         ` Linus Walleij
2016-03-16  9:56         ` Linus Walleij
2016-03-17 19:10       ` Rob Herring
2016-03-17 19:10         ` Rob Herring
2016-03-17 19:10         ` Rob Herring
2016-03-09 10:50   ` [PATCH 2/4] mfd: axp20x: Add AXP209 GPIO driver to the mfd Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
     [not found]     ` <1457520614-32239-3-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-16 10:03       ` Linus Walleij
2016-03-16 10:03         ` Linus Walleij
2016-03-16 10:03         ` Linus Walleij
2016-03-21 11:54       ` Lee Jones
2016-03-21 11:54         ` Lee Jones
2016-03-21 11:54         ` Lee Jones
2016-03-29  9:58         ` Maxime Ripard
2016-03-29  9:58           ` Maxime Ripard
2016-03-29  9:58           ` Maxime Ripard
2016-03-29 10:10           ` Lee Jones
2016-03-29 10:10             ` Lee Jones
2016-03-29 10:10             ` Lee Jones
2016-03-09 10:50   ` [PATCH 3/4] ARM: dt: axp209: Add AXP209 GPIO driver Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
     [not found]     ` <1457520614-32239-4-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-16 10:04       ` Linus Walleij
2016-03-16 10:04         ` Linus Walleij
2016-03-16 10:04         ` Linus Walleij
2016-03-09 10:50   ` [PATCH 4/4] ARM: sun5i: chip: Add status LED Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
2016-03-09 10:50     ` Maxime Ripard
2016-03-09 12:17 ` [PATCH 0/4] Add AXP209 GPIO driver Hans de Goede
2016-03-09 12:17   ` Hans de Goede
     [not found]   ` <56E0146E.6050102-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-09 15:28     ` Maxime Ripard
2016-03-09 15:28       ` Maxime Ripard
2016-03-09 15:28       ` Maxime Ripard
2016-03-09 15:44       ` [linux-sunxi] " Hans de Goede
2016-03-09 15:44         ` Hans de Goede
     [not found]         ` <56E044C1.7080300-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-16 10:10           ` Linus Walleij
2016-03-16 10:10             ` Linus Walleij
2016-03-16 10:10             ` Linus Walleij
2016-03-16 10:38             ` Hans de Goede
2016-03-16 10:38               ` Hans de Goede
2016-03-16 10:38               ` Hans de Goede
2016-03-22  7:22         ` Maxime Ripard
2016-03-22  7:22           ` Maxime Ripard
2016-03-22  7:33           ` Chen-Yu Tsai
2016-03-22  7:33             ` [linux-sunxi] " Chen-Yu Tsai
2016-03-22  7:33             ` Chen-Yu Tsai

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.