int mipi_set_bl(int level) { int ret; /* modify by zhaiqingbo 2013.1.21, for LCD backligh */ #if 0 static int dsi_lcd_bl_initialized=0; if (unlikely(!dsi_lcd_bl_initialized)) { pmapp_disp_backlight_init(); dsi_lcd_bl_initialized = 1; } ret = pmapp_disp_backlight_set_brightness(level); if (ret) pr_err("%s: can't set lcd backlight!\n", __func__); #endif ret = gpio_tlmm_config(GPIO_CFG(GPIO_LCD_BL_PWM, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE); gpio_set_value(GPIO_LCD_BL_PWM, level?1:0); /* modify end by zhaiqingbo */ return ret; }
static int mipi_sharp_qhd_set_bl(int level) { int ret; ret = pmapp_disp_backlight_set_brightness(level); if (ret) pr_err("%s: can't set lcd backlight!\n", __func__); return ret; }
static int skue_backlight_control(int level, int mode) { int ret = 0; ret = pmapp_disp_backlight_set_brightness(level); if (ret) pr_err("%s: can't set lcd backlight!\n", __func__); return ret; }
static void hx8357_backlight_set(int level) { int ret = 0; if(unlikely(!hx8357_state.bk_init)){ pmapp_disp_backlight_init(); hx8357_state.bk_init = TRUE; } ret = pmapp_disp_backlight_set_brightness(level*230/255); if (ret) printk(KERN_INFO"can't set backlight level=%d\n",level); }
void glanceview_oneled_state_ctrl(bool flag) { int ret = 0; if(flag){ ret = pmapp_disp_backlight_set_brightness(0); if (ret) printk(KERN_ERR"[GLANCEVIEW]%s()can't set backlight level=0\n", __func__); gpio_direction_output(121, 1); gv_oneled_state = 1; printk("[GLANCEVIEW]turn on onled gv_oneled_state = %d, then trun off Backlight!\n", gv_oneled_state); }else{ gpio_direction_output(121, 0); gv_oneled_state = 0; printk("[GLANCEVIEW]turn off onled gv_oneled_state = %d\n", gv_oneled_state); } }
/* use the mmp pin like three-leds */ void lcd_set_backlight_pwm(int level) { static uint8 last_level = 0; /* keep duty 10% < level < 100% */ if (level) { level = ((level * PWM_LEVEL_ADJUST_LPG) / PWM_LEVEL ); if (level < BL_MIN_LEVEL_LPG) { level = BL_MIN_LEVEL_LPG; } } if (last_level == level) { return ; } last_level = level; pmapp_disp_backlight_set_brightness(last_level); }
static int mipi_dsi_panel_power(int on) { int rc = 0; uint32_t lcdc_reset_cfg; /* I2C-controlled GPIO Expander -init of the GPIOs very late */ if (unlikely(!dsi_gpio_initialized)) { pmapp_disp_backlight_init(); rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr"); if (rc < 0) { pr_err("failed to request gpio_disp_pwr\n"); return rc; } if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1); if (rc < 0) { pr_err("failed to enable display pwr\n"); goto fail_gpio1; } rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en"); if (rc < 0) { pr_err("failed to request gpio_bkl_en\n"); goto fail_gpio1; } rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1); if (rc < 0) { pr_err("failed to enable backlight\n"); goto fail_gpio2; } } rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) { pr_err("%s: could not get regulators: %d\n", __func__, rc); goto fail_gpio2; } rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) { pr_err("%s: could not set voltages: %d\n", __func__, rc); goto fail_vreg; } if (pmapp_disp_backlight_set_brightness(100)) pr_err("backlight set brightness failed\n"); dsi_gpio_initialized = 1; } if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()) { if (on) { /* This line drives an active low pin on FFA */ rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on); if (rc < 0) pr_err("failed to set direction for " "display pwr\n"); } else { gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on); rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN); if (rc < 0) pr_err("failed to set direction for " "display pwr\n"); } } if (on) { gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0); if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) { lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr); rmb(); lcdc_reset_cfg &= ~1; writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); msleep(20); wmb(); lcdc_reset_cfg |= 1; writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); } else { gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0); msleep(20); gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1); } } else { gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1); } rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) : regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) pr_err("%s: could not %sable regulators: %d\n", __func__, on ? "en" : "dis", rc); return rc; fail_vreg: regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi); fail_gpio2: gpio_free(GPIO_BACKLIGHT_EN); fail_gpio1: gpio_free(GPIO_DISPLAY_PWR_EN); dsi_gpio_initialized = 0; return rc; }
static int evb_backlight_control(int level, int mode) { int i = 0; int remainder, ret = 0; u32 socinfo = socinfo_get_version(); /* device address byte = 0x72 */ if (!mode) { if (socinfo != 0x10000 && level == 0) level = 10; gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); /* t-EOS and t-start */ gpio_set_value(96, 0); ndelay(4200); gpio_set_value(96, 1); ndelay(9000); /* data byte */ /* RFA = 0 */ gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); /* Address bits */ gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); /* Data bits */ for (i = 0; i < 5; i++) { remainder = (level) & (16); if (remainder) { gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); } else { gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); } level = level << 1; } /* t-EOS */ gpio_set_value(96, 0); ndelay(12000); gpio_set_value(96, 1); } else { ret = pmapp_disp_backlight_set_brightness(level); if (ret) pr_err("%s: can't set lcd backlight!\n", __func__); } return ret; }
int backlight_pwm_gpio_config(void) { int rc; struct pm_gpio backlight_drv = { .direction = PM_GPIO_DIR_OUT, .output_buffer = PM_GPIO_OUT_BUF_CMOS, .output_value = 0, .pull = PM_GPIO_PULL_NO, .vin_sel = 0, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_2, .inv_int_pol = 1, }; /* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */ if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro() || machine_is_msm8255_u8860() || machine_is_msm8255_c8860() || machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_r() || machine_is_msm8255_u8860_92() || machine_is_msm8255_u8680() || machine_is_msm8255_u8667() || machine_is_msm8255_u8860_51() || machine_is_msm8255_u8730()) { rc = pm8xxx_gpio_config( 24, &backlight_drv); } else if(machine_is_msm7x30_u8820()) { rc = pm8xxx_gpio_config( 25, &backlight_drv); } else { rc = -1; } if (rc) { pr_err("%s LCD backlight GPIO config failed\n", __func__); return rc; } return 0; } /* use the mmp pin like three-leds */ void msm_backlight_set(int level) { static uint8 last_level = 0; /*fix bug in new base-line 1025*/ #ifdef CONFIG_ARCH_MSM7X30 static boolean first_set_bl = TRUE; static struct pwm_device *bl_pwm; #endif //CONFIG_ARCH_MSM7X30 /* keep duty 10% < level < 100% */ #ifdef CONFIG_ARCH_MSM7X27A if(level) { #ifdef CONFIG_HUAWEI_OLD_BACKLIGHT level = ((level * PWM_LEVEL_ADJUST_LPG) / PWM_LEVEL ); if (level < BL_MIN_LEVEL_LPG) { level = BL_MIN_LEVEL_LPG; } #else if (level < BL_MIN_LEVEL) { level = BL_MIN_LEVEL; } #endif } if (last_level == level) { return ; } last_level = level; pmapp_disp_backlight_set_brightness(last_level); #endif #ifdef CONFIG_ARCH_MSM7X30 if(TRUE == first_set_bl) { backlight_pwm_gpio_config(); /* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */ if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro() || machine_is_msm8255_u8860() || machine_is_msm8255_c8860() || machine_is_msm8255_u8860lp() || machine_is_msm8255_u8860_r() || machine_is_msm8255_u8860_92() || machine_is_msm8255_u8680() || machine_is_msm8255_u8667() || machine_is_msm8255_u8860_51() || machine_is_msm8255_u8730()) { bl_pwm = pwm_request(PM_GPIO25_PWM_ID, "backlight"); } else if(machine_is_msm7x30_u8820()) { bl_pwm = pwm_request(PM_GPIO26_PWM_ID, "backlight"); } else { bl_pwm = NULL; } if (NULL == bl_pwm || IS_ERR(bl_pwm)) { pr_err("%s: pwm_request() failed\n", __func__); bl_pwm = NULL; } first_set_bl = FALSE; } if (bl_pwm) { if(level) { level = ((level * PWM_LEVEL_ADJUST) / PWM_LEVEL + ADD_VALUE); if (level < BL_MIN_LEVEL) { level = BL_MIN_LEVEL; } } if (last_level == level) { return ; } last_level = level; pwm_config(bl_pwm, PWM_DUTY_LEVEL*level/NSEC_PER_USEC, PWM_PERIOD/NSEC_PER_USEC); pwm_enable(bl_pwm); } #endif } void cabc_backlight_set(struct msm_fb_data_type * mfd) { struct msm_fb_panel_data *pdata = NULL; uint32 bl_level = mfd->bl_level; /* keep duty 10% < level < 100% */ if (bl_level) { /****delete one line codes for backlight*****/ if (bl_level < BL_MIN_LEVEL) { bl_level = BL_MIN_LEVEL; } } /* backlight ctrl by LCD-self, like as CABC */ pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data; if ((pdata) && (pdata->set_cabc_brightness)) { pdata->set_cabc_brightness(mfd,bl_level); } } void pwm_set_backlight(struct msm_fb_data_type *mfd) { #ifdef CONFIG_HUAWEI_OLD_BACKLIGHT lcd_panel_type lcd_panel_wvga = LCD_NONE; #endif /*When all the device are resume that can turn the light*/ if(atomic_read(&suspend_flag)) { mfd_local = mfd; backlight_set = TRUE; return; } #ifdef CONFIG_HUAWEI_OLD_BACKLIGHT lcd_panel_wvga = get_lcd_panel_type(); if ((MIPI_CMD_RSP61408_CHIMEI_WVGA == lcd_panel_wvga ) || (MIPI_CMD_RSP61408_BYD_WVGA == lcd_panel_wvga ) || (MIPI_CMD_RSP61408_TRULY_WVGA == lcd_panel_wvga ) || (MIPI_CMD_HX8369A_TIANMA_WVGA == lcd_panel_wvga )) { /* keep duty is 75% of the quondam duty */ mfd->bl_level = mfd->bl_level * 75 / 100; } #endif if (get_hw_lcd_ctrl_bl_type() == CTRL_BL_BY_MSM) { msm_backlight_set(mfd->bl_level); } else { cabc_backlight_set(mfd); } return; }
static int evb_backlight_control(int level, int mode) { int i = 0; int remainder, ret = 0; /* */ if (!mode) { gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); /* */ gpio_set_value(96, 0); ndelay(4200); gpio_set_value(96, 1); ndelay(9000); /* */ /* */ gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); /* */ gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); /* */ for (i = 0; i < 5; i++) { remainder = (level) & (16); if (remainder) { gpio_set_value(96, 0); udelay(33); gpio_set_value(96, 1); udelay(67); } else { gpio_set_value(96, 0); udelay(67); gpio_set_value(96, 1); udelay(33); } level = level << 1; } /* */ gpio_set_value(96, 0); ndelay(12000); gpio_set_value(96, 1); } else { ret = pmapp_disp_backlight_set_brightness(level); if (ret) pr_err("%s: can't set lcd backlight!\n", __func__); } return ret; }
int backlight_pwm_gpio_config(void) { int rc; struct pm_gpio backlight_drv = { .direction = PM_GPIO_DIR_OUT, .output_buffer = PM_GPIO_OUT_BUF_CMOS, .output_value = 0, .pull = PM_GPIO_PULL_NO, .vin_sel = 0, .out_strength = PM_GPIO_STRENGTH_HIGH, .function = PM_GPIO_FUNC_2, .inv_int_pol = 1, }; /* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */ /* < DTS2011102401822 liwei 20111024 begin */ if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro() || machine_is_msm8255_u8860() || machine_is_msm8255_c8860() || machine_is_msm8255_u8860lp() /* < DTS2012022905490 ganfan 20120301 begin */ || machine_is_msm8255_u8860_r() /* DTS2012022905490 ganfan 20120301 end > */ || machine_is_msm8255_u8860_92() || machine_is_msm8255_u8680() || machine_is_msm8255_u8667() || machine_is_msm8255_u8860_51() || machine_is_msm8255_u8730()) /* DTS2011102401822 liwei 20111024 end > */ /*< DTS2012051704510 houming 20120517 begin */ /* renew config the gpio value */ { rc = pm8xxx_gpio_config( PM8058_GPIO_PM_TO_SYS(24), &backlight_drv); } else if(machine_is_msm7x30_u8820()) { rc = pm8xxx_gpio_config( PM8058_GPIO_PM_TO_SYS(25), &backlight_drv); } /* DTS2012051704510 houming 20120517 end >*/ else { rc = -1; } if (rc) { pr_err("%s LCD backlight GPIO config failed\n", __func__); return rc; } return 0; } /* use the mmp pin like three-leds */ /*< DTS2012012101194 lijianzhao 20120121 begin */ void msm_backlight_set(int level) { static uint8 last_level = 0; static boolean first_set_bl = TRUE; /*< DTS2012042605475 zhongjinrong 20120426 begin */ /*< DTS2012032101654 liweiwu 20120321 begin */ /* keep duty 10% < level < 100% */ /* DTS2012032101654 liweiwu 20120321 end >*/ /* DTS2012042605475 zhongjinrong 20120426 end >*/ /*< DTS2012021602342 zhongjinrong 20120224 begin */ #ifdef CONFIG_ARCH_MSM7X27A /* DTS2012021602342 zhongjinrong 20120224 end >*/ if(level) { level = ((level * PWM_LEVEL_ADJUST_LPG) / PWM_LEVEL ); if (level < BL_MIN_LEVEL_LPG) { level = BL_MIN_LEVEL_LPG; } } if (last_level == level) { return ; } last_level = level; pmapp_disp_backlight_set_brightness(last_level); #endif #ifdef CONFIG_ARCH_MSM7X30 if(TRUE == first_set_bl) { backlight_pwm_gpio_config(); /* U8800 use PM_GPIO25 as backlight's PWM,but U8820 use PM_GPIO26 */ /* < DTS2011102401822 liwei 20111024 begin */ if(machine_is_msm7x30_u8800() || machine_is_msm7x30_u8800_51() || machine_is_msm8255_u8800_pro() || machine_is_msm8255_u8860() || machine_is_msm8255_c8860() || machine_is_msm8255_u8860lp() /* < DTS2012022905490 ganfan 20120301 begin */ || machine_is_msm8255_u8860_r() /* DTS2012022905490 ganfan 20120301 end > */ || machine_is_msm8255_u8860_92() || machine_is_msm8255_u8680() || machine_is_msm8255_u8667() || machine_is_msm8255_u8860_51() || machine_is_msm8255_u8730()) /* DTS2011102401822 liwei 20111024 end > */ { bl_pwm = pwm_request(PM_GPIO25_PWM_ID, "backlight"); } else if(machine_is_msm7x30_u8820()) { bl_pwm = pwm_request(PM_GPIO26_PWM_ID, "backlight"); } else { bl_pwm = NULL; } if (NULL == bl_pwm || IS_ERR(bl_pwm)) { pr_err("%s: pwm_request() failed\n", __func__); bl_pwm = NULL; } first_set_bl = FALSE; } if (bl_pwm) { if(level) { level = ((level * PWM_LEVEL_ADJUST) / PWM_LEVEL + ADD_VALUE); if (level < BL_MIN_LEVEL) { level = BL_MIN_LEVEL; } } if (last_level == level) { return ; } last_level = level; pwm_config(bl_pwm, PWM_DUTY_LEVEL*level/NSEC_PER_USEC, PWM_PERIOD/NSEC_PER_USEC); pwm_enable(bl_pwm); } #endif } /* DTS2012012101194 lijianzhao 20120121 end >*/ void cabc_backlight_set(struct msm_fb_data_type * mfd) { struct msm_fb_panel_data *pdata = NULL; uint32 bl_level = mfd->bl_level; /*< DTS2012042605475 zhongjinrong 20120426 begin */ /*< DTS2012032101654 liweiwu 20120321 begin */ /* keep duty 10% < level < 100% */ /* DTS2012032101654 liweiwu 20120321 end >*/ if (bl_level) { /*< DTS2012032101654 liweiwu 20120321 begin */ /****delete one line codes for backlight*****/ /* DTS2012032101654 liweiwu 20120321 end >*/ /* DTS2012042605475 zhongjinrong 20120426 end >*/ if (bl_level < BL_MIN_LEVEL) { bl_level = BL_MIN_LEVEL; } } /* backlight ctrl by LCD-self, like as CABC */ /*< DTS2012012101194 lijianzhao 20120121 begin */ pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data; if ((pdata) && (pdata->set_cabc_brightness)) { pdata->set_cabc_brightness(mfd,bl_level); } /* DTS2012012101194 lijianzhao 20120121 end >*/ } /*< DTS2012022408079 zhongjinrong 20120306 begin */ void pwm_set_backlight(struct msm_fb_data_type *mfd) { lcd_panel_type lcd_panel_wvga = LCD_NONE; /*< DTS2011122704239 liuyuntao 20111229 begin */ /*When all the device are resume that can turn the light*/ if(atomic_read(&suspend_flag)) { mfd_local = mfd; backlight_set = TRUE; return; } /* DTS2011122704239 liuyuntao 20111229 end >*/ /*< DTS2012021601331 duanfei 20120216 begin */ /*< DTS2012021602342 zhongjinrong 20120224 begin */ #ifdef CONFIG_ARCH_MSM7X27A /* DTS2012021602342 zhongjinrong 20120224 end >*/ lcd_panel_wvga = get_lcd_panel_type(); /* <DTS2012022501992 liguosheng 20120229 begin */ if ((MIPI_RSP61408_CHIMEI_WVGA == lcd_panel_wvga ) || (MIPI_RSP61408_BYD_WVGA == lcd_panel_wvga ) || (MIPI_RSP61408_TRULY_WVGA == lcd_panel_wvga ) || (MIPI_HX8369A_TIANMA_WVGA == lcd_panel_wvga )) { /* keep duty is 75% of the quondam duty */ mfd->bl_level = mfd->bl_level * 75 / 100; } /* DTS2012022501992 liguosheng 20120229 end> */ #endif /* DTS2012021601331 duanfei 20120216 end >*/ if (get_hw_lcd_ctrl_bl_type() == CTRL_BL_BY_MSM) { msm_backlight_set(mfd->bl_level); } else { cabc_backlight_set(mfd); } return; }
static int mipi_dsi_panel_msm_power(int on) { /*++ Huize - 20120927 Modify for identifying what the code is used by customization ++*/ #ifdef DISPLAY_CUSTOMIZATION int rc = 0; if (unlikely(!dsi_gpio_initialized)) { pr_emerg("%s\n", __func__); #ifndef CONFIG_LEDS_CHIP_LM3533 rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bl_en"); if (rc < 0) { pr_err("failed to request gpio_bl_en\n"); return rc; } rc = gpio_tlmm_config( GPIO_CFG(GPIO_BACKLIGHT_EN,0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE); #endif if (rc) { pr_err("Failed to enable gpio_bl_en\n"); goto fail_gpio1; } rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) { pr_err("%s: could not get regulators: %d\n", __func__, rc); goto fail_gpio2; } rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) { pr_err("%s: could not set voltages: %d\n", __func__, rc); goto fail_vreg; } dsi_gpio_initialized = 1; } #else int rc = 0; uint32_t lcdc_reset_cfg; /* I2C-controlled GPIO Expander -init of the GPIOs very late */ if (unlikely(!dsi_gpio_initialized)) { pmapp_disp_backlight_init(); rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr"); if (rc < 0) { pr_err("failed to request gpio_disp_pwr\n"); return rc; } if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() || machine_is_msm8625_surf()) { rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1); if (rc < 0) { pr_err("failed to enable display pwr\n"); goto fail_gpio1; } rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en"); if (rc < 0) { pr_err("failed to request gpio_bkl_en\n"); goto fail_gpio1; } rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1); if (rc < 0) { pr_err("failed to enable backlight\n"); goto fail_gpio2; } } rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) { pr_err("%s: could not get regulators: %d\n", __func__, rc); goto fail_gpio2; } rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) { pr_err("%s: could not set voltages: %d\n", __func__, rc); goto fail_vreg; } if (pmapp_disp_backlight_set_brightness(100)) pr_err("backlight set brightness failed\n"); dsi_gpio_initialized = 1; } if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() || machine_is_msm8625_surf()) { gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on); gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on); } else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa() || machine_is_msm8625_ffa()) { if (on) { /* This line drives an active low pin on FFA */ rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on); if (rc < 0) pr_err("failed to set direction for " "display pwr\n"); } else { gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on); rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN); if (rc < 0) pr_err("failed to set direction for " "display pwr\n"); } } if (on) { gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0); if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() || machine_is_msm8625_surf()) { lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr); rmb(); lcdc_reset_cfg &= ~1; writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); msleep(20); wmb(); lcdc_reset_cfg |= 1; writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr); } else { gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0); msleep(20); gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1); } } else { gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1); } #endif /*-- Huize - 20120927 Modify for identifying what the code is used by customization --*/ rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) : regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi); if (rc) pr_err("%s: could not %sable regulators: %d\n", __func__, on ? "en" : "dis", rc); return rc; fail_vreg: regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi); fail_gpio2: gpio_free(GPIO_BACKLIGHT_EN); fail_gpio1: //Jordan-20111230 , remove // gpio_free(GPIO_DISPLAY_PWR_EN); dsi_gpio_initialized = 0; return rc; }