From 30ae99a13bfc5fda2a1081a2261254923af4b01d Mon Sep 17 00:00:00 2001 From: Pankaj Gupta Date: Thu, 20 May 2021 22:50:08 +0530 Subject: [PATCH] msm: kgsl: Allow compatible string matching based on gpu models We can have different GPU properties for different gpu models. Add functionality to use matched GPU target from adreno_gpulist, based on matching compatible string, available in qcom,gpu-models. Change-Id: I55060ef60000c729d0dca6f6ae07bd76b31d5f94 Signed-off-by: Pankaj Gupta --- drivers/gpu/msm/adreno.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 9545cd2c06be..4507ad717509 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -37,6 +37,8 @@ static void adreno_input_work(struct work_struct *work); static int adreno_soft_reset(struct kgsl_device *device); static unsigned int counter_delta(struct kgsl_device *device, unsigned int reg, unsigned int *counter); +static struct device_node * + adreno_get_gpu_model_node(struct platform_device *pdev); static struct adreno_device device_3d0; @@ -629,16 +631,24 @@ _get_gpu_core(struct platform_device *pdev, unsigned int chipid) unsigned int minor = ADRENO_CHIPID_MINOR(chipid); unsigned int patchid = ADRENO_CHIPID_PATCH(chipid); int i; + struct device_node *node; + + /* + * When "qcom,gpu-models" is defined, use gpu model node to match + * on a compatible string, otherwise match using legacy way. + */ + node = adreno_get_gpu_model_node(pdev); + if (!node || !of_find_property(node, "compatible", NULL)) + node = pdev->dev.of_node; /* Check to see if any of the entries match on a compatible string */ for (i = 0; i < ARRAY_SIZE(adreno_gpulist); i++) { if (adreno_gpulist[i]->compatible && - of_device_is_compatible(pdev->dev.of_node, + of_device_is_compatible(node, adreno_gpulist[i]->compatible)) return adreno_gpulist[i]; } - for (i = 0; i < ARRAY_SIZE(adreno_gpulist); i++) { if (core == adreno_gpulist[i]->core && _rev_match(major, adreno_gpulist[i]->major) &&