All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] mfd: wm831x: Add basic device tree binding
@ 2017-02-13 11:15 ` Charles Keepax
  0 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-13 11:15 UTC (permalink / raw)
  To: lee.jones
  Cc: robh+dt, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

Add the basic ability to register the device through device tree, more
work is needed to get each individual sub-driver functioning correctly
but this is enough to get the device to probe from device tree.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Moved MAINTAINERS update to the binding patch
 - Fixed a warning on 64-bit architectures

 drivers/mfd/wm831x-core.c       | 32 +++++++++++++++++++++++++++++++-
 drivers/mfd/wm831x-i2c.c        |  9 ++++++++-
 drivers/mfd/wm831x-irq.c        |  6 +++---
 drivers/mfd/wm831x-spi.c        |  6 +++++-
 include/linux/mfd/wm831x/core.h | 15 +++++++++++++++
 5 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 3e0e99e..21d3cdd 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -19,6 +19,8 @@
 #include <linux/mfd/core.h>
 #include <linux/slab.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <linux/mfd/wm831x/core.h>
 #include <linux/mfd/wm831x/pdata.h>
@@ -1613,6 +1615,31 @@ struct regmap_config wm831x_regmap_config = {
 };
 EXPORT_SYMBOL_GPL(wm831x_regmap_config);
 
+#ifdef CONFIG_OF
+const struct of_device_id wm831x_of_match[] = {
+	{ .compatible = "wlf,wm8310", .data = (void *)WM8310 },
+	{ .compatible = "wlf,wm8311", .data = (void *)WM8311 },
+	{ .compatible = "wlf,wm8312", .data = (void *)WM8312 },
+	{ .compatible = "wlf,wm8320", .data = (void *)WM8320 },
+	{ .compatible = "wlf,wm8321", .data = (void *)WM8321 },
+	{ .compatible = "wlf,wm8325", .data = (void *)WM8325 },
+	{ .compatible = "wlf,wm8326", .data = (void *)WM8326 },
+	{ },
+};
+EXPORT_SYMBOL_GPL(wm831x_of_match);
+
+int wm831x_of_get_type(struct device *dev)
+{
+	const struct of_device_id *id = of_match_device(wm831x_of_match, dev);
+
+	if (id)
+		return (unsigned long)id->data;
+	else
+		return 0;
+}
+EXPORT_SYMBOL_GPL(wm831x_of_get_type);
+#endif
+
 /*
  * Instantiate the generic non-control parts of the device.
  */
@@ -1628,7 +1655,10 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
 	dev_set_drvdata(wm831x->dev, wm831x);
 
 	if (pdata)
-		wm831x->soft_shutdown = pdata->soft_shutdown;
+		memcpy(&wm831x->pdata, pdata, sizeof(*pdata));
+	pdata = &wm831x->pdata;
+
+	wm831x->soft_shutdown = pdata->soft_shutdown;
 
 	ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID);
 	if (ret < 0) {
diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 824bcba..b2acd92 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -28,8 +28,14 @@ static int wm831x_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
 	struct wm831x *wm831x;
+	enum wm831x_parent type;
 	int ret;
 
+	if (i2c->dev.of_node)
+		type = (enum wm831x_parent)wm831x_of_get_type(&i2c->dev);
+	else
+		type = (enum wm831x_parent)id->driver_data;
+
 	wm831x = devm_kzalloc(&i2c->dev, sizeof(struct wm831x), GFP_KERNEL);
 	if (wm831x == NULL)
 		return -ENOMEM;
@@ -45,7 +51,7 @@ static int wm831x_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	return wm831x_device_init(wm831x, id->driver_data, i2c->irq);
+	return wm831x_device_init(wm831x, type, i2c->irq);
 }
 
 static int wm831x_i2c_remove(struct i2c_client *i2c)
@@ -94,6 +100,7 @@ static struct i2c_driver wm831x_i2c_driver = {
 	.driver = {
 		.name = "wm831x",
 		.pm = &wm831x_pm_ops,
+		.of_match_table = of_match_ptr(wm831x_of_match),
 	},
 	.probe = wm831x_i2c_probe,
 	.remove = wm831x_i2c_remove,
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c
index dfea8b9..c01239a 100644
--- a/drivers/mfd/wm831x-irq.c
+++ b/drivers/mfd/wm831x-irq.c
@@ -564,7 +564,7 @@ static const struct irq_domain_ops wm831x_irq_domain_ops = {
 
 int wm831x_irq_init(struct wm831x *wm831x, int irq)
 {
-	struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev);
+	struct wm831x_pdata *pdata = &wm831x->pdata;
 	struct irq_domain *domain;
 	int i, ret, irq_base;
 
@@ -579,7 +579,7 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
 	}
 
 	/* Try to dynamically allocate IRQs if no base is specified */
-	if (pdata && pdata->irq_base) {
+	if (pdata->irq_base) {
 		irq_base = irq_alloc_descs(pdata->irq_base, 0,
 					   WM831X_NUM_IRQS, 0);
 		if (irq_base < 0) {
@@ -608,7 +608,7 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
 		return -EINVAL;
 	}
 
-	if (pdata && pdata->irq_cmos)
+	if (pdata->irq_cmos)
 		i = 0;
 	else
 		i = WM831X_IRQ_OD;
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 80482ae..44c6eec 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -28,7 +28,10 @@ static int wm831x_spi_probe(struct spi_device *spi)
 	enum wm831x_parent type;
 	int ret;
 
-	type = (enum wm831x_parent)id->driver_data;
+	if (spi->dev.of_node)
+		type = (enum wm831x_parent)wm831x_of_get_type(&spi->dev);
+	else
+		type = (enum wm831x_parent)id->driver_data;
 
 	wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
 	if (wm831x == NULL)
@@ -97,6 +100,7 @@ static struct spi_driver wm831x_spi_driver = {
 	.driver = {
 		.name	= "wm831x",
 		.pm	= &wm831x_spi_pm,
+		.of_match_table = of_match_ptr(wm831x_of_match),
 	},
 	.id_table	= wm831x_spi_ids,
 	.probe		= wm831x_spi_probe,
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 76c2264..752a722 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -21,6 +21,8 @@
 #include <linux/list.h>
 #include <linux/regmap.h>
 #include <linux/mfd/wm831x/auxadc.h>
+#include <linux/mfd/wm831x/pdata.h>
+#include <linux/of.h>
 
 /*
  * Register values.
@@ -367,6 +369,8 @@ struct wm831x {
 
 	struct regmap *regmap;
 
+	struct wm831x_pdata pdata;
+
 	int irq;  /* Our chip IRQ */
 	struct mutex irq_lock;
 	struct irq_domain *irq_domain;
@@ -427,4 +431,15 @@ static inline int wm831x_irq(struct wm831x *wm831x, int irq)
 
 extern struct regmap_config wm831x_regmap_config;
 
+extern const struct of_device_id wm831x_of_match[];
+
+#ifdef CONFIG_OF
+int wm831x_of_get_type(struct device *dev);
+#else
+static inline int wm831x_of_get_type(struct device *dev)
+{
+	return 0;
+}
+#endif
+
 #endif
-- 
2.1.4

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

* [PATCH v2 1/3] mfd: wm831x: Add basic device tree binding
@ 2017-02-13 11:15 ` Charles Keepax
  0 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-13 11:15 UTC (permalink / raw)
  To: lee.jones
  Cc: robh+dt, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

Add the basic ability to register the device through device tree, more
work is needed to get each individual sub-driver functioning correctly
but this is enough to get the device to probe from device tree.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Moved MAINTAINERS update to the binding patch
 - Fixed a warning on 64-bit architectures

 drivers/mfd/wm831x-core.c       | 32 +++++++++++++++++++++++++++++++-
 drivers/mfd/wm831x-i2c.c        |  9 ++++++++-
 drivers/mfd/wm831x-irq.c        |  6 +++---
 drivers/mfd/wm831x-spi.c        |  6 +++++-
 include/linux/mfd/wm831x/core.h | 15 +++++++++++++++
 5 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 3e0e99e..21d3cdd 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -19,6 +19,8 @@
 #include <linux/mfd/core.h>
 #include <linux/slab.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <linux/mfd/wm831x/core.h>
 #include <linux/mfd/wm831x/pdata.h>
@@ -1613,6 +1615,31 @@ struct regmap_config wm831x_regmap_config = {
 };
 EXPORT_SYMBOL_GPL(wm831x_regmap_config);
 
+#ifdef CONFIG_OF
+const struct of_device_id wm831x_of_match[] = {
+	{ .compatible = "wlf,wm8310", .data = (void *)WM8310 },
+	{ .compatible = "wlf,wm8311", .data = (void *)WM8311 },
+	{ .compatible = "wlf,wm8312", .data = (void *)WM8312 },
+	{ .compatible = "wlf,wm8320", .data = (void *)WM8320 },
+	{ .compatible = "wlf,wm8321", .data = (void *)WM8321 },
+	{ .compatible = "wlf,wm8325", .data = (void *)WM8325 },
+	{ .compatible = "wlf,wm8326", .data = (void *)WM8326 },
+	{ },
+};
+EXPORT_SYMBOL_GPL(wm831x_of_match);
+
+int wm831x_of_get_type(struct device *dev)
+{
+	const struct of_device_id *id = of_match_device(wm831x_of_match, dev);
+
+	if (id)
+		return (unsigned long)id->data;
+	else
+		return 0;
+}
+EXPORT_SYMBOL_GPL(wm831x_of_get_type);
+#endif
+
 /*
  * Instantiate the generic non-control parts of the device.
  */
@@ -1628,7 +1655,10 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
 	dev_set_drvdata(wm831x->dev, wm831x);
 
 	if (pdata)
-		wm831x->soft_shutdown = pdata->soft_shutdown;
+		memcpy(&wm831x->pdata, pdata, sizeof(*pdata));
+	pdata = &wm831x->pdata;
+
+	wm831x->soft_shutdown = pdata->soft_shutdown;
 
 	ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID);
 	if (ret < 0) {
diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 824bcba..b2acd92 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -28,8 +28,14 @@ static int wm831x_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
 	struct wm831x *wm831x;
+	enum wm831x_parent type;
 	int ret;
 
+	if (i2c->dev.of_node)
+		type = (enum wm831x_parent)wm831x_of_get_type(&i2c->dev);
+	else
+		type = (enum wm831x_parent)id->driver_data;
+
 	wm831x = devm_kzalloc(&i2c->dev, sizeof(struct wm831x), GFP_KERNEL);
 	if (wm831x == NULL)
 		return -ENOMEM;
@@ -45,7 +51,7 @@ static int wm831x_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	return wm831x_device_init(wm831x, id->driver_data, i2c->irq);
+	return wm831x_device_init(wm831x, type, i2c->irq);
 }
 
 static int wm831x_i2c_remove(struct i2c_client *i2c)
@@ -94,6 +100,7 @@ static struct i2c_driver wm831x_i2c_driver = {
 	.driver = {
 		.name = "wm831x",
 		.pm = &wm831x_pm_ops,
+		.of_match_table = of_match_ptr(wm831x_of_match),
 	},
 	.probe = wm831x_i2c_probe,
 	.remove = wm831x_i2c_remove,
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c
index dfea8b9..c01239a 100644
--- a/drivers/mfd/wm831x-irq.c
+++ b/drivers/mfd/wm831x-irq.c
@@ -564,7 +564,7 @@ static const struct irq_domain_ops wm831x_irq_domain_ops = {
 
 int wm831x_irq_init(struct wm831x *wm831x, int irq)
 {
-	struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev);
+	struct wm831x_pdata *pdata = &wm831x->pdata;
 	struct irq_domain *domain;
 	int i, ret, irq_base;
 
@@ -579,7 +579,7 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
 	}
 
 	/* Try to dynamically allocate IRQs if no base is specified */
-	if (pdata && pdata->irq_base) {
+	if (pdata->irq_base) {
 		irq_base = irq_alloc_descs(pdata->irq_base, 0,
 					   WM831X_NUM_IRQS, 0);
 		if (irq_base < 0) {
@@ -608,7 +608,7 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq)
 		return -EINVAL;
 	}
 
-	if (pdata && pdata->irq_cmos)
+	if (pdata->irq_cmos)
 		i = 0;
 	else
 		i = WM831X_IRQ_OD;
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 80482ae..44c6eec 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -28,7 +28,10 @@ static int wm831x_spi_probe(struct spi_device *spi)
 	enum wm831x_parent type;
 	int ret;
 
-	type = (enum wm831x_parent)id->driver_data;
+	if (spi->dev.of_node)
+		type = (enum wm831x_parent)wm831x_of_get_type(&spi->dev);
+	else
+		type = (enum wm831x_parent)id->driver_data;
 
 	wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
 	if (wm831x == NULL)
@@ -97,6 +100,7 @@ static struct spi_driver wm831x_spi_driver = {
 	.driver = {
 		.name	= "wm831x",
 		.pm	= &wm831x_spi_pm,
+		.of_match_table = of_match_ptr(wm831x_of_match),
 	},
 	.id_table	= wm831x_spi_ids,
 	.probe		= wm831x_spi_probe,
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 76c2264..752a722 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -21,6 +21,8 @@
 #include <linux/list.h>
 #include <linux/regmap.h>
 #include <linux/mfd/wm831x/auxadc.h>
+#include <linux/mfd/wm831x/pdata.h>
+#include <linux/of.h>
 
 /*
  * Register values.
@@ -367,6 +369,8 @@ struct wm831x {
 
 	struct regmap *regmap;
 
+	struct wm831x_pdata pdata;
+
 	int irq;  /* Our chip IRQ */
 	struct mutex irq_lock;
 	struct irq_domain *irq_domain;
@@ -427,4 +431,15 @@ static inline int wm831x_irq(struct wm831x *wm831x, int irq)
 
 extern struct regmap_config wm831x_regmap_config;
 
+extern const struct of_device_id wm831x_of_match[];
+
+#ifdef CONFIG_OF
+int wm831x_of_get_type(struct device *dev);
+#else
+static inline int wm831x_of_get_type(struct device *dev)
+{
+	return 0;
+}
+#endif
+
 #endif
-- 
2.1.4

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

* [PATCH v2 2/3] gpio: wm831x: Add basic device tree support
  2017-02-13 11:15 ` Charles Keepax
@ 2017-02-13 11:15   ` Charles Keepax
  -1 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-13 11:15 UTC (permalink / raw)
  To: lee.jones
  Cc: robh+dt, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

Now the wm831x-core has basic DT support we can update this driver to
allow use of the GPIOs within a device tree system.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

No changes since v1.

 drivers/gpio/gpio-wm831x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
index 533707f..110453c7 100644
--- a/drivers/gpio/gpio-wm831x.c
+++ b/drivers/gpio/gpio-wm831x.c
@@ -264,7 +264,7 @@ static const struct gpio_chip template_chip = {
 static int wm831x_gpio_probe(struct platform_device *pdev)
 {
 	struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
-	struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev);
+	struct wm831x_pdata *pdata = &wm831x->pdata;
 	struct wm831x_gpio *wm831x_gpio;
 	int ret;
 
@@ -281,6 +281,9 @@ static int wm831x_gpio_probe(struct platform_device *pdev)
 		wm831x_gpio->gpio_chip.base = pdata->gpio_base;
 	else
 		wm831x_gpio->gpio_chip.base = -1;
+#ifdef CONFIG_OF_GPIO
+	wm831x_gpio->gpio_chip.of_node = wm831x->dev->of_node;
+#endif
 
 	ret = devm_gpiochip_add_data(&pdev->dev, &wm831x_gpio->gpio_chip,
 				     wm831x_gpio);
-- 
2.1.4

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

* [PATCH v2 2/3] gpio: wm831x: Add basic device tree support
@ 2017-02-13 11:15   ` Charles Keepax
  0 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-13 11:15 UTC (permalink / raw)
  To: lee.jones
  Cc: robh+dt, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

Now the wm831x-core has basic DT support we can update this driver to
allow use of the GPIOs within a device tree system.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

No changes since v1.

 drivers/gpio/gpio-wm831x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c
index 533707f..110453c7 100644
--- a/drivers/gpio/gpio-wm831x.c
+++ b/drivers/gpio/gpio-wm831x.c
@@ -264,7 +264,7 @@ static const struct gpio_chip template_chip = {
 static int wm831x_gpio_probe(struct platform_device *pdev)
 {
 	struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
-	struct wm831x_pdata *pdata = dev_get_platdata(wm831x->dev);
+	struct wm831x_pdata *pdata = &wm831x->pdata;
 	struct wm831x_gpio *wm831x_gpio;
 	int ret;
 
@@ -281,6 +281,9 @@ static int wm831x_gpio_probe(struct platform_device *pdev)
 		wm831x_gpio->gpio_chip.base = pdata->gpio_base;
 	else
 		wm831x_gpio->gpio_chip.base = -1;
+#ifdef CONFIG_OF_GPIO
+	wm831x_gpio->gpio_chip.of_node = wm831x->dev->of_node;
+#endif
 
 	ret = devm_gpiochip_add_data(&pdev->dev, &wm831x_gpio->gpio_chip,
 				     wm831x_gpio);
-- 
2.1.4

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

* [PATCH v2 3/3] mfd: wm831x: Add device tree binding document
  2017-02-13 11:15 ` Charles Keepax
@ 2017-02-13 11:15   ` Charles Keepax
  -1 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-13 11:15 UTC (permalink / raw)
  To: lee.jones
  Cc: robh+dt, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

This is just a very simple initial binding, supporting only registering
the chip and the GPIOs. More features will be added as support for
device tree in the driver is expanded.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Added MAINTAINERS update

 Documentation/devicetree/bindings/mfd/wm831x.txt | 31 ++++++++++++++++++++++++
 MAINTAINERS                                      |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/wm831x.txt

diff --git a/Documentation/devicetree/bindings/mfd/wm831x.txt b/Documentation/devicetree/bindings/mfd/wm831x.txt
new file mode 100644
index 0000000..9771022
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/wm831x.txt
@@ -0,0 +1,31 @@
+Cirrus Logic/Wolfson Microelectronics wm831x PMICs
+
+System PMICs with a wide range of additional features.
+
+Required properties:
+
+  - compatible : One of the following chip-specific strings:
+        "wlf,wm8310"
+        "wlf,wm8311"
+        "wlf,wm8312"
+        "wlf,wm8320"
+        "wlf,wm8321"
+        "wlf,wm8325"
+        "wlf,wm8326"
+
+  - reg : I2C slave address when connected using I2C, chip select number when
+    using SPI.
+
+  - gpio-controller : Indicates this device is a GPIO controller.
+  - #gpio-cells : Must be 2. The first cell is the pin number and the
+    second cell is used to specify optional parameters (currently unused).
+
+Example:
+
+wm8310: wm8310@36 {
+	compatible = "wlf,wm8310";
+	reg = <0x36>;
+
+	gpio-controller;
+	#gpio-cells = <2>;
+};
diff --git a/MAINTAINERS b/MAINTAINERS
index 2d8ca28..48fdc82 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13363,6 +13363,7 @@ F:	Documentation/hwmon/wm83??
 F:	Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 F:	Documentation/devicetree/bindings/regulator/arizona-regulator.txt
 F:	Documentation/devicetree/bindings/mfd/arizona.txt
+F:	Documentation/devicetree/bindings/mfd/wm831x.txt
 F:	arch/arm/mach-s3c64xx/mach-crag6410*
 F:	drivers/clk/clk-wm83*.c
 F:	drivers/extcon/extcon-arizona.c
-- 
2.1.4

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

* [PATCH v2 3/3] mfd: wm831x: Add device tree binding document
@ 2017-02-13 11:15   ` Charles Keepax
  0 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-13 11:15 UTC (permalink / raw)
  To: lee.jones
  Cc: robh+dt, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

This is just a very simple initial binding, supporting only registering
the chip and the GPIOs. More features will be added as support for
device tree in the driver is expanded.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Added MAINTAINERS update

 Documentation/devicetree/bindings/mfd/wm831x.txt | 31 ++++++++++++++++++++++++
 MAINTAINERS                                      |  1 +
 2 files changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/wm831x.txt

diff --git a/Documentation/devicetree/bindings/mfd/wm831x.txt b/Documentation/devicetree/bindings/mfd/wm831x.txt
new file mode 100644
index 0000000..9771022
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/wm831x.txt
@@ -0,0 +1,31 @@
+Cirrus Logic/Wolfson Microelectronics wm831x PMICs
+
+System PMICs with a wide range of additional features.
+
+Required properties:
+
+  - compatible : One of the following chip-specific strings:
+        "wlf,wm8310"
+        "wlf,wm8311"
+        "wlf,wm8312"
+        "wlf,wm8320"
+        "wlf,wm8321"
+        "wlf,wm8325"
+        "wlf,wm8326"
+
+  - reg : I2C slave address when connected using I2C, chip select number when
+    using SPI.
+
+  - gpio-controller : Indicates this device is a GPIO controller.
+  - #gpio-cells : Must be 2. The first cell is the pin number and the
+    second cell is used to specify optional parameters (currently unused).
+
+Example:
+
+wm8310: wm8310@36 {
+	compatible = "wlf,wm8310";
+	reg = <0x36>;
+
+	gpio-controller;
+	#gpio-cells = <2>;
+};
diff --git a/MAINTAINERS b/MAINTAINERS
index 2d8ca28..48fdc82 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13363,6 +13363,7 @@ F:	Documentation/hwmon/wm83??
 F:	Documentation/devicetree/bindings/extcon/extcon-arizona.txt
 F:	Documentation/devicetree/bindings/regulator/arizona-regulator.txt
 F:	Documentation/devicetree/bindings/mfd/arizona.txt
+F:	Documentation/devicetree/bindings/mfd/wm831x.txt
 F:	arch/arm/mach-s3c64xx/mach-crag6410*
 F:	drivers/clk/clk-wm83*.c
 F:	drivers/extcon/extcon-arizona.c
-- 
2.1.4

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

* Re: [PATCH v2 2/3] gpio: wm831x: Add basic device tree support
  2017-02-13 11:15   ` Charles Keepax
@ 2017-02-22 14:35       ` Linus Walleij
  -1 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-02-22 14:35 UTC (permalink / raw)
  To: Charles Keepax
  Cc: Lee Jones, Rob Herring, Mark Rutland, Alexandre Courbot,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	open list:WOLFSON MICROELECTRONICS DRIVERS

On Mon, Feb 13, 2017 at 12:15 PM, Charles Keepax
<ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> wrote:

> Now the wm831x-core has basic DT support we can update this driver to
> allow use of the GPIOs within a device tree system.
>
> Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
> ---
>
> No changes since v1.

Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Is it OK if I merge this separately from the first patch in the series?

Else you need to ask Lee to merge it with my ACK.

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] 14+ messages in thread

* Re: [PATCH v2 2/3] gpio: wm831x: Add basic device tree support
@ 2017-02-22 14:35       ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2017-02-22 14:35 UTC (permalink / raw)
  To: Charles Keepax
  Cc: Lee Jones, Rob Herring, Mark Rutland, Alexandre Courbot,
	devicetree, linux-gpio, linux-kernel,
	open list:WOLFSON MICROELECTRONICS DRIVERS

On Mon, Feb 13, 2017 at 12:15 PM, Charles Keepax
<ckeepax@opensource.wolfsonmicro.com> wrote:

> Now the wm831x-core has basic DT support we can update this driver to
> allow use of the GPIOs within a device tree system.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>
> No changes since v1.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Is it OK if I merge this separately from the first patch in the series?

Else you need to ask Lee to merge it with my ACK.

Yours,
Linus Walleij

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

* Re: [PATCH v2 3/3] mfd: wm831x: Add device tree binding document
  2017-02-13 11:15   ` Charles Keepax
@ 2017-02-22 15:15       ` Rob Herring
  -1 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2017-02-22 15:15 UTC (permalink / raw)
  To: Charles Keepax
  Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E

On Mon, Feb 13, 2017 at 11:15:14AM +0000, Charles Keepax wrote:
> This is just a very simple initial binding, supporting only registering
> the chip and the GPIOs. More features will be added as support for
> device tree in the driver is expanded.

Please make the binding as complete as you can. You don't have to have 
driver side support in place. Doesn't have to be everything, but at 
least everything you know you will need.

> 
> Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
> ---
> 
> Changes since v1:
>  - Added MAINTAINERS update
> 
>  Documentation/devicetree/bindings/mfd/wm831x.txt | 31 ++++++++++++++++++++++++
>  MAINTAINERS                                      |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/wm831x.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/wm831x.txt b/Documentation/devicetree/bindings/mfd/wm831x.txt
> new file mode 100644
> index 0000000..9771022
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/wm831x.txt
> @@ -0,0 +1,31 @@
> +Cirrus Logic/Wolfson Microelectronics wm831x PMICs
> +
> +System PMICs with a wide range of additional features.
> +
> +Required properties:
> +
> +  - compatible : One of the following chip-specific strings:
> +        "wlf,wm8310"
> +        "wlf,wm8311"
> +        "wlf,wm8312"
> +        "wlf,wm8320"
> +        "wlf,wm8321"
> +        "wlf,wm8325"
> +        "wlf,wm8326"
> +
> +  - reg : I2C slave address when connected using I2C, chip select number when
> +    using SPI.
> +
> +  - gpio-controller : Indicates this device is a GPIO controller.
> +  - #gpio-cells : Must be 2. The first cell is the pin number and the
> +    second cell is used to specify optional parameters (currently unused).
> +
> +Example:
> +
> +wm8310: wm8310@36 {

pmic@

> +	compatible = "wlf,wm8310";
> +	reg = <0x36>;
> +
> +	gpio-controller;
> +	#gpio-cells = <2>;
> +};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2d8ca28..48fdc82 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -13363,6 +13363,7 @@ F:	Documentation/hwmon/wm83??
>  F:	Documentation/devicetree/bindings/extcon/extcon-arizona.txt
>  F:	Documentation/devicetree/bindings/regulator/arizona-regulator.txt
>  F:	Documentation/devicetree/bindings/mfd/arizona.txt
> +F:	Documentation/devicetree/bindings/mfd/wm831x.txt
>  F:	arch/arm/mach-s3c64xx/mach-crag6410*
>  F:	drivers/clk/clk-wm83*.c
>  F:	drivers/extcon/extcon-arizona.c
> -- 
> 2.1.4
> 
--
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] 14+ messages in thread

* Re: [PATCH v2 3/3] mfd: wm831x: Add device tree binding document
@ 2017-02-22 15:15       ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2017-02-22 15:15 UTC (permalink / raw)
  To: Charles Keepax
  Cc: lee.jones, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

On Mon, Feb 13, 2017 at 11:15:14AM +0000, Charles Keepax wrote:
> This is just a very simple initial binding, supporting only registering
> the chip and the GPIOs. More features will be added as support for
> device tree in the driver is expanded.

Please make the binding as complete as you can. You don't have to have 
driver side support in place. Doesn't have to be everything, but at 
least everything you know you will need.

> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
> 
> Changes since v1:
>  - Added MAINTAINERS update
> 
>  Documentation/devicetree/bindings/mfd/wm831x.txt | 31 ++++++++++++++++++++++++
>  MAINTAINERS                                      |  1 +
>  2 files changed, 32 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/wm831x.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/wm831x.txt b/Documentation/devicetree/bindings/mfd/wm831x.txt
> new file mode 100644
> index 0000000..9771022
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/wm831x.txt
> @@ -0,0 +1,31 @@
> +Cirrus Logic/Wolfson Microelectronics wm831x PMICs
> +
> +System PMICs with a wide range of additional features.
> +
> +Required properties:
> +
> +  - compatible : One of the following chip-specific strings:
> +        "wlf,wm8310"
> +        "wlf,wm8311"
> +        "wlf,wm8312"
> +        "wlf,wm8320"
> +        "wlf,wm8321"
> +        "wlf,wm8325"
> +        "wlf,wm8326"
> +
> +  - reg : I2C slave address when connected using I2C, chip select number when
> +    using SPI.
> +
> +  - gpio-controller : Indicates this device is a GPIO controller.
> +  - #gpio-cells : Must be 2. The first cell is the pin number and the
> +    second cell is used to specify optional parameters (currently unused).
> +
> +Example:
> +
> +wm8310: wm8310@36 {

pmic@

> +	compatible = "wlf,wm8310";
> +	reg = <0x36>;
> +
> +	gpio-controller;
> +	#gpio-cells = <2>;
> +};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2d8ca28..48fdc82 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -13363,6 +13363,7 @@ F:	Documentation/hwmon/wm83??
>  F:	Documentation/devicetree/bindings/extcon/extcon-arizona.txt
>  F:	Documentation/devicetree/bindings/regulator/arizona-regulator.txt
>  F:	Documentation/devicetree/bindings/mfd/arizona.txt
> +F:	Documentation/devicetree/bindings/mfd/wm831x.txt
>  F:	arch/arm/mach-s3c64xx/mach-crag6410*
>  F:	drivers/clk/clk-wm83*.c
>  F:	drivers/extcon/extcon-arizona.c
> -- 
> 2.1.4
> 

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

* Re: [PATCH v2 2/3] gpio: wm831x: Add basic device tree support
  2017-02-22 14:35       ` Linus Walleij
@ 2017-02-22 16:05           ` Charles Keepax
  -1 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-22 16:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lee Jones, Rob Herring, Mark Rutland, Alexandre Courbot,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	open list:WOLFSON MICROELECTRONICS DRIVERS

On Wed, Feb 22, 2017 at 03:35:26PM +0100, Linus Walleij wrote:
> On Mon, Feb 13, 2017 at 12:15 PM, Charles Keepax
> <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> wrote:
> 
> > Now the wm831x-core has basic DT support we can update this driver to
> > allow use of the GPIOs within a device tree system.
> >
> > Signed-off-by: Charles Keepax <ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
> > ---
> >
> > No changes since v1.
> 
> Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Is it OK if I merge this separately from the first patch in the series?
> 
> Else you need to ask Lee to merge it with my ACK.

Afraid these two need to go in together because of a build
dependency.

Thanks,
Charles
--
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] 14+ messages in thread

* Re: [PATCH v2 2/3] gpio: wm831x: Add basic device tree support
@ 2017-02-22 16:05           ` Charles Keepax
  0 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-22 16:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lee Jones, Rob Herring, Mark Rutland, Alexandre Courbot,
	devicetree, linux-gpio, linux-kernel,
	open list:WOLFSON MICROELECTRONICS DRIVERS

On Wed, Feb 22, 2017 at 03:35:26PM +0100, Linus Walleij wrote:
> On Mon, Feb 13, 2017 at 12:15 PM, Charles Keepax
> <ckeepax@opensource.wolfsonmicro.com> wrote:
> 
> > Now the wm831x-core has basic DT support we can update this driver to
> > allow use of the GPIOs within a device tree system.
> >
> > Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> > ---
> >
> > No changes since v1.
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> Is it OK if I merge this separately from the first patch in the series?
> 
> Else you need to ask Lee to merge it with my ACK.

Afraid these two need to go in together because of a build
dependency.

Thanks,
Charles

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

* Re: [PATCH v2 3/3] mfd: wm831x: Add device tree binding document
  2017-02-22 15:15       ` Rob Herring
@ 2017-02-22 16:09         ` Charles Keepax
  -1 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-22 16:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: lee.jones, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

On Wed, Feb 22, 2017 at 09:15:02AM -0600, Rob Herring wrote:
> On Mon, Feb 13, 2017 at 11:15:14AM +0000, Charles Keepax wrote:
> > This is just a very simple initial binding, supporting only registering
> > the chip and the GPIOs. More features will be added as support for
> > device tree in the driver is expanded.
> 
> Please make the binding as complete as you can. You don't have to have 
> driver side support in place. Doesn't have to be everything, but at 
> least everything you know you will need.
> 

I am happy to flush the binding out with a bit more detail,
although the GPIOs are actually all I need to use at the moment.
I will send a new revision with some more detail. Do we normally
do anything to mark the bits of the binding that are currently
un-implemented?

Thanks,
Charles

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

* Re: [PATCH v2 3/3] mfd: wm831x: Add device tree binding document
@ 2017-02-22 16:09         ` Charles Keepax
  0 siblings, 0 replies; 14+ messages in thread
From: Charles Keepax @ 2017-02-22 16:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: lee.jones, mark.rutland, linus.walleij, gnurou, devicetree,
	linux-gpio, linux-kernel, patches

On Wed, Feb 22, 2017 at 09:15:02AM -0600, Rob Herring wrote:
> On Mon, Feb 13, 2017 at 11:15:14AM +0000, Charles Keepax wrote:
> > This is just a very simple initial binding, supporting only registering
> > the chip and the GPIOs. More features will be added as support for
> > device tree in the driver is expanded.
> 
> Please make the binding as complete as you can. You don't have to have 
> driver side support in place. Doesn't have to be everything, but at 
> least everything you know you will need.
> 

I am happy to flush the binding out with a bit more detail,
although the GPIOs are actually all I need to use at the moment.
I will send a new revision with some more detail. Do we normally
do anything to mark the bits of the binding that are currently
un-implemented?

Thanks,
Charles

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

end of thread, other threads:[~2017-02-22 16:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13 11:15 [PATCH v2 1/3] mfd: wm831x: Add basic device tree binding Charles Keepax
2017-02-13 11:15 ` Charles Keepax
2017-02-13 11:15 ` [PATCH v2 2/3] gpio: wm831x: Add basic device tree support Charles Keepax
2017-02-13 11:15   ` Charles Keepax
     [not found]   ` <1486984514-29749-2-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2017-02-22 14:35     ` Linus Walleij
2017-02-22 14:35       ` Linus Walleij
     [not found]       ` <CACRpkdaHrOTXxjHPHOh78ax7Jv1TuMzsruZfgdb3b+tOHrDhwA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-22 16:05         ` Charles Keepax
2017-02-22 16:05           ` Charles Keepax
2017-02-13 11:15 ` [PATCH v2 3/3] mfd: wm831x: Add device tree binding document Charles Keepax
2017-02-13 11:15   ` Charles Keepax
     [not found]   ` <1486984514-29749-3-git-send-email-ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2017-02-22 15:15     ` Rob Herring
2017-02-22 15:15       ` Rob Herring
2017-02-22 16:09       ` Charles Keepax
2017-02-22 16:09         ` Charles Keepax

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.