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
321f5c5f
Commit
321f5c5f
authored
Jun 02, 2017
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau: replace multiple open-coded runpm support checks with function
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
86276921
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
32 deletions
+18
-32
drivers/gpu/drm/nouveau/nouveau_drm.c
drivers/gpu/drm/nouveau/nouveau_drm.c
+15
-19
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_drv.h
+1
-2
drivers/gpu/drm/nouveau/nouveau_vga.c
drivers/gpu/drm/nouveau/nouveau_vga.c
+2
-11
No files found.
drivers/gpu/drm/nouveau/nouveau_drm.c
View file @
321f5c5f
...
...
@@ -80,7 +80,7 @@ int nouveau_modeset = -1;
module_param_named
(
modeset
,
nouveau_modeset
,
int
,
0400
);
MODULE_PARM_DESC
(
runpm
,
"disable (0), force enable (1), optimus only default (-1)"
);
int
nouveau_runtime_pm
=
-
1
;
static
int
nouveau_runtime_pm
=
-
1
;
module_param_named
(
runpm
,
nouveau_runtime_pm
,
int
,
0400
);
static
struct
drm_driver
driver_stub
;
...
...
@@ -726,6 +726,14 @@ nouveau_pmops_thaw(struct device *dev)
return
nouveau_do_resume
(
drm_dev
,
false
);
}
bool
nouveau_pmops_runtime
()
{
if
(
nouveau_runtime_pm
==
-
1
)
return
nouveau_is_optimus
()
||
nouveau_is_v1_dsm
();
return
nouveau_runtime_pm
==
1
;
}
static
int
nouveau_pmops_runtime_suspend
(
struct
device
*
dev
)
{
...
...
@@ -733,14 +741,7 @@ nouveau_pmops_runtime_suspend(struct device *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
"
);
if
(
!
nouveau_pmops_runtime
())
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
...
...
@@ -765,8 +766,10 @@ nouveau_pmops_runtime_resume(struct device *dev)
struct
nvif_device
*
device
=
&
nouveau_drm
(
drm_dev
)
->
client
.
device
;
int
ret
;
if
(
nouveau_runtime_pm
==
0
)
return
-
EINVAL
;
if
(
!
nouveau_pmops_runtime
())
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
pci_set_power_state
(
pdev
,
PCI_D0
);
pci_restore_state
(
pdev
);
...
...
@@ -796,14 +799,7 @@ nouveau_pmops_runtime_idle(struct device *dev)
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
"
);
if
(
!
nouveau_pmops_runtime
())
{
pm_runtime_forbid
(
dev
);
return
-
EBUSY
;
}
...
...
drivers/gpu/drm/nouveau/nouveau_drv.h
View file @
321f5c5f
...
...
@@ -108,8 +108,6 @@ nouveau_cli(struct drm_file *fpriv)
#include <nvif/object.h>
#include <nvif/device.h>
extern
int
nouveau_runtime_pm
;
struct
nouveau_drm
{
struct
nouveau_cli
client
;
struct
drm_device
*
dev
;
...
...
@@ -195,6 +193,7 @@ nouveau_drm(struct drm_device *dev)
int
nouveau_pmops_suspend
(
struct
device
*
);
int
nouveau_pmops_resume
(
struct
device
*
);
bool
nouveau_pmops_runtime
(
void
);
#include <nvkm/core/tegra.h>
...
...
drivers/gpu/drm/nouveau/nouveau_vga.c
View file @
321f5c5f
...
...
@@ -87,7 +87,7 @@ void
nouveau_vga_init
(
struct
nouveau_drm
*
drm
)
{
struct
drm_device
*
dev
=
drm
->
dev
;
bool
runtime
=
false
;
bool
runtime
=
nouveau_pmops_runtime
()
;
/* only relevant for PCI devices */
if
(
!
dev
->
pdev
)
...
...
@@ -99,10 +99,6 @@ nouveau_vga_init(struct nouveau_drm *drm)
if
(
pci_is_thunderbolt_attached
(
dev
->
pdev
))
return
;
if
(
nouveau_runtime_pm
==
1
)
runtime
=
true
;
if
((
nouveau_runtime_pm
==
-
1
)
&&
(
nouveau_is_optimus
()
||
nouveau_is_v1_dsm
()))
runtime
=
true
;
vga_switcheroo_register_client
(
dev
->
pdev
,
&
nouveau_switcheroo_ops
,
runtime
);
if
(
runtime
&&
nouveau_is_v1_dsm
()
&&
!
nouveau_is_optimus
())
...
...
@@ -113,18 +109,13 @@ void
nouveau_vga_fini
(
struct
nouveau_drm
*
drm
)
{
struct
drm_device
*
dev
=
drm
->
dev
;
bool
runtime
=
false
;
bool
runtime
=
nouveau_pmops_runtime
()
;
vga_client_register
(
dev
->
pdev
,
NULL
,
NULL
,
NULL
);
if
(
pci_is_thunderbolt_attached
(
dev
->
pdev
))
return
;
if
(
nouveau_runtime_pm
==
1
)
runtime
=
true
;
if
((
nouveau_runtime_pm
==
-
1
)
&&
(
nouveau_is_optimus
()
||
nouveau_is_v1_dsm
()))
runtime
=
true
;
vga_switcheroo_unregister_client
(
dev
->
pdev
);
if
(
runtime
&&
nouveau_is_v1_dsm
()
&&
!
nouveau_is_optimus
())
vga_switcheroo_fini_domain_pm_ops
(
drm
->
dev
->
dev
);
...
...
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