Commit fe63ea7c authored by Jani Nikula's avatar Jani Nikula

drm/i915: convert INTEL_DISPLAY_ENABLED() into a function

There's no need for this to be a macro. Add some documentation too.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/480b9b697b2ffa0c8677115bd443ba633801c6c1.1696336887.git.jani.nikula@intel.com
parent f2a7b9cd
...@@ -838,7 +838,7 @@ intel_crt_detect(struct drm_connector *connector, ...@@ -838,7 +838,7 @@ intel_crt_detect(struct drm_connector *connector,
connector->base.id, connector->name, connector->base.id, connector->name,
force); force);
if (!INTEL_DISPLAY_ENABLED(dev_priv)) if (!intel_display_device_enabled(dev_priv))
return connector_status_disconnected; return connector_status_disconnected;
if (dev_priv->params.load_detect_test) { if (dev_priv->params.load_detect_test) {
......
...@@ -1091,3 +1091,20 @@ void intel_display_device_info_print(const struct intel_display_device_info *inf ...@@ -1091,3 +1091,20 @@ void intel_display_device_info_print(const struct intel_display_device_info *inf
drm_printf(p, "has_dmc: %s\n", str_yes_no(runtime->has_dmc)); drm_printf(p, "has_dmc: %s\n", str_yes_no(runtime->has_dmc));
drm_printf(p, "has_dsc: %s\n", str_yes_no(runtime->has_dsc)); drm_printf(p, "has_dsc: %s\n", str_yes_no(runtime->has_dsc));
} }
/*
* Assuming the device has display hardware, should it be enabled?
*
* It's an error to call this function if the device does not have display
* hardware.
*
* Disabling display means taking over the display hardware, putting it to
* sleep, and preventing connectors from being connected via any means.
*/
bool intel_display_device_enabled(struct drm_i915_private *i915)
{
/* Only valid when HAS_DISPLAY() is true */
drm_WARN_ON(&i915->drm, !HAS_DISPLAY(i915));
return !i915->params.disable_display && !intel_opregion_headless_sku(i915);
}
...@@ -150,6 +150,7 @@ struct intel_display_device_info { ...@@ -150,6 +150,7 @@ struct intel_display_device_info {
} color; } color;
}; };
bool intel_display_device_enabled(struct drm_i915_private *i915);
void intel_display_device_probe(struct drm_i915_private *i915); void intel_display_device_probe(struct drm_i915_private *i915);
void intel_display_device_info_runtime_init(struct drm_i915_private *i915); void intel_display_device_info_runtime_init(struct drm_i915_private *i915);
......
...@@ -5358,7 +5358,7 @@ intel_dp_detect(struct drm_connector *connector, ...@@ -5358,7 +5358,7 @@ intel_dp_detect(struct drm_connector *connector,
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
!drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex)); !drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex));
if (!INTEL_DISPLAY_ENABLED(dev_priv)) if (!intel_display_device_enabled(dev_priv))
return connector_status_disconnected; return connector_status_disconnected;
/* Can't disconnect eDP */ /* Can't disconnect eDP */
......
...@@ -1056,7 +1056,7 @@ intel_dp_mst_detect(struct drm_connector *connector, ...@@ -1056,7 +1056,7 @@ intel_dp_mst_detect(struct drm_connector *connector,
struct intel_connector *intel_connector = to_intel_connector(connector); struct intel_connector *intel_connector = to_intel_connector(connector);
struct intel_dp *intel_dp = intel_connector->mst_port; struct intel_dp *intel_dp = intel_connector->mst_port;
if (!INTEL_DISPLAY_ENABLED(i915)) if (!intel_display_device_enabled(i915))
return connector_status_disconnected; return connector_status_disconnected;
if (drm_connector_is_unregistered(connector)) if (drm_connector_is_unregistered(connector))
......
...@@ -319,7 +319,7 @@ intel_dvo_detect(struct drm_connector *_connector, bool force) ...@@ -319,7 +319,7 @@ intel_dvo_detect(struct drm_connector *_connector, bool force)
drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n", drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n",
connector->base.base.id, connector->base.name); connector->base.base.id, connector->base.name);
if (!INTEL_DISPLAY_ENABLED(i915)) if (!intel_display_device_enabled(i915))
return connector_status_disconnected; return connector_status_disconnected;
return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev); return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev);
......
...@@ -2496,7 +2496,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) ...@@ -2496,7 +2496,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s]\n", drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s]\n",
connector->base.id, connector->name); connector->base.id, connector->name);
if (!INTEL_DISPLAY_ENABLED(dev_priv)) if (!intel_display_device_enabled(dev_priv))
return connector_status_disconnected; return connector_status_disconnected;
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS); wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
......
...@@ -763,7 +763,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work) ...@@ -763,7 +763,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work)
void intel_hpd_poll_enable(struct drm_i915_private *dev_priv) void intel_hpd_poll_enable(struct drm_i915_private *dev_priv)
{ {
if (!HAS_DISPLAY(dev_priv) || if (!HAS_DISPLAY(dev_priv) ||
!INTEL_DISPLAY_ENABLED(dev_priv)) !intel_display_device_enabled(dev_priv))
return; return;
WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, true); WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, true);
......
...@@ -680,7 +680,7 @@ intel_panel_detect(struct drm_connector *connector, bool force) ...@@ -680,7 +680,7 @@ intel_panel_detect(struct drm_connector *connector, bool force)
{ {
struct drm_i915_private *i915 = to_i915(connector->dev); struct drm_i915_private *i915 = to_i915(connector->dev);
if (!INTEL_DISPLAY_ENABLED(i915)) if (!intel_display_device_enabled(i915))
return connector_status_disconnected; return connector_status_disconnected;
return connector_status_connected; return connector_status_connected;
......
...@@ -2121,7 +2121,7 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) ...@@ -2121,7 +2121,7 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
connector->base.id, connector->name); connector->base.id, connector->name);
if (!INTEL_DISPLAY_ENABLED(i915)) if (!intel_display_device_enabled(i915))
return connector_status_disconnected; return connector_status_disconnected;
if (!intel_sdvo_set_target_output(intel_sdvo, if (!intel_sdvo_set_target_output(intel_sdvo,
......
...@@ -1720,7 +1720,7 @@ intel_tv_detect(struct drm_connector *connector, ...@@ -1720,7 +1720,7 @@ intel_tv_detect(struct drm_connector *connector,
drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] force=%d\n", drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] force=%d\n",
connector->base.id, connector->name, force); connector->base.id, connector->name, force);
if (!INTEL_DISPLAY_ENABLED(i915)) if (!intel_display_device_enabled(i915))
return connector_status_disconnected; return connector_status_disconnected;
if (force) { if (force) {
......
...@@ -821,12 +821,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915, ...@@ -821,12 +821,6 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
#define NUM_L3_SLICES(i915) (IS_HASWELL_GT3(i915) ? \ #define NUM_L3_SLICES(i915) (IS_HASWELL_GT3(i915) ? \
2 : HAS_L3_DPF(i915)) 2 : HAS_L3_DPF(i915))
/* Only valid when HAS_DISPLAY() is true */
#define INTEL_DISPLAY_ENABLED(i915) \
(drm_WARN_ON(&(i915)->drm, !HAS_DISPLAY(i915)), \
!(i915)->params.disable_display && \
!intel_opregion_headless_sku(i915))
#define HAS_GUC_DEPRIVILEGE(i915) \ #define HAS_GUC_DEPRIVILEGE(i915) \
(INTEL_INFO(i915)->has_guc_deprivilege) (INTEL_INFO(i915)->has_guc_deprivilege)
......
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