From: Jian Cao Date: Fri, 31 May 2019 02:56:15 +0000 (+0800) Subject: osd: viu2_osd0 logo init [1/1] X-Git-Tag: khadas-vims-v0.9.6-release~322 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f2353590b73d5ab5530437c97b1a0b0b0ee942c;p=platform%2Fkernel%2Flinux-amlogic.git osd: viu2_osd0 logo init [1/1] PD#TV-5427 Problem: enable support for parsing VIU2 boot parameters Solution: add this support in driver Verify: verified on TL1-X301 Change-Id: I2b2dc97bc76a8816a2c1e17ce5689e2679867011 Signed-off-by: Jian Cao --- diff --git a/drivers/amlogic/media/osd/osd.h b/drivers/amlogic/media/osd/osd.h index b5fdc53..a7b6a7a 100644 --- a/drivers/amlogic/media/osd/osd.h +++ b/drivers/amlogic/media/osd/osd.h @@ -160,6 +160,12 @@ enum color_index_e { #define BYPASS_DIN (1 << 7) #define OSD_BACKUP_COUNT 24 +#define LOGO_DEV_OSD0 0x0 +#define LOGO_DEV_OSD1 0x1 +#define LOGO_DEV_VIU2_OSD0 0x3 +#define LOGO_DEBUG 0x1001 +#define LOGO_LOADED 0x1002 + enum osd_index_e { OSD1 = 0, OSD2, diff --git a/drivers/amlogic/media/osd/osd_fb.c b/drivers/amlogic/media/osd/osd_fb.c index 0943913..8900fe6 100644 --- a/drivers/amlogic/media/osd/osd_fb.c +++ b/drivers/amlogic/media/osd/osd_fb.c @@ -1507,13 +1507,14 @@ static int osd_open(struct fb_info *info, int arg) if ((osd_meson_dev.has_viu2) && (fb_index == osd_meson_dev.viu2_index)) { int vpu_clkc_rate; - - /* select mux0, if select mux1, mux0 must be set */ - clk_prepare_enable(osd_meson_dev.vpu_clkc); - clk_set_rate(osd_meson_dev.vpu_clkc, CUR_VPU_CLKC_CLK); - vpu_clkc_rate = clk_get_rate(osd_meson_dev.vpu_clkc); - osd_log_info("vpu clkc clock is %d MHZ\n", - vpu_clkc_rate/1000000); + if (osd_get_logo_index() != LOGO_DEV_VIU2_OSD0) { + /* select mux0, if select mux1, mux0 must be set */ + clk_prepare_enable(osd_meson_dev.vpu_clkc); + clk_set_rate(osd_meson_dev.vpu_clkc, CUR_VPU_CLKC_CLK); + vpu_clkc_rate = clk_get_rate(osd_meson_dev.vpu_clkc); + osd_log_info("vpu clkc clock is %d MHZ\n", + vpu_clkc_rate/1000000); + } osd_init_viu2(); } if (osd_meson_dev.osd_count <= fb_index) diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index a5e26b0..d92dd21 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -9453,78 +9453,71 @@ void osd_init_hw(u32 logo_loaded, u32 osd_probe, void osd_init_viu2(void) { u32 idx, data32; - struct vinfo_s *vinfo; - set_viu2_rgb2yuv(1); + idx = osd_hw.osd_meson_dev.viu2_index; + if (osd_get_logo_index() != LOGO_DEV_VIU2_OSD0) { + set_viu2_rgb2yuv(1); + osd_vpu_power_on_viu2(); - osd_vpu_power_on_viu2(); + /* here we will init default value, these value only set once */ + /* init vpu fifo control register */ + osd_reg_write(VPP2_OFIFO_SIZE, 0x7ff00800); + /* init osd fifo control register + * set DDR request priority to be urgent + */ - /* here we will init default value ,these value only set once . */ - /* init vpu fifo control register */ - osd_reg_write(VPP2_OFIFO_SIZE, 0x7ff00800); - /* init osd fifo control register - * set DDR request priority to be urgent - */ - data32 = 1; - vinfo = get_current_vinfo2(); + data32 = 0x1 << 0; + data32 |= OSD_GLOBAL_ALPHA_DEF << 12; + osd_reg_write( + hw_osd_reg_array[idx].osd_ctrl_stat, data32); - data32 |= VIU2_DEFAULT_HOLD_LINE << 5; /* hold_fifo_lines */ - /* burst_len_sel: 3=64, g12a = 5 */ - if (osd_hw.osd_meson_dev.osd_ver == OSD_HIGH_ONE) { - data32 |= 1 << 10; - data32 |= 1 << 31; - } else - data32 |= 3 << 10; - /* - * bit 23:22, fifo_ctrl - * 00 : for 1 word in 1 burst - * 01 : for 2 words in 1 burst - * 10 : for 4 words in 1 burst - * 11 : reserved - */ - data32 |= 2 << 22; - /* bit 28:24, fifo_lim */ - data32 |= 2 << 24; - /* data32_ = data32; */ - /* fifo_depth_val: 32 or 64 *8 = 256 or 512 */ - data32 |= (osd_hw.osd_meson_dev.osd_fifo_len - & 0xfffffff) << 12; - idx = osd_hw.osd_meson_dev.viu2_index; - osd_reg_write( - hw_osd_reg_array[idx].osd_fifo_ctrl_stat, data32); - /* osd_reg_write(VIU_OSD2_FIFO_CTRL_STAT, data32_); */ - /* just disable osd to avoid booting hang up */ - data32 = 0x1 << 0; - data32 |= OSD_GLOBAL_ALPHA_DEF << 12; - osd_reg_write( - hw_osd_reg_array[idx].osd_ctrl_stat, data32); - /* TODO: temp set at here, need move it to uboot */ - osd_reg_set_bits( - hw_osd_reg_array[idx].osd_fifo_ctrl_stat, - 1, 31, 1); - osd_reg_set_bits( - hw_osd_reg_array[idx].osd_fifo_ctrl_stat, - 1, 10, 2); - /* TODO: temp set at here, need check for logo */ - if (idx > 0) osd_reg_set_bits( - hw_osd_reg_array[idx].osd_ctrl_stat, - 0, 0, 1); + hw_osd_reg_array[idx].osd_fifo_ctrl_stat, + 1, 31, 1); + osd_reg_set_bits( + hw_osd_reg_array[idx].osd_fifo_ctrl_stat, + 1, 10, 2); + + data32 = 0; + data32 = osd_reg_read( + hw_osd_reg_array[idx].osd_ctrl_stat); + data32 |= 0x80000000; + osd_reg_write( + hw_osd_reg_array[idx].osd_ctrl_stat, data32); + + data32 = 1; + data32 |= VIU2_DEFAULT_HOLD_LINE << 5; /* hold_fifo_lines */ + /* burst_len_sel: 3=64, g12a = 5 */ + if (osd_hw.osd_meson_dev.osd_ver == OSD_HIGH_ONE) { + data32 |= 1 << 10; + data32 |= 1 << 31; + } else + data32 |= 3 << 10; + /* + * bit 23:22, fifo_ctrl + * 00 : for 1 word in 1 burst + * 01 : for 2 words in 1 burst + * 10 : for 4 words in 1 burst + * 11 : reserved + */ + data32 |= 2 << 22; + /* bit 28:24, fifo_lim */ + data32 |= 2 << 24; + /* data32_ = data32; */ + /* fifo_depth_val: 32 or 64 *8 = 256 or 512 */ + data32 |= (osd_hw.osd_meson_dev.osd_fifo_len + & 0xfffffff) << 12; + osd_reg_write( + hw_osd_reg_array[idx].osd_fifo_ctrl_stat, data32); + } + /* enable for latch */ osd_hw.osd_use_latch[idx] = 1; - data32 = 0; - data32 = osd_reg_read( - hw_osd_reg_array[idx].osd_ctrl_stat); - data32 |= 0x80000000; - osd_reg_write( - hw_osd_reg_array[idx].osd_ctrl_stat, data32); - /* init osd reverse */ osd_get_reverse_hw(idx, &data32); if (data32) osd_set_reverse_hw(idx, data32, 1); osd_hw.powered[idx] = 1; - } void osd_cursor_hw(u32 index, s16 x, s16 y, s16 xstart, s16 ystart, u32 osd_w, diff --git a/drivers/amlogic/media/osd/osd_logo.c b/drivers/amlogic/media/osd/osd_logo.c index c48d644..d00279e 100644 --- a/drivers/amlogic/media/osd/osd_logo.c +++ b/drivers/amlogic/media/osd/osd_logo.c @@ -30,16 +30,12 @@ /* Local Headers */ #include "osd_hw.h" #include "osd_log.h" +#include "osd.h" #undef pr_fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#define LOGO_DEV_OSD0 0x0 -#define LOGO_DEV_OSD1 0x1 -#define LOGO_DEBUG 0x1001 -#define LOGO_LOADED 0x1002 - static DEFINE_MUTEX(logo_lock); struct para_pair_s { @@ -51,6 +47,7 @@ struct para_pair_s { static struct para_pair_s logo_args[] = { {"osd0", LOGO_DEV_OSD0}, {"osd1", LOGO_DEV_OSD1}, + {"viu2_osd0", LOGO_DEV_VIU2_OSD0}, {"debug", LOGO_DEBUG}, {"loaded", LOGO_LOADED}, }; @@ -102,6 +99,9 @@ static int logo_info_init(char *para) case LOGO_DEV_OSD1: logo_info.index = LOGO_DEV_OSD1; break; + case LOGO_DEV_VIU2_OSD0: + logo_info.index = LOGO_DEV_VIU2_OSD0; + break; case LOGO_DEBUG: logo_info.debug = 1; break; @@ -138,7 +138,8 @@ static int __init logo_setup(char *str) return -EINVAL; do { - if (!isalpha(*ptr) && !isdigit(*ptr)) { + /* search for a delimiter */ + if (!isalpha(*ptr) && !isdigit(*ptr) && (*ptr != '_')) { find = 1; break; }