aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/rfbi.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2011-04-29 09:51:10 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-05-12 12:39:51 -0400
commitc42ced6391ca19e6796b1984bd200f6ff8e5644a (patch)
tree1f5584edcc9bb585020506f4df116e56efc9bd91 /drivers/video/omap2/dss/rfbi.c
parent1d5952a868c3059dd0d431ffde357f1506823f5e (diff)
OMAP: DSS2: RFBI: cleanup
The RFBI driver is quite messy. Remove dead and unneeded code and add statics to functions. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/rfbi.c')
-rw-r--r--drivers/video/omap2/dss/rfbi.c124
1 files changed, 3 insertions, 121 deletions
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 155caf02bcad..c06fbe0bc678 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -66,9 +66,6 @@ struct rfbi_reg { u16 idx; };
66#define REG_FLD_MOD(idx, val, start, end) \ 66#define REG_FLD_MOD(idx, val, start, end) \
67 rfbi_write_reg(idx, FLD_MOD(rfbi_read_reg(idx), val, start, end)) 67 rfbi_write_reg(idx, FLD_MOD(rfbi_read_reg(idx), val, start, end))
68 68
69/* To work around an RFBI transfer rate limitation */
70#define OMAP_RFBI_RATE_LIMIT 1
71
72enum omap_rfbi_cycleformat { 69enum omap_rfbi_cycleformat {
73 OMAP_DSS_RFBI_CYCLEFORMAT_1_1 = 0, 70 OMAP_DSS_RFBI_CYCLEFORMAT_1_1 = 0,
74 OMAP_DSS_RFBI_CYCLEFORMAT_2_1 = 1, 71 OMAP_DSS_RFBI_CYCLEFORMAT_2_1 = 1,
@@ -90,11 +87,6 @@ enum omap_rfbi_parallelmode {
90 OMAP_DSS_RFBI_PARALLELMODE_16 = 3, 87 OMAP_DSS_RFBI_PARALLELMODE_16 = 3,
91}; 88};
92 89
93enum update_cmd {
94 RFBI_CMD_UPDATE = 0,
95 RFBI_CMD_SYNC = 1,
96};
97
98static int rfbi_convert_timings(struct rfbi_timings *t); 90static int rfbi_convert_timings(struct rfbi_timings *t);
99static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div); 91static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
100 92
@@ -115,22 +107,9 @@ static struct {
115 107
116 struct omap_dss_device *dssdev[2]; 108 struct omap_dss_device *dssdev[2];
117 109
118 struct kfifo cmd_fifo;
119 spinlock_t cmd_lock;
120 struct completion cmd_done;
121 atomic_t cmd_fifo_full;
122 atomic_t cmd_pending;
123
124 struct semaphore bus_lock; 110 struct semaphore bus_lock;
125} rfbi; 111} rfbi;
126 112
127struct update_region {
128 u16 x;
129 u16 y;
130 u16 w;
131 u16 h;
132};
133
134static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) 113static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val)
135{ 114{
136 __raw_writel(val, rfbi.base + idx.idx); 115 __raw_writel(val, rfbi.base + idx.idx);
@@ -305,7 +284,7 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
305} 284}
306EXPORT_SYMBOL(omap_rfbi_write_pixels); 285EXPORT_SYMBOL(omap_rfbi_write_pixels);
307 286
308void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width, 287static void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width,
309 u16 height, void (*callback)(void *data), void *data) 288 u16 height, void (*callback)(void *data), void *data)
310{ 289{
311 u32 l; 290 u32 l;
@@ -345,8 +324,6 @@ static void framedone_callback(void *data, u32 mask)
345 324
346 if (callback != NULL) 325 if (callback != NULL)
347 callback(rfbi.framedone_callback_data); 326 callback(rfbi.framedone_callback_data);
348
349 atomic_set(&rfbi.cmd_pending, 0);
350} 327}
351 328
352#if 1 /* VERBOSE */ 329#if 1 /* VERBOSE */
@@ -436,7 +413,7 @@ static int calc_extif_timings(struct rfbi_timings *t)
436} 413}
437 414
438 415
439void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t) 416static void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t)
440{ 417{
441 int r; 418 int r;
442 419
@@ -471,59 +448,6 @@ static int ps_to_rfbi_ticks(int time, int div)
471 return ret; 448 return ret;
472} 449}
473 450
474#ifdef OMAP_RFBI_RATE_LIMIT
475unsigned long rfbi_get_max_tx_rate(void)
476{
477 unsigned long l4_rate, dss1_rate;
478 int min_l4_ticks = 0;
479 int i;
480
481 /* According to TI this can't be calculated so make the
482 * adjustments for a couple of known frequencies and warn for
483 * others.
484 */
485 static const struct {
486 unsigned long l4_clk; /* HZ */
487 unsigned long dss1_clk; /* HZ */
488 unsigned long min_l4_ticks;
489 } ftab[] = {
490 { 55, 132, 7, }, /* 7.86 MPix/s */
491 { 110, 110, 12, }, /* 9.16 MPix/s */
492 { 110, 132, 10, }, /* 11 Mpix/s */
493 { 120, 120, 10, }, /* 12 Mpix/s */
494 { 133, 133, 10, }, /* 13.3 Mpix/s */
495 };
496
497 l4_rate = rfbi.l4_khz / 1000;
498 dss1_rate = dss_clk_get_rate(DSS_CLK_FCK) / 1000000;
499
500 for (i = 0; i < ARRAY_SIZE(ftab); i++) {
501 /* Use a window instead of an exact match, to account
502 * for different DPLL multiplier / divider pairs.
503 */
504 if (abs(ftab[i].l4_clk - l4_rate) < 3 &&
505 abs(ftab[i].dss1_clk - dss1_rate) < 3) {
506 min_l4_ticks = ftab[i].min_l4_ticks;
507 break;
508 }
509 }
510 if (i == ARRAY_SIZE(ftab)) {
511 /* Can't be sure, return anyway the maximum not
512 * rate-limited. This might cause a problem only for the
513 * tearing synchronisation.
514 */
515 DSSERR("can't determine maximum RFBI transfer rate\n");
516 return rfbi.l4_khz * 1000;
517 }
518 return rfbi.l4_khz * 1000 / min_l4_ticks;
519}
520#else
521int rfbi_get_max_tx_rate(void)
522{
523 return rfbi.l4_khz * 1000;
524}
525#endif
526
527static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div) 451static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div)
528{ 452{
529 *clk_period = 1000000000 / rfbi.l4_khz; 453 *clk_period = 1000000000 / rfbi.l4_khz;
@@ -683,44 +607,7 @@ int omap_rfbi_enable_te(bool enable, unsigned line)
683} 607}
684EXPORT_SYMBOL(omap_rfbi_enable_te); 608EXPORT_SYMBOL(omap_rfbi_enable_te);
685 609
686#if 0 610static int rfbi_configure(int rfbi_module, int bpp, int lines)
687static void rfbi_enable_config(int enable1, int enable2)
688{
689 u32 l;
690 int cs = 0;
691
692 if (enable1)
693 cs |= 1<<0;
694 if (enable2)
695 cs |= 1<<1;
696
697 rfbi_enable_clocks(1);
698
699 l = rfbi_read_reg(RFBI_CONTROL);
700
701 l = FLD_MOD(l, cs, 3, 2);
702 l = FLD_MOD(l, 0, 1, 1);
703
704 rfbi_write_reg(RFBI_CONTROL, l);
705
706
707 l = rfbi_read_reg(RFBI_CONFIG(0));
708 l = FLD_MOD(l, 0, 3, 2); /* TRIGGERMODE: ITE */
709 /*l |= FLD_VAL(2, 8, 7); */ /* L4FORMAT, 2pix/L4 */
710 /*l |= FLD_VAL(0, 8, 7); */ /* L4FORMAT, 1pix/L4 */
711
712 l = FLD_MOD(l, 0, 16, 16); /* A0POLARITY */
713 l = FLD_MOD(l, 1, 20, 20); /* TE_VSYNC_POLARITY */
714 l = FLD_MOD(l, 1, 21, 21); /* HSYNCPOLARITY */
715
716 l = FLD_MOD(l, OMAP_DSS_RFBI_PARALLELMODE_8, 1, 0);
717 rfbi_write_reg(RFBI_CONFIG(0), l);
718
719 rfbi_enable_clocks(0);
720}
721#endif
722
723int rfbi_configure(int rfbi_module, int bpp, int lines)
724{ 611{
725 u32 l; 612 u32 l;
726 int cycle1 = 0, cycle2 = 0, cycle3 = 0; 613 int cycle1 = 0, cycle2 = 0, cycle3 = 0;
@@ -1022,13 +909,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
1022 909
1023 rfbi.pdev = pdev; 910 rfbi.pdev = pdev;
1024 911
1025 spin_lock_init(&rfbi.cmd_lock);
1026 sema_init(&rfbi.bus_lock, 1); 912 sema_init(&rfbi.bus_lock, 1);
1027 913
1028 init_completion(&rfbi.cmd_done);
1029 atomic_set(&rfbi.cmd_fifo_full, 0);
1030 atomic_set(&rfbi.cmd_pending, 0);
1031
1032 rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0); 914 rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0);
1033 if (!rfbi_mem) { 915 if (!rfbi_mem) {
1034 DSSERR("can't get IORESOURCE_MEM RFBI\n"); 916 DSSERR("can't get IORESOURCE_MEM RFBI\n");