From 9255ec34c5aed6d44c99d14d33e99abfb1241aff Mon Sep 17 00:00:00 2001 From: Hareesh Gundu Date: Thu, 9 Jul 2020 22:45:46 +0530 Subject: [PATCH] msm: kgsl: Unbind adreno from component device for nogmu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In absence of GMU adreno can’t bind it as component. So invoke adreno_bind/unbind() calls manually to succeed probe. Change-Id: I7a16ea4ca381dc9466e5827ef3f8b98a2aaf39fa Signed-off-by: Hareesh Gundu --- drivers/gpu/msm/adreno.c | 41 ++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 514865058377..d19d4abd2f72 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1274,6 +1274,12 @@ static void adreno_setup_device(struct adreno_device *adreno_dev) } } +static const struct of_device_id adreno_gmu_match[] = { + { .compatible = "qcom,gpu-gmu" }, + { .compatible = "qcom,gpu-rgmu" }, + {}, +}; + int adreno_device_probe(struct platform_device *pdev, struct adreno_device *adreno_dev) { @@ -1310,10 +1316,12 @@ int adreno_device_probe(struct platform_device *pdev, * Bind the GMU components (if applicable) before doing the KGSL * platform probe */ - status = component_bind_all(dev, NULL); - if (status) { - kgsl_bus_close(device); - return status; + if (of_find_matching_node(dev->of_node, adreno_gmu_match)) { + status = component_bind_all(dev, NULL); + if (status) { + kgsl_bus_close(device); + return status; + } } /* @@ -1418,7 +1426,9 @@ int adreno_device_probe(struct platform_device *pdev, err: device->pdev = NULL; - component_unbind_all(dev, NULL); + if (of_find_matching_node(dev->of_node, adreno_gmu_match)) + component_unbind_all(dev, NULL); + kgsl_bus_close(device); return status; @@ -1511,7 +1521,8 @@ static void adreno_unbind(struct device *dev) kgsl_device_platform_remove(device); - component_unbind_all(dev, NULL); + if (of_find_matching_node(dev->of_node, adreno_gmu_match)) + component_unbind_all(dev, NULL); clear_bit(ADRENO_DEVICE_PWRON_FIXUP, &adreno_dev->priv); clear_bit(ADRENO_DEVICE_INITIALIZED, &adreno_dev->priv); @@ -3755,12 +3766,6 @@ const struct adreno_power_ops adreno_power_operations = { .touch_wakeup = adreno_touch_wakeup, }; -static const struct of_device_id adreno_gmu_match[] = { - { .compatible = "qcom,gpu-gmu" }, - { .compatible = "qcom,gpu-rgmu" }, - {}, -}; - static int _compare_of(struct device *dev, void *data) { return (dev->of_node == data); @@ -3795,12 +3800,20 @@ static int adreno_probe(struct platform_device *pdev) adreno_add_gmu_components(&pdev->dev, &match); - return component_master_add_with_match(&pdev->dev, &adreno_ops, match); + if (match) + return component_master_add_with_match(&pdev->dev, + &adreno_ops, match); + else + return adreno_bind(&pdev->dev); } static int adreno_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &adreno_ops); + if (of_find_matching_node(NULL, adreno_gmu_match)) + component_master_del(&pdev->dev, &adreno_ops); + else + adreno_unbind(&pdev->dev); + return 0; }