Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
14a6650f
Commit
14a6650f
authored
Jan 18, 2009
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CPUFREQ] checkpatch cleanups for powernow-k6
Signed-off-by:
Dave Jones
<
davej@redhat.com
>
parent
48ee923a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
arch/x86/kernel/cpu/cpufreq/powernow-k6.c
arch/x86/kernel/cpu/cpufreq/powernow-k6.c
+26
-18
No files found.
arch/x86/kernel/cpu/cpufreq/powernow-k6.c
View file @
14a6650f
/*
/*
* This file was based upon code in Powertweak Linux (http://powertweak.sf.net)
* This file was based upon code in Powertweak Linux (http://powertweak.sf.net)
* (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä, Dominik Brodowski.
* (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä,
* Dominik Brodowski.
*
*
* Licensed under the terms of the GNU GPL License version 2.
* Licensed under the terms of the GNU GPL License version 2.
*
*
...
@@ -13,14 +14,15 @@
...
@@ -13,14 +14,15 @@
#include <linux/cpufreq.h>
#include <linux/cpufreq.h>
#include <linux/ioport.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <asm/msr.h>
#include <linux/timex.h>
#include <linux/timex.h>
#include <linux/io.h>
#include <linux/io.h>
#include <asm/msr.h>
#define POWERNOW_IOPORT 0xfff0
/* it doesn't matter where, as long
#define POWERNOW_IOPORT 0xfff0
/* it doesn't matter where, as long
as it is unused */
as it is unused */
#define PFX "powernow-k6: "
static
unsigned
int
busfreq
;
/* FSB, in 10 kHz */
static
unsigned
int
busfreq
;
/* FSB, in 10 kHz */
static
unsigned
int
max_multiplier
;
static
unsigned
int
max_multiplier
;
...
@@ -47,8 +49,8 @@ static struct cpufreq_frequency_table clock_ratio[] = {
...
@@ -47,8 +49,8 @@ static struct cpufreq_frequency_table clock_ratio[] = {
*/
*/
static
int
powernow_k6_get_cpu_multiplier
(
void
)
static
int
powernow_k6_get_cpu_multiplier
(
void
)
{
{
u64
invalue
=
0
;
u64
invalue
=
0
;
u32
msrval
;
u32
msrval
;
msrval
=
POWERNOW_IOPORT
+
0x1
;
msrval
=
POWERNOW_IOPORT
+
0x1
;
wrmsr
(
MSR_K6_EPMR
,
msrval
,
0
);
/* enable the PowerNow port */
wrmsr
(
MSR_K6_EPMR
,
msrval
,
0
);
/* enable the PowerNow port */
...
@@ -68,12 +70,12 @@ static int powernow_k6_get_cpu_multiplier(void)
...
@@ -68,12 +70,12 @@ static int powernow_k6_get_cpu_multiplier(void)
*/
*/
static
void
powernow_k6_set_state
(
unsigned
int
best_i
)
static
void
powernow_k6_set_state
(
unsigned
int
best_i
)
{
{
unsigned
long
outvalue
=
0
,
invalue
=
0
;
unsigned
long
outvalue
=
0
,
invalue
=
0
;
unsigned
long
msrval
;
unsigned
long
msrval
;
struct
cpufreq_freqs
freqs
;
struct
cpufreq_freqs
freqs
;
if
(
clock_ratio
[
best_i
].
index
>
max_multiplier
)
{
if
(
clock_ratio
[
best_i
].
index
>
max_multiplier
)
{
printk
(
KERN_ERR
"cpufreq:
invalid target frequency
\n
"
);
printk
(
KERN_ERR
PFX
"
invalid target frequency
\n
"
);
return
;
return
;
}
}
...
@@ -119,7 +121,8 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
...
@@ -119,7 +121,8 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
* powernow_k6_setpolicy - sets a new CPUFreq policy
* powernow_k6_setpolicy - sets a new CPUFreq policy
* @policy: new policy
* @policy: new policy
* @target_freq: the target frequency
* @target_freq: the target frequency
* @relation: how that frequency relates to achieved frequency (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
* @relation: how that frequency relates to achieved frequency
* (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
*
*
* sets a new CPUFreq policy
* sets a new CPUFreq policy
*/
*/
...
@@ -127,9 +130,10 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
...
@@ -127,9 +130,10 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
unsigned
int
target_freq
,
unsigned
int
target_freq
,
unsigned
int
relation
)
unsigned
int
relation
)
{
{
unsigned
int
newstate
=
0
;
unsigned
int
newstate
=
0
;
if
(
cpufreq_frequency_table_target
(
policy
,
&
clock_ratio
[
0
],
target_freq
,
relation
,
&
newstate
))
if
(
cpufreq_frequency_table_target
(
policy
,
&
clock_ratio
[
0
],
target_freq
,
relation
,
&
newstate
))
return
-
EINVAL
;
return
-
EINVAL
;
powernow_k6_set_state
(
newstate
);
powernow_k6_set_state
(
newstate
);
...
@@ -140,7 +144,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
...
@@ -140,7 +144,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
static
int
powernow_k6_cpu_init
(
struct
cpufreq_policy
*
policy
)
static
int
powernow_k6_cpu_init
(
struct
cpufreq_policy
*
policy
)
{
{
unsigned
int
i
;
unsigned
int
i
,
f
;
int
result
;
int
result
;
if
(
policy
->
cpu
!=
0
)
if
(
policy
->
cpu
!=
0
)
...
@@ -152,10 +156,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
...
@@ -152,10 +156,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
/* table init */
/* table init */
for
(
i
=
0
;
(
clock_ratio
[
i
].
frequency
!=
CPUFREQ_TABLE_END
);
i
++
)
{
for
(
i
=
0
;
(
clock_ratio
[
i
].
frequency
!=
CPUFREQ_TABLE_END
);
i
++
)
{
if
(
clock_ratio
[
i
].
index
>
max_multiplier
)
f
=
clock_ratio
[
i
].
index
;
if
(
f
>
max_multiplier
)
clock_ratio
[
i
].
frequency
=
CPUFREQ_ENTRY_INVALID
;
clock_ratio
[
i
].
frequency
=
CPUFREQ_ENTRY_INVALID
;
else
else
clock_ratio
[
i
].
frequency
=
busfreq
*
clock_ratio
[
i
].
index
;
clock_ratio
[
i
].
frequency
=
busfreq
*
f
;
}
}
/* cpuinfo and default policy values */
/* cpuinfo and default policy values */
...
@@ -185,7 +190,9 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
...
@@ -185,7 +190,9 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
static
unsigned
int
powernow_k6_get
(
unsigned
int
cpu
)
static
unsigned
int
powernow_k6_get
(
unsigned
int
cpu
)
{
{
return
busfreq
*
powernow_k6_get_cpu_multiplier
();
unsigned
int
ret
;
ret
=
(
busfreq
*
powernow_k6_get_cpu_multiplier
());
return
ret
;
}
}
static
struct
freq_attr
*
powernow_k6_attr
[]
=
{
static
struct
freq_attr
*
powernow_k6_attr
[]
=
{
...
@@ -221,7 +228,7 @@ static int __init powernow_k6_init(void)
...
@@ -221,7 +228,7 @@ static int __init powernow_k6_init(void)
return
-
ENODEV
;
return
-
ENODEV
;
if
(
!
request_region
(
POWERNOW_IOPORT
,
16
,
"PowerNow!"
))
{
if
(
!
request_region
(
POWERNOW_IOPORT
,
16
,
"PowerNow!"
))
{
printk
(
"cpufreq:
PowerNow IOPORT region already used.
\n
"
);
printk
(
KERN_INFO
PFX
"
PowerNow IOPORT region already used.
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
...
@@ -246,7 +253,8 @@ static void __exit powernow_k6_exit(void)
...
@@ -246,7 +253,8 @@ static void __exit powernow_k6_exit(void)
}
}
MODULE_AUTHOR
(
"Arjan van de Ven, Dave Jones <davej@redhat.com>, Dominik Brodowski <linux@brodo.de>"
);
MODULE_AUTHOR
(
"Arjan van de Ven, Dave Jones <davej@redhat.com>, "
"Dominik Brodowski <linux@brodo.de>"
);
MODULE_DESCRIPTION
(
"PowerNow! driver for AMD K6-2+ / K6-3+ processors."
);
MODULE_DESCRIPTION
(
"PowerNow! driver for AMD K6-2+ / K6-3+ processors."
);
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
...
...
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