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
f8e94f0e
Commit
f8e94f0e
authored
Dec 29, 2002
by
Dominik Brodowski
Committed by
Linus Torvalds
Dec 29, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] cpufreq: powernow-k6 cleanup
Clean up searching for best frequency, and add one safety check.
parent
c2654518
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
35 deletions
+29
-35
arch/i386/kernel/cpu/cpufreq/powernow-k6.c
arch/i386/kernel/cpu/cpufreq/powernow-k6.c
+29
-35
No files found.
arch/i386/kernel/cpu/cpufreq/powernow-k6.c
View file @
f8e94f0e
...
@@ -144,6 +144,9 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
...
@@ -144,6 +144,9 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
policy
->
max
=
clock_ratio
[
j
]
*
busfreq
;
policy
->
max
=
clock_ratio
[
j
]
*
busfreq
;
cpufreq_verify_within_limits
(
policy
,
(
20
*
busfreq
),
(
max_multiplier
*
busfreq
));
return
0
;
return
0
;
}
}
...
@@ -156,53 +159,44 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
...
@@ -156,53 +159,44 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
*/
*/
static
int
powernow_k6_setpolicy
(
struct
cpufreq_policy
*
policy
)
static
int
powernow_k6_setpolicy
(
struct
cpufreq_policy
*
policy
)
{
{
unsigned
int
number_states
=
0
;
unsigned
int
i
;
unsigned
int
i
,
j
=
4
;
unsigned
int
optimal
;
if
(
!
powernow_driver
)
if
(
!
powernow_driver
||
!
policy
||
policy
->
cpu
)
return
-
EINVAL
;
return
-
EINVAL
;
for
(
i
=
0
;
i
<
8
;
i
++
)
switch
(
policy
->
policy
)
{
if
((
policy
->
min
<=
(
busfreq
*
clock_ratio
[
i
]))
&&
(
policy
->
max
>=
(
busfreq
*
clock_ratio
[
i
])))
{
number_states
++
;
j
=
i
;
}
if
(
number_states
==
1
)
{
/* if only one state is within the limit borders, it
is easily detected and set */
powernow_k6_set_state
(
j
);
return
0
;
}
/* more than one state within limit */
switch
(
policy
->
policy
)
{
case
CPUFREQ_POLICY_POWERSAVE
:
case
CPUFREQ_POLICY_POWERSAVE
:
j
=
6
;
optimal
=
6
;
for
(
i
=
0
;
i
<
8
;
i
++
)
if
((
policy
->
min
<=
(
busfreq
*
clock_ratio
[
i
]))
&&
(
policy
->
max
>=
(
busfreq
*
clock_ratio
[
i
]))
&&
(
clock_ratio
[
i
]
<
clock_ratio
[
j
]))
j
=
i
;
break
;
break
;
case
CPUFREQ_POLICY_PERFORMANCE
:
case
CPUFREQ_POLICY_PERFORMANCE
:
j
=
4
;
optimal
=
max_multiplier
;
for
(
i
=
0
;
i
<
8
;
i
++
)
if
((
policy
->
min
<=
(
busfreq
*
clock_ratio
[
i
]))
&&
(
policy
->
max
>=
(
busfreq
*
clock_ratio
[
i
]))
&&
(
clock_ratio
[
i
]
>
clock_ratio
[
j
]))
j
=
i
;
break
;
break
;
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
for
(
i
=
0
;
i
<
8
;
i
++
)
{
unsigned
int
freq
=
busfreq
*
clock_ratio
[
i
];
if
(
clock_ratio
[
i
]
>
max_multiplier
)
if
(
clock_ratio
[
i
]
>
max_multiplier
)
return
-
EINVAL
;
continue
;
if
((
freq
>
policy
->
max
)
||
(
freq
<
policy
->
min
))
continue
;
switch
(
policy
->
policy
)
{
case
CPUFREQ_POLICY_POWERSAVE
:
if
(
freq
<
(
clock_ratio
[
optimal
]
*
busfreq
))
optimal
=
i
;
break
;
case
CPUFREQ_POLICY_PERFORMANCE
:
if
(
freq
>
(
clock_ratio
[
optimal
]
*
busfreq
))
optimal
=
i
;
break
;
}
}
powernow_k6_set_state
(
optimal
);
powernow_k6_set_state
(
j
);
return
0
;
return
0
;
}
}
...
...
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