Skip to content

Commit e403fc9

Browse files
committed
drm/i915/crt: implement get_hw_state
Note that even though this connector is cloneable we still can use the exact same test to check whether the connector is on or whether the encoder is enabled - both the dpms code and the encoder disable/enable frob the exact same hw state. For dvo/sdvo outputs, this will be different. Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent b1dc332 commit e403fc9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/gpu/drm/i915/intel_crt.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,27 @@ static struct intel_crt *intel_encoder_to_crt(struct intel_encoder *encoder)
6161
return container_of(encoder, struct intel_crt, base);
6262
}
6363

64+
static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
65+
enum pipe *pipe)
66+
{
67+
struct drm_device *dev = encoder->base.dev;
68+
struct drm_i915_private *dev_priv = dev->dev_private;
69+
struct intel_crt *crt = intel_encoder_to_crt(encoder);
70+
u32 tmp;
71+
72+
tmp = I915_READ(crt->adpa_reg);
73+
74+
if (!(tmp & ADPA_DAC_ENABLE))
75+
return false;
76+
77+
if (HAS_PCH_CPT(dev))
78+
*pipe = PORT_TO_PIPE_CPT(tmp);
79+
else
80+
*pipe = PORT_TO_PIPE(tmp);
81+
82+
return true;
83+
}
84+
6485
static void intel_disable_crt(struct intel_encoder *encoder)
6586
{
6687
struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
@@ -710,6 +731,8 @@ void intel_crt_init(struct drm_device *dev)
710731

711732
crt->base.disable = intel_disable_crt;
712733
crt->base.enable = intel_enable_crt;
734+
crt->base.get_hw_state = intel_crt_get_hw_state;
735+
intel_connector->get_hw_state = intel_connector_get_hw_state;
713736

714737
drm_encoder_helper_add(&crt->base.base, &crt_encoder_funcs);
715738
drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);

0 commit comments

Comments
 (0)