msm: kgsl: Establish a standard GPU ID scheme for the KGSL core
Establish a standard generic format for a GPU ID in the KGSL core:
[0:15] - GPU specific identifier
[16:31] - 0x0002 for 2D or 0x0003 for 3D
Add a KGSL core function to get the GPU ID from the devices and
GPU specific functions to return them. For Z180, the ID will be
0x0002000B4 (0xB4 = 180). For 3D, the ID will be 0x00030000 ORed
with the GPU identifier (anywhere from 205 to 225).
Change-Id: Ic0dedbadddb3f587121913b9c226e2bda466f84e
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c
index d7c11db..2681263 100644
--- a/drivers/gpu/msm/adreno.c
+++ b/drivers/gpu/msm/adreno.c
@@ -1317,6 +1317,18 @@
adreno_dev->gpudev->irq_control(adreno_dev, state);
}
+static unsigned int adreno_gpuid(struct kgsl_device *device)
+{
+ struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
+
+ /* Standard KGSL gpuid format:
+ * top word is 0x0002 for 2D or 0x0003 for 3D
+ * Bottom word is core specific identifer
+ */
+
+ return (0x0003 << 16) | ((int) adreno_dev->gpurev);
+}
+
static const struct kgsl_functable adreno_functable = {
/* Mandatory functions */
.regread = adreno_regread,
@@ -1335,6 +1347,7 @@
.cleanup_pt = adreno_cleanup_pt,
.power_stats = adreno_power_stats,
.irqctrl = adreno_irqctrl,
+ .gpuid = adreno_gpuid,
/* Optional functions */
.setstate = adreno_setstate,
.drawctxt_create = adreno_drawctxt_create,