Re: [PATCH] devfreq: Register devfreq as a cooling device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/03/2021 16:06, Chanwoo Choi wrote:
> Hi Daniel,
> 
> As Lukasz's comment, actually some devfreq devices like memory bus
> might not affect the thermal critically. In the mainline,
> there are four types devfreq as following:
> 1. GPU
> 2. UFS Storage
> 3. DMC (Memory Controller)
> 4. Memory bus like AMBA AXI
> 
> I think that you can specify this devfreq device will be used
> for cooling device by editing the devfreq_dev_profile structure.

Thanks for the suggestion, it makes sense.

I will do the change following your example below.

  -- Daniel

> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index bf3047896e41..77966a17d03f 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -935,6 +935,13 @@ struct devfreq *devfreq_add_device(struct device *dev,
> 
>         mutex_unlock(&devfreq_list_lock);
> 
> +       if (devfreq->profile->is_cooling_device) {
> +               devfreq->cdev = devfreq_cooling_em_register(devfreq, NULL);
> +               if (IS_ERR(devfreq->cdev))
> +                       dev_info(dev,
> +                               "Failed to register devfreq cooling
> device\n");
> +       }
> +
>         return devfreq;
> 
>  err_init:
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index 26ea0850be9b..26dc69f1047b 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -103,6 +103,7 @@ struct devfreq_dev_profile {
>         unsigned long initial_freq;
>         unsigned int polling_ms;
>         enum devfreq_timer timer;
> +       bool is_cooling_device;
> 
>         int (*target)(struct device *dev, unsigned long *freq, u32 flags);
>         int (*get_dev_status)(struct device *dev,
> 



-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux