[1/2] configs: ARM: omap2plus: Enable OMAP3_THERMAL
diff mbox series

Message ID 20191007220540.30690-1-aford173@gmail.com
State New
Headers show
Series
  • [1/2] configs: ARM: omap2plus: Enable OMAP3_THERMAL
Related show

Commit Message

Adam Ford Oct. 7, 2019, 10:05 p.m. UTC
The some in the OMAP3 family have a bandgap thermal sensor, but
omap2plus has it disabled.

This patch enables the OMAP3_THERMAL by default like the rest of
the OMAP family.

Signed-off-by: Adam Ford <aford173@gmail.com>

Comments

Tony Lindgren Oct. 22, 2019, 4:22 p.m. UTC | #1
Hi,

* Adam Ford <aford173@gmail.com> [191007 15:06]:
> The some in the OMAP3 family have a bandgap thermal sensor, but
> omap2plus has it disabled.
> 
> This patch enables the OMAP3_THERMAL by default like the rest of
> the OMAP family.

Looks like this breaks off mode during idle for omap3, and that's
probably why it never got enabled. The difference in power
consumption during idle is about 7mW vs 32mW for the SoC as
measured from torpedo shunt for main_battery_som.

I think the right fix might be simply to add handling for
CPU_CLUSTER_PM_ENTER to the related thermal driver to disable
it during idle like we have for gpio-omap.c for example.

Regards,

Tony

> 
> Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
> index 8f1c2b6f9e56..7e14a8c8bb29 100644
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -292,6 +292,7 @@ CONFIG_THERMAL_GOV_FAIR_SHARE=y
>  CONFIG_THERMAL_GOV_USER_SPACE=y
>  CONFIG_CPU_THERMAL=y
>  CONFIG_TI_THERMAL=y
> +CONFIG_OMAP3_THERMAL=y
>  CONFIG_OMAP4_THERMAL=y
>  CONFIG_OMAP5_THERMAL=y
>  CONFIG_DRA752_THERMAL=y
> -- 
> 2.17.1
>
Adam Ford Oct. 22, 2019, 7:01 p.m. UTC | #2
On Tue, Oct 22, 2019 at 11:22 AM Tony Lindgren <tony@atomide.com> wrote:
>
> Hi,
>
> * Adam Ford <aford173@gmail.com> [191007 15:06]:
> > The some in the OMAP3 family have a bandgap thermal sensor, but
> > omap2plus has it disabled.
> >
> > This patch enables the OMAP3_THERMAL by default like the rest of
> > the OMAP family.
>
> Looks like this breaks off mode during idle for omap3, and that's
> probably why it never got enabled. The difference in power
> consumption during idle is about 7mW vs 32mW for the SoC as
> measured from torpedo shunt for main_battery_som.
>
> I think the right fix might be simply to add handling for
> CPU_CLUSTER_PM_ENTER to the related thermal driver to disable
> it during idle like we have for gpio-omap.c for example.

I am not sure I know where to start on fixing that issue.  Would you
entertain enabling the driver if we set the device tree to 'disabled'
by default?  This way if people want to to use it, it can be enabled
on a per-device option.  Once the power stuff gets resolved, we might
be able to enable it by default.  For people who are planning on using
the DM3730 @ 1GHz in high temp environments, I am not sure they'll
care about low power.

I'll try to look into it when I have time, but I was hoping a
compromise might be a reasonable work-around.

adam
>
> Regards,
>
> Tony
>
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
> > index 8f1c2b6f9e56..7e14a8c8bb29 100644
> > --- a/arch/arm/configs/omap2plus_defconfig
> > +++ b/arch/arm/configs/omap2plus_defconfig
> > @@ -292,6 +292,7 @@ CONFIG_THERMAL_GOV_FAIR_SHARE=y
> >  CONFIG_THERMAL_GOV_USER_SPACE=y
> >  CONFIG_CPU_THERMAL=y
> >  CONFIG_TI_THERMAL=y
> > +CONFIG_OMAP3_THERMAL=y
> >  CONFIG_OMAP4_THERMAL=y
> >  CONFIG_OMAP5_THERMAL=y
> >  CONFIG_DRA752_THERMAL=y
> > --
> > 2.17.1
> >
Tony Lindgren Oct. 22, 2019, 10:19 p.m. UTC | #3
* Adam Ford <aford173@gmail.com> [191022 19:01]:
> On Tue, Oct 22, 2019 at 11:22 AM Tony Lindgren <tony@atomide.com> wrote:
> >
> > Hi,
> >
> > * Adam Ford <aford173@gmail.com> [191007 15:06]:
> > > The some in the OMAP3 family have a bandgap thermal sensor, but
> > > omap2plus has it disabled.
> > >
> > > This patch enables the OMAP3_THERMAL by default like the rest of
> > > the OMAP family.
> >
> > Looks like this breaks off mode during idle for omap3, and that's
> > probably why it never got enabled. The difference in power
> > consumption during idle is about 7mW vs 32mW for the SoC as
> > measured from torpedo shunt for main_battery_som.
> >
> > I think the right fix might be simply to add handling for
> > CPU_CLUSTER_PM_ENTER to the related thermal driver to disable
> > it during idle like we have for gpio-omap.c for example.
> 
> I am not sure I know where to start on fixing that issue.  Would you
> entertain enabling the driver if we set the device tree to 'disabled'
> by default?  This way if people want to to use it, it can be enabled
> on a per-device option.  Once the power stuff gets resolved, we might
> be able to enable it by default.  For people who are planning on using
> the DM3730 @ 1GHz in high temp environments, I am not sure they'll
> care about low power.

They should both work fine together though. They are not mutually
exclusive features.

> I'll try to look into it when I have time, but I was hoping a
> compromise might be a reasonable work-around.

It should be hopefully a trivial fix.. I have not looked at the
driver code though.

Regards,

Tony
H. Nikolaus Schaller Oct. 23, 2019, 4:41 a.m. UTC | #4
> Am 23.10.2019 um 00:19 schrieb Tony Lindgren <tony@atomide.com>:
> 
> * Adam Ford <aford173@gmail.com> [191022 19:01]:
>> On Tue, Oct 22, 2019 at 11:22 AM Tony Lindgren <tony@atomide.com> wrote:
>>> 
>>> Hi,
>>> 
>>> * Adam Ford <aford173@gmail.com> [191007 15:06]:
>>>> The some in the OMAP3 family have a bandgap thermal sensor, but
>>>> omap2plus has it disabled.
>>>> 
>>>> This patch enables the OMAP3_THERMAL by default like the rest of
>>>> the OMAP family.
>>> 
>>> Looks like this breaks off mode during idle for omap3, and that's
>>> probably why it never got enabled. The difference in power
>>> consumption during idle is about 7mW vs 32mW for the SoC as
>>> measured from torpedo shunt for main_battery_som.
>>> 
>>> I think the right fix might be simply to add handling for
>>> CPU_CLUSTER_PM_ENTER to the related thermal driver to disable
>>> it during idle like we have for gpio-omap.c for example.
>> 
>> I am not sure I know where to start on fixing that issue.  Would you
>> entertain enabling the driver if we set the device tree to 'disabled'
>> by default?  This way if people want to to use it, it can be enabled
>> on a per-device option.  Once the power stuff gets resolved, we might
>> be able to enable it by default.  For people who are planning on using
>> the DM3730 @ 1GHz in high temp environments, I am not sure they'll
>> care about low power.
> 
> They should both work fine together though. They are not mutually
> exclusive features.
> 
>> I'll try to look into it when I have time, but I was hoping a
>> compromise might be a reasonable work-around.
> 
> It should be hopefully a trivial fix.. I have not looked at the
> driver code though.

If I am taken right, it is the drivers/thermal/ti-soc-thermal/ti-*.c
which is a common driver for omap3, omap4, omap5. They only differ
in the thermal data and which registers and bits are used to access
the ADC.

So is this problem with off mode also known for omap4 and omap5?

BR,
Nikolaus
Tony Lindgren Oct. 23, 2019, 2:36 p.m. UTC | #5
* H. Nikolaus Schaller <hns@goldelico.com> [191023 04:42]:
> 
> > Am 23.10.2019 um 00:19 schrieb Tony Lindgren <tony@atomide.com>:
> > 
> > * Adam Ford <aford173@gmail.com> [191022 19:01]:
> >> On Tue, Oct 22, 2019 at 11:22 AM Tony Lindgren <tony@atomide.com> wrote:
> >>> 
> >>> Hi,
> >>> 
> >>> * Adam Ford <aford173@gmail.com> [191007 15:06]:
> >>>> The some in the OMAP3 family have a bandgap thermal sensor, but
> >>>> omap2plus has it disabled.
> >>>> 
> >>>> This patch enables the OMAP3_THERMAL by default like the rest of
> >>>> the OMAP family.
> >>> 
> >>> Looks like this breaks off mode during idle for omap3, and that's
> >>> probably why it never got enabled. The difference in power
> >>> consumption during idle is about 7mW vs 32mW for the SoC as
> >>> measured from torpedo shunt for main_battery_som.
> >>> 
> >>> I think the right fix might be simply to add handling for
> >>> CPU_CLUSTER_PM_ENTER to the related thermal driver to disable
> >>> it during idle like we have for gpio-omap.c for example.
> >> 
> >> I am not sure I know where to start on fixing that issue.  Would you
> >> entertain enabling the driver if we set the device tree to 'disabled'
> >> by default?  This way if people want to to use it, it can be enabled
> >> on a per-device option.  Once the power stuff gets resolved, we might
> >> be able to enable it by default.  For people who are planning on using
> >> the DM3730 @ 1GHz in high temp environments, I am not sure they'll
> >> care about low power.
> > 
> > They should both work fine together though. They are not mutually
> > exclusive features.
> > 
> >> I'll try to look into it when I have time, but I was hoping a
> >> compromise might be a reasonable work-around.
> > 
> > It should be hopefully a trivial fix.. I have not looked at the
> > driver code though.
> 
> If I am taken right, it is the drivers/thermal/ti-soc-thermal/ti-*.c
> which is a common driver for omap3, omap4, omap5. They only differ
> in the thermal data and which registers and bits are used to access
> the ADC.

Yes so it seems. Enabling OMAP3_THERMAL adds support to
of_ti_bandgap_match[] for omap3 and causes the issue.

> So is this problem with off mode also known for omap4 and omap5?

Probably. But we don't have off mode working for omap4, and
it cannot be used for omap5 AFAIK.

My guess is we need to call clk_disable() and call
ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to
what ti_bandgap_suspend does. And then restore it on
CPU_CLUSTER_PM_EXIT.

There's a similar example already in gpio_omap_cpu_notifier().
Not sure if there is some related errata to deal with too,
probably the old Nokia n900 or n9 would provide some hints
on what exactly needs to be done.

Regards,

Tony
Adam Ford Nov. 8, 2019, 8:02 p.m. UTC | #6
On Wed, Oct 23, 2019 at 9:36 AM Tony Lindgren <tony@atomide.com> wrote:
>
> * H. Nikolaus Schaller <hns@goldelico.com> [191023 04:42]:
> >
> > > Am 23.10.2019 um 00:19 schrieb Tony Lindgren <tony@atomide.com>:
> > >
> > > * Adam Ford <aford173@gmail.com> [191022 19:01]:
> > >> On Tue, Oct 22, 2019 at 11:22 AM Tony Lindgren <tony@atomide.com> wrote:
> > >>>
> > >>> Hi,
> > >>>
> > >>> * Adam Ford <aford173@gmail.com> [191007 15:06]:
> > >>>> The some in the OMAP3 family have a bandgap thermal sensor, but
> > >>>> omap2plus has it disabled.
> > >>>>
> > >>>> This patch enables the OMAP3_THERMAL by default like the rest of
> > >>>> the OMAP family.
> > >>>
> > >>> Looks like this breaks off mode during idle for omap3, and that's
> > >>> probably why it never got enabled. The difference in power
> > >>> consumption during idle is about 7mW vs 32mW for the SoC as
> > >>> measured from torpedo shunt for main_battery_som.
> > >>>
> > >>> I think the right fix might be simply to add handling for
> > >>> CPU_CLUSTER_PM_ENTER to the related thermal driver to disable
> > >>> it during idle like we have for gpio-omap.c for example.
> > >>
> > >> I am not sure I know where to start on fixing that issue.  Would you
> > >> entertain enabling the driver if we set the device tree to 'disabled'
> > >> by default?  This way if people want to to use it, it can be enabled
> > >> on a per-device option.  Once the power stuff gets resolved, we might
> > >> be able to enable it by default.  For people who are planning on using
> > >> the DM3730 @ 1GHz in high temp environments, I am not sure they'll
> > >> care about low power.
> > >
> > > They should both work fine together though. They are not mutually
> > > exclusive features.
> > >
> > >> I'll try to look into it when I have time, but I was hoping a
> > >> compromise might be a reasonable work-around.
> > >
> > > It should be hopefully a trivial fix.. I have not looked at the
> > > driver code though.
> >
> > If I am taken right, it is the drivers/thermal/ti-soc-thermal/ti-*.c
> > which is a common driver for omap3, omap4, omap5. They only differ
> > in the thermal data and which registers and bits are used to access
> > the ADC.
>
> Yes so it seems. Enabling OMAP3_THERMAL adds support to
> of_ti_bandgap_match[] for omap3 and causes the issue.
>
> > So is this problem with off mode also known for omap4 and omap5?
>
> Probably. But we don't have off mode working for omap4, and
> it cannot be used for omap5 AFAIK.
>
> My guess is we need to call clk_disable() and call
> ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to
> what ti_bandgap_suspend does. And then restore it on
> CPU_CLUSTER_PM_EXIT.
>
> There's a similar example already in gpio_omap_cpu_notifier().
> Not sure if there is some related errata to deal with too,
> probably the old Nokia n900 or n9 would provide some hints
> on what exactly needs to be done.

I 'think' I have a patch ready that does what you're asking, but I
will fully admit that I don't completely grasp what's going on.

I'll submit it as an RFC, but I am not even sure I understand what to
put into the description, so if you're OK with reviewing the RFC, feel
free to mark up the actual commit message as well.

From what I can see, the changes haven't negatively impact stuff. I
didn't see the power consumption go up before, so I am not sure I can
replicate your findings.

It'll be posted shortly.

adam
>
> Regards,
>
> Tony
Tony Lindgren Nov. 8, 2019, 8:51 p.m. UTC | #7
* Adam Ford <aford173@gmail.com> [191108 20:03]:
> On Wed, Oct 23, 2019 at 9:36 AM Tony Lindgren <tony@atomide.com> wrote:
> > My guess is we need to call clk_disable() and call
> > ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to
> > what ti_bandgap_suspend does. And then restore it on
> > CPU_CLUSTER_PM_EXIT.
> >
> > There's a similar example already in gpio_omap_cpu_notifier().
> > Not sure if there is some related errata to deal with too,
> > probably the old Nokia n900 or n9 would provide some hints
> > on what exactly needs to be done.
> 
> I 'think' I have a patch ready that does what you're asking, but I
> will fully admit that I don't completely grasp what's going on.
> 
> I'll submit it as an RFC, but I am not even sure I understand what to
> put into the description, so if you're OK with reviewing the RFC, feel
> free to mark up the actual commit message as well.
> 
> From what I can see, the changes haven't negatively impact stuff. I
> didn't see the power consumption go up before, so I am not sure I can
> replicate your findings.
> 
> It'll be posted shortly.

Yeah seems to do the job, thanks for fixing this issue.

Tony
Adam Ford Nov. 8, 2019, 9:04 p.m. UTC | #8
On Fri, Nov 8, 2019 at 2:51 PM Tony Lindgren <tony@atomide.com> wrote:
>
> * Adam Ford <aford173@gmail.com> [191108 20:03]:
> > On Wed, Oct 23, 2019 at 9:36 AM Tony Lindgren <tony@atomide.com> wrote:
> > > My guess is we need to call clk_disable() and call
> > > ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to
> > > what ti_bandgap_suspend does. And then restore it on
> > > CPU_CLUSTER_PM_EXIT.
> > >
> > > There's a similar example already in gpio_omap_cpu_notifier().
> > > Not sure if there is some related errata to deal with too,
> > > probably the old Nokia n900 or n9 would provide some hints
> > > on what exactly needs to be done.
> >
> > I 'think' I have a patch ready that does what you're asking, but I
> > will fully admit that I don't completely grasp what's going on.
> >
> > I'll submit it as an RFC, but I am not even sure I understand what to
> > put into the description, so if you're OK with reviewing the RFC, feel
> > free to mark up the actual commit message as well.
> >
> > From what I can see, the changes haven't negatively impact stuff. I
> > didn't see the power consumption go up before, so I am not sure I can
> > replicate your findings.
> >
> > It'll be posted shortly.
>
> Yeah seems to do the job, thanks for fixing this issue.

I am glad I could help!  I am learning new stuff.  :-)

Once the other patch to fix the bandgap clock idling, will it be
possible to accept this as-is, or do you need me to re-base and submit
again?

Ideally, once we get the thermal stuff in and we can drop Nikolaus'
turbo option on the 1GHz processor and just let the processor scale to
1GHz without having to deal with the boost stuff since it should
throttle back when the junction temp hits its threshold.

If you want me to re-base, please let me know which branch I should use.

Thank you,

adam

>
> Tony
Tony Lindgren Nov. 8, 2019, 9:21 p.m. UTC | #9
* Adam Ford <aford173@gmail.com> [191108 21:05]:
> On Fri, Nov 8, 2019 at 2:51 PM Tony Lindgren <tony@atomide.com> wrote:
> >
> > * Adam Ford <aford173@gmail.com> [191108 20:03]:
> > > On Wed, Oct 23, 2019 at 9:36 AM Tony Lindgren <tony@atomide.com> wrote:
> > > > My guess is we need to call clk_disable() and call
> > > > ti_bandgap_save_ctxt() on CPU_CLUSTER_PM_ENTER similar to
> > > > what ti_bandgap_suspend does. And then restore it on
> > > > CPU_CLUSTER_PM_EXIT.
> > > >
> > > > There's a similar example already in gpio_omap_cpu_notifier().
> > > > Not sure if there is some related errata to deal with too,
> > > > probably the old Nokia n900 or n9 would provide some hints
> > > > on what exactly needs to be done.
> > >
> > > I 'think' I have a patch ready that does what you're asking, but I
> > > will fully admit that I don't completely grasp what's going on.
> > >
> > > I'll submit it as an RFC, but I am not even sure I understand what to
> > > put into the description, so if you're OK with reviewing the RFC, feel
> > > free to mark up the actual commit message as well.
> > >
> > > From what I can see, the changes haven't negatively impact stuff. I
> > > didn't see the power consumption go up before, so I am not sure I can
> > > replicate your findings.
> > >
> > > It'll be posted shortly.
> >
> > Yeah seems to do the job, thanks for fixing this issue.
> 
> I am glad I could help!  I am learning new stuff.  :-)
> 
> Once the other patch to fix the bandgap clock idling, will it be
> possible to accept this as-is, or do you need me to re-base and submit
> again?

No need to resend, I've tagged it again to apply after the
driver fix hits the mainline kernel.

> Ideally, once we get the thermal stuff in and we can drop Nikolaus'
> turbo option on the 1GHz processor and just let the processor scale to
> 1GHz without having to deal with the boost stuff since it should
> throttle back when the junction temp hits its threshold.

Right. AFAIK we also still need some way to represent the
arch/arm/mach-omap2/voltage.c as drivers/regulator some kind
of regulator controller regulator for cpufreq to use.

> If you want me to re-base, please let me know which branch I should use.

No need for that.

Thanks,

Tony

Patch
diff mbox series

diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 8f1c2b6f9e56..7e14a8c8bb29 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -292,6 +292,7 @@  CONFIG_THERMAL_GOV_FAIR_SHARE=y
 CONFIG_THERMAL_GOV_USER_SPACE=y
 CONFIG_CPU_THERMAL=y
 CONFIG_TI_THERMAL=y
+CONFIG_OMAP3_THERMAL=y
 CONFIG_OMAP4_THERMAL=y
 CONFIG_OMAP5_THERMAL=y
 CONFIG_DRA752_THERMAL=y