From: Eduardo Valentin <edubezval@gmail.com>
To: Bastian Stender <bst@pengutronix.de>
Cc: Zhang Rui <rui.zhang@intel.com>,
linux-pm@vger.kernel.org, Viresh Kumar <viresh.kumar@linaro.org>,
kernel@pengutronix.de
Subject: Re: [PATCH] thermal: imx: use cpufreq cooling of registration method
Date: Sun, 5 Nov 2017 17:57:36 -0800 [thread overview]
Message-ID: <20171106015733.GA2525@localhost.localdomain> (raw)
In-Reply-To: <20171103164203.5805-1-bst@pengutronix.de>
Hello Bastian,
On Fri, Nov 03, 2017 at 05:42:03PM +0100, Bastian Stender wrote:
> The of variant of cpufreq_cooling_register links the cooling device to
> the device tree node provided.
>
> This makes it possible to bind the cpufreq cooling device to a custom
> thermal zone via a cooling-maps entry like:
>
> cooling-maps {
> map0 {
> trip = <&board_alert>;
> cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> };
> };
>
> Assuming a cpu node exists with label "cpu0" and #cooling-cells
> property.
>
> Signed-off-by: Bastian Stender <bst@pengutronix.de>
> ---
> drivers/thermal/imx_thermal.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 4798b4b1fd77..de71cd3bb03a 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -473,6 +473,8 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
>
> static int imx_thermal_probe(struct platform_device *pdev)
> {
> + struct device_node *np;
> + struct device *cpu_dev;
> struct imx_thermal_data *data;
> struct regmap *map;
> int measure_freq;
> @@ -533,7 +535,19 @@ static int imx_thermal_probe(struct platform_device *pdev)
> return -EPROBE_DEFER;
> }
>
> - data->cdev = cpufreq_cooling_register(data->policy);
> + cpu_dev = get_cpu_device(0);
> + if (!cpu_dev) {
> + pr_err("%s: failed to get cpu0 device\n", __func__);
> + return -ENODEV;
> + }
> +
> + np = of_node_get(cpu_dev->of_node);
> + if (!np) {
> + dev_err(cpu_dev, "failed to find cpu0 node\n");
> + return -ENOENT;
> + }
> +
> + data->cdev = of_cpufreq_cooling_register(np, data->policy);
This would actually be better suited if added to IMX cpufreq driver
instead. Any reason to attempt to add to the thermal driver?
> if (IS_ERR(data->cdev)) {
> ret = PTR_ERR(data->cdev);
> dev_err(&pdev->dev,
> --
> 2.11.0
>
next prev parent reply other threads:[~2017-11-06 1:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 16:42 [PATCH] thermal: imx: use cpufreq cooling of registration method Bastian Stender
2017-11-06 1:57 ` Eduardo Valentin [this message]
2017-11-07 10:26 ` Bastian Stender
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=20171106015733.GA2525@localhost.localdomain \
--to=edubezval@gmail.com \
--cc=bst@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=viresh.kumar@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.