diff mbox series

[2/2] drm/i915/dislay: convert i9xx_display_sr.[ch] to struct intel_display

Message ID 20241126101222.2671224-2-jani.nikula@intel.com (mailing list archive)
State New
Headers show
Series [1/2] drm/i915/display: prefer DISPLAY_VER over GRAPHICS_VER in display s/r | expand

Commit Message

Jani Nikula Nov. 26, 2024, 10:12 a.m. UTC
Going forward, struct intel_display is the main device data structure
for display. Switch to it.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../gpu/drm/i915/display/i9xx_display_sr.c    | 76 +++++++++----------
 .../gpu/drm/i915/display/i9xx_display_sr.h    |  6 +-
 drivers/gpu/drm/i915/i915_driver.c            |  4 +-
 3 files changed, 41 insertions(+), 45 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/i9xx_display_sr.c b/drivers/gpu/drm/i915/display/i9xx_display_sr.c
index e0e8044f9bcb..f6b8333f6339 100644
--- a/drivers/gpu/drm/i915/display/i9xx_display_sr.c
+++ b/drivers/gpu/drm/i915/display/i9xx_display_sr.c
@@ -10,90 +10,86 @@ 
 #include "intel_gmbus.h"
 #include "intel_pci_config.h"
 
-static void i9xx_display_save_swf(struct drm_i915_private *i915)
+static void i9xx_display_save_swf(struct intel_display *display)
 {
-	struct intel_display *display = &i915->display;
 	int i;
 
 	/* Scratch space */
-	if (DISPLAY_VER(i915) == 2 && IS_MOBILE(i915)) {
+	if (DISPLAY_VER(display) == 2 && display->platform.mobile) {
 		for (i = 0; i < 7; i++) {
-			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));
-			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
+			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(display, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(display, i));
 		}
 		for (i = 0; i < 3; i++)
-			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));
-	} else if (DISPLAY_VER(i915) == 2) {
+			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(display, i));
+	} else if (DISPLAY_VER(display) == 2) {
 		for (i = 0; i < 7; i++)
-			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
-	} else if (HAS_GMCH(i915)) {
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(display, i));
+	} else if (HAS_GMCH(display)) {
 		for (i = 0; i < 16; i++) {
-			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(i915, i));
-			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(i915, i));
+			display->restore.saveSWF0[i] = intel_de_read(display, SWF0(display, i));
+			display->restore.saveSWF1[i] = intel_de_read(display, SWF1(display, i));
 		}
 		for (i = 0; i < 3; i++)
-			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(i915, i));
+			display->restore.saveSWF3[i] = intel_de_read(display, SWF3(display, i));
 	}
 }
 
-static void i9xx_display_restore_swf(struct drm_i915_private *i915)
+static void i9xx_display_restore_swf(struct intel_display *display)
 {
-	struct intel_display *display = &i915->display;
 	int i;
 
 	/* Scratch space */
-	if (DISPLAY_VER(i915) == 2 && IS_MOBILE(i915)) {
+	if (DISPLAY_VER(display) == 2 && display->platform.mobile) {
 		for (i = 0; i < 7; i++) {
-			intel_de_write(display, SWF0(i915, i), display->restore.saveSWF0[i]);
-			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
+			intel_de_write(display, SWF0(display, i), display->restore.saveSWF0[i]);
+			intel_de_write(display, SWF1(display, i), display->restore.saveSWF1[i]);
 		}
 		for (i = 0; i < 3; i++)
-			intel_de_write(display, SWF3(i915, i), display->restore.saveSWF3[i]);
-	} else if (DISPLAY_VER(i915) == 2) {
+			intel_de_write(display, SWF3(display, i), display->restore.saveSWF3[i]);
+	} else if (DISPLAY_VER(display) == 2) {
 		for (i = 0; i < 7; i++)
-			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
-	} else if (HAS_GMCH(i915)) {
+			intel_de_write(display, SWF1(display, i), display->restore.saveSWF1[i]);
+	} else if (HAS_GMCH(display)) {
 		for (i = 0; i < 16; i++) {
-			intel_de_write(display, SWF0(i915, i), display->restore.saveSWF0[i]);
-			intel_de_write(display, SWF1(i915, i), display->restore.saveSWF1[i]);
+			intel_de_write(display, SWF0(display, i), display->restore.saveSWF0[i]);
+			intel_de_write(display, SWF1(display, i), display->restore.saveSWF1[i]);
 		}
 		for (i = 0; i < 3; i++)
-			intel_de_write(display, SWF3(i915, i), display->restore.saveSWF3[i]);
+			intel_de_write(display, SWF3(display, i), display->restore.saveSWF3[i]);
 	}
 }
 
-void i9xx_display_sr_save(struct drm_i915_private *i915)
+void i9xx_display_sr_save(struct intel_display *display)
 {
-	struct intel_display *display = &i915->display;
-	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+	struct pci_dev *pdev = to_pci_dev(display->drm->dev);
 
-	if (!HAS_DISPLAY(i915))
+	if (!HAS_DISPLAY(display))
 		return;
 
 	/* Display arbitration control */
-	if (DISPLAY_VER(i915) <= 4)
-		display->restore.saveDSPARB = intel_de_read(display, DSPARB(i915));
+	if (DISPLAY_VER(display) <= 4)
+		display->restore.saveDSPARB = intel_de_read(display, DSPARB(display));
 
-	if (DISPLAY_VER(i915) == 4)
+	if (DISPLAY_VER(display) == 4)
 		pci_read_config_word(pdev, GCDGMBUS, &display->restore.saveGCDGMBUS);
 
-	i9xx_display_save_swf(i915);
+	i9xx_display_save_swf(display);
 }
 
-void i9xx_display_sr_restore(struct drm_i915_private *i915)
+void i9xx_display_sr_restore(struct intel_display *display)
 {
-	struct intel_display *display = &i915->display;
-	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
+	struct pci_dev *pdev = to_pci_dev(display->drm->dev);
 
-	if (!HAS_DISPLAY(i915))
+	if (!HAS_DISPLAY(display))
 		return;
 
-	i9xx_display_restore_swf(i915);
+	i9xx_display_restore_swf(display);
 
-	if (DISPLAY_VER(i915) == 4)
+	if (DISPLAY_VER(display) == 4)
 		pci_write_config_word(pdev, GCDGMBUS, display->restore.saveGCDGMBUS);
 
 	/* Display arbitration */
-	if (DISPLAY_VER(i915) <= 4)
-		intel_de_write(display, DSPARB(i915), display->restore.saveDSPARB);
+	if (DISPLAY_VER(display) <= 4)
+		intel_de_write(display, DSPARB(display), display->restore.saveDSPARB);
 }
diff --git a/drivers/gpu/drm/i915/display/i9xx_display_sr.h b/drivers/gpu/drm/i915/display/i9xx_display_sr.h
index 30383758f97e..39b8c18fe738 100644
--- a/drivers/gpu/drm/i915/display/i9xx_display_sr.h
+++ b/drivers/gpu/drm/i915/display/i9xx_display_sr.h
@@ -6,9 +6,9 @@ 
 #ifndef __I9XX_DISPLAY_SR_H__
 #define __I9XX_DISPLAY_SR_H__
 
-struct drm_i915_private;
+struct intel_display;
 
-void i9xx_display_sr_save(struct drm_i915_private *i915);
-void i9xx_display_sr_restore(struct drm_i915_private *i915);
+void i9xx_display_sr_save(struct intel_display *display);
+void i9xx_display_sr_restore(struct intel_display *display);
 
 #endif
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 2013962e446c..ff99d45bdfda 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1052,7 +1052,7 @@  static int i915_drm_suspend(struct drm_device *dev)
 	intel_dpt_suspend(dev_priv);
 	i915_ggtt_suspend(to_gt(dev_priv)->ggtt);
 
-	i9xx_display_sr_save(dev_priv);
+	i9xx_display_sr_save(display);
 
 	opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
 	intel_opregion_suspend(display, opregion_target_state);
@@ -1169,7 +1169,7 @@  static int i915_drm_resume(struct drm_device *dev)
 
 	intel_dmc_resume(display);
 
-	i9xx_display_sr_restore(dev_priv);
+	i9xx_display_sr_restore(display);
 
 	intel_vga_redisable(display);