linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Matthias Kaehlcke <mka@chromium.org>,
	Andy Gross <agross@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Amit Kucheria <amitk@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Thara Gopinath <thara.gopinath@linaro.org>,
	"open list:DRM DRIVER FOR MSM ADRENO GPU" 
	<linux-arm-msm@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/4] arm64: dts: qcom: sdm845: mtp: Add vadc channels and thermal zones
Date: Mon, 4 Oct 2021 23:56:11 +0300	[thread overview]
Message-ID: <CAA8EJprYij6pWD1A17yr1+5-n5fKPW=YDA_-2+f8h6JnEh4myw@mail.gmail.com> (raw)
In-Reply-To: <YVtg3lcR1HMqVdAJ@ripper>

On Mon, 4 Oct 2021 at 23:13, Bjorn Andersson <bjorn.andersson@linaro.org> wrote:
>
> On Wed 29 Sep 11:40 PDT 2021, Matthias Kaehlcke wrote:
>
> > On Thu, Sep 23, 2021 at 02:23:11PM -0700, Bjorn Andersson wrote:
> > > Downstream defines four ADC channels related to thermal sensors external
> > > to the PM8998 and two channels for internal voltage measurements.
> > >
> > > Add these to the upstream SDM845 MTP, describe the thermal monitor
> > > channels and add thermal_zones for these.
> > >
> > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > ---
> > >
> > > In addition to the iio channels exposed by v1, Daniel wanted thermal_zones...
> > >
> > > Changes since v1:
> > > - Enable the pm8998_adc_tm and describe the ADC channels
> > > - Add thermal-zones for the new channels
> > >
> > >  arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 128 ++++++++++++++++++++++++
> > >  1 file changed, 128 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
> [..]
> > > +&pm8998_adc {
> > > +   adc-chan@4c {
> > > +           reg = <ADC5_XO_THERM_100K_PU>;
> > > +           label = "xo_therm";
> > > +   };
> > > +
> > > +   adc-chan@4d {
> > > +           reg = <ADC5_AMUX_THM1_100K_PU>;
> > > +           label = "msm_therm";
> > > +   };
> > > +
> > > +   adc-chan@4f {
> > > +           reg = <ADC5_AMUX_THM3_100K_PU>;
> > > +           label = "pa_therm1";
> > > +   };
> > > +
> > > +   adc-chan@51 {
> > > +           reg = <ADC5_AMUX_THM5_100K_PU>;
> > > +           label = "quiet_therm";
> > > +   };
> > > +
> > > +   adc-chan@83 {
> > > +           reg = <ADC5_VPH_PWR>;
> > > +           label = "vph_pwr";
> > > +   };
> > > +
> > > +   adc-chan@85 {
> > > +           reg = <ADC5_VCOIN>;
> > > +           label = "vcoin";
> > > +   };
> > > +};
> > > +
> > > +&pm8998_adc_tm {
> > > +   status = "okay";
> > > +
> > > +   xo-thermistor@1 {
> > > +           reg = <1>;
> > > +           io-channels = <&pm8998_adc ADC5_XO_THERM_100K_PU>;
> > > +           qcom,ratiometric;
> > > +           qcom,hw-settle-time-us = <200>;
> > > +   };
> > > +
> > > +   msm-thermistor@2 {
> > > +           reg = <2>;
> > > +           io-channels = <&pm8998_adc ADC5_AMUX_THM1_100K_PU>;
> > > +           qcom,ratiometric;
> > > +           qcom,hw-settle-time-us = <200>;
> > > +   };
> > > +
> > > +   pa-thermistor@3 {
> > > +           reg = <3>;
> > > +           io-channels = <&pm8998_adc ADC5_AMUX_THM3_100K_PU>;
> > > +           qcom,ratiometric;
> > > +           qcom,hw-settle-time-us = <200>;
> > > +   };
> > > +
> > > +   quiet-thermistor@4 {
> > > +           reg = <4>;
> > > +           io-channels = <&pm8998_adc ADC5_AMUX_THM5_100K_PU>;
> > > +           qcom,ratiometric;
> > > +           qcom,hw-settle-time-us = <200>;
> > > +   };
> > > +};
> > > +
> >
> > The example in the 'qcom,spmi-adc-tm5' binding specifies 'qcom,ratiometric'
> > and 'qcom,hw-settle-time-us' for both the ADC and the thermal monitor, so do
> > several board files (e.g. sm8250-mtp.dts and qrb5165-rb5.dts). This apparent
> > redundancy bothered me earlier, it's not really clear to me whether it's
> > needed/recommended or not. Do you happen to have any insights on this?
>
> Hmm, you're right and I missed this in defining my channels. I've not
> looked at this detail, just got reasonable readings from my thermal
> zones and was happy about that.
>
> Dmitry, do you have any further insights why these properties are
> supposed to be duplicated between the adc channel and the thermal zones?

Because both ADC channel and thermal zone registers should be
programmed accordingly.

One not-so-perfect approach would be to use io-channels property to
locate the adc's adc-chan node and to parse it. However this way
thermal driver would have to know the exact structure of adc's device
tree nodes.
Another (even worse) solution would be to introduce qcom-specific API
to query these properties from the IIO channel.

Selecting between these two options I decided to follow the downstream
path and just to duplicate these few properties.

-- 
With best wishes
Dmitry

  reply	other threads:[~2021-10-04 20:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 21:23 [PATCH v2 0/4] arm64: dts: qcom: sdm845: Add thermal zones for PM8998 ADC Bjorn Andersson
2021-09-23 21:23 ` [PATCH v2 1/4] dt-bindings: thermal: qcom: add HC variant of adc-thermal monitor bindings Bjorn Andersson
2021-09-23 21:23 ` [PATCH v2 2/4] thermal/drivers/qcom/spmi-adc-tm5: Add support for HC variant Bjorn Andersson
2021-09-29 19:55   ` Vladimir Zapolskiy
2021-09-23 21:23 ` [PATCH v2 3/4] arm64: dts: qcom: pm8998: Add ADC Thermal Monitor node Bjorn Andersson
2021-11-18 22:04   ` Dmitry Baryshkov
2021-09-23 21:23 ` [PATCH v2 4/4] arm64: dts: qcom: sdm845: mtp: Add vadc channels and thermal zones Bjorn Andersson
2021-09-29 18:40   ` Matthias Kaehlcke
2021-10-04 20:15     ` Bjorn Andersson
2021-10-04 20:56       ` Dmitry Baryshkov [this message]
2021-10-05  3:12         ` Bjorn Andersson
2021-10-05 20:30         ` Thara Gopinath
2021-10-05 21:52           ` Bjorn Andersson
2021-10-05 22:21             ` Thara Gopinath
2021-10-05 22:47               ` Bjorn Andersson

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='CAA8EJprYij6pWD1A17yr1+5-n5fKPW=YDA_-2+f8h6JnEh4myw@mail.gmail.com' \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=amitk@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thara.gopinath@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).