Loading Documentation/devicetree/bindings/batterydata/batterydata.txt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -82,10 +82,15 @@ Profile data node optional properties: If yes, the low and high thresholds defined in If yes, the low and high thresholds defined in "qcom,step-chg-ranges" tuples should be assigned as "qcom,step-chg-ranges" tuples should be assigned as SoC values in percentage. SoC values in percentage. - qcom,ocv-based-step-chg: A bool property to indicate if the battery will perform OCV (Open Circuit Voltage) based step charging. If yes, the low and high thresholds defined in "qcom,step-chg-ranges" tuples should be assigned as OCV values in microvolts. - qcom,step-chg-ranges: Array of tuples in which a tuple describes a range - qcom,step-chg-ranges: Array of tuples in which a tuple describes a range data of step charging setting. data of step charging setting. A range contains following 3 integer elements: A range contains following 3 integer elements: [0]: the low threshold of battery votlage in uV [0]: the low threshold of battery voltage in uV or SoC (State of Charge) in percentage when or SoC (State of Charge) in percentage when SoC based step charge is used; SoC based step charge is used; [1]: the high threshold of battery voltage in uV [1]: the high threshold of battery voltage in uV Loading drivers/power/supply/qcom/step-chg-jeita.c +26 −5 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ struct step_chg_info { bool step_chg_cfg_valid; bool step_chg_cfg_valid; bool sw_jeita_cfg_valid; bool sw_jeita_cfg_valid; bool soc_based_step_chg; bool soc_based_step_chg; bool ocv_based_step_chg; bool batt_missing; bool batt_missing; int jeita_fcc_index; int jeita_fcc_index; int jeita_fv_index; int jeita_fv_index; Loading Loading @@ -267,6 +268,16 @@ static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip) chip->step_chg_config->param.hysteresis = 0; chip->step_chg_config->param.hysteresis = 0; } } chip->ocv_based_step_chg = of_property_read_bool(profile_node, "qcom,ocv-based-step-chg"); if (chip->ocv_based_step_chg) { chip->step_chg_config->param.psy_prop = POWER_SUPPLY_PROP_VOLTAGE_OCV; chip->step_chg_config->param.prop_name = "OCV"; chip->step_chg_config->param.hysteresis = 10000; chip->step_chg_config->param.use_bms = true; } chip->step_chg_cfg_valid = true; chip->step_chg_cfg_valid = true; rc = read_range_data_from_node(profile_node, rc = read_range_data_from_node(profile_node, "qcom,step-chg-ranges", "qcom,step-chg-ranges", Loading Loading @@ -453,8 +464,13 @@ static int handle_step_chg_config(struct step_chg_info *chip) goto update_time; goto update_time; } } if (chip->step_chg_config->param.use_bms) rc = power_supply_get_property(chip->bms_psy, chip->step_chg_config->param.psy_prop, &pval); else rc = power_supply_get_property(chip->batt_psy, rc = power_supply_get_property(chip->batt_psy, chip->step_chg_config->param.psy_prop, &pval); chip->step_chg_config->param.psy_prop, &pval); if (rc < 0) { if (rc < 0) { pr_err("Couldn't read %s property rc=%d\n", pr_err("Couldn't read %s property rc=%d\n", chip->step_chg_config->param.prop_name, rc); chip->step_chg_config->param.prop_name, rc); Loading Loading @@ -521,8 +537,13 @@ static int handle_jeita(struct step_chg_info *chip) if (elapsed_us < STEP_CHG_HYSTERISIS_DELAY_US) if (elapsed_us < STEP_CHG_HYSTERISIS_DELAY_US) goto reschedule; goto reschedule; if (chip->jeita_fcc_config->param.use_bms) rc = power_supply_get_property(chip->bms_psy, chip->jeita_fcc_config->param.psy_prop, &pval); else rc = power_supply_get_property(chip->batt_psy, rc = power_supply_get_property(chip->batt_psy, chip->jeita_fcc_config->param.psy_prop, &pval); chip->jeita_fcc_config->param.psy_prop, &pval); if (rc < 0) { if (rc < 0) { pr_err("Couldn't read %s property rc=%d\n", pr_err("Couldn't read %s property rc=%d\n", chip->jeita_fcc_config->param.prop_name, rc); chip->jeita_fcc_config->param.prop_name, rc); Loading Loading @@ -650,7 +671,7 @@ static void status_change_work(struct work_struct *work) int reschedule_step_work_us = 0; int reschedule_step_work_us = 0; union power_supply_propval prop = {0, }; union power_supply_propval prop = {0, }; if (!is_batt_available(chip)) if (!is_batt_available(chip) || !is_bms_available(chip)) goto exit_work; goto exit_work; handle_battery_insertion(chip); handle_battery_insertion(chip); Loading drivers/power/supply/qcom/step-chg-jeita.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ struct step_chg_jeita_param { u32 psy_prop; u32 psy_prop; char *prop_name; char *prop_name; int hysteresis; int hysteresis; bool use_bms; }; }; struct range_data { struct range_data { Loading Loading
Documentation/devicetree/bindings/batterydata/batterydata.txt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -82,10 +82,15 @@ Profile data node optional properties: If yes, the low and high thresholds defined in If yes, the low and high thresholds defined in "qcom,step-chg-ranges" tuples should be assigned as "qcom,step-chg-ranges" tuples should be assigned as SoC values in percentage. SoC values in percentage. - qcom,ocv-based-step-chg: A bool property to indicate if the battery will perform OCV (Open Circuit Voltage) based step charging. If yes, the low and high thresholds defined in "qcom,step-chg-ranges" tuples should be assigned as OCV values in microvolts. - qcom,step-chg-ranges: Array of tuples in which a tuple describes a range - qcom,step-chg-ranges: Array of tuples in which a tuple describes a range data of step charging setting. data of step charging setting. A range contains following 3 integer elements: A range contains following 3 integer elements: [0]: the low threshold of battery votlage in uV [0]: the low threshold of battery voltage in uV or SoC (State of Charge) in percentage when or SoC (State of Charge) in percentage when SoC based step charge is used; SoC based step charge is used; [1]: the high threshold of battery voltage in uV [1]: the high threshold of battery voltage in uV Loading
drivers/power/supply/qcom/step-chg-jeita.c +26 −5 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ struct step_chg_info { bool step_chg_cfg_valid; bool step_chg_cfg_valid; bool sw_jeita_cfg_valid; bool sw_jeita_cfg_valid; bool soc_based_step_chg; bool soc_based_step_chg; bool ocv_based_step_chg; bool batt_missing; bool batt_missing; int jeita_fcc_index; int jeita_fcc_index; int jeita_fv_index; int jeita_fv_index; Loading Loading @@ -267,6 +268,16 @@ static int get_step_chg_jeita_setting_from_profile(struct step_chg_info *chip) chip->step_chg_config->param.hysteresis = 0; chip->step_chg_config->param.hysteresis = 0; } } chip->ocv_based_step_chg = of_property_read_bool(profile_node, "qcom,ocv-based-step-chg"); if (chip->ocv_based_step_chg) { chip->step_chg_config->param.psy_prop = POWER_SUPPLY_PROP_VOLTAGE_OCV; chip->step_chg_config->param.prop_name = "OCV"; chip->step_chg_config->param.hysteresis = 10000; chip->step_chg_config->param.use_bms = true; } chip->step_chg_cfg_valid = true; chip->step_chg_cfg_valid = true; rc = read_range_data_from_node(profile_node, rc = read_range_data_from_node(profile_node, "qcom,step-chg-ranges", "qcom,step-chg-ranges", Loading Loading @@ -453,8 +464,13 @@ static int handle_step_chg_config(struct step_chg_info *chip) goto update_time; goto update_time; } } if (chip->step_chg_config->param.use_bms) rc = power_supply_get_property(chip->bms_psy, chip->step_chg_config->param.psy_prop, &pval); else rc = power_supply_get_property(chip->batt_psy, rc = power_supply_get_property(chip->batt_psy, chip->step_chg_config->param.psy_prop, &pval); chip->step_chg_config->param.psy_prop, &pval); if (rc < 0) { if (rc < 0) { pr_err("Couldn't read %s property rc=%d\n", pr_err("Couldn't read %s property rc=%d\n", chip->step_chg_config->param.prop_name, rc); chip->step_chg_config->param.prop_name, rc); Loading Loading @@ -521,8 +537,13 @@ static int handle_jeita(struct step_chg_info *chip) if (elapsed_us < STEP_CHG_HYSTERISIS_DELAY_US) if (elapsed_us < STEP_CHG_HYSTERISIS_DELAY_US) goto reschedule; goto reschedule; if (chip->jeita_fcc_config->param.use_bms) rc = power_supply_get_property(chip->bms_psy, chip->jeita_fcc_config->param.psy_prop, &pval); else rc = power_supply_get_property(chip->batt_psy, rc = power_supply_get_property(chip->batt_psy, chip->jeita_fcc_config->param.psy_prop, &pval); chip->jeita_fcc_config->param.psy_prop, &pval); if (rc < 0) { if (rc < 0) { pr_err("Couldn't read %s property rc=%d\n", pr_err("Couldn't read %s property rc=%d\n", chip->jeita_fcc_config->param.prop_name, rc); chip->jeita_fcc_config->param.prop_name, rc); Loading Loading @@ -650,7 +671,7 @@ static void status_change_work(struct work_struct *work) int reschedule_step_work_us = 0; int reschedule_step_work_us = 0; union power_supply_propval prop = {0, }; union power_supply_propval prop = {0, }; if (!is_batt_available(chip)) if (!is_batt_available(chip) || !is_bms_available(chip)) goto exit_work; goto exit_work; handle_battery_insertion(chip); handle_battery_insertion(chip); Loading
drivers/power/supply/qcom/step-chg-jeita.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,7 @@ struct step_chg_jeita_param { u32 psy_prop; u32 psy_prop; char *prop_name; char *prop_name; int hysteresis; int hysteresis; bool use_bms; }; }; struct range_data { struct range_data { Loading