Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
b82ddd48
Commit
b82ddd48
authored
Mar 15, 2016
by
Zhang Rui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'thermal-core', 'thermal-intel' and 'thermal-soc' into next
parents
d0b45880
4cba7d23
032f4a1e
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1037 additions
and
118 deletions
+1037
-118
Documentation/devicetree/bindings/thermal/exynos-thermal.txt
Documentation/devicetree/bindings/thermal/exynos-thermal.txt
+15
-3
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
...entation/devicetree/bindings/thermal/mediatek-thermal.txt
+43
-0
Documentation/thermal/sysfs-api.txt
Documentation/thermal/sysfs-api.txt
+68
-0
drivers/thermal/Kconfig
drivers/thermal/Kconfig
+19
-2
drivers/thermal/Makefile
drivers/thermal/Makefile
+1
-0
drivers/thermal/intel_pch_thermal.c
drivers/thermal/intel_pch_thermal.c
+6
-0
drivers/thermal/mtk_thermal.c
drivers/thermal/mtk_thermal.c
+625
-0
drivers/thermal/of-thermal.c
drivers/thermal/of-thermal.c
+81
-0
drivers/thermal/rcar_thermal.c
drivers/thermal/rcar_thermal.c
+1
-2
drivers/thermal/rockchip_thermal.c
drivers/thermal/rockchip_thermal.c
+136
-103
drivers/thermal/samsung/Kconfig
drivers/thermal/samsung/Kconfig
+1
-0
drivers/thermal/samsung/exynos_tmu.c
drivers/thermal/samsung/exynos_tmu.c
+18
-1
drivers/thermal/tegra_soctherm.c
drivers/thermal/tegra_soctherm.c
+1
-1
drivers/thermal/ti-soc-thermal/ti-bandgap.c
drivers/thermal/ti-soc-thermal/ti-bandgap.c
+4
-6
include/linux/thermal.h
include/linux/thermal.h
+18
-0
No files found.
Documentation/devicetree/bindings/thermal/exynos-thermal.txt
View file @
b82ddd48
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
"samsung,exynos5420-tmu" for TMU channel 0, 1 on Exynos5420
"samsung,exynos5420-tmu" for TMU channel 0, 1 on Exynos5420
"samsung,exynos5420-tmu-ext-triminfo" for TMU channels 2, 3 and 4
"samsung,exynos5420-tmu-ext-triminfo" for TMU channels 2, 3 and 4
Exynos5420 (Must pass triminfo base and triminfo clock)
Exynos5420 (Must pass triminfo base and triminfo clock)
"samsung,exynos5433-tmu"
"samsung,exynos5440-tmu"
"samsung,exynos5440-tmu"
"samsung,exynos7-tmu"
"samsung,exynos7-tmu"
- interrupt-parent : The phandle for the interrupt controller
- interrupt-parent : The phandle for the interrupt controller
...
@@ -40,9 +41,14 @@
...
@@ -40,9 +41,14 @@
for current TMU channel
for current TMU channel
-- "tmu_sclk" clock for functional operation of the current TMU
-- "tmu_sclk" clock for functional operation of the current TMU
channel
channel
- vtmu-supply: This entry is optional and provides the regulator node supplying
voltage to TMU. If needed this entry can be placed inside
The Exynos TMU supports generating interrupts when reaching given
board/platform specific dts file.
temperature thresholds. Number of supported thermal trip points depends
on the SoC (only first trip points defined in DT will be configured):
- most of SoC: 4
- samsung,exynos5433-tmu: 8
- samsung,exynos7-tmu: 8
Following properties are mandatory (depending on SoC):
Following properties are mandatory (depending on SoC):
- samsung,tmu_gain: Gain value for internal TMU operation.
- samsung,tmu_gain: Gain value for internal TMU operation.
- samsung,tmu_reference_voltage: Value of TMU IP block's reference voltage
- samsung,tmu_reference_voltage: Value of TMU IP block's reference voltage
...
@@ -56,6 +62,12 @@ Following properties are mandatory (depending on SoC):
...
@@ -56,6 +62,12 @@ Following properties are mandatory (depending on SoC):
- samsung,tmu_default_temp_offset: Default temperature offset
- samsung,tmu_default_temp_offset: Default temperature offset
- samsung,tmu_cal_type: Callibration type
- samsung,tmu_cal_type: Callibration type
** Optional properties:
- vtmu-supply: This entry is optional and provides the regulator node supplying
voltage to TMU. If needed this entry can be placed inside
board/platform specific dts file.
Example 1):
Example 1):
tmu@100C0000 {
tmu@100C0000 {
...
...
Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
0 → 100644
View file @
b82ddd48
* 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";
};
Documentation/thermal/sysfs-api.txt
View file @
b82ddd48
...
@@ -72,6 +72,74 @@ temperature) and throttle appropriate devices.
...
@@ -72,6 +72,74 @@ temperature) and throttle appropriate devices.
It deletes the corresponding entry form /sys/class/thermal folder and
It deletes the corresponding entry form /sys/class/thermal folder and
unbind all the thermal cooling devices it uses.
unbind all the thermal cooling devices it uses.
1.1.3 struct thermal_zone_device *thermal_zone_of_sensor_register(
struct device *dev, int sensor_id, void *data,
const struct thermal_zone_of_device_ops *ops)
This interface adds a new sensor to a DT thermal zone.
This function will search the list of thermal zones described in
device tree and look for the zone that refer to the sensor device
pointed by dev->of_node as temperature providers. For the zone
pointing to the sensor node, the sensor will be added to the DT
thermal zone device.
The parameters for this interface are:
dev: Device node of sensor containing valid node pointer in
dev->of_node.
sensor_id: a sensor identifier, in case the sensor IP has more
than one sensors
data: a private pointer (owned by the caller) that will be
passed back, when a temperature reading is needed.
ops: struct thermal_zone_of_device_ops *.
get_temp: a pointer to a function that reads the
sensor temperature. This is mandatory
callback provided by sensor driver.
get_trend: a pointer to a function that reads the
sensor temperature trend.
set_emul_temp: a pointer to a function that sets
sensor emulated temperature.
The thermal zone temperature is provided by the get_temp() function
pointer of thermal_zone_of_device_ops. When called, it will
have the private pointer @data back.
It returns error pointer if fails otherwise valid thermal zone device
handle. Caller should check the return handle with IS_ERR() for finding
whether success or not.
1.1.4 void thermal_zone_of_sensor_unregister(struct device *dev,
struct thermal_zone_device *tzd)
This interface unregisters a sensor from a DT thermal zone which was
successfully added by interface thermal_zone_of_sensor_register().
This function removes the sensor callbacks and private data from the
thermal zone device registered with thermal_zone_of_sensor_register()
interface. It will also silent the zone by remove the .get_temp() and
get_trend() thermal zone device callbacks.
1.1.5 struct thermal_zone_device *devm_thermal_zone_of_sensor_register(
struct device *dev, int sensor_id,
void *data, const struct thermal_zone_of_device_ops *ops)
This interface is resource managed version of
thermal_zone_of_sensor_register().
All details of thermal_zone_of_sensor_register() described in
section 1.1.3 is applicable here.
The benefit of using this interface to register sensor is that it
is not require to explicitly call thermal_zone_of_sensor_unregister()
in error path or during driver unbinding as this is done by driver
resource manager.
1.1.6 void devm_thermal_zone_of_sensor_unregister(struct device *dev,
struct thermal_zone_device *tzd)
This interface is resource managed version of
thermal_zone_of_sensor_unregister().
All details of thermal_zone_of_sensor_unregister() described in
section 1.1.4 is applicable here.
Normally this function will not need to be called and the resource
management code will ensure that the resource is freed.
1.2 thermal cooling device interface
1.2 thermal cooling device interface
1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name,
1.2.1 struct thermal_cooling_device *thermal_cooling_device_register(char *name,
void *devdata, struct thermal_cooling_device_ops *)
void *devdata, struct thermal_cooling_device_ops *)
...
...
drivers/thermal/Kconfig
View file @
b82ddd48
...
@@ -178,6 +178,7 @@ config THERMAL_EMULATION
...
@@ -178,6 +178,7 @@ config THERMAL_EMULATION
config HISI_THERMAL
config HISI_THERMAL
tristate "Hisilicon thermal driver"
tristate "Hisilicon thermal driver"
depends on (ARCH_HISI && CPU_THERMAL && OF) || COMPILE_TEST
depends on (ARCH_HISI && CPU_THERMAL && OF) || COMPILE_TEST
depends on HAS_IOMEM
help
help
Enable this to plug hisilicon's thermal sensor driver into the Linux
Enable this to plug hisilicon's thermal sensor driver into the Linux
thermal framework. cpufreq is used as the cooling device to throttle
thermal framework. cpufreq is used as the cooling device to throttle
...
@@ -197,6 +198,7 @@ config IMX_THERMAL
...
@@ -197,6 +198,7 @@ config IMX_THERMAL
config SPEAR_THERMAL
config SPEAR_THERMAL
tristate "SPEAr thermal sensor driver"
tristate "SPEAr thermal sensor driver"
depends on PLAT_SPEAR || COMPILE_TEST
depends on PLAT_SPEAR || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
depends on OF
help
help
Enable this to plug the SPEAr thermal sensor driver into the Linux
Enable this to plug the SPEAr thermal sensor driver into the Linux
...
@@ -206,6 +208,7 @@ config ROCKCHIP_THERMAL
...
@@ -206,6 +208,7 @@ config ROCKCHIP_THERMAL
tristate "Rockchip thermal driver"
tristate "Rockchip thermal driver"
depends on ARCH_ROCKCHIP || COMPILE_TEST
depends on ARCH_ROCKCHIP || COMPILE_TEST
depends on RESET_CONTROLLER
depends on RESET_CONTROLLER
depends on HAS_IOMEM
help
help
Rockchip thermal driver provides support for Temperature sensor
Rockchip thermal driver provides support for Temperature sensor
ADC (TS-ADC) found on Rockchip SoCs. It supports one critical
ADC (TS-ADC) found on Rockchip SoCs. It supports one critical
...
@@ -214,7 +217,7 @@ config ROCKCHIP_THERMAL
...
@@ -214,7 +217,7 @@ config ROCKCHIP_THERMAL
config RCAR_THERMAL
config RCAR_THERMAL
tristate "Renesas R-Car thermal driver"
tristate "Renesas R-Car thermal driver"
depends on ARCH_
SHMOBILE
|| COMPILE_TEST
depends on ARCH_
RENESAS
|| COMPILE_TEST
depends on HAS_IOMEM
depends on HAS_IOMEM
help
help
Enable this to plug the R-Car thermal sensor driver into the Linux
Enable this to plug the R-Car thermal sensor driver into the Linux
...
@@ -223,6 +226,7 @@ config RCAR_THERMAL
...
@@ -223,6 +226,7 @@ config RCAR_THERMAL
config KIRKWOOD_THERMAL
config KIRKWOOD_THERMAL
tristate "Temperature sensor on Marvell Kirkwood SoCs"
tristate "Temperature sensor on Marvell Kirkwood SoCs"
depends on MACH_KIRKWOOD || COMPILE_TEST
depends on MACH_KIRKWOOD || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
depends on OF
help
help
Support for the Kirkwood thermal sensor driver into the Linux thermal
Support for the Kirkwood thermal sensor driver into the Linux thermal
...
@@ -231,6 +235,7 @@ config KIRKWOOD_THERMAL
...
@@ -231,6 +235,7 @@ config KIRKWOOD_THERMAL
config DOVE_THERMAL
config DOVE_THERMAL
tristate "Temperature sensor on Marvell Dove SoCs"
tristate "Temperature sensor on Marvell Dove SoCs"
depends on ARCH_DOVE || MACH_DOVE || COMPILE_TEST
depends on ARCH_DOVE || MACH_DOVE || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
depends on OF
help
help
Support for the Dove thermal sensor driver in the Linux thermal
Support for the Dove thermal sensor driver in the Linux thermal
...
@@ -249,6 +254,7 @@ config DB8500_THERMAL
...
@@ -249,6 +254,7 @@ config DB8500_THERMAL
config ARMADA_THERMAL
config ARMADA_THERMAL
tristate "Armada 370/XP thermal management"
tristate "Armada 370/XP thermal management"
depends on ARCH_MVEBU || COMPILE_TEST
depends on ARCH_MVEBU || COMPILE_TEST
depends on HAS_IOMEM
depends on OF
depends on OF
help
help
Enable this option if you want to have support for thermal management
Enable this option if you want to have support for thermal management
...
@@ -266,7 +272,8 @@ config TEGRA_SOCTHERM
...
@@ -266,7 +272,8 @@ config TEGRA_SOCTHERM
config DB8500_CPUFREQ_COOLING
config DB8500_CPUFREQ_COOLING
tristate "DB8500 cpufreq cooling"
tristate "DB8500 cpufreq cooling"
depends on ARCH_U8500
depends on ARCH_U8500 || COMPILE_TEST
depends on HAS_IOMEM
depends on CPU_THERMAL
depends on CPU_THERMAL
default y
default y
help
help
...
@@ -365,8 +372,18 @@ config INTEL_PCH_THERMAL
...
@@ -365,8 +372,18 @@ config INTEL_PCH_THERMAL
Thermal reporting device will provide temperature reading,
Thermal reporting device will provide temperature reading,
programmable trip points and other information.
programmable trip points and other information.
config MTK_THERMAL
tristate "Temperature sensor driver for mediatek SoCs"
depends on ARCH_MEDIATEK || COMPILE_TEST
depends on HAS_IOMEM
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"
menu "Texas Instruments thermal drivers"
depends on ARCH_HAS_BANDGAP || COMPILE_TEST
depends on ARCH_HAS_BANDGAP || COMPILE_TEST
depends on HAS_IOMEM
source "drivers/thermal/ti-soc-thermal/Kconfig"
source "drivers/thermal/ti-soc-thermal/Kconfig"
endmenu
endmenu
...
...
drivers/thermal/Makefile
View file @
b82ddd48
...
@@ -48,3 +48,4 @@ obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o
...
@@ -48,3 +48,4 @@ obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o
obj-$(CONFIG_ST_THERMAL)
+=
st/
obj-$(CONFIG_ST_THERMAL)
+=
st/
obj-$(CONFIG_TEGRA_SOCTHERM)
+=
tegra_soctherm.o
obj-$(CONFIG_TEGRA_SOCTHERM)
+=
tegra_soctherm.o
obj-$(CONFIG_HISI_THERMAL)
+=
hisi_thermal.o
obj-$(CONFIG_HISI_THERMAL)
+=
hisi_thermal.o
obj-$(CONFIG_MTK_THERMAL)
+=
mtk_thermal.o
drivers/thermal/intel_pch_thermal.c
View file @
b82ddd48
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
/* Intel PCH thermal Device IDs */
/* Intel PCH thermal Device IDs */
#define PCH_THERMAL_DID_WPT 0x9CA4
/* Wildcat Point */
#define PCH_THERMAL_DID_WPT 0x9CA4
/* Wildcat Point */
#define PCH_THERMAL_DID_SKL 0x9D31
/* Skylake PCH */
/* Wildcat Point-LP PCH Thermal registers */
/* Wildcat Point-LP PCH Thermal registers */
#define WPT_TEMP 0x0000
/* Temperature */
#define WPT_TEMP 0x0000
/* Temperature */
...
@@ -201,6 +202,10 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev,
...
@@ -201,6 +202,10 @@ static int intel_pch_thermal_probe(struct pci_dev *pdev,
ptd
->
ops
=
&
pch_dev_ops_wpt
;
ptd
->
ops
=
&
pch_dev_ops_wpt
;
dev_name
=
"pch_wildcat_point"
;
dev_name
=
"pch_wildcat_point"
;
break
;
break
;
case
PCH_THERMAL_DID_SKL
:
ptd
->
ops
=
&
pch_dev_ops_wpt
;
dev_name
=
"pch_skylake"
;
break
;
default:
default:
dev_err
(
&
pdev
->
dev
,
"unknown pch thermal device
\n
"
);
dev_err
(
&
pdev
->
dev
,
"unknown pch thermal device
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -266,6 +271,7 @@ static void intel_pch_thermal_remove(struct pci_dev *pdev)
...
@@ -266,6 +271,7 @@ static void intel_pch_thermal_remove(struct pci_dev *pdev)
static
struct
pci_device_id
intel_pch_thermal_id
[]
=
{
static
struct
pci_device_id
intel_pch_thermal_id
[]
=
{
{
PCI_DEVICE
(
PCI_VENDOR_ID_INTEL
,
PCH_THERMAL_DID_WPT
)
},
{
PCI_DEVICE
(
PCI_VENDOR_ID_INTEL
,
PCH_THERMAL_DID_WPT
)
},
{
PCI_DEVICE
(
PCI_VENDOR_ID_INTEL
,
PCH_THERMAL_DID_SKL
)
},
{
0
,
},
{
0
,
},
};
};
MODULE_DEVICE_TABLE
(
pci
,
intel_pch_thermal_id
);
MODULE_DEVICE_TABLE
(
pci
,
intel_pch_thermal_id
);
...
...
drivers/thermal/mtk_thermal.c
0 → 100644
View file @
b82ddd48
This diff is collapsed.
Click to expand it.
drivers/thermal/of-thermal.c
View file @
b82ddd48
...
@@ -555,6 +555,87 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
...
@@ -555,6 +555,87 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
}
}
EXPORT_SYMBOL_GPL
(
thermal_zone_of_sensor_unregister
);
EXPORT_SYMBOL_GPL
(
thermal_zone_of_sensor_unregister
);
static
void
devm_thermal_zone_of_sensor_release
(
struct
device
*
dev
,
void
*
res
)
{
thermal_zone_of_sensor_unregister
(
dev
,
*
(
struct
thermal_zone_device
**
)
res
);
}
static
int
devm_thermal_zone_of_sensor_match
(
struct
device
*
dev
,
void
*
res
,
void
*
data
)
{
struct
thermal_zone_device
**
r
=
res
;
if
(
WARN_ON
(
!
r
||
!*
r
))
return
0
;
return
*
r
==
data
;
}
/**
* devm_thermal_zone_of_sensor_register - Resource managed version of
* thermal_zone_of_sensor_register()
* @dev: a valid struct device pointer of a sensor device. Must contain
* a valid .of_node, for the sensor node.
* @sensor_id: a sensor identifier, in case the sensor IP has more
* than one sensors
* @data: a private pointer (owned by the caller) that will be passed
* back, when a temperature reading is needed.
* @ops: struct thermal_zone_of_device_ops *. Must contain at least .get_temp.
*
* Refer thermal_zone_of_sensor_register() for more details.
*
* Return: On success returns a valid struct thermal_zone_device,
* otherwise, it returns a corresponding ERR_PTR(). Caller must
* check the return value with help of IS_ERR() helper.
* Registered hermal_zone_device device will automatically be
* released when device is unbounded.
*/
struct
thermal_zone_device
*
devm_thermal_zone_of_sensor_register
(
struct
device
*
dev
,
int
sensor_id
,
void
*
data
,
const
struct
thermal_zone_of_device_ops
*
ops
)
{
struct
thermal_zone_device
**
ptr
,
*
tzd
;
ptr
=
devres_alloc
(
devm_thermal_zone_of_sensor_release
,
sizeof
(
*
ptr
),
GFP_KERNEL
);
if
(
!
ptr
)
return
ERR_PTR
(
-
ENOMEM
);
tzd
=
thermal_zone_of_sensor_register
(
dev
,
sensor_id
,
data
,
ops
);
if
(
IS_ERR
(
tzd
))
{
devres_free
(
ptr
);
return
tzd
;
}
*
ptr
=
tzd
;
devres_add
(
dev
,
ptr
);
return
tzd
;
}
EXPORT_SYMBOL_GPL
(
devm_thermal_zone_of_sensor_register
);
/**
* devm_thermal_zone_of_sensor_unregister - Resource managed version of
* thermal_zone_of_sensor_unregister().
* @dev: Device for which which resource was allocated.
* @tzd: a pointer to struct thermal_zone_device where the sensor is registered.
*
* This function removes the sensor callbacks and private data from the
* thermal zone device registered with devm_thermal_zone_of_sensor_register()
* API. It will also silent the zone by remove the .get_temp() and .get_trend()
* thermal zone device callbacks.
* Normally this function will not need to be called and the resource
* management code will ensure that the resource is freed.
*/
void
devm_thermal_zone_of_sensor_unregister
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tzd
)
{
WARN_ON
(
devres_release
(
dev
,
devm_thermal_zone_of_sensor_release
,
devm_thermal_zone_of_sensor_match
,
tzd
));
}
EXPORT_SYMBOL_GPL
(
devm_thermal_zone_of_sensor_unregister
);
/*** functions parsing device tree nodes ***/
/*** functions parsing device tree nodes ***/
/**
/**
...
...
drivers/thermal/rcar_thermal.c
View file @
b82ddd48
...
@@ -430,8 +430,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
...
@@ -430,8 +430,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
struct
rcar_thermal_priv
*
priv
;
struct
rcar_thermal_priv
*
priv
;
struct
device
*
dev
=
&
pdev
->
dev
;
struct
device
*
dev
=
&
pdev
->
dev
;
struct
resource
*
res
,
*
irq
;
struct
resource
*
res
,
*
irq
;
const
struct
of_device_id
*
of_id
=
of_match_device
(
rcar_thermal_dt_ids
,
dev
);
unsigned
long
of_data
=
(
unsigned
long
)
of_device_get_match_data
(
dev
);
unsigned
long
of_data
=
(
unsigned
long
)
of_id
->
data
;
int
mres
=
0
;
int
mres
=
0
;
int
i
;
int
i
;
int
ret
=
-
ENODEV
;
int
ret
=
-
ENODEV
;
...
...
drivers/thermal/rockchip_thermal.c
View file @
b82ddd48
...
@@ -58,8 +58,8 @@ enum sensor_id {
...
@@ -58,8 +58,8 @@ enum sensor_id {
/**
/**
* The conversion table has the adc value and temperature.
* The conversion table has the adc value and temperature.
* ADC_DECREMENT: the adc value is of diminishing.(e.g.
v2
_code_table)
* ADC_DECREMENT: the adc value is of diminishing.(e.g.
rk3288
_code_table)
* ADC_INCREMENT: the adc value is incremental.(e.g.
v3
_code_table)
* ADC_INCREMENT: the adc value is incremental.(e.g.
rk3368
_code_table)
*/
*/
enum
adc_sort_mode
{
enum
adc_sort_mode
{
ADC_DECREMENT
=
0
,
ADC_DECREMENT
=
0
,
...
@@ -135,7 +135,13 @@ struct rockchip_thermal_data {
...
@@ -135,7 +135,13 @@ struct rockchip_thermal_data {
enum
tshut_polarity
tshut_polarity
;
enum
tshut_polarity
tshut_polarity
;
};
};
/* TSADC Sensor info define: */
/**
* TSADC Sensor Register description:
*
* TSADCV2_* are used for RK3288 SoCs, the other chips can reuse it.
* TSADCV3_* are used for newer SoCs than RK3288. (e.g: RK3228, RK3399)
*
*/
#define TSADCV2_AUTO_CON 0x04
#define TSADCV2_AUTO_CON 0x04
#define TSADCV2_INT_EN 0x08
#define TSADCV2_INT_EN 0x08
#define TSADCV2_INT_PD 0x0c
#define TSADCV2_INT_PD 0x0c
...
@@ -149,13 +155,20 @@ struct rockchip_thermal_data {
...
@@ -149,13 +155,20 @@ struct rockchip_thermal_data {
#define TSADCV2_AUTO_EN BIT(0)
#define TSADCV2_AUTO_EN BIT(0)
#define TSADCV2_AUTO_SRC_EN(chn) BIT(4 + (chn))
#define TSADCV2_AUTO_SRC_EN(chn) BIT(4 + (chn))
#define TSADCV2_AUTO_TSHUT_POLARITY_HIGH BIT(8)
#define TSADCV2_AUTO_TSHUT_POLARITY_HIGH BIT(8)
/**
* TSADCV1_AUTO_Q_SEL_EN:
* whether select (1024 - tsadc_q) as output
* 1'b0:use tsadc_q as output(temperature-code is rising sequence)
* 1'b1:use(1024 - tsadc_q) as output (temperature-code is falling sequence)
*/
#define TSADCV3_AUTO_Q_SEL_EN BIT(1)
#define TSADCV2_INT_SRC_EN(chn) BIT(chn)
#define TSADCV2_INT_SRC_EN(chn) BIT(chn)
#define TSADCV2_SHUT_2GPIO_SRC_EN(chn) BIT(4 + (chn))
#define TSADCV2_SHUT_2GPIO_SRC_EN(chn) BIT(4 + (chn))
#define TSADCV2_SHUT_2CRU_SRC_EN(chn) BIT(8 + (chn))
#define TSADCV2_SHUT_2CRU_SRC_EN(chn) BIT(8 + (chn))
#define TSADCV1_INT_PD_CLEAR_MASK ~BIT(16)
#define TSADCV2_INT_PD_CLEAR_MASK ~BIT(8)
#define TSADCV2_INT_PD_CLEAR_MASK ~BIT(8)
#define TSADCV3_INT_PD_CLEAR_MASK ~BIT(16)
#define TSADCV2_DATA_MASK 0xfff
#define TSADCV2_DATA_MASK 0xfff
#define TSADCV3_DATA_MASK 0x3ff
#define TSADCV3_DATA_MASK 0x3ff
...
@@ -177,45 +190,46 @@ struct tsadc_table {
...
@@ -177,45 +190,46 @@ struct tsadc_table {
* linearly interpolated.
* linearly interpolated.
* Code to Temperature mapping should be updated based on sillcon results.
* Code to Temperature mapping should be updated based on sillcon results.
*/
*/
static
const
struct
tsadc_table
v1_code_table
[]
=
{
static
const
struct
tsadc_table
rk3228_code_table
[]
=
{
{
TSADCV3_DATA_MASK
,
-
40000
},
{
0
,
-
40000
},
{
436
,
-
40000
},
{
588
,
-
40000
},
{
431
,
-
35000
},
{
593
,
-
35000
},
{
426
,
-
30000
},
{
598
,
-
30000
},
{
421
,
-
25000
},
{
603
,
-
25000
},
{
416
,
-
20000
},
{
608
,
-
20000
},
{
411
,
-
15000
},
{
613
,
-
15000
},
{
406
,
-
10000
},
{
618
,
-
10000
},
{
401
,
-
5000
},
{
623
,
-
5000
},
{
395
,
0
},
{
629
,
0
},
{
390
,
5000
},
{
634
,
5000
},
{
385
,
10000
},
{
639
,
10000
},
{
380
,
15000
},
{
644
,
15000
},
{
375
,
20000
},
{
649
,
20000
},
{
370
,
25000
},
{
654
,
25000
},
{
364
,
30000
},
{
660
,
30000
},
{
359
,
35000
},
{
665
,
35000
},
{
354
,
40000
},
{
670
,
40000
},
{
349
,
45000
},
{
675
,
45000
},
{
343
,
50000
},
{
681
,
50000
},
{
338
,
55000
},
{
686
,
55000
},
{
333
,
60000
},
{
691
,
60000
},
{
328
,
65000
},
{
696
,
65000
},
{
322
,
70000
},
{
702
,
70000
},
{
317
,
75000
},
{
707
,
75000
},
{
312
,
80000
},
{
712
,
80000
},
{
307
,
85000
},
{
717
,
85000
},
{
301
,
90000
},
{
723
,
90000
},
{
296
,
95000
},
{
728
,
95000
},
{
291
,
100000
},
{
733
,
100000
},
{
286
,
105000
},
{
738
,
105000
},
{
280
,
110000
},
{
744
,
110000
},
{
275
,
115000
},
{
749
,
115000
},
{
270
,
120000
},
{
754
,
120000
},
{
264
,
125000
},
{
760
,
125000
},
{
TSADCV2_DATA_MASK
,
125000
},
};
};
static
const
struct
tsadc_table
v2
_code_table
[]
=
{
static
const
struct
tsadc_table
rk3288
_code_table
[]
=
{
{
TSADCV2_DATA_MASK
,
-
40000
},
{
TSADCV2_DATA_MASK
,
-
40000
},
{
3800
,
-
40000
},
{
3800
,
-
40000
},
{
3792
,
-
35000
},
{
3792
,
-
35000
},
...
@@ -253,7 +267,7 @@ static const struct tsadc_table v2_code_table[] = {
...
@@ -253,7 +267,7 @@ static const struct tsadc_table v2_code_table[] = {
{
3421
,
125000
},
{
3421
,
125000
},
};
};
static
const
struct
tsadc_table
v3
_code_table
[]
=
{
static
const
struct
tsadc_table
rk3368
_code_table
[]
=
{
{
0
,
-
40000
},
{
0
,
-
40000
},
{
106
,
-
40000
},
{
106
,
-
40000
},
{
108
,
-
35000
},
{
108
,
-
35000
},
...
@@ -292,42 +306,43 @@ static const struct tsadc_table v3_code_table[] = {
...
@@ -292,42 +306,43 @@ static const struct tsadc_table v3_code_table[] = {
{
TSADCV3_DATA_MASK
,
125000
},
{
TSADCV3_DATA_MASK
,
125000
},
};
};
static
const
struct
tsadc_table
v4_code_table
[]
=
{
static
const
struct
tsadc_table
rk3399_code_table
[]
=
{
{
TSADCV3_DATA_MASK
,
-
40000
},
{
0
,
-
40000
},
{
431
,
-
40000
},
{
593
,
-
40000
},
{
426
,
-
35000
},
{
598
,
-
35000
},
{
421
,
-
30000
},
{
603
,
-
30000
},
{
415
,
-
25000
},
{
609
,
-
25000
},
{
410
,
-
20000
},
{
614
,
-
20000
},
{
405
,
-
15000
},
{
619
,
-
15000
},
{
399
,
-
10000
},
{
625
,
-
10000
},
{
394
,
-
5000
},
{
630
,
-
5000
},
{
389
,
0
},
{
635
,
0
},
{
383
,
5000
},
{
641
,
5000
},
{
378
,
10000
},
{
646
,
10000
},
{
373
,
15000
},
{
651
,
15000
},
{
367
,
20000
},
{
657
,
20000
},
{
362
,
25000
},
{
662
,
25000
},
{
357
,
30000
},
{
667
,
30000
},
{
351
,
35000
},
{
673
,
35000
},
{
346
,
40000
},
{
678
,
40000
},
{
340
,
45000
},
{
684
,
45000
},
{
335
,
50000
},
{
689
,
50000
},
{
330
,
55000
},
{
694
,
55000
},
{
324
,
60000
},
{
700
,
60000
},
{
319
,
65000
},
{
705
,
65000
},
{
313
,
70000
},
{
711
,
70000
},
{
308
,
75000
},
{
716
,
75000
},
{
302
,
80000
},
{
722
,
80000
},
{
297
,
85000
},
{
727
,
85000
},
{
291
,
90000
},
{
733
,
90000
},
{
286
,
95000
},
{
738
,
95000
},
{
281
,
100000
},
{
743
,
100000
},
{
275
,
105000
},
{
749
,
105000
},
{
270
,
110000
},
{
754
,
110000
},
{
264
,
115000
},
{
760
,
115000
},
{
259
,
120000
},
{
765
,
120000
},
{
253
,
125000
},
{
771
,
125000
},
{
TSADCV3_DATA_MASK
,
125000
},
};
};
static
u32
rk_tsadcv2_temp_to_code
(
struct
chip_tsadc_table
table
,
static
u32
rk_tsadcv2_temp_to_code
(
struct
chip_tsadc_table
table
,
...
@@ -411,7 +426,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
...
@@ -411,7 +426,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
* temperature between 2 table entries is linear and interpolate
* temperature between 2 table entries is linear and interpolate
* to produce less granular result.
* to produce less granular result.
*/
*/
num
=
table
.
id
[
mid
].
temp
-
v2_code_table
[
mid
-
1
].
temp
;
num
=
table
.
id
[
mid
].
temp
-
table
.
id
[
mid
-
1
].
temp
;
num
*=
abs
(
table
.
id
[
mid
-
1
].
code
-
code
);
num
*=
abs
(
table
.
id
[
mid
-
1
].
code
-
code
);
denom
=
abs
(
table
.
id
[
mid
-
1
].
code
-
table
.
id
[
mid
].
code
);
denom
=
abs
(
table
.
id
[
mid
-
1
].
code
-
table
.
id
[
mid
].
code
);
*
temp
=
table
.
id
[
mid
-
1
].
temp
+
(
num
/
denom
);
*
temp
=
table
.
id
[
mid
-
1
].
temp
+
(
num
/
denom
);
...
@@ -453,20 +468,20 @@ static void rk_tsadcv2_initialize(void __iomem *regs,
...
@@ -453,20 +468,20 @@ static void rk_tsadcv2_initialize(void __iomem *regs,
regs
+
TSADCV2_HIGHT_TSHUT_DEBOUNCE
);
regs
+
TSADCV2_HIGHT_TSHUT_DEBOUNCE
);
}
}
static
void
rk_tsadcv
1
_irq_ack
(
void
__iomem
*
regs
)
static
void
rk_tsadcv
2
_irq_ack
(
void
__iomem
*
regs
)
{
{
u32
val
;
u32
val
;
val
=
readl_relaxed
(
regs
+
TSADCV2_INT_PD
);
val
=
readl_relaxed
(
regs
+
TSADCV2_INT_PD
);
writel_relaxed
(
val
&
TSADCV
1
_INT_PD_CLEAR_MASK
,
regs
+
TSADCV2_INT_PD
);
writel_relaxed
(
val
&
TSADCV
2
_INT_PD_CLEAR_MASK
,
regs
+
TSADCV2_INT_PD
);
}
}
static
void
rk_tsadcv
2
_irq_ack
(
void
__iomem
*
regs
)
static
void
rk_tsadcv
3
_irq_ack
(
void
__iomem
*
regs
)
{
{
u32
val
;
u32
val
;
val
=
readl_relaxed
(
regs
+
TSADCV2_INT_PD
);
val
=
readl_relaxed
(
regs
+
TSADCV2_INT_PD
);
writel_relaxed
(
val
&
TSADCV
2
_INT_PD_CLEAR_MASK
,
regs
+
TSADCV2_INT_PD
);
writel_relaxed
(
val
&
TSADCV
3
_INT_PD_CLEAR_MASK
,
regs
+
TSADCV2_INT_PD
);
}
}
static
void
rk_tsadcv2_control
(
void
__iomem
*
regs
,
bool
enable
)
static
void
rk_tsadcv2_control
(
void
__iomem
*
regs
,
bool
enable
)
...
@@ -482,6 +497,25 @@ static void rk_tsadcv2_control(void __iomem *regs, bool enable)
...
@@ -482,6 +497,25 @@ static void rk_tsadcv2_control(void __iomem *regs, bool enable)
writel_relaxed
(
val
,
regs
+
TSADCV2_AUTO_CON
);
writel_relaxed
(
val
,
regs
+
TSADCV2_AUTO_CON
);
}
}
/**
* @rk_tsadcv3_control:
* TSADC controller works at auto mode, and some SoCs need set the tsadc_q_sel
* bit on TSADCV2_AUTO_CON[1]. The (1024 - tsadc_q) as output adc value if
* setting this bit to enable.
*/
static
void
rk_tsadcv3_control
(
void
__iomem
*
regs
,
bool
enable
)
{
u32
val
;
val
=
readl_relaxed
(
regs
+
TSADCV2_AUTO_CON
);
if
(
enable
)
val
|=
TSADCV2_AUTO_EN
|
TSADCV3_AUTO_Q_SEL_EN
;
else
val
&=
~
TSADCV2_AUTO_EN
;
writel_relaxed
(
val
,
regs
+
TSADCV2_AUTO_CON
);
}
static
int
rk_tsadcv2_get_temp
(
struct
chip_tsadc_table
table
,
static
int
rk_tsadcv2_get_temp
(
struct
chip_tsadc_table
table
,
int
chn
,
void
__iomem
*
regs
,
int
*
temp
)
int
chn
,
void
__iomem
*
regs
,
int
*
temp
)
{
{
...
@@ -531,17 +565,17 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
...
@@ -531,17 +565,17 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
.
tshut_temp
=
95000
,
.
tshut_temp
=
95000
,
.
initialize
=
rk_tsadcv2_initialize
,
.
initialize
=
rk_tsadcv2_initialize
,
.
irq_ack
=
rk_tsadcv
1
_irq_ack
,
.
irq_ack
=
rk_tsadcv
3
_irq_ack
,
.
control
=
rk_tsadcv
2
_control
,
.
control
=
rk_tsadcv
3
_control
,
.
get_temp
=
rk_tsadcv2_get_temp
,
.
get_temp
=
rk_tsadcv2_get_temp
,
.
set_tshut_temp
=
rk_tsadcv2_tshut_temp
,
.
set_tshut_temp
=
rk_tsadcv2_tshut_temp
,
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
table
=
{
.
table
=
{
.
id
=
v1
_code_table
,
.
id
=
rk3228
_code_table
,
.
length
=
ARRAY_SIZE
(
v1
_code_table
),
.
length
=
ARRAY_SIZE
(
rk3228
_code_table
),
.
data_mask
=
TSADCV3_DATA_MASK
,
.
data_mask
=
TSADCV3_DATA_MASK
,
.
mode
=
ADC_
DE
CREMENT
,
.
mode
=
ADC_
IN
CREMENT
,
},
},
};
};
...
@@ -562,8 +596,8 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
...
@@ -562,8 +596,8 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
table
=
{
.
table
=
{
.
id
=
v2
_code_table
,
.
id
=
rk3288
_code_table
,
.
length
=
ARRAY_SIZE
(
v2
_code_table
),
.
length
=
ARRAY_SIZE
(
rk3288
_code_table
),
.
data_mask
=
TSADCV2_DATA_MASK
,
.
data_mask
=
TSADCV2_DATA_MASK
,
.
mode
=
ADC_DECREMENT
,
.
mode
=
ADC_DECREMENT
,
},
},
...
@@ -586,8 +620,8 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
...
@@ -586,8 +620,8 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
table
=
{
.
table
=
{
.
id
=
v3
_code_table
,
.
id
=
rk3368
_code_table
,
.
length
=
ARRAY_SIZE
(
v3
_code_table
),
.
length
=
ARRAY_SIZE
(
rk3368
_code_table
),
.
data_mask
=
TSADCV3_DATA_MASK
,
.
data_mask
=
TSADCV3_DATA_MASK
,
.
mode
=
ADC_INCREMENT
,
.
mode
=
ADC_INCREMENT
,
},
},
...
@@ -603,17 +637,17 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
...
@@ -603,17 +637,17 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
.
tshut_temp
=
95000
,
.
tshut_temp
=
95000
,
.
initialize
=
rk_tsadcv2_initialize
,
.
initialize
=
rk_tsadcv2_initialize
,
.
irq_ack
=
rk_tsadcv
1
_irq_ack
,
.
irq_ack
=
rk_tsadcv
3
_irq_ack
,
.
control
=
rk_tsadcv
2
_control
,
.
control
=
rk_tsadcv
3
_control
,
.
get_temp
=
rk_tsadcv2_get_temp
,
.
get_temp
=
rk_tsadcv2_get_temp
,
.
set_tshut_temp
=
rk_tsadcv2_tshut_temp
,
.
set_tshut_temp
=
rk_tsadcv2_tshut_temp
,
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
set_tshut_mode
=
rk_tsadcv2_tshut_mode
,
.
table
=
{
.
table
=
{
.
id
=
v4
_code_table
,
.
id
=
rk3399
_code_table
,
.
length
=
ARRAY_SIZE
(
v4
_code_table
),
.
length
=
ARRAY_SIZE
(
rk3399
_code_table
),
.
data_mask
=
TSADCV3_DATA_MASK
,
.
data_mask
=
TSADCV3_DATA_MASK
,
.
mode
=
ADC_
DE
CREMENT
,
.
mode
=
ADC_
IN
CREMENT
,
},
},
};
};
...
@@ -693,15 +727,14 @@ static int rockchip_configure_from_dt(struct device *dev,
...
@@ -693,15 +727,14 @@ static int rockchip_configure_from_dt(struct device *dev,
thermal
->
chip
->
tshut_temp
);
thermal
->
chip
->
tshut_temp
);
thermal
->
tshut_temp
=
thermal
->
chip
->
tshut_temp
;
thermal
->
tshut_temp
=
thermal
->
chip
->
tshut_temp
;
}
else
{
}
else
{
if
(
shut_temp
>
INT_MAX
)
{
dev_err
(
dev
,
"Invalid tshut temperature specified: %d
\n
"
,
shut_temp
);
return
-
ERANGE
;
}
thermal
->
tshut_temp
=
shut_temp
;
thermal
->
tshut_temp
=
shut_temp
;
}
}
if
(
thermal
->
tshut_temp
>
INT_MAX
)
{
dev_err
(
dev
,
"Invalid tshut temperature specified: %d
\n
"
,
thermal
->
tshut_temp
);
return
-
ERANGE
;
}
if
(
of_property_read_u32
(
np
,
"rockchip,hw-tshut-mode"
,
&
tshut_mode
))
{
if
(
of_property_read_u32
(
np
,
"rockchip,hw-tshut-mode"
,
&
tshut_mode
))
{
dev_warn
(
dev
,
dev_warn
(
dev
,
"Missing tshut mode property, using default (%s)
\n
"
,
"Missing tshut mode property, using default (%s)
\n
"
,
...
...
drivers/thermal/samsung/Kconfig
View file @
b82ddd48
config EXYNOS_THERMAL
config EXYNOS_THERMAL
tristate "Exynos thermal management unit driver"
tristate "Exynos thermal management unit driver"
depends on THERMAL_OF
depends on THERMAL_OF
depends on HAS_IOMEM
help
help
If you say yes here you get support for the TMU (Thermal Management
If you say yes here you get support for the TMU (Thermal Management
Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
...
...
drivers/thermal/samsung/exynos_tmu.c
View file @
b82ddd48
...
@@ -184,6 +184,7 @@
...
@@ -184,6 +184,7 @@
* @temp_error2: fused value of the second point trim.
* @temp_error2: fused value of the second point trim.
* @regulator: pointer to the TMU regulator structure.
* @regulator: pointer to the TMU regulator structure.
* @reg_conf: pointer to structure to register with core thermal.
* @reg_conf: pointer to structure to register with core thermal.
* @ntrip: number of supported trip points.
* @tmu_initialize: SoC specific TMU initialization method
* @tmu_initialize: SoC specific TMU initialization method
* @tmu_control: SoC specific TMU control method
* @tmu_control: SoC specific TMU control method
* @tmu_read: SoC specific TMU temperature read method
* @tmu_read: SoC specific TMU temperature read method
...
@@ -203,6 +204,7 @@ struct exynos_tmu_data {
...
@@ -203,6 +204,7 @@ struct exynos_tmu_data {
u16
temp_error1
,
temp_error2
;
u16
temp_error1
,
temp_error2
;
struct
regulator
*
regulator
;
struct
regulator
*
regulator
;
struct
thermal_zone_device
*
tzd
;
struct
thermal_zone_device
*
tzd
;
unsigned
int
ntrip
;
int
(
*
tmu_initialize
)(
struct
platform_device
*
pdev
);
int
(
*
tmu_initialize
)(
struct
platform_device
*
pdev
);
void
(
*
tmu_control
)(
struct
platform_device
*
pdev
,
bool
on
);
void
(
*
tmu_control
)(
struct
platform_device
*
pdev
,
bool
on
);
...
@@ -346,6 +348,14 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
...
@@ -346,6 +348,14 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
struct
exynos_tmu_data
*
data
=
platform_get_drvdata
(
pdev
);
struct
exynos_tmu_data
*
data
=
platform_get_drvdata
(
pdev
);
int
ret
;
int
ret
;
if
(
of_thermal_get_ntrips
(
data
->
tzd
)
>
data
->
ntrip
)
{
dev_info
(
&
pdev
->
dev
,
"More trip points than supported by this TMU.
\n
"
);
dev_info
(
&
pdev
->
dev
,
"%d trip points should be configured in polling mode.
\n
"
,
(
of_thermal_get_ntrips
(
data
->
tzd
)
-
data
->
ntrip
));
}
mutex_lock
(
&
data
->
lock
);
mutex_lock
(
&
data
->
lock
);
clk_enable
(
data
->
clk
);
clk_enable
(
data
->
clk
);
if
(
!
IS_ERR
(
data
->
clk_sec
))
if
(
!
IS_ERR
(
data
->
clk_sec
))
...
@@ -1210,6 +1220,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
...
@@ -1210,6 +1220,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data
->
tmu_control
=
exynos4210_tmu_control
;
data
->
tmu_control
=
exynos4210_tmu_control
;
data
->
tmu_read
=
exynos4210_tmu_read
;
data
->
tmu_read
=
exynos4210_tmu_read
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
ntrip
=
4
;
break
;
break
;
case
SOC_ARCH_EXYNOS3250
:
case
SOC_ARCH_EXYNOS3250
:
case
SOC_ARCH_EXYNOS4412
:
case
SOC_ARCH_EXYNOS4412
:
...
@@ -1222,6 +1233,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
...
@@ -1222,6 +1233,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data
->
tmu_read
=
exynos4412_tmu_read
;
data
->
tmu_read
=
exynos4412_tmu_read
;
data
->
tmu_set_emulation
=
exynos4412_tmu_set_emulation
;
data
->
tmu_set_emulation
=
exynos4412_tmu_set_emulation
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
ntrip
=
4
;
break
;
break
;
case
SOC_ARCH_EXYNOS5433
:
case
SOC_ARCH_EXYNOS5433
:
data
->
tmu_initialize
=
exynos5433_tmu_initialize
;
data
->
tmu_initialize
=
exynos5433_tmu_initialize
;
...
@@ -1229,6 +1241,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
...
@@ -1229,6 +1241,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data
->
tmu_read
=
exynos4412_tmu_read
;
data
->
tmu_read
=
exynos4412_tmu_read
;
data
->
tmu_set_emulation
=
exynos4412_tmu_set_emulation
;
data
->
tmu_set_emulation
=
exynos4412_tmu_set_emulation
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
ntrip
=
8
;
break
;
break
;
case
SOC_ARCH_EXYNOS5440
:
case
SOC_ARCH_EXYNOS5440
:
data
->
tmu_initialize
=
exynos5440_tmu_initialize
;
data
->
tmu_initialize
=
exynos5440_tmu_initialize
;
...
@@ -1236,6 +1249,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
...
@@ -1236,6 +1249,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data
->
tmu_read
=
exynos5440_tmu_read
;
data
->
tmu_read
=
exynos5440_tmu_read
;
data
->
tmu_set_emulation
=
exynos5440_tmu_set_emulation
;
data
->
tmu_set_emulation
=
exynos5440_tmu_set_emulation
;
data
->
tmu_clear_irqs
=
exynos5440_tmu_clear_irqs
;
data
->
tmu_clear_irqs
=
exynos5440_tmu_clear_irqs
;
data
->
ntrip
=
4
;
break
;
break
;
case
SOC_ARCH_EXYNOS7
:
case
SOC_ARCH_EXYNOS7
:
data
->
tmu_initialize
=
exynos7_tmu_initialize
;
data
->
tmu_initialize
=
exynos7_tmu_initialize
;
...
@@ -1243,6 +1257,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
...
@@ -1243,6 +1257,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
data
->
tmu_read
=
exynos7_tmu_read
;
data
->
tmu_read
=
exynos7_tmu_read
;
data
->
tmu_set_emulation
=
exynos4412_tmu_set_emulation
;
data
->
tmu_set_emulation
=
exynos4412_tmu_set_emulation
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
tmu_clear_irqs
=
exynos4210_tmu_clear_irqs
;
data
->
ntrip
=
8
;
break
;
break
;
default:
default:
dev_err
(
&
pdev
->
dev
,
"Platform not supported
\n
"
);
dev_err
(
&
pdev
->
dev
,
"Platform not supported
\n
"
);
...
@@ -1295,7 +1310,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
...
@@ -1295,7 +1310,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
* TODO: Add regulator as an SOC feature, so that regulator enable
* TODO: Add regulator as an SOC feature, so that regulator enable
* is a compulsory call.
* is a compulsory call.
*/
*/
data
->
regulator
=
devm_regulator_get
(
&
pdev
->
dev
,
"vtmu"
);
data
->
regulator
=
devm_regulator_get
_optional
(
&
pdev
->
dev
,
"vtmu"
);
if
(
!
IS_ERR
(
data
->
regulator
))
{
if
(
!
IS_ERR
(
data
->
regulator
))
{
ret
=
regulator_enable
(
data
->
regulator
);
ret
=
regulator_enable
(
data
->
regulator
);
if
(
ret
)
{
if
(
ret
)
{
...
@@ -1303,6 +1318,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
...
@@ -1303,6 +1318,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return
ret
;
return
ret
;
}
}
}
else
{
}
else
{
if
(
PTR_ERR
(
data
->
regulator
)
==
-
EPROBE_DEFER
)
return
-
EPROBE_DEFER
;
dev_info
(
&
pdev
->
dev
,
"Regulator node (vtmu) not found
\n
"
);
dev_info
(
&
pdev
->
dev
,
"Regulator node (vtmu) not found
\n
"
);
}
}
...
...
drivers/thermal/tegra_soctherm.c
View file @
b82ddd48
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
#define READBACK_VALUE_MASK 0xff00
#define READBACK_VALUE_MASK 0xff00
#define READBACK_VALUE_SHIFT 8
#define READBACK_VALUE_SHIFT 8
#define READBACK_ADD_HALF BIT(7)
#define READBACK_ADD_HALF BIT(7)
#define READBACK_NEGATE BIT(
1
)
#define READBACK_NEGATE BIT(
0
)
#define FUSE_TSENSOR8_CALIB 0x180
#define FUSE_TSENSOR8_CALIB 0x180
#define FUSE_SPARE_REALIGNMENT_REG_0 0x1fc
#define FUSE_SPARE_REALIGNMENT_REG_0 0x1fc
...
...
drivers/thermal/ti-soc-thermal/ti-bandgap.c
View file @
b82ddd48
...
@@ -1265,7 +1265,7 @@ static
...
@@ -1265,7 +1265,7 @@ static
int
ti_bandgap_probe
(
struct
platform_device
*
pdev
)
int
ti_bandgap_probe
(
struct
platform_device
*
pdev
)
{
{
struct
ti_bandgap
*
bgp
;
struct
ti_bandgap
*
bgp
;
int
clk_rate
,
ret
=
0
,
i
;
int
clk_rate
,
ret
,
i
;
bgp
=
ti_bandgap_build
(
pdev
);
bgp
=
ti_bandgap_build
(
pdev
);
if
(
IS_ERR
(
bgp
))
{
if
(
IS_ERR
(
bgp
))
{
...
@@ -1288,16 +1288,14 @@ int ti_bandgap_probe(struct platform_device *pdev)
...
@@ -1288,16 +1288,14 @@ int ti_bandgap_probe(struct platform_device *pdev)
}
}
bgp
->
fclock
=
clk_get
(
NULL
,
bgp
->
conf
->
fclock_name
);
bgp
->
fclock
=
clk_get
(
NULL
,
bgp
->
conf
->
fclock_name
);
ret
=
IS_ERR
(
bgp
->
fclock
);
if
(
IS_ERR
(
bgp
->
fclock
))
{
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"failed to request fclock reference
\n
"
);
dev_err
(
&
pdev
->
dev
,
"failed to request fclock reference
\n
"
);
ret
=
PTR_ERR
(
bgp
->
fclock
);
ret
=
PTR_ERR
(
bgp
->
fclock
);
goto
free_irqs
;
goto
free_irqs
;
}
}
bgp
->
div_clk
=
clk_get
(
NULL
,
bgp
->
conf
->
div_ck_name
);
bgp
->
div_clk
=
clk_get
(
NULL
,
bgp
->
conf
->
div_ck_name
);
ret
=
IS_ERR
(
bgp
->
div_clk
);
if
(
IS_ERR
(
bgp
->
div_clk
))
{
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"failed to request div_ts_ck clock ref
\n
"
);
dev_err
(
&
pdev
->
dev
,
"failed to request div_ts_ck clock ref
\n
"
);
ret
=
PTR_ERR
(
bgp
->
div_clk
);
ret
=
PTR_ERR
(
bgp
->
div_clk
);
goto
free_irqs
;
goto
free_irqs
;
...
@@ -1314,7 +1312,7 @@ int ti_bandgap_probe(struct platform_device *pdev)
...
@@ -1314,7 +1312,7 @@ int ti_bandgap_probe(struct platform_device *pdev)
* may not be accurate
* may not be accurate
*/
*/
val
=
ti_bandgap_readl
(
bgp
,
tsr
->
bgap_efuse
);
val
=
ti_bandgap_readl
(
bgp
,
tsr
->
bgap_efuse
);
if
(
ret
||
!
val
)
if
(
!
val
)
dev_info
(
&
pdev
->
dev
,
dev_info
(
&
pdev
->
dev
,
"Non-trimmed BGAP, Temp not accurate
\n
"
);
"Non-trimmed BGAP, Temp not accurate
\n
"
);
}
}
...
...
include/linux/thermal.h
View file @
b82ddd48
...
@@ -362,6 +362,11 @@ thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
...
@@ -362,6 +362,11 @@ thermal_zone_of_sensor_register(struct device *dev, int id, void *data,
const
struct
thermal_zone_of_device_ops
*
ops
);
const
struct
thermal_zone_of_device_ops
*
ops
);
void
thermal_zone_of_sensor_unregister
(
struct
device
*
dev
,
void
thermal_zone_of_sensor_unregister
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tz
);
struct
thermal_zone_device
*
tz
);
struct
thermal_zone_device
*
devm_thermal_zone_of_sensor_register
(
struct
device
*
dev
,
int
id
,
void
*
data
,
const
struct
thermal_zone_of_device_ops
*
ops
);
void
devm_thermal_zone_of_sensor_unregister
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tz
);
#else
#else
static
inline
struct
thermal_zone_device
*
static
inline
struct
thermal_zone_device
*
thermal_zone_of_sensor_register
(
struct
device
*
dev
,
int
id
,
void
*
data
,
thermal_zone_of_sensor_register
(
struct
device
*
dev
,
int
id
,
void
*
data
,
...
@@ -376,6 +381,19 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
...
@@ -376,6 +381,19 @@ void thermal_zone_of_sensor_unregister(struct device *dev,
{
{
}
}
static
inline
struct
thermal_zone_device
*
devm_thermal_zone_of_sensor_register
(
struct
device
*
dev
,
int
id
,
void
*
data
,
const
struct
thermal_zone_of_device_ops
*
ops
)
{
return
ERR_PTR
(
-
ENODEV
);
}
static
inline
void
devm_thermal_zone_of_sensor_unregister
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tz
)
{
}
#endif
#endif
#if IS_ENABLED(CONFIG_THERMAL)
#if IS_ENABLED(CONFIG_THERMAL)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment