Skip to content

Commit a231a5c

Browse files
committed
mfd: tps65910: Set PWR_OFF bit during driver probe
The PWR_OFF bit needs to be set in order to power off properly, without hanging PMIC. This bit needs to be set early in order to allow thermal protection of NVIDIA Terga SoCs to power off hardware properly, otherwise a battery re-plug may be needed on some devices to recover after the hang. Cc: <stable@vger.kernel.org> Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF201 Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
1 parent 57eea87 commit a231a5c

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

drivers/mfd/tps65910.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,6 @@ static void tps65910_power_off(void *data)
437437

438438
tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);
439439

440-
/*
441-
* The PWR_OFF bit needs to be set separately, before transitioning
442-
* to the OFF state. It enables the "sequential" power-off mode on
443-
* TPS65911, it's a NO-OP on TPS65910.
444-
*/
445-
if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL,
446-
DEVCTRL_PWR_OFF_MASK) < 0)
447-
return;
448-
449440
regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL,
450441
DEVCTRL_DEV_OFF_MASK | DEVCTRL_DEV_ON_MASK,
451442
DEVCTRL_DEV_OFF_MASK);
@@ -505,6 +496,19 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
505496
tps65910_sleepinit(tps65910, pmic_plat_data);
506497

507498
if (pmic_plat_data->pm_off) {
499+
/*
500+
* The PWR_OFF bit needs to be set separately, before
501+
* transitioning to the OFF state. It enables the "sequential"
502+
* power-off mode on TPS65911, it's a NO-OP on TPS65910.
503+
*/
504+
ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL,
505+
DEVCTRL_PWR_OFF_MASK);
506+
if (ret) {
507+
dev_err(&i2c->dev, "failed to set power-off mode: %d\n",
508+
ret);
509+
return ret;
510+
}
511+
508512
ret = devm_register_simple_power_off_handler(&i2c->dev,
509513
tps65910_power_off,
510514
i2c);

0 commit comments

Comments
 (0)