Merge "power: qpnp-fg-gen3: add SOC_REPORTING_READY property"
This commit is contained in:
commit
684de02b48
4 changed files with 13 additions and 1 deletions
|
@ -278,6 +278,7 @@ static struct device_attribute power_supply_attrs[] = {
|
||||||
POWER_SUPPLY_ATTR(parallel_percent),
|
POWER_SUPPLY_ATTR(parallel_percent),
|
||||||
POWER_SUPPLY_ATTR(pe_start),
|
POWER_SUPPLY_ATTR(pe_start),
|
||||||
POWER_SUPPLY_ATTR(set_ship_mode),
|
POWER_SUPPLY_ATTR(set_ship_mode),
|
||||||
|
POWER_SUPPLY_ATTR(soc_reporting_ready),
|
||||||
/* Local extensions of type int64_t */
|
/* Local extensions of type int64_t */
|
||||||
POWER_SUPPLY_ATTR(charge_counter_ext),
|
POWER_SUPPLY_ATTR(charge_counter_ext),
|
||||||
/* Properties of type `const char *' */
|
/* Properties of type `const char *' */
|
||||||
|
|
|
@ -335,6 +335,7 @@ struct fg_chip {
|
||||||
bool recharge_soc_adjusted;
|
bool recharge_soc_adjusted;
|
||||||
bool ki_coeff_dischg_en;
|
bool ki_coeff_dischg_en;
|
||||||
bool esr_fcc_ctrl_en;
|
bool esr_fcc_ctrl_en;
|
||||||
|
bool soc_reporting_ready;
|
||||||
struct completion soc_update;
|
struct completion soc_update;
|
||||||
struct completion soc_ready;
|
struct completion soc_ready;
|
||||||
struct delayed_work profile_load_work;
|
struct delayed_work profile_load_work;
|
||||||
|
|
|
@ -2050,6 +2050,7 @@ done:
|
||||||
|
|
||||||
fg_notify_charger(chip);
|
fg_notify_charger(chip);
|
||||||
chip->profile_loaded = true;
|
chip->profile_loaded = true;
|
||||||
|
chip->soc_reporting_ready = true;
|
||||||
fg_dbg(chip, FG_STATUS, "profile loaded successfully");
|
fg_dbg(chip, FG_STATUS, "profile loaded successfully");
|
||||||
out:
|
out:
|
||||||
vote(chip->awake_votable, PROFILE_LOAD, false, 0);
|
vote(chip->awake_votable, PROFILE_LOAD, false, 0);
|
||||||
|
@ -2386,6 +2387,9 @@ static int fg_psy_get_property(struct power_supply *psy,
|
||||||
case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
|
case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
|
||||||
rc = fg_get_time_to_empty(chip, &pval->intval);
|
rc = fg_get_time_to_empty(chip, &pval->intval);
|
||||||
break;
|
break;
|
||||||
|
case POWER_SUPPLY_PROP_SOC_REPORTING_READY:
|
||||||
|
pval->intval = chip->soc_reporting_ready;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("unsupported property %d\n", psp);
|
pr_err("unsupported property %d\n", psp);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
|
@ -2483,6 +2487,7 @@ static enum power_supply_property fg_psy_props[] = {
|
||||||
POWER_SUPPLY_PROP_CHARGE_COUNTER,
|
POWER_SUPPLY_PROP_CHARGE_COUNTER,
|
||||||
POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
|
POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
|
||||||
POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
|
POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
|
||||||
|
POWER_SUPPLY_PROP_SOC_REPORTING_READY,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct power_supply_desc fg_psy_desc = {
|
static const struct power_supply_desc fg_psy_desc = {
|
||||||
|
@ -2773,9 +2778,11 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *data)
|
||||||
chip->profile_available = false;
|
chip->profile_available = false;
|
||||||
chip->profile_loaded = false;
|
chip->profile_loaded = false;
|
||||||
clear_cycle_counter(chip);
|
clear_cycle_counter(chip);
|
||||||
|
chip->soc_reporting_ready = false;
|
||||||
} else {
|
} else {
|
||||||
rc = fg_get_batt_profile(chip);
|
rc = fg_get_batt_profile(chip);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
chip->soc_reporting_ready = true;
|
||||||
pr_err("Error in getting battery profile, rc:%d\n", rc);
|
pr_err("Error in getting battery profile, rc:%d\n", rc);
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
@ -3213,9 +3220,11 @@ static int fg_parse_dt(struct fg_chip *chip)
|
||||||
chip->rradc_base = base;
|
chip->rradc_base = base;
|
||||||
|
|
||||||
rc = fg_get_batt_profile(chip);
|
rc = fg_get_batt_profile(chip);
|
||||||
if (rc < 0)
|
if (rc < 0) {
|
||||||
|
chip->soc_reporting_ready = true;
|
||||||
pr_warn("profile for batt_id=%dKOhms not found..using OTP, rc:%d\n",
|
pr_warn("profile for batt_id=%dKOhms not found..using OTP, rc:%d\n",
|
||||||
chip->batt_id_ohms / 1000, rc);
|
chip->batt_id_ohms / 1000, rc);
|
||||||
|
}
|
||||||
|
|
||||||
/* Read all the optional properties below */
|
/* Read all the optional properties below */
|
||||||
rc = of_property_read_u32(node, "qcom,fg-cutoff-voltage", &temp);
|
rc = of_property_read_u32(node, "qcom,fg-cutoff-voltage", &temp);
|
||||||
|
|
|
@ -227,6 +227,7 @@ enum power_supply_property {
|
||||||
POWER_SUPPLY_PROP_PARALLEL_PERCENT,
|
POWER_SUPPLY_PROP_PARALLEL_PERCENT,
|
||||||
POWER_SUPPLY_PROP_PE_START,
|
POWER_SUPPLY_PROP_PE_START,
|
||||||
POWER_SUPPLY_PROP_SET_SHIP_MODE,
|
POWER_SUPPLY_PROP_SET_SHIP_MODE,
|
||||||
|
POWER_SUPPLY_PROP_SOC_REPORTING_READY,
|
||||||
/* Local extensions of type int64_t */
|
/* Local extensions of type int64_t */
|
||||||
POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
|
POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
|
||||||
/* Properties of type `const char *' */
|
/* Properties of type `const char *' */
|
||||||
|
|
Loading…
Add table
Reference in a new issue