diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index 1f61ed95727c..6896dec97fc7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |||
@@ -2008,6 +2008,7 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev) | |||
2008 | 2008 | ||
2009 | int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | 2009 | int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) |
2010 | { | 2010 | { |
2011 | struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; | ||
2011 | int ret; | 2012 | int ret; |
2012 | 2013 | ||
2013 | if (adev->pm.sysfs_initialized) | 2014 | if (adev->pm.sysfs_initialized) |
@@ -2091,12 +2092,14 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | |||
2091 | "pp_power_profile_mode\n"); | 2092 | "pp_power_profile_mode\n"); |
2092 | return ret; | 2093 | return ret; |
2093 | } | 2094 | } |
2094 | ret = device_create_file(adev->dev, | 2095 | if (hwmgr->od_enabled) { |
2095 | &dev_attr_pp_od_clk_voltage); | 2096 | ret = device_create_file(adev->dev, |
2096 | if (ret) { | 2097 | &dev_attr_pp_od_clk_voltage); |
2097 | DRM_ERROR("failed to create device file " | 2098 | if (ret) { |
2098 | "pp_od_clk_voltage\n"); | 2099 | DRM_ERROR("failed to create device file " |
2099 | return ret; | 2100 | "pp_od_clk_voltage\n"); |
2101 | return ret; | ||
2102 | } | ||
2100 | } | 2103 | } |
2101 | ret = device_create_file(adev->dev, | 2104 | ret = device_create_file(adev->dev, |
2102 | &dev_attr_gpu_busy_percent); | 2105 | &dev_attr_gpu_busy_percent); |
@@ -2118,6 +2121,8 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev) | |||
2118 | 2121 | ||
2119 | void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) | 2122 | void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) |
2120 | { | 2123 | { |
2124 | struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; | ||
2125 | |||
2121 | if (adev->pm.dpm_enabled == 0) | 2126 | if (adev->pm.dpm_enabled == 0) |
2122 | return; | 2127 | return; |
2123 | 2128 | ||
@@ -2138,8 +2143,9 @@ void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev) | |||
2138 | device_remove_file(adev->dev, &dev_attr_pp_mclk_od); | 2143 | device_remove_file(adev->dev, &dev_attr_pp_mclk_od); |
2139 | device_remove_file(adev->dev, | 2144 | device_remove_file(adev->dev, |
2140 | &dev_attr_pp_power_profile_mode); | 2145 | &dev_attr_pp_power_profile_mode); |
2141 | device_remove_file(adev->dev, | 2146 | if (hwmgr->od_enabled) |
2142 | &dev_attr_pp_od_clk_voltage); | 2147 | device_remove_file(adev->dev, |
2148 | &dev_attr_pp_od_clk_voltage); | ||
2143 | device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); | 2149 | device_remove_file(adev->dev, &dev_attr_gpu_busy_percent); |
2144 | } | 2150 | } |
2145 | 2151 | ||