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

Commit c47baef5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: hl6111r: Expose chip version"

parents e99605bb 04700702
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ static const char * const power_supply_type_text[] = {
	"USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
	"USB_PD", "USB_PD_DRP", "BrickID",
	"USB_HVDCP", "USB_HVDCP_3", "Wireless", "USB_FLOAT",
	"BMS", "Parallel", "Main", "Wipower", "USB_C_UFP", "USB_C_DFP",
	"BMS", "Parallel", "Main", "USB_C_UFP", "USB_C_DFP",
	"Charge_Pump",
};

+18 −0
Original line number Diff line number Diff line
@@ -297,6 +297,20 @@ static int hl6111r_get_vout_target(struct hl6111r *chip, int *val)
	return rc;
}

static int hl6111r_get_chip_version(struct hl6111r *chip, int *val)
{
	int rc;
	u8 id;

	rc = hl6111r_read(chip, ID_REG, &id);
	if (rc < 0)
		return rc;

	*val = id;

	return 0;
}

/* Callbacks for settable properties */

#define HL6111R_MIN_VOLTAGE_UV	4940000
@@ -382,6 +396,7 @@ static enum power_supply_property hl6111r_psy_props[] = {
	POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
	POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION,
	POWER_SUPPLY_PROP_CHIP_VERSION,
};

static int hl6111r_get_prop(struct power_supply *psy,
@@ -427,6 +442,9 @@ static int hl6111r_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_INPUT_VOLTAGE_REGULATION:
		rc = hl6111r_get_vout_target(chip, val);
		break;
	case POWER_SUPPLY_PROP_CHIP_VERSION:
		rc = hl6111r_get_chip_version(chip, val);
		break;
	default:
		rc = -EINVAL;
		break;
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@

#define VOUT_TARGET_REG		0x0E

#define ID_REG			0xA

#define IOUT_LIM_SEL_REG	0x28
#define IOUT_LIM_SEL_MASK	GENMASK(7, 3)
#define IOUT_LIM_SHIFT		3
+0 −1
Original line number Diff line number Diff line
@@ -389,7 +389,6 @@ enum power_supply_type {
	POWER_SUPPLY_TYPE_BMS,			/* Battery Monitor System */
	POWER_SUPPLY_TYPE_PARALLEL,		/* Parallel Path */
	POWER_SUPPLY_TYPE_MAIN,			/* Main Path */
	POWER_SUPPLY_TYPE_WIPOWER,		/* Wipower */
	POWER_SUPPLY_TYPE_UFP,			/* Type-C UFP */
	POWER_SUPPLY_TYPE_DFP,			/* Type-C DFP */
	POWER_SUPPLY_TYPE_CHARGE_PUMP,		/* Charge Pump */