static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder,
struct intel_crtc_state *crtc_state)
{
- struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
- enum pipe pipe;
+ struct intel_digital_port *dig_port;
u64 domains;
- if (!intel_ddi_get_hw_state(encoder, &pipe))
- return 0;
-
- domains = BIT_ULL(dig_port->ddi_io_power_domain);
- if (!crtc_state)
- return domains;
-
/*
* TODO: Add support for MST encoders. Atm, the following should never
- * happen since this function will be called only for the primary
- * encoder which doesn't have its own pipe/crtc_state.
+ * happen since fake-MST encoders don't set their get_power_domains()
+ * hook.
*/
if (WARN_ON(intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)))
- return domains;
+ return 0;
+
+ dig_port = enc_to_dig_port(&encoder->base);
+ domains = BIT_ULL(dig_port->ddi_io_power_domain);
/* AUX power is only needed for (e)DP mode, not for HDMI. */
if (intel_crtc_has_dp_encoder(crtc_state)) {
continue;
/*
- * For MST and inactive encoders we don't have a crtc state.
- * FIXME: no need to call get_power_domains in such cases, it
- * will always return 0.
+ * MST-primary and inactive encoders don't have a crtc state
+ * and neither of these require any power domain references.
*/
- crtc_state = encoder->base.crtc ?
- to_intel_crtc_state(encoder->base.crtc->state) :
- NULL;
+ if (!encoder->base.crtc)
+ continue;
+ crtc_state = to_intel_crtc_state(encoder->base.crtc->state);
get_domains = encoder->get_power_domains(encoder, crtc_state);
for_each_power_domain(domain, get_domains)
intel_display_power_get(dev_priv, domain);