LCD 每隔10分钟 自动熄灭 --打开Framebuffer console的时候【转】

简介:

转自:http://blog.csdn.net/liujia2100/article/details/9009063

之前移植LCD的时候,一切正常,但是当尝试把log输出到lcd的时候,总是会出现10分钟黑屏,无论如何都唤不醒
通过打log,最终定位到s3c_fb_blank这个函数。


[cpp]  view plain  copy
  1. static int s3c_fb_blank(int blank_mode, struct fb_info *info)  
  2. {  
  3.     struct s3c_fb_win *win = info->par;  
  4.     struct s3c_fb *sfb = win->parent;  
  5.     unsigned int index = win->index;  
  6.     u32 wincon;  
  7. printk("lj:s3c_fb_blank:blank mode:%d\n",blank_mode);  
  8.     dev_dbg(sfb->dev, "blank mode %d\n", blank_mode);  
  9.   
  10.     pm_runtime_get_sync(sfb->dev);  
  11.   
  12.     wincon = readl(sfb->regs + sfb->variant.wincon + (index * 4));  
  13.   
  14.     switch (blank_mode) {  
  15.     case FB_BLANK_POWERDOWN:  
  16.         wincon &= ~WINCONx_ENWIN;  
  17.         sfb->enabled &= ~(1 << index);  
  18.         /* fall through to FB_BLANK_NORMAL */  
  19.   
  20.     case FB_BLANK_NORMAL:  
  21.         /* disable the DMA and display 0x0 (black) */  
  22.         shadow_protect_win(win, 1);  
  23.         dump_stack();  
  24.         writel(WINxMAP_MAP | WINxMAP_MAP_COLOUR(0x00),//liujia  disable the black screen  
  25.                sfb->regs + sfb->variant.winmap + (index * 4));  
  26.         shadow_protect_win(win, 0);  
  27.         break;  
  28.   
  29.     case FB_BLANK_UNBLANK:  
  30.         shadow_protect_win(win, 1);  
  31.         writel(0x0, sfb->regs + sfb->variant.winmap + (index * 4));  
  32.         shadow_protect_win(win, 0);  
  33.         wincon |= WINCONx_ENWIN;  
  34.         sfb->enabled |= (1 << index);  
  35.         break;  
  36.   
  37.     case FB_BLANK_VSYNC_SUSPEND:  
  38.     case FB_BLANK_HSYNC_SUSPEND:  
  39.     default:  
  40.         pm_runtime_put_sync(sfb->dev);  
  41.         return 1;  
  42.     }  
  43.   
  44.     shadow_protect_win(win, 1);  
  45.     writel(wincon, sfb->regs + sfb->variant.wincon + (index * 4));  
  46.     shadow_protect_win(win, 0);  
  47.   
  48.     /* Check the enabled state to see if we need to be running the 
  49.      * main LCD interface, as if there are no active windows then 
  50.      * it is highly likely that we also do not need to output 
  51.      * anything. 
  52.      */  
  53.   
  54.     /* We could do something like the following code, but the current 
  55.      * system of using framebuffer events means that we cannot make 
  56.      * the distinction between just window 0 being inactive and all 
  57.      * the windows being down. 
  58.      * 
  59.      * s3c_fb_enable(sfb, sfb->enabled ? 1 : 0); 
  60.     */  
  61.   
  62.     /* we're stuck with this until we can do something about overriding 
  63.      * the power control using the blanking event for a single fb. 
  64.      */  
  65.     if (index == sfb->pdata->default_win) {  
  66.         shadow_protect_win(win, 1);  
  67.         s3c_fb_enable(sfb, blank_mode != FB_BLANK_POWERDOWN ? 1 : 0);  
  68.         shadow_protect_win(win, 0);  
  69.     }  
  70.   
  71.     pm_runtime_put_sync(sfb->dev);  
  72.     return 0;  
  73. }  


问题就出在
writel(WINxMAP_MAP | WINxMAP_MAP_COLOUR(0x00),//liujia  disable the black screen
      sfb->regs + sfb->variant.winmap + (index * 4));
发现执行到这里,LCD就黑屏了。
查数据手册发现:


这个寄存器的意思是,当MAPCOLEN_F使能的时候,他会把LCD显示成MAPCOLOR设置成颜色,关闭LCD的DMA功能,然后Framebuffer就不能刷新LCD了。
这也许就是FB_BLANK_NORMAL,这个的功能吧,把LCD一直刷成某个颜色。
参考http://blog.csdn.net/zanget/article/details/6569743这个 大侠的博客,
加入dump_stack

[cpp]  view plain  copy
  1. case FB_BLANK_NORMAL:  
  2.     /* disable the DMA and display 0x0 (black) */  
  3.     shadow_protect_win(win, 1);  
  4.     dump_stack();  
  5.     writel(WINxMAP_MAP | WINxMAP_MAP_COLOUR(0x00),//liujia  disable the black screen  
  6.            sfb->regs + sfb->variant.winmap + (index * 4));  
  7.     shadow_protect_win(win, 0);  
  8.     break;  


log:

[cpp]  view plain  copy
  1. <7>[   61.285759] lj:s3c_fb_blank:blank mode:1  
  2. <7>[   61.285772] lj:shadow_protect_win:1  
  3. <7>[   61.285816] [<80013120>] (unwind_backtrace+0x0/0xec) from [<801af0b8>] (s3c_fb_blank+0x84/0x180)  
  4. <7>[   61.285835] [<801af0b8>] (s3c_fb_blank+0x84/0x180) from [<801a2bcc>] (fb_blank+0x3c/0x68)  
  5. <7>[   61.285852] [<801a2bcc>] (fb_blank+0x3c/0x68) from [<801a9690>] (fbcon_blank+0x118/0x260)  
  6. <7>[   61.285875] [<801a9690>] (fbcon_blank+0x118/0x260) from [<801c7594>] (do_blank_screen+0x1b8/0x258)  
  7. <7>[   61.285892] [<801c7594>] (do_blank_screen+0x1b8/0x258) from [<801c884c>] (console_callback+0xe4/0x114)  
  8. <7>[   61.285909] [<801c884c>] (console_callback+0xe4/0x114) from [<8002e12c>] (process_one_work+0x1e8/0x318)  
  9. <7>[   61.285927] [<8002e12c>] (process_one_work+0x1e8/0x318) from [<800301c0>] (worker_thread+0x1b4/0x2b4)  
  10. <7>[   61.285947] [<800301c0>] (worker_thread+0x1b4/0x2b4) from [<80033438>] (kthread+0x88/0x94)  
  11. <7>[   61.285969] [<80033438>] (kthread+0x88/0x94) from [<8000ec20>] (kernel_thread_exit+0x0/0x8)  
  12. <7>[   61.285979] lj:shadow_protect_win:0  
  13. <7>[   61.285984] lj:shadow_protect_win:1  
  14. <7>[   61.285990] lj:shadow_protect_win:0  
  15. <7>[   61.285995] lj:shadow_protect_win:1  
  16. <7>[   61.286001] lj:s3c_fb_set_par  
  17. <7>[   61.286005] lj:shadow_protect_win:0  


找到了调用关系
console_callback--->do_blank_screen--->fb_blank--->s3c_fb_blank.
按照http://blog.csdn.net/zanget/article/details/6569743修改方法
将vt.c   179行
static int blankinterval = 10*60;
修改为
static int blankinterval = 0;
这样就不会出现黑屏的现象了。










本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sky-heaven/p/7650478.html,如需转载请自行联系原作者

相关文章
|
30天前
|
开发框架 .NET
阅读器关闭时尝试调用Read无效时的解决方法
阅读器关闭时尝试调用Read无效时的解决方法
14 0
|
18天前
【RTThread】修改Finsh打印串口波特率
【RTThread】修改Finsh打印串口波特率
|
7月前
在ftp中使用QNetworkReply未触发error信号?
在ftp中使用QNetworkReply未触发error信号?
61 0
|
6月前
|
索引
串口助手(串口发送接收数据, 定时, 清空, hex显示)
串口助手(串口发送接收数据, 定时, 清空, hex显示)
193 0
|
8月前
UE4 使用Animation Data Modifiers修改动画片段
UE4 使用Animation Data Modifiers修改动画片段
59 0
UE4 使用Animation Data Modifiers修改动画片段
|
小程序 前端开发 开发者
小程序用f2真机调试不显示图形报错Cannot read property ‘createView‘ of undefined
小程序用f2真机调试不显示图形报错Cannot read property ‘createView‘ of undefined
491 0
Win2000下打印设定
Win2000下打印设定
503 0