drm/radeon/sumo add helper to go from vid7 to vid2
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 19 Apr 2013 17:29:43 +0000 (13:29 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Aug 2013 20:30:10 +0000 (16:30 -0400)
Needed for DPM on KB/KV.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/sumo_dpm.c
drivers/gpu/drm/radeon/sumo_dpm.h

index c0a85031990841728dd0a11877f1c107f81a01a1..2cefe59ef5866bc12720c01ad6239c46daa7997f 100644 (file)
@@ -1530,6 +1530,20 @@ u32 sumo_convert_vid2_to_vid7(struct radeon_device *rdev,
        return vid_mapping_table->entries[vid_mapping_table->num_entries - 1].vid_7bit;
 }
 
+u32 sumo_convert_vid7_to_vid2(struct radeon_device *rdev,
+                             struct sumo_vid_mapping_table *vid_mapping_table,
+                             u32 vid_7bit)
+{
+       u32 i;
+
+       for (i = 0; i < vid_mapping_table->num_entries; i++) {
+               if (vid_mapping_table->entries[i].vid_7bit == vid_7bit)
+                       return vid_mapping_table->entries[i].vid_2bit;
+       }
+
+       return vid_mapping_table->entries[vid_mapping_table->num_entries - 1].vid_2bit;
+}
+
 static u16 sumo_convert_voltage_index_to_value(struct radeon_device *rdev,
                                               u32 vid_2bit)
 {
index 07dda299c7849b939833f59f78c0016a4a0b1acd..db1ea32a907b35937ea45f8c475cf959b0271b89 100644 (file)
@@ -202,6 +202,9 @@ void sumo_construct_vid_mapping_table(struct radeon_device *rdev,
 u32 sumo_convert_vid2_to_vid7(struct radeon_device *rdev,
                              struct sumo_vid_mapping_table *vid_mapping_table,
                              u32 vid_2bit);
+u32 sumo_convert_vid7_to_vid2(struct radeon_device *rdev,
+                             struct sumo_vid_mapping_table *vid_mapping_table,
+                             u32 vid_7bit);
 u32 sumo_get_sleep_divider_from_id(u32 id);
 u32 sumo_get_sleep_divider_id_from_clock(struct radeon_device *rdev,
                                         u32 sclk,