drm/exynos: update to use component match support
Update Exynos's DRM driver to use component match support rater than add_components. Changelog v2: - release devices and drivers if failed. - change compare_of to compare_dev. Signed-off-by: Inki Dae <inki.dae@samsung.com> Tested-by: Andrzej Hajda <a.hajda@samsung.com>
This commit is contained in:
parent
18383cb92f
commit
53c5558d95
@ -486,21 +486,20 @@ void exynos_drm_component_del(struct device *dev,
|
|||||||
mutex_unlock(&drm_component_lock);
|
mutex_unlock(&drm_component_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_of(struct device *dev, void *data)
|
static int compare_dev(struct device *dev, void *data)
|
||||||
{
|
{
|
||||||
return dev == (struct device *)data;
|
return dev == (struct device *)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exynos_drm_add_components(struct device *dev, struct master *m)
|
static struct component_match *exynos_drm_match_add(struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct component_match *match = NULL;
|
||||||
struct component_dev *cdev;
|
struct component_dev *cdev;
|
||||||
unsigned int attach_cnt = 0;
|
unsigned int attach_cnt = 0;
|
||||||
|
|
||||||
mutex_lock(&drm_component_lock);
|
mutex_lock(&drm_component_lock);
|
||||||
|
|
||||||
list_for_each_entry(cdev, &drm_component_list, list) {
|
list_for_each_entry(cdev, &drm_component_list, list) {
|
||||||
int ret;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add components to master only in case that crtc and
|
* Add components to master only in case that crtc and
|
||||||
* encoder/connector device objects exist.
|
* encoder/connector device objects exist.
|
||||||
@ -515,16 +514,10 @@ static int exynos_drm_add_components(struct device *dev, struct master *m)
|
|||||||
/*
|
/*
|
||||||
* fimd and dpi modules have same device object so add
|
* fimd and dpi modules have same device object so add
|
||||||
* only crtc device object in this case.
|
* only crtc device object in this case.
|
||||||
*
|
|
||||||
* TODO. if dpi module follows driver-model driver then
|
|
||||||
* below codes can be removed.
|
|
||||||
*/
|
*/
|
||||||
if (cdev->crtc_dev == cdev->conn_dev) {
|
if (cdev->crtc_dev == cdev->conn_dev) {
|
||||||
ret = component_master_add_child(m, compare_of,
|
component_match_add(dev, &match, compare_dev,
|
||||||
cdev->crtc_dev);
|
cdev->crtc_dev);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
goto out_lock;
|
goto out_lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,11 +527,8 @@ static int exynos_drm_add_components(struct device *dev, struct master *m)
|
|||||||
* connector/encoder need pipe number of crtc when they
|
* connector/encoder need pipe number of crtc when they
|
||||||
* are created.
|
* are created.
|
||||||
*/
|
*/
|
||||||
ret = component_master_add_child(m, compare_of, cdev->crtc_dev);
|
component_match_add(dev, &match, compare_dev, cdev->crtc_dev);
|
||||||
ret |= component_master_add_child(m, compare_of,
|
component_match_add(dev, &match, compare_dev, cdev->conn_dev);
|
||||||
cdev->conn_dev);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
out_lock:
|
out_lock:
|
||||||
mutex_lock(&drm_component_lock);
|
mutex_lock(&drm_component_lock);
|
||||||
@ -546,7 +536,7 @@ out_lock:
|
|||||||
|
|
||||||
mutex_unlock(&drm_component_lock);
|
mutex_unlock(&drm_component_lock);
|
||||||
|
|
||||||
return attach_cnt ? 0 : -ENODEV;
|
return attach_cnt ? match : ERR_PTR(-EPROBE_DEFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exynos_drm_bind(struct device *dev)
|
static int exynos_drm_bind(struct device *dev)
|
||||||
@ -560,13 +550,13 @@ static void exynos_drm_unbind(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct component_master_ops exynos_drm_ops = {
|
static const struct component_master_ops exynos_drm_ops = {
|
||||||
.add_components = exynos_drm_add_components,
|
|
||||||
.bind = exynos_drm_bind,
|
.bind = exynos_drm_bind,
|
||||||
.unbind = exynos_drm_unbind,
|
.unbind = exynos_drm_unbind,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int exynos_drm_platform_probe(struct platform_device *pdev)
|
static int exynos_drm_platform_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct component_match *match;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
||||||
@ -633,13 +623,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
|
|||||||
goto err_unregister_ipp_drv;
|
goto err_unregister_ipp_drv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = component_master_add(&pdev->dev, &exynos_drm_ops);
|
match = exynos_drm_match_add(&pdev->dev);
|
||||||
if (ret < 0)
|
if (IS_ERR(match)) {
|
||||||
DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n");
|
ret = PTR_ERR(match);
|
||||||
|
goto err_unregister_resources;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops,
|
||||||
|
match);
|
||||||
|
if (ret < 0)
|
||||||
|
goto err_unregister_resources;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
err_unregister_resources:
|
||||||
|
|
||||||
#ifdef CONFIG_DRM_EXYNOS_IPP
|
#ifdef CONFIG_DRM_EXYNOS_IPP
|
||||||
|
exynos_platform_device_ipp_unregister();
|
||||||
err_unregister_ipp_drv:
|
err_unregister_ipp_drv:
|
||||||
platform_driver_unregister(&ipp_driver);
|
platform_driver_unregister(&ipp_driver);
|
||||||
err_unregister_gsc_drv:
|
err_unregister_gsc_drv:
|
||||||
|
Loading…
Reference in New Issue
Block a user