From 1a478c8ca39a96f870abce5615331a45ab5875d0 Mon Sep 17 00:00:00 2001 From: Youngmin Nam Date: Tue, 22 Aug 2017 15:47:38 +0900 Subject: [PATCH] [COMMON] pinctrl: samsung: add pinctrl_force_sleep for sleep state configuration Change-Id: I608701d120774998ff771d084a0da13b1675ec9d Signed-off-by: Youngmin Nam Signed-off-by: Hyunki Koo --- drivers/pinctrl/samsung/pinctrl-samsung.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 70d7a2386911..3e44b2611971 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -1117,6 +1117,14 @@ static int __maybe_unused samsung_pinctrl_suspend(struct device *dev) { struct samsung_pinctrl_drv_data *drvdata = dev_get_drvdata(dev); int i; + int ret; + + if (!drvdata->suspend) + return -EINVAL; + + ret = pinctrl_force_sleep(drvdata->pctl_dev); + if (ret) + dev_err(drvdata->dev, "could not set sleep pinstate %d\n", ret); for (i = 0; i < drvdata->nr_banks; i++) { struct samsung_pin_bank *bank = &drvdata->pin_banks[i]; @@ -1202,6 +1210,10 @@ static int __maybe_unused samsung_pinctrl_resume(struct device *dev) writel(bank->pm_save[type], reg + offs[type]); } + /* For changing state without writing register. */ + if (!IS_ERR(drvdata->pctl_dev->p) && !IS_ERR(drvdata->pctl_dev->hog_default)) + drvdata->pctl_dev->p->state = drvdata->pctl_dev->hog_default; + if (drvdata->retention_ctrl && drvdata->retention_ctrl->disable) drvdata->retention_ctrl->disable(drvdata); -- 2.20.1