Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: unify HDMI/DP hpd definitions

They're physically the same pins and also the same bits, duplicating
only confuses the reader. This also makes it a bit obvious that we
have quite some code duplication going on here. Squashing that is for
a larger rework in our hpd handling though.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+38 -48
+18 -18
drivers/gpu/drm/i915/i915_irq.c
··· 2137 2137 u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN); 2138 2138 2139 2139 /* Note HDMI and DP share bits */ 2140 - if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS) 2141 - hotplug_en |= HDMIB_HOTPLUG_INT_EN; 2142 - if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS) 2143 - hotplug_en |= HDMIC_HOTPLUG_INT_EN; 2144 - if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS) 2145 - hotplug_en |= HDMID_HOTPLUG_INT_EN; 2140 + if (dev_priv->hotplug_supported_mask & PORTB_HOTPLUG_INT_STATUS) 2141 + hotplug_en |= PORTB_HOTPLUG_INT_EN; 2142 + if (dev_priv->hotplug_supported_mask & PORTC_HOTPLUG_INT_STATUS) 2143 + hotplug_en |= PORTC_HOTPLUG_INT_EN; 2144 + if (dev_priv->hotplug_supported_mask & PORTD_HOTPLUG_INT_STATUS) 2145 + hotplug_en |= PORTD_HOTPLUG_INT_EN; 2146 2146 if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_I915) 2147 2147 hotplug_en |= SDVOC_HOTPLUG_INT_EN; 2148 2148 if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_I915) ··· 2408 2408 if (I915_HAS_HOTPLUG(dev)) { 2409 2409 hotplug_en = I915_READ(PORT_HOTPLUG_EN); 2410 2410 2411 - if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS) 2412 - hotplug_en |= HDMIB_HOTPLUG_INT_EN; 2413 - if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS) 2414 - hotplug_en |= HDMIC_HOTPLUG_INT_EN; 2415 - if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS) 2416 - hotplug_en |= HDMID_HOTPLUG_INT_EN; 2411 + if (dev_priv->hotplug_supported_mask & PORTB_HOTPLUG_INT_STATUS) 2412 + hotplug_en |= PORTB_HOTPLUG_INT_EN; 2413 + if (dev_priv->hotplug_supported_mask & PORTC_HOTPLUG_INT_STATUS) 2414 + hotplug_en |= PORTC_HOTPLUG_INT_EN; 2415 + if (dev_priv->hotplug_supported_mask & PORTD_HOTPLUG_INT_STATUS) 2416 + hotplug_en |= PORTD_HOTPLUG_INT_EN; 2417 2417 if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_I915) 2418 2418 hotplug_en |= SDVOC_HOTPLUG_INT_EN; 2419 2419 if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_I915) ··· 2642 2642 2643 2643 /* Note HDMI and DP share hotplug bits */ 2644 2644 hotplug_en = 0; 2645 - if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS) 2646 - hotplug_en |= HDMIB_HOTPLUG_INT_EN; 2647 - if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS) 2648 - hotplug_en |= HDMIC_HOTPLUG_INT_EN; 2649 - if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS) 2650 - hotplug_en |= HDMID_HOTPLUG_INT_EN; 2645 + if (dev_priv->hotplug_supported_mask & PORTB_HOTPLUG_INT_STATUS) 2646 + hotplug_en |= PORTB_HOTPLUG_INT_EN; 2647 + if (dev_priv->hotplug_supported_mask & PORTC_HOTPLUG_INT_STATUS) 2648 + hotplug_en |= PORTC_HOTPLUG_INT_EN; 2649 + if (dev_priv->hotplug_supported_mask & PORTD_HOTPLUG_INT_STATUS) 2650 + hotplug_en |= PORTD_HOTPLUG_INT_EN; 2651 2651 if (IS_G4X(dev)) { 2652 2652 if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_G4X) 2653 2653 hotplug_en |= SDVOC_HOTPLUG_INT_EN;
+9 -19
drivers/gpu/drm/i915/i915_reg.h
··· 1625 1625 1626 1626 /* Hotplug control (945+ only) */ 1627 1627 #define PORT_HOTPLUG_EN (dev_priv->info->display_mmio_offset + 0x61110) 1628 - #define HDMIB_HOTPLUG_INT_EN (1 << 29) 1629 - #define DPB_HOTPLUG_INT_EN (1 << 29) 1630 - #define HDMIC_HOTPLUG_INT_EN (1 << 28) 1631 - #define DPC_HOTPLUG_INT_EN (1 << 28) 1632 - #define HDMID_HOTPLUG_INT_EN (1 << 27) 1633 - #define DPD_HOTPLUG_INT_EN (1 << 27) 1628 + #define PORTB_HOTPLUG_INT_EN (1 << 29) 1629 + #define PORTC_HOTPLUG_INT_EN (1 << 28) 1630 + #define PORTD_HOTPLUG_INT_EN (1 << 27) 1634 1631 #define SDVOB_HOTPLUG_INT_EN (1 << 26) 1635 1632 #define SDVOC_HOTPLUG_INT_EN (1 << 25) 1636 1633 #define TV_HOTPLUG_INT_EN (1 << 18) ··· 1650 1653 1651 1654 #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) 1652 1655 /* HDMI/DP bits are gen4+ */ 1653 - #define DPB_HOTPLUG_LIVE_STATUS (1 << 29) 1654 - #define DPC_HOTPLUG_LIVE_STATUS (1 << 28) 1655 - #define DPD_HOTPLUG_LIVE_STATUS (1 << 27) 1656 - #define DPD_HOTPLUG_INT_STATUS (3 << 21) 1657 - #define DPC_HOTPLUG_INT_STATUS (3 << 19) 1658 - #define DPB_HOTPLUG_INT_STATUS (3 << 17) 1659 - /* HDMI bits are shared with the DP bits */ 1660 - #define HDMIB_HOTPLUG_LIVE_STATUS (1 << 29) 1661 - #define HDMIC_HOTPLUG_LIVE_STATUS (1 << 28) 1662 - #define HDMID_HOTPLUG_LIVE_STATUS (1 << 27) 1663 - #define HDMID_HOTPLUG_INT_STATUS (3 << 21) 1664 - #define HDMIC_HOTPLUG_INT_STATUS (3 << 19) 1665 - #define HDMIB_HOTPLUG_INT_STATUS (3 << 17) 1656 + #define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) 1657 + #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) 1658 + #define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) 1659 + #define PORTD_HOTPLUG_INT_STATUS (3 << 21) 1660 + #define PORTC_HOTPLUG_INT_STATUS (3 << 19) 1661 + #define PORTB_HOTPLUG_INT_STATUS (3 << 17) 1666 1662 /* CRT/TV common between gen3+ */ 1667 1663 #define CRT_HOTPLUG_INT_STATUS (1 << 11) 1668 1664 #define TV_HOTPLUG_INT_STATUS (1 << 10)
+6 -6
drivers/gpu/drm/i915/intel_dp.c
··· 2302 2302 2303 2303 switch (intel_dig_port->port) { 2304 2304 case PORT_B: 2305 - bit = DPB_HOTPLUG_LIVE_STATUS; 2305 + bit = PORTB_HOTPLUG_LIVE_STATUS; 2306 2306 break; 2307 2307 case PORT_C: 2308 - bit = DPC_HOTPLUG_LIVE_STATUS; 2308 + bit = PORTC_HOTPLUG_LIVE_STATUS; 2309 2309 break; 2310 2310 case PORT_D: 2311 - bit = DPD_HOTPLUG_LIVE_STATUS; 2311 + bit = PORTD_HOTPLUG_LIVE_STATUS; 2312 2312 break; 2313 2313 default: 2314 2314 return connector_status_unknown; ··· 2838 2838 name = "DPDDC-A"; 2839 2839 break; 2840 2840 case PORT_B: 2841 - dev_priv->hotplug_supported_mask |= DPB_HOTPLUG_INT_STATUS; 2841 + dev_priv->hotplug_supported_mask |= PORTB_HOTPLUG_INT_STATUS; 2842 2842 name = "DPDDC-B"; 2843 2843 break; 2844 2844 case PORT_C: 2845 - dev_priv->hotplug_supported_mask |= DPC_HOTPLUG_INT_STATUS; 2845 + dev_priv->hotplug_supported_mask |= PORTC_HOTPLUG_INT_STATUS; 2846 2846 name = "DPDDC-C"; 2847 2847 break; 2848 2848 case PORT_D: 2849 - dev_priv->hotplug_supported_mask |= DPD_HOTPLUG_INT_STATUS; 2849 + dev_priv->hotplug_supported_mask |= PORTD_HOTPLUG_INT_STATUS; 2850 2850 name = "DPDDC-D"; 2851 2851 break; 2852 2852 default:
+5 -5
drivers/gpu/drm/i915/intel_hdmi.c
··· 802 802 803 803 switch (intel_dig_port->port) { 804 804 case PORT_B: 805 - bit = HDMIB_HOTPLUG_LIVE_STATUS; 805 + bit = PORTB_HOTPLUG_LIVE_STATUS; 806 806 break; 807 807 case PORT_C: 808 - bit = HDMIC_HOTPLUG_LIVE_STATUS; 808 + bit = PORTC_HOTPLUG_LIVE_STATUS; 809 809 break; 810 810 default: 811 811 bit = 0; ··· 1022 1022 switch (port) { 1023 1023 case PORT_B: 1024 1024 intel_hdmi->ddc_bus = GMBUS_PORT_DPB; 1025 - dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; 1025 + dev_priv->hotplug_supported_mask |= PORTB_HOTPLUG_INT_STATUS; 1026 1026 break; 1027 1027 case PORT_C: 1028 1028 intel_hdmi->ddc_bus = GMBUS_PORT_DPC; 1029 - dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; 1029 + dev_priv->hotplug_supported_mask |= PORTC_HOTPLUG_INT_STATUS; 1030 1030 break; 1031 1031 case PORT_D: 1032 1032 intel_hdmi->ddc_bus = GMBUS_PORT_DPD; 1033 - dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; 1033 + dev_priv->hotplug_supported_mask |= PORTD_HOTPLUG_INT_STATUS; 1034 1034 break; 1035 1035 case PORT_A: 1036 1036 /* Internal port only for eDP. */