summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav Furman <yaro330@gmail.com>2020-05-11 21:09:17 +0300
committerDavide Garberi <dade.garberi@gmail.com>2021-10-07 20:10:10 +0200
commitd7b241410f69072158e719422438c20b3d1099d7 (patch)
tree8b00f4818c3d75adc4c7c9cd1a976dcf34dd32f2
parent787bd11ad74251df61faa32bc1ac5977060561d6 (diff)
of: batterydata: add a relaxed version of battery resistance checks
There are some replacement batteries that have higher than 100 kohm. They are """fine""" to use since they have the same capacity and seem to have the same name as the latest battery revision for Z2 from lenovo. Let's allow people to use those batteries. Signed-off-by: Yaroslav Furman <yaro330@gmail.com> Change-Id: I2605d127e0b0a80b469fdfb6519c19dc25f05569
-rw-r--r--drivers/of/of_batterydata.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/of/of_batterydata.c b/drivers/of/of_batterydata.c
index d5771c78605d..64ff988cdfa8 100644
--- a/drivers/of/of_batterydata.c
+++ b/drivers/of/of_batterydata.c
@@ -366,6 +366,19 @@ struct device_node *of_batterydata_get_best_profile(
best_delta = 0;
delta = 0;
break;
+ } else {
+ pr_info("using relaxed battery checks\n");
+ if ((batt_ids.kohm[i] == 9) ||
+ (batt_ids.kohm[i] == 50) ||
+ (batt_ids.kohm[i] == 100)) {
+ best_node = node;
+ best_id_kohm = batt_ids.kohm[i];
+ in_range = false;
+ limit = 0;
+ best_delta = 0;
+ delta = 0;
+ break;
+ }
}
#else
delta = abs(batt_ids.kohm[i] - batt_id_kohm);
@@ -455,6 +468,16 @@ int of_batterydata_read_data(struct device_node *batterydata_container_node,
best_id_kohm = batt_ids.kohm[i];
delta = 0;
break;
+ } else {
+ pr_info("using relaxed battery checks\n");
+ if ((batt_ids.kohm[i] == 9) ||
+ (batt_ids.kohm[i] == 50) ||
+ (batt_ids.kohm[i] == 100)) {
+ best_node = node;
+ best_id_kohm = batt_ids.kohm[i];
+ delta = 0;
+ break;
+ }
}
#else
delta = abs(batt_ids.kohm[i] - batt_id_kohm);