summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav Furman <yaro330@gmail.com>2020-05-11 21:09:17 +0300
committerDavide Garberi <dade.garberi@gmail.com>2020-05-11 20:35:12 +0200
commitad5a851a31ea7fa1e087ea1e482a7ca0fadbee48 (patch)
treef40257c9d5b2193c1edc2fa486096da51d595477
parent7582db1f80ff7ae43f2b7dd75ec2bfa834690f9e (diff)
of: batterydata: add a relaxed version of battery resistance checkslineage-17.1
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);