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 v5 0/9] iio: adc: introduce Qualcomm SPMI Round Robin ADC
Date: Tue, 15 Feb 2022 16:54:47 +0000 [thread overview]
Message-ID: <20220215165456.1205583-1-caleb.connolly@linaro.org> (raw)
The RRADC is responsible for reading data about the current and
voltage from the USB or DC in jacks, it can also read the battery
ID (resistence) and some temperatures. It is found on the PMI8998 and
PM660 Qualcomm PMICs.
The RRADC has to calibrate some ADC values based on which chip fab
the PMIC was produced in, to facilitate this the patches
("mfd: qcom-spmi-pmic: expose the PMIC revid information to clients")
and ("mfd: qcom-spmi-pmic: read fab id on supported PMICs")
expose the PMIC revision information and fab_id as a struct and register
them as driver data in the Qualcomm SPMI PMIC driver so that it can be
read by the RRADC.
The first 3 patches add support for looking up an SPMI device from a
struct device_node, as well as introducing support for looking up the
base USID of a Qcom PMIC, see patch comments for more details. These
Address Bjorns comments on v2.
Changes since v4:
* Addressed Jonathan's comments on v4
* Reworked the qcom-spmi-pmic patches to properly walk the devicetree
to find the base USID. I've tested this on SDM845 which has two PMICs
(pm8998 and pmi8998) and I'm able to look up the PMIC revid from all
4 USIDs.
Changes since v3:
* Split PMIC patch in two, rework to support function drivers on a
sibling USID
* Completely rework RRADC driver to make use of the modern IIO
framework. This required re-arranging a lot of the equations and
results in some lost precision, where relevant I've left comments to
explain this. I don't think any of it is significant enough to
justify doing post-processing in driver.
Thanks a lot Jonathan and John Stultz for helping me out with
this
Changes since v2:
* Add missing include (thanks kernel test robot :D)
* Rework some confusing function return values, specifically
rradc_read_status_in_cont_mode and rradc_prepare_batt_id_conversion
both of which didn't correctly handle "ret". This also bought up an
issue as the previous implementation didn't actually wait for the
channel to be ready. It doesn't seem like that's strictly necessary
(same data is reported if I wait for the status to be good or not)
but I've included it anyway for good measure.
Changes since v1:
* Rework the RRADC driver based on Jonathan's feedback
* Pick up Rob's reviewed by for the dt-binding patch.
--
Caleb Connolly (9):
spmi: add a helper to look up an SPMI device from a device node
mfd: qcom-spmi-pmic: expose the PMIC revid information to clients
mfd: qcom-spmi-pmic: read fab id on supported PMICs
dt-bindings: iio: adc: document qcom-spmi-rradc
iio: adc: qcom-spmi-rradc: introduce round robin adc
arm64: dts: qcom: pmi8998: add rradc node
arm64: dts: qcom: sdm845-oneplus: enable rradc
arm64: dts: qcom: sdm845-db845c: enable rradc
arm64: dts: qcom: sdm845-xiaomi-beryllium: enable rradc
.../bindings/iio/adc/qcom,spmi-rradc.yaml | 54 +
arch/arm64/boot/dts/qcom/pmi8998.dtsi | 8 +
arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 4 +
.../boot/dts/qcom/sdm845-oneplus-common.dtsi | 4 +
.../boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 4 +
drivers/iio/adc/Kconfig | 12 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/qcom-spmi-rradc.c | 1016 +++++++++++++++++
drivers/mfd/qcom-spmi-pmic.c | 183 ++-
drivers/spmi/spmi.c | 16 +
include/linux/spmi.h | 2 +
include/soc/qcom/qcom-spmi-pmic.h | 61 +
12 files changed, 1308 insertions(+), 57 deletions(-)
create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,spmi-rradc.yaml
create mode 100644 drivers/iio/adc/qcom-spmi-rradc.c
create mode 100644 include/soc/qcom/qcom-spmi-pmic.h
--
2.35.1
next reply other threads:[~2022-02-15 16:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 16:54 Caleb Connolly [this message]
2022-02-15 16:54 ` [PATCH v5 1/9] spmi: add a helper to look up an SPMI device from a device node Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 2/9] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 3/9] mfd: qcom-spmi-pmic: read fab id on supported PMICs Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 4/9] dt-bindings: iio: adc: document qcom-spmi-rradc Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 5/9] iio: adc: qcom-spmi-rradc: introduce round robin adc Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 6/9] arm64: dts: qcom: pmi8998: add rradc node Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 7/9] arm64: dts: qcom: sdm845-oneplus: enable rradc Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 8/9] arm64: dts: qcom: sdm845-db845c: " Caleb Connolly
2022-02-15 16:54 ` [PATCH v5 9/9] arm64: dts: qcom: sdm845-xiaomi-beryllium: " Caleb Connolly
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=20220215165456.1205583-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.