summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_atombios.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-02-13 17:04:59 -0500
committerAlex Deucher <alexander.deucher@amd.com>2013-06-27 19:16:24 -0400
commit58653abdd22427f2b4f2ec9930cadcbeb8832a73 (patch)
tree8e25e3c55852c46a33ec6abe39328f8e726e9139 /drivers/gpu/drm/radeon/radeon_atombios.c
parenteaa778aff0f19c35e9380c2bc5513b5b60ce01a6 (diff)
drm/radeon: update radeon_atom_is_voltage_gpio() for SI
SI uses a new atom table. Required for DPM on SI. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atombios.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c71
1 files changed, 50 insertions, 21 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 45a6f5d155d..0da95eb77d8 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -3102,12 +3102,14 @@ int radeon_atom_get_voltage_gpio_settings(struct radeon_device *rdev,
}
union voltage_object_info {
- struct _ATOM_VOLTAGE_OBJECT_INFO v1;
- struct _ATOM_VOLTAGE_OBJECT_INFO_V2 v2;
+ struct _ATOM_VOLTAGE_OBJECT_INFO v1;
+ struct _ATOM_VOLTAGE_OBJECT_INFO_V2 v2;
+ struct _ATOM_VOLTAGE_OBJECT_INFO_V3_1 v3;
};
bool
-radeon_atom_is_voltage_gpio(struct radeon_device *rdev, u8 voltage_type)
+radeon_atom_is_voltage_gpio(struct radeon_device *rdev,
+ u8 voltage_type, u8 voltage_mode)
{
int index = GetIndexIntoMasterTable(DATA, VoltageObjectInfo);
u8 frev, crev;
@@ -3120,27 +3122,54 @@ radeon_atom_is_voltage_gpio(struct radeon_device *rdev, u8 voltage_type)
voltage_info = (union voltage_object_info *)
(rdev->mode_info.atom_context->bios + data_offset);
- switch (crev) {
+ switch (frev) {
case 1:
- num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
- sizeof(ATOM_VOLTAGE_OBJECT);
-
- for (i = 0; i < num_indices; i++) {
- if ((voltage_info->v1.asVoltageObj[i].ucVoltageType == voltage_type) &&
- (voltage_info->v1.asVoltageObj[i].asControl.ucVoltageControlId ==
- VOLTAGE_CONTROLLED_BY_GPIO))
- return true;
+ case 2:
+ switch (crev) {
+ case 1:
+ num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
+ sizeof(ATOM_VOLTAGE_OBJECT);
+
+ for (i = 0; i < num_indices; i++) {
+ if ((voltage_info->v1.asVoltageObj[i].ucVoltageType == voltage_type) &&
+ (voltage_info->v1.asVoltageObj[i].asControl.ucVoltageControlId ==
+ VOLTAGE_CONTROLLED_BY_GPIO))
+ return true;
+ }
+ break;
+ case 2:
+ num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
+ sizeof(ATOM_VOLTAGE_OBJECT_INFO_V2);
+
+ for (i = 0; i < num_indices; i++) {
+ if ((voltage_info->v2.asVoltageObj[i].ucVoltageType == voltage_type) &&
+ (voltage_info->v2.asVoltageObj[i].asControl.ucVoltageControlId ==
+ VOLTAGE_CONTROLLED_BY_GPIO))
+ return true;
+ }
+ break;
+ default:
+ DRM_ERROR("unknown voltage object table\n");
+ return false;
}
break;
- case 2:
- num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
- sizeof(ATOM_VOLTAGE_OBJECT_INFO_V2);
-
- for (i = 0; i < num_indices; i++) {
- if ((voltage_info->v2.asVoltageObj[i].ucVoltageType == voltage_type) &&
- (voltage_info->v2.asVoltageObj[i].asControl.ucVoltageControlId ==
- VOLTAGE_CONTROLLED_BY_GPIO))
- return true;
+ case 3:
+ switch (crev) {
+ case 1:
+ num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
+ sizeof(ATOM_VOLTAGE_OBJECT_INFO_V3_1);
+
+ for (i = 0; i < num_indices; i++) {
+ if ((voltage_info->v3.asVoltageObj[i].asGpioVoltageObj.sHeader.ucVoltageType ==
+ voltage_type) &&
+ (voltage_info->v3.asVoltageObj[i].asGpioVoltageObj.sHeader.ucVoltageMode ==
+ voltage_mode))
+ return true;
+ }
+ break;
+ default:
+ DRM_ERROR("unknown voltage object table\n");
+ return false;
}
break;
default: