Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: Gaurav Kohli <gaurav.kohli@oss.qualcomm.com>
Cc: linux-arm-msm@vger.kernel.org, krzk+dt@kernel.org,
	casey.connolly@linaro.org, amitk@kernel.org,
	konradybcio@kernel.org, rui.zhang@intel.com,
	daniel.lezcano@linaro.org, rafael@kernel.org,
	conor+dt@kernel.org, andersson@kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org,
	Amit Kucheria <amit.kucheria@oss.qualcomm.com>,
	mathieu.poirier@linaro.org, mani@kernel.org
Subject: Re: [PATCH v1 1/8] thermal: Add Remote Proc cooling driver
Date: Mon, 9 Feb 2026 10:21:35 +0000	[thread overview]
Message-ID: <5d67c958-dbd5-4580-a620-2eb8a6a0f47b@arm.com> (raw)
In-Reply-To: <d5fd45e3-68b2-427d-b75a-4c6bb9ed6ecb@oss.qualcomm.com>



On 2/9/26 05:28, Gaurav Kohli wrote:
> 
> 
> On 2/2/2026 4:29 PM, Lukasz Luba wrote:
>> Hi Gaurav,
>>
>> On 12/23/25 12:32, Gaurav Kohli wrote:
>>> Add a new generic driver for thermal cooling devices that control
>>> remote processors (modem, DSP, etc.) through various communication
>>> channels.
>>>
>>> This driver provides an abstraction layer between the thermal
>>> subsystem and vendor-specific remote processor communication
>>> mechanisms.
>>
>> Is this the patch about proposing the new cooling
>> device type at last LPC2025 conference (what we've discussed with Amit)?
>>
> 
> thanks Lukasz for review, yes this is the same.
> sorry for late reply, was on leave last week.
> 
>> There was some feedback asking you to add a bit more description
>> into this patch header, please do that (with some background as well).
>>
> 
> Sure, will update.
> 
>>>
>>> Suggested-by: Amit Kucheria <amit.kucheria@oss.qualcomm.com>
>>> Signed-off-by: Gaurav Kohli <gaurav.kohli@oss.qualcomm.com>
>>> ---


[snip]


>>> +struct remoteproc_cooling_ops {
>>> +    int (*get_max_level)(void *devdata, unsigned long *level);
>>> +    int (*get_cur_level)(void *devdata, unsigned long *level);
>>> +    int (*set_cur_level)(void *devdata, unsigned long level);
>>> +};
>>
>> 1. There is no comment for struct and the functions like you did below.
>> 2. Why you need those 3 callbacks?
>>     It looks like they are simple wrappers on stuff in
>>     'struct thermal_cooling_device_ops'.
>>     Please try to get rid of them and re-use the existing fwk callbacks.
>>
> 
> thanks for this suggestion, i will use thermal_cooling_device_ops directly.
> 
>>> +
>>> +/**
>>> + * struct remoteproc_cdev - Remote processor cooling device
>>> + * @cdev: Thermal cooling device handle
>>> + * @ops: Vendor-specific operation callbacks
>>> + * @devdata: Private data for vendor implementation
>>> + * @np: Device tree node associated with this cooling device
>>> + * @lock: Mutex to protect cooling device operations
>>> + */
>>> +struct remoteproc_cdev {
>>
>> Please use the full naming:
>> remoteproc_cooling_device
>>
>>> +    struct thermal_cooling_device *cdev;
>>
>> You don't need to keep it here. AFAICS it's only
>> used in the 'unregister' function. Please check my
>> comment here and then remove this pointer.
>> (It creates uneseccery linkage between those devices).
>>
>>> +    const struct remoteproc_cooling_ops *ops;
>>
>> So here it can be simply:
>> struct thermal_cooling_device_ops cooling_ops;
>>
> 
> yes, i will use this as part of remoteproc_cooling_device struct.
> 
>>> +    void *devdata;
>>> +    struct device_node *np;
>>
>> This 'np' is also not used, remove it please.
>>
>>> +    struct mutex lock;
>>> +};
>>> +
>>> +
>>> +/* Thermal cooling device callbacks */
>>> +
>>> +static int remoteproc_get_max_state(struct thermal_cooling_device 
>>> *cdev,
>>> +                    unsigned long *state)
>>> +{
>>> +    struct remoteproc_cdev *rproc_cdev = cdev->devdata;
>>> +    int ret;
>>> +
>>> +    if (!rproc_cdev || !rproc_cdev->ops)
>>> +        return -EINVAL;
>>
>> This mustn't be changed in runtime accidenly. We don't guard in
>> cpufreq-/devfreq- cooling these callbacks that way. Please drop them.
> 
> Sure, let me rewrite this and update in next version.
> 
>>

[snip]

>>> +
>>> +    if (!name || !ops) {
>>
>> IMO you should check the '!np' here, not the lines below.
>> We can simply bail out very early.
>>
> 
> thanks will put explicit check for np, but please let me know for non 
> np, do we have to add support for non np also.

If your code doesn't use the non-np then let's not implement it.
When there will be a new client, we can refactor slightly the existing
code and make two interfaces for the registration (similat to cpufreq
cooling).

> so they can directly register with thermal_cooling_device_register.
> 
>>> +        return ERR_PTR(-EINVAL);
>>> +    }
>>> +

[snip]

>>> +
>>> +void remoteproc_cooling_unregister(struct remoteproc_cdev *rproc_cdev)
>>
>> Change the API to be alined with cpufreq-cooling and devfreq-cooling
>> types of devices, so:
>>
>> void remoteproc_cooling_unregister(struct thermal_cooling_device *cdev)
>>
>> You still should be able to get the rptoc_cdev like:
>>
>> rproc_cdev = cdev->devdata;
>>
>> and free it.
>>
> 
> thanks, will change something like below
> +       rproc_cdev = cdev->devdata;
> +       thermal_cooling_device_unregister(cdev);

Should work, let see in the new code.


[snip]


>>> +struct remoteproc_cooling_ops {
>>> +    int (*get_max_level)(void *devdata, unsigned long *level);
>>> +    int (*get_cur_level)(void *devdata, unsigned long *level);
>>> +    int (*set_cur_level)(void *devdata, unsigned long level);
>>> +};
>>
>> That duplicate w/ .c file content.
>> We don't need this in the header, please follow the cpufreq-/devfreq-
>> design.
>>
> 
> Yes, with new approach of using thermal_cooling_device_ops directly can
> save this.

Great, looking for the the v2

> 
>>> +
>>> +struct remoteproc_cdev;
>>> +
>>> +#ifdef CONFIG_REMOTEPROC_THERMAL
>>> +
>>> +struct remoteproc_cdev *
>>> +remoteproc_cooling_register(struct device_node *np,
>>> +                 const char *name,
>>> +                 const struct remoteproc_cooling_ops *ops,
>>> +                 void *devdata);
>>> +
>>> +void remoteproc_cooling_unregister(struct remoteproc_cdev *rproc_cdev);
>>> +
>>> +#else /* !CONFIG_REMOTEPROC_THERMAL */
>>> +
>>> +static inline struct remoteproc_cdev *
>>> +remoteproc_cooling_register(struct device_node *np,
>>> +                 const char *name,
>>> +                 const struct remoteproc_cooling_ops *ops,
>>> +                 void *devdata)
>>> +{
>>> +    return ERR_PTR(-EINVAL);
>>> +}
>>
>> Function naming convention here as well
>>
> 
> thanks a lot, let me rewrite as per suggestion and update in newer version.
> 

you're welcome


  reply	other threads:[~2026-02-09 10:21 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 12:32 [PATCH v1 0/8] Add RemoteProc cooling support Gaurav Kohli
2025-12-23 12:32 ` [PATCH v1 1/8] thermal: Add Remote Proc cooling driver Gaurav Kohli
2025-12-23 19:23   ` Dmitry Baryshkov
2025-12-24  8:20     ` Gaurav Kohli
2026-01-03 15:05   ` Bjorn Andersson
2026-01-05  5:18     ` Gaurav Kohli
2026-01-08 11:59   ` Zhongqiu Han
2026-01-29  5:40     ` Gaurav Kohli
2026-02-02 10:59   ` Lukasz Luba
2026-02-09  5:28     ` Gaurav Kohli
2026-02-09 10:21       ` Lukasz Luba [this message]
2025-12-23 12:32 ` [PATCH v1 2/8] remoteproc: qcom: probe all child devices Gaurav Kohli
2025-12-23 19:26   ` Dmitry Baryshkov
2026-01-03 14:56   ` Bjorn Andersson
2026-01-08  7:07     ` Gaurav Kohli
2026-01-23 13:53       ` Gaurav Kohli
2026-01-23 19:03         ` Dmitry Baryshkov
2026-01-27 16:12           ` Gaurav Kohli
2026-01-27 16:41             ` Dmitry Baryshkov
2026-01-28  9:39               ` Gaurav Kohli
2026-01-28  9:45                 ` Konrad Dybcio
2026-01-30  7:03                   ` Gaurav Kohli
2026-01-30  9:13                     ` Konrad Dybcio
2026-01-31  8:06                       ` Dmitry Baryshkov
2026-01-31 10:11                         ` Gaurav Kohli
2026-01-31 11:40                           ` Dmitry Baryshkov
2026-01-31 11:45                             ` Gaurav Kohli
2025-12-23 12:32 ` [PATCH v1 3/8] dt-bindings: thermal: Add qcom,qmi-cooling yaml bindings Gaurav Kohli
2025-12-23 13:59   ` Rob Herring (Arm)
2025-12-24  8:20     ` Gaurav Kohli
2025-12-23 19:30   ` Dmitry Baryshkov
2025-12-24  8:24     ` Gaurav Kohli
2025-12-24  9:31       ` Dmitry Baryshkov
2026-01-03 15:08       ` Bjorn Andersson
2025-12-23 19:52   ` Dmitry Baryshkov
2025-12-24  8:57   ` Krzysztof Kozlowski
2025-12-24 10:08     ` Gaurav Kohli
2025-12-24 10:24       ` Krzysztof Kozlowski
2025-12-31  6:42         ` Gaurav Kohli
2025-12-31  7:35           ` Krzysztof Kozlowski
2025-12-31  7:47           ` Dmitry Baryshkov
2025-12-31  7:52             ` Gaurav Kohli
2025-12-31  7:55               ` Dmitry Baryshkov
2025-12-24  9:02   ` Krzysztof Kozlowski
2025-12-31 11:59   ` Konrad Dybcio
2026-01-08  8:43     ` Gaurav Kohli
2025-12-23 12:32 ` [PATCH v1 4/8] thermal: qcom: add qmi-cooling driver Gaurav Kohli
2025-12-23 19:49   ` Dmitry Baryshkov
2025-12-31  6:28     ` Gaurav Kohli
2025-12-31  6:33       ` Dmitry Baryshkov
2025-12-24  9:01   ` Krzysztof Kozlowski
2025-12-31  6:32     ` Gaurav Kohli
2025-12-23 12:32 ` [PATCH v1 5/8] arm64: dts: qcom: Enable cdsp qmi tmd devices for lemans Gaurav Kohli
2025-12-23 19:32   ` Dmitry Baryshkov
2025-12-23 12:32 ` [PATCH v1 6/8] arm64: dts: qcom: Enable cdsp qmi tmd devices for talos Gaurav Kohli
2026-01-03 15:13   ` Bjorn Andersson
2025-12-23 12:32 ` [PATCH v1 7/8] arm64: dts: qcom: Enable cdsp qmi tmd devices for kodiak Gaurav Kohli
2026-01-03 15:14   ` Bjorn Andersson
2025-12-23 12:32 ` [PATCH v1 8/8] arm64: dts: qcom: Enable cdsp qmi tmd devices for monaco Gaurav Kohli
2025-12-24  8:58   ` Krzysztof Kozlowski
2025-12-24 10:11     ` Gaurav Kohli
2026-01-10 16:13 ` [PATCH v1 0/8] Add RemoteProc cooling support Casey Connolly
2026-01-13  9:33   ` Gaurav Kohli
2026-02-01 20:20     ` Trilok Soni
2026-02-02  9:53       ` Konrad Dybcio
2026-02-09 10:22         ` Gaurav Kohli
2026-02-09  5:33       ` Gaurav Kohli

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=5d67c958-dbd5-4580-a620-2eb8a6a0f47b@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=amit.kucheria@oss.qualcomm.com \
    --cc=amitk@kernel.org \
    --cc=andersson@kernel.org \
    --cc=casey.connolly@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gaurav.kohli@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=rafael@kernel.org \
    --cc=robh@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