Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/radeon/atom: add new voltage fetch function for hawaii

Some hawaii boards use a different method for fetching the
voltage information from the vbios.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

+38
+3
drivers/gpu/drm/radeon/radeon.h
··· 304 304 u16 *vddc, u16 *vddci, 305 305 u16 virtual_voltage_id, 306 306 u16 vbios_voltage_id); 307 + int radeon_atom_get_voltage_evv(struct radeon_device *rdev, 308 + u16 virtual_voltage_id, 309 + u16 *voltage); 307 310 int radeon_atom_round_to_true_voltage(struct radeon_device *rdev, 308 311 u8 voltage_type, 309 312 u16 nominal_voltage,
+35
drivers/gpu/drm/radeon/radeon_atombios.c
··· 3236 3236 return 0; 3237 3237 } 3238 3238 3239 + union get_voltage_info { 3240 + struct _GET_VOLTAGE_INFO_INPUT_PARAMETER_V1_2 in; 3241 + struct _GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_2 evv_out; 3242 + }; 3243 + 3244 + int radeon_atom_get_voltage_evv(struct radeon_device *rdev, 3245 + u16 virtual_voltage_id, 3246 + u16 *voltage) 3247 + { 3248 + int index = GetIndexIntoMasterTable(COMMAND, GetVoltageInfo); 3249 + u32 entry_id; 3250 + u32 count = rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count; 3251 + union get_voltage_info args; 3252 + 3253 + for (entry_id = 0; entry_id < count; entry_id++) { 3254 + if (rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].v == 3255 + virtual_voltage_id) 3256 + break; 3257 + } 3258 + 3259 + if (entry_id >= count) 3260 + return -EINVAL; 3261 + 3262 + args.in.ucVoltageType = VOLTAGE_TYPE_VDDC; 3263 + args.in.ucVoltageMode = ATOM_GET_VOLTAGE_EVV_VOLTAGE; 3264 + args.in.ulSCLKFreq = 3265 + cpu_to_le32(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[entry_id].clk); 3266 + 3267 + atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 3268 + 3269 + *voltage = le16_to_cpu(args.evv_out.usVoltageLevel); 3270 + 3271 + return 0; 3272 + } 3273 + 3239 3274 int radeon_atom_get_voltage_gpio_settings(struct radeon_device *rdev, 3240 3275 u16 voltage_level, u8 voltage_type, 3241 3276 u32 *gpio_value, u32 *gpio_mask)