drm/i915: Use encoder->devdata in eDP init
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 8 Feb 2023 01:55:08 +0000 (03:55 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Feb 2023 12:09:08 +0000 (14:09 +0200)
Since we now populate encoder->devdata for all DP capable
platforms we can consult it directly during the eDP
connector init instead of taking a detour via some global
list/array.

Unfortunately we can't quite get rid of
intel_dp_is_port_edp() since it's still used by the higher
level ilk/vlv/chv output setup code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-11-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_bios.h
drivers/gpu/drm/i915/display/intel_dp.c

index 41c584f3c1520edf8d6ea189e51ac3230d50caba..229f9782e2261b25cbc920511fb2744882785ad7 100644 (file)
@@ -2585,7 +2585,7 @@ intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata)
        return devdata->child.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
 }
 
-static bool
+bool
 intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata)
 {
        return intel_bios_encoder_supports_dp(devdata) &&
@@ -3417,21 +3417,6 @@ bool intel_bios_is_port_present(struct drm_i915_private *i915, enum port port)
        return false;
 }
 
-/**
- * intel_bios_is_port_edp - is the device in given port eDP
- * @i915:      i915 device instance
- * @port:      port to check
- *
- * Return true if the device in %port is eDP.
- */
-bool intel_bios_is_port_edp(struct drm_i915_private *i915, enum port port)
-{
-       const struct intel_bios_encoder_data *devdata =
-               intel_bios_encoder_data_lookup(i915, port);
-
-       return devdata && intel_bios_encoder_supports_edp(devdata);
-}
-
 static bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata)
 {
        const struct child_device_config *child = &devdata->child;
index eaff41256a9c4d77a754d07a11baef313a5df1fc..1a6ae38bd4f6c98e0b6a95747a981c3db6d227ea 100644 (file)
@@ -268,6 +268,7 @@ intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port);
 bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
+bool intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_is_lspcon(const struct intel_bios_encoder_data *devdata);
index 15a1157f53715168f537a2a6f796ca210914268b..b92e0b0f5369d459e53a5e68aa71111dbacf92b1 100644 (file)
@@ -5141,8 +5141,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd)
        return IRQ_HANDLED;
 }
 
-/* check the VBT to see whether the eDP is on another port */
-bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
+static bool _intel_dp_is_port_edp(struct drm_i915_private *dev_priv,
+                                 const struct intel_bios_encoder_data *devdata,
+                                 enum port port)
 {
        /*
         * eDP not supported on g4x. so bail out early just
@@ -5154,7 +5155,15 @@ bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
        if (DISPLAY_VER(dev_priv) < 9 && port == PORT_A)
                return true;
 
-       return intel_bios_is_port_edp(dev_priv, port);
+       return devdata && intel_bios_encoder_supports_edp(devdata);
+}
+
+bool intel_dp_is_port_edp(struct drm_i915_private *i915, enum port port)
+{
+       const struct intel_bios_encoder_data *devdata =
+               intel_bios_encoder_data_lookup(i915, port);
+
+       return _intel_dp_is_port_edp(i915, devdata, port);
 }
 
 static bool
@@ -5427,7 +5436,7 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
        intel_dp->DP = intel_de_read(dev_priv, intel_dp->output_reg);
        intel_dp->attached_connector = intel_connector;
 
-       if (intel_dp_is_port_edp(dev_priv, port)) {
+       if (_intel_dp_is_port_edp(dev_priv, intel_encoder->devdata, port)) {
                /*
                 * Currently we don't support eDP on TypeC ports, although in
                 * theory it could work on TypeC legacy ports.