static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level) { if (level > LED_FULL) level = LED_FULL; else if (level < 0) level = 0; switch (cust->mode) { case MT65XX_LED_MODE_PWM: if(strcmp(cust->name,"lcd-backlight") == 0) { return brightness_set_pwm(cust->data, level,&cust->config_data); } else { return led_set_pwm(cust->data, level); } case MT65XX_LED_MODE_GPIO: return brightness_set_gpio(cust->data, level); case MT65XX_LED_MODE_PMIC: return brightness_set_pmic(cust->data, level); case MT65XX_LED_MODE_CUST: return ((cust_brightness_set)(cust->data))(level); case MT65XX_LED_MODE_NONE: default: break; } return -1; }
static void mt65xx_leds_shutdown(struct platform_device *pdev) { int i; struct nled_setting led_tmp_setting = {NLED_OFF,0,0}; LEDS_DRV_DEBUG("[LED]%s\n", __func__); LEDS_DRV_DEBUG("[LED]mt65xx_leds_shutdown: turn off backlight\n"); for (i = 0; i < MT65XX_LED_TYPE_TOTAL; i++) { if (!g_leds_data[i]) continue; switch (g_leds_data[i]->cust.mode) { case MT65XX_LED_MODE_PWM: if(strcmp(g_leds_data[i]->cust.name,"lcd-backlight") == 0) { //mt_set_pwm_disable(g_leds_data[i]->cust.data); //mt_pwm_power_off (g_leds_data[i]->cust.data); mt_led_pwm_disable(g_leds_data[i]->cust.data); }else { led_set_pwm(g_leds_data[i]->cust.data,&led_tmp_setting); } break; // case MT65XX_LED_MODE_GPIO: // brightness_set_gpio(g_leds_data[i]->cust.data, 0); // break; case MT65XX_LED_MODE_PMIC: brightness_set_pmic(g_leds_data[i]->cust.data, 0, 0); break; case MT65XX_LED_MODE_CUST_LCM: LEDS_DRV_DEBUG("[LED]backlight control through LCM!!1\n"); ((cust_brightness_set)(g_leds_data[i]->cust.data))(0, bl_div); break; case MT65XX_LED_MODE_CUST_BLS_PWM: LEDS_DRV_DEBUG("[LED]backlight control through BLS!!1\n"); ((cust_set_brightness)(g_leds_data[i]->cust.data))(0); break; case MT65XX_LED_MODE_NONE: default: break; } } }
static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level) { if (level > LED_FULL) level = LED_FULL; else if (level < 0) level = 0; switch (cust->mode) { case MT65XX_LED_MODE_PWM: if(strcmp(cust->name,"lcd-backlight") == 0) { mdelay(100); //added by chenfei //added by XIE Wei -- begin if (level) { upmu_boost_isink_hw_sel(0x1); upmu_boost_mode(3); upmu_boost_vrsel(0x07); upmu_boost_cabc_en(0); upmu_top2_bst_drv_ck_pdn(0x0); upmu_boost_en(0x1); } else { printf("[LEDS]MT65XX_LED_PMIC_LCD_BOOST:level=%d\n", level); upmu_boost_en(0x0); } //added by XIE Wei -- end return brightness_set_pwm(cust->data, level,&cust->config_data); } else { return led_set_pwm(cust->data, level); } case MT65XX_LED_MODE_GPIO: return brightness_set_gpio(cust->data, level); case MT65XX_LED_MODE_PMIC: return brightness_set_pmic(cust->data, level); case MT65XX_LED_MODE_CUST: return ((cust_brightness_set)(cust->data))(level); case MT65XX_LED_MODE_NONE: default: break; } return -1; }