Commit 27514ce2 authored by Akhil P Oommen's avatar Akhil P Oommen Committed by Rob Clark

drm/msm/a6xx: Use rev to identify SKU

Use rev instead of revn to identify the SKU. This is in
preparation to the introduction of 7c3 gpu which won't have a
revn.
Signed-off-by: default avatarAkhil P Oommen <akhilpo@codeaurora.org>
Link: https://lore.kernel.org/r/20210730011945.v4.2.I286ef007fcadd9e6ee3b2c0ad948f990735f9610@changeidSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent a6f24383
...@@ -1675,11 +1675,11 @@ static u32 a618_get_speed_bin(u32 fuse) ...@@ -1675,11 +1675,11 @@ static u32 a618_get_speed_bin(u32 fuse)
return UINT_MAX; return UINT_MAX;
} }
static u32 fuse_to_supp_hw(struct device *dev, u32 revn, u32 fuse) static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse)
{ {
u32 val = UINT_MAX; u32 val = UINT_MAX;
if (revn == 618) if (adreno_cmp_rev(ADRENO_REV(6, 1, 8, ANY_ID), rev))
val = a618_get_speed_bin(fuse); val = a618_get_speed_bin(fuse);
if (val == UINT_MAX) { if (val == UINT_MAX) {
...@@ -1692,8 +1692,7 @@ static u32 fuse_to_supp_hw(struct device *dev, u32 revn, u32 fuse) ...@@ -1692,8 +1692,7 @@ static u32 fuse_to_supp_hw(struct device *dev, u32 revn, u32 fuse)
return (1 << val); return (1 << val);
} }
static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu, static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev)
u32 revn)
{ {
u32 supp_hw = UINT_MAX; u32 supp_hw = UINT_MAX;
u16 speedbin; u16 speedbin;
...@@ -1714,7 +1713,7 @@ static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu, ...@@ -1714,7 +1713,7 @@ static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu,
} }
speedbin = le16_to_cpu(speedbin); speedbin = le16_to_cpu(speedbin);
supp_hw = fuse_to_supp_hw(dev, revn, speedbin); supp_hw = fuse_to_supp_hw(dev, rev, speedbin);
done: done:
ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1); ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1);
...@@ -1785,7 +1784,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) ...@@ -1785,7 +1784,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
a6xx_llc_slices_init(pdev, a6xx_gpu); a6xx_llc_slices_init(pdev, a6xx_gpu);
ret = a6xx_set_supported_hw(&pdev->dev, a6xx_gpu, info->revn); ret = a6xx_set_supported_hw(&pdev->dev, config->rev);
if (ret) { if (ret) {
a6xx_destroy(&(a6xx_gpu->base.base)); a6xx_destroy(&(a6xx_gpu->base.base));
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include "adreno_gpu.h" #include "adreno_gpu.h"
#define ANY_ID 0xff
bool hang_debug = false; bool hang_debug = false;
MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!)"); MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!)");
module_param_named(hang_debug, hang_debug, bool, 0600); module_param_named(hang_debug, hang_debug, bool, 0600);
...@@ -325,6 +323,15 @@ static inline bool _rev_match(uint8_t entry, uint8_t id) ...@@ -325,6 +323,15 @@ static inline bool _rev_match(uint8_t entry, uint8_t id)
return (entry == ANY_ID) || (entry == id); return (entry == ANY_ID) || (entry == id);
} }
bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2)
{
return _rev_match(rev1.core, rev2.core) &&
_rev_match(rev1.major, rev2.major) &&
_rev_match(rev1.minor, rev2.minor) &&
_rev_match(rev1.patchid, rev2.patchid);
}
const struct adreno_info *adreno_info(struct adreno_rev rev) const struct adreno_info *adreno_info(struct adreno_rev rev)
{ {
int i; int i;
...@@ -332,10 +339,7 @@ const struct adreno_info *adreno_info(struct adreno_rev rev) ...@@ -332,10 +339,7 @@ const struct adreno_info *adreno_info(struct adreno_rev rev)
/* identify gpu: */ /* identify gpu: */
for (i = 0; i < ARRAY_SIZE(gpulist); i++) { for (i = 0; i < ARRAY_SIZE(gpulist); i++) {
const struct adreno_info *info = &gpulist[i]; const struct adreno_info *info = &gpulist[i];
if (_rev_match(info->rev.core, rev.core) && if (adreno_cmp_rev(info->rev, rev))
_rev_match(info->rev.major, rev.major) &&
_rev_match(info->rev.minor, rev.minor) &&
_rev_match(info->rev.patchid, rev.patchid))
return info; return info;
} }
......
...@@ -42,6 +42,8 @@ struct adreno_rev { ...@@ -42,6 +42,8 @@ struct adreno_rev {
uint8_t patchid; uint8_t patchid;
}; };
#define ANY_ID 0xff
#define ADRENO_REV(core, major, minor, patchid) \ #define ADRENO_REV(core, major, minor, patchid) \
((struct adreno_rev){ core, major, minor, patchid }) ((struct adreno_rev){ core, major, minor, patchid })
...@@ -141,6 +143,8 @@ struct adreno_platform_config { ...@@ -141,6 +143,8 @@ struct adreno_platform_config {
__ret; \ __ret; \
}) })
bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2);
static inline bool adreno_is_a2xx(struct adreno_gpu *gpu) static inline bool adreno_is_a2xx(struct adreno_gpu *gpu)
{ {
return (gpu->revn < 300); return (gpu->revn < 300);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment