@@ -946,6 +946,22 @@ static int tps25750_apply_patch(struct tps6598x *tps)
} while (ret != TPS_MODE_APP);
+ /*
+ * The dead battery flag may be triggered when the controller
+ * port is connected to a device that can source power and
+ * attempts to power up both the controller and the board it is on.
+ * To restore controller functionality, it is necessary to clear
+ * this flag
+ */
+ if (status & TPS_BOOT_STATUS_DEAD_BATTERY_FLAG) {
+ ret = tps6598x_exec_cmd(tps, "DBfg", 0, NULL, 0, NULL);
+ if (ret) {
+ dev_err(tps->dev,
+ "failed to clear dead battery %d\n", ret);
+ return ret;
+ }
+ }
+
dev_info(tps->dev, "controller switched to \"APP\" mode\n");
return 0;
@@ -200,6 +200,7 @@
#define TPS_DATA_STATUS_DP_SPEC_PIN_ASSIGNMENT_B (BIT(2) | BIT(1))
/* BOOT STATUS REG*/
+#define TPS_BOOT_STATUS_DEAD_BATTERY_FLAG BIT(2)
#define TPS_BOOT_STATUS_I2C_EEPROM_PRESENT BIT(3)
#endif /* __TPS6598X_H__ */