devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Caleb Connolly <caleb.connolly@linaro.org>
To: caleb.connolly@linaro.org, Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Lee Jones <lee.jones@linaro.org>, Stephen Boyd <sboyd@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Cc: sumit.semwal@linaro.org, amit.pundir@linaro.org, john.stultz@linaro.org
Subject: [PATCH v10 3/9] mfd: qcom-spmi-pmic: read fab id on supported PMICs
Date: Sat,  5 Mar 2022 02:12:41 +0000	[thread overview]
Message-ID: <20220305021247.1020122-4-caleb.connolly@linaro.org> (raw)
In-Reply-To: <20220305021247.1020122-1-caleb.connolly@linaro.org>

The PMI8998 and PM660 expose the fab_id, this is needed by drivers like
the RRADC to calibrate ADC values.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 drivers/mfd/qcom-spmi-pmic.c      | 7 +++++++
 include/soc/qcom/qcom-spmi-pmic.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index bfe1304aee1b..b12a07da6183 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -19,6 +19,7 @@
 #define PMIC_REV4		0x103
 #define PMIC_TYPE		0x104
 #define PMIC_SUBTYPE		0x105
+#define PMIC_FAB_ID		0x1f2
 
 #define PMIC_TYPE_VALUE		0x51
 
@@ -175,6 +176,12 @@ static int pmic_spmi_load_revid(struct regmap *map, struct device *dev,
 	if (ret < 0)
 		return ret;
 
+	if (pmic->subtype == PMI8998_SUBTYPE || pmic->subtype == PM660_SUBTYPE) {
+		ret = regmap_read(map, PMIC_FAB_ID, &pmic->fab_id);
+		if (ret < 0)
+			return ret;
+	}
+
 	/*
 	 * In early versions of PM8941 and PM8226, the major revision number
 	 * started incrementing from 0 (eg 0 = v1.0, 1 = v2.0).
diff --git a/include/soc/qcom/qcom-spmi-pmic.h b/include/soc/qcom/qcom-spmi-pmic.h
index 5400e6509fe8..ff839b230e62 100644
--- a/include/soc/qcom/qcom-spmi-pmic.h
+++ b/include/soc/qcom/qcom-spmi-pmic.h
@@ -50,6 +50,7 @@ struct qcom_spmi_pmic {
 	unsigned int major;
 	unsigned int minor;
 	unsigned int rev2;
+	unsigned int fab_id;
 	const char *name;
 };
 
-- 
2.35.1


  parent reply	other threads:[~2022-03-05  2:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-05  2:12 [PATCH v10 0/9] iio: adc: introduce Qualcomm SPMI Round Robin ADC Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 1/9] spmi: add a helper to look up an SPMI device from a device node Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 2/9] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Caleb Connolly
2022-03-08 20:46   ` kernel test robot
2022-03-05  2:12 ` Caleb Connolly [this message]
2022-03-05  2:12 ` [PATCH v10 4/9] dt-bindings: iio: adc: document qcom-spmi-rradc Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 5/9] iio: adc: qcom-spmi-rradc: introduce round robin adc Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 6/9] arm64: dts: qcom: pmi8998: add rradc node Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 7/9] arm64: dts: qcom: sdm845-oneplus: enable rradc Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 8/9] arm64: dts: qcom: sdm845-db845c: " Caleb Connolly
2022-03-05  2:12 ` [PATCH v10 9/9] arm64: dts: qcom: sdm845-xiaomi-beryllium: " Caleb Connolly
2022-03-05 15:55 ` [PATCH v10 0/9] iio: adc: introduce Qualcomm SPMI Round Robin ADC Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220305021247.1020122-4-caleb.connolly@linaro.org \
    --to=caleb.connolly@linaro.org \
    --cc=agross@kernel.org \
    --cc=amit.pundir@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=john.stultz@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).