drm/msm/adreno: Generate name from chipid for 7c3
authorAkhil P Oommen <quic_akhilpo@quicinc.com>
Fri, 25 Feb 2022 19:21:29 +0000 (00:51 +0530)
committerRob Clark <robdclark@chromium.org>
Fri, 25 Feb 2022 21:29:57 +0000 (13:29 -0800)
Use a gpu name which is sprintf'ed from the chipid for 7c3 gpu instead of
hardcoding one. This helps to avoid code churn in case of a gpu rename.

Signed-off-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Link: https://lore.kernel.org/r/20220226005021.v2.2.I9436e0e300f76b2e6c34136a0b902e8cfd73e0d6@changeid
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/adreno/adreno_device.c
drivers/gpu/drm/msm/adreno/adreno_gpu.c

index fb261930ad1c70ad63c8af5783ec8246b75448bc..89cfd84760d7e1887703f0f02c43d5621637ec63 100644 (file)
@@ -318,7 +318,6 @@ static const struct adreno_info gpulist[] = {
                .hwcg = a660_hwcg,
        }, {
                .rev = ADRENO_REV(6, 3, 5, ANY_ID),
-               .name = "Adreno 7c Gen 3",
                .fw = {
                        [ADRENO_FW_SQE] = "a660_sqe.fw",
                        [ADRENO_FW_GMU] = "a660_gmu.bin",
index 58dfb23cf2afacb239f176aa692c2168702563aa..d5810195df71fad5db100888de5ac72514145671 100644 (file)
@@ -930,12 +930,23 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
        struct adreno_platform_config *config = dev->platform_data;
        struct msm_gpu_config adreno_gpu_config  = { 0 };
        struct msm_gpu *gpu = &adreno_gpu->base;
+       struct adreno_rev *rev = &config->rev;
+       const char *gpu_name;
 
        adreno_gpu->funcs = funcs;
        adreno_gpu->info = adreno_info(config->rev);
        adreno_gpu->gmem = adreno_gpu->info->gmem;
        adreno_gpu->revn = adreno_gpu->info->revn;
-       adreno_gpu->rev = config->rev;
+       adreno_gpu->rev = *rev;
+
+       gpu_name = adreno_gpu->info->name;
+       if (!gpu_name) {
+               gpu_name = devm_kasprintf(dev, GFP_KERNEL, "%d.%d.%d.%d",
+                               rev->core, rev->major, rev->minor,
+                               rev->patchid);
+               if (!gpu_name)
+                       return -ENOMEM;
+       }
 
        adreno_gpu_config.ioname = "kgsl_3d0_reg_memory";
 
@@ -949,7 +960,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev,
        pm_runtime_enable(dev);
 
        return msm_gpu_init(drm, pdev, &adreno_gpu->base, &funcs->base,
-                       adreno_gpu->info->name, &adreno_gpu_config);
+                       gpu_name, &adreno_gpu_config);
 }
 
 void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)