pinctrl: samsung: Ensure that pad retention is disabled on driver init
authorMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 23 Mar 2017 08:03:22 +0000 (09:03 +0100)
committerKrzysztof Kozlowski <krzk@kernel.org>
Thu, 23 Mar 2017 19:05:21 +0000 (21:05 +0200)
When pin controller device is a part of power domain, there is no guarantee
that the power domain was not turned off and then on during boot process
before probing of the pin control driver. If it happened, then pin control
driver should ensure that pad retention is turned off during its probe call.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
drivers/pinctrl/samsung/pinctrl-exynos.c

index f9b49967f512b52cec5447ae0baee9e146745d1b..fa8bdd9ae198ee8542ca2661040dd999cc144225 100644 (file)
@@ -777,6 +777,7 @@ exynos_retention_init(struct samsung_pinctrl_drv_data *drvdata,
 {
        struct samsung_retention_ctrl *ctrl;
        struct regmap *pmu_regs;
+       int i;
 
        ctrl = devm_kzalloc(drvdata->dev, sizeof(*ctrl), GFP_KERNEL);
        if (!ctrl)
@@ -794,6 +795,10 @@ exynos_retention_init(struct samsung_pinctrl_drv_data *drvdata,
        ctrl->enable = exynos_retention_enable;
        ctrl->disable = exynos_retention_disable;
 
+       /* Ensure that retention is disabled on driver init */
+       for (i = 0; i < ctrl->nr_regs; i++)
+               regmap_write(pmu_regs, ctrl->regs[i], ctrl->value);
+
        return ctrl;
 }