linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Kao <michael.kao@mediatek.com>
To: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	<linux-pm@vger.kernel.org>,
	Devicetree List <devicetree@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v2 7/8] thermal: mediatek: add another get_temp ops for thermal sensors
Date: Fri, 6 Dec 2019 17:35:27 +0800	[thread overview]
Message-ID: <1575624927.1631.7.camel@mtksdccf07> (raw)
In-Reply-To: <CAJMQK-ivho3T1hnD9axV2EMKT3Srs_5zAXLqwts8nojY15fBGg@mail.gmail.com>

On Thu, 2019-11-21 at 15:00 +0800, Hsin-Yi Wang wrote:
> On Fri, May 10, 2019 at 9:27 PM michael.kao <michael.kao@mediatek.com> wrote:
> 
> > -       tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
> > -                                                    &mtk_thermal_ops);
> > -       if (IS_ERR(tzdev)) {
> > -               ret = PTR_ERR(tzdev);
> > -               goto err_disable_clk_peri_therm;
> > +       for (i = 0; i < mt->conf->num_sensors + 1; i++) {
> > +               tz = kmalloc(sizeof(*tz), GFP_KERNEL);
> > +               if (!tz)
> > +                       return -ENOMEM;
> > +
> > +               tz->mt = mt;
> > +               tz->id = i;
> > +
> > +               tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, i,
> > +                               tz, (i == 0) ?
> > +                               &mtk_thermal_ops : &mtk_thermal_sensor_ops);
> > +
> > +               if (IS_ERR(tzdev)) {
> > +                       if (IS_ERR(tzdev) != -EACCES) {
>                                 PTR_ERR(tzdev)
> 
> > +                               ret = PTR_ERR(tzdev);
> > +                               goto err_disable_clk_peri_therm;
> > +                       }
> > +               }
> 
> This for loop adding thermal zone sensors will not work for mt8173. It
> assumes that thermal-zones in dts have subnodes (eg. cpu_thermal,
> tzts..) amount equal to num_sensors+1. Otherwise tzdev would be
> -ENODEV and thermal failed to be probed.
> In mt8183 this is fine, since each thermal zone only has one sensor,
> but in mt8173, some sensor appears in multiple thermal zones.
> 
> In order to let the change also works for 8173, I think if the error
> is -ENODEV, and the id is not 0 (0 is cpu_thermal), prompt a warning
> instead of failing. Eg.
> 
>                 if (IS_ERR(tzdev)) {
> +                       if (i > 0 && PTR_ERR(tzdev) == -ENODEV) {
> +                               dev_warn(&pdev->dev, "can't find
> thermal sensor %d\n", i);
> +                               continue;
> +                       }
>                         if (PTR_ERR(tzdev) != -EACCES) {

OK, I will update this patch.

  reply	other threads:[~2019-12-06  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 13:26 [PATCH v2 0/8] Add Mediatek thermal dirver and dtsi michael.kao
2019-05-10 13:26 ` [PATCH v2 1/8] arm64: dts: mt8183: add thermal zone node michael.kao
2019-05-30  6:27   ` Hsin-Yi Wang
2019-05-30 16:08     ` Matthias Kaehlcke
     [not found] ` <1557494826-6044-1-git-send-email-michael.kao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2019-05-10 13:27   ` [PATCH v2 2/8] arm64: dts: mt8183: add/update dynamic power coefficients michael.kao
2019-05-10 13:27   ` [PATCH v2 4/8] arm64: dts: mt8183: Configure CPU cooling michael.kao
2019-05-10 13:27   ` [PATCH v2 5/8] arm64: dts: mt8183: Increase polling frequency for CPU thermal zone michael.kao
2019-05-10 13:27   ` [PATCH v2 6/8] thermal: mediatek: mt8183: fix bank number settings michael.kao
2019-05-10 13:27   ` [PATCH v2 8/8] thermal: mediatek: use spinlock to protect PTPCORESEL michael.kao
2019-05-10 13:27 ` [PATCH v2 3/8] arm64: dts: mt8183: Add #cooling-cells to CPU nodes michael.kao
2019-05-10 13:27 ` [PATCH v2 7/8] thermal: mediatek: add another get_temp ops for thermal sensors michael.kao
2019-09-09 11:13   ` Hsin-Yi Wang
2019-11-21  7:00   ` Hsin-Yi Wang
2019-12-06  9:35     ` Michael Kao [this message]
2019-12-05 16:38 ` [PATCH v2 0/8] Add Mediatek thermal dirver and dtsi Daniel Lezcano

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=1575624927.1631.7.camel@mtksdccf07 \
    --to=michael.kao@mediatek.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=edubezval@gmail.com \
    --cc=hsinyi@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    /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).