aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-03-01 08:45:53 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-11 07:52:23 -0400
commit35deca3de6190b6bc03e34ed45de079047f834ab (patch)
tree6e778144d508dc5550cb105b39d06a522459069a
parentc018c6738bdae8c9f49766fd3d8b3770be2572f9 (diff)
OMAPDSS: interface drivers register their panel devices
Currently the higher level omapdss platform driver gets the list of displays in its platform data, and uses that list to create the omap_dss_device for each display. With DT, the logical way to do the above is to list the displays under each individual output, i.e. we'd have "dpi" node, under which we would have the display that uses DPI. In other words, each output driver handles the displays that use that particular output. To make the current code ready for DT, this patch modifies the output drivers so that each of them creates the display devices which use that output. However, instead of changing the platform data to suit this method, each output driver is passed the full list of displays, and the drivers pick the displays that are meant for them. This allows us to keep the old platform data, and thus we avoid the need to change the board files. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--arch/arm/mach-omap2/display.c11
-rw-r--r--drivers/video/omap2/dss/core.c50
-rw-r--r--drivers/video/omap2/dss/dpi.c17
-rw-r--r--drivers/video/omap2/dss/dsi.c18
-rw-r--r--drivers/video/omap2/dss/dss.h5
-rw-r--r--drivers/video/omap2/dss/hdmi.c17
-rw-r--r--drivers/video/omap2/dss/rfbi.c16
-rw-r--r--drivers/video/omap2/dss/sdi.c17
-rw-r--r--drivers/video/omap2/dss/venc.c18
9 files changed, 128 insertions, 41 deletions
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 40c135696007..54d49ddb9b81 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -327,7 +327,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
327 dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name, 327 dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name,
328 curr_dss_hwmod[0].id, 328 curr_dss_hwmod[0].id,
329 curr_dss_hwmod[0].oh_name, 329 curr_dss_hwmod[0].oh_name,
330 NULL, 0, 330 board_data, sizeof(*board_data),
331 NULL); 331 NULL);
332 332
333 if (IS_ERR(dss_pdev)) { 333 if (IS_ERR(dss_pdev)) {
@@ -341,7 +341,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
341 pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name, 341 pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
342 curr_dss_hwmod[i].id, 342 curr_dss_hwmod[i].id,
343 curr_dss_hwmod[i].oh_name, 343 curr_dss_hwmod[i].oh_name,
344 NULL, 0, 344 board_data, sizeof(*board_data),
345 dss_pdev); 345 dss_pdev);
346 346
347 if (IS_ERR(pdev)) { 347 if (IS_ERR(pdev)) {
@@ -354,15 +354,16 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
354 354
355 /* Create devices for DPI and SDI */ 355 /* Create devices for DPI and SDI */
356 356
357 pdev = create_simple_dss_pdev("omapdss_dpi", -1, NULL, 0, dss_pdev); 357 pdev = create_simple_dss_pdev("omapdss_dpi", -1,
358 board_data, sizeof(*board_data), dss_pdev);
358 if (IS_ERR(pdev)) { 359 if (IS_ERR(pdev)) {
359 pr_err("Could not build platform_device for omapdss_dpi\n"); 360 pr_err("Could not build platform_device for omapdss_dpi\n");
360 return PTR_ERR(pdev); 361 return PTR_ERR(pdev);
361 } 362 }
362 363
363 if (cpu_is_omap34xx()) { 364 if (cpu_is_omap34xx()) {
364 pdev = create_simple_dss_pdev("omapdss_sdi", -1, NULL, 0, 365 pdev = create_simple_dss_pdev("omapdss_sdi", -1,
365 dss_pdev); 366 board_data, sizeof(*board_data), dss_pdev);
366 if (IS_ERR(pdev)) { 367 if (IS_ERR(pdev)) {
367 pr_err("Could not build platform_device for omapdss_sdi\n"); 368 pr_err("Could not build platform_device for omapdss_sdi\n");
368 return PTR_ERR(pdev); 369 return PTR_ERR(pdev);
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index c3566a05d168..72ded9cd2cb0 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -56,9 +56,6 @@ bool dss_debug;
56module_param_named(debug, dss_debug, bool, 0644); 56module_param_named(debug, dss_debug, bool, 0644);
57#endif 57#endif
58 58
59static int omap_dss_register_device(struct omap_dss_device *);
60static void omap_dss_unregister_device(struct omap_dss_device *);
61
62/* REGULATORS */ 59/* REGULATORS */
63 60
64struct regulator *dss_get_vdds_dsi(void) 61struct regulator *dss_get_vdds_dsi(void)
@@ -209,7 +206,6 @@ static int __init omap_dss_probe(struct platform_device *pdev)
209{ 206{
210 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 207 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
211 int r; 208 int r;
212 int i;
213 209
214 core.pdev = pdev; 210 core.pdev = pdev;
215 211
@@ -229,25 +225,8 @@ static int __init omap_dss_probe(struct platform_device *pdev)
229 else if (pdata->default_device) 225 else if (pdata->default_device)
230 core.default_display_name = pdata->default_device->name; 226 core.default_display_name = pdata->default_device->name;
231 227
232 for (i = 0; i < pdata->num_devices; ++i) {
233 struct omap_dss_device *dssdev = pdata->devices[i];
234
235 r = omap_dss_register_device(dssdev);
236 if (r) {
237 DSSERR("device %d %s register failed %d\n", i,
238 dssdev->name ?: "unnamed", r);
239
240 while (--i >= 0)
241 omap_dss_unregister_device(pdata->devices[i]);
242
243 goto err_register;
244 }
245 }
246
247 return 0; 228 return 0;
248 229
249err_register:
250 dss_uninitialize_debugfs();
251err_debugfs: 230err_debugfs:
252 231
253 return r; 232 return r;
@@ -255,17 +234,11 @@ err_debugfs:
255 234
256static int omap_dss_remove(struct platform_device *pdev) 235static int omap_dss_remove(struct platform_device *pdev)
257{ 236{
258 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
259 int i;
260
261 dss_uninitialize_debugfs(); 237 dss_uninitialize_debugfs();
262 238
263 dss_uninit_overlays(pdev); 239 dss_uninit_overlays(pdev);
264 dss_uninit_overlay_managers(pdev); 240 dss_uninit_overlay_managers(pdev);
265 241
266 for (i = 0; i < pdata->num_devices; ++i)
267 omap_dss_unregister_device(pdata->devices[i]);
268
269 return 0; 242 return 0;
270} 243}
271 244
@@ -467,25 +440,36 @@ static void omap_dss_dev_release(struct device *dev)
467 reset_device(dev, 0); 440 reset_device(dev, 0);
468} 441}
469 442
470static int omap_dss_register_device(struct omap_dss_device *dssdev) 443int omap_dss_register_device(struct omap_dss_device *dssdev,
444 struct device *parent, int disp_num)
471{ 445{
472 static int dev_num;
473
474 WARN_ON(!dssdev->driver_name); 446 WARN_ON(!dssdev->driver_name);
475 447
476 reset_device(&dssdev->dev, 1); 448 reset_device(&dssdev->dev, 1);
477 dssdev->dev.bus = &dss_bus_type; 449 dssdev->dev.bus = &dss_bus_type;
478 dssdev->dev.parent = &dss_bus; 450 dssdev->dev.parent = parent;
479 dssdev->dev.release = omap_dss_dev_release; 451 dssdev->dev.release = omap_dss_dev_release;
480 dev_set_name(&dssdev->dev, "display%d", dev_num++); 452 dev_set_name(&dssdev->dev, "display%d", disp_num);
481 return device_register(&dssdev->dev); 453 return device_register(&dssdev->dev);
482} 454}
483 455
484static void omap_dss_unregister_device(struct omap_dss_device *dssdev) 456void omap_dss_unregister_device(struct omap_dss_device *dssdev)
485{ 457{
486 device_unregister(&dssdev->dev); 458 device_unregister(&dssdev->dev);
487} 459}
488 460
461static int dss_unregister_dss_dev(struct device *dev, void *data)
462{
463 struct omap_dss_device *dssdev = to_dss_device(dev);
464 omap_dss_unregister_device(dssdev);
465 return 0;
466}
467
468void omap_dss_unregister_child_devices(struct device *parent)
469{
470 device_for_each_child(parent, NULL, dss_unregister_dss_dev);
471}
472
489/* BUS */ 473/* BUS */
490static int __init omap_dss_bus_register(void) 474static int __init omap_dss_bus_register(void)
491{ 475{
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 6061379559c3..35eb29706934 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -367,11 +367,28 @@ int dpi_init_display(struct omap_dss_device *dssdev)
367 367
368static int __init omap_dpi_probe(struct platform_device *pdev) 368static int __init omap_dpi_probe(struct platform_device *pdev)
369{ 369{
370 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
371 int i, r;
372
373 for (i = 0; i < pdata->num_devices; ++i) {
374 struct omap_dss_device *dssdev = pdata->devices[i];
375
376 if (dssdev->type != OMAP_DISPLAY_TYPE_DPI)
377 continue;
378
379 r = omap_dss_register_device(dssdev, &pdev->dev, i);
380 if (r)
381 DSSERR("device %s register failed: %d\n",
382 dssdev->name, r);
383 }
384
370 return 0; 385 return 0;
371} 386}
372 387
373static int __exit omap_dpi_remove(struct platform_device *pdev) 388static int __exit omap_dpi_remove(struct platform_device *pdev)
374{ 389{
390 omap_dss_unregister_child_devices(&pdev->dev);
391
375 return 0; 392 return 0;
376} 393}
377 394
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index ddea71ea2a0f..78b962308a02 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4614,6 +4614,7 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev)
4614 int r, i, dsi_module = dsi_get_dsidev_id(dsidev); 4614 int r, i, dsi_module = dsi_get_dsidev_id(dsidev);
4615 struct resource *dsi_mem; 4615 struct resource *dsi_mem;
4616 struct dsi_data *dsi; 4616 struct dsi_data *dsi;
4617 struct omap_dss_board_info *pdata = dsidev->dev.platform_data;
4617 4618
4618 dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); 4619 dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL);
4619 if (!dsi) 4620 if (!dsi)
@@ -4700,6 +4701,21 @@ static int __init omap_dsihw_probe(struct platform_device *dsidev)
4700 else 4701 else
4701 dsi->num_lanes_supported = 3; 4702 dsi->num_lanes_supported = 3;
4702 4703
4704 for (i = 0; i < pdata->num_devices; ++i) {
4705 struct omap_dss_device *dssdev = pdata->devices[i];
4706
4707 if (dssdev->type != OMAP_DISPLAY_TYPE_DSI)
4708 continue;
4709
4710 if (dssdev->phy.dsi.module != dsi_module)
4711 continue;
4712
4713 r = omap_dss_register_device(dssdev, &dsidev->dev, i);
4714 if (r)
4715 DSSERR("device %s register failed: %d\n",
4716 dssdev->name, r);
4717 }
4718
4703 dsi_runtime_put(dsidev); 4719 dsi_runtime_put(dsidev);
4704 4720
4705 if (dsi_module == 0) 4721 if (dsi_module == 0)
@@ -4727,6 +4743,8 @@ static int __exit omap_dsihw_remove(struct platform_device *dsidev)
4727 4743
4728 WARN_ON(dsi->scp_clk_refcount > 0); 4744 WARN_ON(dsi->scp_clk_refcount > 0);
4729 4745
4746 omap_dss_unregister_child_devices(&dsidev->dev);
4747
4730 pm_runtime_disable(&dsidev->dev); 4748 pm_runtime_disable(&dsidev->dev);
4731 4749
4732 dsi_put_clocks(dsidev); 4750 dsi_put_clocks(dsidev);
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 7bc24ed8de8e..972b22d27972 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -165,6 +165,11 @@ void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
165int dss_set_min_bus_tput(struct device *dev, unsigned long tput); 165int dss_set_min_bus_tput(struct device *dev, unsigned long tput);
166int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)); 166int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
167 167
168int omap_dss_register_device(struct omap_dss_device *dssdev,
169 struct device *parent, int disp_num);
170void omap_dss_unregister_device(struct omap_dss_device *dssdev);
171void omap_dss_unregister_child_devices(struct device *parent);
172
168/* apply */ 173/* apply */
169void dss_apply_init(void); 174void dss_apply_init(void);
170int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr); 175int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 09ede7fa1983..faa91441a6b0 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -774,8 +774,9 @@ static void hdmi_put_clocks(void)
774/* HDMI HW IP initialisation */ 774/* HDMI HW IP initialisation */
775static int __init omapdss_hdmihw_probe(struct platform_device *pdev) 775static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
776{ 776{
777 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
777 struct resource *hdmi_mem; 778 struct resource *hdmi_mem;
778 int r; 779 int r, i;
779 780
780 hdmi.pdev = pdev; 781 hdmi.pdev = pdev;
781 782
@@ -812,6 +813,18 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
812 813
813 dss_debugfs_create_file("hdmi", hdmi_dump_regs); 814 dss_debugfs_create_file("hdmi", hdmi_dump_regs);
814 815
816 for (i = 0; i < pdata->num_devices; ++i) {
817 struct omap_dss_device *dssdev = pdata->devices[i];
818
819 if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI)
820 continue;
821
822 r = omap_dss_register_device(dssdev, &pdev->dev, i);
823 if (r)
824 DSSERR("device %s register failed: %d\n",
825 dssdev->name, r);
826 }
827
815#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ 828#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
816 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) 829 defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
817 830
@@ -828,6 +841,8 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
828 841
829static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) 842static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
830{ 843{
844 omap_dss_unregister_child_devices(&pdev->dev);
845
831 hdmi_panel_exit(); 846 hdmi_panel_exit();
832 847
833#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ 848#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 58da146254ee..4c0a6c97d62b 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -930,10 +930,11 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
930/* RFBI HW IP initialisation */ 930/* RFBI HW IP initialisation */
931static int __init omap_rfbihw_probe(struct platform_device *pdev) 931static int __init omap_rfbihw_probe(struct platform_device *pdev)
932{ 932{
933 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
933 u32 rev; 934 u32 rev;
934 struct resource *rfbi_mem; 935 struct resource *rfbi_mem;
935 struct clk *clk; 936 struct clk *clk;
936 int r; 937 int r, i;
937 938
938 rfbi.pdev = pdev; 939 rfbi.pdev = pdev;
939 940
@@ -978,6 +979,18 @@ static int __init omap_rfbihw_probe(struct platform_device *pdev)
978 979
979 dss_debugfs_create_file("rfbi", rfbi_dump_regs); 980 dss_debugfs_create_file("rfbi", rfbi_dump_regs);
980 981
982 for (i = 0; i < pdata->num_devices; ++i) {
983 struct omap_dss_device *dssdev = pdata->devices[i];
984
985 if (dssdev->type != OMAP_DISPLAY_TYPE_DBI)
986 continue;
987
988 r = omap_dss_register_device(dssdev, &pdev->dev, i);
989 if (r)
990 DSSERR("device %s register failed: %d\n",
991 dssdev->name, r);
992 }
993
981 return 0; 994 return 0;
982 995
983err_runtime_get: 996err_runtime_get:
@@ -987,6 +1000,7 @@ err_runtime_get:
987 1000
988static int __exit omap_rfbihw_remove(struct platform_device *pdev) 1001static int __exit omap_rfbihw_remove(struct platform_device *pdev)
989{ 1002{
1003 omap_dss_unregister_child_devices(&pdev->dev);
990 pm_runtime_disable(&pdev->dev); 1004 pm_runtime_disable(&pdev->dev);
991 return 0; 1005 return 0;
992} 1006}
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 661b594225a2..3be8134ec2d9 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -178,11 +178,28 @@ int sdi_init_display(struct omap_dss_device *dssdev)
178 178
179static int __init omap_sdi_probe(struct platform_device *pdev) 179static int __init omap_sdi_probe(struct platform_device *pdev)
180{ 180{
181 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
182 int i, r;
183
184 for (i = 0; i < pdata->num_devices; ++i) {
185 struct omap_dss_device *dssdev = pdata->devices[i];
186
187 if (dssdev->type != OMAP_DISPLAY_TYPE_SDI)
188 continue;
189
190 r = omap_dss_register_device(dssdev, &pdev->dev, i);
191 if (r)
192 DSSERR("device %s register failed: %d\n",
193 dssdev->name, r);
194 }
195
181 return 0; 196 return 0;
182} 197}
183 198
184static int __exit omap_sdi_remove(struct platform_device *pdev) 199static int __exit omap_sdi_remove(struct platform_device *pdev)
185{ 200{
201 omap_dss_unregister_child_devices(&pdev->dev);
202
186 return 0; 203 return 0;
187} 204}
188 205
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 7322ac8a3bcc..c194dfab6356 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -832,9 +832,10 @@ static void venc_put_clocks(void)
832/* VENC HW IP initialisation */ 832/* VENC HW IP initialisation */
833static int __init omap_venchw_probe(struct platform_device *pdev) 833static int __init omap_venchw_probe(struct platform_device *pdev)
834{ 834{
835 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
835 u8 rev_id; 836 u8 rev_id;
836 struct resource *venc_mem; 837 struct resource *venc_mem;
837 int r; 838 int r, i;
838 839
839 venc.pdev = pdev; 840 venc.pdev = pdev;
840 841
@@ -876,6 +877,18 @@ static int __init omap_venchw_probe(struct platform_device *pdev)
876 877
877 dss_debugfs_create_file("venc", venc_dump_regs); 878 dss_debugfs_create_file("venc", venc_dump_regs);
878 879
880 for (i = 0; i < pdata->num_devices; ++i) {
881 struct omap_dss_device *dssdev = pdata->devices[i];
882
883 if (dssdev->type != OMAP_DISPLAY_TYPE_VENC)
884 continue;
885
886 r = omap_dss_register_device(dssdev, &pdev->dev, i);
887 if (r)
888 DSSERR("device %s register failed: %d\n",
889 dssdev->name, r);
890 }
891
879 return 0; 892 return 0;
880 893
881err_reg_panel_driver: 894err_reg_panel_driver:
@@ -887,10 +900,13 @@ err_runtime_get:
887 900
888static int __exit omap_venchw_remove(struct platform_device *pdev) 901static int __exit omap_venchw_remove(struct platform_device *pdev)
889{ 902{
903 omap_dss_unregister_child_devices(&pdev->dev);
904
890 if (venc.vdda_dac_reg != NULL) { 905 if (venc.vdda_dac_reg != NULL) {
891 regulator_put(venc.vdda_dac_reg); 906 regulator_put(venc.vdda_dac_reg);
892 venc.vdda_dac_reg = NULL; 907 venc.vdda_dac_reg = NULL;
893 } 908 }
909
894 omap_dss_unregister_driver(&venc_driver); 910 omap_dss_unregister_driver(&venc_driver);
895 911
896 pm_runtime_disable(&pdev->dev); 912 pm_runtime_disable(&pdev->dev);