Loading drivers/of/of_batterydata.c +21 −11 Original line number Diff line number Diff line Loading @@ -308,7 +308,7 @@ static int64_t of_batterydata_convert_battery_id_kohm(int batt_id_uv, struct device_node *of_batterydata_get_best_profile( const struct device_node *batterydata_container_node, const char *psy_name) const char *psy_name, const char *batt_type) { struct batt_ids batt_ids; struct device_node *node, *best_node = NULL; Loading Loading @@ -336,6 +336,15 @@ struct device_node *of_batterydata_get_best_profile( * Find the battery data with a battery id resistor closest to this one */ for_each_child_of_node(batterydata_container_node, node) { if (batt_type != NULL) { rc = of_property_read_string(node, "qcom,battery-type", &battery_type); if (!rc && strcmp(battery_type, batt_type) == 0) { best_node = node; best_id_kohm = batt_id_kohm; break; } } else { rc = of_batterydata_read_batt_id_kohm(node, "qcom,batt-id-kohm", &batt_ids); Loading @@ -350,6 +359,7 @@ struct device_node *of_batterydata_get_best_profile( } } } } if (best_node == NULL) { pr_err("No battery data found\n"); Loading drivers/power/qpnp-fg.c +11 −2 Original line number Diff line number Diff line Loading @@ -175,6 +175,11 @@ module_param_named( first_est_dump, fg_est_dump, int, S_IRUSR | S_IWUSR ); static char *fg_batt_type; module_param_named( battery_type, fg_batt_type, charp, S_IRUSR | S_IWUSR ); struct fg_irq { int irq; unsigned long disabled; Loading Loading @@ -1447,7 +1452,8 @@ wait: return 0; } profile_node = of_batterydata_get_best_profile(batt_node, "bms"); profile_node = of_batterydata_get_best_profile(batt_node, "bms", fg_batt_type); if (!profile_node) { pr_err("couldn't find profile handle\n"); return -ENODATA; Loading Loading @@ -1648,6 +1654,9 @@ wait: goto fail; } done: if (fg_batt_type) chip->batt_type = fg_batt_type; else chip->batt_type = batt_type_str; chip->profile_loaded = true; chip->battery_missing = is_battery_missing(chip); Loading include/linux/of_batterydata.h +2 −1 Original line number Diff line number Diff line Loading @@ -43,13 +43,14 @@ int of_batterydata_read_data(struct device_node *container_node, * POWER_SUPPLY_RESISTANCE_ID value to be used to match * against the id resistances specified in the corresponding * battery data profiles. * @batt_type: Battery type which we want to force load the profile. * * This routine returns a device_node pointer to the closest match battery data * from device tree based on the battery id reading. */ struct device_node *of_batterydata_get_best_profile( struct device_node *batterydata_container_node, const char *psy_name); const char *psy_name, const char *batt_type); #else static inline int of_batterydata_read_data(struct device_node *container_node, struct bms_battery_data *batt_data, Loading Loading
drivers/of/of_batterydata.c +21 −11 Original line number Diff line number Diff line Loading @@ -308,7 +308,7 @@ static int64_t of_batterydata_convert_battery_id_kohm(int batt_id_uv, struct device_node *of_batterydata_get_best_profile( const struct device_node *batterydata_container_node, const char *psy_name) const char *psy_name, const char *batt_type) { struct batt_ids batt_ids; struct device_node *node, *best_node = NULL; Loading Loading @@ -336,6 +336,15 @@ struct device_node *of_batterydata_get_best_profile( * Find the battery data with a battery id resistor closest to this one */ for_each_child_of_node(batterydata_container_node, node) { if (batt_type != NULL) { rc = of_property_read_string(node, "qcom,battery-type", &battery_type); if (!rc && strcmp(battery_type, batt_type) == 0) { best_node = node; best_id_kohm = batt_id_kohm; break; } } else { rc = of_batterydata_read_batt_id_kohm(node, "qcom,batt-id-kohm", &batt_ids); Loading @@ -350,6 +359,7 @@ struct device_node *of_batterydata_get_best_profile( } } } } if (best_node == NULL) { pr_err("No battery data found\n"); Loading
drivers/power/qpnp-fg.c +11 −2 Original line number Diff line number Diff line Loading @@ -175,6 +175,11 @@ module_param_named( first_est_dump, fg_est_dump, int, S_IRUSR | S_IWUSR ); static char *fg_batt_type; module_param_named( battery_type, fg_batt_type, charp, S_IRUSR | S_IWUSR ); struct fg_irq { int irq; unsigned long disabled; Loading Loading @@ -1447,7 +1452,8 @@ wait: return 0; } profile_node = of_batterydata_get_best_profile(batt_node, "bms"); profile_node = of_batterydata_get_best_profile(batt_node, "bms", fg_batt_type); if (!profile_node) { pr_err("couldn't find profile handle\n"); return -ENODATA; Loading Loading @@ -1648,6 +1654,9 @@ wait: goto fail; } done: if (fg_batt_type) chip->batt_type = fg_batt_type; else chip->batt_type = batt_type_str; chip->profile_loaded = true; chip->battery_missing = is_battery_missing(chip); Loading
include/linux/of_batterydata.h +2 −1 Original line number Diff line number Diff line Loading @@ -43,13 +43,14 @@ int of_batterydata_read_data(struct device_node *container_node, * POWER_SUPPLY_RESISTANCE_ID value to be used to match * against the id resistances specified in the corresponding * battery data profiles. * @batt_type: Battery type which we want to force load the profile. * * This routine returns a device_node pointer to the closest match battery data * from device tree based on the battery id reading. */ struct device_node *of_batterydata_get_best_profile( struct device_node *batterydata_container_node, const char *psy_name); const char *psy_name, const char *batt_type); #else static inline int of_batterydata_read_data(struct device_node *container_node, struct bms_battery_data *batt_data, Loading