diff options
author | Nils Wallménius <nils.wallmenius@gmail.com> | 2016-05-05 03:07:47 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-05-11 12:31:23 -0400 |
commit | 354ef928a0e67166249c0136cdba21fdfef31702 (patch) | |
tree | 4e336d646b7a8e2d02e48ffb795651f676b270e1 | |
parent | 9887e425f91b063d68ee1fbec76dea15d6a82085 (diff) |
drm/amdgpu: Simplify calculation in *get_sleep_divider_id_from_clock
a / (1 << b) is equivalent to a >> b for unsigned values
Signed-off-by: Nils Wallménius <nils.wallmenius@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | 2 |
5 files changed, 5 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c index 4d50c43c0939..b2c2f3761c68 100644 --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c | |||
@@ -2560,7 +2560,7 @@ static u8 ci_get_sleep_divider_id_from_clock(struct amdgpu_device *adev, | |||
2560 | return 0; | 2560 | return 0; |
2561 | 2561 | ||
2562 | for (i = CISLAND_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { | 2562 | for (i = CISLAND_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { |
2563 | tmp = sclk / (1 << i); | 2563 | tmp = sclk >> i; |
2564 | if (tmp >= min || i == 0) | 2564 | if (tmp >= min || i == 0) |
2565 | break; | 2565 | break; |
2566 | } | 2566 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c index 4bc107a4546e..bc7997b649c0 100644 --- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c | |||
@@ -135,11 +135,6 @@ static void sumo_take_smu_control(struct amdgpu_device *adev, bool enable) | |||
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | 137 | ||
138 | static u32 sumo_get_sleep_divider_from_id(u32 id) | ||
139 | { | ||
140 | return 1 << id; | ||
141 | } | ||
142 | |||
143 | static void sumo_construct_sclk_voltage_mapping_table(struct amdgpu_device *adev, | 138 | static void sumo_construct_sclk_voltage_mapping_table(struct amdgpu_device *adev, |
144 | struct sumo_sclk_voltage_mapping_table *sclk_voltage_mapping_table, | 139 | struct sumo_sclk_voltage_mapping_table *sclk_voltage_mapping_table, |
145 | ATOM_AVAILABLE_SCLK_LIST *table) | 140 | ATOM_AVAILABLE_SCLK_LIST *table) |
@@ -2185,7 +2180,7 @@ static u8 kv_get_sleep_divider_id_from_clock(struct amdgpu_device *adev, | |||
2185 | return 0; | 2180 | return 0; |
2186 | 2181 | ||
2187 | for (i = KV_MAX_DEEPSLEEP_DIVIDER_ID; i > 0; i--) { | 2182 | for (i = KV_MAX_DEEPSLEEP_DIVIDER_ID; i > 0; i--) { |
2188 | temp = sclk / sumo_get_sleep_divider_from_id(i); | 2183 | temp = sclk >> i; |
2189 | if (temp >= min) | 2184 | if (temp >= min) |
2190 | break; | 2185 | break; |
2191 | } | 2186 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c index 9847e20860bc..cc4b714c0c09 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | |||
@@ -1907,7 +1907,7 @@ static uint8_t fiji_get_sleep_divider_id_from_clock(struct pp_hwmgr *hwmgr, | |||
1907 | 1907 | ||
1908 | PP_ASSERT_WITH_CODE((clock >= min), "Engine clock can't satisfy stutter requirement!", return 0); | 1908 | PP_ASSERT_WITH_CODE((clock >= min), "Engine clock can't satisfy stutter requirement!", return 0); |
1909 | for (i = FIJI_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { | 1909 | for (i = FIJI_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { |
1910 | temp = clock / (1UL << i); | 1910 | temp = clock >> i; |
1911 | 1911 | ||
1912 | if (temp >= min || i == 0) | 1912 | if (temp >= min || i == 0) |
1913 | break; | 1913 | break; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index c911ab881d6a..93768fa1dcdc 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -1177,7 +1177,7 @@ static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr, | |||
1177 | */ | 1177 | */ |
1178 | PP_ASSERT_WITH_CODE((clock >= POLARIS10_MINIMUM_ENGINE_CLOCK), "Engine clock can't satisfy stutter requirement!", return 0); | 1178 | PP_ASSERT_WITH_CODE((clock >= POLARIS10_MINIMUM_ENGINE_CLOCK), "Engine clock can't satisfy stutter requirement!", return 0); |
1179 | for (i = POLARIS10_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { | 1179 | for (i = POLARIS10_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { |
1180 | temp = clock / (1UL << i); | 1180 | temp = clock >> i; |
1181 | 1181 | ||
1182 | if (temp >= POLARIS10_MINIMUM_ENGINE_CLOCK || i == 0) | 1182 | if (temp >= POLARIS10_MINIMUM_ENGINE_CLOCK || i == 0) |
1183 | break; | 1183 | break; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 8969f1ef1de5..13f97708e54c 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
@@ -2426,7 +2426,7 @@ static uint8_t tonga_get_sleep_divider_id_from_clock(struct pp_hwmgr *hwmgr, | |||
2426 | "Engine clock can't satisfy stutter requirement!", return 0); | 2426 | "Engine clock can't satisfy stutter requirement!", return 0); |
2427 | 2427 | ||
2428 | for (i = TONGA_MAX_DEEPSLEEP_DIVIDER_ID;; i--) { | 2428 | for (i = TONGA_MAX_DEEPSLEEP_DIVIDER_ID;; i--) { |
2429 | temp = engine_clock / (1 << i); | 2429 | temp = engine_clock >> i; |
2430 | 2430 | ||
2431 | if(temp >= min || i == 0) | 2431 | if(temp >= min || i == 0) |
2432 | break; | 2432 | break; |