Skip to content

Commit b3bcd58

Browse files
konradybciorobclark
authored andcommitted
drm/msm/a6xx: Use adreno_is_aXYZ macros in speedbin matching
Before transitioning to using per-SoC and not per-Adreno speedbin fuse values (need another patchset to land elsewhere), a good improvement/stopgap solution is to use adreno_is_aXYZ macros in place of explicit revision matching. Do so to allow differentiating between A619 and A619_holi. Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Akhil P Oommen <[email protected]> Signed-off-by: Konrad Dybcio <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/542777/ Signed-off-by: Rob Clark <[email protected]>
1 parent ac92654 commit b3bcd58

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,23 +2269,23 @@ static u32 adreno_7c3_get_speed_bin(u32 fuse)
22692269
return UINT_MAX;
22702270
}
22712271

2272-
static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
2272+
static u32 fuse_to_supp_hw(struct device *dev, struct adreno_gpu *adreno_gpu, u32 fuse)
22732273
{
22742274
u32 val = UINT_MAX;
22752275

2276-
if (adreno_cmp_rev(ADRENO_REV(6, 1, 8, ANY_ID), rev))
2276+
if (adreno_is_a618(adreno_gpu))
22772277
val = a618_get_speed_bin(fuse);
22782278

2279-
else if (adreno_cmp_rev(ADRENO_REV(6, 1, 9, ANY_ID), rev))
2279+
else if (adreno_is_a619(adreno_gpu))
22802280
val = a619_get_speed_bin(fuse);
22812281

2282-
else if (adreno_cmp_rev(ADRENO_REV(6, 3, 5, ANY_ID), rev))
2282+
else if (adreno_is_7c3(adreno_gpu))
22832283
val = adreno_7c3_get_speed_bin(fuse);
22842284

2285-
else if (adreno_cmp_rev(ADRENO_REV(6, 4, 0, ANY_ID), rev))
2285+
else if (adreno_is_a640(adreno_gpu))
22862286
val = a640_get_speed_bin(fuse);
22872287

2288-
else if (adreno_cmp_rev(ADRENO_REV(6, 5, 0, ANY_ID), rev))
2288+
else if (adreno_is_a650(adreno_gpu))
22892289
val = a650_get_speed_bin(fuse);
22902290

22912291
if (val == UINT_MAX) {
@@ -2298,7 +2298,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
22982298
return (1 << val);
22992299
}
23002300

2301-
static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
2301+
static int a6xx_set_supported_hw(struct device *dev, struct adreno_gpu *adreno_gpu)
23022302
{
23032303
u32 supp_hw;
23042304
u32 speedbin;
@@ -2317,7 +2317,7 @@ static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
23172317
return ret;
23182318
}
23192319

2320-
supp_hw = fuse_to_supp_hw(dev, rev, speedbin);
2320+
supp_hw = fuse_to_supp_hw(dev, adreno_gpu, speedbin);
23212321

23222322
ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1);
23232323
if (ret)
@@ -2438,7 +2438,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
24382438

24392439
a6xx_llc_slices_init(pdev, a6xx_gpu);
24402440

2441-
ret = a6xx_set_supported_hw(&pdev->dev, config->rev);
2441+
ret = a6xx_set_supported_hw(&pdev->dev, adreno_gpu);
24422442
if (ret) {
24432443
a6xx_destroy(&(a6xx_gpu->base.base));
24442444
return ERR_PTR(ret);

drivers/gpu/drm/msm/adreno/adreno_gpu.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,9 @@ static inline int adreno_is_a630(const struct adreno_gpu *gpu)
279279
return adreno_is_revn(gpu, 630);
280280
}
281281

282-
static inline int adreno_is_a640_family(const struct adreno_gpu *gpu)
282+
static inline int adreno_is_a640(const struct adreno_gpu *gpu)
283283
{
284-
return adreno_is_revn(gpu, 640) ||
285-
adreno_is_revn(gpu, 680);
284+
return adreno_is_revn(gpu, 640);
286285
}
287286

288287
static inline int adreno_is_a650(const struct adreno_gpu *gpu)
@@ -301,6 +300,11 @@ static inline int adreno_is_a660(const struct adreno_gpu *gpu)
301300
return adreno_is_revn(gpu, 660);
302301
}
303302

303+
static inline int adreno_is_a680(const struct adreno_gpu *gpu)
304+
{
305+
return adreno_is_revn(gpu, 680);
306+
}
307+
304308
static inline int adreno_is_a690(const struct adreno_gpu *gpu)
305309
{
306310
return adreno_is_revn(gpu, 690);
@@ -328,6 +332,11 @@ static inline int adreno_is_a650_family(const struct adreno_gpu *gpu)
328332
adreno_is_a660_family(gpu);
329333
}
330334

335+
static inline int adreno_is_a640_family(const struct adreno_gpu *gpu)
336+
{
337+
return adreno_is_a640(gpu) || adreno_is_a680(gpu);
338+
}
339+
331340
u64 adreno_private_address_space_size(struct msm_gpu *gpu);
332341
int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
333342
uint32_t param, uint64_t *value, uint32_t *len);

0 commit comments

Comments
 (0)