diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2015-07-27 16:05:36 +0200 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2019-05-09 11:13:49 +0200 |
commit | d2a44a140d6e942b0740a55b35ddccd377ef0dd1 (patch) | |
tree | 8748942ad5ea61feaa63648fb74ad41e2c5d2e74 | |
parent | 9b6f8f9257bce60f9e3790832832cf33f5f12497 (diff) |
colibri-imx6: use stopmode for poweroff
After the system has been shutdown with PMIC_ON_REQ and VCC_BATT is supplied
from a battery it will never restart either by RESET or power cycle.
So use the PMIC_STBY_REQ after shutdown to switch off power rails.
Conflicts:
arch/arm/mach-imx/pm-imx6.c
drivers/regulator/pfuze100-regulator.c
(cherry-picked from commit c8b186404065c4502b485820ad4a51515924795c)
(cherry-picked from commit ee4c5c4da3b32f65528a2d523ca4bce574dee3c5)
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
(cherry picked from commit 29ff2389ecf7cb4e30924c80b8d42165cf306936)
-rw-r--r-- | arch/arm/mach-imx/pm-imx6.c | 16 | ||||
-rw-r--r-- | drivers/power/reset/imx-snvs-poweroff.c | 3 | ||||
-rw-r--r-- | drivers/regulator/pfuze100-regulator.c | 73 |
3 files changed, 91 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 7b1f7acddfd6..3184c40b3029 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -1290,6 +1290,12 @@ void __init imx6_pm_ccm_init(const char *ccm_compat) writel_relaxed(val, ccm_base + CLPCR); } +void imx6_stop_mode_poweroff(void) +{ + imx6_set_lpm(STOP_POWER_OFF); + cpu_do_idle(); +} + void __init imx6q_pm_init(void) { if (imx_mmdc_get_ddr_type() == IMX_DDR_TYPE_LPDDR2) @@ -1301,6 +1307,16 @@ void __init imx6q_pm_init(void) void __init imx6dl_pm_init(void) { imx6_pm_common_init(&imx6dl_pm_data); + +#ifndef CONFIG_POWER_RESET_GPIO + /* + * if no specific power off function in board file, power off system by + * SNVS + */ + if (!pm_power_off) + if (of_machine_is_compatible("toradex,colibri_imx6dl")) + pm_power_off = imx6_stop_mode_poweroff; +#endif } void __init imx6sl_pm_init(void) diff --git a/drivers/power/reset/imx-snvs-poweroff.c b/drivers/power/reset/imx-snvs-poweroff.c index ad6ce5020ea7..03447e08ffc4 100644 --- a/drivers/power/reset/imx-snvs-poweroff.c +++ b/drivers/power/reset/imx-snvs-poweroff.c @@ -41,7 +41,8 @@ static int imx_poweroff_probe(struct platform_device *pdev) return -ENODEV; } - pm_power_off = do_imx_poweroff; + if (!of_machine_is_compatible("toradex,colibri_imx6dl")) + pm_power_off = do_imx_poweroff; return 0; } diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 92bf0c952583..31718c1830b6 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -742,6 +742,78 @@ err_ret: return index; } +static void pfuze100_regulator_shutdown(struct i2c_client *client) +{ + struct pfuze_chip *pfuze_chip; + int ret; + + if (!of_machine_is_compatible("toradex,colibri_imx6dl")) + return; + + /* Configure all regulators to off on PMIC standby. For Colibri iMX6 + * we use the PMIC_STBY_REQ after shutdown, as the PMIC_ON_REQ signal + * together with VCC_BATT supplied from a battery leads to a + * nonbooting system. + * After the system has been shutdown with PMIC_ON_REQ it will never + * restart either by RESET or power cycle. + */ + pfuze_chip = i2c_get_clientdata(client); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_SW1ABVOL + PFUZE100_MODE_OFFSET, + 0x0f, 4); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_SW1CVOL + PFUZE100_MODE_OFFSET, + 0x0f, 4); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_SW3AVOL + PFUZE100_MODE_OFFSET, + 0x0f, 4); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_SW3BVOL + PFUZE100_MODE_OFFSET, + 0x0f, 4); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_SWBSTCON1, + 0x60, 0); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_VGEN2VOL, + 0x20, 0x20); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby vgen config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_VGEN4VOL, + 0x20, 0x20); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby vgen config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_VGEN5VOL, + 0x20, 0x20); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby vgen config failed %d\n", ret); + + ret = regmap_update_bits(pfuze_chip->regmap, + PFUZE100_VGEN6VOL, + 0x20, 0x20); + if (ret < 0) + dev_err(pfuze_chip->dev, "stby vgen config failed %d\n", ret); +} + static const struct dev_pm_ops pfuze_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pfuze_suspend, pfuze_resume) }; @@ -754,6 +826,7 @@ static struct i2c_driver pfuze_driver = { .pm = &pfuze_pm_ops, }, .probe = pfuze100_regulator_probe, + .shutdown = pfuze100_regulator_shutdown, }; module_i2c_driver(pfuze_driver); |