Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
17e8d03c
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
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看板
提交
17e8d03c
编写于
10月 25, 2013
作者:
R
Rafael J. Wysocki
浏览文件
操作
浏览文件
下载
差异文件
Merge back earlier 'acpi-assorted' material.
上级
e37f14a5
5e2be4e0
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
335 addition
and
417 deletion
+335
-417
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/acpi/boot.c
+1
-1
drivers/acpi/ac.c
drivers/acpi/ac.c
+65
-191
drivers/acpi/acpi_lpss.c
drivers/acpi/acpi_lpss.c
+9
-3
drivers/acpi/acpi_platform.c
drivers/acpi/acpi_platform.c
+7
-0
drivers/acpi/button.c
drivers/acpi/button.c
+3
-6
drivers/acpi/ec.c
drivers/acpi/ec.c
+24
-25
drivers/acpi/osl.c
drivers/acpi/osl.c
+2
-2
drivers/acpi/sysfs.c
drivers/acpi/sysfs.c
+7
-2
drivers/acpi/thermal.c
drivers/acpi/thermal.c
+20
-23
drivers/acpi/utils.c
drivers/acpi/utils.c
+13
-4
drivers/platform/x86/ideapad-laptop.c
drivers/platform/x86/ideapad-laptop.c
+184
-160
未找到文件。
arch/x86/kernel/acpi/boot.c
浏览文件 @
17e8d03c
...
@@ -745,7 +745,7 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table)
...
@@ -745,7 +745,7 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table)
#ifdef CONFIG_HPET_TIMER
#ifdef CONFIG_HPET_TIMER
#include <asm/hpet.h>
#include <asm/hpet.h>
static
struct
__initdata
resource
*
hpet_res
;
static
struct
resource
*
hpet_res
__initdata
;
static
int
__init
acpi_parse_hpet
(
struct
acpi_table_header
*
table
)
static
int
__init
acpi_parse_hpet
(
struct
acpi_table_header
*
table
)
{
{
...
...
drivers/acpi/ac.c
浏览文件 @
17e8d03c
...
@@ -30,10 +30,7 @@
...
@@ -30,10 +30,7 @@
#include <linux/types.h>
#include <linux/types.h>
#include <linux/dmi.h>
#include <linux/dmi.h>
#include <linux/delay.h>
#include <linux/delay.h>
#ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/platform_device.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
#include <linux/power_supply.h>
#include <linux/power_supply.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <acpi/acpi_drivers.h>
...
@@ -55,75 +52,30 @@ MODULE_AUTHOR("Paul Diefenbaugh");
...
@@ -55,75 +52,30 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION
(
"ACPI AC Adapter Driver"
);
MODULE_DESCRIPTION
(
"ACPI AC Adapter Driver"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
#ifdef CONFIG_ACPI_PROCFS_POWER
extern
struct
proc_dir_entry
*
acpi_lock_ac_dir
(
void
);
extern
void
*
acpi_unlock_ac_dir
(
struct
proc_dir_entry
*
acpi_ac_dir
);
static
int
acpi_ac_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
);
#endif
static
int
acpi_ac_add
(
struct
acpi_device
*
device
);
static
int
acpi_ac_remove
(
struct
acpi_device
*
device
);
static
void
acpi_ac_notify
(
struct
acpi_device
*
device
,
u32
event
);
static
const
struct
acpi_device_id
ac_device_ids
[]
=
{
{
"ACPI0003"
,
0
},
{
""
,
0
},
};
MODULE_DEVICE_TABLE
(
acpi
,
ac_device_ids
);
#ifdef CONFIG_PM_SLEEP
static
int
acpi_ac_resume
(
struct
device
*
dev
);
#endif
static
SIMPLE_DEV_PM_OPS
(
acpi_ac_pm
,
NULL
,
acpi_ac_resume
);
static
int
ac_sleep_before_get_state_ms
;
static
int
ac_sleep_before_get_state_ms
;
static
struct
acpi_driver
acpi_ac_driver
=
{
.
name
=
"ac"
,
.
class
=
ACPI_AC_CLASS
,
.
ids
=
ac_device_ids
,
.
flags
=
ACPI_DRIVER_ALL_NOTIFY_EVENTS
,
.
ops
=
{
.
add
=
acpi_ac_add
,
.
remove
=
acpi_ac_remove
,
.
notify
=
acpi_ac_notify
,
},
.
drv
.
pm
=
&
acpi_ac_pm
,
};
struct
acpi_ac
{
struct
acpi_ac
{
struct
power_supply
charger
;
struct
power_supply
charger
;
struct
acpi_device
*
device
;
struct
acpi_device
*
adev
;
struct
platform_device
*
pdev
;
unsigned
long
long
state
;
unsigned
long
long
state
;
};
};
#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger)
#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger)
#ifdef CONFIG_ACPI_PROCFS_POWER
static
const
struct
file_operations
acpi_ac_fops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
acpi_ac_open_fs
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
#endif
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
AC Adapter Management
AC Adapter Management
-------------------------------------------------------------------------- */
-------------------------------------------------------------------------- */
static
int
acpi_ac_get_state
(
struct
acpi_ac
*
ac
)
static
int
acpi_ac_get_state
(
struct
acpi_ac
*
ac
)
{
{
acpi_status
status
=
AE_OK
;
acpi_status
status
;
if
(
!
ac
)
return
-
EINVAL
;
status
=
acpi_evaluate_integer
(
ac
->
device
->
handle
,
"_PSR"
,
NULL
,
&
ac
->
state
);
status
=
acpi_evaluate_integer
(
ac
->
adev
->
handle
,
"_PSR"
,
NULL
,
&
ac
->
state
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
ACPI_EXCEPTION
((
AE_INFO
,
status
,
"Error reading AC Adapter state"
));
ACPI_EXCEPTION
((
AE_INFO
,
status
,
"Error reading AC Adapter state"
));
ac
->
state
=
ACPI_AC_STATUS_UNKNOWN
;
ac
->
state
=
ACPI_AC_STATUS_UNKNOWN
;
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -160,91 +112,13 @@ static enum power_supply_property ac_props[] = {
...
@@ -160,91 +112,13 @@ static enum power_supply_property ac_props[] = {
POWER_SUPPLY_PROP_ONLINE
,
POWER_SUPPLY_PROP_ONLINE
,
};
};
#ifdef CONFIG_ACPI_PROCFS_POWER
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
static
struct
proc_dir_entry
*
acpi_ac_dir
;
static
int
acpi_ac_seq_show
(
struct
seq_file
*
seq
,
void
*
offset
)
{
struct
acpi_ac
*
ac
=
seq
->
private
;
if
(
!
ac
)
return
0
;
if
(
acpi_ac_get_state
(
ac
))
{
seq_puts
(
seq
,
"ERROR: Unable to read AC Adapter state
\n
"
);
return
0
;
}
seq_puts
(
seq
,
"state: "
);
switch
(
ac
->
state
)
{
case
ACPI_AC_STATUS_OFFLINE
:
seq_puts
(
seq
,
"off-line
\n
"
);
break
;
case
ACPI_AC_STATUS_ONLINE
:
seq_puts
(
seq
,
"on-line
\n
"
);
break
;
default:
seq_puts
(
seq
,
"unknown
\n
"
);
break
;
}
return
0
;
}
static
int
acpi_ac_open_fs
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
acpi_ac_seq_show
,
PDE_DATA
(
inode
));
}
static
int
acpi_ac_add_fs
(
struct
acpi_device
*
device
)
{
struct
proc_dir_entry
*
entry
=
NULL
;
printk
(
KERN_WARNING
PREFIX
"Deprecated procfs I/F for AC is loaded,"
" please retry with CONFIG_ACPI_PROCFS_POWER cleared
\n
"
);
if
(
!
acpi_device_dir
(
device
))
{
acpi_device_dir
(
device
)
=
proc_mkdir
(
acpi_device_bid
(
device
),
acpi_ac_dir
);
if
(
!
acpi_device_dir
(
device
))
return
-
ENODEV
;
}
/* 'state' [R] */
entry
=
proc_create_data
(
ACPI_AC_FILE_STATE
,
S_IRUGO
,
acpi_device_dir
(
device
),
&
acpi_ac_fops
,
acpi_driver_data
(
device
));
if
(
!
entry
)
return
-
ENODEV
;
return
0
;
}
static
int
acpi_ac_remove_fs
(
struct
acpi_device
*
device
)
{
if
(
acpi_device_dir
(
device
))
{
remove_proc_entry
(
ACPI_AC_FILE_STATE
,
acpi_device_dir
(
device
));
remove_proc_entry
(
acpi_device_bid
(
device
),
acpi_ac_dir
);
acpi_device_dir
(
device
)
=
NULL
;
}
return
0
;
}
#endif
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
Driver Model
Driver Model
-------------------------------------------------------------------------- */
-------------------------------------------------------------------------- */
static
void
acpi_ac_notify
(
struct
acpi_device
*
device
,
u32
event
)
static
void
acpi_ac_notify
_handler
(
acpi_handle
handle
,
u32
event
,
void
*
data
)
{
{
struct
acpi_ac
*
ac
=
acpi_driver_data
(
device
);
struct
acpi_ac
*
ac
=
data
;
if
(
!
ac
)
if
(
!
ac
)
return
;
return
;
...
@@ -267,10 +141,10 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
...
@@ -267,10 +141,10 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
msleep
(
ac_sleep_before_get_state_ms
);
msleep
(
ac_sleep_before_get_state_ms
);
acpi_ac_get_state
(
ac
);
acpi_ac_get_state
(
ac
);
acpi_bus_generate_netlink_event
(
device
->
pnp
.
device_class
,
acpi_bus_generate_netlink_event
(
ac
->
adev
->
pnp
.
device_class
,
dev_name
(
&
device
->
dev
),
event
,
dev_name
(
&
ac
->
pdev
->
dev
)
,
(
u32
)
ac
->
state
);
event
,
(
u32
)
ac
->
state
);
acpi_notifier_call_chain
(
device
,
event
,
(
u32
)
ac
->
state
);
acpi_notifier_call_chain
(
ac
->
adev
,
event
,
(
u32
)
ac
->
state
);
kobject_uevent
(
&
ac
->
charger
.
dev
->
kobj
,
KOBJ_CHANGE
);
kobject_uevent
(
&
ac
->
charger
.
dev
->
kobj
,
KOBJ_CHANGE
);
}
}
...
@@ -295,53 +169,55 @@ static struct dmi_system_id ac_dmi_table[] = {
...
@@ -295,53 +169,55 @@ static struct dmi_system_id ac_dmi_table[] = {
{},
{},
};
};
static
int
acpi_ac_
add
(
struct
acpi_device
*
device
)
static
int
acpi_ac_
probe
(
struct
platform_device
*
pdev
)
{
{
int
result
=
0
;
int
result
=
0
;
struct
acpi_ac
*
ac
=
NULL
;
struct
acpi_ac
*
ac
=
NULL
;
struct
acpi_device
*
adev
;
if
(
!
pdev
)
if
(
!
device
)
return
-
EINVAL
;
return
-
EINVAL
;
result
=
acpi_bus_get_device
(
ACPI_HANDLE
(
&
pdev
->
dev
),
&
adev
);
if
(
result
)
return
-
ENODEV
;
ac
=
kzalloc
(
sizeof
(
struct
acpi_ac
),
GFP_KERNEL
);
ac
=
kzalloc
(
sizeof
(
struct
acpi_ac
),
GFP_KERNEL
);
if
(
!
ac
)
if
(
!
ac
)
return
-
ENOMEM
;
return
-
ENOMEM
;
ac
->
device
=
device
;
strcpy
(
acpi_device_name
(
adev
),
ACPI_AC_DEVICE_NAME
);
strcpy
(
acpi_device_name
(
device
),
ACPI_AC_DEVICE_NAME
);
strcpy
(
acpi_device_class
(
adev
),
ACPI_AC_CLASS
);
strcpy
(
acpi_device_class
(
device
),
ACPI_AC_CLASS
);
ac
->
adev
=
adev
;
device
->
driver_data
=
ac
;
ac
->
pdev
=
pdev
;
platform_set_drvdata
(
pdev
,
ac
);
result
=
acpi_ac_get_state
(
ac
);
result
=
acpi_ac_get_state
(
ac
);
if
(
result
)
if
(
result
)
goto
end
;
goto
end
;
#ifdef CONFIG_ACPI_PROCFS_POWER
ac
->
charger
.
name
=
acpi_device_bid
(
adev
);
result
=
acpi_ac_add_fs
(
device
);
#endif
if
(
result
)
goto
end
;
ac
->
charger
.
name
=
acpi_device_bid
(
device
);
ac
->
charger
.
type
=
POWER_SUPPLY_TYPE_MAINS
;
ac
->
charger
.
type
=
POWER_SUPPLY_TYPE_MAINS
;
ac
->
charger
.
properties
=
ac_props
;
ac
->
charger
.
properties
=
ac_props
;
ac
->
charger
.
num_properties
=
ARRAY_SIZE
(
ac_props
);
ac
->
charger
.
num_properties
=
ARRAY_SIZE
(
ac_props
);
ac
->
charger
.
get_property
=
get_ac_property
;
ac
->
charger
.
get_property
=
get_ac_property
;
result
=
power_supply_register
(
&
ac
->
device
->
dev
,
&
ac
->
charger
);
result
=
power_supply_register
(
&
pdev
->
dev
,
&
ac
->
charger
);
if
(
result
)
if
(
result
)
goto
end
;
goto
end
;
result
=
acpi_install_notify_handler
(
ACPI_HANDLE
(
&
pdev
->
dev
),
ACPI_DEVICE_NOTIFY
,
acpi_ac_notify_handler
,
ac
);
if
(
result
)
{
power_supply_unregister
(
&
ac
->
charger
);
goto
end
;
}
printk
(
KERN_INFO
PREFIX
"%s [%s] (%s)
\n
"
,
printk
(
KERN_INFO
PREFIX
"%s [%s] (%s)
\n
"
,
acpi_device_name
(
device
),
acpi_device_bid
(
device
),
acpi_device_name
(
adev
),
acpi_device_bid
(
adev
),
ac
->
state
?
"on-line"
:
"off-line"
);
ac
->
state
?
"on-line"
:
"off-line"
);
end:
end:
if
(
result
)
{
if
(
result
)
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs
(
device
);
#endif
kfree
(
ac
);
kfree
(
ac
);
}
dmi_check_system
(
ac_dmi_table
);
dmi_check_system
(
ac_dmi_table
);
return
result
;
return
result
;
...
@@ -356,7 +232,7 @@ static int acpi_ac_resume(struct device *dev)
...
@@ -356,7 +232,7 @@ static int acpi_ac_resume(struct device *dev)
if
(
!
dev
)
if
(
!
dev
)
return
-
EINVAL
;
return
-
EINVAL
;
ac
=
acpi_driver_data
(
to_acpi
_device
(
dev
));
ac
=
platform_get_drvdata
(
to_platform
_device
(
dev
));
if
(
!
ac
)
if
(
!
ac
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -368,28 +244,44 @@ static int acpi_ac_resume(struct device *dev)
...
@@ -368,28 +244,44 @@ static int acpi_ac_resume(struct device *dev)
return
0
;
return
0
;
}
}
#endif
#endif
static
SIMPLE_DEV_PM_OPS
(
acpi_ac_pm_ops
,
NULL
,
acpi_ac_resume
);
static
int
acpi_ac_remove
(
struct
acpi_device
*
device
)
static
int
acpi_ac_remove
(
struct
platform_device
*
pdev
)
{
{
struct
acpi_ac
*
ac
=
NULL
;
struct
acpi_ac
*
ac
;
if
(
!
device
||
!
acpi_driver_data
(
device
)
)
if
(
!
pdev
)
return
-
EINVAL
;
return
-
EINVAL
;
ac
=
acpi_driver_data
(
device
);
acpi_remove_notify_handler
(
ACPI_HANDLE
(
&
pdev
->
dev
),
ACPI_DEVICE_NOTIFY
,
acpi_ac_notify_handler
);
ac
=
platform_get_drvdata
(
pdev
);
if
(
ac
->
charger
.
dev
)
if
(
ac
->
charger
.
dev
)
power_supply_unregister
(
&
ac
->
charger
);
power_supply_unregister
(
&
ac
->
charger
);
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs
(
device
);
#endif
kfree
(
ac
);
kfree
(
ac
);
return
0
;
return
0
;
}
}
static
const
struct
acpi_device_id
acpi_ac_match
[]
=
{
{
"ACPI0003"
,
0
},
{
}
};
MODULE_DEVICE_TABLE
(
acpi
,
acpi_ac_match
);
static
struct
platform_driver
acpi_ac_driver
=
{
.
probe
=
acpi_ac_probe
,
.
remove
=
acpi_ac_remove
,
.
driver
=
{
.
name
=
"acpi-ac"
,
.
owner
=
THIS_MODULE
,
.
pm
=
&
acpi_ac_pm_ops
,
.
acpi_match_table
=
ACPI_PTR
(
acpi_ac_match
),
},
};
static
int
__init
acpi_ac_init
(
void
)
static
int
__init
acpi_ac_init
(
void
)
{
{
int
result
;
int
result
;
...
@@ -397,34 +289,16 @@ static int __init acpi_ac_init(void)
...
@@ -397,34 +289,16 @@ static int __init acpi_ac_init(void)
if
(
acpi_disabled
)
if
(
acpi_disabled
)
return
-
ENODEV
;
return
-
ENODEV
;
#ifdef CONFIG_ACPI_PROCFS_POWER
result
=
platform_driver_register
(
&
acpi_ac_driver
);
acpi_ac_dir
=
acpi_lock_ac_dir
();
if
(
result
<
0
)
if
(
!
acpi_ac_dir
)
return
-
ENODEV
;
return
-
ENODEV
;
#endif
result
=
acpi_bus_register_driver
(
&
acpi_ac_driver
);
if
(
result
<
0
)
{
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_ac_dir
(
acpi_ac_dir
);
#endif
return
-
ENODEV
;
}
return
0
;
return
0
;
}
}
static
void
__exit
acpi_ac_exit
(
void
)
static
void
__exit
acpi_ac_exit
(
void
)
{
{
platform_driver_unregister
(
&
acpi_ac_driver
);
acpi_bus_unregister_driver
(
&
acpi_ac_driver
);
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_ac_dir
(
acpi_ac_dir
);
#endif
return
;
}
}
module_init
(
acpi_ac_init
);
module_init
(
acpi_ac_init
);
module_exit
(
acpi_ac_exit
);
module_exit
(
acpi_ac_exit
);
drivers/acpi/acpi_lpss.c
浏览文件 @
17e8d03c
...
@@ -30,6 +30,7 @@ ACPI_MODULE_NAME("acpi_lpss");
...
@@ -30,6 +30,7 @@ ACPI_MODULE_NAME("acpi_lpss");
/* Offsets relative to LPSS_PRIVATE_OFFSET */
/* Offsets relative to LPSS_PRIVATE_OFFSET */
#define LPSS_GENERAL 0x08
#define LPSS_GENERAL 0x08
#define LPSS_GENERAL_LTR_MODE_SW BIT(2)
#define LPSS_GENERAL_LTR_MODE_SW BIT(2)
#define LPSS_GENERAL_UART_RTS_OVRD BIT(3)
#define LPSS_SW_LTR 0x10
#define LPSS_SW_LTR 0x10
#define LPSS_AUTO_LTR 0x14
#define LPSS_AUTO_LTR 0x14
#define LPSS_TX_INT 0x20
#define LPSS_TX_INT 0x20
...
@@ -68,11 +69,16 @@ struct lpss_private_data {
...
@@ -68,11 +69,16 @@ struct lpss_private_data {
static
void
lpss_uart_setup
(
struct
lpss_private_data
*
pdata
)
static
void
lpss_uart_setup
(
struct
lpss_private_data
*
pdata
)
{
{
unsigned
int
tx_int_offset
=
pdata
->
dev_desc
->
prv_offset
+
LPSS_TX_INT
;
unsigned
int
offset
;
u32
reg
;
u32
reg
;
reg
=
readl
(
pdata
->
mmio_base
+
tx_int_offset
);
offset
=
pdata
->
dev_desc
->
prv_offset
+
LPSS_TX_INT
;
writel
(
reg
|
LPSS_TX_INT_MASK
,
pdata
->
mmio_base
+
tx_int_offset
);
reg
=
readl
(
pdata
->
mmio_base
+
offset
);
writel
(
reg
|
LPSS_TX_INT_MASK
,
pdata
->
mmio_base
+
offset
);
offset
=
pdata
->
dev_desc
->
prv_offset
+
LPSS_GENERAL
;
reg
=
readl
(
pdata
->
mmio_base
+
offset
);
writel
(
reg
|
LPSS_GENERAL_UART_RTS_OVRD
,
pdata
->
mmio_base
+
offset
);
}
}
static
struct
lpss_device_desc
lpt_dev_desc
=
{
static
struct
lpss_device_desc
lpt_dev_desc
=
{
...
...
drivers/acpi/acpi_platform.c
浏览文件 @
17e8d03c
...
@@ -29,6 +29,13 @@ ACPI_MODULE_NAME("platform");
...
@@ -29,6 +29,13 @@ ACPI_MODULE_NAME("platform");
static
const
struct
acpi_device_id
acpi_platform_device_ids
[]
=
{
static
const
struct
acpi_device_id
acpi_platform_device_ids
[]
=
{
{
"PNP0D40"
},
{
"PNP0D40"
},
{
"ACPI0003"
},
{
"VPC2004"
},
{
"BCM4752"
},
/* Intel Smart Sound Technology */
{
"INT33C8"
},
{
"80860F28"
},
{
}
{
}
};
};
...
...
drivers/acpi/button.c
浏览文件 @
17e8d03c
...
@@ -383,18 +383,15 @@ static int acpi_button_add(struct acpi_device *device)
...
@@ -383,18 +383,15 @@ static int acpi_button_add(struct acpi_device *device)
switch
(
button
->
type
)
{
switch
(
button
->
type
)
{
case
ACPI_BUTTON_TYPE_POWER
:
case
ACPI_BUTTON_TYPE_POWER
:
input
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
);
input_set_capability
(
input
,
EV_KEY
,
KEY_POWER
);
set_bit
(
KEY_POWER
,
input
->
keybit
);
break
;
break
;
case
ACPI_BUTTON_TYPE_SLEEP
:
case
ACPI_BUTTON_TYPE_SLEEP
:
input
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
);
input_set_capability
(
input
,
EV_KEY
,
KEY_SLEEP
);
set_bit
(
KEY_SLEEP
,
input
->
keybit
);
break
;
break
;
case
ACPI_BUTTON_TYPE_LID
:
case
ACPI_BUTTON_TYPE_LID
:
input
->
evbit
[
0
]
=
BIT_MASK
(
EV_SW
);
input_set_capability
(
input
,
EV_SW
,
SW_LID
);
set_bit
(
SW_LID
,
input
->
swbit
);
break
;
break
;
}
}
...
...
drivers/acpi/ec.c
浏览文件 @
17e8d03c
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
/* Uncomment next line to get verbose printout */
/* Uncomment next line to get verbose printout */
/* #define DEBUG */
/* #define DEBUG */
#define pr_fmt(fmt) "ACPI : EC: " fmt
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
...
@@ -49,9 +50,6 @@
...
@@ -49,9 +50,6 @@
#define ACPI_EC_DEVICE_NAME "Embedded Controller"
#define ACPI_EC_DEVICE_NAME "Embedded Controller"
#define ACPI_EC_FILE_INFO "info"
#define ACPI_EC_FILE_INFO "info"
#undef PREFIX
#define PREFIX "ACPI: EC: "
/* EC status register */
/* EC status register */
#define ACPI_EC_FLAG_OBF 0x01
/* Output buffer full */
#define ACPI_EC_FLAG_OBF 0x01
/* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02
/* Input buffer full */
#define ACPI_EC_FLAG_IBF 0x02
/* Input buffer full */
...
@@ -131,26 +129,26 @@ static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */
...
@@ -131,26 +129,26 @@ static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */
static
inline
u8
acpi_ec_read_status
(
struct
acpi_ec
*
ec
)
static
inline
u8
acpi_ec_read_status
(
struct
acpi_ec
*
ec
)
{
{
u8
x
=
inb
(
ec
->
command_addr
);
u8
x
=
inb
(
ec
->
command_addr
);
pr_debug
(
PREFIX
"---> status = 0x%2.2x
\n
"
,
x
);
pr_debug
(
"---> status = 0x%2.2x
\n
"
,
x
);
return
x
;
return
x
;
}
}
static
inline
u8
acpi_ec_read_data
(
struct
acpi_ec
*
ec
)
static
inline
u8
acpi_ec_read_data
(
struct
acpi_ec
*
ec
)
{
{
u8
x
=
inb
(
ec
->
data_addr
);
u8
x
=
inb
(
ec
->
data_addr
);
pr_debug
(
PREFIX
"---> data = 0x%2.2x
\n
"
,
x
);
pr_debug
(
"---> data = 0x%2.2x
\n
"
,
x
);
return
x
;
return
x
;
}
}
static
inline
void
acpi_ec_write_cmd
(
struct
acpi_ec
*
ec
,
u8
command
)
static
inline
void
acpi_ec_write_cmd
(
struct
acpi_ec
*
ec
,
u8
command
)
{
{
pr_debug
(
PREFIX
"<--- command = 0x%2.2x
\n
"
,
command
);
pr_debug
(
"<--- command = 0x%2.2x
\n
"
,
command
);
outb
(
command
,
ec
->
command_addr
);
outb
(
command
,
ec
->
command_addr
);
}
}
static
inline
void
acpi_ec_write_data
(
struct
acpi_ec
*
ec
,
u8
data
)
static
inline
void
acpi_ec_write_data
(
struct
acpi_ec
*
ec
,
u8
data
)
{
{
pr_debug
(
PREFIX
"<--- data = 0x%2.2x
\n
"
,
data
);
pr_debug
(
"<--- data = 0x%2.2x
\n
"
,
data
);
outb
(
data
,
ec
->
data_addr
);
outb
(
data
,
ec
->
data_addr
);
}
}
...
@@ -241,7 +239,7 @@ static int ec_poll(struct acpi_ec *ec)
...
@@ -241,7 +239,7 @@ static int ec_poll(struct acpi_ec *ec)
}
}
advance_transaction
(
ec
,
acpi_ec_read_status
(
ec
));
advance_transaction
(
ec
,
acpi_ec_read_status
(
ec
));
}
while
(
time_before
(
jiffies
,
delay
));
}
while
(
time_before
(
jiffies
,
delay
));
pr_debug
(
PREFIX
"controller reset, restart transaction
\n
"
);
pr_debug
(
"controller reset, restart transaction
\n
"
);
spin_lock_irqsave
(
&
ec
->
lock
,
flags
);
spin_lock_irqsave
(
&
ec
->
lock
,
flags
);
start_transaction
(
ec
);
start_transaction
(
ec
);
spin_unlock_irqrestore
(
&
ec
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
ec
->
lock
,
flags
);
...
@@ -309,12 +307,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
...
@@ -309,12 +307,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
}
}
}
}
if
(
ec_wait_ibf0
(
ec
))
{
if
(
ec_wait_ibf0
(
ec
))
{
pr_err
(
PREFIX
"input buffer is not empty, "
pr_err
(
"input buffer is not empty, "
"aborting transaction
\n
"
);
"aborting transaction
\n
"
);
status
=
-
ETIME
;
status
=
-
ETIME
;
goto
end
;
goto
end
;
}
}
pr_debug
(
PREFIX
"transaction start (cmd=0x%02x, addr=0x%02x)
\n
"
,
pr_debug
(
"transaction start (cmd=0x%02x, addr=0x%02x)
\n
"
,
t
->
command
,
t
->
wdata
?
t
->
wdata
[
0
]
:
0
);
t
->
command
,
t
->
wdata
?
t
->
wdata
[
0
]
:
0
);
/* disable GPE during transaction if storm is detected */
/* disable GPE during transaction if storm is detected */
if
(
test_bit
(
EC_FLAGS_GPE_STORM
,
&
ec
->
flags
))
{
if
(
test_bit
(
EC_FLAGS_GPE_STORM
,
&
ec
->
flags
))
{
...
@@ -331,12 +329,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
...
@@ -331,12 +329,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
/* It is safe to enable the GPE outside of the transaction. */
/* It is safe to enable the GPE outside of the transaction. */
acpi_enable_gpe
(
NULL
,
ec
->
gpe
);
acpi_enable_gpe
(
NULL
,
ec
->
gpe
);
}
else
if
(
t
->
irq_count
>
ec_storm_threshold
)
{
}
else
if
(
t
->
irq_count
>
ec_storm_threshold
)
{
pr_info
(
PREFIX
"GPE storm detected(%d GPEs), "
pr_info
(
"GPE storm detected(%d GPEs), "
"transactions will use polling mode
\n
"
,
"transactions will use polling mode
\n
"
,
t
->
irq_count
);
t
->
irq_count
);
set_bit
(
EC_FLAGS_GPE_STORM
,
&
ec
->
flags
);
set_bit
(
EC_FLAGS_GPE_STORM
,
&
ec
->
flags
);
}
}
pr_debug
(
PREFIX
"transaction end
\n
"
);
pr_debug
(
"transaction end
\n
"
);
end:
end:
if
(
ec
->
global_lock
)
if
(
ec
->
global_lock
)
acpi_release_global_lock
(
glk
);
acpi_release_global_lock
(
glk
);
...
@@ -570,12 +568,12 @@ static void acpi_ec_run(void *cxt)
...
@@ -570,12 +568,12 @@ static void acpi_ec_run(void *cxt)
struct
acpi_ec_query_handler
*
handler
=
cxt
;
struct
acpi_ec_query_handler
*
handler
=
cxt
;
if
(
!
handler
)
if
(
!
handler
)
return
;
return
;
pr_debug
(
PREFIX
"start query execution
\n
"
);
pr_debug
(
"start query execution
\n
"
);
if
(
handler
->
func
)
if
(
handler
->
func
)
handler
->
func
(
handler
->
data
);
handler
->
func
(
handler
->
data
);
else
if
(
handler
->
handle
)
else
if
(
handler
->
handle
)
acpi_evaluate_object
(
handler
->
handle
,
NULL
,
NULL
,
NULL
);
acpi_evaluate_object
(
handler
->
handle
,
NULL
,
NULL
,
NULL
);
pr_debug
(
PREFIX
"stop query execution
\n
"
);
pr_debug
(
"stop query execution
\n
"
);
kfree
(
handler
);
kfree
(
handler
);
}
}
...
@@ -593,7 +591,8 @@ static int acpi_ec_sync_query(struct acpi_ec *ec)
...
@@ -593,7 +591,8 @@ static int acpi_ec_sync_query(struct acpi_ec *ec)
if
(
!
copy
)
if
(
!
copy
)
return
-
ENOMEM
;
return
-
ENOMEM
;
memcpy
(
copy
,
handler
,
sizeof
(
*
copy
));
memcpy
(
copy
,
handler
,
sizeof
(
*
copy
));
pr_debug
(
PREFIX
"push query execution (0x%2x) on queue
\n
"
,
value
);
pr_debug
(
"push query execution (0x%2x) on queue
\n
"
,
value
);
return
acpi_os_execute
((
copy
->
func
)
?
return
acpi_os_execute
((
copy
->
func
)
?
OSL_NOTIFY_HANDLER
:
OSL_GPE_HANDLER
,
OSL_NOTIFY_HANDLER
:
OSL_GPE_HANDLER
,
acpi_ec_run
,
copy
);
acpi_ec_run
,
copy
);
...
@@ -616,7 +615,7 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
...
@@ -616,7 +615,7 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
{
{
if
(
state
&
ACPI_EC_FLAG_SCI
)
{
if
(
state
&
ACPI_EC_FLAG_SCI
)
{
if
(
!
test_and_set_bit
(
EC_FLAGS_QUERY_PENDING
,
&
ec
->
flags
))
{
if
(
!
test_and_set_bit
(
EC_FLAGS_QUERY_PENDING
,
&
ec
->
flags
))
{
pr_debug
(
PREFIX
"push gpe query to the queue
\n
"
);
pr_debug
(
"push gpe query to the queue
\n
"
);
return
acpi_os_execute
(
OSL_NOTIFY_HANDLER
,
return
acpi_os_execute
(
OSL_NOTIFY_HANDLER
,
acpi_ec_gpe_query
,
ec
);
acpi_ec_gpe_query
,
ec
);
}
}
...
@@ -630,7 +629,7 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
...
@@ -630,7 +629,7 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
struct
acpi_ec
*
ec
=
data
;
struct
acpi_ec
*
ec
=
data
;
u8
status
=
acpi_ec_read_status
(
ec
);
u8
status
=
acpi_ec_read_status
(
ec
);
pr_debug
(
PREFIX
"~~~> interrupt, status:0x%02x
\n
"
,
status
);
pr_debug
(
"~~~> interrupt, status:0x%02x
\n
"
,
status
);
advance_transaction
(
ec
,
status
);
advance_transaction
(
ec
,
status
);
if
(
ec_transaction_done
(
ec
)
&&
if
(
ec_transaction_done
(
ec
)
&&
...
@@ -776,7 +775,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
...
@@ -776,7 +775,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
* The AE_NOT_FOUND error will be ignored and OS
* The AE_NOT_FOUND error will be ignored and OS
* continue to initialize EC.
* continue to initialize EC.
*/
*/
pr
intk
(
KERN_ERR
"Fail in evaluating the _REG object"
pr
_err
(
"Fail in evaluating the _REG object"
" of EC device. Broken bios is suspected.
\n
"
);
" of EC device. Broken bios is suspected.
\n
"
);
}
else
{
}
else
{
acpi_remove_gpe_handler
(
NULL
,
ec
->
gpe
,
acpi_remove_gpe_handler
(
NULL
,
ec
->
gpe
,
...
@@ -795,10 +794,10 @@ static void ec_remove_handlers(struct acpi_ec *ec)
...
@@ -795,10 +794,10 @@ static void ec_remove_handlers(struct acpi_ec *ec)
acpi_disable_gpe
(
NULL
,
ec
->
gpe
);
acpi_disable_gpe
(
NULL
,
ec
->
gpe
);
if
(
ACPI_FAILURE
(
acpi_remove_address_space_handler
(
ec
->
handle
,
if
(
ACPI_FAILURE
(
acpi_remove_address_space_handler
(
ec
->
handle
,
ACPI_ADR_SPACE_EC
,
&
acpi_ec_space_handler
)))
ACPI_ADR_SPACE_EC
,
&
acpi_ec_space_handler
)))
pr_err
(
PREFIX
"failed to remove space handler
\n
"
);
pr_err
(
"failed to remove space handler
\n
"
);
if
(
ACPI_FAILURE
(
acpi_remove_gpe_handler
(
NULL
,
ec
->
gpe
,
if
(
ACPI_FAILURE
(
acpi_remove_gpe_handler
(
NULL
,
ec
->
gpe
,
&
acpi_ec_gpe_handler
)))
&
acpi_ec_gpe_handler
)))
pr_err
(
PREFIX
"failed to remove gpe handler
\n
"
);
pr_err
(
"failed to remove gpe handler
\n
"
);
clear_bit
(
EC_FLAGS_HANDLERS_INSTALLED
,
&
ec
->
flags
);
clear_bit
(
EC_FLAGS_HANDLERS_INSTALLED
,
&
ec
->
flags
);
}
}
...
@@ -840,7 +839,7 @@ static int acpi_ec_add(struct acpi_device *device)
...
@@ -840,7 +839,7 @@ static int acpi_ec_add(struct acpi_device *device)
ret
=
!!
request_region
(
ec
->
command_addr
,
1
,
"EC cmd"
);
ret
=
!!
request_region
(
ec
->
command_addr
,
1
,
"EC cmd"
);
WARN
(
!
ret
,
"Could not request EC cmd io port 0x%lx"
,
ec
->
command_addr
);
WARN
(
!
ret
,
"Could not request EC cmd io port 0x%lx"
,
ec
->
command_addr
);
pr_info
(
PREFIX
"GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx
\n
"
,
pr_info
(
"GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx
\n
"
,
ec
->
gpe
,
ec
->
command_addr
,
ec
->
data_addr
);
ec
->
gpe
,
ec
->
command_addr
,
ec
->
data_addr
);
ret
=
ec_install_handlers
(
ec
);
ret
=
ec_install_handlers
(
ec
);
...
@@ -931,7 +930,7 @@ static int ec_validate_ecdt(const struct dmi_system_id *id)
...
@@ -931,7 +930,7 @@ static int ec_validate_ecdt(const struct dmi_system_id *id)
/* MSI EC needs special treatment, enable it */
/* MSI EC needs special treatment, enable it */
static
int
ec_flag_msi
(
const
struct
dmi_system_id
*
id
)
static
int
ec_flag_msi
(
const
struct
dmi_system_id
*
id
)
{
{
pr
intk
(
KERN_DEBUG
PREFIX
"Detected MSI hardware, enabling workarounds.
\n
"
);
pr
_debug
(
"Detected MSI hardware, enabling workarounds.
\n
"
);
EC_FLAGS_MSI
=
1
;
EC_FLAGS_MSI
=
1
;
EC_FLAGS_VALIDATE_ECDT
=
1
;
EC_FLAGS_VALIDATE_ECDT
=
1
;
return
0
;
return
0
;
...
@@ -1010,7 +1009,7 @@ int __init acpi_ec_ecdt_probe(void)
...
@@ -1010,7 +1009,7 @@ int __init acpi_ec_ecdt_probe(void)
status
=
acpi_get_table
(
ACPI_SIG_ECDT
,
1
,
status
=
acpi_get_table
(
ACPI_SIG_ECDT
,
1
,
(
struct
acpi_table_header
**
)
&
ecdt_ptr
);
(
struct
acpi_table_header
**
)
&
ecdt_ptr
);
if
(
ACPI_SUCCESS
(
status
))
{
if
(
ACPI_SUCCESS
(
status
))
{
pr_info
(
PREFIX
"EC description table is found, configuring boot EC
\n
"
);
pr_info
(
"EC description table is found, configuring boot EC
\n
"
);
boot_ec
->
command_addr
=
ecdt_ptr
->
control
.
address
;
boot_ec
->
command_addr
=
ecdt_ptr
->
control
.
address
;
boot_ec
->
data_addr
=
ecdt_ptr
->
data
.
address
;
boot_ec
->
data_addr
=
ecdt_ptr
->
data
.
address
;
boot_ec
->
gpe
=
ecdt_ptr
->
gpe
;
boot_ec
->
gpe
=
ecdt_ptr
->
gpe
;
...
@@ -1030,7 +1029,7 @@ int __init acpi_ec_ecdt_probe(void)
...
@@ -1030,7 +1029,7 @@ int __init acpi_ec_ecdt_probe(void)
/* This workaround is needed only on some broken machines,
/* This workaround is needed only on some broken machines,
* which require early EC, but fail to provide ECDT */
* which require early EC, but fail to provide ECDT */
pr
intk
(
KERN_DEBUG
PREFIX
"Look up EC in DSDT
\n
"
);
pr
_debug
(
"Look up EC in DSDT
\n
"
);
status
=
acpi_get_devices
(
ec_device_ids
[
0
].
id
,
ec_parse_device
,
status
=
acpi_get_devices
(
ec_device_ids
[
0
].
id
,
ec_parse_device
,
boot_ec
,
NULL
);
boot_ec
,
NULL
);
/* Check that acpi_get_devices actually find something */
/* Check that acpi_get_devices actually find something */
...
@@ -1042,7 +1041,7 @@ int __init acpi_ec_ecdt_probe(void)
...
@@ -1042,7 +1041,7 @@ int __init acpi_ec_ecdt_probe(void)
saved_ec
->
data_addr
!=
boot_ec
->
data_addr
||
saved_ec
->
data_addr
!=
boot_ec
->
data_addr
||
saved_ec
->
gpe
!=
boot_ec
->
gpe
||
saved_ec
->
gpe
!=
boot_ec
->
gpe
||
saved_ec
->
handle
!=
boot_ec
->
handle
)
saved_ec
->
handle
!=
boot_ec
->
handle
)
pr_info
(
PREFIX
"ASUSTek keeps feeding us with broken "
pr_info
(
"ASUSTek keeps feeding us with broken "
"ECDT tables, which are very hard to workaround. "
"ECDT tables, which are very hard to workaround. "
"Trying to use DSDT EC info instead. Please send "
"Trying to use DSDT EC info instead. Please send "
"output of acpidump to linux-acpi@vger.kernel.org
\n
"
);
"output of acpidump to linux-acpi@vger.kernel.org
\n
"
);
...
...
drivers/acpi/osl.c
浏览文件 @
17e8d03c
...
@@ -820,7 +820,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
...
@@ -820,7 +820,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
void
acpi_os_sleep
(
u64
ms
)
void
acpi_os_sleep
(
u64
ms
)
{
{
schedule_timeout_interruptible
(
msecs_to_jiffies
(
ms
)
);
msleep
(
ms
);
}
}
void
acpi_os_stall
(
u32
us
)
void
acpi_os_stall
(
u32
us
)
...
@@ -1335,7 +1335,7 @@ static int __init acpi_os_name_setup(char *str)
...
@@ -1335,7 +1335,7 @@ static int __init acpi_os_name_setup(char *str)
if
(
!
str
||
!*
str
)
if
(
!
str
||
!*
str
)
return
0
;
return
0
;
for
(;
count
--
&&
str
&&
*
str
;
str
++
)
{
for
(;
count
--
&&
*
str
;
str
++
)
{
if
(
isalnum
(
*
str
)
||
*
str
==
' '
||
*
str
==
':'
)
if
(
isalnum
(
*
str
)
||
*
str
==
' '
||
*
str
==
':'
)
*
p
++
=
*
str
;
*
p
++
=
*
str
;
else
if
(
*
str
==
'\''
||
*
str
==
'"'
)
else
if
(
*
str
==
'\''
||
*
str
==
'"'
)
...
...
drivers/acpi/sysfs.c
浏览文件 @
17e8d03c
...
@@ -564,6 +564,7 @@ static ssize_t counter_set(struct kobject *kobj,
...
@@ -564,6 +564,7 @@ static ssize_t counter_set(struct kobject *kobj,
acpi_event_status
status
;
acpi_event_status
status
;
acpi_handle
handle
;
acpi_handle
handle
;
int
result
=
0
;
int
result
=
0
;
unsigned
long
tmp
;
if
(
index
==
num_gpes
+
ACPI_NUM_FIXED_EVENTS
+
COUNT_SCI
)
{
if
(
index
==
num_gpes
+
ACPI_NUM_FIXED_EVENTS
+
COUNT_SCI
)
{
int
i
;
int
i
;
...
@@ -596,8 +597,10 @@ static ssize_t counter_set(struct kobject *kobj,
...
@@ -596,8 +597,10 @@ static ssize_t counter_set(struct kobject *kobj,
else
if
(
!
strcmp
(
buf
,
"clear
\n
"
)
&&
else
if
(
!
strcmp
(
buf
,
"clear
\n
"
)
&&
(
status
&
ACPI_EVENT_FLAG_SET
))
(
status
&
ACPI_EVENT_FLAG_SET
))
result
=
acpi_clear_gpe
(
handle
,
index
);
result
=
acpi_clear_gpe
(
handle
,
index
);
else
if
(
!
kstrtoul
(
buf
,
0
,
&
tmp
))
all_counters
[
index
].
count
=
tmp
;
else
else
all_counters
[
index
].
count
=
strtoul
(
buf
,
NULL
,
0
)
;
result
=
-
EINVAL
;
}
else
if
(
index
<
num_gpes
+
ACPI_NUM_FIXED_EVENTS
)
{
}
else
if
(
index
<
num_gpes
+
ACPI_NUM_FIXED_EVENTS
)
{
int
event
=
index
-
num_gpes
;
int
event
=
index
-
num_gpes
;
if
(
!
strcmp
(
buf
,
"disable
\n
"
)
&&
if
(
!
strcmp
(
buf
,
"disable
\n
"
)
&&
...
@@ -609,8 +612,10 @@ static ssize_t counter_set(struct kobject *kobj,
...
@@ -609,8 +612,10 @@ static ssize_t counter_set(struct kobject *kobj,
else
if
(
!
strcmp
(
buf
,
"clear
\n
"
)
&&
else
if
(
!
strcmp
(
buf
,
"clear
\n
"
)
&&
(
status
&
ACPI_EVENT_FLAG_SET
))
(
status
&
ACPI_EVENT_FLAG_SET
))
result
=
acpi_clear_event
(
event
);
result
=
acpi_clear_event
(
event
);
else
if
(
!
kstrtoul
(
buf
,
0
,
&
tmp
))
all_counters
[
index
].
count
=
tmp
;
else
else
all_counters
[
index
].
count
=
strtoul
(
buf
,
NULL
,
0
)
;
result
=
-
EINVAL
;
}
else
}
else
all_counters
[
index
].
count
=
strtoul
(
buf
,
NULL
,
0
);
all_counters
[
index
].
count
=
strtoul
(
buf
,
NULL
,
0
);
...
...
drivers/acpi/thermal.c
浏览文件 @
17e8d03c
...
@@ -299,8 +299,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
...
@@ -299,8 +299,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
ACPI_DEBUG_PRINT
((
ACPI_DB_INFO
,
ACPI_DEBUG_PRINT
((
ACPI_DB_INFO
,
"No critical threshold
\n
"
));
"No critical threshold
\n
"
));
}
else
if
(
tmp
<=
2732
)
{
}
else
if
(
tmp
<=
2732
)
{
pr
intk
(
KERN_WARNING
FW_BUG
"Invalid critical threshold "
pr
_warn
(
FW_BUG
"Invalid critical threshold (%llu)
\n
"
,
"(%llu)
\n
"
,
tmp
);
tmp
);
tz
->
trips
.
critical
.
flags
.
valid
=
0
;
tz
->
trips
.
critical
.
flags
.
valid
=
0
;
}
else
{
}
else
{
tz
->
trips
.
critical
.
flags
.
valid
=
1
;
tz
->
trips
.
critical
.
flags
.
valid
=
1
;
...
@@ -317,8 +317,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
...
@@ -317,8 +317,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
* Allow override critical threshold
* Allow override critical threshold
*/
*/
if
(
crt_k
>
tz
->
trips
.
critical
.
temperature
)
if
(
crt_k
>
tz
->
trips
.
critical
.
temperature
)
pr
intk
(
KERN_WARNING
PREFIX
pr
_warn
(
PREFIX
"Critical threshold %d C
\n
"
,
"Critical threshold %d C
\n
"
,
crt
);
crt
);
tz
->
trips
.
critical
.
temperature
=
crt_k
;
tz
->
trips
.
critical
.
temperature
=
crt_k
;
}
}
}
}
...
@@ -390,8 +390,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
...
@@ -390,8 +390,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
status
=
acpi_evaluate_reference
(
tz
->
device
->
handle
,
"_PSL"
,
status
=
acpi_evaluate_reference
(
tz
->
device
->
handle
,
"_PSL"
,
NULL
,
&
devices
);
NULL
,
&
devices
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
printk
(
KERN_WARNING
PREFIX
pr_warn
(
PREFIX
"Invalid passive threshold
\n
"
);
"Invalid passive threshold
\n
"
);
tz
->
trips
.
passive
.
flags
.
valid
=
0
;
tz
->
trips
.
passive
.
flags
.
valid
=
0
;
}
}
else
else
...
@@ -453,8 +452,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
...
@@ -453,8 +452,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
status
=
acpi_evaluate_reference
(
tz
->
device
->
handle
,
status
=
acpi_evaluate_reference
(
tz
->
device
->
handle
,
name
,
NULL
,
&
devices
);
name
,
NULL
,
&
devices
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
pr
intk
(
KERN_WARNING
PREFIX
pr
_warn
(
PREFIX
"Invalid active%d threshold
\n
"
,
"Invalid active%d threshold
\n
"
,
i
);
i
);
tz
->
trips
.
active
[
i
].
flags
.
valid
=
0
;
tz
->
trips
.
active
[
i
].
flags
.
valid
=
0
;
}
}
else
else
...
@@ -505,7 +504,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
...
@@ -505,7 +504,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
valid
|=
tz
->
trips
.
active
[
i
].
flags
.
valid
;
valid
|=
tz
->
trips
.
active
[
i
].
flags
.
valid
;
if
(
!
valid
)
{
if
(
!
valid
)
{
pr
intk
(
KERN_WARNING
FW_BUG
"No valid trip found
\n
"
);
pr
_warn
(
FW_BUG
"No valid trip found
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
return
0
;
return
0
;
...
@@ -923,8 +922,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
...
@@ -923,8 +922,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
acpi_bus_private_data_handler
,
acpi_bus_private_data_handler
,
tz
->
thermal_zone
);
tz
->
thermal_zone
);
if
(
ACPI_FAILURE
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
{
printk
(
KERN_ERR
PREFIX
pr_err
(
PREFIX
"Error attaching device data
\n
"
);
"Error attaching device data
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -1094,9 +1092,8 @@ static int acpi_thermal_add(struct acpi_device *device)
...
@@ -1094,9 +1092,8 @@ static int acpi_thermal_add(struct acpi_device *device)
if
(
result
)
if
(
result
)
goto
free_memory
;
goto
free_memory
;
printk
(
KERN_INFO
PREFIX
"%s [%s] (%ld C)
\n
"
,
pr_info
(
PREFIX
"%s [%s] (%ld C)
\n
"
,
acpi_device_name
(
device
),
acpi_device_name
(
device
),
acpi_device_bid
(
device
),
acpi_device_bid
(
device
),
KELVIN_TO_CELSIUS
(
tz
->
temperature
));
KELVIN_TO_CELSIUS
(
tz
->
temperature
));
goto
end
;
goto
end
;
free_memory:
free_memory:
...
@@ -1159,24 +1156,24 @@ static int acpi_thermal_resume(struct device *dev)
...
@@ -1159,24 +1156,24 @@ static int acpi_thermal_resume(struct device *dev)
static
int
thermal_act
(
const
struct
dmi_system_id
*
d
)
{
static
int
thermal_act
(
const
struct
dmi_system_id
*
d
)
{
if
(
act
==
0
)
{
if
(
act
==
0
)
{
pr
intk
(
KERN_NOTICE
"ACPI:
%s detected: "
pr
_notice
(
PREFIX
"
%s detected: "
"disabling all active thermal trip points
\n
"
,
d
->
ident
);
"disabling all active thermal trip points
\n
"
,
d
->
ident
);
act
=
-
1
;
act
=
-
1
;
}
}
return
0
;
return
0
;
}
}
static
int
thermal_nocrt
(
const
struct
dmi_system_id
*
d
)
{
static
int
thermal_nocrt
(
const
struct
dmi_system_id
*
d
)
{
pr
intk
(
KERN_NOTICE
"ACPI:
%s detected: "
pr
_notice
(
PREFIX
"
%s detected: "
"disabling all critical thermal trip point actions.
\n
"
,
d
->
ident
);
"disabling all critical thermal trip point actions.
\n
"
,
d
->
ident
);
nocrt
=
1
;
nocrt
=
1
;
return
0
;
return
0
;
}
}
static
int
thermal_tzp
(
const
struct
dmi_system_id
*
d
)
{
static
int
thermal_tzp
(
const
struct
dmi_system_id
*
d
)
{
if
(
tzp
==
0
)
{
if
(
tzp
==
0
)
{
pr
intk
(
KERN_NOTICE
"ACPI:
%s detected: "
pr
_notice
(
PREFIX
"
%s detected: "
"enabling thermal zone polling
\n
"
,
d
->
ident
);
"enabling thermal zone polling
\n
"
,
d
->
ident
);
tzp
=
300
;
/* 300 dS = 30 Seconds */
tzp
=
300
;
/* 300 dS = 30 Seconds */
}
}
return
0
;
return
0
;
...
@@ -1184,8 +1181,8 @@ static int thermal_tzp(const struct dmi_system_id *d) {
...
@@ -1184,8 +1181,8 @@ static int thermal_tzp(const struct dmi_system_id *d) {
static
int
thermal_psv
(
const
struct
dmi_system_id
*
d
)
{
static
int
thermal_psv
(
const
struct
dmi_system_id
*
d
)
{
if
(
psv
==
0
)
{
if
(
psv
==
0
)
{
pr
intk
(
KERN_NOTICE
"ACPI:
%s detected: "
pr
_notice
(
PREFIX
"
%s detected: "
"disabling all passive thermal trip points
\n
"
,
d
->
ident
);
"disabling all passive thermal trip points
\n
"
,
d
->
ident
);
psv
=
-
1
;
psv
=
-
1
;
}
}
return
0
;
return
0
;
...
@@ -1238,7 +1235,7 @@ static int __init acpi_thermal_init(void)
...
@@ -1238,7 +1235,7 @@ static int __init acpi_thermal_init(void)
dmi_check_system
(
thermal_dmi_table
);
dmi_check_system
(
thermal_dmi_table
);
if
(
off
)
{
if
(
off
)
{
pr
intk
(
KERN_NOTICE
"ACPI:
thermal control disabled
\n
"
);
pr
_notice
(
PREFIX
"
thermal control disabled
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
...
drivers/acpi/utils.c
浏览文件 @
17e8d03c
...
@@ -169,11 +169,20 @@ acpi_extract_package(union acpi_object *package,
...
@@ -169,11 +169,20 @@ acpi_extract_package(union acpi_object *package,
/*
/*
* Validate output buffer.
* Validate output buffer.
*/
*/
if
(
buffer
->
length
<
size_required
)
{
if
(
buffer
->
length
==
ACPI_ALLOCATE_BUFFER
)
{
buffer
->
pointer
=
ACPI_ALLOCATE
(
size_required
);
if
(
!
buffer
->
pointer
)
return
AE_NO_MEMORY
;
buffer
->
length
=
size_required
;
buffer
->
length
=
size_required
;
return
AE_BUFFER_OVERFLOW
;
memset
(
buffer
->
pointer
,
0
,
size_required
);
}
else
if
(
buffer
->
length
!=
size_required
||
!
buffer
->
pointer
)
{
}
else
{
return
AE_BAD_PARAMETER
;
if
(
buffer
->
length
<
size_required
)
{
buffer
->
length
=
size_required
;
return
AE_BUFFER_OVERFLOW
;
}
else
if
(
buffer
->
length
!=
size_required
||
!
buffer
->
pointer
)
{
return
AE_BAD_PARAMETER
;
}
}
}
head
=
buffer
->
pointer
;
head
=
buffer
->
pointer
;
...
...
drivers/platform/x86/ideapad-laptop.c
浏览文件 @
17e8d03c
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录