drm/amd/powerplay: add pp_tables_get_response_times function in process pptables
authorHuang Rui <ray.huang@amd.com>
Tue, 12 Jul 2016 07:09:31 +0000 (15:09 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Jul 2016 16:34:03 +0000 (12:34 -0400)
The pp_tables_get_response_times function will be used on iceland HW
mananger.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.h

index 35bc8a29b773c6378f10cf67f3f43f3998c4d604..6c321b0d8a1eb8483c45bf563f79adb000a87865 100644 (file)
@@ -810,6 +810,19 @@ static const ATOM_PPLIB_POWERPLAYTABLE *get_powerplay_table(
        return (const ATOM_PPLIB_POWERPLAYTABLE *)table_addr;
 }
 
+int pp_tables_get_response_times(struct pp_hwmgr *hwmgr,
+                               uint32_t *vol_rep_time, uint32_t *bb_rep_time)
+{
+       const ATOM_PPLIB_POWERPLAYTABLE *powerplay_tab = get_powerplay_table(hwmgr);
+
+       PP_ASSERT_WITH_CODE(NULL != powerplay_tab,
+                           "Missing PowerPlay Table!", return -EINVAL);
+
+       *vol_rep_time = (uint32_t)le16_to_cpu(powerplay_tab->usVoltageTime);
+       *bb_rep_time = (uint32_t)le16_to_cpu(powerplay_tab->usBackbiasTime);
+
+       return 0;
+}
 
 int pp_tables_get_num_of_entries(struct pp_hwmgr *hwmgr,
                                     unsigned long *num_of_entries)
index 30434802417e5254ebbe75a070103596bd33f03e..baddaa75693bce2c8948844cb9cf75ee4ae7d533 100644 (file)
@@ -32,16 +32,19 @@ struct pp_hw_power_state;
 extern const struct pp_table_func pptable_funcs;
 
 typedef int (*pp_tables_hw_clock_info_callback)(struct pp_hwmgr *hwmgr,
-                                       struct pp_hw_power_state *hw_ps,
-                                                       unsigned int index,
-                                                const void *clock_info);
+                                               struct pp_hw_power_state *hw_ps,
+                                               unsigned int index,
+                                               const void *clock_info);
 
 int pp_tables_get_num_of_entries(struct pp_hwmgr *hwmgr,
-                                    unsigned long *num_of_entries);
+                                unsigned long *num_of_entries);
 
 int pp_tables_get_entry(struct pp_hwmgr *hwmgr,
-                                               unsigned long entry_index,
-                                               struct pp_power_state *ps,
-                               pp_tables_hw_clock_info_callback func);
+                       unsigned long entry_index,
+                       struct pp_power_state *ps,
+                       pp_tables_hw_clock_info_callback func);
+
+int pp_tables_get_response_times(struct pp_hwmgr *hwmgr,
+                                uint32_t *vol_rep_time, uint32_t *bb_rep_time);
 
 #endif