backlight:add pre_div parameter
authorlw@rock-chips.com <lw@rock-chips.com>
Fri, 24 Aug 2012 09:57:55 +0000 (17:57 +0800)
committerlw <lw@rock-chips.com>
Fri, 24 Aug 2012 09:58:22 +0000 (17:58 +0800)
arch/arm/plat-rk/include/plat/board.h
drivers/video/backlight/rk29_backlight.c

index b232873ed3dc83b66989f25dccca799095b887aa..30a43455e1d51403d2a58133281005fde866099c 100755 (executable)
@@ -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 {
index 4244e385340c0631c7795e83ee6a910291e416ad..49a78e3df7661616af9e71cdf501502db816ca29 100755 (executable)
@@ -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;