summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDhaval Patel <pdhaval@quicinc.com>2016-11-29 09:25:07 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-11-29 09:25:07 -0800
commite2ae6640273b36cc8c4bae209a7ecbdeeb48cf29 (patch)
tree7527873083b42ea03b421d52f342063633bb79b5 /drivers/gpu
parent3498bf131f294f0b33b53aa133d119b75b58d63b (diff)
parent857addaf00d0b9ead743bd434e8785fd41f20c19 (diff)
Merge "drm/msm: support probe deferral in msm_drv" into dev/msm-4.4-drm_kms
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 860f99a761b0..fb03350e0132 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -212,6 +212,7 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
static int msm_unload(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
+ struct platform_device *pdev = dev->platformdev;
struct msm_kms *kms = priv->kms;
struct msm_gpu *gpu = priv->gpu;
struct msm_vblank_ctrl *vbl_ctrl = &priv->vblank_ctrl;
@@ -270,6 +271,9 @@ static int msm_unload(struct drm_device *dev)
sde_evtlog_destroy();
+ sde_power_client_destroy(&priv->phandle, priv->pclient);
+ sde_power_resource_deinit(pdev, &priv->phandle);
+
component_unbind_all(dev->dev, dev);
dev->dev_private = NULL;
@@ -383,7 +387,13 @@ static int msm_init_vram(struct drm_device *dev)
static int msm_component_bind_all(struct device *dev,
struct drm_device *drm_dev)
{
- return component_bind_all(dev, drm_dev);
+ int ret;
+
+ ret = component_bind_all(dev, drm_dev);
+ if (ret)
+ DRM_ERROR("component_bind_all failed: %d\n", ret);
+
+ return ret;
}
#else
static int msm_component_bind_all(struct device *dev,
@@ -400,7 +410,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
struct msm_kms *kms;
int ret, i;
- priv = platform_get_drvdata(pdev);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(dev->dev, "failed to allocate private data\n");
return -ENOMEM;
@@ -408,11 +418,35 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
dev->dev_private = priv;
+ priv->wq = alloc_ordered_workqueue("msm_drm", 0);
+ init_waitqueue_head(&priv->fence_event);
+ init_waitqueue_head(&priv->pending_crtcs_event);
+
INIT_LIST_HEAD(&priv->client_event_list);
+ INIT_LIST_HEAD(&priv->inactive_list);
+ INIT_LIST_HEAD(&priv->fence_cbs);
+ INIT_LIST_HEAD(&priv->vblank_ctrl.event_list);
+ init_kthread_work(&priv->vblank_ctrl.work, vblank_ctrl_worker);
+ spin_lock_init(&priv->vblank_ctrl.lock);
+
drm_mode_config_init(dev);
platform_set_drvdata(pdev, dev);
+ ret = sde_power_resource_init(pdev, &priv->phandle);
+ if (ret) {
+ pr_err("sde power resource init failed\n");
+ goto fail;
+ }
+
+ priv->pclient = sde_power_client_create(&priv->phandle, "sde");
+ if (IS_ERR_OR_NULL(priv->pclient)) {
+ pr_err("sde power client create failed\n");
+ ret = -EINVAL;
+ goto fail;
+ }
+
+ /* Bind all our sub-components: */
ret = msm_component_bind_all(dev->dev, dev);
if (ret)
return ret;
@@ -1628,7 +1662,13 @@ static const struct dev_pm_ops msm_pm_ops = {
static int msm_drm_bind(struct device *dev)
{
- return drm_platform_init(&msm_driver, to_platform_device(dev));
+ int ret;
+
+ ret = drm_platform_init(&msm_driver, to_platform_device(dev));
+ if (ret)
+ DRM_ERROR("drm_platform_init failed: %d\n", ret);
+
+ return ret;
}
static void msm_drm_unbind(struct device *dev)
@@ -1676,10 +1716,11 @@ static int add_components(struct device *dev, struct component_match **matchptr,
static int msm_add_master_component(struct device *dev,
struct component_match *match)
{
- int ret = component_master_add_with_match(dev, &msm_drm_ops, match);
+ int ret;
+ ret = component_master_add_with_match(dev, &msm_drm_ops, match);
if (ret)
- pr_err("component add match failed\n");
+ DRM_ERROR("component add match failed: %d\n", ret);
return ret;
}
@@ -1705,7 +1746,6 @@ static int msm_pdev_probe(struct platform_device *pdev)
{
int ret;
struct component_match *match = NULL;
- struct msm_drm_private *priv;
#ifdef CONFIG_OF
add_components(&pdev->dev, &match, "connectors");
@@ -1736,56 +1776,16 @@ static int msm_pdev_probe(struct platform_device *pdev)
component_match_add(&pdev->dev, &match, compare_dev, dev);
}
#endif
-
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
- priv->wq = alloc_ordered_workqueue("msm_drm", 0);
- init_waitqueue_head(&priv->fence_event);
- init_waitqueue_head(&priv->pending_crtcs_event);
-
- INIT_LIST_HEAD(&priv->inactive_list);
- INIT_LIST_HEAD(&priv->fence_cbs);
- INIT_LIST_HEAD(&priv->vblank_ctrl.event_list);
- init_kthread_work(&priv->vblank_ctrl.work, vblank_ctrl_worker);
- spin_lock_init(&priv->vblank_ctrl.lock);
-
- platform_set_drvdata(pdev, priv);
-
- ret = sde_power_resource_init(pdev, &priv->phandle);
- if (ret) {
- pr_err("sde power resource init failed\n");
- goto hw_setup_failure;
- }
-
- priv->pclient = sde_power_client_create(&priv->phandle, "sde");
- if (IS_ERR_OR_NULL(priv->pclient)) {
- pr_err("sde power client create failed\n");
- ret = -EINVAL;
- goto client_create_err;
- }
-
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-
- return msm_add_master_component(&pdev->dev, match);
-
-client_create_err:
- sde_power_resource_deinit(pdev, &priv->phandle);
-hw_setup_failure:
- kfree(priv);
+ ret = msm_add_master_component(&pdev->dev, match);
return ret;
}
static int msm_pdev_remove(struct platform_device *pdev)
{
- struct drm_device *drm_dev = platform_get_drvdata(pdev);
- struct msm_drm_private *priv = drm_dev->dev_private;
-
msm_drm_unbind(&pdev->dev);
component_master_del(&pdev->dev, &msm_drm_ops);
- sde_power_resource_deinit(pdev, &priv->phandle);
return 0;
}