mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
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: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
a0e052ce2a
commit
3f65d0a911
2 changed files with 22 additions and 7 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue