/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ * Copyright (C) 2018 XiaoMi, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
int batt_id_kohm, const char *batt_type)
{
struct batt_ids batt_ids;
+#ifdef CONFIG_MACH_XIAOMI_MSM8998
+ struct device_node *node, *best_node = NULL, *generic_node = NULL;
+#else
struct device_node *node, *best_node = NULL;
+#endif
const char *battery_type = NULL;
int delta = 0, best_delta = 0, best_id_kohm = 0, id_range_pct,
i = 0, rc = 0, limit = 0;
}
}
}
+#ifdef CONFIG_MACH_XIAOMI_MSM8998
+ rc = of_property_read_string(node, "qcom,battery-type",
+ &battery_type);
+ if (!rc && strcmp(battery_type, "itech_3000mah") == 0)
+ generic_node = node;
+#endif
}
if (best_node == NULL) {
+#ifdef CONFIG_MACH_XIAOMI_MSM8998
+ /* now that best_node is null, there is no need to
+ * check whether generic node is null. */
+ best_node = generic_node;
+ pr_err("No battery data found,use generic one\n");
+#else
pr_err("No battery data found\n");
+#endif
return best_node;
}