Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
7bb6d442
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看板
提交
7bb6d442
编写于
10月 02, 2014
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau: move the (far too many...) different s/r paths to the same place
No code changes. Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
70b2cc8e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
144 addition
and
138 deletion
+144
-138
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_drm.c
+127
-121
drivers/gpu/drm/nouveau/nouveau_fbcon.c
drivers/gpu/drm/nouveau/nouveau_fbcon.c
+17
-17
未找到文件。
drivers/gpu/drm/nouveau/nouveau_drm.c
浏览文件 @
7bb6d442
...
...
@@ -613,27 +613,6 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
return
ret
;
}
int
nouveau_pmops_suspend
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
int
ret
;
if
(
drm_dev
->
switch_power_state
==
DRM_SWITCH_POWER_OFF
||
drm_dev
->
switch_power_state
==
DRM_SWITCH_POWER_DYNAMIC_OFF
)
return
0
;
ret
=
nouveau_do_suspend
(
drm_dev
,
false
);
if
(
ret
)
return
ret
;
pci_save_state
(
pdev
);
pci_disable_device
(
pdev
);
pci_ignore_hotplug
(
pdev
);
pci_set_power_state
(
pdev
,
PCI_D3hot
);
return
0
;
}
static
int
nouveau_do_resume
(
struct
drm_device
*
dev
,
bool
runtime
)
{
...
...
@@ -668,7 +647,30 @@ nouveau_do_resume(struct drm_device *dev, bool runtime)
return
0
;
}
int
nouveau_pmops_resume
(
struct
device
*
dev
)
int
nouveau_pmops_suspend
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
int
ret
;
if
(
drm_dev
->
switch_power_state
==
DRM_SWITCH_POWER_OFF
||
drm_dev
->
switch_power_state
==
DRM_SWITCH_POWER_DYNAMIC_OFF
)
return
0
;
ret
=
nouveau_do_suspend
(
drm_dev
,
false
);
if
(
ret
)
return
ret
;
pci_save_state
(
pdev
);
pci_disable_device
(
pdev
);
pci_ignore_hotplug
(
pdev
);
pci_set_power_state
(
pdev
,
PCI_D3hot
);
return
0
;
}
int
nouveau_pmops_resume
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
...
...
@@ -688,20 +690,121 @@ int nouveau_pmops_resume(struct device *dev)
return
nouveau_do_resume
(
drm_dev
,
false
);
}
static
int
nouveau_pmops_freeze
(
struct
device
*
dev
)
static
int
nouveau_pmops_freeze
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
return
nouveau_do_suspend
(
drm_dev
,
false
);
}
static
int
nouveau_pmops_thaw
(
struct
device
*
dev
)
static
int
nouveau_pmops_thaw
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
return
nouveau_do_resume
(
drm_dev
,
false
);
}
static
int
nouveau_pmops_runtime_suspend
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
int
ret
;
if
(
nouveau_runtime_pm
==
0
)
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
/* are we optimus enabled? */
if
(
nouveau_runtime_pm
==
-
1
&&
!
nouveau_is_optimus
()
&&
!
nouveau_is_v1_dsm
())
{
DRM_DEBUG_DRIVER
(
"failing to power off - not optimus
\n
"
);
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
nv_debug_level
(
SILENT
);
drm_kms_helper_poll_disable
(
drm_dev
);
vga_switcheroo_set_dynamic_switch
(
pdev
,
VGA_SWITCHEROO_OFF
);
nouveau_switcheroo_optimus_dsm
();
ret
=
nouveau_do_suspend
(
drm_dev
,
true
);
pci_save_state
(
pdev
);
pci_disable_device
(
pdev
);
pci_set_power_state
(
pdev
,
PCI_D3cold
);
drm_dev
->
switch_power_state
=
DRM_SWITCH_POWER_DYNAMIC_OFF
;
return
ret
;
}
static
int
nouveau_pmops_runtime_resume
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
struct
nvif_device
*
device
=
&
nouveau_drm
(
drm_dev
)
->
device
;
int
ret
;
if
(
nouveau_runtime_pm
==
0
)
return
-
EINVAL
;
pci_set_power_state
(
pdev
,
PCI_D0
);
pci_restore_state
(
pdev
);
ret
=
pci_enable_device
(
pdev
);
if
(
ret
)
return
ret
;
pci_set_master
(
pdev
);
ret
=
nouveau_do_resume
(
drm_dev
,
true
);
drm_kms_helper_poll_enable
(
drm_dev
);
/* do magic */
nvif_mask
(
device
,
0x88488
,
(
1
<<
25
),
(
1
<<
25
));
vga_switcheroo_set_dynamic_switch
(
pdev
,
VGA_SWITCHEROO_ON
);
drm_dev
->
switch_power_state
=
DRM_SWITCH_POWER_ON
;
nv_debug_level
(
NORMAL
);
return
ret
;
}
static
int
nouveau_pmops_runtime_idle
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
struct
nouveau_drm
*
drm
=
nouveau_drm
(
drm_dev
);
struct
drm_crtc
*
crtc
;
if
(
nouveau_runtime_pm
==
0
)
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
/* are we optimus enabled? */
if
(
nouveau_runtime_pm
==
-
1
&&
!
nouveau_is_optimus
()
&&
!
nouveau_is_v1_dsm
())
{
DRM_DEBUG_DRIVER
(
"failing to power off - not optimus
\n
"
);
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
/* if we have a hdmi audio device - make sure it has a driver loaded */
if
(
drm
->
hdmi_device
)
{
if
(
!
drm
->
hdmi_device
->
driver
)
{
DRM_DEBUG_DRIVER
(
"failing to power off - no HDMI audio driver loaded
\n
"
);
pm_runtime_mark_last_busy
(
dev
);
return
-
EBUSY
;
}
}
list_for_each_entry
(
crtc
,
&
drm
->
dev
->
mode_config
.
crtc_list
,
head
)
{
if
(
crtc
->
enabled
)
{
DRM_DEBUG_DRIVER
(
"failing to power off - crtc active
\n
"
);
return
-
EBUSY
;
}
}
pm_runtime_mark_last_busy
(
dev
);
pm_runtime_autosuspend
(
dev
);
/* we don't want the main rpm_idle to call suspend - we want to autosuspend */
return
1
;
}
static
int
nouveau_drm_open
(
struct
drm_device
*
dev
,
struct
drm_file
*
fpriv
)
...
...
@@ -908,103 +1011,6 @@ nouveau_drm_pci_table[] = {
{}
};
static
int
nouveau_pmops_runtime_suspend
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
int
ret
;
if
(
nouveau_runtime_pm
==
0
)
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
/* are we optimus enabled? */
if
(
nouveau_runtime_pm
==
-
1
&&
!
nouveau_is_optimus
()
&&
!
nouveau_is_v1_dsm
())
{
DRM_DEBUG_DRIVER
(
"failing to power off - not optimus
\n
"
);
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
nv_debug_level
(
SILENT
);
drm_kms_helper_poll_disable
(
drm_dev
);
vga_switcheroo_set_dynamic_switch
(
pdev
,
VGA_SWITCHEROO_OFF
);
nouveau_switcheroo_optimus_dsm
();
ret
=
nouveau_do_suspend
(
drm_dev
,
true
);
pci_save_state
(
pdev
);
pci_disable_device
(
pdev
);
pci_set_power_state
(
pdev
,
PCI_D3cold
);
drm_dev
->
switch_power_state
=
DRM_SWITCH_POWER_DYNAMIC_OFF
;
return
ret
;
}
static
int
nouveau_pmops_runtime_resume
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
struct
nvif_device
*
device
=
&
nouveau_drm
(
drm_dev
)
->
device
;
int
ret
;
if
(
nouveau_runtime_pm
==
0
)
return
-
EINVAL
;
pci_set_power_state
(
pdev
,
PCI_D0
);
pci_restore_state
(
pdev
);
ret
=
pci_enable_device
(
pdev
);
if
(
ret
)
return
ret
;
pci_set_master
(
pdev
);
ret
=
nouveau_do_resume
(
drm_dev
,
true
);
drm_kms_helper_poll_enable
(
drm_dev
);
/* do magic */
nvif_mask
(
device
,
0x88488
,
(
1
<<
25
),
(
1
<<
25
));
vga_switcheroo_set_dynamic_switch
(
pdev
,
VGA_SWITCHEROO_ON
);
drm_dev
->
switch_power_state
=
DRM_SWITCH_POWER_ON
;
nv_debug_level
(
NORMAL
);
return
ret
;
}
static
int
nouveau_pmops_runtime_idle
(
struct
device
*
dev
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
dev
);
struct
drm_device
*
drm_dev
=
pci_get_drvdata
(
pdev
);
struct
nouveau_drm
*
drm
=
nouveau_drm
(
drm_dev
);
struct
drm_crtc
*
crtc
;
if
(
nouveau_runtime_pm
==
0
)
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
/* are we optimus enabled? */
if
(
nouveau_runtime_pm
==
-
1
&&
!
nouveau_is_optimus
()
&&
!
nouveau_is_v1_dsm
())
{
DRM_DEBUG_DRIVER
(
"failing to power off - not optimus
\n
"
);
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
/* if we have a hdmi audio device - make sure it has a driver loaded */
if
(
drm
->
hdmi_device
)
{
if
(
!
drm
->
hdmi_device
->
driver
)
{
DRM_DEBUG_DRIVER
(
"failing to power off - no HDMI audio driver loaded
\n
"
);
pm_runtime_mark_last_busy
(
dev
);
return
-
EBUSY
;
}
}
list_for_each_entry
(
crtc
,
&
drm
->
dev
->
mode_config
.
crtc_list
,
head
)
{
if
(
crtc
->
enabled
)
{
DRM_DEBUG_DRIVER
(
"failing to power off - crtc active
\n
"
);
return
-
EBUSY
;
}
}
pm_runtime_mark_last_busy
(
dev
);
pm_runtime_autosuspend
(
dev
);
/* we don't want the main rpm_idle to call suspend - we want to autosuspend */
return
1
;
}
static
void
nouveau_display_options
(
void
)
{
DRM_DEBUG_DRIVER
(
"Loading Nouveau with parameters:
\n
"
);
...
...
drivers/gpu/drm/nouveau/nouveau_fbcon.c
浏览文件 @
7bb6d442
...
...
@@ -498,6 +498,23 @@ nouveau_fbcon_set_suspend_work(struct work_struct *work)
console_unlock
();
}
void
nouveau_fbcon_set_suspend
(
struct
drm_device
*
dev
,
int
state
)
{
struct
nouveau_drm
*
drm
=
nouveau_drm
(
dev
);
if
(
drm
->
fbcon
)
{
if
(
state
==
FBINFO_STATE_RUNNING
)
{
schedule_work
(
&
drm
->
fbcon
->
work
);
return
;
}
flush_work
(
&
drm
->
fbcon
->
work
);
console_lock
();
fb_set_suspend
(
drm
->
fbcon
->
helper
.
fbdev
,
state
);
nouveau_fbcon_accel_save_disable
(
dev
);
console_unlock
();
}
}
int
nouveau_fbcon_init
(
struct
drm_device
*
dev
)
{
...
...
@@ -557,20 +574,3 @@ nouveau_fbcon_fini(struct drm_device *dev)
kfree
(
drm
->
fbcon
);
drm
->
fbcon
=
NULL
;
}
void
nouveau_fbcon_set_suspend
(
struct
drm_device
*
dev
,
int
state
)
{
struct
nouveau_drm
*
drm
=
nouveau_drm
(
dev
);
if
(
drm
->
fbcon
)
{
if
(
state
==
FBINFO_STATE_RUNNING
)
{
schedule_work
(
&
drm
->
fbcon
->
work
);
return
;
}
flush_work
(
&
drm
->
fbcon
->
work
);
console_lock
();
fb_set_suspend
(
drm
->
fbcon
->
helper
.
fbdev
,
state
);
nouveau_fbcon_accel_save_disable
(
dev
);
console_unlock
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录