summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-07-27 16:05:36 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2017-04-03 15:36:43 +0200
commit29ff2389ecf7cb4e30924c80b8d42165cf306936 (patch)
tree9663840e378c806c9d2d80e0f9a3619e14645404
parent94a53ed03961218fb89fe10f58afaba0219ae1e8 (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>
-rw-r--r--arch/arm/mach-imx/pm-imx6.c16
-rw-r--r--drivers/power/reset/imx-snvs-poweroff.c3
-rw-r--r--drivers/regulator/pfuze100-regulator.c73
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 54621f1958db..3ef6310319ae 100644
--- a/arch/arm/mach-imx/pm-imx6.c
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -1170,6 +1170,12 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata
IMX6Q_GPR1_GINT);
}
+void imx6_stop_mode_poweroff(void)
+{
+ imx6q_set_lpm(STOP_POWER_OFF);
+ cpu_do_idle();
+}
+
void __init imx6q_pm_init(void)
{
if (imx_mmdc_get_ddr_type() == IMX_DDR_TYPE_LPDDR2)
@@ -1181,6 +1187,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 e8099f4c2738..6fee588d3190 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -734,6 +734,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)
};
@@ -747,6 +819,7 @@ static struct i2c_driver pfuze_driver = {
.pm = &pfuze_pm_ops,
},
.probe = pfuze100_regulator_probe,
+ .shutdown = pfuze100_regulator_shutdown,
};
module_i2c_driver(pfuze_driver);