linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yue Hu <zbestahu@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rafael.j.wysocki@intel.com,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	rui.zhang@intel.com, amit.kucheria@verdurent.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	huyue2@yulong.com, zbestahu@163.com
Subject: Re: [PATCH] thermal: sysfs: fall back to vzalloc for cooling device's statistics
Date: Thu, 27 Aug 2020 14:20:03 +0800	[thread overview]
Message-ID: <20200827142003.000071c1.zbestahu@gmail.com> (raw)
In-Reply-To: <20200827051401.yryitpgq2gi3nkbh@vireshk-i7>

On Thu, 27 Aug 2020 10:44:01 +0530
Viresh Kumar <viresh.kumar@linaro.org> wrote:

> On 27-08-20, 12:03, Yue Hu wrote:
> > Hi Daniel,
> > 
> > Now, i'm just focus on removing the kernel warning based on current code logic.
> > Commit 8ea229511e06 (thermal: Add cooling device's statistics in sysfs) added
> > the thermal statistics by viresh and viresh gived the patch an acknowledgement
> > in anther mail thread. 
> > 
> > Hi viresh,
> > 
> > Could you review the patch again about the question above?  
> 
> Yeah, I Acked it but the questions raised by Daniel are very valid and must be
> answered.

Yes, sure.

> 
> I understand that you only cared about fixing the warning, but maybe we need to
> fix the driver and the warning will go away by itself. If you don't want to do
> it, then someone who is responsible for the driver should do it.

Yes, maybe the patch is not totally correct. maybe the driver has issue. Let's
check the driver firstly.

> 
> Was it the acpi_video.c driver that you got the warning from ? I have added
> Rafael to the email in case that driver needs getting fixed.
> 

Currenly, drivers/video/backlight does not call thermal_of_cooling_device_register()
to register thermal cooling device. The issue happened in msm-4.19 kernel for
QCOM/Android platform. Backlight in msm-4.19 kernel will register thermal cooling
device as below:

+static int bd_cdev_get_max_brightness(struct thermal_cooling_device *cdev,
+                                 unsigned long *state)
+{
+ struct backlight_device *bd = (struct backlight_device *)cdev->devdata;
+
+ *state = bd->props.max_brightness;
+
+ return 0;
+}


+static struct thermal_cooling_device_ops bd_cdev_ops = {
+ .get_max_state = bd_cdev_get_max_brightness,

+static void backlight_cdev_register(struct device *parent,
+                             struct backlight_device *bd)
+{
+ if (of_find_property(parent->of_node, "#cooling-cells", NULL)) {
+         bd->cdev = thermal_of_cooling_device_register(parent->of_node,
+                         (char *)dev_name(&bd->dev), bd, &bd_cdev_ops);

And the bd->props.max_brightness is getting from video/backlight/qcom-wled.c. Maybe
the driver should not assign 1024 to states/max_brightness. I'm not sure about it.
So i consider to change memory allocation methord. That's the origin of the patch.

Thank you.


  reply	other threads:[~2020-08-27  6:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  6:30 [PATCH] thermal: sysfs: fall back to vzalloc for cooling device's statistics Yue Hu
2020-08-19 11:05 ` Amit Kucheria
2020-08-19 11:17 ` Amit Kucheria
2020-08-20  2:57   ` Yue Hu
2020-08-24 10:40 ` Daniel Lezcano
2020-08-26  2:13   ` Yue Hu
2020-08-26  9:19     ` Daniel Lezcano
2020-08-27  4:03       ` Yue Hu
2020-08-27  5:14         ` Viresh Kumar
2020-08-27  6:20           ` Yue Hu [this message]
2020-08-27  6:26             ` Viresh Kumar
2020-08-27  6:40               ` Yue Hu

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=20200827142003.000071c1.zbestahu@gmail.com \
    --to=zbestahu@gmail.com \
    --cc=amit.kucheria@verdurent.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=huyue2@yulong.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=viresh.kumar@linaro.org \
    --cc=zbestahu@163.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).