Re: [8/9] thermal: exynos: Parse the platform data from the device tree.
Amit, Copying Grant for the DT part discussion. On 26-03-2013 07:34, Amit Daniel Kachhap wrote: This patch adds code to parse the DT based platform data like threshold temp, sensor configuration parameters like gain, reference voltages, calibration modes etc. Signed-off-by: Amit Daniel Kachhap --- .../bindings/thermal/exynos5440-thermal.txt| 93 drivers/thermal/samsung/exynos5440_thermal.c |5 +- drivers/thermal/samsung/exynos_common.c| 92 +++ drivers/thermal/samsung/exynos_common.h|2 + 4 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt diff --git a/Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt new file mode 100644 index 000..1ad2dee --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt @@ -0,0 +1,93 @@ + +Exynos5440 TMU driver +--- + +Exynos5440 SoC Thermal Sensor driver for CPU temperature measurement and +performing cooling actions. + +Required properties: +- interrupts: Interrupt to know the threshold change interrupts. +- clocks: phandle of the clock from common clock binding. More description can + be found in Documentation/devicetree/bindings/clock/clock-bindings.txt. +- clock-name: clock name as used in the clock fetch. +- tmu-ctrl-data: phandle of the TMU controller configuration data. Its member + description is shown below, +- gain: A factor describing the gain of amplifier. The value varies between + 0-15. +- reference-voltage: A factor describing the reference volt to amplifier. The + value varies between 0-31. +- noise-cancel-mode: This value selects thermal tripping mode. The possible + values can be, + 0: Use current temp. + 4: Use current temp and past 4 temp values. + 5: Use current temp and past 8 temp values. + 6: Use current temp and past 12 temp values. + 7: Use current temp and past 16 temp values. +-cal-type: This value selects temperature calibration mode. The possible values + can be, + 0: No calibration. + 1: 1 point trimming method at 25 C. + 2: 1 point trimming method at 85 C. + 3: 2 point trimming method. +-cal-mode: This value selects hw/sw mode calibration. The possible values can be, + 0: Software calibration. + 1: Hardware calibration. + +Optional properties: +-efuse-value: This value should be used when the controller does not contain + valid fused temperature data needed for calibration. This is a 16 bit + value. +-threshold-falling: This value defines the falling threshold when it is added to + trip threshold. If this value is not supplied then rising and falling + threshold are same. + +-trip@: This node is added to define the trip properties. The trip members are + shown below, +-trip: This field defines the trip ID. Exynos5440 has 5 trip ID. +-trigger-temp: Temperature at which threshold trigger is fired. Its unit is + celsius. +-type: This denotes the type of trigger. The possible values are, + 0: active trip type + 1: critical + 2: hw system trip +-frequency-max: cpu frequency when this trip is reached. + +Example: + + tmu_ctrl_info: tmu-ctrl-info { Shouldnt this be named something like samsung,tmu_ctrl_info? + gain = <8>; + reference-voltage = <16>; + noise-cancel-mode = <4>; + cal-type = <0>; + cal-mode = <0>; + efuse-value = <0xabcd>; + threshold-falling = <5>; + ditto for the prefix of the above, + trip@0{ + trip = <0>; + trigger-temp = <80>; + type = <0>; + frequency-max = <120>; + }; + + trip@3{ + trip = <3>; + trigger-temp = <110>; + type = <1>; + }; + + trip@4{ + trip = <4>; + trigger-temp = <120>; + type = <2>; + }; + }; + + tmuctrl_0: tmuctrl@160118 { + compatible = "samsung,exynos5440-tmu"; + reg = <0x160118 0x300>; + interrupts = <0 58 0>; + clocks = < 8>; + clock-names = "tmu_apbif"; + tmu-ctrl-data = <_ctrl_info>; ditto. Grant, In fact I believe we must talk about how to standardize the thermal description under DT. + }; diff --git a/drivers/thermal/samsung/exynos5440_thermal.c b/drivers/thermal/samsung/exynos5440_thermal.c index a3c75d3..c140e8c 100644 ---
Re: [8/9] thermal: exynos: Parse the platform data from the device tree.
Amit, Copying Grant for the DT part discussion. On 26-03-2013 07:34, Amit Daniel Kachhap wrote: This patch adds code to parse the DT based platform data like threshold temp, sensor configuration parameters like gain, reference voltages, calibration modes etc. Signed-off-by: Amit Daniel Kachhap amit.dan...@samsung.com --- .../bindings/thermal/exynos5440-thermal.txt| 93 drivers/thermal/samsung/exynos5440_thermal.c |5 +- drivers/thermal/samsung/exynos_common.c| 92 +++ drivers/thermal/samsung/exynos_common.h|2 + 4 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt diff --git a/Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt b/Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt new file mode 100644 index 000..1ad2dee --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/exynos5440-thermal.txt @@ -0,0 +1,93 @@ + +Exynos5440 TMU driver +--- + +Exynos5440 SoC Thermal Sensor driver for CPU temperature measurement and +performing cooling actions. + +Required properties: +- interrupts: Interrupt to know the threshold change interrupts. +- clocks: phandle of the clock from common clock binding. More description can + be found in Documentation/devicetree/bindings/clock/clock-bindings.txt. +- clock-name: clock name as used in the clock fetch. +- tmu-ctrl-data: phandle of the TMU controller configuration data. Its member + description is shown below, +- gain: A factor describing the gain of amplifier. The value varies between + 0-15. +- reference-voltage: A factor describing the reference volt to amplifier. The + value varies between 0-31. +- noise-cancel-mode: This value selects thermal tripping mode. The possible + values can be, + 0: Use current temp. + 4: Use current temp and past 4 temp values. + 5: Use current temp and past 8 temp values. + 6: Use current temp and past 12 temp values. + 7: Use current temp and past 16 temp values. +-cal-type: This value selects temperature calibration mode. The possible values + can be, + 0: No calibration. + 1: 1 point trimming method at 25 C. + 2: 1 point trimming method at 85 C. + 3: 2 point trimming method. +-cal-mode: This value selects hw/sw mode calibration. The possible values can be, + 0: Software calibration. + 1: Hardware calibration. + +Optional properties: +-efuse-value: This value should be used when the controller does not contain + valid fused temperature data needed for calibration. This is a 16 bit + value. +-threshold-falling: This value defines the falling threshold when it is added to + trip threshold. If this value is not supplied then rising and falling + threshold are same. + +-trip@: This node is added to define the trip properties. The trip members are + shown below, +-trip: This field defines the trip ID. Exynos5440 has 5 trip ID. +-trigger-temp: Temperature at which threshold trigger is fired. Its unit is + celsius. +-type: This denotes the type of trigger. The possible values are, + 0: active trip type + 1: critical + 2: hw system trip +-frequency-max: cpu frequency when this trip is reached. + +Example: + + tmu_ctrl_info: tmu-ctrl-info { Shouldnt this be named something like samsung,tmu_ctrl_info? + gain = 8; + reference-voltage = 16; + noise-cancel-mode = 4; + cal-type = 0; + cal-mode = 0; + efuse-value = 0xabcd; + threshold-falling = 5; + ditto for the prefix of the above, + trip@0{ + trip = 0; + trigger-temp = 80; + type = 0; + frequency-max = 120; + }; + + trip@3{ + trip = 3; + trigger-temp = 110; + type = 1; + }; + + trip@4{ + trip = 4; + trigger-temp = 120; + type = 2; + }; + }; + + tmuctrl_0: tmuctrl@160118 { + compatible = samsung,exynos5440-tmu; + reg = 0x160118 0x300; + interrupts = 0 58 0; + clocks = clock 8; + clock-names = tmu_apbif; + tmu-ctrl-data = tmu_ctrl_info; ditto. Grant, In fact I believe we must talk about how to standardize the thermal description under DT. + }; diff --git a/drivers/thermal/samsung/exynos5440_thermal.c b/drivers/thermal/samsung/exynos5440_thermal.c index a3c75d3..c140e8c 100644 ---