diff options
author | Archit Taneja <archit@ti.com> | 2012-09-22 03:09:33 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-09-26 07:58:51 -0400 |
commit | 0b23e5b86850857192c589f837b92e1ac568b485 (patch) | |
tree | cf7493bccc3e6e5113964456dfa24ed28a59c0fd /drivers/video | |
parent | 8bbe09ee4d2c3f201c302f0af75a7c5e17d72625 (diff) |
OMAPDSS: DISPC: Add manager like functions for writeback
Add functions to enable writeback, and set/check state of GO bit. These bits are
identical in behaviour with the corresponding overlay manager bits. Configure
them in a similar way to mgr_enable() and mgr_go_* functions. Add a helper to
get the FRAMEDONE irq corresponding to writeback.
Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 70 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 5 |
2 files changed, 75 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 6f326765f341..3ca9a30473d3 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -536,6 +536,11 @@ u32 dispc_mgr_get_framedone_irq(enum omap_channel channel) | |||
536 | return mgr_desc[channel].framedone_irq; | 536 | return mgr_desc[channel].framedone_irq; |
537 | } | 537 | } |
538 | 538 | ||
539 | u32 dispc_wb_get_framedone_irq(void) | ||
540 | { | ||
541 | return DISPC_IRQ_FRAMEDONEWB; | ||
542 | } | ||
543 | |||
539 | bool dispc_mgr_go_busy(enum omap_channel channel) | 544 | bool dispc_mgr_go_busy(enum omap_channel channel) |
540 | { | 545 | { |
541 | return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1; | 546 | return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1; |
@@ -563,6 +568,30 @@ void dispc_mgr_go(enum omap_channel channel) | |||
563 | mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1); | 568 | mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1); |
564 | } | 569 | } |
565 | 570 | ||
571 | bool dispc_wb_go_busy(void) | ||
572 | { | ||
573 | return REG_GET(DISPC_CONTROL2, 6, 6) == 1; | ||
574 | } | ||
575 | |||
576 | void dispc_wb_go(void) | ||
577 | { | ||
578 | enum omap_plane plane = OMAP_DSS_WB; | ||
579 | bool enable, go; | ||
580 | |||
581 | enable = REG_GET(DISPC_OVL_ATTRIBUTES(plane), 0, 0) == 1; | ||
582 | |||
583 | if (!enable) | ||
584 | return; | ||
585 | |||
586 | go = REG_GET(DISPC_CONTROL2, 6, 6) == 1; | ||
587 | if (go) { | ||
588 | DSSERR("GO bit not down for WB\n"); | ||
589 | return; | ||
590 | } | ||
591 | |||
592 | REG_FLD_MOD(DISPC_CONTROL2, 1, 6, 6); | ||
593 | } | ||
594 | |||
566 | static void dispc_ovl_write_firh_reg(enum omap_plane plane, int reg, u32 value) | 595 | static void dispc_ovl_write_firh_reg(enum omap_plane plane, int reg, u32 value) |
567 | { | 596 | { |
568 | dispc_write_reg(DISPC_OVL_FIR_COEF_H(plane, reg), value); | 597 | dispc_write_reg(DISPC_OVL_FIR_COEF_H(plane, reg), value); |
@@ -2692,6 +2721,47 @@ void dispc_mgr_enable(enum omap_channel channel, bool enable) | |||
2692 | BUG(); | 2721 | BUG(); |
2693 | } | 2722 | } |
2694 | 2723 | ||
2724 | void dispc_wb_enable(bool enable) | ||
2725 | { | ||
2726 | enum omap_plane plane = OMAP_DSS_WB; | ||
2727 | struct completion frame_done_completion; | ||
2728 | bool is_on; | ||
2729 | int r; | ||
2730 | u32 irq; | ||
2731 | |||
2732 | is_on = REG_GET(DISPC_OVL_ATTRIBUTES(plane), 0, 0); | ||
2733 | irq = DISPC_IRQ_FRAMEDONEWB; | ||
2734 | |||
2735 | if (!enable && is_on) { | ||
2736 | init_completion(&frame_done_completion); | ||
2737 | |||
2738 | r = omap_dispc_register_isr(dispc_disable_isr, | ||
2739 | &frame_done_completion, irq); | ||
2740 | if (r) | ||
2741 | DSSERR("failed to register FRAMEDONEWB isr\n"); | ||
2742 | } | ||
2743 | |||
2744 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), enable ? 1 : 0, 0, 0); | ||
2745 | |||
2746 | if (!enable && is_on) { | ||
2747 | if (!wait_for_completion_timeout(&frame_done_completion, | ||
2748 | msecs_to_jiffies(100))) | ||
2749 | DSSERR("timeout waiting for FRAMEDONEWB\n"); | ||
2750 | |||
2751 | r = omap_dispc_unregister_isr(dispc_disable_isr, | ||
2752 | &frame_done_completion, irq); | ||
2753 | if (r) | ||
2754 | DSSERR("failed to unregister FRAMEDONEWB isr\n"); | ||
2755 | } | ||
2756 | } | ||
2757 | |||
2758 | bool dispc_wb_is_enabled(void) | ||
2759 | { | ||
2760 | enum omap_plane plane = OMAP_DSS_WB; | ||
2761 | |||
2762 | return REG_GET(DISPC_OVL_ATTRIBUTES(plane), 0, 0); | ||
2763 | } | ||
2764 | |||
2695 | void dispc_lcd_enable_signal_polarity(bool act_high) | 2765 | void dispc_lcd_enable_signal_polarity(bool act_high) |
2696 | { | 2766 | { |
2697 | if (!dss_has_feature(FEAT_LCDENABLEPOL)) | 2767 | if (!dss_has_feature(FEAT_LCDENABLEPOL)) |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 8677f5157318..6728892f9dad 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -486,6 +486,11 @@ int dispc_mgr_get_clock_div(enum omap_channel channel, | |||
486 | void dispc_mgr_setup(enum omap_channel channel, | 486 | void dispc_mgr_setup(enum omap_channel channel, |
487 | struct omap_overlay_manager_info *info); | 487 | struct omap_overlay_manager_info *info); |
488 | 488 | ||
489 | u32 dispc_wb_get_framedone_irq(void); | ||
490 | bool dispc_wb_go_busy(void); | ||
491 | void dispc_wb_go(void); | ||
492 | void dispc_wb_enable(bool enable); | ||
493 | bool dispc_wb_is_enabled(void); | ||
489 | void dispc_wb_set_channel_in(enum dss_writeback_channel channel); | 494 | void dispc_wb_set_channel_in(enum dss_writeback_channel channel); |
490 | int dispc_wb_setup(const struct omap_dss_writeback_info *wi, | 495 | int dispc_wb_setup(const struct omap_dss_writeback_info *wi, |
491 | bool mem_to_mem, const struct omap_video_timings *timings); | 496 | bool mem_to_mem, const struct omap_video_timings *timings); |