Commit 822cdc52936e026a24c684ccc98850b251c06206
Committed by
Daniel Vetter
1 parent
4d10cc0f86
Exists in
master
and in
13 other branches
drm/i915: Convert DIP port switch cases to a simple macro
We have a couple of switch cases to compute the port value for the VIDEO_DIP_CTL register. Replace them with a simple macro. We do lose a few BUG() calls, but many people may consider that an improvement. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Showing 2 changed files with 3 additions and 32 deletions Side-by-side Diff
drivers/gpu/drm/i915/i915_reg.h
... | ... | @@ -2347,9 +2347,7 @@ |
2347 | 2347 | #define VIDEO_DIP_CTL 0x61170 |
2348 | 2348 | /* Pre HSW: */ |
2349 | 2349 | #define VIDEO_DIP_ENABLE (1 << 31) |
2350 | -#define VIDEO_DIP_PORT_B (1 << 29) | |
2351 | -#define VIDEO_DIP_PORT_C (2 << 29) | |
2352 | -#define VIDEO_DIP_PORT_D (3 << 29) | |
2350 | +#define VIDEO_DIP_PORT(port) ((port) << 29) | |
2353 | 2351 | #define VIDEO_DIP_PORT_MASK (3 << 29) |
2354 | 2352 | #define VIDEO_DIP_ENABLE_GCP (1 << 25) |
2355 | 2353 | #define VIDEO_DIP_ENABLE_AVI (1 << 21) |
drivers/gpu/drm/i915/intel_hdmi.c
... | ... | @@ -425,7 +425,7 @@ |
425 | 425 | struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; |
426 | 426 | u32 reg = VIDEO_DIP_CTL; |
427 | 427 | u32 val = I915_READ(reg); |
428 | - u32 port; | |
428 | + u32 port = VIDEO_DIP_PORT(intel_dig_port->port); | |
429 | 429 | |
430 | 430 | assert_hdmi_port_disabled(intel_hdmi); |
431 | 431 | |
... | ... | @@ -449,18 +449,6 @@ |
449 | 449 | return; |
450 | 450 | } |
451 | 451 | |
452 | - switch (intel_dig_port->port) { | |
453 | - case PORT_B: | |
454 | - port = VIDEO_DIP_PORT_B; | |
455 | - break; | |
456 | - case PORT_C: | |
457 | - port = VIDEO_DIP_PORT_C; | |
458 | - break; | |
459 | - default: | |
460 | - BUG(); | |
461 | - return; | |
462 | - } | |
463 | - | |
464 | 452 | if (port != (val & VIDEO_DIP_PORT_MASK)) { |
465 | 453 | if (val & VIDEO_DIP_ENABLE) { |
466 | 454 | val &= ~VIDEO_DIP_ENABLE; |
... | ... | @@ -491,7 +479,7 @@ |
491 | 479 | struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; |
492 | 480 | u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
493 | 481 | u32 val = I915_READ(reg); |
494 | - u32 port; | |
482 | + u32 port = VIDEO_DIP_PORT(intel_dig_port->port); | |
495 | 483 | |
496 | 484 | assert_hdmi_port_disabled(intel_hdmi); |
497 | 485 | |
... | ... | @@ -504,21 +492,6 @@ |
504 | 492 | val &= ~VIDEO_DIP_ENABLE; |
505 | 493 | I915_WRITE(reg, val); |
506 | 494 | POSTING_READ(reg); |
507 | - return; | |
508 | - } | |
509 | - | |
510 | - switch (intel_dig_port->port) { | |
511 | - case PORT_B: | |
512 | - port = VIDEO_DIP_PORT_B; | |
513 | - break; | |
514 | - case PORT_C: | |
515 | - port = VIDEO_DIP_PORT_C; | |
516 | - break; | |
517 | - case PORT_D: | |
518 | - port = VIDEO_DIP_PORT_D; | |
519 | - break; | |
520 | - default: | |
521 | - BUG(); | |
522 | 495 | return; |
523 | 496 | } |
524 | 497 |