All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND v5 0/2] PWM: PXA: add device tree support to PWM driver
@ 2013-09-21 19:19 ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-pwm
  Cc: Marek Vasut, devicetree, Mike Dunn, Pawel Moll, Sergei Shtylyov,
	Stephen Warren, Dmitry Torokhov, Rob Herring, Chao Xie,
	Thierry Reding, Haojian Zhuang, Grant Likely, Mark Rutland,
	Robert Jarzmik, linux-arm-kernel, Ian Campbell

Dang! Sorry, please disregard previous patch set.
RESENDing because previous set did not include the file
Documentation/devicetree/bindings/pwm/pxa-pwm.txt

This is now a patch set because the changes to pxa27x.dtsi have been moved to a
separate patch.  This was done so that it can go through the arm-soc tree.

Changle log:
v5:
- changes to pxa27x.dtsi moved to a separate patch
- minor changes in phrasing made to bindings documentation
- cast removed from void *
- dummy functions for !CONFIG_OF removed; called only if (IS_ENABLED(CONFIG_OF)
- if-else block in pxa_pwm_get_id_dt() replaced with ternary operator

v4:
- add second "compatible" string to pxa27x.dtsi
- change phrasing in binding doc pxa-pwm.txt to "one or more of"

v3:
- remove support for the polarity flag
- remove per-chip pwm index cell; define custom of_xlate()
   (now #pwm-cells = <1>)
- "compatible" strings for all devices added to OF match table
- various stylistic changes recommended by reviewers

v2:
- of_match_table contains only the "pxa250-pwm" compatible string; require one
  device instance per pwm
- add Documentation/devicetree/bindings/pwm/pxa-pwm.txt
- add support for polarity flag in DT and implement set_polarity() method
  (the treo 680 inverts the signal between pwm out and backlight)
- return -EINVAL instead of -ENODEV if platform data or DT node not found
- output dev_info string if platform data missing
- expanded CC list of patch


Mike Dunn (2):
  PWM: PXA: add device tree support to PWM driver
  PXA: add PWM nodes to pxa27x.dtsi

 Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
 arch/arm/boot/dts/pxa27x.dtsi                     | 24 +++++++++++
 drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
 3 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

-- 
1.8.1.5

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

* [PATCH RESEND v5 0/2] PWM: PXA: add device tree support to PWM driver
@ 2013-09-21 19:19 ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-pwm
  Cc: Mike Dunn, Grant Likely, Thierry Reding, Rob Herring,
	Haojian Zhuang, Robert Jarzmik, Marek Vasut, devicetree,
	linux-arm-kernel, Dmitry Torokhov, Chao Xie, Sergei Shtylyov,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell

Dang! Sorry, please disregard previous patch set.
RESENDing because previous set did not include the file
Documentation/devicetree/bindings/pwm/pxa-pwm.txt

This is now a patch set because the changes to pxa27x.dtsi have been moved to a
separate patch.  This was done so that it can go through the arm-soc tree.

Changle log:
v5:
- changes to pxa27x.dtsi moved to a separate patch
- minor changes in phrasing made to bindings documentation
- cast removed from void *
- dummy functions for !CONFIG_OF removed; called only if (IS_ENABLED(CONFIG_OF)
- if-else block in pxa_pwm_get_id_dt() replaced with ternary operator

v4:
- add second "compatible" string to pxa27x.dtsi
- change phrasing in binding doc pxa-pwm.txt to "one or more of"

v3:
- remove support for the polarity flag
- remove per-chip pwm index cell; define custom of_xlate()
   (now #pwm-cells = <1>)
- "compatible" strings for all devices added to OF match table
- various stylistic changes recommended by reviewers

v2:
- of_match_table contains only the "pxa250-pwm" compatible string; require one
  device instance per pwm
- add Documentation/devicetree/bindings/pwm/pxa-pwm.txt
- add support for polarity flag in DT and implement set_polarity() method
  (the treo 680 inverts the signal between pwm out and backlight)
- return -EINVAL instead of -ENODEV if platform data or DT node not found
- output dev_info string if platform data missing
- expanded CC list of patch


Mike Dunn (2):
  PWM: PXA: add device tree support to PWM driver
  PXA: add PWM nodes to pxa27x.dtsi

 Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
 arch/arm/boot/dts/pxa27x.dtsi                     | 24 +++++++++++
 drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
 3 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

-- 
1.8.1.5

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

* [PATCH RESEND v5 0/2] PWM: PXA: add device tree support to PWM driver
@ 2013-09-21 19:19 ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

Dang! Sorry, please disregard previous patch set.
RESENDing because previous set did not include the file
Documentation/devicetree/bindings/pwm/pxa-pwm.txt

This is now a patch set because the changes to pxa27x.dtsi have been moved to a
separate patch.  This was done so that it can go through the arm-soc tree.

Changle log:
v5:
- changes to pxa27x.dtsi moved to a separate patch
- minor changes in phrasing made to bindings documentation
- cast removed from void *
- dummy functions for !CONFIG_OF removed; called only if (IS_ENABLED(CONFIG_OF)
- if-else block in pxa_pwm_get_id_dt() replaced with ternary operator

v4:
- add second "compatible" string to pxa27x.dtsi
- change phrasing in binding doc pxa-pwm.txt to "one or more of"

v3:
- remove support for the polarity flag
- remove per-chip pwm index cell; define custom of_xlate()
   (now #pwm-cells = <1>)
- "compatible" strings for all devices added to OF match table
- various stylistic changes recommended by reviewers

v2:
- of_match_table contains only the "pxa250-pwm" compatible string; require one
  device instance per pwm
- add Documentation/devicetree/bindings/pwm/pxa-pwm.txt
- add support for polarity flag in DT and implement set_polarity() method
  (the treo 680 inverts the signal between pwm out and backlight)
- return -EINVAL instead of -ENODEV if platform data or DT node not found
- output dev_info string if platform data missing
- expanded CC list of patch


Mike Dunn (2):
  PWM: PXA: add device tree support to PWM driver
  PXA: add PWM nodes to pxa27x.dtsi

 Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
 arch/arm/boot/dts/pxa27x.dtsi                     | 24 +++++++++++
 drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
 3 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

-- 
1.8.1.5

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-09-21 19:19 ` Mike Dunn
  (?)
@ 2013-09-21 19:19     ` Mike Dunn
  -1 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-pwm-u79uwXL29TY76Z2rM5mHXA
  Cc: Mike Dunn, Grant Likely, Thierry Reding, Rob Herring,
	Haojian Zhuang, Robert Jarzmik, Marek Vasut,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell

This patch adds device tree support to the PXA's PWM driver.  Nothing
needs to be extracted from the device tree node by the PWM device.
Client devices need only specify the period; the per-chip index is
implicitly zero because one device node must be present for each PWM
output in use.  This approach is more convenient due to the wide
variability in the number of PWM channels present across the various PXA
variants, and is made possible by the fact that the register sets for
each PWM channel are segregated from each other.  An of_xlate() method
is added to parse this single-cell node.  The existing ID table is
reused for the match table data.

Tested on a Palm Treo 680 (both platform data and DT cases).

Signed-off-by: Mike Dunn <mikedunn-kFrNdAxtuftBDgjK7y7TUQ@public.gmane.org>
---
 Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
 drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
new file mode 100644
index 0000000..5ae9f1e
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
@@ -0,0 +1,30 @@
+Marvell PWM controller
+
+Required properties:
+- compatible: should be one or more of:
+  - "marvell,pxa250-pwm"
+  - "marvell,pxa270-pwm"
+  - "marvell,pxa168-pwm"
+  - "marvell,pxa910-pwm"
+- reg: Physical base address and length of the registers used by the PWM channel
+  Note that one device instance must be created for each PWM that is used, so the
+  length covers only the register window for one PWM output, not that of the
+  entire PWM controller.  Currently length is 0x10 for all supported devices.
+- #pwm-cells: Should be 1.  This cell is used to specify the period in
+  nanoseconds.
+
+Example PWM device node:
+
+pwm0: pwm@40b00000 {
+	compatible = "marvell,pxa250-pwm";
+	reg = <0x40b00000 0x10>;
+	#pwm-cells = <1>;
+};
+
+Example PWM client node:
+
+backlight {
+	compatible = "pwm-backlight";
+	pwms = <&pwm0 5000000>;
+	...
+}
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index a4d2164..e928cc8 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/pwm.h>
+#include <linux/of_device.h>
 
 #include <asm/div64.h>
 
@@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
 	.owner = THIS_MODULE,
 };
 
+#ifdef CONFIG_OF
+/*
+ * Device tree users must create one device instance for each pwm channel.
+ * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
+ * code that this is a single channel pxa25x-pwm.  Currently all devices are
+ * supported identically.
+ */
+static struct of_device_id pwm_of_match[] = {
+	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, pwm_of_match);
+#else
+static struct of_device_id *pwm_of_match;
+#endif
+
+static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
+{
+	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
+	return id ? id->data : NULL;
+}
+
+static struct pwm_device *
+pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
+{
+	struct pwm_device *pwm;
+
+	pwm = pwm_request_from_chip(pc, 0, NULL);
+	if (IS_ERR(pwm))
+		return pwm;
+
+	pwm_set_period(pwm, args->args[0]);
+
+	return pwm;
+}
+
 static int pwm_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
@@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
 	struct resource *r;
 	int ret = 0;
 
+	if (IS_ENABLED(CONFIG_OF) && id == NULL)
+		id = pxa_pwm_get_id_dt(&pdev->dev);
+
+	if (id == NULL)
+		return -EINVAL;
+
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
 	if (pwm == NULL) {
 		dev_err(&pdev->dev, "failed to allocate memory\n");
@@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
 	pwm->chip.ops = &pxa_pwm_ops;
 	pwm->chip.base = -1;
 	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
-
+	if (IS_ENABLED(CONFIG_OF)) {
+		pwm->chip.of_xlate = pxa_pwm_of_xlate;
+		pwm->chip.of_pwm_n_cells = 1;
+	}
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(pwm->mmio_base))
@@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
 	.driver		= {
 		.name	= "pxa25x-pwm",
 		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(pwm_of_match),
 	},
 	.probe		= pwm_probe,
 	.remove		= pwm_remove,
-- 
1.8.1.5

--
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 related	[flat|nested] 29+ messages in thread

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-09-21 19:19     ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-pwm
  Cc: Mike Dunn, Grant Likely, Thierry Reding, Rob Herring,
	Haojian Zhuang, Robert Jarzmik, Marek Vasut, devicetree,
	linux-arm-kernel, Dmitry Torokhov, Chao Xie, Sergei Shtylyov,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell

This patch adds device tree support to the PXA's PWM driver.  Nothing
needs to be extracted from the device tree node by the PWM device.
Client devices need only specify the period; the per-chip index is
implicitly zero because one device node must be present for each PWM
output in use.  This approach is more convenient due to the wide
variability in the number of PWM channels present across the various PXA
variants, and is made possible by the fact that the register sets for
each PWM channel are segregated from each other.  An of_xlate() method
is added to parse this single-cell node.  The existing ID table is
reused for the match table data.

Tested on a Palm Treo 680 (both platform data and DT cases).

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
 Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
 drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
new file mode 100644
index 0000000..5ae9f1e
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
@@ -0,0 +1,30 @@
+Marvell PWM controller
+
+Required properties:
+- compatible: should be one or more of:
+  - "marvell,pxa250-pwm"
+  - "marvell,pxa270-pwm"
+  - "marvell,pxa168-pwm"
+  - "marvell,pxa910-pwm"
+- reg: Physical base address and length of the registers used by the PWM channel
+  Note that one device instance must be created for each PWM that is used, so the
+  length covers only the register window for one PWM output, not that of the
+  entire PWM controller.  Currently length is 0x10 for all supported devices.
+- #pwm-cells: Should be 1.  This cell is used to specify the period in
+  nanoseconds.
+
+Example PWM device node:
+
+pwm0: pwm@40b00000 {
+	compatible = "marvell,pxa250-pwm";
+	reg = <0x40b00000 0x10>;
+	#pwm-cells = <1>;
+};
+
+Example PWM client node:
+
+backlight {
+	compatible = "pwm-backlight";
+	pwms = <&pwm0 5000000>;
+	...
+}
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index a4d2164..e928cc8 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/pwm.h>
+#include <linux/of_device.h>
 
 #include <asm/div64.h>
 
@@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
 	.owner = THIS_MODULE,
 };
 
+#ifdef CONFIG_OF
+/*
+ * Device tree users must create one device instance for each pwm channel.
+ * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
+ * code that this is a single channel pxa25x-pwm.  Currently all devices are
+ * supported identically.
+ */
+static struct of_device_id pwm_of_match[] = {
+	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, pwm_of_match);
+#else
+static struct of_device_id *pwm_of_match;
+#endif
+
+static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
+{
+	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
+	return id ? id->data : NULL;
+}
+
+static struct pwm_device *
+pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
+{
+	struct pwm_device *pwm;
+
+	pwm = pwm_request_from_chip(pc, 0, NULL);
+	if (IS_ERR(pwm))
+		return pwm;
+
+	pwm_set_period(pwm, args->args[0]);
+
+	return pwm;
+}
+
 static int pwm_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
@@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
 	struct resource *r;
 	int ret = 0;
 
+	if (IS_ENABLED(CONFIG_OF) && id == NULL)
+		id = pxa_pwm_get_id_dt(&pdev->dev);
+
+	if (id == NULL)
+		return -EINVAL;
+
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
 	if (pwm == NULL) {
 		dev_err(&pdev->dev, "failed to allocate memory\n");
@@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
 	pwm->chip.ops = &pxa_pwm_ops;
 	pwm->chip.base = -1;
 	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
-
+	if (IS_ENABLED(CONFIG_OF)) {
+		pwm->chip.of_xlate = pxa_pwm_of_xlate;
+		pwm->chip.of_pwm_n_cells = 1;
+	}
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(pwm->mmio_base))
@@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
 	.driver		= {
 		.name	= "pxa25x-pwm",
 		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(pwm_of_match),
 	},
 	.probe		= pwm_probe,
 	.remove		= pwm_remove,
-- 
1.8.1.5

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-09-21 19:19     ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds device tree support to the PXA's PWM driver.  Nothing
needs to be extracted from the device tree node by the PWM device.
Client devices need only specify the period; the per-chip index is
implicitly zero because one device node must be present for each PWM
output in use.  This approach is more convenient due to the wide
variability in the number of PWM channels present across the various PXA
variants, and is made possible by the fact that the register sets for
each PWM channel are segregated from each other.  An of_xlate() method
is added to parse this single-cell node.  The existing ID table is
reused for the match table data.

Tested on a Palm Treo 680 (both platform data and DT cases).

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
 Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
 drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
 2 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
new file mode 100644
index 0000000..5ae9f1e
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
@@ -0,0 +1,30 @@
+Marvell PWM controller
+
+Required properties:
+- compatible: should be one or more of:
+  - "marvell,pxa250-pwm"
+  - "marvell,pxa270-pwm"
+  - "marvell,pxa168-pwm"
+  - "marvell,pxa910-pwm"
+- reg: Physical base address and length of the registers used by the PWM channel
+  Note that one device instance must be created for each PWM that is used, so the
+  length covers only the register window for one PWM output, not that of the
+  entire PWM controller.  Currently length is 0x10 for all supported devices.
+- #pwm-cells: Should be 1.  This cell is used to specify the period in
+  nanoseconds.
+
+Example PWM device node:
+
+pwm0: pwm at 40b00000 {
+	compatible = "marvell,pxa250-pwm";
+	reg = <0x40b00000 0x10>;
+	#pwm-cells = <1>;
+};
+
+Example PWM client node:
+
+backlight {
+	compatible = "pwm-backlight";
+	pwms = <&pwm0 5000000>;
+	...
+}
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index a4d2164..e928cc8 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/pwm.h>
+#include <linux/of_device.h>
 
 #include <asm/div64.h>
 
@@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
 	.owner = THIS_MODULE,
 };
 
+#ifdef CONFIG_OF
+/*
+ * Device tree users must create one device instance for each pwm channel.
+ * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
+ * code that this is a single channel pxa25x-pwm.  Currently all devices are
+ * supported identically.
+ */
+static struct of_device_id pwm_of_match[] = {
+	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
+	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, pwm_of_match);
+#else
+static struct of_device_id *pwm_of_match;
+#endif
+
+static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
+{
+	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
+	return id ? id->data : NULL;
+}
+
+static struct pwm_device *
+pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
+{
+	struct pwm_device *pwm;
+
+	pwm = pwm_request_from_chip(pc, 0, NULL);
+	if (IS_ERR(pwm))
+		return pwm;
+
+	pwm_set_period(pwm, args->args[0]);
+
+	return pwm;
+}
+
 static int pwm_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
@@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
 	struct resource *r;
 	int ret = 0;
 
+	if (IS_ENABLED(CONFIG_OF) && id == NULL)
+		id = pxa_pwm_get_id_dt(&pdev->dev);
+
+	if (id == NULL)
+		return -EINVAL;
+
 	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
 	if (pwm == NULL) {
 		dev_err(&pdev->dev, "failed to allocate memory\n");
@@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
 	pwm->chip.ops = &pxa_pwm_ops;
 	pwm->chip.base = -1;
 	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
-
+	if (IS_ENABLED(CONFIG_OF)) {
+		pwm->chip.of_xlate = pxa_pwm_of_xlate;
+		pwm->chip.of_pwm_n_cells = 1;
+	}
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
 	if (IS_ERR(pwm->mmio_base))
@@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
 	.driver		= {
 		.name	= "pxa25x-pwm",
 		.owner	= THIS_MODULE,
+		.of_match_table	= of_match_ptr(pwm_of_match),
 	},
 	.probe		= pwm_probe,
 	.remove		= pwm_remove,
-- 
1.8.1.5

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

* [PATCH RESEND v5 2/2] PXA: add PWM nodes to pxa27x.dtsi
  2013-09-21 19:19 ` Mike Dunn
  (?)
@ 2013-09-21 19:19     ` Mike Dunn
  -1 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-pwm-u79uwXL29TY76Z2rM5mHXA
  Cc: Mike Dunn, Grant Likely, Thierry Reding, Rob Herring,
	Haojian Zhuang, Robert Jarzmik, Marek Vasut,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell

This patch adds PWM nodes for each of the four channels present on the
pxa270.

Signed-off-by: Mike Dunn <mikedunn-kFrNdAxtuftBDgjK7y7TUQ@public.gmane.org>
---
 arch/arm/boot/dts/pxa27x.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi
index d7c5d72..a705469 100644
--- a/arch/arm/boot/dts/pxa27x.dtsi
+++ b/arch/arm/boot/dts/pxa27x.dtsi
@@ -10,5 +10,29 @@
 			marvell,intc-priority;
 			marvell,intc-nr-irqs = <34>;
 		};
+
+		pwm0: pwm@40b00000 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40b00000 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm1: pwm@40b00010 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40b00010 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm2: pwm@40c00000 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40c00000 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm3: pwm@40c00010 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40c00010 0x10>;
+			#pwm-cells = <1>;
+		};
 	};
 };
-- 
1.8.1.5

--
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 related	[flat|nested] 29+ messages in thread

* [PATCH RESEND v5 2/2] PXA: add PWM nodes to pxa27x.dtsi
@ 2013-09-21 19:19     ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-pwm
  Cc: Mike Dunn, Grant Likely, Thierry Reding, Rob Herring,
	Haojian Zhuang, Robert Jarzmik, Marek Vasut, devicetree,
	linux-arm-kernel, Dmitry Torokhov, Chao Xie, Sergei Shtylyov,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell

This patch adds PWM nodes for each of the four channels present on the
pxa270.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
 arch/arm/boot/dts/pxa27x.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi
index d7c5d72..a705469 100644
--- a/arch/arm/boot/dts/pxa27x.dtsi
+++ b/arch/arm/boot/dts/pxa27x.dtsi
@@ -10,5 +10,29 @@
 			marvell,intc-priority;
 			marvell,intc-nr-irqs = <34>;
 		};
+
+		pwm0: pwm@40b00000 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40b00000 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm1: pwm@40b00010 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40b00010 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm2: pwm@40c00000 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40c00000 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm3: pwm@40c00010 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40c00010 0x10>;
+			#pwm-cells = <1>;
+		};
 	};
 };
-- 
1.8.1.5

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

* [PATCH RESEND v5 2/2] PXA: add PWM nodes to pxa27x.dtsi
@ 2013-09-21 19:19     ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-09-21 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds PWM nodes for each of the four channels present on the
pxa270.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
 arch/arm/boot/dts/pxa27x.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi
index d7c5d72..a705469 100644
--- a/arch/arm/boot/dts/pxa27x.dtsi
+++ b/arch/arm/boot/dts/pxa27x.dtsi
@@ -10,5 +10,29 @@
 			marvell,intc-priority;
 			marvell,intc-nr-irqs = <34>;
 		};
+
+		pwm0: pwm at 40b00000 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40b00000 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm1: pwm at 40b00010 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40b00010 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm2: pwm at 40c00000 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40c00000 0x10>;
+			#pwm-cells = <1>;
+		};
+
+		pwm3: pwm at 40c00010 {
+			compatible = "marvell,pxa270-pwm", "marvell,pxa250-pwm";
+			reg = <0x40c00010 0x10>;
+			#pwm-cells = <1>;
+		};
 	};
 };
-- 
1.8.1.5

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-09-21 19:19     ` Mike Dunn
  (?)
@ 2013-10-08 13:12         ` Thierry Reding
  -1 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-10-08 13:12 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell
  Cc: linux-pwm-u79uwXL29TY76Z2rM5mHXA, Grant Likely, Haojian Zhuang,
	Robert Jarzmik, Marek Vasut, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov, Mike Dunn

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

On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> This patch adds device tree support to the PXA's PWM driver.  Nothing
> needs to be extracted from the device tree node by the PWM device.
> Client devices need only specify the period; the per-chip index is
> implicitly zero because one device node must be present for each PWM
> output in use.  This approach is more convenient due to the wide
> variability in the number of PWM channels present across the various PXA
> variants, and is made possible by the fact that the register sets for
> each PWM channel are segregated from each other.  An of_xlate() method
> is added to parse this single-cell node.  The existing ID table is
> reused for the match table data.
> 
> Tested on a Palm Treo 680 (both platform data and DT cases).
> 
> Signed-off-by: Mike Dunn <mikedunn-kFrNdAxtuftBDgjK7y7TUQ@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

This looks good to me, but I'd like to get an Acked-by: from one of the
device tree bindings maintainers.

Thierry

> 
> diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> new file mode 100644
> index 0000000..5ae9f1e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> @@ -0,0 +1,30 @@
> +Marvell PWM controller
> +
> +Required properties:
> +- compatible: should be one or more of:
> +  - "marvell,pxa250-pwm"
> +  - "marvell,pxa270-pwm"
> +  - "marvell,pxa168-pwm"
> +  - "marvell,pxa910-pwm"
> +- reg: Physical base address and length of the registers used by the PWM channel
> +  Note that one device instance must be created for each PWM that is used, so the
> +  length covers only the register window for one PWM output, not that of the
> +  entire PWM controller.  Currently length is 0x10 for all supported devices.
> +- #pwm-cells: Should be 1.  This cell is used to specify the period in
> +  nanoseconds.
> +
> +Example PWM device node:
> +
> +pwm0: pwm@40b00000 {
> +	compatible = "marvell,pxa250-pwm";
> +	reg = <0x40b00000 0x10>;
> +	#pwm-cells = <1>;
> +};
> +
> +Example PWM client node:
> +
> +backlight {
> +	compatible = "pwm-backlight";
> +	pwms = <&pwm0 5000000>;
> +	...
> +}
> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> index a4d2164..e928cc8 100644
> --- a/drivers/pwm/pwm-pxa.c
> +++ b/drivers/pwm/pwm-pxa.c
> @@ -19,6 +19,7 @@
>  #include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/pwm.h>
> +#include <linux/of_device.h>
>  
>  #include <asm/div64.h>
>  
> @@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
>  	.owner = THIS_MODULE,
>  };
>  
> +#ifdef CONFIG_OF
> +/*
> + * Device tree users must create one device instance for each pwm channel.
> + * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
> + * code that this is a single channel pxa25x-pwm.  Currently all devices are
> + * supported identically.
> + */
> +static struct of_device_id pwm_of_match[] = {
> +	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, pwm_of_match);
> +#else
> +static struct of_device_id *pwm_of_match;
> +#endif
> +
> +static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
> +{
> +	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
> +	return id ? id->data : NULL;
> +}
> +
> +static struct pwm_device *
> +pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
> +{
> +	struct pwm_device *pwm;
> +
> +	pwm = pwm_request_from_chip(pc, 0, NULL);
> +	if (IS_ERR(pwm))
> +		return pwm;
> +
> +	pwm_set_period(pwm, args->args[0]);
> +
> +	return pwm;
> +}
> +
>  static int pwm_probe(struct platform_device *pdev)
>  {
>  	const struct platform_device_id *id = platform_get_device_id(pdev);
> @@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
>  	struct resource *r;
>  	int ret = 0;
>  
> +	if (IS_ENABLED(CONFIG_OF) && id == NULL)
> +		id = pxa_pwm_get_id_dt(&pdev->dev);
> +
> +	if (id == NULL)
> +		return -EINVAL;
> +
>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>  	if (pwm == NULL) {
>  		dev_err(&pdev->dev, "failed to allocate memory\n");
> @@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
>  	pwm->chip.ops = &pxa_pwm_ops;
>  	pwm->chip.base = -1;
>  	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
> -
> +	if (IS_ENABLED(CONFIG_OF)) {
> +		pwm->chip.of_xlate = pxa_pwm_of_xlate;
> +		pwm->chip.of_pwm_n_cells = 1;
> +	}
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>  	if (IS_ERR(pwm->mmio_base))
> @@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
>  	.driver		= {
>  		.name	= "pxa25x-pwm",
>  		.owner	= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(pwm_of_match),
>  	},
>  	.probe		= pwm_probe,
>  	.remove		= pwm_remove,
> -- 
> 1.8.1.5
> 

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

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-10-08 13:12         ` Thierry Reding
  0 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-10-08 13:12 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell
  Cc: linux-pwm, Grant Likely, Haojian Zhuang, Robert Jarzmik,
	Marek Vasut, devicetree, linux-arm-kernel, Dmitry Torokhov,
	Chao Xie, Sergei Shtylyov, Mike Dunn

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

On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> This patch adds device tree support to the PXA's PWM driver.  Nothing
> needs to be extracted from the device tree node by the PWM device.
> Client devices need only specify the period; the per-chip index is
> implicitly zero because one device node must be present for each PWM
> output in use.  This approach is more convenient due to the wide
> variability in the number of PWM channels present across the various PXA
> variants, and is made possible by the fact that the register sets for
> each PWM channel are segregated from each other.  An of_xlate() method
> is added to parse this single-cell node.  The existing ID table is
> reused for the match table data.
> 
> Tested on a Palm Treo 680 (both platform data and DT cases).
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> ---
>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

This looks good to me, but I'd like to get an Acked-by: from one of the
device tree bindings maintainers.

Thierry

> 
> diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> new file mode 100644
> index 0000000..5ae9f1e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> @@ -0,0 +1,30 @@
> +Marvell PWM controller
> +
> +Required properties:
> +- compatible: should be one or more of:
> +  - "marvell,pxa250-pwm"
> +  - "marvell,pxa270-pwm"
> +  - "marvell,pxa168-pwm"
> +  - "marvell,pxa910-pwm"
> +- reg: Physical base address and length of the registers used by the PWM channel
> +  Note that one device instance must be created for each PWM that is used, so the
> +  length covers only the register window for one PWM output, not that of the
> +  entire PWM controller.  Currently length is 0x10 for all supported devices.
> +- #pwm-cells: Should be 1.  This cell is used to specify the period in
> +  nanoseconds.
> +
> +Example PWM device node:
> +
> +pwm0: pwm@40b00000 {
> +	compatible = "marvell,pxa250-pwm";
> +	reg = <0x40b00000 0x10>;
> +	#pwm-cells = <1>;
> +};
> +
> +Example PWM client node:
> +
> +backlight {
> +	compatible = "pwm-backlight";
> +	pwms = <&pwm0 5000000>;
> +	...
> +}
> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> index a4d2164..e928cc8 100644
> --- a/drivers/pwm/pwm-pxa.c
> +++ b/drivers/pwm/pwm-pxa.c
> @@ -19,6 +19,7 @@
>  #include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/pwm.h>
> +#include <linux/of_device.h>
>  
>  #include <asm/div64.h>
>  
> @@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
>  	.owner = THIS_MODULE,
>  };
>  
> +#ifdef CONFIG_OF
> +/*
> + * Device tree users must create one device instance for each pwm channel.
> + * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
> + * code that this is a single channel pxa25x-pwm.  Currently all devices are
> + * supported identically.
> + */
> +static struct of_device_id pwm_of_match[] = {
> +	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, pwm_of_match);
> +#else
> +static struct of_device_id *pwm_of_match;
> +#endif
> +
> +static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
> +{
> +	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
> +	return id ? id->data : NULL;
> +}
> +
> +static struct pwm_device *
> +pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
> +{
> +	struct pwm_device *pwm;
> +
> +	pwm = pwm_request_from_chip(pc, 0, NULL);
> +	if (IS_ERR(pwm))
> +		return pwm;
> +
> +	pwm_set_period(pwm, args->args[0]);
> +
> +	return pwm;
> +}
> +
>  static int pwm_probe(struct platform_device *pdev)
>  {
>  	const struct platform_device_id *id = platform_get_device_id(pdev);
> @@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
>  	struct resource *r;
>  	int ret = 0;
>  
> +	if (IS_ENABLED(CONFIG_OF) && id == NULL)
> +		id = pxa_pwm_get_id_dt(&pdev->dev);
> +
> +	if (id == NULL)
> +		return -EINVAL;
> +
>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>  	if (pwm == NULL) {
>  		dev_err(&pdev->dev, "failed to allocate memory\n");
> @@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
>  	pwm->chip.ops = &pxa_pwm_ops;
>  	pwm->chip.base = -1;
>  	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
> -
> +	if (IS_ENABLED(CONFIG_OF)) {
> +		pwm->chip.of_xlate = pxa_pwm_of_xlate;
> +		pwm->chip.of_pwm_n_cells = 1;
> +	}
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>  	if (IS_ERR(pwm->mmio_base))
> @@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
>  	.driver		= {
>  		.name	= "pxa25x-pwm",
>  		.owner	= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(pwm_of_match),
>  	},
>  	.probe		= pwm_probe,
>  	.remove		= pwm_remove,
> -- 
> 1.8.1.5
> 

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

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-10-08 13:12         ` Thierry Reding
  0 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-10-08 13:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> This patch adds device tree support to the PXA's PWM driver.  Nothing
> needs to be extracted from the device tree node by the PWM device.
> Client devices need only specify the period; the per-chip index is
> implicitly zero because one device node must be present for each PWM
> output in use.  This approach is more convenient due to the wide
> variability in the number of PWM channels present across the various PXA
> variants, and is made possible by the fact that the register sets for
> each PWM channel are segregated from each other.  An of_xlate() method
> is added to parse this single-cell node.  The existing ID table is
> reused for the match table data.
> 
> Tested on a Palm Treo 680 (both platform data and DT cases).
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> ---
>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

This looks good to me, but I'd like to get an Acked-by: from one of the
device tree bindings maintainers.

Thierry

> 
> diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> new file mode 100644
> index 0000000..5ae9f1e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> @@ -0,0 +1,30 @@
> +Marvell PWM controller
> +
> +Required properties:
> +- compatible: should be one or more of:
> +  - "marvell,pxa250-pwm"
> +  - "marvell,pxa270-pwm"
> +  - "marvell,pxa168-pwm"
> +  - "marvell,pxa910-pwm"
> +- reg: Physical base address and length of the registers used by the PWM channel
> +  Note that one device instance must be created for each PWM that is used, so the
> +  length covers only the register window for one PWM output, not that of the
> +  entire PWM controller.  Currently length is 0x10 for all supported devices.
> +- #pwm-cells: Should be 1.  This cell is used to specify the period in
> +  nanoseconds.
> +
> +Example PWM device node:
> +
> +pwm0: pwm at 40b00000 {
> +	compatible = "marvell,pxa250-pwm";
> +	reg = <0x40b00000 0x10>;
> +	#pwm-cells = <1>;
> +};
> +
> +Example PWM client node:
> +
> +backlight {
> +	compatible = "pwm-backlight";
> +	pwms = <&pwm0 5000000>;
> +	...
> +}
> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> index a4d2164..e928cc8 100644
> --- a/drivers/pwm/pwm-pxa.c
> +++ b/drivers/pwm/pwm-pxa.c
> @@ -19,6 +19,7 @@
>  #include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/pwm.h>
> +#include <linux/of_device.h>
>  
>  #include <asm/div64.h>
>  
> @@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
>  	.owner = THIS_MODULE,
>  };
>  
> +#ifdef CONFIG_OF
> +/*
> + * Device tree users must create one device instance for each pwm channel.
> + * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
> + * code that this is a single channel pxa25x-pwm.  Currently all devices are
> + * supported identically.
> + */
> +static struct of_device_id pwm_of_match[] = {
> +	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
> +	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, pwm_of_match);
> +#else
> +static struct of_device_id *pwm_of_match;
> +#endif
> +
> +static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
> +{
> +	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
> +	return id ? id->data : NULL;
> +}
> +
> +static struct pwm_device *
> +pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
> +{
> +	struct pwm_device *pwm;
> +
> +	pwm = pwm_request_from_chip(pc, 0, NULL);
> +	if (IS_ERR(pwm))
> +		return pwm;
> +
> +	pwm_set_period(pwm, args->args[0]);
> +
> +	return pwm;
> +}
> +
>  static int pwm_probe(struct platform_device *pdev)
>  {
>  	const struct platform_device_id *id = platform_get_device_id(pdev);
> @@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
>  	struct resource *r;
>  	int ret = 0;
>  
> +	if (IS_ENABLED(CONFIG_OF) && id == NULL)
> +		id = pxa_pwm_get_id_dt(&pdev->dev);
> +
> +	if (id == NULL)
> +		return -EINVAL;
> +
>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>  	if (pwm == NULL) {
>  		dev_err(&pdev->dev, "failed to allocate memory\n");
> @@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
>  	pwm->chip.ops = &pxa_pwm_ops;
>  	pwm->chip.base = -1;
>  	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
> -
> +	if (IS_ENABLED(CONFIG_OF)) {
> +		pwm->chip.of_xlate = pxa_pwm_of_xlate;
> +		pwm->chip.of_pwm_n_cells = 1;
> +	}
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>  	if (IS_ERR(pwm->mmio_base))
> @@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
>  	.driver		= {
>  		.name	= "pxa25x-pwm",
>  		.owner	= THIS_MODULE,
> +		.of_match_table	= of_match_ptr(pwm_of_match),
>  	},
>  	.probe		= pwm_probe,
>  	.remove		= pwm_remove,
> -- 
> 1.8.1.5
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131008/cd5f6b92/attachment.sig>

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-10-08 13:12         ` Thierry Reding
  (?)
@ 2013-10-10 16:58           ` Mike Dunn
  -1 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-10-10 16:58 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Mark Rutland, linux-pwm, Marek Vasut, Ian Campbell, Pawel Moll,
	Stephen Warren, Dmitry Torokhov, Rob Herring, Chao Xie,
	devicetree, Haojian Zhuang, Grant Likely, Robert Jarzmik,
	Sergei Shtylyov, linux-arm-kernel

On 10/08/2013 06:12 AM, Thierry Reding wrote:
> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>> needs to be extracted from the device tree node by the PWM device.
>> Client devices need only specify the period; the per-chip index is
>> implicitly zero because one device node must be present for each PWM
>> output in use.  This approach is more convenient due to the wide
>> variability in the number of PWM channels present across the various PXA
>> variants, and is made possible by the fact that the register sets for
>> each PWM channel are segregated from each other.  An of_xlate() method
>> is added to parse this single-cell node.  The existing ID table is
>> reused for the match table data.
>>
>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>> ---
>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> 
> This looks good to me, but I'd like to get an Acked-by: from one of the
> device tree bindings maintainers.
> 
> Thierry


Thanks much Thierry and Stephen for the reviews and advice.  Stephen, are there
any remaining issues with the bindings below?

Thanks again,
Mike


> 
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> new file mode 100644
>> index 0000000..5ae9f1e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> @@ -0,0 +1,30 @@
>> +Marvell PWM controller
>> +
>> +Required properties:
>> +- compatible: should be one or more of:
>> +  - "marvell,pxa250-pwm"
>> +  - "marvell,pxa270-pwm"
>> +  - "marvell,pxa168-pwm"
>> +  - "marvell,pxa910-pwm"
>> +- reg: Physical base address and length of the registers used by the PWM channel
>> +  Note that one device instance must be created for each PWM that is used, so the
>> +  length covers only the register window for one PWM output, not that of the
>> +  entire PWM controller.  Currently length is 0x10 for all supported devices.
>> +- #pwm-cells: Should be 1.  This cell is used to specify the period in
>> +  nanoseconds.
>> +
>> +Example PWM device node:
>> +
>> +pwm0: pwm@40b00000 {
>> +	compatible = "marvell,pxa250-pwm";
>> +	reg = <0x40b00000 0x10>;
>> +	#pwm-cells = <1>;
>> +};
>> +
>> +Example PWM client node:
>> +
>> +backlight {
>> +	compatible = "pwm-backlight";
>> +	pwms = <&pwm0 5000000>;
>> +	...
>> +}
>> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
>> index a4d2164..e928cc8 100644
>> --- a/drivers/pwm/pwm-pxa.c
>> +++ b/drivers/pwm/pwm-pxa.c
>> @@ -19,6 +19,7 @@
>>  #include <linux/clk.h>
>>  #include <linux/io.h>
>>  #include <linux/pwm.h>
>> +#include <linux/of_device.h>
>>  
>>  #include <asm/div64.h>
>>  
>> @@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
>>  	.owner = THIS_MODULE,
>>  };
>>  
>> +#ifdef CONFIG_OF
>> +/*
>> + * Device tree users must create one device instance for each pwm channel.
>> + * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
>> + * code that this is a single channel pxa25x-pwm.  Currently all devices are
>> + * supported identically.
>> + */
>> +static struct of_device_id pwm_of_match[] = {
>> +	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(of, pwm_of_match);
>> +#else
>> +static struct of_device_id *pwm_of_match;
>> +#endif
>> +
>> +static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
>> +{
>> +	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
>> +	return id ? id->data : NULL;
>> +}
>> +
>> +static struct pwm_device *
>> +pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
>> +{
>> +	struct pwm_device *pwm;
>> +
>> +	pwm = pwm_request_from_chip(pc, 0, NULL);
>> +	if (IS_ERR(pwm))
>> +		return pwm;
>> +
>> +	pwm_set_period(pwm, args->args[0]);
>> +
>> +	return pwm;
>> +}
>> +
>>  static int pwm_probe(struct platform_device *pdev)
>>  {
>>  	const struct platform_device_id *id = platform_get_device_id(pdev);
>> @@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
>>  	struct resource *r;
>>  	int ret = 0;
>>  
>> +	if (IS_ENABLED(CONFIG_OF) && id == NULL)
>> +		id = pxa_pwm_get_id_dt(&pdev->dev);
>> +
>> +	if (id == NULL)
>> +		return -EINVAL;
>> +
>>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>>  	if (pwm == NULL) {
>>  		dev_err(&pdev->dev, "failed to allocate memory\n");
>> @@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
>>  	pwm->chip.ops = &pxa_pwm_ops;
>>  	pwm->chip.base = -1;
>>  	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
>> -
>> +	if (IS_ENABLED(CONFIG_OF)) {
>> +		pwm->chip.of_xlate = pxa_pwm_of_xlate;
>> +		pwm->chip.of_pwm_n_cells = 1;
>> +	}
>>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>>  	if (IS_ERR(pwm->mmio_base))
>> @@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
>>  	.driver		= {
>>  		.name	= "pxa25x-pwm",
>>  		.owner	= THIS_MODULE,
>> +		.of_match_table	= of_match_ptr(pwm_of_match),
>>  	},
>>  	.probe		= pwm_probe,
>>  	.remove		= pwm_remove,
>> -- 
>> 1.8.1.5
>>

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-10-10 16:58           ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-10-10 16:58 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
	Ian Campbell, linux-pwm, Grant Likely, Haojian Zhuang,
	Robert Jarzmik, Marek Vasut, devicetree, linux-arm-kernel,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov

On 10/08/2013 06:12 AM, Thierry Reding wrote:
> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>> needs to be extracted from the device tree node by the PWM device.
>> Client devices need only specify the period; the per-chip index is
>> implicitly zero because one device node must be present for each PWM
>> output in use.  This approach is more convenient due to the wide
>> variability in the number of PWM channels present across the various PXA
>> variants, and is made possible by the fact that the register sets for
>> each PWM channel are segregated from each other.  An of_xlate() method
>> is added to parse this single-cell node.  The existing ID table is
>> reused for the match table data.
>>
>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>> ---
>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> 
> This looks good to me, but I'd like to get an Acked-by: from one of the
> device tree bindings maintainers.
> 
> Thierry


Thanks much Thierry and Stephen for the reviews and advice.  Stephen, are there
any remaining issues with the bindings below?

Thanks again,
Mike


> 
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> new file mode 100644
>> index 0000000..5ae9f1e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> @@ -0,0 +1,30 @@
>> +Marvell PWM controller
>> +
>> +Required properties:
>> +- compatible: should be one or more of:
>> +  - "marvell,pxa250-pwm"
>> +  - "marvell,pxa270-pwm"
>> +  - "marvell,pxa168-pwm"
>> +  - "marvell,pxa910-pwm"
>> +- reg: Physical base address and length of the registers used by the PWM channel
>> +  Note that one device instance must be created for each PWM that is used, so the
>> +  length covers only the register window for one PWM output, not that of the
>> +  entire PWM controller.  Currently length is 0x10 for all supported devices.
>> +- #pwm-cells: Should be 1.  This cell is used to specify the period in
>> +  nanoseconds.
>> +
>> +Example PWM device node:
>> +
>> +pwm0: pwm@40b00000 {
>> +	compatible = "marvell,pxa250-pwm";
>> +	reg = <0x40b00000 0x10>;
>> +	#pwm-cells = <1>;
>> +};
>> +
>> +Example PWM client node:
>> +
>> +backlight {
>> +	compatible = "pwm-backlight";
>> +	pwms = <&pwm0 5000000>;
>> +	...
>> +}
>> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
>> index a4d2164..e928cc8 100644
>> --- a/drivers/pwm/pwm-pxa.c
>> +++ b/drivers/pwm/pwm-pxa.c
>> @@ -19,6 +19,7 @@
>>  #include <linux/clk.h>
>>  #include <linux/io.h>
>>  #include <linux/pwm.h>
>> +#include <linux/of_device.h>
>>  
>>  #include <asm/div64.h>
>>  
>> @@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
>>  	.owner = THIS_MODULE,
>>  };
>>  
>> +#ifdef CONFIG_OF
>> +/*
>> + * Device tree users must create one device instance for each pwm channel.
>> + * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
>> + * code that this is a single channel pxa25x-pwm.  Currently all devices are
>> + * supported identically.
>> + */
>> +static struct of_device_id pwm_of_match[] = {
>> +	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(of, pwm_of_match);
>> +#else
>> +static struct of_device_id *pwm_of_match;
>> +#endif
>> +
>> +static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
>> +{
>> +	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
>> +	return id ? id->data : NULL;
>> +}
>> +
>> +static struct pwm_device *
>> +pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
>> +{
>> +	struct pwm_device *pwm;
>> +
>> +	pwm = pwm_request_from_chip(pc, 0, NULL);
>> +	if (IS_ERR(pwm))
>> +		return pwm;
>> +
>> +	pwm_set_period(pwm, args->args[0]);
>> +
>> +	return pwm;
>> +}
>> +
>>  static int pwm_probe(struct platform_device *pdev)
>>  {
>>  	const struct platform_device_id *id = platform_get_device_id(pdev);
>> @@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
>>  	struct resource *r;
>>  	int ret = 0;
>>  
>> +	if (IS_ENABLED(CONFIG_OF) && id == NULL)
>> +		id = pxa_pwm_get_id_dt(&pdev->dev);
>> +
>> +	if (id == NULL)
>> +		return -EINVAL;
>> +
>>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>>  	if (pwm == NULL) {
>>  		dev_err(&pdev->dev, "failed to allocate memory\n");
>> @@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
>>  	pwm->chip.ops = &pxa_pwm_ops;
>>  	pwm->chip.base = -1;
>>  	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
>> -
>> +	if (IS_ENABLED(CONFIG_OF)) {
>> +		pwm->chip.of_xlate = pxa_pwm_of_xlate;
>> +		pwm->chip.of_pwm_n_cells = 1;
>> +	}
>>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>>  	if (IS_ERR(pwm->mmio_base))
>> @@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
>>  	.driver		= {
>>  		.name	= "pxa25x-pwm",
>>  		.owner	= THIS_MODULE,
>> +		.of_match_table	= of_match_ptr(pwm_of_match),
>>  	},
>>  	.probe		= pwm_probe,
>>  	.remove		= pwm_remove,
>> -- 
>> 1.8.1.5
>>

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-10-10 16:58           ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-10-10 16:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/08/2013 06:12 AM, Thierry Reding wrote:
> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>> needs to be extracted from the device tree node by the PWM device.
>> Client devices need only specify the period; the per-chip index is
>> implicitly zero because one device node must be present for each PWM
>> output in use.  This approach is more convenient due to the wide
>> variability in the number of PWM channels present across the various PXA
>> variants, and is made possible by the fact that the register sets for
>> each PWM channel are segregated from each other.  An of_xlate() method
>> is added to parse this single-cell node.  The existing ID table is
>> reused for the match table data.
>>
>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>> ---
>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> 
> This looks good to me, but I'd like to get an Acked-by: from one of the
> device tree bindings maintainers.
> 
> Thierry


Thanks much Thierry and Stephen for the reviews and advice.  Stephen, are there
any remaining issues with the bindings below?

Thanks again,
Mike


> 
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pxa-pwm.txt b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> new file mode 100644
>> index 0000000..5ae9f1e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> @@ -0,0 +1,30 @@
>> +Marvell PWM controller
>> +
>> +Required properties:
>> +- compatible: should be one or more of:
>> +  - "marvell,pxa250-pwm"
>> +  - "marvell,pxa270-pwm"
>> +  - "marvell,pxa168-pwm"
>> +  - "marvell,pxa910-pwm"
>> +- reg: Physical base address and length of the registers used by the PWM channel
>> +  Note that one device instance must be created for each PWM that is used, so the
>> +  length covers only the register window for one PWM output, not that of the
>> +  entire PWM controller.  Currently length is 0x10 for all supported devices.
>> +- #pwm-cells: Should be 1.  This cell is used to specify the period in
>> +  nanoseconds.
>> +
>> +Example PWM device node:
>> +
>> +pwm0: pwm at 40b00000 {
>> +	compatible = "marvell,pxa250-pwm";
>> +	reg = <0x40b00000 0x10>;
>> +	#pwm-cells = <1>;
>> +};
>> +
>> +Example PWM client node:
>> +
>> +backlight {
>> +	compatible = "pwm-backlight";
>> +	pwms = <&pwm0 5000000>;
>> +	...
>> +}
>> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
>> index a4d2164..e928cc8 100644
>> --- a/drivers/pwm/pwm-pxa.c
>> +++ b/drivers/pwm/pwm-pxa.c
>> @@ -19,6 +19,7 @@
>>  #include <linux/clk.h>
>>  #include <linux/io.h>
>>  #include <linux/pwm.h>
>> +#include <linux/of_device.h>
>>  
>>  #include <asm/div64.h>
>>  
>> @@ -124,6 +125,45 @@ static struct pwm_ops pxa_pwm_ops = {
>>  	.owner = THIS_MODULE,
>>  };
>>  
>> +#ifdef CONFIG_OF
>> +/*
>> + * Device tree users must create one device instance for each pwm channel.
>> + * Hence we dispense with the HAS_SECONDARY_PWM and "tell" the original driver
>> + * code that this is a single channel pxa25x-pwm.  Currently all devices are
>> + * supported identically.
>> + */
>> +static struct of_device_id pwm_of_match[] = {
>> +	{ .compatible = "marvell,pxa250-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa270-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa168-pwm", .data = &pwm_id_table[0]},
>> +	{ .compatible = "marvell,pxa910-pwm", .data = &pwm_id_table[0]},
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(of, pwm_of_match);
>> +#else
>> +static struct of_device_id *pwm_of_match;
>> +#endif
>> +
>> +static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev)
>> +{
>> +	const struct of_device_id *id = of_match_device(pwm_of_match, dev);
>> +	return id ? id->data : NULL;
>> +}
>> +
>> +static struct pwm_device *
>> +pxa_pwm_of_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
>> +{
>> +	struct pwm_device *pwm;
>> +
>> +	pwm = pwm_request_from_chip(pc, 0, NULL);
>> +	if (IS_ERR(pwm))
>> +		return pwm;
>> +
>> +	pwm_set_period(pwm, args->args[0]);
>> +
>> +	return pwm;
>> +}
>> +
>>  static int pwm_probe(struct platform_device *pdev)
>>  {
>>  	const struct platform_device_id *id = platform_get_device_id(pdev);
>> @@ -131,6 +171,12 @@ static int pwm_probe(struct platform_device *pdev)
>>  	struct resource *r;
>>  	int ret = 0;
>>  
>> +	if (IS_ENABLED(CONFIG_OF) && id == NULL)
>> +		id = pxa_pwm_get_id_dt(&pdev->dev);
>> +
>> +	if (id == NULL)
>> +		return -EINVAL;
>> +
>>  	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
>>  	if (pwm == NULL) {
>>  		dev_err(&pdev->dev, "failed to allocate memory\n");
>> @@ -145,7 +191,10 @@ static int pwm_probe(struct platform_device *pdev)
>>  	pwm->chip.ops = &pxa_pwm_ops;
>>  	pwm->chip.base = -1;
>>  	pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
>> -
>> +	if (IS_ENABLED(CONFIG_OF)) {
>> +		pwm->chip.of_xlate = pxa_pwm_of_xlate;
>> +		pwm->chip.of_pwm_n_cells = 1;
>> +	}
>>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
>>  	if (IS_ERR(pwm->mmio_base))
>> @@ -176,6 +225,7 @@ static struct platform_driver pwm_driver = {
>>  	.driver		= {
>>  		.name	= "pxa25x-pwm",
>>  		.owner	= THIS_MODULE,
>> +		.of_match_table	= of_match_ptr(pwm_of_match),
>>  	},
>>  	.probe		= pwm_probe,
>>  	.remove		= pwm_remove,
>> -- 
>> 1.8.1.5
>>

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-09-21 19:19     ` Mike Dunn
@ 2013-12-03 10:17       ` Thierry Reding
  -1 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-12-03 10:17 UTC (permalink / raw)
  To: Mike Dunn
  Cc: linux-pwm, Grant Likely, Rob Herring, Haojian Zhuang,
	Robert Jarzmik, Marek Vasut, devicetree, linux-arm-kernel,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell

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

On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> This patch adds device tree support to the PXA's PWM driver.  Nothing
> needs to be extracted from the device tree node by the PWM device.
> Client devices need only specify the period; the per-chip index is
> implicitly zero because one device node must be present for each PWM
> output in use.  This approach is more convenient due to the wide
> variability in the number of PWM channels present across the various PXA
> variants, and is made possible by the fact that the register sets for
> each PWM channel are segregated from each other.  An of_xlate() method
> is added to parse this single-cell node.  The existing ID table is
> reused for the match table data.
> 
> Tested on a Palm Treo 680 (both platform data and DT cases).
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> ---
>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

Hi Mike,

It looks like this fell through the cracks. Is this patch still the
latest one you have? Should it still be applied?

Thierry

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

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-03 10:17       ` Thierry Reding
  0 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-12-03 10:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> This patch adds device tree support to the PXA's PWM driver.  Nothing
> needs to be extracted from the device tree node by the PWM device.
> Client devices need only specify the period; the per-chip index is
> implicitly zero because one device node must be present for each PWM
> output in use.  This approach is more convenient due to the wide
> variability in the number of PWM channels present across the various PXA
> variants, and is made possible by the fact that the register sets for
> each PWM channel are segregated from each other.  An of_xlate() method
> is added to parse this single-cell node.  The existing ID table is
> reused for the match table data.
> 
> Tested on a Palm Treo 680 (both platform data and DT cases).
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> ---
>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>  2 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt

Hi Mike,

It looks like this fell through the cracks. Is this patch still the
latest one you have? Should it still be applied?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131203/ecdf98b7/attachment.sig>

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-12-03 10:17       ` Thierry Reding
@ 2013-12-03 18:45         ` Mike Dunn
  -1 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-12-03 18:45 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Marek Vasut, linux-pwm, Pawel Moll, Sergei Shtylyov, devicetree,
	Dmitry Torokhov, Rob Herring, Chao Xie, Haojian Zhuang,
	Stephen Warren, Grant Likely, Mark Rutland, Robert Jarzmik,
	linux-arm-kernel, Ian Campbell

On 12/03/2013 02:17 AM, Thierry Reding wrote:
> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>> needs to be extracted from the device tree node by the PWM device.
>> Client devices need only specify the period; the per-chip index is
>> implicitly zero because one device node must be present for each PWM
>> output in use.  This approach is more convenient due to the wide
>> variability in the number of PWM channels present across the various PXA
>> variants, and is made possible by the fact that the register sets for
>> each PWM channel are segregated from each other.  An of_xlate() method
>> is added to parse this single-cell node.  The existing ID table is
>> reused for the match table data.
>>
>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>> ---
>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> 
> Hi Mike,
> 
> It looks like this fell through the cracks. Is this patch still the
> latest one you have? Should it still be applied?
> 
> Thierry
> 

Hi Thierry,

Funny I should hear from you about this today.... I just turned my attention
back to this today and noticed that it never made it into your for-next branch.
 Yes, it is the latest.  If the patch still applies cleanly, please feel free.
Otherwise, I'd be glad to rework it against something more recent.

Also, we never got any ACKs for patch 2/2, which just adds the nodes to
arch/arm/boot/dts/pxa27x.dtsi
Any advice on whom to nudge?

Thanks much!
Mike

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-03 18:45         ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-12-03 18:45 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/03/2013 02:17 AM, Thierry Reding wrote:
> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>> needs to be extracted from the device tree node by the PWM device.
>> Client devices need only specify the period; the per-chip index is
>> implicitly zero because one device node must be present for each PWM
>> output in use.  This approach is more convenient due to the wide
>> variability in the number of PWM channels present across the various PXA
>> variants, and is made possible by the fact that the register sets for
>> each PWM channel are segregated from each other.  An of_xlate() method
>> is added to parse this single-cell node.  The existing ID table is
>> reused for the match table data.
>>
>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>> ---
>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> 
> Hi Mike,
> 
> It looks like this fell through the cracks. Is this patch still the
> latest one you have? Should it still be applied?
> 
> Thierry
> 

Hi Thierry,

Funny I should hear from you about this today.... I just turned my attention
back to this today and noticed that it never made it into your for-next branch.
 Yes, it is the latest.  If the patch still applies cleanly, please feel free.
Otherwise, I'd be glad to rework it against something more recent.

Also, we never got any ACKs for patch 2/2, which just adds the nodes to
arch/arm/boot/dts/pxa27x.dtsi
Any advice on whom to nudge?

Thanks much!
Mike

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-12-03 18:45         ` Mike Dunn
@ 2013-12-04  1:12           ` Haojian Zhuang
  -1 siblings, 0 replies; 29+ messages in thread
From: Haojian Zhuang @ 2013-12-04  1:12 UTC (permalink / raw)
  To: Mike Dunn, Thierry Reding
  Cc: linux-pwm, Grant Likely, Rob Herring, Robert Jarzmik,
	Marek Vasut, devicetree, linux-arm-kernel, Dmitry Torokhov,
	Chao Xie, Sergei Shtylyov, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell


On 12/04/2013 02:45 AM, Mike Dunn wrote:
> On 12/03/2013 02:17 AM, Thierry Reding wrote:
>> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>>> needs to be extracted from the device tree node by the PWM device.
>>> Client devices need only specify the period; the per-chip index is
>>> implicitly zero because one device node must be present for each PWM
>>> output in use.  This approach is more convenient due to the wide
>>> variability in the number of PWM channels present across the various PXA
>>> variants, and is made possible by the fact that the register sets for
>>> each PWM channel are segregated from each other.  An of_xlate() method
>>> is added to parse this single-cell node.  The existing ID table is
>>> reused for the match table data.
>>>
>>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>>
>>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>>> ---
>>>   Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>>   drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>>   2 files changed, 81 insertions(+), 1 deletion(-)
>>>   create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> Hi Mike,
>>
>> It looks like this fell through the cracks. Is this patch still the
>> latest one you have? Should it still be applied?
>>
>> Thierry
>>
> Hi Thierry,
>
> Funny I should hear from you about this today.... I just turned my attention
> back to this today and noticed that it never made it into your for-next branch.
>   Yes, it is the latest.  If the patch still applies cleanly, please feel free.
> Otherwise, I'd be glad to rework it against something more recent.
>
> Also, we never got any ACKs for patch 2/2, which just adds the nodes to
> arch/arm/boot/dts/pxa27x.dtsi
> Any advice on whom to nudge?
>
> Thanks much!
> Mike
>

It's fine to me.

Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>

Regards
Haojian

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-04  1:12           ` Haojian Zhuang
  0 siblings, 0 replies; 29+ messages in thread
From: Haojian Zhuang @ 2013-12-04  1:12 UTC (permalink / raw)
  To: linux-arm-kernel


On 12/04/2013 02:45 AM, Mike Dunn wrote:
> On 12/03/2013 02:17 AM, Thierry Reding wrote:
>> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>>> needs to be extracted from the device tree node by the PWM device.
>>> Client devices need only specify the period; the per-chip index is
>>> implicitly zero because one device node must be present for each PWM
>>> output in use.  This approach is more convenient due to the wide
>>> variability in the number of PWM channels present across the various PXA
>>> variants, and is made possible by the fact that the register sets for
>>> each PWM channel are segregated from each other.  An of_xlate() method
>>> is added to parse this single-cell node.  The existing ID table is
>>> reused for the match table data.
>>>
>>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>>
>>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>>> ---
>>>   Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>>   drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>>   2 files changed, 81 insertions(+), 1 deletion(-)
>>>   create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>> Hi Mike,
>>
>> It looks like this fell through the cracks. Is this patch still the
>> latest one you have? Should it still be applied?
>>
>> Thierry
>>
> Hi Thierry,
>
> Funny I should hear from you about this today.... I just turned my attention
> back to this today and noticed that it never made it into your for-next branch.
>   Yes, it is the latest.  If the patch still applies cleanly, please feel free.
> Otherwise, I'd be glad to rework it against something more recent.
>
> Also, we never got any ACKs for patch 2/2, which just adds the nodes to
> arch/arm/boot/dts/pxa27x.dtsi
> Any advice on whom to nudge?
>
> Thanks much!
> Mike
>

It's fine to me.

Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>

Regards
Haojian

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-12-04  1:12           ` Haojian Zhuang
@ 2013-12-04  9:03             ` Thierry Reding
  -1 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-12-04  9:03 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: Mike Dunn, linux-pwm, Grant Likely, Rob Herring, Robert Jarzmik,
	Marek Vasut, devicetree, linux-arm-kernel, Dmitry Torokhov,
	Chao Xie, Sergei Shtylyov, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell

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

On Wed, Dec 04, 2013 at 09:12:51AM +0800, Haojian Zhuang wrote:
> 
> On 12/04/2013 02:45 AM, Mike Dunn wrote:
> >On 12/03/2013 02:17 AM, Thierry Reding wrote:
> >>On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> >>>This patch adds device tree support to the PXA's PWM driver.  Nothing
> >>>needs to be extracted from the device tree node by the PWM device.
> >>>Client devices need only specify the period; the per-chip index is
> >>>implicitly zero because one device node must be present for each PWM
> >>>output in use.  This approach is more convenient due to the wide
> >>>variability in the number of PWM channels present across the various PXA
> >>>variants, and is made possible by the fact that the register sets for
> >>>each PWM channel are segregated from each other.  An of_xlate() method
> >>>is added to parse this single-cell node.  The existing ID table is
> >>>reused for the match table data.
> >>>
> >>>Tested on a Palm Treo 680 (both platform data and DT cases).
> >>>
> >>>Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> >>>---
> >>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
> >>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
> >>>  2 files changed, 81 insertions(+), 1 deletion(-)
> >>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> >>Hi Mike,
> >>
> >>It looks like this fell through the cracks. Is this patch still the
> >>latest one you have? Should it still be applied?
> >>
> >>Thierry
> >>
> >Hi Thierry,
> >
> >Funny I should hear from you about this today.... I just turned my attention
> >back to this today and noticed that it never made it into your for-next branch.
> >  Yes, it is the latest.  If the patch still applies cleanly, please feel free.
> >Otherwise, I'd be glad to rework it against something more recent.
> >
> >Also, we never got any ACKs for patch 2/2, which just adds the nodes to
> >arch/arm/boot/dts/pxa27x.dtsi
> >Any advice on whom to nudge?
> >
> >Thanks much!
> >Mike
> >
> 
> It's fine to me.
> 
> Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>

I think it's customary to take DTS file updates through the architecture
trees, so I think it'd be better if you took patch 2/2. There aren't any
dependencies between both patches either.

Thierry

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

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-04  9:03             ` Thierry Reding
  0 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-12-04  9:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Dec 04, 2013 at 09:12:51AM +0800, Haojian Zhuang wrote:
> 
> On 12/04/2013 02:45 AM, Mike Dunn wrote:
> >On 12/03/2013 02:17 AM, Thierry Reding wrote:
> >>On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> >>>This patch adds device tree support to the PXA's PWM driver.  Nothing
> >>>needs to be extracted from the device tree node by the PWM device.
> >>>Client devices need only specify the period; the per-chip index is
> >>>implicitly zero because one device node must be present for each PWM
> >>>output in use.  This approach is more convenient due to the wide
> >>>variability in the number of PWM channels present across the various PXA
> >>>variants, and is made possible by the fact that the register sets for
> >>>each PWM channel are segregated from each other.  An of_xlate() method
> >>>is added to parse this single-cell node.  The existing ID table is
> >>>reused for the match table data.
> >>>
> >>>Tested on a Palm Treo 680 (both platform data and DT cases).
> >>>
> >>>Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> >>>---
> >>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
> >>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
> >>>  2 files changed, 81 insertions(+), 1 deletion(-)
> >>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> >>Hi Mike,
> >>
> >>It looks like this fell through the cracks. Is this patch still the
> >>latest one you have? Should it still be applied?
> >>
> >>Thierry
> >>
> >Hi Thierry,
> >
> >Funny I should hear from you about this today.... I just turned my attention
> >back to this today and noticed that it never made it into your for-next branch.
> >  Yes, it is the latest.  If the patch still applies cleanly, please feel free.
> >Otherwise, I'd be glad to rework it against something more recent.
> >
> >Also, we never got any ACKs for patch 2/2, which just adds the nodes to
> >arch/arm/boot/dts/pxa27x.dtsi
> >Any advice on whom to nudge?
> >
> >Thanks much!
> >Mike
> >
> 
> It's fine to me.
> 
> Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>

I think it's customary to take DTS file updates through the architecture
trees, so I think it'd be better if you took patch 2/2. There aren't any
dependencies between both patches either.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131204/be4e15f2/attachment-0001.sig>

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-12-04  9:03             ` Thierry Reding
@ 2013-12-04  9:17               ` Haojian Zhuang
  -1 siblings, 0 replies; 29+ messages in thread
From: Haojian Zhuang @ 2013-12-04  9:17 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Mike Dunn, linux-pwm, Grant Likely, Rob Herring, Robert Jarzmik,
	Marek Vasut, devicetree, linux-arm-kernel, Dmitry Torokhov,
	Chao Xie, Sergei Shtylyov, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell


On 12/04/2013 05:03 PM, Thierry Reding wrote:
> On Wed, Dec 04, 2013 at 09:12:51AM +0800, Haojian Zhuang wrote:
>> On 12/04/2013 02:45 AM, Mike Dunn wrote:
>>> On 12/03/2013 02:17 AM, Thierry Reding wrote:
>>>> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>>>>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>>>>> needs to be extracted from the device tree node by the PWM device.
>>>>> Client devices need only specify the period; the per-chip index is
>>>>> implicitly zero because one device node must be present for each PWM
>>>>> output in use.  This approach is more convenient due to the wide
>>>>> variability in the number of PWM channels present across the various PXA
>>>>> variants, and is made possible by the fact that the register sets for
>>>>> each PWM channel are segregated from each other.  An of_xlate() method
>>>>> is added to parse this single-cell node.  The existing ID table is
>>>>> reused for the match table data.
>>>>>
>>>>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>>>>
>>>>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>>>>> ---
>>>>>   Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>>>>   drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>>>>   2 files changed, 81 insertions(+), 1 deletion(-)
>>>>>   create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>>>> Hi Mike,
>>>>
>>>> It looks like this fell through the cracks. Is this patch still the
>>>> latest one you have? Should it still be applied?
>>>>
>>>> Thierry
>>>>
>>> Hi Thierry,
>>>
>>> Funny I should hear from you about this today.... I just turned my attention
>>> back to this today and noticed that it never made it into your for-next branch.
>>>   Yes, it is the latest.  If the patch still applies cleanly, please feel free.
>>> Otherwise, I'd be glad to rework it against something more recent.
>>>
>>> Also, we never got any ACKs for patch 2/2, which just adds the nodes to
>>> arch/arm/boot/dts/pxa27x.dtsi
>>> Any advice on whom to nudge?
>>>
>>> Thanks much!
>>> Mike
>>>
>> It's fine to me.
>>
>> Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> I think it's customary to take DTS file updates through the architecture
> trees, so I think it'd be better if you took patch 2/2. There aren't any
> dependencies between both patches either.
>
> Thierry
OK. Let me handle this.

Regards
Haojian

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-04  9:17               ` Haojian Zhuang
  0 siblings, 0 replies; 29+ messages in thread
From: Haojian Zhuang @ 2013-12-04  9:17 UTC (permalink / raw)
  To: linux-arm-kernel


On 12/04/2013 05:03 PM, Thierry Reding wrote:
> On Wed, Dec 04, 2013 at 09:12:51AM +0800, Haojian Zhuang wrote:
>> On 12/04/2013 02:45 AM, Mike Dunn wrote:
>>> On 12/03/2013 02:17 AM, Thierry Reding wrote:
>>>> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>>>>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>>>>> needs to be extracted from the device tree node by the PWM device.
>>>>> Client devices need only specify the period; the per-chip index is
>>>>> implicitly zero because one device node must be present for each PWM
>>>>> output in use.  This approach is more convenient due to the wide
>>>>> variability in the number of PWM channels present across the various PXA
>>>>> variants, and is made possible by the fact that the register sets for
>>>>> each PWM channel are segregated from each other.  An of_xlate() method
>>>>> is added to parse this single-cell node.  The existing ID table is
>>>>> reused for the match table data.
>>>>>
>>>>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>>>>
>>>>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>>>>> ---
>>>>>   Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>>>>   drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>>>>   2 files changed, 81 insertions(+), 1 deletion(-)
>>>>>   create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>>>> Hi Mike,
>>>>
>>>> It looks like this fell through the cracks. Is this patch still the
>>>> latest one you have? Should it still be applied?
>>>>
>>>> Thierry
>>>>
>>> Hi Thierry,
>>>
>>> Funny I should hear from you about this today.... I just turned my attention
>>> back to this today and noticed that it never made it into your for-next branch.
>>>   Yes, it is the latest.  If the patch still applies cleanly, please feel free.
>>> Otherwise, I'd be glad to rework it against something more recent.
>>>
>>> Also, we never got any ACKs for patch 2/2, which just adds the nodes to
>>> arch/arm/boot/dts/pxa27x.dtsi
>>> Any advice on whom to nudge?
>>>
>>> Thanks much!
>>> Mike
>>>
>> It's fine to me.
>>
>> Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> I think it's customary to take DTS file updates through the architecture
> trees, so I think it'd be better if you took patch 2/2. There aren't any
> dependencies between both patches either.
>
> Thierry
OK. Let me handle this.

Regards
Haojian

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-12-03 18:45         ` Mike Dunn
@ 2013-12-04  9:21           ` Thierry Reding
  -1 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-12-04  9:21 UTC (permalink / raw)
  To: Mike Dunn
  Cc: linux-pwm, Grant Likely, Rob Herring, Haojian Zhuang,
	Robert Jarzmik, Marek Vasut, devicetree, linux-arm-kernel,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell

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

On Tue, Dec 03, 2013 at 10:45:29AM -0800, Mike Dunn wrote:
> On 12/03/2013 02:17 AM, Thierry Reding wrote:
> > On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> >> This patch adds device tree support to the PXA's PWM driver.  Nothing
> >> needs to be extracted from the device tree node by the PWM device.
> >> Client devices need only specify the period; the per-chip index is
> >> implicitly zero because one device node must be present for each PWM
> >> output in use.  This approach is more convenient due to the wide
> >> variability in the number of PWM channels present across the various PXA
> >> variants, and is made possible by the fact that the register sets for
> >> each PWM channel are segregated from each other.  An of_xlate() method
> >> is added to parse this single-cell node.  The existing ID table is
> >> reused for the match table data.
> >>
> >> Tested on a Palm Treo 680 (both platform data and DT cases).
> >>
> >> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> >> ---
> >>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
> >>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
> >>  2 files changed, 81 insertions(+), 1 deletion(-)
> >>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> > 
> > Hi Mike,
> > 
> > It looks like this fell through the cracks. Is this patch still the
> > latest one you have? Should it still be applied?
> > 
> > Thierry
> > 
> 
> Hi Thierry,
> 
> Funny I should hear from you about this today.... I just turned my attention
> back to this today and noticed that it never made it into your for-next branch.
>  Yes, it is the latest.  If the patch still applies cleanly, please feel free.
> Otherwise, I'd be glad to rework it against something more recent.

I've applied it to my for-next branch (with some minor whitespace fixups
and some tuning to how the OF match table is defined). I don't consider
any of the changes risky, but it'd be great if you could still test the
version that I pushed.

Thierry

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

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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-04  9:21           ` Thierry Reding
  0 siblings, 0 replies; 29+ messages in thread
From: Thierry Reding @ 2013-12-04  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 03, 2013 at 10:45:29AM -0800, Mike Dunn wrote:
> On 12/03/2013 02:17 AM, Thierry Reding wrote:
> > On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
> >> This patch adds device tree support to the PXA's PWM driver.  Nothing
> >> needs to be extracted from the device tree node by the PWM device.
> >> Client devices need only specify the period; the per-chip index is
> >> implicitly zero because one device node must be present for each PWM
> >> output in use.  This approach is more convenient due to the wide
> >> variability in the number of PWM channels present across the various PXA
> >> variants, and is made possible by the fact that the register sets for
> >> each PWM channel are segregated from each other.  An of_xlate() method
> >> is added to parse this single-cell node.  The existing ID table is
> >> reused for the match table data.
> >>
> >> Tested on a Palm Treo 680 (both platform data and DT cases).
> >>
> >> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> >> ---
> >>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
> >>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
> >>  2 files changed, 81 insertions(+), 1 deletion(-)
> >>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
> > 
> > Hi Mike,
> > 
> > It looks like this fell through the cracks. Is this patch still the
> > latest one you have? Should it still be applied?
> > 
> > Thierry
> > 
> 
> Hi Thierry,
> 
> Funny I should hear from you about this today.... I just turned my attention
> back to this today and noticed that it never made it into your for-next branch.
>  Yes, it is the latest.  If the patch still applies cleanly, please feel free.
> Otherwise, I'd be glad to rework it against something more recent.

I've applied it to my for-next branch (with some minor whitespace fixups
and some tuning to how the OF match table is defined). I don't consider
any of the changes risky, but it'd be great if you could still test the
version that I pushed.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131204/08ffaefe/attachment-0001.sig>

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

* Re: [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
  2013-12-04  9:21           ` Thierry Reding
@ 2013-12-04 18:21             ` Mike Dunn
  -1 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-12-04 18:21 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-pwm, Grant Likely, Rob Herring, Haojian Zhuang,
	Robert Jarzmik, Marek Vasut, devicetree, linux-arm-kernel,
	Dmitry Torokhov, Chao Xie, Sergei Shtylyov, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell

On 12/04/2013 01:21 AM, Thierry Reding wrote:
> On Tue, Dec 03, 2013 at 10:45:29AM -0800, Mike Dunn wrote:
>> On 12/03/2013 02:17 AM, Thierry Reding wrote:
>>> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>>>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>>>> needs to be extracted from the device tree node by the PWM device.
>>>> Client devices need only specify the period; the per-chip index is
>>>> implicitly zero because one device node must be present for each PWM
>>>> output in use.  This approach is more convenient due to the wide
>>>> variability in the number of PWM channels present across the various PXA
>>>> variants, and is made possible by the fact that the register sets for
>>>> each PWM channel are segregated from each other.  An of_xlate() method
>>>> is added to parse this single-cell node.  The existing ID table is
>>>> reused for the match table data.
>>>>
>>>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>>>
>>>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>>>> ---
>>>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>>>
>>> Hi Mike,
>>>
>>> It looks like this fell through the cracks. Is this patch still the
>>> latest one you have? Should it still be applied?
>>>
>>> Thierry
>>>
>>
>> Hi Thierry,
>>
>> Funny I should hear from you about this today.... I just turned my attention
>> back to this today and noticed that it never made it into your for-next branch.
>>  Yes, it is the latest.  If the patch still applies cleanly, please feel free.
>> Otherwise, I'd be glad to rework it against something more recent.
> 
> I've applied it to my for-next branch (with some minor whitespace fixups
> and some tuning to how the OF match table is defined). I don't consider
> any of the changes risky, but it'd be great if you could still test the
> version that I pushed.


I just tested it... looks good.  Thanks again Thierry.  Thanks also Haojian.

Mike


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

* [PATCH RESEND v5 1/2] PWM: PXA: add device tree support to PWM driver
@ 2013-12-04 18:21             ` Mike Dunn
  0 siblings, 0 replies; 29+ messages in thread
From: Mike Dunn @ 2013-12-04 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/04/2013 01:21 AM, Thierry Reding wrote:
> On Tue, Dec 03, 2013 at 10:45:29AM -0800, Mike Dunn wrote:
>> On 12/03/2013 02:17 AM, Thierry Reding wrote:
>>> On Sat, Sep 21, 2013 at 12:19:33PM -0700, Mike Dunn wrote:
>>>> This patch adds device tree support to the PXA's PWM driver.  Nothing
>>>> needs to be extracted from the device tree node by the PWM device.
>>>> Client devices need only specify the period; the per-chip index is
>>>> implicitly zero because one device node must be present for each PWM
>>>> output in use.  This approach is more convenient due to the wide
>>>> variability in the number of PWM channels present across the various PXA
>>>> variants, and is made possible by the fact that the register sets for
>>>> each PWM channel are segregated from each other.  An of_xlate() method
>>>> is added to parse this single-cell node.  The existing ID table is
>>>> reused for the match table data.
>>>>
>>>> Tested on a Palm Treo 680 (both platform data and DT cases).
>>>>
>>>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
>>>> ---
>>>>  Documentation/devicetree/bindings/pwm/pxa-pwm.txt | 30 +++++++++++++
>>>>  drivers/pwm/pwm-pxa.c                             | 52 ++++++++++++++++++++++-
>>>>  2 files changed, 81 insertions(+), 1 deletion(-)
>>>>  create mode 100644 Documentation/devicetree/bindings/pwm/pxa-pwm.txt
>>>
>>> Hi Mike,
>>>
>>> It looks like this fell through the cracks. Is this patch still the
>>> latest one you have? Should it still be applied?
>>>
>>> Thierry
>>>
>>
>> Hi Thierry,
>>
>> Funny I should hear from you about this today.... I just turned my attention
>> back to this today and noticed that it never made it into your for-next branch.
>>  Yes, it is the latest.  If the patch still applies cleanly, please feel free.
>> Otherwise, I'd be glad to rework it against something more recent.
> 
> I've applied it to my for-next branch (with some minor whitespace fixups
> and some tuning to how the OF match table is defined). I don't consider
> any of the changes risky, but it'd be great if you could still test the
> version that I pushed.


I just tested it... looks good.  Thanks again Thierry.  Thanks also Haojian.

Mike

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

end of thread, other threads:[~2013-12-04 18:21 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-21 19:19 [PATCH RESEND v5 0/2] PWM: PXA: add device tree support to PWM driver Mike Dunn
2013-09-21 19:19 ` Mike Dunn
2013-09-21 19:19 ` Mike Dunn
     [not found] ` <1379791174-2369-1-git-send-email-mikedunn-kFrNdAxtuftBDgjK7y7TUQ@public.gmane.org>
2013-09-21 19:19   ` [PATCH RESEND v5 1/2] " Mike Dunn
2013-09-21 19:19     ` Mike Dunn
2013-09-21 19:19     ` Mike Dunn
     [not found]     ` <1379791174-2369-2-git-send-email-mikedunn-kFrNdAxtuftBDgjK7y7TUQ@public.gmane.org>
2013-10-08 13:12       ` Thierry Reding
2013-10-08 13:12         ` Thierry Reding
2013-10-08 13:12         ` Thierry Reding
2013-10-10 16:58         ` Mike Dunn
2013-10-10 16:58           ` Mike Dunn
2013-10-10 16:58           ` Mike Dunn
2013-12-03 10:17     ` Thierry Reding
2013-12-03 10:17       ` Thierry Reding
2013-12-03 18:45       ` Mike Dunn
2013-12-03 18:45         ` Mike Dunn
2013-12-04  1:12         ` Haojian Zhuang
2013-12-04  1:12           ` Haojian Zhuang
2013-12-04  9:03           ` Thierry Reding
2013-12-04  9:03             ` Thierry Reding
2013-12-04  9:17             ` Haojian Zhuang
2013-12-04  9:17               ` Haojian Zhuang
2013-12-04  9:21         ` Thierry Reding
2013-12-04  9:21           ` Thierry Reding
2013-12-04 18:21           ` Mike Dunn
2013-12-04 18:21             ` Mike Dunn
2013-09-21 19:19   ` [PATCH RESEND v5 2/2] PXA: add PWM nodes to pxa27x.dtsi Mike Dunn
2013-09-21 19:19     ` Mike Dunn
2013-09-21 19:19     ` Mike Dunn

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.