61 u16 voltage_id,
u16 *voltage);
131 i2c.hw_capable =
true;
133 i2c.hw_capable =
false;
142 if (i2c.mask_clk_reg)
170 for (i = 0; i < num_indices; i++) {
173 radeon_lookup_i2c_gpio_quirks(rdev, gpio, i);
176 i2c = radeon_get_bus_rec_for_i2c_gpio(gpio);
202 for (i = 0; i < num_indices; i++) {
205 radeon_lookup_i2c_gpio_quirks(rdev, gpio, i);
207 i2c = radeon_get_bus_rec_for_i2c_gpio(gpio);
220 struct atom_context *ctx = rdev->mode_info.atom_context;
237 for (i = 0; i < num_indices; i++) {
268 if (gpio->reg == reg) {
306 if ((dev->pdev->device == 0x791e) &&
307 (dev->pdev->subsystem_vendor == 0x1043) &&
308 (dev->pdev->subsystem_device == 0x826d)) {
315 if ((dev->pdev->device == 0x7941) &&
316 (dev->pdev->subsystem_vendor == 0x1849) &&
317 (dev->pdev->subsystem_device == 0x7941)) {
324 if ((dev->pdev->device == 0x796e) &&
325 (dev->pdev->subsystem_vendor == 0x1462) &&
326 (dev->pdev->subsystem_device == 0x7302)) {
333 if ((dev->pdev->device == 0x7941) &&
334 (dev->pdev->subsystem_vendor == 0x147b) &&
335 (dev->pdev->subsystem_device == 0x2412)) {
341 if ((dev->pdev->device == 0x5653) &&
342 (dev->pdev->subsystem_vendor == 0x1462) &&
343 (dev->pdev->subsystem_device == 0x0291)) {
345 i2c_bus->
valid =
false;
351 if ((dev->pdev->device == 0x7146) &&
352 (dev->pdev->subsystem_vendor == 0x17af) &&
353 (dev->pdev->subsystem_device == 0x2058)) {
359 if ((dev->pdev->device == 0x7142) &&
360 (dev->pdev->subsystem_vendor == 0x1458) &&
361 (dev->pdev->subsystem_device == 0x2134)) {
368 if ((dev->pdev->device == 0x71C5) &&
369 (dev->pdev->subsystem_vendor == 0x106b) &&
370 (dev->pdev->subsystem_device == 0x0080)) {
386 if ((dev->pdev->device == 0x9598) &&
387 (dev->pdev->subsystem_vendor == 0x1043) &&
388 (dev->pdev->subsystem_device == 0x01da)) {
395 if ((dev->pdev->device == 0x9598) &&
396 (dev->pdev->subsystem_vendor == 0x1043) &&
397 (dev->pdev->subsystem_device == 0x01e4)) {
404 if ((dev->pdev->device == 0x95C5) &&
405 (dev->pdev->subsystem_vendor == 0x1043) &&
406 (dev->pdev->subsystem_device == 0x01e2)) {
431 if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) &&
432 (dev->pdev->subsystem_vendor == 0x1025) &&
433 (dev->pdev->subsystem_device == 0x013c)) {
445 if ((dev->pdev->device == 0x9498) &&
446 (dev->pdev->subsystem_vendor == 0x1682) &&
447 (dev->pdev->subsystem_device == 0x2452) &&
448 (i2c_bus->
valid ==
false) &&
451 *i2c_bus = radeon_lookup_i2c_gpio(rdev, 0x93);
455 if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) &&
456 (dev->pdev->subsystem_vendor == 0x1734) &&
457 (dev->pdev->subsystem_device == 0x11bd)) {
503 CONNECTOR_OBJECT_ID_SVIDEO
528 DRM_MODE_CONNECTOR_Unknown
544 int i,
j,
k, path_size, device_support;
546 u16 igp_lane_info,
conn_id, connector_object_id;
560 (ctx->
bios + data_offset +
563 (ctx->
bios + data_offset +
566 (ctx->
bios + data_offset +
569 (ctx->
bios + data_offset +
582 uint8_t con_obj_id, con_obj_num, con_obj_type;
608 IntegratedSystemInfo);
611 &crev, &igp_offset)) {
616 *) (ctx->
bios + igp_offset);
621 if (con_obj_num == 1)
630 ct = (slot_config >> 16) & 0xff;
632 object_connector_convert
634 connector_object_id =
ct;
636 slot_config & 0xffff;
644 object_connector_convert[con_obj_id];
645 connector_object_id = con_obj_id;
650 object_connector_convert[con_obj_id];
651 connector_object_id = con_obj_id;
660 uint8_t grph_obj_id, grph_obj_num, grph_obj_type;
673 for (k = 0; k < enc_obj->ucNumberOfObjects; k++) {
677 (ctx->
bios + data_offset +
678 le16_to_cpu(enc_obj->asObjects[k].usRecordOffset));
708 (ctx->
bios + data_offset +
716 (ctx->
bios + data_offset +
721 for (enum_id = 0; enum_id < router_src_dst_table->
ucNumberOfDst;
740 radeon_lookup_i2c_gpio(rdev,
771 ddc_bus.
valid =
false;
775 for (j = 0; j < con_obj->ucNumberOfObjects; j++) {
783 (ctx->
bios + data_offset +
802 ddc_bus = radeon_lookup_i2c_gpio(rdev,
810 gpio = radeon_lookup_gpio(rdev,
812 hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
833 if (!radeon_atom_apply_quirks
835 &ddc_bus, &conn_id, &hpd))
842 connector_type, &ddc_bus,
863 return supported_devices_connector_object_id_convert
890 return supported_devices_connector_object_id_convert
893 return supported_devices_connector_object_id_convert
920 int i,
j, max_device;
928 bios_connectors = kzalloc(bc_size,
GFP_KERNEL);
929 if (!bios_connectors)
934 kfree(bios_connectors);
948 for (i = 0; i < max_device; i++) {
950 supported_devices->
info.asConnInfo[
i];
952 bios_connectors[
i].
valid =
false;
954 if (!(device_support & (1 << i))) {
959 DRM_DEBUG_KMS(
"Skipping Component Video\n");
968 if (bios_connectors[i].connector_type ==
979 bios_connectors[
i].
ddc_bus.valid =
false;
982 bios_connectors[
i].
ddc_bus.valid =
false;
985 bios_connectors[
i].
ddc_bus.valid =
false;
989 radeon_lookup_i2c_gpio(rdev,
990 bios_connectors[i].line_mux);
992 if ((crev > 1) && (frev > 1)) {
993 u8 isb = supported_devices->
info_2d1.asIntSrcInfo[
i].ucIntSrcBitmap;
1022 if (!radeon_atom_apply_quirks
1023 (dev, (1 << i), &bios_connectors[i].connector_type,
1024 &bios_connectors[i].ddc_bus, &bios_connectors[i].line_mux,
1025 &bios_connectors[i].hpd))
1028 bios_connectors[
i].
valid =
true;
1047 for (i = 0; i < max_device; i++) {
1048 if (bios_connectors[i].
valid) {
1049 for (j = 0; j < max_device; j++) {
1050 if (bios_connectors[j].valid && (i != j)) {
1051 if (bios_connectors[i].line_mux ==
1052 bios_connectors[j].line_mux) {
1056 bios_connectors[
i].
ddc_bus.valid =
false;
1061 bios_connectors[
j].
ddc_bus.valid =
false;
1074 bios_connectors[
i].
hpd =
1075 bios_connectors[
j].
hpd;
1076 bios_connectors[
j].
valid =
false;
1085 for (i = 0; i < max_device; i++) {
1086 if (bios_connectors[i].
valid) {
1088 atombios_get_connector_object_id(dev,
1089 bios_connectors[i].connector_type,
1090 bios_connectors[i].devices);
1092 bios_connectors[i].line_mux,
1093 bios_connectors[i].devices,
1096 &bios_connectors[i].ddc_bus,
1098 connector_object_id,
1099 &bios_connectors[i].hpd,
1106 kfree(bios_connectors);
1134 &frev, &crev, &data_offset)) {
1136 (
union firmware_info *)(mode_info->
atom_context->bios +
1234 rdev->
clock.default_sclk =
1236 rdev->
clock.default_mclk =
1240 rdev->
clock.default_dispclk =
1242 if (rdev->
clock.default_dispclk == 0) {
1244 rdev->
clock.default_dispclk = 54000;
1246 rdev->
clock.default_dispclk = 60000;
1248 rdev->
clock.dp_extclk =
1254 if (rdev->
clock.max_pixel_clock == 0)
1255 rdev->
clock.max_pixel_clock = 40000;
1287 &frev, &crev, &data_offset)) {
1288 igp_info = (
union igp_info *)(mode_info->
atom_context->bios +
1300 DRM_ERROR(
"Unsupported IGP table: %d %d\n", frev, crev);
1321 &frev, &crev, &data_offset)) {
1327 for (i = 0; i < 4; i++) {
1334 ucPLL_VCO_Gain & 0x3f) << 6;
1337 ucPLL_DutyCycle & 0xf) << 12;
1340 ucPLL_VoltageSwing & 0xf) << 16;
1342 DRM_DEBUG_KMS(
"TMDS PLL From ATOMBIOS %u %x\n",
1346 if (maxfreq == tmds->
tmds_pll[i].freq) {
1369 &frev, &crev, &data_offset)) {
1376 for (i = 0; i < num_indices; i++) {
1392 static void radeon_atombios_get_igp_ss_overrides(
struct radeon_device *rdev,
1405 &frev, &crev, &data_offset)) {
1406 igp_info = (
union igp_info *)
1442 DRM_ERROR(
"Unsupported IGP table: %d %d\n", frev, crev);
1471 &frev, &crev, &data_offset)) {
1481 for (i = 0; i < num_indices; i++) {
1482 if ((ss_info->
info.asSpreadSpectrum[i].ucClockIndication ==
id) &&
1483 (clock <=
le32_to_cpu(ss_info->
info.asSpreadSpectrum[i].ulTargetClockRange))) {
1485 le16_to_cpu(ss_info->
info.asSpreadSpectrum[i].usSpreadSpectrumPercentage);
1486 ss->
type = ss_info->
info.asSpreadSpectrum[
i].ucSpreadSpectrumMode;
1495 for (i = 0; i < num_indices; i++) {
1496 if ((ss_info->
info_2.asSpreadSpectrum[i].ucClockIndication ==
id) &&
1497 (clock <=
le32_to_cpu(ss_info->
info_2.asSpreadSpectrum[i].ulTargetClockRange))) {
1500 ss->
type = ss_info->
info_2.asSpreadSpectrum[
i].ucSpreadSpectrumMode;
1509 for (i = 0; i < num_indices; i++) {
1510 if ((ss_info->
info_3.asSpreadSpectrum[i].ucClockIndication ==
id) &&
1511 (clock <=
le32_to_cpu(ss_info->
info_3.asSpreadSpectrum[i].ulTargetClockRange))) {
1514 ss->
type = ss_info->
info_3.asSpreadSpectrum[
i].ucSpreadSpectrumMode;
1517 radeon_atombios_get_igp_ss_overrides(rdev, ss,
id);
1523 DRM_ERROR(
"Unsupported ASIC_InternalSS_Info table: %d %d\n", frev, crev);
1551 &frev, &crev, &data_offset)) {
1553 (
union lvds_info *)(mode_info->
atom_context->bios + data_offset);
1582 misc =
le16_to_cpu(lvds_info->
info.sLCDTiming.susModeMiscInfo.usAccess);
1604 if (encoder_enum == 2)
1607 lvds->
linkb =
false;
1613 bool bad_record =
false;
1616 if ((frev == 1) && (crev < 2))
1648 rdev->
mode_info.bios_hardcoded_edid = edid;
1649 rdev->
mode_info.bios_hardcoded_edid_size = edid_size;
1663 DRM_ERROR(
"Bad LCD record %d\n", *record);
1689 &frev, &crev, &data_offset)) {
1718 &frev, &crev, &data_offset))
1784 if (misc & ATOM_VSYNC_POLARITY)
1786 if (misc & ATOM_HSYNC_POLARITY)
1788 if (misc & ATOM_COMPOSITESYNC)
1790 if (misc & ATOM_INTERLACE)
1792 if (misc & ATOM_DOUBLE_CLOCK_MODE)
1812 &frev, &crev, &data_offset)) {
1820 DRM_DEBUG_KMS(
"Default TV standard: NTSC\n");
1824 DRM_DEBUG_KMS(
"Default TV standard: NTSC-J\n");
1828 DRM_DEBUG_KMS(
"Default TV standard: PAL\n");
1832 DRM_DEBUG_KMS(
"Default TV standard: PAL-M\n");
1836 DRM_DEBUG_KMS(
"Default TV standard: PAL-N\n");
1840 DRM_DEBUG_KMS(
"Default TV standard: PAL-CN\n");
1844 DRM_DEBUG_KMS(
"Default TV standard: PAL-60\n");
1848 DRM_DEBUG_KMS(
"Default TV standard: SECAM\n");
1852 DRM_DEBUG_KMS(
"Unknown TV standard; defaulting to NTSC\n");
1873 &frev, &crev, &data_offset)) {
1900 static const char *thermal_controller_names[] = {
1911 static const char *pp_lib_thermal_controller_names[] = {
1954 static void radeon_atombios_parse_misc_flags_1_3(
struct radeon_device *rdev,
1958 rdev->
pm.power_state[state_index].misc = misc;
1959 rdev->
pm.power_state[state_index].misc2 = misc2;
1962 rdev->
pm.power_state[state_index].type =
1965 rdev->
pm.power_state[state_index].type =
1968 rdev->
pm.power_state[state_index].type =
1971 rdev->
pm.power_state[state_index].type =
1974 rdev->
pm.power_state[state_index].type =
1976 rdev->
pm.power_state[state_index].flags &=
1980 rdev->
pm.power_state[state_index].type =
1983 rdev->
pm.power_state[state_index].type =
1985 rdev->
pm.default_power_state_index = state_index;
1986 rdev->
pm.power_state[state_index].default_clock_mode =
1987 &rdev->
pm.power_state[state_index].clock_info[0];
1988 }
else if (state_index == 0) {
1989 rdev->
pm.power_state[state_index].clock_info[0].flags |=
1994 static int radeon_atombios_parse_power_table_1_3(
struct radeon_device *rdev)
1997 u32 misc, misc2 = 0;
1998 int num_modes = 0,
i;
1999 int state_index = 0;
2007 &frev, &crev, &data_offset))
2009 power_info = (
union power_info *)(mode_info->
atom_context->bios + data_offset);
2012 if ((power_info->
info.ucOverdriveThermalController > 0) &&
2013 (power_info->
info.ucOverdriveThermalController <
ARRAY_SIZE(thermal_controller_names))) {
2014 DRM_INFO(
"Possible %s thermal controller at 0x%02x\n",
2015 thermal_controller_names[power_info->
info.ucOverdriveThermalController],
2016 power_info->
info.ucOverdriveControllerAddress >> 1);
2017 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->
info.ucOverdriveI2cLine);
2019 if (rdev->
pm.i2c_bus) {
2021 const char *
name = thermal_controller_names[power_info->
info.
2022 ucOverdriveThermalController];
2023 info.
addr = power_info->
info.ucOverdriveControllerAddress >> 1;
2028 num_modes = power_info->
info.ucNumOfPowerModeEntries;
2032 if (!rdev->
pm.power_state)
2035 for (i = 0; i < num_modes; i++) {
2036 rdev->
pm.power_state[state_index].clock_info =
2038 if (!rdev->
pm.power_state[state_index].clock_info)
2040 rdev->
pm.power_state[state_index].num_clock_modes = 1;
2041 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
VOLTAGE_NONE;
2044 rdev->
pm.power_state[state_index].clock_info[0].mclk =
2046 rdev->
pm.power_state[state_index].clock_info[0].sclk =
2049 if ((rdev->
pm.power_state[state_index].clock_info[0].mclk == 0) ||
2050 (rdev->
pm.power_state[state_index].clock_info[0].sclk == 0))
2052 rdev->
pm.power_state[state_index].pcie_lanes =
2053 power_info->
info.asPowerPlayInfo[
i].ucNumPciELanes;
2057 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
2059 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio =
2060 radeon_lookup_gpio(rdev,
2061 power_info->
info.asPowerPlayInfo[i].ucVoltageDropIndex);
2062 if (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH)
2063 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2066 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2069 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
2071 rdev->
pm.power_state[state_index].clock_info[0].voltage.vddc_id =
2072 power_info->
info.asPowerPlayInfo[
i].ucVoltageDropIndex;
2075 radeon_atombios_parse_misc_flags_1_3(rdev, state_index, misc, 0);
2079 rdev->
pm.power_state[state_index].clock_info[0].mclk =
2081 rdev->
pm.power_state[state_index].clock_info[0].sclk =
2084 if ((rdev->
pm.power_state[state_index].clock_info[0].mclk == 0) ||
2085 (rdev->
pm.power_state[state_index].clock_info[0].sclk == 0))
2087 rdev->
pm.power_state[state_index].pcie_lanes =
2088 power_info->
info_2.asPowerPlayInfo[
i].ucNumPciELanes;
2091 if ((misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT) ||
2092 (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH)) {
2093 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
2095 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio =
2096 radeon_lookup_gpio(rdev,
2097 power_info->
info_2.asPowerPlayInfo[i].ucVoltageDropIndex);
2098 if (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH)
2099 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2102 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2104 }
else if (misc & ATOM_PM_MISCINFO_PROGRAM_VOLTAGE) {
2105 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
2107 rdev->
pm.power_state[state_index].clock_info[0].voltage.vddc_id =
2108 power_info->
info_2.asPowerPlayInfo[
i].ucVoltageDropIndex;
2111 radeon_atombios_parse_misc_flags_1_3(rdev, state_index, misc, misc2);
2115 rdev->
pm.power_state[state_index].clock_info[0].mclk =
2117 rdev->
pm.power_state[state_index].clock_info[0].sclk =
2120 if ((rdev->
pm.power_state[state_index].clock_info[0].mclk == 0) ||
2121 (rdev->
pm.power_state[state_index].clock_info[0].sclk == 0))
2123 rdev->
pm.power_state[state_index].pcie_lanes =
2124 power_info->
info_3.asPowerPlayInfo[
i].ucNumPciELanes;
2127 if ((misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT) ||
2128 (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH)) {
2129 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
2131 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio =
2132 radeon_lookup_gpio(rdev,
2133 power_info->
info_3.asPowerPlayInfo[i].ucVoltageDropIndex);
2134 if (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_ACTIVE_HIGH)
2135 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2138 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2140 }
else if (misc & ATOM_PM_MISCINFO_PROGRAM_VOLTAGE) {
2141 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
2143 rdev->
pm.power_state[state_index].clock_info[0].voltage.vddc_id =
2144 power_info->
info_3.asPowerPlayInfo[
i].ucVoltageDropIndex;
2146 rdev->
pm.power_state[state_index].clock_info[0].voltage.vddci_enabled =
2148 rdev->
pm.power_state[state_index].clock_info[0].voltage.vddci_id =
2149 power_info->
info_3.asPowerPlayInfo[
i].ucVDDCI_VoltageDropIndex;
2153 radeon_atombios_parse_misc_flags_1_3(rdev, state_index, misc, misc2);
2159 if (rdev->
pm.default_power_state_index == -1) {
2160 rdev->
pm.power_state[state_index - 1].type =
2162 rdev->
pm.default_power_state_index = state_index - 1;
2163 rdev->
pm.power_state[state_index - 1].default_clock_mode =
2164 &rdev->
pm.power_state[state_index - 1].clock_info[0];
2165 rdev->
pm.power_state[state_index].flags &=
2167 rdev->
pm.power_state[state_index].misc = 0;
2168 rdev->
pm.power_state[state_index].misc2 = 0;
2173 static void radeon_atombios_add_pplib_thermal_controller(
struct radeon_device *rdev,
2179 if (controller->
ucType > 0) {
2181 DRM_INFO(
"Internal thermal controller %s fan control\n",
2186 DRM_INFO(
"Internal thermal controller %s fan control\n",
2191 DRM_INFO(
"Internal thermal controller %s fan control\n",
2196 DRM_INFO(
"Internal thermal controller %s fan control\n",
2201 DRM_INFO(
"Internal thermal controller %s fan control\n",
2206 DRM_INFO(
"Internal thermal controller %s fan control\n",
2210 }
else if ((controller->
ucType ==
2216 DRM_INFO(
"Special thermal controller config\n");
2217 }
else if (controller->
ucType <
ARRAY_SIZE(pp_lib_thermal_controller_names)) {
2218 DRM_INFO(
"Possible %s thermal controller at 0x%02x %s fan control\n",
2219 pp_lib_thermal_controller_names[controller->
ucType],
2223 i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->
ucI2cLine);
2225 if (rdev->
pm.i2c_bus) {
2227 const char *
name = pp_lib_thermal_controller_names[controller->
ucType];
2233 DRM_INFO(
"Unknown thermal controller type %d at 0x%02x %s fan control\n",
2242 static void radeon_atombios_get_default_voltages(
struct radeon_device *rdev,
2255 &frev, &crev, &data_offset)) {
2257 (
union firmware_info *)(mode_info->
atom_context->bios +
2260 if ((frev == 2) && (crev >= 2))
2265 static void radeon_atombios_parse_pplib_non_clock_info(
struct radeon_device *rdev,
2266 int state_index,
int mode_index,
2274 radeon_atombios_get_default_voltages(rdev, &vddc, &vddci);
2276 rdev->
pm.power_state[state_index].misc = misc;
2277 rdev->
pm.power_state[state_index].misc2 = misc2;
2278 rdev->
pm.power_state[state_index].pcie_lanes =
2283 rdev->
pm.power_state[state_index].type =
2287 rdev->
pm.power_state[state_index].type =
2291 rdev->
pm.power_state[state_index].type =
2296 rdev->
pm.power_state[state_index].type =
2300 rdev->
pm.power_state[state_index].flags = 0;
2302 rdev->
pm.power_state[state_index].flags |=
2305 rdev->
pm.power_state[state_index].type =
2307 rdev->
pm.default_power_state_index = state_index;
2308 rdev->
pm.power_state[state_index].default_clock_mode =
2309 &rdev->
pm.power_state[state_index].clock_info[mode_index - 1];
2312 rdev->
pm.default_sclk = rdev->
pm.power_state[state_index].clock_info[0].sclk;
2313 rdev->
pm.default_mclk = rdev->
pm.power_state[state_index].clock_info[0].mclk;
2314 rdev->
pm.default_vddc = rdev->
pm.power_state[state_index].clock_info[0].voltage.voltage;
2315 rdev->
pm.default_vddci = rdev->
pm.power_state[state_index].clock_info[0].voltage.vddci;
2318 for (j = 0; j < mode_index; j++) {
2319 rdev->
pm.power_state[state_index].clock_info[
j].mclk =
2320 rdev->
clock.default_mclk;
2321 rdev->
pm.power_state[state_index].clock_info[
j].sclk =
2322 rdev->
clock.default_sclk;
2324 rdev->
pm.power_state[state_index].clock_info[
j].voltage.voltage =
2331 static bool radeon_atombios_parse_pplib_clock_info(
struct radeon_device *rdev,
2332 int state_index,
int mode_index,
2341 sclk |= clock_info->
sumo.ucEngineClockHigh << 16;
2342 rdev->
pm.power_state[state_index].clock_info[mode_index].sclk =
sclk;
2345 sclk |= clock_info->
rs780.ucLowEngineClockHigh << 16;
2346 rdev->
pm.power_state[state_index].clock_info[mode_index].sclk =
sclk;
2350 sclk |= clock_info->
si.ucEngineClockHigh << 16;
2352 mclk |= clock_info->
si.ucMemoryClockHigh << 16;
2353 rdev->
pm.power_state[state_index].clock_info[mode_index].mclk =
mclk;
2354 rdev->
pm.power_state[state_index].clock_info[mode_index].sclk =
sclk;
2355 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.type =
2357 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.voltage =
2359 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.vddci =
2363 sclk |= clock_info->
evergreen.ucEngineClockHigh << 16;
2365 mclk |= clock_info->
evergreen.ucMemoryClockHigh << 16;
2366 rdev->
pm.power_state[state_index].clock_info[mode_index].mclk =
mclk;
2367 rdev->
pm.power_state[state_index].clock_info[mode_index].sclk =
sclk;
2368 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.type =
2370 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.voltage =
2372 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.vddci =
2376 sclk |= clock_info->
r600.ucEngineClockHigh << 16;
2378 mclk |= clock_info->
r600.ucMemoryClockHigh << 16;
2379 rdev->
pm.power_state[state_index].clock_info[mode_index].mclk =
mclk;
2380 rdev->
pm.power_state[state_index].clock_info[mode_index].sclk =
sclk;
2381 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.type =
2383 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.voltage =
2388 switch (rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.voltage) {
2394 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.voltage,
2396 rdev->
pm.power_state[state_index].clock_info[mode_index].voltage.voltage = vddc;
2404 if (rdev->
pm.power_state[state_index].clock_info[mode_index].sclk == 0)
2408 if ((rdev->
pm.power_state[state_index].clock_info[mode_index].mclk == 0) ||
2409 (rdev->
pm.power_state[state_index].clock_info[mode_index].sclk == 0))
2415 static int radeon_atombios_parse_power_table_4_5(
struct radeon_device *rdev)
2421 int state_index = 0, mode_index = 0;
2424 union power_info *power_info;
2430 &frev, &crev, &data_offset))
2432 power_info = (
union power_info *)(mode_info->
atom_context->bios + data_offset);
2434 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->
pplib.sThermalController);
2437 if (!rdev->
pm.power_state)
2440 for (i = 0; i < power_info->
pplib.ucNumStates; i++) {
2445 i * power_info->
pplib.ucStateEntrySize);
2449 (power_state->
v1.ucNonClockStateIndex *
2450 power_info->
pplib.ucNonClockSize));
2452 ((power_info->
pplib.ucStateEntrySize - 1) ?
2453 (power_info->
pplib.ucStateEntrySize - 1) : 1),
2455 if (!rdev->
pm.power_state[i].clock_info)
2457 if (power_info->
pplib.ucStateEntrySize - 1) {
2458 for (j = 0; j < (power_info->
pplib.ucStateEntrySize - 1); j++) {
2462 (power_state->
v1.ucClockStateIndices[
j] *
2463 power_info->
pplib.ucClockInfoSize));
2464 valid = radeon_atombios_parse_pplib_clock_info(rdev,
2465 state_index, mode_index,
2471 rdev->
pm.power_state[state_index].clock_info[0].mclk =
2472 rdev->
clock.default_mclk;
2473 rdev->
pm.power_state[state_index].clock_info[0].sclk =
2474 rdev->
clock.default_sclk;
2477 rdev->
pm.power_state[state_index].num_clock_modes = mode_index;
2479 radeon_atombios_parse_pplib_non_clock_info(rdev, state_index, mode_index,
2485 for (i = 0; i < state_index; i++) {
2486 if (rdev->
pm.power_state[i].num_clock_modes > 1)
2487 rdev->
pm.power_state[
i].clock_info[0].flags |=
2491 if (rdev->
pm.default_power_state_index == -1) {
2492 rdev->
pm.power_state[0].type =
2494 rdev->
pm.default_power_state_index = 0;
2495 rdev->
pm.power_state[0].default_clock_mode =
2496 &rdev->
pm.power_state[0].clock_info[0];
2501 static int radeon_atombios_parse_power_table_6(
struct radeon_device *rdev)
2506 int i,
j, non_clock_array_index, clock_array_index;
2507 int state_index = 0, mode_index = 0;
2513 union power_info *power_info;
2519 &frev, &crev, &data_offset))
2521 power_info = (
union power_info *)(mode_info->
atom_context->bios + data_offset);
2523 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->
pplib.sThermalController);
2535 if (!rdev->
pm.power_state)
2541 non_clock_array_index = i;
2543 &non_clock_info_array->
nonClockInfo[non_clock_array_index];
2545 (power_state->
v2.ucNumDPMLevels ?
2546 power_state->
v2.ucNumDPMLevels : 1),
2548 if (!rdev->
pm.power_state[i].clock_info)
2550 if (power_state->
v2.ucNumDPMLevels) {
2551 for (j = 0; j < power_state->
v2.ucNumDPMLevels; j++) {
2552 clock_array_index = power_state->
v2.clockInfoIndex[
j];
2554 if (clock_array_index >= clock_info_array->
ucNumEntries)
2558 valid = radeon_atombios_parse_pplib_clock_info(rdev,
2559 state_index, mode_index,
2565 rdev->
pm.power_state[state_index].clock_info[0].mclk =
2566 rdev->
clock.default_mclk;
2567 rdev->
pm.power_state[state_index].clock_info[0].sclk =
2568 rdev->
clock.default_sclk;
2571 rdev->
pm.power_state[state_index].num_clock_modes = mode_index;
2573 radeon_atombios_parse_pplib_non_clock_info(rdev, state_index, mode_index,
2579 for (i = 0; i < state_index; i++) {
2580 if (rdev->
pm.power_state[i].num_clock_modes > 1)
2581 rdev->
pm.power_state[
i].clock_info[0].flags |=
2585 if (rdev->
pm.default_power_state_index == -1) {
2586 rdev->
pm.power_state[0].type =
2588 rdev->
pm.default_power_state_index = 0;
2589 rdev->
pm.power_state[0].default_clock_mode =
2590 &rdev->
pm.power_state[0].clock_info[0];
2601 int state_index = 0;
2603 rdev->
pm.default_power_state_index = -1;
2606 &frev, &crev, &data_offset)) {
2611 state_index = radeon_atombios_parse_power_table_1_3(rdev);
2615 state_index = radeon_atombios_parse_power_table_4_5(rdev);
2618 state_index = radeon_atombios_parse_power_table_6(rdev);
2625 if (rdev->
pm.power_state) {
2626 rdev->
pm.power_state[0].clock_info =
2628 if (rdev->
pm.power_state[0].clock_info) {
2630 rdev->
pm.power_state[state_index].type =
2632 rdev->
pm.power_state[state_index].num_clock_modes = 1;
2633 rdev->
pm.power_state[state_index].clock_info[0].mclk = rdev->
clock.default_mclk;
2634 rdev->
pm.power_state[state_index].clock_info[0].sclk = rdev->
clock.default_sclk;
2635 rdev->
pm.power_state[state_index].default_clock_mode =
2636 &rdev->
pm.power_state[state_index].clock_info[0];
2637 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
VOLTAGE_NONE;
2638 rdev->
pm.power_state[state_index].pcie_lanes = 16;
2639 rdev->
pm.default_power_state_index = state_index;
2640 rdev->
pm.power_state[state_index].flags = 0;
2646 rdev->
pm.num_power_states = state_index;
2648 rdev->
pm.current_power_state_index = rdev->
pm.default_power_state_index;
2649 rdev->
pm.current_clock_mode_index = 0;
2650 if (rdev->
pm.default_power_state_index >= 0)
2651 rdev->
pm.current_vddc =
2652 rdev->
pm.power_state[rdev->
pm.default_power_state_index].clock_info[0].voltage.voltage;
2654 rdev->
pm.current_vddc = 0;
2721 u8 frev, crev, volt_index = voltage_level;
2727 if (voltage_level == 0xff01)
2732 args.
v1.ucVoltageType = voltage_type;
2734 args.
v1.ucVoltageIndex = volt_index;
2737 args.
v2.ucVoltageType = voltage_type;
2742 args.
v3.ucVoltageType = voltage_type;
2747 DRM_ERROR(
"Unknown table version %d, %d\n", frev, crev);
2754 static int radeon_atom_get_max_vddc(
struct radeon_device *rdev,
u8 voltage_type,
2755 u16 voltage_id,
u16 *voltage)
2769 args.v2.ucVoltageMode = 0;
2770 args.v2.usVoltageLevel = 0;
2777 args.v3.ucVoltageType = voltage_type;
2786 DRM_ERROR(
"Unknown table version %d, %d\n", frev, crev);
2796 uint32_t bios_2_scratch, bios_6_scratch;
2886 uint32_t bios_0_scratch, bios_3_scratch, bios_6_scratch;
2901 DRM_DEBUG_KMS(
"TV1 connected\n");
2905 DRM_DEBUG_KMS(
"TV1 disconnected\n");
2914 DRM_DEBUG_KMS(
"CV connected\n");
2918 DRM_DEBUG_KMS(
"CV disconnected\n");
2927 DRM_DEBUG_KMS(
"LCD1 connected\n");
2932 DRM_DEBUG_KMS(
"LCD1 disconnected\n");
2941 DRM_DEBUG_KMS(
"CRT1 connected\n");
2946 DRM_DEBUG_KMS(
"CRT1 disconnected\n");
2955 DRM_DEBUG_KMS(
"CRT2 connected\n");
2960 DRM_DEBUG_KMS(
"CRT2 disconnected\n");
2969 DRM_DEBUG_KMS(
"DFP1 connected\n");
2974 DRM_DEBUG_KMS(
"DFP1 disconnected\n");
2980 if ((radeon_encoder->
devices & ATOM_DEVICE_DFP2_SUPPORT) &&
2981 (radeon_connector->
devices & ATOM_DEVICE_DFP2_SUPPORT)) {
2983 DRM_DEBUG_KMS(
"DFP2 connected\n");
2988 DRM_DEBUG_KMS(
"DFP2 disconnected\n");
2997 DRM_DEBUG_KMS(
"DFP3 connected\n");
3002 DRM_DEBUG_KMS(
"DFP3 disconnected\n");
3011 DRM_DEBUG_KMS(
"DFP4 connected\n");
3016 DRM_DEBUG_KMS(
"DFP4 disconnected\n");
3025 DRM_DEBUG_KMS(
"DFP5 connected\n");
3030 DRM_DEBUG_KMS(
"DFP5 disconnected\n");
3039 DRM_DEBUG_KMS(
"DFP6 connected\n");
3044 DRM_DEBUG_KMS(
"DFP6 disconnected\n");
3080 bios_3_scratch |= (crtc << 18);
3084 bios_3_scratch |= (crtc << 24);
3088 bios_3_scratch |= (crtc << 16);
3092 bios_3_scratch |= (crtc << 20);
3096 bios_3_scratch |= (crtc << 17);
3100 bios_3_scratch |= (crtc << 19);
3102 if (radeon_encoder->
devices & ATOM_DEVICE_DFP2_SUPPORT) {
3104 bios_3_scratch |= (crtc << 23);
3108 bios_3_scratch |= (crtc << 25);
3169 if (radeon_encoder->
devices & ATOM_DEVICE_DFP2_SUPPORT) {