• Darren Powell's avatar
    amdgpu/pm: remove code duplication in show_power_cap calls · 91161b06
    Darren Powell authored
     v3: updated patch to apply to latest code
     v2: reorder to check pointers before calling pm_runtime_* functions
    
     created generic function and call with enum from
     * amdgpu_hwmon_show_power_cap_max
     * amdgpu_hwmon_show_power_cap
     * amdgpu_hwmon_show_power_cap_default
    
    === Test ===
    AMDGPU_PCI_ADDR=`lspci -nn | grep "VGA\|Display" | cut -d " " -f 1`
    AMDGPU_HWMON=`ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | cut -d " " -f 10`
    HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
    
    cp pp_show_power_cap.txt{,.old}
    lspci -nn | grep "VGA\|Display" > pp_show_power_cap.test.log
    FILES="
    power1_cap
    power1_cap_max
    power1_cap_default "
    
    for f in $FILES
    do
      echo  $f = `cat $HWMON_DIR/$f` >> pp_show_power_cap.test.log
    done
    Signed-off-by: default avatarDarren Powell <darren.powell@amd.com>
    Reviewed-by: default avatarKevin Wang <kevin1.wang@amd.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    91161b06
amdgpu_pm.c 106 KB