Add Mediatek thermal support
Subsystems (3)
PATCH v12 1/1 Add Mediatek thermal support
This series adds support for the thermal sensors included in the MT8173 SoC. Currently only basic temperature reading is supported without any interrupt support.
The cpufreq driver for MT8173 is currently under review, so there's no real cooling device available in mainline. Until this is available the thermal driver can be tested with the following dts snippet. It creates a fake gpio fan and a fake trip point which is so low that it can easily be reached with a "cat /dev/zero > /dev/null" on the command line.
Sascha
Changes since v11:
- Fix usage of uninitialized variable gcc didn't warn about
changes since v10:
- Some style cleanup
- Add comment to make clear why we use the sensors in banks even if we currently only use the maximum of all banks
changes since v9:
- rebase on v4.3
- Add support for reading the calibration values from nvmem fuses
- Only register a single thermal zone instead of four as it seems that's everything needed
changes since v8:
- Add commit description to binding patch
- rebase on v4.3-rc2
changes since v7:
- re-add some used defines removed in v5
- Use MT8173_THERMAL_ZONE_* defines as array indices in static initializers
changes since v6:
- remove dot in Hanyi Wus name
changes since v5:
- update copyright
- remove unused defines
Changes since v4:
- give calibration constants more meaningful names (offset, slope)
- Use define instead of 0x00c for register access.
Changes since v3:
- add include/dt-bindings/thermal/mt8173.h for to be able to use sensor names in dts files
- fix disabling wrong clock in error path
- remove now unused reset-names property from binding document
- rename MT8173_NUM_BANKS -> MT8173_NUM_ZONES
- rename MT8173_NUM_SENSING_POINTS -> MT8173_NUM_SENSORS_PER_ZONE
- rename struct thermal_zone_device *tz -> struct thermal_zone_device *tzd
Changes since v2:
- sort #includes alphabetically
- Add prefix to register defines
- drop some members from struct mtk_thermal
- simplify raw_to_mcelsius()
- add and use more register bit defines
- use device_reset() instead of devm_reset_control_get()/reset_control_reset()
- misc other stuff
Changes since v1:
- Use "mediatek," prefix for custom properties
- Drop "thermal: consistently use int for temperatures" dependency
-------------
fan: gpio_fan {
compatible = "gpio-fan";
gpios = <&pio 24 0>;
gpio-fan,speed-map = <0 0
4500 1>;
#cooling-cells = <2>;
};
thermal-zones {
cpu_thermal: cpu_thermal {
polling-delay-passive = <1000>; /* milliseconds */
polling-delay = <1000>; /* milliseconds */
thermal-sensors = <&thermal>;
trips {
cpu_passive: cpu_passive {
temperature = <47000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "passive";
};
cpu_crit {
temperature = <90000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "critical";
};
};
cooling-maps {
map0 {
trip = <&cpu_passive>;
cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
};
};
};
};PATCH 1/3 dt-bindings: thermal: Add binding document for Mediatek thermal controller
This adds the device tree binding documentation for the mediatek thermal controller found on Mediatek MT8173 and other SoCs.
--- .../bindings/thermal/mediatek-thermal.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +43 -0
@@ -0,0 +1,43 @@ +* Mediatek Thermal + +This describes the device tree binding for the Mediatek thermal controller +which measures the on-SoC temperatures. This device does not have its own ADC, +instead it directly controls the AUXADC via AHB bus accesses. For this reason +this device needs phandles to the AUXADC. Also it controls a mux in the +apmixedsys register space via AHB bus accesses, so a phandle to the APMIXEDSYS +is also needed. + +Required properties: +- compatible: "mediatek,mt8173-thermal" +- reg: Address range of the thermal controller +- interrupts: IRQ for the thermal controller +- clocks, clock-names: Clocks needed for the thermal controller. required + clocks are: + "therm": Main clock needed for register access + "auxadc": The AUXADC clock +- resets: Reference to the reset controller controlling the thermal controller. +- mediatek,auxadc: A phandle to the AUXADC which the thermal controller uses +- mediatek,apmixedsys: A phandle to the APMIXEDSYS controller. +- #thermal-sensor-cells : Should be 0. See ./thermal.txt for a description. + +Optional properties: +- nvmem-cells: A phandle to the calibration data provided by a nvmem device. If + unspecified default values shall be used. +- nvmem-cell-names: Should be "calibration-data" + +Example: + + thermal: thermal@1100b000 { + #thermal-sensor-cells = <1>; + compatible = "mediatek,mt8173-thermal"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>; + clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>; + clock-names = "therm", "auxadc"; + resets = <&pericfg MT8173_PERI_THERM_SW_RST>; + reset-names = "therm"; + mediatek,auxadc = <&auxadc>; + mediatek,apmixedsys = <&apmixedsys>; + nvmem-cells = <&thermal_calibration_data>; + nvmem-cell-names = "calibration-data"; + };
Signature · 1 line
2.6.2
Re: [PATCH 1/3] dt-bindings: thermal: Add binding document for Mediatek thermal controller
Quoted 38 lines · Sascha Hauer
This adds the device tree binding documentation for the mediatek thermal controller found on Mediatek MT8173 and other SoCs.
Signed-off-by Sascha Hauer <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>Acked-by Rob Herring <[email protected]>--- .../bindings/thermal/mediatek-thermal.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal.txtDocumentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +21
-0@@ -0,0 +1,43 @@ +* Mediatek Thermal + +This describes the device tree binding for the Mediatek thermal controller +which measures the on-SoC temperatures. This device does not have its own ADC, +instead it directly controls the AUXADC via AHB bus accesses. For this reason +this device needs phandles to the AUXADC. Also it controls a mux in the +apmixedsys register space via AHB bus accesses, so a phandle to the APMIXEDSYS +is also needed. + +Required properties: +- compatible: "mediatek,mt8173-thermal" +- reg: Address range of the thermal controller +- interrupts: IRQ for the thermal controller +- clocks, clock-names: Clocks needed for the thermal controller. required + clocks are: + "therm": Main clock needed for register access + "auxadc": The AUXADC clock +- resets: Reference to the reset controller controlling the thermal controller. +- mediatek,auxadc: A phandle to the AUXADC which the thermal controller uses +- mediatek,apmixedsys: A phandle to the APMIXEDSYS controller. +- #thermal-sensor-cells : Should be 0. See ./thermal.txt for a description.
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt line 31
Quoted 10 lines
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +10
-0+ +Optional properties: +- nvmem-cells: A phandle to the calibration data provided by a nvmem device. If + unspecified default values shall be used. +- nvmem-cell-names: Should be "calibration-data" + +Example: + + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <1>;
Tiny nit: this should now be:
#thermal-sensor-cells = <0>;
Quoted 20 lines
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +12
-1+ compatible = "mediatek,mt8173-thermal"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>; + clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>; + clock-names = "therm", "auxadc"; + resets = <&pericfg MT8173_PERI_THERM_SW_RST>; + reset-names = "therm"; + mediatek,auxadc = <&auxadc>; + mediatek,apmixedsys = <&apmixedsys>; + nvmem-cells = <&thermal_calibration_data>; + nvmem-cell-names = "calibration-data"; + }; --2.6.2
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH 1/3] dt-bindings: thermal: Add binding document for Mediatek thermal controller
Quoted 52 lines · Daniel Kurtz
Quoted 38 lines · Sascha Hauer
This adds the device tree binding documentation for the mediatek thermal controller found on Mediatek MT8173 and other SoCs.
Signed-off-by Sascha Hauer <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>Acked-by Rob Herring <[email protected]>--- .../bindings/thermal/mediatek-thermal.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal.txtDocumentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +21
-0@@ -0,0 +1,43 @@ +* Mediatek Thermal + +This describes the device tree binding for the Mediatek thermal controller +which measures the on-SoC temperatures. This device does not have its own ADC, +instead it directly controls the AUXADC via AHB bus accesses. For this reason +this device needs phandles to the AUXADC. Also it controls a mux in the +apmixedsys register space via AHB bus accesses, so a phandle to the APMIXEDSYS +is also needed. + +Required properties: +- compatible: "mediatek,mt8173-thermal" +- reg: Address range of the thermal controller +- interrupts: IRQ for the thermal controller +- clocks, clock-names: Clocks needed for the thermal controller. required + clocks are: + "therm": Main clock needed for register access + "auxadc": The AUXADC clock +- resets: Reference to the reset controller controlling the thermal controller. +- mediatek,auxadc: A phandle to the AUXADC which the thermal controller uses +- mediatek,apmixedsys: A phandle to the APMIXEDSYS controller. +- #thermal-sensor-cells : Should be 0. See ./thermal.txt for a description.Documentation/devicetree/bindings/thermal/mediatek-thermal.txt line 31
Quoted 10 lines
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +10
-0+ +Optional properties: +- nvmem-cells: A phandle to the calibration data provided by a nvmem device. If + unspecified default values shall be used. +- nvmem-cell-names: Should be "calibration-data" + +Example: + + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <1>;Tiny nit: this should now be:
Quoted 1 line
#thermal-sensor-cells = <0>;
This is actually not so tiny'shy. Why does this driver masks out all sensors available? Why don't we expose all of them and use id property to expose and identify each of them?
Re: [PATCH 1/3] dt-bindings: thermal: Add binding document for Mediatek thermal controller
Quoted 53 lines · Eduardo Valentin
Quoted 52 lines · Daniel Kurtz
Quoted 38 lines · Sascha Hauer
This adds the device tree binding documentation for the mediatek thermal controller found on Mediatek MT8173 and other SoCs.
Signed-off-by Sascha Hauer <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>Acked-by Rob Herring <[email protected]>--- .../bindings/thermal/mediatek-thermal.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/mediatek-thermal.txtDocumentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +21
-0@@ -0,0 +1,43 @@ +* Mediatek Thermal + +This describes the device tree binding for the Mediatek thermal controller +which measures the on-SoC temperatures. This device does not have its own ADC, +instead it directly controls the AUXADC via AHB bus accesses. For this reason +this device needs phandles to the AUXADC. Also it controls a mux in the +apmixedsys register space via AHB bus accesses, so a phandle to the APMIXEDSYS +is also needed. + +Required properties: +- compatible: "mediatek,mt8173-thermal" +- reg: Address range of the thermal controller +- interrupts: IRQ for the thermal controller +- clocks, clock-names: Clocks needed for the thermal controller. required + clocks are: + "therm": Main clock needed for register access + "auxadc": The AUXADC clock +- resets: Reference to the reset controller controlling the thermal controller. +- mediatek,auxadc: A phandle to the AUXADC which the thermal controller uses +- mediatek,apmixedsys: A phandle to the APMIXEDSYS controller. +- #thermal-sensor-cells : Should be 0. See ./thermal.txt for a description.Documentation/devicetree/bindings/thermal/mediatek-thermal.txt line 31
Quoted 10 lines
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +10
-0+ +Optional properties: +- nvmem-cells: A phandle to the calibration data provided by a nvmem device. If + unspecified default values shall be used. +- nvmem-cell-names: Should be "calibration-data" + +Example: + + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <1>;Tiny nit: this should now be:
Quoted 6 lines
Quoted 1 line
#thermal-sensor-cells = <0>;
This is actually not so tiny'shy. Why does this driver masks out all sensors available? Why don't we expose all of them and use id property to expose and identify each of them?
This has been the case until v9 of this series. It was requested by Mediatek that the CPU frequency regulation works better when the maximum of all sensors is taken instead of only single sensors. We decided to expose the maximum of all sensors in the device tree. IN the end it will be easier to add additional sensors should we need them later than it is to get rid of sensors we don't need.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 1/3] dt-bindings: thermal: Add binding document for Mediatek thermal controller
Hello Sascha,
Quoted 4 lines · Sascha Hauer
Quoted 3 lines · Eduardo Valentin
Quoted 2 lines · Daniel Kurtz
Quoted 1 line · Sascha Hauer
+Example:
<cut>
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt new file +3
-0+ + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <1>;Quoted 8 lines
Quoted 3 lines
Tiny nit: this should now be:
#thermal-sensor-cells = <0>;
This is actually not so tiny'shy. Why does this driver masks out all sensors available? Why don't we expose all of them and use id property to expose and identify each of them?
Quoted 6 lines
This has been the case until v9 of this series. It was requested by Mediatek that the CPU frequency regulation works better when the maximum of all sensors is taken instead of only single sensors. We decided to expose the maximum of all sensors in the device tree. IN the end it will be easier to add additional sensors should we need them later than it is to get rid of sensors we don't need.
Apologize as I completely missed this transition from v9 to v10. In fact, I really cannot understand the benefit of having such constraint implemented in the driver. In device tree you can mark a thermal zone as status disabled and it won't appear in your system.
One can select which sensors / thermal zones are required. And even reuse same dtsi, and change status on dts per board.
The combination of the above, with the possibility to select the maximum from thermal core / sysfs, would be bring much more flexibility for a system engineer, than having the maximum coded in the driver, because, well, changing that relation would require changing the code. If you keep the driver as simple as possible, changing the this setup later would be as simple as changing the dts(i).
What do you think?
BR,
Quoted 8 lines
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 2/3 thermal: Add Mediatek thermal controller support
In reply to Sascha HauerThis adds support for the Mediatek thermal controller found on MT8173 and likely other SoCs.
The controller is a bit special. It does not have its own ADC, instead it controls the on-SoC AUXADC via AHB bus accesses. For this reason we need the physical address of the AUXADC. Also it controls a mux using AHB bus accesses, so we need the APMIXEDSYS physical address aswell.
--- drivers/thermal/Kconfig | 8 + drivers/thermal/Makefile | 1 + drivers/thermal/mtk_thermal.c | 623 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 632 insertions(+) create mode 100644 drivers/thermal/mtk_thermal.c
drivers/thermal/Kconfig +8 -0
@@ -348,6 +348,14 @@ config INTEL_PCH_THERMAL Thermal reporting device will provide temperature reading, programmable trip points and other information. +config MTK_THERMAL + tristate "Temperature sensor driver for mediatek SoCs" + depends on ARCH_MEDIATEK || COMPILE_TEST + default y + help + Enable this option if you want to have support for thermal management + controller present in Mediatek SoCs + menu "Texas Instruments thermal drivers" depends on ARCH_HAS_BANDGAP || COMPILE_TEST source "drivers/thermal/ti-soc-thermal/Kconfig"
drivers/thermal/Makefile +1 -0
@@ -45,3 +45,4 @@ obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o obj-$(CONFIG_ST_THERMAL) += st/ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra_soctherm.o obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o +obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
drivers/thermal/mtk_thermal.c new file +623 -0
623 lines not on this page · raw message
Signature · 1 line
2.6.2
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Sascha,
Yeah, sorry for the long delay. I was planing on applying this patch for the next merge window, but it just came across one point, see below.
drivers/thermal/mtk_thermal.c line 156
Quoted 3 lines · Sascha Hauer
This adds support for the Mediatek thermal controller found on MT8173
drivers/thermal/mtk_thermal.c new file +2
-0+static const int sensor_mux_values[MT8173_NUM_SENSORS ] = {0 ,1 ,2 ,3 ,16 }; +
<big cut>
Quoted 18 lines
drivers/thermal/mtk_thermal.c new file +18
-0+/* +* The MT8173 thermal controller has four banks. Each bank can read up to +* four temperature sensors simultaneously. The MT8173 has a total of 5 +* temperature sensors. We use each bank to measure a certain area of the +* SoC. Since TS2 is located centrally in the SoC it is influenced by multiple +* areas, hence is used in different banks. +* +* The thermal core only gets the maximum temperature of all banks, so +* the bank concept wouldn't be necessary here. However, the SVS (Smart +* Voltage Scaling) unit makes its decisions based on the same bank +* data, and this indeed needs the temperatures of the individual banks +* for making better decisions. +*/ +static const struct mtk_thermal_bank_cfg bank_data[] = { + { + .num_sensors =2 , + .sensors = {MT8173_TS2 ,MT8173_TS3 }, + }, {
drivers/thermal/mtk_thermal.c line 184
Quoted 10 lines
drivers/thermal/mtk_thermal.c new file +10
-0+ .num_sensors = 2, + .sensors = { MT8173_TS2, MT8173_TS4 }, + }, { + .num_sensors =3 , + .sensors = { MT8173_TS1, MT8173_TS2, MT8173_TSABB }, + }, { + .num_sensors =1 , + .sensors = { MT8173_TS2 }, + }, +};
Why can't we expose all these as thermal zones?
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
BR,
Eduardo Valentin
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Hi Eduardo,
Quoted 43 lines · Eduardo Valentin
Sascha,
Yeah, sorry for the long delay. I was planing on applying this patch for the next merge window, but it just came across one point, see below.
drivers/thermal/mtk_thermal.c line 156
Quoted 3 lines · Sascha Hauer
This adds support for the Mediatek thermal controller found on MT8173
drivers/thermal/mtk_thermal.c new file +2
-0+static const int sensor_mux_values[MT8173_NUM_SENSORS ] = {0 ,1 ,2 ,3 ,16 }; +<big cut>
Quoted 18 lines
drivers/thermal/mtk_thermal.c new file +18
-0+/* +* The MT8173 thermal controller has four banks. Each bank can read up to +* four temperature sensors simultaneously. The MT8173 has a total of 5 +* temperature sensors. We use each bank to measure a certain area of the +* SoC. Since TS2 is located centrally in the SoC it is influenced by multiple +* areas, hence is used in different banks. +* +* The thermal core only gets the maximum temperature of all banks, so +* the bank concept wouldn't be necessary here. However, the SVS (Smart +* Voltage Scaling) unit makes its decisions based on the same bank +* data, and this indeed needs the temperatures of the individual banks +* for making better decisions. +*/ +static const struct mtk_thermal_bank_cfg bank_data[] = { + { + .num_sensors =2 , + .sensors = {MT8173_TS2 ,MT8173_TS3 }, + }, {drivers/thermal/mtk_thermal.c line 184
Quoted 10 lines
drivers/thermal/mtk_thermal.c new file +10
-0+ .num_sensors = 2, + .sensors = { MT8173_TS2, MT8173_TS4 }, + }, { + .num_sensors =3 , + .sensors = { MT8173_TS1, MT8173_TS2, MT8173_TSABB }, + }, { + .num_sensors =1 , + .sensors = { MT8173_TS2 }, + }, +};Why can't we expose all these as thermal zones?
Quoted 7 lines
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
I think the aggregation of thermal zones is quite useful when it comes to putting different chips together to a system. I am not so sure how useful it is to expose different thermal zones of a single SoC to the device tree.
Currently the only control knob we have is the CPU frequency. When any of the sensors on the SoC gets too hot then the only thing we can do is to decrease the CPU frequency. This does not leave much space for configuration in the device tree.
What I need to be able is to attach multiple sensors to one thermal zone. The aggregation patch series only partly solves that and I think is inconsistent, but I commented on the series directly.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Eduardo,
Quoted 11 lines · Sascha Hauer
Hi Eduardo,
Quoted 8 lines
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
Quoted 11 lines
I think the aggregation of thermal zones is quite useful when it comes to putting different chips together to a system. I am not so sure how useful it is to expose different thermal zones of a single SoC to the device tree.
Currently the only control knob we have is the CPU frequency. When any of the sensors on the SoC gets too hot then the only thing we can do is to decrease the CPU frequency. This does not leave much space for configuration in the device tree.
What I need to be able is to attach multiple sensors to one thermal zone. The aggregation patch series only partly solves that and I think is inconsistent, but I commented on the series directly.
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 26 lines · Sascha Hauer
Eduardo,
Quoted 11 lines · Sascha Hauer
Hi Eduardo,
Quoted 8 lines
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
Quoted 11 lines
I think the aggregation of thermal zones is quite useful when it comes to putting different chips together to a system. I am not so sure how useful it is to expose different thermal zones of a single SoC to the device tree.
Currently the only control knob we have is the CPU frequency. When any of the sensors on the SoC gets too hot then the only thing we can do is to decrease the CPU frequency. This does not leave much space for configuration in the device tree.
What I need to be able is to attach multiple sensors to one thermal zone. The aggregation patch series only partly solves that and I think is inconsistent, but I commented on the series directly.
Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.html
Regards,
Eddie
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Hi Eduardo, Sascha,
Quoted 39 lines · Eddie Huang
Quoted 26 lines · Sascha Hauer
Eduardo,
Quoted 11 lines · Sascha Hauer
Hi Eduardo,
Quoted 8 lines
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
Quoted 11 lines
I think the aggregation of thermal zones is quite useful when it comes to putting different chips together to a system. I am not so sure how useful it is to expose different thermal zones of a single SoC to the device tree.
Currently the only control knob we have is the CPU frequency. When any of the sensors on the SoC gets too hot then the only thing we can do is to decrease the CPU frequency. This does not leave much space for configuration in the device tree.
What I need to be able is to attach multiple sensors to one thermal zone. The aggregation patch series only partly solves that and I think is inconsistent, but I commented on the series directly.Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
Quoted 4 lines
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.html
Friendly ping on the Mediatek thermal driver.
The "EFUSE" dependency has now landed in v4.5-rc4.
So, AFAICT, the only thing left that may be blocking landing Mediatek thermal driver is resolution of this discussion about thermal zones. Can we kindly resolve this soon so we have a chance to land it in v4.6.
Thanks,
-Dan
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 42 lines · Daniel Kurtz
Hi Eduardo, Sascha,
Quoted 39 lines · Eddie Huang
Quoted 26 lines · Sascha Hauer
Eduardo,
Quoted 11 lines · Sascha Hauer
Hi Eduardo,
Quoted 8 lines
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
Quoted 11 lines
I think the aggregation of thermal zones is quite useful when it comes to putting different chips together to a system. I am not so sure how useful it is to expose different thermal zones of a single SoC to the device tree.
Currently the only control knob we have is the CPU frequency. When any of the sensors on the SoC gets too hot then the only thing we can do is to decrease the CPU frequency. This does not leave much space for configuration in the device tree.
What I need to be able is to attach multiple sensors to one thermal zone. The aggregation patch series only partly solves that and I think is inconsistent, but I commented on the series directly.Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
Quoted 7 lines
Quoted 4 lines
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.htmlFriendly ping on the Mediatek thermal driver. The "EFUSE" dependency has now landed in v4.5-rc4.
Actually, it landed in char-misc-next, not v4.5-rc4.
Quoted 6 lines
So, AFAICT, the only thing left that may be blocking landing Mediatek thermal driver is resolution of this discussion about thermal zones. Can we kindly resolve this soon so we have a chance to land it in v4.6.
Thanks,
-Dan
Matthias Brugger
maintainerRe: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 48 lines · Daniel Kurtz
Quoted 47 lines · Daniel Kurtz
Hi Eduardo, Sascha,
Quoted 43 lines · Eddie Huang
Quoted 26 lines · Sascha Hauer
Eduardo,
Quoted 11 lines · Sascha Hauer
Hi Eduardo,
Quoted 8 lines
That should remove the policy of computing the maximum from this driver. Please have a look on the work being done [1] to add grouping and aggregation of thermal zones. With that in place, you should be a matter of configuring the grouping and selecting max as the aggregation function, from the thermal core, instead in the driver. Which should give the system engineer, more flexibility to compose whatever policy based on the exposed sensors.
Quoted 11 lines
I think the aggregation of thermal zones is quite useful when it comes to putting different chips together to a system. I am not so sure how useful it is to expose different thermal zones of a single SoC to the device tree.
Currently the only control knob we have is the CPU frequency. When any of the sensors on the SoC gets too hot then the only thing we can do is to decrease the CPU frequency. This does not leave much space for configuration in the device tree.
What I need to be able is to attach multiple sensors to one thermal zone. The aggregation patch series only partly solves that and I think is inconsistent, but I commented on the series directly.Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.html
Quoted 9 lines
Quoted 2 lines
Friendly ping on the Mediatek thermal driver. The "EFUSE" dependency has now landed in v4.5-rc4.
Actually, it landed in char-misc-next, not v4.5-rc4.
Quoted 4 lines
So, AFAICT, the only thing left that may be blocking landing Mediatek thermal driver is resolution of this discussion about thermal zones. Can we kindly resolve this soon so we have a chance to land it in v4.6.
I think the problem is, that Eduardo wants to see the hierachical thermal zones being used. But there is still a discussion ongoing [1].
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 27 lines · Matthias Brugger
Quoted 24 lines · Daniel Kurtz
Quoted 13 lines · Daniel Kurtz
Hi Eduardo, Sascha,
Quoted 11 lines
Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
Quoted 7 lines
Quoted 4 lines
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.htmlFriendly ping on the Mediatek thermal driver. The "EFUSE" dependency has now landed in v4.5-rc4.
Actually, it landed in char-misc-next, not v4.5-rc4.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
So, AFAICT, the only thing left that may be blocking landing Mediatek thermal driver is resolution of this discussion about thermal zones. Can we kindly resolve this soon so we have a chance to land it in v4.6.
I think the problem is, that Eduardo wants to see the hierachical thermal zones being used. But there is still a discussion ongoing [1].
It seems the original Author lost interest in the hierarchical thermal zones. I am not convinced that we need hierarchical thermal zones for the Mediatek driver since from the five sensors we only need the maximum temperature (If this ever changes we could still rework it).
Given the current speed of communication I am not willing to add another, possibly controversal, dependency to an otherwise simple driver. I am even less willing when concerns like these come after *v12* of this series.
Eduardo, it would really help to get a word from you.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Hi Sascha,
Quoted 32 lines · Sascha Hauer
Quoted 31 lines · Matthias Brugger
Quoted 28 lines · Daniel Kurtz
Quoted 13 lines · Daniel Kurtz
Hi Eduardo, Sascha,
Quoted 11 lines
Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
Quoted 7 lines
Quoted 4 lines
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.htmlFriendly ping on the Mediatek thermal driver. The "EFUSE" dependency has now landed in v4.5-rc4.
Actually, it landed in char-misc-next, not v4.5-rc4.
Quoted 4 lines
So, AFAICT, the only thing left that may be blocking landing Mediatek thermal driver is resolution of this discussion about thermal zones. Can we kindly resolve this soon so we have a chance to land it in v4.6.
Quoted 7 lines
Quoted 2 lines
I think the problem is, that Eduardo wants to see the hierachical thermal zones being used. But there is still a discussion ongoing [1].
It seems the original Author lost interest in the hierarchical thermal zones. I am not convinced that we need hierarchical thermal zones for the Mediatek driver since from the five sensors we only need the maximum temperature (If this ever changes we could still rework it).
I guess that "the original Author" refers to me. I haven't lost interest in the hierarchical thermal zones, I just don't have time to work on it currently. I'd like to address your review at some point in the future and continue working on it.
Quoted 4 lines
Given the current speed of communication I am not willing to add another, possibly controversal, dependency to an otherwise simple driver. I am even less willing when concerns like these come after *v12* of this series.
I agree. I don't think we should make this driver depend on the hierarchical thermal zones series. When hierarchical thermal zones get merged we can consider to change the driver to use them but there's no point in waiting for that to happen.
Cheers,
Javi
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
In reply to Sascha HauerFolks,
Quoted 42 lines · Sascha Hauer
Quoted 27 lines · Matthias Brugger
Quoted 24 lines · Daniel Kurtz
Quoted 13 lines · Daniel Kurtz
Hi Eduardo, Sascha,
Quoted 11 lines
Quoted 3 lines
Any input on this? I really like to get this driver upstream as it is currently blocking other Mediatek drivers.
Hi Eduardo,
Do you have any comment about Sascha's response ? We really hope get your comment since Mediatek thermal driver already reviewed in public over half years, and we have other patches [0] [1] depend on thermal driver.
Quoted 7 lines
Quoted 4 lines
[0]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394084.html
[1]:
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/401055.htmlFriendly ping on the Mediatek thermal driver. The "EFUSE" dependency has now landed in v4.5-rc4.
Actually, it landed in char-misc-next, not v4.5-rc4.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
So, AFAICT, the only thing left that may be blocking landing Mediatek thermal driver is resolution of this discussion about thermal zones. Can we kindly resolve this soon so we have a chance to land it in v4.6.
I think the problem is, that Eduardo wants to see the hierachical thermal zones being used. But there is still a discussion ongoing [1].
It seems the original Author lost interest in the hierarchical thermal zones. I am not convinced that we need hierarchical thermal zones for the Mediatek driver since from the five sensors we only need the maximum temperature (If this ever changes we could still rework it).
Quoted 6 lines
Given the current speed of communication I am not willing to add another, possibly controversal, dependency to an otherwise simple driver. I am even less willing when concerns like these come after *v12* of this series.
Eduardo, it would really help to get a word from you.
Apologize for the long delays here. In fact I want the hierarchical support on this driver. But given that it is not really a strong dependency and the hierarchical support is still an ongoing development, I don't see why we should not merge this driver.
I also have had the chance to try it out in a board, and seams to work for me. I am adding to my tree.
Thanks for the perseverance. :-)
Quoted 8 lines
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 17 lines · Eduardo Valentin
Folks,
Quoted 8 lines
Quoted 2 lines
I think the problem is, that Eduardo wants to see the hierachical thermal zones being used. But there is still a discussion ongoing [1].
It seems the original Author lost interest in the hierarchical thermal zones. I am not convinced that we need hierarchical thermal zones for the Mediatek driver since from the five sensors we only need the maximum temperature (If this ever changes we could still rework it).
Quoted 6 lines
Given the current speed of communication I am not willing to add another, possibly controversal, dependency to an otherwise simple driver. I am even less willing when concerns like these come after *v12* of this series.
Eduardo, it would really help to get a word from you.
Quoted 7 lines
Apologize for the long delays here. In fact I want the hierarchical support on this driver. But given that it is not really a strong dependency and the hierarchical support is still an ongoing development, I don't see why we should not merge this driver.
I also have had the chance to try it out in a board, and seams to work for me. I am adding to my tree.
Thanks for applying :)
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
In reply to Sascha HauerHi Sascha,
One nit below that can be fixed up later, or now if you don't plan to spin this driver to
address Eduardo's feedback...
Quoted 8 lines · Sascha Hauer
This adds support for the Mediatek thermal controller found on MT8173 and likely other SoCs.
The controller is a bit special. It does not have its own ADC, instead it controls the on-SoC AUXADC via AHB bus accesses. For this reason we need the physical address of the AUXADC. Also it controls a mux using AHB bus accesses, so we need the APMIXEDSYS physical address aswell.Signed-off-by Sascha Hauer <[email protected]>
[snip]
Quoted 7 lines
drivers/thermal/mtk_thermal.c new file +7
-0+static int mtk_thermal_get_calibration_data (struct device *dev,struct mtk_thermal *mt) +{ +struct nvmem_cell *cell; +u32 *buf; +size_t len; +int i, ret =0 ; +
drivers/thermal/mtk_thermal.c line 453
Quoted 10 lines
drivers/thermal/mtk_thermal.c new file +10
-0+/* Start with default values */ + mt->adc_ge =512 ; +for (i =0 ; i <MT8173_NUM_SENSORS ; i++) + mt->vts[i] =260 ; + mt->degc_cali =40 ; + mt->o_slope =0 ; + + cell =nvmem_cell_get (dev,"calibration-data" ); +if (IS_ERR (cell)) { +if (PTR_ERR (cell) == -EPROBE_DEFER )
It is useful to know why the thermal driver is being probe defered, so I suggest here:dev_warn(dev, "Waiting for calibration data.\n");
drivers/thermal/mtk_thermal.c line 456
Quoted 3 lines
drivers/thermal/mtk_thermal.c new file +3
-0+return PTR_ERR (cell); +return 0 ; + }
Thanks,
-Dan
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 31 lines · Daniel Kurtz
Hi Sascha,
One nit below that can be fixed up later, or now if you don't plan to spin this driver to
address Eduardo's feedback...Quoted 8 lines · Sascha Hauer
This adds support for the Mediatek thermal controller found on MT8173 and likely other SoCs.
The controller is a bit special. It does not have its own ADC, instead it controls the on-SoC AUXADC via AHB bus accesses. For this reason we need the physical address of the AUXADC. Also it controls a mux using AHB bus accesses, so we need the APMIXEDSYS physical address aswell.Signed-off-by Sascha Hauer <[email protected]>[snip]
Quoted 13 lines
drivers/thermal/mtk_thermal.c new file +13
-0+static int mtk_thermal_get_calibration_data (struct device *dev,struct mtk_thermal *mt) +{ +struct nvmem_cell *cell; +u32 *buf; +size_t len; +int i, ret =0 ; + +/* Start with default values */ + mt->adc_ge =512 ; +for (i =0 ; i <MT8173_NUM_SENSORS ; i++) + mt->vts[i] =260 ; + mt->degc_cali =40 ; + mt->o_slope =0 ;
Quoted 8 lines
drivers/thermal/mtk_thermal.c line 453
Quoted 4 lines
drivers/thermal/mtk_thermal.c new file +4
-0+ + cell =nvmem_cell_get (dev,"calibration-data" ); +if (IS_ERR (cell)) { +if (PTR_ERR (cell) == -EPROBE_DEFER )It is useful to know why the thermal driver is being probe defered, so I suggest here:
dev_warn(dev, "Waiting for calibration data.\n");
The problem with that is that this message is not shown once but possibly many times and may not even show a problem because in the end the device may be probed successfully. In this case the last thing you see from the device is "Waiting for calibration data." and get annoyed by all this useless noise from the driver.
Of course I agree that this information may be useful in the case you wonder why your device doesn't show up...
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] thermal: Add Mediatek thermal controller support
Quoted 41 lines · Sascha Hauer
Quoted 31 lines · Daniel Kurtz
Hi Sascha,
One nit below that can be fixed up later, or now if you don't plan to spin this driver to
address Eduardo's feedback...Quoted 8 lines · Sascha Hauer
This adds support for the Mediatek thermal controller found on MT8173 and likely other SoCs.
The controller is a bit special. It does not have its own ADC, instead it controls the on-SoC AUXADC via AHB bus accesses. For this reason we need the physical address of the AUXADC. Also it controls a mux using AHB bus accesses, so we need the APMIXEDSYS physical address aswell.Signed-off-by Sascha Hauer <[email protected]>[snip]
Quoted 13 lines
drivers/thermal/mtk_thermal.c new file +13
-0+static int mtk_thermal_get_calibration_data (struct device *dev,struct mtk_thermal *mt) +{ +struct nvmem_cell *cell; +u32 *buf; +size_t len; +int i, ret =0 ; + +/* Start with default values */ + mt->adc_ge =512 ; +for (i =0 ; i <MT8173_NUM_SENSORS ; i++) + mt->vts[i] =260 ; + mt->degc_cali =40 ; + mt->o_slope =0 ;Quoted 8 lines
drivers/thermal/mtk_thermal.c line 453
Quoted 4 lines
drivers/thermal/mtk_thermal.c new file +4
-0+ + cell =nvmem_cell_get (dev,"calibration-data" ); +if (IS_ERR (cell)) { +if (PTR_ERR (cell) == -EPROBE_DEFER )It is useful to know why the thermal driver is being probe defered, so I suggest here:
dev_warn(dev, "Waiting for calibration data.\n");
Quoted 8 lines
The problem with that is that this message is not shown once but possibly many times and may not even show a problem because in the end the device may be probed successfully. In this case the last thing you see from the device is "Waiting for calibration data." and get annoyed by all this useless noise from the driver.
Of course I agree that this information may be useful in the case you wonder why your device doesn't show up...
The solution for this, then, is:
dev_dbg()
PATCH 3/3 ARM64: dts: mt8173: Add thermal/auxadc device nodes
In reply to Sascha HauerThis adds the thermal controller and auxadc nodes to the Mediatek MT8173 dtsi file.
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +17 -0
@@ -277,6 +277,11 @@ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; }; + auxadc: auxadc at 11001000 { + compatible = "mediatek,mt8173-auxadc"; + reg = <0 0x11001000 0 0x1000>; + }; + uart0: serial at 11002000 { compatible = "mediatek,mt8173-uart", "mediatek,mt6577-uart";
@@ -487,6 +492,18 @@ clock-names = "source", "hclk"; status = "disabled"; }; + + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <0>; + compatible = "mediatek,mt8173-thermal"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>; + clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>; + clock-names = "therm", "auxadc"; + resets = <&pericfg MT8173_PERI_THERM_SW_RST>; + mediatek,auxadc = <&auxadc>; + mediatek,apmixedsys = <&apmixedsys>; + }; }; };
Signature · 1 line
2.6.2
Matthias Brugger
maintainerRe: [PATCH 3/3] ARM64: dts: mt8173: Add thermal/auxadc device nodes
Hi Sascha,
Quoted 14 lines · Sascha Hauer
This adds the thermal controller and auxadc nodes to the Mediatek MT8173 dtsi file.
Signed-off-by Sascha Hauer <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)arch/arm64/boot/dts/mediatek/mt8173.dtsi +0
-0
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 281
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0@@ -277,6 +277,11 @@ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; }; + auxadc: auxadc at 11001000 { + compatible = "mediatek,mt8173-auxadc";
Can you please write a small Documentation about the binding. I suppose it will be mediatek,auxadc and mediatek,mt8173-auxadc.
I can't do it my self, as my datasheet lacks the auxadc registers.
Thanks,
Matthias
Quoted 26 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +15
-0+ reg = <0 0x11001000 0 0x1000>; + }; + uart0: serial at 11002000 { compatible = "mediatek,mt8173-uart", "mediatek,mt6577-uart";@@ -487,6 +492,18 @@ clock-names = "source", "hclk"; status = "disabled"; }; + + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <0>; + compatible = "mediatek,mt8173-thermal"; + reg = <0 0x1100b000 0 0x1000>; + interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>; + clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>; + clock-names = "therm", "auxadc"; + resets = <&pericfg MT8173_PERI_THERM_SW_RST>; + mediatek,auxadc = <&auxadc>; + mediatek,apmixedsys = <&apmixedsys>; + }; }; };
Re: [PATCH 3/3] ARM64: dts: mt8173: Add thermal/auxadc device nodes
Hi Matthias,
Quoted 20 lines · Matthias Brugger
Hi Sascha,
Quoted 17 lines · Sascha Hauer
This adds the thermal controller and auxadc nodes to the Mediatek MT8173 dtsi file.
Signed-off-by Sascha Hauer <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)arch/arm64/boot/dts/mediatek/mt8173.dtsi +0
-0@@ -277,6 +277,11 @@ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; };
Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 281
Quoted 2 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +2
-0+ auxadc: auxadc at 11001000 { + compatible = "mediatek,mt8173-auxadc";Can you please write a small Documentation about the binding. I suppose it will be mediatek,auxadc and mediatek,mt8173-auxadc.
Just did that.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Matthias Brugger
maintainerRe: [PATCH 3/3] ARM64: dts: mt8173: Add thermal/auxadc device nodes
In reply to Sascha HauerQuoted 35 lines · Sascha Hauer
This adds the thermal controller and auxadc nodes to the Mediatek MT8173 dtsi file.
Signed-off-by Sascha Hauer <[email protected]>Reviewed-by Daniel Kurtz <[email protected]>--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)arch/arm64/boot/dts/mediatek/mt8173.dtsi +10
-0@@ -277,6 +277,11 @@ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>; }; + auxadc: auxadc at 11001000 { + compatible = "mediatek,mt8173-auxadc"; + reg = <0 0x11001000 0 0x1000>; + }; + uart0: serial at 11002000 { compatible = "mediatek,mt8173-uart", "mediatek,mt6577-uart";@@ -487,6 +492,18 @@ clock-names = "source", "hclk"; status = "disabled"; }; + + thermal: thermal at 1100b000 { + #thermal-sensor-cells = <0>; + compatible = "mediatek,mt8173-thermal"; + reg = <0 0x1100b000 0 0x1000>;
arch/arm64/boot/dts/mediatek/mt8173.dtsi line 509
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8173.dtsi +7
-0+ interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>; + clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>; + clock-names = "therm", "auxadc"; + resets = <&pericfg MT8173_PERI_THERM_SW_RST>; + mediatek,auxadc = <&auxadc>; + mediatek,apmixedsys = <&apmixedsys>; + }; }; };
Applied with the ACK from Eduardo.
Thanks.
Eduardo,
Ok, to apply this? There seem to be no further comments.
Sascha
Quoted 113 lines · Sascha Hauer
This series adds support for the thermal sensors included in the MT8173 SoC. Currently only basic temperature reading is supported without any interrupt support.
The cpufreq driver for MT8173 is currently under review, so there's no real cooling device available in mainline. Until this is available the thermal driver can be tested with the following dts snippet. It creates a fake gpio fan and a fake trip point which is so low that it can easily be reached with a "cat
/dev/zero>/dev/null" on the command line.Sascha
Changes since v11:
- Fix usage of uninitialized variable gcc didn't warn aboutchanges since v10:
- Some style cleanup
- Add comment to make clear why we use the sensors in banks even if we currently only use the maximum of all bankschanges since v9:
- rebase on v4.3
- Add support for reading the calibration values from nvmem fuses
- Only register a single thermal zone instead of four as it seems that's everything neededchanges since v8:
- Add commit description to binding patch
- rebase on v4.3-rc2changes since v7:
- re-add some used defines removed in v5
- Use MT8173_THERMAL_ZONE_* defines as array indices in static initializerschanges since v6:
- remove dot in Hanyi Wus namechanges since v5:
- update copyright
- remove unused definesChanges since v4:
- give calibration constants more meaningful names (offset, slope)
- Use define instead of0x00cfor register access.Changes since v3:
- addinclude/dt-bindings/thermal/mt8173.hfor to be able to use sensor names in dts files
- fix disabling wrong clock in error path
- remove now unused reset-names property from binding document
- renameMT8173_NUM_BANKS->MT8173_NUM_ZONES
- renameMT8173_NUM_SENSING_POINTS->MT8173_NUM_SENSORS_PER_ZONE
- rename structthermal_zone_device*tz -> structthermal_zone_device*tzdChanges since v2:
- sort #includes alphabetically
- Add prefix to register defines
- drop some members from structmtk_thermal
- simplifyraw_to_mcelsius()
- add and use more register bit defines
- usedevice_reset()instead of devm_reset_control_get()/reset_control_reset()
- misc other stuffChanges since v1:
- Use "mediatek," prefix for custom properties
- Drop "thermal: consistently use int for temperatures" dependency-------------
fan: gpio_fan { compatible = "gpio-fan"; gpios = <&pio 24 0>; gpio-fan,speed-map = <0 0 4500 1>; #cooling-cells = <2>; }; thermal-zones { cpu_thermal: cpu_thermal { polling-delay-passive = <1000>; /* milliseconds */ polling-delay = <1000>; /* milliseconds */ thermal-sensors = <&thermal>; trips { cpu_passive: cpu_passive { temperature = <47000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "passive"; }; cpu_crit { temperature = <90000>; /* millicelsius */ hysteresis = <2000>; /* millicelsius */ type = "critical"; }; }; cooling-maps { map0 { trip = <&cpu_passive>; cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; }; }; }; };_______________________________________________
Linux-mediatek mailing list
Linux-mediatek at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 3 lines · Sascha Hauer
Eduardo,
Ok, to apply this? There seem to be no further comments.
Yeah, sorry for the delay. I will do one more review round, but I dont see much. So, hopefully should be applied in the coming days.
BR
PATCH 1/1 thermal: small style cleanup in mtk_thermal
In reply to Sascha HauerRemove all checkpatch.pl --strict errors, checks, and warnings.
---
Sascha,
Add your v12 in my forlinus branch. But also, on top of it I cleaned the patch further with the following patch.
BR,
Eduardo
drivers/thermal/mtk_thermal.c | 56 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-)
drivers/thermal/mtk_thermal.c +29 -27
@@ -78,7 +78,7 @@#define TEMP_MONCTL1_PERIOD_UNIT (x) ((x) & 0x3ff) -#define TEMP_MONCTL2_FILTER_INTERVAL (x) (((x) & 0x3ff)) << 16 +#define TEMP_MONCTL2_FILTER_INTERVAL (x) (((x) & 0x3ff) << 16)#define TEMP_MONCTL2_SENSOR_INTERVAL (x) ((x) & 0x3ff)#define TEMP_AHBPOLL_ADC_POLL_INTERVAL (x) (x)
@@ -108,15 +108,15 @@#define MT8173_NUM_SENSORS_PER_ZONE 4/* Layout of the fuses providing the calibration data */ -#define MT8173_CALIB_BUF0_VALID (1 << 0) -#define MT8173_CALIB_BUF1_ADC_GE (x) (((x) >> 22 ) & 0x3ff) -#define MT8173_CALIB_BUF0_VTS_TS1 (x) (((x) >> 17 ) & 0x1ff) -#define MT8173_CALIB_BUF0_VTS_TS2 (x) (((x) >> 8 ) & 0x1ff) -#define MT8173_CALIB_BUF1_VTS_TS3 (x) (((x) >> 0 ) & 0x1ff) -#define MT8173_CALIB_BUF2_VTS_TS4 (x) (((x) >> 23 ) & 0x1ff) -#define MT8173_CALIB_BUF2_VTS_TSABB (x) (((x) >> 14 ) & 0x1ff) -#define MT8173_CALIB_BUF0_DEGC_CALI (x) (((x) >> 1 ) & 0x3f) -#define MT8173_CALIB_BUF0_O_SLOPE (x) (((x) >> 26 ) & 0x3f) +#define MT8173_CALIB_BUF0_VALID BIT(0) +#define MT8173_CALIB_BUF1_ADC_GE (x) (((x) >> 22) & 0x3ff) +#define MT8173_CALIB_BUF0_VTS_TS1 (x) (((x) >> 17) & 0x1ff) +#define MT8173_CALIB_BUF0_VTS_TS2 (x) (((x) >> 8) & 0x1ff) +#define MT8173_CALIB_BUF1_VTS_TS3 (x) (((x) >> 0) & 0x1ff) +#define MT8173_CALIB_BUF2_VTS_TS4 (x) (((x) >> 23) & 0x1ff) +#define MT8173_CALIB_BUF2_VTS_TSABB (x) (((x) >> 14) & 0x1ff) +#define MT8173_CALIB_BUF0_DEGC_CALI (x) (((x) >> 1) & 0x3f) +#define MT8173_CALIB_BUF0_O_SLOPE (x) (((x) >> 26) & 0x3f)#define THERMAL_NAME "mtk-thermal"
@@ -136,6 +136,7 @@ struct mtk_thermal {struct mtk_thermal_bank banks[MT8173_NUM_ZONES ]; +/* lock: for getting and putting banks */ struct mutex lock;/* Calibration values */
@@ -271,11 +272,9 @@ static void mtk_thermal_put_bank(struct mtk_thermal_bank *bank)static int mtk_thermal_bank_temperature (struct mtk_thermal_bank *bank) {struct mtk_thermal *mt = bank->mt; -int temp, i, max; +int i, temp =INT_MIN , max =INT_MIN ;u32 raw; - temp = max =INT_MIN ; -for (i =0 ; i < bank_data[bank->id].num_sensors; i++) { raw =readl (mt->thermal_base + sensing_points[i].msr);
@@ -322,7 +321,7 @@ static const struct thermal_zone_of_device_ops mtk_thermal_ops = { };static void mtk_thermal_init_bank (struct mtk_thermal *mt,int num, -u32 apmixed_phys_base,u32 auxadc_phys_base) +u32 apmixed_phys_base,u32 auxadc_phys_base) {struct mtk_thermal_bank *bank = &mt->banks[num];const struct mtk_thermal_bank_cfg *cfg = &bank_data[num];
@@ -346,7 +345,7 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,/* poll is set to 10u */ writel (TEMP_AHBPOLL_ADC_POLL_INTERVAL (768 ), - mt->thermal_base +TEMP_AHBPOLL ); + mt->thermal_base +TEMP_AHBPOLL );/* temperature sampling control, 1 sample */ writel (0x0 , mt->thermal_base +TEMP_MSRCTL0 );
@@ -375,49 +374,50 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,/* AHB address for auxadc mux selection */ writel (auxadc_phys_base +AUXADC_CON1_CLR_V , - mt->thermal_base +TEMP_ADCMUXADDR ); + mt->thermal_base +TEMP_ADCMUXADDR );/* AHB address for pnp sensor mux selection */ writel (apmixed_phys_base +APMIXED_SYS_TS_CON1 , - mt->thermal_base +TEMP_PNPMUXADDR ); + mt->thermal_base +TEMP_PNPMUXADDR );/* AHB value for auxadc enable */ writel (BIT (MT8173_TEMP_AUXADC_CHANNEL ), mt->thermal_base +TEMP_ADCEN );/* AHB address for auxadc enable (channel 0 immediate mode selected) */ writel (auxadc_phys_base +AUXADC_CON1_SET_V , - mt->thermal_base +TEMP_ADCENADDR ); + mt->thermal_base +TEMP_ADCENADDR );/* AHB address for auxadc valid bit */ writel (auxadc_phys_base +AUXADC_DATA (MT8173_TEMP_AUXADC_CHANNEL ), - mt->thermal_base +TEMP_ADCVALIDADDR ); + mt->thermal_base +TEMP_ADCVALIDADDR );/* AHB address for auxadc voltage output */ writel (auxadc_phys_base +AUXADC_DATA (MT8173_TEMP_AUXADC_CHANNEL ), - mt->thermal_base +TEMP_ADCVOLTADDR ); + mt->thermal_base +TEMP_ADCVOLTADDR );/* read valid & voltage are at the same register */ writel (0x0 , mt->thermal_base +TEMP_RDCTRL );/* indicate where the valid bit is */ writel (TEMP_ADCVALIDMASK_VALID_HIGH |TEMP_ADCVALIDMASK_VALID_POS (12 ), - mt->thermal_base +TEMP_ADCVALIDMASK ); + mt->thermal_base +TEMP_ADCVALIDMASK );/* no shift */ writel (0x0 , mt->thermal_base +TEMP_ADCVOLTAGESHIFT );/* enable auxadc mux write transaction */ writel (TEMP_ADCWRITECTRL_ADC_MUX_WRITE , - mt->thermal_base +TEMP_ADCWRITECTRL ); + mt->thermal_base +TEMP_ADCWRITECTRL );for (i =0 ; i < cfg->num_sensors; i++)writel (sensor_mux_values[cfg->sensors[i]], - mt->thermal_base + sensing_points[i].adcpnp); + mt->thermal_base + sensing_points[i].adcpnp);writel ((1 << cfg->num_sensors) -1 , mt->thermal_base +TEMP_MONCTL0 ); -writel (TEMP_ADCWRITECTRL_ADC_PNP_WRITE |TEMP_ADCWRITECTRL_ADC_MUX_WRITE , - mt->thermal_base +TEMP_ADCWRITECTRL ); +writel (TEMP_ADCWRITECTRL_ADC_PNP_WRITE | +TEMP_ADCWRITECTRL_ADC_MUX_WRITE , + mt->thermal_base +TEMP_ADCWRITECTRL );mtk_thermal_put_bank (bank); }
@@ -434,7 +434,8 @@ static u64 of_get_phys_base(struct device_node *np)return of_translate_address (np, regaddr_p); } -static int mtk_thermal_get_calibration_data (struct device *dev,struct mtk_thermal *mt) +static int mtk_thermal_get_calibration_data (struct device *dev, +struct mtk_thermal *mt) {struct nvmem_cell *cell;u32 *buf;
@@ -567,7 +568,8 @@ static int mtk_thermal_probe(struct platform_device *pdev) }for (i =0 ; i <MT8173_NUM_ZONES ; i++) -mtk_thermal_init_bank (mt, i, apmixed_phys_base, auxadc_phys_base); +mtk_thermal_init_bank (mt, i, apmixed_phys_base, + auxadc_phys_base);platform_set_drvdata (pdev, mt);
Signature · 1 line
2.1.4
Re: [PATCH 1/1] thermal: small style cleanup in mtk_thermal
Quoted 10 lines · Eduardo Valentin
Remove all checkpatch.pl --strict errors, checks, and warnings.
Cc Zhang Rui <[email protected]>Cc Matthias Brugger <[email protected]>Cc linux-pm at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-mediatek at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>---
Quoted 171 lines
Sascha,
Add your v12 in my forlinus branch. But also, on top of it I cleaned the patch further with the following patch.
BR,
Eduardo
drivers/thermal/mtk_thermal.c | 56 ++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 27 deletions(-)drivers/thermal/mtk_thermal.c +29
-27@@ -78,7 +78,7 @@#define TEMP_MONCTL1_PERIOD_UNIT (x) ((x) & 0x3ff) -#define TEMP_MONCTL2_FILTER_INTERVAL (x) (((x) & 0x3ff)) << 16 +#define TEMP_MONCTL2_FILTER_INTERVAL (x) (((x) & 0x3ff) << 16)#define TEMP_MONCTL2_SENSOR_INTERVAL (x) ((x) & 0x3ff)#define TEMP_AHBPOLL_ADC_POLL_INTERVAL (x) (x)@@ -108,15 +108,15 @@#define MT8173_NUM_SENSORS_PER_ZONE 4/* Layout of the fuses providing the calibration data */ -#define MT8173_CALIB_BUF0_VALID (1 << 0) -#define MT8173_CALIB_BUF1_ADC_GE (x) (((x) >> 22 ) & 0x3ff) -#define MT8173_CALIB_BUF0_VTS_TS1 (x) (((x) >> 17 ) & 0x1ff) -#define MT8173_CALIB_BUF0_VTS_TS2 (x) (((x) >> 8 ) & 0x1ff) -#define MT8173_CALIB_BUF1_VTS_TS3 (x) (((x) >> 0 ) & 0x1ff) -#define MT8173_CALIB_BUF2_VTS_TS4 (x) (((x) >> 23 ) & 0x1ff) -#define MT8173_CALIB_BUF2_VTS_TSABB (x) (((x) >> 14 ) & 0x1ff) -#define MT8173_CALIB_BUF0_DEGC_CALI (x) (((x) >> 1 ) & 0x3f) -#define MT8173_CALIB_BUF0_O_SLOPE (x) (((x) >> 26 ) & 0x3f) +#define MT8173_CALIB_BUF0_VALID BIT(0) +#define MT8173_CALIB_BUF1_ADC_GE (x) (((x) >> 22) & 0x3ff) +#define MT8173_CALIB_BUF0_VTS_TS1 (x) (((x) >> 17) & 0x1ff) +#define MT8173_CALIB_BUF0_VTS_TS2 (x) (((x) >> 8) & 0x1ff) +#define MT8173_CALIB_BUF1_VTS_TS3 (x) (((x) >> 0) & 0x1ff) +#define MT8173_CALIB_BUF2_VTS_TS4 (x) (((x) >> 23) & 0x1ff) +#define MT8173_CALIB_BUF2_VTS_TSABB (x) (((x) >> 14) & 0x1ff) +#define MT8173_CALIB_BUF0_DEGC_CALI (x) (((x) >> 1) & 0x3f) +#define MT8173_CALIB_BUF0_O_SLOPE (x) (((x) >> 26) & 0x3f)#define THERMAL_NAME "mtk-thermal"@@ -136,6 +136,7 @@ struct mtk_thermal {struct mtk_thermal_bank banks[MT8173_NUM_ZONES ]; +/* lock: for getting and putting banks */ struct mutex lock;/* Calibration values */ @@ -271,11 +272,9 @@ static void mtk_thermal_put_bank(struct mtk_thermal_bank *bank)static int mtk_thermal_bank_temperature (struct mtk_thermal_bank *bank) {struct mtk_thermal *mt = bank->mt; -int temp, i, max; +int i, temp =INT_MIN , max =INT_MIN ;u32 raw; - temp = max =INT_MIN ; -for (i =0 ; i < bank_data[bank->id].num_sensors; i++) { raw =readl (mt->thermal_base + sensing_points[i].msr);@@ -322,7 +321,7 @@ static const struct thermal_zone_of_device_ops mtk_thermal_ops = { };static void mtk_thermal_init_bank (struct mtk_thermal *mt,int num, -u32 apmixed_phys_base,u32 auxadc_phys_base) +u32 apmixed_phys_base,u32 auxadc_phys_base) {struct mtk_thermal_bank *bank = &mt->banks[num];const struct mtk_thermal_bank_cfg *cfg = &bank_data[num];@@ -346,7 +345,7 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,/* poll is set to 10u */ writel (TEMP_AHBPOLL_ADC_POLL_INTERVAL (768 ), - mt->thermal_base +TEMP_AHBPOLL ); + mt->thermal_base +TEMP_AHBPOLL );/* temperature sampling control, 1 sample */ writel (0x0 , mt->thermal_base +TEMP_MSRCTL0 );@@ -375,49 +374,50 @@ static void mtk_thermal_init_bank(struct mtk_thermal *mt, int num,/* AHB address for auxadc mux selection */ writel (auxadc_phys_base +AUXADC_CON1_CLR_V , - mt->thermal_base +TEMP_ADCMUXADDR ); + mt->thermal_base +TEMP_ADCMUXADDR );/* AHB address for pnp sensor mux selection */ writel (apmixed_phys_base +APMIXED_SYS_TS_CON1 , - mt->thermal_base +TEMP_PNPMUXADDR ); + mt->thermal_base +TEMP_PNPMUXADDR );/* AHB value for auxadc enable */ writel (BIT (MT8173_TEMP_AUXADC_CHANNEL ), mt->thermal_base +TEMP_ADCEN );/* AHB address for auxadc enable (channel 0 immediate mode selected) */ writel (auxadc_phys_base +AUXADC_CON1_SET_V , - mt->thermal_base +TEMP_ADCENADDR ); + mt->thermal_base +TEMP_ADCENADDR );/* AHB address for auxadc valid bit */ writel (auxadc_phys_base +AUXADC_DATA (MT8173_TEMP_AUXADC_CHANNEL ), - mt->thermal_base +TEMP_ADCVALIDADDR ); + mt->thermal_base +TEMP_ADCVALIDADDR );/* AHB address for auxadc voltage output */ writel (auxadc_phys_base +AUXADC_DATA (MT8173_TEMP_AUXADC_CHANNEL ), - mt->thermal_base +TEMP_ADCVOLTADDR ); + mt->thermal_base +TEMP_ADCVOLTADDR );/* read valid & voltage are at the same register */ writel (0x0 , mt->thermal_base +TEMP_RDCTRL );/* indicate where the valid bit is */ writel (TEMP_ADCVALIDMASK_VALID_HIGH |TEMP_ADCVALIDMASK_VALID_POS (12 ), - mt->thermal_base +TEMP_ADCVALIDMASK ); + mt->thermal_base +TEMP_ADCVALIDMASK );/* no shift */ writel (0x0 , mt->thermal_base +TEMP_ADCVOLTAGESHIFT );/* enable auxadc mux write transaction */ writel (TEMP_ADCWRITECTRL_ADC_MUX_WRITE , - mt->thermal_base +TEMP_ADCWRITECTRL ); + mt->thermal_base +TEMP_ADCWRITECTRL );for (i =0 ; i < cfg->num_sensors; i++)writel (sensor_mux_values[cfg->sensors[i]], - mt->thermal_base + sensing_points[i].adcpnp); + mt->thermal_base + sensing_points[i].adcpnp);writel ((1 << cfg->num_sensors) -1 , mt->thermal_base +TEMP_MONCTL0 ); -writel (TEMP_ADCWRITECTRL_ADC_PNP_WRITE |TEMP_ADCWRITECTRL_ADC_MUX_WRITE , - mt->thermal_base +TEMP_ADCWRITECTRL ); +writel (TEMP_ADCWRITECTRL_ADC_PNP_WRITE | +TEMP_ADCWRITECTRL_ADC_MUX_WRITE , + mt->thermal_base +TEMP_ADCWRITECTRL );mtk_thermal_put_bank (bank); }@@ -434,7 +434,8 @@ static u64 of_get_phys_base(struct device_node *np)return of_translate_address (np, regaddr_p); } -static int mtk_thermal_get_calibration_data (struct device *dev,struct mtk_thermal *mt) +static int mtk_thermal_get_calibration_data (struct device *dev, +struct mtk_thermal *mt) {struct nvmem_cell *cell;u32 *buf;@@ -567,7 +568,8 @@ static int mtk_thermal_probe(struct platform_device *pdev) }for (i =0 ; i <MT8173_NUM_ZONES ; i++) -mtk_thermal_init_bank (mt, i, apmixed_phys_base, auxadc_phys_base); +mtk_thermal_init_bank (mt, i, apmixed_phys_base, + auxadc_phys_base);platform_set_drvdata (pdev, mt);
Quoted 4 lines · Sascha Hauer
This series adds support for the thermal sensors included in the MT8173 SoC. Currently only basic temperature reading is supported without any interrupt support.
Merged v12.
Quoted 30 lines
fan: gpio_fan {
compatible = "gpio-fan";
gpios = <&pio 24 0>;
gpio-fan,speed-map = <0 0
4500 1>;
#cooling-cells = <2>;
};
thermal-zones {
cpu_thermal: cpu_thermal {
polling-delay-passive = <1000>; /* milliseconds */
polling-delay = <1000>; /* milliseconds */
thermal-sensors = <&thermal>;
trips {
cpu_passive: cpu_passive {
temperature = <47000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "passive";
};
cpu_crit {
temperature = <90000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "critical";
};
};Quoted 8 lines
cooling-maps {
map0 {
trip = <&cpu_passive>;
cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
};
};
};
};But, as usual, the dt changes go via your machine tree.
You may add my
in your DT patch.