Skip to content

Commit 7af78f4

Browse files
sravnborgdanvet
authored andcommitted
drm: move DRM_SWITCH_POWER defines to drm_device.h
Move DRM_SWITCH_POWER out of drmP.h to allow users to get rid of the drmP include. Moved to drm_device.h because drm_device.switch_power_state is the only user. Converted to enum and added sparse kerneldoc comments. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Sean Paul <sean@poorly.run> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20190108192939.15255-3-sam@ravnborg.org
1 parent ac4f24c commit 7af78f4

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

‎include/drm/drmP.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ struct dma_buf_attachment;
9494
struct pci_dev;
9595
struct pci_controller;
9696

97-
#define DRM_SWITCH_POWER_ON 0
98-
#define DRM_SWITCH_POWER_OFF 1
99-
#define DRM_SWITCH_POWER_CHANGING 2
100-
#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
101-
10297
/* returns true if currently okay to sleep */
10398
static inline bool drm_can_sleep(void)
10499
{

‎include/drm/drm_device.h‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ struct inode;
2424
struct pci_dev;
2525
struct pci_controller;
2626

27+
28+
/**
29+
* enum drm_switch_power - power state of drm device
30+
*/
31+
32+
enum switch_power_state {
33+
/** @DRM_SWITCH_POWER_ON: Power state is ON */
34+
DRM_SWITCH_POWER_ON = 0,
35+
36+
/** @DRM_SWITCH_POWER_OFF: Power state is OFF */
37+
DRM_SWITCH_POWER_OFF = 1,
38+
39+
/** @DRM_SWITCH_POWER_CHANGING: Power state is changing */
40+
DRM_SWITCH_POWER_CHANGING = 2,
41+
42+
/** @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended */
43+
DRM_SWITCH_POWER_DYNAMIC_OFF = 3,
44+
};
45+
2746
/**
2847
* struct drm_device - DRM device structure
2948
*
@@ -291,7 +310,15 @@ struct drm_device {
291310
/** @vma_offset_manager: GEM information */
292311
struct drm_vma_offset_manager *vma_offset_manager;
293312

294-
int switch_power_state;
313+
/**
314+
* @switch_power_state:
315+
*
316+
* Power state of the client.
317+
* Used by drivers supporting the switcheroo driver.
318+
* The state is maintained in the
319+
* &vga_switcheroo_client_ops.set_gpu_state callback
320+
*/
321+
enum switch_power_state switch_power_state;
295322

296323
/**
297324
* @fb_helper:

0 commit comments

Comments
 (0)