pwm: pwm-tiehrpwm: pinctrl support
authorPhilip, Avinash <avinashphilip@ti.com>
Tue, 27 Nov 2012 08:48:14 +0000 (14:18 +0530)
committerThierry Reding <thierry.reding@avionic-design.de>
Wed, 28 Nov 2012 14:16:18 +0000 (15:16 +0100)
Enable pinctrl for pwm-tiehrpwm if pinctrl driver available, else
bail out with warning message.

Signed-off-by: Philip, Avinash <avinashphilip@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
drivers/pwm/pwm-tiehrpwm.c

index ee7a8b3..542d5f3 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/clk.h>
 #include <linux/pm_runtime.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/consumer.h>
 
 #include "pwm-tipwmss.h"
 
@@ -415,6 +416,11 @@ static int __devinit ehrpwm_pwm_probe(struct platform_device *pdev)
        struct clk *clk;
        struct ehrpwm_pwm_chip *pc;
        u16 status;
+       struct pinctrl *pinctrl;
+
+       pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+       if (IS_ERR(pinctrl))
+               dev_warn(&pdev->dev, "unable to select pin group\n");
 
        pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
        if (!pc) {