From 6c56dc10226c84f41917ac2117b0e654fa080d40 Mon Sep 17 00:00:00 2001 From: Hardik Shah Date: Thu, 16 Apr 2009 19:00:11 +0530 Subject: [PATCH 36/69] DSS2: Added support for setting and querying alpha blending. Signed-off-by: Hardik Shah --- arch/arm/plat-omap/include/mach/display.h | 3 +++ drivers/video/omap2/dss/dispc.c | 26 ++++++++++++++++++++++++++ drivers/video/omap2/dss/dss.h | 2 ++ drivers/video/omap2/dss/manager.c | 14 ++++++++++++++ 4 files changed, 45 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/mach/display.h b/arch/arm/plat-omap/include/mach/display.h index 073cdda..e1f615a 100644 --- a/arch/arm/plat-omap/include/mach/display.h +++ b/arch/arm/plat-omap/include/mach/display.h @@ -415,11 +415,14 @@ struct omap_overlay_manager { void (*set_default_color)(struct omap_overlay_manager *mgr, u32 color); u32 (*get_default_color)(struct omap_overlay_manager *mgr); + bool (*get_alpha_blending_status)(struct omap_overlay_manager *mgr); void (*set_trans_key)(struct omap_overlay_manager *mgr, enum omap_dss_color_key_type type, u32 trans_key); void (*enable_trans_key)(struct omap_overlay_manager *mgr, bool enable); + void (*enable_alpha_blending)(struct omap_overlay_manager *mgr, + bool enable); }; enum omap_display_caps { diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index b631dd8..7e551c2 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -1847,6 +1847,32 @@ void dispc_enable_trans_key(enum omap_channel ch, bool enable) REG_FLD_MOD(DISPC_CONFIG, enable, 12, 12); enable_clocks(0); } +void dispc_enable_alpha_blending(enum omap_channel ch, bool enable) +{ + enable_clocks(1); + if (ch == OMAP_DSS_CHANNEL_LCD) + REG_FLD_MOD(DISPC_CONFIG, enable, 18, 18); + else /* OMAP_DSS_CHANNEL_DIGIT */ + REG_FLD_MOD(DISPC_CONFIG, enable, 19, 19); + enable_clocks(0); +} +bool dispc_alpha_blending_enabled(enum omap_channel ch) +{ + bool enabled; + + enable_clocks(1); + if (ch == OMAP_DSS_CHANNEL_LCD) + enabled = REG_GET(DISPC_CONFIG, 18, 18); + else if (ch == OMAP_DSS_CHANNEL_DIGIT) + enabled = REG_GET(DISPC_CONFIG, 18, 18); + else + BUG(); + enable_clocks(0); + + return enabled; + +} + bool dispc_trans_key_enabled(enum omap_channel ch) { diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 584dce6..1d01ff6 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -294,7 +294,9 @@ void dispc_get_trans_key(enum omap_channel ch, enum omap_dss_color_key_type *type, u32 *trans_key); void dispc_enable_trans_key(enum omap_channel ch, bool enable); +void dispc_enable_alpha_blending(enum omap_channel ch, bool enable); bool dispc_trans_key_enabled(enum omap_channel ch); +bool dispc_alpha_blending_enabled(enum omap_channel ch); void dispc_set_lcd_timings(struct omap_video_timings *timings); unsigned long dispc_fclk_rate(void); diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 12cf7b0..90acd28 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c @@ -468,6 +468,16 @@ static void omap_dss_mgr_enable_trans_key(struct omap_overlay_manager *mgr, { dispc_enable_trans_key(mgr->id, enable); } +static void omap_dss_mgr_enable_alpha_blending(struct omap_overlay_manager *mgr, + bool enable) +{ + dispc_enable_alpha_blending(mgr->id, enable); +} +static bool omap_dss_mgr_get_alpha_blending_status( + struct omap_overlay_manager *mgr) +{ + return dispc_alpha_blending_enabled(mgr->id); +} static u32 omap_dss_mgr_get_default_color(struct omap_overlay_manager *mgr) { return dispc_get_default_color(mgr->id); @@ -514,6 +524,10 @@ int dss_init_overlay_managers(struct platform_device *pdev) mgr->set_default_color = &omap_dss_mgr_set_def_color, mgr->set_trans_key = &omap_dss_mgr_set_trans_key, mgr->enable_trans_key = &omap_dss_mgr_enable_trans_key, + mgr->enable_alpha_blending = + &omap_dss_mgr_enable_alpha_blending; + mgr->get_alpha_blending_status = + omap_dss_mgr_get_alpha_blending_status; mgr->get_default_color = &omap_dss_mgr_get_default_color; mgr->caps = OMAP_DSS_OVL_MGR_CAP_DISPC, -- 1.6.2.4