amdgpu/pm: Add new hwmgr API function "emit_clock_levels"
authorDarren Powell <darren.powell@amd.com>
Sat, 5 Mar 2022 04:45:25 +0000 (23:45 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 28 Mar 2022 16:54:22 +0000 (12:54 -0400)
 Extend commit 7f36948c92b2 ("amdgpu/pm: Implement new API function "emit" that accepts buffer base and write offset")
   Add new hwmgr API function "emit_clock_levels"
   - add member emit_clock_levels to pp_hwmgr_func
   - Implemented pp_dpm_emit_clock_levels
   - add pp_dpm_emit_clock_levels to pp_dpm_funcs

Signed-off-by: Darren Powell <darren.powell@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c
drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h

index a2da46bf3985d0b22ed9eeb9526ac7fb2042ba14..dbed72c1e0c69c4184cdc395137c190116b8b908 100644 (file)
@@ -671,6 +671,22 @@ static int pp_dpm_force_clock_level(void *handle,
        return hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);
 }
 
+static int pp_dpm_emit_clock_levels(void *handle,
+                                   enum pp_clock_type type,
+                                   char *buf,
+                                   int *offset)
+{
+       struct pp_hwmgr *hwmgr = handle;
+
+       if (!hwmgr || !hwmgr->pm_en)
+               return -EOPNOTSUPP;
+
+       if (!hwmgr->hwmgr_func->emit_clock_levels)
+               return -ENOENT;
+
+       return hwmgr->hwmgr_func->emit_clock_levels(hwmgr, type, buf, offset);
+}
+
 static int pp_dpm_print_clock_levels(void *handle,
                enum pp_clock_type type, char *buf)
 {
@@ -1535,6 +1551,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = {
        .get_pp_table = pp_dpm_get_pp_table,
        .set_pp_table = pp_dpm_set_pp_table,
        .force_clock_level = pp_dpm_force_clock_level,
+       .emit_clock_levels = pp_dpm_emit_clock_levels,
        .print_clock_levels = pp_dpm_print_clock_levels,
        .get_sclk_od = pp_dpm_get_sclk_od,
        .set_sclk_od = pp_dpm_set_sclk_od,
index 4f7f2f455301a9e1c02a9c655dc3b3f4fe77baa1..27f8d0e0e6a8c0a18947b223d7cda25e871c15f5 100644 (file)
@@ -313,6 +313,8 @@ struct pp_hwmgr_func {
        int (*get_max_high_clocks)(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks);
        int (*power_off_asic)(struct pp_hwmgr *hwmgr);
        int (*force_clock_level)(struct pp_hwmgr *hwmgr, enum pp_clock_type type, uint32_t mask);
+       int (*emit_clock_levels)(struct pp_hwmgr *hwmgr,
+                                enum pp_clock_type type, char *buf, int *offset);
        int (*print_clock_levels)(struct pp_hwmgr *hwmgr, enum pp_clock_type type, char *buf);
        int (*powergate_gfx)(struct pp_hwmgr *hwmgr, bool enable);
        int (*get_sclk_od)(struct pp_hwmgr *hwmgr);