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
4f3bff70
Commit
4f3bff70
authored
Apr 05, 2009
by
Len Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'thermal' into release
parents
2ddb9f17
03a971a2
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
525 additions
and
509 deletions
+525
-509
drivers/acpi/fan.c
drivers/acpi/fan.c
+12
-8
drivers/acpi/processor_thermal.c
drivers/acpi/processor_thermal.c
+11
-9
drivers/acpi/thermal.c
drivers/acpi/thermal.c
+99
-440
drivers/acpi/video.c
drivers/acpi/video.c
+13
-9
drivers/platform/x86/intel_menlow.c
drivers/platform/x86/intel_menlow.c
+10
-19
drivers/thermal/thermal_sys.c
drivers/thermal/thermal_sys.c
+341
-15
include/linux/thermal.h
include/linux/thermal.h
+39
-9
No files found.
drivers/acpi/fan.c
View file @
4f3bff70
...
@@ -68,31 +68,35 @@ static struct acpi_driver acpi_fan_driver = {
...
@@ -68,31 +68,35 @@ static struct acpi_driver acpi_fan_driver = {
};
};
/* thermal cooling device callbacks */
/* thermal cooling device callbacks */
static
int
fan_get_max_state
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
static
int
fan_get_max_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
state
)
{
{
/* ACPI fan device only support two states: ON/OFF */
/* ACPI fan device only support two states: ON/OFF */
return
sprintf
(
buf
,
"1
\n
"
);
*
state
=
1
;
return
0
;
}
}
static
int
fan_get_cur_state
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
static
int
fan_get_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
int
state
;
int
result
;
int
result
;
int
acpi_state
;
if
(
!
device
)
if
(
!
device
)
return
-
EINVAL
;
return
-
EINVAL
;
result
=
acpi_bus_get_power
(
device
->
handle
,
&
state
);
result
=
acpi_bus_get_power
(
device
->
handle
,
&
acpi_
state
);
if
(
result
)
if
(
result
)
return
result
;
return
result
;
return
sprintf
(
buf
,
"%s
\n
"
,
state
==
ACPI_STATE_D3
?
"0"
:
*
state
=
(
acpi_state
==
ACPI_STATE_D3
?
0
:
(
state
==
ACPI_STATE_D0
?
"1"
:
"unknown"
));
(
acpi_state
==
ACPI_STATE_D0
?
1
:
-
1
));
return
0
;
}
}
static
int
static
int
fan_set_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
int
state
)
fan_set_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
int
result
;
int
result
;
...
...
drivers/acpi/processor_thermal.c
View file @
4f3bff70
...
@@ -373,7 +373,8 @@ static int acpi_processor_max_state(struct acpi_processor *pr)
...
@@ -373,7 +373,8 @@ static int acpi_processor_max_state(struct acpi_processor *pr)
return
max_state
;
return
max_state
;
}
}
static
int
static
int
processor_get_max_state
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
processor_get_max_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_processor
*
pr
=
acpi_driver_data
(
device
);
struct
acpi_processor
*
pr
=
acpi_driver_data
(
device
);
...
@@ -381,28 +382,29 @@ processor_get_max_state(struct thermal_cooling_device *cdev, char *buf)
...
@@ -381,28 +382,29 @@ processor_get_max_state(struct thermal_cooling_device *cdev, char *buf)
if
(
!
device
||
!
pr
)
if
(
!
device
||
!
pr
)
return
-
EINVAL
;
return
-
EINVAL
;
return
sprintf
(
buf
,
"%d
\n
"
,
acpi_processor_max_state
(
pr
));
*
state
=
acpi_processor_max_state
(
pr
);
return
0
;
}
}
static
int
static
int
processor_get_cur_state
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
processor_get_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
cur_state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_processor
*
pr
=
acpi_driver_data
(
device
);
struct
acpi_processor
*
pr
=
acpi_driver_data
(
device
);
int
cur_state
;
if
(
!
device
||
!
pr
)
if
(
!
device
||
!
pr
)
return
-
EINVAL
;
return
-
EINVAL
;
cur_state
=
cpufreq_get_cur_state
(
pr
->
id
);
*
cur_state
=
cpufreq_get_cur_state
(
pr
->
id
);
if
(
pr
->
flags
.
throttling
)
if
(
pr
->
flags
.
throttling
)
cur_state
+=
pr
->
throttling
.
state
;
*
cur_state
+=
pr
->
throttling
.
state
;
return
0
;
return
sprintf
(
buf
,
"%d
\n
"
,
cur_state
);
}
}
static
int
static
int
processor_set_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
int
state
)
processor_set_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_processor
*
pr
=
acpi_driver_data
(
device
);
struct
acpi_processor
*
pr
=
acpi_driver_data
(
device
);
...
...
drivers/acpi/thermal.c
View file @
4f3bff70
This diff is collapsed.
Click to expand it.
drivers/acpi/video.c
View file @
4f3bff70
...
@@ -358,32 +358,36 @@ static struct output_properties acpi_output_properties = {
...
@@ -358,32 +358,36 @@ static struct output_properties acpi_output_properties = {
/* thermal cooling device callbacks */
/* thermal cooling device callbacks */
static
int
video_get_max_state
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
static
int
video_get_max_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_video_device
*
video
=
acpi_driver_data
(
device
);
struct
acpi_video_device
*
video
=
acpi_driver_data
(
device
);
return
sprintf
(
buf
,
"%d
\n
"
,
video
->
brightness
->
count
-
3
);
*
state
=
video
->
brightness
->
count
-
3
;
return
0
;
}
}
static
int
video_get_cur_state
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
static
int
video_get_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_video_device
*
video
=
acpi_driver_data
(
device
);
struct
acpi_video_device
*
video
=
acpi_driver_data
(
device
);
unsigned
long
long
level
;
unsigned
long
long
level
;
int
state
;
int
offset
;
acpi_video_device_lcd_get_level_current
(
video
,
&
level
);
acpi_video_device_lcd_get_level_current
(
video
,
&
level
);
for
(
state
=
2
;
state
<
video
->
brightness
->
count
;
state
++
)
for
(
offset
=
2
;
offset
<
video
->
brightness
->
count
;
offset
++
)
if
(
level
==
video
->
brightness
->
levels
[
state
])
if
(
level
==
video
->
brightness
->
levels
[
offset
])
{
return
sprintf
(
buf
,
"%d
\n
"
,
*
state
=
video
->
brightness
->
count
-
offset
-
1
;
video
->
brightness
->
count
-
state
-
1
);
return
0
;
}
return
-
EINVAL
;
return
-
EINVAL
;
}
}
static
int
static
int
video_set_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
int
state
)
video_set_cur_state
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_video_device
*
video
=
acpi_driver_data
(
device
);
struct
acpi_video_device
*
video
=
acpi_driver_data
(
device
);
...
...
drivers/platform/x86/intel_menlow.c
View file @
4f3bff70
...
@@ -57,7 +57,7 @@ MODULE_LICENSE("GPL");
...
@@ -57,7 +57,7 @@ MODULE_LICENSE("GPL");
* In that case max_cstate would be n-1
* In that case max_cstate would be n-1
* GTHS returning '0' would mean that no bandwidth control states are supported
* GTHS returning '0' would mean that no bandwidth control states are supported
*/
*/
static
int
memory_get_
int_
max_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
static
int
memory_get_max_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
unsigned
long
*
max_state
)
unsigned
long
*
max_state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
...
@@ -83,22 +83,12 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,
...
@@ -83,22 +83,12 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,
return
0
;
return
0
;
}
}
static
int
memory_get_max_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
{
unsigned
long
value
;
if
(
memory_get_int_max_bandwidth
(
cdev
,
&
value
))
return
-
EINVAL
;
return
sprintf
(
buf
,
"%ld
\n
"
,
value
);
}
static
int
memory_get_cur_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
static
int
memory_get_cur_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
char
*
buf
)
unsigned
long
*
value
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
acpi_handle
handle
=
device
->
handle
;
acpi_handle
handle
=
device
->
handle
;
unsigned
long
long
value
;
unsigned
long
long
result
;
struct
acpi_object_list
arg_list
;
struct
acpi_object_list
arg_list
;
union
acpi_object
arg
;
union
acpi_object
arg
;
acpi_status
status
=
AE_OK
;
acpi_status
status
=
AE_OK
;
...
@@ -108,15 +98,16 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev,
...
@@ -108,15 +98,16 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev,
arg
.
type
=
ACPI_TYPE_INTEGER
;
arg
.
type
=
ACPI_TYPE_INTEGER
;
arg
.
integer
.
value
=
MEMORY_ARG_CUR_BANDWIDTH
;
arg
.
integer
.
value
=
MEMORY_ARG_CUR_BANDWIDTH
;
status
=
acpi_evaluate_integer
(
handle
,
MEMORY_GET_BANDWIDTH
,
status
=
acpi_evaluate_integer
(
handle
,
MEMORY_GET_BANDWIDTH
,
&
arg_list
,
&
value
);
&
arg_list
,
&
result
);
if
(
ACPI_FAILURE
(
status
))
if
(
ACPI_FAILURE
(
status
))
return
-
EFAULT
;
return
-
EFAULT
;
return
sprintf
(
buf
,
"%llu
\n
"
,
value
);
*
value
=
result
;
return
0
;
}
}
static
int
memory_set_cur_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
static
int
memory_set_cur_bandwidth
(
struct
thermal_cooling_device
*
cdev
,
unsigned
int
state
)
unsigned
long
state
)
{
{
struct
acpi_device
*
device
=
cdev
->
devdata
;
struct
acpi_device
*
device
=
cdev
->
devdata
;
acpi_handle
handle
=
device
->
handle
;
acpi_handle
handle
=
device
->
handle
;
...
@@ -126,7 +117,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
...
@@ -126,7 +117,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
unsigned
long
long
temp
;
unsigned
long
long
temp
;
unsigned
long
max_state
;
unsigned
long
max_state
;
if
(
memory_get_
int_
max_bandwidth
(
cdev
,
&
max_state
))
if
(
memory_get_max_bandwidth
(
cdev
,
&
max_state
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
state
>
max_state
)
if
(
state
>
max_state
)
...
@@ -142,7 +133,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
...
@@ -142,7 +133,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
&
temp
);
&
temp
);
printk
(
KERN_INFO
printk
(
KERN_INFO
"Bandwidth value was %d: status is %d
\n
"
,
state
,
status
);
"Bandwidth value was %
l
d: status is %d
\n
"
,
state
,
status
);
if
(
ACPI_FAILURE
(
status
))
if
(
ACPI_FAILURE
(
status
))
return
-
EFAULT
;
return
-
EFAULT
;
...
...
drivers/thermal/thermal_sys.c
View file @
4f3bff70
This diff is collapsed.
Click to expand it.
include/linux/thermal.h
View file @
4f3bff70
...
@@ -27,27 +27,46 @@
...
@@ -27,27 +27,46 @@
#include <linux/idr.h>
#include <linux/idr.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/workqueue.h>
struct
thermal_zone_device
;
struct
thermal_zone_device
;
struct
thermal_cooling_device
;
struct
thermal_cooling_device
;
enum
thermal_device_mode
{
THERMAL_DEVICE_DISABLED
=
0
,
THERMAL_DEVICE_ENABLED
,
};
enum
thermal_trip_type
{
THERMAL_TRIP_ACTIVE
=
0
,
THERMAL_TRIP_PASSIVE
,
THERMAL_TRIP_HOT
,
THERMAL_TRIP_CRITICAL
,
};
struct
thermal_zone_device_ops
{
struct
thermal_zone_device_ops
{
int
(
*
bind
)
(
struct
thermal_zone_device
*
,
int
(
*
bind
)
(
struct
thermal_zone_device
*
,
struct
thermal_cooling_device
*
);
struct
thermal_cooling_device
*
);
int
(
*
unbind
)
(
struct
thermal_zone_device
*
,
int
(
*
unbind
)
(
struct
thermal_zone_device
*
,
struct
thermal_cooling_device
*
);
struct
thermal_cooling_device
*
);
int
(
*
get_temp
)
(
struct
thermal_zone_device
*
,
char
*
);
int
(
*
get_temp
)
(
struct
thermal_zone_device
*
,
unsigned
long
*
);
int
(
*
get_mode
)
(
struct
thermal_zone_device
*
,
char
*
);
int
(
*
get_mode
)
(
struct
thermal_zone_device
*
,
int
(
*
set_mode
)
(
struct
thermal_zone_device
*
,
const
char
*
);
enum
thermal_device_mode
*
);
int
(
*
get_trip_type
)
(
struct
thermal_zone_device
*
,
int
,
char
*
);
int
(
*
set_mode
)
(
struct
thermal_zone_device
*
,
int
(
*
get_trip_temp
)
(
struct
thermal_zone_device
*
,
int
,
char
*
);
enum
thermal_device_mode
);
int
(
*
get_trip_type
)
(
struct
thermal_zone_device
*
,
int
,
enum
thermal_trip_type
*
);
int
(
*
get_trip_temp
)
(
struct
thermal_zone_device
*
,
int
,
unsigned
long
*
);
int
(
*
get_crit_temp
)
(
struct
thermal_zone_device
*
,
unsigned
long
*
);
int
(
*
get_crit_temp
)
(
struct
thermal_zone_device
*
,
unsigned
long
*
);
int
(
*
notify
)
(
struct
thermal_zone_device
*
,
int
,
enum
thermal_trip_type
);
};
};
struct
thermal_cooling_device_ops
{
struct
thermal_cooling_device_ops
{
int
(
*
get_max_state
)
(
struct
thermal_cooling_device
*
,
char
*
);
int
(
*
get_max_state
)
(
struct
thermal_cooling_device
*
,
unsigned
long
*
);
int
(
*
get_cur_state
)
(
struct
thermal_cooling_device
*
,
char
*
);
int
(
*
get_cur_state
)
(
struct
thermal_cooling_device
*
,
unsigned
long
*
);
int
(
*
set_cur_state
)
(
struct
thermal_cooling_device
*
,
unsigned
int
);
int
(
*
set_cur_state
)
(
struct
thermal_cooling_device
*
,
unsigned
long
);
};
};
#define THERMAL_TRIPS_NONE -1
#define THERMAL_TRIPS_NONE -1
...
@@ -88,11 +107,19 @@ struct thermal_zone_device {
...
@@ -88,11 +107,19 @@ struct thermal_zone_device {
struct
device
device
;
struct
device
device
;
void
*
devdata
;
void
*
devdata
;
int
trips
;
int
trips
;
int
tc1
;
int
tc2
;
int
passive_delay
;
int
polling_delay
;
int
last_temperature
;
bool
passive
;
unsigned
int
forced_passive
;
struct
thermal_zone_device_ops
*
ops
;
struct
thermal_zone_device_ops
*
ops
;
struct
list_head
cooling_devices
;
struct
list_head
cooling_devices
;
struct
idr
idr
;
struct
idr
idr
;
struct
mutex
lock
;
/* protect cooling devices list */
struct
mutex
lock
;
/* protect cooling devices list */
struct
list_head
node
;
struct
list_head
node
;
struct
delayed_work
poll_queue
;
#if defined(CONFIG_THERMAL_HWMON)
#if defined(CONFIG_THERMAL_HWMON)
struct
list_head
hwmon_node
;
struct
list_head
hwmon_node
;
struct
thermal_hwmon_device
*
hwmon
;
struct
thermal_hwmon_device
*
hwmon
;
...
@@ -104,13 +131,16 @@ struct thermal_zone_device {
...
@@ -104,13 +131,16 @@ struct thermal_zone_device {
struct
thermal_zone_device
*
thermal_zone_device_register
(
char
*
,
int
,
void
*
,
struct
thermal_zone_device
*
thermal_zone_device_register
(
char
*
,
int
,
void
*
,
struct
struct
thermal_zone_device_ops
thermal_zone_device_ops
*
);
*
,
int
tc1
,
int
tc2
,
int
passive_freq
,
int
polling_freq
);
void
thermal_zone_device_unregister
(
struct
thermal_zone_device
*
);
void
thermal_zone_device_unregister
(
struct
thermal_zone_device
*
);
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
*
);
int
thermal_zone_unbind_cooling_device
(
struct
thermal_zone_device
*
,
int
,
int
thermal_zone_unbind_cooling_device
(
struct
thermal_zone_device
*
,
int
,
struct
thermal_cooling_device
*
);
struct
thermal_cooling_device
*
);
void
thermal_zone_device_update
(
struct
thermal_zone_device
*
);
struct
thermal_cooling_device
*
thermal_cooling_device_register
(
char
*
,
void
*
,
struct
thermal_cooling_device
*
thermal_cooling_device_register
(
char
*
,
void
*
,
struct
struct
thermal_cooling_device_ops
thermal_cooling_device_ops
...
...
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