Merge tag 'pwm/for-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry...
[deliverable/linux.git] / drivers / pwm / pwm-tiecap.c
index 616af764a27682ed0301e897ab731f5ffe8c5a13..6ec342dd3eea48ec71be46e698ab87ba9e70433f 100644 (file)
@@ -27,8 +27,6 @@
 #include <linux/pwm.h>
 #include <linux/of_device.h>
 
-#include "pwm-tipwmss.h"
-
 /* ECAP registers and bits definitions */
 #define CAP1                   0x08
 #define CAP2                   0x0C
@@ -195,6 +193,7 @@ static const struct pwm_ops ecap_pwm_ops = {
 };
 
 static const struct of_device_id ecap_of_match[] = {
+       { .compatible   = "ti,am3352-ecap" },
        { .compatible   = "ti,am33xx-ecap" },
        {},
 };
@@ -202,17 +201,24 @@ MODULE_DEVICE_TABLE(of, ecap_of_match);
 
 static int ecap_pwm_probe(struct platform_device *pdev)
 {
+       struct device_node *np = pdev->dev.of_node;
        int ret;
        struct resource *r;
        struct clk *clk;
        struct ecap_pwm_chip *pc;
-       u16 status;
 
        pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL);
        if (!pc)
                return -ENOMEM;
 
        clk = devm_clk_get(&pdev->dev, "fck");
+       if (IS_ERR(clk)) {
+               if (of_device_is_compatible(np, "ti,am33xx-ecap")) {
+                       dev_warn(&pdev->dev, "Binding is obsolete.\n");
+                       clk = devm_clk_get(pdev->dev.parent, "fck");
+               }
+       }
+
        if (IS_ERR(clk)) {
                dev_err(&pdev->dev, "failed to get clock\n");
                return PTR_ERR(clk);
@@ -243,40 +249,15 @@ static int ecap_pwm_probe(struct platform_device *pdev)
        }
 
        pm_runtime_enable(&pdev->dev);
-       pm_runtime_get_sync(&pdev->dev);
-
-       status = pwmss_submodule_state_change(pdev->dev.parent,
-                       PWMSS_ECAPCLK_EN);
-       if (!(status & PWMSS_ECAPCLK_EN_ACK)) {
-               dev_err(&pdev->dev, "PWMSS config space clock enable failed\n");
-               ret = -EINVAL;
-               goto pwmss_clk_failure;
-       }
-
-       pm_runtime_put_sync(&pdev->dev);
 
        platform_set_drvdata(pdev, pc);
        return 0;
-
-pwmss_clk_failure:
-       pm_runtime_put_sync(&pdev->dev);
-       pm_runtime_disable(&pdev->dev);
-       pwmchip_remove(&pc->chip);
-       return ret;
 }
 
 static int ecap_pwm_remove(struct platform_device *pdev)
 {
        struct ecap_pwm_chip *pc = platform_get_drvdata(pdev);
 
-       pm_runtime_get_sync(&pdev->dev);
-       /*
-        * Due to hardware misbehaviour, acknowledge of the stop_req
-        * is missing. Hence checking of the status bit skipped.
-        */
-       pwmss_submodule_state_change(pdev->dev.parent, PWMSS_ECAPCLK_STOP_REQ);
-       pm_runtime_put_sync(&pdev->dev);
-
        pm_runtime_disable(&pdev->dev);
        return pwmchip_remove(&pc->chip);
 }
This page took 0.044115 seconds and 5 git commands to generate.