backlight:add pre_div parameter

This commit is contained in:
lw@rock-chips.com 2012-08-24 17:57:55 +08:00 committed by lw
parent b618612b88
commit eb5cba4889
2 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,7 @@ struct rk29_bl_info {
int (*pwm_resume)(void);
int min_brightness; /* 0 ~ 255 */
unsigned int delay_ms; /* in milliseconds */
int pre_div;
};
struct rk29_io_t {

View File

@ -219,6 +219,7 @@ static int rk29_backlight_probe(struct platform_device *pdev)
u32 divh, div_total;
unsigned long pwm_clk_rate;
struct backlight_properties props;
int pre_div = PWM_APB_PRE_DIV;
if (rk29_bl) {
printk(KERN_CRIT "%s: backlight device register has existed \n",
@ -236,6 +237,9 @@ static int rk29_backlight_probe(struct platform_device *pdev)
rk29_bl_info->io_init();
}
if(rk29_bl_info->pre_div > 0)
pre_div = rk29_bl_info->pre_div;
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.max_brightness = BL_STEP;
@ -259,7 +263,7 @@ static int rk29_backlight_probe(struct platform_device *pdev)
return -ENODEV;
}
pwm_clk_rate = clk_get_rate(pwm_clk);
div_total = pwm_clk_rate / PWM_APB_PRE_DIV;
div_total = pwm_clk_rate / pre_div;
div_total >>= (1 + (PWM_DIV >> 9));
div_total = (div_total) ? div_total : 1;