Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3923828c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-fg: add support for restoring battery information"

parents e7a37bc8 5d82a81e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -273,6 +273,14 @@ Parent node optional properties:
					default limit would be 150C.
- qcom,fg-cc-soc-limit-pct:		Percentage of CC_SOC before resetting
					FG and restore the full CC_SOC value.
- qcom,fg-restore-batt-info:		A boolean property to specify whether
					battery parameters needs to be
					restored. If this feature is enabled,
					then validating the battery parameters
					by OCV/battery SOC, validation range
					in percentage should be specified via
					appropriate module parameters to make
					it work properly.

qcom,fg-soc node required properties:
- reg : offset and length of the PMIC peripheral register map.
+2 −0
Original line number Diff line number Diff line
@@ -250,6 +250,8 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(soc_reporting_ready),
	POWER_SUPPLY_ATTR(ignore_false_negative_isense),
	POWER_SUPPLY_ATTR(enable_jeita_detection),
	POWER_SUPPLY_ATTR(battery_info),
	POWER_SUPPLY_ATTR(battery_info_id),
	/* Local extensions of type int64_t */
	POWER_SUPPLY_ATTR(charge_counter_ext),
	/* Properties of type `const char *' */
+481 −250

File changed.

Preview size limit exceeded, changes collapsed.

+35 −0
Original line number Diff line number Diff line
@@ -1105,6 +1105,33 @@ static int get_prop_batt_current_now(struct smbchg_chip *chip)
	return ua;
}

#define DEFAULT_BATT_RESISTANCE_ID	0
static int get_prop_batt_resistance_id(struct smbchg_chip *chip)
{
	int rbatt, rc;

	rc = get_property_from_fg(chip, POWER_SUPPLY_PROP_RESISTANCE_ID,
			&rbatt);
	if (rc) {
		pr_smb(PR_STATUS, "Couldn't get resistance id rc = %d\n", rc);
		rbatt = DEFAULT_BATT_RESISTANCE_ID;
	}
	return rbatt;
}

#define DEFAULT_BATT_FULL_CHG_CAPACITY	0
static int get_prop_batt_full_charge(struct smbchg_chip *chip)
{
	int bfc, rc;

	rc = get_property_from_fg(chip, POWER_SUPPLY_PROP_CHARGE_FULL, &bfc);
	if (rc) {
		pr_smb(PR_STATUS, "Couldn't get charge_full rc = %d\n", rc);
		bfc = DEFAULT_BATT_FULL_CHG_CAPACITY;
	}
	return bfc;
}

#define DEFAULT_BATT_VOLTAGE_NOW	0
static int get_prop_batt_voltage_now(struct smbchg_chip *chip)
{
@@ -5751,6 +5778,8 @@ static enum power_supply_property smbchg_battery_properties[] = {
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_TEMP,
	POWER_SUPPLY_PROP_VOLTAGE_NOW,
	POWER_SUPPLY_PROP_RESISTANCE_ID,
	POWER_SUPPLY_PROP_CHARGE_FULL,
	POWER_SUPPLY_PROP_SAFETY_TIMER_ENABLE,
	POWER_SUPPLY_PROP_INPUT_CURRENT_MAX,
	POWER_SUPPLY_PROP_INPUT_CURRENT_SETTLED,
@@ -5939,6 +5968,12 @@ static int smbchg_battery_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
		val->intval = get_prop_batt_voltage_now(chip);
		break;
	case POWER_SUPPLY_PROP_RESISTANCE_ID:
		val->intval = get_prop_batt_resistance_id(chip);
		break;
	case POWER_SUPPLY_PROP_CHARGE_FULL:
		val->intval = get_prop_batt_full_charge(chip);
		break;
	case POWER_SUPPLY_PROP_TEMP:
		val->intval = get_prop_batt_temp(chip);
		break;
+2 −0
Original line number Diff line number Diff line
@@ -213,6 +213,8 @@ enum power_supply_property {
	POWER_SUPPLY_PROP_SOC_REPORTING_READY,
	POWER_SUPPLY_PROP_IGNORE_FALSE_NEGATIVE_ISENSE,
	POWER_SUPPLY_PROP_ENABLE_JEITA_DETECTION,
	POWER_SUPPLY_PROP_BATTERY_INFO,
	POWER_SUPPLY_PROP_BATTERY_INFO_ID,
	/* Local extensions of type int64_t */
	POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
	/* Properties of type `const char *' */