aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorSenthilvadivu Guruswamy <svadivu@ti.com>2011-01-24 01:21:59 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-03-11 08:46:20 -0500
commit3448d500f7002a5ee374ec92d954b1667cbf72a4 (patch)
tree20f5d41b1335b1359052331f2cbdbc278edae545 /drivers/video/omap2
parent8b9cb3a8f39d0864c925c5cd5c2c54cfd85ad551 (diff)
OMAP2, 3: DSS2: RFBI: create platform_driver, move init, exit to driver
Hwmod adaptation design requires each of the DSS HW IP to be a platform driver. So a platform_driver for RFBI is created and init exit methods are moved from core.c to its driver probe,remove. pdev member has to be maintained by its own drivers. RFBI platform driver is registered from inside omap_dss_probe, in the order desired. Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com> Signed-off-by: Sumit Semwal <sumit.semwal@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/dss/core.c8
-rw-r--r--drivers/video/omap2/dss/dss.h8
-rw-r--r--drivers/video/omap2/dss/rfbi.c110
3 files changed, 74 insertions, 52 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 255935541d0d..8eef616fee03 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -201,9 +201,9 @@ static int omap_dss_probe(struct platform_device *pdev)
201 /* keep clocks enabled to prevent context saves/restores during init */ 201 /* keep clocks enabled to prevent context saves/restores during init */
202 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); 202 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
203 203
204 r = rfbi_init(); 204 r = rfbi_init_platform_driver();
205 if (r) { 205 if (r) {
206 DSSERR("Failed to initialize rfbi\n"); 206 DSSERR("Failed to initialize rfbi platform driver\n");
207 goto err_rfbi; 207 goto err_rfbi;
208 } 208 }
209 209
@@ -285,7 +285,7 @@ err_venc:
285err_dispc: 285err_dispc:
286 dpi_exit(); 286 dpi_exit();
287err_dpi: 287err_dpi:
288 rfbi_exit(); 288 rfbi_uninit_platform_driver();
289err_rfbi: 289err_rfbi:
290 dss_uninit_platform_driver(); 290 dss_uninit_platform_driver();
291err_dss: 291err_dss:
@@ -303,7 +303,7 @@ static int omap_dss_remove(struct platform_device *pdev)
303 venc_exit(); 303 venc_exit();
304 dispc_exit(); 304 dispc_exit();
305 dpi_exit(); 305 dpi_exit();
306 rfbi_exit(); 306 rfbi_uninit_platform_driver();
307 if (cpu_is_omap34xx()) { 307 if (cpu_is_omap34xx()) {
308 dsi_exit(); 308 dsi_exit();
309 sdi_exit(); 309 sdi_exit();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index c535ee1db3ee..0ba4bdbd6b01 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -428,8 +428,8 @@ static inline void venc_exit(void)
428 428
429/* RFBI */ 429/* RFBI */
430#ifdef CONFIG_OMAP2_DSS_RFBI 430#ifdef CONFIG_OMAP2_DSS_RFBI
431int rfbi_init(void); 431int rfbi_init_platform_driver(void);
432void rfbi_exit(void); 432void rfbi_uninit_platform_driver(void);
433void rfbi_dump_regs(struct seq_file *s); 433void rfbi_dump_regs(struct seq_file *s);
434 434
435int rfbi_configure(int rfbi_module, int bpp, int lines); 435int rfbi_configure(int rfbi_module, int bpp, int lines);
@@ -440,11 +440,11 @@ void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t);
440unsigned long rfbi_get_max_tx_rate(void); 440unsigned long rfbi_get_max_tx_rate(void);
441int rfbi_init_display(struct omap_dss_device *display); 441int rfbi_init_display(struct omap_dss_device *display);
442#else 442#else
443static inline int rfbi_init(void) 443static inline int rfbi_init_platform_driver(void)
444{ 444{
445 return 0; 445 return 0;
446} 446}
447static inline void rfbi_exit(void) 447static inline void rfbi_uninit_platform_driver(void)
448{ 448{
449} 449}
450#endif 450#endif
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 10a2ffe02882..153f963e8e89 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -100,6 +100,7 @@ static int rfbi_convert_timings(struct rfbi_timings *t);
100static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div); 100static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
101 101
102static struct { 102static struct {
103 struct platform_device *pdev;
103 void __iomem *base; 104 void __iomem *base;
104 105
105 unsigned long l4_khz; 106 unsigned long l4_khz;
@@ -957,50 +958,6 @@ void rfbi_dump_regs(struct seq_file *s)
957#undef DUMPREG 958#undef DUMPREG
958} 959}
959 960
960int rfbi_init(void)
961{
962 u32 rev;
963 u32 l;
964
965 spin_lock_init(&rfbi.cmd_lock);
966
967 init_completion(&rfbi.cmd_done);
968 atomic_set(&rfbi.cmd_fifo_full, 0);
969 atomic_set(&rfbi.cmd_pending, 0);
970
971 rfbi.base = ioremap(RFBI_BASE, SZ_256);
972 if (!rfbi.base) {
973 DSSERR("can't ioremap RFBI\n");
974 return -ENOMEM;
975 }
976
977 rfbi_enable_clocks(1);
978
979 msleep(10);
980
981 rfbi.l4_khz = dss_clk_get_rate(DSS_CLK_ICK) / 1000;
982
983 /* Enable autoidle and smart-idle */
984 l = rfbi_read_reg(RFBI_SYSCONFIG);
985 l |= (1 << 0) | (2 << 3);
986 rfbi_write_reg(RFBI_SYSCONFIG, l);
987
988 rev = rfbi_read_reg(RFBI_REVISION);
989 printk(KERN_INFO "OMAP RFBI rev %d.%d\n",
990 FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
991
992 rfbi_enable_clocks(0);
993
994 return 0;
995}
996
997void rfbi_exit(void)
998{
999 DSSDBG("rfbi_exit\n");
1000
1001 iounmap(rfbi.base);
1002}
1003
1004int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) 961int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev)
1005{ 962{
1006 int r; 963 int r;
@@ -1056,3 +1013,68 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
1056 dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; 1013 dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
1057 return 0; 1014 return 0;
1058} 1015}
1016
1017/* RFBI HW IP initialisation */
1018static int omap_rfbihw_probe(struct platform_device *pdev)
1019{
1020 u32 rev;
1021 u32 l;
1022
1023 rfbi.pdev = pdev;
1024
1025 spin_lock_init(&rfbi.cmd_lock);
1026
1027 init_completion(&rfbi.cmd_done);
1028 atomic_set(&rfbi.cmd_fifo_full, 0);
1029 atomic_set(&rfbi.cmd_pending, 0);
1030
1031 rfbi.base = ioremap(RFBI_BASE, SZ_256);
1032 if (!rfbi.base) {
1033 DSSERR("can't ioremap RFBI\n");
1034 return -ENOMEM;
1035 }
1036
1037 rfbi_enable_clocks(1);
1038
1039 msleep(10);
1040
1041 rfbi.l4_khz = dss_clk_get_rate(DSS_CLK_ICK) / 1000;
1042
1043 /* Enable autoidle and smart-idle */
1044 l = rfbi_read_reg(RFBI_SYSCONFIG);
1045 l |= (1 << 0) | (2 << 3);
1046 rfbi_write_reg(RFBI_SYSCONFIG, l);
1047
1048 rev = rfbi_read_reg(RFBI_REVISION);
1049 printk(KERN_INFO "OMAP RFBI rev %d.%d\n",
1050 FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
1051
1052 rfbi_enable_clocks(0);
1053
1054 return 0;
1055}
1056
1057static int omap_rfbihw_remove(struct platform_device *pdev)
1058{
1059 iounmap(rfbi.base);
1060 return 0;
1061}
1062
1063static struct platform_driver omap_rfbihw_driver = {
1064 .probe = omap_rfbihw_probe,
1065 .remove = omap_rfbihw_remove,
1066 .driver = {
1067 .name = "omapdss_rfbi",
1068 .owner = THIS_MODULE,
1069 },
1070};
1071
1072int rfbi_init_platform_driver(void)
1073{
1074 return platform_driver_register(&omap_rfbihw_driver);
1075}
1076
1077void rfbi_uninit_platform_driver(void)
1078{
1079 return platform_driver_unregister(&omap_rfbihw_driver);
1080}