drm/i915: Replace intel_bios_is_port_hpd_inverted() with intel_bios_encoder_hpd_invert()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 8 Feb 2023 01:55:03 +0000 (03:55 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Feb 2023 12:05:06 +0000 (14:05 +0200)
intel_bios_is_port_hpd_inverted() is only used on bxt/glk on
which we always have encoder->devdata available. So consult
that instead of digging around in vbt.ports[].

And rename the function to match the common pattern.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-6-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/i915_irq.c

index 3cf5122c24018a95426e0487af1777cb5d258e56..81bfb039740ab44fe8d65fefb2358ff09c73b9dd 100644 (file)
@@ -3574,26 +3574,6 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
        return false;
 }
 
-/**
- * intel_bios_is_port_hpd_inverted - is HPD inverted for %port
- * @i915:      i915 device instance
- * @port:      port to check
- *
- * Return true if HPD should be inverted for %port.
- */
-bool
-intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
-                               enum port port)
-{
-       const struct intel_bios_encoder_data *devdata = i915->display.vbt.ports[port];
-
-       if (drm_WARN_ON_ONCE(&i915->drm,
-                            !IS_GEMINILAKE(i915) && !IS_BROXTON(i915)))
-               return false;
-
-       return devdata && devdata->child.hpd_invert;
-}
-
 enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *i915,
                                   enum port port)
 {
@@ -3763,6 +3743,11 @@ bool intel_bios_encoder_lane_reversal(const struct intel_bios_encoder_data *devd
        return devdata && devdata->child.lane_reversal;
 }
 
+bool intel_bios_encoder_hpd_invert(const struct intel_bios_encoder_data *devdata)
+{
+       return devdata && devdata->child.hpd_invert;
+}
+
 const struct intel_bios_encoder_data *
 intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port)
 {
index 29119145cf34a2514d5a69400cb762da8d425882..cf9fbf506790f29ee90a1996824c55f7f2296a33 100644 (file)
@@ -248,8 +248,6 @@ bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port por
 bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
 bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port);
 bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
-bool intel_bios_is_port_hpd_inverted(const struct drm_i915_private *i915,
-                                    enum port port);
 enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv, enum port port);
 bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
                               struct intel_crtc_state *crtc_state,
@@ -274,5 +272,6 @@ bool intel_bios_encoder_is_lspcon(const struct intel_bios_encoder_data *devdata)
 int intel_bios_encoder_dp_boost_level(const struct intel_bios_encoder_data *devdata);
 int intel_bios_encoder_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_lane_reversal(const struct intel_bios_encoder_data *devdata);
+bool intel_bios_encoder_hpd_invert(const struct intel_bios_encoder_data *devdata);
 
 #endif /* _INTEL_BIOS_H_ */
index ae0a3b07281afaa7ca4d6e1462d8a34bd6ed9ad0..b024a3a7ca19d2e8b659777999ae82c5c0c5efef 100644 (file)
@@ -3131,23 +3131,22 @@ static void ilk_hpd_irq_setup(struct drm_i915_private *dev_priv)
 
 static u32 bxt_hotplug_enables(struct intel_encoder *encoder)
 {
-       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
        u32 hotplug;
 
        switch (encoder->hpd_pin) {
        case HPD_PORT_A:
                hotplug = PORTA_HOTPLUG_ENABLE;
-               if (intel_bios_is_port_hpd_inverted(i915, PORT_A))
+               if (intel_bios_encoder_hpd_invert(encoder->devdata))
                        hotplug |= BXT_DDIA_HPD_INVERT;
                return hotplug;
        case HPD_PORT_B:
                hotplug = PORTB_HOTPLUG_ENABLE;
-               if (intel_bios_is_port_hpd_inverted(i915, PORT_B))
+               if (intel_bios_encoder_hpd_invert(encoder->devdata))
                        hotplug |= BXT_DDIB_HPD_INVERT;
                return hotplug;
        case HPD_PORT_C:
                hotplug = PORTC_HOTPLUG_ENABLE;
-               if (intel_bios_is_port_hpd_inverted(i915, PORT_C))
+               if (intel_bios_encoder_hpd_invert(encoder->devdata))
                        hotplug |= BXT_DDIC_HPD_INVERT;
                return hotplug;
        default: