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
b8bb6cb9
Commit
b8bb6cb9
authored
Nov 22, 2012
by
Zhang Rui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
step_wise: Unify the code for both throttle and dethrottle
Signed-off-by:
Zhang Rui
<
rui.zhang@intel.com
>
parent
3dbfff3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
45 deletions
+25
-45
drivers/thermal/step_wise.c
drivers/thermal/step_wise.c
+25
-45
No files found.
drivers/thermal/step_wise.c
View file @
b8bb6cb9
...
@@ -99,52 +99,14 @@ static void update_passive_instance(struct thermal_zone_device *tz,
...
@@ -99,52 +99,14 @@ static void update_passive_instance(struct thermal_zone_device *tz,
tz
->
passive
+=
value
;
tz
->
passive
+=
value
;
}
}
static
void
update_instance_for_throttle
(
struct
thermal_zone_device
*
tz
,
int
trip
,
enum
thermal_trip_type
trip_type
,
enum
thermal_trend
trend
)
{
struct
thermal_instance
*
instance
;
list_for_each_entry
(
instance
,
&
tz
->
thermal_instances
,
tz_node
)
{
if
(
instance
->
trip
!=
trip
)
continue
;
instance
->
target
=
get_target_state
(
instance
,
trend
,
true
);
/* Activate a passive thermal instance */
if
(
instance
->
target
==
THERMAL_NO_TARGET
)
update_passive_instance
(
tz
,
trip_type
,
1
);
instance
->
cdev
->
updated
=
false
;
/* cdev needs update */
}
}
static
void
update_instance_for_dethrottle
(
struct
thermal_zone_device
*
tz
,
int
trip
,
enum
thermal_trip_type
trip_type
,
enum
thermal_trend
trend
)
{
struct
thermal_instance
*
instance
;
list_for_each_entry
(
instance
,
&
tz
->
thermal_instances
,
tz_node
)
{
if
(
instance
->
trip
!=
trip
||
instance
->
target
==
THERMAL_NO_TARGET
)
continue
;
instance
->
target
=
get_target_state
(
instance
,
trend
,
false
);
/* Deactivate a passive thermal instance */
if
(
instance
->
target
==
THERMAL_NO_TARGET
)
update_passive_instance
(
tz
,
trip_type
,
-
1
);
instance
->
cdev
->
updated
=
false
;
/* cdev needs update */
}
}
static
void
thermal_zone_trip_update
(
struct
thermal_zone_device
*
tz
,
int
trip
)
static
void
thermal_zone_trip_update
(
struct
thermal_zone_device
*
tz
,
int
trip
)
{
{
long
trip_temp
;
long
trip_temp
;
enum
thermal_trip_type
trip_type
;
enum
thermal_trip_type
trip_type
;
enum
thermal_trend
trend
;
enum
thermal_trend
trend
;
struct
thermal_instance
*
instance
;
bool
throttle
=
false
;
int
old_target
;
if
(
trip
==
THERMAL_TRIPS_NONE
)
{
if
(
trip
==
THERMAL_TRIPS_NONE
)
{
trip_temp
=
tz
->
forced_passive
;
trip_temp
=
tz
->
forced_passive
;
...
@@ -156,12 +118,30 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
...
@@ -156,12 +118,30 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
trend
=
get_tz_trend
(
tz
,
trip
);
trend
=
get_tz_trend
(
tz
,
trip
);
if
(
tz
->
temperature
>=
trip_temp
)
throttle
=
true
;
mutex_lock
(
&
tz
->
lock
);
mutex_lock
(
&
tz
->
lock
);
if
(
tz
->
temperature
>=
trip_temp
)
list_for_each_entry
(
instance
,
&
tz
->
thermal_instances
,
tz_node
)
{
update_instance_for_throttle
(
tz
,
trip
,
trip_type
,
trend
);
if
(
instance
->
trip
!=
trip
)
else
continue
;
update_instance_for_dethrottle
(
tz
,
trip
,
trip_type
,
trend
);
old_target
=
instance
->
target
;
instance
->
target
=
get_target_state
(
instance
,
trend
,
throttle
);
/* Activate a passive thermal instance */
if
(
old_target
==
THERMAL_NO_TARGET
&&
instance
->
target
!=
THERMAL_NO_TARGET
)
update_passive_instance
(
tz
,
trip_type
,
1
);
/* Deactivate a passive thermal instance */
else
if
(
old_target
!=
THERMAL_NO_TARGET
&&
instance
->
target
==
THERMAL_NO_TARGET
)
update_passive_instance
(
tz
,
trip_type
,
-
1
);
instance
->
cdev
->
updated
=
false
;
/* cdev needs update */
}
mutex_unlock
(
&
tz
->
lock
);
mutex_unlock
(
&
tz
->
lock
);
}
}
...
...
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