From 92828fe7f7de3bee617f9ca1fa5a611eb753555c Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Thu, 22 Jan 2015 23:21:15 +0100 Subject: WIP: DSI display working on logo --- board/lge/sniper/Makefile | 2 +- board/lge/sniper/battery_charging_480x800.rle | Bin 0 -> 145072 bytes board/lge/sniper/hub_dispc.c | 1 - board/lge/sniper/hub_dpi.c | 10 ++- board/lge/sniper/hub_dsi.c | 27 +++++-- board/lge/sniper/hub_dss.h | 6 +- board/lge/sniper/logo.S | 11 +++ board/lge/sniper/logo_480x800.rle | Bin 0 -> 22256 bytes board/lge/sniper/logo_480x800_gradation.rle | Bin 0 -> 14572 bytes board/lge/sniper/logo_480x800_new.rle | Bin 0 -> 22256 bytes board/lge/sniper/logo_480x800_white.rle | Bin 0 -> 5736 bytes board/lge/sniper/panel-hub.c | 14 +++- board/lge/sniper/sniper.c | 109 +++++++++++++++++++++++++- board/lge/sniper/webdownloadlogo.rle | Bin 0 -> 57136 bytes include/configs/sniper.h | 8 +- 15 files changed, 170 insertions(+), 18 deletions(-) create mode 100755 board/lge/sniper/battery_charging_480x800.rle create mode 100755 board/lge/sniper/logo.S create mode 100755 board/lge/sniper/logo_480x800.rle create mode 100755 board/lge/sniper/logo_480x800_gradation.rle create mode 100755 board/lge/sniper/logo_480x800_new.rle create mode 100755 board/lge/sniper/logo_480x800_white.rle create mode 100755 board/lge/sniper/webdownloadlogo.rle diff --git a/board/lge/sniper/Makefile b/board/lge/sniper/Makefile index 88f0a45f09b..d2952c0a281 100644 --- a/board/lge/sniper/Makefile +++ b/board/lge/sniper/Makefile @@ -5,4 +5,4 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y := sniper.o hub_dispc.o hub_dpi.o hub_dsi.o panel-hub.o +obj-y := sniper.o hub_dispc.o hub_dpi.o hub_dsi.o panel-hub.o logo.o diff --git a/board/lge/sniper/battery_charging_480x800.rle b/board/lge/sniper/battery_charging_480x800.rle new file mode 100755 index 00000000000..7087a5b19fb Binary files /dev/null and b/board/lge/sniper/battery_charging_480x800.rle differ diff --git a/board/lge/sniper/hub_dispc.c b/board/lge/sniper/hub_dispc.c index 158a9d93474..23e645ee145 100755 --- a/board/lge/sniper/hub_dispc.c +++ b/board/lge/sniper/hub_dispc.c @@ -14,7 +14,6 @@ */ #include -#include #include #include #include diff --git a/board/lge/sniper/hub_dpi.c b/board/lge/sniper/hub_dpi.c index 40f7b689516..ad7c75db648 100755 --- a/board/lge/sniper/hub_dpi.c +++ b/board/lge/sniper/hub_dpi.c @@ -13,11 +13,11 @@ * */ #include -#include #include #include #include #include +#include #include "hub_dss.h" @@ -164,9 +164,13 @@ int dss_clk_enable(bool enable) #define FCK_DSS_ON 0x00000007 /* tv+dss1+dss2 */ #define ICK_DSS_ON 0x00000001 +#define CM_FCLKEN_DSS 0x48004e00 +#define CM_ICLKEN_DSS 0x48004e10 + if(enable) { - sr32(CM_FCLKEN_DSS, 0, 32, FCK_DSS_ON); - sr32(CM_ICLKEN_DSS, 0, 32, ICK_DSS_ON); + out_le32(CM_FCLKEN_DSS, FCK_DSS_ON); + out_le32(CM_ICLKEN_DSS, ICK_DSS_ON); + } else { //sr32(CM_FCLKEN_DSS, 0, 32, 0x0); diff --git a/board/lge/sniper/hub_dsi.c b/board/lge/sniper/hub_dsi.c index 9b8b3774a73..0ed2781899f 100755 --- a/board/lge/sniper/hub_dsi.c +++ b/board/lge/sniper/hub_dsi.c @@ -14,7 +14,6 @@ */ #include -#include #include #include #include @@ -567,6 +566,8 @@ static inline void dsi_enable_pll_clock(bool enable) if (enable && dsi.pll_locked) { if (wait_for_bit_change(DSI_PLL_STATUS, 1, 1) != 1) printf("cannot lock PLL when enabling clocks\n"); + else + printf("PLL LOCKED at %s\n", __func__); } } @@ -1135,13 +1136,15 @@ int dsi_pll_set_clock_div(struct dsi_clock_info *cinfo) REG_FLD_MOD(DSI_PLL_GO, 1, 0, 0); /* DSI_PLL_GO */ if (wait_for_bit_change(DSI_PLL_GO, 0, 0) != 0) { - //printf("dsi pll go bit not going down.\n"); + printf("dsi pll go bit not going down.\n"); r = -EIO; goto err; } + mdelay(50); + if (wait_for_bit_change(DSI_PLL_STATUS, 1, 1) != 1) { - //printf("cannot lock PLL\n"); + printf("cannot lock PLL\n"); r = -EIO; goto err; } @@ -1179,7 +1182,7 @@ int dsi_pll_init(bool enable_hsclk, bool enable_hsdiv) enum dsi_pll_power_state pwstate; struct dispc_clock_info cinfo; - //printf("PLL init\n"); + printf("PLL init\n"); enable_clocks(1); dsi_enable_pll_clock(1); @@ -2874,7 +2877,7 @@ static int dsi_configure_dsi_clocks(void) { struct dsi_clock_info cinfo; int r; - //printf("dsi_configure_dsi_clocks\n"); + printf("dsi_configure_dsi_clocks\n"); /* we always use DSS2_FCK as input clock */ cinfo.use_dss2_fck = 1; @@ -2883,12 +2886,13 @@ static int dsi_configure_dsi_clocks(void) cinfo.regm3 = DSI_DIV_REGM3; cinfo.regm4 = DSI_DIV_REGM4; r = dsi_calc_clock_rates(&cinfo); - if (r) + if (r) { + printf("failed to calc clock rates\n"); return r; - + } r = dsi_pll_set_clock_div(&cinfo); if (r) { - //printf("Failed to set dsi clocks\n"); + printf("Failed to set dsi clocks\n"); return r; } @@ -3008,19 +3012,24 @@ static int dsi_display_enable(void) int r = 0; //printf("dsi_display_enabled\n"); + printf("%s: enable clocks\n", __func__); enable_clocks(1); dsi_enable_pll_clock(1); + printf("%s: DSI reset\n", __func__); r = _dsi_reset(); if (r) goto err2; + printf("%s: DSI core init\n", __func__); dsi_core_init(); + printf("%s: DSI display init dispc\n", __func__); r = dsi_display_init_dispc(); if (r) goto err2; + printf("%s: DSI display init DSI\n", __func__); r = dsi_display_init_dsi(); if (r) goto err3; @@ -3028,6 +3037,8 @@ static int dsi_display_enable(void) dsi.user_update_mode = OMAP_DSS_UPDATE_MANUAL; dsi.te_enabled = 0; + + printf("%s: trigger TE %d/%d\n", __func__, dsi.te_enabled, dsi_ext_te); dsi_set_te(dsi.te_enabled); dsi.use_ext_te = dsi_ext_te; diff --git a/board/lge/sniper/hub_dss.h b/board/lge/sniper/hub_dss.h index fe36dc5a940..3d5408cfd2d 100755 --- a/board/lge/sniper/hub_dss.h +++ b/board/lge/sniper/hub_dss.h @@ -16,9 +16,12 @@ #ifndef __OMAP2_DSS_H #define __OMAP2_DSS_H -typedef _Bool bool; extern void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value); +#define CONFIG_SNIPER +#define CONFIG_FB_ADDRESS 0x9FA00000 +#define SZ_1K 0x00000400 + //display.h #define DISPC_IRQ_FRAMEDONE (1 << 0) #define DISPC_IRQ_VSYNC (1 << 1) @@ -320,6 +323,7 @@ struct overlay_cache_data { }; extern unsigned int lg_boot_logo[]; + static struct overlay_cache_data hub_overlay = { .paddr = lg_boot_logo, .screen_width = 480, diff --git a/board/lge/sniper/logo.S b/board/lge/sniper/logo.S new file mode 100755 index 00000000000..22a0748caad --- /dev/null +++ b/board/lge/sniper/logo.S @@ -0,0 +1,11 @@ + .data + .align 4 + .globl lg_boot_logo + .globl battery_charging_0 + .globl web_download +lg_boot_logo: + .incbin "/home/paulk/projets/replicant/p970/u-boot/board/lge/sniper/logo_480x800.rle" +battery_charging_0: + .incbin "/home/paulk/projets/replicant/p970/u-boot/board/lge/sniper/battery_charging_480x800.rle" +web_download: + .incbin "/home/paulk/projets/replicant/p970/u-boot/board/lge/sniper/webdownloadlogo.rle" diff --git a/board/lge/sniper/logo_480x800.rle b/board/lge/sniper/logo_480x800.rle new file mode 100755 index 00000000000..9ddefd71760 Binary files /dev/null and b/board/lge/sniper/logo_480x800.rle differ diff --git a/board/lge/sniper/logo_480x800_gradation.rle b/board/lge/sniper/logo_480x800_gradation.rle new file mode 100755 index 00000000000..1ef9117af6d Binary files /dev/null and b/board/lge/sniper/logo_480x800_gradation.rle differ diff --git a/board/lge/sniper/logo_480x800_new.rle b/board/lge/sniper/logo_480x800_new.rle new file mode 100755 index 00000000000..9ddefd71760 Binary files /dev/null and b/board/lge/sniper/logo_480x800_new.rle differ diff --git a/board/lge/sniper/logo_480x800_white.rle b/board/lge/sniper/logo_480x800_white.rle new file mode 100755 index 00000000000..989f84be4aa Binary files /dev/null and b/board/lge/sniper/logo_480x800_white.rle differ diff --git a/board/lge/sniper/panel-hub.c b/board/lge/sniper/panel-hub.c index 5b3e0ad08bb..be22f5c2412 100755 --- a/board/lge/sniper/panel-hub.c +++ b/board/lge/sniper/panel-hub.c @@ -13,7 +13,6 @@ * */ #include -#include #include #include #include @@ -483,6 +482,7 @@ void hub_panel_reset_lcd(void) extern void aat2862_ldo_enabled(int enable); +/* omap_set_gpio_direction(HUB_PANEL_LCD_RESET_N, 0); mdelay(2); omap_set_gpio_dataout(HUB_PANEL_LCD_RESET_N, 0); @@ -490,6 +490,7 @@ void hub_panel_reset_lcd(void) mdelay(50); omap_set_gpio_dataout(HUB_PANEL_LCD_RESET_N, 1); mdelay(10); +*/ return; @@ -539,6 +540,16 @@ int hub_panel_enable(void) int hub_panel_init_lcd(void) { u32 val; + + hub_panel_enable(); + + if (!lcd_present()) { + printf("LCD is NOT present at this point\n"); + } else { + printf("LCD IS present at this point\n"); + } + +/* val = *((volatile unsigned int *)0x48005000) | (1<<13); *((volatile unsigned int *)0x48005000) = val; val = *((volatile unsigned int *)0x48005010) | (1<<13); @@ -549,6 +560,7 @@ int hub_panel_init_lcd(void) hub_panel_enable(); if (!lcd_present()) hub_add_bootargs(" nolcd"); +*/ // u8 mode; diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index 32cabd292c9..b4200861eb4 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -182,6 +182,10 @@ static struct panel_config lcd_cfg = { #if defined(CONFIG_VIDEO) && !defined(CONFIG_SPL_BUILD) int board_video_init(void) { + + dispc_init(); + dsi_init(); + printf("Trying to contact AAT2870\n"); gpio_request(SNIPER_GPIO_LCD_CP_EN, "aat2870_en"); @@ -221,13 +225,15 @@ int board_video_init(void) //SNIPER_GPIO_LCD_RESET_N - lcd_cfg.frame_buffer = (void *)0x880000000; +// lcd_cfg.frame_buffer = (void *)0x880000000; // CONFIG_VIDEO_OMAP3 + +/* omap3_dss_panel_config(&lcd_cfg); omap3_dss_enable(); printf("DSS enable over\n"); - +*/ printf("AAT2862 backlight enable\n"); i2c_set_bus_num(1); @@ -238,10 +244,53 @@ int board_video_init(void) aat2862_write_reg(0x06,0x74); /* LED main group, LED enabled, 30 */ i2c_set_bus_num(0); + + + hub_panel_init_lcd(); + dsi_init(); //20100906 kyungtae.oh@lge.com for Factory test at LCD off + dsi_display_update(0, 0, 480, 800); // PAULK: that's totally useless + configure_dispc(); + dispc_configure_image(NULL); + + hub_load_rle565_image(lg_boot_logo, CONFIG_FB_ADDRESS, 480*800); + + dispc_enable_lcd_out(1); + dsi_update_screen_dispc(0,0,480,800); + return 0; } #endif + +void hub_load_rle565_image(unsigned char* src, unsigned int* dest, int len) +{ + unsigned short* src_ptr = (unsigned short*)src; + unsigned int* dest_ptr = dest; + unsigned short size; + unsigned short value; + int length = len; + unsigned char red, green, blue; + + while (length > 0) { + size = *src_ptr; + src_ptr++; + value = *src_ptr; + src_ptr++; + while(size--) { + red = ((value >> 11) & 0xFF) << 3; + green = ((value >> 5) & 0xFF) << 2; + blue = (value & 0xFF) << 3; + *dest_ptr = (0xFF << 24) | (red << 16) | (green << 8) | blue; + dest_ptr++; + length --; + } + } +} + + +extern unsigned int lg_boot_logo[]; +#define CONFIG_FB_ADDRESS 0x9FA00000 + /* * Routine: misc_init_r * Description: Configure board specific parts @@ -266,6 +315,62 @@ int misc_init_r(void) mdelay(10); */ + printf("VIDEO INIT BEGIN\n"); + + /* VIDEO INIT HERE */ + + + printf("AAT2862 backlight enable\n"); + + gpio_request(SNIPER_GPIO_LCD_CP_EN, "aat2870_en"); + gpio_direction_output(SNIPER_GPIO_LCD_CP_EN, 0); + gpio_set_value(SNIPER_GPIO_LCD_CP_EN, 1); + + gpio_request(SNIPER_GPIO_LCD_CS, "lcd_cs"); + gpio_direction_output(SNIPER_GPIO_LCD_CS, 0); + + gpio_request(SNIPER_GPIO_LCD_RESET_N, "lcd_reset_n"); + gpio_direction_output(SNIPER_GPIO_LCD_RESET_N, 0); + + i2c_set_bus_num(1); + aat2862_write_reg(0x0,0xff); /* LCD channel enable */ + aat2862_write_reg(0x03,0xF4); /* LED main group, LED enabled, 22.26 */ + aat2862_write_reg(0x04,0x74); /* LED main group, LED enabled, 22.26 */ + aat2862_write_reg(0x05,0x74); /* LED main group, LED enabled, 30 */ + aat2862_write_reg(0x06,0x74); /* LED main group, LED enabled, 30 */ + i2c_set_bus_num(0); + + i2c_set_bus_num(1); + aat2862_write_reg(LDO_AB_LEVEL_REG,0x4A); /* LDOA 1.8V_LCD_IOVCC (1010), LDOB 3.0V_LCD_VCC_VCI (1100) */ + aat2862_write_reg(LDO_CD_LEVEL_REG,0x4C); /* LDOC 1.8V_TOUCH_VDD (0100), LDOD 3.0V_TOUCH_VCPIN (1100) */ + aat2862_write_reg(LDO_ABCD_EN_REG,0x3); /* LDO A & B ON */ + i2c_set_bus_num(0); + + dispc_init(); + dsi_init(); + + printf("LCD reset\n"); + + gpio_set_value(SNIPER_GPIO_LCD_CS, 1); + + gpio_set_value(SNIPER_GPIO_LCD_RESET_N, 0); + mdelay(50); + gpio_set_value(SNIPER_GPIO_LCD_RESET_N, 1); + mdelay(10); + + hub_panel_init_lcd(); + + dsi_init(); //20100906 kyungtae.oh@lge.com for Factory test at LCD off + dsi_display_update(0, 0, 480, 800); // PAULK: that's totally useless + + configure_dispc(); + dispc_configure_image(NULL); + hub_load_rle565_image(lg_boot_logo, CONFIG_FB_ADDRESS, 480*800); + dispc_enable_lcd_out(1); + dsi_update_screen_dispc(0,0,480,800); + + printf("VIDEO INIT END\n"); + return 0; } diff --git a/board/lge/sniper/webdownloadlogo.rle b/board/lge/sniper/webdownloadlogo.rle new file mode 100755 index 00000000000..99fe00570ad Binary files /dev/null and b/board/lge/sniper/webdownloadlogo.rle differ diff --git a/include/configs/sniper.h b/include/configs/sniper.h index 7a0f94773ad..f5f1649988a 100644 --- a/include/configs/sniper.h +++ b/include/configs/sniper.h @@ -188,11 +188,13 @@ * Video */ +/* #define CONFIG_VIDEO #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE #define CONFIG_VIDEO_OMAP3 #define CONFIG_VIDEO_LOGO +*/ /* * USB @@ -256,10 +258,14 @@ */ #define CONFIG_BOOTCOMMAND \ + "i2c dev 1; i2c md 0x44 0x00 0x10; i2c mw 0x44 0x03 0x00; i2c md 0x44 0x00 0x10; i2c dev 0;" \ + "load mmc 0 0x82000000 recovery.img;" \ + "bootm 0x82000000;" +/* "i2c dev 1; i2c md 0x44 0x00 0x10; i2c mw 0x44 0x03 0x00; i2c md 0x44 0x00 0x10; i2c dev 0; fastboot;" \ "load mmc 0 0x82000000 recovery.img;" \ "bootm 0x82000000;" - +*/ /* * Boot */ -- cgit v1.2.3