diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atombios.c')
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 304 |
1 files changed, 160 insertions, 144 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 08d0b94332e6..d24baf30efcb 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -62,6 +62,87 @@ union atom_supported_devices { | |||
| 62 | struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1; | 62 | struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1; |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | static void radeon_lookup_i2c_gpio_quirks(struct radeon_device *rdev, | ||
| 66 | ATOM_GPIO_I2C_ASSIGMENT *gpio, | ||
| 67 | u8 index) | ||
| 68 | { | ||
| 69 | /* r4xx mask is technically not used by the hw, so patch in the legacy mask bits */ | ||
| 70 | if ((rdev->family == CHIP_R420) || | ||
| 71 | (rdev->family == CHIP_R423) || | ||
| 72 | (rdev->family == CHIP_RV410)) { | ||
| 73 | if ((le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0018) || | ||
| 74 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x0019) || | ||
| 75 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x001a)) { | ||
| 76 | gpio->ucClkMaskShift = 0x19; | ||
| 77 | gpio->ucDataMaskShift = 0x18; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | /* some evergreen boards have bad data for this entry */ | ||
| 82 | if (ASIC_IS_DCE4(rdev)) { | ||
| 83 | if ((index == 7) && | ||
| 84 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && | ||
| 85 | (gpio->sucI2cId.ucAccess == 0)) { | ||
| 86 | gpio->sucI2cId.ucAccess = 0x97; | ||
| 87 | gpio->ucDataMaskShift = 8; | ||
| 88 | gpio->ucDataEnShift = 8; | ||
| 89 | gpio->ucDataY_Shift = 8; | ||
| 90 | gpio->ucDataA_Shift = 8; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | |||
| 94 | /* some DCE3 boards have bad data for this entry */ | ||
| 95 | if (ASIC_IS_DCE3(rdev)) { | ||
| 96 | if ((index == 4) && | ||
| 97 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && | ||
| 98 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
| 99 | gpio->sucI2cId.ucAccess = 0x14; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | static struct radeon_i2c_bus_rec radeon_get_bus_rec_for_i2c_gpio(ATOM_GPIO_I2C_ASSIGMENT *gpio) | ||
| 104 | { | ||
| 105 | struct radeon_i2c_bus_rec i2c; | ||
| 106 | |||
| 107 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); | ||
| 108 | |||
| 109 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | ||
| 110 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
| 111 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
| 112 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
| 113 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
| 114 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
| 115 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
| 116 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
| 117 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
| 118 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
| 119 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
| 120 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
| 121 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
| 122 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
| 123 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
| 124 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
| 125 | |||
| 126 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
| 127 | i2c.hw_capable = true; | ||
| 128 | else | ||
| 129 | i2c.hw_capable = false; | ||
| 130 | |||
| 131 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
| 132 | i2c.mm_i2c = true; | ||
| 133 | else | ||
| 134 | i2c.mm_i2c = false; | ||
| 135 | |||
| 136 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | ||
| 137 | |||
| 138 | if (i2c.mask_clk_reg) | ||
| 139 | i2c.valid = true; | ||
| 140 | else | ||
| 141 | i2c.valid = false; | ||
| 142 | |||
| 143 | return i2c; | ||
| 144 | } | ||
| 145 | |||
| 65 | static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev, | 146 | static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev, |
| 66 | uint8_t id) | 147 | uint8_t id) |
| 67 | { | 148 | { |
| @@ -85,59 +166,10 @@ static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rd | |||
| 85 | for (i = 0; i < num_indices; i++) { | 166 | for (i = 0; i < num_indices; i++) { |
| 86 | gpio = &i2c_info->asGPIO_Info[i]; | 167 | gpio = &i2c_info->asGPIO_Info[i]; |
| 87 | 168 | ||
| 88 | /* some evergreen boards have bad data for this entry */ | 169 | radeon_lookup_i2c_gpio_quirks(rdev, gpio, i); |
| 89 | if (ASIC_IS_DCE4(rdev)) { | ||
| 90 | if ((i == 7) && | ||
| 91 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && | ||
| 92 | (gpio->sucI2cId.ucAccess == 0)) { | ||
| 93 | gpio->sucI2cId.ucAccess = 0x97; | ||
| 94 | gpio->ucDataMaskShift = 8; | ||
| 95 | gpio->ucDataEnShift = 8; | ||
| 96 | gpio->ucDataY_Shift = 8; | ||
| 97 | gpio->ucDataA_Shift = 8; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | /* some DCE3 boards have bad data for this entry */ | ||
| 102 | if (ASIC_IS_DCE3(rdev)) { | ||
| 103 | if ((i == 4) && | ||
| 104 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && | ||
| 105 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
| 106 | gpio->sucI2cId.ucAccess = 0x14; | ||
| 107 | } | ||
| 108 | 170 | ||
| 109 | if (gpio->sucI2cId.ucAccess == id) { | 171 | if (gpio->sucI2cId.ucAccess == id) { |
| 110 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 172 | i2c = radeon_get_bus_rec_for_i2c_gpio(gpio); |
| 111 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
| 112 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
| 113 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
| 114 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
| 115 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
| 116 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
| 117 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
| 118 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
| 119 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
| 120 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
| 121 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
| 122 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
| 123 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
| 124 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
| 125 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
| 126 | |||
| 127 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
| 128 | i2c.hw_capable = true; | ||
| 129 | else | ||
| 130 | i2c.hw_capable = false; | ||
| 131 | |||
| 132 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
| 133 | i2c.mm_i2c = true; | ||
| 134 | else | ||
| 135 | i2c.mm_i2c = false; | ||
| 136 | |||
| 137 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | ||
| 138 | |||
| 139 | if (i2c.mask_clk_reg) | ||
| 140 | i2c.valid = true; | ||
| 141 | break; | 173 | break; |
| 142 | } | 174 | } |
| 143 | } | 175 | } |
| @@ -157,8 +189,6 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
| 157 | int i, num_indices; | 189 | int i, num_indices; |
| 158 | char stmp[32]; | 190 | char stmp[32]; |
| 159 | 191 | ||
| 160 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); | ||
| 161 | |||
| 162 | if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) { | 192 | if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) { |
| 163 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); | 193 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); |
| 164 | 194 | ||
| @@ -167,60 +197,12 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) | |||
| 167 | 197 | ||
| 168 | for (i = 0; i < num_indices; i++) { | 198 | for (i = 0; i < num_indices; i++) { |
| 169 | gpio = &i2c_info->asGPIO_Info[i]; | 199 | gpio = &i2c_info->asGPIO_Info[i]; |
| 170 | i2c.valid = false; | ||
| 171 | |||
| 172 | /* some evergreen boards have bad data for this entry */ | ||
| 173 | if (ASIC_IS_DCE4(rdev)) { | ||
| 174 | if ((i == 7) && | ||
| 175 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1936) && | ||
| 176 | (gpio->sucI2cId.ucAccess == 0)) { | ||
| 177 | gpio->sucI2cId.ucAccess = 0x97; | ||
| 178 | gpio->ucDataMaskShift = 8; | ||
| 179 | gpio->ucDataEnShift = 8; | ||
| 180 | gpio->ucDataY_Shift = 8; | ||
| 181 | gpio->ucDataA_Shift = 8; | ||
| 182 | } | ||
| 183 | } | ||
| 184 | 200 | ||
| 185 | /* some DCE3 boards have bad data for this entry */ | 201 | radeon_lookup_i2c_gpio_quirks(rdev, gpio, i); |
| 186 | if (ASIC_IS_DCE3(rdev)) { | ||
| 187 | if ((i == 4) && | ||
| 188 | (le16_to_cpu(gpio->usClkMaskRegisterIndex) == 0x1fda) && | ||
| 189 | (gpio->sucI2cId.ucAccess == 0x94)) | ||
| 190 | gpio->sucI2cId.ucAccess = 0x14; | ||
| 191 | } | ||
| 192 | 202 | ||
| 193 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | 203 | i2c = radeon_get_bus_rec_for_i2c_gpio(gpio); |
| 194 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
| 195 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
| 196 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
| 197 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
| 198 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
| 199 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
| 200 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
| 201 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
| 202 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
| 203 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
| 204 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
| 205 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
| 206 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
| 207 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
| 208 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
| 209 | |||
| 210 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
| 211 | i2c.hw_capable = true; | ||
| 212 | else | ||
| 213 | i2c.hw_capable = false; | ||
| 214 | |||
| 215 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
| 216 | i2c.mm_i2c = true; | ||
| 217 | else | ||
| 218 | i2c.mm_i2c = false; | ||
| 219 | 204 | ||
| 220 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | 205 | if (i2c.valid) { |
| 221 | |||
| 222 | if (i2c.mask_clk_reg) { | ||
| 223 | i2c.valid = true; | ||
| 224 | sprintf(stmp, "0x%x", i2c.i2c_id); | 206 | sprintf(stmp, "0x%x", i2c.i2c_id); |
| 225 | rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp); | 207 | rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp); |
| 226 | } | 208 | } |
| @@ -1996,10 +1978,14 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
| 1996 | return state_index; | 1978 | return state_index; |
| 1997 | /* last mode is usually default, array is low to high */ | 1979 | /* last mode is usually default, array is low to high */ |
| 1998 | for (i = 0; i < num_modes; i++) { | 1980 | for (i = 0; i < num_modes; i++) { |
| 1981 | rdev->pm.power_state[state_index].clock_info = | ||
| 1982 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); | ||
| 1983 | if (!rdev->pm.power_state[state_index].clock_info) | ||
| 1984 | return state_index; | ||
| 1985 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
| 1999 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 1986 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
| 2000 | switch (frev) { | 1987 | switch (frev) { |
| 2001 | case 1: | 1988 | case 1: |
| 2002 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
| 2003 | rdev->pm.power_state[state_index].clock_info[0].mclk = | 1989 | rdev->pm.power_state[state_index].clock_info[0].mclk = |
| 2004 | le16_to_cpu(power_info->info.asPowerPlayInfo[i].usMemoryClock); | 1990 | le16_to_cpu(power_info->info.asPowerPlayInfo[i].usMemoryClock); |
| 2005 | rdev->pm.power_state[state_index].clock_info[0].sclk = | 1991 | rdev->pm.power_state[state_index].clock_info[0].sclk = |
| @@ -2035,7 +2021,6 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
| 2035 | state_index++; | 2021 | state_index++; |
| 2036 | break; | 2022 | break; |
| 2037 | case 2: | 2023 | case 2: |
| 2038 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
| 2039 | rdev->pm.power_state[state_index].clock_info[0].mclk = | 2024 | rdev->pm.power_state[state_index].clock_info[0].mclk = |
| 2040 | le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMemoryClock); | 2025 | le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMemoryClock); |
| 2041 | rdev->pm.power_state[state_index].clock_info[0].sclk = | 2026 | rdev->pm.power_state[state_index].clock_info[0].sclk = |
| @@ -2072,7 +2057,6 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
| 2072 | state_index++; | 2057 | state_index++; |
| 2073 | break; | 2058 | break; |
| 2074 | case 3: | 2059 | case 3: |
| 2075 | rdev->pm.power_state[state_index].num_clock_modes = 1; | ||
| 2076 | rdev->pm.power_state[state_index].clock_info[0].mclk = | 2060 | rdev->pm.power_state[state_index].clock_info[0].mclk = |
| 2077 | le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMemoryClock); | 2061 | le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMemoryClock); |
| 2078 | rdev->pm.power_state[state_index].clock_info[0].sclk = | 2062 | rdev->pm.power_state[state_index].clock_info[0].sclk = |
| @@ -2257,7 +2241,7 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde | |||
| 2257 | rdev->pm.default_power_state_index = state_index; | 2241 | rdev->pm.default_power_state_index = state_index; |
| 2258 | rdev->pm.power_state[state_index].default_clock_mode = | 2242 | rdev->pm.power_state[state_index].default_clock_mode = |
| 2259 | &rdev->pm.power_state[state_index].clock_info[mode_index - 1]; | 2243 | &rdev->pm.power_state[state_index].clock_info[mode_index - 1]; |
| 2260 | if (ASIC_IS_DCE5(rdev)) { | 2244 | if (ASIC_IS_DCE5(rdev) && !(rdev->flags & RADEON_IS_IGP)) { |
| 2261 | /* NI chips post without MC ucode, so default clocks are strobe mode only */ | 2245 | /* NI chips post without MC ucode, so default clocks are strobe mode only */ |
| 2262 | rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; | 2246 | rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; |
| 2263 | rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; | 2247 | rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; |
| @@ -2377,17 +2361,31 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev) | |||
| 2377 | le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) + | 2361 | le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) + |
| 2378 | (power_state->v1.ucNonClockStateIndex * | 2362 | (power_state->v1.ucNonClockStateIndex * |
| 2379 | power_info->pplib.ucNonClockSize)); | 2363 | power_info->pplib.ucNonClockSize)); |
| 2380 | for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) { | 2364 | rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) * |
| 2381 | clock_info = (union pplib_clock_info *) | 2365 | ((power_info->pplib.ucStateEntrySize - 1) ? |
| 2382 | (mode_info->atom_context->bios + data_offset + | 2366 | (power_info->pplib.ucStateEntrySize - 1) : 1), |
| 2383 | le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) + | 2367 | GFP_KERNEL); |
| 2384 | (power_state->v1.ucClockStateIndices[j] * | 2368 | if (!rdev->pm.power_state[i].clock_info) |
| 2385 | power_info->pplib.ucClockInfoSize)); | 2369 | return state_index; |
| 2386 | valid = radeon_atombios_parse_pplib_clock_info(rdev, | 2370 | if (power_info->pplib.ucStateEntrySize - 1) { |
| 2387 | state_index, mode_index, | 2371 | for (j = 0; j < (power_info->pplib.ucStateEntrySize - 1); j++) { |
| 2388 | clock_info); | 2372 | clock_info = (union pplib_clock_info *) |
| 2389 | if (valid) | 2373 | (mode_info->atom_context->bios + data_offset + |
| 2390 | mode_index++; | 2374 | le16_to_cpu(power_info->pplib.usClockInfoArrayOffset) + |
| 2375 | (power_state->v1.ucClockStateIndices[j] * | ||
| 2376 | power_info->pplib.ucClockInfoSize)); | ||
| 2377 | valid = radeon_atombios_parse_pplib_clock_info(rdev, | ||
| 2378 | state_index, mode_index, | ||
| 2379 | clock_info); | ||
| 2380 | if (valid) | ||
| 2381 | mode_index++; | ||
| 2382 | } | ||
| 2383 | } else { | ||
| 2384 | rdev->pm.power_state[state_index].clock_info[0].mclk = | ||
| 2385 | rdev->clock.default_mclk; | ||
| 2386 | rdev->pm.power_state[state_index].clock_info[0].sclk = | ||
| 2387 | rdev->clock.default_sclk; | ||
| 2388 | mode_index++; | ||
| 2391 | } | 2389 | } |
| 2392 | rdev->pm.power_state[state_index].num_clock_modes = mode_index; | 2390 | rdev->pm.power_state[state_index].num_clock_modes = mode_index; |
| 2393 | if (mode_index) { | 2391 | if (mode_index) { |
| @@ -2456,18 +2454,32 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev) | |||
| 2456 | non_clock_array_index = i; /* power_state->v2.nonClockInfoIndex */ | 2454 | non_clock_array_index = i; /* power_state->v2.nonClockInfoIndex */ |
| 2457 | non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) | 2455 | non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) |
| 2458 | &non_clock_info_array->nonClockInfo[non_clock_array_index]; | 2456 | &non_clock_info_array->nonClockInfo[non_clock_array_index]; |
| 2459 | for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { | 2457 | rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) * |
| 2460 | clock_array_index = power_state->v2.clockInfoIndex[j]; | 2458 | (power_state->v2.ucNumDPMLevels ? |
| 2461 | /* XXX this might be an inagua bug... */ | 2459 | power_state->v2.ucNumDPMLevels : 1), |
| 2462 | if (clock_array_index >= clock_info_array->ucNumEntries) | 2460 | GFP_KERNEL); |
| 2463 | continue; | 2461 | if (!rdev->pm.power_state[i].clock_info) |
| 2464 | clock_info = (union pplib_clock_info *) | 2462 | return state_index; |
| 2465 | &clock_info_array->clockInfo[clock_array_index]; | 2463 | if (power_state->v2.ucNumDPMLevels) { |
| 2466 | valid = radeon_atombios_parse_pplib_clock_info(rdev, | 2464 | for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { |
| 2467 | state_index, mode_index, | 2465 | clock_array_index = power_state->v2.clockInfoIndex[j]; |
| 2468 | clock_info); | 2466 | /* XXX this might be an inagua bug... */ |
| 2469 | if (valid) | 2467 | if (clock_array_index >= clock_info_array->ucNumEntries) |
| 2470 | mode_index++; | 2468 | continue; |
| 2469 | clock_info = (union pplib_clock_info *) | ||
| 2470 | &clock_info_array->clockInfo[clock_array_index]; | ||
| 2471 | valid = radeon_atombios_parse_pplib_clock_info(rdev, | ||
| 2472 | state_index, mode_index, | ||
| 2473 | clock_info); | ||
| 2474 | if (valid) | ||
| 2475 | mode_index++; | ||
| 2476 | } | ||
| 2477 | } else { | ||
| 2478 | rdev->pm.power_state[state_index].clock_info[0].mclk = | ||
| 2479 | rdev->clock.default_mclk; | ||
| 2480 | rdev->pm.power_state[state_index].clock_info[0].sclk = | ||
| 2481 | rdev->clock.default_sclk; | ||
| 2482 | mode_index++; | ||
| 2471 | } | 2483 | } |
| 2472 | rdev->pm.power_state[state_index].num_clock_modes = mode_index; | 2484 | rdev->pm.power_state[state_index].num_clock_modes = mode_index; |
| 2473 | if (mode_index) { | 2485 | if (mode_index) { |
| @@ -2524,19 +2536,23 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
| 2524 | } else { | 2536 | } else { |
| 2525 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); | 2537 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); |
| 2526 | if (rdev->pm.power_state) { | 2538 | if (rdev->pm.power_state) { |
| 2527 | /* add the default mode */ | 2539 | rdev->pm.power_state[0].clock_info = |
| 2528 | rdev->pm.power_state[state_index].type = | 2540 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); |
| 2529 | POWER_STATE_TYPE_DEFAULT; | 2541 | if (rdev->pm.power_state[0].clock_info) { |
| 2530 | rdev->pm.power_state[state_index].num_clock_modes = 1; | 2542 | /* add the default mode */ |
| 2531 | rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; | 2543 | rdev->pm.power_state[state_index].type = |
| 2532 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; | 2544 | POWER_STATE_TYPE_DEFAULT; |
| 2533 | rdev->pm.power_state[state_index].default_clock_mode = | 2545 | rdev->pm.power_state[state_index].num_clock_modes = 1; |
| 2534 | &rdev->pm.power_state[state_index].clock_info[0]; | 2546 | rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; |
| 2535 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 2547 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; |
| 2536 | rdev->pm.power_state[state_index].pcie_lanes = 16; | 2548 | rdev->pm.power_state[state_index].default_clock_mode = |
| 2537 | rdev->pm.default_power_state_index = state_index; | 2549 | &rdev->pm.power_state[state_index].clock_info[0]; |
| 2538 | rdev->pm.power_state[state_index].flags = 0; | 2550 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
| 2539 | state_index++; | 2551 | rdev->pm.power_state[state_index].pcie_lanes = 16; |
| 2552 | rdev->pm.default_power_state_index = state_index; | ||
| 2553 | rdev->pm.power_state[state_index].flags = 0; | ||
| 2554 | state_index++; | ||
| 2555 | } | ||
| 2540 | } | 2556 | } |
| 2541 | } | 2557 | } |
| 2542 | 2558 | ||
