aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay2019-05-20 09:47:07 +0200
committerPatrick Delaunay2019-07-12 11:18:53 +0200
commit82cd1a2a04e24b92976d46fc8a55dd7574929391 (patch)
treed8477d68ae183a74768136c9a1098bf5e86ed057
parent35a54d41d9d4e91f75c87a16f7db7e362549d4f9 (diff)
pmic: stpmic1: add support for SYSRESET_POWER_OFF
Adds support for SYSRESET_POWER_OFF = PMIC power off used by command power off and introduced by commit 751fed426f87 ("sysreset: Add a way to find the last reset"). The driver use SYSRESET_POWER for the PMIC-level power cycle, with restart. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
-rw-r--r--drivers/power/pmic/stpmic1.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/power/pmic/stpmic1.c b/drivers/power/pmic/stpmic1.c
index 65296c5fc3a..c3381489dda 100644
--- a/drivers/power/pmic/stpmic1.c
+++ b/drivers/power/pmic/stpmic1.c
@@ -221,7 +221,7 @@ static int stpmic1_sysreset_request(struct udevice *dev, enum sysreset_t type)
struct udevice *pmic_dev;
int ret;
- if (type != SYSRESET_POWER)
+ if (type != SYSRESET_POWER && type != SYSRESET_POWER_OFF)
return -EPROTONOSUPPORT;
ret = uclass_get_device_by_driver(UCLASS_PMIC,
@@ -235,8 +235,13 @@ static int stpmic1_sysreset_request(struct udevice *dev, enum sysreset_t type)
if (ret < 0)
return ret;
- ret = pmic_reg_write(pmic_dev, STPMIC1_MAIN_CR,
- ret | STPMIC1_SWOFF | STPMIC1_RREQ_EN);
+ ret |= STPMIC1_SWOFF;
+ ret &= ~STPMIC1_RREQ_EN;
+ /* request Power Cycle */
+ if (type == SYSRESET_POWER)
+ ret |= STPMIC1_RREQ_EN;
+
+ ret = pmic_reg_write(pmic_dev, STPMIC1_MAIN_CR, ret);
if (ret < 0)
return ret;