On Thu, 27 Aug 2020 10:44:01 +0530 Viresh Kumar <viresh.ku...@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.