Skip to content

Commit bbcfe51

Browse files
macromorgansre
authored andcommitted
power: supply: axp20x_battery: Update temp sensor for AXP717 from device tree
Allow a boolean property of "x-powers,no-thermistor" to specify devices where the ts pin is not connected to anything. This works around an issue found with some devices where the efuse is not programmed correctly from the factory or when the register gets set erroneously. Signed-off-by: Chris Morgan <[email protected]> Tested-by: Philippe Simons <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 6260065 commit bbcfe51

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/power/supply/axp20x_battery.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
#define AXP717_BAT_CC_MIN_UA 0
9090
#define AXP717_BAT_CC_MAX_UA 3008000
9191

92+
#define AXP717_TS_PIN_DISABLE BIT(4)
93+
9294
struct axp20x_batt_ps;
9395

9496
struct axp_data {
@@ -117,6 +119,7 @@ struct axp20x_batt_ps {
117119
/* Maximum constant charge current */
118120
unsigned int max_ccc;
119121
const struct axp_data *data;
122+
bool ts_disable;
120123
};
121124

122125
static int axp20x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
@@ -985,6 +988,24 @@ static void axp717_set_battery_info(struct platform_device *pdev,
985988
int ccc = info->constant_charge_current_max_ua;
986989
int val;
987990

991+
axp_batt->ts_disable = (device_property_read_bool(axp_batt->dev,
992+
"x-powers,no-thermistor"));
993+
994+
/*
995+
* Under rare conditions an incorrectly programmed efuse for
996+
* the temp sensor on the PMIC may trigger a fault condition.
997+
* Allow users to hard-code if the ts pin is not used to work
998+
* around this problem. Note that this requires the battery
999+
* be correctly defined in the device tree with a monitored
1000+
* battery node.
1001+
*/
1002+
if (axp_batt->ts_disable) {
1003+
regmap_update_bits(axp_batt->regmap,
1004+
AXP717_TS_PIN_CFG,
1005+
AXP717_TS_PIN_DISABLE,
1006+
AXP717_TS_PIN_DISABLE);
1007+
}
1008+
9881009
if (vmin > 0 && axp717_set_voltage_min_design(axp_batt, vmin))
9891010
dev_err(&pdev->dev,
9901011
"couldn't set voltage_min_design\n");

0 commit comments

Comments
 (0)