Loading Documentation/devicetree/bindings/batterydata/batterydata.txt +6 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,12 @@ qcom,battery-data node required properties: - qcom,vref-batt-therm-uv : The vadc voltage used to make readings. For Qualcomm VADCs this should be 1800000uV. qcom,battery-data node optional properties: - qcom,batt-id-range-pct : The area of variation between upper and lower bound for which a given battery ID resistance is valid. This value is expressed as a percentage of the specified kohm resistance provided by qcom,batt-id-kohm. qcom,battery-data can also include any number of children nodes. These children nodes will be treated as battery profile data nodes. Loading drivers/of/of_batterydata.c +19 −1 Original line number Diff line number Diff line Loading @@ -315,7 +315,7 @@ struct device_node *of_batterydata_get_best_profile( struct power_supply *psy; const char *battery_type = NULL; union power_supply_propval ret = {0, }; int delta = 0, best_delta = 0, best_id_kohm = 0, int delta = 0, best_delta = 0, best_id_kohm = 0, id_range_pct, batt_id_kohm = 0, i = 0, rc = 0; psy = power_supply_get_by_name(psy_name); Loading Loading @@ -356,6 +356,24 @@ struct device_node *of_batterydata_get_best_profile( return best_node; } /* read battery id value for best profile */ rc = of_property_read_u32(batterydata_container_node, "qcom,batt-id-range-pct", &id_range_pct); if (!rc) { /* check that profile id is in range of the measured batt_id */ if (abs(best_id_kohm - batt_id_kohm) > ((best_id_kohm * id_range_pct) / 100)) { pr_err("out of range: profile id %d batt id %d pct %d", best_id_kohm, batt_id_kohm, id_range_pct); return NULL; } } else if (rc == -EINVAL) { rc = 0; } else { pr_err("failed to read battery id range\n"); return ERR_PTR(-ENXIO); } rc = of_property_read_string(best_node, "qcom,battery-type", &battery_type); if (!rc) Loading Loading
Documentation/devicetree/bindings/batterydata/batterydata.txt +6 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,12 @@ qcom,battery-data node required properties: - qcom,vref-batt-therm-uv : The vadc voltage used to make readings. For Qualcomm VADCs this should be 1800000uV. qcom,battery-data node optional properties: - qcom,batt-id-range-pct : The area of variation between upper and lower bound for which a given battery ID resistance is valid. This value is expressed as a percentage of the specified kohm resistance provided by qcom,batt-id-kohm. qcom,battery-data can also include any number of children nodes. These children nodes will be treated as battery profile data nodes. Loading
drivers/of/of_batterydata.c +19 −1 Original line number Diff line number Diff line Loading @@ -315,7 +315,7 @@ struct device_node *of_batterydata_get_best_profile( struct power_supply *psy; const char *battery_type = NULL; union power_supply_propval ret = {0, }; int delta = 0, best_delta = 0, best_id_kohm = 0, int delta = 0, best_delta = 0, best_id_kohm = 0, id_range_pct, batt_id_kohm = 0, i = 0, rc = 0; psy = power_supply_get_by_name(psy_name); Loading Loading @@ -356,6 +356,24 @@ struct device_node *of_batterydata_get_best_profile( return best_node; } /* read battery id value for best profile */ rc = of_property_read_u32(batterydata_container_node, "qcom,batt-id-range-pct", &id_range_pct); if (!rc) { /* check that profile id is in range of the measured batt_id */ if (abs(best_id_kohm - batt_id_kohm) > ((best_id_kohm * id_range_pct) / 100)) { pr_err("out of range: profile id %d batt id %d pct %d", best_id_kohm, batt_id_kohm, id_range_pct); return NULL; } } else if (rc == -EINVAL) { rc = 0; } else { pr_err("failed to read battery id range\n"); return ERR_PTR(-ENXIO); } rc = of_property_read_string(best_node, "qcom,battery-type", &battery_type); if (!rc) Loading