Message ID | 1413863011-2736-1-git-send-email-zyw@rock-chips.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Oct 21, 2014 at 5:43 AM, <zyw@rock-chips.com> wrote: > From: Chris Zhong <zyw@rock-chips.com> > > Save and restore the gpio6_c6 pinmux setting, since Maskrom of RK3288 > would modify it to sdmmc0_det, so it need to be restored to the correct > setting after resume from Maskrom. > > Signed-off-by: Chris Zhong <zyw@rock-chips.com> > --- > > Changes in v3: None > Changes in v2: None Heiko, ping on this too. Yours, Linus Walleij
Linus, On Tue, Oct 28, 2014 at 8:52 AM, Linus Walleij <linus.walleij@linaro.org> wrote: > On Tue, Oct 21, 2014 at 5:43 AM, <zyw@rock-chips.com> wrote: > >> From: Chris Zhong <zyw@rock-chips.com> >> >> Save and restore the gpio6_c6 pinmux setting, since Maskrom of RK3288 >> would modify it to sdmmc0_det, so it need to be restored to the correct >> setting after resume from Maskrom. >> >> Signed-off-by: Chris Zhong <zyw@rock-chips.com> >> --- >> >> Changes in v3: None >> Changes in v2: None > > Heiko, ping on this too. There's a newer version with his review (v5). For this series see: pinctrl: rockchip: save and restore gpio6_c6 pinmux in suspend/resume https://patchwork.kernel.org/patch/5160781/ - pinctrl: rockchip: add suspend/resume functions https://patchwork.kernel.org/patch/5160761/
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index d384d99..85134e4 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1796,26 +1796,54 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( } #ifdef CONFIG_PM + +#define RK3288_GRF_GPIO6C_IOMUX 0x64 +#define GPIO6C6_SEL_WRITE_ENABLE BIT(28) + +static u32 rk3288_grf_gpio6c_iomux; + static int rockchip_pinctrl_suspend(struct platform_device *pdev, pm_message_t state) { struct rockchip_pinctrl *info; + int ret; info = platform_get_drvdata(pdev); if (!info) return -EINVAL; - return pinctrl_force_sleep(info->pctl_dev); + ret = pinctrl_force_sleep(info->pctl_dev); + if (ret) + return ret; + + /* + * RK3288 GPIO6_C6 mux would be modified by Maskrom when resume, so save + * the setting here, and restore it at resume. + */ + if (info->ctrl->type == RK3288) { + ret = regmap_read(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, + &rk3288_grf_gpio6c_iomux); + if (ret) + return ret; + } + + return 0; } static int rockchip_pinctrl_resume(struct platform_device *pdev) { struct rockchip_pinctrl *info; + int ret; info = platform_get_drvdata(pdev); if (!info) return -EINVAL; + ret = regmap_write(info->regmap_base, RK3288_GRF_GPIO6C_IOMUX, + rk3288_grf_gpio6c_iomux | GPIO6C6_SEL_WRITE_ENABLE); + if (ret) + return ret; + return pinctrl_force_default(info->pctl_dev); } #endif