Commit 769b081c authored by Jani Nikula's avatar Jani Nikula

drm/i915/opregion: convert to struct intel_display

Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_opregion.[ch] to struct intel_display.

v2:
- Fix declarations for !CONFIG_ACPI (Imre, kernel test robot)
- Pass encoder/connector directly to intel_display() (Imre)
Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/aef94503909bbbf95f0244dc382a4d4cd050b903.1723213547.git.jani.nikula@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent b7f317e6
...@@ -622,7 +622,9 @@ static int opregion_get_panel_type(struct drm_i915_private *i915, ...@@ -622,7 +622,9 @@ static int opregion_get_panel_type(struct drm_i915_private *i915,
const struct intel_bios_encoder_data *devdata, const struct intel_bios_encoder_data *devdata,
const struct drm_edid *drm_edid, bool use_fallback) const struct drm_edid *drm_edid, bool use_fallback)
{ {
return intel_opregion_get_panel_type(i915); struct intel_display *display = &i915->display;
return intel_opregion_get_panel_type(display);
} }
static int vbt_get_panel_type(struct drm_i915_private *i915, static int vbt_get_panel_type(struct drm_i915_private *i915,
...@@ -3158,13 +3160,14 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *i915, ...@@ -3158,13 +3160,14 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *i915,
static const struct vbt_header *intel_bios_get_vbt(struct drm_i915_private *i915, static const struct vbt_header *intel_bios_get_vbt(struct drm_i915_private *i915,
size_t *sizep) size_t *sizep)
{ {
struct intel_display *display = &i915->display;
const struct vbt_header *vbt = NULL; const struct vbt_header *vbt = NULL;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
vbt = firmware_get_vbt(i915, sizep); vbt = firmware_get_vbt(i915, sizep);
if (!vbt) if (!vbt)
vbt = intel_opregion_get_vbt(i915, sizep); vbt = intel_opregion_get_vbt(display, sizep);
/* /*
* If the OpRegion does not have VBT, look in SPI flash * If the OpRegion does not have VBT, look in SPI flash
...@@ -3378,6 +3381,7 @@ bool intel_bios_is_tv_present(struct drm_i915_private *i915) ...@@ -3378,6 +3381,7 @@ bool intel_bios_is_tv_present(struct drm_i915_private *i915)
*/ */
bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin) bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin)
{ {
struct intel_display *display = &i915->display;
const struct intel_bios_encoder_data *devdata; const struct intel_bios_encoder_data *devdata;
if (list_empty(&i915->display.vbt.display_devices)) if (list_empty(&i915->display.vbt.display_devices))
...@@ -3410,7 +3414,7 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin) ...@@ -3410,7 +3414,7 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin)
* additional data. Trust that if the VBT was written into * additional data. Trust that if the VBT was written into
* the OpRegion then they have validated the LVDS's existence. * the OpRegion then they have validated the LVDS's existence.
*/ */
return intel_opregion_vbt_present(i915); return intel_opregion_vbt_present(display);
} }
return false; return false;
......
...@@ -1049,6 +1049,7 @@ static const struct { ...@@ -1049,6 +1049,7 @@ static const struct {
void intel_display_debugfs_register(struct drm_i915_private *i915) void intel_display_debugfs_register(struct drm_i915_private *i915)
{ {
struct intel_display *display = &i915->display;
struct drm_minor *minor = i915->drm.primary; struct drm_minor *minor = i915->drm.primary;
int i; int i;
...@@ -1067,9 +1068,9 @@ void intel_display_debugfs_register(struct drm_i915_private *i915) ...@@ -1067,9 +1068,9 @@ void intel_display_debugfs_register(struct drm_i915_private *i915)
intel_bios_debugfs_register(i915); intel_bios_debugfs_register(i915);
intel_cdclk_debugfs_register(i915); intel_cdclk_debugfs_register(i915);
intel_dmc_debugfs_register(i915); intel_dmc_debugfs_register(i915);
intel_fbc_debugfs_register(&i915->display); intel_fbc_debugfs_register(display);
intel_hpd_debugfs_register(i915); intel_hpd_debugfs_register(i915);
intel_opregion_debugfs_register(i915); intel_opregion_debugfs_register(display);
intel_psr_debugfs_register(i915); intel_psr_debugfs_register(i915);
intel_wm_debugfs_register(i915); intel_wm_debugfs_register(i915);
intel_display_debugfs_params(i915); intel_display_debugfs_params(i915);
......
...@@ -1529,9 +1529,11 @@ void intel_display_device_info_print(const struct intel_display_device_info *inf ...@@ -1529,9 +1529,11 @@ void intel_display_device_info_print(const struct intel_display_device_info *inf
*/ */
bool intel_display_device_enabled(struct drm_i915_private *i915) bool intel_display_device_enabled(struct drm_i915_private *i915)
{ {
struct intel_display *display = &i915->display;
/* Only valid when HAS_DISPLAY() is true */ /* Only valid when HAS_DISPLAY() is true */
drm_WARN_ON(&i915->drm, !HAS_DISPLAY(i915)); drm_WARN_ON(display->drm, !HAS_DISPLAY(display));
return !i915->display.params.disable_display && return !display->params.disable_display &&
!intel_opregion_headless_sku(i915); !intel_opregion_headless_sku(display);
} }
...@@ -535,7 +535,7 @@ void intel_display_driver_register(struct drm_i915_private *i915) ...@@ -535,7 +535,7 @@ void intel_display_driver_register(struct drm_i915_private *i915)
return; return;
/* Must be done after probing outputs */ /* Must be done after probing outputs */
intel_opregion_register(i915); intel_opregion_register(display);
intel_acpi_video_register(display); intel_acpi_video_register(display);
intel_audio_init(i915); intel_audio_init(i915);
...@@ -626,6 +626,8 @@ void intel_display_driver_remove_nogem(struct drm_i915_private *i915) ...@@ -626,6 +626,8 @@ void intel_display_driver_remove_nogem(struct drm_i915_private *i915)
void intel_display_driver_unregister(struct drm_i915_private *i915) void intel_display_driver_unregister(struct drm_i915_private *i915)
{ {
struct intel_display *display = &i915->display;
if (!HAS_DISPLAY(i915)) if (!HAS_DISPLAY(i915))
return; return;
...@@ -645,7 +647,7 @@ void intel_display_driver_unregister(struct drm_i915_private *i915) ...@@ -645,7 +647,7 @@ void intel_display_driver_unregister(struct drm_i915_private *i915)
drm_atomic_helper_shutdown(&i915->drm); drm_atomic_helper_shutdown(&i915->drm);
acpi_video_unregister(); acpi_video_unregister();
intel_opregion_unregister(i915); intel_opregion_unregister(display);
} }
/* /*
......
...@@ -270,10 +270,12 @@ void i915_disable_pipestat(struct drm_i915_private *dev_priv, ...@@ -270,10 +270,12 @@ void i915_disable_pipestat(struct drm_i915_private *dev_priv,
static bool i915_has_asle(struct drm_i915_private *i915) static bool i915_has_asle(struct drm_i915_private *i915)
{ {
struct intel_display *display = &i915->display;
if (!IS_PINEVIEW(i915) && !IS_MOBILE(i915)) if (!IS_PINEVIEW(i915) && !IS_MOBILE(i915))
return false; return false;
return intel_opregion_asle_present(i915); return intel_opregion_asle_present(display);
} }
/** /**
...@@ -497,6 +499,8 @@ void i8xx_pipestat_irq_handler(struct drm_i915_private *dev_priv, ...@@ -497,6 +499,8 @@ void i8xx_pipestat_irq_handler(struct drm_i915_private *dev_priv,
void i915_pipestat_irq_handler(struct drm_i915_private *dev_priv, void i915_pipestat_irq_handler(struct drm_i915_private *dev_priv,
u32 iir, u32 pipe_stats[I915_MAX_PIPES]) u32 iir, u32 pipe_stats[I915_MAX_PIPES])
{ {
struct intel_display *display = &dev_priv->display;
bool blc_event = false; bool blc_event = false;
enum pipe pipe; enum pipe pipe;
...@@ -515,12 +519,13 @@ void i915_pipestat_irq_handler(struct drm_i915_private *dev_priv, ...@@ -515,12 +519,13 @@ void i915_pipestat_irq_handler(struct drm_i915_private *dev_priv,
} }
if (blc_event || (iir & I915_ASLE_INTERRUPT)) if (blc_event || (iir & I915_ASLE_INTERRUPT))
intel_opregion_asle_intr(dev_priv); intel_opregion_asle_intr(display);
} }
void i965_pipestat_irq_handler(struct drm_i915_private *dev_priv, void i965_pipestat_irq_handler(struct drm_i915_private *dev_priv,
u32 iir, u32 pipe_stats[I915_MAX_PIPES]) u32 iir, u32 pipe_stats[I915_MAX_PIPES])
{ {
struct intel_display *display = &dev_priv->display;
bool blc_event = false; bool blc_event = false;
enum pipe pipe; enum pipe pipe;
...@@ -539,7 +544,7 @@ void i965_pipestat_irq_handler(struct drm_i915_private *dev_priv, ...@@ -539,7 +544,7 @@ void i965_pipestat_irq_handler(struct drm_i915_private *dev_priv,
} }
if (blc_event || (iir & I915_ASLE_INTERRUPT)) if (blc_event || (iir & I915_ASLE_INTERRUPT))
intel_opregion_asle_intr(dev_priv); intel_opregion_asle_intr(display);
if (pipe_stats[0] & PIPE_GMBUS_INTERRUPT_STATUS) if (pipe_stats[0] & PIPE_GMBUS_INTERRUPT_STATUS)
intel_gmbus_irq_handler(dev_priv); intel_gmbus_irq_handler(dev_priv);
...@@ -695,6 +700,7 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir) ...@@ -695,6 +700,7 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
{ {
struct intel_display *display = &dev_priv->display;
enum pipe pipe; enum pipe pipe;
u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG; u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG;
...@@ -705,7 +711,7 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) ...@@ -705,7 +711,7 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(dev_priv);
if (de_iir & DE_GSE) if (de_iir & DE_GSE)
intel_opregion_asle_intr(dev_priv); intel_opregion_asle_intr(display);
if (de_iir & DE_POISON) if (de_iir & DE_POISON)
drm_err(&dev_priv->drm, "Poison interrupt\n"); drm_err(&dev_priv->drm, "Poison interrupt\n");
...@@ -743,6 +749,7 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) ...@@ -743,6 +749,7 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
void ivb_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) void ivb_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
{ {
struct intel_display *display = &dev_priv->display;
enum pipe pipe; enum pipe pipe;
u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG_IVB; u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG_IVB;
...@@ -770,7 +777,7 @@ void ivb_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir) ...@@ -770,7 +777,7 @@ void ivb_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
intel_dp_aux_irq_handler(dev_priv); intel_dp_aux_irq_handler(dev_priv);
if (de_iir & DE_GSE_IVB) if (de_iir & DE_GSE_IVB)
intel_opregion_asle_intr(dev_priv); intel_opregion_asle_intr(display);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (de_iir & DE_PIPE_VBLANK_IVB(pipe)) if (de_iir & DE_PIPE_VBLANK_IVB(pipe))
...@@ -894,6 +901,7 @@ static void intel_pmdemand_irq_handler(struct drm_i915_private *dev_priv) ...@@ -894,6 +901,7 @@ static void intel_pmdemand_irq_handler(struct drm_i915_private *dev_priv)
static void static void
gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir) gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
{ {
struct intel_display *display = &dev_priv->display;
bool found = false; bool found = false;
if (DISPLAY_VER(dev_priv) >= 14) { if (DISPLAY_VER(dev_priv) >= 14) {
...@@ -914,7 +922,7 @@ gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir) ...@@ -914,7 +922,7 @@ gen8_de_misc_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
found = true; found = true;
} }
} else if (iir & GEN8_DE_MISC_GSE) { } else if (iir & GEN8_DE_MISC_GSE) {
intel_opregion_asle_intr(dev_priv); intel_opregion_asle_intr(display);
found = true; found = true;
} }
...@@ -1218,8 +1226,10 @@ u32 gen11_gu_misc_irq_ack(struct drm_i915_private *i915, const u32 master_ctl) ...@@ -1218,8 +1226,10 @@ u32 gen11_gu_misc_irq_ack(struct drm_i915_private *i915, const u32 master_ctl)
void gen11_gu_misc_irq_handler(struct drm_i915_private *i915, const u32 iir) void gen11_gu_misc_irq_handler(struct drm_i915_private *i915, const u32 iir)
{ {
struct intel_display *display = &i915->display;
if (iir & GEN11_GU_MISC_GSE) if (iir & GEN11_GU_MISC_GSE)
intel_opregion_asle_intr(i915); intel_opregion_asle_intr(display);
} }
void gen11_display_irq_handler(struct drm_i915_private *i915) void gen11_display_irq_handler(struct drm_i915_private *i915)
......
...@@ -28,72 +28,72 @@ ...@@ -28,72 +28,72 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/types.h> #include <linux/types.h>
struct drm_i915_private;
struct intel_connector; struct intel_connector;
struct intel_display;
struct intel_encoder; struct intel_encoder;
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
int intel_opregion_setup(struct drm_i915_private *dev_priv); int intel_opregion_setup(struct intel_display *display);
void intel_opregion_cleanup(struct drm_i915_private *i915); void intel_opregion_cleanup(struct intel_display *display);
void intel_opregion_register(struct drm_i915_private *dev_priv); void intel_opregion_register(struct intel_display *display);
void intel_opregion_unregister(struct drm_i915_private *dev_priv); void intel_opregion_unregister(struct intel_display *display);
void intel_opregion_resume(struct drm_i915_private *dev_priv); void intel_opregion_resume(struct intel_display *display);
void intel_opregion_suspend(struct drm_i915_private *dev_priv, void intel_opregion_suspend(struct intel_display *display,
pci_power_t state); pci_power_t state);
bool intel_opregion_asle_present(struct drm_i915_private *i915); bool intel_opregion_asle_present(struct intel_display *display);
void intel_opregion_asle_intr(struct drm_i915_private *dev_priv); void intel_opregion_asle_intr(struct intel_display *display);
int intel_opregion_notify_encoder(struct intel_encoder *encoder, int intel_opregion_notify_encoder(struct intel_encoder *encoder,
bool enable); bool enable);
int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv, int intel_opregion_notify_adapter(struct intel_display *display,
pci_power_t state); pci_power_t state);
int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv); int intel_opregion_get_panel_type(struct intel_display *display);
const struct drm_edid *intel_opregion_get_edid(struct intel_connector *connector); const struct drm_edid *intel_opregion_get_edid(struct intel_connector *connector);
bool intel_opregion_vbt_present(struct drm_i915_private *i915); bool intel_opregion_vbt_present(struct intel_display *display);
const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size); const void *intel_opregion_get_vbt(struct intel_display *display, size_t *size);
bool intel_opregion_headless_sku(struct drm_i915_private *i915); bool intel_opregion_headless_sku(struct intel_display *display);
void intel_opregion_debugfs_register(struct drm_i915_private *i915); void intel_opregion_debugfs_register(struct intel_display *display);
#else /* CONFIG_ACPI*/ #else /* CONFIG_ACPI*/
static inline int intel_opregion_setup(struct drm_i915_private *dev_priv) static inline int intel_opregion_setup(struct intel_display *display)
{ {
return 0; return 0;
} }
static inline void intel_opregion_cleanup(struct drm_i915_private *i915) static inline void intel_opregion_cleanup(struct intel_display *display)
{ {
} }
static inline void intel_opregion_register(struct drm_i915_private *dev_priv) static inline void intel_opregion_register(struct intel_display *display)
{ {
} }
static inline void intel_opregion_unregister(struct drm_i915_private *dev_priv) static inline void intel_opregion_unregister(struct intel_display *display)
{ {
} }
static inline void intel_opregion_resume(struct drm_i915_private *dev_priv) static inline void intel_opregion_resume(struct intel_display *display)
{ {
} }
static inline void intel_opregion_suspend(struct drm_i915_private *dev_priv, static inline void intel_opregion_suspend(struct intel_display *display,
pci_power_t state) pci_power_t state)
{ {
} }
static inline bool intel_opregion_asle_present(struct drm_i915_private *i915) static inline bool intel_opregion_asle_present(struct intel_display *display)
{ {
return false; return false;
} }
static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv) static inline void intel_opregion_asle_intr(struct intel_display *display)
{ {
} }
...@@ -104,12 +104,12 @@ intel_opregion_notify_encoder(struct intel_encoder *encoder, bool enable) ...@@ -104,12 +104,12 @@ intel_opregion_notify_encoder(struct intel_encoder *encoder, bool enable)
} }
static inline int static inline int
intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state) intel_opregion_notify_adapter(struct intel_display *display, pci_power_t state)
{ {
return 0; return 0;
} }
static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev) static inline int intel_opregion_get_panel_type(struct intel_display *display)
{ {
return -ENODEV; return -ENODEV;
} }
...@@ -120,23 +120,23 @@ intel_opregion_get_edid(struct intel_connector *connector) ...@@ -120,23 +120,23 @@ intel_opregion_get_edid(struct intel_connector *connector)
return NULL; return NULL;
} }
static inline bool intel_opregion_vbt_present(struct drm_i915_private *i915) static inline bool intel_opregion_vbt_present(struct intel_display *display)
{ {
return false; return false;
} }
static inline const void * static inline const void *
intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size) intel_opregion_get_vbt(struct intel_display *display, size_t *size)
{ {
return NULL; return NULL;
} }
static inline bool intel_opregion_headless_sku(struct drm_i915_private *i915) static inline bool intel_opregion_headless_sku(struct intel_display *display)
{ {
return false; return false;
} }
static inline void intel_opregion_debugfs_register(struct drm_i915_private *i915) static inline void intel_opregion_debugfs_register(struct intel_display *display)
{ {
} }
......
...@@ -442,6 +442,7 @@ static int i915_pcode_init(struct drm_i915_private *i915) ...@@ -442,6 +442,7 @@ static int i915_pcode_init(struct drm_i915_private *i915)
*/ */
static int i915_driver_hw_probe(struct drm_i915_private *dev_priv) static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
{ {
struct intel_display *display = &dev_priv->display;
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
int ret; int ret;
...@@ -542,7 +543,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv) ...@@ -542,7 +543,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
if (ret) if (ret)
goto err_msi; goto err_msi;
intel_opregion_setup(dev_priv); intel_opregion_setup(display);
ret = i915_pcode_init(dev_priv); ret = i915_pcode_init(dev_priv);
if (ret) if (ret)
...@@ -559,7 +560,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv) ...@@ -559,7 +560,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
return 0; return 0;
err_opregion: err_opregion:
intel_opregion_cleanup(dev_priv); intel_opregion_cleanup(display);
err_msi: err_msi:
if (pdev->msi_enabled) if (pdev->msi_enabled)
pci_disable_msi(pdev); pci_disable_msi(pdev);
...@@ -580,11 +581,12 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv) ...@@ -580,11 +581,12 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
*/ */
static void i915_driver_hw_remove(struct drm_i915_private *dev_priv) static void i915_driver_hw_remove(struct drm_i915_private *dev_priv)
{ {
struct intel_display *display = &dev_priv->display;
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
i915_perf_fini(dev_priv); i915_perf_fini(dev_priv);
intel_opregion_cleanup(dev_priv); intel_opregion_cleanup(display);
if (pdev->msi_enabled) if (pdev->msi_enabled)
pci_disable_msi(pdev); pci_disable_msi(pdev);
...@@ -1014,6 +1016,7 @@ static int i915_drm_prepare(struct drm_device *dev) ...@@ -1014,6 +1016,7 @@ static int i915_drm_prepare(struct drm_device *dev)
static int i915_drm_suspend(struct drm_device *dev) static int i915_drm_suspend(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_display *display = &dev_priv->display;
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
pci_power_t opregion_target_state; pci_power_t opregion_target_state;
...@@ -1049,7 +1052,7 @@ static int i915_drm_suspend(struct drm_device *dev) ...@@ -1049,7 +1052,7 @@ static int i915_drm_suspend(struct drm_device *dev)
i915_save_display(dev_priv); i915_save_display(dev_priv);
opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold; opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
intel_opregion_suspend(dev_priv, opregion_target_state); intel_opregion_suspend(display, opregion_target_state);
dev_priv->suspend_count++; dev_priv->suspend_count++;
...@@ -1138,6 +1141,7 @@ int i915_driver_suspend_switcheroo(struct drm_i915_private *i915, ...@@ -1138,6 +1141,7 @@ int i915_driver_suspend_switcheroo(struct drm_i915_private *i915,
static int i915_drm_resume(struct drm_device *dev) static int i915_drm_resume(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_display *display = &dev_priv->display;
struct intel_gt *gt; struct intel_gt *gt;
int ret, i; int ret, i;
...@@ -1205,7 +1209,7 @@ static int i915_drm_resume(struct drm_device *dev) ...@@ -1205,7 +1209,7 @@ static int i915_drm_resume(struct drm_device *dev)
} }
intel_hpd_poll_disable(dev_priv); intel_hpd_poll_disable(dev_priv);
intel_opregion_resume(dev_priv); intel_opregion_resume(display);
intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false); intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING, false);
...@@ -1454,6 +1458,7 @@ static int i915_pm_restore(struct device *kdev) ...@@ -1454,6 +1458,7 @@ static int i915_pm_restore(struct device *kdev)
static int intel_runtime_suspend(struct device *kdev) static int intel_runtime_suspend(struct device *kdev)
{ {
struct drm_i915_private *dev_priv = kdev_to_i915(kdev); struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
struct intel_display *display = &dev_priv->display;
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
struct pci_dev *root_pdev; struct pci_dev *root_pdev;
...@@ -1528,7 +1533,7 @@ static int intel_runtime_suspend(struct device *kdev) ...@@ -1528,7 +1533,7 @@ static int intel_runtime_suspend(struct device *kdev)
* won't be able to restore them. Since PCI_D3hot matches the * won't be able to restore them. Since PCI_D3hot matches the
* actual specification and appears to be working, use it. * actual specification and appears to be working, use it.
*/ */
intel_opregion_notify_adapter(dev_priv, PCI_D3hot); intel_opregion_notify_adapter(display, PCI_D3hot);
} else { } else {
/* /*
* current versions of firmware which depend on this opregion * current versions of firmware which depend on this opregion
...@@ -1537,7 +1542,7 @@ static int intel_runtime_suspend(struct device *kdev) ...@@ -1537,7 +1542,7 @@ static int intel_runtime_suspend(struct device *kdev)
* to distinguish it from notifications that might be sent via * to distinguish it from notifications that might be sent via
* the suspend path. * the suspend path.
*/ */
intel_opregion_notify_adapter(dev_priv, PCI_D1); intel_opregion_notify_adapter(display, PCI_D1);
} }
assert_forcewakes_inactive(&dev_priv->uncore); assert_forcewakes_inactive(&dev_priv->uncore);
...@@ -1552,6 +1557,7 @@ static int intel_runtime_suspend(struct device *kdev) ...@@ -1552,6 +1557,7 @@ static int intel_runtime_suspend(struct device *kdev)
static int intel_runtime_resume(struct device *kdev) static int intel_runtime_resume(struct device *kdev)
{ {
struct drm_i915_private *dev_priv = kdev_to_i915(kdev); struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
struct intel_display *display = &dev_priv->display;
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
struct pci_dev *root_pdev; struct pci_dev *root_pdev;
...@@ -1566,7 +1572,7 @@ static int intel_runtime_resume(struct device *kdev) ...@@ -1566,7 +1572,7 @@ static int intel_runtime_resume(struct device *kdev)
drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count)); drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count));
disable_rpm_wakeref_asserts(rpm); disable_rpm_wakeref_asserts(rpm);
intel_opregion_notify_adapter(dev_priv, PCI_D0); intel_opregion_notify_adapter(display, PCI_D0);
root_pdev = pcie_find_root_port(pdev); root_pdev = pcie_find_root_port(pdev);
if (root_pdev) if (root_pdev)
......
...@@ -127,16 +127,18 @@ int xe_display_init_nommio(struct xe_device *xe) ...@@ -127,16 +127,18 @@ int xe_display_init_nommio(struct xe_device *xe)
static void xe_display_fini_noirq(void *arg) static void xe_display_fini_noirq(void *arg)
{ {
struct xe_device *xe = arg; struct xe_device *xe = arg;
struct intel_display *display = &xe->display;
if (!xe->info.enable_display) if (!xe->info.enable_display)
return; return;
intel_display_driver_remove_noirq(xe); intel_display_driver_remove_noirq(xe);
intel_opregion_cleanup(xe); intel_opregion_cleanup(display);
} }
int xe_display_init_noirq(struct xe_device *xe) int xe_display_init_noirq(struct xe_device *xe)
{ {
struct intel_display *display = &xe->display;
int err; int err;
if (!xe->info.enable_display) if (!xe->info.enable_display)
...@@ -145,7 +147,7 @@ int xe_display_init_noirq(struct xe_device *xe) ...@@ -145,7 +147,7 @@ int xe_display_init_noirq(struct xe_device *xe)
intel_display_driver_early_probe(xe); intel_display_driver_early_probe(xe);
/* Early display init.. */ /* Early display init.. */
intel_opregion_setup(xe); intel_opregion_setup(display);
/* /*
* Fill the dram structure to get the system dram info. This will be * Fill the dram structure to get the system dram info. This will be
...@@ -159,7 +161,7 @@ int xe_display_init_noirq(struct xe_device *xe) ...@@ -159,7 +161,7 @@ int xe_display_init_noirq(struct xe_device *xe)
err = intel_display_driver_probe_noirq(xe); err = intel_display_driver_probe_noirq(xe);
if (err) { if (err) {
intel_opregion_cleanup(xe); intel_opregion_cleanup(display);
return err; return err;
} }
...@@ -250,11 +252,13 @@ void xe_display_irq_handler(struct xe_device *xe, u32 master_ctl) ...@@ -250,11 +252,13 @@ void xe_display_irq_handler(struct xe_device *xe, u32 master_ctl)
void xe_display_irq_enable(struct xe_device *xe, u32 gu_misc_iir) void xe_display_irq_enable(struct xe_device *xe, u32 gu_misc_iir)
{ {
struct intel_display *display = &xe->display;
if (!xe->info.enable_display) if (!xe->info.enable_display)
return; return;
if (gu_misc_iir & GU_MISC_GSE) if (gu_misc_iir & GU_MISC_GSE)
intel_opregion_asle_intr(xe); intel_opregion_asle_intr(display);
} }
void xe_display_irq_reset(struct xe_device *xe) void xe_display_irq_reset(struct xe_device *xe)
...@@ -285,6 +289,7 @@ static bool suspend_to_idle(void) ...@@ -285,6 +289,7 @@ static bool suspend_to_idle(void)
void xe_display_pm_suspend(struct xe_device *xe, bool runtime) void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
{ {
struct intel_display *display = &xe->display;
bool s2idle = suspend_to_idle(); bool s2idle = suspend_to_idle();
if (!xe->info.enable_display) if (!xe->info.enable_display)
return; return;
...@@ -306,7 +311,7 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime) ...@@ -306,7 +311,7 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
intel_encoder_suspend_all(&xe->display); intel_encoder_suspend_all(&xe->display);
intel_opregion_suspend(xe, s2idle ? PCI_D1 : PCI_D3cold); intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true); intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
...@@ -336,6 +341,8 @@ void xe_display_pm_resume_early(struct xe_device *xe) ...@@ -336,6 +341,8 @@ void xe_display_pm_resume_early(struct xe_device *xe)
void xe_display_pm_resume(struct xe_device *xe, bool runtime) void xe_display_pm_resume(struct xe_device *xe, bool runtime)
{ {
struct intel_display *display = &xe->display;
if (!xe->info.enable_display) if (!xe->info.enable_display)
return; return;
...@@ -356,7 +363,7 @@ void xe_display_pm_resume(struct xe_device *xe, bool runtime) ...@@ -356,7 +363,7 @@ void xe_display_pm_resume(struct xe_device *xe, bool runtime)
if (has_display(xe)) if (has_display(xe))
drm_kms_helper_poll_enable(&xe->drm); drm_kms_helper_poll_enable(&xe->drm);
intel_opregion_resume(xe); intel_opregion_resume(display);
intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false); intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_RUNNING, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment