LCOV - code coverage report
Current view: top level - drivers/gpu/drm/amd/pm/powerplay/hwmgr - vega20_powertune.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 16 0.0 %
Date: 2022-12-09 01:23:36 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright 2018 Advanced Micro Devices, Inc.
       3             :  *
       4             :  * Permission is hereby granted, free of charge, to any person obtaining a
       5             :  * copy of this software and associated documentation files (the "Software"),
       6             :  * to deal in the Software without restriction, including without limitation
       7             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
       8             :  * and/or sell copies of the Software, and to permit persons to whom the
       9             :  * Software is furnished to do so, subject to the following conditions:
      10             :  *
      11             :  * The above copyright notice and this permission notice shall be included in
      12             :  * all copies or substantial portions of the Software.
      13             :  *
      14             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      15             :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      16             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      17             :  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
      18             :  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
      19             :  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
      20             :  * OTHER DEALINGS IN THE SOFTWARE.
      21             :  *
      22             :  */
      23             : 
      24             : #include "hwmgr.h"
      25             : #include "vega20_hwmgr.h"
      26             : #include "vega20_powertune.h"
      27             : #include "vega20_smumgr.h"
      28             : #include "vega20_ppsmc.h"
      29             : #include "vega20_inc.h"
      30             : #include "pp_debug.h"
      31             : 
      32           0 : int vega20_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n)
      33             : {
      34           0 :         struct vega20_hwmgr *data =
      35             :                         (struct vega20_hwmgr *)(hwmgr->backend);
      36             : 
      37           0 :         if (data->smu_features[GNLD_PPT].enabled)
      38           0 :                 return smum_send_msg_to_smc_with_parameter(hwmgr,
      39             :                                 PPSMC_MSG_SetPptLimit, n,
      40             :                                 NULL);
      41             : 
      42             :         return 0;
      43             : }
      44             : 
      45           0 : int vega20_validate_power_level_request(struct pp_hwmgr *hwmgr,
      46             :                 uint32_t tdp_percentage_adjustment, uint32_t tdp_absolute_value_adjustment)
      47             : {
      48           0 :         return (tdp_percentage_adjustment > hwmgr->platform_descriptor.TDPLimit) ? -1 : 0;
      49             : }
      50             : 
      51             : static int vega20_set_overdrive_target_percentage(struct pp_hwmgr *hwmgr,
      52             :                 uint32_t adjust_percent)
      53             : {
      54           0 :         return smum_send_msg_to_smc_with_parameter(hwmgr,
      55             :                         PPSMC_MSG_OverDriveSetPercentage, adjust_percent,
      56             :                         NULL);
      57             : }
      58             : 
      59           0 : int vega20_power_control_set_level(struct pp_hwmgr *hwmgr)
      60             : {
      61           0 :         int adjust_percent, result = 0;
      62             : 
      63           0 :         if (PP_CAP(PHM_PlatformCaps_PowerContainment)) {
      64           0 :                 adjust_percent =
      65           0 :                                 hwmgr->platform_descriptor.TDPAdjustmentPolarity ?
      66           0 :                                 hwmgr->platform_descriptor.TDPAdjustment :
      67           0 :                                 (-1 * hwmgr->platform_descriptor.TDPAdjustment);
      68           0 :                 result = vega20_set_overdrive_target_percentage(hwmgr,
      69             :                                 (uint32_t)adjust_percent);
      70             :         }
      71           0 :         return result;
      72             : }

Generated by: LCOV version 1.14