RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
Hi, Viresh

Best Regards!
Anson Huang

> -Original Message-
> From: Viresh Kumar [mailto:viresh.ku...@linaro.org]
> Sent: 2018年11月20日 18:49
> To: Anson Huang 
> Cc: Zhang Rui ; Eduardo Valentin
> ; Linux PM list ; Linux
> Kernel Mailing List ; dl-linux-imx
> 
> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> While I am aligned with the fact that we need to carry this code for backward
> compatibility, there are few things I would suggest to improve.
> 
> On Wed, Oct 24, 2018 at 12:10 PM Anson Huang 
> wrote:
> >  static int imx_thermal_probe(struct platform_device *pdev)  { @@
> > -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device
> *pdev)
> > regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
> >  data->socdata->power_down_mask);
> >
> > +#ifdef CONFIG_CPU_FREQ
> > data->policy = cpufreq_cpu_get(0);
> > if (!data->policy) {
> > pr_debug("%s: CPUFreq policy not found\n", __func__);
> > @@ -755,6 +758,7 @@ static int imx_thermal_probe(struct platform_device
> *pdev)
> > "failed to register cpufreq cooling device: %d\n",
> ret);
> > return ret;
> > }
> > +#endif
> >
> > data->thermal_clk = devm_clk_get(>dev, NULL);
> > if (IS_ERR(data->thermal_clk)) {
> 
> You missed the error handling code which unregisters cooling/cpufreq stuff.
> 
> And it would be better to write things in a somewhat better way, like this:
> 
> #ifdef CONFIG_CPU_FREQ
> 
> static int imx_thermal_register_legacy_cooling(...)
> {
> ... current function body
> }
> 
> static void imx_thermal_unregister_legacy_cooling(...)
> {
> new routine body to unregister things }
> 
> #else
> static inline  int imx_thermal_register_legacy_cooling(...)
> {
> return 0;
> }
> 
> static void imx_thermal_unregister_legacy_cooling(...) { }
> 
> #endif
> 
> 
> And then you can get rid of ifdef hackery in the middle of probe().

Thanks for good suggestion, please help review the V2 patch I just sent out.

Anson.


RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
Hi, Viresh

Best Regards!
Anson Huang

> -Original Message-
> From: Viresh Kumar [mailto:viresh.ku...@linaro.org]
> Sent: 2018年11月20日 18:49
> To: Anson Huang 
> Cc: Zhang Rui ; Eduardo Valentin
> ; Linux PM list ; Linux
> Kernel Mailing List ; dl-linux-imx
> 
> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> While I am aligned with the fact that we need to carry this code for backward
> compatibility, there are few things I would suggest to improve.
> 
> On Wed, Oct 24, 2018 at 12:10 PM Anson Huang 
> wrote:
> >  static int imx_thermal_probe(struct platform_device *pdev)  { @@
> > -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device
> *pdev)
> > regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
> >  data->socdata->power_down_mask);
> >
> > +#ifdef CONFIG_CPU_FREQ
> > data->policy = cpufreq_cpu_get(0);
> > if (!data->policy) {
> > pr_debug("%s: CPUFreq policy not found\n", __func__);
> > @@ -755,6 +758,7 @@ static int imx_thermal_probe(struct platform_device
> *pdev)
> > "failed to register cpufreq cooling device: %d\n",
> ret);
> > return ret;
> > }
> > +#endif
> >
> > data->thermal_clk = devm_clk_get(>dev, NULL);
> > if (IS_ERR(data->thermal_clk)) {
> 
> You missed the error handling code which unregisters cooling/cpufreq stuff.
> 
> And it would be better to write things in a somewhat better way, like this:
> 
> #ifdef CONFIG_CPU_FREQ
> 
> static int imx_thermal_register_legacy_cooling(...)
> {
> ... current function body
> }
> 
> static void imx_thermal_unregister_legacy_cooling(...)
> {
> new routine body to unregister things }
> 
> #else
> static inline  int imx_thermal_register_legacy_cooling(...)
> {
> return 0;
> }
> 
> static void imx_thermal_unregister_legacy_cooling(...) { }
> 
> #endif
> 
> 
> And then you can get rid of ifdef hackery in the middle of probe().

Thanks for good suggestion, please help review the V2 patch I just sent out.

Anson.


Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Viresh Kumar
While I am aligned with the fact that we need to carry this code for backward
compatibility, there are few things I would suggest to improve.

On Wed, Oct 24, 2018 at 12:10 PM Anson Huang  wrote:
>  static int imx_thermal_probe(struct platform_device *pdev)
>  {
> @@ -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
> regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
>  data->socdata->power_down_mask);
>
> +#ifdef CONFIG_CPU_FREQ
> data->policy = cpufreq_cpu_get(0);
> if (!data->policy) {
> pr_debug("%s: CPUFreq policy not found\n", __func__);
> @@ -755,6 +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
> "failed to register cpufreq cooling device: %d\n", 
> ret);
> return ret;
> }
> +#endif
>
> data->thermal_clk = devm_clk_get(>dev, NULL);
> if (IS_ERR(data->thermal_clk)) {

You missed the error handling code which unregisters cooling/cpufreq stuff.

And it would be better to write things in a somewhat better way, like this:

#ifdef CONFIG_CPU_FREQ

static int imx_thermal_register_legacy_cooling(...)
{
... current function body
}

static void imx_thermal_unregister_legacy_cooling(...)
{
new routine body to unregister things
}

#else
static inline  int imx_thermal_register_legacy_cooling(...)
{
return 0;
}

static void imx_thermal_unregister_legacy_cooling(...) { }

#endif


And then you can get rid of ifdef hackery in the middle of probe().


Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Viresh Kumar
While I am aligned with the fact that we need to carry this code for backward
compatibility, there are few things I would suggest to improve.

On Wed, Oct 24, 2018 at 12:10 PM Anson Huang  wrote:
>  static int imx_thermal_probe(struct platform_device *pdev)
>  {
> @@ -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
> regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
>  data->socdata->power_down_mask);
>
> +#ifdef CONFIG_CPU_FREQ
> data->policy = cpufreq_cpu_get(0);
> if (!data->policy) {
> pr_debug("%s: CPUFreq policy not found\n", __func__);
> @@ -755,6 +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
> "failed to register cpufreq cooling device: %d\n", 
> ret);
> return ret;
> }
> +#endif
>
> data->thermal_clk = devm_clk_get(>dev, NULL);
> if (IS_ERR(data->thermal_clk)) {

You missed the error handling code which unregisters cooling/cpufreq stuff.

And it would be better to write things in a somewhat better way, like this:

#ifdef CONFIG_CPU_FREQ

static int imx_thermal_register_legacy_cooling(...)
{
... current function body
}

static void imx_thermal_unregister_legacy_cooling(...)
{
new routine body to unregister things
}

#else
static inline  int imx_thermal_register_legacy_cooling(...)
{
return 0;
}

static void imx_thermal_unregister_legacy_cooling(...) { }

#endif


And then you can get rid of ifdef hackery in the middle of probe().


Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Lucas Stach
Am Dienstag, den 20.11.2018, 10:29 +0100 schrieb Daniel Lezcano:
> On 20/11/2018 09:58, Anson Huang wrote:
> > Hi, Daniel
> > 
> > Best Regards!
> > Anson Huang
> > 
> > > -Original Message-
> > > From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> > > Sent: 2018年11月20日 16:54
> > > To: Anson Huang ; rui.zh...@intel.com;
> > > edubez...@gmail.com; linux...@vger.kernel.org;
> > > linux-kernel@vger.kernel.org
> > > Cc: dl-linux-imx 
> > > Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> > > 
> > > On 20/11/2018 09:47, Anson Huang wrote:
> > > > Hi, Daniel
> > > > 
> > > > Best Regards!
> > > > Anson Huang
> > > > 
> > > > > -Original Message-
> > > > > From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> > > > > Sent: 2018年11月20日 16:45
> > > > > To: Anson Huang ; rui.zh...@intel.com;
> > > > > edubez...@gmail.com; linux...@vger.kernel.org;
> > > > > linux-kernel@vger.kernel.org
> > > > > Cc: dl-linux-imx 
> > > > > Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-
> > > > > freq
> > > > > 
> > > > > On 24/10/2018 08:39, Anson Huang wrote:
> > > > > > The thermal driver is a standalone driver for monitoring
> > > > > > SoC
> > > > > > temperature by enabling thermal sensor, so it can be
> > > > > > enabled even
> > > > > > when CONFIG_CPU_FREQ is NOT set. So remove the dependency
> > > > > > with
> > > > > 
> > > > > CPU_THERMAL.
> > > > > > 
> > > > > > Add CONFIG_CPU_FREQ check for cpu-freq related operation in
> > > > > > thermal
> > > > > > driver to make thermal driver probe successfully when
> > > > > > CONFIG_CPU_FREQ is NOT set.
> > > > > > 
> > > > > > Signed-off-by: Anson Huang 
> > > > > > ---
> > > > > 
> > > > > Why not simply kill this legacy code ?
> > > > 
> > > > Because killing legacy code will have old dtb compatible issue,
> > > > old
> > > > dtb will NOT have cpufreq cooling function.
> > > 
> > > Yeah, I imagine that is the reason why you want to keep the
> > > legacy code but do
> > > you really care about old DTB based boards? Are they still
> > > updated with newer
> > > *upstream vanilla* kernels?
> > 
> > I am NOT sure if there is someone care about it, but I did receive
> > many comments
> > about old dtb compatible when I sent out other patches, so is it a
> > solid requirement
> > of old dtb compatible when doing upstream, or each sub-system or
> > maintainer has
> > different requirement about it? Actually I am happy to just remove
> > the legacy
> > code, because it makes the code more clean and easy reading. Who
> > can make the
> > decision?
> 
> Yes, making sure to not break the compatibility makes the patch
> submission easier. However, sometime it makes sense to put in
> question
> if keeping old (and hackish) code really matters.
> 
> Old boards are rarely updated with newer kernels and when that
> happens,
> usually the DT is updated also.
> 
> IMO, this decision is in the hands of the platform maintainers. I
> suggest to send a patch removing the legacy code Cc'ing all of them.

On i.MX we usually try to keep DT compatibility as much as possible.
There are cases where keeping the compatibility is just too much of a
burden on maintenance, but IMHO this is not the case for the piece of
code in question here.

Regards,
Lucas



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Lucas Stach
Am Dienstag, den 20.11.2018, 10:29 +0100 schrieb Daniel Lezcano:
> On 20/11/2018 09:58, Anson Huang wrote:
> > Hi, Daniel
> > 
> > Best Regards!
> > Anson Huang
> > 
> > > -Original Message-
> > > From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> > > Sent: 2018年11月20日 16:54
> > > To: Anson Huang ; rui.zh...@intel.com;
> > > edubez...@gmail.com; linux...@vger.kernel.org;
> > > linux-kernel@vger.kernel.org
> > > Cc: dl-linux-imx 
> > > Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> > > 
> > > On 20/11/2018 09:47, Anson Huang wrote:
> > > > Hi, Daniel
> > > > 
> > > > Best Regards!
> > > > Anson Huang
> > > > 
> > > > > -Original Message-
> > > > > From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> > > > > Sent: 2018年11月20日 16:45
> > > > > To: Anson Huang ; rui.zh...@intel.com;
> > > > > edubez...@gmail.com; linux...@vger.kernel.org;
> > > > > linux-kernel@vger.kernel.org
> > > > > Cc: dl-linux-imx 
> > > > > Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-
> > > > > freq
> > > > > 
> > > > > On 24/10/2018 08:39, Anson Huang wrote:
> > > > > > The thermal driver is a standalone driver for monitoring
> > > > > > SoC
> > > > > > temperature by enabling thermal sensor, so it can be
> > > > > > enabled even
> > > > > > when CONFIG_CPU_FREQ is NOT set. So remove the dependency
> > > > > > with
> > > > > 
> > > > > CPU_THERMAL.
> > > > > > 
> > > > > > Add CONFIG_CPU_FREQ check for cpu-freq related operation in
> > > > > > thermal
> > > > > > driver to make thermal driver probe successfully when
> > > > > > CONFIG_CPU_FREQ is NOT set.
> > > > > > 
> > > > > > Signed-off-by: Anson Huang 
> > > > > > ---
> > > > > 
> > > > > Why not simply kill this legacy code ?
> > > > 
> > > > Because killing legacy code will have old dtb compatible issue,
> > > > old
> > > > dtb will NOT have cpufreq cooling function.
> > > 
> > > Yeah, I imagine that is the reason why you want to keep the
> > > legacy code but do
> > > you really care about old DTB based boards? Are they still
> > > updated with newer
> > > *upstream vanilla* kernels?
> > 
> > I am NOT sure if there is someone care about it, but I did receive
> > many comments
> > about old dtb compatible when I sent out other patches, so is it a
> > solid requirement
> > of old dtb compatible when doing upstream, or each sub-system or
> > maintainer has
> > different requirement about it? Actually I am happy to just remove
> > the legacy
> > code, because it makes the code more clean and easy reading. Who
> > can make the
> > decision?
> 
> Yes, making sure to not break the compatibility makes the patch
> submission easier. However, sometime it makes sense to put in
> question
> if keeping old (and hackish) code really matters.
> 
> Old boards are rarely updated with newer kernels and when that
> happens,
> usually the DT is updated also.
> 
> IMO, this decision is in the hands of the platform maintainers. I
> suggest to send a patch removing the legacy code Cc'ing all of them.

On i.MX we usually try to keep DT compatibility as much as possible.
There are cases where keeping the compatibility is just too much of a
burden on maintenance, but IMHO this is not the case for the piece of
code in question here.

Regards,
Lucas



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Daniel Lezcano
On 20/11/2018 09:58, Anson Huang wrote:
> Hi, Daniel
> 
> Best Regards!
> Anson Huang
> 
>> -Original Message-
>> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
>> Sent: 2018年11月20日 16:54
>> To: Anson Huang ; rui.zh...@intel.com;
>> edubez...@gmail.com; linux...@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Cc: dl-linux-imx 
>> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
>>
>> On 20/11/2018 09:47, Anson Huang wrote:
>>> Hi, Daniel
>>>
>>> Best Regards!
>>> Anson Huang
>>>
>>>> -Original Message-
>>>> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
>>>> Sent: 2018年11月20日 16:45
>>>> To: Anson Huang ; rui.zh...@intel.com;
>>>> edubez...@gmail.com; linux...@vger.kernel.org;
>>>> linux-kernel@vger.kernel.org
>>>> Cc: dl-linux-imx 
>>>> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
>>>>
>>>> On 24/10/2018 08:39, Anson Huang wrote:
>>>>> The thermal driver is a standalone driver for monitoring SoC
>>>>> temperature by enabling thermal sensor, so it can be enabled even
>>>>> when CONFIG_CPU_FREQ is NOT set. So remove the dependency with
>>>> CPU_THERMAL.
>>>>>
>>>>> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
>>>>> driver to make thermal driver probe successfully when
>>>>> CONFIG_CPU_FREQ is NOT set.
>>>>>
>>>>> Signed-off-by: Anson Huang 
>>>>> ---
>>>>
>>>> Why not simply kill this legacy code ?
>>>
>>> Because killing legacy code will have old dtb compatible issue, old
>>> dtb will NOT have cpufreq cooling function.
>>
>> Yeah, I imagine that is the reason why you want to keep the legacy code but 
>> do
>> you really care about old DTB based boards? Are they still updated with newer
>> *upstream vanilla* kernels?
> 
> I am NOT sure if there is someone care about it, but I did receive many 
> comments
> about old dtb compatible when I sent out other patches, so is it a solid 
> requirement
> of old dtb compatible when doing upstream, or each sub-system or maintainer 
> has
> different requirement about it? Actually I am happy to just remove the legacy
> code, because it makes the code more clean and easy reading. Who can make the
> decision?

Yes, making sure to not break the compatibility makes the patch
submission easier. However, sometime it makes sense to put in question
if keeping old (and hackish) code really matters.

Old boards are rarely updated with newer kernels and when that happens,
usually the DT is updated also.

IMO, this decision is in the hands of the platform maintainers. I
suggest to send a patch removing the legacy code Cc'ing all of them.




-- 
 <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



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Daniel Lezcano
On 20/11/2018 09:58, Anson Huang wrote:
> Hi, Daniel
> 
> Best Regards!
> Anson Huang
> 
>> -Original Message-
>> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
>> Sent: 2018年11月20日 16:54
>> To: Anson Huang ; rui.zh...@intel.com;
>> edubez...@gmail.com; linux...@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Cc: dl-linux-imx 
>> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
>>
>> On 20/11/2018 09:47, Anson Huang wrote:
>>> Hi, Daniel
>>>
>>> Best Regards!
>>> Anson Huang
>>>
>>>> -Original Message-
>>>> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
>>>> Sent: 2018年11月20日 16:45
>>>> To: Anson Huang ; rui.zh...@intel.com;
>>>> edubez...@gmail.com; linux...@vger.kernel.org;
>>>> linux-kernel@vger.kernel.org
>>>> Cc: dl-linux-imx 
>>>> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
>>>>
>>>> On 24/10/2018 08:39, Anson Huang wrote:
>>>>> The thermal driver is a standalone driver for monitoring SoC
>>>>> temperature by enabling thermal sensor, so it can be enabled even
>>>>> when CONFIG_CPU_FREQ is NOT set. So remove the dependency with
>>>> CPU_THERMAL.
>>>>>
>>>>> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
>>>>> driver to make thermal driver probe successfully when
>>>>> CONFIG_CPU_FREQ is NOT set.
>>>>>
>>>>> Signed-off-by: Anson Huang 
>>>>> ---
>>>>
>>>> Why not simply kill this legacy code ?
>>>
>>> Because killing legacy code will have old dtb compatible issue, old
>>> dtb will NOT have cpufreq cooling function.
>>
>> Yeah, I imagine that is the reason why you want to keep the legacy code but 
>> do
>> you really care about old DTB based boards? Are they still updated with newer
>> *upstream vanilla* kernels?
> 
> I am NOT sure if there is someone care about it, but I did receive many 
> comments
> about old dtb compatible when I sent out other patches, so is it a solid 
> requirement
> of old dtb compatible when doing upstream, or each sub-system or maintainer 
> has
> different requirement about it? Actually I am happy to just remove the legacy
> code, because it makes the code more clean and easy reading. Who can make the
> decision?

Yes, making sure to not break the compatibility makes the patch
submission easier. However, sometime it makes sense to put in question
if keeping old (and hackish) code really matters.

Old boards are rarely updated with newer kernels and when that happens,
usually the DT is updated also.

IMO, this decision is in the hands of the platform maintainers. I
suggest to send a patch removing the legacy code Cc'ing all of them.




-- 
 <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



RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
Hi, Daniel

Best Regards!
Anson Huang

> -Original Message-
> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> Sent: 2018年11月20日 16:54
> To: Anson Huang ; rui.zh...@intel.com;
> edubez...@gmail.com; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: dl-linux-imx 
> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> On 20/11/2018 09:47, Anson Huang wrote:
> > Hi, Daniel
> >
> > Best Regards!
> > Anson Huang
> >
> >> -Original Message-
> >> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> >> Sent: 2018年11月20日 16:45
> >> To: Anson Huang ; rui.zh...@intel.com;
> >> edubez...@gmail.com; linux...@vger.kernel.org;
> >> linux-kernel@vger.kernel.org
> >> Cc: dl-linux-imx 
> >> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> >>
> >> On 24/10/2018 08:39, Anson Huang wrote:
> >>> The thermal driver is a standalone driver for monitoring SoC
> >>> temperature by enabling thermal sensor, so it can be enabled even
> >>> when CONFIG_CPU_FREQ is NOT set. So remove the dependency with
> >> CPU_THERMAL.
> >>>
> >>> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
> >>> driver to make thermal driver probe successfully when
> >>> CONFIG_CPU_FREQ is NOT set.
> >>>
> >>> Signed-off-by: Anson Huang 
> >>> ---
> >>
> >> Why not simply kill this legacy code ?
> >
> > Because killing legacy code will have old dtb compatible issue, old
> > dtb will NOT have cpufreq cooling function.
> 
> Yeah, I imagine that is the reason why you want to keep the legacy code but do
> you really care about old DTB based boards? Are they still updated with newer
> *upstream vanilla* kernels?

I am NOT sure if there is someone care about it, but I did receive many comments
about old dtb compatible when I sent out other patches, so is it a solid 
requirement
of old dtb compatible when doing upstream, or each sub-system or maintainer has
different requirement about it? Actually I am happy to just remove the legacy
code, because it makes the code more clean and easy reading. Who can make the
decision?

Anson.

> 
> 
> --
> 
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Fdata=02%7C01%7Canson.huang%40nxp.com%7Cbb8cdd
> 4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C0%7C636783008739373537sdata=x6qHDTFYb3SNARICs15KkLL7
> %2Fpp7enYZkZJHRoJksXs%3Dreserved=0> Linaro.org │ Open source
> software for ARM SoCs
> 
> Follow Linaro:
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .facebook.com%2Fpages%2FLinarodata=02%7C01%7Canson.huang%40
> nxp.com%7Cbb8cdd4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa9
> 2cd99c5c301635%7C0%7C0%7C636783008739373537sdata=JJ4H9Z0
> RAY%2F1uLlcKXNQN36L0ApFIwM9%2FuPOU9UBUcI%3Dreserved=0>
> Facebook |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitt
> er.com%2F%23!%2Flinaroorgdata=02%7C01%7Canson.huang%40nxp.c
> om%7Cbb8cdd4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783008739373537sdata=o0o7h8GYALt
> o6NuuI%2BAxFzx6rcr3VFg6CWwh3feGggI%3Dreserved=0> Twitter |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Flinaro-blog%2Fdata=02%7C01%7Canson.huang%40nxp.c
> om%7Cbb8cdd4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783008739373537sdata=6r2baB5ZimC
> zJEkrKTvCBH98%2BBlnw0ZHiYOdG5JlimA%3Dreserved=0> Blog



RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
Hi, Daniel

Best Regards!
Anson Huang

> -Original Message-
> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> Sent: 2018年11月20日 16:54
> To: Anson Huang ; rui.zh...@intel.com;
> edubez...@gmail.com; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: dl-linux-imx 
> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> On 20/11/2018 09:47, Anson Huang wrote:
> > Hi, Daniel
> >
> > Best Regards!
> > Anson Huang
> >
> >> -Original Message-
> >> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> >> Sent: 2018年11月20日 16:45
> >> To: Anson Huang ; rui.zh...@intel.com;
> >> edubez...@gmail.com; linux...@vger.kernel.org;
> >> linux-kernel@vger.kernel.org
> >> Cc: dl-linux-imx 
> >> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> >>
> >> On 24/10/2018 08:39, Anson Huang wrote:
> >>> The thermal driver is a standalone driver for monitoring SoC
> >>> temperature by enabling thermal sensor, so it can be enabled even
> >>> when CONFIG_CPU_FREQ is NOT set. So remove the dependency with
> >> CPU_THERMAL.
> >>>
> >>> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
> >>> driver to make thermal driver probe successfully when
> >>> CONFIG_CPU_FREQ is NOT set.
> >>>
> >>> Signed-off-by: Anson Huang 
> >>> ---
> >>
> >> Why not simply kill this legacy code ?
> >
> > Because killing legacy code will have old dtb compatible issue, old
> > dtb will NOT have cpufreq cooling function.
> 
> Yeah, I imagine that is the reason why you want to keep the legacy code but do
> you really care about old DTB based boards? Are they still updated with newer
> *upstream vanilla* kernels?

I am NOT sure if there is someone care about it, but I did receive many comments
about old dtb compatible when I sent out other patches, so is it a solid 
requirement
of old dtb compatible when doing upstream, or each sub-system or maintainer has
different requirement about it? Actually I am happy to just remove the legacy
code, because it makes the code more clean and easy reading. Who can make the
decision?

Anson.

> 
> 
> --
> 
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Fdata=02%7C01%7Canson.huang%40nxp.com%7Cbb8cdd
> 4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C0%7C636783008739373537sdata=x6qHDTFYb3SNARICs15KkLL7
> %2Fpp7enYZkZJHRoJksXs%3Dreserved=0> Linaro.org │ Open source
> software for ARM SoCs
> 
> Follow Linaro:
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .facebook.com%2Fpages%2FLinarodata=02%7C01%7Canson.huang%40
> nxp.com%7Cbb8cdd4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa9
> 2cd99c5c301635%7C0%7C0%7C636783008739373537sdata=JJ4H9Z0
> RAY%2F1uLlcKXNQN36L0ApFIwM9%2FuPOU9UBUcI%3Dreserved=0>
> Facebook |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitt
> er.com%2F%23!%2Flinaroorgdata=02%7C01%7Canson.huang%40nxp.c
> om%7Cbb8cdd4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783008739373537sdata=o0o7h8GYALt
> o6NuuI%2BAxFzx6rcr3VFg6CWwh3feGggI%3Dreserved=0> Twitter |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Flinaro-blog%2Fdata=02%7C01%7Canson.huang%40nxp.c
> om%7Cbb8cdd4155fb4c02dab308d64ec5c9cd%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783008739373537sdata=6r2baB5ZimC
> zJEkrKTvCBH98%2BBlnw0ZHiYOdG5JlimA%3Dreserved=0> Blog



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Daniel Lezcano
On 20/11/2018 09:47, Anson Huang wrote:
> Hi, Daniel
> 
> Best Regards!
> Anson Huang
> 
>> -Original Message-
>> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
>> Sent: 2018年11月20日 16:45
>> To: Anson Huang ; rui.zh...@intel.com;
>> edubez...@gmail.com; linux...@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Cc: dl-linux-imx 
>> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
>>
>> On 24/10/2018 08:39, Anson Huang wrote:
>>> The thermal driver is a standalone driver for monitoring SoC
>>> temperature by enabling thermal sensor, so it can be enabled even when
>>> CONFIG_CPU_FREQ is NOT set. So remove the dependency with
>> CPU_THERMAL.
>>>
>>> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
>>> driver to make thermal driver probe successfully when CONFIG_CPU_FREQ
>>> is NOT set.
>>>
>>> Signed-off-by: Anson Huang 
>>> ---
>>
>> Why not simply kill this legacy code ?
> 
> Because killing legacy code will have old dtb compatible issue, old dtb
> will NOT have cpufreq cooling function.

Yeah, I imagine that is the reason why you want to keep the legacy code
but do you really care about old DTB based boards? Are they still
updated with newer *upstream vanilla* kernels?


-- 
 <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



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Daniel Lezcano
On 20/11/2018 09:47, Anson Huang wrote:
> Hi, Daniel
> 
> Best Regards!
> Anson Huang
> 
>> -Original Message-
>> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
>> Sent: 2018年11月20日 16:45
>> To: Anson Huang ; rui.zh...@intel.com;
>> edubez...@gmail.com; linux...@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Cc: dl-linux-imx 
>> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
>>
>> On 24/10/2018 08:39, Anson Huang wrote:
>>> The thermal driver is a standalone driver for monitoring SoC
>>> temperature by enabling thermal sensor, so it can be enabled even when
>>> CONFIG_CPU_FREQ is NOT set. So remove the dependency with
>> CPU_THERMAL.
>>>
>>> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
>>> driver to make thermal driver probe successfully when CONFIG_CPU_FREQ
>>> is NOT set.
>>>
>>> Signed-off-by: Anson Huang 
>>> ---
>>
>> Why not simply kill this legacy code ?
> 
> Because killing legacy code will have old dtb compatible issue, old dtb
> will NOT have cpufreq cooling function.

Yeah, I imagine that is the reason why you want to keep the legacy code
but do you really care about old DTB based boards? Are they still
updated with newer *upstream vanilla* kernels?


-- 
 <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



RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
Hi, Daniel

Best Regards!
Anson Huang

> -Original Message-
> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> Sent: 2018年11月20日 16:45
> To: Anson Huang ; rui.zh...@intel.com;
> edubez...@gmail.com; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: dl-linux-imx 
> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> On 24/10/2018 08:39, Anson Huang wrote:
> > The thermal driver is a standalone driver for monitoring SoC
> > temperature by enabling thermal sensor, so it can be enabled even when
> > CONFIG_CPU_FREQ is NOT set. So remove the dependency with
> CPU_THERMAL.
> >
> > Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
> > driver to make thermal driver probe successfully when CONFIG_CPU_FREQ
> > is NOT set.
> >
> > Signed-off-by: Anson Huang 
> > ---
> 
> Why not simply kill this legacy code ?

Because killing legacy code will have old dtb compatible issue, old dtb
will NOT have cpufreq cooling function.

Anson. 

> 
> 
> 
> >  drivers/thermal/Kconfig   | 2 +-
> >  drivers/thermal/imx_thermal.c | 4 
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> > 1775d44..c8a6352 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -212,7 +212,7 @@ config HISI_THERMAL
> >
> >  config IMX_THERMAL
> > tristate "Temperature sensor driver for Freescale i.MX SoCs"
> > -   depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> > +   depends on ARCH_MXC || COMPILE_TEST
> > depends on NVMEM || !NVMEM
> > depends on MFD_SYSCON
> > depends on OF
> > diff --git a/drivers/thermal/imx_thermal.c
> > b/drivers/thermal/imx_thermal.c index 1566154..87386d1 100644
> > --- a/drivers/thermal/imx_thermal.c
> > +++ b/drivers/thermal/imx_thermal.c
> > @@ -648,6 +648,7 @@ static const struct of_device_id
> > of_imx_thermal_match[] = {  };  MODULE_DEVICE_TABLE(of,
> > of_imx_thermal_match);
> >
> > +#ifdef CONFIG_CPU_FREQ
> >  /*
> >   * Create cooling device in case no #cooling-cells property is available in
> >   * CPU node
> > @@ -668,6 +669,7 @@ static int
> > imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
> >
> > return 0;
> >  }
> > +#endif
> >
> >  static int imx_thermal_probe(struct platform_device *pdev)  { @@
> > -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device
> *pdev)
> > regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
> >  data->socdata->power_down_mask);
> >
> > +#ifdef CONFIG_CPU_FREQ
> > data->policy = cpufreq_cpu_get(0);
> > if (!data->policy) {
> > pr_debug("%s: CPUFreq policy not found\n", __func__); @@ -755,6
> > +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
> > "failed to register cpufreq cooling device: %d\n", ret);
> > return ret;
> > }
> > +#endif
> >
> > data->thermal_clk = devm_clk_get(>dev, NULL);
> > if (IS_ERR(data->thermal_clk)) {
> >
> 
> 
> --
> 
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Fdata=02%7C01%7Canson.huang%40nxp.com%7C6d1060
> ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C0%7C636783002767430588sdata=EO0xxkmPjZTReBzJ%2F%2FJj
> x%2FblahtmYxHHogDxw5u%2Fbjo%3Dreserved=0> Linaro.org │ Open
> source software for ARM SoCs
> 
> Follow Linaro:
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .facebook.com%2Fpages%2FLinarodata=02%7C01%7Canson.huang%40
> nxp.com%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C636783002767430588sdata=gp3BlLl
> SXe6PGnpp93K%2B0n03XInnRscXERGl4T2d0Sc%3Dreserved=0>
> Facebook |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitt
> er.com%2F%23!%2Flinaroorgdata=02%7C01%7Canson.huang%40nxp.c
> om%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783002767430588sdata=oGXtzLBie1Zy
> 419jAh9Lc3mw7Vu2KsCgaWYd4s2tujY%3Dreserved=0> Twitter |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Flinaro-blog%2Fdata=02%7C01%7Canson.huang%40nxp.c
> om%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783002767430588sdata=AbA1RofuJWY
> un%2BKZvLsvp6Hnkbn%2F1VqjCfiEQsDW%2Bc0%3Dreserved=0> Blog



RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Anson Huang
Hi, Daniel

Best Regards!
Anson Huang

> -Original Message-
> From: Daniel Lezcano [mailto:daniel.lezc...@linaro.org]
> Sent: 2018年11月20日 16:45
> To: Anson Huang ; rui.zh...@intel.com;
> edubez...@gmail.com; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: dl-linux-imx 
> Subject: Re: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> On 24/10/2018 08:39, Anson Huang wrote:
> > The thermal driver is a standalone driver for monitoring SoC
> > temperature by enabling thermal sensor, so it can be enabled even when
> > CONFIG_CPU_FREQ is NOT set. So remove the dependency with
> CPU_THERMAL.
> >
> > Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
> > driver to make thermal driver probe successfully when CONFIG_CPU_FREQ
> > is NOT set.
> >
> > Signed-off-by: Anson Huang 
> > ---
> 
> Why not simply kill this legacy code ?

Because killing legacy code will have old dtb compatible issue, old dtb
will NOT have cpufreq cooling function.

Anson. 

> 
> 
> 
> >  drivers/thermal/Kconfig   | 2 +-
> >  drivers/thermal/imx_thermal.c | 4 
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> > 1775d44..c8a6352 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -212,7 +212,7 @@ config HISI_THERMAL
> >
> >  config IMX_THERMAL
> > tristate "Temperature sensor driver for Freescale i.MX SoCs"
> > -   depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> > +   depends on ARCH_MXC || COMPILE_TEST
> > depends on NVMEM || !NVMEM
> > depends on MFD_SYSCON
> > depends on OF
> > diff --git a/drivers/thermal/imx_thermal.c
> > b/drivers/thermal/imx_thermal.c index 1566154..87386d1 100644
> > --- a/drivers/thermal/imx_thermal.c
> > +++ b/drivers/thermal/imx_thermal.c
> > @@ -648,6 +648,7 @@ static const struct of_device_id
> > of_imx_thermal_match[] = {  };  MODULE_DEVICE_TABLE(of,
> > of_imx_thermal_match);
> >
> > +#ifdef CONFIG_CPU_FREQ
> >  /*
> >   * Create cooling device in case no #cooling-cells property is available in
> >   * CPU node
> > @@ -668,6 +669,7 @@ static int
> > imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
> >
> > return 0;
> >  }
> > +#endif
> >
> >  static int imx_thermal_probe(struct platform_device *pdev)  { @@
> > -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device
> *pdev)
> > regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
> >  data->socdata->power_down_mask);
> >
> > +#ifdef CONFIG_CPU_FREQ
> > data->policy = cpufreq_cpu_get(0);
> > if (!data->policy) {
> > pr_debug("%s: CPUFreq policy not found\n", __func__); @@ -755,6
> > +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
> > "failed to register cpufreq cooling device: %d\n", ret);
> > return ret;
> > }
> > +#endif
> >
> > data->thermal_clk = devm_clk_get(>dev, NULL);
> > if (IS_ERR(data->thermal_clk)) {
> >
> 
> 
> --
> 
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Fdata=02%7C01%7Canson.huang%40nxp.com%7C6d1060
> ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C0%7C636783002767430588sdata=EO0xxkmPjZTReBzJ%2F%2FJj
> x%2FblahtmYxHHogDxw5u%2Fbjo%3Dreserved=0> Linaro.org │ Open
> source software for ARM SoCs
> 
> Follow Linaro:
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .facebook.com%2Fpages%2FLinarodata=02%7C01%7Canson.huang%40
> nxp.com%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C636783002767430588sdata=gp3BlLl
> SXe6PGnpp93K%2B0n03XInnRscXERGl4T2d0Sc%3Dreserved=0>
> Facebook |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitt
> er.com%2F%23!%2Flinaroorgdata=02%7C01%7Canson.huang%40nxp.c
> om%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783002767430588sdata=oGXtzLBie1Zy
> 419jAh9Lc3mw7Vu2KsCgaWYd4s2tujY%3Dreserved=0> Twitter |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Flinaro-blog%2Fdata=02%7C01%7Canson.huang%40nxp.c
> om%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783002767430588sdata=AbA1RofuJWY
> un%2BKZvLsvp6Hnkbn%2F1VqjCfiEQsDW%2Bc0%3Dreserved=0> Blog



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Daniel Lezcano
On 24/10/2018 08:39, Anson Huang wrote:
> The thermal driver is a standalone driver for monitoring SoC temperature
> by enabling thermal sensor, so it can be enabled even when CONFIG_CPU_FREQ
> is NOT set. So remove the dependency with CPU_THERMAL.
> 
> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
> driver to make thermal driver probe successfully when CONFIG_CPU_FREQ
> is NOT set.
> 
> Signed-off-by: Anson Huang 
> ---

Why not simply kill this legacy code ?



>  drivers/thermal/Kconfig   | 2 +-
>  drivers/thermal/imx_thermal.c | 4 
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 1775d44..c8a6352 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -212,7 +212,7 @@ config HISI_THERMAL
>  
>  config IMX_THERMAL
>   tristate "Temperature sensor driver for Freescale i.MX SoCs"
> - depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> + depends on ARCH_MXC || COMPILE_TEST
>   depends on NVMEM || !NVMEM
>   depends on MFD_SYSCON
>   depends on OF
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 1566154..87386d1 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -648,6 +648,7 @@ static const struct of_device_id of_imx_thermal_match[] = 
> {
>  };
>  MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
>  
> +#ifdef CONFIG_CPU_FREQ
>  /*
>   * Create cooling device in case no #cooling-cells property is available in
>   * CPU node
> @@ -668,6 +669,7 @@ static int imx_thermal_register_legacy_cooling(struct 
> imx_thermal_data *data)
>  
>   return 0;
>  }
> +#endif
>  
>  static int imx_thermal_probe(struct platform_device *pdev)
>  {
> @@ -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
>data->socdata->power_down_mask);
>  
> +#ifdef CONFIG_CPU_FREQ
>   data->policy = cpufreq_cpu_get(0);
>   if (!data->policy) {
>   pr_debug("%s: CPUFreq policy not found\n", __func__);
> @@ -755,6 +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   "failed to register cpufreq cooling device: %d\n", ret);
>   return ret;
>   }
> +#endif
>  
>   data->thermal_clk = devm_clk_get(>dev, NULL);
>   if (IS_ERR(data->thermal_clk)) {
> 


-- 
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog



Re: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-20 Thread Daniel Lezcano
On 24/10/2018 08:39, Anson Huang wrote:
> The thermal driver is a standalone driver for monitoring SoC temperature
> by enabling thermal sensor, so it can be enabled even when CONFIG_CPU_FREQ
> is NOT set. So remove the dependency with CPU_THERMAL.
> 
> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal
> driver to make thermal driver probe successfully when CONFIG_CPU_FREQ
> is NOT set.
> 
> Signed-off-by: Anson Huang 
> ---

Why not simply kill this legacy code ?



>  drivers/thermal/Kconfig   | 2 +-
>  drivers/thermal/imx_thermal.c | 4 
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 1775d44..c8a6352 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -212,7 +212,7 @@ config HISI_THERMAL
>  
>  config IMX_THERMAL
>   tristate "Temperature sensor driver for Freescale i.MX SoCs"
> - depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> + depends on ARCH_MXC || COMPILE_TEST
>   depends on NVMEM || !NVMEM
>   depends on MFD_SYSCON
>   depends on OF
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 1566154..87386d1 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -648,6 +648,7 @@ static const struct of_device_id of_imx_thermal_match[] = 
> {
>  };
>  MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
>  
> +#ifdef CONFIG_CPU_FREQ
>  /*
>   * Create cooling device in case no #cooling-cells property is available in
>   * CPU node
> @@ -668,6 +669,7 @@ static int imx_thermal_register_legacy_cooling(struct 
> imx_thermal_data *data)
>  
>   return 0;
>  }
> +#endif
>  
>  static int imx_thermal_probe(struct platform_device *pdev)
>  {
> @@ -743,6 +745,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
>data->socdata->power_down_mask);
>  
> +#ifdef CONFIG_CPU_FREQ
>   data->policy = cpufreq_cpu_get(0);
>   if (!data->policy) {
>   pr_debug("%s: CPUFreq policy not found\n", __func__);
> @@ -755,6 +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   "failed to register cpufreq cooling device: %d\n", ret);
>   return ret;
>   }
> +#endif
>  
>   data->thermal_clk = devm_clk_get(>dev, NULL);
>   if (IS_ERR(data->thermal_clk)) {
> 


-- 
  Linaro.org │ Open source software for ARM SoCs

Follow Linaro:   Facebook |
 Twitter |
 Blog



RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-19 Thread Anson Huang
Gentle Ping...

Best Regards!
Anson Huang

> -Original Message-
> From: Anson Huang
> Sent: 2018年10月24日 14:40
> To: rui.zh...@intel.com; edubez...@gmail.com; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: dl-linux-imx 
> Subject: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> The thermal driver is a standalone driver for monitoring SoC temperature by
> enabling thermal sensor, so it can be enabled even when CONFIG_CPU_FREQ is
> NOT set. So remove the dependency with CPU_THERMAL.
> 
> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal driver
> to make thermal driver probe successfully when CONFIG_CPU_FREQ is NOT
> set.
> 
> Signed-off-by: Anson Huang 
> ---
>  drivers/thermal/Kconfig   | 2 +-
>  drivers/thermal/imx_thermal.c | 4 
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> 1775d44..c8a6352 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -212,7 +212,7 @@ config HISI_THERMAL
> 
>  config IMX_THERMAL
>   tristate "Temperature sensor driver for Freescale i.MX SoCs"
> - depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> + depends on ARCH_MXC || COMPILE_TEST
>   depends on NVMEM || !NVMEM
>   depends on MFD_SYSCON
>   depends on OF
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 1566154..87386d1 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -648,6 +648,7 @@ static const struct of_device_id
> of_imx_thermal_match[] = {  };  MODULE_DEVICE_TABLE(of,
> of_imx_thermal_match);
> 
> +#ifdef CONFIG_CPU_FREQ
>  /*
>   * Create cooling device in case no #cooling-cells property is available in
>   * CPU node
> @@ -668,6 +669,7 @@ static int imx_thermal_register_legacy_cooling(struct
> imx_thermal_data *data)
> 
>   return 0;
>  }
> +#endif
> 
>  static int imx_thermal_probe(struct platform_device *pdev)  { @@ -743,6
> +745,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
>data->socdata->power_down_mask);
> 
> +#ifdef CONFIG_CPU_FREQ
>   data->policy = cpufreq_cpu_get(0);
>   if (!data->policy) {
>   pr_debug("%s: CPUFreq policy not found\n", __func__); @@ -755,6
> +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   "failed to register cpufreq cooling device: %d\n", ret);
>   return ret;
>   }
> +#endif
> 
>   data->thermal_clk = devm_clk_get(>dev, NULL);
>   if (IS_ERR(data->thermal_clk)) {
> --
> 2.7.4



RE: [PATCH] thermal: imx: fix for dependency on cpu-freq

2018-11-19 Thread Anson Huang
Gentle Ping...

Best Regards!
Anson Huang

> -Original Message-
> From: Anson Huang
> Sent: 2018年10月24日 14:40
> To: rui.zh...@intel.com; edubez...@gmail.com; linux...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Cc: dl-linux-imx 
> Subject: [PATCH] thermal: imx: fix for dependency on cpu-freq
> 
> The thermal driver is a standalone driver for monitoring SoC temperature by
> enabling thermal sensor, so it can be enabled even when CONFIG_CPU_FREQ is
> NOT set. So remove the dependency with CPU_THERMAL.
> 
> Add CONFIG_CPU_FREQ check for cpu-freq related operation in thermal driver
> to make thermal driver probe successfully when CONFIG_CPU_FREQ is NOT
> set.
> 
> Signed-off-by: Anson Huang 
> ---
>  drivers/thermal/Kconfig   | 2 +-
>  drivers/thermal/imx_thermal.c | 4 
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> 1775d44..c8a6352 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -212,7 +212,7 @@ config HISI_THERMAL
> 
>  config IMX_THERMAL
>   tristate "Temperature sensor driver for Freescale i.MX SoCs"
> - depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> + depends on ARCH_MXC || COMPILE_TEST
>   depends on NVMEM || !NVMEM
>   depends on MFD_SYSCON
>   depends on OF
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 1566154..87386d1 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -648,6 +648,7 @@ static const struct of_device_id
> of_imx_thermal_match[] = {  };  MODULE_DEVICE_TABLE(of,
> of_imx_thermal_match);
> 
> +#ifdef CONFIG_CPU_FREQ
>  /*
>   * Create cooling device in case no #cooling-cells property is available in
>   * CPU node
> @@ -668,6 +669,7 @@ static int imx_thermal_register_legacy_cooling(struct
> imx_thermal_data *data)
> 
>   return 0;
>  }
> +#endif
> 
>  static int imx_thermal_probe(struct platform_device *pdev)  { @@ -743,6
> +745,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   regmap_write(map, data->socdata->sensor_ctrl + REG_SET,
>data->socdata->power_down_mask);
> 
> +#ifdef CONFIG_CPU_FREQ
>   data->policy = cpufreq_cpu_get(0);
>   if (!data->policy) {
>   pr_debug("%s: CPUFreq policy not found\n", __func__); @@ -755,6
> +758,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
>   "failed to register cpufreq cooling device: %d\n", ret);
>   return ret;
>   }
> +#endif
> 
>   data->thermal_clk = devm_clk_get(>dev, NULL);
>   if (IS_ERR(data->thermal_clk)) {
> --
> 2.7.4