diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-06-04 15:22:23 +0300 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2015-06-17 13:44:53 +0300 |
commit | 736e60ddc215b85e73bbf7da26e1cde84cc9500f (patch) | |
tree | 82a8c0f7b9022cac659e6491da70ef7cd41b5fa4 /drivers/video/fbdev/omap2/dss/dispc.c | |
parent | 606ae4865a1947c04d52b97b5109cda90aebe892 (diff) |
OMAPDSS: componentize omapdss
omapdss kernel module contains drivers for multiple devices, one for
each DSS submodule. The probing we have at the moment is a mess, and
doesn't give us proper deferred probing nor ensure that all the devices
are probed before omapfb/omapdrm start using omapdss.
This patch solves the mess by using the component system for DSS
submodules.
The changes to all DSS submodules (dispc, dpi, dsi, hdmi4/5, rfbi, sdi,
venc) are the same: probe & remove functions are changed to bind &
unbind, and new probe & remove functions are added which call
component_add/del.
The dss_core driver (dss.c) acts as a component master. Adding and
matching the components is simple: all dss device's child devices are
added as components.
However, we do have some dependencies between the drivers. The order in
which they should be probed is reflected by the list in core.c
(dss_output_drv_reg_funcs). The drivers are registered in that order,
which causes the components to be added in that order, which makes the
components to be bound in that order. This feels a bit fragile, and we
probably should improve the code to manage binds in random order.
However, for now, this works fine.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/video/fbdev/omap2/dss/dispc.c')
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dispc.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index e3417af63451..c8e34163211a 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -39,6 +39,7 @@ #include <linux/mfd/syscon.h> #include <linux/regmap.h> #include <linux/of.h> +#include <linux/component.h> #include <video/omapdss.h> @@ -3882,8 +3883,9 @@ void dispc_free_irq(void *dev_id) EXPORT_SYMBOL(dispc_free_irq); /* DISPC HW IP initialisation */ -static int omap_dispchw_probe(struct platform_device *pdev) +static int dispc_bind(struct device *dev, struct device *master, void *data) { + struct platform_device *pdev = to_platform_device(dev); u32 rev; int r = 0; struct resource *dispc_mem; @@ -3955,12 +3957,27 @@ err_runtime_get: return r; } -static int omap_dispchw_remove(struct platform_device *pdev) +static void dispc_unbind(struct device *dev, struct device *master, + void *data) { - pm_runtime_disable(&pdev->dev); + pm_runtime_disable(dev); dss_uninit_overlay_managers(); +} + +static const struct component_ops dispc_component_ops = { + .bind = dispc_bind, + .unbind = dispc_unbind, +}; +static int dispc_probe(struct platform_device *pdev) +{ + return component_add(&pdev->dev, &dispc_component_ops); +} + +static int dispc_remove(struct platform_device *pdev) +{ + component_del(&pdev->dev, &dispc_component_ops); return 0; } @@ -4013,7 +4030,8 @@ static const struct of_device_id dispc_of_match[] = { }; static struct platform_driver omap_dispchw_driver = { - .remove = omap_dispchw_remove, + .probe = dispc_probe, + .remove = dispc_remove, .driver = { .name = "omapdss_dispc", .pm = &dispc_pm_ops, @@ -4024,7 +4042,7 @@ static struct platform_driver omap_dispchw_driver = { int __init dispc_init_platform_driver(void) { - return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); + return platform_driver_register(&omap_dispchw_driver); } void dispc_uninit_platform_driver(void) |