[PATCH 2/7] drm: move DRM_SWITCH_POWER defines to drm_device.h

From: Sam Ravnborg
Date: Wed Dec 26 2018 - 08:21:01 EST


Move DRM_SWITCH_POWER out of drmP.h to allow users
to get rid of the drmP include.

DRM_SWITCH_POWER defines are used in combination
with drm_device.switch_power_state.

Move the DRM_SWITCH_POWER defines to the file where
drm_device.switch_power_state is defined.

Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Cc: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
Cc: Sean Paul <sean@xxxxxxxxxx>
Cc: David Airlie <airlied@xxxxxxxx>
Cc: Daniel Vetter <daniel@xxxxxxxx>
---
include/drm/drmP.h | 5 -----
include/drm/drm_device.h | 37 ++++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b6b8436b5123..2ba786820052 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -95,11 +95,6 @@ struct dma_buf_attachment;
struct pci_dev;
struct pci_controller;

-#define DRM_SWITCH_POWER_ON 0
-#define DRM_SWITCH_POWER_OFF 1
-#define DRM_SWITCH_POWER_CHANGING 2
-#define DRM_SWITCH_POWER_DYNAMIC_OFF 3
-
/* returns true if currently okay to sleep */
static inline bool drm_can_sleep(void)
{
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index cd385d3fc979..098bbc2b169e 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -24,6 +24,33 @@ struct inode;
struct pci_dev;
struct pci_controller;

+
+/**
+ * enum drm_switch_power - power state of drm device
+ */
+
+enum switch_power_state {
+ /**
+ * @DRM_SWITCH_POWER_ON: Power state is ON
+ */
+ DRM_SWITCH_POWER_ON = 0,
+
+ /**
+ * @DRM_SWITCH_POWER_OFF: Power state is OFF
+ */
+ DRM_SWITCH_POWER_OFF = 1,
+
+ /**
+ * @DRM_SWITCH_POWER_CHANGING: Power state is changing
+ */
+ DRM_SWITCH_POWER_CHANGING = 2,
+
+ /**
+ * @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended
+ */
+ DRM_SWITCH_POWER_DYNAMIC_OFF = 3,
+};
+
/**
* struct drm_device - DRM device structure
*
@@ -259,7 +286,15 @@ struct drm_device {
/** @vma_offset_manager: GEM information */
struct drm_vma_offset_manager *vma_offset_manager;

- int switch_power_state;
+ /**
+ * @switch_power_state:
+ *
+ * Power state of the client.
+ * Used by drivers supporting the switcheroo driver.
+ * The state is maintained in the
+ * &vga_switcheroo_client_ops.set_gpu_state callback
+ */
+ enum switch_power_state switch_power_state;

/**
* @fb_helper:
--
2.12.0