diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_connectors.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_connectors.c | 66 |
1 files changed, 18 insertions, 48 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 8137b7a34696..c667c43f1c1f 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -216,7 +216,6 @@ radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_c | |||
216 | struct drm_encoder *best_encoder = NULL; | 216 | struct drm_encoder *best_encoder = NULL; |
217 | struct drm_encoder *encoder = NULL; | 217 | struct drm_encoder *encoder = NULL; |
218 | struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; | 218 | struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; |
219 | struct drm_mode_object *obj; | ||
220 | bool connected; | 219 | bool connected; |
221 | int i; | 220 | int i; |
222 | 221 | ||
@@ -226,14 +225,11 @@ radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_c | |||
226 | if (connector->encoder_ids[i] == 0) | 225 | if (connector->encoder_ids[i] == 0) |
227 | break; | 226 | break; |
228 | 227 | ||
229 | obj = drm_mode_object_find(connector->dev, | 228 | encoder = drm_encoder_find(connector->dev, |
230 | connector->encoder_ids[i], | 229 | connector->encoder_ids[i]); |
231 | DRM_MODE_OBJECT_ENCODER); | 230 | if (!encoder) |
232 | if (!obj) | ||
233 | continue; | 231 | continue; |
234 | 232 | ||
235 | encoder = obj_to_encoder(obj); | ||
236 | |||
237 | if ((encoder == best_encoder) && (status == connector_status_connected)) | 233 | if ((encoder == best_encoder) && (status == connector_status_connected)) |
238 | connected = true; | 234 | connected = true; |
239 | else | 235 | else |
@@ -249,7 +245,6 @@ radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_c | |||
249 | 245 | ||
250 | static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, int encoder_type) | 246 | static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, int encoder_type) |
251 | { | 247 | { |
252 | struct drm_mode_object *obj; | ||
253 | struct drm_encoder *encoder; | 248 | struct drm_encoder *encoder; |
254 | int i; | 249 | int i; |
255 | 250 | ||
@@ -257,11 +252,10 @@ static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, | |||
257 | if (connector->encoder_ids[i] == 0) | 252 | if (connector->encoder_ids[i] == 0) |
258 | break; | 253 | break; |
259 | 254 | ||
260 | obj = drm_mode_object_find(connector->dev, connector->encoder_ids[i], DRM_MODE_OBJECT_ENCODER); | 255 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); |
261 | if (!obj) | 256 | if (!encoder) |
262 | continue; | 257 | continue; |
263 | 258 | ||
264 | encoder = obj_to_encoder(obj); | ||
265 | if (encoder->encoder_type == encoder_type) | 259 | if (encoder->encoder_type == encoder_type) |
266 | return encoder; | 260 | return encoder; |
267 | } | 261 | } |
@@ -271,17 +265,9 @@ static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, | |||
271 | static struct drm_encoder *radeon_best_single_encoder(struct drm_connector *connector) | 265 | static struct drm_encoder *radeon_best_single_encoder(struct drm_connector *connector) |
272 | { | 266 | { |
273 | int enc_id = connector->encoder_ids[0]; | 267 | int enc_id = connector->encoder_ids[0]; |
274 | struct drm_mode_object *obj; | ||
275 | struct drm_encoder *encoder; | ||
276 | |||
277 | /* pick the encoder ids */ | 268 | /* pick the encoder ids */ |
278 | if (enc_id) { | 269 | if (enc_id) |
279 | obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER); | 270 | return drm_encoder_find(connector->dev, enc_id); |
280 | if (!obj) | ||
281 | return NULL; | ||
282 | encoder = obj_to_encoder(obj); | ||
283 | return encoder; | ||
284 | } | ||
285 | return NULL; | 271 | return NULL; |
286 | } | 272 | } |
287 | 273 | ||
@@ -1048,7 +1034,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1048 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1034 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1049 | struct drm_encoder *encoder = NULL; | 1035 | struct drm_encoder *encoder = NULL; |
1050 | struct drm_encoder_helper_funcs *encoder_funcs; | 1036 | struct drm_encoder_helper_funcs *encoder_funcs; |
1051 | struct drm_mode_object *obj; | ||
1052 | int i, r; | 1037 | int i, r; |
1053 | enum drm_connector_status ret = connector_status_disconnected; | 1038 | enum drm_connector_status ret = connector_status_disconnected; |
1054 | bool dret = false, broken_edid = false; | 1039 | bool dret = false, broken_edid = false; |
@@ -1153,14 +1138,11 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1153 | if (connector->encoder_ids[i] == 0) | 1138 | if (connector->encoder_ids[i] == 0) |
1154 | break; | 1139 | break; |
1155 | 1140 | ||
1156 | obj = drm_mode_object_find(connector->dev, | 1141 | encoder = drm_encoder_find(connector->dev, |
1157 | connector->encoder_ids[i], | 1142 | connector->encoder_ids[i]); |
1158 | DRM_MODE_OBJECT_ENCODER); | 1143 | if (!encoder) |
1159 | if (!obj) | ||
1160 | continue; | 1144 | continue; |
1161 | 1145 | ||
1162 | encoder = obj_to_encoder(obj); | ||
1163 | |||
1164 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC && | 1146 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC && |
1165 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) | 1147 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) |
1166 | continue; | 1148 | continue; |
@@ -1225,19 +1207,16 @@ static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector) | |||
1225 | { | 1207 | { |
1226 | int enc_id = connector->encoder_ids[0]; | 1208 | int enc_id = connector->encoder_ids[0]; |
1227 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1209 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1228 | struct drm_mode_object *obj; | ||
1229 | struct drm_encoder *encoder; | 1210 | struct drm_encoder *encoder; |
1230 | int i; | 1211 | int i; |
1231 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { | 1212 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
1232 | if (connector->encoder_ids[i] == 0) | 1213 | if (connector->encoder_ids[i] == 0) |
1233 | break; | 1214 | break; |
1234 | 1215 | ||
1235 | obj = drm_mode_object_find(connector->dev, connector->encoder_ids[i], DRM_MODE_OBJECT_ENCODER); | 1216 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); |
1236 | if (!obj) | 1217 | if (!encoder) |
1237 | continue; | 1218 | continue; |
1238 | 1219 | ||
1239 | encoder = obj_to_encoder(obj); | ||
1240 | |||
1241 | if (radeon_connector->use_digital == true) { | 1220 | if (radeon_connector->use_digital == true) { |
1242 | if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) | 1221 | if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) |
1243 | return encoder; | 1222 | return encoder; |
@@ -1252,13 +1231,8 @@ static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector) | |||
1252 | 1231 | ||
1253 | /* then check use digitial */ | 1232 | /* then check use digitial */ |
1254 | /* pick the first one */ | 1233 | /* pick the first one */ |
1255 | if (enc_id) { | 1234 | if (enc_id) |
1256 | obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER); | 1235 | return drm_encoder_find(connector->dev, enc_id); |
1257 | if (!obj) | ||
1258 | return NULL; | ||
1259 | encoder = obj_to_encoder(obj); | ||
1260 | return encoder; | ||
1261 | } | ||
1262 | return NULL; | 1236 | return NULL; |
1263 | } | 1237 | } |
1264 | 1238 | ||
@@ -1391,7 +1365,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1391 | 1365 | ||
1392 | u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector) | 1366 | u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector) |
1393 | { | 1367 | { |
1394 | struct drm_mode_object *obj; | ||
1395 | struct drm_encoder *encoder; | 1368 | struct drm_encoder *encoder; |
1396 | struct radeon_encoder *radeon_encoder; | 1369 | struct radeon_encoder *radeon_encoder; |
1397 | int i; | 1370 | int i; |
@@ -1400,11 +1373,10 @@ u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn | |||
1400 | if (connector->encoder_ids[i] == 0) | 1373 | if (connector->encoder_ids[i] == 0) |
1401 | break; | 1374 | break; |
1402 | 1375 | ||
1403 | obj = drm_mode_object_find(connector->dev, connector->encoder_ids[i], DRM_MODE_OBJECT_ENCODER); | 1376 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); |
1404 | if (!obj) | 1377 | if (!encoder) |
1405 | continue; | 1378 | continue; |
1406 | 1379 | ||
1407 | encoder = obj_to_encoder(obj); | ||
1408 | radeon_encoder = to_radeon_encoder(encoder); | 1380 | radeon_encoder = to_radeon_encoder(encoder); |
1409 | 1381 | ||
1410 | switch (radeon_encoder->encoder_id) { | 1382 | switch (radeon_encoder->encoder_id) { |
@@ -1421,7 +1393,6 @@ u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn | |||
1421 | 1393 | ||
1422 | bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector) | 1394 | bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector) |
1423 | { | 1395 | { |
1424 | struct drm_mode_object *obj; | ||
1425 | struct drm_encoder *encoder; | 1396 | struct drm_encoder *encoder; |
1426 | struct radeon_encoder *radeon_encoder; | 1397 | struct radeon_encoder *radeon_encoder; |
1427 | int i; | 1398 | int i; |
@@ -1431,11 +1402,10 @@ bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector) | |||
1431 | if (connector->encoder_ids[i] == 0) | 1402 | if (connector->encoder_ids[i] == 0) |
1432 | break; | 1403 | break; |
1433 | 1404 | ||
1434 | obj = drm_mode_object_find(connector->dev, connector->encoder_ids[i], DRM_MODE_OBJECT_ENCODER); | 1405 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); |
1435 | if (!obj) | 1406 | if (!encoder) |
1436 | continue; | 1407 | continue; |
1437 | 1408 | ||
1438 | encoder = obj_to_encoder(obj); | ||
1439 | radeon_encoder = to_radeon_encoder(encoder); | 1409 | radeon_encoder = to_radeon_encoder(encoder); |
1440 | if (radeon_encoder->caps & ATOM_ENCODER_CAP_RECORD_HBR2) | 1410 | if (radeon_encoder->caps & ATOM_ENCODER_CAP_RECORD_HBR2) |
1441 | found = true; | 1411 | found = true; |