RE: [PATCH] thermal: imx: fix for dependency on cpu-freq
From: Anson Huang
Date: Tue Nov 20 2018 - 03:48:03 EST
Hi, Daniel
Best Regards!
Anson Huang
> -----Original Message-----
> From: Daniel Lezcano [mailto:daniel.lezcano@xxxxxxxxxx]
> Sent: 2018å11æ20æ 16:45
> To: Anson Huang <anson.huang@xxxxxxx>; rui.zhang@xxxxxxxxx;
> edubezval@xxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx
> Cc: dl-linux-imx <linux-imx@xxxxxxx>
> 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 <Anson.Huang@xxxxxxx>
> > ---
>
> 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(&pdev->dev, NULL);
> > if (IS_ERR(data->thermal_clk)) {
> >
>
>
> --
>
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2F&data=02%7C01%7Canson.huang%40nxp.com%7C6d1060
> ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd99c5c301635%7
> C0%7C0%7C636783002767430588&sdata=EO0xxkmPjZTReBzJ%2F%2FJj
> x%2FblahtmYxHHogDxw5u%2Fbjo%3D&reserved=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%2FLinaro&data=02%7C01%7Canson.huang%40
> nxp.com%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C636783002767430588&sdata=gp3BlLl
> SXe6PGnpp93K%2B0n03XInnRscXERGl4T2d0Sc%3D&reserved=0>
> Facebook |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftwitt
> er.com%2F%23!%2Flinaroorg&data=02%7C01%7Canson.huang%40nxp.c
> om%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783002767430588&sdata=oGXtzLBie1Zy
> 419jAh9Lc3mw7Vu2KsCgaWYd4s2tujY%3D&reserved=0> Twitter |
> <https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
> .linaro.org%2Flinaro-blog%2F&data=02%7C01%7Canson.huang%40nxp.c
> om%7C6d1060ba33e24e37bf5608d64ec46651%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0%7C0%7C636783002767430588&sdata=AbA1RofuJWY
> un%2BKZvLsvp6Hnkbn%2F1VqjCfiEQsDW%2Bc0%3D&reserved=0> Blog