]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Add HAS_DISPLAY() and use it
authorJosé Roberto de Souza <jose.souza@intel.com>
Fri, 30 Nov 2018 23:20:47 +0000 (15:20 -0800)
committerJosé Roberto de Souza <jose.souza@intel.com>
Mon, 3 Dec 2018 22:55:39 +0000 (14:55 -0800)
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: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130232048.14216-1-jose.souza@intel.com
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_device_info.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fbdev.c
drivers/gpu/drm/i915/intel_i2c.c

index 3e5e2efce670bd88d334f36a23fbeb6ab9a83ee4..c2a3ba7e09e0f45ca3942045fd53d460e5902de0 100644 (file)
@@ -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
         * 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");
                dev_priv->pch_type = PCH_NOP;
                dev_priv->pch_id = 0;
@@ -645,7 +645,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
        if (i915_inject_load_failure())
                return -ENODEV;
 
-       if (INTEL_INFO(dev_priv)->num_pipes) {
+       if (HAS_DISPLAY(dev_priv)) {
                ret = drm_vblank_init(&dev_priv->drm,
                                      INTEL_INFO(dev_priv)->num_pipes);
                if (ret)
@@ -696,7 +696,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
        intel_overlay_setup(dev_priv);
 
-       if (INTEL_INFO(dev_priv)->num_pipes == 0)
+       if (!HAS_DISPLAY(dev_priv))
                return 0;
 
        ret = intel_fbdev_init(dev);
@@ -1566,7 +1566,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
        } else
                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 */
                intel_opregion_register(dev_priv);
                acpi_video_register();
@@ -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
         * 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);
 
        intel_power_domains_enable(dev_priv);
index d4547528713075a3127b3b9a85beac7cc68714c7..f38658e1a20a343c6d13279eded413c90dc39555 100644 (file)
@@ -2569,6 +2569,8 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define GT_FREQUENCY_MULTIPLIER 50
 #define GEN9_FREQ_SCALER 3
 
+#define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->num_pipes > 0)
+
 #include "i915_trace.h"
 
 static inline bool intel_vtd_active(void)
index 0694aa8bb9bcaa55e505c9678e857a00abd21dd5..6d3e0260d49cda5b2d5ffa36152ef6eb544cc14e 100644 (file)
@@ -1752,7 +1752,7 @@ void intel_bios_init(struct drm_i915_private *dev_priv)
        const struct bdb_header *bdb;
        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");
                return;
        }
index ceecb5bd5226ac1fd0357f9e5b96a79d574d6233..677002a9e89358abc54ff52fc4b07e63a6ebab8b 100644 (file)
@@ -782,7 +782,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
        if (i915_modparams.disable_display) {
                DRM_INFO("Display disabled (module parameter)\n");
                info->num_pipes = 0;
-       } else if (info->num_pipes > 0 &&
+       } else if (HAS_DISPLAY(dev_priv) &&
                   (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
                   HAS_PCH_SPLIT(dev_priv)) {
                u32 fuse_strap = I915_READ(FUSE_STRAP);
@@ -807,7 +807,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
                        DRM_INFO("PipeC fused off\n");
                        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);
                u8 disabled_mask = 0;
                bool invalid;
index 58cadd251accc1df09f7ec793bfe80ffa16eed98..aa5f89f26cf502c7a528d3e875d7cb7478222e6c 100644 (file)
@@ -14249,7 +14249,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 
        intel_pps_init(dev_priv);
 
-       if (INTEL_INFO(dev_priv)->num_pipes == 0)
+       if (!HAS_DISPLAY(dev_priv))
                return;
 
        /*
@@ -16040,7 +16040,7 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv)
        };
        int i;
 
-       if (INTEL_INFO(dev_priv)->num_pipes == 0)
+       if (!HAS_DISPLAY(dev_priv))
                return NULL;
 
        error = kzalloc(sizeof(*error), GFP_ATOMIC);
index 2480c7d6edee468f15fa9af2794cf2f8c72404fc..fb5bb5b32a6034d152516ae11c15913e2f97597d 100644 (file)
@@ -672,7 +672,7 @@ int intel_fbdev_init(struct drm_device *dev)
        struct intel_fbdev *ifbdev;
        int ret;
 
-       if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0))
+       if (WARN_ON(!HAS_DISPLAY(dev_priv)))
                return -ENODEV;
 
        ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
index 33d87ab93fdd4bd81a221daf9a039e84510d592d..802d0394ccc4ad82d92e244cce2109313c84b9a2 100644 (file)
@@ -817,7 +817,7 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv)
        unsigned int pin;
        int ret;
 
-       if (INTEL_INFO(dev_priv)->num_pipes == 0)
+       if (!HAS_DISPLAY(dev_priv))
                return 0;
 
        if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))