Lines Matching +full:clkf +full:- +full:- +full:-
2 * Copyright 2007-8 Advanced Micro Devices, Inc.
36 #include "atom-bits.h"
52 if ((rdev->family == CHIP_R420) || in radeon_lookup_i2c_gpio_quirks()
53 (rdev->family == CHIP_R423) || in radeon_lookup_i2c_gpio_quirks()
54 (rdev->family == CHIP_RV410)) { in radeon_lookup_i2c_gpio_quirks()
55 if ((le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0018) || in radeon_lookup_i2c_gpio_quirks()
56 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0019) || in radeon_lookup_i2c_gpio_quirks()
57 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x001a)) { in radeon_lookup_i2c_gpio_quirks()
58 gpio->ucClkMaskShift = 0x19; in radeon_lookup_i2c_gpio_quirks()
59 gpio->ucDataMaskShift = 0x18; in radeon_lookup_i2c_gpio_quirks()
66 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && in radeon_lookup_i2c_gpio_quirks()
67 (gpio->sucI2cId.ucAccess == 0)) { in radeon_lookup_i2c_gpio_quirks()
68 gpio->sucI2cId.ucAccess = 0x97; in radeon_lookup_i2c_gpio_quirks()
69 gpio->ucDataMaskShift = 8; in radeon_lookup_i2c_gpio_quirks()
70 gpio->ucDataEnShift = 8; in radeon_lookup_i2c_gpio_quirks()
71 gpio->ucDataY_Shift = 8; in radeon_lookup_i2c_gpio_quirks()
72 gpio->ucDataA_Shift = 8; in radeon_lookup_i2c_gpio_quirks()
79 (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && in radeon_lookup_i2c_gpio_quirks()
80 (gpio->sucI2cId.ucAccess == 0x94)) in radeon_lookup_i2c_gpio_quirks()
81 gpio->sucI2cId.ucAccess = 0x14; in radeon_lookup_i2c_gpio_quirks()
91 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
92 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
93 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
94 i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
95 i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
96 i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
97 i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
98 i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; in radeon_get_bus_rec_for_i2c_gpio()
99 i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); in radeon_get_bus_rec_for_i2c_gpio()
100 i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); in radeon_get_bus_rec_for_i2c_gpio()
101 i2c.en_clk_mask = (1 << gpio->ucClkEnShift); in radeon_get_bus_rec_for_i2c_gpio()
102 i2c.en_data_mask = (1 << gpio->ucDataEnShift); in radeon_get_bus_rec_for_i2c_gpio()
103 i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); in radeon_get_bus_rec_for_i2c_gpio()
104 i2c.y_data_mask = (1 << gpio->ucDataY_Shift); in radeon_get_bus_rec_for_i2c_gpio()
105 i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); in radeon_get_bus_rec_for_i2c_gpio()
106 i2c.a_data_mask = (1 << gpio->ucDataA_Shift); in radeon_get_bus_rec_for_i2c_gpio()
108 if (gpio->sucI2cId.sbfAccess.bfHW_Capable) in radeon_get_bus_rec_for_i2c_gpio()
113 if (gpio->sucI2cId.ucAccess == 0xa0) in radeon_get_bus_rec_for_i2c_gpio()
118 i2c.i2c_id = gpio->sucI2cId.ucAccess; in radeon_get_bus_rec_for_i2c_gpio()
131 struct atom_context *ctx = rdev->mode_info.atom_context; in radeon_lookup_i2c_gpio()
143 i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); in radeon_lookup_i2c_gpio()
145 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_lookup_i2c_gpio()
148 gpio = &i2c_info->asGPIO_Info[0]; in radeon_lookup_i2c_gpio()
153 if (gpio->sucI2cId.ucAccess == id) { in radeon_lookup_i2c_gpio()
167 struct atom_context *ctx = rdev->mode_info.atom_context; in radeon_atombios_i2c_init()
177 i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); in radeon_atombios_i2c_init()
179 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_i2c_init()
182 gpio = &i2c_info->asGPIO_Info[0]; in radeon_atombios_i2c_init()
190 rdev->i2c_bus[i] = radeon_i2c_create(rdev_to_drm(rdev), &i2c, stmp); in radeon_atombios_i2c_init()
201 struct atom_context *ctx = rdev->mode_info.atom_context; in radeon_atombios_lookup_gpio()
213 gpio_info = (struct _ATOM_GPIO_PIN_LUT *)(ctx->bios + data_offset); in radeon_atombios_lookup_gpio()
215 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_lookup_gpio()
218 pin = gpio_info->asGPIO_Pin; in radeon_atombios_lookup_gpio()
220 if (id == pin->ucGPIO_ID) { in radeon_atombios_lookup_gpio()
221 gpio.id = pin->ucGPIO_ID; in radeon_atombios_lookup_gpio()
222 gpio.reg = le16_to_cpu(pin->usGpioPin_AIndex) * 4; in radeon_atombios_lookup_gpio()
223 gpio.shift = pin->ucGpioPinBitShift; in radeon_atombios_lookup_gpio()
224 gpio.mask = (1 << pin->ucGpioPinBitShift); in radeon_atombios_lookup_gpio()
252 if (gpio->reg == reg) { in radeon_atom_get_hpd_info_from_gpio()
253 switch(gpio->mask) { in radeon_atom_get_hpd_info_from_gpio()
288 struct pci_dev *pdev = to_pci_dev(dev->dev); in radeon_atom_apply_quirks()
290 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ in radeon_atom_apply_quirks()
291 if ((pdev->device == 0x791e) && in radeon_atom_apply_quirks()
292 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
293 (pdev->subsystem_device == 0x826d)) { in radeon_atom_apply_quirks()
300 if ((pdev->device == 0x7941) && in radeon_atom_apply_quirks()
301 (pdev->subsystem_vendor == 0x1849) && in radeon_atom_apply_quirks()
302 (pdev->subsystem_device == 0x7941)) { in radeon_atom_apply_quirks()
309 if ((pdev->device == 0x796e) && in radeon_atom_apply_quirks()
310 (pdev->subsystem_vendor == 0x1462) && in radeon_atom_apply_quirks()
311 (pdev->subsystem_device == 0x7302)) { in radeon_atom_apply_quirks()
317 /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ in radeon_atom_apply_quirks()
318 if ((pdev->device == 0x7941) && in radeon_atom_apply_quirks()
319 (pdev->subsystem_vendor == 0x147b) && in radeon_atom_apply_quirks()
320 (pdev->subsystem_device == 0x2412)) { in radeon_atom_apply_quirks()
326 if ((pdev->device == 0x5653) && in radeon_atom_apply_quirks()
327 (pdev->subsystem_vendor == 0x1462) && in radeon_atom_apply_quirks()
328 (pdev->subsystem_device == 0x0291)) { in radeon_atom_apply_quirks()
330 i2c_bus->valid = false; in radeon_atom_apply_quirks()
336 if ((pdev->device == 0x7146) && in radeon_atom_apply_quirks()
337 (pdev->subsystem_vendor == 0x17af) && in radeon_atom_apply_quirks()
338 (pdev->subsystem_device == 0x2058)) { in radeon_atom_apply_quirks()
344 if ((pdev->device == 0x7142) && in radeon_atom_apply_quirks()
345 (pdev->subsystem_vendor == 0x1458) && in radeon_atom_apply_quirks()
346 (pdev->subsystem_device == 0x2134)) { in radeon_atom_apply_quirks()
353 if ((pdev->device == 0x71C5) && in radeon_atom_apply_quirks()
354 (pdev->subsystem_vendor == 0x106b) && in radeon_atom_apply_quirks()
355 (pdev->subsystem_device == 0x0080)) { in radeon_atom_apply_quirks()
371 if ((pdev->device == 0x9598) && in radeon_atom_apply_quirks()
372 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
373 (pdev->subsystem_device == 0x01da)) { in radeon_atom_apply_quirks()
380 if ((pdev->device == 0x9598) && in radeon_atom_apply_quirks()
381 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
382 (pdev->subsystem_device == 0x01e4)) { in radeon_atom_apply_quirks()
389 if ((pdev->device == 0x95C5) && in radeon_atom_apply_quirks()
390 (pdev->subsystem_vendor == 0x1043) && in radeon_atom_apply_quirks()
391 (pdev->subsystem_device == 0x01e2)) { in radeon_atom_apply_quirks()
397 /* some BIOSes seem to report DAC on HDMI - usually this is a board with in radeon_atom_apply_quirks()
416 if (((pdev->device == 0x95c4) || (pdev->device == 0x9591)) && in radeon_atom_apply_quirks()
417 (pdev->subsystem_vendor == 0x1025) && in radeon_atom_apply_quirks()
418 (pdev->subsystem_device == 0x013c)) { in radeon_atom_apply_quirks()
421 /* actually it's a DVI-D port not DVI-I */ in radeon_atom_apply_quirks()
430 if ((pdev->device == 0x9498) && in radeon_atom_apply_quirks()
431 (pdev->subsystem_vendor == 0x1682) && in radeon_atom_apply_quirks()
432 (pdev->subsystem_device == 0x2452) && in radeon_atom_apply_quirks()
433 (i2c_bus->valid == false) && in radeon_atom_apply_quirks()
435 struct radeon_device *rdev = dev->dev_private; in radeon_atom_apply_quirks()
439 /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ in radeon_atom_apply_quirks()
440 if (((pdev->device == 0x9802) || in radeon_atom_apply_quirks()
441 (pdev->device == 0x9805) || in radeon_atom_apply_quirks()
442 (pdev->device == 0x9806)) && in radeon_atom_apply_quirks()
443 (pdev->subsystem_vendor == 0x1734) && in radeon_atom_apply_quirks()
444 (pdev->subsystem_device == 0x11bd)) { in radeon_atom_apply_quirks()
480 CONNECTOR_OBJECT_ID_VGA, /* technically DVI-A */
519 struct radeon_device *rdev = dev->dev_private; in radeon_get_atom_connector_info_from_object_table()
520 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_get_atom_connector_info_from_object_table()
521 struct atom_context *ctx = mode_info->atom_context; in radeon_get_atom_connector_info_from_object_table()
544 obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset); in radeon_get_atom_connector_info_from_object_table()
546 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
547 le16_to_cpu(obj_header->usDisplayPathTableOffset)); in radeon_get_atom_connector_info_from_object_table()
549 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
550 le16_to_cpu(obj_header->usConnectorObjectTableOffset)); in radeon_get_atom_connector_info_from_object_table()
552 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
553 le16_to_cpu(obj_header->usEncoderObjectTableOffset)); in radeon_get_atom_connector_info_from_object_table()
555 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
556 le16_to_cpu(obj_header->usRouterObjectTableOffset)); in radeon_get_atom_connector_info_from_object_table()
557 device_support = le16_to_cpu(obj_header->usDeviceSupport); in radeon_get_atom_connector_info_from_object_table()
560 for (i = 0; i < path_obj->ucNumOfDispPath; i++) { in radeon_get_atom_connector_info_from_object_table()
561 uint8_t *addr = (uint8_t *) path_obj->asDispPath; in radeon_get_atom_connector_info_from_object_table()
565 path_size += le16_to_cpu(path->usSize); in radeon_get_atom_connector_info_from_object_table()
567 if (device_support & le16_to_cpu(path->usDeviceTag)) { in radeon_get_atom_connector_info_from_object_table()
571 (le16_to_cpu(path->usConnObjectId) & OBJECT_ID_MASK) in radeon_get_atom_connector_info_from_object_table()
574 (le16_to_cpu(path->usConnObjectId) & ENUM_ID_MASK) in radeon_get_atom_connector_info_from_object_table()
578 if (le16_to_cpu(path->usDeviceTag) == in radeon_get_atom_connector_info_from_object_table()
583 if ((rdev->flags & RADEON_IS_IGP) && in radeon_get_atom_connector_info_from_object_table()
599 *) (ctx->bios + igp_offset); in radeon_get_atom_connector_info_from_object_table()
606 igp_obj-> in radeon_get_atom_connector_info_from_object_table()
610 igp_obj-> in radeon_get_atom_connector_info_from_object_table()
642 for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); j++) { in radeon_get_atom_connector_info_from_object_table()
644 (le16_to_cpu(path->usGraphicObjIds[j]) & in radeon_get_atom_connector_info_from_object_table()
648 for (k = 0; k < enc_obj->ucNumberOfObjects; k++) { in radeon_get_atom_connector_info_from_object_table()
649 u16 encoder_obj = le16_to_cpu(enc_obj->asObjects[k].usObjectID); in radeon_get_atom_connector_info_from_object_table()
650 if (le16_to_cpu(path->usGraphicObjIds[j]) == encoder_obj) { in radeon_get_atom_connector_info_from_object_table()
652 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
653 le16_to_cpu(enc_obj->asObjects[k].usRecordOffset)); in radeon_get_atom_connector_info_from_object_table()
657 while (record->ucRecordSize > 0 && in radeon_get_atom_connector_info_from_object_table()
658 record->ucRecordType > 0 && in radeon_get_atom_connector_info_from_object_table()
659 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { in radeon_get_atom_connector_info_from_object_table()
660 switch (record->ucRecordType) { in radeon_get_atom_connector_info_from_object_table()
664 caps = le16_to_cpu(cap_record->usEncoderCap); in radeon_get_atom_connector_info_from_object_table()
668 ((char *)record + record->ucRecordSize); in radeon_get_atom_connector_info_from_object_table()
673 (path-> in radeon_get_atom_connector_info_from_object_table()
679 for (k = 0; k < router_obj->ucNumberOfObjects; k++) { in radeon_get_atom_connector_info_from_object_table()
680 u16 router_obj_id = le16_to_cpu(router_obj->asObjects[k].usObjectID); in radeon_get_atom_connector_info_from_object_table()
681 if (le16_to_cpu(path->usGraphicObjIds[j]) == router_obj_id) { in radeon_get_atom_connector_info_from_object_table()
683 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
684 le16_to_cpu(router_obj->asObjects[k].usRecordOffset)); in radeon_get_atom_connector_info_from_object_table()
691 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
692 le16_to_cpu(router_obj->asObjects[k].usSrcDstTableOffset)); in radeon_get_atom_connector_info_from_object_table()
695 (router_src_dst_table->ucNumberOfSrc * 2)); in radeon_get_atom_connector_info_from_object_table()
701 if (le16_to_cpu(path->usConnObjectId) == in radeon_get_atom_connector_info_from_object_table()
706 while (record->ucRecordSize > 0 && in radeon_get_atom_connector_info_from_object_table()
707 record->ucRecordType > 0 && in radeon_get_atom_connector_info_from_object_table()
708 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { in radeon_get_atom_connector_info_from_object_table()
709 switch (record->ucRecordType) { in radeon_get_atom_connector_info_from_object_table()
716 &i2c_record->sucI2cId; in radeon_get_atom_connector_info_from_object_table()
719 i2c_config-> in radeon_get_atom_connector_info_from_object_table()
721 router.i2c_addr = i2c_record->ucI2CAddr >> 1; in radeon_get_atom_connector_info_from_object_table()
727 router.ddc_mux_type = ddc_path->ucMuxType; in radeon_get_atom_connector_info_from_object_table()
728 router.ddc_mux_control_pin = ddc_path->ucMuxControlPin; in radeon_get_atom_connector_info_from_object_table()
729 router.ddc_mux_state = ddc_path->ucMuxState[enum_id]; in radeon_get_atom_connector_info_from_object_table()
735 router.cd_mux_type = cd_path->ucMuxType; in radeon_get_atom_connector_info_from_object_table()
736 router.cd_mux_control_pin = cd_path->ucMuxControlPin; in radeon_get_atom_connector_info_from_object_table()
737 router.cd_mux_state = cd_path->ucMuxState[enum_id]; in radeon_get_atom_connector_info_from_object_table()
741 ((char *)record + record->ucRecordSize); in radeon_get_atom_connector_info_from_object_table()
751 if ((le16_to_cpu(path->usDeviceTag) & in radeon_get_atom_connector_info_from_object_table()
753 for (j = 0; j < con_obj->ucNumberOfObjects; j++) { in radeon_get_atom_connector_info_from_object_table()
754 if (le16_to_cpu(path->usConnObjectId) == in radeon_get_atom_connector_info_from_object_table()
755 le16_to_cpu(con_obj->asObjects[j]. in radeon_get_atom_connector_info_from_object_table()
761 (ctx->bios + data_offset + in radeon_get_atom_connector_info_from_object_table()
762 le16_to_cpu(con_obj-> in radeon_get_atom_connector_info_from_object_table()
769 while (record->ucRecordSize > 0 && in radeon_get_atom_connector_info_from_object_table()
770 record->ucRecordType > 0 && in radeon_get_atom_connector_info_from_object_table()
771 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { in radeon_get_atom_connector_info_from_object_table()
772 switch (record->ucRecordType) { in radeon_get_atom_connector_info_from_object_table()
779 &i2c_record->sucI2cId; in radeon_get_atom_connector_info_from_object_table()
781 i2c_config-> in radeon_get_atom_connector_info_from_object_table()
789 hpd_record->ucHPDIntGPIOID); in radeon_get_atom_connector_info_from_object_table()
791 hpd.plugged_state = hpd_record->ucPlugged_PinState; in radeon_get_atom_connector_info_from_object_table()
798 record-> in radeon_get_atom_connector_info_from_object_table()
809 conn_id = le16_to_cpu(path->usConnObjectId); in radeon_get_atom_connector_info_from_object_table()
812 (dev, le16_to_cpu(path->usDeviceTag), &connector_type, in radeon_get_atom_connector_info_from_object_table()
818 le16_to_cpu(path-> in radeon_get_atom_connector_info_from_object_table()
837 struct radeon_device *rdev = dev->dev_private; in atombios_get_connector_object_id()
839 if (rdev->flags & RADEON_IS_IGP) { in atombios_get_connector_object_id()
845 struct radeon_mode_info *mode_info = &rdev->mode_info; in atombios_get_connector_object_id()
846 struct atom_context *ctx = mode_info->atom_context; in atombios_get_connector_object_id()
853 xtmds = (ATOM_XTMDS_INFO *)(ctx->bios + data_offset); in atombios_get_connector_object_id()
855 if (xtmds->ucSupportedLink & ATOM_XTMDS_SUPPORTED_DUALLINK) { in atombios_get_connector_object_id()
888 struct radeon_device *rdev = dev->dev_private; in radeon_get_atom_connector_info_from_supported_devices_table()
889 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_get_atom_connector_info_from_supported_devices_table()
890 struct atom_context *ctx = mode_info->atom_context; in radeon_get_atom_connector_info_from_supported_devices_table()
916 (union atom_supported_devices *)(ctx->bios + data_offset); in radeon_get_atom_connector_info_from_supported_devices_table()
918 device_support = le16_to_cpu(supported_devices->info.usDeviceSupport); in radeon_get_atom_connector_info_from_supported_devices_table()
929 ci = supported_devices->info_2d1.asConnInfo[i]; in radeon_get_atom_connector_info_from_supported_devices_table()
931 ci = supported_devices->info.asConnInfo[i]; in radeon_get_atom_connector_info_from_supported_devices_table()
974 u8 isb = supported_devices->info_2d1.asIntSrcInfo[i].ucIntSrcBitmap; in radeon_get_atom_connector_info_from_supported_devices_table()
1045 /* combine analog and digital for DVI-I */ in radeon_get_atom_connector_info_from_supported_devices_table()
1110 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_dentist_vco_freq()
1116 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_dentist_vco_freq()
1118 igp_info = (union igp_info *)(mode_info->atom_context->bios + in radeon_atombios_get_dentist_vco_freq()
1120 rdev->clock.vco_freq = in radeon_atombios_get_dentist_vco_freq()
1121 le32_to_cpu(igp_info->info_6.ulDentistVCOFreq); in radeon_atombios_get_dentist_vco_freq()
1127 struct radeon_device *rdev = dev->dev_private; in radeon_atom_get_clock_info()
1128 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atom_get_clock_info()
1132 struct radeon_pll *p1pll = &rdev->clock.p1pll; in radeon_atom_get_clock_info()
1133 struct radeon_pll *p2pll = &rdev->clock.p2pll; in radeon_atom_get_clock_info()
1134 struct radeon_pll *dcpll = &rdev->clock.dcpll; in radeon_atom_get_clock_info()
1135 struct radeon_pll *spll = &rdev->clock.spll; in radeon_atom_get_clock_info()
1136 struct radeon_pll *mpll = &rdev->clock.mpll; in radeon_atom_get_clock_info()
1139 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atom_get_clock_info()
1142 (union firmware_info *)(mode_info->atom_context->bios + in radeon_atom_get_clock_info()
1145 p1pll->reference_freq = in radeon_atom_get_clock_info()
1146 le16_to_cpu(firmware_info->info.usReferenceClock); in radeon_atom_get_clock_info()
1147 p1pll->reference_div = 0; in radeon_atom_get_clock_info()
1150 p1pll->pll_out_min = in radeon_atom_get_clock_info()
1151 le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output); in radeon_atom_get_clock_info()
1153 p1pll->pll_out_min = in radeon_atom_get_clock_info()
1154 le32_to_cpu(firmware_info->info_12.ulMinPixelClockPLL_Output); in radeon_atom_get_clock_info()
1155 p1pll->pll_out_max = in radeon_atom_get_clock_info()
1156 le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); in radeon_atom_get_clock_info()
1159 p1pll->lcd_pll_out_min = in radeon_atom_get_clock_info()
1160 le16_to_cpu(firmware_info->info_14.usLcdMinPixelClockPLL_Output) * 100; in radeon_atom_get_clock_info()
1161 if (p1pll->lcd_pll_out_min == 0) in radeon_atom_get_clock_info()
1162 p1pll->lcd_pll_out_min = p1pll->pll_out_min; in radeon_atom_get_clock_info()
1163 p1pll->lcd_pll_out_max = in radeon_atom_get_clock_info()
1164 le16_to_cpu(firmware_info->info_14.usLcdMaxPixelClockPLL_Output) * 100; in radeon_atom_get_clock_info()
1165 if (p1pll->lcd_pll_out_max == 0) in radeon_atom_get_clock_info()
1166 p1pll->lcd_pll_out_max = p1pll->pll_out_max; in radeon_atom_get_clock_info()
1168 p1pll->lcd_pll_out_min = p1pll->pll_out_min; in radeon_atom_get_clock_info()
1169 p1pll->lcd_pll_out_max = p1pll->pll_out_max; in radeon_atom_get_clock_info()
1172 if (p1pll->pll_out_min == 0) { in radeon_atom_get_clock_info()
1174 p1pll->pll_out_min = 64800; in radeon_atom_get_clock_info()
1176 p1pll->pll_out_min = 20000; in radeon_atom_get_clock_info()
1179 p1pll->pll_in_min = in radeon_atom_get_clock_info()
1180 le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Input); in radeon_atom_get_clock_info()
1181 p1pll->pll_in_max = in radeon_atom_get_clock_info()
1182 le16_to_cpu(firmware_info->info.usMaxPixelClockPLL_Input); in radeon_atom_get_clock_info()
1188 spll->reference_freq = in radeon_atom_get_clock_info()
1189 le16_to_cpu(firmware_info->info_21.usCoreReferenceClock); in radeon_atom_get_clock_info()
1191 spll->reference_freq = in radeon_atom_get_clock_info()
1192 le16_to_cpu(firmware_info->info.usReferenceClock); in radeon_atom_get_clock_info()
1193 spll->reference_div = 0; in radeon_atom_get_clock_info()
1195 spll->pll_out_min = in radeon_atom_get_clock_info()
1196 le16_to_cpu(firmware_info->info.usMinEngineClockPLL_Output); in radeon_atom_get_clock_info()
1197 spll->pll_out_max = in radeon_atom_get_clock_info()
1198 le32_to_cpu(firmware_info->info.ulMaxEngineClockPLL_Output); in radeon_atom_get_clock_info()
1201 if (spll->pll_out_min == 0) { in radeon_atom_get_clock_info()
1203 spll->pll_out_min = 64800; in radeon_atom_get_clock_info()
1205 spll->pll_out_min = 20000; in radeon_atom_get_clock_info()
1208 spll->pll_in_min = in radeon_atom_get_clock_info()
1209 le16_to_cpu(firmware_info->info.usMinEngineClockPLL_Input); in radeon_atom_get_clock_info()
1210 spll->pll_in_max = in radeon_atom_get_clock_info()
1211 le16_to_cpu(firmware_info->info.usMaxEngineClockPLL_Input); in radeon_atom_get_clock_info()
1215 mpll->reference_freq = in radeon_atom_get_clock_info()
1216 le16_to_cpu(firmware_info->info_21.usMemoryReferenceClock); in radeon_atom_get_clock_info()
1218 mpll->reference_freq = in radeon_atom_get_clock_info()
1219 le16_to_cpu(firmware_info->info.usReferenceClock); in radeon_atom_get_clock_info()
1220 mpll->reference_div = 0; in radeon_atom_get_clock_info()
1222 mpll->pll_out_min = in radeon_atom_get_clock_info()
1223 le16_to_cpu(firmware_info->info.usMinMemoryClockPLL_Output); in radeon_atom_get_clock_info()
1224 mpll->pll_out_max = in radeon_atom_get_clock_info()
1225 le32_to_cpu(firmware_info->info.ulMaxMemoryClockPLL_Output); in radeon_atom_get_clock_info()
1228 if (mpll->pll_out_min == 0) { in radeon_atom_get_clock_info()
1230 mpll->pll_out_min = 64800; in radeon_atom_get_clock_info()
1232 mpll->pll_out_min = 20000; in radeon_atom_get_clock_info()
1235 mpll->pll_in_min = in radeon_atom_get_clock_info()
1236 le16_to_cpu(firmware_info->info.usMinMemoryClockPLL_Input); in radeon_atom_get_clock_info()
1237 mpll->pll_in_max = in radeon_atom_get_clock_info()
1238 le16_to_cpu(firmware_info->info.usMaxMemoryClockPLL_Input); in radeon_atom_get_clock_info()
1240 rdev->clock.default_sclk = in radeon_atom_get_clock_info()
1241 le32_to_cpu(firmware_info->info.ulDefaultEngineClock); in radeon_atom_get_clock_info()
1242 rdev->clock.default_mclk = in radeon_atom_get_clock_info()
1243 le32_to_cpu(firmware_info->info.ulDefaultMemoryClock); in radeon_atom_get_clock_info()
1246 rdev->clock.default_dispclk = in radeon_atom_get_clock_info()
1247 le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); in radeon_atom_get_clock_info()
1248 if (rdev->clock.default_dispclk == 0) { in radeon_atom_get_clock_info()
1250 rdev->clock.default_dispclk = 60000; /* 600 Mhz */ in radeon_atom_get_clock_info()
1252 rdev->clock.default_dispclk = 54000; /* 540 Mhz */ in radeon_atom_get_clock_info()
1254 rdev->clock.default_dispclk = 60000; /* 600 Mhz */ in radeon_atom_get_clock_info()
1257 if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) { in radeon_atom_get_clock_info()
1259 rdev->clock.default_dispclk / 100); in radeon_atom_get_clock_info()
1260 rdev->clock.default_dispclk = 60000; in radeon_atom_get_clock_info()
1262 rdev->clock.dp_extclk = in radeon_atom_get_clock_info()
1263 le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); in radeon_atom_get_clock_info()
1264 rdev->clock.current_dispclk = rdev->clock.default_dispclk; in radeon_atom_get_clock_info()
1268 rdev->clock.max_pixel_clock = le16_to_cpu(firmware_info->info.usMaxPixelClock); in radeon_atom_get_clock_info()
1269 if (rdev->clock.max_pixel_clock == 0) in radeon_atom_get_clock_info()
1270 rdev->clock.max_pixel_clock = 40000; in radeon_atom_get_clock_info()
1273 rdev->mode_info.firmware_flags = in radeon_atom_get_clock_info()
1274 le16_to_cpu(firmware_info->info.usFirmwareCapability.susAccess); in radeon_atom_get_clock_info()
1277 rdev->clock.vco_freq = in radeon_atom_get_clock_info()
1278 le32_to_cpu(firmware_info->info_22.ulGPUPLL_OutputFreq); in radeon_atom_get_clock_info()
1280 rdev->clock.vco_freq = rdev->clock.current_dispclk; in radeon_atom_get_clock_info()
1284 rdev->clock.vco_freq = rdev->clock.current_dispclk; in radeon_atom_get_clock_info()
1286 if (rdev->clock.vco_freq == 0) in radeon_atom_get_clock_info()
1287 rdev->clock.vco_freq = 360000; /* 3.6 GHz */ in radeon_atom_get_clock_info()
1297 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_sideport_present()
1304 if (rdev->family == CHIP_RS600) in radeon_atombios_sideport_present()
1307 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_sideport_present()
1309 igp_info = (union igp_info *)(mode_info->atom_context->bios + in radeon_atombios_sideport_present()
1313 if (le32_to_cpu(igp_info->info.ulBootUpMemoryClock)) in radeon_atombios_sideport_present()
1317 if (le32_to_cpu(igp_info->info_2.ulBootUpSidePortClock)) in radeon_atombios_sideport_present()
1331 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_tmds_info()
1332 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_tmds_info()
1333 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_tmds_info()
1341 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_tmds_info()
1344 (struct _ATOM_TMDS_INFO *)(mode_info->atom_context->bios + in radeon_atombios_get_tmds_info()
1347 maxfreq = le16_to_cpu(tmds_info->usMaxFrequency); in radeon_atombios_get_tmds_info()
1349 tmds->tmds_pll[i].freq = in radeon_atombios_get_tmds_info()
1350 le16_to_cpu(tmds_info->asMiscInfo[i].usFrequency); in radeon_atombios_get_tmds_info()
1351 tmds->tmds_pll[i].value = in radeon_atombios_get_tmds_info()
1352 tmds_info->asMiscInfo[i].ucPLL_ChargePump & 0x3f; in radeon_atombios_get_tmds_info()
1353 tmds->tmds_pll[i].value |= in radeon_atombios_get_tmds_info()
1354 (tmds_info->asMiscInfo[i]. in radeon_atombios_get_tmds_info()
1356 tmds->tmds_pll[i].value |= in radeon_atombios_get_tmds_info()
1357 (tmds_info->asMiscInfo[i]. in radeon_atombios_get_tmds_info()
1359 tmds->tmds_pll[i].value |= in radeon_atombios_get_tmds_info()
1360 (tmds_info->asMiscInfo[i]. in radeon_atombios_get_tmds_info()
1364 tmds->tmds_pll[i].freq, in radeon_atombios_get_tmds_info()
1365 tmds->tmds_pll[i].value); in radeon_atombios_get_tmds_info()
1367 if (maxfreq == tmds->tmds_pll[i].freq) { in radeon_atombios_get_tmds_info()
1368 tmds->tmds_pll[i].freq = 0xffffffff; in radeon_atombios_get_tmds_info()
1381 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_ppll_ss_info()
1390 if (atom_parse_data_header(mode_info->atom_context, index, &size, in radeon_atombios_get_ppll_ss_info()
1393 (struct _ATOM_SPREAD_SPECTRUM_INFO *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_get_ppll_ss_info()
1395 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_ppll_ss_info()
1398 ((u8 *)&ss_info->asSS_Info[0]); in radeon_atombios_get_ppll_ss_info()
1400 if (ss_assign->ucSS_Id == id) { in radeon_atombios_get_ppll_ss_info()
1401 ss->percentage = in radeon_atombios_get_ppll_ss_info()
1402 le16_to_cpu(ss_assign->usSpreadSpectrumPercentage); in radeon_atombios_get_ppll_ss_info()
1403 ss->type = ss_assign->ucSpreadSpectrumType; in radeon_atombios_get_ppll_ss_info()
1404 ss->step = ss_assign->ucSS_Step; in radeon_atombios_get_ppll_ss_info()
1405 ss->delay = ss_assign->ucSS_Delay; in radeon_atombios_get_ppll_ss_info()
1406 ss->range = ss_assign->ucSS_Range; in radeon_atombios_get_ppll_ss_info()
1407 ss->refdiv = ss_assign->ucRecommendedRef_Div; in radeon_atombios_get_ppll_ss_info()
1421 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_igp_ss_overrides()
1429 if (atom_parse_data_header(mode_info->atom_context, index, &size, in radeon_atombios_get_igp_ss_overrides()
1432 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_igp_ss_overrides()
1437 percentage = le16_to_cpu(igp_info->info_6.usDVISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1438 rate = le16_to_cpu(igp_info->info_6.usDVISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1441 percentage = le16_to_cpu(igp_info->info_6.usHDMISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1442 rate = le16_to_cpu(igp_info->info_6.usHDMISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1445 percentage = le16_to_cpu(igp_info->info_6.usLvdsSSPercentage); in radeon_atombios_get_igp_ss_overrides()
1446 rate = le16_to_cpu(igp_info->info_6.usLvdsSSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1453 percentage = le16_to_cpu(igp_info->info_7.usDVISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1454 rate = le16_to_cpu(igp_info->info_7.usDVISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1457 percentage = le16_to_cpu(igp_info->info_7.usHDMISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1458 rate = le16_to_cpu(igp_info->info_7.usHDMISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1461 percentage = le16_to_cpu(igp_info->info_7.usLvdsSSPercentage); in radeon_atombios_get_igp_ss_overrides()
1462 rate = le16_to_cpu(igp_info->info_7.usLvdsSSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1469 percentage = le16_to_cpu(igp_info->info_8.usDVISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1470 rate = le16_to_cpu(igp_info->info_8.usDVISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1473 percentage = le16_to_cpu(igp_info->info_8.usHDMISSPercentage); in radeon_atombios_get_igp_ss_overrides()
1474 rate = le16_to_cpu(igp_info->info_8.usHDMISSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1477 percentage = le16_to_cpu(igp_info->info_8.usLvdsSSPercentage); in radeon_atombios_get_igp_ss_overrides()
1478 rate = le16_to_cpu(igp_info->info_8.usLvdsSSpreadRateIn10Hz); in radeon_atombios_get_igp_ss_overrides()
1487 ss->percentage = percentage; in radeon_atombios_get_igp_ss_overrides()
1489 ss->rate = rate; in radeon_atombios_get_igp_ss_overrides()
1509 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_asic_ss_info()
1518 if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_MEMORY_CLOCK_SS_SUPPORT)) in radeon_atombios_get_asic_ss_info()
1522 if (!(rdev->mode_info.firmware_flags & ATOM_BIOS_INFO_ENGINE_CLOCK_SS_SUPPORT)) in radeon_atombios_get_asic_ss_info()
1527 if (atom_parse_data_header(mode_info->atom_context, index, &size, in radeon_atombios_get_asic_ss_info()
1531 (union asic_ss_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_get_asic_ss_info()
1535 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_asic_ss_info()
1538 ss_assign = (union asic_ss_assignment *)((u8 *)&ss_info->info.asSpreadSpectrum[0]); in radeon_atombios_get_asic_ss_info()
1540 if ((ss_assign->v1.ucClockIndication == id) && in radeon_atombios_get_asic_ss_info()
1541 (clock <= le32_to_cpu(ss_assign->v1.ulTargetClockRange))) { in radeon_atombios_get_asic_ss_info()
1542 ss->percentage = in radeon_atombios_get_asic_ss_info()
1543 le16_to_cpu(ss_assign->v1.usSpreadSpectrumPercentage); in radeon_atombios_get_asic_ss_info()
1544 ss->type = ss_assign->v1.ucSpreadSpectrumMode; in radeon_atombios_get_asic_ss_info()
1545 ss->rate = le16_to_cpu(ss_assign->v1.usSpreadRateInKhz); in radeon_atombios_get_asic_ss_info()
1546 ss->percentage_divider = 100; in radeon_atombios_get_asic_ss_info()
1554 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_asic_ss_info()
1556 ss_assign = (union asic_ss_assignment *)((u8 *)&ss_info->info_2.asSpreadSpectrum[0]); in radeon_atombios_get_asic_ss_info()
1558 if ((ss_assign->v2.ucClockIndication == id) && in radeon_atombios_get_asic_ss_info()
1559 (clock <= le32_to_cpu(ss_assign->v2.ulTargetClockRange))) { in radeon_atombios_get_asic_ss_info()
1560 ss->percentage = in radeon_atombios_get_asic_ss_info()
1561 le16_to_cpu(ss_assign->v2.usSpreadSpectrumPercentage); in radeon_atombios_get_asic_ss_info()
1562 ss->type = ss_assign->v2.ucSpreadSpectrumMode; in radeon_atombios_get_asic_ss_info()
1563 ss->rate = le16_to_cpu(ss_assign->v2.usSpreadRateIn10Hz); in radeon_atombios_get_asic_ss_info()
1564 ss->percentage_divider = 100; in radeon_atombios_get_asic_ss_info()
1568 ss->rate /= 100; in radeon_atombios_get_asic_ss_info()
1576 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / in radeon_atombios_get_asic_ss_info()
1578 ss_assign = (union asic_ss_assignment *)((u8 *)&ss_info->info_3.asSpreadSpectrum[0]); in radeon_atombios_get_asic_ss_info()
1580 if ((ss_assign->v3.ucClockIndication == id) && in radeon_atombios_get_asic_ss_info()
1581 (clock <= le32_to_cpu(ss_assign->v3.ulTargetClockRange))) { in radeon_atombios_get_asic_ss_info()
1582 ss->percentage = in radeon_atombios_get_asic_ss_info()
1583 le16_to_cpu(ss_assign->v3.usSpreadSpectrumPercentage); in radeon_atombios_get_asic_ss_info()
1584 ss->type = ss_assign->v3.ucSpreadSpectrumMode; in radeon_atombios_get_asic_ss_info()
1585 ss->rate = le16_to_cpu(ss_assign->v3.usSpreadRateIn10Hz); in radeon_atombios_get_asic_ss_info()
1586 if (ss_assign->v3.ucSpreadSpectrumMode & in radeon_atombios_get_asic_ss_info()
1588 ss->percentage_divider = 1000; in radeon_atombios_get_asic_ss_info()
1590 ss->percentage_divider = 100; in radeon_atombios_get_asic_ss_info()
1593 ss->rate /= 100; in radeon_atombios_get_asic_ss_info()
1594 if (rdev->flags & RADEON_IS_IGP) in radeon_atombios_get_asic_ss_info()
1620 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_lvds_info()
1621 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_lvds_info()
1622 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_lvds_info()
1628 int encoder_enum = (encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; in radeon_atombios_get_lvds_info()
1630 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_lvds_info()
1633 (union lvds_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_get_lvds_info()
1640 lvds->native_mode.clock = in radeon_atombios_get_lvds_info()
1641 le16_to_cpu(lvds_info->info.sLCDTiming.usPixClk) * 10; in radeon_atombios_get_lvds_info()
1642 lvds->native_mode.hdisplay = in radeon_atombios_get_lvds_info()
1643 le16_to_cpu(lvds_info->info.sLCDTiming.usHActive); in radeon_atombios_get_lvds_info()
1644 lvds->native_mode.vdisplay = in radeon_atombios_get_lvds_info()
1645 le16_to_cpu(lvds_info->info.sLCDTiming.usVActive); in radeon_atombios_get_lvds_info()
1646 lvds->native_mode.htotal = lvds->native_mode.hdisplay + in radeon_atombios_get_lvds_info()
1647 le16_to_cpu(lvds_info->info.sLCDTiming.usHBlanking_Time); in radeon_atombios_get_lvds_info()
1648 lvds->native_mode.hsync_start = lvds->native_mode.hdisplay + in radeon_atombios_get_lvds_info()
1649 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncOffset); in radeon_atombios_get_lvds_info()
1650 lvds->native_mode.hsync_end = lvds->native_mode.hsync_start + in radeon_atombios_get_lvds_info()
1651 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncWidth); in radeon_atombios_get_lvds_info()
1652 lvds->native_mode.vtotal = lvds->native_mode.vdisplay + in radeon_atombios_get_lvds_info()
1653 le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time); in radeon_atombios_get_lvds_info()
1654 lvds->native_mode.vsync_start = lvds->native_mode.vdisplay + in radeon_atombios_get_lvds_info()
1655 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncOffset); in radeon_atombios_get_lvds_info()
1656 lvds->native_mode.vsync_end = lvds->native_mode.vsync_start + in radeon_atombios_get_lvds_info()
1657 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth); in radeon_atombios_get_lvds_info()
1658 lvds->panel_pwr_delay = in radeon_atombios_get_lvds_info()
1659 le16_to_cpu(lvds_info->info.usOffDelayInMs); in radeon_atombios_get_lvds_info()
1660 lvds->lcd_misc = lvds_info->info.ucLVDS_Misc; in radeon_atombios_get_lvds_info()
1662 misc = le16_to_cpu(lvds_info->info.sLCDTiming.susModeMiscInfo.usAccess); in radeon_atombios_get_lvds_info()
1664 lvds->native_mode.flags |= DRM_MODE_FLAG_NVSYNC; in radeon_atombios_get_lvds_info()
1666 lvds->native_mode.flags |= DRM_MODE_FLAG_NHSYNC; in radeon_atombios_get_lvds_info()
1668 lvds->native_mode.flags |= DRM_MODE_FLAG_CSYNC; in radeon_atombios_get_lvds_info()
1670 lvds->native_mode.flags |= DRM_MODE_FLAG_INTERLACE; in radeon_atombios_get_lvds_info()
1672 lvds->native_mode.flags |= DRM_MODE_FLAG_DBLSCAN; in radeon_atombios_get_lvds_info()
1674 lvds->native_mode.width_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageHSize); in radeon_atombios_get_lvds_info()
1675 lvds->native_mode.height_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageVSize); in radeon_atombios_get_lvds_info()
1678 drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); in radeon_atombios_get_lvds_info()
1680 lvds->lcd_ss_id = lvds_info->info.ucSS_Id; in radeon_atombios_get_lvds_info()
1682 encoder->native_mode = lvds->native_mode; in radeon_atombios_get_lvds_info()
1685 lvds->linkb = true; in radeon_atombios_get_lvds_info()
1687 lvds->linkb = false; in radeon_atombios_get_lvds_info()
1690 if (le16_to_cpu(lvds_info->info.usModePatchTableOffset)) { in radeon_atombios_get_lvds_info()
1698 record = (u8 *)(mode_info->atom_context->bios + in radeon_atombios_get_lvds_info()
1699 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); in radeon_atombios_get_lvds_info()
1702 record = (u8 *)(mode_info->atom_context->bios + in radeon_atombios_get_lvds_info()
1704 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); in radeon_atombios_get_lvds_info()
1718 if (fake_edid_record->ucFakeEDIDLength) { in radeon_atombios_get_lvds_info()
1722 if (fake_edid_record->ucFakeEDIDLength == 128) in radeon_atombios_get_lvds_info()
1723 edid_size = fake_edid_record->ucFakeEDIDLength; in radeon_atombios_get_lvds_info()
1725 edid_size = fake_edid_record->ucFakeEDIDLength * 128; in radeon_atombios_get_lvds_info()
1726 edid = drm_edid_alloc(fake_edid_record->ucFakeEDIDString, edid_size); in radeon_atombios_get_lvds_info()
1728 rdev->mode_info.bios_hardcoded_edid = edid; in radeon_atombios_get_lvds_info()
1741 lvds->native_mode.width_mm = panel_res_record->usHSize; in radeon_atombios_get_lvds_info()
1742 lvds->native_mode.height_mm = panel_res_record->usVSize; in radeon_atombios_get_lvds_info()
1761 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_primary_dac_info()
1762 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_primary_dac_info()
1763 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_primary_dac_info()
1771 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_primary_dac_info()
1774 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_primary_dac_info()
1781 bg = dac_info->ucDAC1_BG_Adjustment; in radeon_atombios_get_primary_dac_info()
1782 dac = dac_info->ucDAC1_DAC_Adjustment; in radeon_atombios_get_primary_dac_info()
1783 p_dac->ps2_pdac_adj = (bg << 8) | (dac); in radeon_atombios_get_primary_dac_info()
1792 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atom_get_tv_timings()
1800 if (!atom_parse_data_header(mode_info->atom_context, data_index, NULL, in radeon_atom_get_tv_timings()
1806 tv_info = (ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset); in radeon_atom_get_tv_timings()
1810 mode->crtc_htotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Total); in radeon_atom_get_tv_timings()
1811 mode->crtc_hdisplay = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_Disp); in radeon_atom_get_tv_timings()
1812 mode->crtc_hsync_start = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart); in radeon_atom_get_tv_timings()
1813 mode->crtc_hsync_end = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncStart) + in radeon_atom_get_tv_timings()
1814 le16_to_cpu(tv_info->aModeTimings[index].usCRTC_H_SyncWidth); in radeon_atom_get_tv_timings()
1816 mode->crtc_vtotal = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Total); in radeon_atom_get_tv_timings()
1817 mode->crtc_vdisplay = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_Disp); in radeon_atom_get_tv_timings()
1818 mode->crtc_vsync_start = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart); in radeon_atom_get_tv_timings()
1819 mode->crtc_vsync_end = le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncStart) + in radeon_atom_get_tv_timings()
1820 le16_to_cpu(tv_info->aModeTimings[index].usCRTC_V_SyncWidth); in radeon_atom_get_tv_timings()
1822 mode->flags = 0; in radeon_atom_get_tv_timings()
1823 misc = le16_to_cpu(tv_info->aModeTimings[index].susModeMiscInfo.usAccess); in radeon_atom_get_tv_timings()
1825 mode->flags |= DRM_MODE_FLAG_NVSYNC; in radeon_atom_get_tv_timings()
1827 mode->flags |= DRM_MODE_FLAG_NHSYNC; in radeon_atom_get_tv_timings()
1829 mode->flags |= DRM_MODE_FLAG_CSYNC; in radeon_atom_get_tv_timings()
1831 mode->flags |= DRM_MODE_FLAG_INTERLACE; in radeon_atom_get_tv_timings()
1833 mode->flags |= DRM_MODE_FLAG_DBLSCAN; in radeon_atom_get_tv_timings()
1835 mode->crtc_clock = mode->clock = in radeon_atom_get_tv_timings()
1836 le16_to_cpu(tv_info->aModeTimings[index].usPixelClock) * 10; in radeon_atom_get_tv_timings()
1840 mode->crtc_htotal -= 1; in radeon_atom_get_tv_timings()
1841 mode->crtc_vtotal -= 1; in radeon_atom_get_tv_timings()
1845 tv_info_v1_2 = (ATOM_ANALOG_TV_INFO_V1_2 *)(mode_info->atom_context->bios + data_offset); in radeon_atom_get_tv_timings()
1849 dtd_timings = &tv_info_v1_2->aModeTimings[index]; in radeon_atom_get_tv_timings()
1850 mode->crtc_htotal = le16_to_cpu(dtd_timings->usHActive) + in radeon_atom_get_tv_timings()
1851 le16_to_cpu(dtd_timings->usHBlanking_Time); in radeon_atom_get_tv_timings()
1852 mode->crtc_hdisplay = le16_to_cpu(dtd_timings->usHActive); in radeon_atom_get_tv_timings()
1853 mode->crtc_hsync_start = le16_to_cpu(dtd_timings->usHActive) + in radeon_atom_get_tv_timings()
1854 le16_to_cpu(dtd_timings->usHSyncOffset); in radeon_atom_get_tv_timings()
1855 mode->crtc_hsync_end = mode->crtc_hsync_start + in radeon_atom_get_tv_timings()
1856 le16_to_cpu(dtd_timings->usHSyncWidth); in radeon_atom_get_tv_timings()
1858 mode->crtc_vtotal = le16_to_cpu(dtd_timings->usVActive) + in radeon_atom_get_tv_timings()
1859 le16_to_cpu(dtd_timings->usVBlanking_Time); in radeon_atom_get_tv_timings()
1860 mode->crtc_vdisplay = le16_to_cpu(dtd_timings->usVActive); in radeon_atom_get_tv_timings()
1861 mode->crtc_vsync_start = le16_to_cpu(dtd_timings->usVActive) + in radeon_atom_get_tv_timings()
1862 le16_to_cpu(dtd_timings->usVSyncOffset); in radeon_atom_get_tv_timings()
1863 mode->crtc_vsync_end = mode->crtc_vsync_start + in radeon_atom_get_tv_timings()
1864 le16_to_cpu(dtd_timings->usVSyncWidth); in radeon_atom_get_tv_timings()
1866 mode->flags = 0; in radeon_atom_get_tv_timings()
1867 misc = le16_to_cpu(dtd_timings->susModeMiscInfo.usAccess); in radeon_atom_get_tv_timings()
1869 mode->flags |= DRM_MODE_FLAG_NVSYNC; in radeon_atom_get_tv_timings()
1871 mode->flags |= DRM_MODE_FLAG_NHSYNC; in radeon_atom_get_tv_timings()
1873 mode->flags |= DRM_MODE_FLAG_CSYNC; in radeon_atom_get_tv_timings()
1875 mode->flags |= DRM_MODE_FLAG_INTERLACE; in radeon_atom_get_tv_timings()
1877 mode->flags |= DRM_MODE_FLAG_DBLSCAN; in radeon_atom_get_tv_timings()
1879 mode->crtc_clock = mode->clock = in radeon_atom_get_tv_timings()
1880 le16_to_cpu(dtd_timings->usPixClk) * 10; in radeon_atom_get_tv_timings()
1889 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_tv_info()
1896 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_tv_info()
1900 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_tv_info()
1902 switch (tv_info->ucTV_BootUpDefaultStandard) { in radeon_atombios_get_tv_info()
1909 DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); in radeon_atombios_get_tv_info()
1917 DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); in radeon_atombios_get_tv_info()
1921 DRM_DEBUG_KMS("Default TV standard: PAL-N\n"); in radeon_atombios_get_tv_info()
1925 DRM_DEBUG_KMS("Default TV standard: PAL-CN\n"); in radeon_atombios_get_tv_info()
1929 DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); in radeon_atombios_get_tv_info()
1947 struct drm_device *dev = encoder->base.dev; in radeon_atombios_get_tv_dac_info()
1948 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_get_tv_dac_info()
1949 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_tv_dac_info()
1957 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_tv_dac_info()
1961 (mode_info->atom_context->bios + data_offset); in radeon_atombios_get_tv_dac_info()
1968 bg = dac_info->ucDAC2_CRT2_BG_Adjustment; in radeon_atombios_get_tv_dac_info()
1969 dac = dac_info->ucDAC2_CRT2_DAC_Adjustment; in radeon_atombios_get_tv_dac_info()
1970 tv_dac->ps2_tvdac_adj = (bg << 16) | (dac << 20); in radeon_atombios_get_tv_dac_info()
1972 bg = dac_info->ucDAC2_PAL_BG_Adjustment; in radeon_atombios_get_tv_dac_info()
1973 dac = dac_info->ucDAC2_PAL_DAC_Adjustment; in radeon_atombios_get_tv_dac_info()
1974 tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20); in radeon_atombios_get_tv_dac_info()
1976 bg = dac_info->ucDAC2_NTSC_BG_Adjustment; in radeon_atombios_get_tv_dac_info()
1977 dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; in radeon_atombios_get_tv_dac_info()
1978 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); in radeon_atombios_get_tv_dac_info()
1980 tv_dac->tv_std = radeon_atombios_get_tv_info(rdev); in radeon_atombios_get_tv_dac_info()
2045 rdev->pm.power_state[state_index].misc = misc; in radeon_atombios_parse_misc_flags_1_3()
2046 rdev->pm.power_state[state_index].misc2 = misc2; in radeon_atombios_parse_misc_flags_1_3()
2049 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2052 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2055 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2058 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2061 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2063 rdev->pm.power_state[state_index].flags &= in radeon_atombios_parse_misc_flags_1_3()
2067 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2070 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_misc_flags_1_3()
2072 rdev->pm.default_power_state_index = state_index; in radeon_atombios_parse_misc_flags_1_3()
2073 rdev->pm.power_state[state_index].default_clock_mode = in radeon_atombios_parse_misc_flags_1_3()
2074 &rdev->pm.power_state[state_index].clock_info[0]; in radeon_atombios_parse_misc_flags_1_3()
2076 rdev->pm.power_state[state_index].clock_info[0].flags |= in radeon_atombios_parse_misc_flags_1_3()
2083 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_parse_power_table_1_3()
2093 if (!atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_parse_power_table_1_3()
2096 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_parse_power_table_1_3()
2099 if ((power_info->info.ucOverdriveThermalController > 0) && in radeon_atombios_parse_power_table_1_3()
2100 (power_info->info.ucOverdriveThermalController < ARRAY_SIZE(thermal_controller_names))) { in radeon_atombios_parse_power_table_1_3()
2102 thermal_controller_names[power_info->info.ucOverdriveThermalController], in radeon_atombios_parse_power_table_1_3()
2103 power_info->info.ucOverdriveControllerAddress >> 1); in radeon_atombios_parse_power_table_1_3()
2104 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); in radeon_atombios_parse_power_table_1_3()
2105 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); in radeon_atombios_parse_power_table_1_3()
2106 if (rdev->pm.i2c_bus) { in radeon_atombios_parse_power_table_1_3()
2108 const char *name = thermal_controller_names[power_info->info. in radeon_atombios_parse_power_table_1_3()
2110 info.addr = power_info->info.ucOverdriveControllerAddress >> 1; in radeon_atombios_parse_power_table_1_3()
2112 i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info); in radeon_atombios_parse_power_table_1_3()
2115 num_modes = power_info->info.ucNumOfPowerModeEntries; in radeon_atombios_parse_power_table_1_3()
2120 rdev->pm.power_state = kcalloc(num_modes, in radeon_atombios_parse_power_table_1_3()
2123 if (!rdev->pm.power_state) in radeon_atombios_parse_power_table_1_3()
2128 if (!rdev->pm.power_state[state_index].clock_info) { in radeon_atombios_parse_power_table_1_3()
2129 rdev->pm.power_state[state_index].clock_info = in radeon_atombios_parse_power_table_1_3()
2133 if (!rdev->pm.power_state[state_index].clock_info) in radeon_atombios_parse_power_table_1_3()
2135 rdev->pm.power_state[state_index].num_clock_modes = 1; in radeon_atombios_parse_power_table_1_3()
2136 rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; in radeon_atombios_parse_power_table_1_3()
2139 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_1_3()
2140 le16_to_cpu(power_info->info.asPowerPlayInfo[i].usMemoryClock); in radeon_atombios_parse_power_table_1_3()
2141 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_1_3()
2142 le16_to_cpu(power_info->info.asPowerPlayInfo[i].usEngineClock); in radeon_atombios_parse_power_table_1_3()
2144 if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || in radeon_atombios_parse_power_table_1_3()
2145 (rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) in radeon_atombios_parse_power_table_1_3()
2147 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_power_table_1_3()
2148 power_info->info.asPowerPlayInfo[i].ucNumPciELanes; in radeon_atombios_parse_power_table_1_3()
2149 misc = le32_to_cpu(power_info->info.asPowerPlayInfo[i].ulMiscInfo); in radeon_atombios_parse_power_table_1_3()
2152 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2154 rdev->pm.power_state[state_index].clock_info[0].voltage.gpio = in radeon_atombios_parse_power_table_1_3()
2156 power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex); in radeon_atombios_parse_power_table_1_3()
2158 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2161 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2164 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2166 rdev->pm.power_state[state_index].clock_info[0].voltage.vddc_id = in radeon_atombios_parse_power_table_1_3()
2167 power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2169 rdev->pm.power_state[state_index].flags = RADEON_PM_STATE_SINGLE_DISPLAY_ONLY; in radeon_atombios_parse_power_table_1_3()
2174 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_1_3()
2175 le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMemoryClock); in radeon_atombios_parse_power_table_1_3()
2176 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_1_3()
2177 le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulEngineClock); in radeon_atombios_parse_power_table_1_3()
2179 if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || in radeon_atombios_parse_power_table_1_3()
2180 (rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) in radeon_atombios_parse_power_table_1_3()
2182 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_power_table_1_3()
2183 power_info->info_2.asPowerPlayInfo[i].ucNumPciELanes; in radeon_atombios_parse_power_table_1_3()
2184 misc = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo); in radeon_atombios_parse_power_table_1_3()
2185 misc2 = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo2); in radeon_atombios_parse_power_table_1_3()
2188 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2190 rdev->pm.power_state[state_index].clock_info[0].voltage.gpio = in radeon_atombios_parse_power_table_1_3()
2192 power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex); in radeon_atombios_parse_power_table_1_3()
2194 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2197 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2200 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2202 rdev->pm.power_state[state_index].clock_info[0].voltage.vddc_id = in radeon_atombios_parse_power_table_1_3()
2203 power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2205 rdev->pm.power_state[state_index].flags = RADEON_PM_STATE_SINGLE_DISPLAY_ONLY; in radeon_atombios_parse_power_table_1_3()
2210 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_1_3()
2211 le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMemoryClock); in radeon_atombios_parse_power_table_1_3()
2212 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_1_3()
2213 le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulEngineClock); in radeon_atombios_parse_power_table_1_3()
2215 if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || in radeon_atombios_parse_power_table_1_3()
2216 (rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) in radeon_atombios_parse_power_table_1_3()
2218 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_power_table_1_3()
2219 power_info->info_3.asPowerPlayInfo[i].ucNumPciELanes; in radeon_atombios_parse_power_table_1_3()
2220 misc = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo); in radeon_atombios_parse_power_table_1_3()
2221 misc2 = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo2); in radeon_atombios_parse_power_table_1_3()
2224 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2226 rdev->pm.power_state[state_index].clock_info[0].voltage.gpio = in radeon_atombios_parse_power_table_1_3()
2228 power_info->info_3.asPowerPlayInfo[i].ucVoltageDropIndex); in radeon_atombios_parse_power_table_1_3()
2230 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2233 rdev->pm.power_state[state_index].clock_info[0].voltage.active_high = in radeon_atombios_parse_power_table_1_3()
2236 rdev->pm.power_state[state_index].clock_info[0].voltage.type = in radeon_atombios_parse_power_table_1_3()
2238 rdev->pm.power_state[state_index].clock_info[0].voltage.vddc_id = in radeon_atombios_parse_power_table_1_3()
2239 power_info->info_3.asPowerPlayInfo[i].ucVoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2241 rdev->pm.power_state[state_index].clock_info[0].voltage.vddci_enabled = in radeon_atombios_parse_power_table_1_3()
2243 rdev->pm.power_state[state_index].clock_info[0].voltage.vddci_id = in radeon_atombios_parse_power_table_1_3()
2244 power_info->info_3.asPowerPlayInfo[i].ucVDDCI_VoltageDropIndex; in radeon_atombios_parse_power_table_1_3()
2247 rdev->pm.power_state[state_index].flags = RADEON_PM_STATE_SINGLE_DISPLAY_ONLY; in radeon_atombios_parse_power_table_1_3()
2256 kfree(rdev->pm.power_state[state_index].clock_info); in radeon_atombios_parse_power_table_1_3()
2257 rdev->pm.power_state[state_index].clock_info = NULL; in radeon_atombios_parse_power_table_1_3()
2261 if (state_index && rdev->pm.default_power_state_index == -1) { in radeon_atombios_parse_power_table_1_3()
2262 rdev->pm.power_state[state_index - 1].type = in radeon_atombios_parse_power_table_1_3()
2264 rdev->pm.default_power_state_index = state_index - 1; in radeon_atombios_parse_power_table_1_3()
2265 rdev->pm.power_state[state_index - 1].default_clock_mode = in radeon_atombios_parse_power_table_1_3()
2266 &rdev->pm.power_state[state_index - 1].clock_info[0]; in radeon_atombios_parse_power_table_1_3()
2267 rdev->pm.power_state[state_index - 1].flags &= in radeon_atombios_parse_power_table_1_3()
2269 rdev->pm.power_state[state_index - 1].misc = 0; in radeon_atombios_parse_power_table_1_3()
2270 rdev->pm.power_state[state_index - 1].misc2 = 0; in radeon_atombios_parse_power_table_1_3()
2281 if (controller->ucType > 0) { in radeon_atombios_add_pplib_thermal_controller()
2282 if (controller->ucFanParameters & ATOM_PP_FANPARAMETERS_NOFAN) in radeon_atombios_add_pplib_thermal_controller()
2283 rdev->pm.no_fan = true; in radeon_atombios_add_pplib_thermal_controller()
2284 rdev->pm.fan_pulses_per_revolution = in radeon_atombios_add_pplib_thermal_controller()
2285 controller->ucFanParameters & ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK; in radeon_atombios_add_pplib_thermal_controller()
2286 if (rdev->pm.fan_pulses_per_revolution) { in radeon_atombios_add_pplib_thermal_controller()
2287 rdev->pm.fan_min_rpm = controller->ucFanMinRPM; in radeon_atombios_add_pplib_thermal_controller()
2288 rdev->pm.fan_max_rpm = controller->ucFanMaxRPM; in radeon_atombios_add_pplib_thermal_controller()
2290 if (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) { in radeon_atombios_add_pplib_thermal_controller()
2292 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2294 rdev->pm.int_thermal_type = THERMAL_TYPE_RV6XX; in radeon_atombios_add_pplib_thermal_controller()
2295 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) { in radeon_atombios_add_pplib_thermal_controller()
2297 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2299 rdev->pm.int_thermal_type = THERMAL_TYPE_RV770; in radeon_atombios_add_pplib_thermal_controller()
2300 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN) { in radeon_atombios_add_pplib_thermal_controller()
2302 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2304 rdev->pm.int_thermal_type = THERMAL_TYPE_EVERGREEN; in radeon_atombios_add_pplib_thermal_controller()
2305 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_SUMO) { in radeon_atombios_add_pplib_thermal_controller()
2307 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2309 rdev->pm.int_thermal_type = THERMAL_TYPE_SUMO; in radeon_atombios_add_pplib_thermal_controller()
2310 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_NISLANDS) { in radeon_atombios_add_pplib_thermal_controller()
2312 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2314 rdev->pm.int_thermal_type = THERMAL_TYPE_NI; in radeon_atombios_add_pplib_thermal_controller()
2315 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_SISLANDS) { in radeon_atombios_add_pplib_thermal_controller()
2317 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2319 rdev->pm.int_thermal_type = THERMAL_TYPE_SI; in radeon_atombios_add_pplib_thermal_controller()
2320 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_CISLANDS) { in radeon_atombios_add_pplib_thermal_controller()
2322 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2324 rdev->pm.int_thermal_type = THERMAL_TYPE_CI; in radeon_atombios_add_pplib_thermal_controller()
2325 } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_KAVERI) { in radeon_atombios_add_pplib_thermal_controller()
2327 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2329 rdev->pm.int_thermal_type = THERMAL_TYPE_KV; in radeon_atombios_add_pplib_thermal_controller()
2330 } else if (controller->ucType == in radeon_atombios_add_pplib_thermal_controller()
2333 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2335 rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO; in radeon_atombios_add_pplib_thermal_controller()
2336 } else if (controller->ucType == in radeon_atombios_add_pplib_thermal_controller()
2339 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2341 rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL; in radeon_atombios_add_pplib_thermal_controller()
2342 } else if (controller->ucType == in radeon_atombios_add_pplib_thermal_controller()
2345 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2347 rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL; in radeon_atombios_add_pplib_thermal_controller()
2348 } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { in radeon_atombios_add_pplib_thermal_controller()
2350 pp_lib_thermal_controller_names[controller->ucType], in radeon_atombios_add_pplib_thermal_controller()
2351 controller->ucI2cAddress >> 1, in radeon_atombios_add_pplib_thermal_controller()
2352 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2354 rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL; in radeon_atombios_add_pplib_thermal_controller()
2355 i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); in radeon_atombios_add_pplib_thermal_controller()
2356 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); in radeon_atombios_add_pplib_thermal_controller()
2357 if (rdev->pm.i2c_bus) { in radeon_atombios_add_pplib_thermal_controller()
2359 const char *name = pp_lib_thermal_controller_names[controller->ucType]; in radeon_atombios_add_pplib_thermal_controller()
2360 info.addr = controller->ucI2cAddress >> 1; in radeon_atombios_add_pplib_thermal_controller()
2362 i2c_new_client_device(&rdev->pm.i2c_bus->adapter, &info); in radeon_atombios_add_pplib_thermal_controller()
2366 controller->ucType, in radeon_atombios_add_pplib_thermal_controller()
2367 controller->ucI2cAddress >> 1, in radeon_atombios_add_pplib_thermal_controller()
2368 (controller->ucFanParameters & in radeon_atombios_add_pplib_thermal_controller()
2377 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_default_voltages()
2387 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_default_voltages()
2390 (union firmware_info *)(mode_info->atom_context->bios + in radeon_atombios_get_default_voltages()
2392 *vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); in radeon_atombios_get_default_voltages()
2394 *vddci = le16_to_cpu(firmware_info->info_22.usBootUpVDDCIVoltage); in radeon_atombios_get_default_voltages()
2395 *mvdd = le16_to_cpu(firmware_info->info_22.usBootUpMVDDCVoltage); in radeon_atombios_get_default_voltages()
2405 u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); in radeon_atombios_parse_pplib_non_clock_info()
2406 u32 misc2 = le16_to_cpu(non_clock_info->usClassification); in radeon_atombios_parse_pplib_non_clock_info()
2411 rdev->pm.power_state[state_index].misc = misc; in radeon_atombios_parse_pplib_non_clock_info()
2412 rdev->pm.power_state[state_index].misc2 = misc2; in radeon_atombios_parse_pplib_non_clock_info()
2413 rdev->pm.power_state[state_index].pcie_lanes = in radeon_atombios_parse_pplib_non_clock_info()
2418 rdev->pm.power_state[state_index].type = 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()
2431 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2435 rdev->pm.power_state[state_index].flags = 0; in radeon_atombios_parse_pplib_non_clock_info()
2437 rdev->pm.power_state[state_index].flags |= in radeon_atombios_parse_pplib_non_clock_info()
2440 rdev->pm.power_state[state_index].type = in radeon_atombios_parse_pplib_non_clock_info()
2442 rdev->pm.default_power_state_index = state_index; in radeon_atombios_parse_pplib_non_clock_info()
2443 rdev->pm.power_state[state_index].default_clock_mode = in radeon_atombios_parse_pplib_non_clock_info()
2444 &rdev->pm.power_state[state_index].clock_info[mode_index - 1]; in radeon_atombios_parse_pplib_non_clock_info()
2445 if ((rdev->family >= CHIP_BARTS) && !(rdev->flags & RADEON_IS_IGP)) { in radeon_atombios_parse_pplib_non_clock_info()
2447 rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; in radeon_atombios_parse_pplib_non_clock_info()
2448 rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; in radeon_atombios_parse_pplib_non_clock_info()
2449 rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; in radeon_atombios_parse_pplib_non_clock_info()
2450 rdev->pm.default_vddci = rdev->pm.power_state[state_index].clock_info[0].voltage.vddci; in radeon_atombios_parse_pplib_non_clock_info()
2460 rdev->pm.power_state[state_index].clock_info[j].mclk = in radeon_atombios_parse_pplib_non_clock_info()
2461 rdev->clock.default_mclk; in radeon_atombios_parse_pplib_non_clock_info()
2462 rdev->pm.power_state[state_index].clock_info[j].sclk = in radeon_atombios_parse_pplib_non_clock_info()
2463 rdev->clock.default_sclk; in radeon_atombios_parse_pplib_non_clock_info()
2465 rdev->pm.power_state[state_index].clock_info[j].voltage.voltage = in radeon_atombios_parse_pplib_non_clock_info()
2468 rdev->pm.power_state[state_index].clock_info[j].voltage.vddci = in radeon_atombios_parse_pplib_non_clock_info()
2482 if (rdev->flags & RADEON_IS_IGP) { in radeon_atombios_parse_pplib_clock_info()
2483 if (rdev->family >= CHIP_PALM) { in radeon_atombios_parse_pplib_clock_info()
2484 sclk = le16_to_cpu(clock_info->sumo.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2485 sclk |= clock_info->sumo.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2486 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2488 sclk = le16_to_cpu(clock_info->rs780.usLowEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2489 sclk |= clock_info->rs780.ucLowEngineClockHigh << 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 } else if (rdev->family >= CHIP_BONAIRE) { in radeon_atombios_parse_pplib_clock_info()
2493 sclk = le16_to_cpu(clock_info->ci.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2494 sclk |= clock_info->ci.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2495 mclk = le16_to_cpu(clock_info->ci.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2496 mclk |= clock_info->ci.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2497 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2498 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2499 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2501 } else if (rdev->family >= CHIP_TAHITI) { in radeon_atombios_parse_pplib_clock_info()
2502 sclk = le16_to_cpu(clock_info->si.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2503 sclk |= clock_info->si.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2504 mclk = le16_to_cpu(clock_info->si.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2505 mclk |= clock_info->si.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2506 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2507 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2508 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2510 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = in radeon_atombios_parse_pplib_clock_info()
2511 le16_to_cpu(clock_info->si.usVDDC); in radeon_atombios_parse_pplib_clock_info()
2512 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci = in radeon_atombios_parse_pplib_clock_info()
2513 le16_to_cpu(clock_info->si.usVDDCI); in radeon_atombios_parse_pplib_clock_info()
2514 } else if (rdev->family >= CHIP_CEDAR) { in radeon_atombios_parse_pplib_clock_info()
2515 sclk = le16_to_cpu(clock_info->evergreen.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2516 sclk |= clock_info->evergreen.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2517 mclk = le16_to_cpu(clock_info->evergreen.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2518 mclk |= clock_info->evergreen.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2519 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2520 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2521 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2523 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = in radeon_atombios_parse_pplib_clock_info()
2524 le16_to_cpu(clock_info->evergreen.usVDDC); in radeon_atombios_parse_pplib_clock_info()
2525 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci = in radeon_atombios_parse_pplib_clock_info()
2526 le16_to_cpu(clock_info->evergreen.usVDDCI); in radeon_atombios_parse_pplib_clock_info()
2528 sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); in radeon_atombios_parse_pplib_clock_info()
2529 sclk |= clock_info->r600.ucEngineClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2530 mclk = le16_to_cpu(clock_info->r600.usMemoryClockLow); in radeon_atombios_parse_pplib_clock_info()
2531 mclk |= clock_info->r600.ucMemoryClockHigh << 16; in radeon_atombios_parse_pplib_clock_info()
2532 rdev->pm.power_state[state_index].clock_info[mode_index].mclk = mclk; in radeon_atombios_parse_pplib_clock_info()
2533 rdev->pm.power_state[state_index].clock_info[mode_index].sclk = sclk; in radeon_atombios_parse_pplib_clock_info()
2534 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type = in radeon_atombios_parse_pplib_clock_info()
2536 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = in radeon_atombios_parse_pplib_clock_info()
2537 le16_to_cpu(clock_info->r600.usVDDC); in radeon_atombios_parse_pplib_clock_info()
2541 switch (rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage) { in radeon_atombios_parse_pplib_clock_info()
2551 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage, in radeon_atombios_parse_pplib_clock_info()
2553 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = vddc; in radeon_atombios_parse_pplib_clock_info()
2559 if (rdev->flags & RADEON_IS_IGP) { in radeon_atombios_parse_pplib_clock_info()
2561 if (rdev->pm.power_state[state_index].clock_info[mode_index].sclk == 0) in radeon_atombios_parse_pplib_clock_info()
2565 if ((rdev->pm.power_state[state_index].clock_info[mode_index].mclk == 0) || in radeon_atombios_parse_pplib_clock_info()
2566 (rdev->pm.power_state[state_index].clock_info[mode_index].sclk == 0)) in radeon_atombios_parse_pplib_clock_info()
2574 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_parse_power_table_4_5()
2586 if (!atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_parse_power_table_4_5()
2589 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_parse_power_table_4_5()
2591 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); in radeon_atombios_parse_power_table_4_5()
2592 if (power_info->pplib.ucNumStates == 0) in radeon_atombios_parse_power_table_4_5()
2594 rdev->pm.power_state = kcalloc(power_info->pplib.ucNumStates, in radeon_atombios_parse_power_table_4_5()
2597 if (!rdev->pm.power_state) in radeon_atombios_parse_power_table_4_5()
2600 for (i = 0; i < power_info->pplib.ucNumStates; i++) { in radeon_atombios_parse_power_table_4_5()
2603 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_4_5()
2604 le16_to_cpu(power_info->pplib.usStateArrayOffset) + in radeon_atombios_parse_power_table_4_5()
2605 i * power_info->pplib.ucStateEntrySize); 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.usNonClockInfoArrayOffset) + in radeon_atombios_parse_power_table_4_5()
2609 (power_state->v1.ucNonClockStateIndex * in radeon_atombios_parse_power_table_4_5()
2610 power_info->pplib.ucNonClockSize)); in radeon_atombios_parse_power_table_4_5()
2611 rdev->pm.power_state[i].clock_info = in radeon_atombios_parse_power_table_4_5()
2612 kcalloc((power_info->pplib.ucStateEntrySize - 1) ? in radeon_atombios_parse_power_table_4_5()
2613 (power_info->pplib.ucStateEntrySize - 1) : 1, in radeon_atombios_parse_power_table_4_5()
2616 if (!rdev->pm.power_state[i].clock_info) in radeon_atombios_parse_power_table_4_5()
2618 if (power_info->pplib.ucStateEntrySize - 1) { in radeon_atombios_parse_power_table_4_5()
2619 for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) { in radeon_atombios_parse_power_table_4_5()
2621 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_4_5()
2622 le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) + in radeon_atombios_parse_power_table_4_5()
2623 (power_state->v1.ucClockStateIndices[j] * in radeon_atombios_parse_power_table_4_5()
2624 power_info->pplib.ucClockInfoSize)); in radeon_atombios_parse_power_table_4_5()
2632 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_4_5()
2633 rdev->clock.default_mclk; in radeon_atombios_parse_power_table_4_5()
2634 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_4_5()
2635 rdev->clock.default_sclk; in radeon_atombios_parse_power_table_4_5()
2638 rdev->pm.power_state[state_index].num_clock_modes = mode_index; in radeon_atombios_parse_power_table_4_5()
2647 if (rdev->pm.power_state[i].num_clock_modes > 1) in radeon_atombios_parse_power_table_4_5()
2648 rdev->pm.power_state[i].clock_info[0].flags |= in radeon_atombios_parse_power_table_4_5()
2652 if (rdev->pm.default_power_state_index == -1) { in radeon_atombios_parse_power_table_4_5()
2653 rdev->pm.power_state[0].type = in radeon_atombios_parse_power_table_4_5()
2655 rdev->pm.default_power_state_index = 0; in radeon_atombios_parse_power_table_4_5()
2656 rdev->pm.power_state[0].default_clock_mode = in radeon_atombios_parse_power_table_4_5()
2657 &rdev->pm.power_state[0].clock_info[0]; in radeon_atombios_parse_power_table_4_5()
2664 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_parse_power_table_6()
2680 if (!atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_parse_power_table_6()
2683 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); in radeon_atombios_parse_power_table_6()
2685 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); in radeon_atombios_parse_power_table_6()
2687 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_6()
2688 le16_to_cpu(power_info->pplib.usStateArrayOffset)); in radeon_atombios_parse_power_table_6()
2690 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_6()
2691 le16_to_cpu(power_info->pplib.usClockInfoArrayOffset)); in radeon_atombios_parse_power_table_6()
2693 (mode_info->atom_context->bios + data_offset + in radeon_atombios_parse_power_table_6()
2694 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); in radeon_atombios_parse_power_table_6()
2695 if (state_array->ucNumEntries == 0) in radeon_atombios_parse_power_table_6()
2697 rdev->pm.power_state = kcalloc(state_array->ucNumEntries, in radeon_atombios_parse_power_table_6()
2700 if (!rdev->pm.power_state) in radeon_atombios_parse_power_table_6()
2702 power_state_offset = (u8 *)state_array->states; in radeon_atombios_parse_power_table_6()
2703 for (i = 0; i < state_array->ucNumEntries; i++) { in radeon_atombios_parse_power_table_6()
2706 non_clock_array_index = power_state->v2.nonClockInfoIndex; in radeon_atombios_parse_power_table_6()
2708 &non_clock_info_array->nonClockInfo[non_clock_array_index]; in radeon_atombios_parse_power_table_6()
2709 rdev->pm.power_state[i].clock_info = in radeon_atombios_parse_power_table_6()
2710 kcalloc(power_state->v2.ucNumDPMLevels ? in radeon_atombios_parse_power_table_6()
2711 power_state->v2.ucNumDPMLevels : 1, in radeon_atombios_parse_power_table_6()
2714 if (!rdev->pm.power_state[i].clock_info) in radeon_atombios_parse_power_table_6()
2716 if (power_state->v2.ucNumDPMLevels) { in radeon_atombios_parse_power_table_6()
2717 for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { in radeon_atombios_parse_power_table_6()
2718 clock_array_index = power_state->v2.clockInfoIndex[j]; in radeon_atombios_parse_power_table_6()
2720 &clock_info_array->clockInfo[clock_array_index * clock_info_array->ucEntrySize]; in radeon_atombios_parse_power_table_6()
2728 rdev->pm.power_state[state_index].clock_info[0].mclk = in radeon_atombios_parse_power_table_6()
2729 rdev->clock.default_mclk; in radeon_atombios_parse_power_table_6()
2730 rdev->pm.power_state[state_index].clock_info[0].sclk = in radeon_atombios_parse_power_table_6()
2731 rdev->clock.default_sclk; in radeon_atombios_parse_power_table_6()
2734 rdev->pm.power_state[state_index].num_clock_modes = mode_index; in radeon_atombios_parse_power_table_6()
2740 power_state_offset += 2 + power_state->v2.ucNumDPMLevels; in radeon_atombios_parse_power_table_6()
2744 if (rdev->pm.power_state[i].num_clock_modes > 1) in radeon_atombios_parse_power_table_6()
2745 rdev->pm.power_state[i].clock_info[0].flags |= in radeon_atombios_parse_power_table_6()
2749 if (rdev->pm.default_power_state_index == -1) { in radeon_atombios_parse_power_table_6()
2750 rdev->pm.power_state[0].type = in radeon_atombios_parse_power_table_6()
2752 rdev->pm.default_power_state_index = 0; in radeon_atombios_parse_power_table_6()
2753 rdev->pm.power_state[0].default_clock_mode = in radeon_atombios_parse_power_table_6()
2754 &rdev->pm.power_state[0].clock_info[0]; in radeon_atombios_parse_power_table_6()
2761 struct radeon_mode_info *mode_info = &rdev->mode_info; in radeon_atombios_get_power_modes()
2767 rdev->pm.default_power_state_index = -1; in radeon_atombios_get_power_modes()
2769 if (atom_parse_data_header(mode_info->atom_context, index, NULL, in radeon_atombios_get_power_modes()
2790 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); in radeon_atombios_get_power_modes()
2791 if (rdev->pm.power_state) { in radeon_atombios_get_power_modes()
2792 rdev->pm.power_state[0].clock_info = in radeon_atombios_get_power_modes()
2796 if (rdev->pm.power_state[0].clock_info) { in radeon_atombios_get_power_modes()
2798 rdev->pm.power_state[state_index].type = in radeon_atombios_get_power_modes()
2800 rdev->pm.power_state[state_index].num_clock_modes = 1; in radeon_atombios_get_power_modes()
2801 rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; in radeon_atombios_get_power_modes()
2802 rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; in radeon_atombios_get_power_modes()
2803 rdev->pm.power_state[state_index].default_clock_mode = in radeon_atombios_get_power_modes()
2804 &rdev->pm.power_state[state_index].clock_info[0]; in radeon_atombios_get_power_modes()
2805 rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; in radeon_atombios_get_power_modes()
2806 rdev->pm.power_state[state_index].pcie_lanes = 16; in radeon_atombios_get_power_modes()
2807 rdev->pm.default_power_state_index = state_index; in radeon_atombios_get_power_modes()
2808 rdev->pm.power_state[state_index].flags = 0; in radeon_atombios_get_power_modes()
2814 rdev->pm.num_power_states = state_index; in radeon_atombios_get_power_modes()
2816 rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; in radeon_atombios_get_power_modes()
2817 rdev->pm.current_clock_mode_index = 0; in radeon_atombios_get_power_modes()
2818 if (rdev->pm.default_power_state_index >= 0) in radeon_atombios_get_power_modes()
2819 rdev->pm.current_vddc = in radeon_atombios_get_power_modes()
2820 rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; in radeon_atombios_get_power_modes()
2822 rdev->pm.current_vddc = 0; in radeon_atombios_get_power_modes()
2848 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_clock_dividers()
2849 return -EINVAL; in radeon_atom_get_clock_dividers()
2857 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_clock_dividers()
2859 dividers->post_div = args.v1.ucPostDiv; in radeon_atom_get_clock_dividers()
2860 dividers->fb_div = args.v1.ucFbDiv; in radeon_atom_get_clock_dividers()
2861 dividers->enable_post_div = true; in radeon_atom_get_clock_dividers()
2867 if (rdev->family <= CHIP_RV770) { in radeon_atom_get_clock_dividers()
2871 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_clock_dividers()
2873 dividers->post_div = args.v2.ucPostDiv; in radeon_atom_get_clock_dividers()
2874 dividers->fb_div = le16_to_cpu(args.v2.usFbDiv); in radeon_atom_get_clock_dividers()
2875 dividers->ref_div = args.v2.ucAction; in radeon_atom_get_clock_dividers()
2876 if (rdev->family == CHIP_RV770) { in radeon_atom_get_clock_dividers()
2877 dividers->enable_post_div = (le32_to_cpu(args.v2.ulClock) & (1 << 24)) ? in radeon_atom_get_clock_dividers()
2879 dividers->vco_mode = (le32_to_cpu(args.v2.ulClock) & (1 << 25)) ? 1 : 0; in radeon_atom_get_clock_dividers()
2881 dividers->enable_post_div = (dividers->fb_div & 1) ? true : false; in radeon_atom_get_clock_dividers()
2886 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_clock_dividers()
2888 dividers->post_div = args.v3.ucPostDiv; in radeon_atom_get_clock_dividers()
2889 dividers->enable_post_div = (args.v3.ucCntlFlag & in radeon_atom_get_clock_dividers()
2891 dividers->enable_dithen = (args.v3.ucCntlFlag & in radeon_atom_get_clock_dividers()
2893 dividers->whole_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); in radeon_atom_get_clock_dividers()
2894 dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); in radeon_atom_get_clock_dividers()
2895 dividers->ref_div = args.v3.ucRefDiv; in radeon_atom_get_clock_dividers()
2896 dividers->vco_mode = (args.v3.ucCntlFlag & in radeon_atom_get_clock_dividers()
2900 if (rdev->family >= CHIP_TAHITI) in radeon_atom_get_clock_dividers()
2901 return -EINVAL; in radeon_atom_get_clock_dividers()
2906 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_clock_dividers()
2908 dividers->post_div = args.v5.ucPostDiv; in radeon_atom_get_clock_dividers()
2909 dividers->enable_post_div = (args.v5.ucCntlFlag & in radeon_atom_get_clock_dividers()
2911 dividers->enable_dithen = (args.v5.ucCntlFlag & in radeon_atom_get_clock_dividers()
2913 dividers->whole_fb_div = le16_to_cpu(args.v5.ulFbDiv.usFbDiv); in radeon_atom_get_clock_dividers()
2914 dividers->frac_fb_div = le16_to_cpu(args.v5.ulFbDiv.usFbDivFrac); in radeon_atom_get_clock_dividers()
2915 dividers->ref_div = args.v5.ucRefDiv; in radeon_atom_get_clock_dividers()
2916 dividers->vco_mode = (args.v5.ucCntlFlag & in radeon_atom_get_clock_dividers()
2925 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_clock_dividers()
2927 dividers->post_divider = dividers->post_div = args.v4.ucPostDiv; in radeon_atom_get_clock_dividers()
2928 dividers->real_clock = le32_to_cpu(args.v4.ulClock); in radeon_atom_get_clock_dividers()
2936 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_clock_dividers()
2938 dividers->whole_fb_div = le16_to_cpu(args.v6_out.ulFbDiv.usFbDiv); in radeon_atom_get_clock_dividers()
2939 dividers->frac_fb_div = le16_to_cpu(args.v6_out.ulFbDiv.usFbDivFrac); in radeon_atom_get_clock_dividers()
2940 dividers->ref_div = args.v6_out.ucPllRefDiv; in radeon_atom_get_clock_dividers()
2941 dividers->post_div = args.v6_out.ucPllPostDiv; in radeon_atom_get_clock_dividers()
2942 dividers->flags = args.v6_out.ucPllCntlFlag; in radeon_atom_get_clock_dividers()
2943 dividers->real_clock = le32_to_cpu(args.v6_out.ulClock.ulClock); in radeon_atom_get_clock_dividers()
2944 dividers->post_divider = args.v6_out.ulClock.ucPostDiv; in radeon_atom_get_clock_dividers()
2947 return -EINVAL; in radeon_atom_get_clock_dividers()
2964 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_memory_pll_dividers()
2965 return -EINVAL; in radeon_atom_get_memory_pll_dividers()
2977 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_memory_pll_dividers()
2979 mpll_param->clkfrac = le16_to_cpu(args.ulFbDiv.usFbDivFrac); in radeon_atom_get_memory_pll_dividers()
2980 mpll_param->clkf = le16_to_cpu(args.ulFbDiv.usFbDiv); in radeon_atom_get_memory_pll_dividers()
2981 mpll_param->post_div = args.ucPostDiv; in radeon_atom_get_memory_pll_dividers()
2982 mpll_param->dll_speed = args.ucDllSpeed; in radeon_atom_get_memory_pll_dividers()
2983 mpll_param->bwcntl = args.ucBWCntl; in radeon_atom_get_memory_pll_dividers()
2984 mpll_param->vco_mode = in radeon_atom_get_memory_pll_dividers()
2986 mpll_param->yclk_sel = in radeon_atom_get_memory_pll_dividers()
2988 mpll_param->qdr = in radeon_atom_get_memory_pll_dividers()
2990 mpll_param->half_rate = in radeon_atom_get_memory_pll_dividers()
2994 return -EINVAL; in radeon_atom_get_memory_pll_dividers()
2998 return -EINVAL; in radeon_atom_get_memory_pll_dividers()
3010 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_set_clock_gating()
3018 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_engine_clock()
3027 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_memory_clock()
3039 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_set_engine_clock()
3048 if (rdev->flags & RADEON_IS_IGP) in radeon_atom_set_memory_clock()
3053 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_set_memory_clock()
3072 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_set_engine_dram_timings()
3083 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_update_memory_dll()
3095 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_set_ac_timing()
3111 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_set_voltage()
3139 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_set_voltage()
3149 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_max_vddc()
3150 return -EINVAL; in radeon_atom_get_max_vddc()
3154 return -EINVAL; in radeon_atom_get_max_vddc()
3160 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_max_vddc()
3169 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_max_vddc()
3175 return -EINVAL; in radeon_atom_get_max_vddc()
3195 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_leakage_id_from_vbios()
3196 return -EINVAL; in radeon_atom_get_leakage_id_from_vbios()
3205 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_leakage_id_from_vbios()
3211 return -EINVAL; in radeon_atom_get_leakage_id_from_vbios()
3232 if (!atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3234 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3237 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3241 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3246 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3248 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3249 le16_to_cpu(profile->usLeakageBinArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3251 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3252 le16_to_cpu(profile->usElbVDDC_IdArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3254 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3255 le16_to_cpu(profile->usElbVDDC_LevelArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3257 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3258 le16_to_cpu(profile->usElbVDDCI_IdArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3260 (rdev->mode_info.atom_context->bios + data_offset + in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3261 le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset)); in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3263 if (profile->ucElbVDDC_Num > 0) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3264 for (i = 0; i < profile->ucElbVDDC_Num; i++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3266 for (j = 0; j < profile->ucLeakageBinNum; j++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3268 *vddc = vddc_buf[j * profile->ucElbVDDC_Num + i]; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3276 if (profile->ucElbVDDCI_Num > 0) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3277 for (i = 0; i < profile->ucElbVDDCI_Num; i++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3279 for (j = 0; j < profile->ucLeakageBinNum; j++) { in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3281 *vddci = vddci_buf[j * profile->ucElbVDDCI_Num + i]; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3292 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3297 return -EINVAL; in radeon_atom_get_leakage_vddc_based_on_leakage_params()
3314 u32 count = rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count; in radeon_atom_get_voltage_evv()
3318 if (rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].v == in radeon_atom_get_voltage_evv()
3324 return -EINVAL; in radeon_atom_get_voltage_evv()
3330 cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk); in radeon_atom_get_voltage_evv()
3332 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_voltage_evv()
3347 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) in radeon_atom_get_voltage_gpio_settings()
3348 return -EINVAL; in radeon_atom_get_voltage_gpio_settings()
3352 return -EINVAL; in radeon_atom_get_voltage_gpio_settings()
3358 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_voltage_gpio_settings()
3366 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in radeon_atom_get_voltage_gpio_settings()
3372 return -EINVAL; in radeon_atom_get_voltage_gpio_settings()
3393 u32 size = le16_to_cpu(v1->sHeader.usStructureSize); in atom_lookup_voltage_object_v1()
3399 if (vo->ucVoltageType == voltage_type) in atom_lookup_voltage_object_v1()
3402 vo->asFormula.ucNumOfVoltageEntries; in atom_lookup_voltage_object_v1()
3410 u32 size = le16_to_cpu(v2->sHeader.usStructureSize); in atom_lookup_voltage_object_v2()
3416 if (vo->ucVoltageType == voltage_type) in atom_lookup_voltage_object_v2()
3419 (vo->asFormula.ucNumOfVoltageEntries * sizeof(VOLTAGE_LUT_ENTRY)); in atom_lookup_voltage_object_v2()
3427 u32 size = le16_to_cpu(v3->sHeader.usStructureSize); in atom_lookup_voltage_object_v3()
3433 if ((vo->asGpioVoltageObj.sHeader.ucVoltageType == voltage_type) && in atom_lookup_voltage_object_v3()
3434 (vo->asGpioVoltageObj.sHeader.ucVoltageMode == voltage_mode)) in atom_lookup_voltage_object_v3()
3436 offset += le16_to_cpu(vo->asGpioVoltageObj.sHeader.usSize); in atom_lookup_voltage_object_v3()
3451 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_is_voltage_gpio()
3454 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_is_voltage_gpio()
3462 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_is_voltage_gpio()
3464 (voltage_object->v1.asControl.ucVoltageControlId == VOLTAGE_CONTROLLED_BY_GPIO)) in radeon_atom_is_voltage_gpio()
3469 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_is_voltage_gpio()
3471 (voltage_object->v2.asControl.ucVoltageControlId == VOLTAGE_CONTROLLED_BY_GPIO)) in radeon_atom_is_voltage_gpio()
3482 if (atom_lookup_voltage_object_v3(&voltage_info->v3, in radeon_atom_is_voltage_gpio()
3510 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_svi2_info()
3513 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_svi2_info()
3520 atom_lookup_voltage_object_v3(&voltage_info->v3, in radeon_atom_get_svi2_info()
3524 *svd_gpio_id = voltage_object->v3.asSVID2Obj.ucSVDGpioId; in radeon_atom_get_svi2_info()
3525 *svc_gpio_id = voltage_object->v3.asSVID2Obj.ucSVCGpioId; in radeon_atom_get_svi2_info()
3527 return -EINVAL; in radeon_atom_get_svi2_info()
3532 return -EINVAL; in radeon_atom_get_svi2_info()
3537 return -EINVAL; in radeon_atom_get_svi2_info()
3553 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_max_voltage()
3556 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_max_voltage()
3561 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_get_max_voltage()
3564 &voltage_object->v1.asFormula; in radeon_atom_get_max_voltage()
3565 if (formula->ucFlag & 1) in radeon_atom_get_max_voltage()
3567 le16_to_cpu(formula->usVoltageBaseLevel) + in radeon_atom_get_max_voltage()
3568 formula->ucNumOfVoltageEntries / 2 * in radeon_atom_get_max_voltage()
3569 le16_to_cpu(formula->usVoltageStep); in radeon_atom_get_max_voltage()
3572 le16_to_cpu(formula->usVoltageBaseLevel) + in radeon_atom_get_max_voltage()
3573 (formula->ucNumOfVoltageEntries - 1) * in radeon_atom_get_max_voltage()
3574 le16_to_cpu(formula->usVoltageStep); in radeon_atom_get_max_voltage()
3580 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_get_max_voltage()
3583 &voltage_object->v2.asFormula; in radeon_atom_get_max_voltage()
3584 if (formula->ucNumOfVoltageEntries) { in radeon_atom_get_max_voltage()
3586 ((u8 *)&formula->asVIDAdjustEntries[0] + in radeon_atom_get_max_voltage()
3587 (sizeof(VOLTAGE_LUT_ENTRY) * (formula->ucNumOfVoltageEntries - 1))); in radeon_atom_get_max_voltage()
3589 le16_to_cpu(lut->usVoltageValue); in radeon_atom_get_max_voltage()
3596 return -EINVAL; in radeon_atom_get_max_voltage()
3600 return -EINVAL; in radeon_atom_get_max_voltage()
3612 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_min_voltage()
3615 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_min_voltage()
3620 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_get_min_voltage()
3623 &voltage_object->v1.asFormula; in radeon_atom_get_min_voltage()
3625 le16_to_cpu(formula->usVoltageBaseLevel); in radeon_atom_get_min_voltage()
3631 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_get_min_voltage()
3634 &voltage_object->v2.asFormula; in radeon_atom_get_min_voltage()
3635 if (formula->ucNumOfVoltageEntries) { in radeon_atom_get_min_voltage()
3637 le16_to_cpu(formula->asVIDAdjustEntries[ in radeon_atom_get_min_voltage()
3646 return -EINVAL; in radeon_atom_get_min_voltage()
3650 return -EINVAL; in radeon_atom_get_min_voltage()
3662 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_voltage_step()
3665 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_voltage_step()
3670 atom_lookup_voltage_object_v1(&voltage_info->v1, voltage_type); in radeon_atom_get_voltage_step()
3673 &voltage_object->v1.asFormula; in radeon_atom_get_voltage_step()
3674 if (formula->ucFlag & 1) in radeon_atom_get_voltage_step()
3676 (le16_to_cpu(formula->usVoltageStep) + 1) / 2; in radeon_atom_get_voltage_step()
3679 le16_to_cpu(formula->usVoltageStep); in radeon_atom_get_voltage_step()
3684 return -EINVAL; in radeon_atom_get_voltage_step()
3687 return -EINVAL; in radeon_atom_get_voltage_step()
3691 return -EINVAL; in radeon_atom_get_voltage_step()
3702 return -EINVAL; in radeon_atom_round_to_true_voltage()
3704 return -EINVAL; in radeon_atom_round_to_true_voltage()
3706 return -EINVAL; in radeon_atom_round_to_true_voltage()
3714 ((nominal_voltage - min_voltage) / voltage_step) * in radeon_atom_round_to_true_voltage()
3731 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_voltage_table()
3734 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_voltage_table()
3742 return -EINVAL; in radeon_atom_get_voltage_table()
3745 atom_lookup_voltage_object_v2(&voltage_info->v2, voltage_type); in radeon_atom_get_voltage_table()
3748 &voltage_object->v2.asFormula; in radeon_atom_get_voltage_table()
3750 if (formula->ucNumOfVoltageEntries > MAX_VOLTAGE_ENTRIES) in radeon_atom_get_voltage_table()
3751 return -EINVAL; in radeon_atom_get_voltage_table()
3752 lut = &formula->asVIDAdjustEntries[0]; in radeon_atom_get_voltage_table()
3753 for (i = 0; i < formula->ucNumOfVoltageEntries; i++) { in radeon_atom_get_voltage_table()
3754 voltage_table->entries[i].value = in radeon_atom_get_voltage_table()
3755 le16_to_cpu(lut->usVoltageValue); in radeon_atom_get_voltage_table()
3757 voltage_table->entries[i].value, in radeon_atom_get_voltage_table()
3759 &voltage_table->entries[i].smio_low, in radeon_atom_get_voltage_table()
3760 &voltage_table->mask_low); in radeon_atom_get_voltage_table()
3766 voltage_table->count = formula->ucNumOfVoltageEntries; in radeon_atom_get_voltage_table()
3772 return -EINVAL; in radeon_atom_get_voltage_table()
3779 atom_lookup_voltage_object_v3(&voltage_info->v3, in radeon_atom_get_voltage_table()
3783 &voltage_object->v3.asGpioVoltageObj; in radeon_atom_get_voltage_table()
3785 if (gpio->ucGpioEntryNum > MAX_VOLTAGE_ENTRIES) in radeon_atom_get_voltage_table()
3786 return -EINVAL; in radeon_atom_get_voltage_table()
3787 lut = &gpio->asVolGpioLut[0]; in radeon_atom_get_voltage_table()
3788 for (i = 0; i < gpio->ucGpioEntryNum; i++) { in radeon_atom_get_voltage_table()
3789 voltage_table->entries[i].value = in radeon_atom_get_voltage_table()
3790 le16_to_cpu(lut->usVoltageValue); in radeon_atom_get_voltage_table()
3791 voltage_table->entries[i].smio_low = in radeon_atom_get_voltage_table()
3792 le32_to_cpu(lut->ulVoltageId); in radeon_atom_get_voltage_table()
3796 voltage_table->mask_low = le32_to_cpu(gpio->ulGpioMaskVal); in radeon_atom_get_voltage_table()
3797 voltage_table->count = gpio->ucGpioEntryNum; in radeon_atom_get_voltage_table()
3798 voltage_table->phase_delay = gpio->ucPhaseDelay; in radeon_atom_get_voltage_table()
3804 return -EINVAL; in radeon_atom_get_voltage_table()
3809 return -EINVAL; in radeon_atom_get_voltage_table()
3812 return -EINVAL; in radeon_atom_get_voltage_table()
3831 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_memory_info()
3834 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_memory_info()
3840 if (module_index < vram_info->v1_3.ucNumOfVRAMModule) { in radeon_atom_get_memory_info()
3842 (ATOM_VRAM_MODULE_V3 *)vram_info->v1_3.aVramInfo; in radeon_atom_get_memory_info()
3845 if (le16_to_cpu(vram_module->usSize) == 0) in radeon_atom_get_memory_info()
3846 return -EINVAL; in radeon_atom_get_memory_info()
3848 ((u8 *)vram_module + le16_to_cpu(vram_module->usSize)); in radeon_atom_get_memory_info()
3850 mem_info->mem_vendor = vram_module->asMemory.ucMemoryVenderID & 0xf; in radeon_atom_get_memory_info()
3851 mem_info->mem_type = vram_module->asMemory.ucMemoryType & 0xf0; in radeon_atom_get_memory_info()
3853 return -EINVAL; in radeon_atom_get_memory_info()
3857 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) { in radeon_atom_get_memory_info()
3859 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo; in radeon_atom_get_memory_info()
3862 if (le16_to_cpu(vram_module->usModuleSize) == 0) in radeon_atom_get_memory_info()
3863 return -EINVAL; in radeon_atom_get_memory_info()
3865 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize)); in radeon_atom_get_memory_info()
3867 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf; in radeon_atom_get_memory_info()
3868 mem_info->mem_type = vram_module->ucMemoryType & 0xf0; in radeon_atom_get_memory_info()
3870 return -EINVAL; in radeon_atom_get_memory_info()
3874 return -EINVAL; in radeon_atom_get_memory_info()
3881 if (module_index < vram_info->v2_1.ucNumOfVRAMModule) { in radeon_atom_get_memory_info()
3883 (ATOM_VRAM_MODULE_V7 *)vram_info->v2_1.aVramInfo; in radeon_atom_get_memory_info()
3886 if (le16_to_cpu(vram_module->usModuleSize) == 0) in radeon_atom_get_memory_info()
3887 return -EINVAL; in radeon_atom_get_memory_info()
3889 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize)); in radeon_atom_get_memory_info()
3891 mem_info->mem_vendor = vram_module->ucMemoryVenderID & 0xf; in radeon_atom_get_memory_info()
3892 mem_info->mem_type = vram_module->ucMemoryType & 0xf0; in radeon_atom_get_memory_info()
3894 return -EINVAL; in radeon_atom_get_memory_info()
3898 return -EINVAL; in radeon_atom_get_memory_info()
3903 return -EINVAL; in radeon_atom_get_memory_info()
3907 return -EINVAL; in radeon_atom_get_memory_info()
3923 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_get_mclk_range_table()
3926 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_get_mclk_range_table()
3932 return -EINVAL; in radeon_atom_get_mclk_range_table()
3935 if (module_index < vram_info->v1_4.ucNumOfVRAMModule) { in radeon_atom_get_mclk_range_table()
3937 (ATOM_VRAM_MODULE_V4 *)vram_info->v1_4.aVramInfo; in radeon_atom_get_mclk_range_table()
3941 if (le16_to_cpu(vram_module->usModuleSize) == 0) in radeon_atom_get_mclk_range_table()
3942 return -EINVAL; in radeon_atom_get_mclk_range_table()
3944 ((u8 *)vram_module + le16_to_cpu(vram_module->usModuleSize)); in radeon_atom_get_mclk_range_table()
3946 mclk_range_table->num_entries = (u8) in radeon_atom_get_mclk_range_table()
3947 ((le16_to_cpu(vram_module->usModuleSize) - offsetof(ATOM_VRAM_MODULE_V4, asMemTiming)) / in radeon_atom_get_mclk_range_table()
3949 format = &vram_module->asMemTiming[0]; in radeon_atom_get_mclk_range_table()
3950 for (i = 0; i < mclk_range_table->num_entries; i++) { in radeon_atom_get_mclk_range_table()
3951 mclk_range_table->mclk[i] = le32_to_cpu(format->ulClkRange); in radeon_atom_get_mclk_range_table()
3956 return -EINVAL; in radeon_atom_get_mclk_range_table()
3960 return -EINVAL; in radeon_atom_get_mclk_range_table()
3965 return -EINVAL; in radeon_atom_get_mclk_range_table()
3968 return -EINVAL; in radeon_atom_get_mclk_range_table()
3972 return -EINVAL; in radeon_atom_get_mclk_range_table()
3995 if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, in radeon_atom_init_mc_reg_table()
3998 (rdev->mode_info.atom_context->bios + data_offset); in radeon_atom_init_mc_reg_table()
4002 return -EINVAL; in radeon_atom_init_mc_reg_table()
4006 if (module_index < vram_info->v2_1.ucNumOfVRAMModule) { in radeon_atom_init_mc_reg_table()
4009 ((u8 *)vram_info + le16_to_cpu(vram_info->v2_1.usMemClkPatchTblOffset)); in radeon_atom_init_mc_reg_table()
4013 le16_to_cpu(reg_block->usRegIndexTblSize)); in radeon_atom_init_mc_reg_table()
4014 ATOM_INIT_REG_INDEX_FORMAT *format = ®_block->asRegIndexBuf[0]; in radeon_atom_init_mc_reg_table()
4015 num_entries = (u8)((le16_to_cpu(reg_block->usRegIndexTblSize)) / in radeon_atom_init_mc_reg_table()
4016 sizeof(ATOM_INIT_REG_INDEX_FORMAT)) - 1; in radeon_atom_init_mc_reg_table()
4018 return -EINVAL; in radeon_atom_init_mc_reg_table()
4020 if (format->ucPreRegDataLength & ACCESS_PLACEHOLDER) in radeon_atom_init_mc_reg_table()
4022 reg_table->mc_reg_address[i].s1 = in radeon_atom_init_mc_reg_table()
4023 (u16)(le16_to_cpu(format->usRegIndex)); in radeon_atom_init_mc_reg_table()
4024 reg_table->mc_reg_address[i].pre_reg_data = in radeon_atom_init_mc_reg_table()
4025 (u8)(format->ucPreRegDataLength); in radeon_atom_init_mc_reg_table()
4030 reg_table->last = i; in radeon_atom_init_mc_reg_table()
4036 reg_table->mc_reg_table_entry[num_ranges].mclk_max = in radeon_atom_init_mc_reg_table()
4039 for (i = 0, j = 1; i < reg_table->last; i++) { in radeon_atom_init_mc_reg_table()
4040 if ((reg_table->mc_reg_address[i].pre_reg_data & LOW_NIBBLE_MASK) == DATA_FROM_TABLE) { in radeon_atom_init_mc_reg_table()
4041 reg_table->mc_reg_table_entry[num_ranges].mc_data[i] = in radeon_atom_init_mc_reg_table()
4044 } else if ((reg_table->mc_reg_address[i].pre_reg_data & LOW_NIBBLE_MASK) == DATA_EQU_PREV) { 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()
4046 reg_table->mc_reg_table_entry[num_ranges].mc_data[i - 1]; in radeon_atom_init_mc_reg_table()
4052 ((u8 *)reg_data + le16_to_cpu(reg_block->usRegDataBlkSize)); in radeon_atom_init_mc_reg_table()
4055 return -EINVAL; in radeon_atom_init_mc_reg_table()
4056 reg_table->num_entries = num_ranges; in radeon_atom_init_mc_reg_table()
4058 return -EINVAL; in radeon_atom_init_mc_reg_table()
4062 return -EINVAL; in radeon_atom_init_mc_reg_table()
4067 return -EINVAL; in radeon_atom_init_mc_reg_table()
4071 return -EINVAL; in radeon_atom_init_mc_reg_table()
4076 struct radeon_device *rdev = dev->dev_private; in radeon_atom_initialize_bios_scratch_regs()
4079 if (rdev->family >= CHIP_R600) { in radeon_atom_initialize_bios_scratch_regs()
4097 if (rdev->family >= CHIP_R600) { in radeon_atom_initialize_bios_scratch_regs()
4112 if (rdev->family >= CHIP_R600) in radeon_save_bios_scratch_regs()
4118 rdev->bios_scratch[i] = RREG32(scratch_reg + (i * 4)); in radeon_save_bios_scratch_regs()
4126 if (rdev->family >= CHIP_R600) in radeon_restore_bios_scratch_regs()
4132 WREG32(scratch_reg + (i * 4), rdev->bios_scratch[i]); in radeon_restore_bios_scratch_regs()
4137 struct drm_device *dev = encoder->dev; in radeon_atom_output_lock()
4138 struct radeon_device *rdev = dev->dev_private; in radeon_atom_output_lock()
4141 if (rdev->family >= CHIP_R600) in radeon_atom_output_lock()
4154 if (rdev->family >= CHIP_R600) in radeon_atom_output_lock()
4166 struct drm_device *dev = connector->dev; in radeon_atombios_connected_scratch_regs()
4167 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_connected_scratch_regs()
4173 if (rdev->family >= CHIP_R600) { in radeon_atombios_connected_scratch_regs()
4183 if ((radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4184 (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4196 if ((radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4197 (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4209 if ((radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4210 (radeon_connector->devices & ATOM_DEVICE_LCD1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4223 if ((radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4224 (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4237 if ((radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4238 (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4251 if ((radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4252 (radeon_connector->devices & ATOM_DEVICE_DFP1_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4265 if ((radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4266 (radeon_connector->devices & ATOM_DEVICE_DFP2_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4279 if ((radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4280 (radeon_connector->devices & ATOM_DEVICE_DFP3_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4293 if ((radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4294 (radeon_connector->devices & ATOM_DEVICE_DFP4_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4307 if ((radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4308 (radeon_connector->devices & ATOM_DEVICE_DFP5_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4321 if ((radeon_encoder->devices & ATOM_DEVICE_DFP6_SUPPORT) && in radeon_atombios_connected_scratch_regs()
4322 (radeon_connector->devices & ATOM_DEVICE_DFP6_SUPPORT)) { in radeon_atombios_connected_scratch_regs()
4336 if (rdev->family >= CHIP_R600) { in radeon_atombios_connected_scratch_regs()
4350 struct drm_device *dev = encoder->dev; in radeon_atombios_encoder_crtc_scratch_regs()
4351 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_encoder_crtc_scratch_regs()
4358 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_crtc_scratch_regs()
4363 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4367 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4371 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4375 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4379 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4383 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4387 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4391 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) { in radeon_atombios_encoder_crtc_scratch_regs()
4396 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_crtc_scratch_regs()
4405 struct drm_device *dev = encoder->dev; in radeon_atombios_encoder_dpms_scratch_regs()
4406 struct radeon_device *rdev = dev->dev_private; in radeon_atombios_encoder_dpms_scratch_regs()
4413 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_dpms_scratch_regs()
4418 if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4424 if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4430 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4436 if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4442 if (radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4448 if (radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4454 if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4460 if (radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4466 if (radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4472 if (radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) { in radeon_atombios_encoder_dpms_scratch_regs()
4479 if (rdev->family >= CHIP_R600) in radeon_atombios_encoder_dpms_scratch_regs()