Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: remove duplicate cg/pg wrapper functions

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König<christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
43fa561f 10b3f45c

+30 -107
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 222 222 AMDGPU_CP_KIQ_IRQ_LAST 223 223 }; 224 224 225 - int amdgpu_device_ip_set_clockgating_state(struct amdgpu_device *adev, 225 + int amdgpu_device_ip_set_clockgating_state(void *dev, 226 226 enum amd_ip_block_type block_type, 227 227 enum amd_clockgating_state state); 228 - int amdgpu_device_ip_set_powergating_state(struct amdgpu_device *adev, 228 + int amdgpu_device_ip_set_powergating_state(void *dev, 229 229 enum amd_ip_block_type block_type, 230 230 enum amd_powergating_state state); 231 231 void amdgpu_device_ip_get_clockgating_state(struct amdgpu_device *adev,
-44
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
··· 108 108 WARN(1, "Invalid indirect register space"); 109 109 } 110 110 111 - static int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device, 112 - enum amd_ip_block_type block_type, 113 - enum amd_clockgating_state state) 114 - { 115 - CGS_FUNC_ADEV; 116 - int i, r = -1; 117 - 118 - for (i = 0; i < adev->num_ip_blocks; i++) { 119 - if (!adev->ip_blocks[i].status.valid) 120 - continue; 121 - 122 - if (adev->ip_blocks[i].version->type == block_type) { 123 - r = adev->ip_blocks[i].version->funcs->set_clockgating_state( 124 - (void *)adev, 125 - state); 126 - break; 127 - } 128 - } 129 - return r; 130 - } 131 - 132 - static int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device, 133 - enum amd_ip_block_type block_type, 134 - enum amd_powergating_state state) 135 - { 136 - CGS_FUNC_ADEV; 137 - int i, r = -1; 138 - 139 - for (i = 0; i < adev->num_ip_blocks; i++) { 140 - if (!adev->ip_blocks[i].status.valid) 141 - continue; 142 - 143 - if (adev->ip_blocks[i].version->type == block_type) { 144 - r = adev->ip_blocks[i].version->funcs->set_powergating_state( 145 - (void *)adev, 146 - state); 147 - break; 148 - } 149 - } 150 - return r; 151 - } 152 - 153 111 static uint32_t fw_type_convert(struct cgs_device *cgs_device, uint32_t fw_type) 154 112 { 155 113 CGS_FUNC_ADEV; ··· 448 490 .read_ind_register = amdgpu_cgs_read_ind_register, 449 491 .write_ind_register = amdgpu_cgs_write_ind_register, 450 492 .get_firmware_info = amdgpu_cgs_get_firmware_info, 451 - .set_powergating_state = amdgpu_cgs_set_powergating_state, 452 - .set_clockgating_state = amdgpu_cgs_set_clockgating_state, 453 493 }; 454 494 455 495 struct cgs_device *amdgpu_cgs_create_device(struct amdgpu_device *adev)
+4 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1039 1039 * the hardware IP specified. 1040 1040 * Returns the error code from the last instance. 1041 1041 */ 1042 - int amdgpu_device_ip_set_clockgating_state(struct amdgpu_device *adev, 1042 + int amdgpu_device_ip_set_clockgating_state(void *dev, 1043 1043 enum amd_ip_block_type block_type, 1044 1044 enum amd_clockgating_state state) 1045 1045 { 1046 + struct amdgpu_device *adev = dev; 1046 1047 int i, r = 0; 1047 1048 1048 1049 for (i = 0; i < adev->num_ip_blocks; i++) { ··· 1073 1072 * the hardware IP specified. 1074 1073 * Returns the error code from the last instance. 1075 1074 */ 1076 - int amdgpu_device_ip_set_powergating_state(struct amdgpu_device *adev, 1075 + int amdgpu_device_ip_set_powergating_state(void *dev, 1077 1076 enum amd_ip_block_type block_type, 1078 1077 enum amd_powergating_state state) 1079 1078 { 1079 + struct amdgpu_device *adev = dev; 1080 1080 int i, r = 0; 1081 1081 1082 1082 for (i = 0; i < adev->num_ip_blocks; i++) {
-31
drivers/gpu/drm/amd/include/cgs_common.h
··· 42 42 CGS_IND_REG__AUDIO_ENDPT 43 43 }; 44 44 45 - /** 46 - * enum cgs_engine - Engines that can be statically power-gated 47 - */ 48 - enum cgs_engine { 49 - CGS_ENGINE__UVD, 50 - CGS_ENGINE__VCE, 51 - CGS_ENGINE__VP8, 52 - CGS_ENGINE__ACP_DMA, 53 - CGS_ENGINE__ACP_DSP0, 54 - CGS_ENGINE__ACP_DSP1, 55 - CGS_ENGINE__ISP, 56 - /* ... */ 57 - }; 58 - 59 45 /* 60 46 * enum cgs_ucode_id - Firmware types for different IPs 61 47 */ ··· 138 152 enum cgs_ucode_id type, 139 153 struct cgs_firmware_info *info); 140 154 141 - 142 - typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device, 143 - enum amd_ip_block_type block_type, 144 - enum amd_powergating_state state); 145 - 146 - typedef int(*cgs_set_clockgating_state)(struct cgs_device *cgs_device, 147 - enum amd_ip_block_type block_type, 148 - enum amd_clockgating_state state); 149 - 150 155 struct cgs_ops { 151 156 /* MMIO access */ 152 157 cgs_read_register_t read_register; ··· 146 169 cgs_write_ind_register_t write_ind_register; 147 170 /* Firmware Info */ 148 171 cgs_get_firmware_info get_firmware_info; 149 - /* cg pg interface*/ 150 - cgs_set_powergating_state set_powergating_state; 151 - cgs_set_clockgating_state set_clockgating_state; 152 172 }; 153 173 154 174 struct cgs_os_ops; /* To be define in OS-specific CGS header */ ··· 174 200 175 201 #define cgs_get_firmware_info(dev, type, info) \ 176 202 CGS_CALL(get_firmware_info, dev, type, info) 177 - #define cgs_set_powergating_state(dev, block_type, state) \ 178 - CGS_CALL(set_powergating_state, dev, block_type, state) 179 - #define cgs_set_clockgating_state(dev, block_type, state) \ 180 - CGS_CALL(set_clockgating_state, dev, block_type, state) 181 - 182 203 183 204 #endif /* _CGS_COMMON_H */
+4 -4
drivers/gpu/drm/amd/powerplay/amd_powerplay.c
··· 288 288 if (*level & profile_mode_mask) { 289 289 hwmgr->saved_dpm_level = hwmgr->dpm_level; 290 290 hwmgr->en_umd_pstate = true; 291 - cgs_set_clockgating_state(hwmgr->device, 291 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 292 292 AMD_IP_BLOCK_TYPE_GFX, 293 293 AMD_CG_STATE_UNGATE); 294 - cgs_set_powergating_state(hwmgr->device, 294 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 295 295 AMD_IP_BLOCK_TYPE_GFX, 296 296 AMD_PG_STATE_UNGATE); 297 297 } ··· 301 301 if (*level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT) 302 302 *level = hwmgr->saved_dpm_level; 303 303 hwmgr->en_umd_pstate = false; 304 - cgs_set_clockgating_state(hwmgr->device, 304 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 305 305 AMD_IP_BLOCK_TYPE_GFX, 306 306 AMD_CG_STATE_GATE); 307 - cgs_set_powergating_state(hwmgr->device, 307 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 308 308 AMD_IP_BLOCK_TYPE_GFX, 309 309 AMD_PG_STATE_GATE); 310 310 }
+8 -8
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c
··· 147 147 data->uvd_power_gated = bgate; 148 148 149 149 if (bgate) { 150 - cgs_set_powergating_state(hwmgr->device, 150 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 151 151 AMD_IP_BLOCK_TYPE_UVD, 152 152 AMD_PG_STATE_GATE); 153 - cgs_set_clockgating_state(hwmgr->device, 153 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 154 154 AMD_IP_BLOCK_TYPE_UVD, 155 155 AMD_CG_STATE_GATE); 156 156 smu7_update_uvd_dpm(hwmgr, true); 157 157 smu7_powerdown_uvd(hwmgr); 158 158 } else { 159 159 smu7_powerup_uvd(hwmgr); 160 - cgs_set_clockgating_state(hwmgr->device, 160 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 161 161 AMD_IP_BLOCK_TYPE_UVD, 162 162 AMD_CG_STATE_UNGATE); 163 - cgs_set_powergating_state(hwmgr->device, 163 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 164 164 AMD_IP_BLOCK_TYPE_UVD, 165 165 AMD_PG_STATE_UNGATE); 166 166 smu7_update_uvd_dpm(hwmgr, false); ··· 175 175 data->vce_power_gated = bgate; 176 176 177 177 if (bgate) { 178 - cgs_set_powergating_state(hwmgr->device, 178 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 179 179 AMD_IP_BLOCK_TYPE_VCE, 180 180 AMD_PG_STATE_GATE); 181 - cgs_set_clockgating_state(hwmgr->device, 181 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 182 182 AMD_IP_BLOCK_TYPE_VCE, 183 183 AMD_CG_STATE_GATE); 184 184 smu7_update_vce_dpm(hwmgr, true); 185 185 smu7_powerdown_vce(hwmgr); 186 186 } else { 187 187 smu7_powerup_vce(hwmgr); 188 - cgs_set_clockgating_state(hwmgr->device, 188 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 189 189 AMD_IP_BLOCK_TYPE_VCE, 190 190 AMD_CG_STATE_UNGATE); 191 - cgs_set_powergating_state(hwmgr->device, 191 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 192 192 AMD_IP_BLOCK_TYPE_VCE, 193 193 AMD_PG_STATE_UNGATE); 194 194 smu7_update_vce_dpm(hwmgr, false);
+8 -12
drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
··· 1892 1892 data->uvd_power_gated = bgate; 1893 1893 1894 1894 if (bgate) { 1895 - cgs_set_powergating_state(hwmgr->device, 1895 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 1896 1896 AMD_IP_BLOCK_TYPE_UVD, 1897 1897 AMD_PG_STATE_GATE); 1898 - cgs_set_clockgating_state(hwmgr->device, 1898 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 1899 1899 AMD_IP_BLOCK_TYPE_UVD, 1900 1900 AMD_CG_STATE_GATE); 1901 1901 smu8_dpm_update_uvd_dpm(hwmgr, true); 1902 1902 smu8_dpm_powerdown_uvd(hwmgr); 1903 1903 } else { 1904 1904 smu8_dpm_powerup_uvd(hwmgr); 1905 - cgs_set_clockgating_state(hwmgr->device, 1905 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 1906 1906 AMD_IP_BLOCK_TYPE_UVD, 1907 1907 AMD_CG_STATE_UNGATE); 1908 - cgs_set_powergating_state(hwmgr->device, 1908 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 1909 1909 AMD_IP_BLOCK_TYPE_UVD, 1910 1910 AMD_PG_STATE_UNGATE); 1911 1911 smu8_dpm_update_uvd_dpm(hwmgr, false); ··· 1918 1918 struct smu8_hwmgr *data = hwmgr->backend; 1919 1919 1920 1920 if (bgate) { 1921 - cgs_set_powergating_state( 1922 - hwmgr->device, 1921 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 1923 1922 AMD_IP_BLOCK_TYPE_VCE, 1924 1923 AMD_PG_STATE_GATE); 1925 - cgs_set_clockgating_state( 1926 - hwmgr->device, 1924 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 1927 1925 AMD_IP_BLOCK_TYPE_VCE, 1928 1926 AMD_CG_STATE_GATE); 1929 1927 smu8_enable_disable_vce_dpm(hwmgr, false); ··· 1930 1932 } else { 1931 1933 smu8_dpm_powerup_vce(hwmgr); 1932 1934 data->vce_power_gated = false; 1933 - cgs_set_clockgating_state( 1934 - hwmgr->device, 1935 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 1935 1936 AMD_IP_BLOCK_TYPE_VCE, 1936 1937 AMD_CG_STATE_UNGATE); 1937 - cgs_set_powergating_state( 1938 - hwmgr->device, 1938 + amdgpu_device_ip_set_powergating_state(hwmgr->adev, 1939 1939 AMD_IP_BLOCK_TYPE_VCE, 1940 1940 AMD_PG_STATE_UNGATE); 1941 1941 smu8_dpm_update_vce_dpm(hwmgr);
+4 -4
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
··· 306 306 } 307 307 308 308 /* To initialize all clock gating before RLC loaded and running.*/ 309 - cgs_set_clockgating_state(hwmgr->device, 309 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 310 310 AMD_IP_BLOCK_TYPE_GFX, AMD_CG_STATE_GATE); 311 - cgs_set_clockgating_state(hwmgr->device, 311 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 312 312 AMD_IP_BLOCK_TYPE_GMC, AMD_CG_STATE_GATE); 313 - cgs_set_clockgating_state(hwmgr->device, 313 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 314 314 AMD_IP_BLOCK_TYPE_SDMA, AMD_CG_STATE_GATE); 315 - cgs_set_clockgating_state(hwmgr->device, 315 + amdgpu_device_ip_set_clockgating_state(hwmgr->adev, 316 316 AMD_IP_BLOCK_TYPE_COMMON, AMD_CG_STATE_GATE); 317 317 318 318 /* Setup SoftRegsStart here for register lookup in case