aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2015-06-04 08:22:23 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-06-17 06:44:53 -0400
commit736e60ddc215b85e73bbf7da26e1cde84cc9500f (patch)
tree82a8c0f7b9022cac659e6491da70ef7cd41b5fa4
parent606ae4865a1947c04d52b97b5109cda90aebe892 (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>
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc.c28
-rw-r--r--drivers/video/fbdev/omap2/dss/dpi.c26
-rw-r--r--drivers/video/fbdev/omap2/dss/dsi.c25
-rw-r--r--drivers/video/fbdev/omap2/dss/dss.c59
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4.c26
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5.c26
-rw-r--r--drivers/video/fbdev/omap2/dss/rfbi.c28
-rw-r--r--drivers/video/fbdev/omap2/dss/sdi.c27
-rw-r--r--drivers/video/fbdev/omap2/dss/venc.c27
9 files changed, 234 insertions, 38 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 @@
39#include <linux/mfd/syscon.h> 39#include <linux/mfd/syscon.h>
40#include <linux/regmap.h> 40#include <linux/regmap.h>
41#include <linux/of.h> 41#include <linux/of.h>
42#include <linux/component.h>
42 43
43#include <video/omapdss.h> 44#include <video/omapdss.h>
44 45
@@ -3882,8 +3883,9 @@ void dispc_free_irq(void *dev_id)
3882EXPORT_SYMBOL(dispc_free_irq); 3883EXPORT_SYMBOL(dispc_free_irq);
3883 3884
3884/* DISPC HW IP initialisation */ 3885/* DISPC HW IP initialisation */
3885static int omap_dispchw_probe(struct platform_device *pdev) 3886static int dispc_bind(struct device *dev, struct device *master, void *data)
3886{ 3887{
3888 struct platform_device *pdev = to_platform_device(dev);
3887 u32 rev; 3889 u32 rev;
3888 int r = 0; 3890 int r = 0;
3889 struct resource *dispc_mem; 3891 struct resource *dispc_mem;
@@ -3955,12 +3957,27 @@ err_runtime_get:
3955 return r; 3957 return r;
3956} 3958}
3957 3959
3958static int omap_dispchw_remove(struct platform_device *pdev) 3960static void dispc_unbind(struct device *dev, struct device *master,
3961 void *data)
3959{ 3962{
3960 pm_runtime_disable(&pdev->dev); 3963 pm_runtime_disable(dev);
3961 3964
3962 dss_uninit_overlay_managers(); 3965 dss_uninit_overlay_managers();
3966}
3967
3968static const struct component_ops dispc_component_ops = {
3969 .bind = dispc_bind,
3970 .unbind = dispc_unbind,
3971};
3963 3972
3973static int dispc_probe(struct platform_device *pdev)
3974{
3975 return component_add(&pdev->dev, &dispc_component_ops);
3976}
3977
3978static int dispc_remove(struct platform_device *pdev)
3979{
3980 component_del(&pdev->dev, &dispc_component_ops);
3964 return 0; 3981 return 0;
3965} 3982}
3966 3983
@@ -4013,7 +4030,8 @@ static const struct of_device_id dispc_of_match[] = {
4013}; 4030};
4014 4031
4015static struct platform_driver omap_dispchw_driver = { 4032static struct platform_driver omap_dispchw_driver = {
4016 .remove = omap_dispchw_remove, 4033 .probe = dispc_probe,
4034 .remove = dispc_remove,
4017 .driver = { 4035 .driver = {
4018 .name = "omapdss_dispc", 4036 .name = "omapdss_dispc",
4019 .pm = &dispc_pm_ops, 4037 .pm = &dispc_pm_ops,
@@ -4024,7 +4042,7 @@ static struct platform_driver omap_dispchw_driver = {
4024 4042
4025int __init dispc_init_platform_driver(void) 4043int __init dispc_init_platform_driver(void)
4026{ 4044{
4027 return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); 4045 return platform_driver_register(&omap_dispchw_driver);
4028} 4046}
4029 4047
4030void dispc_uninit_platform_driver(void) 4048void dispc_uninit_platform_driver(void)
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c
index a06e7558280f..fb45b6432968 100644
--- a/drivers/video/fbdev/omap2/dss/dpi.c
+++ b/drivers/video/fbdev/omap2/dss/dpi.c
@@ -32,6 +32,7 @@
32#include <linux/string.h> 32#include <linux/string.h>
33#include <linux/of.h> 33#include <linux/of.h>
34#include <linux/clk.h> 34#include <linux/clk.h>
35#include <linux/component.h>
35 36
36#include <video/omapdss.h> 37#include <video/omapdss.h>
37 38
@@ -783,8 +784,9 @@ static void dpi_uninit_output_port(struct device_node *port)
783 omapdss_unregister_output(out); 784 omapdss_unregister_output(out);
784} 785}
785 786
786static int omap_dpi_probe(struct platform_device *pdev) 787static int dpi_bind(struct device *dev, struct device *master, void *data)
787{ 788{
789 struct platform_device *pdev = to_platform_device(dev);
788 struct dpi_data *dpi; 790 struct dpi_data *dpi;
789 791
790 dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL); 792 dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL);
@@ -802,16 +804,32 @@ static int omap_dpi_probe(struct platform_device *pdev)
802 return 0; 804 return 0;
803} 805}
804 806
805static int omap_dpi_remove(struct platform_device *pdev) 807static void dpi_unbind(struct device *dev, struct device *master, void *data)
806{ 808{
809 struct platform_device *pdev = to_platform_device(dev);
810
807 dpi_uninit_output(pdev); 811 dpi_uninit_output(pdev);
812}
813
814static const struct component_ops dpi_component_ops = {
815 .bind = dpi_bind,
816 .unbind = dpi_unbind,
817};
808 818
819static int dpi_probe(struct platform_device *pdev)
820{
821 return component_add(&pdev->dev, &dpi_component_ops);
822}
823
824static int dpi_remove(struct platform_device *pdev)
825{
826 component_del(&pdev->dev, &dpi_component_ops);
809 return 0; 827 return 0;
810} 828}
811 829
812static struct platform_driver omap_dpi_driver = { 830static struct platform_driver omap_dpi_driver = {
813 .probe = omap_dpi_probe, 831 .probe = dpi_probe,
814 .remove = omap_dpi_remove, 832 .remove = dpi_remove,
815 .driver = { 833 .driver = {
816 .name = "omapdss_dpi", 834 .name = "omapdss_dpi",
817 .suppress_bind_attrs = true, 835 .suppress_bind_attrs = true,
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c
index c4c27c09c62f..b3606def5b7b 100644
--- a/drivers/video/fbdev/omap2/dss/dsi.c
+++ b/drivers/video/fbdev/omap2/dss/dsi.c
@@ -40,6 +40,7 @@
40#include <linux/pm_runtime.h> 40#include <linux/pm_runtime.h>
41#include <linux/of.h> 41#include <linux/of.h>
42#include <linux/of_platform.h> 42#include <linux/of_platform.h>
43#include <linux/component.h>
43 44
44#include <video/omapdss.h> 45#include <video/omapdss.h>
45#include <video/mipi_display.h> 46#include <video/mipi_display.h>
@@ -5274,8 +5275,9 @@ static int dsi_init_pll_data(struct platform_device *dsidev)
5274} 5275}
5275 5276
5276/* DSI1 HW IP initialisation */ 5277/* DSI1 HW IP initialisation */
5277static int omap_dsihw_probe(struct platform_device *dsidev) 5278static int dsi_bind(struct device *dev, struct device *master, void *data)
5278{ 5279{
5280 struct platform_device *dsidev = to_platform_device(dev);
5279 u32 rev; 5281 u32 rev;
5280 int r, i; 5282 int r, i;
5281 struct dsi_data *dsi; 5283 struct dsi_data *dsi;
@@ -5484,8 +5486,9 @@ err_runtime_get:
5484 return r; 5486 return r;
5485} 5487}
5486 5488
5487static int omap_dsihw_remove(struct platform_device *dsidev) 5489static void dsi_unbind(struct device *dev, struct device *master, void *data)
5488{ 5490{
5491 struct platform_device *dsidev = to_platform_device(dev);
5489 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 5492 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
5490 5493
5491 of_platform_depopulate(&dsidev->dev); 5494 of_platform_depopulate(&dsidev->dev);
@@ -5502,7 +5505,21 @@ static int omap_dsihw_remove(struct platform_device *dsidev)
5502 regulator_disable(dsi->vdds_dsi_reg); 5505 regulator_disable(dsi->vdds_dsi_reg);
5503 dsi->vdds_dsi_enabled = false; 5506 dsi->vdds_dsi_enabled = false;
5504 } 5507 }
5508}
5509
5510static const struct component_ops dsi_component_ops = {
5511 .bind = dsi_bind,
5512 .unbind = dsi_unbind,
5513};
5505 5514
5515static int dsi_probe(struct platform_device *pdev)
5516{
5517 return component_add(&pdev->dev, &dsi_component_ops);
5518}
5519
5520static int dsi_remove(struct platform_device *pdev)
5521{
5522 component_del(&pdev->dev, &dsi_component_ops);
5506 return 0; 5523 return 0;
5507} 5524}
5508 5525
@@ -5569,8 +5586,8 @@ static const struct of_device_id dsi_of_match[] = {
5569}; 5586};
5570 5587
5571static struct platform_driver omap_dsihw_driver = { 5588static struct platform_driver omap_dsihw_driver = {
5572 .probe = omap_dsihw_probe, 5589 .probe = dsi_probe,
5573 .remove = omap_dsihw_remove, 5590 .remove = dsi_remove,
5574 .driver = { 5591 .driver = {
5575 .name = "omapdss_dsi", 5592 .name = "omapdss_dsi",
5576 .pm = &dsi_pm_ops, 5593 .pm = &dsi_pm_ops,
diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c
index 3397cbf484b0..612b093831d5 100644
--- a/drivers/video/fbdev/omap2/dss/dss.c
+++ b/drivers/video/fbdev/omap2/dss/dss.c
@@ -39,6 +39,7 @@
39#include <linux/of.h> 39#include <linux/of.h>
40#include <linux/regulator/consumer.h> 40#include <linux/regulator/consumer.h>
41#include <linux/suspend.h> 41#include <linux/suspend.h>
42#include <linux/component.h>
42 43
43#include <video/omapdss.h> 44#include <video/omapdss.h>
44 45
@@ -1088,8 +1089,9 @@ static int dss_video_pll_probe(struct platform_device *pdev)
1088} 1089}
1089 1090
1090/* DSS HW IP initialisation */ 1091/* DSS HW IP initialisation */
1091static int omap_dsshw_probe(struct platform_device *pdev) 1092static int dss_bind(struct device *dev)
1092{ 1093{
1094 struct platform_device *pdev = to_platform_device(dev);
1093 struct resource *dss_mem; 1095 struct resource *dss_mem;
1094 u32 rev; 1096 u32 rev;
1095 int r; 1097 int r;
@@ -1159,6 +1161,10 @@ static int omap_dsshw_probe(struct platform_device *pdev)
1159 1161
1160 dss_runtime_put(); 1162 dss_runtime_put();
1161 1163
1164 r = component_bind_all(&pdev->dev, NULL);
1165 if (r)
1166 goto err_component;
1167
1162 dss_debugfs_create_file("dss", dss_dump_regs); 1168 dss_debugfs_create_file("dss", dss_dump_regs);
1163 1169
1164 pm_set_vt_switch(0); 1170 pm_set_vt_switch(0);
@@ -1167,6 +1173,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
1167 1173
1168 return 0; 1174 return 0;
1169 1175
1176err_component:
1170err_runtime_get: 1177err_runtime_get:
1171 pm_runtime_disable(&pdev->dev); 1178 pm_runtime_disable(&pdev->dev);
1172 dss_uninit_ports(pdev); 1179 dss_uninit_ports(pdev);
@@ -1182,10 +1189,14 @@ err_setup_clocks:
1182 return r; 1189 return r;
1183} 1190}
1184 1191
1185static int omap_dsshw_remove(struct platform_device *pdev) 1192static void dss_unbind(struct device *dev)
1186{ 1193{
1194 struct platform_device *pdev = to_platform_device(dev);
1195
1187 dss_initialized = false; 1196 dss_initialized = false;
1188 1197
1198 component_unbind_all(&pdev->dev, NULL);
1199
1189 if (dss.video1_pll) 1200 if (dss.video1_pll)
1190 dss_video_pll_uninit(dss.video1_pll); 1201 dss_video_pll_uninit(dss.video1_pll);
1191 1202
@@ -1197,7 +1208,46 @@ static int omap_dsshw_remove(struct platform_device *pdev)
1197 pm_runtime_disable(&pdev->dev); 1208 pm_runtime_disable(&pdev->dev);
1198 1209
1199 dss_put_clocks(); 1210 dss_put_clocks();
1211}
1212
1213static const struct component_master_ops dss_component_ops = {
1214 .bind = dss_bind,
1215 .unbind = dss_unbind,
1216};
1200 1217
1218static int dss_component_compare(struct device *dev, void *data)
1219{
1220 struct device *child = data;
1221 return dev == child;
1222}
1223
1224static int dss_add_child_component(struct device *dev, void *data)
1225{
1226 struct component_match **match = data;
1227
1228 component_match_add(dev->parent, match, dss_component_compare, dev);
1229
1230 return 0;
1231}
1232
1233static int dss_probe(struct platform_device *pdev)
1234{
1235 struct component_match *match = NULL;
1236 int r;
1237
1238 /* add all the child devices as components */
1239 device_for_each_child(&pdev->dev, &match, dss_add_child_component);
1240
1241 r = component_master_add_with_match(&pdev->dev, &dss_component_ops, match);
1242 if (r)
1243 return r;
1244
1245 return 0;
1246}
1247
1248static int dss_remove(struct platform_device *pdev)
1249{
1250 component_master_del(&pdev->dev, &dss_component_ops);
1201 return 0; 1251 return 0;
1202} 1252}
1203 1253
@@ -1243,7 +1293,8 @@ static const struct of_device_id dss_of_match[] = {
1243MODULE_DEVICE_TABLE(of, dss_of_match); 1293MODULE_DEVICE_TABLE(of, dss_of_match);
1244 1294
1245static struct platform_driver omap_dsshw_driver = { 1295static struct platform_driver omap_dsshw_driver = {
1246 .remove = omap_dsshw_remove, 1296 .probe = dss_probe,
1297 .remove = dss_remove,
1247 .driver = { 1298 .driver = {
1248 .name = "omapdss_dss", 1299 .name = "omapdss_dss",
1249 .pm = &dss_pm_ops, 1300 .pm = &dss_pm_ops,
@@ -1254,7 +1305,7 @@ static struct platform_driver omap_dsshw_driver = {
1254 1305
1255int __init dss_init_platform_driver(void) 1306int __init dss_init_platform_driver(void)
1256{ 1307{
1257 return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe); 1308 return platform_driver_register(&omap_dsshw_driver);
1258} 1309}
1259 1310
1260void dss_uninit_platform_driver(void) 1311void dss_uninit_platform_driver(void)
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 31deebbc32dc..d35312d69025 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -32,6 +32,7 @@
32#include <linux/clk.h> 32#include <linux/clk.h>
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/regulator/consumer.h> 34#include <linux/regulator/consumer.h>
35#include <linux/component.h>
35#include <video/omapdss.h> 36#include <video/omapdss.h>
36#include <sound/omap-hdmi-audio.h> 37#include <sound/omap-hdmi-audio.h>
37 38
@@ -646,8 +647,9 @@ static int hdmi_audio_register(struct device *dev)
646} 647}
647 648
648/* HDMI HW IP initialisation */ 649/* HDMI HW IP initialisation */
649static int omapdss_hdmihw_probe(struct platform_device *pdev) 650static int hdmi4_bind(struct device *dev, struct device *master, void *data)
650{ 651{
652 struct platform_device *pdev = to_platform_device(dev);
651 int r; 653 int r;
652 int irq; 654 int irq;
653 655
@@ -713,8 +715,10 @@ err:
713 return r; 715 return r;
714} 716}
715 717
716static int omapdss_hdmihw_remove(struct platform_device *pdev) 718static void hdmi4_unbind(struct device *dev, struct device *master, void *data)
717{ 719{
720 struct platform_device *pdev = to_platform_device(dev);
721
718 if (hdmi.audio_pdev) 722 if (hdmi.audio_pdev)
719 platform_device_unregister(hdmi.audio_pdev); 723 platform_device_unregister(hdmi.audio_pdev);
720 724
@@ -723,7 +727,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
723 hdmi_pll_uninit(&hdmi.pll); 727 hdmi_pll_uninit(&hdmi.pll);
724 728
725 pm_runtime_disable(&pdev->dev); 729 pm_runtime_disable(&pdev->dev);
730}
731
732static const struct component_ops hdmi4_component_ops = {
733 .bind = hdmi4_bind,
734 .unbind = hdmi4_unbind,
735};
726 736
737static int hdmi4_probe(struct platform_device *pdev)
738{
739 return component_add(&pdev->dev, &hdmi4_component_ops);
740}
741
742static int hdmi4_remove(struct platform_device *pdev)
743{
744 component_del(&pdev->dev, &hdmi4_component_ops);
727 return 0; 745 return 0;
728} 746}
729 747
@@ -756,8 +774,8 @@ static const struct of_device_id hdmi_of_match[] = {
756}; 774};
757 775
758static struct platform_driver omapdss_hdmihw_driver = { 776static struct platform_driver omapdss_hdmihw_driver = {
759 .probe = omapdss_hdmihw_probe, 777 .probe = hdmi4_probe,
760 .remove = omapdss_hdmihw_remove, 778 .remove = hdmi4_remove,
761 .driver = { 779 .driver = {
762 .name = "omapdss_hdmi", 780 .name = "omapdss_hdmi",
763 .pm = &hdmi_pm_ops, 781 .pm = &hdmi_pm_ops,
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index a57f5e8f9aea..7f875788edbc 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -37,6 +37,7 @@
37#include <linux/clk.h> 37#include <linux/clk.h>
38#include <linux/gpio.h> 38#include <linux/gpio.h>
39#include <linux/regulator/consumer.h> 39#include <linux/regulator/consumer.h>
40#include <linux/component.h>
40#include <video/omapdss.h> 41#include <video/omapdss.h>
41#include <sound/omap-hdmi-audio.h> 42#include <sound/omap-hdmi-audio.h>
42 43
@@ -681,8 +682,9 @@ static int hdmi_audio_register(struct device *dev)
681} 682}
682 683
683/* HDMI HW IP initialisation */ 684/* HDMI HW IP initialisation */
684static int omapdss_hdmihw_probe(struct platform_device *pdev) 685static int hdmi5_bind(struct device *dev, struct device *master, void *data)
685{ 686{
687 struct platform_device *pdev = to_platform_device(dev);
686 int r; 688 int r;
687 int irq; 689 int irq;
688 690
@@ -748,8 +750,10 @@ err:
748 return r; 750 return r;
749} 751}
750 752
751static int omapdss_hdmihw_remove(struct platform_device *pdev) 753static void hdmi5_unbind(struct device *dev, struct device *master, void *data)
752{ 754{
755 struct platform_device *pdev = to_platform_device(dev);
756
753 if (hdmi.audio_pdev) 757 if (hdmi.audio_pdev)
754 platform_device_unregister(hdmi.audio_pdev); 758 platform_device_unregister(hdmi.audio_pdev);
755 759
@@ -758,7 +762,21 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
758 hdmi_pll_uninit(&hdmi.pll); 762 hdmi_pll_uninit(&hdmi.pll);
759 763
760 pm_runtime_disable(&pdev->dev); 764 pm_runtime_disable(&pdev->dev);
765}
766
767static const struct component_ops hdmi5_component_ops = {
768 .bind = hdmi5_bind,
769 .unbind = hdmi5_unbind,
770};
761 771
772static int hdmi5_probe(struct platform_device *pdev)
773{
774 return component_add(&pdev->dev, &hdmi5_component_ops);
775}
776
777static int hdmi5_remove(struct platform_device *pdev)
778{
779 component_del(&pdev->dev, &hdmi5_component_ops);
762 return 0; 780 return 0;
763} 781}
764 782
@@ -792,8 +810,8 @@ static const struct of_device_id hdmi_of_match[] = {
792}; 810};
793 811
794static struct platform_driver omapdss_hdmihw_driver = { 812static struct platform_driver omapdss_hdmihw_driver = {
795 .probe = omapdss_hdmihw_probe, 813 .probe = hdmi5_probe,
796 .remove = omapdss_hdmihw_remove, 814 .remove = hdmi5_remove,
797 .driver = { 815 .driver = {
798 .name = "omapdss_hdmi5", 816 .name = "omapdss_hdmi5",
799 .pm = &hdmi_pm_ops, 817 .pm = &hdmi_pm_ops,
diff --git a/drivers/video/fbdev/omap2/dss/rfbi.c b/drivers/video/fbdev/omap2/dss/rfbi.c
index 8ec810bce0b6..1525a494d057 100644
--- a/drivers/video/fbdev/omap2/dss/rfbi.c
+++ b/drivers/video/fbdev/omap2/dss/rfbi.c
@@ -36,6 +36,7 @@
36#include <linux/semaphore.h> 36#include <linux/semaphore.h>
37#include <linux/platform_device.h> 37#include <linux/platform_device.h>
38#include <linux/pm_runtime.h> 38#include <linux/pm_runtime.h>
39#include <linux/component.h>
39 40
40#include <video/omapdss.h> 41#include <video/omapdss.h>
41#include "dss.h" 42#include "dss.h"
@@ -946,8 +947,9 @@ static void rfbi_uninit_output(struct platform_device *pdev)
946} 947}
947 948
948/* RFBI HW IP initialisation */ 949/* RFBI HW IP initialisation */
949static int omap_rfbihw_probe(struct platform_device *pdev) 950static int rfbi_bind(struct device *dev, struct device *master, void *data)
950{ 951{
952 struct platform_device *pdev = to_platform_device(dev);
951 u32 rev; 953 u32 rev;
952 struct resource *rfbi_mem; 954 struct resource *rfbi_mem;
953 struct clk *clk; 955 struct clk *clk;
@@ -1005,8 +1007,10 @@ err_runtime_get:
1005 return r; 1007 return r;
1006} 1008}
1007 1009
1008static int omap_rfbihw_remove(struct platform_device *pdev) 1010static void rfbi_unbind(struct device *dev, struct device *master, void *data)
1009{ 1011{
1012 struct platform_device *pdev = to_platform_device(dev);
1013
1010 rfbi_uninit_output(pdev); 1014 rfbi_uninit_output(pdev);
1011 1015
1012 pm_runtime_disable(&pdev->dev); 1016 pm_runtime_disable(&pdev->dev);
@@ -1014,6 +1018,22 @@ static int omap_rfbihw_remove(struct platform_device *pdev)
1014 return 0; 1018 return 0;
1015} 1019}
1016 1020
1021static const struct component_ops rfbi_component_ops = {
1022 .bind = rfbi_bind,
1023 .unbind = rfbi_unbind,
1024};
1025
1026static int rfbi_probe(struct platform_device *pdev)
1027{
1028 return component_add(&pdev->dev, &rfbi_component_ops);
1029}
1030
1031static int rfbi_remove(struct platform_device *pdev)
1032{
1033 component_del(&pdev->dev, &rfbi_component_ops);
1034 return 0;
1035}
1036
1017static int rfbi_runtime_suspend(struct device *dev) 1037static int rfbi_runtime_suspend(struct device *dev)
1018{ 1038{
1019 dispc_runtime_put(); 1039 dispc_runtime_put();
@@ -1038,8 +1058,8 @@ static const struct dev_pm_ops rfbi_pm_ops = {
1038}; 1058};
1039 1059
1040static struct platform_driver omap_rfbihw_driver = { 1060static struct platform_driver omap_rfbihw_driver = {
1041 .probe = omap_rfbihw_probe, 1061 .probe = rfbi_probe,
1042 .remove = omap_rfbihw_remove, 1062 .remove = rfbi_remove,
1043 .driver = { 1063 .driver = {
1044 .name = "omapdss_rfbi", 1064 .name = "omapdss_rfbi",
1045 .pm = &rfbi_pm_ops, 1065 .pm = &rfbi_pm_ops,
diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c
index a873118f1e0e..5843580a1deb 100644
--- a/drivers/video/fbdev/omap2/dss/sdi.c
+++ b/drivers/video/fbdev/omap2/dss/sdi.c
@@ -27,6 +27,7 @@
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/component.h>
30 31
31#include <video/omapdss.h> 32#include <video/omapdss.h>
32#include "dss.h" 33#include "dss.h"
@@ -357,8 +358,10 @@ static void sdi_uninit_output(struct platform_device *pdev)
357 omapdss_unregister_output(out); 358 omapdss_unregister_output(out);
358} 359}
359 360
360static int omap_sdi_probe(struct platform_device *pdev) 361static int sdi_bind(struct device *dev, struct device *master, void *data)
361{ 362{
363 struct platform_device *pdev = to_platform_device(dev);
364
362 sdi.pdev = pdev; 365 sdi.pdev = pdev;
363 366
364 sdi_init_output(pdev); 367 sdi_init_output(pdev);
@@ -366,16 +369,32 @@ static int omap_sdi_probe(struct platform_device *pdev)
366 return 0; 369 return 0;
367} 370}
368 371
369static int omap_sdi_remove(struct platform_device *pdev) 372static void sdi_unbind(struct device *dev, struct device *master, void *data)
370{ 373{
374 struct platform_device *pdev = to_platform_device(dev);
375
371 sdi_uninit_output(pdev); 376 sdi_uninit_output(pdev);
377}
378
379static const struct component_ops sdi_component_ops = {
380 .bind = sdi_bind,
381 .unbind = sdi_unbind,
382};
372 383
384static int sdi_probe(struct platform_device *pdev)
385{
386 return component_add(&pdev->dev, &sdi_component_ops);
387}
388
389static int sdi_remove(struct platform_device *pdev)
390{
391 component_del(&pdev->dev, &sdi_component_ops);
373 return 0; 392 return 0;
374} 393}
375 394
376static struct platform_driver omap_sdi_driver = { 395static struct platform_driver omap_sdi_driver = {
377 .probe = omap_sdi_probe, 396 .probe = sdi_probe,
378 .remove = omap_sdi_remove, 397 .remove = sdi_remove,
379 .driver = { 398 .driver = {
380 .name = "omapdss_sdi", 399 .name = "omapdss_sdi",
381 .suppress_bind_attrs = true, 400 .suppress_bind_attrs = true,
diff --git a/drivers/video/fbdev/omap2/dss/venc.c b/drivers/video/fbdev/omap2/dss/venc.c
index e7fad0e19d43..99ca268c1cdd 100644
--- a/drivers/video/fbdev/omap2/dss/venc.c
+++ b/drivers/video/fbdev/omap2/dss/venc.c
@@ -35,6 +35,7 @@
35#include <linux/regulator/consumer.h> 35#include <linux/regulator/consumer.h>
36#include <linux/pm_runtime.h> 36#include <linux/pm_runtime.h>
37#include <linux/of.h> 37#include <linux/of.h>
38#include <linux/component.h>
38 39
39#include <video/omapdss.h> 40#include <video/omapdss.h>
40 41
@@ -852,8 +853,9 @@ err:
852} 853}
853 854
854/* VENC HW IP initialisation */ 855/* VENC HW IP initialisation */
855static int omap_venchw_probe(struct platform_device *pdev) 856static int venc_bind(struct device *dev, struct device *master, void *data)
856{ 857{
858 struct platform_device *pdev = to_platform_device(dev);
857 u8 rev_id; 859 u8 rev_id;
858 struct resource *venc_mem; 860 struct resource *venc_mem;
859 int r; 861 int r;
@@ -912,12 +914,28 @@ err_runtime_get:
912 return r; 914 return r;
913} 915}
914 916
915static int omap_venchw_remove(struct platform_device *pdev) 917static void venc_unbind(struct device *dev, struct device *master, void *data)
916{ 918{
919 struct platform_device *pdev = to_platform_device(dev);
920
917 venc_uninit_output(pdev); 921 venc_uninit_output(pdev);
918 922
919 pm_runtime_disable(&pdev->dev); 923 pm_runtime_disable(&pdev->dev);
924}
920 925
926static const struct component_ops venc_component_ops = {
927 .bind = venc_bind,
928 .unbind = venc_unbind,
929};
930
931static int venc_probe(struct platform_device *pdev)
932{
933 return component_add(&pdev->dev, &venc_component_ops);
934}
935
936static int venc_remove(struct platform_device *pdev)
937{
938 component_del(&pdev->dev, &venc_component_ops);
921 return 0; 939 return 0;
922} 940}
923 941
@@ -950,7 +968,6 @@ static const struct dev_pm_ops venc_pm_ops = {
950 .runtime_resume = venc_runtime_resume, 968 .runtime_resume = venc_runtime_resume,
951}; 969};
952 970
953
954static const struct of_device_id venc_of_match[] = { 971static const struct of_device_id venc_of_match[] = {
955 { .compatible = "ti,omap2-venc", }, 972 { .compatible = "ti,omap2-venc", },
956 { .compatible = "ti,omap3-venc", }, 973 { .compatible = "ti,omap3-venc", },
@@ -959,8 +976,8 @@ static const struct of_device_id venc_of_match[] = {
959}; 976};
960 977
961static struct platform_driver omap_venchw_driver = { 978static struct platform_driver omap_venchw_driver = {
962 .probe = omap_venchw_probe, 979 .probe = venc_probe,
963 .remove = omap_venchw_remove, 980 .remove = venc_remove,
964 .driver = { 981 .driver = {
965 .name = "omapdss_venc", 982 .name = "omapdss_venc",
966 .pm = &venc_pm_ops, 983 .pm = &venc_pm_ops,