Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f65d0a9 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Allow compatible string matching for gpu devices



Allow a GPU definition to specify a compatible string to match a GPU
target. If specified a matching compatible string will take priority
over the GPU chipid match.

Change-Id: Ic0dedbadd998dcc8e8f9bc5de2e383870258ad48
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent a0e052ce
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -615,7 +615,8 @@ static inline bool _rev_match(unsigned int id, unsigned int entry)
	return (entry == ANY_ID || entry == id);
}

static inline const struct adreno_gpu_core *_get_gpu_core(unsigned int chipid)
static const struct adreno_gpu_core *
_get_gpu_core(struct platform_device *pdev, unsigned int chipid)
{
	unsigned int core = ADRENO_CHIPID_CORE(chipid);
	unsigned int major = ADRENO_CHIPID_MAJOR(chipid);
@@ -623,6 +624,15 @@ static inline const struct adreno_gpu_core *_get_gpu_core(unsigned int chipid)
	unsigned int patchid = ADRENO_CHIPID_PATCH(chipid);
	int i;

	/* 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,
				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) &&
@@ -718,16 +728,16 @@ adreno_update_soc_hw_revision_quirks(struct adreno_device *adreno_dev,
		of_node_put(node);
}

static int adreno_identify_gpu(struct adreno_device *adreno_dev)
static int adreno_identify_gpu(struct platform_device *pdev,
		struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct adreno_gpudev *gpudev;
	int i;

	adreno_dev->gpucore = _get_gpu_core(adreno_dev->chipid);
	adreno_dev->gpucore = _get_gpu_core(pdev, adreno_dev->chipid);

	if (adreno_dev->gpucore == NULL) {
		dev_crit(&device->pdev->dev,
		dev_crit(&pdev->dev,
			"Unknown GPU chip ID %8.8X\n", adreno_dev->chipid);
		return -ENODEV;
	}
@@ -737,7 +747,7 @@ static int adreno_identify_gpu(struct adreno_device *adreno_dev)
	 * message
	 */
	if (adreno_dev->gpucore->features & ADRENO_DEPRECATED) {
		dev_err(&device->pdev->dev,
		dev_err(&pdev->dev,
			"Support for GPU %d.%d.%d.%d has been deprecated\n",
			adreno_dev->gpucore->core,
			adreno_dev->gpucore->major,
@@ -1340,7 +1350,7 @@ static int adreno_bind(struct device *dev)
	device->speed_bin = status;

	/* Get the chip ID from the DT and set up target specific parameters */
	if (adreno_identify_gpu(adreno_dev))
	if (adreno_identify_gpu(pdev, adreno_dev))
		return -ENODEV;

	status = adreno_of_get_power(adreno_dev, pdev);
+5 −0
Original line number Diff line number Diff line
@@ -340,6 +340,11 @@ struct adreno_reglist {
struct adreno_gpu_core {
	enum adreno_gpurev gpurev;
	unsigned int core, major, minor, patchid;
	/**
	 * @compatible: If specified, use the compatible string to match the
	 * device
	 */
	const char *compatible;
	unsigned long features;
	struct adreno_gpudev *gpudev;
	unsigned long gmem_base;