Skip to content
This repository has been archived by the owner on Aug 8, 2021. It is now read-only.

Commit

Permalink
Revert "qpnp-fg-gen3: Limit how frequently fg data can be queried"
Browse files Browse the repository at this point in the history
This reverts commit 79774bf.

freqbench requires fresh power data every second for accuracy.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
  • Loading branch information
kdrag0n committed Dec 7, 2020
1 parent 4c8c5e6 commit 87ac3f8
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 49 deletions.
6 changes: 0 additions & 6 deletions drivers/power/supply/qcom/fg-core.h
Expand Up @@ -357,11 +357,6 @@ static const struct fg_pt fg_tsmc_osc_table[] = {
{ 90, 444992 },
};

struct fg_saved_data {
union power_supply_propval val;
unsigned long last_req_expires;
};

struct fg_chip {
struct device *dev;
struct pmic_revid_data *pmic_rev_id;
Expand Down Expand Up @@ -433,7 +428,6 @@ struct fg_chip {
struct delayed_work sram_dump_work;
struct fg_circ_buf ibatt_circ_buf;
struct fg_circ_buf vbatt_circ_buf;
struct fg_saved_data saved_data[POWER_SUPPLY_PROP_MAX];
};

/* Debugfs data structures are below */
Expand Down
42 changes: 0 additions & 42 deletions drivers/power/supply/qcom/qpnp-fg-gen3.c
Expand Up @@ -410,8 +410,6 @@ module_param_named(
static int fg_restart;
static bool fg_sram_dump;

#define FG_RATE_LIM_MS (2 * MSEC_PER_SEC)

/* All getters HERE */

#define VOLTAGE_15BIT_MASK GENMASK(14, 0)
Expand Down Expand Up @@ -1330,15 +1328,6 @@ static bool batt_psy_initialized(struct fg_chip *chip)
return true;
}

static bool usb_psy_initialized(struct fg_chip *chip)
{
if (chip->usb_psy)
return true;

chip->usb_psy = power_supply_get_by_name("usb");
return chip->usb_psy;
}

static bool is_parallel_charger_available(struct fg_chip *chip)
{
if (!chip->parallel_psy)
Expand Down Expand Up @@ -3361,36 +3350,8 @@ static int fg_psy_get_property(struct power_supply *psy,
union power_supply_propval *pval)
{
struct fg_chip *chip = power_supply_get_drvdata(psy);
struct fg_saved_data *sd = chip->saved_data + psp;
union power_supply_propval typec_sts = { .intval = -1 };
int rc = 0;

switch (psp) {
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
case POWER_SUPPLY_PROP_RESISTANCE_ID:
case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
case POWER_SUPPLY_PROP_CYCLE_COUNT_ID:
case POWER_SUPPLY_PROP_CHARGE_NOW:
case POWER_SUPPLY_PROP_CHARGE_FULL:
case POWER_SUPPLY_PROP_SOC_REPORTING_READY:
/* These props don't require a fg query; don't ratelimit them */
break;
default:
if (!sd->last_req_expires)
break;

if (usb_psy_initialized(chip))
power_supply_get_property(chip->usb_psy,
POWER_SUPPLY_PROP_TYPEC_MODE, &typec_sts);

if (typec_sts.intval == POWER_SUPPLY_TYPEC_NONE &&
time_before(jiffies, sd->last_req_expires)) {
*pval = sd->val;
return 0;
}
break;
}

switch (psp) {
case POWER_SUPPLY_PROP_CAPACITY:
rc = fg_get_prop_capacity(chip, &pval->intval);
Expand Down Expand Up @@ -3479,9 +3440,6 @@ static int fg_psy_get_property(struct power_supply *psy,
if (rc < 0)
return -ENODATA;

sd->val = *pval;
sd->last_req_expires = jiffies + msecs_to_jiffies(FG_RATE_LIM_MS);

return 0;
}

Expand Down
1 change: 0 additions & 1 deletion include/linux/power_supply.h
Expand Up @@ -263,7 +263,6 @@ enum power_supply_property {
POWER_SUPPLY_PROP_MANUFACTURER,
POWER_SUPPLY_PROP_SERIAL_NUMBER,
POWER_SUPPLY_PROP_BATTERY_TYPE,
POWER_SUPPLY_PROP_MAX
};

enum power_supply_type {
Expand Down

0 comments on commit 87ac3f8

Please sign in to comment.