Commit 4294fa5f authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Reduce duplicated switch cases in hpd code

With GEN11_HOTPLUG_CTL_LONG_DETECT(), SHOTPLUG_CTL_DDI_HPD_LONG_DETECT()
and ICP_TC_HPD_LONG_DETECT() taking the hpd_pin as their argument
we can remove some duplication in the long_detect() switch statements.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201204182309.14213-1-ville.syrjala@linux.intel.comReviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
parent 7cb917b2
...@@ -1044,17 +1044,12 @@ static bool gen11_port_hotplug_long_detect(enum hpd_pin pin, u32 val) ...@@ -1044,17 +1044,12 @@ static bool gen11_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
{ {
switch (pin) { switch (pin) {
case HPD_PORT_TC1: case HPD_PORT_TC1:
return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC1);
case HPD_PORT_TC2: case HPD_PORT_TC2:
return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC2);
case HPD_PORT_TC3: case HPD_PORT_TC3:
return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC3);
case HPD_PORT_TC4: case HPD_PORT_TC4:
return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC4);
case HPD_PORT_TC5: case HPD_PORT_TC5:
return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC5);
case HPD_PORT_TC6: case HPD_PORT_TC6:
return val & GEN11_HOTPLUG_CTL_LONG_DETECT(HPD_PORT_TC6); return val & GEN11_HOTPLUG_CTL_LONG_DETECT(pin);
default: default:
return false; return false;
} }
...@@ -1078,13 +1073,10 @@ static bool icp_ddi_port_hotplug_long_detect(enum hpd_pin pin, u32 val) ...@@ -1078,13 +1073,10 @@ static bool icp_ddi_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
{ {
switch (pin) { switch (pin) {
case HPD_PORT_A: case HPD_PORT_A:
return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_A);
case HPD_PORT_B: case HPD_PORT_B:
return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_B);
case HPD_PORT_C: case HPD_PORT_C:
return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_C);
case HPD_PORT_D: case HPD_PORT_D:
return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(HPD_PORT_D); return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(pin);
default: default:
return false; return false;
} }
...@@ -1094,17 +1086,12 @@ static bool icp_tc_port_hotplug_long_detect(enum hpd_pin pin, u32 val) ...@@ -1094,17 +1086,12 @@ static bool icp_tc_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
{ {
switch (pin) { switch (pin) {
case HPD_PORT_TC1: case HPD_PORT_TC1:
return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC1);
case HPD_PORT_TC2: case HPD_PORT_TC2:
return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC2);
case HPD_PORT_TC3: case HPD_PORT_TC3:
return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC3);
case HPD_PORT_TC4: case HPD_PORT_TC4:
return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC4);
case HPD_PORT_TC5: case HPD_PORT_TC5:
return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC5);
case HPD_PORT_TC6: case HPD_PORT_TC6:
return val & ICP_TC_HPD_LONG_DETECT(HPD_PORT_TC6); return val & ICP_TC_HPD_LONG_DETECT(pin);
default: default:
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment