aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-02-20 09:57:37 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-11 07:44:51 -0400
commita57dd4fe7bef557afaa1a6cdb77cd95b2cba094e (patch)
tree50cae3f775bc743299dc7285c758df599d2874cc /drivers
parent53f576a8dc5729e719c862aba2ed3430867bd5cb (diff)
OMAPDSS: create DPI & SDI drivers
We currently have separate device/driver for each DSS HW module. The DPI and SDI outputs are more or less parts of the DSS or DISPC hardware modules, but in SW it makes sense to represent them as device/driver pairs similarly to all the other outputs. This also makes sense for device tree, as each node under dss will be a platform device, and handling DPI & SDI somehow differently than the rest would just make the code more complex. This patch modifies the dpi.c and sdi.c to create drivers for the platform devices. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/omap2/dss/core.c18
-rw-r--r--drivers/video/omap2/dss/dpi.c23
-rw-r--r--drivers/video/omap2/dss/dss.c20
-rw-r--r--drivers/video/omap2/dss/dss.h26
-rw-r--r--drivers/video/omap2/dss/sdi.c25
5 files changed, 71 insertions, 41 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index db45e6abe311..77fbd99295dc 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -536,6 +536,18 @@ static int __init omap_dss_register_drivers(void)
536 goto err_dispc; 536 goto err_dispc;
537 } 537 }
538 538
539 r = dpi_init_platform_driver();
540 if (r) {
541 DSSERR("Failed to initialize dpi platform driver\n");
542 goto err_dpi;
543 }
544
545 r = sdi_init_platform_driver();
546 if (r) {
547 DSSERR("Failed to initialize sdi platform driver\n");
548 goto err_sdi;
549 }
550
539 r = rfbi_init_platform_driver(); 551 r = rfbi_init_platform_driver();
540 if (r) { 552 if (r) {
541 DSSERR("Failed to initialize rfbi platform driver\n"); 553 DSSERR("Failed to initialize rfbi platform driver\n");
@@ -569,6 +581,10 @@ err_dsi:
569err_venc: 581err_venc:
570 rfbi_uninit_platform_driver(); 582 rfbi_uninit_platform_driver();
571err_rfbi: 583err_rfbi:
584 sdi_uninit_platform_driver();
585err_sdi:
586 dpi_uninit_platform_driver();
587err_dpi:
572 dispc_uninit_platform_driver(); 588 dispc_uninit_platform_driver();
573err_dispc: 589err_dispc:
574 dss_uninit_platform_driver(); 590 dss_uninit_platform_driver();
@@ -584,6 +600,8 @@ static void __exit omap_dss_unregister_drivers(void)
584 dsi_uninit_platform_driver(); 600 dsi_uninit_platform_driver();
585 venc_uninit_platform_driver(); 601 venc_uninit_platform_driver();
586 rfbi_uninit_platform_driver(); 602 rfbi_uninit_platform_driver();
603 sdi_uninit_platform_driver();
604 dpi_uninit_platform_driver();
587 dispc_uninit_platform_driver(); 605 dispc_uninit_platform_driver();
588 dss_uninit_platform_driver(); 606 dss_uninit_platform_driver();
589 607
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index d6e8fe776152..79d242a42607 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -379,12 +379,31 @@ int dpi_init_display(struct omap_dss_device *dssdev)
379 return 0; 379 return 0;
380} 380}
381 381
382int dpi_init(void) 382static int omap_dpi_probe(struct platform_device *pdev)
383{ 383{
384 return 0; 384 return 0;
385} 385}
386 386
387void dpi_exit(void) 387static int omap_dpi_remove(struct platform_device *pdev)
388{ 388{
389 return 0;
389} 390}
390 391
392static struct platform_driver omap_dpi_driver = {
393 .probe = omap_dpi_probe,
394 .remove = omap_dpi_remove,
395 .driver = {
396 .name = "omapdss_dpi",
397 .owner = THIS_MODULE,
398 },
399};
400
401int dpi_init_platform_driver(void)
402{
403 return platform_driver_register(&omap_dpi_driver);
404}
405
406void dpi_uninit_platform_driver(void)
407{
408 platform_driver_unregister(&omap_dpi_driver);
409}
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index c849d8bd5256..7a7ddd8fbf5e 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -786,18 +786,6 @@ static int omap_dsshw_probe(struct platform_device *pdev)
786 dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK; 786 dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK;
787 dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK; 787 dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK;
788 788
789 r = dpi_init();
790 if (r) {
791 DSSERR("Failed to initialize DPI\n");
792 goto err_dpi;
793 }
794
795 r = sdi_init();
796 if (r) {
797 DSSERR("Failed to initialize SDI\n");
798 goto err_sdi;
799 }
800
801 rev = dss_read_reg(DSS_REVISION); 789 rev = dss_read_reg(DSS_REVISION);
802 printk(KERN_INFO "OMAP DSS rev %d.%d\n", 790 printk(KERN_INFO "OMAP DSS rev %d.%d\n",
803 FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); 791 FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
@@ -805,10 +793,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
805 dss_runtime_put(); 793 dss_runtime_put();
806 794
807 return 0; 795 return 0;
808err_sdi: 796
809 dpi_exit();
810err_dpi:
811 dss_runtime_put();
812err_runtime_get: 797err_runtime_get:
813 pm_runtime_disable(&pdev->dev); 798 pm_runtime_disable(&pdev->dev);
814 dss_put_clocks(); 799 dss_put_clocks();
@@ -817,9 +802,6 @@ err_runtime_get:
817 802
818static int omap_dsshw_remove(struct platform_device *pdev) 803static int omap_dsshw_remove(struct platform_device *pdev)
819{ 804{
820 dpi_exit();
821 sdi_exit();
822
823 pm_runtime_disable(&pdev->dev); 805 pm_runtime_disable(&pdev->dev);
824 806
825 dss_put_clocks(); 807 dss_put_clocks();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 848fc9cd65d4..5496134c280b 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -272,17 +272,12 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
272 272
273/* SDI */ 273/* SDI */
274#ifdef CONFIG_OMAP2_DSS_SDI 274#ifdef CONFIG_OMAP2_DSS_SDI
275int sdi_init(void); 275int sdi_init_platform_driver(void);
276void sdi_exit(void); 276void sdi_uninit_platform_driver(void);
277int sdi_init_display(struct omap_dss_device *display); 277int sdi_init_display(struct omap_dss_device *display);
278#else 278#else
279static inline int sdi_init(void) 279static inline int sdi_init_platform_driver(void) { return 0; }
280{ 280static inline void sdi_uninit_platform_driver(void) { }
281 return 0;
282}
283static inline void sdi_exit(void)
284{
285}
286#endif 281#endif
287 282
288/* DSI */ 283/* DSI */
@@ -384,17 +379,12 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module)
384 379
385/* DPI */ 380/* DPI */
386#ifdef CONFIG_OMAP2_DSS_DPI 381#ifdef CONFIG_OMAP2_DSS_DPI
387int dpi_init(void); 382int dpi_init_platform_driver(void);
388void dpi_exit(void); 383void dpi_uninit_platform_driver(void);
389int dpi_init_display(struct omap_dss_device *dssdev); 384int dpi_init_display(struct omap_dss_device *dssdev);
390#else 385#else
391static inline int dpi_init(void) 386static inline int dpi_init_platform_driver(void) { return 0; }
392{ 387static inline void dpi_uninit_platform_driver(void) { }
393 return 0;
394}
395static inline void dpi_exit(void)
396{
397}
398#endif 388#endif
399 389
400/* DISPC */ 390/* DISPC */
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 67fbe7cee412..4ae2d8f55048 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -24,6 +24,7 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/regulator/consumer.h> 25#include <linux/regulator/consumer.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/platform_device.h>
27 28
28#include <video/omapdss.h> 29#include <video/omapdss.h>
29#include "dss.h" 30#include "dss.h"
@@ -182,11 +183,31 @@ int sdi_init_display(struct omap_dss_device *dssdev)
182 return 0; 183 return 0;
183} 184}
184 185
185int sdi_init(void) 186static int omap_sdi_probe(struct platform_device *pdev)
186{ 187{
187 return 0; 188 return 0;
188} 189}
189 190
190void sdi_exit(void) 191static int omap_sdi_remove(struct platform_device *pdev)
191{ 192{
193 return 0;
194}
195
196static struct platform_driver omap_sdi_driver = {
197 .probe = omap_sdi_probe,
198 .remove = omap_sdi_remove,
199 .driver = {
200 .name = "omapdss_sdi",
201 .owner = THIS_MODULE,
202 },
203};
204
205int sdi_init_platform_driver(void)
206{
207 return platform_driver_register(&omap_sdi_driver);
208}
209
210void sdi_uninit_platform_driver(void)
211{
212 platform_driver_unregister(&omap_sdi_driver);
192} 213}