@@ -27,6 +27,7 @@
#include <linux/of.h>
#include <linux/coresight.h>
#include <linux/amba/bus.h>
+#include <linux/pm_runtime.h>
#include "coresight-priv.h"
@@ -249,9 +250,11 @@ static int tmc_enable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
if (ret)
return ret;
+ pm_runtime_get_sync(drvdata->dev);
spin_lock_irqsave(&drvdata->spinlock, flags);
if (drvdata->reading) {
spin_unlock_irqrestore(&drvdata->spinlock, flags);
+ pm_runtime_put_sync(drvdata->dev);
clk_disable_unprepare(drvdata->clk);
return -EBUSY;
}
@@ -385,7 +388,7 @@ static void tmc_disable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
out:
drvdata->enable = false;
spin_unlock_irqrestore(&drvdata->spinlock, flags);
-
+ pm_runtime_put_sync(drvdata->dev);
clk_disable_unprepare(drvdata->clk);
dev_info(drvdata->dev, "TMC disabled\n");
@@ -717,6 +720,9 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
if (ret)
goto err_misc_register;
+ pm_runtime_set_suspended(dev);
+ pm_runtime_put_noidle(dev);
+
dev_info(dev, "TMC initialized\n");
return 0;