Commit 736e60dd authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 606ae486
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
...@@ -3882,8 +3883,9 @@ void dispc_free_irq(void *dev_id) ...@@ -3882,8 +3883,9 @@ void dispc_free_irq(void *dev_id)
EXPORT_SYMBOL(dispc_free_irq); EXPORT_SYMBOL(dispc_free_irq);
/* DISPC HW IP initialisation */ /* 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; u32 rev;
int r = 0; int r = 0;
struct resource *dispc_mem; struct resource *dispc_mem;
...@@ -3955,12 +3957,27 @@ static int omap_dispchw_probe(struct platform_device *pdev) ...@@ -3955,12 +3957,27 @@ static int omap_dispchw_probe(struct platform_device *pdev)
return r; 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(); 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; return 0;
} }
...@@ -4013,7 +4030,8 @@ static const struct of_device_id dispc_of_match[] = { ...@@ -4013,7 +4030,8 @@ static const struct of_device_id dispc_of_match[] = {
}; };
static struct platform_driver omap_dispchw_driver = { static struct platform_driver omap_dispchw_driver = {
.remove = omap_dispchw_remove, .probe = dispc_probe,
.remove = dispc_remove,
.driver = { .driver = {
.name = "omapdss_dispc", .name = "omapdss_dispc",
.pm = &dispc_pm_ops, .pm = &dispc_pm_ops,
...@@ -4024,7 +4042,7 @@ static struct platform_driver omap_dispchw_driver = { ...@@ -4024,7 +4042,7 @@ static struct platform_driver omap_dispchw_driver = {
int __init dispc_init_platform_driver(void) 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) void dispc_uninit_platform_driver(void)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
...@@ -783,8 +784,9 @@ static void dpi_uninit_output_port(struct device_node *port) ...@@ -783,8 +784,9 @@ static void dpi_uninit_output_port(struct device_node *port)
omapdss_unregister_output(out); omapdss_unregister_output(out);
} }
static int omap_dpi_probe(struct platform_device *pdev) static int dpi_bind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct dpi_data *dpi; struct dpi_data *dpi;
dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL); dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL);
...@@ -802,16 +804,32 @@ static int omap_dpi_probe(struct platform_device *pdev) ...@@ -802,16 +804,32 @@ static int omap_dpi_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int omap_dpi_remove(struct platform_device *pdev) static void dpi_unbind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
dpi_uninit_output(pdev); dpi_uninit_output(pdev);
}
static const struct component_ops dpi_component_ops = {
.bind = dpi_bind,
.unbind = dpi_unbind,
};
static int dpi_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &dpi_component_ops);
}
static int dpi_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &dpi_component_ops);
return 0; return 0;
} }
static struct platform_driver omap_dpi_driver = { static struct platform_driver omap_dpi_driver = {
.probe = omap_dpi_probe, .probe = dpi_probe,
.remove = omap_dpi_remove, .remove = dpi_remove,
.driver = { .driver = {
.name = "omapdss_dpi", .name = "omapdss_dpi",
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
...@@ -5274,8 +5275,9 @@ static int dsi_init_pll_data(struct platform_device *dsidev) ...@@ -5274,8 +5275,9 @@ static int dsi_init_pll_data(struct platform_device *dsidev)
} }
/* DSI1 HW IP initialisation */ /* DSI1 HW IP initialisation */
static int omap_dsihw_probe(struct platform_device *dsidev) static int dsi_bind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *dsidev = to_platform_device(dev);
u32 rev; u32 rev;
int r, i; int r, i;
struct dsi_data *dsi; struct dsi_data *dsi;
...@@ -5484,8 +5486,9 @@ static int omap_dsihw_probe(struct platform_device *dsidev) ...@@ -5484,8 +5486,9 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
return r; return r;
} }
static int omap_dsihw_remove(struct platform_device *dsidev) static void dsi_unbind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *dsidev = to_platform_device(dev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
of_platform_depopulate(&dsidev->dev); of_platform_depopulate(&dsidev->dev);
...@@ -5502,7 +5505,21 @@ static int omap_dsihw_remove(struct platform_device *dsidev) ...@@ -5502,7 +5505,21 @@ static int omap_dsihw_remove(struct platform_device *dsidev)
regulator_disable(dsi->vdds_dsi_reg); regulator_disable(dsi->vdds_dsi_reg);
dsi->vdds_dsi_enabled = false; dsi->vdds_dsi_enabled = false;
} }
}
static const struct component_ops dsi_component_ops = {
.bind = dsi_bind,
.unbind = dsi_unbind,
};
static int dsi_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &dsi_component_ops);
}
static int dsi_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &dsi_component_ops);
return 0; return 0;
} }
...@@ -5569,8 +5586,8 @@ static const struct of_device_id dsi_of_match[] = { ...@@ -5569,8 +5586,8 @@ static const struct of_device_id dsi_of_match[] = {
}; };
static struct platform_driver omap_dsihw_driver = { static struct platform_driver omap_dsihw_driver = {
.probe = omap_dsihw_probe, .probe = dsi_probe,
.remove = omap_dsihw_remove, .remove = dsi_remove,
.driver = { .driver = {
.name = "omapdss_dsi", .name = "omapdss_dsi",
.pm = &dsi_pm_ops, .pm = &dsi_pm_ops,
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
...@@ -1088,8 +1089,9 @@ static int dss_video_pll_probe(struct platform_device *pdev) ...@@ -1088,8 +1089,9 @@ static int dss_video_pll_probe(struct platform_device *pdev)
} }
/* DSS HW IP initialisation */ /* DSS HW IP initialisation */
static int omap_dsshw_probe(struct platform_device *pdev) static int dss_bind(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *dss_mem; struct resource *dss_mem;
u32 rev; u32 rev;
int r; int r;
...@@ -1159,6 +1161,10 @@ static int omap_dsshw_probe(struct platform_device *pdev) ...@@ -1159,6 +1161,10 @@ static int omap_dsshw_probe(struct platform_device *pdev)
dss_runtime_put(); dss_runtime_put();
r = component_bind_all(&pdev->dev, NULL);
if (r)
goto err_component;
dss_debugfs_create_file("dss", dss_dump_regs); dss_debugfs_create_file("dss", dss_dump_regs);
pm_set_vt_switch(0); pm_set_vt_switch(0);
...@@ -1167,6 +1173,7 @@ static int omap_dsshw_probe(struct platform_device *pdev) ...@@ -1167,6 +1173,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
return 0; return 0;
err_component:
err_runtime_get: err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
dss_uninit_ports(pdev); dss_uninit_ports(pdev);
...@@ -1182,10 +1189,14 @@ static int omap_dsshw_probe(struct platform_device *pdev) ...@@ -1182,10 +1189,14 @@ static int omap_dsshw_probe(struct platform_device *pdev)
return r; return r;
} }
static int omap_dsshw_remove(struct platform_device *pdev) static void dss_unbind(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
dss_initialized = false; dss_initialized = false;
component_unbind_all(&pdev->dev, NULL);
if (dss.video1_pll) if (dss.video1_pll)
dss_video_pll_uninit(dss.video1_pll); dss_video_pll_uninit(dss.video1_pll);
...@@ -1197,7 +1208,46 @@ static int omap_dsshw_remove(struct platform_device *pdev) ...@@ -1197,7 +1208,46 @@ static int omap_dsshw_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
dss_put_clocks(); dss_put_clocks();
}
static const struct component_master_ops dss_component_ops = {
.bind = dss_bind,
.unbind = dss_unbind,
};
static int dss_component_compare(struct device *dev, void *data)
{
struct device *child = data;
return dev == child;
}
static int dss_add_child_component(struct device *dev, void *data)
{
struct component_match **match = data;
component_match_add(dev->parent, match, dss_component_compare, dev);
return 0;
}
static int dss_probe(struct platform_device *pdev)
{
struct component_match *match = NULL;
int r;
/* add all the child devices as components */
device_for_each_child(&pdev->dev, &match, dss_add_child_component);
r = component_master_add_with_match(&pdev->dev, &dss_component_ops, match);
if (r)
return r;
return 0;
}
static int dss_remove(struct platform_device *pdev)
{
component_master_del(&pdev->dev, &dss_component_ops);
return 0; return 0;
} }
...@@ -1243,7 +1293,8 @@ static const struct of_device_id dss_of_match[] = { ...@@ -1243,7 +1293,8 @@ static const struct of_device_id dss_of_match[] = {
MODULE_DEVICE_TABLE(of, dss_of_match); MODULE_DEVICE_TABLE(of, dss_of_match);
static struct platform_driver omap_dsshw_driver = { static struct platform_driver omap_dsshw_driver = {
.remove = omap_dsshw_remove, .probe = dss_probe,
.remove = dss_remove,
.driver = { .driver = {
.name = "omapdss_dss", .name = "omapdss_dss",
.pm = &dss_pm_ops, .pm = &dss_pm_ops,
...@@ -1254,7 +1305,7 @@ static struct platform_driver omap_dsshw_driver = { ...@@ -1254,7 +1305,7 @@ static struct platform_driver omap_dsshw_driver = {
int __init dss_init_platform_driver(void) int __init dss_init_platform_driver(void)
{ {
return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe); return platform_driver_register(&omap_dsshw_driver);
} }
void dss_uninit_platform_driver(void) void dss_uninit_platform_driver(void)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
#include <sound/omap-hdmi-audio.h> #include <sound/omap-hdmi-audio.h>
...@@ -646,8 +647,9 @@ static int hdmi_audio_register(struct device *dev) ...@@ -646,8 +647,9 @@ static int hdmi_audio_register(struct device *dev)
} }
/* HDMI HW IP initialisation */ /* HDMI HW IP initialisation */
static int omapdss_hdmihw_probe(struct platform_device *pdev) static int hdmi4_bind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
int r; int r;
int irq; int irq;
...@@ -713,8 +715,10 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) ...@@ -713,8 +715,10 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
return r; return r;
} }
static int omapdss_hdmihw_remove(struct platform_device *pdev) static void hdmi4_unbind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
if (hdmi.audio_pdev) if (hdmi.audio_pdev)
platform_device_unregister(hdmi.audio_pdev); platform_device_unregister(hdmi.audio_pdev);
...@@ -723,7 +727,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev) ...@@ -723,7 +727,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
hdmi_pll_uninit(&hdmi.pll); hdmi_pll_uninit(&hdmi.pll);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
}
static const struct component_ops hdmi4_component_ops = {
.bind = hdmi4_bind,
.unbind = hdmi4_unbind,
};
static int hdmi4_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &hdmi4_component_ops);
}
static int hdmi4_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &hdmi4_component_ops);
return 0; return 0;
} }
...@@ -756,8 +774,8 @@ static const struct of_device_id hdmi_of_match[] = { ...@@ -756,8 +774,8 @@ static const struct of_device_id hdmi_of_match[] = {
}; };
static struct platform_driver omapdss_hdmihw_driver = { static struct platform_driver omapdss_hdmihw_driver = {
.probe = omapdss_hdmihw_probe, .probe = hdmi4_probe,
.remove = omapdss_hdmihw_remove, .remove = hdmi4_remove,
.driver = { .driver = {
.name = "omapdss_hdmi", .name = "omapdss_hdmi",
.pm = &hdmi_pm_ops, .pm = &hdmi_pm_ops,
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
#include <sound/omap-hdmi-audio.h> #include <sound/omap-hdmi-audio.h>
...@@ -681,8 +682,9 @@ static int hdmi_audio_register(struct device *dev) ...@@ -681,8 +682,9 @@ static int hdmi_audio_register(struct device *dev)
} }
/* HDMI HW IP initialisation */ /* 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 r;
int irq; int irq;
...@@ -748,8 +750,10 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) ...@@ -748,8 +750,10 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
return r; 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) if (hdmi.audio_pdev)
platform_device_unregister(hdmi.audio_pdev); platform_device_unregister(hdmi.audio_pdev);
...@@ -758,7 +762,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev) ...@@ -758,7 +762,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
hdmi_pll_uninit(&hdmi.pll); hdmi_pll_uninit(&hdmi.pll);
pm_runtime_disable(&pdev->dev); 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; return 0;
} }
...@@ -792,8 +810,8 @@ static const struct of_device_id hdmi_of_match[] = { ...@@ -792,8 +810,8 @@ static const struct of_device_id hdmi_of_match[] = {
}; };
static struct platform_driver omapdss_hdmihw_driver = { static struct platform_driver omapdss_hdmihw_driver = {
.probe = omapdss_hdmihw_probe, .probe = hdmi5_probe,
.remove = omapdss_hdmihw_remove, .remove = hdmi5_remove,
.driver = { .driver = {
.name = "omapdss_hdmi5", .name = "omapdss_hdmi5",
.pm = &hdmi_pm_ops, .pm = &hdmi_pm_ops,
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/semaphore.h> #include <linux/semaphore.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
#include "dss.h" #include "dss.h"
...@@ -946,8 +947,9 @@ static void rfbi_uninit_output(struct platform_device *pdev) ...@@ -946,8 +947,9 @@ static void rfbi_uninit_output(struct platform_device *pdev)
} }
/* RFBI HW IP initialisation */ /* RFBI HW IP initialisation */
static int omap_rfbihw_probe(struct platform_device *pdev) static int rfbi_bind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
u32 rev; u32 rev;
struct resource *rfbi_mem; struct resource *rfbi_mem;
struct clk *clk; struct clk *clk;
...@@ -1005,8 +1007,10 @@ static int omap_rfbihw_probe(struct platform_device *pdev) ...@@ -1005,8 +1007,10 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
return r; return r;
} }
static int omap_rfbihw_remove(struct platform_device *pdev) static void rfbi_unbind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
rfbi_uninit_output(pdev); rfbi_uninit_output(pdev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
...@@ -1014,6 +1018,22 @@ static int omap_rfbihw_remove(struct platform_device *pdev) ...@@ -1014,6 +1018,22 @@ static int omap_rfbihw_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct component_ops rfbi_component_ops = {
.bind = rfbi_bind,
.unbind = rfbi_unbind,
};
static int rfbi_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &rfbi_component_ops);
}
static int rfbi_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &rfbi_component_ops);
return 0;
}
static int rfbi_runtime_suspend(struct device *dev) static int rfbi_runtime_suspend(struct device *dev)
{ {
dispc_runtime_put(); dispc_runtime_put();
...@@ -1038,8 +1058,8 @@ static const struct dev_pm_ops rfbi_pm_ops = { ...@@ -1038,8 +1058,8 @@ static const struct dev_pm_ops rfbi_pm_ops = {
}; };
static struct platform_driver omap_rfbihw_driver = { static struct platform_driver omap_rfbihw_driver = {
.probe = omap_rfbihw_probe, .probe = rfbi_probe,
.remove = omap_rfbihw_remove, .remove = rfbi_remove,
.driver = { .driver = {
.name = "omapdss_rfbi", .name = "omapdss_rfbi",
.pm = &rfbi_pm_ops, .pm = &rfbi_pm_ops,
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
#include "dss.h" #include "dss.h"
...@@ -357,8 +358,10 @@ static void sdi_uninit_output(struct platform_device *pdev) ...@@ -357,8 +358,10 @@ static void sdi_uninit_output(struct platform_device *pdev)
omapdss_unregister_output(out); omapdss_unregister_output(out);
} }
static int omap_sdi_probe(struct platform_device *pdev) static int sdi_bind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
sdi.pdev = pdev; sdi.pdev = pdev;
sdi_init_output(pdev); sdi_init_output(pdev);
...@@ -366,16 +369,32 @@ static int omap_sdi_probe(struct platform_device *pdev) ...@@ -366,16 +369,32 @@ static int omap_sdi_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int omap_sdi_remove(struct platform_device *pdev) static void sdi_unbind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
sdi_uninit_output(pdev); sdi_uninit_output(pdev);
}
static const struct component_ops sdi_component_ops = {
.bind = sdi_bind,
.unbind = sdi_unbind,
};
static int sdi_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &sdi_component_ops);
}
static int sdi_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &sdi_component_ops);
return 0; return 0;
} }
static struct platform_driver omap_sdi_driver = { static struct platform_driver omap_sdi_driver = {
.probe = omap_sdi_probe, .probe = sdi_probe,
.remove = omap_sdi_remove, .remove = sdi_remove,
.driver = { .driver = {
.name = "omapdss_sdi", .name = "omapdss_sdi",
.suppress_bind_attrs = true, .suppress_bind_attrs = true,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/component.h>
#include <video/omapdss.h> #include <video/omapdss.h>
...@@ -852,8 +853,9 @@ static int venc_probe_of(struct platform_device *pdev) ...@@ -852,8 +853,9 @@ static int venc_probe_of(struct platform_device *pdev)
} }
/* VENC HW IP initialisation */ /* VENC HW IP initialisation */
static int omap_venchw_probe(struct platform_device *pdev) static int venc_bind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
u8 rev_id; u8 rev_id;
struct resource *venc_mem; struct resource *venc_mem;
int r; int r;
...@@ -912,12 +914,28 @@ static int omap_venchw_probe(struct platform_device *pdev) ...@@ -912,12 +914,28 @@ static int omap_venchw_probe(struct platform_device *pdev)
return r; return r;
} }
static int omap_venchw_remove(struct platform_device *pdev) static void venc_unbind(struct device *dev, struct device *master, void *data)
{ {
struct platform_device *pdev = to_platform_device(dev);
venc_uninit_output(pdev); venc_uninit_output(pdev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
}
static const struct component_ops venc_component_ops = {
.bind = venc_bind,
.unbind = venc_unbind,
};
static int venc_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &venc_component_ops);
}
static int venc_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &venc_component_ops);
return 0; return 0;
} }
...@@ -950,7 +968,6 @@ static const struct dev_pm_ops venc_pm_ops = { ...@@ -950,7 +968,6 @@ static const struct dev_pm_ops venc_pm_ops = {
.runtime_resume = venc_runtime_resume, .runtime_resume = venc_runtime_resume,
}; };
static const struct of_device_id venc_of_match[] = { static const struct of_device_id venc_of_match[] = {
{ .compatible = "ti,omap2-venc", }, { .compatible = "ti,omap2-venc", },
{ .compatible = "ti,omap3-venc", }, { .compatible = "ti,omap3-venc", },
...@@ -959,8 +976,8 @@ static const struct of_device_id venc_of_match[] = { ...@@ -959,8 +976,8 @@ static const struct of_device_id venc_of_match[] = {
}; };
static struct platform_driver omap_venchw_driver = { static struct platform_driver omap_venchw_driver = {
.probe = omap_venchw_probe, .probe = venc_probe,
.remove = omap_venchw_remove, .remove = venc_remove,
.driver = { .driver = {
.name = "omapdss_venc", .name = "omapdss_venc",
.pm = &venc_pm_ops, .pm = &venc_pm_ops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment