Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1518700

[PATCH v2 3/5] mfd: palmas: Reset the POWERHOLD mux during power off

From Keerthy <j-keerthy@ti.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/5] mfd: palmas: Reset the POWERHOLD mux during power off
Date 2016-11-10 06:40 +0100
Message-ID <sBQfD-1gO-3@gated-at.bofh.it> (permalink)
References <sBPMB-13Z-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


POWERHOLD signal has higher priority  over the DEV_ON bit.
So power off will not happen if the POWERHOLD is held high.
Hence reset the MUX to GPIO_7 mode to release the POWERHOLD
and the DEV_ON bit to take effect to power off the PMIC.

PMIC Power off happens in dire situations like thermal shutdown
so irrespective of the POWERHOLD setting go ahead and turn off
the powerhold.  Currently poweroff is broken on boards that have
powerhold enabled. This fixes poweroff on those boards.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---

Changes in v2:

  * Changed pr_err to dev_err
  * removed redundant boolean variable override-powerhold

 drivers/mfd/palmas.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index ee9e9ea..da90124 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -430,6 +430,20 @@ static void palmas_power_off(void)
 {
 	unsigned int addr;
 	int ret, slave;
+	struct device_node *np = palmas_dev->dev->of_node;
+
+	if (of_property_read_bool(np, "ti,palmas-override-powerhold")) {
+		addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE,
+					  PALMAS_PRIMARY_SECONDARY_PAD2);
+		slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE);
+
+		ret = regmap_update_bits(palmas_dev->regmap[slave], addr,
+				PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0);
+		if (ret)
+			dev_err(palmas_dev->dev,
+				"Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
+				ret);
+	}
 
 	slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE);
 	addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] mfd: palmas: add powerhold overriding during power off Keerthy <j-keerthy@ti.com> - 2016-11-10 06:10 +0100
  [PATCH v2 2/5] mfd: palmas: Remove redundant check in palmas_power_off Keerthy <j-keerthy@ti.com> - 2016-11-10 06:10 +0100
  [PATCH v2 5/5] arm: dts: am57xx-idk-common: Add overide powerhold property Keerthy <j-keerthy@ti.com> - 2016-11-10 06:20 +0100
  [PATCH v2 4/5] arm: dts: am57xx-beagle-x15-common: Add overide powerhold property Keerthy <j-keerthy@ti.com> - 2016-11-10 06:20 +0100
  [PATCH v2 1/5] Documentation: pinctrl: palmas: Add ti,palmas-powerhold-override property definition Keerthy <j-keerthy@ti.com> - 2016-11-10 06:20 +0100
  [PATCH v2 3/5] mfd: palmas: Reset the POWERHOLD mux during power off Keerthy <j-keerthy@ti.com> - 2016-11-10 06:40 +0100

csiph-web