57 次浏览
path: /vendor/nxp-opensource/kernel_imx/drivers/video/backlight/pwm_bl.c
新增头文件:
// added by peng
#include <linux/delay.h>
#include <linux/kthread.h>
新增变量定义:
// added by peng
static struct task_struct *bl_delay_task;
新增延时函数:
// added by peng
int bl_on_fuction(void *arg)
{
struct backlight_device *bl;
bl = (struct backlight_device *)arg;
printk("[bgk] bl_on gpio before mdelay \n");
msleep(2000);
bl->props.power = 0;
backlight_update_status(bl);
printk("[bgk] bl_on gpio after mdeay \n");
return 0;
}
在pwm_backlight_probe()函数中新增延时线程:
bl->props.power = 1;
// added by peng
bl_delay_task = kthread_create(bl_on_fuction, bl, "bl_delay");
if(IS_ERR(bl_delay_task))
{
printk("[bgk] bl_on kthread_create Unable to start kernel thread. \n");
bl_delay_task = NULL;
return 0;
}
wake_up_process(bl_delay_task);
在pwm_backlight_remove()函数中退出延时线程:
//added by peng
if (bl_delay_task)
{
kthread_stop(bl_delay_task);
bl_delay_task = NULL;
}