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

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>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF201
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211124190104.23554-1-digetx@gmail.com

authored by

Dmitry Osipenko and committed by
Lee Jones
7620ad0b 5b78223f

+13 -9
+13 -9
drivers/mfd/tps65910.c
··· 436 436 437 437 tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); 438 438 439 - /* 440 - * The PWR_OFF bit needs to be set separately, before transitioning 441 - * to the OFF state. It enables the "sequential" power-off mode on 442 - * TPS65911, it's a NO-OP on TPS65910. 443 - */ 444 - if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, 445 - DEVCTRL_PWR_OFF_MASK) < 0) 446 - return; 447 - 448 439 regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL, 449 440 DEVCTRL_DEV_OFF_MASK | DEVCTRL_DEV_ON_MASK, 450 441 DEVCTRL_DEV_OFF_MASK); ··· 495 504 tps65910_sleepinit(tps65910, pmic_plat_data); 496 505 497 506 if (pmic_plat_data->pm_off && !pm_power_off) { 507 + /* 508 + * The PWR_OFF bit needs to be set separately, before 509 + * transitioning to the OFF state. It enables the "sequential" 510 + * power-off mode on TPS65911, it's a NO-OP on TPS65910. 511 + */ 512 + ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, 513 + DEVCTRL_PWR_OFF_MASK); 514 + if (ret) { 515 + dev_err(&i2c->dev, "failed to set power-off mode: %d\n", 516 + ret); 517 + return ret; 518 + } 519 + 498 520 tps65910_i2c_client = i2c; 499 521 pm_power_off = tps65910_power_off; 500 522 }