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/hdmi5.c | |
parent | 606ae4865a1947c04d52b97b5109cda90aebe892 (diff) | |
download | op-kernel-dev-736e60ddc215b85e73bbf7da26e1cde84cc9500f.zip op-kernel-dev-736e60ddc215b85e73bbf7da26e1cde84cc9500f.tar.gz |
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/hdmi5.c')
-rw-r--r-- | drivers/video/fbdev/omap2/dss/hdmi5.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c index a57f5e8..7f87578 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5.c @@ -37,6 +37,7 @@ #include <linux/clk.h> #include <linux/gpio.h> #include <linux/regulator/consumer.h> +#include <linux/component.h> #include <video/omapdss.h> #include <sound/omap-hdmi-audio.h> @@ -681,8 +682,9 @@ static int hdmi_audio_register(struct device *dev) } /* HDMI HW IP initialisation */ -static int omapdss_hdmihw_probe(struct platform_device *pdev) +static int hdmi5_bind(struct device *dev, struct device *master, void *data) { + struct platform_device *pdev = to_platform_device(dev); int r; int irq; @@ -748,8 +750,10 @@ err: return r; } -static int omapdss_hdmihw_remove(struct platform_device *pdev) +static void hdmi5_unbind(struct device *dev, struct device *master, void *data) { + struct platform_device *pdev = to_platform_device(dev); + if (hdmi.audio_pdev) platform_device_unregister(hdmi.audio_pdev); @@ -758,7 +762,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev) hdmi_pll_uninit(&hdmi.pll); pm_runtime_disable(&pdev->dev); +} + +static const struct component_ops hdmi5_component_ops = { + .bind = hdmi5_bind, + .unbind = hdmi5_unbind, +}; +static int hdmi5_probe(struct platform_device *pdev) +{ + return component_add(&pdev->dev, &hdmi5_component_ops); +} + +static int hdmi5_remove(struct platform_device *pdev) +{ + component_del(&pdev->dev, &hdmi5_component_ops); return 0; } @@ -792,8 +810,8 @@ static const struct of_device_id hdmi_of_match[] = { }; static struct platform_driver omapdss_hdmihw_driver = { - .probe = omapdss_hdmihw_probe, - .remove = omapdss_hdmihw_remove, + .probe = hdmi5_probe, + .remove = hdmi5_remove, .driver = { .name = "omapdss_hdmi5", .pm = &hdmi_pm_ops, |