devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	andersson@kernel.org
Cc: konrad.dybcio@somainline.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, johan+linaro@kernel.org,
	quic_jprakash@quicinc.com, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/11] dt-bindings: iio: qcom: adc7-pm8350: Allow specifying SID for channels
Date: Thu, 27 Oct 2022 09:46:58 -0400	[thread overview]
Message-ID: <f023f273-e4d2-fd92-a3d4-2c17af7e4314@linaro.org> (raw)
In-Reply-To: <20221027063006.9056-2-manivannan.sadhasivam@linaro.org>

On 27/10/2022 02:29, Manivannan Sadhasivam wrote:
> As per the new ADC7 architecture used by the Qualcomm PMICs, each PMIC
> has the static Slave ID (SID) assigned by default. The primary PMIC
> PMK8350 is responsible for collecting the temperature/voltage data from
> the slave PMICs and exposing them via it's registers.
> 
> For getting the measurements from the slave PMICs, PMK8350 uses the
> channel ID encoded with the SID of the relevant PMIC. So far, the
> dt-binding for the slave PMIC PM8350 assumed that there will be only
> one PM8350 in a system. So it harcoded SID 1 with channel IDs.
> 
> But this got changed in platforms such as Lenovo X13s where there are a
> couple of PM8350 PMICs available. So to address multiple PM8350s, change
> the binding to accept the SID specified by the user and use it for
> encoding the channel ID.
> 
> It should be noted that, even though the SID is static it is not
> globally unique. Only the primary PMIC has the unique SID id 0.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../bindings/thermal/qcom-spmi-adc-tm5.yaml   |  6 +-
>  .../dt-bindings/iio/qcom,spmi-adc7-pm8350.h   | 90 +++++++++----------
>  2 files changed, 46 insertions(+), 50 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml b/Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml
> index feb390d50696..d20569b9b763 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml
> +++ b/Documentation/devicetree/bindings/thermal/qcom-spmi-adc-tm5.yaml
> @@ -222,8 +222,8 @@ examples:
>                  qcom,hw-settle-time = <200>;
>              };
>  
> -            conn-therm@47 {
> -                reg = <PM8350_ADC7_AMUX_THM4_100K_PU>;
> +            conn-therm@147 {
> +                reg = <PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
>                  qcom,ratiometric;
>                  qcom,hw-settle-time = <200>;
>              };
> @@ -247,7 +247,7 @@ examples:
>  
>              conn-therm@1 {
>                  reg = <1>;
> -                io-channels = <&pmk8350_vadc PM8350_ADC7_AMUX_THM4_100K_PU>;
> +                io-channels = <&pmk8350_vadc PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
>                  qcom,avg-samples = <2>;
>                  qcom,ratiometric;
>                  qcom,hw-settle-time-us = <200>;
> diff --git a/include/dt-bindings/iio/qcom,spmi-adc7-pm8350.h b/include/dt-bindings/iio/qcom,spmi-adc7-pm8350.h
> index 9426f27a1946..50de5adfe6ac 100644
> --- a/include/dt-bindings/iio/qcom,spmi-adc7-pm8350.h
> +++ b/include/dt-bindings/iio/qcom,spmi-adc7-pm8350.h
> @@ -6,62 +6,58 @@
>  #ifndef _DT_BINDINGS_QCOM_SPMI_VADC_PM8350_H
>  #define _DT_BINDINGS_QCOM_SPMI_VADC_PM8350_H
>  
> -#ifndef PM8350_SID
> -#define PM8350_SID					1
> -#endif
> -
>  /* ADC channels for PM8350_ADC for PMIC7 */
> -#define PM8350_ADC7_REF_GND			(PM8350_SID << 8 | 0x0)
> -#define PM8350_ADC7_1P25VREF			(PM8350_SID << 8 | 0x01)
> -#define PM8350_ADC7_VREF_VADC			(PM8350_SID << 8 | 0x02)
> -#define PM8350_ADC7_DIE_TEMP			(PM8350_SID << 8 | 0x03)
> -
> -#define PM8350_ADC7_AMUX_THM1			(PM8350_SID << 8 | 0x04)
> -#define PM8350_ADC7_AMUX_THM2			(PM8350_SID << 8 | 0x05)
> -#define PM8350_ADC7_AMUX_THM3			(PM8350_SID << 8 | 0x06)
> -#define PM8350_ADC7_AMUX_THM4			(PM8350_SID << 8 | 0x07)
> -#define PM8350_ADC7_AMUX_THM5			(PM8350_SID << 8 | 0x08)
> -#define PM8350_ADC7_GPIO1			(PM8350_SID << 8 | 0x0a)
> -#define PM8350_ADC7_GPIO2			(PM8350_SID << 8 | 0x0b)
> -#define PM8350_ADC7_GPIO3			(PM8350_SID << 8 | 0x0c)
> -#define PM8350_ADC7_GPIO4			(PM8350_SID << 8 | 0x0d)
> +#define PM8350_ADC7_REF_GND(sid)			(sid << 8 | 0x0)

As it is macro, I think it argument should be in parens: (sid)


Best regards,
Krzysztof


  reply	other threads:[~2022-10-27 13:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-27  6:29 [PATCH 00/11] Updates to sc8280xp-pmic Manivannan Sadhasivam
2022-10-27  6:29 ` [PATCH 01/11] dt-bindings: iio: qcom: adc7-pm8350: Allow specifying SID for channels Manivannan Sadhasivam
2022-10-27 13:46   ` Krzysztof Kozlowski [this message]
2022-10-27  6:29 ` [PATCH 02/11] arm64: dts: qcom: sc8280xp-pmics: Add temp alarm for PM8280_{1/2} PMICs Manivannan Sadhasivam
2022-10-27 13:47   ` Krzysztof Kozlowski
2022-10-27  6:29 ` [PATCH 03/11] arm64: dts: qcom: sc8280xp-pmics: Add thermal zones " Manivannan Sadhasivam
2022-10-27 13:50   ` Krzysztof Kozlowski
2022-10-27  6:29 ` [PATCH 04/11] arm64: dts: qcom: sc8280xp-pmics: Add support for PMK8280 RESIN input Manivannan Sadhasivam
2022-10-27 13:50   ` Krzysztof Kozlowski
2022-10-27  6:30 ` [PATCH 05/11] arm64: dts: qcom: sc8280xp-pmics: Add PMK8280 ADC7 block Manivannan Sadhasivam
2022-10-27 13:54   ` Krzysztof Kozlowski
2022-10-27  6:30 ` [PATCH 06/11] arm64: dts: qcom: sc8280xp-pmics: Add support for TM5 block in PMK8280 Manivannan Sadhasivam
2022-10-27 14:01   ` Krzysztof Kozlowski
2022-10-27  6:30 ` [PATCH 07/11] arm64: dts: qcom: sc8280xp-x13s: Enable PMK8280 RESIN input Manivannan Sadhasivam
2022-10-27 14:01   ` Krzysztof Kozlowski
2022-10-27  6:30 ` [PATCH 08/11] arm64: dts: qcom: sc8280xp-x13s: Add PMK8280 VADC channels Manivannan Sadhasivam
2022-10-27 14:03   ` Krzysztof Kozlowski
2022-10-27 14:04     ` Krzysztof Kozlowski
2022-10-29  4:45       ` Manivannan Sadhasivam
2022-10-27  6:30 ` [PATCH 09/11] arm64: dts: qcom: sc8280xp-x13s: Add PM8280_{1/2} " Manivannan Sadhasivam
2022-10-27 14:09   ` Krzysztof Kozlowski
2022-10-29  4:48     ` Manivannan Sadhasivam
2022-10-30  7:16       ` Manivannan Sadhasivam
2022-11-02 16:21         ` Krzysztof Kozlowski
2022-10-27  6:30 ` [PATCH 10/11] arm64: dts: qcom: sc8280xp-x13s: Add PMR735A VADC channel Manivannan Sadhasivam
2022-10-27  6:30 ` [PATCH 11/11] arm64: dts: qcom: sc8280xp-x13s: Add PM8280_{1/2} ADC_TM5 channels Manivannan Sadhasivam
2022-10-27 14:11   ` Krzysztof Kozlowski

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=f023f273-e4d2-fd92-a3d4-2c17af7e4314@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=quic_jprakash@quicinc.com \
    --cc=robh+dt@kernel.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).