drm/i915: Pass the whole encoder to hotplug_enables()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 8 Feb 2023 01:54:59 +0000 (03:54 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Feb 2023 12:03:05 +0000 (14:03 +0200)
bxt_hotplug_enables() needs to dig out not only the
hpd_pin but also the VBT child device info, so let's just
pass in the whole encoder to avoid having to look things
up multiple times.

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

index 240d5e1..ae0a3b0 100644 (file)
@@ -81,8 +81,7 @@ static inline void pmu_irq_stats(struct drm_i915_private *i915,
 }
 
 typedef bool (*long_pulse_detect_func)(enum hpd_pin pin, u32 val);
-typedef u32 (*hotplug_enables_func)(struct drm_i915_private *i915,
-                                   enum hpd_pin pin);
+typedef u32 (*hotplug_enables_func)(struct intel_encoder *encoder);
 
 static const u32 hpd_ilk[HPD_NUM_PINS] = {
        [HPD_PORT_A] = DE_DP_A_HOTPLUG,
@@ -884,7 +883,7 @@ static u32 intel_hpd_hotplug_enables(struct drm_i915_private *i915,
        u32 hotplug = 0;
 
        for_each_intel_encoder(&i915->drm, encoder)
-               hotplug |= hotplug_enables(i915, encoder->hpd_pin);
+               hotplug |= hotplug_enables(encoder);
 
        return hotplug;
 }
@@ -2835,10 +2834,11 @@ static void cherryview_irq_reset(struct drm_i915_private *dev_priv)
        spin_unlock_irq(&dev_priv->irq_lock);
 }
 
-static u32 ibx_hotplug_enables(struct drm_i915_private *i915,
-                              enum hpd_pin pin)
+static u32 ibx_hotplug_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+
+       switch (encoder->hpd_pin) {
        case HPD_PORT_A:
                /*
                 * When CPU and PCH are on the same package, port A
@@ -2890,31 +2890,29 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv)
        ibx_hpd_detection_setup(dev_priv);
 }
 
-static u32 icp_ddi_hotplug_enables(struct drm_i915_private *i915,
-                                  enum hpd_pin pin)
+static u32 icp_ddi_hotplug_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_A:
        case HPD_PORT_B:
        case HPD_PORT_C:
        case HPD_PORT_D:
-               return SHOTPLUG_CTL_DDI_HPD_ENABLE(pin);
+               return SHOTPLUG_CTL_DDI_HPD_ENABLE(encoder->hpd_pin);
        default:
                return 0;
        }
 }
 
-static u32 icp_tc_hotplug_enables(struct drm_i915_private *i915,
-                                 enum hpd_pin pin)
+static u32 icp_tc_hotplug_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_TC1:
        case HPD_PORT_TC2:
        case HPD_PORT_TC3:
        case HPD_PORT_TC4:
        case HPD_PORT_TC5:
        case HPD_PORT_TC6:
-               return ICP_TC_HPD_ENABLE(pin);
+               return ICP_TC_HPD_ENABLE(encoder->hpd_pin);
        default:
                return 0;
        }
@@ -2958,17 +2956,16 @@ static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
        icp_tc_hpd_detection_setup(dev_priv);
 }
 
-static u32 gen11_hotplug_enables(struct drm_i915_private *i915,
-                                enum hpd_pin pin)
+static u32 gen11_hotplug_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_TC1:
        case HPD_PORT_TC2:
        case HPD_PORT_TC3:
        case HPD_PORT_TC4:
        case HPD_PORT_TC5:
        case HPD_PORT_TC6:
-               return GEN11_HOTPLUG_CTL_ENABLE(pin);
+               return GEN11_HOTPLUG_CTL_ENABLE(encoder->hpd_pin);
        default:
                return 0;
        }
@@ -3031,10 +3028,9 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
                icp_hpd_irq_setup(dev_priv);
 }
 
-static u32 spt_hotplug_enables(struct drm_i915_private *i915,
-                              enum hpd_pin pin)
+static u32 spt_hotplug_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_A:
                return PORTA_HOTPLUG_ENABLE;
        case HPD_PORT_B:
@@ -3048,10 +3044,9 @@ static u32 spt_hotplug_enables(struct drm_i915_private *i915,
        }
 }
 
-static u32 spt_hotplug2_enables(struct drm_i915_private *i915,
-                               enum hpd_pin pin)
+static u32 spt_hotplug2_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_E:
                return PORTE_HOTPLUG_ENABLE;
        default:
@@ -3094,10 +3089,9 @@ static void spt_hpd_irq_setup(struct drm_i915_private *dev_priv)
        spt_hpd_detection_setup(dev_priv);
 }
 
-static u32 ilk_hotplug_enables(struct drm_i915_private *i915,
-                              enum hpd_pin pin)
+static u32 ilk_hotplug_enables(struct intel_encoder *encoder)
 {
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_A:
                return DIGITAL_PORTA_HOTPLUG_ENABLE |
                        DIGITAL_PORTA_PULSE_DURATION_2ms;
@@ -3135,12 +3129,12 @@ static void ilk_hpd_irq_setup(struct drm_i915_private *dev_priv)
        ibx_hpd_irq_setup(dev_priv);
 }
 
-static u32 bxt_hotplug_enables(struct drm_i915_private *i915,
-                              enum hpd_pin pin)
+static u32 bxt_hotplug_enables(struct intel_encoder *encoder)
 {
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
        u32 hotplug;
 
-       switch (pin) {
+       switch (encoder->hpd_pin) {
        case HPD_PORT_A:
                hotplug = PORTA_HOTPLUG_ENABLE;
                if (intel_bios_is_port_hpd_inverted(i915, PORT_A))