2 * Copyright 2004 ATI Technologies Inc., Markham, Ontario
3 * Copyright 2007-8 Advanced Micro Devices, Inc.
4 * Copyright 2008 Red Hat Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
24 * Authors: Dave Airlie
28 #include "radeon_drm.h"
32 #ifdef CONFIG_PPC_PMAC
33 /* not sure which of these are needed */
34 #include <asm/machdep.h>
35 #include <asm/pmac_feature.h>
37 #include <asm/pci-bridge.h>
38 #endif /* CONFIG_PPC_PMAC */
40 /* from radeon_encoder.c */
42 radeon_get_encoder_id(struct drm_device
*dev
, uint32_t supported_device
,
44 extern void radeon_link_encoder_connector(struct drm_device
*dev
);
46 /* from radeon_connector.c */
48 radeon_add_legacy_connector(struct drm_device
*dev
,
49 uint32_t connector_id
,
50 uint32_t supported_device
,
52 struct radeon_i2c_bus_rec
*i2c_bus
);
54 /* from radeon_legacy_encoder.c */
56 radeon_add_legacy_encoder(struct drm_device
*dev
, uint32_t encoder_id
,
57 uint32_t supported_device
);
59 /* old legacy ATI BIOS routines */
61 /* COMBIOS table offsets */
62 enum radeon_combios_table_offset
{
63 /* absolute offset tables */
64 COMBIOS_ASIC_INIT_1_TABLE
,
65 COMBIOS_BIOS_SUPPORT_TABLE
,
66 COMBIOS_DAC_PROGRAMMING_TABLE
,
67 COMBIOS_MAX_COLOR_DEPTH_TABLE
,
68 COMBIOS_CRTC_INFO_TABLE
,
69 COMBIOS_PLL_INFO_TABLE
,
70 COMBIOS_TV_INFO_TABLE
,
71 COMBIOS_DFP_INFO_TABLE
,
72 COMBIOS_HW_CONFIG_INFO_TABLE
,
73 COMBIOS_MULTIMEDIA_INFO_TABLE
,
74 COMBIOS_TV_STD_PATCH_TABLE
,
75 COMBIOS_LCD_INFO_TABLE
,
76 COMBIOS_MOBILE_INFO_TABLE
,
77 COMBIOS_PLL_INIT_TABLE
,
78 COMBIOS_MEM_CONFIG_TABLE
,
79 COMBIOS_SAVE_MASK_TABLE
,
80 COMBIOS_HARDCODED_EDID_TABLE
,
81 COMBIOS_ASIC_INIT_2_TABLE
,
82 COMBIOS_CONNECTOR_INFO_TABLE
,
83 COMBIOS_DYN_CLK_1_TABLE
,
84 COMBIOS_RESERVED_MEM_TABLE
,
85 COMBIOS_EXT_TMDS_INFO_TABLE
,
86 COMBIOS_MEM_CLK_INFO_TABLE
,
87 COMBIOS_EXT_DAC_INFO_TABLE
,
88 COMBIOS_MISC_INFO_TABLE
,
89 COMBIOS_CRT_INFO_TABLE
,
90 COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE
,
91 COMBIOS_COMPONENT_VIDEO_INFO_TABLE
,
92 COMBIOS_FAN_SPEED_INFO_TABLE
,
93 COMBIOS_OVERDRIVE_INFO_TABLE
,
94 COMBIOS_OEM_INFO_TABLE
,
95 COMBIOS_DYN_CLK_2_TABLE
,
96 COMBIOS_POWER_CONNECTOR_INFO_TABLE
,
97 COMBIOS_I2C_INFO_TABLE
,
98 /* relative offset tables */
99 COMBIOS_ASIC_INIT_3_TABLE
, /* offset from misc info */
100 COMBIOS_ASIC_INIT_4_TABLE
, /* offset from misc info */
101 COMBIOS_DETECTED_MEM_TABLE
, /* offset from misc info */
102 COMBIOS_ASIC_INIT_5_TABLE
, /* offset from misc info */
103 COMBIOS_RAM_RESET_TABLE
, /* offset from mem config */
104 COMBIOS_POWERPLAY_INFO_TABLE
, /* offset from mobile info */
105 COMBIOS_GPIO_INFO_TABLE
, /* offset from mobile info */
106 COMBIOS_LCD_DDC_INFO_TABLE
, /* offset from mobile info */
107 COMBIOS_TMDS_POWER_TABLE
, /* offset from mobile info */
108 COMBIOS_TMDS_POWER_ON_TABLE
, /* offset from tmds power */
109 COMBIOS_TMDS_POWER_OFF_TABLE
, /* offset from tmds power */
112 enum radeon_combios_ddc
{
122 enum radeon_combios_connector
{
123 CONNECTOR_NONE_LEGACY
,
124 CONNECTOR_PROPRIETARY_LEGACY
,
125 CONNECTOR_CRT_LEGACY
,
126 CONNECTOR_DVI_I_LEGACY
,
127 CONNECTOR_DVI_D_LEGACY
,
128 CONNECTOR_CTV_LEGACY
,
129 CONNECTOR_STV_LEGACY
,
130 CONNECTOR_UNSUPPORTED_LEGACY
133 const int legacy_connector_convert
[] = {
134 DRM_MODE_CONNECTOR_Unknown
,
135 DRM_MODE_CONNECTOR_DVID
,
136 DRM_MODE_CONNECTOR_VGA
,
137 DRM_MODE_CONNECTOR_DVII
,
138 DRM_MODE_CONNECTOR_DVID
,
139 DRM_MODE_CONNECTOR_Composite
,
140 DRM_MODE_CONNECTOR_SVIDEO
,
141 DRM_MODE_CONNECTOR_Unknown
,
144 static uint16_t combios_get_table_offset(struct drm_device
*dev
,
145 enum radeon_combios_table_offset table
)
147 struct radeon_device
*rdev
= dev
->dev_private
;
149 uint16_t offset
= 0, check_offset
;
152 /* absolute offset tables */
153 case COMBIOS_ASIC_INIT_1_TABLE
:
154 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0xc);
156 offset
= check_offset
;
158 case COMBIOS_BIOS_SUPPORT_TABLE
:
159 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x14);
161 offset
= check_offset
;
163 case COMBIOS_DAC_PROGRAMMING_TABLE
:
164 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x2a);
166 offset
= check_offset
;
168 case COMBIOS_MAX_COLOR_DEPTH_TABLE
:
169 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x2c);
171 offset
= check_offset
;
173 case COMBIOS_CRTC_INFO_TABLE
:
174 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x2e);
176 offset
= check_offset
;
178 case COMBIOS_PLL_INFO_TABLE
:
179 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x30);
181 offset
= check_offset
;
183 case COMBIOS_TV_INFO_TABLE
:
184 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x32);
186 offset
= check_offset
;
188 case COMBIOS_DFP_INFO_TABLE
:
189 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x34);
191 offset
= check_offset
;
193 case COMBIOS_HW_CONFIG_INFO_TABLE
:
194 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x36);
196 offset
= check_offset
;
198 case COMBIOS_MULTIMEDIA_INFO_TABLE
:
199 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x38);
201 offset
= check_offset
;
203 case COMBIOS_TV_STD_PATCH_TABLE
:
204 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x3e);
206 offset
= check_offset
;
208 case COMBIOS_LCD_INFO_TABLE
:
209 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x40);
211 offset
= check_offset
;
213 case COMBIOS_MOBILE_INFO_TABLE
:
214 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x42);
216 offset
= check_offset
;
218 case COMBIOS_PLL_INIT_TABLE
:
219 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x46);
221 offset
= check_offset
;
223 case COMBIOS_MEM_CONFIG_TABLE
:
224 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x48);
226 offset
= check_offset
;
228 case COMBIOS_SAVE_MASK_TABLE
:
229 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x4a);
231 offset
= check_offset
;
233 case COMBIOS_HARDCODED_EDID_TABLE
:
234 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x4c);
236 offset
= check_offset
;
238 case COMBIOS_ASIC_INIT_2_TABLE
:
239 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x4e);
241 offset
= check_offset
;
243 case COMBIOS_CONNECTOR_INFO_TABLE
:
244 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x50);
246 offset
= check_offset
;
248 case COMBIOS_DYN_CLK_1_TABLE
:
249 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x52);
251 offset
= check_offset
;
253 case COMBIOS_RESERVED_MEM_TABLE
:
254 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x54);
256 offset
= check_offset
;
258 case COMBIOS_EXT_TMDS_INFO_TABLE
:
259 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x58);
261 offset
= check_offset
;
263 case COMBIOS_MEM_CLK_INFO_TABLE
:
264 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x5a);
266 offset
= check_offset
;
268 case COMBIOS_EXT_DAC_INFO_TABLE
:
269 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x5c);
271 offset
= check_offset
;
273 case COMBIOS_MISC_INFO_TABLE
:
274 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x5e);
276 offset
= check_offset
;
278 case COMBIOS_CRT_INFO_TABLE
:
279 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x60);
281 offset
= check_offset
;
283 case COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE
:
284 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x62);
286 offset
= check_offset
;
288 case COMBIOS_COMPONENT_VIDEO_INFO_TABLE
:
289 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x64);
291 offset
= check_offset
;
293 case COMBIOS_FAN_SPEED_INFO_TABLE
:
294 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x66);
296 offset
= check_offset
;
298 case COMBIOS_OVERDRIVE_INFO_TABLE
:
299 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x68);
301 offset
= check_offset
;
303 case COMBIOS_OEM_INFO_TABLE
:
304 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x6a);
306 offset
= check_offset
;
308 case COMBIOS_DYN_CLK_2_TABLE
:
309 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x6c);
311 offset
= check_offset
;
313 case COMBIOS_POWER_CONNECTOR_INFO_TABLE
:
314 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x6e);
316 offset
= check_offset
;
318 case COMBIOS_I2C_INFO_TABLE
:
319 check_offset
= RBIOS16(rdev
->bios_header_start
+ 0x70);
321 offset
= check_offset
;
323 /* relative offset tables */
324 case COMBIOS_ASIC_INIT_3_TABLE
: /* offset from misc info */
326 combios_get_table_offset(dev
, COMBIOS_MISC_INFO_TABLE
);
328 rev
= RBIOS8(check_offset
);
330 check_offset
= RBIOS16(check_offset
+ 0x3);
332 offset
= check_offset
;
336 case COMBIOS_ASIC_INIT_4_TABLE
: /* offset from misc info */
338 combios_get_table_offset(dev
, COMBIOS_MISC_INFO_TABLE
);
340 rev
= RBIOS8(check_offset
);
342 check_offset
= RBIOS16(check_offset
+ 0x5);
344 offset
= check_offset
;
348 case COMBIOS_DETECTED_MEM_TABLE
: /* offset from misc info */
350 combios_get_table_offset(dev
, COMBIOS_MISC_INFO_TABLE
);
352 rev
= RBIOS8(check_offset
);
354 check_offset
= RBIOS16(check_offset
+ 0x7);
356 offset
= check_offset
;
360 case COMBIOS_ASIC_INIT_5_TABLE
: /* offset from misc info */
362 combios_get_table_offset(dev
, COMBIOS_MISC_INFO_TABLE
);
364 rev
= RBIOS8(check_offset
);
366 check_offset
= RBIOS16(check_offset
+ 0x9);
368 offset
= check_offset
;
372 case COMBIOS_RAM_RESET_TABLE
: /* offset from mem config */
374 combios_get_table_offset(dev
, COMBIOS_MEM_CONFIG_TABLE
);
376 while (RBIOS8(check_offset
++));
379 offset
= check_offset
;
382 case COMBIOS_POWERPLAY_INFO_TABLE
: /* offset from mobile info */
384 combios_get_table_offset(dev
, COMBIOS_MOBILE_INFO_TABLE
);
386 check_offset
= RBIOS16(check_offset
+ 0x11);
388 offset
= check_offset
;
391 case COMBIOS_GPIO_INFO_TABLE
: /* offset from mobile info */
393 combios_get_table_offset(dev
, COMBIOS_MOBILE_INFO_TABLE
);
395 check_offset
= RBIOS16(check_offset
+ 0x13);
397 offset
= check_offset
;
400 case COMBIOS_LCD_DDC_INFO_TABLE
: /* offset from mobile info */
402 combios_get_table_offset(dev
, COMBIOS_MOBILE_INFO_TABLE
);
404 check_offset
= RBIOS16(check_offset
+ 0x15);
406 offset
= check_offset
;
409 case COMBIOS_TMDS_POWER_TABLE
: /* offset from mobile info */
411 combios_get_table_offset(dev
, COMBIOS_MOBILE_INFO_TABLE
);
413 check_offset
= RBIOS16(check_offset
+ 0x17);
415 offset
= check_offset
;
418 case COMBIOS_TMDS_POWER_ON_TABLE
: /* offset from tmds power */
420 combios_get_table_offset(dev
, COMBIOS_TMDS_POWER_TABLE
);
422 check_offset
= RBIOS16(check_offset
+ 0x2);
424 offset
= check_offset
;
427 case COMBIOS_TMDS_POWER_OFF_TABLE
: /* offset from tmds power */
429 combios_get_table_offset(dev
, COMBIOS_TMDS_POWER_TABLE
);
431 check_offset
= RBIOS16(check_offset
+ 0x4);
433 offset
= check_offset
;
444 struct radeon_i2c_bus_rec
combios_setup_i2c_bus(int ddc_line
)
446 struct radeon_i2c_bus_rec i2c
;
448 i2c
.mask_clk_mask
= RADEON_GPIO_EN_1
;
449 i2c
.mask_data_mask
= RADEON_GPIO_EN_0
;
450 i2c
.a_clk_mask
= RADEON_GPIO_A_1
;
451 i2c
.a_data_mask
= RADEON_GPIO_A_0
;
452 i2c
.put_clk_mask
= RADEON_GPIO_EN_1
;
453 i2c
.put_data_mask
= RADEON_GPIO_EN_0
;
454 i2c
.get_clk_mask
= RADEON_GPIO_Y_1
;
455 i2c
.get_data_mask
= RADEON_GPIO_Y_0
;
456 if ((ddc_line
== RADEON_LCD_GPIO_MASK
) ||
457 (ddc_line
== RADEON_MDGPIO_EN_REG
)) {
458 i2c
.mask_clk_reg
= ddc_line
;
459 i2c
.mask_data_reg
= ddc_line
;
460 i2c
.a_clk_reg
= ddc_line
;
461 i2c
.a_data_reg
= ddc_line
;
462 i2c
.put_clk_reg
= ddc_line
;
463 i2c
.put_data_reg
= ddc_line
;
464 i2c
.get_clk_reg
= ddc_line
+ 4;
465 i2c
.get_data_reg
= ddc_line
+ 4;
467 i2c
.mask_clk_reg
= ddc_line
;
468 i2c
.mask_data_reg
= ddc_line
;
469 i2c
.a_clk_reg
= ddc_line
;
470 i2c
.a_data_reg
= ddc_line
;
471 i2c
.put_clk_reg
= ddc_line
;
472 i2c
.put_data_reg
= ddc_line
;
473 i2c
.get_clk_reg
= ddc_line
;
474 i2c
.get_data_reg
= ddc_line
;
485 bool radeon_combios_get_clock_info(struct drm_device
*dev
)
487 struct radeon_device
*rdev
= dev
->dev_private
;
489 struct radeon_pll
*p1pll
= &rdev
->clock
.p1pll
;
490 struct radeon_pll
*p2pll
= &rdev
->clock
.p2pll
;
491 struct radeon_pll
*spll
= &rdev
->clock
.spll
;
492 struct radeon_pll
*mpll
= &rdev
->clock
.mpll
;
496 if (rdev
->bios
== NULL
)
499 pll_info
= combios_get_table_offset(dev
, COMBIOS_PLL_INFO_TABLE
);
501 rev
= RBIOS8(pll_info
);
504 p1pll
->reference_freq
= RBIOS16(pll_info
+ 0xe);
505 p1pll
->reference_div
= RBIOS16(pll_info
+ 0x10);
506 p1pll
->pll_out_min
= RBIOS32(pll_info
+ 0x12);
507 p1pll
->pll_out_max
= RBIOS32(pll_info
+ 0x16);
510 p1pll
->pll_in_min
= RBIOS32(pll_info
+ 0x36);
511 p1pll
->pll_in_max
= RBIOS32(pll_info
+ 0x3a);
513 p1pll
->pll_in_min
= 40;
514 p1pll
->pll_in_max
= 500;
519 spll
->reference_freq
= RBIOS16(pll_info
+ 0x1a);
520 spll
->reference_div
= RBIOS16(pll_info
+ 0x1c);
521 spll
->pll_out_min
= RBIOS32(pll_info
+ 0x1e);
522 spll
->pll_out_max
= RBIOS32(pll_info
+ 0x22);
525 spll
->pll_in_min
= RBIOS32(pll_info
+ 0x48);
526 spll
->pll_in_max
= RBIOS32(pll_info
+ 0x4c);
529 spll
->pll_in_min
= 40;
530 spll
->pll_in_max
= 500;
534 mpll
->reference_freq
= RBIOS16(pll_info
+ 0x26);
535 mpll
->reference_div
= RBIOS16(pll_info
+ 0x28);
536 mpll
->pll_out_min
= RBIOS32(pll_info
+ 0x2a);
537 mpll
->pll_out_max
= RBIOS32(pll_info
+ 0x2e);
540 mpll
->pll_in_min
= RBIOS32(pll_info
+ 0x5a);
541 mpll
->pll_in_max
= RBIOS32(pll_info
+ 0x5e);
544 mpll
->pll_in_min
= 40;
545 mpll
->pll_in_max
= 500;
548 /* default sclk/mclk */
549 sclk
= RBIOS16(pll_info
+ 0xa);
550 mclk
= RBIOS16(pll_info
+ 0x8);
556 rdev
->clock
.default_sclk
= sclk
;
557 rdev
->clock
.default_mclk
= mclk
;
564 struct radeon_encoder_primary_dac
*radeon_combios_get_primary_dac_info(struct
568 struct drm_device
*dev
= encoder
->base
.dev
;
569 struct radeon_device
*rdev
= dev
->dev_private
;
571 uint8_t rev
, bg
, dac
;
572 struct radeon_encoder_primary_dac
*p_dac
= NULL
;
574 if (rdev
->bios
== NULL
)
577 /* check CRT table */
578 dac_info
= combios_get_table_offset(dev
, COMBIOS_CRT_INFO_TABLE
);
581 kzalloc(sizeof(struct radeon_encoder_primary_dac
),
587 rev
= RBIOS8(dac_info
) & 0x3;
589 bg
= RBIOS8(dac_info
+ 0x2) & 0xf;
590 dac
= (RBIOS8(dac_info
+ 0x2) >> 4) & 0xf;
591 p_dac
->ps2_pdac_adj
= (bg
<< 8) | (dac
);
593 bg
= RBIOS8(dac_info
+ 0x2) & 0xf;
594 dac
= RBIOS8(dac_info
+ 0x3) & 0xf;
595 p_dac
->ps2_pdac_adj
= (bg
<< 8) | (dac
);
603 static enum radeon_tv_std
604 radeon_combios_get_tv_info(struct radeon_encoder
*encoder
)
606 struct drm_device
*dev
= encoder
->base
.dev
;
607 struct radeon_device
*rdev
= dev
->dev_private
;
609 enum radeon_tv_std tv_std
= TV_STD_NTSC
;
611 tv_info
= combios_get_table_offset(dev
, COMBIOS_TV_INFO_TABLE
);
613 if (RBIOS8(tv_info
+ 6) == 'T') {
614 switch (RBIOS8(tv_info
+ 7) & 0xf) {
616 tv_std
= TV_STD_NTSC
;
617 DRM_INFO("Default TV standard: NTSC\n");
621 DRM_INFO("Default TV standard: PAL\n");
624 tv_std
= TV_STD_PAL_M
;
625 DRM_INFO("Default TV standard: PAL-M\n");
628 tv_std
= TV_STD_PAL_60
;
629 DRM_INFO("Default TV standard: PAL-60\n");
632 tv_std
= TV_STD_NTSC_J
;
633 DRM_INFO("Default TV standard: NTSC-J\n");
636 tv_std
= TV_STD_SCART_PAL
;
637 DRM_INFO("Default TV standard: SCART-PAL\n");
640 tv_std
= TV_STD_NTSC
;
642 ("Unknown TV standard; defaulting to NTSC\n");
646 switch ((RBIOS8(tv_info
+ 9) >> 2) & 0x3) {
648 DRM_INFO("29.498928713 MHz TV ref clk\n");
651 DRM_INFO("28.636360000 MHz TV ref clk\n");
654 DRM_INFO("14.318180000 MHz TV ref clk\n");
657 DRM_INFO("27.000000000 MHz TV ref clk\n");
667 static const uint32_t default_tvdac_adj
[CHIP_LAST
] = {
668 0x00000000, /* r100 */
669 0x00280000, /* rv100 */
670 0x00000000, /* rs100 */
671 0x00880000, /* rv200 */
672 0x00000000, /* rs200 */
673 0x00000000, /* r200 */
674 0x00770000, /* rv250 */
675 0x00290000, /* rs300 */
676 0x00560000, /* rv280 */
677 0x00780000, /* r300 */
678 0x00770000, /* r350 */
679 0x00780000, /* rv350 */
680 0x00780000, /* rv380 */
681 0x01080000, /* r420 */
682 0x01080000, /* r423 */
683 0x01080000, /* rv410 */
684 0x00780000, /* rs400 */
685 0x00780000, /* rs480 */
688 static void radeon_legacy_get_tv_dac_info_from_table(struct radeon_device
*rdev
,
689 struct radeon_encoder_tv_dac
*tv_dac
)
691 tv_dac
->ps2_tvdac_adj
= default_tvdac_adj
[rdev
->family
];
692 if ((rdev
->flags
& RADEON_IS_MOBILITY
) && (rdev
->family
== CHIP_RV250
))
693 tv_dac
->ps2_tvdac_adj
= 0x00880000;
694 tv_dac
->pal_tvdac_adj
= tv_dac
->ps2_tvdac_adj
;
695 tv_dac
->ntsc_tvdac_adj
= tv_dac
->ps2_tvdac_adj
;
699 struct radeon_encoder_tv_dac
*radeon_combios_get_tv_dac_info(struct
703 struct drm_device
*dev
= encoder
->base
.dev
;
704 struct radeon_device
*rdev
= dev
->dev_private
;
706 uint8_t rev
, bg
, dac
;
707 struct radeon_encoder_tv_dac
*tv_dac
= NULL
;
710 tv_dac
= kzalloc(sizeof(struct radeon_encoder_tv_dac
), GFP_KERNEL
);
714 if (rdev
->bios
== NULL
)
717 /* first check TV table */
718 dac_info
= combios_get_table_offset(dev
, COMBIOS_TV_INFO_TABLE
);
720 rev
= RBIOS8(dac_info
+ 0x3);
722 bg
= RBIOS8(dac_info
+ 0xc) & 0xf;
723 dac
= RBIOS8(dac_info
+ 0xd) & 0xf;
724 tv_dac
->ps2_tvdac_adj
= (bg
<< 16) | (dac
<< 20);
726 bg
= RBIOS8(dac_info
+ 0xe) & 0xf;
727 dac
= RBIOS8(dac_info
+ 0xf) & 0xf;
728 tv_dac
->pal_tvdac_adj
= (bg
<< 16) | (dac
<< 20);
730 bg
= RBIOS8(dac_info
+ 0x10) & 0xf;
731 dac
= RBIOS8(dac_info
+ 0x11) & 0xf;
732 tv_dac
->ntsc_tvdac_adj
= (bg
<< 16) | (dac
<< 20);
734 } else if (rev
> 1) {
735 bg
= RBIOS8(dac_info
+ 0xc) & 0xf;
736 dac
= (RBIOS8(dac_info
+ 0xc) >> 4) & 0xf;
737 tv_dac
->ps2_tvdac_adj
= (bg
<< 16) | (dac
<< 20);
739 bg
= RBIOS8(dac_info
+ 0xd) & 0xf;
740 dac
= (RBIOS8(dac_info
+ 0xd) >> 4) & 0xf;
741 tv_dac
->pal_tvdac_adj
= (bg
<< 16) | (dac
<< 20);
743 bg
= RBIOS8(dac_info
+ 0xe) & 0xf;
744 dac
= (RBIOS8(dac_info
+ 0xe) >> 4) & 0xf;
745 tv_dac
->ntsc_tvdac_adj
= (bg
<< 16) | (dac
<< 20);
748 tv_dac
->tv_std
= radeon_combios_get_tv_info(encoder
);
751 /* then check CRT table */
753 combios_get_table_offset(dev
, COMBIOS_CRT_INFO_TABLE
);
755 rev
= RBIOS8(dac_info
) & 0x3;
757 bg
= RBIOS8(dac_info
+ 0x3) & 0xf;
758 dac
= (RBIOS8(dac_info
+ 0x3) >> 4) & 0xf;
759 tv_dac
->ps2_tvdac_adj
=
760 (bg
<< 16) | (dac
<< 20);
761 tv_dac
->pal_tvdac_adj
= tv_dac
->ps2_tvdac_adj
;
762 tv_dac
->ntsc_tvdac_adj
= tv_dac
->ps2_tvdac_adj
;
765 bg
= RBIOS8(dac_info
+ 0x4) & 0xf;
766 dac
= RBIOS8(dac_info
+ 0x5) & 0xf;
767 tv_dac
->ps2_tvdac_adj
=
768 (bg
<< 16) | (dac
<< 20);
769 tv_dac
->pal_tvdac_adj
= tv_dac
->ps2_tvdac_adj
;
770 tv_dac
->ntsc_tvdac_adj
= tv_dac
->ps2_tvdac_adj
;
774 DRM_INFO("No TV DAC info found in BIOS\n");
779 if (!found
) /* fallback to defaults */
780 radeon_legacy_get_tv_dac_info_from_table(rdev
, tv_dac
);
785 static struct radeon_encoder_lvds
*radeon_legacy_get_lvds_info_from_regs(struct
789 struct radeon_encoder_lvds
*lvds
= NULL
;
790 uint32_t fp_vert_stretch
, fp_horz_stretch
;
791 uint32_t ppll_div_sel
, ppll_val
;
792 uint32_t lvds_ss_gen_cntl
= RREG32(RADEON_LVDS_SS_GEN_CNTL
);
794 lvds
= kzalloc(sizeof(struct radeon_encoder_lvds
), GFP_KERNEL
);
799 fp_vert_stretch
= RREG32(RADEON_FP_VERT_STRETCH
);
800 fp_horz_stretch
= RREG32(RADEON_FP_HORZ_STRETCH
);
802 /* These should be fail-safe defaults, fingers crossed */
803 lvds
->panel_pwr_delay
= 200;
804 lvds
->panel_vcc_delay
= 2000;
806 lvds
->lvds_gen_cntl
= RREG32(RADEON_LVDS_GEN_CNTL
);
807 lvds
->panel_digon_delay
= (lvds_ss_gen_cntl
>> RADEON_LVDS_PWRSEQ_DELAY1_SHIFT
) & 0xf;
808 lvds
->panel_blon_delay
= (lvds_ss_gen_cntl
>> RADEON_LVDS_PWRSEQ_DELAY2_SHIFT
) & 0xf;
810 if (fp_vert_stretch
& RADEON_VERT_STRETCH_ENABLE
)
811 lvds
->native_mode
.panel_yres
=
812 ((fp_vert_stretch
& RADEON_VERT_PANEL_SIZE
) >>
813 RADEON_VERT_PANEL_SHIFT
) + 1;
815 lvds
->native_mode
.panel_yres
=
816 (RREG32(RADEON_CRTC_V_TOTAL_DISP
) >> 16) + 1;
818 if (fp_horz_stretch
& RADEON_HORZ_STRETCH_ENABLE
)
819 lvds
->native_mode
.panel_xres
=
820 (((fp_horz_stretch
& RADEON_HORZ_PANEL_SIZE
) >>
821 RADEON_HORZ_PANEL_SHIFT
) + 1) * 8;
823 lvds
->native_mode
.panel_xres
=
824 ((RREG32(RADEON_CRTC_H_TOTAL_DISP
) >> 16) + 1) * 8;
826 if ((lvds
->native_mode
.panel_xres
< 640) ||
827 (lvds
->native_mode
.panel_yres
< 480)) {
828 lvds
->native_mode
.panel_xres
= 640;
829 lvds
->native_mode
.panel_yres
= 480;
832 ppll_div_sel
= RREG8(RADEON_CLOCK_CNTL_INDEX
+ 1) & 0x3;
833 ppll_val
= RREG32_PLL(RADEON_PPLL_DIV_0
+ ppll_div_sel
);
834 if ((ppll_val
& 0x000707ff) == 0x1bb)
835 lvds
->use_bios_dividers
= false;
837 lvds
->panel_ref_divider
=
838 RREG32_PLL(RADEON_PPLL_REF_DIV
) & 0x3ff;
839 lvds
->panel_post_divider
= (ppll_val
>> 16) & 0x7;
840 lvds
->panel_fb_divider
= ppll_val
& 0x7ff;
842 if ((lvds
->panel_ref_divider
!= 0) &&
843 (lvds
->panel_fb_divider
> 3))
844 lvds
->use_bios_dividers
= true;
846 lvds
->panel_vcc_delay
= 200;
848 DRM_INFO("Panel info derived from registers\n");
849 DRM_INFO("Panel Size %dx%d\n", lvds
->native_mode
.panel_xres
,
850 lvds
->native_mode
.panel_yres
);
855 struct radeon_encoder_lvds
*radeon_combios_get_lvds_info(struct radeon_encoder
858 struct drm_device
*dev
= encoder
->base
.dev
;
859 struct radeon_device
*rdev
= dev
->dev_private
;
861 uint32_t panel_setup
;
864 struct radeon_encoder_lvds
*lvds
= NULL
;
866 if (rdev
->bios
== NULL
) {
867 lvds
= radeon_legacy_get_lvds_info_from_regs(rdev
);
871 lcd_info
= combios_get_table_offset(dev
, COMBIOS_LCD_INFO_TABLE
);
874 lvds
= kzalloc(sizeof(struct radeon_encoder_lvds
), GFP_KERNEL
);
879 for (i
= 0; i
< 24; i
++)
880 stmp
[i
] = RBIOS8(lcd_info
+ i
+ 1);
883 DRM_INFO("Panel ID String: %s\n", stmp
);
885 lvds
->native_mode
.panel_xres
= RBIOS16(lcd_info
+ 0x19);
886 lvds
->native_mode
.panel_yres
= RBIOS16(lcd_info
+ 0x1b);
888 DRM_INFO("Panel Size %dx%d\n", lvds
->native_mode
.panel_xres
,
889 lvds
->native_mode
.panel_yres
);
891 lvds
->panel_vcc_delay
= RBIOS16(lcd_info
+ 0x2c);
892 if (lvds
->panel_vcc_delay
> 2000 || lvds
->panel_vcc_delay
< 0)
893 lvds
->panel_vcc_delay
= 2000;
895 lvds
->panel_pwr_delay
= RBIOS8(lcd_info
+ 0x24);
896 lvds
->panel_digon_delay
= RBIOS16(lcd_info
+ 0x38) & 0xf;
897 lvds
->panel_blon_delay
= (RBIOS16(lcd_info
+ 0x38) >> 4) & 0xf;
899 lvds
->panel_ref_divider
= RBIOS16(lcd_info
+ 0x2e);
900 lvds
->panel_post_divider
= RBIOS8(lcd_info
+ 0x30);
901 lvds
->panel_fb_divider
= RBIOS16(lcd_info
+ 0x31);
902 if ((lvds
->panel_ref_divider
!= 0) &&
903 (lvds
->panel_fb_divider
> 3))
904 lvds
->use_bios_dividers
= true;
906 panel_setup
= RBIOS32(lcd_info
+ 0x39);
907 lvds
->lvds_gen_cntl
= 0xff00;
908 if (panel_setup
& 0x1)
909 lvds
->lvds_gen_cntl
|= RADEON_LVDS_PANEL_FORMAT
;
911 if ((panel_setup
>> 4) & 0x1)
912 lvds
->lvds_gen_cntl
|= RADEON_LVDS_PANEL_TYPE
;
914 switch ((panel_setup
>> 8) & 0x7) {
916 lvds
->lvds_gen_cntl
|= RADEON_LVDS_NO_FM
;
919 lvds
->lvds_gen_cntl
|= RADEON_LVDS_2_GREY
;
922 lvds
->lvds_gen_cntl
|= RADEON_LVDS_4_GREY
;
928 if ((panel_setup
>> 16) & 0x1)
929 lvds
->lvds_gen_cntl
|= RADEON_LVDS_FP_POL_LOW
;
931 if ((panel_setup
>> 17) & 0x1)
932 lvds
->lvds_gen_cntl
|= RADEON_LVDS_LP_POL_LOW
;
934 if ((panel_setup
>> 18) & 0x1)
935 lvds
->lvds_gen_cntl
|= RADEON_LVDS_DTM_POL_LOW
;
937 if ((panel_setup
>> 23) & 0x1)
938 lvds
->lvds_gen_cntl
|= RADEON_LVDS_BL_CLK_SEL
;
940 lvds
->lvds_gen_cntl
|= (panel_setup
& 0xf0000000);
942 for (i
= 0; i
< 32; i
++) {
943 tmp
= RBIOS16(lcd_info
+ 64 + i
* 2);
947 if ((RBIOS16(tmp
) == lvds
->native_mode
.panel_xres
) &&
949 lvds
->native_mode
.panel_yres
)) {
950 lvds
->native_mode
.hblank
=
951 (RBIOS16(tmp
+ 17) - RBIOS16(tmp
+ 19)) * 8;
952 lvds
->native_mode
.hoverplus
=
953 (RBIOS16(tmp
+ 21) - RBIOS16(tmp
+ 19) -
955 lvds
->native_mode
.hsync_width
=
956 RBIOS8(tmp
+ 23) * 8;
958 lvds
->native_mode
.vblank
= (RBIOS16(tmp
+ 24) -
960 lvds
->native_mode
.voverplus
=
961 ((RBIOS16(tmp
+ 28) & 0x7ff) -
963 lvds
->native_mode
.vsync_width
=
964 ((RBIOS16(tmp
+ 28) & 0xf800) >> 11);
965 lvds
->native_mode
.dotclock
=
966 RBIOS16(tmp
+ 9) * 10;
967 lvds
->native_mode
.flags
= 0;
971 DRM_INFO("No panel info found in BIOS\n");
972 lvds
= radeon_legacy_get_lvds_info_from_regs(rdev
);
976 encoder
->native_mode
= lvds
->native_mode
;
980 static const struct radeon_tmds_pll default_tmds_pll
[CHIP_LAST
][4] = {
981 {{12000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}}, /* CHIP_R100 */
982 {{12000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}}, /* CHIP_RV100 */
983 {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_RS100 */
984 {{15000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}}, /* CHIP_RV200 */
985 {{12000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}}, /* CHIP_RS200 */
986 {{15000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}}, /* CHIP_R200 */
987 {{15500, 0x81b}, {0xffffffff, 0x83f}, {0, 0}, {0, 0}}, /* CHIP_RV250 */
988 {{0, 0}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_RS300 */
989 {{13000, 0x400f4}, {15000, 0x400f7}, {0xffffffff, 0x40111}, {0, 0}}, /* CHIP_RV280 */
990 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_R300 */
991 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_R350 */
992 {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}}, /* CHIP_RV350 */
993 {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}}, /* CHIP_RV380 */
994 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_R420 */
995 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_R423 */
996 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}}, /* CHIP_RV410 */
997 {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}}, /* CHIP_RS400 */
998 {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}}, /* CHIP_RS480 */
1001 bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder
*encoder
,
1002 struct radeon_encoder_int_tmds
*tmds
)
1004 struct drm_device
*dev
= encoder
->base
.dev
;
1005 struct radeon_device
*rdev
= dev
->dev_private
;
1008 for (i
= 0; i
< 4; i
++) {
1009 tmds
->tmds_pll
[i
].value
=
1010 default_tmds_pll
[rdev
->family
][i
].value
;
1011 tmds
->tmds_pll
[i
].freq
= default_tmds_pll
[rdev
->family
][i
].freq
;
1017 bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder
*encoder
,
1018 struct radeon_encoder_int_tmds
*tmds
)
1020 struct drm_device
*dev
= encoder
->base
.dev
;
1021 struct radeon_device
*rdev
= dev
->dev_private
;
1026 if (rdev
->bios
== NULL
)
1029 tmds_info
= combios_get_table_offset(dev
, COMBIOS_DFP_INFO_TABLE
);
1033 ver
= RBIOS8(tmds_info
);
1034 DRM_INFO("DFP table revision: %d\n", ver
);
1036 n
= RBIOS8(tmds_info
+ 5) + 1;
1039 for (i
= 0; i
< n
; i
++) {
1040 tmds
->tmds_pll
[i
].value
=
1041 RBIOS32(tmds_info
+ i
* 10 + 0x08);
1042 tmds
->tmds_pll
[i
].freq
=
1043 RBIOS16(tmds_info
+ i
* 10 + 0x10);
1044 DRM_DEBUG("TMDS PLL From COMBIOS %u %x\n",
1045 tmds
->tmds_pll
[i
].freq
,
1046 tmds
->tmds_pll
[i
].value
);
1048 } else if (ver
== 4) {
1050 n
= RBIOS8(tmds_info
+ 5) + 1;
1053 for (i
= 0; i
< n
; i
++) {
1054 tmds
->tmds_pll
[i
].value
=
1055 RBIOS32(tmds_info
+ stride
+ 0x08);
1056 tmds
->tmds_pll
[i
].freq
=
1057 RBIOS16(tmds_info
+ stride
+ 0x10);
1062 DRM_DEBUG("TMDS PLL From COMBIOS %u %x\n",
1063 tmds
->tmds_pll
[i
].freq
,
1064 tmds
->tmds_pll
[i
].value
);
1068 DRM_INFO("No TMDS info found in BIOS\n");
1072 struct radeon_encoder_int_tmds
*radeon_combios_get_tmds_info(struct radeon_encoder
*encoder
)
1074 struct radeon_encoder_int_tmds
*tmds
= NULL
;
1077 tmds
= kzalloc(sizeof(struct radeon_encoder_int_tmds
), GFP_KERNEL
);
1082 ret
= radeon_legacy_get_tmds_info_from_combios(encoder
, tmds
);
1084 radeon_legacy_get_tmds_info_from_table(encoder
, tmds
);
1089 void radeon_combios_get_ext_tmds_info(struct radeon_encoder
*encoder
)
1091 struct drm_device
*dev
= encoder
->base
.dev
;
1092 struct radeon_device
*rdev
= dev
->dev_private
;
1093 uint16_t ext_tmds_info
;
1096 if (rdev
->bios
== NULL
)
1100 combios_get_table_offset(dev
, COMBIOS_EXT_TMDS_INFO_TABLE
);
1101 if (ext_tmds_info
) {
1102 ver
= RBIOS8(ext_tmds_info
);
1103 DRM_INFO("External TMDS Table revision: %d\n", ver
);
1108 bool radeon_get_legacy_connector_info_from_table(struct drm_device
*dev
)
1110 struct radeon_device
*rdev
= dev
->dev_private
;
1111 struct radeon_i2c_bus_rec ddc_i2c
;
1113 rdev
->mode_info
.connector_table
= radeon_connector_table
;
1114 if (rdev
->mode_info
.connector_table
== CT_NONE
) {
1115 #ifdef CONFIG_PPC_PMAC
1116 if (machine_is_compatible("PowerBook3,3")) {
1117 /* powerbook with VGA */
1118 rdev
->mode_info
.connector_table
= CT_POWERBOOK_VGA
;
1119 } else if (machine_is_compatible("PowerBook3,4") ||
1120 machine_is_compatible("PowerBook3,5")) {
1121 /* powerbook with internal tmds */
1122 rdev
->mode_info
.connector_table
= CT_POWERBOOK_INTERNAL
;
1123 } else if (machine_is_compatible("PowerBook5,1") ||
1124 machine_is_compatible("PowerBook5,2") ||
1125 machine_is_compatible("PowerBook5,3") ||
1126 machine_is_compatible("PowerBook5,4") ||
1127 machine_is_compatible("PowerBook5,5")) {
1128 /* powerbook with external single link tmds (sil164) */
1129 rdev
->mode_info
.connector_table
= CT_POWERBOOK_EXTERNAL
;
1130 } else if (machine_is_compatible("PowerBook5,6")) {
1131 /* powerbook with external dual or single link tmds */
1132 rdev
->mode_info
.connector_table
= CT_POWERBOOK_EXTERNAL
;
1133 } else if (machine_is_compatible("PowerBook5,7") ||
1134 machine_is_compatible("PowerBook5,8") ||
1135 machine_is_compatible("PowerBook5,9")) {
1136 /* PowerBook6,2 ? */
1137 /* powerbook with external dual link tmds (sil1178?) */
1138 rdev
->mode_info
.connector_table
= CT_POWERBOOK_EXTERNAL
;
1139 } else if (machine_is_compatible("PowerBook4,1") ||
1140 machine_is_compatible("PowerBook4,2") ||
1141 machine_is_compatible("PowerBook4,3") ||
1142 machine_is_compatible("PowerBook6,3") ||
1143 machine_is_compatible("PowerBook6,5") ||
1144 machine_is_compatible("PowerBook6,7")) {
1146 rdev
->mode_info
.connector_table
= CT_IBOOK
;
1147 } else if (machine_is_compatible("PowerMac4,4")) {
1149 rdev
->mode_info
.connector_table
= CT_EMAC
;
1150 } else if (machine_is_compatible("PowerMac10,1")) {
1151 /* mini with internal tmds */
1152 rdev
->mode_info
.connector_table
= CT_MINI_INTERNAL
;
1153 } else if (machine_is_compatible("PowerMac10,2")) {
1154 /* mini with external tmds */
1155 rdev
->mode_info
.connector_table
= CT_MINI_EXTERNAL
;
1156 } else if (machine_is_compatible("PowerMac12,1")) {
1158 /* imac g5 isight */
1159 rdev
->mode_info
.connector_table
= CT_IMAC_G5_ISIGHT
;
1161 #endif /* CONFIG_PPC_PMAC */
1162 rdev
->mode_info
.connector_table
= CT_GENERIC
;
1165 switch (rdev
->mode_info
.connector_table
) {
1167 DRM_INFO("Connector Table: %d (generic)\n",
1168 rdev
->mode_info
.connector_table
);
1169 /* these are the most common settings */
1170 if (rdev
->flags
& RADEON_SINGLE_CRTC
) {
1171 /* VGA - primary dac */
1172 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1173 radeon_add_legacy_encoder(dev
,
1174 radeon_get_encoder_id(dev
,
1175 ATOM_DEVICE_CRT1_SUPPORT
,
1177 ATOM_DEVICE_CRT1_SUPPORT
);
1178 radeon_add_legacy_connector(dev
, 0,
1179 ATOM_DEVICE_CRT1_SUPPORT
,
1180 DRM_MODE_CONNECTOR_VGA
,
1182 } else if (rdev
->flags
& RADEON_IS_MOBILITY
) {
1184 ddc_i2c
= combios_setup_i2c_bus(RADEON_LCD_GPIO_MASK
);
1185 radeon_add_legacy_encoder(dev
,
1186 radeon_get_encoder_id(dev
,
1187 ATOM_DEVICE_LCD1_SUPPORT
,
1189 ATOM_DEVICE_LCD1_SUPPORT
);
1190 radeon_add_legacy_connector(dev
, 0,
1191 ATOM_DEVICE_LCD1_SUPPORT
,
1192 DRM_MODE_CONNECTOR_LVDS
,
1195 /* VGA - primary dac */
1196 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1197 radeon_add_legacy_encoder(dev
,
1198 radeon_get_encoder_id(dev
,
1199 ATOM_DEVICE_CRT1_SUPPORT
,
1201 ATOM_DEVICE_CRT1_SUPPORT
);
1202 radeon_add_legacy_connector(dev
, 1,
1203 ATOM_DEVICE_CRT1_SUPPORT
,
1204 DRM_MODE_CONNECTOR_VGA
,
1207 /* DVI-I - tv dac, int tmds */
1208 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1209 radeon_add_legacy_encoder(dev
,
1210 radeon_get_encoder_id(dev
,
1211 ATOM_DEVICE_DFP1_SUPPORT
,
1213 ATOM_DEVICE_DFP1_SUPPORT
);
1214 radeon_add_legacy_encoder(dev
,
1215 radeon_get_encoder_id(dev
,
1216 ATOM_DEVICE_CRT2_SUPPORT
,
1218 ATOM_DEVICE_CRT2_SUPPORT
);
1219 radeon_add_legacy_connector(dev
, 0,
1220 ATOM_DEVICE_DFP1_SUPPORT
|
1221 ATOM_DEVICE_CRT2_SUPPORT
,
1222 DRM_MODE_CONNECTOR_DVII
,
1225 /* VGA - primary dac */
1226 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1227 radeon_add_legacy_encoder(dev
,
1228 radeon_get_encoder_id(dev
,
1229 ATOM_DEVICE_CRT1_SUPPORT
,
1231 ATOM_DEVICE_CRT1_SUPPORT
);
1232 radeon_add_legacy_connector(dev
, 1,
1233 ATOM_DEVICE_CRT1_SUPPORT
,
1234 DRM_MODE_CONNECTOR_VGA
,
1238 if (rdev
->family
!= CHIP_R100
&& rdev
->family
!= CHIP_R200
) {
1240 radeon_add_legacy_encoder(dev
,
1241 radeon_get_encoder_id(dev
,
1242 ATOM_DEVICE_TV1_SUPPORT
,
1244 ATOM_DEVICE_TV1_SUPPORT
);
1245 radeon_add_legacy_connector(dev
, 2,
1246 ATOM_DEVICE_TV1_SUPPORT
,
1247 DRM_MODE_CONNECTOR_SVIDEO
,
1252 DRM_INFO("Connector Table: %d (ibook)\n",
1253 rdev
->mode_info
.connector_table
);
1255 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1256 radeon_add_legacy_encoder(dev
,
1257 radeon_get_encoder_id(dev
,
1258 ATOM_DEVICE_LCD1_SUPPORT
,
1260 ATOM_DEVICE_LCD1_SUPPORT
);
1261 radeon_add_legacy_connector(dev
, 0, ATOM_DEVICE_LCD1_SUPPORT
,
1262 DRM_MODE_CONNECTOR_LVDS
, &ddc_i2c
);
1264 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1265 radeon_add_legacy_encoder(dev
,
1266 radeon_get_encoder_id(dev
,
1267 ATOM_DEVICE_CRT2_SUPPORT
,
1269 ATOM_DEVICE_CRT2_SUPPORT
);
1270 radeon_add_legacy_connector(dev
, 1, ATOM_DEVICE_CRT2_SUPPORT
,
1271 DRM_MODE_CONNECTOR_VGA
, &ddc_i2c
);
1273 radeon_add_legacy_encoder(dev
,
1274 radeon_get_encoder_id(dev
,
1275 ATOM_DEVICE_TV1_SUPPORT
,
1277 ATOM_DEVICE_TV1_SUPPORT
);
1278 radeon_add_legacy_connector(dev
, 2, ATOM_DEVICE_TV1_SUPPORT
,
1279 DRM_MODE_CONNECTOR_SVIDEO
,
1282 case CT_POWERBOOK_EXTERNAL
:
1283 DRM_INFO("Connector Table: %d (powerbook external tmds)\n",
1284 rdev
->mode_info
.connector_table
);
1286 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1287 radeon_add_legacy_encoder(dev
,
1288 radeon_get_encoder_id(dev
,
1289 ATOM_DEVICE_LCD1_SUPPORT
,
1291 ATOM_DEVICE_LCD1_SUPPORT
);
1292 radeon_add_legacy_connector(dev
, 0, ATOM_DEVICE_LCD1_SUPPORT
,
1293 DRM_MODE_CONNECTOR_LVDS
, &ddc_i2c
);
1294 /* DVI-I - primary dac, ext tmds */
1295 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1296 radeon_add_legacy_encoder(dev
,
1297 radeon_get_encoder_id(dev
,
1298 ATOM_DEVICE_DFP2_SUPPORT
,
1300 ATOM_DEVICE_DFP2_SUPPORT
);
1301 radeon_add_legacy_encoder(dev
,
1302 radeon_get_encoder_id(dev
,
1303 ATOM_DEVICE_CRT1_SUPPORT
,
1305 ATOM_DEVICE_CRT1_SUPPORT
);
1306 radeon_add_legacy_connector(dev
, 1,
1307 ATOM_DEVICE_DFP2_SUPPORT
|
1308 ATOM_DEVICE_CRT1_SUPPORT
,
1309 DRM_MODE_CONNECTOR_DVII
, &ddc_i2c
);
1311 radeon_add_legacy_encoder(dev
,
1312 radeon_get_encoder_id(dev
,
1313 ATOM_DEVICE_TV1_SUPPORT
,
1315 ATOM_DEVICE_TV1_SUPPORT
);
1316 radeon_add_legacy_connector(dev
, 2, ATOM_DEVICE_TV1_SUPPORT
,
1317 DRM_MODE_CONNECTOR_SVIDEO
,
1320 case CT_POWERBOOK_INTERNAL
:
1321 DRM_INFO("Connector Table: %d (powerbook internal tmds)\n",
1322 rdev
->mode_info
.connector_table
);
1324 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1325 radeon_add_legacy_encoder(dev
,
1326 radeon_get_encoder_id(dev
,
1327 ATOM_DEVICE_LCD1_SUPPORT
,
1329 ATOM_DEVICE_LCD1_SUPPORT
);
1330 radeon_add_legacy_connector(dev
, 0, ATOM_DEVICE_LCD1_SUPPORT
,
1331 DRM_MODE_CONNECTOR_LVDS
, &ddc_i2c
);
1332 /* DVI-I - primary dac, int tmds */
1333 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1334 radeon_add_legacy_encoder(dev
,
1335 radeon_get_encoder_id(dev
,
1336 ATOM_DEVICE_DFP1_SUPPORT
,
1338 ATOM_DEVICE_DFP1_SUPPORT
);
1339 radeon_add_legacy_encoder(dev
,
1340 radeon_get_encoder_id(dev
,
1341 ATOM_DEVICE_CRT1_SUPPORT
,
1343 ATOM_DEVICE_CRT1_SUPPORT
);
1344 radeon_add_legacy_connector(dev
, 1,
1345 ATOM_DEVICE_DFP1_SUPPORT
|
1346 ATOM_DEVICE_CRT1_SUPPORT
,
1347 DRM_MODE_CONNECTOR_DVII
, &ddc_i2c
);
1349 radeon_add_legacy_encoder(dev
,
1350 radeon_get_encoder_id(dev
,
1351 ATOM_DEVICE_TV1_SUPPORT
,
1353 ATOM_DEVICE_TV1_SUPPORT
);
1354 radeon_add_legacy_connector(dev
, 2, ATOM_DEVICE_TV1_SUPPORT
,
1355 DRM_MODE_CONNECTOR_SVIDEO
,
1358 case CT_POWERBOOK_VGA
:
1359 DRM_INFO("Connector Table: %d (powerbook vga)\n",
1360 rdev
->mode_info
.connector_table
);
1362 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1363 radeon_add_legacy_encoder(dev
,
1364 radeon_get_encoder_id(dev
,
1365 ATOM_DEVICE_LCD1_SUPPORT
,
1367 ATOM_DEVICE_LCD1_SUPPORT
);
1368 radeon_add_legacy_connector(dev
, 0, ATOM_DEVICE_LCD1_SUPPORT
,
1369 DRM_MODE_CONNECTOR_LVDS
, &ddc_i2c
);
1370 /* VGA - primary dac */
1371 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1372 radeon_add_legacy_encoder(dev
,
1373 radeon_get_encoder_id(dev
,
1374 ATOM_DEVICE_CRT1_SUPPORT
,
1376 ATOM_DEVICE_CRT1_SUPPORT
);
1377 radeon_add_legacy_connector(dev
, 1, ATOM_DEVICE_CRT1_SUPPORT
,
1378 DRM_MODE_CONNECTOR_VGA
, &ddc_i2c
);
1380 radeon_add_legacy_encoder(dev
,
1381 radeon_get_encoder_id(dev
,
1382 ATOM_DEVICE_TV1_SUPPORT
,
1384 ATOM_DEVICE_TV1_SUPPORT
);
1385 radeon_add_legacy_connector(dev
, 2, ATOM_DEVICE_TV1_SUPPORT
,
1386 DRM_MODE_CONNECTOR_SVIDEO
,
1389 case CT_MINI_EXTERNAL
:
1390 DRM_INFO("Connector Table: %d (mini external tmds)\n",
1391 rdev
->mode_info
.connector_table
);
1392 /* DVI-I - tv dac, ext tmds */
1393 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC
);
1394 radeon_add_legacy_encoder(dev
,
1395 radeon_get_encoder_id(dev
,
1396 ATOM_DEVICE_DFP2_SUPPORT
,
1398 ATOM_DEVICE_DFP2_SUPPORT
);
1399 radeon_add_legacy_encoder(dev
,
1400 radeon_get_encoder_id(dev
,
1401 ATOM_DEVICE_CRT2_SUPPORT
,
1403 ATOM_DEVICE_CRT2_SUPPORT
);
1404 radeon_add_legacy_connector(dev
, 0,
1405 ATOM_DEVICE_DFP2_SUPPORT
|
1406 ATOM_DEVICE_CRT2_SUPPORT
,
1407 DRM_MODE_CONNECTOR_DVII
, &ddc_i2c
);
1409 radeon_add_legacy_encoder(dev
,
1410 radeon_get_encoder_id(dev
,
1411 ATOM_DEVICE_TV1_SUPPORT
,
1413 ATOM_DEVICE_TV1_SUPPORT
);
1414 radeon_add_legacy_connector(dev
, 1, ATOM_DEVICE_TV1_SUPPORT
,
1415 DRM_MODE_CONNECTOR_SVIDEO
,
1418 case CT_MINI_INTERNAL
:
1419 DRM_INFO("Connector Table: %d (mini internal tmds)\n",
1420 rdev
->mode_info
.connector_table
);
1421 /* DVI-I - tv dac, int tmds */
1422 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC
);
1423 radeon_add_legacy_encoder(dev
,
1424 radeon_get_encoder_id(dev
,
1425 ATOM_DEVICE_DFP1_SUPPORT
,
1427 ATOM_DEVICE_DFP1_SUPPORT
);
1428 radeon_add_legacy_encoder(dev
,
1429 radeon_get_encoder_id(dev
,
1430 ATOM_DEVICE_CRT2_SUPPORT
,
1432 ATOM_DEVICE_CRT2_SUPPORT
);
1433 radeon_add_legacy_connector(dev
, 0,
1434 ATOM_DEVICE_DFP1_SUPPORT
|
1435 ATOM_DEVICE_CRT2_SUPPORT
,
1436 DRM_MODE_CONNECTOR_DVII
, &ddc_i2c
);
1438 radeon_add_legacy_encoder(dev
,
1439 radeon_get_encoder_id(dev
,
1440 ATOM_DEVICE_TV1_SUPPORT
,
1442 ATOM_DEVICE_TV1_SUPPORT
);
1443 radeon_add_legacy_connector(dev
, 1, ATOM_DEVICE_TV1_SUPPORT
,
1444 DRM_MODE_CONNECTOR_SVIDEO
,
1447 case CT_IMAC_G5_ISIGHT
:
1448 DRM_INFO("Connector Table: %d (imac g5 isight)\n",
1449 rdev
->mode_info
.connector_table
);
1450 /* DVI-D - int tmds */
1451 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_MONID
);
1452 radeon_add_legacy_encoder(dev
,
1453 radeon_get_encoder_id(dev
,
1454 ATOM_DEVICE_DFP1_SUPPORT
,
1456 ATOM_DEVICE_DFP1_SUPPORT
);
1457 radeon_add_legacy_connector(dev
, 0, ATOM_DEVICE_DFP1_SUPPORT
,
1458 DRM_MODE_CONNECTOR_DVID
, &ddc_i2c
);
1460 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1461 radeon_add_legacy_encoder(dev
,
1462 radeon_get_encoder_id(dev
,
1463 ATOM_DEVICE_CRT2_SUPPORT
,
1465 ATOM_DEVICE_CRT2_SUPPORT
);
1466 radeon_add_legacy_connector(dev
, 1, ATOM_DEVICE_CRT2_SUPPORT
,
1467 DRM_MODE_CONNECTOR_VGA
, &ddc_i2c
);
1469 radeon_add_legacy_encoder(dev
,
1470 radeon_get_encoder_id(dev
,
1471 ATOM_DEVICE_TV1_SUPPORT
,
1473 ATOM_DEVICE_TV1_SUPPORT
);
1474 radeon_add_legacy_connector(dev
, 2, ATOM_DEVICE_TV1_SUPPORT
,
1475 DRM_MODE_CONNECTOR_SVIDEO
,
1479 DRM_INFO("Connector Table: %d (emac)\n",
1480 rdev
->mode_info
.connector_table
);
1481 /* VGA - primary dac */
1482 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1483 radeon_add_legacy_encoder(dev
,
1484 radeon_get_encoder_id(dev
,
1485 ATOM_DEVICE_CRT1_SUPPORT
,
1487 ATOM_DEVICE_CRT1_SUPPORT
);
1488 radeon_add_legacy_connector(dev
, 0, ATOM_DEVICE_CRT1_SUPPORT
,
1489 DRM_MODE_CONNECTOR_VGA
, &ddc_i2c
);
1491 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC
);
1492 radeon_add_legacy_encoder(dev
,
1493 radeon_get_encoder_id(dev
,
1494 ATOM_DEVICE_CRT2_SUPPORT
,
1496 ATOM_DEVICE_CRT2_SUPPORT
);
1497 radeon_add_legacy_connector(dev
, 1, ATOM_DEVICE_CRT2_SUPPORT
,
1498 DRM_MODE_CONNECTOR_VGA
, &ddc_i2c
);
1500 radeon_add_legacy_encoder(dev
,
1501 radeon_get_encoder_id(dev
,
1502 ATOM_DEVICE_TV1_SUPPORT
,
1504 ATOM_DEVICE_TV1_SUPPORT
);
1505 radeon_add_legacy_connector(dev
, 2, ATOM_DEVICE_TV1_SUPPORT
,
1506 DRM_MODE_CONNECTOR_SVIDEO
,
1510 DRM_INFO("Connector table: %d (invalid)\n",
1511 rdev
->mode_info
.connector_table
);
1515 radeon_link_encoder_connector(dev
);
1520 static bool radeon_apply_legacy_quirks(struct drm_device
*dev
,
1522 enum radeon_combios_connector
1524 struct radeon_i2c_bus_rec
*ddc_i2c
)
1526 struct radeon_device
*rdev
= dev
->dev_private
;
1528 /* XPRESS DDC quirks */
1529 if ((rdev
->family
== CHIP_RS400
||
1530 rdev
->family
== CHIP_RS480
) &&
1531 ddc_i2c
->mask_clk_reg
== RADEON_GPIO_CRT2_DDC
)
1532 *ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_MONID
);
1533 else if ((rdev
->family
== CHIP_RS400
||
1534 rdev
->family
== CHIP_RS480
) &&
1535 ddc_i2c
->mask_clk_reg
== RADEON_GPIO_MONID
) {
1536 ddc_i2c
->valid
= true;
1537 ddc_i2c
->mask_clk_mask
= (0x20 << 8);
1538 ddc_i2c
->mask_data_mask
= 0x80;
1539 ddc_i2c
->a_clk_mask
= (0x20 << 8);
1540 ddc_i2c
->a_data_mask
= 0x80;
1541 ddc_i2c
->put_clk_mask
= (0x20 << 8);
1542 ddc_i2c
->put_data_mask
= 0x80;
1543 ddc_i2c
->get_clk_mask
= (0x20 << 8);
1544 ddc_i2c
->get_data_mask
= 0x80;
1545 ddc_i2c
->mask_clk_reg
= RADEON_GPIOPAD_MASK
;
1546 ddc_i2c
->mask_data_reg
= RADEON_GPIOPAD_MASK
;
1547 ddc_i2c
->a_clk_reg
= RADEON_GPIOPAD_A
;
1548 ddc_i2c
->a_data_reg
= RADEON_GPIOPAD_A
;
1549 ddc_i2c
->put_clk_reg
= RADEON_GPIOPAD_EN
;
1550 ddc_i2c
->put_data_reg
= RADEON_GPIOPAD_EN
;
1551 ddc_i2c
->get_clk_reg
= RADEON_LCD_GPIO_Y_REG
;
1552 ddc_i2c
->get_data_reg
= RADEON_LCD_GPIO_Y_REG
;
1555 /* Certain IBM chipset RN50s have a BIOS reporting two VGAs,
1556 one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */
1557 if (dev
->pdev
->device
== 0x515e &&
1558 dev
->pdev
->subsystem_vendor
== 0x1014) {
1559 if (*legacy_connector
== CONNECTOR_CRT_LEGACY
&&
1560 ddc_i2c
->mask_clk_reg
== RADEON_GPIO_CRT2_DDC
)
1564 /* Some RV100 cards with 2 VGA ports show up with DVI+VGA */
1565 if (dev
->pdev
->device
== 0x5159 &&
1566 dev
->pdev
->subsystem_vendor
== 0x1002 &&
1567 dev
->pdev
->subsystem_device
== 0x013a) {
1568 if (*legacy_connector
== CONNECTOR_DVI_I_LEGACY
)
1569 *legacy_connector
= CONNECTOR_CRT_LEGACY
;
1573 /* X300 card with extra non-existent DVI port */
1574 if (dev
->pdev
->device
== 0x5B60 &&
1575 dev
->pdev
->subsystem_vendor
== 0x17af &&
1576 dev
->pdev
->subsystem_device
== 0x201e && bios_index
== 2) {
1577 if (*legacy_connector
== CONNECTOR_DVI_I_LEGACY
)
1584 bool radeon_get_legacy_connector_info_from_bios(struct drm_device
*dev
)
1586 struct radeon_device
*rdev
= dev
->dev_private
;
1587 uint32_t conn_info
, entry
, devices
;
1589 enum radeon_combios_ddc ddc_type
;
1590 enum radeon_combios_connector connector
;
1592 struct radeon_i2c_bus_rec ddc_i2c
;
1594 if (rdev
->bios
== NULL
)
1597 conn_info
= combios_get_table_offset(dev
, COMBIOS_CONNECTOR_INFO_TABLE
);
1599 for (i
= 0; i
< 4; i
++) {
1600 entry
= conn_info
+ 2 + i
* 2;
1602 if (!RBIOS16(entry
))
1605 tmp
= RBIOS16(entry
);
1607 connector
= (tmp
>> 12) & 0xf;
1609 ddc_type
= (tmp
>> 8) & 0xf;
1613 combios_setup_i2c_bus(RADEON_GPIO_MONID
);
1617 combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1621 combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC
);
1625 combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC
);
1631 radeon_apply_legacy_quirks(dev
, i
, &connector
,
1634 switch (connector
) {
1635 case CONNECTOR_PROPRIETARY_LEGACY
:
1636 if ((tmp
>> 4) & 0x1)
1637 devices
= ATOM_DEVICE_DFP2_SUPPORT
;
1639 devices
= ATOM_DEVICE_DFP1_SUPPORT
;
1640 radeon_add_legacy_encoder(dev
,
1641 radeon_get_encoder_id
1644 radeon_add_legacy_connector(dev
, i
, devices
,
1645 legacy_connector_convert
1649 case CONNECTOR_CRT_LEGACY
:
1651 devices
= ATOM_DEVICE_CRT2_SUPPORT
;
1652 radeon_add_legacy_encoder(dev
,
1653 radeon_get_encoder_id
1655 ATOM_DEVICE_CRT2_SUPPORT
,
1657 ATOM_DEVICE_CRT2_SUPPORT
);
1659 devices
= ATOM_DEVICE_CRT1_SUPPORT
;
1660 radeon_add_legacy_encoder(dev
,
1661 radeon_get_encoder_id
1663 ATOM_DEVICE_CRT1_SUPPORT
,
1665 ATOM_DEVICE_CRT1_SUPPORT
);
1667 radeon_add_legacy_connector(dev
,
1670 legacy_connector_convert
1674 case CONNECTOR_DVI_I_LEGACY
:
1677 devices
|= ATOM_DEVICE_CRT2_SUPPORT
;
1678 radeon_add_legacy_encoder(dev
,
1679 radeon_get_encoder_id
1681 ATOM_DEVICE_CRT2_SUPPORT
,
1683 ATOM_DEVICE_CRT2_SUPPORT
);
1685 devices
|= ATOM_DEVICE_CRT1_SUPPORT
;
1686 radeon_add_legacy_encoder(dev
,
1687 radeon_get_encoder_id
1689 ATOM_DEVICE_CRT1_SUPPORT
,
1691 ATOM_DEVICE_CRT1_SUPPORT
);
1693 if ((tmp
>> 4) & 0x1) {
1694 devices
|= ATOM_DEVICE_DFP2_SUPPORT
;
1695 radeon_add_legacy_encoder(dev
,
1696 radeon_get_encoder_id
1698 ATOM_DEVICE_DFP2_SUPPORT
,
1700 ATOM_DEVICE_DFP2_SUPPORT
);
1702 devices
|= ATOM_DEVICE_DFP1_SUPPORT
;
1703 radeon_add_legacy_encoder(dev
,
1704 radeon_get_encoder_id
1706 ATOM_DEVICE_DFP1_SUPPORT
,
1708 ATOM_DEVICE_DFP1_SUPPORT
);
1710 radeon_add_legacy_connector(dev
,
1713 legacy_connector_convert
1717 case CONNECTOR_DVI_D_LEGACY
:
1718 if ((tmp
>> 4) & 0x1)
1719 devices
= ATOM_DEVICE_DFP2_SUPPORT
;
1721 devices
= ATOM_DEVICE_DFP1_SUPPORT
;
1722 radeon_add_legacy_encoder(dev
,
1723 radeon_get_encoder_id
1726 radeon_add_legacy_connector(dev
, i
, devices
,
1727 legacy_connector_convert
1731 case CONNECTOR_CTV_LEGACY
:
1732 case CONNECTOR_STV_LEGACY
:
1733 radeon_add_legacy_encoder(dev
,
1734 radeon_get_encoder_id
1736 ATOM_DEVICE_TV1_SUPPORT
,
1738 ATOM_DEVICE_TV1_SUPPORT
);
1739 radeon_add_legacy_connector(dev
, i
,
1740 ATOM_DEVICE_TV1_SUPPORT
,
1741 legacy_connector_convert
1746 DRM_ERROR("Unknown connector type: %d\n",
1753 uint16_t tmds_info
=
1754 combios_get_table_offset(dev
, COMBIOS_DFP_INFO_TABLE
);
1756 DRM_DEBUG("Found DFP table, assuming DVI connector\n");
1758 radeon_add_legacy_encoder(dev
,
1759 radeon_get_encoder_id(dev
,
1760 ATOM_DEVICE_CRT1_SUPPORT
,
1762 ATOM_DEVICE_CRT1_SUPPORT
);
1763 radeon_add_legacy_encoder(dev
,
1764 radeon_get_encoder_id(dev
,
1765 ATOM_DEVICE_DFP1_SUPPORT
,
1767 ATOM_DEVICE_DFP1_SUPPORT
);
1769 ddc_i2c
= combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC
);
1770 radeon_add_legacy_connector(dev
,
1772 ATOM_DEVICE_CRT1_SUPPORT
|
1773 ATOM_DEVICE_DFP1_SUPPORT
,
1774 DRM_MODE_CONNECTOR_DVII
,
1777 DRM_DEBUG("No connector info found\n");
1782 if (rdev
->flags
& RADEON_IS_MOBILITY
|| rdev
->flags
& RADEON_IS_IGP
) {
1784 combios_get_table_offset(dev
, COMBIOS_LCD_INFO_TABLE
);
1786 uint16_t lcd_ddc_info
=
1787 combios_get_table_offset(dev
,
1788 COMBIOS_LCD_DDC_INFO_TABLE
);
1790 radeon_add_legacy_encoder(dev
,
1791 radeon_get_encoder_id(dev
,
1792 ATOM_DEVICE_LCD1_SUPPORT
,
1794 ATOM_DEVICE_LCD1_SUPPORT
);
1797 ddc_type
= RBIOS8(lcd_ddc_info
+ 2);
1801 combios_setup_i2c_bus
1802 (RADEON_GPIO_MONID
);
1806 combios_setup_i2c_bus
1807 (RADEON_GPIO_DVI_DDC
);
1811 combios_setup_i2c_bus
1812 (RADEON_GPIO_VGA_DDC
);
1816 combios_setup_i2c_bus
1817 (RADEON_GPIO_CRT2_DDC
);
1821 combios_setup_i2c_bus
1822 (RADEON_LCD_GPIO_MASK
);
1823 ddc_i2c
.mask_clk_mask
=
1824 RBIOS32(lcd_ddc_info
+ 3);
1825 ddc_i2c
.mask_data_mask
=
1826 RBIOS32(lcd_ddc_info
+ 7);
1827 ddc_i2c
.a_clk_mask
=
1828 RBIOS32(lcd_ddc_info
+ 3);
1829 ddc_i2c
.a_data_mask
=
1830 RBIOS32(lcd_ddc_info
+ 7);
1831 ddc_i2c
.put_clk_mask
=
1832 RBIOS32(lcd_ddc_info
+ 3);
1833 ddc_i2c
.put_data_mask
=
1834 RBIOS32(lcd_ddc_info
+ 7);
1835 ddc_i2c
.get_clk_mask
=
1836 RBIOS32(lcd_ddc_info
+ 3);
1837 ddc_i2c
.get_data_mask
=
1838 RBIOS32(lcd_ddc_info
+ 7);
1842 combios_setup_i2c_bus
1843 (RADEON_MDGPIO_EN_REG
);
1844 ddc_i2c
.mask_clk_mask
=
1845 RBIOS32(lcd_ddc_info
+ 3);
1846 ddc_i2c
.mask_data_mask
=
1847 RBIOS32(lcd_ddc_info
+ 7);
1848 ddc_i2c
.a_clk_mask
=
1849 RBIOS32(lcd_ddc_info
+ 3);
1850 ddc_i2c
.a_data_mask
=
1851 RBIOS32(lcd_ddc_info
+ 7);
1852 ddc_i2c
.put_clk_mask
=
1853 RBIOS32(lcd_ddc_info
+ 3);
1854 ddc_i2c
.put_data_mask
=
1855 RBIOS32(lcd_ddc_info
+ 7);
1856 ddc_i2c
.get_clk_mask
=
1857 RBIOS32(lcd_ddc_info
+ 3);
1858 ddc_i2c
.get_data_mask
=
1859 RBIOS32(lcd_ddc_info
+ 7);
1862 ddc_i2c
.valid
= false;
1865 DRM_DEBUG("LCD DDC Info Table found!\n");
1867 ddc_i2c
.valid
= false;
1869 radeon_add_legacy_connector(dev
,
1871 ATOM_DEVICE_LCD1_SUPPORT
,
1872 DRM_MODE_CONNECTOR_LVDS
,
1877 /* check TV table */
1878 if (rdev
->family
!= CHIP_R100
&& rdev
->family
!= CHIP_R200
) {
1880 combios_get_table_offset(dev
, COMBIOS_TV_INFO_TABLE
);
1882 if (RBIOS8(tv_info
+ 6) == 'T') {
1883 radeon_add_legacy_encoder(dev
,
1884 radeon_get_encoder_id
1886 ATOM_DEVICE_TV1_SUPPORT
,
1888 ATOM_DEVICE_TV1_SUPPORT
);
1889 radeon_add_legacy_connector(dev
, 6,
1890 ATOM_DEVICE_TV1_SUPPORT
,
1891 DRM_MODE_CONNECTOR_SVIDEO
,
1897 radeon_link_encoder_connector(dev
);
1902 static void combios_parse_mmio_table(struct drm_device
*dev
, uint16_t offset
)
1904 struct radeon_device
*rdev
= dev
->dev_private
;
1907 while (RBIOS16(offset
)) {
1908 uint16_t cmd
= ((RBIOS16(offset
) & 0xe000) >> 13);
1909 uint32_t addr
= (RBIOS16(offset
) & 0x1fff);
1910 uint32_t val
, and_mask
, or_mask
;
1916 val
= RBIOS32(offset
);
1921 val
= RBIOS32(offset
);
1926 and_mask
= RBIOS32(offset
);
1928 or_mask
= RBIOS32(offset
);
1936 and_mask
= RBIOS32(offset
);
1938 or_mask
= RBIOS32(offset
);
1946 val
= RBIOS16(offset
);
1951 val
= RBIOS16(offset
);
1958 (RADEON_CLK_PWRMGT_CNTL
) &
1965 if ((RREG32(RADEON_MC_STATUS
) &
1981 static void combios_parse_pll_table(struct drm_device
*dev
, uint16_t offset
)
1983 struct radeon_device
*rdev
= dev
->dev_private
;
1986 while (RBIOS8(offset
)) {
1987 uint8_t cmd
= ((RBIOS8(offset
) & 0xc0) >> 6);
1988 uint8_t addr
= (RBIOS8(offset
) & 0x3f);
1989 uint32_t val
, shift
, tmp
;
1990 uint32_t and_mask
, or_mask
;
1995 val
= RBIOS32(offset
);
1997 WREG32_PLL(addr
, val
);
2000 shift
= RBIOS8(offset
) * 8;
2002 and_mask
= RBIOS8(offset
) << shift
;
2003 and_mask
|= ~(0xff << shift
);
2005 or_mask
= RBIOS8(offset
) << shift
;
2007 tmp
= RREG32_PLL(addr
);
2010 WREG32_PLL(addr
, tmp
);
2026 (RADEON_CLK_PWRMGT_CNTL
) &
2034 (RADEON_CLK_PWRMGT_CNTL
) &
2041 RREG32_PLL(RADEON_CLK_PWRMGT_CNTL
);
2042 if (tmp
& RADEON_CG_NO1_DEBUG_0
) {
2044 uint32_t mclk_cntl
=
2047 mclk_cntl
&= 0xffff0000;
2048 /*mclk_cntl |= 0x00001111;*//* ??? */
2049 WREG32_PLL(RADEON_MCLK_CNTL
,
2054 (RADEON_CLK_PWRMGT_CNTL
,
2056 ~RADEON_CG_NO1_DEBUG_0
);
2071 static void combios_parse_ram_reset_table(struct drm_device
*dev
,
2074 struct radeon_device
*rdev
= dev
->dev_private
;
2078 uint8_t val
= RBIOS8(offset
);
2079 while (val
!= 0xff) {
2083 uint32_t channel_complete_mask
;
2085 if (ASIC_IS_R300(rdev
))
2086 channel_complete_mask
=
2087 R300_MEM_PWRUP_COMPLETE
;
2089 channel_complete_mask
=
2090 RADEON_MEM_PWRUP_COMPLETE
;
2093 if ((RREG32(RADEON_MEM_STR_CNTL
) &
2094 channel_complete_mask
) ==
2095 channel_complete_mask
)
2099 uint32_t or_mask
= RBIOS16(offset
);
2102 tmp
= RREG32(RADEON_MEM_SDRAM_MODE_REG
);
2103 tmp
&= RADEON_SDRAM_MODE_MASK
;
2105 WREG32(RADEON_MEM_SDRAM_MODE_REG
, tmp
);
2107 or_mask
= val
<< 24;
2108 tmp
= RREG32(RADEON_MEM_SDRAM_MODE_REG
);
2109 tmp
&= RADEON_B3MEM_RESET_MASK
;
2111 WREG32(RADEON_MEM_SDRAM_MODE_REG
, tmp
);
2113 val
= RBIOS8(offset
);
2118 static uint32_t combios_detect_ram(struct drm_device
*dev
, int ram
,
2119 int mem_addr_mapping
)
2121 struct radeon_device
*rdev
= dev
->dev_private
;
2126 mem_cntl
= RREG32(RADEON_MEM_CNTL
);
2127 if (mem_cntl
& RV100_HALF_MODE
)
2130 mem_cntl
&= ~(0xff << 8);
2131 mem_cntl
|= (mem_addr_mapping
& 0xff) << 8;
2132 WREG32(RADEON_MEM_CNTL
, mem_cntl
);
2133 RREG32(RADEON_MEM_CNTL
);
2137 /* something like this???? */
2139 addr
= ram
* 1024 * 1024;
2140 /* write to each page */
2141 WREG32(RADEON_MM_INDEX
, (addr
) | RADEON_MM_APER
);
2142 WREG32(RADEON_MM_DATA
, 0xdeadbeef);
2143 /* read back and verify */
2144 WREG32(RADEON_MM_INDEX
, (addr
) | RADEON_MM_APER
);
2145 if (RREG32(RADEON_MM_DATA
) != 0xdeadbeef)
2152 static void combios_write_ram_size(struct drm_device
*dev
)
2154 struct radeon_device
*rdev
= dev
->dev_private
;
2157 uint32_t mem_size
= 0;
2158 uint32_t mem_cntl
= 0;
2160 /* should do something smarter here I guess... */
2161 if (rdev
->flags
& RADEON_IS_IGP
)
2164 /* first check detected mem table */
2165 offset
= combios_get_table_offset(dev
, COMBIOS_DETECTED_MEM_TABLE
);
2167 rev
= RBIOS8(offset
);
2169 mem_cntl
= RBIOS32(offset
+ 1);
2170 mem_size
= RBIOS16(offset
+ 5);
2171 if (((rdev
->flags
& RADEON_FAMILY_MASK
) < CHIP_R200
) &&
2172 ((dev
->pdev
->device
!= 0x515e)
2173 && (dev
->pdev
->device
!= 0x5969)))
2174 WREG32(RADEON_MEM_CNTL
, mem_cntl
);
2180 combios_get_table_offset(dev
, COMBIOS_MEM_CONFIG_TABLE
);
2182 rev
= RBIOS8(offset
- 1);
2184 if (((rdev
->flags
& RADEON_FAMILY_MASK
) <
2186 && ((dev
->pdev
->device
!= 0x515e)
2187 && (dev
->pdev
->device
!= 0x5969))) {
2189 int mem_addr_mapping
= 0;
2191 while (RBIOS8(offset
)) {
2192 ram
= RBIOS8(offset
);
2195 if (mem_addr_mapping
!= 0x25)
2198 combios_detect_ram(dev
, ram
,
2205 mem_size
= RBIOS8(offset
);
2207 mem_size
= RBIOS8(offset
);
2208 mem_size
*= 2; /* convert to MB */
2213 mem_size
*= (1024 * 1024); /* convert to bytes */
2214 WREG32(RADEON_CONFIG_MEMSIZE
, mem_size
);
2217 void radeon_combios_dyn_clk_setup(struct drm_device
*dev
, int enable
)
2219 uint16_t dyn_clk_info
=
2220 combios_get_table_offset(dev
, COMBIOS_DYN_CLK_1_TABLE
);
2223 combios_parse_pll_table(dev
, dyn_clk_info
);
2226 void radeon_combios_asic_init(struct drm_device
*dev
)
2228 struct radeon_device
*rdev
= dev
->dev_private
;
2231 /* port hardcoded mac stuff from radeonfb */
2232 if (rdev
->bios
== NULL
)
2236 table
= combios_get_table_offset(dev
, COMBIOS_ASIC_INIT_1_TABLE
);
2238 combios_parse_mmio_table(dev
, table
);
2241 table
= combios_get_table_offset(dev
, COMBIOS_PLL_INIT_TABLE
);
2243 combios_parse_pll_table(dev
, table
);
2246 table
= combios_get_table_offset(dev
, COMBIOS_ASIC_INIT_2_TABLE
);
2248 combios_parse_mmio_table(dev
, table
);
2250 if (!(rdev
->flags
& RADEON_IS_IGP
)) {
2253 combios_get_table_offset(dev
, COMBIOS_ASIC_INIT_4_TABLE
);
2255 combios_parse_mmio_table(dev
, table
);
2258 table
= combios_get_table_offset(dev
, COMBIOS_RAM_RESET_TABLE
);
2260 combios_parse_ram_reset_table(dev
, table
);
2264 combios_get_table_offset(dev
, COMBIOS_ASIC_INIT_3_TABLE
);
2266 combios_parse_mmio_table(dev
, table
);
2268 /* write CONFIG_MEMSIZE */
2269 combios_write_ram_size(dev
);
2273 table
= combios_get_table_offset(dev
, COMBIOS_DYN_CLK_1_TABLE
);
2275 combios_parse_pll_table(dev
, table
);
2279 void radeon_combios_initialize_bios_scratch_regs(struct drm_device
*dev
)
2281 struct radeon_device
*rdev
= dev
->dev_private
;
2282 uint32_t bios_0_scratch
, bios_6_scratch
, bios_7_scratch
;
2284 bios_0_scratch
= RREG32(RADEON_BIOS_0_SCRATCH
);
2285 bios_6_scratch
= RREG32(RADEON_BIOS_6_SCRATCH
);
2286 bios_7_scratch
= RREG32(RADEON_BIOS_7_SCRATCH
);
2288 /* let the bios control the backlight */
2289 bios_0_scratch
&= ~RADEON_DRIVER_BRIGHTNESS_EN
;
2291 /* tell the bios not to handle mode switching */
2292 bios_6_scratch
|= (RADEON_DISPLAY_SWITCHING_DIS
|
2293 RADEON_ACC_MODE_CHANGE
);
2295 /* tell the bios a driver is loaded */
2296 bios_7_scratch
|= RADEON_DRV_LOADED
;
2298 WREG32(RADEON_BIOS_0_SCRATCH
, bios_0_scratch
);
2299 WREG32(RADEON_BIOS_6_SCRATCH
, bios_6_scratch
);
2300 WREG32(RADEON_BIOS_7_SCRATCH
, bios_7_scratch
);
2303 void radeon_combios_output_lock(struct drm_encoder
*encoder
, bool lock
)
2305 struct drm_device
*dev
= encoder
->dev
;
2306 struct radeon_device
*rdev
= dev
->dev_private
;
2307 uint32_t bios_6_scratch
;
2309 bios_6_scratch
= RREG32(RADEON_BIOS_6_SCRATCH
);
2312 bios_6_scratch
|= RADEON_DRIVER_CRITICAL
;
2314 bios_6_scratch
&= ~RADEON_DRIVER_CRITICAL
;
2316 WREG32(RADEON_BIOS_6_SCRATCH
, bios_6_scratch
);
2320 radeon_combios_connected_scratch_regs(struct drm_connector
*connector
,
2321 struct drm_encoder
*encoder
,
2324 struct drm_device
*dev
= connector
->dev
;
2325 struct radeon_device
*rdev
= dev
->dev_private
;
2326 struct radeon_connector
*radeon_connector
=
2327 to_radeon_connector(connector
);
2328 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
2329 uint32_t bios_4_scratch
= RREG32(RADEON_BIOS_4_SCRATCH
);
2330 uint32_t bios_5_scratch
= RREG32(RADEON_BIOS_5_SCRATCH
);
2332 if ((radeon_encoder
->devices
& ATOM_DEVICE_TV1_SUPPORT
) &&
2333 (radeon_connector
->devices
& ATOM_DEVICE_TV1_SUPPORT
)) {
2335 DRM_DEBUG("TV1 connected\n");
2337 bios_4_scratch
|= RADEON_TV1_ATTACHED_SVIDEO
;
2338 /*save->bios_4_scratch |= RADEON_TV1_ATTACHED_COMP; */
2339 bios_5_scratch
|= RADEON_TV1_ON
;
2340 bios_5_scratch
|= RADEON_ACC_REQ_TV1
;
2342 DRM_DEBUG("TV1 disconnected\n");
2343 bios_4_scratch
&= ~RADEON_TV1_ATTACHED_MASK
;
2344 bios_5_scratch
&= ~RADEON_TV1_ON
;
2345 bios_5_scratch
&= ~RADEON_ACC_REQ_TV1
;
2348 if ((radeon_encoder
->devices
& ATOM_DEVICE_LCD1_SUPPORT
) &&
2349 (radeon_connector
->devices
& ATOM_DEVICE_LCD1_SUPPORT
)) {
2351 DRM_DEBUG("LCD1 connected\n");
2352 bios_4_scratch
|= RADEON_LCD1_ATTACHED
;
2353 bios_5_scratch
|= RADEON_LCD1_ON
;
2354 bios_5_scratch
|= RADEON_ACC_REQ_LCD1
;
2356 DRM_DEBUG("LCD1 disconnected\n");
2357 bios_4_scratch
&= ~RADEON_LCD1_ATTACHED
;
2358 bios_5_scratch
&= ~RADEON_LCD1_ON
;
2359 bios_5_scratch
&= ~RADEON_ACC_REQ_LCD1
;
2362 if ((radeon_encoder
->devices
& ATOM_DEVICE_CRT1_SUPPORT
) &&
2363 (radeon_connector
->devices
& ATOM_DEVICE_CRT1_SUPPORT
)) {
2365 DRM_DEBUG("CRT1 connected\n");
2366 bios_4_scratch
|= RADEON_CRT1_ATTACHED_COLOR
;
2367 bios_5_scratch
|= RADEON_CRT1_ON
;
2368 bios_5_scratch
|= RADEON_ACC_REQ_CRT1
;
2370 DRM_DEBUG("CRT1 disconnected\n");
2371 bios_4_scratch
&= ~RADEON_CRT1_ATTACHED_MASK
;
2372 bios_5_scratch
&= ~RADEON_CRT1_ON
;
2373 bios_5_scratch
&= ~RADEON_ACC_REQ_CRT1
;
2376 if ((radeon_encoder
->devices
& ATOM_DEVICE_CRT2_SUPPORT
) &&
2377 (radeon_connector
->devices
& ATOM_DEVICE_CRT2_SUPPORT
)) {
2379 DRM_DEBUG("CRT2 connected\n");
2380 bios_4_scratch
|= RADEON_CRT2_ATTACHED_COLOR
;
2381 bios_5_scratch
|= RADEON_CRT2_ON
;
2382 bios_5_scratch
|= RADEON_ACC_REQ_CRT2
;
2384 DRM_DEBUG("CRT2 disconnected\n");
2385 bios_4_scratch
&= ~RADEON_CRT2_ATTACHED_MASK
;
2386 bios_5_scratch
&= ~RADEON_CRT2_ON
;
2387 bios_5_scratch
&= ~RADEON_ACC_REQ_CRT2
;
2390 if ((radeon_encoder
->devices
& ATOM_DEVICE_DFP1_SUPPORT
) &&
2391 (radeon_connector
->devices
& ATOM_DEVICE_DFP1_SUPPORT
)) {
2393 DRM_DEBUG("DFP1 connected\n");
2394 bios_4_scratch
|= RADEON_DFP1_ATTACHED
;
2395 bios_5_scratch
|= RADEON_DFP1_ON
;
2396 bios_5_scratch
|= RADEON_ACC_REQ_DFP1
;
2398 DRM_DEBUG("DFP1 disconnected\n");
2399 bios_4_scratch
&= ~RADEON_DFP1_ATTACHED
;
2400 bios_5_scratch
&= ~RADEON_DFP1_ON
;
2401 bios_5_scratch
&= ~RADEON_ACC_REQ_DFP1
;
2404 if ((radeon_encoder
->devices
& ATOM_DEVICE_DFP2_SUPPORT
) &&
2405 (radeon_connector
->devices
& ATOM_DEVICE_DFP2_SUPPORT
)) {
2407 DRM_DEBUG("DFP2 connected\n");
2408 bios_4_scratch
|= RADEON_DFP2_ATTACHED
;
2409 bios_5_scratch
|= RADEON_DFP2_ON
;
2410 bios_5_scratch
|= RADEON_ACC_REQ_DFP2
;
2412 DRM_DEBUG("DFP2 disconnected\n");
2413 bios_4_scratch
&= ~RADEON_DFP2_ATTACHED
;
2414 bios_5_scratch
&= ~RADEON_DFP2_ON
;
2415 bios_5_scratch
&= ~RADEON_ACC_REQ_DFP2
;
2418 WREG32(RADEON_BIOS_4_SCRATCH
, bios_4_scratch
);
2419 WREG32(RADEON_BIOS_5_SCRATCH
, bios_5_scratch
);
2423 radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder
*encoder
, int crtc
)
2425 struct drm_device
*dev
= encoder
->dev
;
2426 struct radeon_device
*rdev
= dev
->dev_private
;
2427 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
2428 uint32_t bios_5_scratch
= RREG32(RADEON_BIOS_5_SCRATCH
);
2430 if (radeon_encoder
->devices
& ATOM_DEVICE_TV1_SUPPORT
) {
2431 bios_5_scratch
&= ~RADEON_TV1_CRTC_MASK
;
2432 bios_5_scratch
|= (crtc
<< RADEON_TV1_CRTC_SHIFT
);
2434 if (radeon_encoder
->devices
& ATOM_DEVICE_CRT1_SUPPORT
) {
2435 bios_5_scratch
&= ~RADEON_CRT1_CRTC_MASK
;
2436 bios_5_scratch
|= (crtc
<< RADEON_CRT1_CRTC_SHIFT
);
2438 if (radeon_encoder
->devices
& ATOM_DEVICE_CRT2_SUPPORT
) {
2439 bios_5_scratch
&= ~RADEON_CRT2_CRTC_MASK
;
2440 bios_5_scratch
|= (crtc
<< RADEON_CRT2_CRTC_SHIFT
);
2442 if (radeon_encoder
->devices
& ATOM_DEVICE_LCD1_SUPPORT
) {
2443 bios_5_scratch
&= ~RADEON_LCD1_CRTC_MASK
;
2444 bios_5_scratch
|= (crtc
<< RADEON_LCD1_CRTC_SHIFT
);
2446 if (radeon_encoder
->devices
& ATOM_DEVICE_DFP1_SUPPORT
) {
2447 bios_5_scratch
&= ~RADEON_DFP1_CRTC_MASK
;
2448 bios_5_scratch
|= (crtc
<< RADEON_DFP1_CRTC_SHIFT
);
2450 if (radeon_encoder
->devices
& ATOM_DEVICE_DFP2_SUPPORT
) {
2451 bios_5_scratch
&= ~RADEON_DFP2_CRTC_MASK
;
2452 bios_5_scratch
|= (crtc
<< RADEON_DFP2_CRTC_SHIFT
);
2454 WREG32(RADEON_BIOS_5_SCRATCH
, bios_5_scratch
);
2458 radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder
*encoder
, bool on
)
2460 struct drm_device
*dev
= encoder
->dev
;
2461 struct radeon_device
*rdev
= dev
->dev_private
;
2462 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
2463 uint32_t bios_6_scratch
= RREG32(RADEON_BIOS_6_SCRATCH
);
2465 if (radeon_encoder
->devices
& (ATOM_DEVICE_TV_SUPPORT
)) {
2467 bios_6_scratch
|= RADEON_TV_DPMS_ON
;
2469 bios_6_scratch
&= ~RADEON_TV_DPMS_ON
;
2471 if (radeon_encoder
->devices
& (ATOM_DEVICE_CRT_SUPPORT
)) {
2473 bios_6_scratch
|= RADEON_CRT_DPMS_ON
;
2475 bios_6_scratch
&= ~RADEON_CRT_DPMS_ON
;
2477 if (radeon_encoder
->devices
& (ATOM_DEVICE_LCD_SUPPORT
)) {
2479 bios_6_scratch
|= RADEON_LCD_DPMS_ON
;
2481 bios_6_scratch
&= ~RADEON_LCD_DPMS_ON
;
2483 if (radeon_encoder
->devices
& (ATOM_DEVICE_DFP_SUPPORT
)) {
2485 bios_6_scratch
|= RADEON_DFP_DPMS_ON
;
2487 bios_6_scratch
&= ~RADEON_DFP_DPMS_ON
;
2489 WREG32(RADEON_BIOS_6_SCRATCH
, bios_6_scratch
);