mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
backlight:set bl_pwm as gpio and set it low, make sure backlight be off
This commit is contained in:
@@ -1017,6 +1017,7 @@ static struct platform_device rk29_device_camera = {
|
||||
#define PWM_MUX_NAME GPIO1B5_PWM0_NAME
|
||||
#define PWM_MUX_MODE GPIO1L_PWM0
|
||||
#define PWM_MUX_MODE_GPIO GPIO1L_GPIO1B5
|
||||
#define PWM_GPIO RK29_PIN1_PB5
|
||||
#define PWM_EFFECT_VALUE 1
|
||||
|
||||
//#define LCD_DISP_ON_PIN
|
||||
@@ -1057,11 +1058,33 @@ static int rk29_backlight_io_deinit(void)
|
||||
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_suspend(void)
|
||||
{
|
||||
int ret = 0;
|
||||
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
if (ret = gpio_request(PWM_GPIO, NULL)) {
|
||||
printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
gpio_direction_output(PWM_GPIO, GPIO_LOW);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_resume(void)
|
||||
{
|
||||
gpio_free(PWM_GPIO);
|
||||
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct rk29_bl_info rk29_bl_info = {
|
||||
.pwm_id = PWM_ID,
|
||||
.bl_ref = PWM_EFFECT_VALUE,
|
||||
.io_init = rk29_backlight_io_init,
|
||||
.io_deinit = rk29_backlight_io_deinit,
|
||||
.pwm_suspend = rk29_backlight_pwm_suspend,
|
||||
.pwm_resume = rk29_backlight_pwm_resume,
|
||||
};
|
||||
#endif
|
||||
/*****************************************************************************************
|
||||
|
||||
@@ -81,6 +81,8 @@ struct rk29_bl_info{
|
||||
u32 bl_ref;
|
||||
int (*io_init)(void);
|
||||
int (*io_deinit)(void);
|
||||
int (*pwm_suspend)(void);
|
||||
int (*pwm_resume)(void);
|
||||
struct timer_list timer;
|
||||
struct notifier_block freq_transition;
|
||||
};
|
||||
|
||||
11
drivers/video/backlight/rk29_backlight.c
Normal file → Executable file
11
drivers/video/backlight/rk29_backlight.c
Normal file → Executable file
@@ -164,6 +164,10 @@ static void rk29_delaybacklight_timer(unsigned long data)
|
||||
struct rk29_bl_info *rk29_bl_info = (struct rk29_bl_info *)data;
|
||||
u32 id, brightness;
|
||||
u32 div_total, divh;
|
||||
|
||||
if (rk29_bl_info->pwm_resume)
|
||||
rk29_bl_info->pwm_resume();
|
||||
|
||||
clk_enable(pwm_clk);
|
||||
id = rk29_bl_info->pwm_id;
|
||||
brightness = rk29_bl->props.brightness;
|
||||
@@ -197,9 +201,12 @@ static void rk29_bl_suspend(struct early_suspend *h)
|
||||
}
|
||||
|
||||
write_pwm_reg(id, PWM_REG_HRC, divh);
|
||||
if (!suspend_flag)
|
||||
if (!suspend_flag) {
|
||||
clk_disable(pwm_clk);
|
||||
|
||||
if (rk29_bl_info->pwm_suspend)
|
||||
rk29_bl_info->pwm_suspend();
|
||||
}
|
||||
|
||||
suspend_flag = 1;
|
||||
del_timer_sync(&rk29_bl_info->timer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user