]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/radeon: update radeon_atom_is_voltage_gpio() for SI
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 13 Feb 2013 22:04:59 +0000 (17:04 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2013 23:16:24 +0000 (19:16 -0400)
SI uses a new atom table.  Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/btc_dpm.c
drivers/gpu/drm/radeon/cypress_dpm.c
drivers/gpu/drm/radeon/ni_dpm.c
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/rv6xx_dpm.c
drivers/gpu/drm/radeon/rv770_dpm.c

index f26cefe2432f7866dec37ff0f653348ee1a49df3..e0d315e7fd010561ed4adaaaea902c8e77f57aa8 100644 (file)
@@ -2529,13 +2529,13 @@ int btc_dpm_init(struct radeon_device *rdev)
        eg_pi->smu_uvd_hs = true;
 
        pi->voltage_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 0);
 
        pi->mvdd_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0);
 
        eg_pi->vddci_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0);
 
        if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size,
                                    &frev, &crev, &data_offset)) {
index 0b7b31976edaabb2cf9e3ca1d8ff355b95acd038..7108580d30e1bcee25dc8ae401baf75d042cb6d3 100644 (file)
@@ -2022,13 +2022,13 @@ int cypress_dpm_init(struct radeon_device *rdev)
        pi->lmp = RV770_LMP_DFLT;
 
        pi->voltage_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 0);
 
        pi->mvdd_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0);
 
        eg_pi->vddci_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0);
 
        if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size,
                                    &frev, &crev, &data_offset)) {
index 7530ee9591d3aecd07712f39ca38e86ce2b88866..3cf8d9ba5499e68c6e34c28103122c8e855156b0 100644 (file)
@@ -3977,13 +3977,13 @@ int ni_dpm_init(struct radeon_device *rdev)
        ni_pi->mclk_rtt_mode_threshold = eg_pi->mclk_edc_wr_enable_threshold;
 
        pi->voltage_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 0);
 
        pi->mvdd_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0);
 
        eg_pi->vddci_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0);
 
        if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size,
                                    &frev, &crev, &data_offset)) {
index 1fb1d3faed0a24e2c542f4349d845d924e34b450..fdc36e8219fa7e2ed8a1968eb5cf1c23285928c3 100644 (file)
@@ -244,7 +244,8 @@ int radeon_atom_get_max_voltage(struct radeon_device *rdev,
 int radeon_atom_get_voltage_table(struct radeon_device *rdev,
                                  u8 voltage_type,
                                  struct atom_voltage_table *voltage_table);
-bool radeon_atom_is_voltage_gpio(struct radeon_device *rdev, u8 voltage_type);
+bool radeon_atom_is_voltage_gpio(struct radeon_device *rdev,
+                                u8 voltage_type, u8 voltage_mode);
 void radeon_atom_update_memory_dll(struct radeon_device *rdev,
                                   u32 mem_clock);
 void radeon_atom_set_ac_timing(struct radeon_device *rdev,
index 45a6f5d155df445ac7213965bee7a87d87fb55e2..0da95eb77d8e5b696d5a5197476a94c6f5df20db 100644 (file)
@@ -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:
index e8f07b1223340b7b285e7824ef72a6d243468ad6..cc2a7c2477e780dc83ac991fed9b9060814207d3 100644 (file)
@@ -1933,7 +1933,7 @@ int rv6xx_dpm_init(struct radeon_device *rdev)
                pi->fb_div_scale = 0;
 
        pi->voltage_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 0);
 
        pi->gfx_clock_gating = true;
 
index 3c2866e7ca5b4b2d624bb62efd55bf6739b0cc76..aa387647a7dd10e415f90dbb669c5be1767f2fa1 100644 (file)
@@ -2301,10 +2301,10 @@ int rv770_dpm_init(struct radeon_device *rdev)
        pi->lmp = RV770_LMP_DFLT;
 
        pi->voltage_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 0);
 
        pi->mvdd_control =
-               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC);
+               radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0);
 
        if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size,
                                    &frev, &crev, &data_offset)) {