pwm-mxs driver updates
Subsystems (3)
cover pwm-mxs driver updates
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(-)
Signature · 1 line
1.7.5.4
PATCH 1/4 pwm: pwm-mxs: encode soc name in compatible string
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.
--- Documentation/devicetree/bindings/pwm/mxs-pwm.txt | 4 ++-- drivers/pwm/pwm-mxs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pwm/mxs-pwm.txt +2 -2
@@ -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>;
drivers/pwm/pwm-mxs.c +1 -1
@@ -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);
Signature · 1 line
1.7.5.4
PATCH 2/4 pwm: pwm-mxs: use global reset function stmp_reset_block
In reply to Shawn GuoUse global reset function stmp_reset_block instead of mxs_reset_block to remove <mach/common.h> inclusion.
--- drivers/pwm/pwm-mxs.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-mxs.c +2 -2
@@ -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 ;
Signature · 1 line
1.7.5.4
PATCH 2/4 pwm: pwm-mxs: use global reset function stmp_reset_block
Quoted 7 lines · Shawn Guo
Use global reset function
stmp_reset_blockinstead ofmxs_reset_blockto remove <mach/common.h> inclusion.Signed-off-by Shawn Guo <[email protected]>--- 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>
PATCH 2/4 pwm: pwm-mxs: use global reset function stmp_reset_block
Quoted 10 lines · Thierry Reding
Quoted 7 lines · Shawn Guo
Use global reset function
stmp_reset_blockinstead ofmxs_reset_blockto remove <mach/common.h> inclusion.Signed-off-by Shawn Guo <[email protected]>--- 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>
PATCH 2/4 pwm: pwm-mxs: use global reset function stmp_reset_block
Quoted 4 lines · Thierry Reding
Quoted 1 line
Doesn't this need a depends on/select
STMP_DEVICE?Upon closer investigation, select
STMP_DEVICEseems to be correct.
Yes, you are right. Will fix it. Thanks.
Signature · 2 lines
Regards, Shawn
PATCH v2 2/4 pwm: pwm-mxs: use global reset function stmp_reset_block
In reply to Shawn GuoUse global reset function stmp_reset_block instead of mxs_reset_block to remove <mach/common.h> inclusion.
---
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(-)
drivers/pwm/Kconfig +1 -0
@@ -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.
drivers/pwm/pwm-mxs.c +2 -2
@@ -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 ;
Signature · 1 line
1.7.5.4
PATCH v2 2/4 pwm: pwm-mxs: use global reset function stmp_reset_block
Quoted 7 lines · Shawn Guo
Use global reset function
stmp_reset_blockinstead ofmxs_reset_blockto remove <mach/common.h> inclusion.Signed-off-by Shawn Guo <[email protected]>---
Changes since v1:
* SelectSTMP_DEVICEforPWM_MXSKconfigoption
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>
PATCH 3/4 pwm: pwm-mxs: use devm_* managed functions
In reply to Shawn GuoUse devm_* managed functions to have a clean fail-out.
--- drivers/pwm/pwm-mxs.c | 24 ++++++++---------------- 1 files changed, 8 insertions(+), 16 deletions(-)
drivers/pwm/pwm-mxs.c +8 -16
@@ -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 ; }
Signature · 1 line
1.7.5.4
PATCH 4/4 pwm: pwm-mxs: add pinctrl support
In reply to Shawn GuoCall pinctrl subsystem to set up pwm pin.
--- drivers/pwm/pwm-mxs.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/pwm/pwm-mxs.c +6 -0
@@ -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);
Signature · 1 line
1.7.5.4