mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-21 06:50:25 +00:00
drm/msm/adreno: Check for recognized GPU before bind
If we have a newer dtb than kernel, we could end up in a situation where the GPU device is present in the dtb, but not in the drivers device table. We don't want this to prevent the display from probing. So check that we recognize the GPU before adding the GPU component. v2: use %pOF Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/657701/
This commit is contained in:
parent
1efb73791c
commit
0838fc3e67
3 changed files with 26 additions and 6 deletions
|
@ -182,6 +182,26 @@ static int find_chipid(struct device_node *node, uint32_t *chipid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool adreno_has_gpu(struct device_node *node)
|
||||||
|
{
|
||||||
|
const struct adreno_info *info;
|
||||||
|
uint32_t chip_id;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = find_chipid(node, &chip_id);
|
||||||
|
if (ret)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
info = adreno_info(chip_id);
|
||||||
|
if (!info) {
|
||||||
|
pr_warn("%pOF: Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
|
||||||
|
node, ADRENO_CHIPID_ARGS(chip_id));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int adreno_bind(struct device *dev, struct device *master, void *data)
|
static int adreno_bind(struct device *dev, struct device *master, void *data)
|
||||||
{
|
{
|
||||||
static struct adreno_platform_config config = {};
|
static struct adreno_platform_config config = {};
|
||||||
|
@ -192,18 +212,17 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = find_chipid(dev->of_node, &config.chip_id);
|
ret = find_chipid(dev->of_node, &config.chip_id);
|
||||||
if (ret)
|
/* We shouldn't have gotten this far if we can't parse the chip_id */
|
||||||
|
if (WARN_ON(ret))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
dev->platform_data = &config;
|
dev->platform_data = &config;
|
||||||
priv->gpu_pdev = to_platform_device(dev);
|
priv->gpu_pdev = to_platform_device(dev);
|
||||||
|
|
||||||
info = adreno_info(config.chip_id);
|
info = adreno_info(config.chip_id);
|
||||||
if (!info) {
|
/* We shouldn't have gotten this far if we don't recognize the GPU: */
|
||||||
dev_warn(drm->dev, "Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
|
if (!WARN_ON(info))
|
||||||
ADRENO_CHIPID_ARGS(config.chip_id));
|
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
|
||||||
|
|
||||||
config.info = info;
|
config.info = info;
|
||||||
|
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ static int add_gpu_components(struct device *dev,
|
||||||
if (!np)
|
if (!np)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (of_device_is_available(np))
|
if (of_device_is_available(np) && adreno_has_gpu(np))
|
||||||
drm_of_component_match_add(dev, matchptr, component_compare_of, np);
|
drm_of_component_match_add(dev, matchptr, component_compare_of, np);
|
||||||
|
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
|
|
|
@ -662,6 +662,7 @@ msm_gpu_create_private_address_space(struct msm_gpu *gpu, struct task_struct *ta
|
||||||
void msm_gpu_cleanup(struct msm_gpu *gpu);
|
void msm_gpu_cleanup(struct msm_gpu *gpu);
|
||||||
|
|
||||||
struct msm_gpu *adreno_load_gpu(struct drm_device *dev);
|
struct msm_gpu *adreno_load_gpu(struct drm_device *dev);
|
||||||
|
bool adreno_has_gpu(struct device_node *node);
|
||||||
void __init adreno_register(void);
|
void __init adreno_register(void);
|
||||||
void __exit adreno_unregister(void);
|
void __exit adreno_unregister(void);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue