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

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

Merge "platform: qpnp-revid: add support to identify PMI8937"

parents f36f4bd7 c9f79175
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#define REVID_TYPE	0x4
#define REVID_SUBTYPE	0x5
#define REVID_STATUS1	0x8
#define REVID_SPARE_0	0x60

#define QPNP_REVID_DEV_NAME "qcom,qpnp-revid"

@@ -48,6 +49,7 @@ static const char *const pmic_names[] = {
		"PMK8001",
		"PMI8996",
	[25] =	"PM8937",
	[55] =	"PMI8937",
};

struct revid_chip {
@@ -109,6 +111,8 @@ EXPORT_SYMBOL(get_revid_data);
#define PM8941_PERIPHERAL_SUBTYPE	0x01
#define PM8226_PERIPHERAL_SUBTYPE	0x04
#define PMD9655_PERIPHERAL_SUBTYPE	0x0F
#define PMI8950_PERIPHERAL_SUBTYPE	0x11
#define PMI8937_PERIPHERAL_SUBTYPE	0x37
static size_t build_pmic_string(char *buf, size_t n, int sid,
		u8 subtype, u8 rev1, u8 rev2, u8 rev3, u8 rev4)
{
@@ -144,7 +148,7 @@ static size_t build_pmic_string(char *buf, size_t n, int sid,
static int qpnp_revid_probe(struct spmi_device *spmi)
{
	u8 rev1, rev2, rev3, rev4, pmic_type, pmic_subtype, pmic_status;
	u8 option1, option2, option3, option4;
	u8 option1, option2, option3, option4, spare0;
	struct resource *resource;
	char pmic_string[PMIC_STRING_MAXLENGTH] = {'\0'};
	struct revid_chip *revid_chip;
@@ -172,6 +176,14 @@ static int qpnp_revid_probe(struct spmi_device *spmi)
	else
		pmic_status = 0;

	/* special case for PMI8937 */
	if (pmic_subtype == PMI8950_PERIPHERAL_SUBTYPE) {
		/* read spare register */
		spare0 = qpnp_read_byte(spmi, resource->start + REVID_SPARE_0);
		if (spare0)
			pmic_subtype = PMI8937_PERIPHERAL_SUBTYPE;
	}

	revid_chip = devm_kzalloc(&spmi->dev, sizeof(struct revid_chip),
						GFP_KERNEL);
	if (!revid_chip)
+3 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ enum pmic_subtype {
	PMI8994		= 10,
	PMI8950		= 17,
	PMI8996		= 19,
	PMI8937		= 55,
};

enum wa_flags {
@@ -6002,6 +6003,7 @@ static int fg_hw_init(struct fg_chip *chip)

		break;
	case PMI8950:
	case PMI8937:
		rc = fg_8950_hw_init(chip);
		/* Setup workaround flag based on PMIC type */
		if (fg_sense_type == INTERNAL_CURRENT_SENSE)
@@ -6094,6 +6096,7 @@ static int fg_detect_pmic_type(struct fg_chip *chip)
	switch (pmic_rev_id->pmic_subtype) {
	case PMI8994:
	case PMI8950:
	case PMI8937:
	case PMI8996:
		chip->pmic_subtype = pmic_rev_id->pmic_subtype;
		chip->pmic_revision[REVID_RESERVED]	= pmic_rev_id->rev1;
+12 −4
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ struct smbchg_chip {
	bool				hvdcp3_supported;
	bool				restricted_charging;
	bool				skip_usb_suspend_for_fake_battery;
	bool				hvdcp_not_supported;
	u8				original_usbin_allowance;
	struct parallel_usb_cfg		parallel;
	struct delayed_work		parallel_en_work;
@@ -282,6 +283,7 @@ enum pmic_subtype {
	PMI8994		= 10,
	PMI8950		= 17,
	PMI8996		= 19,
	PMI8937		= 55,
};

enum smbchg_wa {
@@ -4447,6 +4449,7 @@ static void handle_usb_removal(struct smbchg_chip *chip)
	vote(chip->usb_icl_votable, WEAK_CHARGER_ICL_VOTER, false, 0);
	chip->usb_icl_delta = 0;
	vote(chip->usb_icl_votable, SW_AICL_ICL_VOTER, false, 0);
	if (!chip->hvdcp_not_supported)
		restore_from_hvdcp_detection(chip);
}

@@ -4519,7 +4522,8 @@ static void handle_usb_insertion(struct smbchg_chip *chip)
	}
	schedule_work(&chip->usb_set_online_work);

	if (usb_supply_type == POWER_SUPPLY_TYPE_USB_DCP)
	if (!chip->hvdcp_not_supported &&
			(usb_supply_type == POWER_SUPPLY_TYPE_USB_DCP))
		schedule_delayed_work(&chip->hvdcp_det_work,
					msecs_to_jiffies(HVDCP_NOTIFY_MS));

@@ -7393,6 +7397,7 @@ static int smbchg_check_chg_version(struct smbchg_chip *chip)
		chip->schg_version = QPNP_SCHG;
		break;
	case PMI8950:
	case PMI8937:
		chip->wa_flags |= SMBCHG_BATT_OV_WA;
		if (pmic_rev_id->rev4 < 2) /* PMI8950 1.0 */ {
			chip->wa_flags |= SMBCHG_AICL_DEGLITCH_WA;
@@ -7402,6 +7407,8 @@ static int smbchg_check_chg_version(struct smbchg_chip *chip)
		}
		use_pmi8994_tables(chip);
		chip->schg_version = QPNP_SCHG_LITE;
		if (pmic_rev_id->pmic_subtype == PMI8937)
			chip->hvdcp_not_supported = true;
		break;
	case PMI8996:
		chip->wa_flags |= SMBCHG_CC_ESR_WA
@@ -7414,8 +7421,9 @@ static int smbchg_check_chg_version(struct smbchg_chip *chip)
				pmic_rev_id->pmic_subtype);
	}

	pr_smb(PR_STATUS, "pmic=%s, wa_flags=0x%x\n",
			pmic_rev_id->pmic_name, chip->wa_flags);
	pr_smb(PR_STATUS, "pmic=%s, wa_flags=0x%x, hvdcp_supported=%s\n",
			pmic_rev_id->pmic_name, chip->wa_flags,
			chip->hvdcp_not_supported ? "false" : "true");

	return 0;
}