mbox series

[v3,0/3] thermal: mediatek: Add LVTS architecture thermal controller

Message ID 20210312034018.17437-1-michael.kao@mediatek.com
Headers show
Series thermal: mediatek: Add LVTS architecture thermal controller | expand

Message

Michael Kao March 12, 2021, 3:40 a.m. UTC
This patch move thermal files related to Mediatek to the mediatek folder.
And introduce the new architecture LVTS (low pressure thermal sensor) driver to report
the highest temperature in the SoC and record the highest temperature sensor,
each sensor as a hot zone.
The LVTS body is divided into two parts, the LVTS controller and the LVTS device.
The LVTS controller can connect up to 4 LVTS devices, and each LVTS device
can connect up to 7 TSMCUs.

The architecture will be the first to be used on mt6873 and mt8192.

Change in v3:
        - [2/3]
          - change the expression in the lvts_temp_to_raw to dev_s64.

Change in v2:
	- Rebase to kernel-5.11-rc1.
	- [2/3]
	  - sort headers
	  - remove initial value 0 of msr_raw in the lvts_temp_to_raw.
	  - disconstruct the api of lvts_read_tc_msr_raw.
	  - add the initial value max_temp = 0 and compare e.q.
	    in the lvts_read_all_tc_temperature.
	  - add the return with invalid number in the lvts_init.

This patch depends on [1].

[1]https://patchwork.kernel.org/project/linux-mediatek/cover/1608642587-15634-1-git-send-email-weiyi.lu@mediatek.com/

Michael Kao (3):
  thermal: mediatek: Relocate driver to mediatek folder
  thermal: mediatek: Add LVTS drivers for SoC theraml zones
  dt-bindings: thermal: Add binding document for mt6873 thermal
    controller

 .../thermal/mediatek-thermal-lvts.yaml        |   81 ++
 drivers/thermal/Kconfig                       |   14 +-
 drivers/thermal/Makefile                      |    2 +-
 drivers/thermal/mediatek/Kconfig              |   33 +
 drivers/thermal/mediatek/Makefile             |    2 +
 .../{mtk_thermal.c => mediatek/soc_temp.c}    |    0
 drivers/thermal/mediatek/soc_temp_lvts.c      | 1287 +++++++++++++++++
 drivers/thermal/mediatek/soc_temp_lvts.h      |  312 ++++
 8 files changed, 1720 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal-lvts.yaml
 create mode 100644 drivers/thermal/mediatek/Kconfig
 create mode 100644 drivers/thermal/mediatek/Makefile
 rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (100%)
 create mode 100644 drivers/thermal/mediatek/soc_temp_lvts.c
 create mode 100644 drivers/thermal/mediatek/soc_temp_lvts.h

Comments

Rob Herring (Arm) March 23, 2021, 8:20 p.m. UTC | #1
On Fri, 12 Mar 2021 11:40:18 +0800, Michael Kao wrote:
> This patch adds binding document for mt6873 thermal controller.

> 

> Signed-off-by: Michael Kao <michael.kao@mediatek.com>

> ---

> This patch depends on [1].

> 

> [1]https://patchwork.kernel.org/project/linux-mediatek/cover/1608642587-15634-1-git-send-email-weiyi.lu@mediatek.com/

> ---

>  .../thermal/mediatek-thermal-lvts.yaml        | 81 +++++++++++++++++++

>  1 file changed, 81 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal-lvts.yaml

> 


Reviewed-by: Rob Herring <robh@kernel.org>
Michael Kao April 7, 2021, 9:08 a.m. UTC | #2
Hi Maintainers,
 
Gentle pin for this patch.
 
Thanks


On Fri, 2021-03-12 at 11:40 +0800, Michael Kao wrote:
> Add Mediatek proprietary folder to upstream more thermal zone and cooler

> drivers. Relocate the original thermal controller driver to it and rename

> as soc_temp.c to show its purpose more clearly.

> 

> Signed-off-by: Michael Kao <michael.kao@mediatek.com>

> ---

>  drivers/thermal/Kconfig                       | 14 ++++-------

>  drivers/thermal/Makefile                      |  2 +-

>  drivers/thermal/mediatek/Kconfig              | 23 +++++++++++++++++++

>  drivers/thermal/mediatek/Makefile             |  1 +

>  .../{mtk_thermal.c => mediatek/soc_temp.c}    |  0

>  5 files changed, 29 insertions(+), 11 deletions(-)

>  create mode 100644 drivers/thermal/mediatek/Kconfig

>  create mode 100644 drivers/thermal/mediatek/Makefile

>  rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (100%)

> 

> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig

> index 7edc8dc6bbab..b2da0a1bda34 100644

> --- a/drivers/thermal/Kconfig

> +++ b/drivers/thermal/Kconfig

> @@ -401,16 +401,10 @@ config DA9062_THERMAL

>  	  zone.

>  	  Compatible with the DA9062 and DA9061 PMICs.

>  

> -config MTK_THERMAL

> -	tristate "Temperature sensor driver for mediatek SoCs"

> -	depends on ARCH_MEDIATEK || COMPILE_TEST

> -	depends on HAS_IOMEM

> -	depends on NVMEM || NVMEM=n

> -	depends on RESET_CONTROLLER

> -	default y

> -	help

> -	  Enable this option if you want to have support for thermal management

> -	  controller present in Mediatek SoCs

> +menu "Mediatek thermal drivers"

> +depends on ARCH_MEDIATEK || COMPILE_TEST

> +source "drivers/thermal/mediatek/Kconfig"

> +endmenu

>  

>  config AMLOGIC_THERMAL

>  	tristate "Amlogic Thermal Support"

> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile

> index b64dd50a6629..f9e07c3f529e 100644

> --- a/drivers/thermal/Makefile

> +++ b/drivers/thermal/Makefile

> @@ -55,7 +55,7 @@ obj-y				+= st/

>  obj-$(CONFIG_QCOM_TSENS)	+= qcom/

>  obj-y				+= tegra/

>  obj-$(CONFIG_HISI_THERMAL)     += hisi_thermal.o

> -obj-$(CONFIG_MTK_THERMAL)	+= mtk_thermal.o

> +obj-$(CONFIG_MTK_THERMAL)	+= mediatek/

>  obj-$(CONFIG_GENERIC_ADC_THERMAL)	+= thermal-generic-adc.o

>  obj-$(CONFIG_ZX2967_THERMAL)	+= zx2967_thermal.o

>  obj-$(CONFIG_UNIPHIER_THERMAL)	+= uniphier_thermal.o

> diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig

> new file mode 100644

> index 000000000000..0351e73170b7

> --- /dev/null

> +++ b/drivers/thermal/mediatek/Kconfig

> @@ -0,0 +1,23 @@

> +config MTK_THERMAL

> +	tristate "Mediatek thermal drivers"

> +	depends on THERMAL_OF

> +	help

> +	  This is the option for Mediatek thermal software

> +	  solutions. Please enable corresponding options to

> +	  get temperature information from thermal sensors or

> +	  turn on throttle mechaisms for thermal mitigation.

> +

> +if MTK_THERMAL

> +

> +config MTK_SOC_THERMAL

> +	tristate "Temperature sensor driver for mediatek SoCs"

> +	depends on HAS_IOMEM

> +	depends on NVMEM

> +	depends on RESET_CONTROLLER

> +	help

> +	  Enable this option if you want to get SoC temperature

> +	  information for Mediatek platforms. This driver

> +	  configures thermal controllers to collect temperature

> +	  via AUXADC interface.

> +

> +endif

> diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile

> new file mode 100644

> index 000000000000..f75313ddce5e

> --- /dev/null

> +++ b/drivers/thermal/mediatek/Makefile

> @@ -0,0 +1 @@

> +obj-$(CONFIG_MTK_SOC_THERMAL)	+= soc_temp.o

> diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mediatek/soc_temp.c

> similarity index 100%

> rename from drivers/thermal/mtk_thermal.c

> rename to drivers/thermal/mediatek/soc_temp.c
Daniel Lezcano April 7, 2021, 9:10 a.m. UTC | #3
On 07/04/2021 11:08, Michael Kao wrote:
> Hi Maintainers,

>  

> Gentle pin for this patch.

>  

> Thanks


ack, pong



-- 
<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
Daniel Lezcano April 20, 2021, 9:22 p.m. UTC | #4
On 12/03/2021 04:40, Michael Kao wrote:
> Add Mediatek proprietary folder to upstream more thermal zone and cooler

> drivers. Relocate the original thermal controller driver to it and rename

> as soc_temp.c to show its purpose more clearly.


We already know the purpose :)

soc_temp gives no additional information.

Either keep the name or give the hardware sensor name. It is a driver
directory.

> Signed-off-by: Michael Kao <michael.kao@mediatek.com>

> ---

>  drivers/thermal/Kconfig                       | 14 ++++-------

>  drivers/thermal/Makefile                      |  2 +-

>  drivers/thermal/mediatek/Kconfig              | 23 +++++++++++++++++++

>  drivers/thermal/mediatek/Makefile             |  1 +

>  .../{mtk_thermal.c => mediatek/soc_temp.c}    |  0


[ ... ]

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


> +config MTK_THERMAL

> +	tristate "Mediatek thermal drivers"

> +	depends on THERMAL_OF

> +	help

> +	  This is the option for Mediatek thermal software

> +	  solutions. Please enable corresponding options to

> +	  get temperature information from thermal sensors or

> +	  turn on throttle mechaisms for thermal mitigation.

> +

> +if MTK_THERMAL



^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

All the above not needed.

> +config MTK_SOC_THERMAL

> +	tristate "Temperature sensor driver for mediatek SoCs"

> +	depends on HAS_IOMEM

> +	depends on NVMEM

> +	depends on RESET_CONTROLLER

> +	help

> +	  Enable this option if you want to get SoC temperature

> +	  information for Mediatek platforms. This driver

> +	  configures thermal controllers to collect temperature

> +	  via AUXADC interface.

> +

> +endif

> diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile

> new file mode 100644

> index 000000000000..f75313ddce5e

> --- /dev/null

> +++ b/drivers/thermal/mediatek/Makefile

> @@ -0,0 +1 @@

> +obj-$(CONFIG_MTK_SOC_THERMAL)	+= soc_temp.o

> diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mediatek/soc_temp.c

> similarity index 100%

> rename from drivers/thermal/mtk_thermal.c

> rename to drivers/thermal/mediatek/soc_temp.c




-- 
<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
Michael Kao April 22, 2021, 8:32 a.m. UTC | #5
On Tue, 2021-04-20 at 23:22 +0200, Daniel Lezcano wrote:
> On 12/03/2021 04:40, Michael Kao wrote:

> > Add Mediatek proprietary folder to upstream more thermal zone and

> > cooler

> > drivers. Relocate the original thermal controller driver to it and

> > rename

> > as soc_temp.c to show its purpose more clearly.

> 

> We already know the purpose :)

> 

> soc_temp gives no additional information.

> 

> Either keep the name or give the hardware sensor name. It is a driver

> directory.

> 

Dear Daniel,

We introduce the new thermal hardware design called lvts in the new
project. The new project will desgin with lvts will enable the
CONFIG_MTK_SOC_THERMAL_LVTS to build lvts driver[1].
The old project will use CONFIG_MTK_THERMAL to build soc_temp.c.

The new design use lvts device to access thermal sensors in the soc.
The original design access thermal sensors by auxadc.

[1] [v3,2/3] thermal: mediatek: Add LVTS drivers for SoC theraml zones


> > Signed-off-by: Michael Kao <michael.kao@mediatek.com>

> > ---

> >  drivers/thermal/Kconfig                       | 14 ++++-------

> >  drivers/thermal/Makefile                      |  2 +-

> >  drivers/thermal/mediatek/Kconfig              | 23

> > +++++++++++++++++++

> >  drivers/thermal/mediatek/Makefile             |  1 +

> >  .../{mtk_thermal.c => mediatek/soc_temp.c}    |  0

> 

> [ ... ]

> 

> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

> 

> 

> > +config MTK_THERMAL

> > +	tristate "Mediatek thermal drivers"

> > +	depends on THERMAL_OF

> > +	help

> > +	  This is the option for Mediatek thermal software

> > +	  solutions. Please enable corresponding options to

> > +	  get temperature information from thermal sensors or

> > +	  turn on throttle mechaisms for thermal mitigation.

> > +

> > +if MTK_THERMAL

> 

> 

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> 

> All the above not needed.

> 

> > +config MTK_SOC_THERMAL

> > +	tristate "Temperature sensor driver for mediatek SoCs"

> > +	depends on HAS_IOMEM

> > +	depends on NVMEM

> > +	depends on RESET_CONTROLLER

> > +	help

> > +	  Enable this option if you want to get SoC temperature

> > +	  information for Mediatek platforms. This driver

> > +	  configures thermal controllers to collect temperature

> > +	  via AUXADC interface.

> > +

> > +endif

> > diff --git a/drivers/thermal/mediatek/Makefile

> > b/drivers/thermal/mediatek/Makefile

> > new file mode 100644

> > index 000000000000..f75313ddce5e

> > --- /dev/null

> > +++ b/drivers/thermal/mediatek/Makefile

> > @@ -0,0 +1 @@

> > +obj-$(CONFIG_MTK_SOC_THERMAL)	+= soc_temp.o

> > diff --git a/drivers/thermal/mtk_thermal.c

> > b/drivers/thermal/mediatek/soc_temp.c

> > similarity index 100%

> > rename from drivers/thermal/mtk_thermal.c

> > rename to drivers/thermal/mediatek/soc_temp.c

> 

> 

>
Michael Kao April 22, 2021, 8:47 a.m. UTC | #6
On Tue, 2021-04-20 at 23:22 +0200, Daniel Lezcano wrote:
> On 12/03/2021 04:40, Michael Kao wrote:

> > Add Mediatek proprietary folder to upstream more thermal zone and

> > cooler

> > drivers. Relocate the original thermal controller driver to it and

> > rename

> > as soc_temp.c to show its purpose more clearly.

> 

> We already know the purpose :)

> 

> soc_temp gives no additional information.

> 

> Either keep the name or give the hardware sensor name. It is a driver

> directory.

> 


Dear Daniel,
The new thermal hardware design called lvts (Low voltage thermal
sensor).
Instead of original one using auxadc, the lvts use lvts device to
access thermal senosrs.
It will save power and be more efficient.
We use the config CONFIG_MTK_THERMAL and CONFIG_MTK_SOC_THERMAL_LVTS[1]
to select the different hardware archtecture.

[1] [v3,2/3] thermal: mediatek: Add LVTS drivers for SoC theraml zones

https://patchwork.kernel.org/project/linux-mediatek/patch/20210312034018.17437-3-michael.kao@mediatek.com/

> > Signed-off-by: Michael Kao <michael.kao@mediatek.com>

> > ---

> >  drivers/thermal/Kconfig                       | 14 ++++-------

> >  drivers/thermal/Makefile                      |  2 +-

> >  drivers/thermal/mediatek/Kconfig              | 23

> > +++++++++++++++++++

> >  drivers/thermal/mediatek/Makefile             |  1 +

> >  .../{mtk_thermal.c => mediatek/soc_temp.c}    |  0

> 

> [ ... ]

> 

> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

> 

> 

> > +config MTK_THERMAL

> > +	tristate "Mediatek thermal drivers"

> > +	depends on THERMAL_OF

> > +	help

> > +	  This is the option for Mediatek thermal software

> > +	  solutions. Please enable corresponding options to

> > +	  get temperature information from thermal sensors or

> > +	  turn on throttle mechaisms for thermal mitigation.

> > +

> > +if MTK_THERMAL

> 

> 

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> 

> All the above not needed.

> 

> > +config MTK_SOC_THERMAL

> > +	tristate "Temperature sensor driver for mediatek SoCs"

> > +	depends on HAS_IOMEM

> > +	depends on NVMEM

> > +	depends on RESET_CONTROLLER

> > +	help

> > +	  Enable this option if you want to get SoC temperature

> > +	  information for Mediatek platforms. This driver

> > +	  configures thermal controllers to collect temperature

> > +	  via AUXADC interface.

> > +

> > +endif

> > diff --git a/drivers/thermal/mediatek/Makefile

> > b/drivers/thermal/mediatek/Makefile

> > new file mode 100644

> > index 000000000000..f75313ddce5e

> > --- /dev/null

> > +++ b/drivers/thermal/mediatek/Makefile

> > @@ -0,0 +1 @@

> > +obj-$(CONFIG_MTK_SOC_THERMAL)	+= soc_temp.o

> > diff --git a/drivers/thermal/mtk_thermal.c

> > b/drivers/thermal/mediatek/soc_temp.c

> > similarity index 100%

> > rename from drivers/thermal/mtk_thermal.c

> > rename to drivers/thermal/mediatek/soc_temp.c

> 

> 

>