@@ -628,6 +628,14 @@ static bool intel_sdvo_set_active_outputs(struct intel_sdvo *intel_sdvo,
628
628
& outputs , sizeof (outputs ));
629
629
}
630
630
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
+
631
639
static bool intel_sdvo_set_encoder_power_state (struct intel_sdvo * intel_sdvo ,
632
640
int mode )
633
641
{
@@ -1142,6 +1150,42 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1142
1150
intel_sdvo_write_sdvox (intel_sdvo , sdvox );
1143
1151
}
1144
1152
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
+
1145
1189
static void intel_disable_sdvo (struct intel_encoder * encoder )
1146
1190
{
1147
1191
struct drm_i915_private * dev_priv = encoder -> base .dev -> dev_private ;
@@ -2066,6 +2110,7 @@ intel_sdvo_connector_init(struct intel_sdvo_connector *connector,
2066
2110
connector -> base .base .interlace_allowed = 1 ;
2067
2111
connector -> base .base .doublescan_allowed = 0 ;
2068
2112
connector -> base .base .display_info .subpixel_order = SubPixelHorizontalRGB ;
2113
+ connector -> base .get_hw_state = intel_sdvo_connector_get_hw_state ;
2069
2114
2070
2115
intel_connector_attach_encoder (& connector -> base , & encoder -> base );
2071
2116
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)
2619
2664
2620
2665
intel_encoder -> disable = intel_disable_sdvo ;
2621
2666
intel_encoder -> enable = intel_enable_sdvo ;
2667
+ intel_encoder -> get_hw_state = intel_sdvo_get_hw_state ;
2622
2668
2623
2669
/* In default case sdvo lvds is false */
2624
2670
if (!intel_sdvo_get_capabilities (intel_sdvo , & intel_sdvo -> caps ))
0 commit comments