drm/i915: unify HDMI/DP hpd definitions
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/i915/i915_irq.c | 36 ++++++++++++++++++------------------ drivers/gpu/drm/i915/i915_reg.h | 28 +++++++++------------------- drivers/gpu/drm/i915/intel_dp.c | 12 ++++++------ drivers/gpu/drm/i915/intel_hdmi.c | 10 +++++----- 4 files changed, 38 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +18 -18
@@ -2137,12 +2137,12 @@ static void valleyview_hpd_irq_setup(struct drm_device *dev)u32 hotplug_en =I915_READ (PORT_HOTPLUG_EN );/* Note HDMI and DP share bits */ -if (dev_priv->hotplug_supported_mask &HDMIB_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIB_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMIC_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMID_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTB_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTB_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTC_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTD_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTD_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_I915 ) hotplug_en |=SDVOC_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_I915 )
@@ -2408,12 +2408,12 @@ static void i915_hpd_irq_setup(struct drm_device *dev)if (I915_HAS_HOTPLUG (dev)) { hotplug_en =I915_READ (PORT_HOTPLUG_EN ); -if (dev_priv->hotplug_supported_mask &HDMIB_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIB_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMIC_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMID_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTB_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTB_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTC_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTD_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTD_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_I915 ) hotplug_en |=SDVOC_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_I915 )
@@ -2642,12 +2642,12 @@ static void i965_hpd_irq_setup(struct drm_device *dev)/* Note HDMI and DP share hotplug bits */ hotplug_en =0 ; -if (dev_priv->hotplug_supported_mask &HDMIB_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIB_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMIC_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMID_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTB_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTB_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTC_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTD_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTD_HOTPLUG_INT_EN ;if (IS_G4X (dev)) {if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_G4X ) hotplug_en |=SDVOC_HOTPLUG_INT_EN ;
drivers/gpu/drm/i915/i915_reg.h +9 -19
@@ -1625,12 +1625,9 @@/* Hotplug control (945+ only) */ #define PORT_HOTPLUG_EN (dev_priv->info->display_mmio_offset + 0x61110) -#define HDMIB_HOTPLUG_INT_EN (1 << 29) -#define DPB_HOTPLUG_INT_EN (1 << 29) -#define HDMIC_HOTPLUG_INT_EN (1 << 28) -#define DPC_HOTPLUG_INT_EN (1 << 28) -#define HDMID_HOTPLUG_INT_EN (1 << 27) -#define DPD_HOTPLUG_INT_EN (1 << 27) +#define PORTB_HOTPLUG_INT_EN (1 << 29) +#define PORTC_HOTPLUG_INT_EN (1 << 28) +#define PORTD_HOTPLUG_INT_EN (1 << 27)#define SDVOB_HOTPLUG_INT_EN (1 << 26)#define SDVOC_HOTPLUG_INT_EN (1 << 25)#define TV_HOTPLUG_INT_EN (1 << 18)
@@ -1653,19 +1650,12 @@#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114)/* HDMI/DP bits are gen4+ */ -#define DPB_HOTPLUG_LIVE_STATUS (1 << 29) -#define DPC_HOTPLUG_LIVE_STATUS (1 << 28) -#define DPD_HOTPLUG_LIVE_STATUS (1 << 27) -#define DPD_HOTPLUG_INT_STATUS (3 << 21) -#define DPC_HOTPLUG_INT_STATUS (3 << 19) -#define DPB_HOTPLUG_INT_STATUS (3 << 17) -/* HDMI bits are shared with the DP bits */ -#define HDMIB_HOTPLUG_LIVE_STATUS (1 << 29) -#define HDMIC_HOTPLUG_LIVE_STATUS (1 << 28) -#define HDMID_HOTPLUG_LIVE_STATUS (1 << 27) -#define HDMID_HOTPLUG_INT_STATUS (3 << 21) -#define HDMIC_HOTPLUG_INT_STATUS (3 << 19) -#define HDMIB_HOTPLUG_INT_STATUS (3 << 17) +#define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) +#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) +#define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) +#define PORTD_HOTPLUG_INT_STATUS (3 << 21) +#define PORTC_HOTPLUG_INT_STATUS (3 << 19) +#define PORTB_HOTPLUG_INT_STATUS (3 << 17)/* CRT/TV common between gen3+ */ #define CRT_HOTPLUG_INT_STATUS (1 << 11)#define TV_HOTPLUG_INT_STATUS (1 << 10)
drivers/gpu/drm/i915/intel_dp.c +6 -6
@@ -2302,13 +2302,13 @@ g4x_dp_detect(struct intel_dp *intel_dp)switch (intel_dig_port->port) {case PORT_B : - bit =DPB_HOTPLUG_LIVE_STATUS ; + bit =PORTB_HOTPLUG_LIVE_STATUS ;break ;case PORT_C : - bit =DPC_HOTPLUG_LIVE_STATUS ; + bit =PORTC_HOTPLUG_LIVE_STATUS ;break ;case PORT_D : - bit =DPD_HOTPLUG_LIVE_STATUS ; + bit =PORTD_HOTPLUG_LIVE_STATUS ;break ;default :return connector_status_unknown;
@@ -2838,15 +2838,15 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, name ="DPDDC-A" ;break ;case PORT_B : - dev_priv->hotplug_supported_mask |=DPB_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTB_HOTPLUG_INT_STATUS ; name ="DPDDC-B" ;break ;case PORT_C : - dev_priv->hotplug_supported_mask |=DPC_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTC_HOTPLUG_INT_STATUS ; name ="DPDDC-C" ;break ;case PORT_D : - dev_priv->hotplug_supported_mask |=DPD_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTD_HOTPLUG_INT_STATUS ; name ="DPDDC-D" ;break ;default :
drivers/gpu/drm/i915/intel_hdmi.c +5 -5
@@ -802,10 +802,10 @@ static bool g4x_hdmi_connected(struct intel_hdmi *intel_hdmi)switch (intel_dig_port->port) {case PORT_B : - bit =HDMIB_HOTPLUG_LIVE_STATUS ; + bit =PORTB_HOTPLUG_LIVE_STATUS ;break ;case PORT_C : - bit =HDMIC_HOTPLUG_LIVE_STATUS ; + bit =PORTC_HOTPLUG_LIVE_STATUS ;break ;default : bit =0 ;
@@ -1022,15 +1022,15 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,switch (port) {case PORT_B : intel_hdmi->ddc_bus =GMBUS_PORT_DPB ; - dev_priv->hotplug_supported_mask |=HDMIB_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTB_HOTPLUG_INT_STATUS ;break ;case PORT_C : intel_hdmi->ddc_bus =GMBUS_PORT_DPC ; - dev_priv->hotplug_supported_mask |=HDMIC_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTC_HOTPLUG_INT_STATUS ;break ;case PORT_D : intel_hdmi->ddc_bus =GMBUS_PORT_DPD ; - dev_priv->hotplug_supported_mask |=HDMID_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTD_HOTPLUG_INT_STATUS ;break ;case PORT_A :/* Internal port only for eDP. */
Signature · 1 line
1.7.10.4
2013/2/7 Daniel Vetter <[email protected]>:
Quoted 6 lines
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.
Signed-off-by Daniel Vetter <[email protected]>
Quoted 197 lines
--- drivers/gpu/drm/i915/i915_irq.c | 36 ++++++++++++++++++------------------ drivers/gpu/drm/i915/i915_reg.h | 28 +++++++++------------------- drivers/gpu/drm/i915/intel_dp.c | 12 ++++++------ drivers/gpu/drm/i915/intel_hdmi.c | 10 +++++----- 4 files changed, 38 insertions(+), 48 deletions(-)drivers/gpu/drm/i915/i915_irq.c +18
-18@@ -2137,12 +2137,12 @@ static void valleyview_hpd_irq_setup(struct drm_device *dev)u32 hotplug_en =I915_READ (PORT_HOTPLUG_EN );/* Note HDMI and DP share bits */ -if (dev_priv->hotplug_supported_mask &HDMIB_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIB_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMIC_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMID_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTB_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTB_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTC_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTD_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTD_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_I915 ) hotplug_en |=SDVOC_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_I915 )@@ -2408,12 +2408,12 @@ static void i915_hpd_irq_setup(struct drm_device *dev)if (I915_HAS_HOTPLUG (dev)) { hotplug_en =I915_READ (PORT_HOTPLUG_EN ); -if (dev_priv->hotplug_supported_mask &HDMIB_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIB_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMIC_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMID_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTB_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTB_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTC_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTD_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTD_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_I915 ) hotplug_en |=SDVOC_HOTPLUG_INT_EN ;if (dev_priv->hotplug_supported_mask &SDVOB_HOTPLUG_INT_STATUS_I915 )@@ -2642,12 +2642,12 @@ static void i965_hpd_irq_setup(struct drm_device *dev)/* Note HDMI and DP share hotplug bits */ hotplug_en =0 ; -if (dev_priv->hotplug_supported_mask &HDMIB_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIB_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMIC_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMIC_HOTPLUG_INT_EN ; -if (dev_priv->hotplug_supported_mask &HDMID_HOTPLUG_INT_STATUS ) - hotplug_en |=HDMID_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTB_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTB_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTC_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTC_HOTPLUG_INT_EN ; +if (dev_priv->hotplug_supported_mask &PORTD_HOTPLUG_INT_STATUS ) + hotplug_en |=PORTD_HOTPLUG_INT_EN ;if (IS_G4X (dev)) {if (dev_priv->hotplug_supported_mask &SDVOC_HOTPLUG_INT_STATUS_G4X ) hotplug_en |=SDVOC_HOTPLUG_INT_EN ;drivers/gpu/drm/i915/i915_reg.h +9
-19@@ -1625,12 +1625,9 @@/* Hotplug control (945+ only) */ #define PORT_HOTPLUG_EN (dev_priv->info->display_mmio_offset + 0x61110) -#define HDMIB_HOTPLUG_INT_EN (1 << 29) -#define DPB_HOTPLUG_INT_EN (1 << 29) -#define HDMIC_HOTPLUG_INT_EN (1 << 28) -#define DPC_HOTPLUG_INT_EN (1 << 28) -#define HDMID_HOTPLUG_INT_EN (1 << 27) -#define DPD_HOTPLUG_INT_EN (1 << 27) +#define PORTB_HOTPLUG_INT_EN (1 << 29) +#define PORTC_HOTPLUG_INT_EN (1 << 28) +#define PORTD_HOTPLUG_INT_EN (1 << 27)#define SDVOB_HOTPLUG_INT_EN (1 << 26)#define SDVOC_HOTPLUG_INT_EN (1 << 25)#define TV_HOTPLUG_INT_EN (1 << 18)@@ -1653,19 +1650,12 @@#define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114)/* HDMI/DP bits are gen4+ */ -#define DPB_HOTPLUG_LIVE_STATUS (1 << 29) -#define DPC_HOTPLUG_LIVE_STATUS (1 << 28) -#define DPD_HOTPLUG_LIVE_STATUS (1 << 27) -#define DPD_HOTPLUG_INT_STATUS (3 << 21) -#define DPC_HOTPLUG_INT_STATUS (3 << 19) -#define DPB_HOTPLUG_INT_STATUS (3 << 17) -/* HDMI bits are shared with the DP bits */ -#define HDMIB_HOTPLUG_LIVE_STATUS (1 << 29) -#define HDMIC_HOTPLUG_LIVE_STATUS (1 << 28) -#define HDMID_HOTPLUG_LIVE_STATUS (1 << 27) -#define HDMID_HOTPLUG_INT_STATUS (3 << 21) -#define HDMIC_HOTPLUG_INT_STATUS (3 << 19) -#define HDMIB_HOTPLUG_INT_STATUS (3 << 17) +#define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) +#define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) +#define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) +#define PORTD_HOTPLUG_INT_STATUS (3 << 21) +#define PORTC_HOTPLUG_INT_STATUS (3 << 19) +#define PORTB_HOTPLUG_INT_STATUS (3 << 17)/* CRT/TV common between gen3+ */ #define CRT_HOTPLUG_INT_STATUS (1 << 11)#define TV_HOTPLUG_INT_STATUS (1 << 10)drivers/gpu/drm/i915/intel_dp.c +6
-6@@ -2302,13 +2302,13 @@ g4x_dp_detect(struct intel_dp *intel_dp)switch (intel_dig_port->port) {case PORT_B : - bit =DPB_HOTPLUG_LIVE_STATUS ; + bit =PORTB_HOTPLUG_LIVE_STATUS ;break ;case PORT_C : - bit =DPC_HOTPLUG_LIVE_STATUS ; + bit =PORTC_HOTPLUG_LIVE_STATUS ;break ;case PORT_D : - bit =DPD_HOTPLUG_LIVE_STATUS ; + bit =PORTD_HOTPLUG_LIVE_STATUS ;break ;default :return connector_status_unknown;@@ -2838,15 +2838,15 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, name ="DPDDC-A" ;break ;case PORT_B : - dev_priv->hotplug_supported_mask |=DPB_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTB_HOTPLUG_INT_STATUS ; name ="DPDDC-B" ;break ;case PORT_C : - dev_priv->hotplug_supported_mask |=DPC_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTC_HOTPLUG_INT_STATUS ; name ="DPDDC-C" ;break ;case PORT_D : - dev_priv->hotplug_supported_mask |=DPD_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTD_HOTPLUG_INT_STATUS ; name ="DPDDC-D" ;break ;default :drivers/gpu/drm/i915/intel_hdmi.c +5
-6@@ -802,10 +802,10 @@ static bool g4x_hdmi_connected(struct intel_hdmi *intel_hdmi)switch (intel_dig_port->port) {case PORT_B : - bit =HDMIB_HOTPLUG_LIVE_STATUS ; + bit =PORTB_HOTPLUG_LIVE_STATUS ;break ;case PORT_C : - bit =HDMIC_HOTPLUG_LIVE_STATUS ; + bit =PORTC_HOTPLUG_LIVE_STATUS ;break ;default : bit =0 ;@@ -1022,15 +1022,15 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,switch (port) {case PORT_B : intel_hdmi->ddc_bus =GMBUS_PORT_DPB ; - dev_priv->hotplug_supported_mask |=HDMIB_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTB_HOTPLUG_INT_STATUS ;break ;case PORT_C : intel_hdmi->ddc_bus =GMBUS_PORT_DPC ; - dev_priv->hotplug_supported_mask |=HDMIC_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTC_HOTPLUG_INT_STATUS ;break ;case PORT_D : intel_hdmi->ddc_bus =GMBUS_PORT_DPD ; - dev_priv->hotplug_supported_mask |=HDMID_HOTPLUG_INT_STATUS ; + dev_priv->hotplug_supported_mask |=PORTD_HOTPLUG_INT_STATUS ;break ;case PORT_A :/* Internal port only for eDP. */ --1.7.10.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni
Daniel Vetter
AppliedQuoted 9 lines · Paulo Zanoni
2013/2/7 Daniel Vetter <[email protected]>:
Quoted 6 lines
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.
Signed-off-by Daniel Vetter <[email protected]>Reviewed-by Paulo Zanoni <[email protected]>
Queued for -next, thanks for the review.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch