diff options
-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 e58cfa195794..fe9b4999fb15 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -1315,6 +1315,12 @@ void __init imx6_pm_ccm_init(const char *ccm_compat) imx6_pm_stby_poweroff_probe(); } +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) @@ -1326,6 +1332,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 f409ce850563..16af1f0c24d1 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -774,6 +774,78 @@ err_ret: } #endif +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) }; @@ -786,6 +858,7 @@ static struct i2c_driver pfuze_driver = { .pm = &pfuze_pm_ops, }, .probe = pfuze100_regulator_probe, + .shutdown = pfuze100_regulator_shutdown, }; module_i2c_driver(pfuze_driver); |