diff options
-rwxr-xr-x | board/lge/sniper/logo.S | 9 | ||||
-rw-r--r-- | board/lge/sniper/peace.rle | bin | 0 -> 18756 bytes | |||
-rw-r--r-- | board/lge/sniper/sniper.c | 83 | ||||
-rw-r--r-- | include/configs/sniper.h | 2 |
4 files changed, 52 insertions, 42 deletions
diff --git a/board/lge/sniper/logo.S b/board/lge/sniper/logo.S index 22a0748caad..aff071d7c71 100755 --- a/board/lge/sniper/logo.S +++ b/board/lge/sniper/logo.S @@ -1,11 +1,8 @@ .data .align 4 .globl lg_boot_logo - .globl battery_charging_0 - .globl web_download + .globl peace 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" +peace: + .incbin "/home/paulk/projets/replicant/p970/u-boot/board/lge/sniper/peace.rle" diff --git a/board/lge/sniper/peace.rle b/board/lge/sniper/peace.rle Binary files differnew file mode 100644 index 00000000000..e460e2f6beb --- /dev/null +++ b/board/lge/sniper/peace.rle diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index a3e42fcf22d..e0102d134f6 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -270,6 +270,7 @@ void hub_load_rle565_image(unsigned char* src, unsigned int* dest, int len) extern unsigned int lg_boot_logo[]; +extern unsigned int peace[]; #define CONFIG_FB_ADDRESS 0x9FA00000 struct led_ctrl_data { @@ -369,14 +370,6 @@ void video_init(void) 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 */ @@ -401,12 +394,19 @@ void video_init(void) configure_dispc(); dispc_configure_image(NULL); // use fbaddress - hub_load_rle565_image(lg_boot_logo, CONFIG_FB_ADDRESS, 480*800); + hub_load_rle565_image(peace, CONFIG_FB_ADDRESS, 480*800); dispc_enable_lcd_out(1); dsi_update_screen_dispc(0,0,480,800); printf("VIDEO INIT END\n"); + 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); } @@ -423,41 +423,54 @@ int misc_init_r(void) #endif u8 val; + int rev; - val = twl4030_i2c_write_u8(TWL4030_CHIP_INTBR, + /* Turn on MADC clocks */ twl4030_i2c_read_u8(TWL4030_CHIP_INTBR, TWL4030_BASEADD_INTBR + 0x0c, &val); val |= 0x80 | 0x10; twl4030_i2c_write_u8(TWL4030_CHIP_INTBR, TWL4030_BASEADD_INTBR + 0x0c, val); - // turn adc on + /* Turn MADC on */ twl4030_i2c_write_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC, 0x01); + /* Channel 9 SW1 trigger */ + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x07, &val); + val |= 0x02; + twl4030_i2c_write_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x07, val); -#if 0 - /* turning adc_on */ - ret = twl4030_i2c_write_u8(TWL4030_CHIP_MADC, MADC_ON, - REG_CTRL1); - if (ret) - return ret; + /* Channel 5 SW1 trigger */ + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x06, &val); + val |= 0x20; + twl4030_i2c_write_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x06, val); -#define REG_SW1SELECT_MSB 0x07 - - /* setting MDC channel 9 to trigger by SW1 */ - ret = clear_n_set(TWL4030_CHIP_MADC, 0, SW1_CH9_SEL, - REG_SW1SELECT_MSB); - -/* LGE_CHANGE_S [skykrkrk@lge.com] 2009-11-12, for PCB Version ADC */ -#ifdef CONFIG_SNIPER -#define SW1_CH5_SEL 0x20 -#define REG_SW1SELECT_LSB 0x06 - ret = clear_n_set(TWL4030_CHIP_MADC, 0, SW1_CH5_SEL, REG_SW1SELECT_LSB); -#endif /* CONFIG_SNIPER */ -/* LGE_CHANGE_E [skykrkrk@lge.com] 2009-11-12, for PCB Version ADC */ -/* LGE_CHANGE_S [taehwan.kim@lge.com] 2010-05-01, for Battery detect */ -#define SW1_CH2_SEL 0x04 - ret = clear_n_set(TWL4030_CHIP_MADC, 0, SW1_CH2_SEL, REG_SW1SELECT_LSB); -/* LGE_CHANGE_E [taehwan.kim@lge.com] 2010-05-01, for Battery detect */ -#endif + /* Channel 2 SW1 trigger */ + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x06, &val); + val |= 0x04; + twl4030_i2c_write_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x06, val); + + /* SW1 trigger */ + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x12, &val); + val |= 0x20; + twl4030_i2c_write_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x12, val); + + printf("About to convert!\n"); + + // FIXME: timeout + do { + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x12, &val); + printf("val is 0x%x\n", val); + } while ((val & 0x02 == 0) || (val & 0x01)); + + /* Read da result on chan 5*/ + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x37 + 5 * 2 + 1, &val); + + rev = ((int) val) << 2; + + twl4030_i2c_read_u8(TWL4030_CHIP_MADC, TWL4030_BASEADD_MADC + 0x37 + 5 * 2, &val); + + rev |= ((int) (val & 0xC0)) >> 6; + + printf("So apparently, rev is like %d\n", rev); /* for dss, look at LCD_RESET_N: diff --git a/include/configs/sniper.h b/include/configs/sniper.h index a98d08027b0..ff0dcb657e8 100644 --- a/include/configs/sniper.h +++ b/include/configs/sniper.h @@ -255,7 +255,7 @@ #define CONFIG_ENV_IS_NOWHERE #define CONFIG_EXTRA_ENV_SETTINGS \ - "bootargs=mem=511M init=/init videoout=omap24xxvout omap_vout_mod.video1_numbuffers=6 omap_vout_mod.vid1_static_vrfb_alloc=y vram=5M,0x9FA00000 omapfb.vram=0:5M lpj=2334720 fuelgauge=g muic_state=0 console=/dev/null" + "bootargs=mem=511M init=/init videoout=omap24xxvout omap_vout_mod.video1_numbuffers=6 omap_vout_mod.vid1_static_vrfb_alloc=y vram=5M,0x9FA00000 omapfb.vram=0:5M lpj=2334720 fuelgauge=g muic_state=0 console=ttyO2" /* * Boot command |