Add support of New Amlogic temperature sensor for G12 SoCs
Subsystems (4)
Guillaume La Roque
maintainerv2 cover Add support of New Amlogic temperature sensor for G12 SoCs
This patchs series add support of New Amlogic temperature sensor and minimal thermal zone for SEI510 and ODROID-N2 boards.
First implementation was doing on IIO[1] but after comments i move on thermal framework. Formulas and calibration values come from amlogic.
Changes since v1:
- fix enum vs const in documentation for compatible
- fix error with thermal-sensor-cells value set to 1 instead of 0
- add some dependencies needed to add cooling-maps
Dependencies :
- patch 3,4 & 5: depends on Neil's patch and series :
- missing dwc2 phy-names[1]
- patchsets to add DVFS on G12a[3] which have deps on [4] and [5]
[1] https://lore.kernel.org/linux-amlogic/[email protected]/
[2] https://lore.kernel.org/linux-amlogic/[email protected]/
[3] https://lore.kernel.org/linux-amlogic/[email protected]/
[4] https://lore.kernel.org/linux-amlogic/[email protected]/
[5] https://lore.kernel.org/linux-amlogic/[email protected]/
Guillaume La Roque (6):
dt-bindings: thermal: Add DT bindings documentation for Amlogic
Thermal
thermal: amlogic: Add thermal driver to support G12 SoCs
arm64: dts: amlogic: g12: add temperature sensor
arm64: dts: meson: sei510: Add minimal thermal zone
arm64: dts: amlogic: odroid-n2: add minimal thermal zone
MAINTAINERS: add entry for Amlogic Thermal driver
.../bindings/thermal/amlogic,thermal.yaml | 58 +++ MAINTAINERS | 9 + .../boot/dts/amlogic/meson-g12-common.dtsi | 22 ++ .../boot/dts/amlogic/meson-g12a-sei510.dts | 56 +++ .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 60 ++++ drivers/thermal/Kconfig | 11 + drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 332 ++++++++++++++++++ 8 files changed, 549 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml create mode 100644 drivers/thermal/amlogic_thermal.c
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH v2 1/6 dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal
Adding the devicetree binding documentation for the Amlogic temperature sensor found in the Amlogic Meson G12 SoCs.
the G12A and G12B SoCs are supported.
--- .../bindings/thermal/amlogic,thermal.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +58 -0
@@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/amlogic,thermal.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Thermal Driver + +maintainers: + - Guillaume La Roque <[email protected]> + +description: Amlogic Thermal driver + +properties: + compatible: + oneOf: + - items: + - enum: + - amlogic,g12-cpu-thermal + - amlogic,g12-ddr-thermal + - const: + - amlogic,g12-thermal + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + amlogic,ao-secure: + description: phandle to the ao-secure syscon + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + + +required: + - compatible + - reg + - interrupts + - clocks + - amlogic,ao-secure + +examples: + - | + cpu_temp: temperature-sensor@ff634800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0xff634800 0x0 0x50>; + interrupts = <0x0 0x24 0x0>; + clocks = <&clk 164>; + status = "okay"; + #thermal-sensor-cells = <0>; + amlogic,ao-secure = <&sec_AO>; + }; +...
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v2 1/6] dt-bindings: thermal: Add DT bindings documentation for Amlogic Thermal
Quoted 17 lines · Guillaume La Roque
Adding the devicetree binding documentation for the Amlogic temperature sensor found in the Amlogic Meson G12 SoCs.
the G12A and G12B SoCs are supported.Signed-off-by Guillaume La Roque <[email protected]>--- .../bindings/thermal/amlogic,thermal.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/amlogic,thermal.yamlDocumentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +0
-0
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 7
Quoted 7 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +7
-0@@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/amlogic,thermal.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic Thermal Driver
This is not a driver.
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 16
Quoted 9 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +9
-0+ +maintainers: + - Guillaume La Roque <[email protected]> + +description: Amlogic Thermal driver + +properties: + compatible: + oneOf:
oneOf is not necessary as there is only one of.
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 22
Quoted 6 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +6
-0+ - items: + - enum: + - amlogic,g12-cpu-thermal + - amlogic,g12-ddr-thermal + - const: + - amlogic,g12-thermal
Please run 'make dt_binding_check'. You'll find this is not valid json-schema.
Quoted 19 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +19
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + amlogic,ao-secure: + description: phandle to the ao-secure syscon + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + + +required: + - compatible + - reg
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 51
Quoted 10 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +10
-0+ - interrupts + - clocks + - amlogic,ao-secure + +examples: + - | + cpu_temp: temperature-sensor@ff634800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0xff634800 0x0 0x50>;
Examples are built now and this will have an error. The default address and size cells are 1 for examples, so you either have to override them or adjust this.
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml line 54
Quoted 3 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +3
-0+ interrupts = <0x0 0x24 0x0>; + clocks = <&clk 164>; + status = "okay";
Don't show status in examples.
Quoted 8 lines
Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml new file +4
-1+ #thermal-sensor-cells = <0>; + amlogic,ao-secure = <&sec_AO>; + }; +... --2.17.1
Guillaume La Roque
maintainerPATCH v2 2/6 thermal: amlogic: Add thermal driver to support G12 SoCs
In reply to Guillaume La Roque--- drivers/thermal/Kconfig | 11 + drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 332 ++++++++++++++++++++++++++++++ 3 files changed, 344 insertions(+) create mode 100644 drivers/thermal/amlogic_thermal.c
drivers/thermal/Kconfig +11 -0
@@ -348,6 +348,17 @@ config MTK_THERMAL Enable this option if you want to have support for thermal management controller present in Mediatek SoCs +config AMLOGIC_THERMAL + tristate "Amlogic Thermal Support" + default ARCH_MESON + depends on OF && ARCH_MESON + help + If you say yes here you get support for Amlogic Thermal + for G12 SoC Family. + + This driver can also be built as a module. If so, the module will + be called amlogic_thermal. + menu "Intel thermal drivers" depends on X86 || X86_INTEL_QUARK || COMPILE_TEST source "drivers/thermal/intel/Kconfig"
drivers/thermal/Makefile +1 -0
@@ -54,3 +54,4 @@ obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o +obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
drivers/thermal/amlogic_thermal.c new file +332 -0
332 lines not on this page · raw message
Signature · 1 line
2.17.1
Martin Blumenstingl
reviewerRe: [PATCH v2 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs
Hi Guillaume,
(I still don't have any experience with the thermal framework, so below are some general comments)
On Wed, Jul 31, 2019 at 5:36 PM Guillaume La Roque <[email protected]> wrote:
I would add a patch description here:
"
Amlogic G12A and G12B SoCs integrate two thermal sensors with the same design. One is located close to the DDR (controller?) and the other one is located close to the PLLs (between the CPU and GPU).
The calibration data for each of the thermal sensors instance is stored in a different location within the AO region.
Implement reading the temperature from each thermal sensor.
The IP block has more functionality, which may be added to this driver in the future:
- reading up to 16 stored temperature samples
- chip reset when the temperature exceeds a configurable threshold
- up to four interrupts when the temperature has risen above a configurable threshold
- up to four interrupts when the temperature has fallen below a configurable threshold
"
Quoted 13 lines
Signed-off-by Guillaume La Roque <[email protected]>--- drivers/thermal/Kconfig | 11 + drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 332 ++++++++++++++++++++++++++++++ 3 files changed, 344 insertions(+) create mode 100644 drivers/thermal/amlogic_thermal.cdrivers/thermal/Kconfig +0
-0
drivers/thermal/Kconfig config MTK_THERMAL · line 351
Quoted 4 lines
drivers/thermal/Kconfig +1
-0@@ -348,6 +348,17 @@ config MTK_THERMAL Enable this option if you want to have support for thermal management controller present in Mediatek SoCs +config AMLOGIC_THERMAL
we typically use "MESON" in the Kconfig symbols:
$ grep -c AMLOGIC .config 1 $ grep -c MESON .config 33
I also wonder if we should add G12 or G12A so we don't conflict with upcoming thermal sensors with a different design (assuming that this will be a thing).
for example we already have three different USB2 PHY drivers
[...]
drivers/thermal/Kconfig config MTK_THERMAL · line 354
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+/* + * Calculate a temperature value from a temperature code. + * The unit of the temperature is degree Celsius.
is it really degree Celsius or millicelsius?
drivers/thermal/Kconfig config MTK_THERMAL · line 356
Quoted 2 lines
drivers/thermal/Kconfig +2
-0+ */ +static int code_to_temp(struct amlogic_thermal *pdata, int temp_code)
PREFIX_thermal_code_to_millicelsius?
[...]
drivers/thermal/Kconfig config MTK_THERMAL · line 359
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+static int amlogic_thermal_enable(struct amlogic_thermal *data) +{ + clk_prepare_enable(data->clk);
no clock error handling?
drivers/thermal/Kconfig config MTK_THERMAL
Quoted 11 lines
drivers/thermal/Kconfig +11
-0+ regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, + TSENSOR_CFG_REG1_ENABLE, TSENSOR_CFG_REG1_ENABLE); + + return 0; +} + +static int amlogic_thermal_disable(struct amlogic_thermal *data) +{ + regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, + TSENSOR_CFG_REG1_ENABLE, 0); + clk_disable(data->clk);
either clk_disable_unprepare here or use only clk_enable in amlogic_thermal_enable and move prepare/unprepare somewhere else
Quoted 5 lines
drivers/thermal/Kconfig +5
-0+ + return 0; +} + +static int amlogic_thermal_get_temp(void *data, int *temp)
drivers/thermal/Kconfig
Quoted 10 lines
drivers/thermal/Kconfig +10
-0+{ + unsigned int tvalue; + struct amlogic_thermal *pdata = data; + + if (!data) + return -EINVAL; + + regmap_read(pdata->regmap, TSENSOR_STAT0, &tvalue); + *temp = code_to_temp(pdata, + tvalue & TSENSOR_READ_TEMP_MASK);
maybe simply move the implementation from code_to_temp here?
[...]
drivers/thermal/Kconfig
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+static const struct amlogic_thermal_data amlogic_thermal_g12_cpu_param = { + .u_efuse_off = 0x128, + .soc = &amlogic_thermal_g12,
based on the variable name I expected this to be an enum of some sort. I would have expected it to be called calibration_parameters or similar to match the explanation in the driver description (no need to change it if you prefer it like this, I just want to make you aware of this)
Quoted 1 line
+ .regmap_config =
&amlogic_thermal_regmap_config_g12,
if regmap_config is always the same you may also pass it directly to devm_regmap_init_mmio
drivers/thermal/Kconfig
Quoted 4 lines
drivers/thermal/Kconfig +4
-0+}; + +static const struct amlogic_thermal_data amlogic_thermal_g12_ddr_param = { + .u_efuse_off = 0xF0,
I believe we use lower-case hex everywhere else
[...]
drivers/thermal/Kconfig
Quoted 10 lines
drivers/thermal/Kconfig +10
-0+static const struct of_device_id of_amlogic_thermal_match[] = { + { + .compatible = "amlogic,g12-ddr-thermal", + .data = &amlogic_thermal_g12_ddr_param, + }, + { + .compatible = "amlogic,g12-cpu-thermal", + .data = &amlogic_thermal_g12_cpu_param, + }, + { /* end */ }
other drivers use "sentinel", but personally I have no preference here
[...]
drivers/thermal/Kconfig
Quoted 5 lines
drivers/thermal/Kconfig +5
-0+ pdata->tzd = devm_thermal_zone_of_sensor_register + (&pdev->dev, + 0, + pdata, + &amlogic_thermal_ops);
I believe the opening brace has to go onto the same line as the function name
[...]
drivers/thermal/Kconfig
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+ ret = amlogic_thermal_enable(pdata); + if (ret) + clk_unprepare(pdata->clk);
clk_disable_unprepare, else you'll leave the clock prepared
Quoted 5 lines
drivers/thermal/Kconfig +5
-0+#ifdef CONFIG_PM_SLEEP +static int amlogic_thermal_suspend(struct device *dev) +{ + struct amlogic_thermal *data = dev_get_drvdata(dev); +
drivers/thermal/Kconfig
Quoted 10 lines
drivers/thermal/Kconfig +10
-0+ return amlogic_thermal_disable(data); +} + +static int amlogic_thermal_resume(struct device *dev) +{ + struct amlogic_thermal *data = dev_get_drvdata(dev); + + return amlogic_thermal_enable(data); +} +#endif
instead of using an #ifdef here annotate the suspend/resume functions with __maybe_unused, see [0]
Martin
guillaume La Roque
maintainerRe: [PATCH v2 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs
Hi Martin,
again thanks for your review.
Quoted 13 lines · Martin Blumenstingl
Hi Guillaume,
(I still don't have any experience with the thermal framework, so below are some general comments)
On Wed, Jul 31, 2019 at 5:36 PM Guillaume La Roque <[email protected]> wrote:
I would add a patch description here:
"
Amlogic G12A and G12B SoCs integrate two thermal sensors with the same design. One is located close to the DDR (controller?) and the other one is located close to the PLLs (between the CPU and GPU).
Quoted 8 lines
The calibration data for each of the thermal sensors instance is stored in a different location within the AO region.
Implement reading the temperature from each thermal sensor.
The IP block has more functionality, which may be added to this driver in the future:
- reading up to 16 stored temperature samples
it's not working, you can verify it if you check the regmap define in the driver. in fact temp is only write in one register, it's confirmed by amlogic.
Quoted 6 lines
- chip reset when the temperature exceeds a configurable threshold
- up to four interrupts when the temperature has risen above a configurable threshold
- up to four interrupts when the temperature has fallen below a configurable threshold
"
agreed with you to add description and optional without 16 register part.
Quoted 24 lines
Quoted 14 lines
Signed-off-by Guillaume La Roque <[email protected]>--- drivers/thermal/Kconfig | 11 + drivers/thermal/Makefile | 1 + drivers/thermal/amlogic_thermal.c | 332 ++++++++++++++++++++++++++++++ 3 files changed, 344 insertions(+) create mode 100644 drivers/thermal/amlogic_thermal.cdrivers/thermal/Kconfig +0
-0drivers/thermal/Kconfig config MTK_THERMAL · line 351
Quoted 4 lines
drivers/thermal/Kconfig +1
-0@@ -348,6 +348,17 @@ config MTK_THERMAL Enable this option if you want to have support for thermal management controller present in Mediatek SoCs +config AMLOGIC_THERMALwe typically use "MESON" in the
Kconfigsymbols:$ grep -c AMLOGIC .config 1 $ grep -c MESON .config 33
Quoted 6 lines
I also wonder if we should add G12 or G12A so we don't conflict with upcoming thermal sensors with a different design (assuming that this will be a thing).
for example we already have three different USB2 PHY drivers[...]
i check with Neil and for new family it's better to use Amlogic instead of meson.
i don't add G12 because we already know it's same sensors for SM1 SoC family [0].
Quoted 4 lines
drivers/thermal/Kconfig config MTK_THERMAL · line 354
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+/* + * Calculate a temperature value from a temperature code. + * The unit of the temperature is degree Celsius.is it really degree Celsius or millicelsius?
good point it's in millicelsius, i will fix all
Quoted 4 lines
drivers/thermal/Kconfig config MTK_THERMAL · line 356
Quoted 3 lines
drivers/thermal/Kconfig +2
-0+ */ +static int code_to_temp(struct amlogic_thermal *pdata, int temp_code)
PREFIX_thermal_code_to_millicelsius?
ok
Quoted 5 lines
[...]
drivers/thermal/Kconfig
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+static int amlogic_thermal_enable(struct amlogic_thermal *data) +{ + clk_prepare_enable(data->clk);no clock error handling?
i will fix
Quoted 14 lines
drivers/thermal/Kconfig
Quoted 12 lines
drivers/thermal/Kconfig +11
-0+ regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, + TSENSOR_CFG_REG1_ENABLE, TSENSOR_CFG_REG1_ENABLE); + + return 0; +} + +static int amlogic_thermal_disable(struct amlogic_thermal *data) +{ + regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, + TSENSOR_CFG_REG1_ENABLE, 0); + clk_disable(data->clk);either
clk_disable_unpreparehere or use onlyclk_enableinamlogic_thermal_enableand move prepare/unprepare somewhere else
i will align with enable and use clk_disable_unprepare
Quoted 17 lines
Quoted 6 lines
drivers/thermal/Kconfig +5
-0+ + return 0; +} + +static int amlogic_thermal_get_temp(void *data, int *temp)drivers/thermal/Kconfig
Quoted 10 lines
drivers/thermal/Kconfig +10
-0+{ + unsigned int tvalue; + struct amlogic_thermal *pdata = data; + + if (!data) + return -EINVAL; + + regmap_read(pdata->regmap, TSENSOR_STAT0, &tvalue); + *temp = code_to_temp(pdata, + tvalue & TSENSOR_READ_TEMP_MASK);maybe simply move the implementation from
code_to_temphere?
for the optional function it could be a problem if i move all in code_to_temp.
i prefer to have a function which are just do the conversion.
Quoted 10 lines
[...]
drivers/thermal/Kconfig
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+static const struct amlogic_thermal_data amlogic_thermal_g12_cpu_param = { + .u_efuse_off = 0x128, + .soc = &amlogic_thermal_g12,based on the variable name I expected this to be an enum of some sort. I would have expected it to be called
calibration_parametersor similar to match the explanation in the driver description (no need to change it if you prefer it like this, I just want to make you aware of this)
ok to rename structure name
Quoted 4 lines
Quoted 2 lines
+ .regmap_config =
&amlogic_thermal_regmap_config_g12,if
regmap_configis always the same you may also pass it directly todevm_regmap_init_mmio
it's the same for now but we don't know if in the future SoCs use same regmap.
Quoted 8 lines
drivers/thermal/Kconfig
Quoted 5 lines
drivers/thermal/Kconfig +4
-0+}; + +static const struct amlogic_thermal_data amlogic_thermal_g12_ddr_param = { + .u_efuse_off = 0xF0,I believe we use lower-case hex everywhere else
[...]
will fix
Quoted 10 lines
drivers/thermal/Kconfig
Quoted 10 lines
drivers/thermal/Kconfig +10
-0+static const struct of_device_id of_amlogic_thermal_match[] = { + { + .compatible = "amlogic,g12-ddr-thermal", + .data = &amlogic_thermal_g12_ddr_param, + }, + { + .compatible = "amlogic,g12-cpu-thermal", + .data = &amlogic_thermal_g12_cpu_param, + }, + { /* end */ }
Quoted 3 lines
other drivers use "sentinel", but personally I have no preference here
[...]
same for me i will do same as other drivers
Quoted 8 lines
drivers/thermal/Kconfig
Quoted 5 lines
drivers/thermal/Kconfig +5
-0+ pdata->tzd = devm_thermal_zone_of_sensor_register + (&pdev->dev, + 0, + pdata, + &amlogic_thermal_ops);I believe the opening brace has to go onto the same line as the function name
[...]
will fix
Quoted 4 lines
drivers/thermal/Kconfig
Quoted 3 lines
drivers/thermal/Kconfig +3
-0+ ret = amlogic_thermal_enable(pdata); + if (ret) + clk_unprepare(pdata->clk);
clk_disable_unprepare, else you'll leave the clock prepared
will fix
Quoted 10 lines
Quoted 10 lines
drivers/thermal/Kconfig +9
-0+#ifdef CONFIG_PM_SLEEP +static int amlogic_thermal_suspend(struct device *dev) +{ + struct amlogic_thermal *data = dev_get_drvdata(dev); + + return amlogic_thermal_disable(data); +} + +static int amlogic_thermal_resume(struct device *dev)
Quoted 8 lines
drivers/thermal/Kconfig
Quoted 6 lines
drivers/thermal/Kconfig +6
-0+{ + struct amlogic_thermal *data = dev_get_drvdata(dev); + + return amlogic_thermal_enable(data); +} +#endifinstead of using an #ifdef here annotate the suspend/resume functions with
__maybe_unused, see [0]
will fix
Quoted 6 lines
Martin
[0] https://lore.kernel.org/linux-arm-kernel/[email protected]/
thanks
Guillaume
Martin Blumenstingl
reviewerRe: [PATCH v2 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs
Hi Guillaume,
Quoted 4 lines · guillaume La Roque
Hi Martin,
again thanks for your review.
you're welcome - thank you for working on the driver :-)
[...]
Quoted 5 lines
Quoted 3 lines
The IP block has more functionality, which may be added to this driver in the future:
- reading up to 16 stored temperature samplesit's not working, you can verify it if you check the regmap define in the driver. in fact temp is only write in one register, it's confirmed by amlogic.
I missed that - so please skip this part
[...]
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+config
AMLOGIC_THERMALwe typically use "MESON" in the
Kconfigsymbols:$ grep -c AMLOGIC .config 1 $ grep -c MESON .config 33
Quoted 8 lines
Quoted 6 lines
I also wonder if we should add G12 or G12A so we don't conflict with upcoming thermal sensors with a different design (assuming that this will be a thing).
for example we already have three different USB2 PHY drivers[...]
i check with Neil and for new family it's better to use Amlogic instead of meson.
can you please share the considerations behind this decision? if new drivers should use AMLOGIC_* Kconfig symbols instead of MESON_* then we all should know about it
Quoted 1 line
i don't add G12 because we already know it's same sensors for SM1 SoC family [0].
my idea behind this was to avoid conflicts in the future
in case of the thermal driver we may be fine with using a generic name assuming that Amlogic will not switch to a new IP block in the next years
I'm not saying you have to change the name - I'm bringing this up so you can decide for yourself based on examples from the past
here are a few examples:
- when Kevin upstreamed the MMC driver for GX he decided to use MMC_MESON_GX for the Kconfig symbol name. it turns out that this is smart because there are at least two other MMC controller IPs on the 32-bit SoCs. due to him including GX in the name the drivers are easy to differentiate (MMC_MESON_MX_SDIO and MMC_MESON_MX_SDHC being the other ones, while the latter is not upstream yet)
- when Carlo upstreamed the eFuse driver he decided to use MESON_EFUSE for the Kconfig symbol name. I found out much later that the 32-bit SoCs use a different IP (or at least direct register access instead of going through Secure Monitor). the driver for the 32-bit SoCs now uses MESON_MX_EFUSE. if you don't know which driver applies where then it's easy to mix up MESON_EFUSE and MESON_MX_EFUSE
- when Jerome upstreamed the ALSA driver for AXG (which is also used on G12A and G12B) he decided to use the SND_MESON_AXG_* prefix for the Kconfig symbol names. in my opinion this was a good choice because GXM and everything earlier (including the 32-bit SoCs) use a different audio IP block. we won't have a Kconfig symbol name clash when a driver for the "older" SoCs is upstreamed
- (there are more examples, Meson8b USB PHY driver, Meson8b DWMAC glue, ... - just like there's many examples where the IP block is mostly compatible with older generations: SAR ADC, RNG, SPI, ...)
I'm not sure what driver naming rules other mainline SoC teams use to me it seems that the rule for Allwinner driver names is to use the "code-name of the first SoC the IP block appeared in"
[...]
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/thermal/amlogic_thermal.c new file +4
-0+static int amlogic_thermal_get_temp (void *data,int *temp) +{ +unsigned int tvalue; +struct amlogic_thermal *pdata = data;Quoted 8 lines
drivers/thermal/amlogic_thermal.c line 181
Quoted 7 lines
drivers/thermal/amlogic_thermal.c new file +7
-0+ +if (!data) +return -EINVAL ; + +regmap_read (pdata->regmap,TSENSOR_STAT0 , &tvalue); + *temp =code_to_temp (pdata, + tvalue &TSENSOR_READ_TEMP_MASK );maybe simply move the implementation from
code_to_temphere?
Quoted 3 lines
for the optional function it could be a problem if i move all in
code_to_temp.i prefer to have a function which are just do the conversion.
I didn't consider this before but you are right
if the other temperature registers (like IRQ thresholds) also use a "temperature code" then it should be a dedicated function (so it'll be easier to add more functionality to the driver)
Martin
Kevin Hilman
maintainerRe: [PATCH v2 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs
Quoted 59 lines · Martin Blumenstingl
Hi Guillaume,
Quoted 4 lines · guillaume La Roque
Hi Martin,
again thanks for your review.
you're welcome - thank you for working on the driver :-)
[...]
Quoted 5 lines
Quoted 3 lines
The IP block has more functionality, which may be added to this driver in the future:
- reading up to 16 stored temperature samplesit's not working, you can verify it if you check the regmap define in the driver. in fact temp is only write in one register, it's confirmed by amlogic.
I missed that - so please skip this part
[...]
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+config
AMLOGIC_THERMALwe typically use "MESON" in the
Kconfigsymbols:$ grep -c AMLOGIC .config 1 $ grep -c MESON .config 33Quoted 8 lines
Quoted 6 lines
I also wonder if we should add G12 or G12A so we don't conflict with upcoming thermal sensors with a different design (assuming that this will be a thing).
for example we already have three different USB2 PHY drivers[...]
i check with Neil and for new family it's better to use Amlogic instead of meson.
can you please share the considerations behind this decision? if new drivers should use AMLOGIC_*
Kconfigsymbols instead of MESON_* then we all should know about itQuoted 1 line
i don't add G12 because we already know it's same sensors for SM1 SoC family [0].
my idea behind this was to avoid conflicts in the future
in case of the thermal driver we may be fine with using a generic name assuming that Amlogic will not switch to a new IP block in the next years
I'm not saying you have to change the name - I'm bringing this up so you can decide for yourself based on examples from the pasthere are a few examples:
- when Kevin upstreamed the MMC driver for GX he decided to useMMC_MESON_GXfor theKconfigsymbol name. it turns out that this is smart because there are at least two other MMC controller IPs on the 32-bit SoCs. due to him including GX in the name the drivers are easy to differentiate (MMC_MESON_MX_SDIOandMMC_MESON_MX_SDHCbeing the other ones, while the latter is not upstream yet)
- when Carlo upstreamed the eFuse driver he decided to useMESON_EFUSEfor theKconfigsymbol name. I found out much later that the 32-bit SoCs use a different IP (or at least direct register access instead of going through Secure Monitor). the driver for the 32-bit SoCs now usesMESON_MX_EFUSE. if you don't know which driver applies where then it's easy to mix upMESON_EFUSEandMESON_MX_EFUSE
- when Jerome upstreamed the ALSA driver for AXG (which is also used
Quoted 8 lines
on G12A and G12B) he decided to use the SND_MESON_AXG_* prefix for the
Kconfigsymbol names. in my opinion this was a good choice because GXM and everything earlier (including the 32-bit SoCs) use a different audio IP block. we won't have aKconfigsymbol name clash when a driver for the "older" SoCs is upstreamed
- (there are more examples, Meson8b USB PHY driver, Meson8b DWMAC glue, ... - just like there's many examples where the IP block is mostly compatible with older generations: SAR ADC, RNG, SPI, ...)
While these are all good examples, you can see it can go both ways, so there's really no way know up front what is the "right" way. We only know after the fact. Unfortunately, we simply have no visibility into future chips and where IP blocks may be shared or not (there are other examples where vendors add a new version of an IP *and* keep the old version. ;)
Even having worked inside a (different) SoC vendor and having some knowledge about what IPs are shared, it's difficult to get this right.
Quoted 3 lines
I'm not sure what driver naming rules other mainline SoC teams use to me it seems that the rule for Allwinner driver names is to use the "code-name of the first SoC the IP block appeared in"
That's a good rule of thumb (and one we generally follow) but I don't feel it's important enough to enforce strictly either.
Kevin
Martin Blumenstingl
reviewerRe: [PATCH v2 2/6] thermal: amlogic: Add thermal driver to support G12 SoCs
Hi Kevin,
Quoted 78 lines · Kevin Hilman
Quoted 59 lines · Martin Blumenstingl
Hi Guillaume,
Quoted 4 lines · guillaume La Roque
Hi Martin,
again thanks for your review.
you're welcome - thank you for working on the driver :-)
[...]
Quoted 5 lines
Quoted 3 lines
The IP block has more functionality, which may be added to this driver in the future:
- reading up to 16 stored temperature samplesit's not working, you can verify it if you check the regmap define in the driver. in fact temp is only write in one register, it's confirmed by amlogic.
I missed that - so please skip this part
[...]
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
+config
AMLOGIC_THERMALwe typically use "MESON" in the
Kconfigsymbols:$ grep -c AMLOGIC .config 1 $ grep -c MESON .config 33Quoted 8 lines
Quoted 6 lines
I also wonder if we should add G12 or G12A so we don't conflict with upcoming thermal sensors with a different design (assuming that this will be a thing).
for example we already have three different USB2 PHY drivers[...]
i check with Neil and for new family it's better to use Amlogic instead of meson.
can you please share the considerations behind this decision? if new drivers should use AMLOGIC_*
Kconfigsymbols instead of MESON_* then we all should know about itQuoted 1 line
i don't add G12 because we already know it's same sensors for SM1 SoC family [0].
my idea behind this was to avoid conflicts in the future
in case of the thermal driver we may be fine with using a generic name assuming that Amlogic will not switch to a new IP block in the next years
I'm not saying you have to change the name - I'm bringing this up so you can decide for yourself based on examples from the pasthere are a few examples:
- when Kevin upstreamed the MMC driver for GX he decided to useMMC_MESON_GXfor theKconfigsymbol name. it turns out that this is smart because there are at least two other MMC controller IPs on the 32-bit SoCs. due to him including GX in the name the drivers are easy to differentiate (MMC_MESON_MX_SDIOandMMC_MESON_MX_SDHCbeing the other ones, while the latter is not upstream yet)
- when Carlo upstreamed the eFuse driver he decided to useMESON_EFUSEfor theKconfigsymbol name. I found out much later that the 32-bit SoCs use a different IP (or at least direct register access instead of going through Secure Monitor). the driver for the 32-bit SoCs now usesMESON_MX_EFUSE. if you don't know which driver applies where then it's easy to mix upMESON_EFUSEandMESON_MX_EFUSE
- when Jerome upstreamed the ALSA driver for AXG (which is also usedQuoted 8 lines
on G12A and G12B) he decided to use the SND_MESON_AXG_* prefix for the
Kconfigsymbol names. in my opinion this was a good choice because GXM and everything earlier (including the 32-bit SoCs) use a different audio IP block. we won't have aKconfigsymbol name clash when a driver for the "older" SoCs is upstreamed
- (there are more examples, Meson8b USB PHY driver, Meson8b DWMAC glue, ... - just like there's many examples where the IP block is mostly compatible with older generations: SAR ADC, RNG, SPI, ...)While these are all good examples, you can see it can go both ways, so there's really no way know up front what is the "right" way. We only know after the fact. Unfortunately, we simply have no visibility into future chips and where IP blocks may be shared or not (there are other examples where vendors add a new version of an IP *and* keep the old version. ;)
Quoted 2 lines
Even having worked inside a (different) SoC vendor and having some knowledge about what IPs are shared, it's difficult to get this right.
right. The fact that it'll be the IP block in SM1 will be backwards compatible (or even the same) means that it has a longer life-span than some of the USB PHY IP.
so I'm fine either way
Martin
Guillaume La Roque
maintainerPATCH v2 3/6 arm64: dts: amlogic: g12: add temperature sensor
In reply to Guillaume La RoqueAdd cpu and ddr temperature sensors for G12 Socs
--- .../boot/dts/amlogic/meson-g12-common.dtsi | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +22 -0
@@ -1353,6 +1353,28 @@ }; }; + cpu_temp: temperature-sensor@34800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34800 0x0 0x50>; + interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc CLKID_TS>; + status = "okay"; + #thermal-sensor-cells = <0>; + amlogic,ao-secure = <&sec_AO>; + }; + + ddr_temp: temperature-sensor@34c00 { + compatible = "amlogic,g12-ddr-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34c00 0x0 0x50>; + interrupts = <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc CLKID_TS>; + status = "okay"; + #thermal-sensor-cells = <0>; + amlogic,ao-secure = <&sec_AO>; + }; + usb2_phy0: phy@36000 { compatible = "amlogic,g12a-usb2-phy"; reg = <0x0 0x36000 0x0 0x2000>;
Signature · 1 line
2.17.1
Re: [PATCH v2 3/6] arm64: dts: amlogic: g12: add temperature sensor
Hi Guillaume,
Quoted 4 lines · Guillaume La Roque
Add cpu and ddr temperature sensors for G12 Socs
Signed-off-by Guillaume La Roque <[email protected]>
with the nit-pick below addressed:
Quoted 9 lines
--- .../boot/dts/amlogic/meson-g12-common.dtsi | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0
-0
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi line 1362
Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +7
-0@@ -1353,6 +1353,28 @@ }; }; + cpu_temp: temperature-sensor@34800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34800 0x0 0x50>; + interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc CLKID_TS>; + status = "okay";
I believe nodes are enabled automatically if they don't have a status property
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi line 1373
Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +11
-0+ #thermal-sensor-cells = <0>; + amlogic,ao-secure = <&sec_AO>; + }; + + ddr_temp: temperature-sensor@34c00 { + compatible = "amlogic,g12-ddr-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34c00 0x0 0x50>; + interrupts = <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc CLKID_TS>; + status = "okay";
same here
Martin
guillaume La Roque
maintainerRe: [PATCH v2 3/6] arm64: dts: amlogic: g12: add temperature sensor
hi Martin,
thanks for comments i will fix in v3.
guillaume
Quoted 46 lines · Martin Blumenstingl
Hi Guillaume,
Quoted 3 lines · Guillaume La Roque
Add cpu and ddr temperature sensors for G12 Socs
Signed-off-by Guillaume La Roque <[email protected]>with the nit-pick below addressed:
Reviewed-by Martin Blumenstingl <[email protected]>Quoted 9 lines
--- .../boot/dts/amlogic/meson-g12-common.dtsi | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0
-0arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi line 1362
Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +7
-0@@ -1353,6 +1353,28 @@ }; }; + cpu_temp: temperature-sensor@34800 { + compatible = "amlogic,g12-cpu-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34800 0x0 0x50>; + interrupts = <GIC_SPI 35 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc CLKID_TS>; + status = "okay";I believe nodes are enabled automatically if they don't have a status property
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi line 1373
Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +11
-0+ #thermal-sensor-cells = <0>; + amlogic,ao-secure = <&sec_AO>; + }; + + ddr_temp: temperature-sensor@34c00 { + compatible = "amlogic,g12-ddr-thermal", + "amlogic,g12-thermal"; + reg = <0x0 0x34c00 0x0 0x50>; + interrupts = <GIC_SPI 36 IRQ_TYPE_EDGE_RISING>; + clocks = <&clkc CLKID_TS>; + status = "okay";same here
Martin
Guillaume La Roque
maintainerPATCH v2 4/6 arm64: dts: meson: sei510: Add minimal thermal zone
In reply to Guillaume La RoqueAdd minimal thermal zone for DDR and CPU sensor
--- .../boot/dts/amlogic/meson-g12a-sei510.dts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +56 -0
@@ -10,6 +10,7 @@ #include <dt-bindings/input/input.h> #include <dt-bindings/gpio/meson-g12a-gpio.h> #include <dt-bindings/sound/meson-g12a-tohdmitx.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "seirobotics,sei510", "amlogic,g12a";
@@ -33,6 +34,53 @@ ethernet0 = ðmac; }; + thermal-zones { + cpu-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp>; + + trips { + cpu_critical: cpu-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_critical>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + ddr-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp>; + + trips { + ddr_critical: ddr-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_critical>; + cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + mono_dac: audio-codec-0 { compatible = "maxim,max98357a"; #sound-dai-cells = <0>;
@@ -321,6 +369,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu1 {
@@ -328,6 +377,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu2 {
@@ -335,6 +385,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu3 {
@@ -342,6 +393,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cvbs_vdac_port {
@@ -368,6 +420,10 @@ status = "okay"; }; +&mali { + #cooling-cells = <2>; +}; + &hdmi_tx { status = "okay"; pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
Signature · 1 line
2.17.1
Martin Blumenstingl
reviewerRe: [PATCH v2 4/6] arm64: dts: meson: sei510: Add minimal thermal zone
Hi Guillaume,
Quoted 2 lines · Guillaume La Roque
Add minimal thermal zone for DDR and CPU sensor
so high DDR (controller?) temperatures will throttle Mali and high PLL temperatures will throttle the CPU?
to get things started I'm fine with this, but I think it should be mentioned here
Quoted 104 lines
Signed-off-by Guillaume La Roque <[email protected]>--- .../boot/dts/amlogic/meson-g12a-sei510.dts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+)arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +52
-0@@ -10,6 +10,7 @@ #include <dt-bindings/input/input.h> #include <dt-bindings/gpio/meson-g12a-gpio.h> #include <dt-bindings/sound/meson-g12a-tohdmitx.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "seirobotics,sei510", "amlogic,g12a";@@ -33,6 +34,53 @@ ethernet0 = ðmac; }; + thermal-zones { + cpu-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp>; + + trips { + cpu_critical: cpu-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_critical>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + ddr-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp>; + + trips { + ddr_critical: ddr-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_critical>; + cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + mono_dac: audio-codec-0 { compatible = "maxim,max98357a"; #sound-dai-cells = <0>;@@ -321,6 +369,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu1 {@@ -328,6 +377,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu2 {@@ -335,6 +385,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu3 {@@ -342,6 +393,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cvbs_vdac_port {
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts line 425
Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +3
-0@@ -368,6 +420,10 @@ status = "okay"; }; +&mali { + #cooling-cells = <2>; +};
is there something device-specific in this patch? I'm wondering whether we can move all of this go g12a.dtsi to simplify maintenance in the future
Martin
guillaume La Roque
maintainerRe: [PATCH v2 4/6] arm64: dts: meson: sei510: Add minimal thermal zone
Hi Martin,
Quoted 9 lines · Martin Blumenstingl
Hi Guillaume,
Quoted 1 line · Guillaume La Roque
Add minimal thermal zone for DDR and CPU sensor
so high DDR (controller?) temperatures will throttle Mali and high PLL temperatures will throttle the CPU?
to get things started I'm fine with this, but I think it should be mentioned here
i will add in commit description
Quoted 108 lines
Quoted 108 lines
Signed-off-by Guillaume La Roque <[email protected]>--- .../boot/dts/amlogic/meson-g12a-sei510.dts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+)arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +52
-0@@ -10,6 +10,7 @@ #include <dt-bindings/input/input.h> #include <dt-bindings/gpio/meson-g12a-gpio.h> #include <dt-bindings/sound/meson-g12a-tohdmitx.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "seirobotics,sei510", "amlogic,g12a";@@ -33,6 +34,53 @@ ethernet0 = ðmac; }; + thermal-zones { + cpu-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp>; + + trips { + cpu_critical: cpu-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_critical>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + ddr-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp>; + + trips { + ddr_critical: ddr-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_critical>; + cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + mono_dac: audio-codec-0 { compatible = "maxim,max98357a"; #sound-dai-cells = <0>;@@ -321,6 +369,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu1 {@@ -328,6 +377,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu2 {@@ -335,6 +385,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu3 {@@ -342,6 +393,7 @@ operating-points-v2 = <&cpu_opp_table>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cvbs_vdac_port {@@ -368,6 +420,10 @@ status = "okay"; };
Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts line 425
Quoted 3 lines
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +3
-0+&mali { + #cooling-cells = <2>; +};is there something device-specific in this patch? I'm wondering whether we can move all of this go
g12a.dtsito simplify maintenance in the future
this is depending of each board. actually it's same on all
but if a new one have a fan this value should be different or not.
Quoted 3 lines
Martin
thanks,
Guillaume
Guillaume La Roque
maintainerPATCH v2 5/6 arm64: dts: amlogic: odroid-n2: add minimal thermal zone
In reply to Guillaume La RoqueAdd minimal thermal zone for DDR and CPU sensor
--- .../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts +60 -0
@@ -10,6 +10,7 @@ #include <dt-bindings/input/input.h> #include <dt-bindings/gpio/meson-g12a-gpio.h> #include <dt-bindings/sound/meson-g12a-tohdmitx.h> +#include <dt-bindings/thermal/thermal.h> / { compatible = "hardkernel,odroid-n2", "amlogic,g12b";
@@ -20,6 +21,55 @@ ethernet0 = ðmac; }; + thermal-zones { + cpu-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&cpu_temp>; + + trips { + cpu_critical: cpu-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_critical>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + + ddr-thermal { + polling-delay = <1000>; + polling-delay-passive = <100>; + thermal-sensors = <&ddr_temp>; + + trips { + ddr_critical: ddr-critical { + temperature = <110000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_critical>; + cooling-device = <&mali THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + chosen { stdout-path = "serial0:115200n8"; };
@@ -288,6 +338,7 @@ operating-points-v2 = <&cpu_opp_table_0>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu1 {
@@ -295,6 +346,7 @@ operating-points-v2 = <&cpu_opp_table_0>; clocks = <&clkc CLKID_CPU_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu100 {
@@ -302,6 +354,7 @@ operating-points-v2 = <&cpub_opp_table_1>; clocks = <&clkc CLKID_CPUB_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu101 {
@@ -309,6 +362,7 @@ operating-points-v2 = <&cpub_opp_table_1>; clocks = <&clkc CLKID_CPUB_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu102 {
@@ -316,6 +370,7 @@ operating-points-v2 = <&cpub_opp_table_1>; clocks = <&clkc CLKID_CPUB_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &cpu103 {
@@ -323,6 +378,7 @@ operating-points-v2 = <&cpub_opp_table_1>; clocks = <&clkc CLKID_CPUB_CLK>; clock-latency = <50000>; + #cooling-cells = <2>; }; &ext_mdio {
@@ -377,6 +433,10 @@ }; }; +&mali { + #cooling-cells = <2>; +}; + &hdmi_tx { status = "okay"; pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
Signature · 1 line
2.17.1
Guillaume La Roque
maintainerPATCH v2 6/6 MAINTAINERS: add entry for Amlogic Thermal driver
In reply to Guillaume La RoqueAdd myself as maintainer for Amlogic Thermal driver.
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -15910,6 +15910,15 @@ F: Documentation/driver-api/thermal/cpu-cooling-api.rst F: drivers/thermal/cpu_cooling.c F: include/linux/cpu_cooling.h +THERMAL DRIVER FOR AMLOGIC SOCS +M: Guillaume La Roque <[email protected]> +L: [email protected] +L: [email protected] +W: http://linux-meson.com/ +S: Supported +F: drivers/thermal/amlogic_thermal.c +F: Documentation/devicetree/bindings/thermal/amlogic,thermal.yaml + THINKPAD ACPI EXTRAS DRIVER M: Henrique de Moraes Holschuh <[email protected]> L: [email protected]
Signature · 1 line
2.17.1