From 82cd1a2a04e24b92976d46fc8a55dd7574929391 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 20 May 2019 09:47:07 +0200 Subject: 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 --- drivers/power/pmic/stpmic1.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/power') 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; -- cgit v1.2.3 From c8a8937b92f467aca377953db35ef7a454f4f1d8 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 21 Jun 2019 15:26:49 +0200 Subject: power: regulator: stm32: Fix warnings when compiling with W=1 This patch solves the following warnings: drivers/power/regulator/stm32-vrefbuf.c: In function 'stm32_vrefbuf_set_value': warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (uV == stm32_vrefbuf_voltages[i]) { ^~ Signed-off-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- drivers/power/regulator/stm32-vrefbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/power') diff --git a/drivers/power/regulator/stm32-vrefbuf.c b/drivers/power/regulator/stm32-vrefbuf.c index 0ad6833ed04..645528e84e8 100644 --- a/drivers/power/regulator/stm32-vrefbuf.c +++ b/drivers/power/regulator/stm32-vrefbuf.c @@ -30,7 +30,7 @@ struct stm32_vrefbuf { struct udevice *vdda_supply; }; -static const unsigned int stm32_vrefbuf_voltages[] = { +static const int stm32_vrefbuf_voltages[] = { /* Matches resp. VRS = 000b, 001b, 010b, 011b */ 2500000, 2048000, 1800000, 1500000, }; -- cgit v1.2.3 From 92be6834da54efaa61ebee70a7dfd7005a7b9bf5 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 21 Jun 2019 15:26:53 +0200 Subject: power: stpmic1: Fix warnings when compiling with W=1 This patch solves the following warnings: warning: this statement may fall through [-Wimplicit-fallthrough=] Signed-off-by: Patrick Delaunay --- drivers/power/regulator/stpmic1.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/power') diff --git a/drivers/power/regulator/stpmic1.c b/drivers/power/regulator/stpmic1.c index 50ef2a21d18..1e3f96f3a08 100644 --- a/drivers/power/regulator/stpmic1.c +++ b/drivers/power/regulator/stpmic1.c @@ -422,6 +422,7 @@ static int stpmic1_ldo_set_mode(struct udevice *dev, int mode) case STPMIC1_LDO_MODE_SINK_SOURCE: ret &= ~STPMIC1_LDO12356_VOUT_MASK; ret |= STPMIC1_LDO3_DDR_SEL << STPMIC1_LDO12356_VOUT_SHIFT; + /* fallthrough */ case STPMIC1_LDO_MODE_NORMAL: ret &= ~STPMIC1_LDO3_MODE; break; -- cgit v1.2.3