static void init_lcm_registers(void) { #if (!defined(BUILD_UBOOT) && !defined(BUILD_LK)) && defined(INIT_CODE_TUNNING_BY_SD_CARD) /* */ //sd_initial int line_cnt = 0; LCM_PRINT("[LCD] : [KERNEL] init_lcm_registers \n "); if (Filesize(LCD_INITIAL_TXT) > 0) { line_cnt= lcd_init_read_from_sd(); if (line_cnt > 0) { LCM_PRINT("[LCD] : SD card tunning & initial setting!!! \n "); push_table(lcm_initialization_setting_sd, sizeof(lcm_initialization_setting_sd) / sizeof(struct LCM_setting_table), 1); } else { LCM_PRINT("[LCD] : Default initial setting \n "); push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); } } else { LCM_PRINT("[LCD] : Default initial setting \n "); push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); } #else push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); LCM_PRINT("[LCD] init_lcm_registers \n"); #endif /* */ }
static void lcm_resume(void) { static int temp = 0x46; unsigned int data_array[16]; //zrl add for debug for Cut screen, 121015 push_table(lcm_truly_initialization_debug1, sizeof(lcm_truly_initialization_debug1) / sizeof(struct LCM_setting_table), 1); data_array[0]= 0x00023902; data_array[1]= 0x00|0x00|(temp<<8)|0xD9; dsi_set_cmdq(&data_array, 2, 1); push_table(lcm_truly_initialization_debug2, sizeof(lcm_truly_initialization_debug2) / sizeof(struct LCM_setting_table), 1); #if defined(BUILD_LK) printf("zrl lcm_resume,temp = 0x%x,data_array[1] = 0x%x\n",temp,data_array[1]); #else printk("zrl lcm_resume111,temp = 0x%x,data_array[1] = 0x%x\n",temp,data_array[1]); #endif //x1=temp%256; //x2=temp/256; temp+=2; }
//no use static unsigned int lcm_esd_recover(void) { unsigned char para = 0; unsigned int data_array1[16]; SET_RESET_PIN(1); MDELAY(10); SET_RESET_PIN(0); MDELAY(30); SET_RESET_PIN(1); MDELAY(130); #if 0 push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); MDELAY(10); push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); MDELAY(10); #else lcm_init(); #endif data_array1[0]= 0x00320500; dsi_set_cmdq(data_array1, 1, 1); MDELAY(50); return 1; }
static void lcm_setColorMode(long lmode) { //struct LCM_setting_table ce_start[] = {{0xFF,5,{0xFF,0x98,0x06,0x04,0x00}},}; struct LCM_setting_table ce_disable[] = {{0xFF, 5, {0xFF,0x98,0x06,0x04,0x00}},//page0 {0x55, 1, {0x00}}, {REGFLAG_DELAY, 10, {}}, {0xFF, 5, {0xFF,0x98,0x06,0x04,0x08}},//page8 // Setting ending by predefined flag {REGFLAG_END_OF_TABLE, 0x00, {}}, }; struct LCM_setting_table ce_high[] = {{0xFF, 5, {0xFF,0x98,0x06,0x04,0x00}}, {0x55, 1, {0xB0}}, {REGFLAG_DELAY, 10, {}}, {0xFF, 5, {0xFF,0x98,0x06,0x04,0x08}}, // Setting ending by predefined flag {REGFLAG_END_OF_TABLE, 0x00, {}}, }; //push_table(ce_start, sizeof(ce_start)/sizeof(struct LCM_setting_table), 1); switch (lmode) { case 0: push_table(ce_disable, sizeof(ce_disable)/sizeof(struct LCM_setting_table), 1); break; default: push_table(ce_high, sizeof(ce_high)/sizeof(struct LCM_setting_table), 1); break; } s_ucColorMode = (unsigned char)lmode; }
static void lcm_init(void) { int kk =0; #if defined(BUILD_LK) upmu_set_rg_vgp2_vosel(5); upmu_set_rg_vgp2_en(1); upmu_set_rg_vgp3_vosel(3); upmu_set_rg_vgp3_en(1); #else hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM"); hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM"); #endif MDELAY(100); SET_RESET_PIN(1); SET_RESET_PIN(0); MDELAY(10);//10 SET_RESET_PIN(1); MDELAY(50);//50 kk = lcm_check_id(); if(kk == 1) { push_table(lcm_initialization_setting_ykl, sizeof(lcm_initialization_setting_ykl) / sizeof(struct LCM_setting_table), 1); } else { push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); } }
static void lcm_suspend(void) { //zrl add for optimize the LCD begin,130723 //zrl add for optimize the LCD end,130723 push_table(lcm_deep_sleep_mode_in_setting, sizeof(lcm_deep_sleep_mode_in_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_resume_tm(void) { //enable VSP & VSN lcm_util.set_gpio_out(GPIO_LCD_BIAS_ENP_PIN, GPIO_OUT_ONE); mdelay(10); lcm_util.set_gpio_out(GPIO_LCD_BIAS_ENN_PIN, GPIO_OUT_ONE); msleep(50); //reset low to high lcm_util.set_gpio_out(GPIO_DISP_LRSTB_PIN, GPIO_OUT_ONE); mdelay(5); lcm_util.set_gpio_out(GPIO_DISP_LRSTB_PIN, GPIO_OUT_ZERO); mdelay(5); lcm_util.set_gpio_out(GPIO_DISP_LRSTB_PIN, GPIO_OUT_ONE); msleep(20); push_table(lcm_initialization_setting_tm, sizeof(lcm_initialization_setting_tm) / sizeof(struct LCM_setting_table), 1); //Back to MP.P7 baseline , solve LCD display abnormal On the right //when sleep out, config output high ,enable backlight drv chip lcm_util.set_gpio_out(GPIO_LCD_DRV_EN_PIN, GPIO_OUT_ONE); LCD_DEBUG("uboot:tm_nt35521_lcm_resume\n"); }
// in: linda_ud, key [, key]? // out: (key, val) or nothing int keepercall_receive( lua_State* L) { int top = lua_gettop( L); int i; push_table( L, 1); // ud keys fifos lua_replace( L, 1); // fifos keys for( i = 2; i <= top; ++ i) { keeper_fifo* fifo; lua_pushvalue( L, i); // fifos keys key[i] lua_rawget( L, 1); // fifos keys fifo fifo = prepare_fifo_access( L, -1); // fifos keys fifo if( fifo != NULL && fifo->count > 0) { fifo_pop( L, fifo, 1); // fifos keys val if( !lua_isnil( L, -1)) { lua_replace( L, 1); // val keys lua_settop( L, i); // val keys key[i] if( i != 2) { lua_replace( L, 2); // val key keys lua_settop( L, 2); // val key } lua_insert( L, 1); // key, val return 2; } } lua_settop( L, top); // data keys } // nothing to receive return 0; }
static unsigned int lcm_compare_id(void) { unsigned int id = 0; unsigned char buffer[5]; unsigned int array[16]; SET_RESET_PIN(1); //NOTE:should reset LCM firstly MDELAY(10); SET_RESET_PIN(0); MDELAY(50); SET_RESET_PIN(1); MDELAY(50); push_table(lcm_compare_id_setting, sizeof(lcm_compare_id_setting) / sizeof(struct LCM_setting_table), 1); array[0] = 0x00033700; dsi_set_cmdq(array, 1, 1); MDELAY(5); read_reg_v2(0xC5, buffer, 3); id = ((buffer[0] << 8) | buffer[1]); //we only need ID #if defined(BUILD_LK) printf (" [nt35512_auo445_ykl] %s, id = 0x%x,buffer[0] = 0x%x,buffer[1] = 0x%x buffer[2] = 0x%x\n", __func__, id, buffer[0], buffer[1], buffer[2]); #endif return (LCM_NT35512_HSD_HST_ID == id) ? 1 : 0; }
static void lcm_init(void) { #ifdef BUILD_LK printf("[LK/LCM] lcm_init() enter\n"); SET_RESET_PIN(1); MDELAY(10); SET_RESET_PIN(0); MDELAY(10); SET_RESET_PIN(1); MDELAY(10); // when phone initial , config output high, enable backlight drv chip push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); lcm_set_gpio_output(GPIO_LCD_BL_EN, GPIO_OUT_ONE); MDELAY(10); printf("[LK/LCM] lcm_init() end\n"); #else pr_debug("[Kernel/LCM] lcm_init() enter\n"); #endif }
static void lcm_init(void) { unsigned int data_array[64]; #if defined(BUILD_LK) upmu_set_rg_vgp2_vosel(5); upmu_set_rg_vgp2_en(1); upmu_set_rg_vgp3_vosel(3); upmu_set_rg_vgp3_en(1); #else hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM"); hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM"); #endif mt_set_gpio_mode(59,GPIO_MODE_00); mt_set_gpio_dir(59,GPIO_DIR_OUT); mt_set_gpio_out(59,GPIO_OUT_ONE); MDELAY(10);//Must > 10ms mt_set_gpio_out(59,GPIO_OUT_ZERO); MDELAY(10);//Must > 10ms mt_set_gpio_out(59,GPIO_OUT_ONE); MDELAY(120);//Must > 120m push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); }
// in: linda_ud key n // out: true or nil int keepercall_limit( lua_State* L) { keeper_fifo* fifo; int limit = (int) lua_tointeger( L, 3); push_table( L, 1); // ud key n fifos lua_replace( L, 1); // fifos key n lua_pop( L, 1); // fifos key lua_pushvalue( L, -1); // fifos key key lua_rawget( L, -3); // fifos key fifo|nil fifo = (keeper_fifo*) lua_touserdata( L, -1); if( fifo == NULL) { // fifos key nil lua_pop( L, 1); // fifos key fifo_new( L); // fifos key fifo fifo = (keeper_fifo*) lua_touserdata( L, -1); lua_rawset( L, -3); // fifos } // remove any clutter on the stack lua_settop( L, 0); // return true if we decide that blocked threads waiting to write on that key should be awakened // this is the case if we detect the key was full but it is no longer the case if( ((fifo->limit >= 0) && (fifo->count >= fifo->limit)) // the key was full if limited and count exceeded the previous limit && ((limit < 0) || (fifo->count < limit)) // the key is not full if unlimited or count is lower than the new limit ) { lua_pushboolean( L, 1); } // set the new limit fifo->limit = limit; // return 0 or 1 value return lua_gettop( L); }
static void lcm_resume(void) { //add by xia lei jie for LCD INIT //lcm_init(); push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_init(void) { // SET_RESET_PIN(0); // MDELAY(1); #ifdef BUILD_LK upmu_set_rg_vgp3_vosel(3); //3 means 1.8V upmu_set_rg_vgp3_en(1); #else if(TRUE != hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800,"lcdGP3")) { printk("%s, Fail to enable digital power\n", __func__); } #endif MDELAY(5); //need 1ms mt_set_gpio_mode(LCD_5V_LDO, GPIO_MODE_00); mt_set_gpio_dir(LCD_5V_LDO, GPIO_DIR_OUT); mt_set_gpio_out(LCD_5V_LDO, GPIO_OUT_ONE); MDELAY(10); //need 1ms SET_RESET_PIN(1); MDELAY(10); //need 10ms // init_lcm_registers(); push_table(lcm_initialization_setting); }
static void lcm_init(void) { #ifdef BUILD_LK upmu_set_rg_vgp2_vosel(5); upmu_set_rg_vgp2_en(1); MDELAY(50); upmu_set_rg_vgp3_vosel(3); upmu_set_rg_vgp3_en(1); #else hwPowerOn(MT6323_POWER_LDO_VGP2,VOL_2800,"LCM28"); hwPowerOn(MT6323_POWER_LDO_VGP3,VOL_1800,"LCM18"); #endif MDELAY(50); SET_RESET_PIN(1); SET_RESET_PIN(0); MDELAY(1); SET_RESET_PIN(1); MDELAY(10); push_table(lcm_initialization_setting1, sizeof(lcm_initialization_setting1) / sizeof(struct LCM_setting_table), 1); }
static unsigned int lcm_esd_recover() { lcm_init(); push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_resume(void) { //lcm_compare_id(); //lcm_init(); push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); int array[4]; char buffer[5]; char id_high=0; char id_low=0; int id=0; array[0] = 0x00053700;// read id return two byte,version and id dsi_set_cmdq(array, 1, 1); read_reg_v2(0xA1,buffer, 5); id_high = buffer[2]; //should be 0x80 Lcd_Log("%s, id_high = 0x%08x\n", __func__, id_high); id_low = buffer[3]; //should be 0x18 Lcd_Log("%s, id_low = 0x%08x\n", __func__, id_low); id = (id_high<<8)|id_low; //should be 0x8018 Lcd_Log("%s,wangdong id = 0x%08x\n", __func__, id); }
// in: linda_ud, key, ... // out: true|false int keepercall_send( lua_State* L) { keeper_fifo* fifo; int n = lua_gettop( L) - 2; push_table( L, 1); // ud key ... fifos // get the fifo associated to this key in this linda, create it if it doesn't exist lua_pushvalue( L, 2); // ud key ... fifos key lua_rawget( L, -2); // ud key ... fifos fifo if( lua_isnil( L, -1)) { lua_pop( L, 1); // ud key ... fifos fifo_new( L); // ud key ... fifos fifo lua_pushvalue( L, 2); // ud key ... fifos fifo key lua_pushvalue( L, -2); // ud key ... fifos fifo key fifo lua_rawset( L, -4); // ud key ... fifos fifo } lua_remove( L, -2); // ud key ... fifo fifo = (keeper_fifo*) lua_touserdata( L, -1); if( fifo->limit >= 0 && fifo->count + n > fifo->limit) { lua_settop( L, 0); // lua_pushboolean( L, 0); // false } else { fifo = prepare_fifo_access( L, -1); lua_replace( L, 2); // ud fifo ... fifo_push( L, fifo, n); // ud fifo lua_settop( L, 0); // lua_pushboolean( L, 1); // true } return 1; }
static void lcm_suspend(void) { push_table(lcm_deep_sleep_mode_in_setting, sizeof(lcm_deep_sleep_mode_in_setting) / sizeof(struct LCM_setting_table), 1); SET_RESET_PIN(0); MDELAY(1); SET_RESET_PIN(1); }
//in: linda_ud key mincount [maxcount] int keepercall_receive_batched( lua_State* L) { int const min_count = (int) lua_tointeger( L, 3); if( min_count > 0) { keeper_fifo* fifo; int const max_count = (int) luaL_optinteger( L, 4, min_count); lua_settop( L, 2); // ud key lua_insert( L, 1); // key ud push_table( L, 2); // key ud fifos lua_remove( L, 2); // key fifos lua_pushvalue( L, 1); // key fifos key lua_rawget( L, 2); // key fifos fifo lua_remove( L, 2); // key fifo fifo = prepare_fifo_access( L, 2); // key fifo if( fifo != NULL && fifo->count >= min_count) { fifo_pop( L, fifo, __min( max_count, fifo->count)); // key ... } else { lua_settop( L, 0); } return lua_gettop( L); } else { return 0; } }
static void lcm_init(void) { #if defined(BUILD_LK) upmu_set_rg_vgp2_vosel(5); upmu_set_rg_vgp2_en(1); upmu_set_rg_vgp3_vosel(3); upmu_set_rg_vgp3_en(1); #else hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM"); hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM"); #endif #ifdef BUILD_LK printf("MYCAT ILI9608 lk lcm_init\n"); #else printk("MYCAT ILI9608 kernel lcm_init\n"); #endif SET_RESET_PIN(1); MDELAY(10); SET_RESET_PIN(0); MDELAY(50); SET_RESET_PIN(1); MDELAY(180); push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); //init_lcm_registers(); }
static void lcm_init(void) { unsigned char buffer[5]; unsigned int array[16]; #ifdef BUILD_LK upmu_set_rg_vgp6_vosel(6); upmu_set_rg_vgp6_en(1); #else hwPowerOn(MT65XX_POWER_LDO_VGP6, VOL_3300, "LCM"); #endif #if 0 SET_RESET_PIN(1); MDELAY(1); SET_RESET_PIN(0); MDELAY(10); SET_RESET_PIN(1); MDELAY(60); #else mt_set_gpio_mode(GPIO_LCD_RST_EN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LCD_RST_EN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ONE); MDELAY(10); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ZERO); MDELAY(50); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ONE); MDELAY(120); #endif push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_setbacklight(unsigned int level) { // printk("gxf_lcm_setbacklight\n"); #if 1//gxf // Refresh value of backlight level. lcm_backlight_level_setting[0].para_list[0] = level; //push_table(lcm_backlight_level_setting, sizeof(lcm_backlight_level_setting) / sizeof(struct LCM_setting_table), 1); #else unsigned int default_level = 0;//145 lenovo-sw jixu modify to 0 20120213 unsigned int mapped_level = 0; //for LGE backlight IC mapping table if(level > 255) level = 255; if(level >0) mapped_level = default_level+(level)*(255-default_level)/(255); else mapped_level=0; // Refresh value of backlight level. lcm_backlight_level_setting[0].para_list[0] = mapped_level; push_table(lcm_backlight_level_setting, sizeof(lcm_backlight_level_setting) / sizeof(struct LCM_setting_table), 1); #endif }
static void lcm_init(void) { int flag=0; #if defined(BUILD_LK) upmu_set_rg_vgp2_vosel(5); upmu_set_rg_vgp2_en(1); upmu_set_rg_vgp3_vosel(3); upmu_set_rg_vgp3_en(1); #else hwPowerOn(MT6323_POWER_LDO_VGP2, VOL_2800, "Lance_LCM"); hwPowerOn(MT6323_POWER_LDO_VGP3, VOL_1800, "Lance_LCM"); #endif //MDELAY(100); SET_RESET_PIN(1); SET_RESET_PIN(0); MDELAY(1); SET_RESET_PIN(1); MDELAY(10); Lcd_Log("mycat otm8018b flag=%d \n",flag); push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_resume(void) { //zrl add for optimize the LCD begin,130723 //lcm_init(); //zrl add for optimize the LCD end,130723 push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); }
static unsigned int lcm_compare_id(void) { unsigned int id; unsigned char buffer[5]; unsigned int array[5]; #ifdef BUILD_LK upmu_set_rg_vgp6_vosel(6); upmu_set_rg_vgp6_en(1); #else hwPowerOn(MT65XX_POWER_LDO_VGP6, VOL_2800, "LCM"); #endif mt_set_gpio_mode(GPIO_LCD_RST_EN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_LCD_RST_EN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ONE); MDELAY(10); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ZERO); MDELAY(10); mt_set_gpio_out(GPIO_LCD_RST_EN, GPIO_OUT_ONE); MDELAY(100); push_table(lcm_compare_id_setting, sizeof(lcm_compare_id_setting) / sizeof(struct LCM_setting_table), 1); read_reg_v2(0xc5, buffer, 2); id = ((buffer[0] << 8) | buffer[1]); #if defined(BUILD_LK) printf ("%s, [rm68180_boe60_wcl] buffer[0] = [0x%d] buffer[2] = [0x%d] ID = [0x%d]\n", __func__, buffer[0], buffer[1], id); #endif return ((LCM_RM68180_ID == id)? 1 : 0); }
static void init_lcm_registers(void) { int id; push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_init(void) { #ifndef BUILD_LK printk("vgp3 on\n"); hwPowerOn(MT6325_POWER_LDO_VGP3, VOL_1800, "LCD"); #endif MDELAY(200); /*-----------------DSV start---------------------*/ mt_set_gpio_mode(GPIO_DW8768_ENP, GPIO_MODE_00); mt_set_gpio_dir(GPIO_DW8768_ENP, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_DW8768_ENP, GPIO_OUT_ONE); mt_set_gpio_mode(GPIO_DW8768_ENN, GPIO_MODE_00); mt_set_gpio_dir(GPIO_DW8768_ENN, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_DW8768_ENN, GPIO_OUT_ONE); MDELAY(20); /*-----------------DSV end---------------------*/ mt_set_gpio_out(GPIO_LCM_RST, GPIO_OUT_ONE); MDELAY(20); mt_set_gpio_out(GPIO_LCM_RST, GPIO_OUT_ZERO); MDELAY(2); mt_set_gpio_out(GPIO_LCM_RST, GPIO_OUT_ONE); MDELAY(20); push_table(lcm_initialization_setting, sizeof(lcm_initialization_setting) / sizeof(struct LCM_setting_table), 1); }
static void lcm_resume(void) { #ifndef BUILD_LK push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); #endif }
static void lcm_resume(void) { //lcm_compare_id(); lcm_init(); push_table(lcm_sleep_out_setting, sizeof(lcm_sleep_out_setting) / sizeof(struct LCM_setting_table), 1); }