Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
bf6fc9fd
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 大约 4 年
通知
14
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
bf6fc9fd
编写于
5月 31, 2005
作者:
D
Dave Jones
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CPUFREQ] AMD Elan SC520 cpufreq driver.
From: Sean Young <sean@mess.org> Signed-off-by:
N
Dave Jones
<
davej@redhat.com
>
上级
33100108
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
200 addition
and
1 deletion
+200
-1
arch/i386/kernel/cpu/cpufreq/Kconfig
arch/i386/kernel/cpu/cpufreq/Kconfig
+13
-1
arch/i386/kernel/cpu/cpufreq/Makefile
arch/i386/kernel/cpu/cpufreq/Makefile
+1
-0
arch/i386/kernel/cpu/cpufreq/sc520_freq.c
arch/i386/kernel/cpu/cpufreq/sc520_freq.c
+186
-0
未找到文件。
arch/i386/kernel/cpu/cpufreq/Kconfig
浏览文件 @
bf6fc9fd
...
@@ -23,7 +23,7 @@ config X86_ACPI_CPUFREQ
...
@@ -23,7 +23,7 @@ config X86_ACPI_CPUFREQ
If in doubt, say N.
If in doubt, say N.
config ELAN_CPUFREQ
config ELAN_CPUFREQ
tristate "AMD Elan"
tristate "AMD Elan
SC400 and SC410
"
select CPU_FREQ_TABLE
select CPU_FREQ_TABLE
depends on X86_ELAN
depends on X86_ELAN
---help---
---help---
...
@@ -38,6 +38,18 @@ config ELAN_CPUFREQ
...
@@ -38,6 +38,18 @@ config ELAN_CPUFREQ
If in doubt, say N.
If in doubt, say N.
config SC520_CPUFREQ
tristate "AMD Elan SC520"
select CPU_FREQ_TABLE
depends on X86_ELAN
---help---
This adds the CPUFreq driver for AMD Elan SC520 processor.
For details, take a look at <file:Documentation/cpu-freq/>.
If in doubt, say N.
config X86_POWERNOW_K6
config X86_POWERNOW_K6
tristate "AMD Mobile K6-2/K6-3 PowerNow!"
tristate "AMD Mobile K6-2/K6-3 PowerNow!"
select CPU_FREQ_TABLE
select CPU_FREQ_TABLE
...
...
arch/i386/kernel/cpu/cpufreq/Makefile
浏览文件 @
bf6fc9fd
...
@@ -3,6 +3,7 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
...
@@ -3,6 +3,7 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
obj-$(CONFIG_X86_POWERNOW_K8)
+=
powernow-k8.o
obj-$(CONFIG_X86_POWERNOW_K8)
+=
powernow-k8.o
obj-$(CONFIG_X86_LONGHAUL)
+=
longhaul.o
obj-$(CONFIG_X86_LONGHAUL)
+=
longhaul.o
obj-$(CONFIG_ELAN_CPUFREQ)
+=
elanfreq.o
obj-$(CONFIG_ELAN_CPUFREQ)
+=
elanfreq.o
obj-$(CONFIG_SC520_CPUFREQ)
+=
sc520_freq.o
obj-$(CONFIG_X86_LONGRUN)
+=
longrun.o
obj-$(CONFIG_X86_LONGRUN)
+=
longrun.o
obj-$(CONFIG_X86_GX_SUSPMOD)
+=
gx-suspmod.o
obj-$(CONFIG_X86_GX_SUSPMOD)
+=
gx-suspmod.o
obj-$(CONFIG_X86_SPEEDSTEP_ICH)
+=
speedstep-ich.o
obj-$(CONFIG_X86_SPEEDSTEP_ICH)
+=
speedstep-ich.o
...
...
arch/i386/kernel/cpu/cpufreq/sc520_freq.c
0 → 100644
浏览文件 @
bf6fc9fd
/*
* sc520_freq.c: cpufreq driver for the AMD Elan sc520
*
* Copyright (C) 2005 Sean Young <sean@mess.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Based on elanfreq.c
*
* 2005-03-30: - initial revision
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/cpufreq.h>
#include <asm/msr.h>
#include <asm/timex.h>
#include <asm/io.h>
#define MMCR_BASE 0xfffef000
/* The default base address */
#define OFFS_CPUCTL 0x2
/* CPU Control Register */
static
__u8
__iomem
*
cpuctl
;
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "sc520_freq", msg)
static
struct
cpufreq_frequency_table
sc520_freq_table
[]
=
{
{
0x01
,
100000
},
{
0x02
,
133000
},
{
0
,
CPUFREQ_TABLE_END
},
};
static
unsigned
int
sc520_freq_get_cpu_frequency
(
unsigned
int
cpu
)
{
u8
clockspeed_reg
=
*
cpuctl
;
switch
(
clockspeed_reg
&
0x03
)
{
default:
printk
(
KERN_ERR
"sc520_freq: error: cpuctl register has unexpected value %02x
\n
"
,
clockspeed_reg
);
case
0x01
:
return
100000
;
case
0x02
:
return
133000
;
}
}
static
void
sc520_freq_set_cpu_state
(
unsigned
int
state
)
{
struct
cpufreq_freqs
freqs
;
u8
clockspeed_reg
;
freqs
.
old
=
sc520_freq_get_cpu_frequency
(
0
);
freqs
.
new
=
sc520_freq_table
[
state
].
frequency
;
freqs
.
cpu
=
0
;
/* AMD Elan is UP */
cpufreq_notify_transition
(
&
freqs
,
CPUFREQ_PRECHANGE
);
dprintk
(
"attempting to set frequency to %i kHz
\n
"
,
sc520_freq_table
[
state
].
frequency
);
local_irq_disable
();
clockspeed_reg
=
*
cpuctl
&
~
0x03
;
*
cpuctl
=
clockspeed_reg
|
sc520_freq_table
[
state
].
index
;
local_irq_enable
();
cpufreq_notify_transition
(
&
freqs
,
CPUFREQ_POSTCHANGE
);
};
static
int
sc520_freq_verify
(
struct
cpufreq_policy
*
policy
)
{
return
cpufreq_frequency_table_verify
(
policy
,
&
sc520_freq_table
[
0
]);
}
static
int
sc520_freq_target
(
struct
cpufreq_policy
*
policy
,
unsigned
int
target_freq
,
unsigned
int
relation
)
{
unsigned
int
newstate
=
0
;
if
(
cpufreq_frequency_table_target
(
policy
,
sc520_freq_table
,
target_freq
,
relation
,
&
newstate
))
return
-
EINVAL
;
sc520_freq_set_cpu_state
(
newstate
);
return
0
;
}
/*
* Module init and exit code
*/
static
int
sc520_freq_cpu_init
(
struct
cpufreq_policy
*
policy
)
{
struct
cpuinfo_x86
*
c
=
cpu_data
;
int
result
;
/* capability check */
if
(
c
->
x86_vendor
!=
X86_VENDOR_AMD
||
c
->
x86
!=
4
||
c
->
x86_model
!=
9
)
return
-
ENODEV
;
/* cpuinfo and default policy values */
policy
->
governor
=
CPUFREQ_DEFAULT_GOVERNOR
;
policy
->
cpuinfo
.
transition_latency
=
1000000
;
/* 1ms */
policy
->
cur
=
sc520_freq_get_cpu_frequency
(
0
);
result
=
cpufreq_frequency_table_cpuinfo
(
policy
,
sc520_freq_table
);
if
(
result
)
return
(
result
);
cpufreq_frequency_table_get_attr
(
sc520_freq_table
,
policy
->
cpu
);
return
0
;
}
static
int
sc520_freq_cpu_exit
(
struct
cpufreq_policy
*
policy
)
{
cpufreq_frequency_table_put_attr
(
policy
->
cpu
);
return
0
;
}
static
struct
freq_attr
*
sc520_freq_attr
[]
=
{
&
cpufreq_freq_attr_scaling_available_freqs
,
NULL
,
};
static
struct
cpufreq_driver
sc520_freq_driver
=
{
.
get
=
sc520_freq_get_cpu_frequency
,
.
verify
=
sc520_freq_verify
,
.
target
=
sc520_freq_target
,
.
init
=
sc520_freq_cpu_init
,
.
exit
=
sc520_freq_cpu_exit
,
.
name
=
"sc520_freq"
,
.
owner
=
THIS_MODULE
,
.
attr
=
sc520_freq_attr
,
};
static
int
__init
sc520_freq_init
(
void
)
{
struct
cpuinfo_x86
*
c
=
cpu_data
;
/* Test if we have the right hardware */
if
(
c
->
x86_vendor
!=
X86_VENDOR_AMD
||
c
->
x86
!=
4
||
c
->
x86_model
!=
9
)
{
dprintk
(
"no Elan SC520 processor found!
\n
"
);
return
-
ENODEV
;
}
cpuctl
=
ioremap
((
unsigned
long
)(
MMCR_BASE
+
OFFS_CPUCTL
),
1
);
if
(
!
cpuctl
)
{
printk
(
KERN_ERR
"sc520_freq: error: failed to remap memory
\n
"
);
return
-
ENOMEM
;
}
return
cpufreq_register_driver
(
&
sc520_freq_driver
);
}
static
void
__exit
sc520_freq_exit
(
void
)
{
cpufreq_unregister_driver
(
&
sc520_freq_driver
);
iounmap
(
cpuctl
);
}
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Sean Young <sean@mess.org>"
);
MODULE_DESCRIPTION
(
"cpufreq driver for AMD's Elan sc520 CPU"
);
module_init
(
sc520_freq_init
);
module_exit
(
sc520_freq_exit
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录