Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: tps65217: Set PMIC to shutdown on PWR_EN toggle

Set tps65217 PMIC status to OFF if power enable toggle is supported.
By setting this bit to 1 to enter PMIC to OFF state when PWR_EN pin
is pulled low. Also adds a DT flag to specify that device pmic
supports shutdown control or not.

Signed-off-by: Colin Foe-Parker <colin.foeparker@logicpd.com>
[anilkumar@ti.com: move the additions to tps65217 MFD driver]
Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Colin Foe-Parker and committed by
Samuel Ortiz
eb433dad 433e075c

+16
+4
Documentation/devicetree/bindings/regulator/tps65217.txt
··· 11 11 using the standard binding for regulators found at 12 12 Documentation/devicetree/bindings/regulator/regulator.txt. 13 13 14 + Optional properties: 15 + - ti,pmic-shutdown-controller: Telling the PMIC to shutdown on PWR_EN toggle. 16 + 14 17 The valid names for regulators are: 15 18 tps65217: dcdc1, dcdc2, dcdc3, ldo1, ldo2, ldo3 and ldo4 16 19 ··· 23 20 24 21 tps: tps@24 { 25 22 compatible = "ti,tps65217"; 23 + ti,pmic-shutdown-controller; 26 24 27 25 regulators { 28 26 dcdc1_reg: dcdc1 {
+12
drivers/mfd/tps65217.c
··· 160 160 unsigned int version; 161 161 unsigned int chip_id = ids->driver_data; 162 162 const struct of_device_id *match; 163 + bool status_off = false; 163 164 int ret; 164 165 165 166 if (client->dev.of_node) { ··· 171 170 return -EINVAL; 172 171 } 173 172 chip_id = (unsigned int)match->data; 173 + status_off = of_property_read_bool(client->dev.of_node, 174 + "ti,pmic-shutdown-controller"); 174 175 } 175 176 176 177 if (!chip_id) { ··· 208 205 dev_err(tps->dev, "Failed to read revision register: %d\n", 209 206 ret); 210 207 return ret; 208 + } 209 + 210 + /* Set the PMIC to shutdown on PWR_EN toggle */ 211 + if (status_off) { 212 + ret = tps65217_set_bits(tps, TPS65217_REG_STATUS, 213 + TPS65217_STATUS_OFF, TPS65217_STATUS_OFF, 214 + TPS65217_PROTECT_NONE); 215 + if (ret) 216 + dev_warn(tps->dev, "unable to set the status OFF\n"); 211 217 } 212 218 213 219 dev_info(tps->dev, "TPS65217 ID %#x version 1.%d\n",