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

Commit c9f79175 authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

platform: qpnp-revid: add support to identify PMI8937



PMI8937 has same subtype as PMI8950 and is identified by
SPARE0, add support to detect PMI8937.
Add the name 'PMI8937' to the list of pmic names.

Change-Id: I1f36cb8648f4970c0281aede0119b03e37a89927
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent df59a7f6
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)