RE: [PATCH V2] cpufreq: qoriq: Register cooling device based on device tree

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

 





> -----Original Message-----
> From: Denis Kirjanov [mailto:kda@xxxxxxxxxxxxxxxxx]
> Sent: Thursday, November 26, 2015 4:32 PM
> To: Jia Hongtao-B38951
> Cc: edubezval@xxxxxxxxx; viresh.kumar@xxxxxxxxxx; Wood Scott-B07421;
> devicetree@xxxxxxxxxxxxxxx; linuxppc-dev@xxxxxxxxxxxxxxxx; linux-
> pm@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH V2] cpufreq: qoriq: Register cooling device based on
> device tree
> 
> On 11/26/15, Jia Hongtao <hongtao.jia@xxxxxxxxxxxxx> wrote:
> > Register the qoriq cpufreq driver as a cooling device, based on the
> > thermal device tree framework. When temperature crosses the passive
> > trip point cpufreq is used to throttle CPUs.
> >
> > Signed-off-by: Jia Hongtao <hongtao.jia@xxxxxxxxxxxxx>
> > ---
> > Changes for V2:
> > * Using ->ready callback for cpu cooling device registering.
> >
> >  drivers/cpufreq/qoriq-cpufreq.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> >
> > diff --git a/drivers/cpufreq/qoriq-cpufreq.c
> > b/drivers/cpufreq/qoriq-cpufreq.c index 4f53fa2..a39f868 100644
> > --- a/drivers/cpufreq/qoriq-cpufreq.c
> > +++ b/drivers/cpufreq/qoriq-cpufreq.c
> > @@ -12,6 +12,7 @@
> >
> >  #include <linux/clk.h>
> >  #include <linux/cpufreq.h>
> > +#include <linux/cpu_cooling.h>
> >  #include <linux/errno.h>
> >  #include <linux/init.h>
> >  #include <linux/kernel.h>
> > @@ -33,6 +34,7 @@
> >  struct cpu_data {
> >  	struct clk **pclk;
> >  	struct cpufreq_frequency_table *table;
> > +	struct thermal_cooling_device *cdev;
> >  };
> >
> >  /*
> > @@ -260,6 +262,30 @@ static int qoriq_cpufreq_target(struct
> > cpufreq_policy *policy,
> >  	return clk_set_parent(policy->clk, parent);  }
> >
> > +
> > +static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) {
> > +	struct cpu_data *cpud = policy->driver_data;
> > +	struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
> > +
> > +	if (WARN_ON(!np))
> > +		return;
> I doubt that WARN_ON is necessary here. Do you know the exact case where
> the np is NULL?

This seems not necessary as you said.
If no one else has the opposite opinion I will remove it.

Thanks.

> > +
> > +	if (of_find_property(np, "#cooling-cells", NULL)) {
> > +		cpud->cdev = of_cpufreq_cooling_register(np,
> > +							 policy->related_cpus);
> > +
> > +		if (IS_ERR(cpud->cdev)) {
> > +			pr_err("Failed to register cooling device cpu%d: %ld\n",
> > +					policy->cpu, PTR_ERR(cpud->cdev));
> > +
> > +			cpud->cdev = NULL;
> > +		}
> > +	}
> > +
> > +	of_node_put(np);
> > +}
> > +
> >  static struct cpufreq_driver qoriq_cpufreq_driver = {
> >  	.name		= "qoriq_cpufreq",
> >  	.flags		= CPUFREQ_CONST_LOOPS,
> > @@ -268,6 +294,7 @@ static struct cpufreq_driver qoriq_cpufreq_driver =
> {
> >  	.verify		= cpufreq_generic_frequency_table_verify,
> >  	.target_index	= qoriq_cpufreq_target,
> >  	.get		= cpufreq_generic_get,
> > +	.ready		= qoriq_cpufreq_ready,
> >  	.attr		= cpufreq_generic_attr,
> >  };
> >
> > --
> > 2.1.0.27.g96db324
> >
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@xxxxxxxxxxxxxxxx
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
��.n��������+%������w��{.n����z�{��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux