Skip to content

Commit 4ac41f4

Browse files
committed
drm/i915/sdvo: implement get_hw_state
SDVO is the first real special case - we support multiple outputs on the same encoder and the encoder dpms state isn't the same as when just disabling the outputs when the encoder is cloned. Hence we need a real connector get_hw_state function which inquires the sdvo encoder about its active outputs. Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent e403fc9 commit 4ac41f4

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

drivers/gpu/drm/i915/intel_sdvo.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,14 @@ static bool intel_sdvo_set_active_outputs(struct intel_sdvo *intel_sdvo,
628628
&outputs, sizeof(outputs));
629629
}
630630

631+
static bool intel_sdvo_get_active_outputs(struct intel_sdvo *intel_sdvo,
632+
u16 *outputs)
633+
{
634+
return intel_sdvo_get_value(intel_sdvo,
635+
SDVO_CMD_GET_ACTIVE_OUTPUTS,
636+
outputs, sizeof(*outputs));
637+
}
638+
631639
static bool intel_sdvo_set_encoder_power_state(struct intel_sdvo *intel_sdvo,
632640
int mode)
633641
{
@@ -1142,6 +1150,42 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
11421150
intel_sdvo_write_sdvox(intel_sdvo, sdvox);
11431151
}
11441152

1153+
static bool intel_sdvo_connector_get_hw_state(struct intel_connector *connector)
1154+
{
1155+
struct intel_sdvo_connector *intel_sdvo_connector =
1156+
to_intel_sdvo_connector(&connector->base);
1157+
struct intel_sdvo *intel_sdvo = intel_attached_sdvo(&connector->base);
1158+
u16 active_outputs;
1159+
1160+
intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
1161+
1162+
if (active_outputs & intel_sdvo_connector->output_flag)
1163+
return true;
1164+
else
1165+
return false;
1166+
}
1167+
1168+
static bool intel_sdvo_get_hw_state(struct intel_encoder *encoder,
1169+
enum pipe *pipe)
1170+
{
1171+
struct drm_device *dev = encoder->base.dev;
1172+
struct drm_i915_private *dev_priv = dev->dev_private;
1173+
struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base);
1174+
u32 tmp;
1175+
1176+
tmp = I915_READ(intel_sdvo->sdvo_reg);
1177+
1178+
if (!(tmp & SDVO_ENABLE))
1179+
return false;
1180+
1181+
if (HAS_PCH_CPT(dev))
1182+
*pipe = PORT_TO_PIPE_CPT(tmp);
1183+
else
1184+
*pipe = PORT_TO_PIPE(tmp);
1185+
1186+
return true;
1187+
}
1188+
11451189
static void intel_disable_sdvo(struct intel_encoder *encoder)
11461190
{
11471191
struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
@@ -2066,6 +2110,7 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
20662110
connector->base.base.interlace_allowed = 1;
20672111
connector->base.base.doublescan_allowed = 0;
20682112
connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB;
2113+
connector->base.get_hw_state = intel_sdvo_connector_get_hw_state;
20692114

20702115
intel_connector_attach_encoder(&connector->base, &encoder->base);
20712116
drm_sysfs_connector_add(&connector->base.base);
@@ -2619,6 +2664,7 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
26192664

26202665
intel_encoder->disable = intel_disable_sdvo;
26212666
intel_encoder->enable = intel_enable_sdvo;
2667+
intel_encoder->get_hw_state = intel_sdvo_get_hw_state;
26222668

26232669
/* In default case sdvo lvds is false */
26242670
if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps))

0 commit comments

Comments
 (0)