2 * Copyright 2007-8 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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.
23 * Authors: Dave Airlie
27 #include "radeon_drm.h"
31 #include "atom-bits.h"
33 /* from radeon_encoder.c */
35 radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device,
37 extern void radeon_link_encoder_connector(struct drm_device *dev);
39 radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id,
40 uint32_t supported_device);
42 /* from radeon_connector.c */
44 radeon_add_atom_connector(struct drm_device *dev,
45 uint32_t connector_id,
46 uint32_t supported_device,
48 struct radeon_i2c_bus_rec *i2c_bus,
49 bool linkb, uint32_t igp_lane_info);
51 /* from radeon_legacy_encoder.c */
53 radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id,
54 uint32_t supported_device);
56 union atom_supported_devices {
57 struct _ATOM_SUPPORTED_DEVICES_INFO info;
58 struct _ATOM_SUPPORTED_DEVICES_INFO_2 info_2;
59 struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1;
62 static inline struct radeon_i2c_bus_rec radeon_lookup_gpio(struct drm_device
65 struct radeon_device *rdev = dev->dev_private;
66 struct atom_context *ctx = rdev->mode_info.atom_context;
67 ATOM_GPIO_I2C_ASSIGMENT gpio;
68 struct radeon_i2c_bus_rec i2c;
69 int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
70 struct _ATOM_GPIO_I2C_INFO *i2c_info;
73 memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec));
76 atom_parse_data_header(ctx, index, NULL, NULL, NULL, &data_offset);
78 i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
80 gpio = i2c_info->asGPIO_Info[id];
82 i2c.mask_clk_reg = le16_to_cpu(gpio.usClkMaskRegisterIndex) * 4;
83 i2c.mask_data_reg = le16_to_cpu(gpio.usDataMaskRegisterIndex) * 4;
84 i2c.put_clk_reg = le16_to_cpu(gpio.usClkEnRegisterIndex) * 4;
85 i2c.put_data_reg = le16_to_cpu(gpio.usDataEnRegisterIndex) * 4;
86 i2c.get_clk_reg = le16_to_cpu(gpio.usClkY_RegisterIndex) * 4;
87 i2c.get_data_reg = le16_to_cpu(gpio.usDataY_RegisterIndex) * 4;
88 i2c.a_clk_reg = le16_to_cpu(gpio.usClkA_RegisterIndex) * 4;
89 i2c.a_data_reg = le16_to_cpu(gpio.usDataA_RegisterIndex) * 4;
90 i2c.mask_clk_mask = (1 << gpio.ucClkMaskShift);
91 i2c.mask_data_mask = (1 << gpio.ucDataMaskShift);
92 i2c.put_clk_mask = (1 << gpio.ucClkEnShift);
93 i2c.put_data_mask = (1 << gpio.ucDataEnShift);
94 i2c.get_clk_mask = (1 << gpio.ucClkY_Shift);
95 i2c.get_data_mask = (1 << gpio.ucDataY_Shift);
96 i2c.a_clk_mask = (1 << gpio.ucClkA_Shift);
97 i2c.a_data_mask = (1 << gpio.ucDataA_Shift);
103 static bool radeon_atom_apply_quirks(struct drm_device *dev,
104 uint32_t supported_device,
106 struct radeon_i2c_bus_rec *i2c_bus)
109 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
110 if ((dev->pdev->device == 0x791e) &&
111 (dev->pdev->subsystem_vendor == 0x1043) &&
112 (dev->pdev->subsystem_device == 0x826d)) {
113 if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
114 (supported_device == ATOM_DEVICE_DFP3_SUPPORT))
115 *connector_type = DRM_MODE_CONNECTOR_DVID;
118 /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */
119 if ((dev->pdev->device == 0x7941) &&
120 (dev->pdev->subsystem_vendor == 0x147b) &&
121 (dev->pdev->subsystem_device == 0x2412)) {
122 if (*connector_type == DRM_MODE_CONNECTOR_DVII)
126 /* Falcon NW laptop lists vga ddc line for LVDS */
127 if ((dev->pdev->device == 0x5653) &&
128 (dev->pdev->subsystem_vendor == 0x1462) &&
129 (dev->pdev->subsystem_device == 0x0291)) {
130 if (*connector_type == DRM_MODE_CONNECTOR_LVDS)
131 i2c_bus->valid = false;
135 if ((dev->pdev->device == 0x71C5) &&
136 (dev->pdev->subsystem_vendor == 0x106b) &&
137 (dev->pdev->subsystem_device == 0x0080)) {
138 if ((supported_device == ATOM_DEVICE_CRT1_SUPPORT) ||
139 (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
143 /* some BIOSes seem to report DAC on HDMI - they hurt me with their lies */
144 if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
145 (*connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
146 if (supported_device & (ATOM_DEVICE_CRT_SUPPORT)) {
151 /* ASUS HD 3600 XT board lists the DVI port as HDMI */
152 if ((dev->pdev->device == 0x9598) &&
153 (dev->pdev->subsystem_vendor == 0x1043) &&
154 (dev->pdev->subsystem_device == 0x01da)) {
155 if (*connector_type == DRM_MODE_CONNECTOR_HDMIB) {
156 *connector_type = DRM_MODE_CONNECTOR_DVID;
163 const int supported_devices_connector_convert[] = {
164 DRM_MODE_CONNECTOR_Unknown,
165 DRM_MODE_CONNECTOR_VGA,
166 DRM_MODE_CONNECTOR_DVII,
167 DRM_MODE_CONNECTOR_DVID,
168 DRM_MODE_CONNECTOR_DVIA,
169 DRM_MODE_CONNECTOR_SVIDEO,
170 DRM_MODE_CONNECTOR_Composite,
171 DRM_MODE_CONNECTOR_LVDS,
172 DRM_MODE_CONNECTOR_Unknown,
173 DRM_MODE_CONNECTOR_Unknown,
174 DRM_MODE_CONNECTOR_HDMIA,
175 DRM_MODE_CONNECTOR_HDMIB,
176 DRM_MODE_CONNECTOR_Unknown,
177 DRM_MODE_CONNECTOR_Unknown,
178 DRM_MODE_CONNECTOR_9PinDIN,
179 DRM_MODE_CONNECTOR_DisplayPort
182 const int object_connector_convert[] = {
183 DRM_MODE_CONNECTOR_Unknown,
184 DRM_MODE_CONNECTOR_DVII,
185 DRM_MODE_CONNECTOR_DVII,
186 DRM_MODE_CONNECTOR_DVID,
187 DRM_MODE_CONNECTOR_DVID,
188 DRM_MODE_CONNECTOR_VGA,
189 DRM_MODE_CONNECTOR_Composite,
190 DRM_MODE_CONNECTOR_SVIDEO,
191 DRM_MODE_CONNECTOR_Unknown,
192 DRM_MODE_CONNECTOR_9PinDIN,
193 DRM_MODE_CONNECTOR_Unknown,
194 DRM_MODE_CONNECTOR_HDMIA,
195 DRM_MODE_CONNECTOR_HDMIB,
196 DRM_MODE_CONNECTOR_HDMIB,
197 DRM_MODE_CONNECTOR_LVDS,
198 DRM_MODE_CONNECTOR_9PinDIN,
199 DRM_MODE_CONNECTOR_Unknown,
200 DRM_MODE_CONNECTOR_Unknown,
201 DRM_MODE_CONNECTOR_Unknown,
202 DRM_MODE_CONNECTOR_DisplayPort
205 bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
207 struct radeon_device *rdev = dev->dev_private;
208 struct radeon_mode_info *mode_info = &rdev->mode_info;
209 struct atom_context *ctx = mode_info->atom_context;
210 int index = GetIndexIntoMasterTable(DATA, Object_Header);
211 uint16_t size, data_offset;
212 uint8_t frev, crev, line_mux = 0;
213 ATOM_CONNECTOR_OBJECT_TABLE *con_obj;
214 ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj;
215 ATOM_OBJECT_HEADER *obj_header;
216 int i, j, path_size, device_support;
218 uint16_t igp_lane_info;
220 struct radeon_i2c_bus_rec ddc_bus;
222 atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset);
224 if (data_offset == 0)
230 obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset);
231 path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *)
232 (ctx->bios + data_offset +
233 le16_to_cpu(obj_header->usDisplayPathTableOffset));
234 con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *)
235 (ctx->bios + data_offset +
236 le16_to_cpu(obj_header->usConnectorObjectTableOffset));
237 device_support = le16_to_cpu(obj_header->usDeviceSupport);
240 for (i = 0; i < path_obj->ucNumOfDispPath; i++) {
241 uint8_t *addr = (uint8_t *) path_obj->asDispPath;
242 ATOM_DISPLAY_OBJECT_PATH *path;
244 path = (ATOM_DISPLAY_OBJECT_PATH *) addr;
245 path_size += le16_to_cpu(path->usSize);
248 if (device_support & le16_to_cpu(path->usDeviceTag)) {
249 uint8_t con_obj_id, con_obj_num, con_obj_type;
252 (le16_to_cpu(path->usConnObjectId) & OBJECT_ID_MASK)
255 (le16_to_cpu(path->usConnObjectId) & ENUM_ID_MASK)
258 (le16_to_cpu(path->usConnObjectId) &
259 OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
261 if ((le16_to_cpu(path->usDeviceTag) ==
262 ATOM_DEVICE_TV1_SUPPORT)
263 || (le16_to_cpu(path->usDeviceTag) ==
264 ATOM_DEVICE_TV2_SUPPORT)
265 || (le16_to_cpu(path->usDeviceTag) ==
266 ATOM_DEVICE_CV_SUPPORT))
269 if ((rdev->family == CHIP_RS780) &&
271 CONNECTOR_OBJECT_ID_PCIE_CONNECTOR)) {
272 uint16_t igp_offset = 0;
273 ATOM_INTEGRATED_SYSTEM_INFO_V2 *igp_obj;
276 GetIndexIntoMasterTable(DATA,
277 IntegratedSystemInfo);
279 atom_parse_data_header(ctx, index, &size, &frev,
284 (ATOM_INTEGRATED_SYSTEM_INFO_V2
285 *) (ctx->bios + igp_offset);
288 uint32_t slot_config, ct;
290 if (con_obj_num == 1)
299 ct = (slot_config >> 16) & 0xff;
301 object_connector_convert
304 slot_config & 0xffff;
312 object_connector_convert[con_obj_id];
315 if (connector_type == DRM_MODE_CONNECTOR_Unknown)
318 for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2);
320 uint8_t enc_obj_id, enc_obj_num, enc_obj_type;
323 (le16_to_cpu(path->usGraphicObjIds[j]) &
324 OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
326 (le16_to_cpu(path->usGraphicObjIds[j]) &
327 ENUM_ID_MASK) >> ENUM_ID_SHIFT;
329 (le16_to_cpu(path->usGraphicObjIds[j]) &
330 OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
332 /* FIXME: add support for router objects */
333 if (enc_obj_type == GRAPH_OBJECT_TYPE_ENCODER) {
334 if (enc_obj_num == 2)
339 radeon_add_atom_encoder(dev,
348 /* look up gpio for ddc */
349 if ((le16_to_cpu(path->usDeviceTag) &
350 (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))
352 for (j = 0; j < con_obj->ucNumberOfObjects; j++) {
353 if (le16_to_cpu(path->usConnObjectId) ==
354 le16_to_cpu(con_obj->asObjects[j].
356 ATOM_COMMON_RECORD_HEADER
358 (ATOM_COMMON_RECORD_HEADER
360 (ctx->bios + data_offset +
361 le16_to_cpu(con_obj->
364 ATOM_I2C_RECORD *i2c_record;
366 while (record->ucRecordType > 0
369 ATOM_MAX_OBJECT_RECORD_NUMBER) {
376 case ATOM_I2C_RECORD_TYPE:
387 (ATOM_COMMON_RECORD_HEADER
399 if ((le16_to_cpu(path->usDeviceTag) ==
400 ATOM_DEVICE_TV1_SUPPORT)
401 || (le16_to_cpu(path->usDeviceTag) ==
402 ATOM_DEVICE_TV2_SUPPORT)
403 || (le16_to_cpu(path->usDeviceTag) ==
404 ATOM_DEVICE_CV_SUPPORT))
405 ddc_bus.valid = false;
407 ddc_bus = radeon_lookup_gpio(dev, line_mux);
409 radeon_add_atom_connector(dev,
414 connector_type, &ddc_bus,
415 linkb, igp_lane_info);
420 radeon_link_encoder_connector(dev);
425 struct bios_connector {
430 struct radeon_i2c_bus_rec ddc_bus;
433 bool radeon_get_atom_connector_info_from_supported_devices_table(struct
437 struct radeon_device *rdev = dev->dev_private;
438 struct radeon_mode_info *mode_info = &rdev->mode_info;
439 struct atom_context *ctx = mode_info->atom_context;
440 int index = GetIndexIntoMasterTable(DATA, SupportedDevicesInfo);
441 uint16_t size, data_offset;
443 uint16_t device_support;
445 union atom_supported_devices *supported_devices;
447 struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE];
449 atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset);
452 (union atom_supported_devices *)(ctx->bios + data_offset);
454 device_support = le16_to_cpu(supported_devices->info.usDeviceSupport);
456 for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
457 ATOM_CONNECTOR_INFO_I2C ci =
458 supported_devices->info.asConnInfo[i];
460 bios_connectors[i].valid = false;
462 if (!(device_support & (1 << i))) {
466 if (i == ATOM_DEVICE_CV_INDEX) {
467 DRM_DEBUG("Skipping Component Video\n");
471 if (i == ATOM_DEVICE_TV1_INDEX) {
472 DRM_DEBUG("Skipping TV Out\n");
476 bios_connectors[i].connector_type =
477 supported_devices_connector_convert[ci.sucConnectorInfo.
481 if (bios_connectors[i].connector_type ==
482 DRM_MODE_CONNECTOR_Unknown)
485 dac = ci.sucConnectorInfo.sbfAccess.bfAssociatedDAC;
487 if ((rdev->family == CHIP_RS690) ||
488 (rdev->family == CHIP_RS740)) {
489 if ((i == ATOM_DEVICE_DFP2_INDEX)
490 && (ci.sucI2cId.sbfAccess.bfI2C_LineMux == 2))
491 bios_connectors[i].line_mux =
492 ci.sucI2cId.sbfAccess.bfI2C_LineMux + 1;
493 else if ((i == ATOM_DEVICE_DFP3_INDEX)
494 && (ci.sucI2cId.sbfAccess.bfI2C_LineMux == 1))
495 bios_connectors[i].line_mux =
496 ci.sucI2cId.sbfAccess.bfI2C_LineMux + 1;
498 bios_connectors[i].line_mux =
499 ci.sucI2cId.sbfAccess.bfI2C_LineMux;
501 bios_connectors[i].line_mux =
502 ci.sucI2cId.sbfAccess.bfI2C_LineMux;
504 /* give tv unique connector ids */
505 if (i == ATOM_DEVICE_TV1_INDEX) {
506 bios_connectors[i].ddc_bus.valid = false;
507 bios_connectors[i].line_mux = 50;
508 } else if (i == ATOM_DEVICE_TV2_INDEX) {
509 bios_connectors[i].ddc_bus.valid = false;
510 bios_connectors[i].line_mux = 51;
511 } else if (i == ATOM_DEVICE_CV_INDEX) {
512 bios_connectors[i].ddc_bus.valid = false;
513 bios_connectors[i].line_mux = 52;
515 bios_connectors[i].ddc_bus =
516 radeon_lookup_gpio(dev,
517 bios_connectors[i].line_mux);
519 /* Always set the connector type to VGA for CRT1/CRT2. if they are
520 * shared with a DVI port, we'll pick up the DVI connector when we
521 * merge the outputs. Some bioses incorrectly list VGA ports as DVI.
523 if (i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX)
524 bios_connectors[i].connector_type =
525 DRM_MODE_CONNECTOR_VGA;
527 if (!radeon_atom_apply_quirks
528 (dev, (1 << i), &bios_connectors[i].connector_type,
529 &bios_connectors[i].ddc_bus))
532 bios_connectors[i].valid = true;
533 bios_connectors[i].devices = (1 << i);
535 if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom)
536 radeon_add_atom_encoder(dev,
537 radeon_get_encoder_id(dev,
542 radeon_add_legacy_encoder(dev,
543 radeon_get_encoder_id(dev,
550 /* combine shared connectors */
551 for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
552 if (bios_connectors[i].valid) {
553 for (j = 0; j < ATOM_MAX_SUPPORTED_DEVICE; j++) {
554 if (bios_connectors[j].valid && (i != j)) {
555 if (bios_connectors[i].line_mux ==
556 bios_connectors[j].line_mux) {
557 if (((bios_connectors[i].
559 (ATOM_DEVICE_DFP_SUPPORT))
560 && (bios_connectors[j].
562 (ATOM_DEVICE_CRT_SUPPORT)))
564 ((bios_connectors[j].
566 (ATOM_DEVICE_DFP_SUPPORT))
567 && (bios_connectors[i].
569 (ATOM_DEVICE_CRT_SUPPORT)))) {
576 DRM_MODE_CONNECTOR_DVII;
586 /* add the connectors */
587 for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
588 if (bios_connectors[i].valid)
589 radeon_add_atom_connector(dev,
590 bios_connectors[i].line_mux,
591 bios_connectors[i].devices,
594 &bios_connectors[i].ddc_bus,
598 radeon_link_encoder_connector(dev);
603 union firmware_info {
604 ATOM_FIRMWARE_INFO info;
605 ATOM_FIRMWARE_INFO_V1_2 info_12;
606 ATOM_FIRMWARE_INFO_V1_3 info_13;
607 ATOM_FIRMWARE_INFO_V1_4 info_14;
610 bool radeon_atom_get_clock_info(struct drm_device *dev)
612 struct radeon_device *rdev = dev->dev_private;
613 struct radeon_mode_info *mode_info = &rdev->mode_info;
614 int index = GetIndexIntoMasterTable(DATA, FirmwareInfo);
615 union firmware_info *firmware_info;
617 struct radeon_pll *p1pll = &rdev->clock.p1pll;
618 struct radeon_pll *p2pll = &rdev->clock.p2pll;
619 struct radeon_pll *spll = &rdev->clock.spll;
620 struct radeon_pll *mpll = &rdev->clock.mpll;
621 uint16_t data_offset;
623 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev,
624 &crev, &data_offset);
627 (union firmware_info *)(mode_info->atom_context->bios +
632 p1pll->reference_freq =
633 le16_to_cpu(firmware_info->info.usReferenceClock);
634 p1pll->reference_div = 0;
637 le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output);
639 le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output);
641 if (p1pll->pll_out_min == 0) {
642 if (ASIC_IS_AVIVO(rdev))
643 p1pll->pll_out_min = 64800;
645 p1pll->pll_out_min = 20000;
649 le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Input);
651 le16_to_cpu(firmware_info->info.usMaxPixelClockPLL_Input);
656 spll->reference_freq =
657 le16_to_cpu(firmware_info->info.usReferenceClock);
658 spll->reference_div = 0;
661 le16_to_cpu(firmware_info->info.usMinEngineClockPLL_Output);
663 le32_to_cpu(firmware_info->info.ulMaxEngineClockPLL_Output);
666 if (spll->pll_out_min == 0) {
667 if (ASIC_IS_AVIVO(rdev))
668 spll->pll_out_min = 64800;
670 spll->pll_out_min = 20000;
674 le16_to_cpu(firmware_info->info.usMinEngineClockPLL_Input);
676 le16_to_cpu(firmware_info->info.usMaxEngineClockPLL_Input);
679 mpll->reference_freq =
680 le16_to_cpu(firmware_info->info.usReferenceClock);
681 mpll->reference_div = 0;
684 le16_to_cpu(firmware_info->info.usMinMemoryClockPLL_Output);
686 le32_to_cpu(firmware_info->info.ulMaxMemoryClockPLL_Output);
689 if (mpll->pll_out_min == 0) {
690 if (ASIC_IS_AVIVO(rdev))
691 mpll->pll_out_min = 64800;
693 mpll->pll_out_min = 20000;
697 le16_to_cpu(firmware_info->info.usMinMemoryClockPLL_Input);
699 le16_to_cpu(firmware_info->info.usMaxMemoryClockPLL_Input);
701 rdev->clock.default_sclk =
702 le32_to_cpu(firmware_info->info.ulDefaultEngineClock);
703 rdev->clock.default_mclk =
704 le32_to_cpu(firmware_info->info.ulDefaultMemoryClock);
711 struct radeon_encoder_int_tmds *radeon_atombios_get_tmds_info(struct
715 struct drm_device *dev = encoder->base.dev;
716 struct radeon_device *rdev = dev->dev_private;
717 struct radeon_mode_info *mode_info = &rdev->mode_info;
718 int index = GetIndexIntoMasterTable(DATA, TMDS_Info);
719 uint16_t data_offset;
720 struct _ATOM_TMDS_INFO *tmds_info;
724 struct radeon_encoder_int_tmds *tmds = NULL;
726 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev,
727 &crev, &data_offset);
730 (struct _ATOM_TMDS_INFO *)(mode_info->atom_context->bios +
735 kzalloc(sizeof(struct radeon_encoder_int_tmds), GFP_KERNEL);
740 maxfreq = le16_to_cpu(tmds_info->usMaxFrequency);
741 for (i = 0; i < 4; i++) {
742 tmds->tmds_pll[i].freq =
743 le16_to_cpu(tmds_info->asMiscInfo[i].usFrequency);
744 tmds->tmds_pll[i].value =
745 tmds_info->asMiscInfo[i].ucPLL_ChargePump & 0x3f;
746 tmds->tmds_pll[i].value |=
747 (tmds_info->asMiscInfo[i].
748 ucPLL_VCO_Gain & 0x3f) << 6;
749 tmds->tmds_pll[i].value |=
750 (tmds_info->asMiscInfo[i].
751 ucPLL_DutyCycle & 0xf) << 12;
752 tmds->tmds_pll[i].value |=
753 (tmds_info->asMiscInfo[i].
754 ucPLL_VoltageSwing & 0xf) << 16;
756 DRM_DEBUG("TMDS PLL From ATOMBIOS %u %x\n",
757 tmds->tmds_pll[i].freq,
758 tmds->tmds_pll[i].value);
760 if (maxfreq == tmds->tmds_pll[i].freq) {
761 tmds->tmds_pll[i].freq = 0xffffffff;
770 struct _ATOM_LVDS_INFO info;
771 struct _ATOM_LVDS_INFO_V12 info_12;
774 struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
778 struct drm_device *dev = encoder->base.dev;
779 struct radeon_device *rdev = dev->dev_private;
780 struct radeon_mode_info *mode_info = &rdev->mode_info;
781 int index = GetIndexIntoMasterTable(DATA, LVDS_Info);
782 uint16_t data_offset;
783 union lvds_info *lvds_info;
785 struct radeon_encoder_atom_dig *lvds = NULL;
787 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev,
788 &crev, &data_offset);
791 (union lvds_info *)(mode_info->atom_context->bios + data_offset);
795 kzalloc(sizeof(struct radeon_encoder_atom_dig), GFP_KERNEL);
800 lvds->native_mode.dotclock =
801 le16_to_cpu(lvds_info->info.sLCDTiming.usPixClk) * 10;
802 lvds->native_mode.panel_xres =
803 le16_to_cpu(lvds_info->info.sLCDTiming.usHActive);
804 lvds->native_mode.panel_yres =
805 le16_to_cpu(lvds_info->info.sLCDTiming.usVActive);
806 lvds->native_mode.hblank =
807 le16_to_cpu(lvds_info->info.sLCDTiming.usHBlanking_Time);
808 lvds->native_mode.hoverplus =
809 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncOffset);
810 lvds->native_mode.hsync_width =
811 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncWidth);
812 lvds->native_mode.vblank =
813 le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time);
814 lvds->native_mode.voverplus =
815 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncOffset);
816 lvds->native_mode.vsync_width =
817 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth);
818 lvds->panel_pwr_delay =
819 le16_to_cpu(lvds_info->info.usOffDelayInMs);
820 lvds->lvds_misc = lvds_info->info.ucLVDS_Misc;
822 encoder->native_mode = lvds->native_mode;
827 struct radeon_encoder_primary_dac *
828 radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder)
830 struct drm_device *dev = encoder->base.dev;
831 struct radeon_device *rdev = dev->dev_private;
832 struct radeon_mode_info *mode_info = &rdev->mode_info;
833 int index = GetIndexIntoMasterTable(DATA, CompassionateData);
834 uint16_t data_offset;
835 struct _COMPASSIONATE_DATA *dac_info;
838 struct radeon_encoder_primary_dac *p_dac = NULL;
840 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
842 dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset);
845 p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), GFP_KERNEL);
850 bg = dac_info->ucDAC1_BG_Adjustment;
851 dac = dac_info->ucDAC1_DAC_Adjustment;
852 p_dac->ps2_pdac_adj = (bg << 8) | (dac);
858 struct radeon_encoder_tv_dac *
859 radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
861 struct drm_device *dev = encoder->base.dev;
862 struct radeon_device *rdev = dev->dev_private;
863 struct radeon_mode_info *mode_info = &rdev->mode_info;
864 int index = GetIndexIntoMasterTable(DATA, CompassionateData);
865 uint16_t data_offset;
866 struct _COMPASSIONATE_DATA *dac_info;
869 struct radeon_encoder_tv_dac *tv_dac = NULL;
871 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
873 dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset);
876 tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
881 bg = dac_info->ucDAC2_CRT2_BG_Adjustment;
882 dac = dac_info->ucDAC2_CRT2_DAC_Adjustment;
883 tv_dac->ps2_tvdac_adj = (bg << 16) | (dac << 20);
885 bg = dac_info->ucDAC2_PAL_BG_Adjustment;
886 dac = dac_info->ucDAC2_PAL_DAC_Adjustment;
887 tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20);
889 bg = dac_info->ucDAC2_NTSC_BG_Adjustment;
890 dac = dac_info->ucDAC2_NTSC_DAC_Adjustment;
891 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
897 void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable)
899 DYNAMIC_CLOCK_GATING_PS_ALLOCATION args;
900 int index = GetIndexIntoMasterTable(COMMAND, DynamicClockGating);
902 args.ucEnable = enable;
904 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
907 void radeon_atom_static_pwrmgt_setup(struct radeon_device *rdev, int enable)
909 ENABLE_ASIC_STATIC_PWR_MGT_PS_ALLOCATION args;
910 int index = GetIndexIntoMasterTable(COMMAND, EnableASIC_StaticPwrMgt);
912 args.ucEnable = enable;
914 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
917 void radeon_atom_set_engine_clock(struct radeon_device *rdev,
920 SET_ENGINE_CLOCK_PS_ALLOCATION args;
921 int index = GetIndexIntoMasterTable(COMMAND, SetEngineClock);
923 args.ulTargetEngineClock = eng_clock; /* 10 khz */
925 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
928 void radeon_atom_set_memory_clock(struct radeon_device *rdev,
931 SET_MEMORY_CLOCK_PS_ALLOCATION args;
932 int index = GetIndexIntoMasterTable(COMMAND, SetMemoryClock);
934 if (rdev->flags & RADEON_IS_IGP)
937 args.ulTargetMemoryClock = mem_clock; /* 10 khz */
939 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
942 void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
944 struct radeon_device *rdev = dev->dev_private;
945 uint32_t bios_2_scratch, bios_6_scratch;
947 if (rdev->family >= CHIP_R600) {
948 bios_2_scratch = RREG32(R600_BIOS_0_SCRATCH);
949 bios_6_scratch = RREG32(R600_BIOS_6_SCRATCH);
951 bios_2_scratch = RREG32(RADEON_BIOS_0_SCRATCH);
952 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
955 /* let the bios control the backlight */
956 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE;
958 /* tell the bios not to handle mode switching */
959 bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE);
961 if (rdev->family >= CHIP_R600) {
962 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
963 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
965 WREG32(RADEON_BIOS_2_SCRATCH, bios_2_scratch);
966 WREG32(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
971 void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock)
973 struct drm_device *dev = encoder->dev;
974 struct radeon_device *rdev = dev->dev_private;
975 uint32_t bios_6_scratch;
977 if (rdev->family >= CHIP_R600)
978 bios_6_scratch = RREG32(R600_BIOS_6_SCRATCH);
980 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
983 bios_6_scratch |= ATOM_S6_CRITICAL_STATE;
985 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE;
987 if (rdev->family >= CHIP_R600)
988 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
990 WREG32(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
993 /* at some point we may want to break this out into individual functions */
995 radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
996 struct drm_encoder *encoder,
999 struct drm_device *dev = connector->dev;
1000 struct radeon_device *rdev = dev->dev_private;
1001 struct radeon_connector *radeon_connector =
1002 to_radeon_connector(connector);
1003 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1004 uint32_t bios_0_scratch, bios_3_scratch, bios_6_scratch;
1006 if (rdev->family >= CHIP_R600) {
1007 bios_0_scratch = RREG32(R600_BIOS_0_SCRATCH);
1008 bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH);
1009 bios_6_scratch = RREG32(R600_BIOS_6_SCRATCH);
1011 bios_0_scratch = RREG32(RADEON_BIOS_0_SCRATCH);
1012 bios_3_scratch = RREG32(RADEON_BIOS_3_SCRATCH);
1013 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
1016 if ((radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) &&
1017 (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT)) {
1019 DRM_DEBUG("TV1 connected\n");
1020 bios_3_scratch |= ATOM_S3_TV1_ACTIVE;
1021 bios_6_scratch |= ATOM_S6_ACC_REQ_TV1;
1023 DRM_DEBUG("TV1 disconnected\n");
1024 bios_0_scratch &= ~ATOM_S0_TV1_MASK;
1025 bios_3_scratch &= ~ATOM_S3_TV1_ACTIVE;
1026 bios_6_scratch &= ~ATOM_S6_ACC_REQ_TV1;
1029 if ((radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) &&
1030 (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT)) {
1032 DRM_DEBUG("CV connected\n");
1033 bios_3_scratch |= ATOM_S3_CV_ACTIVE;
1034 bios_6_scratch |= ATOM_S6_ACC_REQ_CV;
1036 DRM_DEBUG("CV disconnected\n");
1037 bios_0_scratch &= ~ATOM_S0_CV_MASK;
1038 bios_3_scratch &= ~ATOM_S3_CV_ACTIVE;
1039 bios_6_scratch &= ~ATOM_S6_ACC_REQ_CV;
1042 if ((radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) &&
1043 (radeon_connector->devices & ATOM_DEVICE_LCD1_SUPPORT)) {
1045 DRM_DEBUG("LCD1 connected\n");
1046 bios_0_scratch |= ATOM_S0_LCD1;
1047 bios_3_scratch |= ATOM_S3_LCD1_ACTIVE;
1048 bios_6_scratch |= ATOM_S6_ACC_REQ_LCD1;
1050 DRM_DEBUG("LCD1 disconnected\n");
1051 bios_0_scratch &= ~ATOM_S0_LCD1;
1052 bios_3_scratch &= ~ATOM_S3_LCD1_ACTIVE;
1053 bios_6_scratch &= ~ATOM_S6_ACC_REQ_LCD1;
1056 if ((radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) &&
1057 (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)) {
1059 DRM_DEBUG("CRT1 connected\n");
1060 bios_0_scratch |= ATOM_S0_CRT1_COLOR;
1061 bios_3_scratch |= ATOM_S3_CRT1_ACTIVE;
1062 bios_6_scratch |= ATOM_S6_ACC_REQ_CRT1;
1064 DRM_DEBUG("CRT1 disconnected\n");
1065 bios_0_scratch &= ~ATOM_S0_CRT1_MASK;
1066 bios_3_scratch &= ~ATOM_S3_CRT1_ACTIVE;
1067 bios_6_scratch &= ~ATOM_S6_ACC_REQ_CRT1;
1070 if ((radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) &&
1071 (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)) {
1073 DRM_DEBUG("CRT2 connected\n");
1074 bios_0_scratch |= ATOM_S0_CRT2_COLOR;
1075 bios_3_scratch |= ATOM_S3_CRT2_ACTIVE;
1076 bios_6_scratch |= ATOM_S6_ACC_REQ_CRT2;
1078 DRM_DEBUG("CRT2 disconnected\n");
1079 bios_0_scratch &= ~ATOM_S0_CRT2_MASK;
1080 bios_3_scratch &= ~ATOM_S3_CRT2_ACTIVE;
1081 bios_6_scratch &= ~ATOM_S6_ACC_REQ_CRT2;
1084 if ((radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) &&
1085 (radeon_connector->devices & ATOM_DEVICE_DFP1_SUPPORT)) {
1087 DRM_DEBUG("DFP1 connected\n");
1088 bios_0_scratch |= ATOM_S0_DFP1;
1089 bios_3_scratch |= ATOM_S3_DFP1_ACTIVE;
1090 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP1;
1092 DRM_DEBUG("DFP1 disconnected\n");
1093 bios_0_scratch &= ~ATOM_S0_DFP1;
1094 bios_3_scratch &= ~ATOM_S3_DFP1_ACTIVE;
1095 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP1;
1098 if ((radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) &&
1099 (radeon_connector->devices & ATOM_DEVICE_DFP2_SUPPORT)) {
1101 DRM_DEBUG("DFP2 connected\n");
1102 bios_0_scratch |= ATOM_S0_DFP2;
1103 bios_3_scratch |= ATOM_S3_DFP2_ACTIVE;
1104 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP2;
1106 DRM_DEBUG("DFP2 disconnected\n");
1107 bios_0_scratch &= ~ATOM_S0_DFP2;
1108 bios_3_scratch &= ~ATOM_S3_DFP2_ACTIVE;
1109 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP2;
1112 if ((radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) &&
1113 (radeon_connector->devices & ATOM_DEVICE_DFP3_SUPPORT)) {
1115 DRM_DEBUG("DFP3 connected\n");
1116 bios_0_scratch |= ATOM_S0_DFP3;
1117 bios_3_scratch |= ATOM_S3_DFP3_ACTIVE;
1118 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP3;
1120 DRM_DEBUG("DFP3 disconnected\n");
1121 bios_0_scratch &= ~ATOM_S0_DFP3;
1122 bios_3_scratch &= ~ATOM_S3_DFP3_ACTIVE;
1123 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP3;
1126 if ((radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) &&
1127 (radeon_connector->devices & ATOM_DEVICE_DFP4_SUPPORT)) {
1129 DRM_DEBUG("DFP4 connected\n");
1130 bios_0_scratch |= ATOM_S0_DFP4;
1131 bios_3_scratch |= ATOM_S3_DFP4_ACTIVE;
1132 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP4;
1134 DRM_DEBUG("DFP4 disconnected\n");
1135 bios_0_scratch &= ~ATOM_S0_DFP4;
1136 bios_3_scratch &= ~ATOM_S3_DFP4_ACTIVE;
1137 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP4;
1140 if ((radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) &&
1141 (radeon_connector->devices & ATOM_DEVICE_DFP5_SUPPORT)) {
1143 DRM_DEBUG("DFP5 connected\n");
1144 bios_0_scratch |= ATOM_S0_DFP5;
1145 bios_3_scratch |= ATOM_S3_DFP5_ACTIVE;
1146 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP5;
1148 DRM_DEBUG("DFP5 disconnected\n");
1149 bios_0_scratch &= ~ATOM_S0_DFP5;
1150 bios_3_scratch &= ~ATOM_S3_DFP5_ACTIVE;
1151 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5;
1155 if (rdev->family >= CHIP_R600) {
1156 WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch);
1157 WREG32(R600_BIOS_3_SCRATCH, bios_3_scratch);
1158 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
1160 WREG32(RADEON_BIOS_0_SCRATCH, bios_0_scratch);
1161 WREG32(RADEON_BIOS_3_SCRATCH, bios_3_scratch);
1162 WREG32(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
1167 radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc)
1169 struct drm_device *dev = encoder->dev;
1170 struct radeon_device *rdev = dev->dev_private;
1171 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1172 uint32_t bios_3_scratch;
1174 if (rdev->family >= CHIP_R600)
1175 bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH);
1177 bios_3_scratch = RREG32(RADEON_BIOS_3_SCRATCH);
1179 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) {
1180 bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE;
1181 bios_3_scratch |= (crtc << 18);
1183 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) {
1184 bios_3_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE;
1185 bios_3_scratch |= (crtc << 24);
1187 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) {
1188 bios_3_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE;
1189 bios_3_scratch |= (crtc << 16);
1191 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) {
1192 bios_3_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE;
1193 bios_3_scratch |= (crtc << 20);
1195 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) {
1196 bios_3_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE;
1197 bios_3_scratch |= (crtc << 17);
1199 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) {
1200 bios_3_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE;
1201 bios_3_scratch |= (crtc << 19);
1203 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) {
1204 bios_3_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE;
1205 bios_3_scratch |= (crtc << 23);
1207 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) {
1208 bios_3_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE;
1209 bios_3_scratch |= (crtc << 25);
1212 if (rdev->family >= CHIP_R600)
1213 WREG32(R600_BIOS_3_SCRATCH, bios_3_scratch);
1215 WREG32(RADEON_BIOS_3_SCRATCH, bios_3_scratch);
1219 radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on)
1221 struct drm_device *dev = encoder->dev;
1222 struct radeon_device *rdev = dev->dev_private;
1223 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1224 uint32_t bios_2_scratch;
1226 if (rdev->family >= CHIP_R600)
1227 bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH);
1229 bios_2_scratch = RREG32(RADEON_BIOS_2_SCRATCH);
1231 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) {
1233 bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE;
1235 bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE;
1237 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) {
1239 bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE;
1241 bios_2_scratch |= ATOM_S2_CV_DPMS_STATE;
1243 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) {
1245 bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE;
1247 bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE;
1249 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) {
1251 bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE;
1253 bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE;
1255 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) {
1257 bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE;
1259 bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE;
1261 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) {
1263 bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE;
1265 bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE;
1267 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) {
1269 bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE;
1271 bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE;
1273 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) {
1275 bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE;
1277 bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE;
1279 if (radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) {
1281 bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE;
1283 bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE;
1285 if (radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) {
1287 bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE;
1289 bios_2_scratch |= ATOM_S2_DFP5_DPMS_STATE;
1292 if (rdev->family >= CHIP_R600)
1293 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
1295 WREG32(RADEON_BIOS_2_SCRATCH, bios_2_scratch);