From: Youngmin Nam Date: Tue, 22 Aug 2017 06:47:38 +0000 (+0900) Subject: [COMMON] pinctrl: samsung: add pinctrl_force_sleep for sleep state configuration X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1a478c8ca39a96f870abce5615331a45ab5875d0;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [COMMON] pinctrl: samsung: add pinctrl_force_sleep for sleep state configuration Change-Id: I608701d120774998ff771d084a0da13b1675ec9d Signed-off-by: Youngmin Nam Signed-off-by: Hyunki Koo --- 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);