aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-26 09:48:55 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-26 09:48:55 -0400
commit69036f0ccd9d48b4e999be4e98fa459430ec93b4 (patch)
treee09e075957c7e9b8299e57883d50eb3cff6ee3b2
parent866f0956cba7d28432f20f8a696e5c1a2b40b915 (diff)
parent6e5264b0380593efda8157406ec40f00daac9f2d (diff)
Merge branch 'archit/wb-dispc-for-3.7'
Merge omapdss writeback work. These patches implement the low level writeback features in the DISPC, but do not yet add a way to actually use the writeback from the userspace. * archit/wb-dispc-for-3.7: OMAPDSS: DISPC: Configure color conversion coefficients for writeback OMAPDSS: DISPC: Add manager like functions for writeback OMAPDSS: DISPC: Configure writeback FIFOs OMAPDSS: DISPC: Configure writeback specific parameters in dispc_wb_setup() OMAPDSS: DISPC: Configure overlay-like parameters in dispc_wb_setup OMAPDSS: DISPC: Add function to set channel in for writeback OMAPDSS: DISPC: Don't set chroma resampling bit for writeback OMAPDSS: DISPC: Downscale chroma if plane is writeback OMAPDSS: DISPC: Configure input and output sizes for writeback OMAPDSS: DISPC: Add writeback register offsets and dss features structs OMAPDSS: DISPC: Allow both upscaling and downscaling of chroma OMAPDSS: DIPSC: Relax scaling limitations when in memory to memory mode OMAPDSS: DISPC: Don't pass channel out when configuring overlays OMAPDSS: DISPC: Make dispc_ovl_setup call dispc_ovl_setup_common OMAPDSS: OVERLAY: Add position and replication as overlay caps OMAPDSS: DISPC: Pass overlay caps as a parameter to dispc plane functions OMAPDSS: DISPC: Simplify function names for setting pipeline input and output sizes OMAPDSS: DISPC: Constify omap_overlay_info in dispc_ovl_setup()
-rw-r--r--drivers/video/omap2/dss/apply.c2
-rw-r--r--drivers/video/omap2/dss/dispc.c562
-rw-r--r--drivers/video/omap2/dss/dispc.h33
-rw-r--r--drivers/video/omap2/dss/dss.h25
-rw-r--r--drivers/video/omap2/dss/dss_features.c57
-rw-r--r--drivers/video/omap2/dss/dss_features.h1
-rw-r--r--include/video/omapdss.h15
7 files changed, 510 insertions, 185 deletions
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 2b1fa851a8b9..19d66f471b4b 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -584,7 +584,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
584 584
585 replication = dss_ovl_use_replication(mp->lcd_config, oi->color_mode); 585 replication = dss_ovl_use_replication(mp->lcd_config, oi->color_mode);
586 586
587 r = dispc_ovl_setup(ovl->id, oi, replication, &mp->timings); 587 r = dispc_ovl_setup(ovl->id, oi, replication, &mp->timings, false);
588 if (r) { 588 if (r) {
589 /* 589 /*
590 * We can't do much here, as this function can be called from 590 * We can't do much here, as this function can be called from
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 811fe381aaea..a173a9481a23 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -86,14 +86,15 @@ struct dispc_features {
86 u16 sw_max; 86 u16 sw_max;
87 u16 vp_max; 87 u16 vp_max;
88 u16 hp_max; 88 u16 hp_max;
89 int (*calc_scaling) (enum omap_channel channel, 89 int (*calc_scaling) (enum omap_plane plane,
90 const struct omap_video_timings *mgr_timings, 90 const struct omap_video_timings *mgr_timings,
91 u16 width, u16 height, u16 out_width, u16 out_height, 91 u16 width, u16 height, u16 out_width, u16 out_height,
92 enum omap_color_mode color_mode, bool *five_taps, 92 enum omap_color_mode color_mode, bool *five_taps,
93 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y, 93 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
94 u16 pos_x, unsigned long *core_clk); 94 u16 pos_x, unsigned long *core_clk, bool mem_to_mem);
95 unsigned long (*calc_core_clk) (enum omap_channel channel, 95 unsigned long (*calc_core_clk) (enum omap_plane plane,
96 u16 width, u16 height, u16 out_width, u16 out_height); 96 u16 width, u16 height, u16 out_width, u16 out_height,
97 bool mem_to_mem);
97 u8 num_fifos; 98 u8 num_fifos;
98 99
99 /* swap GFX & WB fifos */ 100 /* swap GFX & WB fifos */
@@ -235,7 +236,14 @@ static const struct {
235 }, 236 },
236}; 237};
237 238
239struct color_conv_coef {
240 int ry, rcr, rcb, gy, gcr, gcb, by, bcr, bcb;
241 int full_range;
242};
243
238static void _omap_dispc_set_irqs(void); 244static void _omap_dispc_set_irqs(void);
245static unsigned long dispc_plane_pclk_rate(enum omap_plane plane);
246static unsigned long dispc_plane_lclk_rate(enum omap_plane plane);
239 247
240static inline void dispc_write_reg(const u16 idx, u32 val) 248static inline void dispc_write_reg(const u16 idx, u32 val)
241{ 249{
@@ -533,6 +541,11 @@ u32 dispc_mgr_get_framedone_irq(enum omap_channel channel)
533 return mgr_desc[channel].framedone_irq; 541 return mgr_desc[channel].framedone_irq;
534} 542}
535 543
544u32 dispc_wb_get_framedone_irq(void)
545{
546 return DISPC_IRQ_FRAMEDONEWB;
547}
548
536bool dispc_mgr_go_busy(enum omap_channel channel) 549bool dispc_mgr_go_busy(enum omap_channel channel)
537{ 550{
538 return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1; 551 return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1;
@@ -560,6 +573,30 @@ void dispc_mgr_go(enum omap_channel channel)
560 mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1); 573 mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1);
561} 574}
562 575
576bool dispc_wb_go_busy(void)
577{
578 return REG_GET(DISPC_CONTROL2, 6, 6) == 1;
579}
580
581void dispc_wb_go(void)
582{
583 enum omap_plane plane = OMAP_DSS_WB;
584 bool enable, go;
585
586 enable = REG_GET(DISPC_OVL_ATTRIBUTES(plane), 0, 0) == 1;
587
588 if (!enable)
589 return;
590
591 go = REG_GET(DISPC_CONTROL2, 6, 6) == 1;
592 if (go) {
593 DSSERR("GO bit not down for WB\n");
594 return;
595 }
596
597 REG_FLD_MOD(DISPC_CONTROL2, 1, 6, 6);
598}
599
563static void dispc_ovl_write_firh_reg(enum omap_plane plane, int reg, u32 value) 600static void dispc_ovl_write_firh_reg(enum omap_plane plane, int reg, u32 value)
564{ 601{
565 dispc_write_reg(DISPC_OVL_FIR_COEF_H(plane, reg), value); 602 dispc_write_reg(DISPC_OVL_FIR_COEF_H(plane, reg), value);
@@ -642,41 +679,41 @@ static void dispc_ovl_set_scale_coef(enum omap_plane plane, int fir_hinc,
642 } 679 }
643} 680}
644 681
645static void _dispc_setup_color_conv_coef(void)
646{
647 int i;
648 const struct color_conv_coef {
649 int ry, rcr, rcb, gy, gcr, gcb, by, bcr, bcb;
650 int full_range;
651 } ctbl_bt601_5 = {
652 298, 409, 0, 298, -208, -100, 298, 0, 517, 0,
653 };
654
655 const struct color_conv_coef *ct;
656 682
683static void dispc_ovl_write_color_conv_coef(enum omap_plane plane,
684 const struct color_conv_coef *ct)
685{
657#define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) 686#define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0))
658 687
659 ct = &ctbl_bt601_5; 688 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 0), CVAL(ct->rcr, ct->ry));
689 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 1), CVAL(ct->gy, ct->rcb));
690 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 2), CVAL(ct->gcb, ct->gcr));
691 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 3), CVAL(ct->bcr, ct->by));
692 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 4), CVAL(0, ct->bcb));
660 693
661 for (i = 1; i < dss_feat_get_num_ovls(); i++) { 694 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), ct->full_range, 11, 11);
662 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 0),
663 CVAL(ct->rcr, ct->ry));
664 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 1),
665 CVAL(ct->gy, ct->rcb));
666 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 2),
667 CVAL(ct->gcb, ct->gcr));
668 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 3),
669 CVAL(ct->bcr, ct->by));
670 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 4),
671 CVAL(0, ct->bcb));
672
673 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), ct->full_range,
674 11, 11);
675 }
676 695
677#undef CVAL 696#undef CVAL
678} 697}
679 698
699static void dispc_setup_color_conv_coef(void)
700{
701 int i;
702 int num_ovl = dss_feat_get_num_ovls();
703 int num_wb = dss_feat_get_num_wbs();
704 const struct color_conv_coef ctbl_bt601_5_ovl = {
705 298, 409, 0, 298, -208, -100, 298, 0, 517, 0,
706 };
707 const struct color_conv_coef ctbl_bt601_5_wb = {
708 66, 112, -38, 129, -94, -74, 25, -18, 112, 0,
709 };
710
711 for (i = 1; i < num_ovl; i++)
712 dispc_ovl_write_color_conv_coef(i, &ctbl_bt601_5_ovl);
713
714 for (; i < num_wb; i++)
715 dispc_ovl_write_color_conv_coef(i, &ctbl_bt601_5_wb);
716}
680 717
681static void dispc_ovl_set_ba0(enum om