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
Kirill Smelkov
linux
Commits
065ca2a8
Commit
065ca2a8
authored
Apr 14, 2023
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge back Intel thermal control material for 6.4-rc1.
parents
117e4e5b
d4d85166
Changes
67
Hide whitespace changes
Inline
Side-by-side
Showing
67 changed files
with
223 additions
and
249 deletions
+223
-249
drivers/acpi/thermal.c
drivers/acpi/thermal.c
+9
-9
drivers/ata/ahci_imx.c
drivers/ata/ahci_imx.c
+1
-1
drivers/hwmon/hwmon.c
drivers/hwmon/hwmon.c
+2
-2
drivers/hwmon/pmbus/pmbus_core.c
drivers/hwmon/pmbus/pmbus_core.c
+1
-1
drivers/hwmon/scmi-hwmon.c
drivers/hwmon/scmi-hwmon.c
+2
-2
drivers/hwmon/scpi-hwmon.c
drivers/hwmon/scpi-hwmon.c
+1
-1
drivers/iio/adc/sun4i-gpadc-iio.c
drivers/iio/adc/sun4i-gpadc-iio.c
+1
-1
drivers/input/touchscreen/sun4i-ts.c
drivers/input/touchscreen/sun4i-ts.c
+1
-1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
+1
-1
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+8
-8
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+2
-2
drivers/platform/x86/acerhdf.c
drivers/platform/x86/acerhdf.c
+3
-16
drivers/power/supply/power_supply_core.c
drivers/power/supply/power_supply_core.c
+1
-1
drivers/regulator/max8973-regulator.c
drivers/regulator/max8973-regulator.c
+1
-1
drivers/thermal/amlogic_thermal.c
drivers/thermal/amlogic_thermal.c
+2
-2
drivers/thermal/armada_thermal.c
drivers/thermal/armada_thermal.c
+4
-10
drivers/thermal/broadcom/bcm2711_thermal.c
drivers/thermal/broadcom/bcm2711_thermal.c
+1
-2
drivers/thermal/broadcom/bcm2835_thermal.c
drivers/thermal/broadcom/bcm2835_thermal.c
+1
-2
drivers/thermal/broadcom/brcmstb_thermal.c
drivers/thermal/broadcom/brcmstb_thermal.c
+3
-5
drivers/thermal/broadcom/ns-thermal.c
drivers/thermal/broadcom/ns-thermal.c
+1
-1
drivers/thermal/broadcom/sr-thermal.c
drivers/thermal/broadcom/sr-thermal.c
+1
-1
drivers/thermal/da9062-thermal.c
drivers/thermal/da9062-thermal.c
+8
-5
drivers/thermal/db8500_thermal.c
drivers/thermal/db8500_thermal.c
+1
-1
drivers/thermal/dove_thermal.c
drivers/thermal/dove_thermal.c
+2
-5
drivers/thermal/hisi_thermal.c
drivers/thermal/hisi_thermal.c
+1
-4
drivers/thermal/imx8mm_thermal.c
drivers/thermal/imx8mm_thermal.c
+2
-2
drivers/thermal/imx_sc_thermal.c
drivers/thermal/imx_sc_thermal.c
+3
-6
drivers/thermal/imx_thermal.c
drivers/thermal/imx_thermal.c
+12
-35
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+1
-1
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+2
-2
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
...rmal/intel/int340x_thermal/processor_thermal_device_pci.c
+2
-2
drivers/thermal/intel/intel_pch_thermal.c
drivers/thermal/intel/intel_pch_thermal.c
+1
-1
drivers/thermal/intel/intel_quark_dts_thermal.c
drivers/thermal/intel/intel_quark_dts_thermal.c
+3
-3
drivers/thermal/intel/intel_soc_dts_iosf.c
drivers/thermal/intel/intel_soc_dts_iosf.c
+5
-8
drivers/thermal/intel/x86_pkg_temp_thermal.c
drivers/thermal/intel/x86_pkg_temp_thermal.c
+7
-5
drivers/thermal/k3_bandgap.c
drivers/thermal/k3_bandgap.c
+2
-2
drivers/thermal/k3_j72xx_bandgap.c
drivers/thermal/k3_j72xx_bandgap.c
+1
-1
drivers/thermal/kirkwood_thermal.c
drivers/thermal/kirkwood_thermal.c
+2
-5
drivers/thermal/max77620_thermal.c
drivers/thermal/max77620_thermal.c
+2
-4
drivers/thermal/mediatek/auxadc_thermal.c
drivers/thermal/mediatek/auxadc_thermal.c
+2
-2
drivers/thermal/mediatek/lvts_thermal.c
drivers/thermal/mediatek/lvts_thermal.c
+6
-4
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
+3
-3
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+3
-3
drivers/thermal/qcom/tsens.c
drivers/thermal/qcom/tsens.c
+3
-3
drivers/thermal/qoriq_thermal.c
drivers/thermal/qoriq_thermal.c
+2
-2
drivers/thermal/rcar_gen3_thermal.c
drivers/thermal/rcar_gen3_thermal.c
+2
-3
drivers/thermal/rcar_thermal.c
drivers/thermal/rcar_thermal.c
+1
-7
drivers/thermal/rockchip_thermal.c
drivers/thermal/rockchip_thermal.c
+2
-6
drivers/thermal/rzg2l_thermal.c
drivers/thermal/rzg2l_thermal.c
+1
-2
drivers/thermal/samsung/exynos_tmu.c
drivers/thermal/samsung/exynos_tmu.c
+2
-2
drivers/thermal/spear_thermal.c
drivers/thermal/spear_thermal.c
+5
-5
drivers/thermal/sprd_thermal.c
drivers/thermal/sprd_thermal.c
+1
-1
drivers/thermal/st/st_thermal.c
drivers/thermal/st/st_thermal.c
+1
-4
drivers/thermal/st/stm_thermal.c
drivers/thermal/st/stm_thermal.c
+2
-2
drivers/thermal/sun8i_thermal.c
drivers/thermal/sun8i_thermal.c
+2
-2
drivers/thermal/tegra/soctherm.c
drivers/thermal/tegra/soctherm.c
+3
-3
drivers/thermal/tegra/tegra-bpmp-thermal.c
drivers/thermal/tegra/tegra-bpmp-thermal.c
+4
-2
drivers/thermal/tegra/tegra30-tsensor.c
drivers/thermal/tegra/tegra30-tsensor.c
+17
-14
drivers/thermal/thermal-generic-adc.c
drivers/thermal/thermal-generic-adc.c
+3
-4
drivers/thermal/thermal_core.c
drivers/thermal/thermal_core.c
+18
-0
drivers/thermal/thermal_helpers.c
drivers/thermal/thermal_helpers.c
+3
-0
drivers/thermal/thermal_hwmon.c
drivers/thermal/thermal_hwmon.c
+5
-4
drivers/thermal/thermal_hwmon.h
drivers/thermal/thermal_hwmon.h
+2
-2
drivers/thermal/thermal_mmio.c
drivers/thermal/thermal_mmio.c
+1
-1
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+5
-5
drivers/thermal/uniphier_thermal.c
drivers/thermal/uniphier_thermal.c
+1
-1
include/linux/thermal.h
include/linux/thermal.h
+19
-0
No files found.
drivers/acpi/thermal.c
View file @
065ca2a8
...
@@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
...
@@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
static
int
thermal_get_temp
(
struct
thermal_zone_device
*
thermal
,
int
*
temp
)
static
int
thermal_get_temp
(
struct
thermal_zone_device
*
thermal
,
int
*
temp
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
int
result
;
int
result
;
if
(
!
tz
)
if
(
!
tz
)
...
@@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
...
@@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
static
int
thermal_get_trip_type
(
struct
thermal_zone_device
*
thermal
,
static
int
thermal_get_trip_type
(
struct
thermal_zone_device
*
thermal
,
int
trip
,
enum
thermal_trip_type
*
type
)
int
trip
,
enum
thermal_trip_type
*
type
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
int
i
;
int
i
;
if
(
!
tz
||
trip
<
0
)
if
(
!
tz
||
trip
<
0
)
...
@@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
...
@@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
static
int
thermal_get_trip_temp
(
struct
thermal_zone_device
*
thermal
,
static
int
thermal_get_trip_temp
(
struct
thermal_zone_device
*
thermal
,
int
trip
,
int
*
temp
)
int
trip
,
int
*
temp
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
int
i
;
int
i
;
if
(
!
tz
||
trip
<
0
)
if
(
!
tz
||
trip
<
0
)
...
@@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
...
@@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
static
int
thermal_get_crit_temp
(
struct
thermal_zone_device
*
thermal
,
static
int
thermal_get_crit_temp
(
struct
thermal_zone_device
*
thermal
,
int
*
temperature
)
int
*
temperature
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
if
(
tz
->
trips
.
critical
.
flags
.
valid
)
{
if
(
tz
->
trips
.
critical
.
flags
.
valid
)
{
*
temperature
=
deci_kelvin_to_millicelsius_with_offset
(
*
temperature
=
deci_kelvin_to_millicelsius_with_offset
(
...
@@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
...
@@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
static
int
thermal_get_trend
(
struct
thermal_zone_device
*
thermal
,
static
int
thermal_get_trend
(
struct
thermal_zone_device
*
thermal
,
int
trip
,
enum
thermal_trend
*
trend
)
int
trip
,
enum
thermal_trend
*
trend
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
enum
thermal_trip_type
type
;
enum
thermal_trip_type
type
;
int
i
;
int
i
;
...
@@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
...
@@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
static
void
acpi_thermal_zone_device_hot
(
struct
thermal_zone_device
*
thermal
)
static
void
acpi_thermal_zone_device_hot
(
struct
thermal_zone_device
*
thermal
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
acpi_bus_generate_netlink_event
(
tz
->
device
->
pnp
.
device_class
,
acpi_bus_generate_netlink_event
(
tz
->
device
->
pnp
.
device_class
,
dev_name
(
&
tz
->
device
->
dev
),
dev_name
(
&
tz
->
device
->
dev
),
...
@@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
...
@@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
static
void
acpi_thermal_zone_device_critical
(
struct
thermal_zone_device
*
thermal
)
static
void
acpi_thermal_zone_device_critical
(
struct
thermal_zone_device
*
thermal
)
{
{
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
acpi_bus_generate_netlink_event
(
tz
->
device
->
pnp
.
device_class
,
acpi_bus_generate_netlink_event
(
tz
->
device
->
pnp
.
device_class
,
dev_name
(
&
tz
->
device
->
dev
),
dev_name
(
&
tz
->
device
->
dev
),
...
@@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
...
@@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
bool
bind
)
bool
bind
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
->
devdata
;
struct
acpi_thermal
*
tz
=
thermal
_zone_device_priv
(
thermal
)
;
struct
acpi_device
*
dev
;
struct
acpi_device
*
dev
;
acpi_handle
handle
;
acpi_handle
handle
;
int
i
;
int
i
;
...
@@ -842,7 +842,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
...
@@ -842,7 +842,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
goto
acpi_bus_detach
;
goto
acpi_bus_detach
;
dev_info
(
&
tz
->
device
->
dev
,
"registered as thermal_zone%d
\n
"
,
dev_info
(
&
tz
->
device
->
dev
,
"registered as thermal_zone%d
\n
"
,
t
z
->
thermal_zone
->
id
);
t
hermal_zone_device_id
(
tz
->
thermal_zone
)
);
return
0
;
return
0
;
...
...
drivers/ata/ahci_imx.c
View file @
065ca2a8
...
@@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int *temp)
...
@@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int *temp)
static
int
sata_ahci_read_temperature
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
sata_ahci_read_temperature
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
return
__sata_ahci_read_temperature
(
t
z
->
devdata
,
temp
);
return
__sata_ahci_read_temperature
(
t
hermal_zone_device_priv
(
tz
)
,
temp
);
}
}
static
ssize_t
sata_ahci_show_temp
(
struct
device
*
dev
,
static
ssize_t
sata_ahci_show_temp
(
struct
device
*
dev
,
...
...
drivers/hwmon/hwmon.c
View file @
065ca2a8
...
@@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida);
...
@@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida);
#ifdef CONFIG_THERMAL_OF
#ifdef CONFIG_THERMAL_OF
static
int
hwmon_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
hwmon_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
hwmon_thermal_data
*
tdata
=
t
z
->
devdata
;
struct
hwmon_thermal_data
*
tdata
=
t
hermal_zone_device_priv
(
tz
)
;
struct
hwmon_device
*
hwdev
=
to_hwmon_device
(
tdata
->
dev
);
struct
hwmon_device
*
hwdev
=
to_hwmon_device
(
tdata
->
dev
);
int
ret
;
int
ret
;
long
t
;
long
t
;
...
@@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
static
int
hwmon_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
hwmon_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
hwmon_thermal_data
*
tdata
=
t
z
->
devdata
;
struct
hwmon_thermal_data
*
tdata
=
t
hermal_zone_device_priv
(
tz
)
;
struct
hwmon_device
*
hwdev
=
to_hwmon_device
(
tdata
->
dev
);
struct
hwmon_device
*
hwdev
=
to_hwmon_device
(
tdata
->
dev
);
const
struct
hwmon_chip_info
*
chip
=
hwdev
->
chip
;
const
struct
hwmon_chip_info
*
chip
=
hwdev
->
chip
;
const
struct
hwmon_channel_info
**
info
=
chip
->
info
;
const
struct
hwmon_channel_info
**
info
=
chip
->
info
;
...
...
drivers/hwmon/pmbus/pmbus_core.c
View file @
065ca2a8
...
@@ -1272,7 +1272,7 @@ struct pmbus_thermal_data {
...
@@ -1272,7 +1272,7 @@ struct pmbus_thermal_data {
static
int
pmbus_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
pmbus_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
pmbus_thermal_data
*
tdata
=
t
z
->
devdata
;
struct
pmbus_thermal_data
*
tdata
=
t
hermal_zone_device_priv
(
tz
)
;
struct
pmbus_sensor
*
sensor
=
tdata
->
sensor
;
struct
pmbus_sensor
*
sensor
=
tdata
->
sensor
;
struct
pmbus_data
*
pmbus_data
=
tdata
->
pmbus_data
;
struct
pmbus_data
*
pmbus_data
=
tdata
->
pmbus_data
;
struct
i2c_client
*
client
=
to_i2c_client
(
pmbus_data
->
dev
);
struct
i2c_client
*
client
=
to_i2c_client
(
pmbus_data
->
dev
);
...
...
drivers/hwmon/scmi-hwmon.c
View file @
065ca2a8
...
@@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
...
@@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
{
{
int
ret
;
int
ret
;
long
value
;
long
value
;
struct
scmi_thermal_sensor
*
th_sensor
=
t
z
->
devdata
;
struct
scmi_thermal_sensor
*
th_sensor
=
t
hermal_zone_device_priv
(
tz
)
;
ret
=
scmi_hwmon_read_scaled_value
(
th_sensor
->
ph
,
th_sensor
->
info
,
ret
=
scmi_hwmon_read_scaled_value
(
th_sensor
->
ph
,
th_sensor
->
info
,
&
value
);
&
value
);
...
@@ -220,7 +220,7 @@ static int scmi_thermal_sensor_register(struct device *dev,
...
@@ -220,7 +220,7 @@ static int scmi_thermal_sensor_register(struct device *dev,
sensor
->
name
);
sensor
->
name
);
}
else
{
}
else
{
dev_dbg
(
dev
,
"Sensor '%s' attached to thermal zone ID:%d
\n
"
,
dev_dbg
(
dev
,
"Sensor '%s' attached to thermal zone ID:%d
\n
"
,
sensor
->
name
,
t
zd
->
id
);
sensor
->
name
,
t
hermal_zone_device_id
(
tzd
)
);
}
}
return
0
;
return
0
;
...
...
drivers/hwmon/scpi-hwmon.c
View file @
065ca2a8
...
@@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor)
...
@@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor)
static
int
scpi_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
scpi_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
scpi_thermal_zone
*
zone
=
t
z
->
devdata
;
struct
scpi_thermal_zone
*
zone
=
t
hermal_zone_device_priv
(
tz
)
;
struct
scpi_sensors
*
scpi_sensors
=
zone
->
scpi_sensors
;
struct
scpi_sensors
*
scpi_sensors
=
zone
->
scpi_sensors
;
struct
scpi_ops
*
scpi_ops
=
scpi_sensors
->
scpi_ops
;
struct
scpi_ops
*
scpi_ops
=
scpi_sensors
->
scpi_ops
;
struct
sensor_data
*
sensor
=
&
scpi_sensors
->
data
[
zone
->
sensor_id
];
struct
sensor_data
*
sensor
=
&
scpi_sensors
->
data
[
zone
->
sensor_id
];
...
...
drivers/iio/adc/sun4i-gpadc-iio.c
View file @
065ca2a8
...
@@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
...
@@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
static
int
sun4i_gpadc_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
sun4i_gpadc_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
sun4i_gpadc_iio
*
info
=
t
z
->
devdata
;
struct
sun4i_gpadc_iio
*
info
=
t
hermal_zone_device_priv
(
tz
)
;
int
val
,
scale
,
offset
;
int
val
,
scale
,
offset
;
if
(
sun4i_gpadc_temp_read
(
info
->
indio_dev
,
&
val
))
if
(
sun4i_gpadc_temp_read
(
info
->
indio_dev
,
&
val
))
...
...
drivers/input/touchscreen/sun4i-ts.c
View file @
065ca2a8
...
@@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
...
@@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
static
int
sun4i_get_tz_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
sun4i_get_tz_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
return
sun4i_get_temp
(
t
z
->
devdata
,
temp
);
return
sun4i_get_temp
(
t
hermal_zone_device_priv
(
tz
)
,
temp
);
}
}
static
const
struct
thermal_zone_device_ops
sun4i_ts_tz_ops
=
{
static
const
struct
thermal_zone_device_ops
sun4i_ts_tz_ops
=
{
...
...
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
View file @
065ca2a8
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
static
int
cxgb4_thermal_get_temp
(
struct
thermal_zone_device
*
tzdev
,
static
int
cxgb4_thermal_get_temp
(
struct
thermal_zone_device
*
tzdev
,
int
*
temp
)
int
*
temp
)
{
{
struct
adapter
*
adap
=
t
zdev
->
devdata
;
struct
adapter
*
adap
=
t
hermal_zone_device_priv
(
tzdev
)
;
u32
param
,
val
;
u32
param
,
val
;
int
ret
;
int
ret
;
...
...
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
View file @
065ca2a8
...
@@ -176,7 +176,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
...
@@ -176,7 +176,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
if
(
crit_temp
>
emerg_temp
)
{
if
(
crit_temp
>
emerg_temp
)
{
dev_warn
(
dev
,
"%s : Critical threshold %d is above emergency threshold %d
\n
"
,
dev_warn
(
dev
,
"%s : Critical threshold %d is above emergency threshold %d
\n
"
,
t
z
->
tzdev
->
type
,
crit_temp
,
emerg_temp
);
t
hermal_zone_device_type
(
tz
->
tzdev
)
,
crit_temp
,
emerg_temp
);
return
0
;
return
0
;
}
}
...
@@ -200,7 +200,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
...
@@ -200,7 +200,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
static
int
mlxsw_thermal_bind
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_bind
(
struct
thermal_zone_device
*
tzdev
,
struct
thermal_cooling_device
*
cdev
)
struct
thermal_cooling_device
*
cdev
)
{
{
struct
mlxsw_thermal
*
thermal
=
t
zdev
->
devdata
;
struct
mlxsw_thermal
*
thermal
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
device
*
dev
=
thermal
->
bus_info
->
dev
;
struct
device
*
dev
=
thermal
->
bus_info
->
dev
;
int
i
,
err
;
int
i
,
err
;
...
@@ -226,7 +226,7 @@ static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
...
@@ -226,7 +226,7 @@ static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
static
int
mlxsw_thermal_unbind
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_unbind
(
struct
thermal_zone_device
*
tzdev
,
struct
thermal_cooling_device
*
cdev
)
struct
thermal_cooling_device
*
cdev
)
{
{
struct
mlxsw_thermal
*
thermal
=
t
zdev
->
devdata
;
struct
mlxsw_thermal
*
thermal
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
device
*
dev
=
thermal
->
bus_info
->
dev
;
struct
device
*
dev
=
thermal
->
bus_info
->
dev
;
int
i
;
int
i
;
int
err
;
int
err
;
...
@@ -248,7 +248,7 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
...
@@ -248,7 +248,7 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
static
int
mlxsw_thermal_get_temp
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_get_temp
(
struct
thermal_zone_device
*
tzdev
,
int
*
p_temp
)
int
*
p_temp
)
{
{
struct
mlxsw_thermal
*
thermal
=
t
zdev
->
devdata
;
struct
mlxsw_thermal
*
thermal
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
device
*
dev
=
thermal
->
bus_info
->
dev
;
struct
device
*
dev
=
thermal
->
bus_info
->
dev
;
char
mtmp_pl
[
MLXSW_REG_MTMP_LEN
];
char
mtmp_pl
[
MLXSW_REG_MTMP_LEN
];
int
temp
;
int
temp
;
...
@@ -280,7 +280,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
...
@@ -280,7 +280,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
static
int
mlxsw_thermal_module_bind
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_module_bind
(
struct
thermal_zone_device
*
tzdev
,
struct
thermal_cooling_device
*
cdev
)
struct
thermal_cooling_device
*
cdev
)
{
{
struct
mlxsw_thermal_module
*
tz
=
t
zdev
->
devdata
;
struct
mlxsw_thermal_module
*
tz
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
int
i
,
j
,
err
;
int
i
,
j
,
err
;
...
@@ -309,7 +309,7 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
...
@@ -309,7 +309,7 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
static
int
mlxsw_thermal_module_unbind
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_module_unbind
(
struct
thermal_zone_device
*
tzdev
,
struct
thermal_cooling_device
*
cdev
)
struct
thermal_cooling_device
*
cdev
)
{
{
struct
mlxsw_thermal_module
*
tz
=
t
zdev
->
devdata
;
struct
mlxsw_thermal_module
*
tz
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
int
i
;
int
i
;
int
err
;
int
err
;
...
@@ -355,7 +355,7 @@ mlxsw_thermal_module_temp_and_thresholds_get(struct mlxsw_core *core,
...
@@ -355,7 +355,7 @@ mlxsw_thermal_module_temp_and_thresholds_get(struct mlxsw_core *core,
static
int
mlxsw_thermal_module_temp_get
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_module_temp_get
(
struct
thermal_zone_device
*
tzdev
,
int
*
p_temp
)
int
*
p_temp
)
{
{
struct
mlxsw_thermal_module
*
tz
=
t
zdev
->
devdata
;
struct
mlxsw_thermal_module
*
tz
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
int
temp
,
crit_temp
,
emerg_temp
;
int
temp
,
crit_temp
,
emerg_temp
;
struct
device
*
dev
;
struct
device
*
dev
;
...
@@ -390,7 +390,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
...
@@ -390,7 +390,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
static
int
mlxsw_thermal_gearbox_temp_get
(
struct
thermal_zone_device
*
tzdev
,
static
int
mlxsw_thermal_gearbox_temp_get
(
struct
thermal_zone_device
*
tzdev
,
int
*
p_temp
)
int
*
p_temp
)
{
{
struct
mlxsw_thermal_module
*
tz
=
t
zdev
->
devdata
;
struct
mlxsw_thermal_module
*
tz
=
t
hermal_zone_device_priv
(
tzdev
)
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
struct
mlxsw_thermal
*
thermal
=
tz
->
parent
;
char
mtmp_pl
[
MLXSW_REG_MTMP_LEN
];
char
mtmp_pl
[
MLXSW_REG_MTMP_LEN
];
u16
index
;
u16
index
;
...
...
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
View file @
065ca2a8
...
@@ -615,7 +615,7 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
...
@@ -615,7 +615,7 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
static
int
iwl_mvm_tzone_get_temp
(
struct
thermal_zone_device
*
device
,
static
int
iwl_mvm_tzone_get_temp
(
struct
thermal_zone_device
*
device
,
int
*
temperature
)
int
*
temperature
)
{
{
struct
iwl_mvm
*
mvm
=
(
struct
iwl_mvm
*
)
device
->
devdata
;
struct
iwl_mvm
*
mvm
=
thermal_zone_device_priv
(
device
)
;
int
ret
;
int
ret
;
int
temp
;
int
temp
;
...
@@ -641,7 +641,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
...
@@ -641,7 +641,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
static
int
iwl_mvm_tzone_set_trip_temp
(
struct
thermal_zone_device
*
device
,
static
int
iwl_mvm_tzone_set_trip_temp
(
struct
thermal_zone_device
*
device
,
int
trip
,
int
temp
)
int
trip
,
int
temp
)
{
{
struct
iwl_mvm
*
mvm
=
(
struct
iwl_mvm
*
)
device
->
devdata
;
struct
iwl_mvm
*
mvm
=
thermal_zone_device_priv
(
device
)
;
struct
iwl_mvm_thermal_device
*
tzone
;
struct
iwl_mvm_thermal_device
*
tzone
;
int
ret
;
int
ret
;
...
...
drivers/platform/x86/acerhdf.c
View file @
065ca2a8
...
@@ -79,7 +79,6 @@ static unsigned int list_supported;
...
@@ -79,7 +79,6 @@ static unsigned int list_supported;
static
unsigned
int
fanstate
=
ACERHDF_FAN_AUTO
;
static
unsigned
int
fanstate
=
ACERHDF_FAN_AUTO
;
static
char
force_bios
[
16
];
static
char
force_bios
[
16
];
static
char
force_product
[
16
];
static
char
force_product
[
16
];
static
unsigned
int
prev_interval
;
static
struct
thermal_zone_device
*
thz_dev
;
static
struct
thermal_zone_device
*
thz_dev
;
static
struct
thermal_cooling_device
*
cl_dev
;
static
struct
thermal_cooling_device
*
cl_dev
;
static
struct
platform_device
*
acerhdf_dev
;
static
struct
platform_device
*
acerhdf_dev
;
...
@@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal)
...
@@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal)
trips
[
0
].
temperature
=
fanon
;
trips
[
0
].
temperature
=
fanon
;
trips
[
0
].
hysteresis
=
fanon
-
fanoff
;
trips
[
0
].
hysteresis
=
fanon
-
fanoff
;
if
(
kernelmode
&&
prev_interval
!=
interval
)
{
if
(
kernelmode
)
{
if
(
interval
>
ACERHDF_MAX_INTERVAL
)
{
if
(
interval
>
ACERHDF_MAX_INTERVAL
)
{
pr_err
(
"interval too high, set to %d
\n
"
,
pr_err
(
"interval too high, set to %d
\n
"
,
ACERHDF_MAX_INTERVAL
);
ACERHDF_MAX_INTERVAL
);
interval
=
ACERHDF_MAX_INTERVAL
;
interval
=
ACERHDF_MAX_INTERVAL
;
}
}
if
(
verbose
)
if
(
verbose
)
pr_notice
(
"interval changed to: %d
\n
"
,
interval
);
pr_notice
(
"interval changed to: %d
\n
"
,
interval
);
if
(
thermal
)
thermal
->
polling_delay_jiffies
=
round_jiffies
(
msecs_to_jiffies
(
interval
*
1000
));
prev_interval
=
interval
;
}
}
}
}
...
@@ -697,13 +691,6 @@ static int __init acerhdf_register_thermal(void)
...
@@ -697,13 +691,6 @@ static int __init acerhdf_register_thermal(void)
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
if
(
strcmp
(
thz_dev
->
governor
->
name
,
acerhdf_zone_params
.
governor_name
))
{
pr_err
(
"Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.
\n
"
,
acerhdf_zone_params
.
governor_name
);
return
-
EINVAL
;
}
return
0
;
return
0
;
}
}
...
@@ -801,5 +788,5 @@ static const struct kernel_param_ops interval_ops = {
...
@@ -801,5 +788,5 @@ static const struct kernel_param_ops interval_ops = {
.
get
=
param_get_uint
,
.
get
=
param_get_uint
,
};
};
module_param_cb
(
interval
,
&
interval_ops
,
&
interval
,
0
6
00
);
module_param_cb
(
interval
,
&
interval_ops
,
&
interval
,
0
0
00
);
MODULE_PARM_DESC
(
interval
,
"Polling interval of temperature check"
);
MODULE_PARM_DESC
(
interval
,
"Polling interval of temperature check"
);
drivers/power/supply/power_supply_core.c
View file @
065ca2a8
...
@@ -1142,7 +1142,7 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd,
...
@@ -1142,7 +1142,7 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd,
int
ret
;
int
ret
;
WARN_ON
(
tzd
==
NULL
);
WARN_ON
(
tzd
==
NULL
);
psy
=
t
zd
->
devdata
;
psy
=
t
hermal_zone_device_priv
(
tzd
)
;
ret
=
power_supply_get_property
(
psy
,
POWER_SUPPLY_PROP_TEMP
,
&
val
);
ret
=
power_supply_get_property
(
psy
,
POWER_SUPPLY_PROP_TEMP
,
&
val
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
...
...
drivers/regulator/max8973-regulator.c
View file @
065ca2a8
...
@@ -436,7 +436,7 @@ static int max8973_init_dcdc(struct max8973_chip *max,
...
@@ -436,7 +436,7 @@ static int max8973_init_dcdc(struct max8973_chip *max,
static
int
max8973_thermal_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
max8973_thermal_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
max8973_chip
*
mchip
=
t
z
->
devdata
;
struct
max8973_chip
*
mchip
=
t
hermal_zone_device_priv
(
tz
)
;
unsigned
int
val
;
unsigned
int
val
;
int
ret
;
int
ret
;
...
...
drivers/thermal/amlogic_thermal.c
View file @
065ca2a8
...
@@ -181,7 +181,7 @@ static int amlogic_thermal_disable(struct amlogic_thermal *data)
...
@@ -181,7 +181,7 @@ static int amlogic_thermal_disable(struct amlogic_thermal *data)
static
int
amlogic_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
amlogic_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
unsigned
int
tval
;
unsigned
int
tval
;
struct
amlogic_thermal
*
pdata
=
t
z
->
devdata
;
struct
amlogic_thermal
*
pdata
=
t
hermal_zone_device_priv
(
tz
)
;
if
(
!
pdata
)
if
(
!
pdata
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -285,7 +285,7 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
...
@@ -285,7 +285,7 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
return
ret
;
return
ret
;
}
}
if
(
devm_thermal_add_hwmon_sysfs
(
pdata
->
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
&
pdev
->
dev
,
pdata
->
tzd
))
dev_warn
(
&
pdev
->
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
dev_warn
(
&
pdev
->
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
ret
=
amlogic_thermal_initialize
(
pdata
);
ret
=
amlogic_thermal_initialize
(
pdata
);
...
...
drivers/thermal/armada_thermal.c
View file @
065ca2a8
...
@@ -360,11 +360,8 @@ static int armada_select_channel(struct armada_thermal_priv *priv, int channel)
...
@@ -360,11 +360,8 @@ static int armada_select_channel(struct armada_thermal_priv *priv, int channel)
* we must absolutely wait for the sensor validity bit to ensure we read
* we must absolutely wait for the sensor validity bit to ensure we read
* actual data.
* actual data.
*/
*/
if
(
armada_wait_sensor_validity
(
priv
))
{
if
(
armada_wait_sensor_validity
(
priv
))
dev_err
(
priv
->
dev
,
"Temperature sensor reading not valid
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
return
0
;
return
0
;
}
}
...
@@ -398,15 +395,12 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp)
...
@@ -398,15 +395,12 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp)
static
int
armada_get_temp_legacy
(
struct
thermal_zone_device
*
thermal
,
static
int
armada_get_temp_legacy
(
struct
thermal_zone_device
*
thermal
,
int
*
temp
)
int
*
temp
)
{
{
struct
armada_thermal_priv
*
priv
=
thermal
->
devdata
;
struct
armada_thermal_priv
*
priv
=
thermal
_zone_device_priv
(
thermal
)
;
int
ret
;
int
ret
;
/* Valid check */
/* Valid check */
if
(
!
armada_is_valid
(
priv
))
{
if
(
!
armada_is_valid
(
priv
))
dev_err
(
priv
->
dev
,
"Temperature sensor reading not valid
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
/* Do the actual reading */
/* Do the actual reading */
ret
=
armada_read_sensor
(
priv
,
temp
);
ret
=
armada_read_sensor
(
priv
,
temp
);
...
@@ -420,7 +414,7 @@ static struct thermal_zone_device_ops legacy_ops = {
...
@@ -420,7 +414,7 @@ static struct thermal_zone_device_ops legacy_ops = {
static
int
armada_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
armada_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
armada_thermal_sensor
*
sensor
=
t
z
->
devdata
;
struct
armada_thermal_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
struct
armada_thermal_priv
*
priv
=
sensor
->
priv
;
struct
armada_thermal_priv
*
priv
=
sensor
->
priv
;
int
ret
;
int
ret
;
...
...
drivers/thermal/broadcom/bcm2711_thermal.c
View file @
065ca2a8
...
@@ -33,7 +33,7 @@ struct bcm2711_thermal_priv {
...
@@ -33,7 +33,7 @@ struct bcm2711_thermal_priv {
static
int
bcm2711_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
bcm2711_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
bcm2711_thermal_priv
*
priv
=
t
z
->
devdata
;
struct
bcm2711_thermal_priv
*
priv
=
t
hermal_zone_device_priv
(
tz
)
;
int
slope
=
thermal_zone_get_slope
(
tz
);
int
slope
=
thermal_zone_get_slope
(
tz
);
int
offset
=
thermal_zone_get_offset
(
tz
);
int
offset
=
thermal_zone_get_offset
(
tz
);
u32
val
;
u32
val
;
...
@@ -98,7 +98,6 @@ static int bcm2711_thermal_probe(struct platform_device *pdev)
...
@@ -98,7 +98,6 @@ static int bcm2711_thermal_probe(struct platform_device *pdev)
priv
->
thermal
=
thermal
;
priv
->
thermal
=
thermal
;
thermal
->
tzp
->
no_hwmon
=
false
;
return
thermal_add_hwmon_sysfs
(
thermal
);
return
thermal_add_hwmon_sysfs
(
thermal
);
}
}
...
...
drivers/thermal/broadcom/bcm2835_thermal.c
View file @
065ca2a8
...
@@ -90,7 +90,7 @@ static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)
...
@@ -90,7 +90,7 @@ static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)
static
int
bcm2835_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
bcm2835_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
bcm2835_thermal_data
*
data
=
t
z
->
devdata
;
struct
bcm2835_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
u32
val
=
readl
(
data
->
regs
+
BCM2835_TS_TSENSSTAT
);
u32
val
=
readl
(
data
->
regs
+
BCM2835_TS_TSENSSTAT
);
if
(
!
(
val
&
BCM2835_TS_TSENSSTAT_VALID
))
if
(
!
(
val
&
BCM2835_TS_TSENSSTAT_VALID
))
...
@@ -267,7 +267,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
...
@@ -267,7 +267,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
* Thermal_zone doesn't enable hwmon as default,
* Thermal_zone doesn't enable hwmon as default,
* enable it here
* enable it here
*/
*/
tz
->
tzp
->
no_hwmon
=
false
;
err
=
thermal_add_hwmon_sysfs
(
tz
);
err
=
thermal_add_hwmon_sysfs
(
tz
);
if
(
err
)
if
(
err
)
goto
err_tz
;
goto
err_tz
;
...
...
drivers/thermal/broadcom/brcmstb_thermal.c
View file @
065ca2a8
...
@@ -152,16 +152,14 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv,
...
@@ -152,16 +152,14 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv,
static
int
brcmstb_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
brcmstb_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
brcmstb_thermal_priv
*
priv
=
t
z
->
devdata
;
struct
brcmstb_thermal_priv
*
priv
=
t
hermal_zone_device_priv
(
tz
)
;
u32
val
;
u32
val
;
long
t
;
long
t
;
val
=
__raw_readl
(
priv
->
tmon_base
+
AVS_TMON_STATUS
);
val
=
__raw_readl
(
priv
->
tmon_base
+
AVS_TMON_STATUS
);
if
(
!
(
val
&
AVS_TMON_STATUS_valid_msk
))
{
if
(
!
(
val
&
AVS_TMON_STATUS_valid_msk
))
dev_err
(
priv
->
dev
,
"reading not valid
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
val
=
(
val
&
AVS_TMON_STATUS_data_msk
)
>>
AVS_TMON_STATUS_data_shift
;
val
=
(
val
&
AVS_TMON_STATUS_data_msk
)
>>
AVS_TMON_STATUS_data_shift
;
...
@@ -262,7 +260,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data)
...
@@ -262,7 +260,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data)
static
int
brcmstb_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
brcmstb_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
brcmstb_thermal_priv
*
priv
=
t
z
->
devdata
;
struct
brcmstb_thermal_priv
*
priv
=
t
hermal_zone_device_priv
(
tz
)
;
dev_dbg
(
priv
->
dev
,
"set trips %d <--> %d
\n
"
,
low
,
high
);
dev_dbg
(
priv
->
dev
,
"set trips %d <--> %d
\n
"
,
low
,
high
);
...
...
drivers/thermal/broadcom/ns-thermal.c
View file @
065ca2a8
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
static
int
ns_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
ns_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
void
__iomem
*
pvtmon
=
t
z
->
devdata
;
void
__iomem
*
pvtmon
=
t
hermal_zone_device_priv
(
tz
)
;
int
offset
=
thermal_zone_get_offset
(
tz
);
int
offset
=
thermal_zone_get_offset
(
tz
);
int
slope
=
thermal_zone_get_slope
(
tz
);
int
slope
=
thermal_zone_get_slope
(
tz
);
u32
val
;
u32
val
;
...
...
drivers/thermal/broadcom/sr-thermal.c
View file @
065ca2a8
...
@@ -32,7 +32,7 @@ struct sr_thermal {
...
@@ -32,7 +32,7 @@ struct sr_thermal {
static
int
sr_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
sr_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
sr_tmon
*
tmon
=
t
z
->
devdata
;
struct
sr_tmon
*
tmon
=
t
hermal_zone_device_priv
(
tz
)
;
struct
sr_thermal
*
sr_thermal
=
tmon
->
priv
;
struct
sr_thermal
*
sr_thermal
=
tmon
->
priv
;
*
temp
=
readl
(
sr_thermal
->
regs
+
SR_TMON_TEMP_BASE
(
tmon
->
tmon_id
));
*
temp
=
readl
(
sr_thermal
->
regs
+
SR_TMON_TEMP_BASE
(
tmon
->
tmon_id
));
...
...
drivers/thermal/da9062-thermal.c
View file @
065ca2a8
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
#define DA9062_MILLI_CELSIUS(t) ((t) * 1000)
#define DA9062_MILLI_CELSIUS(t) ((t) * 1000)
static
unsigned
int
pp_tmp
=
DA9062_DEFAULT_POLLING_MS_PERIOD
;
struct
da9062_thermal_config
{
struct
da9062_thermal_config
{
const
char
*
name
;
const
char
*
name
;
};
};
...
@@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *work)
...
@@ -95,7 +97,10 @@ static void da9062_thermal_poll_on(struct work_struct *work)
thermal_zone_device_update
(
thermal
->
zone
,
thermal_zone_device_update
(
thermal
->
zone
,
THERMAL_EVENT_UNSPECIFIED
);
THERMAL_EVENT_UNSPECIFIED
);
delay
=
thermal
->
zone
->
passive_delay_jiffies
;
/*
* pp_tmp is between 1s and 10s, so we can round the jiffies
*/
delay
=
round_jiffies
(
msecs_to_jiffies
(
pp_tmp
));
queue_delayed_work
(
system_freezable_wq
,
&
thermal
->
work
,
delay
);
queue_delayed_work
(
system_freezable_wq
,
&
thermal
->
work
,
delay
);
return
;
return
;
}
}
...
@@ -123,7 +128,7 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
...
@@ -123,7 +128,7 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
static
int
da9062_thermal_get_temp
(
struct
thermal_zone_device
*
z
,
static
int
da9062_thermal_get_temp
(
struct
thermal_zone_device
*
z
,
int
*
temp
)
int
*
temp
)
{
{
struct
da9062_thermal
*
thermal
=
z
->
devdata
;
struct
da9062_thermal
*
thermal
=
thermal_zone_device_priv
(
z
)
;
mutex_lock
(
&
thermal
->
lock
);
mutex_lock
(
&
thermal
->
lock
);
*
temp
=
thermal
->
temperature
;
*
temp
=
thermal
->
temperature
;
...
@@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device *pdev)
...
@@ -155,7 +160,6 @@ static int da9062_thermal_probe(struct platform_device *pdev)
{
{
struct
da9062
*
chip
=
dev_get_drvdata
(
pdev
->
dev
.
parent
);
struct
da9062
*
chip
=
dev_get_drvdata
(
pdev
->
dev
.
parent
);
struct
da9062_thermal
*
thermal
;
struct
da9062_thermal
*
thermal
;
unsigned
int
pp_tmp
=
DA9062_DEFAULT_POLLING_MS_PERIOD
;
const
struct
of_device_id
*
match
;
const
struct
of_device_id
*
match
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev)
...
@@ -208,8 +212,7 @@ static int da9062_thermal_probe(struct platform_device *pdev)
}
}
dev_dbg
(
&
pdev
->
dev
,
dev_dbg
(
&
pdev
->
dev
,
"TJUNC temperature polling period set at %d ms
\n
"
,
"TJUNC temperature polling period set at %d ms
\n
"
,
pp_tmp
);
jiffies_to_msecs
(
thermal
->
zone
->
passive_delay_jiffies
));
ret
=
platform_get_irq_byname
(
pdev
,
"THERMAL"
);
ret
=
platform_get_irq_byname
(
pdev
,
"THERMAL"
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
...
drivers/thermal/db8500_thermal.c
View file @
065ca2a8
...
@@ -60,7 +60,7 @@ struct db8500_thermal_zone {
...
@@ -60,7 +60,7 @@ struct db8500_thermal_zone {
/* Callback to get current temperature */
/* Callback to get current temperature */
static
int
db8500_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
db8500_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
db8500_thermal_zone
*
th
=
t
z
->
devdata
;
struct
db8500_thermal_zone
*
th
=
t
hermal_zone_device_priv
(
tz
)
;
/*
/*
* TODO: There is no PRCMU interface to get temperature data currently,
* TODO: There is no PRCMU interface to get temperature data currently,
...
...
drivers/thermal/dove_thermal.c
View file @
065ca2a8
...
@@ -87,15 +87,12 @@ static int dove_get_temp(struct thermal_zone_device *thermal,
...
@@ -87,15 +87,12 @@ static int dove_get_temp(struct thermal_zone_device *thermal,
int
*
temp
)
int
*
temp
)
{
{
unsigned
long
reg
;
unsigned
long
reg
;
struct
dove_thermal_priv
*
priv
=
thermal
->
devdata
;
struct
dove_thermal_priv
*
priv
=
thermal
_zone_device_priv
(
thermal
)
;
/* Valid check */
/* Valid check */
reg
=
readl_relaxed
(
priv
->
control
+
PMU_TEMP_DIOD_CTRL1_REG
);
reg
=
readl_relaxed
(
priv
->
control
+
PMU_TEMP_DIOD_CTRL1_REG
);
if
((
reg
&
PMU_TDC1_TEMP_VALID_MASK
)
==
0x0
)
{
if
((
reg
&
PMU_TDC1_TEMP_VALID_MASK
)
==
0x0
)
dev_err
(
&
thermal
->
device
,
"Temperature sensor reading not valid
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
/*
/*
* Calculate temperature. According to Marvell internal
* Calculate temperature. According to Marvell internal
...
...
drivers/thermal/hisi_thermal.c
View file @
065ca2a8
...
@@ -431,14 +431,11 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)
...
@@ -431,14 +431,11 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)
static
int
hisi_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
hisi_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
hisi_thermal_sensor
*
sensor
=
t
z
->
devdata
;
struct
hisi_thermal_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
struct
hisi_thermal_data
*
data
=
sensor
->
data
;
struct
hisi_thermal_data
*
data
=
sensor
->
data
;
*
temp
=
data
->
ops
->
get_temp
(
sensor
);
*
temp
=
data
->
ops
->
get_temp
(
sensor
);
dev_dbg
(
&
data
->
pdev
->
dev
,
"tzd=%p, id=%d, temp=%d, thres=%d
\n
"
,
sensor
->
tzd
,
sensor
->
id
,
*
temp
,
sensor
->
thres_temp
);
return
0
;
return
0
;
}
}
...
...
drivers/thermal/imx8mm_thermal.c
View file @
065ca2a8
...
@@ -141,7 +141,7 @@ static int imx8mp_tmu_get_temp(void *data, int *temp)
...
@@ -141,7 +141,7 @@ static int imx8mp_tmu_get_temp(void *data, int *temp)
static
int
tmu_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
tmu_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
tmu_sensor
*
sensor
=
t
z
->
devdata
;
struct
tmu_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
struct
imx8mm_tmu
*
tmu
=
sensor
->
priv
;
struct
imx8mm_tmu
*
tmu
=
sensor
->
priv
;
return
tmu
->
socdata
->
get_temp
(
sensor
,
temp
);
return
tmu
->
socdata
->
get_temp
(
sensor
,
temp
);
...
@@ -343,7 +343,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
...
@@ -343,7 +343,7 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
}
}
tmu
->
sensors
[
i
].
hw_id
=
i
;
tmu
->
sensors
[
i
].
hw_id
=
i
;
if
(
devm_thermal_add_hwmon_sysfs
(
tmu
->
sensors
[
i
].
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
&
pdev
->
dev
,
tmu
->
sensors
[
i
].
tzd
))
dev_warn
(
&
pdev
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
dev_warn
(
&
pdev
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
}
}
...
...
drivers/thermal/imx_sc_thermal.c
View file @
065ca2a8
...
@@ -46,7 +46,7 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -46,7 +46,7 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
{
struct
imx_sc_msg_misc_get_temp
msg
;
struct
imx_sc_msg_misc_get_temp
msg
;
struct
imx_sc_rpc_msg
*
hdr
=
&
msg
.
hdr
;
struct
imx_sc_rpc_msg
*
hdr
=
&
msg
.
hdr
;
struct
imx_sc_sensor
*
sensor
=
t
z
->
devdata
;
struct
imx_sc_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
int
ret
;
int
ret
;
msg
.
data
.
req
.
resource_id
=
sensor
->
resource_id
;
msg
.
data
.
req
.
resource_id
=
sensor
->
resource_id
;
...
@@ -58,11 +58,8 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -58,11 +58,8 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
hdr
->
size
=
2
;
hdr
->
size
=
2
;
ret
=
imx_scu_call_rpc
(
thermal_ipc_handle
,
&
msg
,
true
);
ret
=
imx_scu_call_rpc
(
thermal_ipc_handle
,
&
msg
,
true
);
if
(
ret
)
{
if
(
ret
)
dev_err
(
&
sensor
->
tzd
->
device
,
"read temp sensor %d failed, ret %d
\n
"
,
sensor
->
resource_id
,
ret
);
return
ret
;
return
ret
;
}
*
temp
=
msg
.
data
.
resp
.
celsius
*
1000
+
msg
.
data
.
resp
.
tenths
*
100
;
*
temp
=
msg
.
data
.
resp
.
celsius
*
1000
+
msg
.
data
.
resp
.
tenths
*
100
;
...
@@ -119,7 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
...
@@ -119,7 +116,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
return
ret
;
return
ret
;
}
}
if
(
devm_thermal_add_hwmon_sysfs
(
sensor
->
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
&
pdev
->
dev
,
sensor
->
tzd
))
dev_warn
(
&
pdev
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
dev_warn
(
&
pdev
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
}
}
...
...
drivers/thermal/imx_thermal.c
View file @
065ca2a8
...
@@ -252,7 +252,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data,
...
@@ -252,7 +252,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data,
static
int
imx_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
imx_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
imx_thermal_data
*
data
=
t
z
->
devdata
;
struct
imx_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
const
struct
thermal_soc_data
*
soc_data
=
data
->
socdata
;
const
struct
thermal_soc_data
*
soc_data
=
data
->
socdata
;
struct
regmap
*
map
=
data
->
tempmon
;
struct
regmap
*
map
=
data
->
tempmon
;
unsigned
int
n_meas
;
unsigned
int
n_meas
;
...
@@ -265,10 +265,8 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -265,10 +265,8 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
regmap_read
(
map
,
soc_data
->
temp_data
,
&
val
);
regmap_read
(
map
,
soc_data
->
temp_data
,
&
val
);
if
((
val
&
soc_data
->
temp_valid_mask
)
==
0
)
{
if
((
val
&
soc_data
->
temp_valid_mask
)
==
0
)
dev_dbg
(
&
tz
->
device
,
"temp measurement never finished
\n
"
);
return
-
EAGAIN
;
return
-
EAGAIN
;
}
n_meas
=
(
val
&
soc_data
->
temp_value_mask
)
n_meas
=
(
val
&
soc_data
->
temp_value_mask
)
>>
soc_data
->
temp_value_shift
;
>>
soc_data
->
temp_value_shift
;
...
@@ -287,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -287,13 +285,13 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
if
(
data
->
alarm_temp
==
trips
[
IMX_TRIP_CRITICAL
].
temperature
&&
if
(
data
->
alarm_temp
==
trips
[
IMX_TRIP_CRITICAL
].
temperature
&&
*
temp
<
trips
[
IMX_TRIP_PASSIVE
].
temperature
)
{
*
temp
<
trips
[
IMX_TRIP_PASSIVE
].
temperature
)
{
imx_set_alarm_temp
(
data
,
trips
[
IMX_TRIP_PASSIVE
].
temperature
);
imx_set_alarm_temp
(
data
,
trips
[
IMX_TRIP_PASSIVE
].
temperature
);
dev_dbg
(
&
tz
->
device
,
"thermal alarm off: T < %d
\n
"
,
dev_dbg
(
data
->
dev
,
"thermal alarm off: T < %d
\n
"
,
data
->
alarm_temp
/
1000
);
data
->
alarm_temp
/
1000
);
}
}
}
}
if
(
*
temp
!=
data
->
last_temp
)
{
if
(
*
temp
!=
data
->
last_temp
)
{
dev_dbg
(
&
tz
->
device
,
"millicelsius: %d
\n
"
,
*
temp
);
dev_dbg
(
data
->
dev
,
"millicelsius: %d
\n
"
,
*
temp
);
data
->
last_temp
=
*
temp
;
data
->
last_temp
=
*
temp
;
}
}
...
@@ -311,7 +309,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -311,7 +309,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
static
int
imx_change_mode
(
struct
thermal_zone_device
*
tz
,
static
int
imx_change_mode
(
struct
thermal_zone_device
*
tz
,
enum
thermal_device_mode
mode
)
enum
thermal_device_mode
mode
)
{
{
struct
imx_thermal_data
*
data
=
t
z
->
devdata
;
struct
imx_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
if
(
mode
==
THERMAL_DEVICE_ENABLED
)
{
if
(
mode
==
THERMAL_DEVICE_ENABLED
)
{
pm_runtime_get
(
data
->
dev
);
pm_runtime_get
(
data
->
dev
);
...
@@ -342,7 +340,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -342,7 +340,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
static
int
imx_set_trip_temp
(
struct
thermal_zone_device
*
tz
,
int
trip
,
static
int
imx_set_trip_temp
(
struct
thermal_zone_device
*
tz
,
int
trip
,
int
temp
)
int
temp
)
{
{
struct
imx_thermal_data
*
data
=
t
z
->
devdata
;
struct
imx_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
int
ret
;
int
ret
;
ret
=
pm_runtime_resume_and_get
(
data
->
dev
);
ret
=
pm_runtime_resume_and_get
(
data
->
dev
);
...
@@ -369,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
...
@@ -369,36 +367,16 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
static
int
imx_bind
(
struct
thermal_zone_device
*
tz
,
static
int
imx_bind
(
struct
thermal_zone_device
*
tz
,
struct
thermal_cooling_device
*
cdev
)
struct
thermal_cooling_device
*
cdev
)
{
{
int
ret
;
return
thermal_zone_bind_cooling_device
(
tz
,
IMX_TRIP_PASSIVE
,
cdev
,
THERMAL_NO_LIMIT
,
ret
=
thermal_zone_bind_cooling_device
(
tz
,
IMX_TRIP_PASSIVE
,
cdev
,
THERMAL_NO_LIMIT
,
THERMAL_NO_LIMIT
,
THERMAL_WEIGHT_DEFAULT
);
THERMAL_NO_LIMIT
,
THERMAL_WEIGHT_DEFAULT
);
if
(
ret
)
{
dev_err
(
&
tz
->
device
,
"binding zone %s with cdev %s failed:%d
\n
"
,
tz
->
type
,
cdev
->
type
,
ret
);
return
ret
;
}
return
0
;
}
}
static
int
imx_unbind
(
struct
thermal_zone_device
*
tz
,
static
int
imx_unbind
(
struct
thermal_zone_device
*
tz
,
struct
thermal_cooling_device
*
cdev
)
struct
thermal_cooling_device
*
cdev
)
{
{
int
ret
;
return
thermal_zone_unbind_cooling_device
(
tz
,
IMX_TRIP_PASSIVE
,
cdev
);
ret
=
thermal_zone_unbind_cooling_device
(
tz
,
IMX_TRIP_PASSIVE
,
cdev
);
if
(
ret
)
{
dev_err
(
&
tz
->
device
,
"unbinding zone %s with cdev %s failed:%d
\n
"
,
tz
->
type
,
cdev
->
type
,
ret
);
return
ret
;
}
return
0
;
}
}
static
struct
thermal_zone_device_ops
imx_tz_ops
=
{
static
struct
thermal_zone_device_ops
imx_tz_ops
=
{
...
@@ -560,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
...
@@ -560,8 +538,7 @@ static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
{
{
struct
imx_thermal_data
*
data
=
dev
;
struct
imx_thermal_data
*
data
=
dev
;
dev_dbg
(
&
data
->
tz
->
device
,
"THERMAL ALARM: T > %d
\n
"
,
dev_dbg
(
data
->
dev
,
"THERMAL ALARM: T > %d
\n
"
,
data
->
alarm_temp
/
1000
);
data
->
alarm_temp
/
1000
);
thermal_zone_device_update
(
data
->
tz
,
THERMAL_EVENT_UNSPECIFIED
);
thermal_zone_device_update
(
data
->
tz
,
THERMAL_EVENT_UNSPECIFIED
);
...
...
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
View file @
065ca2a8
...
@@ -497,7 +497,7 @@ static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
...
@@ -497,7 +497,7 @@ static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
static
int
int3400_thermal_change_mode
(
struct
thermal_zone_device
*
thermal
,
static
int
int3400_thermal_change_mode
(
struct
thermal_zone_device
*
thermal
,
enum
thermal_device_mode
mode
)
enum
thermal_device_mode
mode
)
{
{
struct
int3400_thermal_priv
*
priv
=
thermal
->
devdata
;
struct
int3400_thermal_priv
*
priv
=
thermal
_zone_device_priv
(
thermal
)
;
int
result
=
0
;
int
result
=
0
;
if
(
!
priv
)
if
(
!
priv
)
...
...
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
View file @
065ca2a8
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
static
int
int340x_thermal_get_zone_temp
(
struct
thermal_zone_device
*
zone
,
static
int
int340x_thermal_get_zone_temp
(
struct
thermal_zone_device
*
zone
,
int
*
temp
)
int
*
temp
)
{
{
struct
int34x_thermal_zone
*
d
=
zone
->
devdata
;
struct
int34x_thermal_zone
*
d
=
thermal_zone_device_priv
(
zone
)
;
unsigned
long
long
tmp
;
unsigned
long
long
tmp
;
acpi_status
status
;
acpi_status
status
;
...
@@ -41,7 +41,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
...
@@ -41,7 +41,7 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
static
int
int340x_thermal_set_trip_temp
(
struct
thermal_zone_device
*
zone
,
static
int
int340x_thermal_set_trip_temp
(
struct
thermal_zone_device
*
zone
,
int
trip
,
int
temp
)
int
trip
,
int
temp
)
{
{
struct
int34x_thermal_zone
*
d
=
zone
->
devdata
;
struct
int34x_thermal_zone
*
d
=
thermal_zone_device_priv
(
zone
)
;
char
name
[]
=
{
'P'
,
'A'
,
'T'
,
'0'
+
trip
,
'\0'
};
char
name
[]
=
{
'P'
,
'A'
,
'T'
,
'0'
+
trip
,
'\0'
};
acpi_status
status
;
acpi_status
status
;
...
...
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
View file @
065ca2a8
...
@@ -135,7 +135,7 @@ static irqreturn_t proc_thermal_irq_handler(int irq, void *devid)
...
@@ -135,7 +135,7 @@ static irqreturn_t proc_thermal_irq_handler(int irq, void *devid)
static
int
sys_get_curr_temp
(
struct
thermal_zone_device
*
tzd
,
int
*
temp
)
static
int
sys_get_curr_temp
(
struct
thermal_zone_device
*
tzd
,
int
*
temp
)
{
{
struct
proc_thermal_pci
*
pci_info
=
t
zd
->
devdata
;
struct
proc_thermal_pci
*
pci_info
=
t
hermal_zone_device_priv
(
tzd
)
;
u32
_temp
;
u32
_temp
;
proc_thermal_mmio_read
(
pci_info
,
PROC_THERMAL_MMIO_PKG_TEMP
,
&
_temp
);
proc_thermal_mmio_read
(
pci_info
,
PROC_THERMAL_MMIO_PKG_TEMP
,
&
_temp
);
...
@@ -146,7 +146,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
...
@@ -146,7 +146,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
static
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
int
temp
)
static
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
int
temp
)
{
{
struct
proc_thermal_pci
*
pci_info
=
t
zd
->
devdata
;
struct
proc_thermal_pci
*
pci_info
=
t
hermal_zone_device_priv
(
tzd
)
;
int
tjmax
,
_temp
;
int
tjmax
,
_temp
;
if
(
temp
<=
0
)
{
if
(
temp
<=
0
)
{
...
...
drivers/thermal/intel/intel_pch_thermal.c
View file @
065ca2a8
...
@@ -119,7 +119,7 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip)
...
@@ -119,7 +119,7 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip)
static
int
pch_thermal_get_temp
(
struct
thermal_zone_device
*
tzd
,
int
*
temp
)
static
int
pch_thermal_get_temp
(
struct
thermal_zone_device
*
tzd
,
int
*
temp
)
{
{
struct
pch_thermal_device
*
ptd
=
t
zd
->
devdata
;
struct
pch_thermal_device
*
ptd
=
t
hermal_zone_device_priv
(
tzd
)
;
*
temp
=
GET_WPT_TEMP
(
WPT_TEMP_TSR
&
readw
(
ptd
->
hw_base
+
WPT_TEMP
));
*
temp
=
GET_WPT_TEMP
(
WPT_TEMP_TSR
&
readw
(
ptd
->
hw_base
+
WPT_TEMP
));
return
0
;
return
0
;
...
...
drivers/thermal/intel/intel_quark_dts_thermal.c
View file @
065ca2a8
...
@@ -120,7 +120,7 @@ static DEFINE_MUTEX(dts_update_mutex);
...
@@ -120,7 +120,7 @@ static DEFINE_MUTEX(dts_update_mutex);
static
int
soc_dts_enable
(
struct
thermal_zone_device
*
tzd
)
static
int
soc_dts_enable
(
struct
thermal_zone_device
*
tzd
)
{
{
u32
out
;
u32
out
;
struct
soc_sensor_entry
*
aux_entry
=
t
zd
->
devdata
;
struct
soc_sensor_entry
*
aux_entry
=
t
hermal_zone_device_priv
(
tzd
)
;
int
ret
;
int
ret
;
ret
=
iosf_mbi_read
(
QRK_MBI_UNIT_RMU
,
MBI_REG_READ
,
ret
=
iosf_mbi_read
(
QRK_MBI_UNIT_RMU
,
MBI_REG_READ
,
...
@@ -148,7 +148,7 @@ static int soc_dts_enable(struct thermal_zone_device *tzd)
...
@@ -148,7 +148,7 @@ static int soc_dts_enable(struct thermal_zone_device *tzd)
static
int
soc_dts_disable
(
struct
thermal_zone_device
*
tzd
)
static
int
soc_dts_disable
(
struct
thermal_zone_device
*
tzd
)
{
{
u32
out
;
u32
out
;
struct
soc_sensor_entry
*
aux_entry
=
t
zd
->
devdata
;
struct
soc_sensor_entry
*
aux_entry
=
t
hermal_zone_device_priv
(
tzd
)
;
int
ret
;
int
ret
;
ret
=
iosf_mbi_read
(
QRK_MBI_UNIT_RMU
,
MBI_REG_READ
,
ret
=
iosf_mbi_read
(
QRK_MBI_UNIT_RMU
,
MBI_REG_READ
,
...
@@ -250,7 +250,7 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry,
...
@@ -250,7 +250,7 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry,
static
inline
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
static
inline
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
int
temp
)
int
temp
)
{
{
return
update_trip_temp
(
t
zd
->
devdata
,
trip
,
temp
);
return
update_trip_temp
(
t
hermal_zone_device_priv
(
tzd
)
,
trip
,
temp
);
}
}
static
int
sys_get_curr_temp
(
struct
thermal_zone_device
*
tzd
,
static
int
sys_get_curr_temp
(
struct
thermal_zone_device
*
tzd
,
...
...
drivers/thermal/intel/intel_soc_dts_iosf.c
View file @
065ca2a8
...
@@ -54,7 +54,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
...
@@ -54,7 +54,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
struct
intel_soc_dts_sensor_entry
*
dts
;
struct
intel_soc_dts_sensor_entry
*
dts
;
struct
intel_soc_dts_sensors
*
sensors
;
struct
intel_soc_dts_sensors
*
sensors
;
dts
=
t
zd
->
devdata
;
dts
=
t
hermal_zone_device_priv
(
tzd
)
;
sensors
=
dts
->
sensors
;
sensors
=
dts
->
sensors
;
mutex_lock
(
&
sensors
->
dts_update_lock
);
mutex_lock
(
&
sensors
->
dts_update_lock
);
status
=
iosf_mbi_read
(
BT_MBI_UNIT_PMC
,
MBI_REG_READ
,
status
=
iosf_mbi_read
(
BT_MBI_UNIT_PMC
,
MBI_REG_READ
,
...
@@ -168,7 +168,7 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
...
@@ -168,7 +168,7 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
static
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
static
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
int
temp
)
int
temp
)
{
{
struct
intel_soc_dts_sensor_entry
*
dts
=
t
zd
->
devdata
;
struct
intel_soc_dts_sensor_entry
*
dts
=
t
hermal_zone_device_priv
(
tzd
)
;
struct
intel_soc_dts_sensors
*
sensors
=
dts
->
sensors
;
struct
intel_soc_dts_sensors
*
sensors
=
dts
->
sensors
;
int
status
;
int
status
;
...
@@ -176,7 +176,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
...
@@ -176,7 +176,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
return
-
EINVAL
;
return
-
EINVAL
;
mutex_lock
(
&
sensors
->
dts_update_lock
);
mutex_lock
(
&
sensors
->
dts_update_lock
);
status
=
update_trip_temp
(
tzd
->
devdata
,
trip
,
temp
,
status
=
update_trip_temp
(
dts
,
trip
,
temp
,
dts
->
trip_types
[
trip
]);
dts
->
trip_types
[
trip
]);
mutex_unlock
(
&
sensors
->
dts_update_lock
);
mutex_unlock
(
&
sensors
->
dts_update_lock
);
...
@@ -186,9 +186,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
...
@@ -186,9 +186,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
static
int
sys_get_trip_type
(
struct
thermal_zone_device
*
tzd
,
static
int
sys_get_trip_type
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
enum
thermal_trip_type
*
type
)
int
trip
,
enum
thermal_trip_type
*
type
)
{
{
struct
intel_soc_dts_sensor_entry
*
dts
;
struct
intel_soc_dts_sensor_entry
*
dts
=
thermal_zone_device_priv
(
tzd
);
dts
=
tzd
->
devdata
;
*
type
=
dts
->
trip_types
[
trip
];
*
type
=
dts
->
trip_types
[
trip
];
...
@@ -200,11 +198,10 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd,
...
@@ -200,11 +198,10 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd,
{
{
int
status
;
int
status
;
u32
out
;
u32
out
;
struct
intel_soc_dts_sensor_entry
*
dts
;
struct
intel_soc_dts_sensor_entry
*
dts
=
thermal_zone_device_priv
(
tzd
)
;
struct
intel_soc_dts_sensors
*
sensors
;
struct
intel_soc_dts_sensors
*
sensors
;
unsigned
long
raw
;
unsigned
long
raw
;
dts
=
tzd
->
devdata
;
sensors
=
dts
->
sensors
;
sensors
=
dts
->
sensors
;
status
=
iosf_mbi_read
(
BT_MBI_UNIT_PMC
,
MBI_REG_READ
,
status
=
iosf_mbi_read
(
BT_MBI_UNIT_PMC
,
MBI_REG_READ
,
SOC_DTS_OFFSET_TEMP
,
&
out
);
SOC_DTS_OFFSET_TEMP
,
&
out
);
...
...
drivers/thermal/intel/x86_pkg_temp_thermal.c
View file @
065ca2a8
...
@@ -107,7 +107,7 @@ static struct zone_device *pkg_temp_thermal_get_dev(unsigned int cpu)
...
@@ -107,7 +107,7 @@ static struct zone_device *pkg_temp_thermal_get_dev(unsigned int cpu)
static
int
sys_get_curr_temp
(
struct
thermal_zone_device
*
tzd
,
int
*
temp
)
static
int
sys_get_curr_temp
(
struct
thermal_zone_device
*
tzd
,
int
*
temp
)
{
{
struct
zone_device
*
zonedev
=
t
zd
->
devdata
;
struct
zone_device
*
zonedev
=
t
hermal_zone_device_priv
(
tzd
)
;
int
val
;
int
val
;
val
=
intel_tcc_get_temp
(
zonedev
->
cpu
,
true
);
val
=
intel_tcc_get_temp
(
zonedev
->
cpu
,
true
);
...
@@ -122,16 +122,18 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
...
@@ -122,16 +122,18 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
static
int
static
int
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
int
temp
)
sys_set_trip_temp
(
struct
thermal_zone_device
*
tzd
,
int
trip
,
int
temp
)
{
{
struct
zone_device
*
zonedev
=
t
zd
->
devdata
;
struct
zone_device
*
zonedev
=
t
hermal_zone_device_priv
(
tzd
)
;
u32
l
,
h
,
mask
,
shift
,
intr
;
u32
l
,
h
,
mask
,
shift
,
intr
;
int
tj_max
,
ret
;
int
tj_max
,
val
,
ret
;
tj_max
=
intel_tcc_get_tjmax
(
zonedev
->
cpu
);
tj_max
=
intel_tcc_get_tjmax
(
zonedev
->
cpu
);
if
(
tj_max
<
0
)
if
(
tj_max
<
0
)
return
tj_max
;
return
tj_max
;
tj_max
*=
1000
;
tj_max
*=
1000
;
if
(
trip
>=
MAX_NUMBER_OF_TRIPS
||
temp
>=
tj_max
)
val
=
(
tj_max
-
temp
)
/
1000
;
if
(
trip
>=
MAX_NUMBER_OF_TRIPS
||
val
<
0
||
val
>
0x7f
)
return
-
EINVAL
;
return
-
EINVAL
;
ret
=
rdmsr_on_cpu
(
zonedev
->
cpu
,
MSR_IA32_PACKAGE_THERM_INTERRUPT
,
ret
=
rdmsr_on_cpu
(
zonedev
->
cpu
,
MSR_IA32_PACKAGE_THERM_INTERRUPT
,
...
@@ -156,7 +158,7 @@ sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp)
...
@@ -156,7 +158,7 @@ sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp)
if
(
!
temp
)
{
if
(
!
temp
)
{
l
&=
~
intr
;
l
&=
~
intr
;
}
else
{
}
else
{
l
|=
(
tj_max
-
temp
)
/
1000
<<
shift
;
l
|=
val
<<
shift
;
l
|=
intr
;
l
|=
intr
;
}
}
...
...
drivers/thermal/k3_bandgap.c
View file @
065ca2a8
...
@@ -141,7 +141,7 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
...
@@ -141,7 +141,7 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
static
int
k3_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
k3_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
k3_thermal_data
*
data
=
t
z
->
devdata
;
struct
k3_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
int
ret
=
0
;
int
ret
=
0
;
ret
=
k3_bgp_read_temp
(
data
,
temp
);
ret
=
k3_bgp_read_temp
(
data
,
temp
);
...
@@ -222,7 +222,7 @@ static int k3_bandgap_probe(struct platform_device *pdev)
...
@@ -222,7 +222,7 @@ static int k3_bandgap_probe(struct platform_device *pdev)
goto
err_alloc
;
goto
err_alloc
;
}
}
if
(
devm_thermal_add_hwmon_sysfs
(
data
[
id
].
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
d
ev
,
d
ata
[
id
].
tzd
))
dev_warn
(
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
dev_warn
(
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
}
}
...
...
drivers/thermal/k3_j72xx_bandgap.c
View file @
065ca2a8
...
@@ -248,7 +248,7 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata,
...
@@ -248,7 +248,7 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata,
/* Get temperature callback function for thermal zone */
/* Get temperature callback function for thermal zone */
static
int
k3_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
k3_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
return
k3_bgp_read_temp
(
t
z
->
devdata
,
temp
);
return
k3_bgp_read_temp
(
t
hermal_zone_device_priv
(
tz
)
,
temp
);
}
}
static
const
struct
thermal_zone_device_ops
k3_of_thermal_ops
=
{
static
const
struct
thermal_zone_device_ops
k3_of_thermal_ops
=
{
...
...
drivers/thermal/kirkwood_thermal.c
View file @
065ca2a8
...
@@ -27,17 +27,14 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal,
...
@@ -27,17 +27,14 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal,
int
*
temp
)
int
*
temp
)
{
{
unsigned
long
reg
;
unsigned
long
reg
;
struct
kirkwood_thermal_priv
*
priv
=
thermal
->
devdata
;
struct
kirkwood_thermal_priv
*
priv
=
thermal
_zone_device_priv
(
thermal
)
;
reg
=
readl_relaxed
(
priv
->
sensor
);
reg
=
readl_relaxed
(
priv
->
sensor
);
/* Valid check */
/* Valid check */
if
(
!
((
reg
>>
KIRKWOOD_THERMAL_VALID_OFFSET
)
&
if
(
!
((
reg
>>
KIRKWOOD_THERMAL_VALID_OFFSET
)
&
KIRKWOOD_THERMAL_VALID_MASK
))
{
KIRKWOOD_THERMAL_VALID_MASK
))
dev_err
(
&
thermal
->
device
,
"Temperature sensor reading not valid
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
/*
/*
* Calculate temperature. According to Marvell internal
* Calculate temperature. According to Marvell internal
...
...
drivers/thermal/max77620_thermal.c
View file @
065ca2a8
...
@@ -46,15 +46,13 @@ struct max77620_therm_info {
...
@@ -46,15 +46,13 @@ struct max77620_therm_info {
static
int
max77620_thermal_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
max77620_thermal_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
max77620_therm_info
*
mtherm
=
t
z
->
devdata
;
struct
max77620_therm_info
*
mtherm
=
t
hermal_zone_device_priv
(
tz
)
;
unsigned
int
val
;
unsigned
int
val
;
int
ret
;
int
ret
;
ret
=
regmap_read
(
mtherm
->
rmap
,
MAX77620_REG_STATLBT
,
&
val
);
ret
=
regmap_read
(
mtherm
->
rmap
,
MAX77620_REG_STATLBT
,
&
val
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
dev_err
(
mtherm
->
dev
,
"Failed to read STATLBT: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
if
(
val
&
MAX77620_IRQ_TJALRM2_MASK
)
if
(
val
&
MAX77620_IRQ_TJALRM2_MASK
)
*
temp
=
MAX77620_TJALARM2_TEMP
;
*
temp
=
MAX77620_TJALARM2_TEMP
;
...
...
drivers/thermal/mediatek/auxadc_thermal.c
View file @
065ca2a8
...
@@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
...
@@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
static
int
mtk_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temperature
)
static
int
mtk_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temperature
)
{
{
struct
mtk_thermal
*
mt
=
t
z
->
devdata
;
struct
mtk_thermal
*
mt
=
t
hermal_zone_device_priv
(
tz
)
;
int
i
;
int
i
;
int
tempmax
=
INT_MIN
;
int
tempmax
=
INT_MIN
;
...
@@ -1210,7 +1210,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
...
@@ -1210,7 +1210,7 @@ static int mtk_thermal_probe(struct platform_device *pdev)
goto
err_disable_clk_peri_therm
;
goto
err_disable_clk_peri_therm
;
}
}
ret
=
devm_thermal_add_hwmon_sysfs
(
tzdev
);
ret
=
devm_thermal_add_hwmon_sysfs
(
&
pdev
->
dev
,
tzdev
);
if
(
ret
)
if
(
ret
)
dev_warn
(
&
pdev
->
dev
,
"error in thermal_add_hwmon_sysfs"
);
dev_warn
(
&
pdev
->
dev
,
"error in thermal_add_hwmon_sysfs"
);
...
...
drivers/thermal/mediatek/lvts_thermal.c
View file @
065ca2a8
...
@@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature)
...
@@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature)
static
int
lvts_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
lvts_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
lvts_sensor
*
lvts_sensor
=
t
z
->
devdata
;
struct
lvts_sensor
*
lvts_sensor
=
t
hermal_zone_device_priv
(
tz
)
;
void
__iomem
*
msr
=
lvts_sensor
->
msr
;
void
__iomem
*
msr
=
lvts_sensor
->
msr
;
u32
value
;
u32
value
;
...
@@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
static
int
lvts_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
lvts_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
lvts_sensor
*
lvts_sensor
=
t
z
->
devdata
;
struct
lvts_sensor
*
lvts_sensor
=
t
hermal_zone_device_priv
(
tz
)
;
void
__iomem
*
base
=
lvts_sensor
->
base
;
void
__iomem
*
base
=
lvts_sensor
->
base
;
u32
raw_low
=
lvts_temp_to_raw
(
low
);
u32
raw_low
=
lvts_temp_to_raw
(
low
);
u32
raw_high
=
lvts_temp_to_raw
(
high
);
u32
raw_high
=
lvts_temp_to_raw
(
high
);
...
@@ -305,7 +305,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
...
@@ -305,7 +305,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
* 14-0 : Raw temperature for threshold
* 14-0 : Raw temperature for threshold
*/
*/
if
(
low
!=
-
INT_MAX
)
{
if
(
low
!=
-
INT_MAX
)
{
dev_dbg
(
&
tz
->
device
,
"Setting low limit temperature interrupt: %d
\n
"
,
low
);
pr_debug
(
"%s: Setting low limit temperature interrupt: %d
\n
"
,
thermal_zone_device_type
(
tz
),
low
);
writel
(
raw_low
,
LVTS_H2NTHRE
(
base
));
writel
(
raw_low
,
LVTS_H2NTHRE
(
base
));
}
}
...
@@ -318,7 +319,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
...
@@ -318,7 +319,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
*
*
* 14-0 : Raw temperature for threshold
* 14-0 : Raw temperature for threshold
*/
*/
dev_dbg
(
&
tz
->
device
,
"Setting high limit temperature interrupt: %d
\n
"
,
high
);
pr_debug
(
"%s: Setting high limit temperature interrupt: %d
\n
"
,
thermal_zone_device_type
(
tz
),
high
);
writel
(
raw_high
,
LVTS_HTHRE
(
base
));
writel
(
raw_high
,
LVTS_HTHRE
(
base
));
return
0
;
return
0
;
...
...
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
View file @
065ca2a8
...
@@ -360,7 +360,7 @@ static irqreturn_t adc_tm5_gen2_isr(int irq, void *data)
...
@@ -360,7 +360,7 @@ static irqreturn_t adc_tm5_gen2_isr(int irq, void *data)
static
int
adc_tm5_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
adc_tm5_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
adc_tm5_channel
*
channel
=
t
z
->
devdata
;
struct
adc_tm5_channel
*
channel
=
t
hermal_zone_device_priv
(
tz
)
;
int
ret
;
int
ret
;
if
(
!
channel
||
!
channel
->
iio
)
if
(
!
channel
||
!
channel
->
iio
)
...
@@ -642,7 +642,7 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channel *channel, int low, int
...
@@ -642,7 +642,7 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channel *channel, int low, int
static
int
adc_tm5_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
adc_tm5_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
adc_tm5_channel
*
channel
=
t
z
->
devdata
;
struct
adc_tm5_channel
*
channel
=
t
hermal_zone_device_priv
(
tz
)
;
struct
adc_tm5_chip
*
chip
;
struct
adc_tm5_chip
*
chip
;
int
ret
;
int
ret
;
...
@@ -689,7 +689,7 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
...
@@ -689,7 +689,7 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
return
PTR_ERR
(
tzd
);
return
PTR_ERR
(
tzd
);
}
}
adc_tm
->
channels
[
i
].
tzd
=
tzd
;
adc_tm
->
channels
[
i
].
tzd
=
tzd
;
if
(
devm_thermal_add_hwmon_sysfs
(
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
adc_tm
->
dev
,
tzd
))
dev_warn
(
adc_tm
->
dev
,
dev_warn
(
adc_tm
->
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
"Failed to add hwmon sysfs attributes
\n
"
);
}
}
...
...
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
View file @
065ca2a8
...
@@ -187,7 +187,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip)
...
@@ -187,7 +187,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip)
static
int
qpnp_tm_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
qpnp_tm_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
qpnp_tm_chip
*
chip
=
t
z
->
devdata
;
struct
qpnp_tm_chip
*
chip
=
t
hermal_zone_device_priv
(
tz
)
;
int
ret
,
mili_celsius
;
int
ret
,
mili_celsius
;
if
(
!
temp
)
if
(
!
temp
)
...
@@ -265,7 +265,7 @@ static int qpnp_tm_update_critical_trip_temp(struct qpnp_tm_chip *chip,
...
@@ -265,7 +265,7 @@ static int qpnp_tm_update_critical_trip_temp(struct qpnp_tm_chip *chip,
static
int
qpnp_tm_set_trip_temp
(
struct
thermal_zone_device
*
tz
,
int
trip_id
,
int
temp
)
static
int
qpnp_tm_set_trip_temp
(
struct
thermal_zone_device
*
tz
,
int
trip_id
,
int
temp
)
{
{
struct
qpnp_tm_chip
*
chip
=
t
z
->
devdata
;
struct
qpnp_tm_chip
*
chip
=
t
hermal_zone_device_priv
(
tz
)
;
struct
thermal_trip
trip
;
struct
thermal_trip
trip
;
int
ret
;
int
ret
;
...
@@ -459,7 +459,7 @@ static int qpnp_tm_probe(struct platform_device *pdev)
...
@@ -459,7 +459,7 @@ static int qpnp_tm_probe(struct platform_device *pdev)
return
ret
;
return
ret
;
}
}
if
(
devm_thermal_add_hwmon_sysfs
(
chip
->
tz_dev
))
if
(
devm_thermal_add_hwmon_sysfs
(
&
pdev
->
dev
,
chip
->
tz_dev
))
dev_warn
(
&
pdev
->
dev
,
dev_warn
(
&
pdev
->
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
"Failed to add hwmon sysfs attributes
\n
"
);
...
...
drivers/thermal/qcom/tsens.c
View file @
065ca2a8
...
@@ -673,7 +673,7 @@ static irqreturn_t tsens_combined_irq_thread(int irq, void *data)
...
@@ -673,7 +673,7 @@ static irqreturn_t tsens_combined_irq_thread(int irq, void *data)
static
int
tsens_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
tsens_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
tsens_sensor
*
s
=
t
z
->
devdata
;
struct
tsens_sensor
*
s
=
t
hermal_zone_device_priv
(
tz
)
;
struct
tsens_priv
*
priv
=
s
->
priv
;
struct
tsens_priv
*
priv
=
s
->
priv
;
struct
device
*
dev
=
priv
->
dev
;
struct
device
*
dev
=
priv
->
dev
;
struct
tsens_irq_data
d
;
struct
tsens_irq_data
d
;
...
@@ -1057,7 +1057,7 @@ int __init init_common(struct tsens_priv *priv)
...
@@ -1057,7 +1057,7 @@ int __init init_common(struct tsens_priv *priv)
static
int
tsens_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
tsens_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
tsens_sensor
*
s
=
t
z
->
devdata
;
struct
tsens_sensor
*
s
=
t
hermal_zone_device_priv
(
tz
)
;
struct
tsens_priv
*
priv
=
s
->
priv
;
struct
tsens_priv
*
priv
=
s
->
priv
;
return
priv
->
ops
->
get_temp
(
s
,
temp
);
return
priv
->
ops
->
get_temp
(
s
,
temp
);
...
@@ -1189,7 +1189,7 @@ static int tsens_register(struct tsens_priv *priv)
...
@@ -1189,7 +1189,7 @@ static int tsens_register(struct tsens_priv *priv)
if
(
priv
->
ops
->
enable
)
if
(
priv
->
ops
->
enable
)
priv
->
ops
->
enable
(
priv
,
i
);
priv
->
ops
->
enable
(
priv
,
i
);
if
(
devm_thermal_add_hwmon_sysfs
(
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
priv
->
dev
,
tzd
))
dev_warn
(
priv
->
dev
,
dev_warn
(
priv
->
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
"Failed to add hwmon sysfs attributes
\n
"
);
}
}
...
...
drivers/thermal/qoriq_thermal.c
View file @
065ca2a8
...
@@ -83,7 +83,7 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s)
...
@@ -83,7 +83,7 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s)
static
int
tmu_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
tmu_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
qoriq_sensor
*
qsensor
=
t
z
->
devdata
;
struct
qoriq_sensor
*
qsensor
=
t
hermal_zone_device_priv
(
tz
)
;
struct
qoriq_tmu_data
*
qdata
=
qoriq_sensor_to_data
(
qsensor
);
struct
qoriq_tmu_data
*
qdata
=
qoriq_sensor_to_data
(
qsensor
);
u32
val
;
u32
val
;
/*
/*
...
@@ -157,7 +157,7 @@ static int qoriq_tmu_register_tmu_zone(struct device *dev,
...
@@ -157,7 +157,7 @@ static int qoriq_tmu_register_tmu_zone(struct device *dev,
return
ret
;
return
ret
;
}
}
if
(
devm_thermal_add_hwmon_sysfs
(
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
dev
,
tzd
))
dev_warn
(
dev
,
dev_warn
(
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
"Failed to add hwmon sysfs attributes
\n
"
);
...
...
drivers/thermal/rcar_gen3_thermal.c
View file @
065ca2a8
...
@@ -167,7 +167,7 @@ static int rcar_gen3_thermal_round(int temp)
...
@@ -167,7 +167,7 @@ static int rcar_gen3_thermal_round(int temp)
static
int
rcar_gen3_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
rcar_gen3_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
rcar_gen3_thermal_tsc
*
tsc
=
t
z
->
devdata
;
struct
rcar_gen3_thermal_tsc
*
tsc
=
t
hermal_zone_device_priv
(
tz
)
;
int
mcelsius
,
val
;
int
mcelsius
,
val
;
int
reg
;
int
reg
;
...
@@ -206,7 +206,7 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc,
...
@@ -206,7 +206,7 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc,
static
int
rcar_gen3_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
rcar_gen3_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
rcar_gen3_thermal_tsc
*
tsc
=
t
z
->
devdata
;
struct
rcar_gen3_thermal_tsc
*
tsc
=
t
hermal_zone_device_priv
(
tz
)
;
u32
irqmsk
=
0
;
u32
irqmsk
=
0
;
if
(
low
!=
-
INT_MAX
)
{
if
(
low
!=
-
INT_MAX
)
{
...
@@ -527,7 +527,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
...
@@ -527,7 +527,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
}
}
tsc
->
zone
=
zone
;
tsc
->
zone
=
zone
;
tsc
->
zone
->
tzp
->
no_hwmon
=
false
;
ret
=
thermal_add_hwmon_sysfs
(
tsc
->
zone
);
ret
=
thermal_add_hwmon_sysfs
(
tsc
->
zone
);
if
(
ret
)
if
(
ret
)
goto
error_unregister
;
goto
error_unregister
;
...
...
drivers/thermal/rcar_thermal.c
View file @
065ca2a8
...
@@ -101,7 +101,6 @@ struct rcar_thermal_priv {
...
@@ -101,7 +101,6 @@ struct rcar_thermal_priv {
list_for_each_entry(pos, &common->head, list)
list_for_each_entry(pos, &common->head, list)
#define MCELSIUS(temp) ((temp) * 1000)
#define MCELSIUS(temp) ((temp) * 1000)
#define rcar_zone_to_priv(zone) ((zone)->devdata)
#define rcar_priv_to_dev(priv) ((priv)->common->dev)
#define rcar_priv_to_dev(priv) ((priv)->common->dev)
#define rcar_has_irq_support(priv) ((priv)->common->base)
#define rcar_has_irq_support(priv) ((priv)->common->base)
#define rcar_id_to_shift(priv) ((priv)->id * 8)
#define rcar_id_to_shift(priv) ((priv)->id * 8)
...
@@ -273,7 +272,7 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
...
@@ -273,7 +272,7 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
static
int
rcar_thermal_get_temp
(
struct
thermal_zone_device
*
zone
,
int
*
temp
)
static
int
rcar_thermal_get_temp
(
struct
thermal_zone_device
*
zone
,
int
*
temp
)
{
{
struct
rcar_thermal_priv
*
priv
=
rcar_zone_to
_priv
(
zone
);
struct
rcar_thermal_priv
*
priv
=
thermal_zone_device
_priv
(
zone
);
return
rcar_thermal_get_current_temp
(
priv
,
temp
);
return
rcar_thermal_get_current_temp
(
priv
,
temp
);
}
}
...
@@ -510,11 +509,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
...
@@ -510,11 +509,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
}
}
if
(
chip
->
use_of_thermal
)
{
if
(
chip
->
use_of_thermal
)
{
/*
* thermal_zone doesn't enable hwmon as default,
* but, enable it here to keep compatible
*/
priv
->
zone
->
tzp
->
no_hwmon
=
false
;
ret
=
thermal_add_hwmon_sysfs
(
priv
->
zone
);
ret
=
thermal_add_hwmon_sysfs
(
priv
->
zone
);
if
(
ret
)
if
(
ret
)
goto
error_unregister
;
goto
error_unregister
;
...
...
drivers/thermal/rockchip_thermal.c
View file @
065ca2a8
...
@@ -1213,7 +1213,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev)
...
@@ -1213,7 +1213,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev)
static
int
rockchip_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
rockchip_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
rockchip_thermal_sensor
*
sensor
=
t
z
->
devdata
;
struct
rockchip_thermal_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
struct
rockchip_thermal_data
*
thermal
=
sensor
->
thermal
;
struct
rockchip_thermal_data
*
thermal
=
sensor
->
thermal
;
const
struct
rockchip_tsadc_chip
*
tsadc
=
thermal
->
chip
;
const
struct
rockchip_tsadc_chip
*
tsadc
=
thermal
->
chip
;
...
@@ -1226,16 +1226,13 @@ static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, i
...
@@ -1226,16 +1226,13 @@ static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, i
static
int
rockchip_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
static
int
rockchip_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
{
{
struct
rockchip_thermal_sensor
*
sensor
=
t
z
->
devdata
;
struct
rockchip_thermal_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
struct
rockchip_thermal_data
*
thermal
=
sensor
->
thermal
;
struct
rockchip_thermal_data
*
thermal
=
sensor
->
thermal
;
const
struct
rockchip_tsadc_chip
*
tsadc
=
sensor
->
thermal
->
chip
;
const
struct
rockchip_tsadc_chip
*
tsadc
=
sensor
->
thermal
->
chip
;
int
retval
;
int
retval
;
retval
=
tsadc
->
get_temp
(
&
tsadc
->
table
,
retval
=
tsadc
->
get_temp
(
&
tsadc
->
table
,
sensor
->
id
,
thermal
->
regs
,
out_temp
);
sensor
->
id
,
thermal
->
regs
,
out_temp
);
dev_dbg
(
&
thermal
->
pdev
->
dev
,
"sensor %d - temp: %d, retval: %d
\n
"
,
sensor
->
id
,
*
out_temp
,
retval
);
return
retval
;
return
retval
;
}
}
...
@@ -1454,7 +1451,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
...
@@ -1454,7 +1451,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
for
(
i
=
0
;
i
<
thermal
->
chip
->
chn_num
;
i
++
)
{
for
(
i
=
0
;
i
<
thermal
->
chip
->
chn_num
;
i
++
)
{
rockchip_thermal_toggle_sensor
(
&
thermal
->
sensors
[
i
],
true
);
rockchip_thermal_toggle_sensor
(
&
thermal
->
sensors
[
i
],
true
);
thermal
->
sensors
[
i
].
tzd
->
tzp
->
no_hwmon
=
false
;
error
=
thermal_add_hwmon_sysfs
(
thermal
->
sensors
[
i
].
tzd
);
error
=
thermal_add_hwmon_sysfs
(
thermal
->
sensors
[
i
].
tzd
);
if
(
error
)
if
(
error
)
dev_warn
(
&
pdev
->
dev
,
dev_warn
(
&
pdev
->
dev
,
...
...
drivers/thermal/rzg2l_thermal.c
View file @
065ca2a8
...
@@ -75,7 +75,7 @@ static inline void rzg2l_thermal_write(struct rzg2l_thermal_priv *priv, u32 reg,
...
@@ -75,7 +75,7 @@ static inline void rzg2l_thermal_write(struct rzg2l_thermal_priv *priv, u32 reg,
static
int
rzg2l_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
rzg2l_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
rzg2l_thermal_priv
*
priv
=
t
z
->
devdata
;
struct
rzg2l_thermal_priv
*
priv
=
t
hermal_zone_device_priv
(
tz
)
;
u32
result
=
0
,
dsensor
,
ts_code_ave
;
u32
result
=
0
,
dsensor
,
ts_code_ave
;
int
val
,
i
;
int
val
,
i
;
...
@@ -216,7 +216,6 @@ static int rzg2l_thermal_probe(struct platform_device *pdev)
...
@@ -216,7 +216,6 @@ static int rzg2l_thermal_probe(struct platform_device *pdev)
}
}
priv
->
zone
=
zone
;
priv
->
zone
=
zone
;
priv
->
zone
->
tzp
->
no_hwmon
=
false
;
ret
=
thermal_add_hwmon_sysfs
(
priv
->
zone
);
ret
=
thermal_add_hwmon_sysfs
(
priv
->
zone
);
if
(
ret
)
if
(
ret
)
goto
err
;
goto
err
;
...
...
drivers/thermal/samsung/exynos_tmu.c
View file @
065ca2a8
...
@@ -645,7 +645,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
...
@@ -645,7 +645,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
static
int
exynos_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
exynos_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
exynos_tmu_data
*
data
=
t
z
->
devdata
;
struct
exynos_tmu_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
int
value
,
ret
=
0
;
int
value
,
ret
=
0
;
if
(
!
data
||
!
data
->
tmu_read
)
if
(
!
data
||
!
data
->
tmu_read
)
...
@@ -723,7 +723,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
...
@@ -723,7 +723,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
static
int
exynos_tmu_set_emulation
(
struct
thermal_zone_device
*
tz
,
int
temp
)
static
int
exynos_tmu_set_emulation
(
struct
thermal_zone_device
*
tz
,
int
temp
)
{
{
struct
exynos_tmu_data
*
data
=
t
z
->
devdata
;
struct
exynos_tmu_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
int
ret
=
-
EINVAL
;
int
ret
=
-
EINVAL
;
if
(
data
->
soc
==
SOC_ARCH_EXYNOS4210
)
if
(
data
->
soc
==
SOC_ARCH_EXYNOS4210
)
...
...
drivers/thermal/spear_thermal.c
View file @
065ca2a8
...
@@ -31,7 +31,7 @@ struct spear_thermal_dev {
...
@@ -31,7 +31,7 @@ struct spear_thermal_dev {
static
inline
int
thermal_get_temp
(
struct
thermal_zone_device
*
thermal
,
static
inline
int
thermal_get_temp
(
struct
thermal_zone_device
*
thermal
,
int
*
temp
)
int
*
temp
)
{
{
struct
spear_thermal_dev
*
stdev
=
thermal
->
devdata
;
struct
spear_thermal_dev
*
stdev
=
thermal
_zone_device_priv
(
thermal
)
;
/*
/*
* Data are ready to be read after 628 usec from POWERDOWN signal
* Data are ready to be read after 628 usec from POWERDOWN signal
...
@@ -48,7 +48,7 @@ static struct thermal_zone_device_ops ops = {
...
@@ -48,7 +48,7 @@ static struct thermal_zone_device_ops ops = {
static
int
__maybe_unused
spear_thermal_suspend
(
struct
device
*
dev
)
static
int
__maybe_unused
spear_thermal_suspend
(
struct
device
*
dev
)
{
{
struct
thermal_zone_device
*
spear_thermal
=
dev_get_drvdata
(
dev
);
struct
thermal_zone_device
*
spear_thermal
=
dev_get_drvdata
(
dev
);
struct
spear_thermal_dev
*
stdev
=
spear_thermal
->
devdata
;
struct
spear_thermal_dev
*
stdev
=
thermal_zone_device_priv
(
spear_thermal
)
;
unsigned
int
actual_mask
=
0
;
unsigned
int
actual_mask
=
0
;
/* Disable SPEAr Thermal Sensor */
/* Disable SPEAr Thermal Sensor */
...
@@ -64,7 +64,7 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
...
@@ -64,7 +64,7 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
static
int
__maybe_unused
spear_thermal_resume
(
struct
device
*
dev
)
static
int
__maybe_unused
spear_thermal_resume
(
struct
device
*
dev
)
{
{
struct
thermal_zone_device
*
spear_thermal
=
dev_get_drvdata
(
dev
);
struct
thermal_zone_device
*
spear_thermal
=
dev_get_drvdata
(
dev
);
struct
spear_thermal_dev
*
stdev
=
spear_thermal
->
devdata
;
struct
spear_thermal_dev
*
stdev
=
thermal_zone_device_priv
(
spear_thermal
)
;
unsigned
int
actual_mask
=
0
;
unsigned
int
actual_mask
=
0
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -137,7 +137,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
...
@@ -137,7 +137,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
platform_set_drvdata
(
pdev
,
spear_thermal
);
platform_set_drvdata
(
pdev
,
spear_thermal
);
dev_info
(
&
spear_thermal
->
device
,
"Thermal Sensor Loaded at: 0x%p.
\n
"
,
dev_info
(
&
pdev
->
dev
,
"Thermal Sensor Loaded at: 0x%p.
\n
"
,
stdev
->
thermal_base
);
stdev
->
thermal_base
);
return
0
;
return
0
;
...
@@ -154,7 +154,7 @@ static int spear_thermal_exit(struct platform_device *pdev)
...
@@ -154,7 +154,7 @@ static int spear_thermal_exit(struct platform_device *pdev)
{
{
unsigned
int
actual_mask
=
0
;
unsigned
int
actual_mask
=
0
;
struct
thermal_zone_device
*
spear_thermal
=
platform_get_drvdata
(
pdev
);
struct
thermal_zone_device
*
spear_thermal
=
platform_get_drvdata
(
pdev
);
struct
spear_thermal_dev
*
stdev
=
spear_thermal
->
devdata
;
struct
spear_thermal_dev
*
stdev
=
thermal_zone_device_priv
(
spear_thermal
)
;
thermal_zone_device_unregister
(
spear_thermal
);
thermal_zone_device_unregister
(
spear_thermal
);
...
...
drivers/thermal/sprd_thermal.c
View file @
065ca2a8
...
@@ -206,7 +206,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
...
@@ -206,7 +206,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
static
int
sprd_thm_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
sprd_thm_read_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
sprd_thermal_sensor
*
sen
=
t
z
->
devdata
;
struct
sprd_thermal_sensor
*
sen
=
t
hermal_zone_device_priv
(
tz
)
;
u32
data
;
u32
data
;
data
=
readl
(
sen
->
data
->
base
+
SPRD_THM_TEMP
(
sen
->
id
))
&
data
=
readl
(
sen
->
data
->
base
+
SPRD_THM_TEMP
(
sen
->
id
))
&
...
...
drivers/thermal/st/st_thermal.c
View file @
065ca2a8
...
@@ -108,8 +108,7 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor)
...
@@ -108,8 +108,7 @@ static int st_thermal_calibration(struct st_thermal_sensor *sensor)
/* Callback to get temperature from HW*/
/* Callback to get temperature from HW*/
static
int
st_thermal_get_temp
(
struct
thermal_zone_device
*
th
,
int
*
temperature
)
static
int
st_thermal_get_temp
(
struct
thermal_zone_device
*
th
,
int
*
temperature
)
{
{
struct
st_thermal_sensor
*
sensor
=
th
->
devdata
;
struct
st_thermal_sensor
*
sensor
=
thermal_zone_device_priv
(
th
);
struct
device
*
dev
=
sensor
->
dev
;
unsigned
int
temp
;
unsigned
int
temp
;
unsigned
int
overflow
;
unsigned
int
overflow
;
int
ret
;
int
ret
;
...
@@ -127,8 +126,6 @@ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature)
...
@@ -127,8 +126,6 @@ static int st_thermal_get_temp(struct thermal_zone_device *th, int *temperature)
temp
+=
sensor
->
cdata
->
temp_adjust_val
;
temp
+=
sensor
->
cdata
->
temp_adjust_val
;
temp
=
mcelsius
(
temp
);
temp
=
mcelsius
(
temp
);
dev_dbg
(
dev
,
"temperature: %d
\n
"
,
temp
);
*
temperature
=
temp
;
*
temperature
=
temp
;
return
0
;
return
0
;
...
...
drivers/thermal/st/stm_thermal.c
View file @
065ca2a8
...
@@ -303,7 +303,7 @@ static int stm_disable_irq(struct stm_thermal_sensor *sensor)
...
@@ -303,7 +303,7 @@ static int stm_disable_irq(struct stm_thermal_sensor *sensor)
static
int
stm_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
stm_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
stm_thermal_sensor
*
sensor
=
t
z
->
devdata
;
struct
stm_thermal_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
u32
itr1
,
th
;
u32
itr1
,
th
;
int
ret
;
int
ret
;
...
@@ -351,7 +351,7 @@ static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int hi
...
@@ -351,7 +351,7 @@ static int stm_thermal_set_trips(struct thermal_zone_device *tz, int low, int hi
/* Callback to get temperature from HW */
/* Callback to get temperature from HW */
static
int
stm_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
stm_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
stm_thermal_sensor
*
sensor
=
t
z
->
devdata
;
struct
stm_thermal_sensor
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
u32
periods
;
u32
periods
;
int
freqM
,
ret
;
int
freqM
,
ret
;
...
...
drivers/thermal/sun8i_thermal.c
View file @
065ca2a8
...
@@ -110,7 +110,7 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev,
...
@@ -110,7 +110,7 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev,
static
int
sun8i_ths_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
sun8i_ths_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
tsensor
*
s
=
t
z
->
devdata
;
struct
tsensor
*
s
=
t
hermal_zone_device_priv
(
tz
)
;
struct
ths_device
*
tmdev
=
s
->
tmdev
;
struct
ths_device
*
tmdev
=
s
->
tmdev
;
int
val
=
0
;
int
val
=
0
;
...
@@ -475,7 +475,7 @@ static int sun8i_ths_register(struct ths_device *tmdev)
...
@@ -475,7 +475,7 @@ static int sun8i_ths_register(struct ths_device *tmdev)
if
(
IS_ERR
(
tmdev
->
sensor
[
i
].
tzd
))
if
(
IS_ERR
(
tmdev
->
sensor
[
i
].
tzd
))
return
PTR_ERR
(
tmdev
->
sensor
[
i
].
tzd
);
return
PTR_ERR
(
tmdev
->
sensor
[
i
].
tzd
);
if
(
devm_thermal_add_hwmon_sysfs
(
tmdev
->
sensor
[
i
].
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
tmdev
->
dev
,
tmdev
->
sensor
[
i
].
tzd
))
dev_warn
(
tmdev
->
dev
,
dev_warn
(
tmdev
->
dev
,
"Failed to add hwmon sysfs attributes
\n
"
);
"Failed to add hwmon sysfs attributes
\n
"
);
}
}
...
...
drivers/thermal/tegra/soctherm.c
View file @
065ca2a8
...
@@ -423,7 +423,7 @@ static int translate_temp(u16 val)
...
@@ -423,7 +423,7 @@ static int translate_temp(u16 val)
static
int
tegra_thermctl_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
static
int
tegra_thermctl_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
{
{
struct
tegra_thermctl_zone
*
zone
=
t
z
->
devdata
;
struct
tegra_thermctl_zone
*
zone
=
t
hermal_zone_device_priv
(
tz
)
;
u32
val
;
u32
val
;
val
=
readl
(
zone
->
reg
);
val
=
readl
(
zone
->
reg
);
...
@@ -584,7 +584,7 @@ static int tsensor_group_thermtrip_get(struct tegra_soctherm *ts, int id)
...
@@ -584,7 +584,7 @@ static int tsensor_group_thermtrip_get(struct tegra_soctherm *ts, int id)
static
int
tegra_thermctl_set_trip_temp
(
struct
thermal_zone_device
*
tz
,
int
trip_id
,
int
temp
)
static
int
tegra_thermctl_set_trip_temp
(
struct
thermal_zone_device
*
tz
,
int
trip_id
,
int
temp
)
{
{
struct
tegra_thermctl_zone
*
zone
=
t
z
->
devdata
;
struct
tegra_thermctl_zone
*
zone
=
t
hermal_zone_device_priv
(
tz
)
;
struct
tegra_soctherm
*
ts
=
zone
->
ts
;
struct
tegra_soctherm
*
ts
=
zone
->
ts
;
struct
thermal_trip
trip
;
struct
thermal_trip
trip
;
const
struct
tegra_tsensor_group
*
sg
=
zone
->
sg
;
const
struct
tegra_tsensor_group
*
sg
=
zone
->
sg
;
...
@@ -658,7 +658,7 @@ static void thermal_irq_disable(struct tegra_thermctl_zone *zn)
...
@@ -658,7 +658,7 @@ static void thermal_irq_disable(struct tegra_thermctl_zone *zn)
static
int
tegra_thermctl_set_trips
(
struct
thermal_zone_device
*
tz
,
int
lo
,
int
hi
)
static
int
tegra_thermctl_set_trips
(
struct
thermal_zone_device
*
tz
,
int
lo
,
int
hi
)
{
{
struct
tegra_thermctl_zone
*
zone
=
t
z
->
devdata
;
struct
tegra_thermctl_zone
*
zone
=
t
hermal_zone_device_priv
(
tz
)
;
u32
r
;
u32
r
;
thermal_irq_disable
(
zone
);
thermal_irq_disable
(
zone
);
...
...
drivers/thermal/tegra/tegra-bpmp-thermal.c
View file @
065ca2a8
...
@@ -62,12 +62,14 @@ static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *zone,
...
@@ -62,12 +62,14 @@ static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *zone,
static
int
tegra_bpmp_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
static
int
tegra_bpmp_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
{
{
return
__tegra_bpmp_thermal_get_temp
(
tz
->
devdata
,
out_temp
);
struct
tegra_bpmp_thermal_zone
*
zone
=
thermal_zone_device_priv
(
tz
);
return
__tegra_bpmp_thermal_get_temp
(
zone
,
out_temp
);
}
}
static
int
tegra_bpmp_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
tegra_bpmp_thermal_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
struct
tegra_bpmp_thermal_zone
*
zone
=
t
z
->
devdata
;
struct
tegra_bpmp_thermal_zone
*
zone
=
t
hermal_zone_device_priv
(
tz
)
;
struct
mrq_thermal_host_to_bpmp_request
req
;
struct
mrq_thermal_host_to_bpmp_request
req
;
struct
tegra_bpmp_message
msg
;
struct
tegra_bpmp_message
msg
;
int
err
;
int
err
;
...
...
drivers/thermal/tegra/tegra30-tsensor.c
View file @
065ca2a8
...
@@ -160,7 +160,7 @@ static void devm_tegra_tsensor_hw_disable(void *data)
...
@@ -160,7 +160,7 @@ static void devm_tegra_tsensor_hw_disable(void *data)
static
int
tegra_tsensor_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
tegra_tsensor_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
const
struct
tegra_tsensor_channel
*
tsc
=
t
z
->
devdata
;
const
struct
tegra_tsensor_channel
*
tsc
=
t
hermal_zone_device_priv
(
tz
)
;
const
struct
tegra_tsensor
*
ts
=
tsc
->
ts
;
const
struct
tegra_tsensor
*
ts
=
tsc
->
ts
;
int
err
,
c1
,
c2
,
c3
,
c4
,
counter
;
int
err
,
c1
,
c2
,
c3
,
c4
,
counter
;
u32
val
;
u32
val
;
...
@@ -218,7 +218,7 @@ static int tegra_tsensor_temp_to_counter(const struct tegra_tsensor *ts, int tem
...
@@ -218,7 +218,7 @@ static int tegra_tsensor_temp_to_counter(const struct tegra_tsensor *ts, int tem
static
int
tegra_tsensor_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
static
int
tegra_tsensor_set_trips
(
struct
thermal_zone_device
*
tz
,
int
low
,
int
high
)
{
{
const
struct
tegra_tsensor_channel
*
tsc
=
t
z
->
devdata
;
const
struct
tegra_tsensor_channel
*
tsc
=
t
hermal_zone_device_priv
(
tz
)
;
const
struct
tegra_tsensor
*
ts
=
tsc
->
ts
;
const
struct
tegra_tsensor
*
ts
=
tsc
->
ts
;
u32
val
;
u32
val
;
...
@@ -359,9 +359,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
...
@@ -359,9 +359,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
tegra_tsensor_get_hw_channel_trips
(
tzd
,
&
hot_trip
,
&
crit_trip
);
tegra_tsensor_get_hw_channel_trips
(
tzd
,
&
hot_trip
,
&
crit_trip
);
/* prevent potential racing with tegra_tsensor_set_trips() */
mutex_lock
(
&
tzd
->
lock
);
dev_info_once
(
ts
->
dev
,
"ch%u: PMC emergency shutdown trip set to %dC
\n
"
,
dev_info_once
(
ts
->
dev
,
"ch%u: PMC emergency shutdown trip set to %dC
\n
"
,
id
,
DIV_ROUND_CLOSEST
(
crit_trip
,
1000
));
id
,
DIV_ROUND_CLOSEST
(
crit_trip
,
1000
));
...
@@ -404,8 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
...
@@ -404,8 +401,6 @@ static int tegra_tsensor_enable_hw_channel(const struct tegra_tsensor *ts,
val
|=
FIELD_PREP
(
TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN
,
1
);
val
|=
FIELD_PREP
(
TSENSOR_SENSOR0_CONFIG0_INTR_THERMAL_RST_EN
,
1
);
writel_relaxed
(
val
,
tsc
->
regs
+
TSENSOR_SENSOR0_CONFIG0
);
writel_relaxed
(
val
,
tsc
->
regs
+
TSENSOR_SENSOR0_CONFIG0
);
mutex_unlock
(
&
tzd
->
lock
);
err
=
thermal_zone_device_enable
(
tzd
);
err
=
thermal_zone_device_enable
(
tzd
);
if
(
err
)
{
if
(
err
)
{
dev_err
(
ts
->
dev
,
"ch%u: failed to enable zone: %d
\n
"
,
id
,
err
);
dev_err
(
ts
->
dev
,
"ch%u: failed to enable zone: %d
\n
"
,
id
,
err
);
...
@@ -528,7 +523,7 @@ static int tegra_tsensor_register_channel(struct tegra_tsensor *ts,
...
@@ -528,7 +523,7 @@ static int tegra_tsensor_register_channel(struct tegra_tsensor *ts,
return
0
;
return
0
;
}
}
if
(
devm_thermal_add_hwmon_sysfs
(
tsc
->
tzd
))
if
(
devm_thermal_add_hwmon_sysfs
(
ts
->
dev
,
ts
c
->
tzd
))
dev_warn
(
ts
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
dev_warn
(
ts
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
return
0
;
return
0
;
...
@@ -585,6 +580,20 @@ static int tegra_tsensor_probe(struct platform_device *pdev)
...
@@ -585,6 +580,20 @@ static int tegra_tsensor_probe(struct platform_device *pdev)
return
err
;
return
err
;
}
}
/*
* Enable the channels before setting the interrupt so
* set_trips() can not be called while we are setting up the
* register TSENSOR_SENSOR0_CONFIG1. With this we close a
* potential race window where we are setting up the TH2 and
* the temperature hits TH1 resulting to an update of the
* TSENSOR_SENSOR0_CONFIG1 register in the ISR.
*/
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
ts
->
ch
);
i
++
)
{
err
=
tegra_tsensor_enable_hw_channel
(
ts
,
i
);
if
(
err
)
return
err
;
}
err
=
devm_request_threaded_irq
(
&
pdev
->
dev
,
irq
,
NULL
,
err
=
devm_request_threaded_irq
(
&
pdev
->
dev
,
irq
,
NULL
,
tegra_tsensor_isr
,
IRQF_ONESHOT
,
tegra_tsensor_isr
,
IRQF_ONESHOT
,
"tegra_tsensor"
,
ts
);
"tegra_tsensor"
,
ts
);
...
@@ -592,12 +601,6 @@ static int tegra_tsensor_probe(struct platform_device *pdev)
...
@@ -592,12 +601,6 @@ static int tegra_tsensor_probe(struct platform_device *pdev)
return
dev_err_probe
(
&
pdev
->
dev
,
err
,
return
dev_err_probe
(
&
pdev
->
dev
,
err
,
"failed to request interrupt
\n
"
);
"failed to request interrupt
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
ts
->
ch
);
i
++
)
{
err
=
tegra_tsensor_enable_hw_channel
(
ts
,
i
);
if
(
err
)
return
err
;
}
return
0
;
return
0
;
}
}
...
...
drivers/thermal/thermal-generic-adc.c
View file @
065ca2a8
...
@@ -54,15 +54,14 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
...
@@ -54,15 +54,14 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
static
int
gadc_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
gadc_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
gadc_thermal_info
*
gti
=
t
z
->
devdata
;
struct
gadc_thermal_info
*
gti
=
t
hermal_zone_device_priv
(
tz
)
;
int
val
;
int
val
;
int
ret
;
int
ret
;
ret
=
iio_read_channel_processed
(
gti
->
channel
,
&
val
);
ret
=
iio_read_channel_processed
(
gti
->
channel
,
&
val
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
dev_err
(
gti
->
dev
,
"IIO channel read failed %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
*
temp
=
gadc_thermal_adc_to_temp
(
gti
,
val
);
*
temp
=
gadc_thermal_adc_to_temp
(
gti
,
val
);
return
0
;
return
0
;
...
...
drivers/thermal/thermal_core.c
View file @
065ca2a8
...
@@ -1467,6 +1467,24 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, int n
...
@@ -1467,6 +1467,24 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, int n
}
}
EXPORT_SYMBOL_GPL
(
thermal_zone_device_register
);
EXPORT_SYMBOL_GPL
(
thermal_zone_device_register
);
void
*
thermal_zone_device_priv
(
struct
thermal_zone_device
*
tzd
)
{
return
tzd
->
devdata
;
}
EXPORT_SYMBOL_GPL
(
thermal_zone_device_priv
);
const
char
*
thermal_zone_device_type
(
struct
thermal_zone_device
*
tzd
)
{
return
tzd
->
type
;
}
EXPORT_SYMBOL_GPL
(
thermal_zone_device_type
);
int
thermal_zone_device_id
(
struct
thermal_zone_device
*
tzd
)
{
return
tzd
->
id
;
}
EXPORT_SYMBOL_GPL
(
thermal_zone_device_id
);
/**
/**
* thermal_zone_device_unregister - removes the registered thermal zone device
* thermal_zone_device_unregister - removes the registered thermal zone device
* @tz: the thermal zone device to remove
* @tz: the thermal zone device to remove
...
...
drivers/thermal/thermal_helpers.c
View file @
065ca2a8
...
@@ -107,6 +107,9 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
...
@@ -107,6 +107,9 @@ int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
*
temp
=
tz
->
emul_temperature
;
*
temp
=
tz
->
emul_temperature
;
}
}
if
(
ret
)
dev_dbg
(
&
tz
->
device
,
"Failed to get temperature: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
...
...
drivers/thermal/thermal_hwmon.c
View file @
065ca2a8
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include <linux/thermal.h>
#include <linux/thermal.h>
#include "thermal_hwmon.h"
#include "thermal_hwmon.h"
#include "thermal_core.h"
/* hwmon sys I/F */
/* hwmon sys I/F */
/* thermal zone devices with the same type share one hwmon device */
/* thermal zone devices with the same type share one hwmon device */
...
@@ -228,14 +229,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
...
@@ -228,14 +229,14 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
hwmon
=
thermal_hwmon_lookup_by_type
(
tz
);
hwmon
=
thermal_hwmon_lookup_by_type
(
tz
);
if
(
unlikely
(
!
hwmon
))
{
if
(
unlikely
(
!
hwmon
))
{
/* Should never happen... */
/* Should never happen... */
dev_dbg
(
&
tz
->
device
,
"hwmon device lookup failed!
\n
"
);
dev_dbg
(
hwmon
->
device
,
"hwmon device lookup failed!
\n
"
);
return
;
return
;
}
}
temp
=
thermal_hwmon_lookup_temp
(
hwmon
,
tz
);
temp
=
thermal_hwmon_lookup_temp
(
hwmon
,
tz
);
if
(
unlikely
(
!
temp
))
{
if
(
unlikely
(
!
temp
))
{
/* Should never happen... */
/* Should never happen... */
dev_dbg
(
&
tz
->
device
,
"temperature input lookup failed!
\n
"
);
dev_dbg
(
hwmon
->
device
,
"temperature input lookup failed!
\n
"
);
return
;
return
;
}
}
...
@@ -263,7 +264,7 @@ static void devm_thermal_hwmon_release(struct device *dev, void *res)
...
@@ -263,7 +264,7 @@ static void devm_thermal_hwmon_release(struct device *dev, void *res)
thermal_remove_hwmon_sysfs
(
*
(
struct
thermal_zone_device
**
)
res
);
thermal_remove_hwmon_sysfs
(
*
(
struct
thermal_zone_device
**
)
res
);
}
}
int
devm_thermal_add_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
)
int
devm_thermal_add_hwmon_sysfs
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tz
)
{
{
struct
thermal_zone_device
**
ptr
;
struct
thermal_zone_device
**
ptr
;
int
ret
;
int
ret
;
...
@@ -280,7 +281,7 @@ int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
...
@@ -280,7 +281,7 @@ int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
}
}
*
ptr
=
tz
;
*
ptr
=
tz
;
devres_add
(
&
tz
->
device
,
ptr
);
devres_add
(
dev
,
ptr
);
return
ret
;
return
ret
;
}
}
...
...
drivers/thermal/thermal_hwmon.h
View file @
065ca2a8
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#ifdef CONFIG_THERMAL_HWMON
#ifdef CONFIG_THERMAL_HWMON
int
thermal_add_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
);
int
thermal_add_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
);
int
devm_thermal_add_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
);
int
devm_thermal_add_hwmon_sysfs
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tz
);
void
thermal_remove_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
);
void
thermal_remove_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
);
#else
#else
static
inline
int
static
inline
int
...
@@ -27,7 +27,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
...
@@ -27,7 +27,7 @@ thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
}
}
static
inline
int
static
inline
int
devm_thermal_add_hwmon_sysfs
(
struct
thermal_zone_device
*
tz
)
devm_thermal_add_hwmon_sysfs
(
struct
device
*
dev
,
struct
thermal_zone_device
*
tz
)
{
{
return
0
;
return
0
;
}
}
...
...
drivers/thermal/thermal_mmio.c
View file @
065ca2a8
...
@@ -23,7 +23,7 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base)
...
@@ -23,7 +23,7 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base)
static
int
thermal_mmio_get_temperature
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
int
thermal_mmio_get_temperature
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
int
t
;
int
t
;
struct
thermal_mmio
*
sensor
=
t
z
->
devdata
;
struct
thermal_mmio
*
sensor
=
t
hermal_zone_device_priv
(
tz
)
;
t
=
sensor
->
read_mmio
(
sensor
->
mmio_base
)
&
sensor
->
mask
;
t
=
sensor
->
read_mmio
(
sensor
->
mmio_base
)
&
sensor
->
mask
;
t
*=
sensor
->
factor
;
t
*=
sensor
->
factor
;
...
...
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
View file @
065ca2a8
...
@@ -43,8 +43,8 @@ static void ti_thermal_work(struct work_struct *work)
...
@@ -43,8 +43,8 @@ static void ti_thermal_work(struct work_struct *work)
thermal_zone_device_update
(
data
->
ti_thermal
,
THERMAL_EVENT_UNSPECIFIED
);
thermal_zone_device_update
(
data
->
ti_thermal
,
THERMAL_EVENT_UNSPECIFIED
);
dev_dbg
(
&
data
->
ti_thermal
->
device
,
"updated thermal zone %s
\n
"
,
dev_dbg
(
data
->
bgp
->
dev
,
"updated thermal zone %s
\n
"
,
data
->
ti_thermal
->
type
);
thermal_zone_device_type
(
data
->
ti_thermal
)
);
}
}
/**
/**
...
@@ -68,7 +68,7 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
...
@@ -68,7 +68,7 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
static
inline
int
__ti_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
static
inline
int
__ti_thermal_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
temp
)
{
{
struct
thermal_zone_device
*
pcb_tz
=
NULL
;
struct
thermal_zone_device
*
pcb_tz
=
NULL
;
struct
ti_thermal_data
*
data
=
t
z
->
devdata
;
struct
ti_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
struct
ti_bandgap
*
bgp
;
struct
ti_bandgap
*
bgp
;
const
struct
ti_temp_sensor
*
s
;
const
struct
ti_temp_sensor
*
s
;
int
ret
,
tmp
,
slope
,
constant
;
int
ret
,
tmp
,
slope
,
constant
;
...
@@ -109,7 +109,7 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem
...
@@ -109,7 +109,7 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem
static
int
__ti_thermal_get_trend
(
struct
thermal_zone_device
*
tz
,
int
trip
,
enum
thermal_trend
*
trend
)
static
int
__ti_thermal_get_trend
(
struct
thermal_zone_device
*
tz
,
int
trip
,
enum
thermal_trend
*
trend
)
{
{
struct
ti_thermal_data
*
data
=
t
z
->
devdata
;
struct
ti_thermal_data
*
data
=
t
hermal_zone_device_priv
(
tz
)
;
struct
ti_bandgap
*
bgp
;
struct
ti_bandgap
*
bgp
;
int
id
,
tr
,
ret
=
0
;
int
id
,
tr
,
ret
=
0
;
...
@@ -182,7 +182,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
...
@@ -182,7 +182,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
ti_bandgap_set_sensor_data
(
bgp
,
id
,
data
);
ti_bandgap_set_sensor_data
(
bgp
,
id
,
data
);
ti_bandgap_write_update_interval
(
bgp
,
data
->
sensor_id
,
interval
);
ti_bandgap_write_update_interval
(
bgp
,
data
->
sensor_id
,
interval
);
if
(
devm_thermal_add_hwmon_sysfs
(
data
->
ti_thermal
))
if
(
devm_thermal_add_hwmon_sysfs
(
bgp
->
dev
,
data
->
ti_thermal
))
dev_warn
(
bgp
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
dev_warn
(
bgp
->
dev
,
"failed to add hwmon sysfs attributes
\n
"
);
return
0
;
return
0
;
...
...
drivers/thermal/uniphier_thermal.c
View file @
065ca2a8
...
@@ -187,7 +187,7 @@ static void uniphier_tm_disable_sensor(struct uniphier_tm_dev *tdev)
...
@@ -187,7 +187,7 @@ static void uniphier_tm_disable_sensor(struct uniphier_tm_dev *tdev)
static
int
uniphier_tm_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
static
int
uniphier_tm_get_temp
(
struct
thermal_zone_device
*
tz
,
int
*
out_temp
)
{
{
struct
uniphier_tm_dev
*
tdev
=
t
z
->
devdata
;
struct
uniphier_tm_dev
*
tdev
=
t
hermal_zone_device_priv
(
tz
)
;
struct
regmap
*
map
=
tdev
->
regmap
;
struct
regmap
*
map
=
tdev
->
regmap
;
int
ret
;
int
ret
;
u32
temp
;
u32
temp
;
...
...
include/linux/thermal.h
View file @
065ca2a8
...
@@ -365,6 +365,10 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int
...
@@ -365,6 +365,10 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int
void
*
,
struct
thermal_zone_device_ops
*
,
void
*
,
struct
thermal_zone_device_ops
*
,
struct
thermal_zone_params
*
,
int
,
int
);
struct
thermal_zone_params
*
,
int
,
int
);
void
*
thermal_zone_device_priv
(
struct
thermal_zone_device
*
tzd
);
const
char
*
thermal_zone_device_type
(
struct
thermal_zone_device
*
tzd
);
int
thermal_zone_device_id
(
struct
thermal_zone_device
*
tzd
);
int
thermal_zone_bind_cooling_device
(
struct
thermal_zone_device
*
,
int
,
int
thermal_zone_bind_cooling_device
(
struct
thermal_zone_device
*
,
int
,
struct
thermal_cooling_device
*
,
struct
thermal_cooling_device
*
,
unsigned
long
,
unsigned
long
,
unsigned
long
,
unsigned
long
,
...
@@ -437,6 +441,21 @@ static inline int thermal_zone_get_offset(
...
@@ -437,6 +441,21 @@ static inline int thermal_zone_get_offset(
struct
thermal_zone_device
*
tz
)
struct
thermal_zone_device
*
tz
)
{
return
-
ENODEV
;
}
{
return
-
ENODEV
;
}
static
inline
void
*
thermal_zone_device_priv
(
struct
thermal_zone_device
*
tz
)
{
return
NULL
;
}
static
inline
const
char
*
thermal_zone_device_type
(
struct
thermal_zone_device
*
tzd
)
{
return
NULL
;
}
static
inline
int
thermal_zone_device_id
(
struct
thermal_zone_device
*
tzd
)
{
return
-
ENODEV
;
}
static
inline
int
thermal_zone_device_enable
(
struct
thermal_zone_device
*
tz
)
static
inline
int
thermal_zone_device_enable
(
struct
thermal_zone_device
*
tz
)
{
return
-
ENODEV
;
}
{
return
-
ENODEV
;
}
...
...
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