static int mipi_jdi_panel_set_backlight(struct platform_device *pdev) { struct balong_fb_data_type *balongfd = NULL; u32 level = 0; /* Our eyes are more sensitive to small brightness. So we adjust the brightness of lcd following iphone4 */ char bl_level_adjust[2] = { 0x51, 0x00, }; struct dsi_cmd_desc jdi_bl_level_adjust[] = { {DTYPE_DCS_WRITE1, 0, 0, WAIT_TYPE_US, sizeof(bl_level_adjust), bl_level_adjust}, {DTYPE_DCS_WRITE1, 0, 0, WAIT_TYPE_US, sizeof(bl_enable), bl_enable}, }; BUG_ON(pdev == NULL); balongfd = (struct balong_fb_data_type *)platform_get_drvdata(pdev); BUG_ON(balongfd == NULL); level = balongfd->bl_level; if (level > 255) { level = 255; } //backlight may turn off when bl_level is below 6. if (level < 6 && level != 0) { level = 6; } bl_level_adjust[1] = level; mipi_dsi_cmds_tx(jdi_bl_level_adjust, ARRAY_SIZE(jdi_bl_level_adjust)); balongfb_logi_backlight_debugfs(" set backlight succ level = %d \n",level); if (unlikely(g_debug_enable)) { LOG_JANK_D(JLID_KERNEL_LCD_BACKLIGHT_ON, "JL_KERNEL_LCD_BACKLIGHT_ON,%u", level); g_debug_enable = false; } return 0; }
static int mipi_jdi_panel_off(struct platform_device *pdev) { struct balong_fb_data_type *balongfd = NULL; BUG_ON(pdev == NULL); pr_info("%s enter succ!\n",__func__); balongfd = (struct balong_fb_data_type *)platform_get_drvdata(pdev); BUG_ON(balongfd == NULL); if (g_display_on) { LOG_JANK_D(JLID_KERNEL_LCD_POWER_OFF, "%s", "JL_KERNEL_LCD_POWER_OFF"); g_display_on = false; /* lcd display off */ jdi_disp_off(balongfd); } cnt = 0; return 0; }
static int mipi_jdi_panel_on(struct platform_device *pdev) { struct balong_fb_data_type *balongfd = NULL; struct balong_panel_info *pinfo = NULL; BUG_ON(pdev == NULL); balongfd = (struct balong_fb_data_type *)platform_get_drvdata(pdev); BUG_ON(balongfd == NULL); pr_info("%s enter succ!\n",__func__); pinfo = &(balongfd->panel_info); pr_info("%s,pinfo->lcd_init_step = %d!\n",__func__,pinfo->lcd_init_step); if (pinfo->lcd_init_step == LCD_INIT_POWER_ON) { /* set vcc current and voltage */ //LCD_VCC_SET_CURRENT(pinfo->lcd_bl_vcc, 20000, 20000); /* bl_vcc must be 20mA */ LCD_VCC_SET_VOLTAGE(pinfo->lcd_bias_vcc, 5000000, 5000000); /* 5.0V */ LCD_VCC_SET_VOLTAGE(pinfo->lcd_vsn_vcc, 5000000, 5000000); /* 5.0V */ LCD_VCC_SET_VOLTAGE(pinfo->lcd_vsp_vcc, 5000000, 5000000); /* 5.0V */ pinfo->lcd_init_step = LCD_INIT_SEND_SEQUENCE; } else if (pinfo->lcd_init_step == LCD_INIT_SEND_SEQUENCE) { if (!g_display_on) { LOG_JANK_D(JLID_KERNEL_LCD_POWER_ON, "%s", "JL_KERNEL_LCD_POWER_ON"); g_debug_enable = true; /* lcd display on */ jdi_disp_on(balongfd); g_display_on = true; } } else { balongfb_loge("failed to init lcd!\n"); } pr_info("%s exit succ!\n",__func__); return 0; }
static int mipi_tm_panel_on(struct platform_device* pdev) { struct balong_fb_data_type* balongfd = NULL; struct balong_panel_info* pinfo = NULL; struct balong_fb_panel_data* pdata = NULL; #if defined (CONFIG_HUAWEI_DSM) u8* ade_base = NULL; u32 int_st0 = 0, int_st1 = 0; #endif BUG_ON(pdev == NULL); pr_info("%s enter succ!\n", __func__); balongfd = (struct balong_fb_data_type*)platform_get_drvdata(pdev); BUG_ON(balongfd == NULL); #if defined (CONFIG_HUAWEI_DSM) ade_base = balongfd->ade_base; #endif pinfo = &(balongfd->panel_info); pr_info("%s,pinfo->lcd_init_step = %d!\n", __func__, pinfo->lcd_init_step); if (pinfo->lcd_init_step == LCD_INIT_POWER_ON) { /* lcd set voltage */ vcc_cmds_tx(NULL, tm_lcd_vcc_set_cmds, \ ARRAY_SIZE(tm_lcd_vcc_set_cmds)); pinfo->lcd_init_step = LCD_INIT_SEND_SEQUENCE; } else if (pinfo->lcd_init_step == LCD_INIT_SEND_SEQUENCE) { if (!g_display_on) { LOG_JANK_D(JLID_KERNEL_LCD_POWER_ON, "%s", "JL_KERNEL_LCD_POWER_ON"); g_debug_enable = true; /* lcd pinctrl normal */ pinctrl_cmds_tx(pdev, tm_lcd_pinctrl_normal_cmds, \ ARRAY_SIZE(tm_lcd_pinctrl_normal_cmds)); /* lcd gpio request */ gpio_cmds_tx(NULL, tm_lcd_gpio_request_cmds, \ ARRAY_SIZE(tm_lcd_gpio_request_cmds)); /* lcd vcc enable */ if(1==is_vcc_disabled) { balongfb_logi("enable VSP and VSN \n"); vcc_cmds_tx(NULL, tm_lcd_vcc_enable_cmds, \ ARRAY_SIZE(tm_lcd_vcc_enable_cmds)); } else { /* lcd vcc does not enable vsp_vsn*/ balongfb_logi("VSP VSN does not power on for is_vcc_disabled = %d\n",is_vcc_disabled); } /* lcd gpio normal */ gpio_cmds_tx(NULL, tm_lcd_gpio_normal_cmds, \ ARRAY_SIZE(tm_lcd_gpio_normal_cmds)); /* lcd display on sequence */ mipi_dsi_cmds_tx(tm_display_on_cmds, \ ARRAY_SIZE(tm_display_on_cmds), balongfd->dsi_base); g_display_on = true; /*first set sbl to panel*/ if (balongfd->panel_info.sbl_enable) { pdata = (struct balong_fb_panel_data*)balongfd->pdev->dev.platform_data; if (pdata->set_sre != NULL) { pdata->set_sre(balongfd->pdev, balongfd->sbl_enable, balongfd->sbl_lsensor_value); } } } } else { balongfb_loge("failed to init lcd!\n"); } pr_info("%s exit succ!\n", __func__); #if defined (CONFIG_HUAWEI_DSM) int_st0 = inp32(ade_base + MIPIDSI_INT_ST0_ADDR); int_st1 = inp32(ade_base + MIPIDSI_INT_ST1_ADDR); if ((0x00 != int_st0 || 0x00 != int_st1) && (!dsm_client_ocuppy(lcd_dclient))) { dsm_client_record(lcd_dclient, "LCD dsi status. int_st0:0x%x,\ int_st1:0x%x.\n", int_st0, int_st1); dsm_client_notify(lcd_dclient, DSM_LCD_STATUS_ERROR_NO); }