转自:https://blog.csdn.net/kk20000/article/details/83041081
使用的汇顶的触摸驱动的时候会重新亮屏速度慢3秒,而在使用另外一个敦泰触摸驱动的时候没有发现问题。
比较代码后发现,fb_notifier_callback的影响是关键.
有问题的代码是:
static int fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data)
{
struct fb_event *evdata = data;
int *blank;
struct goodix_ts_data *ts =
container_of(self, struct goodix_ts_data, fb_notif);
if (evdata && evdata->data && event == FB_EVENT_BLANK &&
ts && ts->client) {
blank = evdata->data;
GTP_DEBUG("fb notifier callback blank :%d",*blank);
if (*blank == FB_BLANK_UNBLANK)
goodix_ts_resume(&ts->client->dev);
else if (*blank == FB_BLANK_POWERDOWN)
goodix_ts_suspend(&ts->client->dev);
}
return 0;
}
修改为下面的方式后正常:
static int fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data)
{
struct fb_event *evdata = data;
int *blank;
struct goodix_ts_data *ts =
container_of(self, struct goodix_ts_data, fb_notif);
if (evdata && evdata->data && event == FB_EARLY_EVENT_BLANK && ts && ts->client)
{
blank = evdata->data;
GTP_DEBUG ("fb_notifier_callback:goodix blank=%d\n", *blank);
if (*blank == FB_BLANK_UNBLANK)
{
if (!work_pending (&ts->resume_work))
{
schedule_work (&ts->resume_work);
}
}
else if (*blank == FB_BLANK_POWERDOWN)
{
cancel_work_sync (&ts->resume_work);
goodix_ts_suspend (&ts->client->dev);
}
}
else if (event == FB_R_EARLY_EVENT_BLANK)
{
if (!work_pending (&ts->resume_work))
{
schedule_work (&ts->resume_work);
}
}
return 0;
}
所以在使用屏幕通知唤醒的时候,要避免直接调用唤醒函数,而应该采用内核工作队列中来处理。
---------------------
作者:雨滴平头哥
来源:CSDN
原文:https://blog.csdn.net/kk20000/article/details/83041081
版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/sky-heaven/p/10765223.html