static void cmc623_pwm_backlight_ctl(struct platform_device *pdev, int intensity) { int tune_level; // brightness tuning tune_level = cmc623_pwm_get_tune(intensity); printk("[cmc]%d(%d)\n", intensity, tune_level); cmc623_pwm_apply_brightness(pdev, tune_level); }
/*for measuring luminance*/ void cmc623_pwm_set_brightness(int brightness) { /*unsigned long flags;*/ printk("%s: value=%d\n", __func__, brightness); mutex_lock(&cmc623_pwm_mutex); cmc623_pwm_apply_brightness(bl_pdev, brightness); mutex_unlock(&cmc623_pwm_mutex); }
//for measuring luminance void cmc623_pwm_set_brightness(int brightness) { //unsigned long flags; printk("%s: value=%d\n", __func__, brightness); //spin_lock_irqsave(&cmc623_pwm_lock, flags); //spin_lock(&cmc623_pwm_lock); mutex_lock(&cmc623_pwm_mutex); cmc623_pwm_apply_brightness(bl_pdev, brightness); //spin_unlock_irqrestore(&cmc623_pwm_lock, flags); //spin_unlock(&cmc623_pwm_lock); mutex_unlock(&cmc623_pwm_mutex); }
static void cmc623_pwm_backlight_ctl(struct platform_device *pdev, int intensity) { int tune_level; int in_one = 2; int in_two = 200; int in_three = 255; int out_one = 18; int out_two = 75; int out_three = 255; if (intensity >= 0 && intensity <= in_one) { //e.g input 25, should output (25 * 80) / 50 = 40 intensity = (intensity * out_one) / in_one; } else if (intensity > in_one && intensity <= in_two) { //e.g. input 100, should output 80 + ((100-50) / (220-50) * (100-80)) = 85 intensity = out_one + ( ((intensity - in_one) * (out_two - out_one)) / (in_two - in_one) ); } else if (intensity > in_two) { //e.g. input 240, should output 100 + ((240-220) * (250-100) / (250-220)) = 200 //e.g. input 250, should output 100 + ((250-220) * (250-100) / (250-220)) = 250 intensity = out_two + ( ((intensity - in_two) * (out_three - out_two)) / (in_three - in_two) ); } if (intensity > 255) { intensity = 255; } intensity = (intensity * 1550) / 255; if (intensity > 1550) intensity = 1550; if (intensity < 0) intensity = 0; tune_level = intensity; cmc623_pwm_apply_brightness(pdev, tune_level); }
static void cmc623_pwm_backlight_ctl(struct platform_device *pdev, int intensity) { int tune_level; // brightness tuning if(intensity >= MID_BRIGHTNESS_LEVEL) tune_level = (intensity - MID_BRIGHTNESS_LEVEL) * (MAX_BACKLIGHT_VALUE-MID_BACKLIGHT_VALUE) / (MAX_BRIGHTNESS_LEVEL-MID_BRIGHTNESS_LEVEL) + MID_BACKLIGHT_VALUE; else if(intensity >= LOW_BRIGHTNESS_LEVEL) tune_level = (intensity - LOW_BRIGHTNESS_LEVEL) * (MID_BACKLIGHT_VALUE-LOW_BACKLIGHT_VALUE) / (MID_BRIGHTNESS_LEVEL-LOW_BRIGHTNESS_LEVEL) + LOW_BACKLIGHT_VALUE; else if(intensity >= DIM_BACKLIGHT_LEVEL) tune_level = (intensity - DIM_BACKLIGHT_LEVEL) * (LOW_BACKLIGHT_VALUE-DIM_BACKLIGHT_VALUE) / (LOW_BRIGHTNESS_LEVEL-DIM_BACKLIGHT_LEVEL) + DIM_BACKLIGHT_VALUE; else if(intensity > 0) tune_level = (intensity) * (DIM_BACKLIGHT_VALUE) / (DIM_BACKLIGHT_LEVEL); else tune_level = intensity; printk("[cmc]%d(%d)\n", intensity, tune_level); cmc623_pwm_apply_brightness(pdev, tune_level); }
static void cmc623_pwm_backlight_ctl(struct platform_device *pdev, int intensity) { int tune_level; /* brightness tuning*/ if (intensity >= MID_BRIGHTNESS_LEVEL) tune_level = (intensity - MID_BRIGHTNESS_LEVEL) * (MAX_BACKLIGHT_VALUE-MID_BACKLIGHT_VALUE) / (MAX_BRIGHTNESS_LEVEL-MID_BRIGHTNESS_LEVEL) + MID_BACKLIGHT_VALUE; else if (intensity >= LOW_BRIGHTNESS_LEVEL) tune_level = (intensity - LOW_BRIGHTNESS_LEVEL) * (MID_BACKLIGHT_VALUE-LOW_BACKLIGHT_VALUE) / (MID_BRIGHTNESS_LEVEL-LOW_BRIGHTNESS_LEVEL) + LOW_BACKLIGHT_VALUE; else if (intensity >= DIM_BRIGHTNESS_LEVEL) tune_level = (intensity - DIM_BRIGHTNESS_LEVEL) * (LOW_BACKLIGHT_VALUE-DIM_BACKLIGHT_VALUE) / (LOW_BRIGHTNESS_LEVEL-DIM_BRIGHTNESS_LEVEL) + DIM_BACKLIGHT_VALUE; else if (intensity > 0) tune_level = DIM_BACKLIGHT_VALUE; else tune_level = intensity; /*printk("--- [cmc]%d(%d)---\n", intensity, tune_level);*/ //printk("[CMC623:INFO] Intensity : %d, Tuned Intensity : %d\n",intensity, tune_level); cmc623_pwm_apply_brightness(pdev, tune_level); }