drm/i915: Add HAS_DISPLAY() and use it

Right now it is decided if GEN has display by checking the num_pipes,
so lets make it explicit and use a macro.

Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130232048.14216-1-jose.souza@intel.com
parent ae9e7ced
...@@ -287,7 +287,7 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv) ...@@ -287,7 +287,7 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv)
* Use PCH_NOP (PCH but no South Display) for PCH platforms without * Use PCH_NOP (PCH but no South Display) for PCH platforms without
* display. * display.
*/ */
if (pch && INTEL_INFO(dev_priv)->num_pipes == 0) { if (pch && !HAS_DISPLAY(dev_priv)) {
DRM_DEBUG_KMS("Display disabled, reverting to NOP PCH\n"); DRM_DEBUG_KMS("Display disabled, reverting to NOP PCH\n");
dev_priv->pch_type = PCH_NOP; dev_priv->pch_type = PCH_NOP;
dev_priv->pch_id = 0; dev_priv->pch_id = 0;
...@@ -645,7 +645,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -645,7 +645,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (i915_inject_load_failure()) if (i915_inject_load_failure())
return -ENODEV; return -ENODEV;
if (INTEL_INFO(dev_priv)->num_pipes) { if (HAS_DISPLAY(dev_priv)) {
ret = drm_vblank_init(&dev_priv->drm, ret = drm_vblank_init(&dev_priv->drm,
INTEL_INFO(dev_priv)->num_pipes); INTEL_INFO(dev_priv)->num_pipes);
if (ret) if (ret)
...@@ -696,7 +696,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -696,7 +696,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
intel_overlay_setup(dev_priv); intel_overlay_setup(dev_priv);
if (INTEL_INFO(dev_priv)->num_pipes == 0) if (!HAS_DISPLAY(dev_priv))
return 0; return 0;
ret = intel_fbdev_init(dev); ret = intel_fbdev_init(dev);
...@@ -1566,7 +1566,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) ...@@ -1566,7 +1566,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
} else } else
DRM_ERROR("Failed to register driver for userspace access!\n"); DRM_ERROR("Failed to register driver for userspace access!\n");
if (INTEL_INFO(dev_priv)->num_pipes) { if (HAS_DISPLAY(dev_priv)) {
/* Must be done after probing outputs */ /* Must be done after probing outputs */
intel_opregion_register(dev_priv); intel_opregion_register(dev_priv);
acpi_video_register(); acpi_video_register();
...@@ -1590,7 +1590,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) ...@@ -1590,7 +1590,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
* We need to coordinate the hotplugs with the asynchronous fbdev * We need to coordinate the hotplugs with the asynchronous fbdev
* configuration, for which we use the fbdev->async_cookie. * configuration, for which we use the fbdev->async_cookie.
*/ */
if (INTEL_INFO(dev_priv)->num_pipes) if (HAS_DISPLAY(dev_priv))
drm_kms_helper_poll_init(dev); drm_kms_helper_poll_init(dev);
intel_power_domains_enable(dev_priv); intel_power_domains_enable(dev_priv);
......
...@@ -2569,6 +2569,8 @@ intel_info(const struct drm_i915_private *dev_priv) ...@@ -2569,6 +2569,8 @@ intel_info(const struct drm_i915_private *dev_priv)
#define GT_FREQUENCY_MULTIPLIER 50 #define GT_FREQUENCY_MULTIPLIER 50
#define GEN9_FREQ_SCALER 3 #define GEN9_FREQ_SCALER 3
#define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->num_pipes > 0)
#include "i915_trace.h" #include "i915_trace.h"
static inline bool intel_vtd_active(void) static inline bool intel_vtd_active(void)
......
...@@ -1752,7 +1752,7 @@ void intel_bios_init(struct drm_i915_private *dev_priv) ...@@ -1752,7 +1752,7 @@ void intel_bios_init(struct drm_i915_private *dev_priv)
const struct bdb_header *bdb; const struct bdb_header *bdb;
u8 __iomem *bios = NULL; u8 __iomem *bios = NULL;
if (INTEL_INFO(dev_priv)->num_pipes == 0) { if (!HAS_DISPLAY(dev_priv)) {
DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n"); DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n");
return; return;
} }
......
...@@ -782,7 +782,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info) ...@@ -782,7 +782,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
if (i915_modparams.disable_display) { if (i915_modparams.disable_display) {
DRM_INFO("Display disabled (module parameter)\n"); DRM_INFO("Display disabled (module parameter)\n");
info->num_pipes = 0; info->num_pipes = 0;
} else if (info->num_pipes > 0 && } else if (HAS_DISPLAY(dev_priv) &&
(IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) && (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
HAS_PCH_SPLIT(dev_priv)) { HAS_PCH_SPLIT(dev_priv)) {
u32 fuse_strap = I915_READ(FUSE_STRAP); u32 fuse_strap = I915_READ(FUSE_STRAP);
...@@ -807,7 +807,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info) ...@@ -807,7 +807,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
DRM_INFO("PipeC fused off\n"); DRM_INFO("PipeC fused off\n");
info->num_pipes -= 1; info->num_pipes -= 1;
} }
} else if (info->num_pipes > 0 && IS_GEN9(dev_priv)) { } else if (HAS_DISPLAY(dev_priv) && IS_GEN9(dev_priv)) {
u32 dfsm = I915_READ(SKL_DFSM); u32 dfsm = I915_READ(SKL_DFSM);
u8 disabled_mask = 0; u8 disabled_mask = 0;
bool invalid; bool invalid;
......
...@@ -14249,7 +14249,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv) ...@@ -14249,7 +14249,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
intel_pps_init(dev_priv); intel_pps_init(dev_priv);
if (INTEL_INFO(dev_priv)->num_pipes == 0) if (!HAS_DISPLAY(dev_priv))
return; return;
/* /*
...@@ -16040,7 +16040,7 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv) ...@@ -16040,7 +16040,7 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv)
}; };
int i; int i;
if (INTEL_INFO(dev_priv)->num_pipes == 0) if (!HAS_DISPLAY(dev_priv))
return NULL; return NULL;
error = kzalloc(sizeof(*error), GFP_ATOMIC); error = kzalloc(sizeof(*error), GFP_ATOMIC);
......
...@@ -672,7 +672,7 @@ int intel_fbdev_init(struct drm_device *dev) ...@@ -672,7 +672,7 @@ int intel_fbdev_init(struct drm_device *dev)
struct intel_fbdev *ifbdev; struct intel_fbdev *ifbdev;
int ret; int ret;
if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0)) if (WARN_ON(!HAS_DISPLAY(dev_priv)))
return -ENODEV; return -ENODEV;
ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL); ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
......
...@@ -817,7 +817,7 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv) ...@@ -817,7 +817,7 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv)
unsigned int pin; unsigned int pin;
int ret; int ret;
if (INTEL_INFO(dev_priv)->num_pipes == 0) if (!HAS_DISPLAY(dev_priv))
return 0; return 0;
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
......
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