Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2007-8 Advanced Micro Devices, Inc. |
| 3 | * Copyright 2008 Red Hat Inc. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included in |
| 13 | * all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 21 | * OTHER DEALINGS IN THE SOFTWARE. |
| 22 | * |
| 23 | * Authors: Dave Airlie |
| 24 | * Alex Deucher |
| 25 | */ |
| 26 | #include "drmP.h" |
| 27 | #include "drm_edid.h" |
| 28 | #include "drm_crtc_helper.h" |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 29 | #include "drm_fb_helper.h" |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 30 | #include "radeon_drm.h" |
| 31 | #include "radeon.h" |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 32 | #include "atom.h" |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 33 | |
| 34 | extern void |
| 35 | radeon_combios_connected_scratch_regs(struct drm_connector *connector, |
| 36 | struct drm_encoder *encoder, |
| 37 | bool connected); |
| 38 | extern void |
| 39 | radeon_atombios_connected_scratch_regs(struct drm_connector *connector, |
| 40 | struct drm_encoder *encoder, |
| 41 | bool connected); |
| 42 | |
Alex Deucher | d4877cf | 2009-12-04 16:56:37 -0500 | [diff] [blame] | 43 | void radeon_connector_hotplug(struct drm_connector *connector) |
| 44 | { |
| 45 | struct drm_device *dev = connector->dev; |
| 46 | struct radeon_device *rdev = dev->dev_private; |
| 47 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 48 | |
| 49 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) |
| 50 | radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); |
| 51 | |
Alex Deucher | 196c58d | 2010-01-07 14:22:32 -0500 | [diff] [blame] | 52 | if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
| 53 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { |
| 54 | if ((radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
| 55 | (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_eDP)) { |
Alex Deucher | d4877cf | 2009-12-04 16:56:37 -0500 | [diff] [blame] | 56 | if (radeon_dp_needs_link_train(radeon_connector)) { |
| 57 | if (connector->encoder) |
| 58 | dp_link_train(connector->encoder, connector); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | } |
| 64 | |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 65 | static void radeon_property_change_mode(struct drm_encoder *encoder) |
| 66 | { |
| 67 | struct drm_crtc *crtc = encoder->crtc; |
| 68 | |
| 69 | if (crtc && crtc->enabled) { |
| 70 | drm_crtc_helper_set_mode(crtc, &crtc->mode, |
| 71 | crtc->x, crtc->y, crtc->fb); |
| 72 | } |
| 73 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 74 | static void |
| 75 | radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_connector_status status) |
| 76 | { |
| 77 | struct drm_device *dev = connector->dev; |
| 78 | struct radeon_device *rdev = dev->dev_private; |
| 79 | struct drm_encoder *best_encoder = NULL; |
| 80 | struct drm_encoder *encoder = NULL; |
| 81 | struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; |
| 82 | struct drm_mode_object *obj; |
| 83 | bool connected; |
| 84 | int i; |
| 85 | |
| 86 | best_encoder = connector_funcs->best_encoder(connector); |
| 87 | |
| 88 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
| 89 | if (connector->encoder_ids[i] == 0) |
| 90 | break; |
| 91 | |
| 92 | obj = drm_mode_object_find(connector->dev, |
| 93 | connector->encoder_ids[i], |
| 94 | DRM_MODE_OBJECT_ENCODER); |
| 95 | if (!obj) |
| 96 | continue; |
| 97 | |
| 98 | encoder = obj_to_encoder(obj); |
| 99 | |
| 100 | if ((encoder == best_encoder) && (status == connector_status_connected)) |
| 101 | connected = true; |
| 102 | else |
| 103 | connected = false; |
| 104 | |
| 105 | if (rdev->is_atom_bios) |
| 106 | radeon_atombios_connected_scratch_regs(connector, encoder, connected); |
| 107 | else |
| 108 | radeon_combios_connected_scratch_regs(connector, encoder, connected); |
| 109 | |
| 110 | } |
| 111 | } |
| 112 | |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 113 | struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, int encoder_type) |
| 114 | { |
| 115 | struct drm_mode_object *obj; |
| 116 | struct drm_encoder *encoder; |
| 117 | int i; |
| 118 | |
| 119 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
| 120 | if (connector->encoder_ids[i] == 0) |
| 121 | break; |
| 122 | |
| 123 | obj = drm_mode_object_find(connector->dev, connector->encoder_ids[i], DRM_MODE_OBJECT_ENCODER); |
| 124 | if (!obj) |
| 125 | continue; |
| 126 | |
| 127 | encoder = obj_to_encoder(obj); |
| 128 | if (encoder->encoder_type == encoder_type) |
| 129 | return encoder; |
| 130 | } |
| 131 | return NULL; |
| 132 | } |
| 133 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 134 | struct drm_encoder *radeon_best_single_encoder(struct drm_connector *connector) |
| 135 | { |
| 136 | int enc_id = connector->encoder_ids[0]; |
| 137 | struct drm_mode_object *obj; |
| 138 | struct drm_encoder *encoder; |
| 139 | |
| 140 | /* pick the encoder ids */ |
| 141 | if (enc_id) { |
| 142 | obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER); |
| 143 | if (!obj) |
| 144 | return NULL; |
| 145 | encoder = obj_to_encoder(obj); |
| 146 | return encoder; |
| 147 | } |
| 148 | return NULL; |
| 149 | } |
| 150 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 151 | /* |
| 152 | * radeon_connector_analog_encoder_conflict_solve |
| 153 | * - search for other connectors sharing this encoder |
| 154 | * if priority is true, then set them disconnected if this is connected |
| 155 | * if priority is false, set us disconnected if they are connected |
| 156 | */ |
| 157 | static enum drm_connector_status |
| 158 | radeon_connector_analog_encoder_conflict_solve(struct drm_connector *connector, |
| 159 | struct drm_encoder *encoder, |
| 160 | enum drm_connector_status current_status, |
| 161 | bool priority) |
| 162 | { |
| 163 | struct drm_device *dev = connector->dev; |
| 164 | struct drm_connector *conflict; |
Alex Deucher | 08d0751 | 2010-04-15 13:31:12 -0400 | [diff] [blame^] | 165 | struct radeon_connector *radeon_conflict; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 166 | int i; |
| 167 | |
| 168 | list_for_each_entry(conflict, &dev->mode_config.connector_list, head) { |
| 169 | if (conflict == connector) |
| 170 | continue; |
| 171 | |
Alex Deucher | 08d0751 | 2010-04-15 13:31:12 -0400 | [diff] [blame^] | 172 | radeon_conflict = to_radeon_connector(conflict); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 173 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
| 174 | if (conflict->encoder_ids[i] == 0) |
| 175 | break; |
| 176 | |
| 177 | /* if the IDs match */ |
| 178 | if (conflict->encoder_ids[i] == encoder->base.id) { |
| 179 | if (conflict->status != connector_status_connected) |
| 180 | continue; |
| 181 | |
Alex Deucher | 08d0751 | 2010-04-15 13:31:12 -0400 | [diff] [blame^] | 182 | if (radeon_conflict->use_digital) |
| 183 | continue; |
| 184 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 185 | if (priority == true) { |
| 186 | DRM_INFO("1: conflicting encoders switching off %s\n", drm_get_connector_name(conflict)); |
| 187 | DRM_INFO("in favor of %s\n", drm_get_connector_name(connector)); |
| 188 | conflict->status = connector_status_disconnected; |
| 189 | radeon_connector_update_scratch_regs(conflict, connector_status_disconnected); |
| 190 | } else { |
| 191 | DRM_INFO("2: conflicting encoders switching off %s\n", drm_get_connector_name(connector)); |
| 192 | DRM_INFO("in favor of %s\n", drm_get_connector_name(conflict)); |
| 193 | current_status = connector_status_disconnected; |
| 194 | } |
| 195 | break; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | return current_status; |
| 200 | |
| 201 | } |
| 202 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 203 | static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encoder) |
| 204 | { |
| 205 | struct drm_device *dev = encoder->dev; |
| 206 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 207 | struct drm_display_mode *mode = NULL; |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 208 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 209 | |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 210 | if (native_mode->hdisplay != 0 && |
| 211 | native_mode->vdisplay != 0 && |
| 212 | native_mode->clock != 0) { |
Alex Deucher | fb06ca8 | 2009-10-12 11:25:05 -0400 | [diff] [blame] | 213 | mode = drm_mode_duplicate(dev, native_mode); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 214 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
| 215 | drm_mode_set_name(mode); |
| 216 | |
| 217 | DRM_DEBUG("Adding native panel mode %s\n", mode->name); |
Alex Deucher | d2efdf6 | 2009-12-22 10:06:49 -0500 | [diff] [blame] | 218 | } else if (native_mode->hdisplay != 0 && |
| 219 | native_mode->vdisplay != 0) { |
| 220 | /* mac laptops without an edid */ |
| 221 | /* Note that this is not necessarily the exact panel mode, |
| 222 | * but an approximation based on the cvt formula. For these |
| 223 | * systems we should ideally read the mode info out of the |
| 224 | * registers or add a mode table, but this works and is much |
| 225 | * simpler. |
| 226 | */ |
| 227 | mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); |
| 228 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; |
| 229 | DRM_DEBUG("Adding cvt approximation of native panel mode %s\n", mode->name); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 230 | } |
| 231 | return mode; |
| 232 | } |
| 233 | |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 234 | static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_connector *connector) |
| 235 | { |
| 236 | struct drm_device *dev = encoder->dev; |
| 237 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 238 | struct drm_display_mode *mode = NULL; |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 239 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 240 | int i; |
| 241 | struct mode_size { |
| 242 | int w; |
| 243 | int h; |
| 244 | } common_modes[17] = { |
| 245 | { 640, 480}, |
| 246 | { 720, 480}, |
| 247 | { 800, 600}, |
| 248 | { 848, 480}, |
| 249 | {1024, 768}, |
| 250 | {1152, 768}, |
| 251 | {1280, 720}, |
| 252 | {1280, 800}, |
| 253 | {1280, 854}, |
| 254 | {1280, 960}, |
| 255 | {1280, 1024}, |
| 256 | {1440, 900}, |
| 257 | {1400, 1050}, |
| 258 | {1680, 1050}, |
| 259 | {1600, 1200}, |
| 260 | {1920, 1080}, |
| 261 | {1920, 1200} |
| 262 | }; |
| 263 | |
| 264 | for (i = 0; i < 17; i++) { |
Alex Deucher | dfdd646 | 2009-10-13 12:48:44 -0400 | [diff] [blame] | 265 | if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) { |
| 266 | if (common_modes[i].w > 1024 || |
| 267 | common_modes[i].h > 768) |
| 268 | continue; |
| 269 | } |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 270 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 271 | if (common_modes[i].w > native_mode->hdisplay || |
| 272 | common_modes[i].h > native_mode->vdisplay || |
| 273 | (common_modes[i].w == native_mode->hdisplay && |
| 274 | common_modes[i].h == native_mode->vdisplay)) |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 275 | continue; |
| 276 | } |
| 277 | if (common_modes[i].w < 320 || common_modes[i].h < 200) |
| 278 | continue; |
| 279 | |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 280 | mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false); |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 281 | drm_mode_probed_add(connector, mode); |
| 282 | } |
| 283 | } |
| 284 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 285 | int radeon_connector_set_property(struct drm_connector *connector, struct drm_property *property, |
| 286 | uint64_t val) |
| 287 | { |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 288 | struct drm_device *dev = connector->dev; |
| 289 | struct radeon_device *rdev = dev->dev_private; |
| 290 | struct drm_encoder *encoder; |
| 291 | struct radeon_encoder *radeon_encoder; |
| 292 | |
| 293 | if (property == rdev->mode_info.coherent_mode_property) { |
| 294 | struct radeon_encoder_atom_dig *dig; |
Dave Airlie | ce227c4 | 2010-04-09 06:27:00 +0000 | [diff] [blame] | 295 | bool new_coherent_mode; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 296 | |
| 297 | /* need to find digital encoder on connector */ |
| 298 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_TMDS); |
| 299 | if (!encoder) |
| 300 | return 0; |
| 301 | |
| 302 | radeon_encoder = to_radeon_encoder(encoder); |
| 303 | |
| 304 | if (!radeon_encoder->enc_priv) |
| 305 | return 0; |
| 306 | |
| 307 | dig = radeon_encoder->enc_priv; |
Dave Airlie | ce227c4 | 2010-04-09 06:27:00 +0000 | [diff] [blame] | 308 | new_coherent_mode = val ? true : false; |
| 309 | if (dig->coherent_mode != new_coherent_mode) { |
| 310 | dig->coherent_mode = new_coherent_mode; |
| 311 | radeon_property_change_mode(&radeon_encoder->base); |
| 312 | } |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | if (property == rdev->mode_info.tv_std_property) { |
| 316 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_TVDAC); |
| 317 | if (!encoder) { |
| 318 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_DAC); |
| 319 | } |
| 320 | |
| 321 | if (!encoder) |
| 322 | return 0; |
| 323 | |
| 324 | radeon_encoder = to_radeon_encoder(encoder); |
| 325 | if (!radeon_encoder->enc_priv) |
| 326 | return 0; |
Alex Deucher | 643acac | 2010-04-05 23:57:52 -0400 | [diff] [blame] | 327 | if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom) { |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 328 | struct radeon_encoder_atom_dac *dac_int; |
| 329 | dac_int = radeon_encoder->enc_priv; |
| 330 | dac_int->tv_std = val; |
| 331 | } else { |
| 332 | struct radeon_encoder_tv_dac *dac_int; |
| 333 | dac_int = radeon_encoder->enc_priv; |
| 334 | dac_int->tv_std = val; |
| 335 | } |
| 336 | radeon_property_change_mode(&radeon_encoder->base); |
| 337 | } |
| 338 | |
| 339 | if (property == rdev->mode_info.load_detect_property) { |
| 340 | struct radeon_connector *radeon_connector = |
| 341 | to_radeon_connector(connector); |
| 342 | |
| 343 | if (val == 0) |
| 344 | radeon_connector->dac_load_detect = false; |
| 345 | else |
| 346 | radeon_connector->dac_load_detect = true; |
| 347 | } |
| 348 | |
| 349 | if (property == rdev->mode_info.tmds_pll_property) { |
| 350 | struct radeon_encoder_int_tmds *tmds = NULL; |
| 351 | bool ret = false; |
| 352 | /* need to find digital encoder on connector */ |
| 353 | encoder = radeon_find_encoder(connector, DRM_MODE_ENCODER_TMDS); |
| 354 | if (!encoder) |
| 355 | return 0; |
| 356 | |
| 357 | radeon_encoder = to_radeon_encoder(encoder); |
| 358 | |
| 359 | tmds = radeon_encoder->enc_priv; |
| 360 | if (!tmds) |
| 361 | return 0; |
| 362 | |
| 363 | if (val == 0) { |
| 364 | if (rdev->is_atom_bios) |
| 365 | ret = radeon_atombios_get_tmds_info(radeon_encoder, tmds); |
| 366 | else |
| 367 | ret = radeon_legacy_get_tmds_info_from_combios(radeon_encoder, tmds); |
| 368 | } |
| 369 | if (val == 1 || ret == false) { |
| 370 | radeon_legacy_get_tmds_info_from_table(radeon_encoder, tmds); |
| 371 | } |
| 372 | radeon_property_change_mode(&radeon_encoder->base); |
| 373 | } |
| 374 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 375 | return 0; |
| 376 | } |
| 377 | |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 378 | static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder, |
| 379 | struct drm_connector *connector) |
| 380 | { |
| 381 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 382 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 383 | |
| 384 | /* Try to get native mode details from EDID if necessary */ |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 385 | if (!native_mode->clock) { |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 386 | struct drm_display_mode *t, *mode; |
| 387 | |
| 388 | list_for_each_entry_safe(mode, t, &connector->probed_modes, head) { |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 389 | if (mode->hdisplay == native_mode->hdisplay && |
| 390 | mode->vdisplay == native_mode->vdisplay) { |
| 391 | *native_mode = *mode; |
| 392 | drm_mode_set_crtcinfo(native_mode, CRTC_INTERLACE_HALVE_V); |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 393 | DRM_INFO("Determined LVDS native mode details from EDID\n"); |
| 394 | break; |
| 395 | } |
| 396 | } |
| 397 | } |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 398 | if (!native_mode->clock) { |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 399 | DRM_INFO("No LVDS native mode details, disabling RMX\n"); |
| 400 | radeon_encoder->rmx_type = RMX_OFF; |
| 401 | } |
| 402 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 403 | |
| 404 | static int radeon_lvds_get_modes(struct drm_connector *connector) |
| 405 | { |
| 406 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 407 | struct drm_encoder *encoder; |
| 408 | int ret = 0; |
| 409 | struct drm_display_mode *mode; |
| 410 | |
| 411 | if (radeon_connector->ddc_bus) { |
| 412 | ret = radeon_ddc_get_modes(radeon_connector); |
| 413 | if (ret > 0) { |
Alex Deucher | 7747b71 | 2009-09-11 11:15:43 -0400 | [diff] [blame] | 414 | encoder = radeon_best_single_encoder(connector); |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 415 | if (encoder) { |
| 416 | radeon_fixup_lvds_native_mode(encoder, connector); |
Alex Deucher | 7747b71 | 2009-09-11 11:15:43 -0400 | [diff] [blame] | 417 | /* add scaled modes */ |
| 418 | radeon_add_common_modes(encoder, connector); |
Michel Dänzer | 8dfaa8a | 2009-09-15 17:09:27 +0200 | [diff] [blame] | 419 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 420 | return ret; |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | encoder = radeon_best_single_encoder(connector); |
| 425 | if (!encoder) |
| 426 | return 0; |
| 427 | |
| 428 | /* we have no EDID modes */ |
| 429 | mode = radeon_fp_native_mode(encoder); |
| 430 | if (mode) { |
| 431 | ret = 1; |
| 432 | drm_mode_probed_add(connector, mode); |
Alex Deucher | 7747b71 | 2009-09-11 11:15:43 -0400 | [diff] [blame] | 433 | /* add scaled modes */ |
| 434 | radeon_add_common_modes(encoder, connector); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 435 | } |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 436 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 437 | return ret; |
| 438 | } |
| 439 | |
| 440 | static int radeon_lvds_mode_valid(struct drm_connector *connector, |
| 441 | struct drm_display_mode *mode) |
| 442 | { |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 443 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
| 444 | |
| 445 | if ((mode->hdisplay < 320) || (mode->vdisplay < 240)) |
| 446 | return MODE_PANEL; |
| 447 | |
| 448 | if (encoder) { |
| 449 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 450 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
| 451 | |
| 452 | /* AVIVO hardware supports downscaling modes larger than the panel |
| 453 | * to the panel size, but I'm not sure this is desirable. |
| 454 | */ |
| 455 | if ((mode->hdisplay > native_mode->hdisplay) || |
| 456 | (mode->vdisplay > native_mode->vdisplay)) |
| 457 | return MODE_PANEL; |
| 458 | |
| 459 | /* if scaling is disabled, block non-native modes */ |
| 460 | if (radeon_encoder->rmx_type == RMX_OFF) { |
| 461 | if ((mode->hdisplay != native_mode->hdisplay) || |
| 462 | (mode->vdisplay != native_mode->vdisplay)) |
| 463 | return MODE_PANEL; |
| 464 | } |
| 465 | } |
| 466 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 467 | return MODE_OK; |
| 468 | } |
| 469 | |
| 470 | static enum drm_connector_status radeon_lvds_detect(struct drm_connector *connector) |
| 471 | { |
Alex Deucher | 0549a061 | 2009-10-09 18:41:19 -0400 | [diff] [blame] | 472 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
Alex Deucher | 2ffb842 | 2009-10-08 13:02:19 -0400 | [diff] [blame] | 473 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
Alex Deucher | 0549a061 | 2009-10-09 18:41:19 -0400 | [diff] [blame] | 474 | enum drm_connector_status ret = connector_status_disconnected; |
Alex Deucher | 2ffb842 | 2009-10-08 13:02:19 -0400 | [diff] [blame] | 475 | |
| 476 | if (encoder) { |
| 477 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 478 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
Alex Deucher | 2ffb842 | 2009-10-08 13:02:19 -0400 | [diff] [blame] | 479 | |
| 480 | /* check if panel is valid */ |
Alex Deucher | de2103e | 2009-10-09 15:14:30 -0400 | [diff] [blame] | 481 | if (native_mode->hdisplay >= 320 && native_mode->vdisplay >= 240) |
Alex Deucher | 2ffb842 | 2009-10-08 13:02:19 -0400 | [diff] [blame] | 482 | ret = connector_status_connected; |
| 483 | |
| 484 | } |
Alex Deucher | 0549a061 | 2009-10-09 18:41:19 -0400 | [diff] [blame] | 485 | |
| 486 | /* check for edid as well */ |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 487 | if (radeon_connector->edid) |
| 488 | ret = connector_status_connected; |
| 489 | else { |
| 490 | if (radeon_connector->ddc_bus) { |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 491 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
| 492 | &radeon_connector->ddc_bus->adapter); |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 493 | if (radeon_connector->edid) |
| 494 | ret = connector_status_connected; |
| 495 | } |
Alex Deucher | 0549a061 | 2009-10-09 18:41:19 -0400 | [diff] [blame] | 496 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 497 | /* check acpi lid status ??? */ |
Alex Deucher | 2ffb842 | 2009-10-08 13:02:19 -0400 | [diff] [blame] | 498 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 499 | radeon_connector_update_scratch_regs(connector, ret); |
| 500 | return ret; |
| 501 | } |
| 502 | |
| 503 | static void radeon_connector_destroy(struct drm_connector *connector) |
| 504 | { |
| 505 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 506 | |
| 507 | if (radeon_connector->ddc_bus) |
| 508 | radeon_i2c_destroy(radeon_connector->ddc_bus); |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 509 | if (radeon_connector->edid) |
| 510 | kfree(radeon_connector->edid); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 511 | kfree(radeon_connector->con_priv); |
| 512 | drm_sysfs_connector_remove(connector); |
| 513 | drm_connector_cleanup(connector); |
| 514 | kfree(connector); |
| 515 | } |
| 516 | |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 517 | static int radeon_lvds_set_property(struct drm_connector *connector, |
| 518 | struct drm_property *property, |
| 519 | uint64_t value) |
| 520 | { |
| 521 | struct drm_device *dev = connector->dev; |
| 522 | struct radeon_encoder *radeon_encoder; |
| 523 | enum radeon_rmx_type rmx_type; |
| 524 | |
| 525 | DRM_DEBUG("\n"); |
| 526 | if (property != dev->mode_config.scaling_mode_property) |
| 527 | return 0; |
| 528 | |
| 529 | if (connector->encoder) |
| 530 | radeon_encoder = to_radeon_encoder(connector->encoder); |
| 531 | else { |
| 532 | struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; |
| 533 | radeon_encoder = to_radeon_encoder(connector_funcs->best_encoder(connector)); |
| 534 | } |
| 535 | |
| 536 | switch (value) { |
| 537 | case DRM_MODE_SCALE_NONE: rmx_type = RMX_OFF; break; |
| 538 | case DRM_MODE_SCALE_CENTER: rmx_type = RMX_CENTER; break; |
| 539 | case DRM_MODE_SCALE_ASPECT: rmx_type = RMX_ASPECT; break; |
| 540 | default: |
| 541 | case DRM_MODE_SCALE_FULLSCREEN: rmx_type = RMX_FULL; break; |
| 542 | } |
| 543 | if (radeon_encoder->rmx_type == rmx_type) |
| 544 | return 0; |
| 545 | |
| 546 | radeon_encoder->rmx_type = rmx_type; |
| 547 | |
| 548 | radeon_property_change_mode(&radeon_encoder->base); |
| 549 | return 0; |
| 550 | } |
| 551 | |
| 552 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 553 | struct drm_connector_helper_funcs radeon_lvds_connector_helper_funcs = { |
| 554 | .get_modes = radeon_lvds_get_modes, |
| 555 | .mode_valid = radeon_lvds_mode_valid, |
| 556 | .best_encoder = radeon_best_single_encoder, |
| 557 | }; |
| 558 | |
| 559 | struct drm_connector_funcs radeon_lvds_connector_funcs = { |
| 560 | .dpms = drm_helper_connector_dpms, |
| 561 | .detect = radeon_lvds_detect, |
| 562 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 563 | .destroy = radeon_connector_destroy, |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 564 | .set_property = radeon_lvds_set_property, |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 565 | }; |
| 566 | |
| 567 | static int radeon_vga_get_modes(struct drm_connector *connector) |
| 568 | { |
| 569 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 570 | int ret; |
| 571 | |
| 572 | ret = radeon_ddc_get_modes(radeon_connector); |
| 573 | |
| 574 | return ret; |
| 575 | } |
| 576 | |
| 577 | static int radeon_vga_mode_valid(struct drm_connector *connector, |
| 578 | struct drm_display_mode *mode) |
| 579 | { |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 580 | /* XXX check mode bandwidth */ |
| 581 | /* XXX verify against max DAC output frequency */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 582 | return MODE_OK; |
| 583 | } |
| 584 | |
| 585 | static enum drm_connector_status radeon_vga_detect(struct drm_connector *connector) |
| 586 | { |
| 587 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 588 | struct drm_encoder *encoder; |
| 589 | struct drm_encoder_helper_funcs *encoder_funcs; |
Dave Airlie | 4b9d2a2 | 2010-02-08 13:16:55 +1000 | [diff] [blame] | 590 | bool dret = false; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 591 | enum drm_connector_status ret = connector_status_disconnected; |
| 592 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 593 | encoder = radeon_best_single_encoder(connector); |
| 594 | if (!encoder) |
| 595 | ret = connector_status_disconnected; |
| 596 | |
Dave Airlie | eb6b6d7 | 2010-02-25 13:44:04 +1000 | [diff] [blame] | 597 | if (radeon_connector->ddc_bus) |
Dave Airlie | 4b9d2a2 | 2010-02-08 13:16:55 +1000 | [diff] [blame] | 598 | dret = radeon_ddc_probe(radeon_connector); |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 599 | if (dret) { |
| 600 | if (radeon_connector->edid) { |
| 601 | kfree(radeon_connector->edid); |
| 602 | radeon_connector->edid = NULL; |
| 603 | } |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 604 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 605 | |
| 606 | if (!radeon_connector->edid) { |
Jerome Glisse | f82f5f3 | 2009-11-12 14:13:53 +0100 | [diff] [blame] | 607 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", |
| 608 | drm_get_connector_name(connector)); |
| 609 | ret = connector_status_connected; |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 610 | } else { |
| 611 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
| 612 | |
| 613 | /* some oems have boards with separate digital and analog connectors |
| 614 | * with a shared ddc line (often vga + hdmi) |
| 615 | */ |
| 616 | if (radeon_connector->use_digital && radeon_connector->shared_ddc) { |
| 617 | kfree(radeon_connector->edid); |
| 618 | radeon_connector->edid = NULL; |
| 619 | ret = connector_status_disconnected; |
| 620 | } else |
| 621 | ret = connector_status_connected; |
| 622 | } |
| 623 | } else { |
Darren Jenkins | d8a7f79 | 2009-12-30 12:22:55 +1100 | [diff] [blame] | 624 | if (radeon_connector->dac_load_detect && encoder) { |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 625 | encoder_funcs = encoder->helper_private; |
| 626 | ret = encoder_funcs->detect(encoder, connector); |
| 627 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 628 | } |
| 629 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 630 | if (ret == connector_status_connected) |
| 631 | ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 632 | radeon_connector_update_scratch_regs(connector, ret); |
| 633 | return ret; |
| 634 | } |
| 635 | |
| 636 | struct drm_connector_helper_funcs radeon_vga_connector_helper_funcs = { |
| 637 | .get_modes = radeon_vga_get_modes, |
| 638 | .mode_valid = radeon_vga_mode_valid, |
| 639 | .best_encoder = radeon_best_single_encoder, |
| 640 | }; |
| 641 | |
| 642 | struct drm_connector_funcs radeon_vga_connector_funcs = { |
| 643 | .dpms = drm_helper_connector_dpms, |
| 644 | .detect = radeon_vga_detect, |
| 645 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 646 | .destroy = radeon_connector_destroy, |
| 647 | .set_property = radeon_connector_set_property, |
| 648 | }; |
| 649 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 650 | static int radeon_tv_get_modes(struct drm_connector *connector) |
| 651 | { |
| 652 | struct drm_device *dev = connector->dev; |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 653 | struct radeon_device *rdev = dev->dev_private; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 654 | struct drm_display_mode *tv_mode; |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 655 | struct drm_encoder *encoder; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 656 | |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 657 | encoder = radeon_best_single_encoder(connector); |
| 658 | if (!encoder) |
| 659 | return 0; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 660 | |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 661 | /* avivo chips can scale any mode */ |
| 662 | if (rdev->family >= CHIP_RS600) |
| 663 | /* add scaled modes */ |
| 664 | radeon_add_common_modes(encoder, connector); |
| 665 | else { |
| 666 | /* only 800x600 is supported right now on pre-avivo chips */ |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 667 | tv_mode = drm_cvt_mode(dev, 800, 600, 60, false, false, false); |
Alex Deucher | 923f684 | 2009-09-10 17:53:39 -0400 | [diff] [blame] | 668 | tv_mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; |
| 669 | drm_mode_probed_add(connector, tv_mode); |
| 670 | } |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 671 | return 1; |
| 672 | } |
| 673 | |
| 674 | static int radeon_tv_mode_valid(struct drm_connector *connector, |
| 675 | struct drm_display_mode *mode) |
| 676 | { |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 677 | if ((mode->hdisplay > 1024) || (mode->vdisplay > 768)) |
| 678 | return MODE_CLOCK_RANGE; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 679 | return MODE_OK; |
| 680 | } |
| 681 | |
| 682 | static enum drm_connector_status radeon_tv_detect(struct drm_connector *connector) |
| 683 | { |
| 684 | struct drm_encoder *encoder; |
| 685 | struct drm_encoder_helper_funcs *encoder_funcs; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 686 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 687 | enum drm_connector_status ret = connector_status_disconnected; |
| 688 | |
| 689 | if (!radeon_connector->dac_load_detect) |
| 690 | return ret; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 691 | |
| 692 | encoder = radeon_best_single_encoder(connector); |
| 693 | if (!encoder) |
| 694 | ret = connector_status_disconnected; |
| 695 | else { |
| 696 | encoder_funcs = encoder->helper_private; |
| 697 | ret = encoder_funcs->detect(encoder, connector); |
| 698 | } |
| 699 | if (ret == connector_status_connected) |
| 700 | ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, false); |
| 701 | radeon_connector_update_scratch_regs(connector, ret); |
| 702 | return ret; |
| 703 | } |
| 704 | |
| 705 | struct drm_connector_helper_funcs radeon_tv_connector_helper_funcs = { |
| 706 | .get_modes = radeon_tv_get_modes, |
| 707 | .mode_valid = radeon_tv_mode_valid, |
| 708 | .best_encoder = radeon_best_single_encoder, |
| 709 | }; |
| 710 | |
| 711 | struct drm_connector_funcs radeon_tv_connector_funcs = { |
| 712 | .dpms = drm_helper_connector_dpms, |
| 713 | .detect = radeon_tv_detect, |
| 714 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 715 | .destroy = radeon_connector_destroy, |
| 716 | .set_property = radeon_connector_set_property, |
| 717 | }; |
| 718 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 719 | static int radeon_dvi_get_modes(struct drm_connector *connector) |
| 720 | { |
| 721 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 722 | int ret; |
| 723 | |
| 724 | ret = radeon_ddc_get_modes(radeon_connector); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 725 | return ret; |
| 726 | } |
| 727 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 728 | /* |
| 729 | * DVI is complicated |
| 730 | * Do a DDC probe, if DDC probe passes, get the full EDID so |
| 731 | * we can do analog/digital monitor detection at this point. |
| 732 | * If the monitor is an analog monitor or we got no DDC, |
| 733 | * we need to find the DAC encoder object for this connector. |
| 734 | * If we got no DDC, we do load detection on the DAC encoder object. |
| 735 | * If we got analog DDC or load detection passes on the DAC encoder |
| 736 | * we have to check if this analog encoder is shared with anyone else (TV) |
| 737 | * if its shared we have to set the other connector to disconnected. |
| 738 | */ |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 739 | static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connector) |
| 740 | { |
| 741 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 742 | struct drm_encoder *encoder = NULL; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 743 | struct drm_encoder_helper_funcs *encoder_funcs; |
| 744 | struct drm_mode_object *obj; |
| 745 | int i; |
| 746 | enum drm_connector_status ret = connector_status_disconnected; |
Dave Airlie | 4b9d2a2 | 2010-02-08 13:16:55 +1000 | [diff] [blame] | 747 | bool dret = false; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 748 | |
Dave Airlie | eb6b6d7 | 2010-02-25 13:44:04 +1000 | [diff] [blame] | 749 | if (radeon_connector->ddc_bus) |
Dave Airlie | 4b9d2a2 | 2010-02-08 13:16:55 +1000 | [diff] [blame] | 750 | dret = radeon_ddc_probe(radeon_connector); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 751 | if (dret) { |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 752 | if (radeon_connector->edid) { |
| 753 | kfree(radeon_connector->edid); |
| 754 | radeon_connector->edid = NULL; |
| 755 | } |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 756 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 757 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 758 | if (!radeon_connector->edid) { |
Jerome Glisse | f82f5f3 | 2009-11-12 14:13:53 +0100 | [diff] [blame] | 759 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", |
| 760 | drm_get_connector_name(connector)); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 761 | } else { |
| 762 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 763 | |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 764 | /* some oems have boards with separate digital and analog connectors |
| 765 | * with a shared ddc line (often vga + hdmi) |
| 766 | */ |
| 767 | if ((!radeon_connector->use_digital) && radeon_connector->shared_ddc) { |
| 768 | kfree(radeon_connector->edid); |
| 769 | radeon_connector->edid = NULL; |
| 770 | ret = connector_status_disconnected; |
| 771 | } else |
| 772 | ret = connector_status_connected; |
Alex Deucher | 71407c4 | 2009-11-17 15:44:01 -0500 | [diff] [blame] | 773 | |
| 774 | /* multiple connectors on the same encoder with the same ddc line |
| 775 | * This tends to be HDMI and DVI on the same encoder with the |
| 776 | * same ddc line. If the edid says HDMI, consider the HDMI port |
| 777 | * connected and the DVI port disconnected. If the edid doesn't |
| 778 | * say HDMI, vice versa. |
| 779 | */ |
Alex Deucher | d3932d6 | 2010-02-19 02:13:56 -0500 | [diff] [blame] | 780 | if (radeon_connector->shared_ddc && (ret == connector_status_connected)) { |
Alex Deucher | 71407c4 | 2009-11-17 15:44:01 -0500 | [diff] [blame] | 781 | struct drm_device *dev = connector->dev; |
| 782 | struct drm_connector *list_connector; |
| 783 | struct radeon_connector *list_radeon_connector; |
| 784 | list_for_each_entry(list_connector, &dev->mode_config.connector_list, head) { |
| 785 | if (connector == list_connector) |
| 786 | continue; |
| 787 | list_radeon_connector = to_radeon_connector(list_connector); |
| 788 | if (radeon_connector->devices == list_radeon_connector->devices) { |
| 789 | if (drm_detect_hdmi_monitor(radeon_connector->edid)) { |
| 790 | if (connector->connector_type == DRM_MODE_CONNECTOR_DVID) { |
| 791 | kfree(radeon_connector->edid); |
| 792 | radeon_connector->edid = NULL; |
| 793 | ret = connector_status_disconnected; |
| 794 | } |
| 795 | } else { |
| 796 | if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) || |
| 797 | (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) { |
| 798 | kfree(radeon_connector->edid); |
| 799 | radeon_connector->edid = NULL; |
| 800 | ret = connector_status_disconnected; |
| 801 | } |
| 802 | } |
| 803 | } |
| 804 | } |
| 805 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 806 | } |
| 807 | } |
| 808 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 809 | if ((ret == connector_status_connected) && (radeon_connector->use_digital == true)) |
| 810 | goto out; |
| 811 | |
| 812 | /* find analog encoder */ |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 813 | if (radeon_connector->dac_load_detect) { |
| 814 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
| 815 | if (connector->encoder_ids[i] == 0) |
| 816 | break; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 817 | |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 818 | obj = drm_mode_object_find(connector->dev, |
| 819 | connector->encoder_ids[i], |
| 820 | DRM_MODE_OBJECT_ENCODER); |
| 821 | if (!obj) |
| 822 | continue; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 823 | |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 824 | encoder = obj_to_encoder(obj); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 825 | |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 826 | encoder_funcs = encoder->helper_private; |
| 827 | if (encoder_funcs->detect) { |
| 828 | if (ret != connector_status_connected) { |
| 829 | ret = encoder_funcs->detect(encoder, connector); |
| 830 | if (ret == connector_status_connected) { |
| 831 | radeon_connector->use_digital = false; |
| 832 | } |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 833 | } |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 834 | break; |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 835 | } |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 836 | } |
| 837 | } |
| 838 | |
| 839 | if ((ret == connector_status_connected) && (radeon_connector->use_digital == false) && |
| 840 | encoder) { |
| 841 | ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true); |
| 842 | } |
| 843 | |
| 844 | out: |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 845 | /* updated in get modes as well since we need to know if it's analog or digital */ |
| 846 | radeon_connector_update_scratch_regs(connector, ret); |
| 847 | return ret; |
| 848 | } |
| 849 | |
| 850 | /* okay need to be smart in here about which encoder to pick */ |
| 851 | struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector) |
| 852 | { |
| 853 | int enc_id = connector->encoder_ids[0]; |
| 854 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 855 | struct drm_mode_object *obj; |
| 856 | struct drm_encoder *encoder; |
| 857 | int i; |
| 858 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
| 859 | if (connector->encoder_ids[i] == 0) |
| 860 | break; |
| 861 | |
| 862 | obj = drm_mode_object_find(connector->dev, connector->encoder_ids[i], DRM_MODE_OBJECT_ENCODER); |
| 863 | if (!obj) |
| 864 | continue; |
| 865 | |
| 866 | encoder = obj_to_encoder(obj); |
| 867 | |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 868 | if (radeon_connector->use_digital == true) { |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 869 | if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) |
| 870 | return encoder; |
| 871 | } else { |
| 872 | if (encoder->encoder_type == DRM_MODE_ENCODER_DAC || |
| 873 | encoder->encoder_type == DRM_MODE_ENCODER_TVDAC) |
| 874 | return encoder; |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | /* see if we have a default encoder TODO */ |
| 879 | |
| 880 | /* then check use digitial */ |
| 881 | /* pick the first one */ |
| 882 | if (enc_id) { |
| 883 | obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER); |
| 884 | if (!obj) |
| 885 | return NULL; |
| 886 | encoder = obj_to_encoder(obj); |
| 887 | return encoder; |
| 888 | } |
| 889 | return NULL; |
| 890 | } |
| 891 | |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 892 | static void radeon_dvi_force(struct drm_connector *connector) |
| 893 | { |
| 894 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 895 | if (connector->force == DRM_FORCE_ON) |
| 896 | radeon_connector->use_digital = false; |
| 897 | if (connector->force == DRM_FORCE_ON_DIGITAL) |
| 898 | radeon_connector->use_digital = true; |
| 899 | } |
| 900 | |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 901 | static int radeon_dvi_mode_valid(struct drm_connector *connector, |
| 902 | struct drm_display_mode *mode) |
| 903 | { |
Alex Deucher | 1b24203 | 2010-01-11 15:02:31 -0500 | [diff] [blame] | 904 | struct drm_device *dev = connector->dev; |
| 905 | struct radeon_device *rdev = dev->dev_private; |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 906 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 907 | |
| 908 | /* XXX check mode bandwidth */ |
| 909 | |
Alex Deucher | 1b24203 | 2010-01-11 15:02:31 -0500 | [diff] [blame] | 910 | /* clocks over 135 MHz have heat issues with DVI on RV100 */ |
| 911 | if (radeon_connector->use_digital && |
| 912 | (rdev->family == CHIP_RV100) && |
| 913 | (mode->clock > 135000)) |
| 914 | return MODE_CLOCK_HIGH; |
| 915 | |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 916 | if (radeon_connector->use_digital && (mode->clock > 165000)) { |
| 917 | if ((radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) || |
| 918 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || |
| 919 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) |
| 920 | return MODE_OK; |
| 921 | else |
| 922 | return MODE_CLOCK_HIGH; |
| 923 | } |
| 924 | return MODE_OK; |
| 925 | } |
| 926 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 927 | struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs = { |
| 928 | .get_modes = radeon_dvi_get_modes, |
Alex Deucher | a3fa632 | 2009-11-05 11:57:07 -0500 | [diff] [blame] | 929 | .mode_valid = radeon_dvi_mode_valid, |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 930 | .best_encoder = radeon_dvi_encoder, |
| 931 | }; |
| 932 | |
| 933 | struct drm_connector_funcs radeon_dvi_connector_funcs = { |
| 934 | .dpms = drm_helper_connector_dpms, |
| 935 | .detect = radeon_dvi_detect, |
| 936 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 937 | .set_property = radeon_connector_set_property, |
| 938 | .destroy = radeon_connector_destroy, |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 939 | .force = radeon_dvi_force, |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 940 | }; |
| 941 | |
Alex Deucher | ffd09c6 | 2009-11-24 16:13:23 -0500 | [diff] [blame] | 942 | static void radeon_dp_connector_destroy(struct drm_connector *connector) |
| 943 | { |
| 944 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 945 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
| 946 | |
| 947 | if (radeon_connector->ddc_bus) |
| 948 | radeon_i2c_destroy(radeon_connector->ddc_bus); |
| 949 | if (radeon_connector->edid) |
| 950 | kfree(radeon_connector->edid); |
| 951 | if (radeon_dig_connector->dp_i2c_bus) |
Alex Deucher | ac1aade | 2010-03-14 12:22:44 -0400 | [diff] [blame] | 952 | radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus); |
Alex Deucher | ffd09c6 | 2009-11-24 16:13:23 -0500 | [diff] [blame] | 953 | kfree(radeon_connector->con_priv); |
| 954 | drm_sysfs_connector_remove(connector); |
| 955 | drm_connector_cleanup(connector); |
| 956 | kfree(connector); |
| 957 | } |
| 958 | |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 959 | static int radeon_dp_get_modes(struct drm_connector *connector) |
| 960 | { |
| 961 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 962 | int ret; |
| 963 | |
| 964 | ret = radeon_ddc_get_modes(radeon_connector); |
| 965 | return ret; |
| 966 | } |
| 967 | |
| 968 | static enum drm_connector_status radeon_dp_detect(struct drm_connector *connector) |
| 969 | { |
| 970 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 971 | enum drm_connector_status ret = connector_status_disconnected; |
Alex Deucher | 4143e91 | 2009-11-23 18:02:35 -0500 | [diff] [blame] | 972 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
| 973 | u8 sink_type; |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 974 | |
| 975 | if (radeon_connector->edid) { |
| 976 | kfree(radeon_connector->edid); |
| 977 | radeon_connector->edid = NULL; |
| 978 | } |
| 979 | |
| 980 | sink_type = radeon_dp_getsinktype(radeon_connector); |
Alex Deucher | 196c58d | 2010-01-07 14:22:32 -0500 | [diff] [blame] | 981 | if ((sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
| 982 | (sink_type == CONNECTOR_OBJECT_ID_eDP)) { |
Alex Deucher | 9fa05c9 | 2009-11-27 13:01:46 -0500 | [diff] [blame] | 983 | if (radeon_dp_getdpcd(radeon_connector)) { |
| 984 | radeon_dig_connector->dp_sink_type = sink_type; |
| 985 | ret = connector_status_connected; |
| 986 | } |
Alex Deucher | 4143e91 | 2009-11-23 18:02:35 -0500 | [diff] [blame] | 987 | } else { |
Alex Deucher | 4143e91 | 2009-11-23 18:02:35 -0500 | [diff] [blame] | 988 | if (radeon_ddc_probe(radeon_connector)) { |
| 989 | radeon_dig_connector->dp_sink_type = sink_type; |
| 990 | ret = connector_status_connected; |
| 991 | } |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 992 | } |
Alex Deucher | 4143e91 | 2009-11-23 18:02:35 -0500 | [diff] [blame] | 993 | |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 994 | return ret; |
| 995 | } |
| 996 | |
Alex Deucher | 5801ead | 2009-11-24 13:32:59 -0500 | [diff] [blame] | 997 | static int radeon_dp_mode_valid(struct drm_connector *connector, |
| 998 | struct drm_display_mode *mode) |
| 999 | { |
| 1000 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 1001 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
| 1002 | |
| 1003 | /* XXX check mode bandwidth */ |
| 1004 | |
Alex Deucher | 196c58d | 2010-01-07 14:22:32 -0500 | [diff] [blame] | 1005 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
| 1006 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) |
Alex Deucher | 5801ead | 2009-11-24 13:32:59 -0500 | [diff] [blame] | 1007 | return radeon_dp_mode_valid_helper(radeon_connector, mode); |
| 1008 | else |
| 1009 | return MODE_OK; |
| 1010 | } |
| 1011 | |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 1012 | struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = { |
| 1013 | .get_modes = radeon_dp_get_modes, |
Alex Deucher | 5801ead | 2009-11-24 13:32:59 -0500 | [diff] [blame] | 1014 | .mode_valid = radeon_dp_mode_valid, |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 1015 | .best_encoder = radeon_dvi_encoder, |
| 1016 | }; |
| 1017 | |
| 1018 | struct drm_connector_funcs radeon_dp_connector_funcs = { |
| 1019 | .dpms = drm_helper_connector_dpms, |
| 1020 | .detect = radeon_dp_detect, |
| 1021 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 1022 | .set_property = radeon_connector_set_property, |
Alex Deucher | ffd09c6 | 2009-11-24 16:13:23 -0500 | [diff] [blame] | 1023 | .destroy = radeon_dp_connector_destroy, |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 1024 | .force = radeon_dvi_force, |
| 1025 | }; |
| 1026 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1027 | void |
| 1028 | radeon_add_atom_connector(struct drm_device *dev, |
| 1029 | uint32_t connector_id, |
| 1030 | uint32_t supported_device, |
| 1031 | int connector_type, |
| 1032 | struct radeon_i2c_bus_rec *i2c_bus, |
| 1033 | bool linkb, |
Alex Deucher | b75fad0 | 2009-11-05 13:16:01 -0500 | [diff] [blame] | 1034 | uint32_t igp_lane_info, |
Alex Deucher | eed45b3 | 2009-12-04 14:45:27 -0500 | [diff] [blame] | 1035 | uint16_t connector_object_id, |
| 1036 | struct radeon_hpd *hpd) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1037 | { |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1038 | struct radeon_device *rdev = dev->dev_private; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1039 | struct drm_connector *connector; |
| 1040 | struct radeon_connector *radeon_connector; |
| 1041 | struct radeon_connector_atom_dig *radeon_dig_connector; |
| 1042 | uint32_t subpixel_order = SubPixelNone; |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 1043 | bool shared_ddc = false; |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 1044 | int ret; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1045 | |
| 1046 | /* fixme - tv/cv/din */ |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 1047 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1048 | return; |
| 1049 | |
| 1050 | /* see if we already added it */ |
| 1051 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1052 | radeon_connector = to_radeon_connector(connector); |
| 1053 | if (radeon_connector->connector_id == connector_id) { |
| 1054 | radeon_connector->devices |= supported_device; |
| 1055 | return; |
| 1056 | } |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 1057 | if (radeon_connector->ddc_bus && i2c_bus->valid) { |
Alex Deucher | d3932d6 | 2010-02-19 02:13:56 -0500 | [diff] [blame] | 1058 | if (radeon_connector->ddc_bus->rec.i2c_id == i2c_bus->i2c_id) { |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 1059 | radeon_connector->shared_ddc = true; |
| 1060 | shared_ddc = true; |
| 1061 | } |
| 1062 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1063 | } |
| 1064 | |
| 1065 | radeon_connector = kzalloc(sizeof(struct radeon_connector), GFP_KERNEL); |
| 1066 | if (!radeon_connector) |
| 1067 | return; |
| 1068 | |
| 1069 | connector = &radeon_connector->base; |
| 1070 | |
| 1071 | radeon_connector->connector_id = connector_id; |
| 1072 | radeon_connector->devices = supported_device; |
Alex Deucher | 0294cf4f | 2009-10-15 16:16:35 -0400 | [diff] [blame] | 1073 | radeon_connector->shared_ddc = shared_ddc; |
Alex Deucher | b75fad0 | 2009-11-05 13:16:01 -0500 | [diff] [blame] | 1074 | radeon_connector->connector_object_id = connector_object_id; |
Alex Deucher | eed45b3 | 2009-12-04 14:45:27 -0500 | [diff] [blame] | 1075 | radeon_connector->hpd = *hpd; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1076 | switch (connector_type) { |
| 1077 | case DRM_MODE_CONNECTOR_VGA: |
| 1078 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1079 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1080 | if (ret) |
| 1081 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1082 | if (i2c_bus->valid) { |
| 1083 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); |
| 1084 | if (!radeon_connector->ddc_bus) |
| 1085 | goto failed; |
| 1086 | } |
Dave Airlie | 35e4b7a | 2009-09-25 11:56:50 +1000 | [diff] [blame] | 1087 | radeon_connector->dac_load_detect = true; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1088 | drm_connector_attach_property(&radeon_connector->base, |
| 1089 | rdev->mode_info.load_detect_property, |
| 1090 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1091 | break; |
| 1092 | case DRM_MODE_CONNECTOR_DVIA: |
| 1093 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1094 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1095 | if (ret) |
| 1096 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1097 | if (i2c_bus->valid) { |
| 1098 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
| 1099 | if (!radeon_connector->ddc_bus) |
| 1100 | goto failed; |
| 1101 | } |
Dave Airlie | 35e4b7a | 2009-09-25 11:56:50 +1000 | [diff] [blame] | 1102 | radeon_connector->dac_load_detect = true; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1103 | drm_connector_attach_property(&radeon_connector->base, |
| 1104 | rdev->mode_info.load_detect_property, |
| 1105 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1106 | break; |
| 1107 | case DRM_MODE_CONNECTOR_DVII: |
| 1108 | case DRM_MODE_CONNECTOR_DVID: |
| 1109 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
| 1110 | if (!radeon_dig_connector) |
| 1111 | goto failed; |
| 1112 | radeon_dig_connector->linkb = linkb; |
| 1113 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
| 1114 | radeon_connector->con_priv = radeon_dig_connector; |
| 1115 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1116 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
| 1117 | if (ret) |
| 1118 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1119 | if (i2c_bus->valid) { |
| 1120 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
| 1121 | if (!radeon_connector->ddc_bus) |
| 1122 | goto failed; |
| 1123 | } |
| 1124 | subpixel_order = SubPixelHorizontalRGB; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1125 | drm_connector_attach_property(&radeon_connector->base, |
| 1126 | rdev->mode_info.coherent_mode_property, |
| 1127 | 1); |
Alex Deucher | 390d0bb | 2009-12-08 12:48:20 -0500 | [diff] [blame] | 1128 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { |
| 1129 | radeon_connector->dac_load_detect = true; |
| 1130 | drm_connector_attach_property(&radeon_connector->base, |
| 1131 | rdev->mode_info.load_detect_property, |
| 1132 | 1); |
| 1133 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1134 | break; |
| 1135 | case DRM_MODE_CONNECTOR_HDMIA: |
| 1136 | case DRM_MODE_CONNECTOR_HDMIB: |
| 1137 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
| 1138 | if (!radeon_dig_connector) |
| 1139 | goto failed; |
| 1140 | radeon_dig_connector->linkb = linkb; |
| 1141 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
| 1142 | radeon_connector->con_priv = radeon_dig_connector; |
| 1143 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1144 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
| 1145 | if (ret) |
| 1146 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1147 | if (i2c_bus->valid) { |
| 1148 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "HDMI"); |
| 1149 | if (!radeon_connector->ddc_bus) |
| 1150 | goto failed; |
| 1151 | } |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1152 | drm_connector_attach_property(&radeon_connector->base, |
| 1153 | rdev->mode_info.coherent_mode_property, |
| 1154 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1155 | subpixel_order = SubPixelHorizontalRGB; |
| 1156 | break; |
| 1157 | case DRM_MODE_CONNECTOR_DisplayPort: |
Alex Deucher | 196c58d | 2010-01-07 14:22:32 -0500 | [diff] [blame] | 1158 | case DRM_MODE_CONNECTOR_eDP: |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1159 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
| 1160 | if (!radeon_dig_connector) |
| 1161 | goto failed; |
| 1162 | radeon_dig_connector->linkb = linkb; |
| 1163 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
| 1164 | radeon_connector->con_priv = radeon_dig_connector; |
Dave Airlie | 746c1aa | 2009-12-08 07:07:28 +1000 | [diff] [blame] | 1165 | drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type); |
| 1166 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1167 | if (ret) |
| 1168 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1169 | if (i2c_bus->valid) { |
Alex Deucher | 390d0bb | 2009-12-08 12:48:20 -0500 | [diff] [blame] | 1170 | /* add DP i2c bus */ |
Alex Deucher | 196c58d | 2010-01-07 14:22:32 -0500 | [diff] [blame] | 1171 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
| 1172 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); |
| 1173 | else |
| 1174 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); |
Alex Deucher | 390d0bb | 2009-12-08 12:48:20 -0500 | [diff] [blame] | 1175 | if (!radeon_dig_connector->dp_i2c_bus) |
| 1176 | goto failed; |
Alex Deucher | 196c58d | 2010-01-07 14:22:32 -0500 | [diff] [blame] | 1177 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
| 1178 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "eDP"); |
| 1179 | else |
| 1180 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1181 | if (!radeon_connector->ddc_bus) |
| 1182 | goto failed; |
| 1183 | } |
| 1184 | subpixel_order = SubPixelHorizontalRGB; |
Alex Deucher | 390d0bb | 2009-12-08 12:48:20 -0500 | [diff] [blame] | 1185 | drm_connector_attach_property(&radeon_connector->base, |
| 1186 | rdev->mode_info.coherent_mode_property, |
| 1187 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1188 | break; |
| 1189 | case DRM_MODE_CONNECTOR_SVIDEO: |
| 1190 | case DRM_MODE_CONNECTOR_Composite: |
| 1191 | case DRM_MODE_CONNECTOR_9PinDIN: |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 1192 | if (radeon_tv == 1) { |
| 1193 | drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1194 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); |
| 1195 | if (ret) |
| 1196 | goto failed; |
| 1197 | radeon_connector->dac_load_detect = true; |
| 1198 | drm_connector_attach_property(&radeon_connector->base, |
| 1199 | rdev->mode_info.load_detect_property, |
| 1200 | 1); |
Alex Deucher | ed16014 | 2009-12-01 14:12:14 -0500 | [diff] [blame] | 1201 | drm_connector_attach_property(&radeon_connector->base, |
| 1202 | rdev->mode_info.tv_std_property, |
Alex Deucher | d79766f | 2009-12-17 19:00:29 -0500 | [diff] [blame] | 1203 | radeon_atombios_get_tv_info(rdev)); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 1204 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1205 | break; |
| 1206 | case DRM_MODE_CONNECTOR_LVDS: |
| 1207 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
| 1208 | if (!radeon_dig_connector) |
| 1209 | goto failed; |
| 1210 | radeon_dig_connector->linkb = linkb; |
| 1211 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
| 1212 | radeon_connector->con_priv = radeon_dig_connector; |
| 1213 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1214 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); |
| 1215 | if (ret) |
| 1216 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1217 | if (i2c_bus->valid) { |
| 1218 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); |
| 1219 | if (!radeon_connector->ddc_bus) |
| 1220 | goto failed; |
| 1221 | } |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1222 | drm_connector_attach_property(&radeon_connector->base, |
| 1223 | dev->mode_config.scaling_mode_property, |
| 1224 | DRM_MODE_SCALE_FULLSCREEN); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1225 | subpixel_order = SubPixelHorizontalRGB; |
| 1226 | break; |
| 1227 | } |
| 1228 | |
| 1229 | connector->display_info.subpixel_order = subpixel_order; |
| 1230 | drm_sysfs_connector_add(connector); |
| 1231 | return; |
| 1232 | |
| 1233 | failed: |
| 1234 | if (radeon_connector->ddc_bus) |
| 1235 | radeon_i2c_destroy(radeon_connector->ddc_bus); |
| 1236 | drm_connector_cleanup(connector); |
| 1237 | kfree(connector); |
| 1238 | } |
| 1239 | |
| 1240 | void |
| 1241 | radeon_add_legacy_connector(struct drm_device *dev, |
| 1242 | uint32_t connector_id, |
| 1243 | uint32_t supported_device, |
| 1244 | int connector_type, |
Alex Deucher | b75fad0 | 2009-11-05 13:16:01 -0500 | [diff] [blame] | 1245 | struct radeon_i2c_bus_rec *i2c_bus, |
Alex Deucher | eed45b3 | 2009-12-04 14:45:27 -0500 | [diff] [blame] | 1246 | uint16_t connector_object_id, |
| 1247 | struct radeon_hpd *hpd) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1248 | { |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1249 | struct radeon_device *rdev = dev->dev_private; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1250 | struct drm_connector *connector; |
| 1251 | struct radeon_connector *radeon_connector; |
| 1252 | uint32_t subpixel_order = SubPixelNone; |
Dave Airlie | d50ba25 | 2009-09-23 14:44:08 +1000 | [diff] [blame] | 1253 | int ret; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1254 | |
| 1255 | /* fixme - tv/cv/din */ |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 1256 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1257 | return; |
| 1258 | |
| 1259 | /* see if we already added it */ |
| 1260 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 1261 | radeon_connector = to_radeon_connector(connector); |
| 1262 | if (radeon_connector->connector_id == connector_id) { |
| 1263 | radeon_connector->devices |= supported_device; |
| 1264 | return; |
| 1265 | } |
| 1266 | } |
| 1267 | |
| 1268 | radeon_connector = kzalloc(sizeof(struct radeon_connector), GFP_KERNEL); |
| 1269 | if (!radeon_connector) |
| 1270 | return; |
| 1271 | |
| 1272 | connector = &radeon_connector->base; |
| 1273 | |
| 1274 | radeon_connector->connector_id = connector_id; |
| 1275 | radeon_connector->devices = supported_device; |
Alex Deucher | b75fad0 | 2009-11-05 13:16:01 -0500 | [diff] [blame] | 1276 | radeon_connector->connector_object_id = connector_object_id; |
Alex Deucher | eed45b3 | 2009-12-04 14:45:27 -0500 | [diff] [blame] | 1277 | radeon_connector->hpd = *hpd; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1278 | switch (connector_type) { |
| 1279 | case DRM_MODE_CONNECTOR_VGA: |
| 1280 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1281 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1282 | if (ret) |
| 1283 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1284 | if (i2c_bus->valid) { |
| 1285 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); |
| 1286 | if (!radeon_connector->ddc_bus) |
| 1287 | goto failed; |
| 1288 | } |
Dave Airlie | 35e4b7a | 2009-09-25 11:56:50 +1000 | [diff] [blame] | 1289 | radeon_connector->dac_load_detect = true; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1290 | drm_connector_attach_property(&radeon_connector->base, |
| 1291 | rdev->mode_info.load_detect_property, |
| 1292 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1293 | break; |
| 1294 | case DRM_MODE_CONNECTOR_DVIA: |
| 1295 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1296 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1297 | if (ret) |
| 1298 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1299 | if (i2c_bus->valid) { |
| 1300 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
| 1301 | if (!radeon_connector->ddc_bus) |
| 1302 | goto failed; |
| 1303 | } |
Dave Airlie | 35e4b7a | 2009-09-25 11:56:50 +1000 | [diff] [blame] | 1304 | radeon_connector->dac_load_detect = true; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1305 | drm_connector_attach_property(&radeon_connector->base, |
| 1306 | rdev->mode_info.load_detect_property, |
| 1307 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1308 | break; |
| 1309 | case DRM_MODE_CONNECTOR_DVII: |
| 1310 | case DRM_MODE_CONNECTOR_DVID: |
| 1311 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1312 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
| 1313 | if (ret) |
| 1314 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1315 | if (i2c_bus->valid) { |
| 1316 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
| 1317 | if (!radeon_connector->ddc_bus) |
| 1318 | goto failed; |
Dave Airlie | 35e4b7a | 2009-09-25 11:56:50 +1000 | [diff] [blame] | 1319 | radeon_connector->dac_load_detect = true; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1320 | drm_connector_attach_property(&radeon_connector->base, |
| 1321 | rdev->mode_info.load_detect_property, |
| 1322 | 1); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1323 | } |
| 1324 | subpixel_order = SubPixelHorizontalRGB; |
| 1325 | break; |
| 1326 | case DRM_MODE_CONNECTOR_SVIDEO: |
| 1327 | case DRM_MODE_CONNECTOR_Composite: |
| 1328 | case DRM_MODE_CONNECTOR_9PinDIN: |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 1329 | if (radeon_tv == 1) { |
| 1330 | drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1331 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); |
| 1332 | if (ret) |
| 1333 | goto failed; |
Dave Airlie | 35e4b7a | 2009-09-25 11:56:50 +1000 | [diff] [blame] | 1334 | radeon_connector->dac_load_detect = true; |
Jerome Glisse | 0beb81a | 2009-11-13 20:56:35 +0100 | [diff] [blame] | 1335 | /* RS400,RC410,RS480 chipset seems to report a lot |
| 1336 | * of false positive on load detect, we haven't yet |
| 1337 | * found a way to make load detect reliable on those |
| 1338 | * chipset, thus just disable it for TV. |
| 1339 | */ |
| 1340 | if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) |
| 1341 | radeon_connector->dac_load_detect = false; |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1342 | drm_connector_attach_property(&radeon_connector->base, |
| 1343 | rdev->mode_info.load_detect_property, |
Dave Airlie | 624ab4f | 2010-01-27 16:07:15 +1000 | [diff] [blame] | 1344 | radeon_connector->dac_load_detect); |
Alex Deucher | ed16014 | 2009-12-01 14:12:14 -0500 | [diff] [blame] | 1345 | drm_connector_attach_property(&radeon_connector->base, |
| 1346 | rdev->mode_info.tv_std_property, |
Alex Deucher | d79766f | 2009-12-17 19:00:29 -0500 | [diff] [blame] | 1347 | radeon_combios_get_tv_info(rdev)); |
Dave Airlie | 4ce001a | 2009-08-13 16:32:14 +1000 | [diff] [blame] | 1348 | } |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1349 | break; |
| 1350 | case DRM_MODE_CONNECTOR_LVDS: |
| 1351 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
Dave Airlie | 74bf2ad | 2009-09-28 15:31:10 +1000 | [diff] [blame] | 1352 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); |
| 1353 | if (ret) |
| 1354 | goto failed; |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1355 | if (i2c_bus->valid) { |
| 1356 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); |
| 1357 | if (!radeon_connector->ddc_bus) |
| 1358 | goto failed; |
| 1359 | } |
Dave Airlie | 445282d | 2009-09-09 17:40:54 +1000 | [diff] [blame] | 1360 | drm_connector_attach_property(&radeon_connector->base, |
| 1361 | dev->mode_config.scaling_mode_property, |
| 1362 | DRM_MODE_SCALE_FULLSCREEN); |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1363 | subpixel_order = SubPixelHorizontalRGB; |
| 1364 | break; |
| 1365 | } |
| 1366 | |
Jerome Glisse | 771fe6b | 2009-06-05 14:42:42 +0200 | [diff] [blame] | 1367 | connector->display_info.subpixel_order = subpixel_order; |
| 1368 | drm_sysfs_connector_add(connector); |
| 1369 | return; |
| 1370 | |
| 1371 | failed: |
| 1372 | if (radeon_connector->ddc_bus) |
| 1373 | radeon_i2c_destroy(radeon_connector->ddc_bus); |
| 1374 | drm_connector_cleanup(connector); |
| 1375 | kfree(connector); |
| 1376 | } |