linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] pwm-mxs driver updates
@ 2012-06-26  8:58 Shawn Guo
  2012-06-26  8:58 ` [PATCH 1/4] pwm: pwm-mxs: encode soc name in compatible string Shawn Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Shawn Guo @ 2012-06-26  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

The series makes a few updates on pwm-mxs driver to make it better.

Shawn Guo (4):
  pwm: pwm-mxs: encode soc name in compatible string
  pwm: pwm-mxs: use global reset function stmp_reset_block
  pwm: pwm-mxs: use devm_* managed functions
  pwm: pwm-mxs: add pinctrl support

 Documentation/devicetree/bindings/pwm/mxs-pwm.txt |    4 +-
 drivers/pwm/pwm-mxs.c                             |   36 ++++++++++-----------
 2 files changed, 19 insertions(+), 21 deletions(-)

-- 
1.7.5.4

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

* [PATCH 1/4] pwm: pwm-mxs: encode soc name in compatible string
  2012-06-26  8:58 [PATCH 0/4] pwm-mxs driver updates Shawn Guo
@ 2012-06-26  8:58 ` Shawn Guo
  2012-06-26  8:58 ` [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block Shawn Guo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Shawn Guo @ 2012-06-26  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

Encode soc name in the compatible string to know the specific version
hardware block.  This is the general approach adopted for most bindings.
Change mxs-pwm binding to use the approach.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 Documentation/devicetree/bindings/pwm/mxs-pwm.txt |    4 ++--
 drivers/pwm/pwm-mxs.c                             |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/pwm/mxs-pwm.txt b/Documentation/devicetree/bindings/pwm/mxs-pwm.txt
index 48ead0d..b16f4a5 100644
--- a/Documentation/devicetree/bindings/pwm/mxs-pwm.txt
+++ b/Documentation/devicetree/bindings/pwm/mxs-pwm.txt
@@ -1,7 +1,7 @@
 Freescale MXS PWM controller
 
 Required properties:
-- compatible: should be "fsl,mxs-pwm"
+- compatible: should be "fsl,imx23-pwm"
 - reg: physical base address and length of the controller's registers
 - #pwm-cells: should be 2.  The first cell specifies the per-chip index
   of the PWM to use and the second cell is the duty cycle in nanoseconds.
@@ -10,7 +10,7 @@ Required properties:
 Example:
 
 pwm: pwm at 80064000 {
-	compatible = "fsl,imx28-pwm", "fsl,mxs-pwm";
+	compatible = "fsl,imx28-pwm", "fsl,imx23-pwm";
 	reg = <0x80064000 2000>;
 	#pwm-cells = <2>;
 	fsl,pwm-number = <8>;
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index ebf91da..7af3a6a 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -186,7 +186,7 @@ static int __devexit mxs_pwm_remove(struct platform_device *pdev)
 }
 
 static struct of_device_id mxs_pwm_dt_ids[] = {
-	{ .compatible = "fsl,mxs-pwm", },
+	{ .compatible = "fsl,imx23-pwm", },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxs_pwm_of_match);
-- 
1.7.5.4

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

* [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block
  2012-06-26  8:58 [PATCH 0/4] pwm-mxs driver updates Shawn Guo
  2012-06-26  8:58 ` [PATCH 1/4] pwm: pwm-mxs: encode soc name in compatible string Shawn Guo
@ 2012-06-26  8:58 ` Shawn Guo
  2012-06-26  9:54   ` Thierry Reding
  2012-06-27 13:36   ` [PATCH v2 " Shawn Guo
  2012-06-26  8:58 ` [PATCH 3/4] pwm: pwm-mxs: use devm_* managed functions Shawn Guo
  2012-06-26  8:58 ` [PATCH 4/4] pwm: pwm-mxs: add pinctrl support Shawn Guo
  3 siblings, 2 replies; 10+ messages in thread
From: Shawn Guo @ 2012-06-26  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

Use global reset function stmp_reset_block instead of mxs_reset_block
to remove <mach/common.h> inclusion.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/pwm/pwm-mxs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 7af3a6a..7a97997 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -19,7 +19,7 @@
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
-#include <mach/common.h>
+#include <linux/stmp_device.h>
 
 #define SET	0x4
 #define CLR	0x8
@@ -163,7 +163,7 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 	mxs->dev = &pdev->dev;
 	platform_set_drvdata(pdev, mxs);
 
-	mxs_reset_block(mxs->base);
+	stmp_reset_block(mxs->base);
 
 	return 0;
 
-- 
1.7.5.4

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

* [PATCH 3/4] pwm: pwm-mxs: use devm_* managed functions
  2012-06-26  8:58 [PATCH 0/4] pwm-mxs driver updates Shawn Guo
  2012-06-26  8:58 ` [PATCH 1/4] pwm: pwm-mxs: encode soc name in compatible string Shawn Guo
  2012-06-26  8:58 ` [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block Shawn Guo
@ 2012-06-26  8:58 ` Shawn Guo
  2012-06-26  8:58 ` [PATCH 4/4] pwm: pwm-mxs: add pinctrl support Shawn Guo
  3 siblings, 0 replies; 10+ messages in thread
From: Shawn Guo @ 2012-06-26  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

Use devm_* managed functions to have a clean fail-out.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/pwm/pwm-mxs.c |   24 ++++++++----------------
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 7a97997..bbda509 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -129,21 +129,21 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct mxs_pwm_chip *mxs;
+	struct resource *res;
 	int ret;
 
 	mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL);
 	if (!mxs)
 		return -ENOMEM;
 
-	mxs->base = of_iomap(np, 0);
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	mxs->base = devm_request_and_ioremap(&pdev->dev, res);
 	if (!mxs->base)
 		return -EADDRNOTAVAIL;
 
-	mxs->clk = clk_get(&pdev->dev, NULL);
-	if (IS_ERR(mxs->clk)) {
-		ret = PTR_ERR(mxs->clk);
-		goto iounmap;
-	}
+	mxs->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(mxs->clk))
+		return PTR_ERR(mxs->clk);
 
 	mxs->chip.dev = &pdev->dev;
 	mxs->chip.ops = &mxs_pwm_ops;
@@ -151,13 +151,13 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 	ret = of_property_read_u32(np, "fsl,pwm-number", &mxs->chip.npwm);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to get pwm number: %d\n", ret);
-		goto clk_put;
+		return ret;
 	}
 
 	ret = pwmchip_add(&mxs->chip);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to add pwm chip %d\n", ret);
-		goto clk_put;
+		return ret;
 	}
 
 	mxs->dev = &pdev->dev;
@@ -166,12 +166,6 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 	stmp_reset_block(mxs->base);
 
 	return 0;
-
-clk_put:
-	clk_put(mxs->clk);
-iounmap:
-	iounmap(mxs->base);
-	return ret;
 }
 
 static int __devexit mxs_pwm_remove(struct platform_device *pdev)
@@ -179,8 +173,6 @@ static int __devexit mxs_pwm_remove(struct platform_device *pdev)
 	struct mxs_pwm_chip *mxs = platform_get_drvdata(pdev);
 
 	pwmchip_remove(&mxs->chip);
-	clk_put(mxs->clk);
-	iounmap(mxs->base);
 
 	return 0;
 }
-- 
1.7.5.4

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

* [PATCH 4/4] pwm: pwm-mxs: add pinctrl support
  2012-06-26  8:58 [PATCH 0/4] pwm-mxs driver updates Shawn Guo
                   ` (2 preceding siblings ...)
  2012-06-26  8:58 ` [PATCH 3/4] pwm: pwm-mxs: use devm_* managed functions Shawn Guo
@ 2012-06-26  8:58 ` Shawn Guo
  3 siblings, 0 replies; 10+ messages in thread
From: Shawn Guo @ 2012-06-26  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

Call pinctrl subsystem to set up pwm pin.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/pwm/pwm-mxs.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index bbda509..dd25975 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
@@ -130,6 +131,7 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct mxs_pwm_chip *mxs;
 	struct resource *res;
+	struct pinctrl *pinctrl;
 	int ret;
 
 	mxs = devm_kzalloc(&pdev->dev, sizeof(*mxs), GFP_KERNEL);
@@ -141,6 +143,10 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 	if (!mxs->base)
 		return -EADDRNOTAVAIL;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl))
+		return PTR_ERR(pinctrl);
+
 	mxs->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(mxs->clk))
 		return PTR_ERR(mxs->clk);
-- 
1.7.5.4

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

* [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block
  2012-06-26  8:58 ` [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block Shawn Guo
@ 2012-06-26  9:54   ` Thierry Reding
  2012-06-26  9:57     ` Thierry Reding
  2012-06-27 13:36   ` [PATCH v2 " Shawn Guo
  1 sibling, 1 reply; 10+ messages in thread
From: Thierry Reding @ 2012-06-26  9:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 26, 2012 at 04:58:09PM +0800, Shawn Guo wrote:
> Use global reset function stmp_reset_block instead of mxs_reset_block
> to remove <mach/common.h> inclusion.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  drivers/pwm/pwm-mxs.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Doesn't this need a depends on/select STMP_DEVICE?

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/20120626/37b47b34/attachment.sig>

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

* [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block
  2012-06-26  9:54   ` Thierry Reding
@ 2012-06-26  9:57     ` Thierry Reding
  2012-06-26 11:14       ` Shawn Guo
  0 siblings, 1 reply; 10+ messages in thread
From: Thierry Reding @ 2012-06-26  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 26, 2012 at 11:54:56AM +0200, Thierry Reding wrote:
> On Tue, Jun 26, 2012 at 04:58:09PM +0800, Shawn Guo wrote:
> > Use global reset function stmp_reset_block instead of mxs_reset_block
> > to remove <mach/common.h> inclusion.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > ---
> >  drivers/pwm/pwm-mxs.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> Doesn't this need a depends on/select STMP_DEVICE?

Upon closer investigation, select STMP_DEVICE seems to be correct.

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/20120626/9e34ec72/attachment.sig>

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

* [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block
  2012-06-26  9:57     ` Thierry Reding
@ 2012-06-26 11:14       ` Shawn Guo
  0 siblings, 0 replies; 10+ messages in thread
From: Shawn Guo @ 2012-06-26 11:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 26, 2012 at 11:57:03AM +0200, Thierry Reding wrote:
> > Doesn't this need a depends on/select STMP_DEVICE?
> 
> Upon closer investigation, select STMP_DEVICE seems to be correct.
> 
Yes, you are right.  Will fix it.  Thanks.

-- 
Regards,
Shawn

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

* [PATCH v2 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block
  2012-06-26  8:58 ` [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block Shawn Guo
  2012-06-26  9:54   ` Thierry Reding
@ 2012-06-27 13:36   ` Shawn Guo
  2012-06-27 13:39     ` Thierry Reding
  1 sibling, 1 reply; 10+ messages in thread
From: Shawn Guo @ 2012-06-27 13:36 UTC (permalink / raw)
  To: linux-arm-kernel

Use global reset function stmp_reset_block instead of mxs_reset_block
to remove <mach/common.h> inclusion.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
Changes since v1:
* Select STMP_DEVICE for PWM_MXS Kconfig option

 drivers/pwm/Kconfig   |    1 +
 drivers/pwm/pwm-mxs.c |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 39bdebc..5227415 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -30,6 +30,7 @@ config PWM_IMX
 config PWM_MXS
 	tristate "Freescale MXS PWM support"
 	depends on ARCH_MXS && OF
+	select STMP_DEVICE
 	help
 	  Generic PWM framework driver for Freescale MXS.
 
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 7af3a6a..7a97997 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -19,7 +19,7 @@
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
 #include <linux/slab.h>
-#include <mach/common.h>
+#include <linux/stmp_device.h>
 
 #define SET	0x4
 #define CLR	0x8
@@ -163,7 +163,7 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 	mxs->dev = &pdev->dev;
 	platform_set_drvdata(pdev, mxs);
 
-	mxs_reset_block(mxs->base);
+	stmp_reset_block(mxs->base);
 
 	return 0;
 
-- 
1.7.5.4

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

* [PATCH v2 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block
  2012-06-27 13:36   ` [PATCH v2 " Shawn Guo
@ 2012-06-27 13:39     ` Thierry Reding
  0 siblings, 0 replies; 10+ messages in thread
From: Thierry Reding @ 2012-06-27 13:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 27, 2012 at 09:36:05PM +0800, Shawn Guo wrote:
> Use global reset function stmp_reset_block instead of mxs_reset_block
> to remove <mach/common.h> inclusion.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
> Changes since v1:
> * Select STMP_DEVICE for PWM_MXS Kconfig option

Thanks, I'll apply them to for-next. Hopefully Stephen will pick them up
in linux-next real soon now. I've already sent the pull request.

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/20120627/c39c921b/attachment.sig>

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

end of thread, other threads:[~2012-06-27 13:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26  8:58 [PATCH 0/4] pwm-mxs driver updates Shawn Guo
2012-06-26  8:58 ` [PATCH 1/4] pwm: pwm-mxs: encode soc name in compatible string Shawn Guo
2012-06-26  8:58 ` [PATCH 2/4] pwm: pwm-mxs: use global reset function stmp_reset_block Shawn Guo
2012-06-26  9:54   ` Thierry Reding
2012-06-26  9:57     ` Thierry Reding
2012-06-26 11:14       ` Shawn Guo
2012-06-27 13:36   ` [PATCH v2 " Shawn Guo
2012-06-27 13:39     ` Thierry Reding
2012-06-26  8:58 ` [PATCH 3/4] pwm: pwm-mxs: use devm_* managed functions Shawn Guo
2012-06-26  8:58 ` [PATCH 4/4] pwm: pwm-mxs: add pinctrl support Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).