drm/radeon/dpm: add support for SVI2 voltage for SI
Some newer boards use SVI2 for voltage control rather than GPIO. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -3397,6 +3397,50 @@ radeon_atom_is_voltage_gpio(struct radeon_device *rdev,
|
||||
return false;
|
||||
}
|
||||
|
||||
int radeon_atom_get_svi2_info(struct radeon_device *rdev,
|
||||
u8 voltage_type,
|
||||
u8 *svd_gpio_id, u8 *svc_gpio_id)
|
||||
{
|
||||
int index = GetIndexIntoMasterTable(DATA, VoltageObjectInfo);
|
||||
u8 frev, crev;
|
||||
u16 data_offset, size;
|
||||
union voltage_object_info *voltage_info;
|
||||
union voltage_object *voltage_object = NULL;
|
||||
|
||||
if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size,
|
||||
&frev, &crev, &data_offset)) {
|
||||
voltage_info = (union voltage_object_info *)
|
||||
(rdev->mode_info.atom_context->bios + data_offset);
|
||||
|
||||
switch (frev) {
|
||||
case 3:
|
||||
switch (crev) {
|
||||
case 1:
|
||||
voltage_object = (union voltage_object *)
|
||||
atom_lookup_voltage_object_v3(&voltage_info->v3,
|
||||
voltage_type,
|
||||
VOLTAGE_OBJ_SVID2);
|
||||
if (voltage_object) {
|
||||
*svd_gpio_id = voltage_object->v3.asSVID2Obj.ucSVDGpioId;
|
||||
*svc_gpio_id = voltage_object->v3.asSVID2Obj.ucSVCGpioId;
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("unknown voltage object table\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("unknown voltage object table\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int radeon_atom_get_max_voltage(struct radeon_device *rdev,
|
||||
u8 voltage_type, u16 *max_voltage)
|
||||
{
|
||||
|
Reference in New Issue
Block a user