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;
839 struct radeon_encoder_primary_dac *p_dac = NULL;
841 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
843 dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset);
846 p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), GFP_KERNEL);
851 bg = dac_info->ucDAC1_BG_Adjustment;
852 dac = dac_info->ucDAC1_DAC_Adjustment;
853 p_dac->ps2_pdac_adj = (bg << 8) | (dac);
859 struct radeon_encoder_tv_dac *
860 radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
862 struct drm_device *dev = encoder->base.dev;
863 struct radeon_device *rdev = dev->dev_private;
864 struct radeon_mode_info *mode_info = &rdev->mode_info;
865 int index = GetIndexIntoMasterTable(DATA, CompassionateData);
866 uint16_t data_offset;
867 struct _COMPASSIONATE_DATA *dac_info;
871 struct radeon_encoder_tv_dac *tv_dac = NULL;
873 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
875 dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset);
878 tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
883 bg = dac_info->ucDAC2_CRT2_BG_Adjustment;
884 dac = dac_info->ucDAC2_CRT2_DAC_Adjustment;
885 tv_dac->ps2_tvdac_adj = (bg << 16) | (dac << 20);
887 bg = dac_info->ucDAC2_PAL_BG_Adjustment;
888 dac = dac_info->ucDAC2_PAL_DAC_Adjustment;
889 tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20);
891 bg = dac_info->ucDAC2_NTSC_BG_Adjustment;
892 dac = dac_info->ucDAC2_NTSC_DAC_Adjustment;
893 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
899 void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable)
901 DYNAMIC_CLOCK_GATING_PS_ALLOCATION args;
902 int index = GetIndexIntoMasterTable(COMMAND, DynamicClockGating);
904 args.ucEnable = enable;
906 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
909 void radeon_atom_static_pwrmgt_setup(struct radeon_device *rdev, int enable)
911 ENABLE_ASIC_STATIC_PWR_MGT_PS_ALLOCATION args;
912 int index = GetIndexIntoMasterTable(COMMAND, EnableASIC_StaticPwrMgt);
914 args.ucEnable = enable;
916 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
919 void radeon_atom_set_engine_clock(struct radeon_device *rdev,
922 SET_ENGINE_CLOCK_PS_ALLOCATION args;
923 int index = GetIndexIntoMasterTable(COMMAND, SetEngineClock);
925 args.ulTargetEngineClock = eng_clock; /* 10 khz */
927 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
930 void radeon_atom_set_memory_clock(struct radeon_device *rdev,
933 SET_MEMORY_CLOCK_PS_ALLOCATION args;
934 int index = GetIndexIntoMasterTable(COMMAND, SetMemoryClock);
936 if (rdev->flags & RADEON_IS_IGP)
939 args.ulTargetMemoryClock = mem_clock; /* 10 khz */
941 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
944 void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
946 struct radeon_device *rdev = dev->dev_private;
947 uint32_t bios_2_scratch, bios_6_scratch;
949 if (rdev->family >= CHIP_R600) {
950 bios_2_scratch = RREG32(R600_BIOS_0_SCRATCH);
951 bios_6_scratch = RREG32(R600_BIOS_6_SCRATCH);
953 bios_2_scratch = RREG32(RADEON_BIOS_0_SCRATCH);
954 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
957 /* let the bios control the backlight */
958 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE;
960 /* tell the bios not to handle mode switching */
961 bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE);
963 if (rdev->family >= CHIP_R600) {
964 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
965 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
967 WREG32(RADEON_BIOS_2_SCRATCH, bios_2_scratch);
968 WREG32(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
973 void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock)
975 struct drm_device *dev = encoder->dev;
976 struct radeon_device *rdev = dev->dev_private;
977 uint32_t bios_6_scratch;
979 if (rdev->family >= CHIP_R600)
980 bios_6_scratch = RREG32(R600_BIOS_6_SCRATCH);
982 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
985 bios_6_scratch |= ATOM_S6_CRITICAL_STATE;
987 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE;
989 if (rdev->family >= CHIP_R600)
990 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
992 WREG32(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
995 /* at some point we may want to break this out into individual functions */
997 radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
998 struct drm_encoder *encoder,
1001 struct drm_device *dev = connector->dev;
1002 struct radeon_device *rdev = dev->dev_private;
1003 struct radeon_connector *radeon_connector =
1004 to_radeon_connector(connector);
1005 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1006 uint32_t bios_0_scratch, bios_3_scratch, bios_6_scratch;
1008 if (rdev->family >= CHIP_R600) {
1009 bios_0_scratch = RREG32(R600_BIOS_0_SCRATCH);
1010 bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH);
1011 bios_6_scratch = RREG32(R600_BIOS_6_SCRATCH);
1013 bios_0_scratch = RREG32(RADEON_BIOS_0_SCRATCH);
1014 bios_3_scratch = RREG32(RADEON_BIOS_3_SCRATCH);
1015 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
1018 if ((radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) &&
1019 (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT)) {
1021 DRM_DEBUG("TV1 connected\n");
1022 bios_3_scratch |= ATOM_S3_TV1_ACTIVE;
1023 bios_6_scratch |= ATOM_S6_ACC_REQ_TV1;
1025 DRM_DEBUG("TV1 disconnected\n");
1026 bios_0_scratch &= ~ATOM_S0_TV1_MASK;
1027 bios_3_scratch &= ~ATOM_S3_TV1_ACTIVE;
1028 bios_6_scratch &= ~ATOM_S6_ACC_REQ_TV1;
1031 if ((radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) &&
1032 (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT)) {
1034 DRM_DEBUG("CV connected\n");
1035 bios_3_scratch |= ATOM_S3_CV_ACTIVE;
1036 bios_6_scratch |= ATOM_S6_ACC_REQ_CV;
1038 DRM_DEBUG("CV disconnected\n");
1039 bios_0_scratch &= ~ATOM_S0_CV_MASK;
1040 bios_3_scratch &= ~ATOM_S3_CV_ACTIVE;
1041 bios_6_scratch &= ~ATOM_S6_ACC_REQ_CV;
1044 if ((radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) &&
1045 (radeon_connector->devices & ATOM_DEVICE_LCD1_SUPPORT)) {
1047 DRM_DEBUG("LCD1 connected\n");
1048 bios_0_scratch |= ATOM_S0_LCD1;
1049 bios_3_scratch |= ATOM_S3_LCD1_ACTIVE;
1050 bios_6_scratch |= ATOM_S6_ACC_REQ_LCD1;
1052 DRM_DEBUG("LCD1 disconnected\n");
1053 bios_0_scratch &= ~ATOM_S0_LCD1;
1054 bios_3_scratch &= ~ATOM_S3_LCD1_ACTIVE;
1055 bios_6_scratch &= ~ATOM_S6_ACC_REQ_LCD1;
1058 if ((radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) &&
1059 (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)) {
1061 DRM_DEBUG("CRT1 connected\n");
1062 bios_0_scratch |= ATOM_S0_CRT1_COLOR;
1063 bios_3_scratch |= ATOM_S3_CRT1_ACTIVE;
1064 bios_6_scratch |= ATOM_S6_ACC_REQ_CRT1;
1066 DRM_DEBUG("CRT1 disconnected\n");
1067 bios_0_scratch &= ~ATOM_S0_CRT1_MASK;
1068 bios_3_scratch &= ~ATOM_S3_CRT1_ACTIVE;
1069 bios_6_scratch &= ~ATOM_S6_ACC_REQ_CRT1;
1072 if ((radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) &&
1073 (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)) {
1075 DRM_DEBUG("CRT2 connected\n");
1076 bios_0_scratch |= ATOM_S0_CRT2_COLOR;
1077 bios_3_scratch |= ATOM_S3_CRT2_ACTIVE;
1078 bios_6_scratch |= ATOM_S6_ACC_REQ_CRT2;
1080 DRM_DEBUG("CRT2 disconnected\n");
1081 bios_0_scratch &= ~ATOM_S0_CRT2_MASK;
1082 bios_3_scratch &= ~ATOM_S3_CRT2_ACTIVE;
1083 bios_6_scratch &= ~ATOM_S6_ACC_REQ_CRT2;
1086 if ((radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) &&
1087 (radeon_connector->devices & ATOM_DEVICE_DFP1_SUPPORT)) {
1089 DRM_DEBUG("DFP1 connected\n");
1090 bios_0_scratch |= ATOM_S0_DFP1;
1091 bios_3_scratch |= ATOM_S3_DFP1_ACTIVE;
1092 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP1;
1094 DRM_DEBUG("DFP1 disconnected\n");
1095 bios_0_scratch &= ~ATOM_S0_DFP1;
1096 bios_3_scratch &= ~ATOM_S3_DFP1_ACTIVE;
1097 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP1;
1100 if ((radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) &&
1101 (radeon_connector->devices & ATOM_DEVICE_DFP2_SUPPORT)) {
1103 DRM_DEBUG("DFP2 connected\n");
1104 bios_0_scratch |= ATOM_S0_DFP2;
1105 bios_3_scratch |= ATOM_S3_DFP2_ACTIVE;
1106 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP2;
1108 DRM_DEBUG("DFP2 disconnected\n");
1109 bios_0_scratch &= ~ATOM_S0_DFP2;
1110 bios_3_scratch &= ~ATOM_S3_DFP2_ACTIVE;
1111 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP2;
1114 if ((radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) &&
1115 (radeon_connector->devices & ATOM_DEVICE_DFP3_SUPPORT)) {
1117 DRM_DEBUG("DFP3 connected\n");
1118 bios_0_scratch |= ATOM_S0_DFP3;
1119 bios_3_scratch |= ATOM_S3_DFP3_ACTIVE;
1120 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP3;
1122 DRM_DEBUG("DFP3 disconnected\n");
1123 bios_0_scratch &= ~ATOM_S0_DFP3;
1124 bios_3_scratch &= ~ATOM_S3_DFP3_ACTIVE;
1125 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP3;
1128 if ((radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) &&
1129 (radeon_connector->devices & ATOM_DEVICE_DFP4_SUPPORT)) {
1131 DRM_DEBUG("DFP4 connected\n");
1132 bios_0_scratch |= ATOM_S0_DFP4;
1133 bios_3_scratch |= ATOM_S3_DFP4_ACTIVE;
1134 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP4;
1136 DRM_DEBUG("DFP4 disconnected\n");
1137 bios_0_scratch &= ~ATOM_S0_DFP4;
1138 bios_3_scratch &= ~ATOM_S3_DFP4_ACTIVE;
1139 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP4;
1142 if ((radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) &&
1143 (radeon_connector->devices & ATOM_DEVICE_DFP5_SUPPORT)) {
1145 DRM_DEBUG("DFP5 connected\n");
1146 bios_0_scratch |= ATOM_S0_DFP5;
1147 bios_3_scratch |= ATOM_S3_DFP5_ACTIVE;
1148 bios_6_scratch |= ATOM_S6_ACC_REQ_DFP5;
1150 DRM_DEBUG("DFP5 disconnected\n");
1151 bios_0_scratch &= ~ATOM_S0_DFP5;
1152 bios_3_scratch &= ~ATOM_S3_DFP5_ACTIVE;
1153 bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5;
1157 if (rdev->family >= CHIP_R600) {
1158 WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch);
1159 WREG32(R600_BIOS_3_SCRATCH, bios_3_scratch);
1160 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
1162 WREG32(RADEON_BIOS_0_SCRATCH, bios_0_scratch);
1163 WREG32(RADEON_BIOS_3_SCRATCH, bios_3_scratch);
1164 WREG32(RADEON_BIOS_6_SCRATCH, bios_6_scratch);
1169 radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc)
1171 struct drm_device *dev = encoder->dev;
1172 struct radeon_device *rdev = dev->dev_private;
1173 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1174 uint32_t bios_3_scratch;
1176 if (rdev->family >= CHIP_R600)
1177 bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH);
1179 bios_3_scratch = RREG32(RADEON_BIOS_3_SCRATCH);
1181 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) {
1182 bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE;
1183 bios_3_scratch |= (crtc << 18);
1185 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) {
1186 bios_3_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE;
1187 bios_3_scratch |= (crtc << 24);
1189 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) {
1190 bios_3_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE;
1191 bios_3_scratch |= (crtc << 16);
1193 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) {
1194 bios_3_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE;
1195 bios_3_scratch |= (crtc << 20);
1197 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) {
1198 bios_3_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE;
1199 bios_3_scratch |= (crtc << 17);
1201 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) {
1202 bios_3_scratch &= ~ATOM_S3_DFP1_CRTC_ACTIVE;
1203 bios_3_scratch |= (crtc << 19);
1205 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) {
1206 bios_3_scratch &= ~ATOM_S3_DFP2_CRTC_ACTIVE;
1207 bios_3_scratch |= (crtc << 23);
1209 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) {
1210 bios_3_scratch &= ~ATOM_S3_DFP3_CRTC_ACTIVE;
1211 bios_3_scratch |= (crtc << 25);
1214 if (rdev->family >= CHIP_R600)
1215 WREG32(R600_BIOS_3_SCRATCH, bios_3_scratch);
1217 WREG32(RADEON_BIOS_3_SCRATCH, bios_3_scratch);
1221 radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on)
1223 struct drm_device *dev = encoder->dev;
1224 struct radeon_device *rdev = dev->dev_private;
1225 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1226 uint32_t bios_2_scratch;
1228 if (rdev->family >= CHIP_R600)
1229 bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH);
1231 bios_2_scratch = RREG32(RADEON_BIOS_2_SCRATCH);
1233 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) {
1235 bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE;
1237 bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE;
1239 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) {
1241 bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE;
1243 bios_2_scratch |= ATOM_S2_CV_DPMS_STATE;
1245 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) {
1247 bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE;
1249 bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE;
1251 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) {
1253 bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE;
1255 bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE;
1257 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) {
1259 bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE;
1261 bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE;
1263 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) {
1265 bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE;
1267 bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE;
1269 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) {
1271 bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE;
1273 bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE;
1275 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) {
1277 bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE;
1279 bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE;
1281 if (radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) {
1283 bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE;
1285 bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE;
1287 if (radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) {
1289 bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE;
1291 bios_2_scratch |= ATOM_S2_DFP5_DPMS_STATE;
1294 if (rdev->family >= CHIP_R600)
1295 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
1297 WREG32(RADEON_BIOS_2_SCRATCH, bios_2_scratch);