drm/i915/ddi: Simplify get_encoder_power_domains()
authorImre Deak <imre.deak@intel.com>
Thu, 5 Jul 2018 12:26:54 +0000 (15:26 +0300)
committerImre Deak <imre.deak@intel.com>
Fri, 6 Jul 2018 12:56:38 +0000 (15:56 +0300)
commitb79ebe74e1c4219e91940b637d40939b0c80c0f2
tree9fb375fd1a38f968877558f74a2f87b2b7dfbd5f
parent6cc42152b02b3f73969934b63332d47e2dac55e4
drm/i915/ddi: Simplify get_encoder_power_domains()

We can simplify the encoder's get_power_domains() hook by calling it
only if the encoder is active. That way the hook can return its power
domains unconditionally without checking the active state by calling
encoder::get_hw_state(). This get_hw_state() query is in fact
redundant since it's already done by intel_modeset_readout_hw_state()
setting the encoder's crtc or leaving it NULL accordingly. Let's use
this fact to decide if the encoder is active.

While at it clarify the comment in intel_ddi_get_power_domains() about
primary vs. fake MST encoders and make sure we never do an incorrect
encoder->dig_port cast for fake MST encoders.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180705122654.17072-1-imre.deak@intel.com
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_display.c