Lines Matching +full:adt7473 +full:- +full:d
2 * Copyright 2007-8 Advanced Micro Devices, Inc.
35 #include "atom-bits.h"
51 if ((rdev->family == CHIP_R420) || in radeon_lookup_i2c_gpio_quirks()
52 (rdev->family == CHIP_R423) || in radeon_lookup_i2c_gpio_quirks()
53 (rdev->family == CHIP_RV410)) { in radeon_lookup_i2c_gpio_quirks()
54 if ((le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0018) || in radeon_lookup_i2c_gpio_quirks()
55 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0019) || in radeon_lookup_i2c_gpio_quirks()
56 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x001a)) { in radeon_lookup_i2c_gpio_quirks()
57 gpio->ucClkMaskShift = 0x19; in radeon_lookup_i2c_gpio_quirks()
58 gpio->ucDataMaskShift = 0x18; in radeon_lookup_i2c_gpio_quirks()
65 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && in radeon_lookup_i2c_gpio_quirks()
66 (gpio->sucI2cId.ucAccess == 0)) { in radeon_lookup_i2c_gpio_quirks()
67 gpio->sucI2cId.ucAccess = 0x97; in radeon_lookup_i2c_gpio_quirks()
68 gpio->ucDataMaskShift = 8; in radeon_lookup_i2c_gpio_quirks()
69 gpio->ucDataEnShift = 8; in radeon_lookup_i2c_gpio_quirks()
70 gpio->ucDataY_Shift = 8; in radeon_lookup_i2c_gpio_quirks()
71 gpio->ucDataA_Shift = 8; in radeon_lookup_i2c_gpio_quirks()
78 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && in radeon_lookup_i2c_gpio_quirks()
79 (gpio->sucI2cId.ucAccess == 0x94)) in radeon_lookup_i2c_gpio_quirks()
80 gpio->sucI2cId.ucAccess = 0x14; in radeon_lookup_i2c_gpio_quirks()
90 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
91 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
92 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
93 i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
94 i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
95 i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
96 i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
97 i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
98 i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); in radeon_get_bus_rec_for_i2c_gpio()
99 i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); in radeon_get_bus_rec_for_i2c_gpio()
100 i2c.en_clk_mask = (1 << gpio->ucClkEnShift); in radeon_get_bus_rec_for_i2c_gpio()
101 i2c.en_data_mask = (1 << gpio->ucDataEnShift); in radeon_get_bus_rec_for_i2c_gpio()
102 i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); in radeon_get_bus_rec_for_i2c_gpio()
103 i2c.y_data_mask = (1 << gpio->ucDataY_Shift); in radeon_get_bus_rec_for_i2c_gpio()
104 i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); in radeon_get_bus_rec_for_i2c_gpio()
105 i2c.a_data_mask = (1 << gpio->ucDataA_Shift); in radeon_get_bus_rec_for_i2c_gpio()
107 if (gpio->sucI2cId.sbfAccess.bfHW_Capable) in radeon_get_bus_rec_for_i2c_gpio()
112 if (gpio->sucI2cId.ucAccess == 0xa0) in radeon_get_bus_rec_for_i2c_gpio()
117 i2c.i2c_id = gpio->sucI2cId.ucAccess; in radeon_get_bus_rec_for_i2c_gpio()
130 struct atom_context *ctx = rdev->mode_info.atom_context; in radeon_lookup_i2c_gpio()
142 i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); in radeon_lookup_i2c_gpio()
144 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_lookup_i2c_gpio()
147 gpio = &i2c_info->asGPIO_Info[0]; in radeon_lookup_i2c_gpio()
152 if (gpio->sucI2cId.ucAccess == id) { in radeon_lookup_i2c_gpio()
166 struct atom_context *ctx = rdev->mode_info.atom_context; in radeon_atombios_i2c_init()
176 i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); in radeon_atombios_i2c_init()
178 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_i2c_init()
181 gpio = &i2c_info->asGPIO_Info[0]; in radeon_atombios_i2c_init()
189 rdev->i2c_bus[i] = radeon_i2c_create(rdev_to_drm(rdev), &i2c, stmp); in radeon_atombios_i2c_init()
200 struct atom_context *ctx = rdev->mode_info.atom_context; in radeon_atombios_lookup_gpio()
212 gpio_info = (struct _ATOM_GPIO_PIN_LUT *)(ctx->bios + data_offset); in radeon_atombios_lookup_gpio()
214 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_lookup_gpio()
217 pin = gpio_info->asGPIO_Pin; in radeon_atombios_lookup_gpio()
219 if (id == pin->ucGPIO_ID) { in radeon_atombios_lookup_gpio()
220 gpio.id = pin->ucGPIO_ID; in radeon_atombios_lookup_gpio()
221 gpio.reg = le16_to_cpu(pin->usGpioPin_AIndex) * 4; in radeon_atombios_lookup_gpio()
222 gpio.shift = pin->ucGpioPinBitShift; in radeon_atombios_lookup_gpio()
223 gpio.mask = (1 << pin->ucGpioPinBitShift); in radeon_atombios_lookup_gpio()
251 if (gpio->reg == reg) { in radeon_atom_get_hpd_info_from_gpio()
252 switch(gpio->mask) { in radeon_atom_get_hpd_info_from_gpio()
287 struct pci_dev *pdev = to_pci_dev(dev->dev); in radeon_atom_apply_quirks()
289 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ in radeon_atom_apply_quirks()
290 if ((pdev->device == 0x791e) && in radeon_atom_apply_quirks()
291 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
292 (pdev->subsystem_device == 0x826d)) { in radeon_atom_apply_quirks()
299 if ((pdev->device == 0x7941) && in radeon_atom_apply_quirks()
300 (pdev->subsystem_vendor == 0x1849) && in radeon_atom_apply_quirks()
301 (pdev->subsystem_device == 0x7941)) { in radeon_atom_apply_quirks()
308 if ((pdev->device == 0x796e) && in radeon_atom_apply_quirks()
309 (pdev->subsystem_vendor == 0x1462) && in radeon_atom_apply_quirks()
310 (pdev->subsystem_device == 0x7302)) { in radeon_atom_apply_quirks()
316 /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ in radeon_atom_apply_quirks()
317 if ((pdev->device == 0x7941) && in radeon_atom_apply_quirks()
318 (pdev->subsystem_vendor == 0x147b) && in radeon_atom_apply_quirks()
319 (pdev->subsystem_device == 0x2412)) { in radeon_atom_apply_quirks()
325 if ((pdev->device == 0x5653) && in radeon_atom_apply_quirks()
326 (pdev->subsystem_vendor == 0x1462) && in radeon_atom_apply_quirks()
327 (pdev->subsystem_device == 0x0291)) { in radeon_atom_apply_quirks()
329 i2c_bus->valid = false; in radeon_atom_apply_quirks()
335 if ((pdev->device == 0x7146) && in radeon_atom_apply_quirks()
336 (pdev->subsystem_vendor == 0x17af) && in radeon_atom_apply_quirks()
337 (pdev->subsystem_device == 0x2058)) { in radeon_atom_apply_quirks()
343 if ((pdev->device == 0x7142) && in radeon_atom_apply_quirks()
344 (pdev->subsystem_vendor == 0x1458) && in radeon_atom_apply_quirks()
345 (pdev->subsystem_device == 0x2134)) { in radeon_atom_apply_quirks()
352 if ((pdev->device == 0x71C5) && in radeon_atom_apply_quirks()
353 (pdev->subsystem_vendor == 0x106b) && in radeon_atom_apply_quirks()
354 (pdev->subsystem_device == 0x0080)) { in radeon_atom_apply_quirks()
370 if ((pdev->device == 0x9598) && in radeon_atom_apply_quirks()
371 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
372 (pdev->subsystem_device == 0x01da)) { in radeon_atom_apply_quirks()
379 if ((pdev->device == 0x9598) && in radeon_atom_apply_quirks()
380 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
381 (pdev->subsystem_device == 0x01e4)) { in radeon_atom_apply_quirks()
388 if ((pdev->device == 0x95C5) && in radeon_atom_apply_quirks()
389 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
390 (pdev->subsystem_device == 0x01e2)) { in radeon_atom_apply_quirks()
396 /* some BIOSes seem to report DAC on HDMI - usually this is a board with in radeon_atom_apply_quirks()
415 if (((pdev->device == 0x95c4) || (pdev->device == 0x9591)) && in radeon_atom_apply_quirks()
416 (pdev->subsystem_vendor == 0x1025) && in radeon_atom_apply_quirks()
417 (pdev->subsystem_device == 0x013c)) { in radeon_atom_apply_quirks()
420 /* actually it's a DVI-D port not DVI-I */ in radeon_atom_apply_quirks()
429 if ((pdev->device == 0x9498) && in radeon_atom_apply_quirks()
430 (pdev->subsystem_vendor == 0x1682) && in radeon_atom_apply_quirks()
431 (pdev->subsystem_device == 0x2452) && in radeon_atom_apply_quirks()
432 (i2c_bus->valid == false) && in radeon_atom_apply_quirks()
434 struct radeon_device *rdev = dev->dev_private; in radeon_atom_apply_quirks()
438 /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ in radeon_atom_apply_quirks()
439 if (((pdev->device == 0x9802) || in radeon_atom_apply_quirks()
440 (pdev->device == 0x9805) || in radeon_atom_apply_quirks()
441 (pdev->device == 0x9806)) && in radeon_atom_apply_quirks()
442 (pdev->subsystem_vendor == 0x1734) && in radeon_atom_apply_quirks()
443 (pdev->subsystem_device == 0x11bd)) { in radeon_atom_apply_quirks()
479 CONNECTOR_OBJECT_ID_VGA, /* technically DVI-A */
518 struct radeon_device *rdev = dev->dev_private; in radeon_get_atom_connector_info_from_object_table()
519 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_get_atom_connector_info_from_object_table()
520 struct atom_context *ctx = mode_info->atom_context; in radeon_get_atom_connector_info_from_object_table()
543 obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset); in radeon_get_atom_connector_info_from_object_table()
545 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
546 le16_to_cpu(obj_header->usDisplayPathTableOffset)); in radeon_get_atom_connector_info_from_object_table()
548 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
549 le16_to_cpu(obj_header->usConnectorObjectTableOffset)); in radeon_get_atom_connector_info_from_object_table()
551 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
552 le16_to_cpu(obj_header->usEncoderObjectTableOffset)); in radeon_get_atom_connector_info_from_object_table()
554 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
555 le16_to_cpu(obj_header->usRouterObjectTableOffset)); in radeon_get_atom_connector_info_from_object_table()
556 device_support = le16_to_cpu(obj_header->usDeviceSupport); in radeon_get_atom_connector_info_from_object_table()
559 for (i = 0; i < path_obj->ucNumOfDispPath; i++) { in radeon_get_atom_connector_info_from_object_table()
560 uint8_t *addr = (uint8_t *) path_obj->asDispPath; in radeon_get_atom_connector_info_from_object_table()
564 path_size += le16_to_cpu(path->usSize); in radeon_get_atom_connector_info_from_object_table()
566 if (device_support & le16_to_cpu(path->usDeviceTag)) { in radeon_get_atom_connector_info_from_object_table()
570 (le16_to_cpu(path->usConnObjectId) & OBJECT_ID_MASK) in radeon_get_atom_connector_info_from_object_table()
573 (le16_to_cpu(path->usConnObjectId) & ENUM_ID_MASK) in radeon_get_atom_connector_info_from_object_table()
577 if (le16_to_cpu(path->usDeviceTag) == in radeon_get_atom_connector_info_from_object_table()
582 if ((rdev->flags & RADEON_IS_IGP) && in radeon_get_atom_connector_info_from_object_table()
598 *) (ctx->bios + igp_offset); in radeon_get_atom_connector_info_from_object_table()
605 igp_obj-> in radeon_get_atom_connector_info_from_object_table()
609 igp_obj-> in radeon_get_atom_connector_info_from_object_table()
641 for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); j++) { in radeon_get_atom_connector_info_from_object_table()
643 (le16_to_cpu(path->usGraphicObjIds[j]) & in radeon_get_atom_connector_info_from_object_table()
647 for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { in radeon_get_atom_connector_info_from_object_table()
648 u16 encoder_obj = le16_to_cpu(enc_obj->asObjects[k].usObjectID); in radeon_get_atom_connector_info_from_object_table()
649 if (le16_to_cpu(path->usGraphicObjIds[j]) == encoder_obj) { in radeon_get_atom_connector_info_from_object_table()
651 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
652 le16_to_cpu(enc_obj->asObjects[k].usRecordOffset)); in radeon_get_atom_connector_info_from_object_table()
656 while (record->ucRecordSize > 0 && in radeon_get_atom_connector_info_from_object_table()
657 record->ucRecordType > 0 && in radeon_get_atom_connector_info_from_object_table()
658 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { in radeon_get_atom_connector_info_from_object_table()
659 switch (record->ucRecordType) { in radeon_get_atom_connector_info_from_object_table()
663 caps = le16_to_cpu(cap_record->usEncoderCap); in radeon_get_atom_connector_info_from_object_table()
667 ((char *)record + record->ucRecordSize); in radeon_get_atom_connector_info_from_object_table()
672 (path-> in radeon_get_atom_connector_info_from_object_table()
678 for (k = 0; k < router_obj->ucNumberOfObjects; k++) { in radeon_get_atom_connector_info_from_object_table()
679 u16 router_obj_id = le16_to_cpu(router_obj->asObjects[k].usObjectID); in radeon_get_atom_connector_info_from_object_table()
680 if (le16_to_cpu(path->usGraphicObjIds[j]) == router_obj_id) { in radeon_get_atom_connector_info_from_object_table()
682 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
683 le16_to_cpu(router_obj->asObjects[k].usRecordOffset)); in radeon_get_atom_connector_info_from_object_table()
690 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
691 le16_to_cpu(router_obj->asObjects[k].usSrcDstTableOffset)); in radeon_get_atom_connector_info_from_object_table()
694 (router_src_dst_table->ucNumberOfSrc * 2)); in radeon_get_atom_connector_info_from_object_table()
700 if (le16_to_cpu(path->usConnObjectId) == in radeon_get_atom_connector_info_from_object_table()
705 while (record->ucRecordSize > 0 && in radeon_get_atom_connector_info_from_object_table()
706 record->ucRecordType > 0 && in radeon_get_atom_connector_info_from_object_table()
707 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { in radeon_get_atom_connector_info_from_object_table()
708 switch (record->ucRecordType) { in radeon_get_atom_connector_info_from_object_table()
715 &i2c_record->sucI2cId; in radeon_get_atom_connector_info_from_object_table()
718 i2c_config-> in radeon_get_atom_connector_info_from_object_table()
720 router.i2c_addr = i2c_record->ucI2CAddr >> 1; in radeon_get_atom_connector_info_from_object_table()
726 router.ddc_mux_type = ddc_path->ucMuxType; in radeon_get_atom_connector_info_from_object_table()
727 router.ddc_mux_control_pin = ddc_path->ucMuxControlPin; in radeon_get_atom_connector_info_from_object_table()
728 router.ddc_mux_state = ddc_path->ucMuxState[enum_id]; in radeon_get_atom_connector_info_from_object_table()
734 router.cd_mux_type = cd_path->ucMuxType; in radeon_get_atom_connector_info_from_object_table()
735 router.cd_mux_control_pin = cd_path->ucMuxControlPin; in radeon_get_atom_connector_info_from_object_table()
736 router.cd_mux_state = cd_path->ucMuxState[enum_id]; in radeon_get_atom_connector_info_from_object_table()
740 ((char *)record + record->ucRecordSize); in radeon_get_atom_connector_info_from_object_table()
750 if ((le16_to_cpu(path->usDeviceTag) & in radeon_get_atom_connector_info_from_object_table()
752 for (j = 0; j < con_obj->ucNumberOfObjects; j++) { in radeon_get_atom_connector_info_from_object_table()
753 if (le16_to_cpu(path->usConnObjectId) == in radeon_get_atom_connector_info_from_object_table()
754 le16_to_cpu(con_obj->asObjects[j]. in radeon_get_atom_connector_info_from_object_table()
760 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
761 le16_to_cpu(con_obj-> in radeon_get_atom_connector_info_from_object_table()
768 while (record->ucRecordSize > 0 && in radeon_get_atom_connector_info_from_object_table()
769 record->ucRecordType > 0 && in radeon_get_atom_connector_info_from_object_table()
770 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { in radeon_get_atom_connector_info_from_object_table()
771 switch (record->ucRecordType) { in radeon_get_atom_connector_info_from_object_table()
778 &i2c_record->sucI2cId; in radeon_get_atom_connector_info_from_object_table()
780 i2c_config-> in radeon_get_atom_connector_info_from_object_table()
788 hpd_record->ucHPDIntGPIOID); in radeon_get_atom_connector_info_from_object_table()
790 hpd.plugged_state = hpd_record->ucPlugged_PinState; in radeon_get_atom_connector_info_from_object_table()
797 record-> in radeon_get_atom_connector_info_from_object_table()
808 conn_id = le16_to_cpu(path->usConnObjectId); in radeon_get_atom_connector_info_from_object_table()
811 (dev, le16_to_cpu(path->usDeviceTag), &connector_type, in radeon_get_atom_connector_info_from_object_table()
817 le16_to_cpu(path-> in radeon_get_atom_connector_info_from_object_table()
836 struct radeon_device *rdev = dev->dev_private; in atombios_get_connector_object_id()
838 if (rdev->flags & RADEON_IS_IGP) { in atombios_get_connector_object_id()
844 struct radeon_mode_info *mode_info = &rdev->mode_info; in atombios_get_connector_object_id()
845 struct atom_context *ctx = mode_info->atom_context; in atombios_get_connector_object_id()
852 xtmds = (ATOM_XTMDS_INFO *)(ctx->bios + data_offset); in atombios_get_connector_object_id()
854 if (xtmds->ucSupportedLink & ATOM_XTMDS_SUPPORTED_DUALLINK) { in atombios_get_connector_object_id()
887 struct radeon_device *rdev = dev->dev_private; in radeon_get_atom_connector_info_from_supported_devices_table()
888 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_get_atom_connector_info_from_supported_devices_table()
889 struct atom_context *ctx = mode_info->atom_context; in radeon_get_atom_connector_info_from_supported_devices_table()
915 (union atom_supported_devices *)(ctx->bios + data_offset); in radeon_get_atom_connector_info_from_supported_devices_table()
917 device_support = le16_to_cpu(supported_devices->info.usDeviceSupport); in radeon_get_atom_connector_info_from_supported_devices_table()
928 ci = supported_devices->info_2d1.asConnInfo[i]; in radeon_get_atom_connector_info_from_supported_devices_table()
930 ci = supported_devices->info.asConnInfo[i]; in radeon_get_atom_connector_info_from_supported_devices_table()
973 u8 isb = supported_devices->info_2d1.asIntSrcInfo[i].ucIntSrcBitmap; in radeon_get_atom_connector_info_from_supported_devices_table()
1044 /* combine analog and digital for DVI-I */ in radeon_get_atom_connector_info_from_supported_devices_table()
1109 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_dentist_vco_freq()
1115 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_dentist_vco_freq()
1117 igp_info = (union igp_info *)(mode_info->atom_context->bios + in radeon_atombios_get_dentist_vco_freq()
1119 rdev->clock.vco_freq = in radeon_atombios_get_dentist_vco_freq()
1120 le32_to_cpu(igp_info->info_6.ulDentistVCOFreq); in radeon_atombios_get_dentist_vco_freq()
1126 struct radeon_device *rdev = dev->dev_private; in radeon_atom_get_clock_info()
1127 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atom_get_clock_info()
1131 struct radeon_pll *p1pll = &rdev->clock.p1pll; in radeon_atom_get_clock_info()
1132 struct radeon_pll *p2pll = &rdev->clock.p2pll; in radeon_atom_get_clock_info()
1133 struct radeon_pll *dcpll = &rdev->clock.dcpll; in radeon_atom_get_clock_info()
1134 struct radeon_pll *spll = &rdev->clock.spll; in radeon_atom_get_clock_info()
1135 struct radeon_pll *mpll = &rdev->clock.mpll; in radeon_atom_get_clock_info()
1138 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atom_get_clock_info()
1141 (union firmware_info *)(mode_info->atom_context->bios + in radeon_atom_get_clock_info()
1144 p1pll->reference_freq = in radeon_atom_get_clock_info()
1145 le16_to_cpu(firmware_info->info.usReferenceClock); in radeon_atom_get_clock_info()
1146 p1pll->reference_div = 0; in radeon_atom_get_clock_info()
1149 p1pll->pll_out_min = in radeon_atom_get_clock_info()
1150 le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output); in radeon_atom_get_clock_info()
1152 p1pll->pll_out_min = in radeon_atom_get_clock_info()
1153 le32_to_cpu(firmware_info->info_12.ulMinPixelClockPLL_Output); in radeon_atom_get_clock_info()
1154 p1pll->pll_out_max = in radeon_atom_get_clock_info()
1155 le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); in radeon_atom_get_clock_info()
1158 p1pll->lcd_pll_out_min = in radeon_atom_get_clock_info()
1159 le16_to_cpu(firmware_info->info_14.usLcdMinPixelClockPLL_Output) * 100; in radeon_atom_get_clock_info()
1160 if (p1pll->lcd_pll_out_min == 0) in radeon_atom_get_clock_info()
1161 p1pll->lcd_pll_out_min = p1pll->pll_out_min; in radeon_atom_get_clock_info()
1162 p1pll->lcd_pll_out_max = in radeon_atom_get_clock_info()
1163 le16_to_cpu(firmware_info->info_14.usLcdMaxPixelClockPLL_Output) * 100; in radeon_atom_get_clock_info()
1164 if (p1pll->lcd_pll_out_max == 0) in radeon_atom_get_clock_info()
1165 p1pll->lcd_pll_out_max = p1pll->pll_out_max; in radeon_atom_get_clock_info()
1167 p1pll->lcd_pll_out_min = p1pll->pll_out_min; in radeon_atom_get_clock_info()
1168 p1pll->lcd_pll_out_max = p1pll->pll_out_max; in radeon_atom_get_clock_info()
1171 if (p1pll->pll_out_min == 0) { in radeon_atom_get_clock_info()
1173 p1pll->pll_out_min = 64800; in radeon_atom_get_clock_info()
1175 p1pll->pll_out_min = 20000; in radeon_atom_get_clock_info()
1178 p1pll->pll_in_min = in radeon_atom_get_clock_info()
1179 le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Input); in radeon_atom_get_clock_info()
1180 p1pll->pll_in_max = in radeon_atom_get_clock_info()
1181 le16_to_cpu(firmware_info->info.usMaxPixelClockPLL_Input); in radeon_atom_get_clock_info()
1187 spll->reference_freq = in radeon_atom_get_clock_info()
1188 le16_to_cpu(firmware_info->info_21.usCoreReferenceClock); in radeon_atom_get_clock_info()
1190 spll->reference_freq = in radeon_atom_get_clock_info()
1191 le16_to_cpu(firmware_info->info.usReferenceClock); in radeon_atom_get_clock_info()
1192 spll->reference_div = 0; in radeon_atom_get_clock_info()
1194 spll->pll_out_min = in radeon_atom_get_clock_info()
1195 le16_to_cpu(firmware_info->info.usMinEngineClockPLL_Output); in radeon_atom_get_clock_info()
1196 spll->pll_out_max = in radeon_atom_get_clock_info()
1197 le32_to_cpu(firmware_info->info.ulMaxEngineClockPLL_Output); in radeon_atom_get_clock_info()
1200 if (spll->pll_out_min == 0) { in radeon_atom_get_clock_info()
1202 spll->pll_out_min = 64800; in radeon_atom_get_clock_info()
1204 spll->pll_out_min = 20000; in radeon_atom_get_clock_info()
1207 spll->pll_in_min = in radeon_atom_get_clock_info()
1208 le16_to_cpu(firmware_info->info.usMinEngineClockPLL_Input); in radeon_atom_get_clock_info()
1209 spll->pll_in_max = in radeon_atom_get_clock_info()
1210 le16_to_cpu(firmware_info->info.usMaxEngineClockPLL_Input); in radeon_atom_get_clock_info()
1214 mpll->reference_freq = in radeon_atom_get_clock_info()
1215 le16_to_cpu(firmware_info->info_21.usMemoryReferenceClock); in radeon_atom_get_clock_info()
1217 mpll->reference_freq = in radeon_atom_get_clock_info()
1218 le16_to_cpu(firmware_info->info.usReferenceClock); in radeon_atom_get_clock_info()
1219 mpll->reference_div = 0; in radeon_atom_get_clock_info()
1221 mpll->pll_out_min = in radeon_atom_get_clock_info()
1222 le16_to_cpu(firmware_info->info.usMinMemoryClockPLL_Output); in radeon_atom_get_clock_info()
1223 mpll->pll_out_max = in radeon_atom_get_clock_info()
1224 le32_to_cpu(firmware_info->info.ulMaxMemoryClockPLL_Output); in radeon_atom_get_clock_info()
1227 if (mpll->pll_out_min == 0) { in radeon_atom_get_clock_info()
1229 mpll->pll_out_min = 64800; in radeon_atom_get_clock_info()
1231 mpll->pll_out_min = 20000; in radeon_atom_get_clock_info()
1234 mpll->pll_in_min = in radeon_atom_get_clock_info()
1235 le16_to_cpu(firmware_info->info.usMinMemoryClockPLL_Input); in radeon_atom_get_clock_info()
1236 mpll->pll_in_max = in radeon_atom_get_clock_info()
1237 le16_to_cpu(firmware_info->info.usMaxMemoryClockPLL_Input); in radeon_atom_get_clock_info()
1239 rdev->clock.default_sclk = in radeon_atom_get_clock_info()
1240 le32_to_cpu(firmware_info->info.ulDefaultEngineClock); in radeon_atom_get_clock_info()
1241 rdev->clock.default_mclk = in radeon_atom_get_clock_info()
1242 le32_to_cpu(firmware_info->info.ulDefaultMemoryClock); in radeon_atom_get_clock_info()
1245 rdev->clock.default_dispclk = in radeon_atom_get_clock_info()
1246 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); in radeon_atom_get_clock_info()
1247 if (rdev->clock.default_dispclk == 0) { in radeon_atom_get_clock_info()
1249 rdev->clock.default_dispclk = 60000; /* 600 Mhz */ in radeon_atom_get_clock_info()
1251 rdev->clock.default_dispclk = 54000; /* 540 Mhz */ in radeon_atom_get_clock_info()
1253 rdev->clock.default_dispclk = 60000; /* 600 Mhz */ in radeon_atom_get_clock_info()
1256 if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) { in radeon_atom_get_clock_info()
1258 rdev->clock.default_dispclk / 100); in radeon_atom_get_clock_info()
1259 rdev->clock.default_dispclk = 60000; in radeon_atom_get_clock_info()
1261 rdev->clock.dp_extclk = in radeon_atom_get_clock_info()
1262 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); in radeon_atom_get_clock_info()
1263 rdev->clock.current_dispclk = rdev->clock.default_dispclk; in radeon_atom_get_clock_info()
1267 rdev->clock.max_pixel_clock = le16_to_cpu(firmware_info->info.usMaxPixelClock); in radeon_atom_get_clock_info()
1268 if (rdev->clock.max_pixel_clock == 0) in radeon_atom_get_clock_info()
1269 rdev->clock.max_pixel_clock = 40000; in radeon_atom_get_clock_info()
1272 rdev->mode_info.firmware_flags = in radeon_atom_get_clock_info()
1273 le16_to_cpu(firmware_info->info.usFirmwareCapability.susAccess); in radeon_atom_get_clock_info()
1276 rdev->clock.vco_freq = in radeon_atom_get_clock_info()
1277 le32_to_cpu(firmware_info->info_22.ulGPUPLL_OutputFreq); in radeon_atom_get_clock_info()
1279 rdev->clock.vco_freq = rdev->clock.current_dispclk; in radeon_atom_get_clock_info()
1283 rdev->clock.vco_freq = rdev->clock.current_dispclk; in radeon_atom_get_clock_info()
1285 if (rdev->clock.vco_freq == 0) in radeon_atom_get_clock_info()
1286 rdev->clock.vco_freq = 360000; /* 3.6 GHz */ in radeon_atom_get_clock_info()
1296 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_sideport_present()
1303 if (rdev->family == CHIP_RS600) in radeon_atombios_sideport_present()
1306 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_sideport_present()
1308 igp_info = (union igp_info *)(mode_info->atom_context->bios + in radeon_atombios_sideport_present()
1312 if (le32_to_cpu(igp_info->info.ulBootUpMemoryClock)) in radeon_atombios_sideport_present()
1316 if (le32_to_cpu(igp_info->info_2.ulBootUpSidePortClock)) in radeon_atombios_sideport_present()
1320 DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev); in radeon_atombios_sideport_present()
1330 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_tmds_info()
1331 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_tmds_info()
1332 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_tmds_info()
1340 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_tmds_info()
1343 (struct _ATOM_TMDS_INFO *)(mode_info->atom_context->bios + in radeon_atombios_get_tmds_info()
1346 maxfreq = le16_to_cpu(tmds_info->usMaxFrequency); in radeon_atombios_get_tmds_info()
1348 tmds->tmds_pll[i].freq = in radeon_atombios_get_tmds_info()
1349 le16_to_cpu(tmds_info->asMiscInfo[i].usFrequency); in radeon_atombios_get_tmds_info()
1350 tmds->tmds_pll[i].value = in radeon_atombios_get_tmds_info()
1351 tmds_info->asMiscInfo[i].ucPLL_ChargePump & 0x3f; in radeon_atombios_get_tmds_info()
1352 tmds->tmds_pll[i].value |= in radeon_atombios_get_tmds_info()
1353 (tmds_info->asMiscInfo[i]. in radeon_atombios_get_tmds_info()
1355 tmds->tmds_pll[i].value |= in radeon_atombios_get_tmds_info()
1356 (tmds_info->asMiscInfo[i]. in radeon_atombios_get_tmds_info()
1358 tmds->tmds_pll[i].value |= in radeon_atombios_get_tmds_info()
1359 (tmds_info->asMiscInfo[i]. in radeon_atombios_get_tmds_info()
1363 tmds->tmds_pll[i].freq, in radeon_atombios_get_tmds_info()
1364 tmds->tmds_pll[i].value); in radeon_atombios_get_tmds_info()
1366 if (maxfreq == tmds->tmds_pll[i].freq) { in radeon_atombios_get_tmds_info()
1367 tmds->tmds_pll[i].freq = 0xffffffff; in radeon_atombios_get_tmds_info()
1380 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_ppll_ss_info()
1389 if (atom_parse_data_header(mode_info->atom_context, index, &size, in radeon_atombios_get_ppll_ss_info()
1392 (struct _ATOM_SPREAD_SPECTRUM_INFO *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_get_ppll_ss_info()
1394 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_ppll_ss_info()
1397 ((u8 *)&ss_info->asSS_Info[0]); in radeon_atombios_get_ppll_ss_info()
1399 if (ss_assign->ucSS_Id == id) { in radeon_atombios_get_ppll_ss_info()
1400 ss->percentage = in radeon_atombios_get_ppll_ss_info()
1401 le16_to_cpu(ss_assign->usSpreadSpectrumPercentage); in radeon_atombios_get_ppll_ss_info()
1402 ss->type = ss_assign->ucSpreadSpectrumType; in radeon_atombios_get_ppll_ss_info()
1403 ss->step = ss_assign->ucSS_Step; in radeon_atombios_get_ppll_ss_info()
1404 ss->delay = ss_assign->ucSS_Delay; in radeon_atombios_get_ppll_ss_info()
1405 ss->range = ss_assign->ucSS_Range; in radeon_atombios_get_ppll_ss_info()
1406 ss->refdiv = ss_assign->ucRecommendedRef_Div; in radeon_atombios_get_ppll_ss_info()
1420 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_igp_ss_overrides()
1428 if (atom_parse_data_header(mode_info->atom_context, index, &size, in radeon_atombios_get_igp_ss_overrides()
1431 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_igp_ss_overrides()
1436 percentage = le16_to_cpu(igp_info->info_6.usDVISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1437 rate = le16_to_cpu(igp_info->info_6.usDVISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1440 percentage = le16_to_cpu(igp_info->info_6.usHDMISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1441 rate = le16_to_cpu(igp_info->info_6.usHDMISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1444 percentage = le16_to_cpu(igp_info->info_6.usLvdsSSPercentage); in radeon_atombios_get_igp_ss_overrides()
1445 rate = le16_to_cpu(igp_info->info_6.usLvdsSSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1452 percentage = le16_to_cpu(igp_info->info_7.usDVISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1453 rate = le16_to_cpu(igp_info->info_7.usDVISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1456 percentage = le16_to_cpu(igp_info->info_7.usHDMISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1457 rate = le16_to_cpu(igp_info->info_7.usHDMISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1460 percentage = le16_to_cpu(igp_info->info_7.usLvdsSSPercentage); in radeon_atombios_get_igp_ss_overrides()
1461 rate = le16_to_cpu(igp_info->info_7.usLvdsSSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1468 percentage = le16_to_cpu(igp_info->info_8.usDVISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1469 rate = le16_to_cpu(igp_info->info_8.usDVISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1472 percentage = le16_to_cpu(igp_info->info_8.usHDMISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1473 rate = le16_to_cpu(igp_info->info_8.usHDMISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1476 percentage = le16_to_cpu(igp_info->info_8.usLvdsSSPercentage); in radeon_atombios_get_igp_ss_overrides()
1477 rate = le16_to_cpu(igp_info->info_8.usLvdsSSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1482 DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev); in radeon_atombios_get_igp_ss_overrides()
1486 ss->percentage = percentage; in radeon_atombios_get_igp_ss_overrides()
1488 ss->rate = rate; in radeon_atombios_get_igp_ss_overrides()
1508 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_asic_ss_info()
1517 if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_MEMORY_CLOCK_SS_SUPPORT)) in radeon_atombios_get_asic_ss_info()
1521 if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_ENGINE_CLOCK_SS_SUPPORT)) in radeon_atombios_get_asic_ss_info()
1526 if (atom_parse_data_header(mode_info->atom_context, index, &size, in radeon_atombios_get_asic_ss_info()
1530 (union asic_ss_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_get_asic_ss_info()
1534 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_asic_ss_info()
1537 ss_assign = (union asic_ss_assignment *)((u8 *)&ss_info->info.asSpreadSpectrum[0]); in radeon_atombios_get_asic_ss_info()
1539 if ((ss_assign->v1.ucClockIndication == id) && in radeon_atombios_get_asic_ss_info()
1540 (clock <= le32_to_cpu(ss_assign->v1.ulTargetClockRange))) { in radeon_atombios_get_asic_ss_info()
1541 ss->percentage = in radeon_atombios_get_asic_ss_info()
1542 le16_to_cpu(ss_assign->v1.usSpreadSpectrumPercentage); in radeon_atombios_get_asic_ss_info()
1543 ss->type = ss_assign->v1.ucSpreadSpectrumMode; in radeon_atombios_get_asic_ss_info()
1544 ss->rate = le16_to_cpu(ss_assign->v1.usSpreadRateInKhz); in radeon_atombios_get_asic_ss_info()
1545 ss->percentage_divider = 100; in radeon_atombios_get_asic_ss_info()
1553 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_asic_ss_info()
1555 ss_assign = (union asic_ss_assignment *)((u8 *)&ss_info->info_2.asSpreadSpectrum[0]); in radeon_atombios_get_asic_ss_info()
1557 if ((ss_assign->v2.ucClockIndication == id) && in radeon_atombios_get_asic_ss_info()
1558 (clock <= le32_to_cpu(ss_assign->v2.ulTargetClockRange))) { in radeon_atombios_get_asic_ss_info()
1559 ss->percentage = in radeon_atombios_get_asic_ss_info()
1560 le16_to_cpu(ss_assign->v2.usSpreadSpectrumPercentage); in radeon_atombios_get_asic_ss_info()
1561 ss->type = ss_assign->v2.ucSpreadSpectrumMode; in radeon_atombios_get_asic_ss_info()
1562 ss->rate = le16_to_cpu(ss_assign->v2.usSpreadRateIn10Hz); in radeon_atombios_get_asic_ss_info()
1563 ss->percentage_divider = 100; in radeon_atombios_get_asic_ss_info()
1567 ss->rate /= 100; in radeon_atombios_get_asic_ss_info()
1575 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_asic_ss_info()
1577 ss_assign = (union asic_ss_assignment *)((u8 *)&ss_info->info_3.asSpreadSpectrum[0]); in radeon_atombios_get_asic_ss_info()
1579 if ((ss_assign->v3.ucClockIndication == id) && in radeon_atombios_get_asic_ss_info()
1580 (clock <= le32_to_cpu(ss_assign->v3.ulTargetClockRange))) { in radeon_atombios_get_asic_ss_info()
1581 ss->percentage = in radeon_atombios_get_asic_ss_info()
1582 le16_to_cpu(ss_assign->v3.usSpreadSpectrumPercentage); in radeon_atombios_get_asic_ss_info()
1583 ss->type = ss_assign->v3.ucSpreadSpectrumMode; in radeon_atombios_get_asic_ss_info()
1584 ss->rate = le16_to_cpu(ss_assign->v3.usSpreadRateIn10Hz); in radeon_atombios_get_asic_ss_info()
1585 if (ss_assign->v3.ucSpreadSpectrumMode & in radeon_atombios_get_asic_ss_info()
1587 ss->percentage_divider = 1000; in radeon_atombios_get_asic_ss_info()
1589 ss->percentage_divider = 100; in radeon_atombios_get_asic_ss_info()
1592 ss->rate /= 100; in radeon_atombios_get_asic_ss_info()
1593 if (rdev->flags & RADEON_IS_IGP) in radeon_atombios_get_asic_ss_info()
1602 DRM_ERROR("Unsupported ASIC_InternalSS_Info table: %d %d\n", frev, crev); in radeon_atombios_get_asic_ss_info()
1619 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_lvds_info()
1620 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_lvds_info()
1621 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_lvds_info()
1627 int encoder_enum = (encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; in radeon_atombios_get_lvds_info()
1629 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_lvds_info()
1632 (union lvds_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_get_lvds_info()
1639 lvds->native_mode.clock = in radeon_atombios_get_lvds_info()
1640 le16_to_cpu(lvds_info->info.sLCDTiming.usPixClk) * 10; in radeon_atombios_get_lvds_info()
1641 lvds->native_mode.hdisplay = in radeon_atombios_get_lvds_info()
1642 le16_to_cpu(lvds_info->info.sLCDTiming.usHActive); in radeon_atombios_get_lvds_info()
1643 lvds->native_mode.vdisplay = in radeon_atombios_get_lvds_info()
1644 le16_to_cpu(lvds_info->info.sLCDTiming.usVActive); in radeon_atombios_get_lvds_info()
1645 lvds->native_mode.htotal = lvds->native_mode.hdisplay + in radeon_atombios_get_lvds_info()
1646 le16_to_cpu(lvds_info->info.sLCDTiming.usHBlanking_Time); in radeon_atombios_get_lvds_info()
1647 lvds->native_mode.hsync_start = lvds->native_mode.hdisplay + in radeon_atombios_get_lvds_info()
1648 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncOffset); in radeon_atombios_get_lvds_info()
1649 lvds->native_mode.hsync_end = lvds->native_mode.hsync_start + in radeon_atombios_get_lvds_info()
1650 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncWidth); in radeon_atombios_get_lvds_info()
1651 lvds->native_mode.vtotal = lvds->native_mode.vdisplay + in radeon_atombios_get_lvds_info()
1652 le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time); in radeon_atombios_get_lvds_info()
1653 lvds->native_mode.vsync_start = lvds->native_mode.vdisplay + in radeon_atombios_get_lvds_info()
1654 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncOffset); in radeon_atombios_get_lvds_info()
1655 lvds->native_mode.vsync_end = lvds->native_mode.vsync_start + in radeon_atombios_get_lvds_info()
1656 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth); in radeon_atombios_get_lvds_info()
1657 lvds->panel_pwr_delay = in radeon_atombios_get_lvds_info()
1658 le16_to_cpu(lvds_info->info.usOffDelayInMs); in radeon_atombios_get_lvds_info()
1659 lvds->lcd_misc = lvds_info->info.ucLVDS_Misc; in radeon_atombios_get_lvds_info()
1661 misc = le16_to_cpu(lvds_info->info.sLCDTiming.susModeMiscInfo.usAccess); in radeon_atombios_get_lvds_info()
1663 lvds->native_mode.flags |= DRM_MODE_FLAG_NVSYNC; in radeon_atombios_get_lvds_info()
1665 lvds->native_mode.flags |= DRM_MODE_FLAG_NHSYNC; in radeon_atombios_get_lvds_info()
1667 lvds->native_mode.flags |= DRM_MODE_FLAG_CSYNC; in radeon_atombios_get_lvds_info()
1669 lvds->native_mode.flags |= DRM_MODE_FLAG_INTERLACE; in radeon_atombios_get_lvds_info()
1671 lvds->native_mode.flags |= DRM_MODE_FLAG_DBLSCAN; in radeon_atombios_get_lvds_info()
1673 lvds->native_mode.width_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageHSize); in radeon_atombios_get_lvds_info()
1674 lvds->native_mode.height_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageVSize); in radeon_atombios_get_lvds_info()
1677 drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); in radeon_atombios_get_lvds_info()
1679 lvds->lcd_ss_id = lvds_info->info.ucSS_Id; in radeon_atombios_get_lvds_info()
1681 encoder->native_mode = lvds->native_mode; in radeon_atombios_get_lvds_info()
1684 lvds->linkb = true; in radeon_atombios_get_lvds_info()
1686 lvds->linkb = false; in radeon_atombios_get_lvds_info()
1689 if (le16_to_cpu(lvds_info->info.usModePatchTableOffset)) { in radeon_atombios_get_lvds_info()
1697 record = (u8 *)(mode_info->atom_context->bios + in radeon_atombios_get_lvds_info()
1698 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); in radeon_atombios_get_lvds_info()
1701 record = (u8 *)(mode_info->atom_context->bios + in radeon_atombios_get_lvds_info()
1703 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); in radeon_atombios_get_lvds_info()
1717 if (fake_edid_record->ucFakeEDIDLength) { in radeon_atombios_get_lvds_info()
1721 if (fake_edid_record->ucFakeEDIDLength == 128) in radeon_atombios_get_lvds_info()
1722 edid_size = fake_edid_record->ucFakeEDIDLength; in radeon_atombios_get_lvds_info()
1724 edid_size = fake_edid_record->ucFakeEDIDLength * 128; in radeon_atombios_get_lvds_info()
1725 edid = kmemdup(&fake_edid_record->ucFakeEDIDString[0], in radeon_atombios_get_lvds_info()
1729 rdev->mode_info.bios_hardcoded_edid = edid; in radeon_atombios_get_lvds_info()
1730 rdev->mode_info.bios_hardcoded_edid_size = edid_size; in radeon_atombios_get_lvds_info()
1745 lvds->native_mode.width_mm = panel_res_record->usHSize; in radeon_atombios_get_lvds_info()
1746 lvds->native_mode.height_mm = panel_res_record->usVSize; in radeon_atombios_get_lvds_info()
1750 DRM_ERROR("Bad LCD record %d\n", *record); in radeon_atombios_get_lvds_info()
1765 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_primary_dac_info()
1766 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_primary_dac_info()
1767 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_primary_dac_info()
1775 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_primary_dac_info()
1778 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_primary_dac_info()
1785 bg = dac_info->ucDAC1_BG_Adjustment; in radeon_atombios_get_primary_dac_info()
1786 dac = dac_info->ucDAC1_DAC_Adjustment; in radeon_atombios_get_primary_dac_info()
1787 p_dac->ps2_pdac_adj = (bg << 8) | (dac); in radeon_atombios_get_primary_dac_info()
1796 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atom_get_tv_timings()
1804 if (!atom_parse_data_header(mode_info->atom_context, data_index, NULL, in radeon_atom_get_tv_timings()
1810 tv_info = (ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset); in radeon_atom_get_tv_timings()
1814 mode->crtc_htotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total); in radeon_atom_get_tv_timings()
1815 mode->crtc_hdisplay = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Disp); in radeon_atom_get_tv_timings()
1816 mode->crtc_hsync_start = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart); in radeon_atom_get_tv_timings()
1817 mode->crtc_hsync_end = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart) + in radeon_atom_get_tv_timings()
1818 le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncWidth); in radeon_atom_get_tv_timings()
1820 mode->crtc_vtotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Total); in radeon_atom_get_tv_timings()
1821 mode->crtc_vdisplay = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Disp); in radeon_atom_get_tv_timings()
1822 mode->crtc_vsync_start = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart); in radeon_atom_get_tv_timings()
1823 mode->crtc_vsync_end = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart) + in radeon_atom_get_tv_timings()
1824 le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncWidth); in radeon_atom_get_tv_timings()
1826 mode->flags = 0; in radeon_atom_get_tv_timings()
1827 misc = le16_to_cpu(tv_info->aModeTimings[index].susModeMiscInfo.usAccess); in radeon_atom_get_tv_timings()
1829 mode->flags |= DRM_MODE_FLAG_NVSYNC; in radeon_atom_get_tv_timings()
1831 mode->flags |= DRM_MODE_FLAG_NHSYNC; in radeon_atom_get_tv_timings()
1833 mode->flags |= DRM_MODE_FLAG_CSYNC; in radeon_atom_get_tv_timings()
1835 mode->flags |= DRM_MODE_FLAG_INTERLACE; in radeon_atom_get_tv_timings()
1837 mode->flags |= DRM_MODE_FLAG_DBLSCAN; in radeon_atom_get_tv_timings()
1839 mode->crtc_clock = mode->clock = in radeon_atom_get_tv_timings()
1840 le16_to_cpu(tv_info->aModeTimings[index].usPixelClock) * 10; in radeon_atom_get_tv_timings()
1844 mode->crtc_htotal -= 1; in radeon_atom_get_tv_timings()
1845 mode->crtc_vtotal -= 1; in radeon_atom_get_tv_timings()
1849 tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2 *)(mode_info->atom_context->bios + data_offset); in radeon_atom_get_tv_timings()
1853 dtd_timings = &tv_info_v1_2->aModeTimings[index]; in radeon_atom_get_tv_timings()
1854 mode->crtc_htotal = le16_to_cpu(dtd_timings->usHActive) + in radeon_atom_get_tv_timings()
1855 le16_to_cpu(dtd_timings->usHBlanking_Time); in radeon_atom_get_tv_timings()
1856 mode->crtc_hdisplay = le16_to_cpu(dtd_timings->usHActive); in radeon_atom_get_tv_timings()
1857 mode->crtc_hsync_start = le16_to_cpu(dtd_timings->usHActive) + in radeon_atom_get_tv_timings()
1858 le16_to_cpu(dtd_timings->usHSyncOffset); in radeon_atom_get_tv_timings()
1859 mode->crtc_hsync_end = mode->crtc_hsync_start + in radeon_atom_get_tv_timings()
1860 le16_to_cpu(dtd_timings->usHSyncWidth); in radeon_atom_get_tv_timings()
1862 mode->crtc_vtotal = le16_to_cpu(dtd_timings->usVActive) + in radeon_atom_get_tv_timings()
1863 le16_to_cpu(dtd_timings->usVBlanking_Time); in radeon_atom_get_tv_timings()
1864 mode->crtc_vdisplay = le16_to_cpu(dtd_timings->usVActive); in radeon_atom_get_tv_timings()
1865 mode->crtc_vsync_start = le16_to_cpu(dtd_timings->usVActive) + in radeon_atom_get_tv_timings()
1866 le16_to_cpu(dtd_timings->usVSyncOffset); in radeon_atom_get_tv_timings()
1867 mode->crtc_vsync_end = mode->crtc_vsync_start + in radeon_atom_get_tv_timings()
1868 le16_to_cpu(dtd_timings->usVSyncWidth); in radeon_atom_get_tv_timings()
1870 mode->flags = 0; in radeon_atom_get_tv_timings()
1871 misc = le16_to_cpu(dtd_timings->susModeMiscInfo.usAccess); in radeon_atom_get_tv_timings()
1873 mode->flags |= DRM_MODE_FLAG_NVSYNC; in radeon_atom_get_tv_timings()
1875 mode->flags |= DRM_MODE_FLAG_NHSYNC; in radeon_atom_get_tv_timings()
1877 mode->flags |= DRM_MODE_FLAG_CSYNC; in radeon_atom_get_tv_timings()
1879 mode->flags |= DRM_MODE_FLAG_INTERLACE; in radeon_atom_get_tv_timings()
1881 mode->flags |= DRM_MODE_FLAG_DBLSCAN; in radeon_atom_get_tv_timings()
1883 mode->crtc_clock = mode->clock = in radeon_atom_get_tv_timings()
1884 le16_to_cpu(dtd_timings->usPixClk) * 10; in radeon_atom_get_tv_timings()
1893 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_tv_info()
1900 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_tv_info()
1904 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_tv_info()
1906 switch (tv_info->ucTV_BootUpDefaultStandard) { in radeon_atombios_get_tv_info()
1913 DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); in radeon_atombios_get_tv_info()
1921 DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); in radeon_atombios_get_tv_info()
1925 DRM_DEBUG_KMS("Default TV standard: PAL-N\n"); in radeon_atombios_get_tv_info()
1929 DRM_DEBUG_KMS("Default TV standard: PAL-CN\n"); in radeon_atombios_get_tv_info()
1933 DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); in radeon_atombios_get_tv_info()
1951 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_tv_dac_info()
1952 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_tv_dac_info()
1953 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_tv_dac_info()
1961 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_tv_dac_info()
1965 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_tv_dac_info()
1972 bg = dac_info->ucDAC2_CRT2_BG_Adjustment; in radeon_atombios_get_tv_dac_info()
1973 dac = dac_info->ucDAC2_CRT2_DAC_Adjustment; in radeon_atombios_get_tv_dac_info()
1974 tv_dac->ps2_tvdac_adj = (bg << 16) | (dac << 20); in radeon_atombios_get_tv_dac_info()
1976 bg = dac_info->ucDAC2_PAL_BG_Adjustment; in radeon_atombios_get_tv_dac_info()
1977 dac = dac_info->ucDAC2_PAL_DAC_Adjustment; in radeon_atombios_get_tv_dac_info()
1978 tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20); in radeon_atombios_get_tv_dac_info()
1980 bg = dac_info->ucDAC2_NTSC_BG_Adjustment; in radeon_atombios_get_tv_dac_info()
1981 dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; in radeon_atombios_get_tv_dac_info()
1982 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); in radeon_atombios_get_tv_dac_info()
1984 tv_dac->tv_std = radeon_atombios_get_tv_info(rdev); in radeon_atombios_get_tv_dac_info()
2010 "adt7473",
2049 rdev->pm.power_state[state_index].misc = misc; in radeon_atombios_parse_misc_flags_1_3()
2050 rdev->pm.power_state[state_index].misc2 = misc2; in radeon_atombios_parse_misc_flags_1_3()
2053 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2056 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2059 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2062 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2065 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2067 rdev->pm.power_state[state_index].flags &= in radeon_atombios_parse_misc_flags_1_3()
2071 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2074 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2076 rdev->pm.default_power_state_index = state_index; in radeon_atombios_parse_misc_flags_1_3()
2077 rdev->pm.power_state[state_index].default_clock_mode = in radeon_atombios_parse_misc_flags_1_3()
2078 &rdev->pm.power_state[state_index].clock_info[0]; in radeon_atombios_parse_misc_flags_1_3()
2080 rdev->pm.power_state[state_index].clock_info[0].flags |= in radeon_atombios_parse_misc_flags_1_3()
2087 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_parse_power_table_1_3()
2097 if (!atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_parse_power_table_1_3()
2100 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_parse_power_table_1_3()
2103 if ((power_info->info.ucOverdriveThermalController > 0) && in radeon_atombios_parse_power_table_1_3()
2104 (power_info->info.ucOverdriveThermalController < ARRAY_SIZE(thermal_controller_names))) { in radeon_atombios_parse_power_table_1_3()
2106 thermal_controller_names[power_info->info.ucOverdriveThermalController], in radeon_atombios_parse_power_table_1_3()
2107 power_info->info.ucOverdriveControllerAddress >> 1); in radeon_atombios_parse_power_table_1_3()
2108 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); in radeon_atombios_parse_power_table_1_3()
2109 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); in radeon_atombios_parse_power_table_1_3()
2110 if (rdev->pm.i2c_bus) { in radeon_atombios_parse_power_table_1_3()
2112 const char *name = thermal_controller_names[power_info->info. in radeon_atombios_parse_power_table_1_3()
2114 info.addr = power_info->info.ucOverdriveControllerAddress >> 1; in radeon_atombios_parse_power_table_1_3()
2116 i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info); in radeon_atombios_parse_power_table_1_3()
2119 num_modes = power_info->info.ucNumOfPowerModeEntries; in radeon_atombios_parse_power_table_1_3()
2124 rdev->pm.power_state = kcalloc(num_modes, in radeon_atombios_parse_power_table_1_3()
2127 if (!rdev->pm.power_state) in radeon_atombios_parse_power_table_1_3()
2132 if (!rdev->pm.power_state[state_index].clock_info) { in radeon_atombios_parse_power_table_1_3()
2133 rdev->pm.power_state[state_index].clock_info = in radeon_atombios_parse_power_table_1_3()
2137 if (!rdev->pm.power_state[state_index].clock_info) in radeon_atombios_parse_power_table_1_3()
2139 rdev->pm.power_state[state_index].num_clock_modes = 1; in radeon_atombios_parse_power_table_1_3()
2140 rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; in radeon_atombios_parse_power_table_1_3()
2143 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_1_3()
2144 le16_to_cpu(power_info->info.asPowerPlayInfo[i].usMemoryClock); in radeon_atombios_parse_power_table_1_3()
2145 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_1_3()
2146 le16_to_cpu(power_info->info.asPowerPlayInfo[i].usEngineClock); in radeon_atombios_parse_power_table_1_3()
2148 if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || in radeon_atombios_parse_power_table_1_3()
2149 (rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) in radeon_atombios_parse_power_table_1_3()
2151 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_power_table_1_3()
2152 power_info->info.asPowerPlayInfo[i].ucNumPciELanes; in radeon_atombios_parse_power_table_1_3()
2153 misc = le32_to_cpu(power_info->info.asPowerPlayInfo[i].ulMiscInfo); in radeon_atombios_parse_power_table_1_3()
2156 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2158 rdev->pm.power_state[state_index].clock_info[0].voltage.gpio = in radeon_atombios_parse_power_table_1_3()
2160 power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex); in radeon_atombios_parse_power_table_1_3()
2162 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2165 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2168 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2170 rdev->pm.power_state[state_index].clock_info[0].voltage.vddc_id = in radeon_atombios_parse_power_table_1_3()
2171 power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2173 rdev->pm.power_state[state_index].flags = RADEON_PM_STATE_SINGLE_DISPLAY_ONLY; in radeon_atombios_parse_power_table_1_3()
2178 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_1_3()
2179 le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMemoryClock); in radeon_atombios_parse_power_table_1_3()
2180 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_1_3()
2181 le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulEngineClock); in radeon_atombios_parse_power_table_1_3()
2183 if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || in radeon_atombios_parse_power_table_1_3()
2184 (rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) in radeon_atombios_parse_power_table_1_3()
2186 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_power_table_1_3()
2187 power_info->info_2.asPowerPlayInfo[i].ucNumPciELanes; in radeon_atombios_parse_power_table_1_3()
2188 misc = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo); in radeon_atombios_parse_power_table_1_3()
2189 misc2 = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo2); in radeon_atombios_parse_power_table_1_3()
2192 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2194 rdev->pm.power_state[state_index].clock_info[0].voltage.gpio = in radeon_atombios_parse_power_table_1_3()
2196 power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex); in radeon_atombios_parse_power_table_1_3()
2198 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2201 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2204 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2206 rdev->pm.power_state[state_index].clock_info[0].voltage.vddc_id = in radeon_atombios_parse_power_table_1_3()
2207 power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2209 rdev->pm.power_state[state_index].flags = RADEON_PM_STATE_SINGLE_DISPLAY_ONLY; in radeon_atombios_parse_power_table_1_3()
2214 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_1_3()
2215 le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMemoryClock); in radeon_atombios_parse_power_table_1_3()
2216 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_1_3()
2217 le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulEngineClock); in radeon_atombios_parse_power_table_1_3()
2219 if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || in radeon_atombios_parse_power_table_1_3()
2220 (rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) in radeon_atombios_parse_power_table_1_3()
2222 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_power_table_1_3()
2223 power_info->info_3.asPowerPlayInfo[i].ucNumPciELanes; in radeon_atombios_parse_power_table_1_3()
2224 misc = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo); in radeon_atombios_parse_power_table_1_3()
2225 misc2 = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo2); in radeon_atombios_parse_power_table_1_3()
2228 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2230 rdev->pm.power_state[state_index].clock_info[0].voltage.gpio = in radeon_atombios_parse_power_table_1_3()
2232 power_info->info_3.asPowerPlayInfo[i].ucVoltageDropIndex); in radeon_atombios_parse_power_table_1_3()
2234 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2237 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2240 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2242 rdev->pm.power_state[state_index].clock_info[0].voltage.vddc_id = in radeon_atombios_parse_power_table_1_3()
2243 power_info->info_3.asPowerPlayInfo[i].ucVoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2245 rdev->pm.power_state[state_index].clock_info[0].voltage.vddci_enabled = in radeon_atombios_parse_power_table_1_3()
2247 rdev->pm.power_state[state_index].clock_info[0].voltage.vddci_id = in radeon_atombios_parse_power_table_1_3()
2248 power_info->info_3.asPowerPlayInfo[i].ucVDDCI_VoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2251 rdev->pm.power_state[state_index].flags = RADEON_PM_STATE_SINGLE_DISPLAY_ONLY; in radeon_atombios_parse_power_table_1_3()
2260 kfree(rdev->pm.power_state[state_index].clock_info); in radeon_atombios_parse_power_table_1_3()
2261 rdev->pm.power_state[state_index].clock_info = NULL; in radeon_atombios_parse_power_table_1_3()
2265 if (state_index && rdev->pm.default_power_state_index == -1) { in radeon_atombios_parse_power_table_1_3()
2266 rdev->pm.power_state[state_index - 1].type = in radeon_atombios_parse_power_table_1_3()
2268 rdev->pm.default_power_state_index = state_index - 1; in radeon_atombios_parse_power_table_1_3()
2269 rdev->pm.power_state[state_index - 1].default_clock_mode = in radeon_atombios_parse_power_table_1_3()
2270 &rdev->pm.power_state[state_index - 1].clock_info[0]; in radeon_atombios_parse_power_table_1_3()
2271 rdev->pm.power_state[state_index - 1].flags &= in radeon_atombios_parse_power_table_1_3()
2273 rdev->pm.power_state[state_index - 1].misc = 0; in radeon_atombios_parse_power_table_1_3()
2274 rdev->pm.power_state[state_index - 1].misc2 = 0; in radeon_atombios_parse_power_table_1_3()
2285 if (controller->ucType > 0) { in radeon_atombios_add_pplib_thermal_controller()
2286 if (controller->ucFanParameters & ATOM_PP_FANPARAMETERS_NOFAN) in radeon_atombios_add_pplib_thermal_controller()
2287 rdev->pm.no_fan = true; in radeon_atombios_add_pplib_thermal_controller()
2288 rdev->pm.fan_pulses_per_revolution = in radeon_atombios_add_pplib_thermal_controller()
2289 controller->ucFanParameters & ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK; in radeon_atombios_add_pplib_thermal_controller()
2290 if (rdev->pm.fan_pulses_per_revolution) { in radeon_atombios_add_pplib_thermal_controller()
2291 rdev->pm.fan_min_rpm = controller->ucFanMinRPM; in radeon_atombios_add_pplib_thermal_controller()
2292 rdev->pm.fan_max_rpm = controller->ucFanMaxRPM; in radeon_atombios_add_pplib_thermal_controller()
2294 if (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) { in radeon_atombios_add_pplib_thermal_controller()
2296 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2298 rdev->pm.int_thermal_type = THERMAL_TYPE_RV6XX; in radeon_atombios_add_pplib_thermal_controller()
2299 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) { in radeon_atombios_add_pplib_thermal_controller()
2301 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2303 rdev->pm.int_thermal_type = THERMAL_TYPE_RV770; in radeon_atombios_add_pplib_thermal_controller()
2304 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN) { in radeon_atombios_add_pplib_thermal_controller()
2306 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2308 rdev->pm.int_thermal_type = THERMAL_TYPE_EVERGREEN; in radeon_atombios_add_pplib_thermal_controller()
2309 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_SUMO) { in radeon_atombios_add_pplib_thermal_controller()
2311 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2313 rdev->pm.int_thermal_type = THERMAL_TYPE_SUMO; in radeon_atombios_add_pplib_thermal_controller()
2314 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_NISLANDS) { in radeon_atombios_add_pplib_thermal_controller()
2316 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2318 rdev->pm.int_thermal_type = THERMAL_TYPE_NI; in radeon_atombios_add_pplib_thermal_controller()
2319 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_SISLANDS) { in radeon_atombios_add_pplib_thermal_controller()
2321 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2323 rdev->pm.int_thermal_type = THERMAL_TYPE_SI; in radeon_atombios_add_pplib_thermal_controller()
2324 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_CISLANDS) { in radeon_atombios_add_pplib_thermal_controller()
2326 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2328 rdev->pm.int_thermal_type = THERMAL_TYPE_CI; in radeon_atombios_add_pplib_thermal_controller()
2329 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_KAVERI) { in radeon_atombios_add_pplib_thermal_controller()
2331 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2333 rdev->pm.int_thermal_type = THERMAL_TYPE_KV; in radeon_atombios_add_pplib_thermal_controller()
2334 } else if (controller->ucType == in radeon_atombios_add_pplib_thermal_controller()
2337 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2339 rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO; in radeon_atombios_add_pplib_thermal_controller()
2340 } else if (controller->ucType == in radeon_atombios_add_pplib_thermal_controller()
2342 DRM_INFO("ADT7473 with internal thermal controller %s fan control\n", in radeon_atombios_add_pplib_thermal_controller()
2343 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2345 rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL; in radeon_atombios_add_pplib_thermal_controller()
2346 } else if (controller->ucType == in radeon_atombios_add_pplib_thermal_controller()
2349 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2351 rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL; in radeon_atombios_add_pplib_thermal_controller()
2352 } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { in radeon_atombios_add_pplib_thermal_controller()
2354 pp_lib_thermal_controller_names[controller->ucType], in radeon_atombios_add_pplib_thermal_controller()
2355 controller->ucI2cAddress >> 1, in radeon_atombios_add_pplib_thermal_controller()
2356 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2358 rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL; in radeon_atombios_add_pplib_thermal_controller()
2359 i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); in radeon_atombios_add_pplib_thermal_controller()
2360 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); in radeon_atombios_add_pplib_thermal_controller()
2361 if (rdev->pm.i2c_bus) { in radeon_atombios_add_pplib_thermal_controller()
2363 const char *name = pp_lib_thermal_controller_names[controller->ucType]; in radeon_atombios_add_pplib_thermal_controller()
2364 info.addr = controller->ucI2cAddress >> 1; in radeon_atombios_add_pplib_thermal_controller()
2366 i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info); in radeon_atombios_add_pplib_thermal_controller()
2369 DRM_INFO("Unknown thermal controller type %d at 0x%02x %s fan control\n", in radeon_atombios_add_pplib_thermal_controller()
2370 controller->ucType, in radeon_atombios_add_pplib_thermal_controller()
2371 controller->ucI2cAddress >> 1, in radeon_atombios_add_pplib_thermal_controller()
2372 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2381 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_default_voltages()
2391 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_default_voltages()
2394 (union firmware_info *)(mode_info->atom_context->bios + in radeon_atombios_get_default_voltages()
2396 *vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); in radeon_atombios_get_default_voltages()
2398 *vddci = le16_to_cpu(firmware_info->info_22.usBootUpVDDCIVoltage); in radeon_atombios_get_default_voltages()
2399 *mvdd = le16_to_cpu(firmware_info->info_22.usBootUpMVDDCVoltage); in radeon_atombios_get_default_voltages()
2409 u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); in radeon_atombios_parse_pplib_non_clock_info()
2410 u32 misc2 = le16_to_cpu(non_clock_info->usClassification); in radeon_atombios_parse_pplib_non_clock_info()
2415 rdev->pm.power_state[state_index].misc = misc; in radeon_atombios_parse_pplib_non_clock_info()
2416 rdev->pm.power_state[state_index].misc2 = misc2; in radeon_atombios_parse_pplib_non_clock_info()
2417 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_pplib_non_clock_info()
2422 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2426 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2430 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2435 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2439 rdev->pm.power_state[state_index].flags = 0; in radeon_atombios_parse_pplib_non_clock_info()
2441 rdev->pm.power_state[state_index].flags |= in radeon_atombios_parse_pplib_non_clock_info()
2444 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2446 rdev->pm.default_power_state_index = state_index; in radeon_atombios_parse_pplib_non_clock_info()
2447 rdev->pm.power_state[state_index].default_clock_mode = in radeon_atombios_parse_pplib_non_clock_info()
2448 &rdev->pm.power_state[state_index].clock_info[mode_index - 1]; in radeon_atombios_parse_pplib_non_clock_info()
2449 if ((rdev->family >= CHIP_BARTS) && !(rdev->flags & RADEON_IS_IGP)) { in radeon_atombios_parse_pplib_non_clock_info()
2451 rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; in radeon_atombios_parse_pplib_non_clock_info()
2452 rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; in radeon_atombios_parse_pplib_non_clock_info()
2453 rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; in radeon_atombios_parse_pplib_non_clock_info()
2454 rdev->pm.default_vddci = rdev->pm.power_state[state_index].clock_info[0].voltage.vddci; in radeon_atombios_parse_pplib_non_clock_info()
2464 rdev->pm.power_state[state_index].clock_info[j].mclk = in radeon_atombios_parse_pplib_non_clock_info()
2465 rdev->clock.default_mclk; in radeon_atombios_parse_pplib_non_clock_info()
2466 rdev->pm.power_state[state_index].clock_info[j].sclk = in radeon_atombios_parse_pplib_non_clock_info()
2467 rdev->clock.default_sclk; in radeon_atombios_parse_pplib_non_clock_info()
2469 rdev->pm.power_state[state_index].clock_info[j].voltage.voltage = in radeon_atombios_parse_pplib_non_clock_info()
2472 rdev->pm.power_state[state_index].clock_info[j].voltage.vddci = in radeon_atombios_parse_pplib_non_clock_info()
2486 if (rdev->flags & RADEON_IS_IGP) { in radeon_atombios_parse_pplib_clock_info()
2487 if (rdev->family >= CHIP_PALM) { in radeon_atombios_parse_pplib_clock_info()
2488 sclk = le16_to_cpu(clock_info->sumo.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2489 sclk |= clock_info->sumo.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2490 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2492 sclk = le16_to_cpu(clock_info->rs780.usLowEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2493 sclk |= clock_info->rs780.ucLowEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2494 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2496 } else if (rdev->family >= CHIP_BONAIRE) { in radeon_atombios_parse_pplib_clock_info()
2497 sclk = le16_to_cpu(clock_info->ci.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2498 sclk |= clock_info->ci.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2499 mclk = le16_to_cpu(clock_info->ci.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2500 mclk |= clock_info->ci.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2501 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2502 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2503 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2505 } else if (rdev->family >= CHIP_TAHITI) { in radeon_atombios_parse_pplib_clock_info()
2506 sclk = le16_to_cpu(clock_info->si.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2507 sclk |= clock_info->si.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2508 mclk = le16_to_cpu(clock_info->si.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2509 mclk |= clock_info->si.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2510 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2511 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2512 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2514 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = in radeon_atombios_parse_pplib_clock_info()
2515 le16_to_cpu(clock_info->si.usVDDC); in radeon_atombios_parse_pplib_clock_info()
2516 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci = in radeon_atombios_parse_pplib_clock_info()
2517 le16_to_cpu(clock_info->si.usVDDCI); in radeon_atombios_parse_pplib_clock_info()
2518 } else if (rdev->family >= CHIP_CEDAR) { in radeon_atombios_parse_pplib_clock_info()
2519 sclk = le16_to_cpu(clock_info->evergreen.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2520 sclk |= clock_info->evergreen.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2521 mclk = le16_to_cpu(clock_info->evergreen.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2522 mclk |= clock_info->evergreen.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2523 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2524 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2525 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2527 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = in radeon_atombios_parse_pplib_clock_info()
2528 le16_to_cpu(clock_info->evergreen.usVDDC); in radeon_atombios_parse_pplib_clock_info()
2529 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci = in radeon_atombios_parse_pplib_clock_info()
2530 le16_to_cpu(clock_info->evergreen.usVDDCI); in radeon_atombios_parse_pplib_clock_info()
2532 sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2533 sclk |= clock_info->r600.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2534 mclk = le16_to_cpu(clock_info->r600.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2535 mclk |= clock_info->r600.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2536 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2537 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2538 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2540 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = in radeon_atombios_parse_pplib_clock_info()
2541 le16_to_cpu(clock_info->r600.usVDDC); in radeon_atombios_parse_pplib_clock_info()
2545 switch (rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage) { in radeon_atombios_parse_pplib_clock_info()
2555 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage, in radeon_atombios_parse_pplib_clock_info()
2557 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = vddc; in radeon_atombios_parse_pplib_clock_info()
2563 if (rdev->flags & RADEON_IS_IGP) { in radeon_atombios_parse_pplib_clock_info()
2565 if (rdev->pm.power_state[state_index].clock_info[mode_index].sclk == 0) in radeon_atombios_parse_pplib_clock_info()
2569 if ((rdev->pm.power_state[state_index].clock_info[mode_index].mclk == 0) || in radeon_atombios_parse_pplib_clock_info()
2570 (rdev->pm.power_state[state_index].clock_info[mode_index].sclk == 0)) in radeon_atombios_parse_pplib_clock_info()
2578 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_parse_power_table_4_5()
2590 if (!atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_parse_power_table_4_5()
2593 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_parse_power_table_4_5()
2595 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); in radeon_atombios_parse_power_table_4_5()
2596 if (power_info->pplib.ucNumStates == 0) in radeon_atombios_parse_power_table_4_5()
2598 rdev->pm.power_state = kcalloc(power_info->pplib.ucNumStates, in radeon_atombios_parse_power_table_4_5()
2601 if (!rdev->pm.power_state) in radeon_atombios_parse_power_table_4_5()
2604 for (i = 0; i < power_info->pplib.ucNumStates; i++) { in radeon_atombios_parse_power_table_4_5()
2607 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_4_5()
2608 le16_to_cpu(power_info->pplib.usStateArrayOffset) + in radeon_atombios_parse_power_table_4_5()
2609 i * power_info->pplib.ucStateEntrySize); in radeon_atombios_parse_power_table_4_5()
2611 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_4_5()
2612 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) + in radeon_atombios_parse_power_table_4_5()
2613 (power_state->v1.ucNonClockStateIndex * in radeon_atombios_parse_power_table_4_5()
2614 power_info->pplib.ucNonClockSize)); in radeon_atombios_parse_power_table_4_5()
2615 rdev->pm.power_state[i].clock_info = in radeon_atombios_parse_power_table_4_5()
2616 kcalloc((power_info->pplib.ucStateEntrySize - 1) ? in radeon_atombios_parse_power_table_4_5()
2617 (power_info->pplib.ucStateEntrySize - 1) : 1, in radeon_atombios_parse_power_table_4_5()
2620 if (!rdev->pm.power_state[i].clock_info) in radeon_atombios_parse_power_table_4_5()
2622 if (power_info->pplib.ucStateEntrySize - 1) { in radeon_atombios_parse_power_table_4_5()
2623 for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) { in radeon_atombios_parse_power_table_4_5()
2625 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_4_5()
2626 le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) + in radeon_atombios_parse_power_table_4_5()
2627 (power_state->v1.ucClockStateIndices[j] * in radeon_atombios_parse_power_table_4_5()
2628 power_info->pplib.ucClockInfoSize)); in radeon_atombios_parse_power_table_4_5()
2636 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_4_5()
2637 rdev->clock.default_mclk; in radeon_atombios_parse_power_table_4_5()
2638 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_4_5()
2639 rdev->clock.default_sclk; in radeon_atombios_parse_power_table_4_5()
2642 rdev->pm.power_state[state_index].num_clock_modes = mode_index; in radeon_atombios_parse_power_table_4_5()
2651 if (rdev->pm.power_state[i].num_clock_modes > 1) in radeon_atombios_parse_power_table_4_5()
2652 rdev->pm.power_state[i].clock_info[0].flags |= in radeon_atombios_parse_power_table_4_5()
2656 if (rdev->pm.default_power_state_index == -1) { in radeon_atombios_parse_power_table_4_5()
2657 rdev->pm.power_state[0].type = in radeon_atombios_parse_power_table_4_5()
2659 rdev->pm.default_power_state_index = 0; in radeon_atombios_parse_power_table_4_5()
2660 rdev->pm.power_state[0].default_clock_mode = in radeon_atombios_parse_power_table_4_5()
2661 &rdev->pm.power_state[0].clock_info[0]; in radeon_atombios_parse_power_table_4_5()
2668 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_parse_power_table_6()
2684 if (!atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_parse_power_table_6()
2687 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_parse_power_table_6()
2689 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); in radeon_atombios_parse_power_table_6()
2691 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_6()
2692 le16_to_cpu(power_info->pplib.usStateArrayOffset)); in radeon_atombios_parse_power_table_6()
2694 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_6()
2695 le16_to_cpu(power_info->pplib.usClockInfoArrayOffset)); in radeon_atombios_parse_power_table_6()
2697 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_6()
2698 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); in radeon_atombios_parse_power_table_6()
2699 if (state_array->ucNumEntries == 0) in radeon_atombios_parse_power_table_6()
2701 rdev->pm.power_state = kcalloc(state_array->ucNumEntries, in radeon_atombios_parse_power_table_6()
2704 if (!rdev->pm.power_state) in radeon_atombios_parse_power_table_6()
2706 power_state_offset = (u8 *)state_array->states; in radeon_atombios_parse_power_table_6()
2707 for (i = 0; i < state_array->ucNumEntries; i++) { in radeon_atombios_parse_power_table_6()
2710 non_clock_array_index = power_state->v2.nonClockInfoIndex; in radeon_atombios_parse_power_table_6()
2712 &non_clock_info_array->nonClockInfo[non_clock_array_index]; in radeon_atombios_parse_power_table_6()
2713 rdev->pm.power_state[i].clock_info = in radeon_atombios_parse_power_table_6()
2714 kcalloc(power_state->v2.ucNumDPMLevels ? in radeon_atombios_parse_power_table_6()
2715 power_state->v2.ucNumDPMLevels : 1, in radeon_atombios_parse_power_table_6()
2718 if (!rdev->pm.power_state[i].clock_info) in radeon_atombios_parse_power_table_6()
2720 if (power_state->v2.ucNumDPMLevels) { in radeon_atombios_parse_power_table_6()
2721 for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { in radeon_atombios_parse_power_table_6()
2722 clock_array_index = power_state->v2.clockInfoIndex[j]; in radeon_atombios_parse_power_table_6()
2724 &clock_info_array->clockInfo[clock_array_index * clock_info_array->ucEntrySize]; in radeon_atombios_parse_power_table_6()
2732 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_6()
2733 rdev->clock.default_mclk; in radeon_atombios_parse_power_table_6()
2734 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_6()
2735 rdev->clock.default_sclk; in radeon_atombios_parse_power_table_6()
2738 rdev->pm.power_state[state_index].num_clock_modes = mode_index; in radeon_atombios_parse_power_table_6()
2744 power_state_offset += 2 + power_state->v2.ucNumDPMLevels; in radeon_atombios_parse_power_table_6()
2748 if (rdev->pm.power_state[i].num_clock_modes > 1) in radeon_atombios_parse_power_table_6()
2749 rdev->pm.power_state[i].clock_info[0].flags |= in radeon_atombios_parse_power_table_6()
2753 if (rdev->pm.default_power_state_index == -1) { in radeon_atombios_parse_power_table_6()
2754 rdev->pm.power_state[0].type = in radeon_atombios_parse_power_table_6()
2756 rdev->pm.default_power_state_index = 0; in radeon_atombios_parse_power_table_6()
2757 rdev->pm.power_state[0].default_clock_mode = in radeon_atombios_parse_power_table_6()
2758 &rdev->pm.power_state[0].clock_info[0]; in radeon_atombios_parse_power_table_6()
2765 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_power_modes()
2771 rdev->pm.default_power_state_index = -1; in radeon_atombios_get_power_modes()
2773 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_power_modes()
2794 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); in radeon_atombios_get_power_modes()
2795 if (rdev->pm.power_state) { in radeon_atombios_get_power_modes()
2796 rdev->pm.power_state[0].clock_info = in radeon_atombios_get_power_modes()
2800 if (rdev->pm.power_state[0].clock_info) { in radeon_atombios_get_power_modes()
2802 rdev->pm.power_state[state_index].type = in radeon_atombios_get_power_modes()
2804 rdev->pm.power_state[state_index].num_clock_modes = 1; in radeon_atombios_get_power_modes()
2805 rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; in radeon_atombios_get_power_modes()
2806 rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; in radeon_atombios_get_power_modes()
2807 rdev->pm.power_state[state_index].default_clock_mode = in radeon_atombios_get_power_modes()
2808 &rdev->pm.power_state[state_index].clock_info[0]; in radeon_atombios_get_power_modes()
2809 rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; in radeon_atombios_get_power_modes()
2810 rdev->pm.power_state[state_index].pcie_lanes = 16; in radeon_atombios_get_power_modes()
2811 rdev->pm.default_power_state_index = state_index; in radeon_atombios_get_power_modes()
2812 rdev->pm.power_state[state_index].flags = 0; in radeon_atombios_get_power_modes()
2818 rdev->pm.num_power_states = state_index; in radeon_atombios_get_power_modes()
2820 rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; in radeon_atombios_get_power_modes()
2821 rdev->pm.current_clock_mode_index = 0; in radeon_atombios_get_power_modes()
2822 if (rdev->pm.default_power_state_index >= 0) in radeon_atombios_get_power_modes()
2823 rdev->pm.current_vddc = in radeon_atombios_get_power_modes()
2824 rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; in radeon_atombios_get_power_modes()
2826 rdev->pm.current_vddc = 0; in radeon_atombios_get_power_modes()
2852 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_clock_dividers()
2853 return -EINVAL; in radeon_atom_get_clock_dividers()
2861 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_clock_dividers()
2863 dividers->post_div = args.v1.ucPostDiv; in radeon_atom_get_clock_dividers()
2864 dividers->fb_div = args.v1.ucFbDiv; in radeon_atom_get_clock_dividers()
2865 dividers->enable_post_div = true; in radeon_atom_get_clock_dividers()
2871 if (rdev->family <= CHIP_RV770) { in radeon_atom_get_clock_dividers()
2875 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_clock_dividers()
2877 dividers->post_div = args.v2.ucPostDiv; in radeon_atom_get_clock_dividers()
2878 dividers->fb_div = le16_to_cpu(args.v2.usFbDiv); in radeon_atom_get_clock_dividers()
2879 dividers->ref_div = args.v2.ucAction; in radeon_atom_get_clock_dividers()
2880 if (rdev->family == CHIP_RV770) { in radeon_atom_get_clock_dividers()
2881 dividers->enable_post_div = (le32_to_cpu(args.v2.ulClock) & (1 << 24)) ? in radeon_atom_get_clock_dividers()
2883 dividers->vco_mode = (le32_to_cpu(args.v2.ulClock) & (1 << 25)) ? 1 : 0; in radeon_atom_get_clock_dividers()
2885 dividers->enable_post_div = (dividers->fb_div & 1) ? true : false; in radeon_atom_get_clock_dividers()
2890 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_clock_dividers()
2892 dividers->post_div = args.v3.ucPostDiv; in radeon_atom_get_clock_dividers()
2893 dividers->enable_post_div = (args.v3.ucCntlFlag & in radeon_atom_get_clock_dividers()
2895 dividers->enable_dithen = (args.v3.ucCntlFlag & in radeon_atom_get_clock_dividers()
2897 dividers->whole_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); in radeon_atom_get_clock_dividers()
2898 dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); in radeon_atom_get_clock_dividers()
2899 dividers->ref_div = args.v3.ucRefDiv; in radeon_atom_get_clock_dividers()
2900 dividers->vco_mode = (args.v3.ucCntlFlag & in radeon_atom_get_clock_dividers()
2904 if (rdev->family >= CHIP_TAHITI) in radeon_atom_get_clock_dividers()
2905 return -EINVAL; in radeon_atom_get_clock_dividers()
2910 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_clock_dividers()
2912 dividers->post_div = args.v5.ucPostDiv; in radeon_atom_get_clock_dividers()
2913 dividers->enable_post_div = (args.v5.ucCntlFlag & in radeon_atom_get_clock_dividers()
2915 dividers->enable_dithen = (args.v5.ucCntlFlag & in radeon_atom_get_clock_dividers()
2917 dividers->whole_fb_div = le16_to_cpu(args.v5.ulFbDiv.usFbDiv); in radeon_atom_get_clock_dividers()
2918 dividers->frac_fb_div = le16_to_cpu(args.v5.ulFbDiv.usFbDivFrac); in radeon_atom_get_clock_dividers()
2919 dividers->ref_div = args.v5.ucRefDiv; in radeon_atom_get_clock_dividers()
2920 dividers->vco_mode = (args.v5.ucCntlFlag & in radeon_atom_get_clock_dividers()
2929 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_clock_dividers()
2931 dividers->post_divider = dividers->post_div = args.v4.ucPostDiv; in radeon_atom_get_clock_dividers()
2932 dividers->real_clock = le32_to_cpu(args.v4.ulClock); in radeon_atom_get_clock_dividers()
2940 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_clock_dividers()
2942 dividers->whole_fb_div = le16_to_cpu(args.v6_out.ulFbDiv.usFbDiv); in radeon_atom_get_clock_dividers()
2943 dividers->frac_fb_div = le16_to_cpu(args.v6_out.ulFbDiv.usFbDivFrac); in radeon_atom_get_clock_dividers()
2944 dividers->ref_div = args.v6_out.ucPllRefDiv; in radeon_atom_get_clock_dividers()
2945 dividers->post_div = args.v6_out.ucPllPostDiv; in radeon_atom_get_clock_dividers()
2946 dividers->flags = args.v6_out.ucPllCntlFlag; in radeon_atom_get_clock_dividers()
2947 dividers->real_clock = le32_to_cpu(args.v6_out.ulClock.ulClock); in radeon_atom_get_clock_dividers()
2948 dividers->post_divider = args.v6_out.ulClock.ucPostDiv; in radeon_atom_get_clock_dividers()
2951 return -EINVAL; in radeon_atom_get_clock_dividers()
2968 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_memory_pll_dividers()
2969 return -EINVAL; in radeon_atom_get_memory_pll_dividers()
2981 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_memory_pll_dividers()
2983 mpll_param->clkfrac = le16_to_cpu(args.ulFbDiv.usFbDivFrac); in radeon_atom_get_memory_pll_dividers()
2984 mpll_param->clkf = le16_to_cpu(args.ulFbDiv.usFbDiv); in radeon_atom_get_memory_pll_dividers()
2985 mpll_param->post_div = args.ucPostDiv; in radeon_atom_get_memory_pll_dividers()
2986 mpll_param->dll_speed = args.ucDllSpeed; in radeon_atom_get_memory_pll_dividers()
2987 mpll_param->bwcntl = args.ucBWCntl; in radeon_atom_get_memory_pll_dividers()
2988 mpll_param->vco_mode = in radeon_atom_get_memory_pll_dividers()
2990 mpll_param->yclk_sel = in radeon_atom_get_memory_pll_dividers()
2992 mpll_param->qdr = in radeon_atom_get_memory_pll_dividers()
2994 mpll_param->half_rate = in radeon_atom_get_memory_pll_dividers()
2998 return -EINVAL; in radeon_atom_get_memory_pll_dividers()
3002 return -EINVAL; in radeon_atom_get_memory_pll_dividers()
3014 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_set_clock_gating()
3022 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_engine_clock()
3031 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_memory_clock()
3043 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_set_engine_clock()
3052 if (rdev->flags & RADEON_IS_IGP) in radeon_atom_set_memory_clock()
3057 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_set_memory_clock()
3076 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_set_engine_dram_timings()
3087 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_update_memory_dll()
3099 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_set_ac_timing()
3115 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_set_voltage()
3139 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_set_voltage()
3143 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_set_voltage()
3153 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_max_vddc()
3154 return -EINVAL; in radeon_atom_get_max_vddc()
3158 return -EINVAL; in radeon_atom_get_max_vddc()
3164 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_max_vddc()
3173 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_max_vddc()
3178 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_max_vddc()
3179 return -EINVAL; in radeon_atom_get_max_vddc()
3199 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_leakage_id_from_vbios()
3200 return -EINVAL; in radeon_atom_get_leakage_id_from_vbios()
3209 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_leakage_id_from_vbios()
3214 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_leakage_id_from_vbios()
3215 return -EINVAL; in radeon_atom_get_leakage_id_from_vbios()
3236 if (!atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3238 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3241 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3245 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3250 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3252 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3253 le16_to_cpu(profile->usLeakageBinArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3255 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3256 le16_to_cpu(profile->usElbVDDC_IdArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3258 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3259 le16_to_cpu(profile->usElbVDDC_LevelArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3261 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3262 le16_to_cpu(profile->usElbVDDCI_IdArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3264 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3265 le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3267 if (profile->ucElbVDDC_Num > 0) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3268 for (i = 0; i < profile->ucElbVDDC_Num; i++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3270 for (j = 0; j < profile->ucLeakageBinNum; j++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3272 *vddc = vddc_buf[j * profile->ucElbVDDC_Num + i]; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3280 if (profile->ucElbVDDCI_Num > 0) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3281 for (i = 0; i < profile->ucElbVDDCI_Num; i++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3283 for (j = 0; j < profile->ucLeakageBinNum; j++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3285 *vddci = vddci_buf[j * profile->ucElbVDDCI_Num + i]; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3295 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3296 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3300 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3301 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3318 u32 count = rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count; in radeon_atom_get_voltage_evv()
3322 if (rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].v == in radeon_atom_get_voltage_evv()
3328 return -EINVAL; in radeon_atom_get_voltage_evv()
3334 cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk); in radeon_atom_get_voltage_evv()
3336 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_voltage_evv()
3351 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_voltage_gpio_settings()
3352 return -EINVAL; in radeon_atom_get_voltage_gpio_settings()
3356 return -EINVAL; in radeon_atom_get_voltage_gpio_settings()
3362 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_voltage_gpio_settings()
3370 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); in radeon_atom_get_voltage_gpio_settings()
3375 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_voltage_gpio_settings()
3376 return -EINVAL; in radeon_atom_get_voltage_gpio_settings()
3397 u32 size = le16_to_cpu(v1->sHeader.usStructureSize); in atom_lookup_voltage_object_v1()
3403 if (vo->ucVoltageType == voltage_type) in atom_lookup_voltage_object_v1()
3406 vo->asFormula.ucNumOfVoltageEntries; in atom_lookup_voltage_object_v1()
3414 u32 size = le16_to_cpu(v2->sHeader.usStructureSize); in atom_lookup_voltage_object_v2()
3420 if (vo->ucVoltageType == voltage_type) in atom_lookup_voltage_object_v2()
3423 (vo->asFormula.ucNumOfVoltageEntries * sizeof(VOLTAGE_LUT_ENTRY)); in atom_lookup_voltage_object_v2()
3431 u32 size = le16_to_cpu(v3->sHeader.usStructureSize); in atom_lookup_voltage_object_v3()
3437 if ((vo->asGpioVoltageObj.sHeader.ucVoltageType == voltage_type) && in atom_lookup_voltage_object_v3()
3438 (vo->asGpioVoltageObj.sHeader.ucVoltageMode == voltage_mode)) in atom_lookup_voltage_object_v3()
3440 offset += le16_to_cpu(vo->asGpioVoltageObj.sHeader.usSize); in atom_lookup_voltage_object_v3()
3455 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_is_voltage_gpio()
3458 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_is_voltage_gpio()
3466 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_is_voltage_gpio()
3468 (voltage_object->v1.asControl.ucVoltageControlId == VOLTAGE_CONTROLLED_BY_GPIO)) in radeon_atom_is_voltage_gpio()
3473 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_is_voltage_gpio()
3475 (voltage_object->v2.asControl.ucVoltageControlId == VOLTAGE_CONTROLLED_BY_GPIO)) in radeon_atom_is_voltage_gpio()
3486 if (atom_lookup_voltage_object_v3(&voltage_info->v3, in radeon_atom_is_voltage_gpio()
3514 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_svi2_info()
3517 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_svi2_info()
3524 atom_lookup_voltage_object_v3(&voltage_info->v3, in radeon_atom_get_svi2_info()
3528 *svd_gpio_id = voltage_object->v3.asSVID2Obj.ucSVDGpioId; in radeon_atom_get_svi2_info()
3529 *svc_gpio_id = voltage_object->v3.asSVID2Obj.ucSVCGpioId; in radeon_atom_get_svi2_info()
3531 return -EINVAL; in radeon_atom_get_svi2_info()
3536 return -EINVAL; in radeon_atom_get_svi2_info()
3541 return -EINVAL; in radeon_atom_get_svi2_info()
3557 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_max_voltage()
3560 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_max_voltage()
3565 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_get_max_voltage()
3568 &voltage_object->v1.asFormula; in radeon_atom_get_max_voltage()
3569 if (formula->ucFlag & 1) in radeon_atom_get_max_voltage()
3571 le16_to_cpu(formula->usVoltageBaseLevel) + in radeon_atom_get_max_voltage()
3572 formula->ucNumOfVoltageEntries / 2 * in radeon_atom_get_max_voltage()
3573 le16_to_cpu(formula->usVoltageStep); in radeon_atom_get_max_voltage()
3576 le16_to_cpu(formula->usVoltageBaseLevel) + in radeon_atom_get_max_voltage()
3577 (formula->ucNumOfVoltageEntries - 1) * in radeon_atom_get_max_voltage()
3578 le16_to_cpu(formula->usVoltageStep); in radeon_atom_get_max_voltage()
3584 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_get_max_voltage()
3587 &voltage_object->v2.asFormula; in radeon_atom_get_max_voltage()
3588 if (formula->ucNumOfVoltageEntries) { in radeon_atom_get_max_voltage()
3590 ((u8 *)&formula->asVIDAdjustEntries[0] + in radeon_atom_get_max_voltage()
3591 (sizeof(VOLTAGE_LUT_ENTRY) * (formula->ucNumOfVoltageEntries - 1))); in radeon_atom_get_max_voltage()
3593 le16_to_cpu(lut->usVoltageValue); in radeon_atom_get_max_voltage()
3600 return -EINVAL; in radeon_atom_get_max_voltage()
3604 return -EINVAL; in radeon_atom_get_max_voltage()
3616 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_min_voltage()
3619 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_min_voltage()
3624 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_get_min_voltage()
3627 &voltage_object->v1.asFormula; in radeon_atom_get_min_voltage()
3629 le16_to_cpu(formula->usVoltageBaseLevel); in radeon_atom_get_min_voltage()
3635 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_get_min_voltage()
3638 &voltage_object->v2.asFormula; in radeon_atom_get_min_voltage()
3639 if (formula->ucNumOfVoltageEntries) { in radeon_atom_get_min_voltage()
3641 le16_to_cpu(formula->asVIDAdjustEntries[ in radeon_atom_get_min_voltage()
3650 return -EINVAL; in radeon_atom_get_min_voltage()
3654 return -EINVAL; in radeon_atom_get_min_voltage()
3666 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_voltage_step()
3669 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_voltage_step()
3674 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_get_voltage_step()
3677 &voltage_object->v1.asFormula; in radeon_atom_get_voltage_step()
3678 if (formula->ucFlag & 1) in radeon_atom_get_voltage_step()
3680 (le16_to_cpu(formula->usVoltageStep) + 1) / 2; in radeon_atom_get_voltage_step()
3683 le16_to_cpu(formula->usVoltageStep); in radeon_atom_get_voltage_step()
3688 return -EINVAL; in radeon_atom_get_voltage_step()
3691 return -EINVAL; in radeon_atom_get_voltage_step()
3695 return -EINVAL; in radeon_atom_get_voltage_step()
3706 return -EINVAL; in radeon_atom_round_to_true_voltage()
3708 return -EINVAL; in radeon_atom_round_to_true_voltage()
3710 return -EINVAL; in radeon_atom_round_to_true_voltage()
3718 ((nominal_voltage - min_voltage) / voltage_step) * in radeon_atom_round_to_true_voltage()
3735 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_voltage_table()
3738 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_voltage_table()
3745 DRM_ERROR("old table version %d, %d\n", frev, crev); in radeon_atom_get_voltage_table()
3746 return -EINVAL; in radeon_atom_get_voltage_table()
3749 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_get_voltage_table()
3752 &voltage_object->v2.asFormula; in radeon_atom_get_voltage_table()
3754 if (formula->ucNumOfVoltageEntries > MAX_VOLTAGE_ENTRIES) in radeon_atom_get_voltage_table()
3755 return -EINVAL; in radeon_atom_get_voltage_table()
3756 lut = &formula->asVIDAdjustEntries[0]; in radeon_atom_get_voltage_table()
3757 for (i = 0; i < formula->ucNumOfVoltageEntries; i++) { in radeon_atom_get_voltage_table()
3758 voltage_table->entries[i].value = in radeon_atom_get_voltage_table()
3759 le16_to_cpu(lut->usVoltageValue); in radeon_atom_get_voltage_table()
3761 voltage_table->entries[i].value, in radeon_atom_get_voltage_table()
3763 &voltage_table->entries[i].smio_low, in radeon_atom_get_voltage_table()
3764 &voltage_table->mask_low); in radeon_atom_get_voltage_table()
3770 voltage_table->count = formula->ucNumOfVoltageEntries; in radeon_atom_get_voltage_table()
3776 return -EINVAL; in radeon_atom_get_voltage_table()
3783 atom_lookup_voltage_object_v3(&voltage_info->v3, in radeon_atom_get_voltage_table()
3787 &voltage_object->v3.asGpioVoltageObj; in radeon_atom_get_voltage_table()
3789 if (gpio->ucGpioEntryNum > MAX_VOLTAGE_ENTRIES) in radeon_atom_get_voltage_table()
3790 return -EINVAL; in radeon_atom_get_voltage_table()
3791 lut = &gpio->asVolGpioLut[0]; in radeon_atom_get_voltage_table()
3792 for (i = 0; i < gpio->ucGpioEntryNum; i++) { in radeon_atom_get_voltage_table()
3793 voltage_table->entries[i].value = in radeon_atom_get_voltage_table()
3794 le16_to_cpu(lut->usVoltageValue); in radeon_atom_get_voltage_table()
3795 voltage_table->entries[i].smio_low = in radeon_atom_get_voltage_table()
3796 le32_to_cpu(lut->ulVoltageId); in radeon_atom_get_voltage_table()
3800 voltage_table->mask_low = le32_to_cpu(gpio->ulGpioMaskVal); in radeon_atom_get_voltage_table()
3801 voltage_table->count = gpio->ucGpioEntryNum; in radeon_atom_get_voltage_table()
3802 voltage_table->phase_delay = gpio->ucPhaseDelay; in radeon_atom_get_voltage_table()
3808 return -EINVAL; in radeon_atom_get_voltage_table()
3813 return -EINVAL; in radeon_atom_get_voltage_table()
3816 return -EINVAL; in radeon_atom_get_voltage_table()
3835 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_memory_info()
3838 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_memory_info()
3844 if (module_index < vram_info->v1_3.ucNumOfVRAMModule) { in radeon_atom_get_memory_info()
3846 (ATOM_VRAM_MODULE_V3 *)vram_info->v1_3.aVramInfo; in radeon_atom_get_memory_info()
3849 if (le16_to_cpu(vram_module->usSize) == 0) in radeon_atom_get_memory_info()
3850 return -EINVAL; in radeon_atom_get_memory_info()
3852 ((u8 *)vram_module + le16_to_cpu(vram_module->usSize)); in radeon_atom_get_memory_info()
3854 mem_info->mem_vendor = vram_module->asMemory.ucMemoryVenderID & 0xf; in radeon_atom_get_memory_info()
3855 mem_info->mem_type = vram_module->asMemory.ucMemoryType & 0xf0; in radeon_atom_get_memory_info()
3857 return -EINVAL; in radeon_atom_get_memory_info()
3861 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) { in radeon_atom_get_memory_info()
3863 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo; in radeon_atom_get_memory_info()
3866 if (le16_to_cpu(vram_module->usModuleSize) == 0) in radeon_atom_get_memory_info()
3867 return -EINVAL; in radeon_atom_get_memory_info()
3869 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize)); in radeon_atom_get_memory_info()
3871 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf; in radeon_atom_get_memory_info()
3872 mem_info->mem_type = vram_module->ucMemoryType & 0xf0; in radeon_atom_get_memory_info()
3874 return -EINVAL; in radeon_atom_get_memory_info()
3877 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_memory_info()
3878 return -EINVAL; in radeon_atom_get_memory_info()
3885 if (module_index < vram_info->v2_1.ucNumOfVRAMModule) { in radeon_atom_get_memory_info()
3887 (ATOM_VRAM_MODULE_V7 *)vram_info->v2_1.aVramInfo; in radeon_atom_get_memory_info()
3890 if (le16_to_cpu(vram_module->usModuleSize) == 0) in radeon_atom_get_memory_info()
3891 return -EINVAL; in radeon_atom_get_memory_info()
3893 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize)); in radeon_atom_get_memory_info()
3895 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf; in radeon_atom_get_memory_info()
3896 mem_info->mem_type = vram_module->ucMemoryType & 0xf0; in radeon_atom_get_memory_info()
3898 return -EINVAL; in radeon_atom_get_memory_info()
3901 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_memory_info()
3902 return -EINVAL; in radeon_atom_get_memory_info()
3906 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_memory_info()
3907 return -EINVAL; in radeon_atom_get_memory_info()
3911 return -EINVAL; in radeon_atom_get_memory_info()
3927 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_mclk_range_table()
3930 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_mclk_range_table()
3935 DRM_ERROR("old table version %d, %d\n", frev, crev); in radeon_atom_get_mclk_range_table()
3936 return -EINVAL; in radeon_atom_get_mclk_range_table()
3939 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) { in radeon_atom_get_mclk_range_table()
3941 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo; in radeon_atom_get_mclk_range_table()
3945 if (le16_to_cpu(vram_module->usModuleSize) == 0) in radeon_atom_get_mclk_range_table()
3946 return -EINVAL; in radeon_atom_get_mclk_range_table()
3948 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize)); in radeon_atom_get_mclk_range_table()
3950 mclk_range_table->num_entries = (u8) in radeon_atom_get_mclk_range_table()
3951 ((le16_to_cpu(vram_module->usModuleSize) - offsetof(ATOM_VRAM_MODULE_V4, asMemTiming)) / in radeon_atom_get_mclk_range_table()
3953 format = &vram_module->asMemTiming[0]; in radeon_atom_get_mclk_range_table()
3954 for (i = 0; i < mclk_range_table->num_entries; i++) { in radeon_atom_get_mclk_range_table()
3955 mclk_range_table->mclk[i] = le32_to_cpu(format->ulClkRange); in radeon_atom_get_mclk_range_table()
3960 return -EINVAL; in radeon_atom_get_mclk_range_table()
3963 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_mclk_range_table()
3964 return -EINVAL; in radeon_atom_get_mclk_range_table()
3968 DRM_ERROR("new table version %d, %d\n", frev, crev); in radeon_atom_get_mclk_range_table()
3969 return -EINVAL; in radeon_atom_get_mclk_range_table()
3971 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_get_mclk_range_table()
3972 return -EINVAL; in radeon_atom_get_mclk_range_table()
3976 return -EINVAL; in radeon_atom_get_mclk_range_table()
3999 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_init_mc_reg_table()
4002 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_init_mc_reg_table()
4005 DRM_ERROR("old table version %d, %d\n", frev, crev); in radeon_atom_init_mc_reg_table()
4006 return -EINVAL; in radeon_atom_init_mc_reg_table()
4010 if (module_index < vram_info->v2_1.ucNumOfVRAMModule) { in radeon_atom_init_mc_reg_table()
4013 ((u8 *)vram_info + le16_to_cpu(vram_info->v2_1.usMemClkPatchTblOffset)); in radeon_atom_init_mc_reg_table()
4017 le16_to_cpu(reg_block->usRegIndexTblSize)); in radeon_atom_init_mc_reg_table()
4018 ATOM_INIT_REG_INDEX_FORMAT *format = ®_block->asRegIndexBuf[0]; in radeon_atom_init_mc_reg_table()
4019 num_entries = (u8)((le16_to_cpu(reg_block->usRegIndexTblSize)) / in radeon_atom_init_mc_reg_table()
4020 sizeof(ATOM_INIT_REG_INDEX_FORMAT)) - 1; in radeon_atom_init_mc_reg_table()
4022 return -EINVAL; in radeon_atom_init_mc_reg_table()
4024 if (format->ucPreRegDataLength & ACCESS_PLACEHOLDER) in radeon_atom_init_mc_reg_table()
4026 reg_table->mc_reg_address[i].s1 = in radeon_atom_init_mc_reg_table()
4027 (u16)(le16_to_cpu(format->usRegIndex)); in radeon_atom_init_mc_reg_table()
4028 reg_table->mc_reg_address[i].pre_reg_data = in radeon_atom_init_mc_reg_table()
4029 (u8)(format->ucPreRegDataLength); in radeon_atom_init_mc_reg_table()
4034 reg_table->last = i; in radeon_atom_init_mc_reg_table()
4040 reg_table->mc_reg_table_entry[num_ranges].mclk_max = in radeon_atom_init_mc_reg_table()
4043 for (i = 0, j = 1; i < reg_table->last; i++) { in radeon_atom_init_mc_reg_table()
4044 if ((reg_table->mc_reg_address[i].pre_reg_data & LOW_NIBBLE_MASK) == DATA_FROM_TABLE) { in radeon_atom_init_mc_reg_table()
4045 reg_table->mc_reg_table_entry[num_ranges].mc_data[i] = in radeon_atom_init_mc_reg_table()
4048 } else if ((reg_table->mc_reg_address[i].pre_reg_data & LOW_NIBBLE_MASK) == DATA_EQU_PREV) { in radeon_atom_init_mc_reg_table()
4049 reg_table->mc_reg_table_entry[num_ranges].mc_data[i] = in radeon_atom_init_mc_reg_table()
4050 reg_table->mc_reg_table_entry[num_ranges].mc_data[i - 1]; in radeon_atom_init_mc_reg_table()
4056 ((u8 *)reg_data + le16_to_cpu(reg_block->usRegDataBlkSize)); in radeon_atom_init_mc_reg_table()
4059 return -EINVAL; in radeon_atom_init_mc_reg_table()
4060 reg_table->num_entries = num_ranges; in radeon_atom_init_mc_reg_table()
4062 return -EINVAL; in radeon_atom_init_mc_reg_table()
4065 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_init_mc_reg_table()
4066 return -EINVAL; in radeon_atom_init_mc_reg_table()
4070 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); in radeon_atom_init_mc_reg_table()
4071 return -EINVAL; in radeon_atom_init_mc_reg_table()
4075 return -EINVAL; in radeon_atom_init_mc_reg_table()
4080 struct radeon_device *rdev = dev->dev_private; in radeon_atom_initialize_bios_scratch_regs()
4083 if (rdev->family >= CHIP_R600) { in radeon_atom_initialize_bios_scratch_regs()
4101 if (rdev->family >= CHIP_R600) { in radeon_atom_initialize_bios_scratch_regs()
4116 if (rdev->family >= CHIP_R600) in radeon_save_bios_scratch_regs()
4122 rdev->bios_scratch[i] = RREG32(scratch_reg + (i * 4)); in radeon_save_bios_scratch_regs()
4130 if (rdev->family >= CHIP_R600) in radeon_restore_bios_scratch_regs()
4136 WREG32(scratch_reg + (i * 4), rdev->bios_scratch[i]); in radeon_restore_bios_scratch_regs()
4141 struct drm_device *dev = encoder->dev; in radeon_atom_output_lock()
4142 struct radeon_device *rdev = dev->dev_private; in radeon_atom_output_lock()
4145 if (rdev->family >= CHIP_R600) in radeon_atom_output_lock()
4158 if (rdev->family >= CHIP_R600) in radeon_atom_output_lock()
4170 struct drm_device *dev = connector->dev; in radeon_atombios_connected_scratch_regs()
4171 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_connected_scratch_regs()
4177 if (rdev->family >= CHIP_R600) { in radeon_atombios_connected_scratch_regs()
4187 if ((radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4188 (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4200 if ((radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4201 (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4213 if ((radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4214 (radeon_connector->devices & ATOM_DEVICE_LCD1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4227 if ((radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4228 (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4241 if ((radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4242 (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4255 if ((radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4256 (radeon_connector->devices & ATOM_DEVICE_DFP1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4269 if ((radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4270 (radeon_connector->devices & ATOM_DEVICE_DFP2_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4283 if ((radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4284 (radeon_connector->devices & ATOM_DEVICE_DFP3_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4297 if ((radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4298 (radeon_connector->devices & ATOM_DEVICE_DFP4_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4311 if ((radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4312 (radeon_connector->devices & ATOM_DEVICE_DFP5_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4325 if ((radeon_encoder->devices & ATOM_DEVICE_DFP6_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4326 (radeon_connector->devices & ATOM_DEVICE_DFP6_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4340 if (rdev->family >= CHIP_R600) { in radeon_atombios_connected_scratch_regs()
4354 struct drm_device *dev = encoder->dev; in radeon_atombios_encoder_crtc_scratch_regs()
4355 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_encoder_crtc_scratch_regs()
4362 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_crtc_scratch_regs()
4367 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4371 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4375 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4379 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4383 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4387 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4391 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4395 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4400 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_crtc_scratch_regs()
4409 struct drm_device *dev = encoder->dev; in radeon_atombios_encoder_dpms_scratch_regs()
4410 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_encoder_dpms_scratch_regs()
4417 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_dpms_scratch_regs()
4422 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4428 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4434 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4440 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4446 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4452 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4458 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4464 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4470 if (radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4476 if (radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4483 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_dpms_scratch_regs()