<div dir="ltr">Great!<div><br></div><div>Reviewed-by: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 6, 2015 at 12:45 AM Xiong Zhang <<a href="mailto:xiong.y.zhang@intel.com">xiong.y.zhang@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Xiong Zhang <<a href="mailto:xiong.y.zhang@intel.com" target="_blank">xiong.y.zhang@intel.com</a>><br>
---<br>
 drivers/gpu/drm/i915/i915_drv.h      |  1 +<br>
 drivers/gpu/drm/i915/i915_irq.c      | 49 +++++++++++++++++++++++++++++++++---<br>
 drivers/gpu/drm/i915/i915_reg.h      | 12 +++++++++<br>
 drivers/gpu/drm/i915/intel_display.c |  2 ++<br>
 drivers/gpu/drm/i915/intel_dp.c      |  3 +++<br>
 drivers/gpu/drm/i915/intel_hotplug.c |  3 +++<br>
 6 files changed, 66 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h<br>
index 8d50d4f..6d93334 100644<br>
--- a/drivers/gpu/drm/i915/i915_drv.h<br>
+++ b/drivers/gpu/drm/i915/i915_drv.h<br>
@@ -214,6 +214,7 @@ enum hpd_pin {<br>
        HPD_PORT_B,<br>
        HPD_PORT_C,<br>
        HPD_PORT_D,<br>
+       HPD_PORT_E,<br>
        HPD_NUM_PINS<br>
 };<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c<br>
index 1118c39..420cf5a 100644<br>
--- a/drivers/gpu/drm/i915/i915_irq.c<br>
+++ b/drivers/gpu/drm/i915/i915_irq.c<br>
@@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {<br>
        [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT<br>
 };<br>
<br>
+static const u32 hpd_spt[HPD_NUM_PINS] = {<br>
+       [HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,<br>
+       [HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,<br>
+       [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,<br>
+       [HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT<br>
+};<br>
+<br>
 static const u32 hpd_mask_i915[HPD_NUM_PINS] = {<br>
        [HPD_CRT] = CRT_HOTPLUG_INT_EN,<br>
        [HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,<br>
@@ -1252,6 +1259,8 @@ static bool pch_port_hotplug_long_detect(enum port port, u32 val)<br>
                return val & PORTC_HOTPLUG_LONG_DETECT;<br>
        case PORT_D:<br>
                return val & PORTD_HOTPLUG_LONG_DETECT;<br>
+       case PORT_E:<br>
+               return val & PORTE_HOTPLUG_LONG_DETECT;<br>
        default:<br>
                return false;<br>
        }<br>
@@ -1752,7 +1761,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)<br>
 {<br>
        struct drm_i915_private *dev_priv = dev->dev_private;<br>
        int pipe;<br>
-       u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;<br>
+       u32 hotplug_trigger;<br>
+<br>
+       if (HAS_PCH_SPT(dev))<br>
+               hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;<br>
+       else<br>
+               hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;<br>
<br>
        if (hotplug_trigger) {<br>
                u32 dig_hotplug_reg, pin_mask, long_mask;<br>
@@ -1760,9 +1774,24 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)<br>
                dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);<br>
                I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);<br>
<br>
-               intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,<br>
-                                  dig_hotplug_reg, hpd_cpt,<br>
-                                  pch_port_hotplug_long_detect);<br>
+               if (HAS_PCH_SPT(dev)) {<br>
+                       intel_get_hpd_pins(&pin_mask, &long_mask,<br>
+                                          hotplug_trigger,<br>
+                                          dig_hotplug_reg, hpd_spt,<br>
+                                          pch_port_hotplug_long_detect);<br>
+<br>
+                       /* detect PORTE HP event */<br>
+                       dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);<br>
+                       if (pch_port_hotplug_long_detect(PORT_E,<br>
+                                                        dig_hotplug_reg))<br>
+                               long_mask |= 1 << HPD_PORT_E;<br>
+               }<br>
+               else<br>
+                       intel_get_hpd_pins(&pin_mask, &long_mask,<br>
+                                          hotplug_trigger,<br>
+                                          dig_hotplug_reg, hpd_cpt,<br>
+                                          pch_port_hotplug_long_detect);<br>
+<br>
                intel_hpd_irq_handler(dev, pin_mask, long_mask);<br>
        }<br>
<br>
@@ -2984,6 +3013,11 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)<br>
                for_each_intel_encoder(dev, intel_encoder)<br>
                        if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)<br>
                                enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];<br>
+       } else if (HAS_PCH_SPT(dev)) {<br>
+               hotplug_irqs = SDE_HOTPLUG_MASK_SPT;<br>
+               for_each_intel_encoder(dev, intel_encoder)<br>
+                       if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)<br>
+                               enabled_irqs |= hpd_spt[intel_encoder->hpd_pin];<br>
        } else {<br>
                hotplug_irqs = SDE_HOTPLUG_MASK_CPT;<br>
                for_each_intel_encoder(dev, intel_encoder)<br>
@@ -3005,6 +3039,13 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)<br>
        hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;<br>
        hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;<br>
        I915_WRITE(PCH_PORT_HOTPLUG, hotplug);<br>
+<br>
+       /* enable SPT PORTE hot plug */<br>
+       if (HAS_PCH_SPT(dev)) {<br>
+               hotplug = I915_READ(PCH_PORT_HOTPLUG2);<br>
+               hotplug |= PORTE_HOTPLUG_ENABLE;<br>
+               I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);<br>
+       }<br>
 }<br>
<br>
 static void bxt_hpd_irq_setup(struct drm_device *dev)<br>
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h<br>
index 3a77678..cdd2244 100644<br>
--- a/drivers/gpu/drm/i915/i915_reg.h<br>
+++ b/drivers/gpu/drm/i915/i915_reg.h<br>
@@ -5940,6 +5940,7 @@ enum skl_disp_power_wells {<br>
 #define SDE_AUXC_CPT           (1 << 26)<br>
 #define SDE_AUXB_CPT           (1 << 25)<br>
 #define SDE_AUX_MASK_CPT       (7 << 25)<br>
+#define SDE_PORTE_HOTPLUG_SPT  (1 << 25)<br>
 #define SDE_PORTD_HOTPLUG_CPT  (1 << 23)<br>
 #define SDE_PORTC_HOTPLUG_CPT  (1 << 22)<br>
 #define SDE_PORTB_HOTPLUG_CPT  (1 << 21)<br>
@@ -5950,6 +5951,10 @@ enum skl_disp_power_wells {<br>
                                 SDE_PORTD_HOTPLUG_CPT |        \<br>
                                 SDE_PORTC_HOTPLUG_CPT |        \<br>
                                 SDE_PORTB_HOTPLUG_CPT)<br>
+#define SDE_HOTPLUG_MASK_SPT   (SDE_PORTE_HOTPLUG_SPT |        \<br>
+                                SDE_PORTD_HOTPLUG_CPT |        \<br>
+                                SDE_PORTC_HOTPLUG_CPT |        \<br>
+                                SDE_PORTB_HOTPLUG_CPT)<br>
 #define SDE_GMBUS_CPT          (1 << 17)<br>
 #define SDE_ERROR_CPT          (1 << 16)<br>
 #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10)<br>
@@ -6021,6 +6026,13 @@ enum skl_disp_power_wells {<br>
 #define  PORTB_HOTPLUG_SHORT_DETECT    (1 << 0)<br>
 #define  PORTB_HOTPLUG_LONG_DETECT     (2 << 0)<br>
<br>
+#define PCH_PORT_HOTPLUG2        0xc403C               /* SHOTPLUG_CTL2 */<br>
+#define PORTE_HOTPLUG_ENABLE            (1 << 4)<br>
+#define PORTE_HOTPLUG_STATUS_MASK      (0x3 << 0)<br>
+#define  PORTE_HOTPLUG_NO_DETECT       (0 << 0)<br>
+#define  PORTE_HOTPLUG_SHORT_DETECT    (1 << 0)<br>
+#define  PORTE_HOTPLUG_LONG_DETECT     (2 << 0)<br>
+<br>
 #define PCH_GPIOA               0xc5010<br>
 #define PCH_GPIOB               0xc5014<br>
 #define PCH_GPIOC               0xc5018<br>
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c<br>
index ea10fa8..5009b01 100644<br>
--- a/drivers/gpu/drm/i915/intel_display.c<br>
+++ b/drivers/gpu/drm/i915/intel_display.c<br>
@@ -1098,6 +1098,8 @@ bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,<br>
                case PORT_D:<br>
                        bit = SDE_PORTD_HOTPLUG_CPT;<br>
                        break;<br>
+               case PORT_E:<br>
+                       bit = SDE_PORTE_HOTPLUG_SPT;<br>
                default:<br>
                        return true;<br>
                }<br>
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c<br>
index 0643a91..3b5c0ee 100644<br>
--- a/drivers/gpu/drm/i915/intel_dp.c<br>
+++ b/drivers/gpu/drm/i915/intel_dp.c<br>
@@ -5823,6 +5823,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,<br>
        case PORT_D:<br>
                intel_encoder->hpd_pin = HPD_PORT_D;<br>
                break;<br>
+       case PORT_E:<br>
+               intel_encoder->hpd_pin = HPD_PORT_E;<br>
+               break;<br>
        default:<br>
                BUG();<br>
        }<br>
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c<br>
index 032a0bf..53c0173 100644<br>
--- a/drivers/gpu/drm/i915/intel_hotplug.c<br>
+++ b/drivers/gpu/drm/i915/intel_hotplug.c<br>
@@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port)<br>
        case HPD_PORT_D:<br>
                *port = PORT_D;<br>
                return true;<br>
+       case HPD_PORT_E:<br>
+               *port = PORT_E;<br>
+               return true;<br>
        default:<br>
                return false;   /* no hpd */<br>
        }<br>
--<br>
2.1.4<br>
<br>
_______________________________________________<br>
Intel-gfx mailing list<br>
<a href="mailto:Intel-gfx@lists.freedesktop.org" target="_blank">Intel-gfx@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/intel-gfx" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
</blockquote></div>