Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
2d8fe675
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看板
提交
2d8fe675
编写于
5月 24, 2014
作者:
R
Rafael J. Wysocki
浏览文件
操作
浏览文件
下载
差异文件
Merge back earlier 'acpi-video' material.
上级
07d1d29e
9404cd95
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
101 addition
and
68 deletion
+101
-68
Documentation/kernel-parameters.txt
Documentation/kernel-parameters.txt
+1
-1
drivers/acpi/video.c
drivers/acpi/video.c
+89
-66
drivers/platform/x86/acer-wmi.c
drivers/platform/x86/acer-wmi.c
+9
-1
include/acpi/video.h
include/acpi/video.h
+2
-0
未找到文件。
Documentation/kernel-parameters.txt
浏览文件 @
2d8fe675
...
@@ -3461,7 +3461,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
...
@@ -3461,7 +3461,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
the allocated input device; If set to 0, video driver
the allocated input device; If set to 0, video driver
will only send out the event without touching backlight
will only send out the event without touching backlight
brightness level.
brightness level.
default:
1
default:
0
virtio_mmio.device=
virtio_mmio.device=
[VMMIO] Memory mapped virtio (platform) device.
[VMMIO] Memory mapped virtio (platform) device.
...
...
drivers/acpi/video.c
浏览文件 @
2d8fe675
...
@@ -68,7 +68,7 @@ MODULE_AUTHOR("Bruno Ducrot");
...
@@ -68,7 +68,7 @@ MODULE_AUTHOR("Bruno Ducrot");
MODULE_DESCRIPTION
(
"ACPI Video Driver"
);
MODULE_DESCRIPTION
(
"ACPI Video Driver"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
static
bool
brightness_switch_enabled
=
1
;
static
bool
brightness_switch_enabled
;
module_param
(
brightness_switch_enabled
,
bool
,
0644
);
module_param
(
brightness_switch_enabled
,
bool
,
0644
);
/*
/*
...
@@ -150,6 +150,7 @@ struct acpi_video_enumerated_device {
...
@@ -150,6 +150,7 @@ struct acpi_video_enumerated_device {
struct
acpi_video_bus
{
struct
acpi_video_bus
{
struct
acpi_device
*
device
;
struct
acpi_device
*
device
;
bool
backlight_registered
;
u8
dos_setting
;
u8
dos_setting
;
struct
acpi_video_enumerated_device
*
attached_array
;
struct
acpi_video_enumerated_device
*
attached_array
;
u8
attached_count
;
u8
attached_count
;
...
@@ -1658,88 +1659,89 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
...
@@ -1658,88 +1659,89 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
static
void
acpi_video_dev_register_backlight
(
struct
acpi_video_device
*
device
)
static
void
acpi_video_dev_register_backlight
(
struct
acpi_video_device
*
device
)
{
{
if
(
acpi_video_verify_backlight_support
())
{
struct
backlight_properties
props
;
struct
backlight_properties
props
;
struct
pci_dev
*
pdev
;
struct
pci_dev
*
pdev
;
acpi_handle
acpi_parent
;
acpi_handle
acpi_parent
;
struct
device
*
parent
=
NULL
;
struct
device
*
parent
=
NULL
;
int
result
;
int
result
;
static
int
count
;
static
int
count
;
char
*
name
;
char
*
name
;
result
=
acpi_video_init_brightness
(
device
);
if
(
result
)
return
;
name
=
kasprintf
(
GFP_KERNEL
,
"acpi_video%d"
,
count
);
if
(
!
name
)
return
;
count
++
;
acpi_get_parent
(
device
->
dev
->
handle
,
&
acpi_parent
);
result
=
acpi_video_init_brightness
(
device
);
if
(
result
)
return
;
name
=
kasprintf
(
GFP_KERNEL
,
"acpi_video%d"
,
count
);
if
(
!
name
)
return
;
count
++
;
pdev
=
acpi_get_pci_dev
(
acpi_parent
);
acpi_get_parent
(
device
->
dev
->
handle
,
&
acpi_parent
);
if
(
pdev
)
{
parent
=
&
pdev
->
dev
;
pci_dev_put
(
pdev
);
}
memset
(
&
props
,
0
,
sizeof
(
struct
backlight_properties
));
pdev
=
acpi_get_pci_dev
(
acpi_parent
);
props
.
type
=
BACKLIGHT_FIRMWARE
;
if
(
pdev
)
{
props
.
max_brightness
=
device
->
brightness
->
count
-
3
;
parent
=
&
pdev
->
dev
;
device
->
backlight
=
backlight_device_register
(
name
,
pci_dev_put
(
pdev
);
parent
,
}
device
,
&
acpi_backlight_ops
,
&
props
);
kfree
(
name
);
if
(
IS_ERR
(
device
->
backlight
))
return
;
/*
memset
(
&
props
,
0
,
sizeof
(
struct
backlight_properties
));
* Save current brightness level in case we have to restore it
props
.
type
=
BACKLIGHT_FIRMWARE
;
* before acpi_video_device_lcd_set_level() is called next time.
props
.
max_brightness
=
device
->
brightness
->
count
-
3
;
*/
device
->
backlight
=
backlight_device_register
(
name
,
device
->
backlight
->
props
.
brightness
=
parent
,
acpi_video_get_brightness
(
device
->
backlight
);
device
,
&
acpi_backlight_ops
,
&
props
);
kfree
(
name
);
if
(
IS_ERR
(
device
->
backlight
))
return
;
device
->
cooling_dev
=
thermal_cooling_device_register
(
"LCD"
,
/*
device
->
dev
,
&
video_cooling_ops
);
* Save current brightness level in case we have to restore it
if
(
IS_ERR
(
device
->
cooling_dev
))
{
* before acpi_video_device_lcd_set_level() is called next time.
/*
*/
* Set cooling_dev to NULL so we don't crash trying to
device
->
backlight
->
props
.
brightness
=
* free it.
acpi_video_get_brightness
(
device
->
backlight
);
* Also, why the hell we are returning early and
* not attempt to register video output if cooling
* device registration failed?
* -- dtor
*/
device
->
cooling_dev
=
NULL
;
return
;
}
dev_info
(
&
device
->
dev
->
dev
,
"registered as cooling_device%d
\n
"
,
device
->
cooling_dev
=
thermal_cooling_device_register
(
"LCD
"
,
device
->
cooling_dev
->
id
);
device
->
dev
,
&
video_cooling_ops
);
result
=
sysfs_create_link
(
&
device
->
dev
->
dev
.
kobj
,
if
(
IS_ERR
(
device
->
cooling_dev
))
{
&
device
->
cooling_dev
->
device
.
kobj
,
/*
"thermal_cooling"
);
* Set cooling_dev to NULL so we don't crash trying to free it.
if
(
result
)
* Also, why the hell we are returning early and not attempt to
printk
(
KERN_ERR
PREFIX
"Create sysfs link
\n
"
);
* register video output if cooling device registration failed?
result
=
sysfs_create_link
(
&
device
->
cooling_dev
->
device
.
kobj
,
* -- dtor
&
device
->
dev
->
dev
.
kobj
,
"device"
);
*/
if
(
result
)
device
->
cooling_dev
=
NULL
;
printk
(
KERN_ERR
PREFIX
"Create sysfs link
\n
"
)
;
return
;
}
}
dev_info
(
&
device
->
dev
->
dev
,
"registered as cooling_device%d
\n
"
,
device
->
cooling_dev
->
id
);
result
=
sysfs_create_link
(
&
device
->
dev
->
dev
.
kobj
,
&
device
->
cooling_dev
->
device
.
kobj
,
"thermal_cooling"
);
if
(
result
)
printk
(
KERN_ERR
PREFIX
"Create sysfs link
\n
"
);
result
=
sysfs_create_link
(
&
device
->
cooling_dev
->
device
.
kobj
,
&
device
->
dev
->
dev
.
kobj
,
"device"
);
if
(
result
)
printk
(
KERN_ERR
PREFIX
"Create sysfs link
\n
"
);
}
}
static
int
acpi_video_bus_register_backlight
(
struct
acpi_video_bus
*
video
)
static
int
acpi_video_bus_register_backlight
(
struct
acpi_video_bus
*
video
)
{
{
struct
acpi_video_device
*
dev
;
struct
acpi_video_device
*
dev
;
if
(
!
acpi_video_verify_backlight_support
())
return
0
;
mutex_lock
(
&
video
->
device_list_lock
);
mutex_lock
(
&
video
->
device_list_lock
);
list_for_each_entry
(
dev
,
&
video
->
video_device_list
,
entry
)
list_for_each_entry
(
dev
,
&
video
->
video_device_list
,
entry
)
acpi_video_dev_register_backlight
(
dev
);
acpi_video_dev_register_backlight
(
dev
);
mutex_unlock
(
&
video
->
device_list_lock
);
mutex_unlock
(
&
video
->
device_list_lock
);
video
->
backlight_registered
=
true
;
video
->
pm_nb
.
notifier_call
=
acpi_video_resume
;
video
->
pm_nb
.
notifier_call
=
acpi_video_resume
;
video
->
pm_nb
.
priority
=
0
;
video
->
pm_nb
.
priority
=
0
;
return
register_pm_notifier
(
&
video
->
pm_nb
);
return
register_pm_notifier
(
&
video
->
pm_nb
);
...
@@ -1767,13 +1769,20 @@ static void acpi_video_dev_unregister_backlight(struct acpi_video_device *device
...
@@ -1767,13 +1769,20 @@ static void acpi_video_dev_unregister_backlight(struct acpi_video_device *device
static
int
acpi_video_bus_unregister_backlight
(
struct
acpi_video_bus
*
video
)
static
int
acpi_video_bus_unregister_backlight
(
struct
acpi_video_bus
*
video
)
{
{
struct
acpi_video_device
*
dev
;
struct
acpi_video_device
*
dev
;
int
error
=
unregister_pm_notifier
(
&
video
->
pm_nb
);
int
error
;
if
(
!
video
->
backlight_registered
)
return
0
;
error
=
unregister_pm_notifier
(
&
video
->
pm_nb
);
mutex_lock
(
&
video
->
device_list_lock
);
mutex_lock
(
&
video
->
device_list_lock
);
list_for_each_entry
(
dev
,
&
video
->
video_device_list
,
entry
)
list_for_each_entry
(
dev
,
&
video
->
video_device_list
,
entry
)
acpi_video_dev_unregister_backlight
(
dev
);
acpi_video_dev_unregister_backlight
(
dev
);
mutex_unlock
(
&
video
->
device_list_lock
);
mutex_unlock
(
&
video
->
device_list_lock
);
video
->
backlight_registered
=
false
;
return
error
;
return
error
;
}
}
...
@@ -2061,6 +2070,20 @@ void acpi_video_unregister(void)
...
@@ -2061,6 +2070,20 @@ void acpi_video_unregister(void)
}
}
EXPORT_SYMBOL
(
acpi_video_unregister
);
EXPORT_SYMBOL
(
acpi_video_unregister
);
void
acpi_video_unregister_backlight
(
void
)
{
struct
acpi_video_bus
*
video
;
if
(
!
register_count
)
return
;
mutex_lock
(
&
video_list_lock
);
list_for_each_entry
(
video
,
&
video_bus_head
,
entry
)
acpi_video_bus_unregister_backlight
(
video
);
mutex_unlock
(
&
video_list_lock
);
}
EXPORT_SYMBOL
(
acpi_video_unregister_backlight
);
/*
/*
* This is kind of nasty. Hardware using Intel chipsets may require
* This is kind of nasty. Hardware using Intel chipsets may require
* the video opregion code to be run first in order to initialise
* the video opregion code to be run first in order to initialise
...
...
drivers/platform/x86/acer-wmi.c
浏览文件 @
2d8fe675
...
@@ -570,6 +570,14 @@ static const struct dmi_system_id video_vendor_dmi_table[] = {
...
@@ -570,6 +570,14 @@ static const struct dmi_system_id video_vendor_dmi_table[] = {
DMI_MATCH
(
DMI_PRODUCT_NAME
,
"Aspire 5750"
),
DMI_MATCH
(
DMI_PRODUCT_NAME
,
"Aspire 5750"
),
},
},
},
},
{
.
callback
=
video_set_backlight_video_vendor
,
.
ident
=
"Acer Aspire 5741"
,
.
matches
=
{
DMI_MATCH
(
DMI_BOARD_VENDOR
,
"Acer"
),
DMI_MATCH
(
DMI_PRODUCT_NAME
,
"Aspire 5741"
),
},
},
{}
{}
};
};
...
@@ -2228,7 +2236,7 @@ static int __init acer_wmi_init(void)
...
@@ -2228,7 +2236,7 @@ static int __init acer_wmi_init(void)
pr_info
(
"Brightness must be controlled by acpi video driver
\n
"
);
pr_info
(
"Brightness must be controlled by acpi video driver
\n
"
);
}
else
{
}
else
{
pr_info
(
"Disabling ACPI video driver
\n
"
);
pr_info
(
"Disabling ACPI video driver
\n
"
);
acpi_video_unregister
();
acpi_video_unregister
_backlight
();
}
}
if
(
wmi_has_guid
(
WMID_GUID3
))
{
if
(
wmi_has_guid
(
WMID_GUID3
))
{
...
...
include/acpi/video.h
浏览文件 @
2d8fe675
...
@@ -19,11 +19,13 @@ struct acpi_device;
...
@@ -19,11 +19,13 @@ struct acpi_device;
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
extern
int
acpi_video_register
(
void
);
extern
int
acpi_video_register
(
void
);
extern
void
acpi_video_unregister
(
void
);
extern
void
acpi_video_unregister
(
void
);
extern
void
acpi_video_unregister_backlight
(
void
);
extern
int
acpi_video_get_edid
(
struct
acpi_device
*
device
,
int
type
,
extern
int
acpi_video_get_edid
(
struct
acpi_device
*
device
,
int
type
,
int
device_id
,
void
**
edid
);
int
device_id
,
void
**
edid
);
#else
#else
static
inline
int
acpi_video_register
(
void
)
{
return
0
;
}
static
inline
int
acpi_video_register
(
void
)
{
return
0
;
}
static
inline
void
acpi_video_unregister
(
void
)
{
return
;
}
static
inline
void
acpi_video_unregister
(
void
)
{
return
;
}
static
inline
void
acpi_video_unregister_backlight
(
void
)
{
return
;
}
static
inline
int
acpi_video_get_edid
(
struct
acpi_device
*
device
,
int
type
,
static
inline
int
acpi_video_get_edid
(
struct
acpi_device
*
device
,
int
type
,
int
device_id
,
void
**
edid
)
int
device_id
,
void
**
edid
)
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录