AM335x kernel4.4.12 LCD 时钟翻转设置记录

TI AM335x kernel 4.4.12 LCD display 时钟翻转记录

因为公司硬件上已经确定LCD 转LVDS 转换芯片上确认以上升沿时钟为基准,所以只能在软件上调整相关东西。

入口在:

drivers/gpu/drm/tilcdc/tilcdc_drv.c入口函数:
module_init(tilcdc_drm_init);    
出口函数:                                                
module_exit(tilcdc_drm_fini);   722 static int __init tilcdc_drm_init(void)                                         
723 {                                                                               
724     DBG("init");                                                                
725     tilcdc_tfp410_init();                                                       
726     tilcdc_panel_init();   ---> 这里面有关监视器的初始化----------                                                      
727     return platform_driver_register(&tilcdc_platform_driver); |                   
728 }                                                             |                   |                   |
drivers/gpu/drm/tilcdc/tilcdc_panel.c                             ||
452 int __init tilcdc_panel_init(void)  <--------------------------                                           
453 {                                                                               
454     return platform_driver_register(&panel_driver);                             
455 }                                         |----------                                      |
437 static struct of_device_id panel_of_match[] = {     |                            
438         { .compatible = "ti,tilcdc,panel", },       |                            
439         { },                                        |                            
440 };                                                  |                            
441                                                     |                            
442 struct platform_driver panel_driver = { <------------                            
443     .probe = panel_probe,                                                       
444     .remove = panel_remove,                                                     
445     .driver = {                                                                 
446         .owner = THIS_MODULE,                                                   
447         .name = "panel",                                                        
448         .of_match_table = panel_of_match,                                       
449     },                                                                          
450 };  

根据panel_of_match[].compatible = "ti,tilcdc,panel", 找到设备树相应内容。
arch/arm/boot/dts/am335x-chenfl.dts47     panel {48         compatible = "ti,tilcdc,panel";49         status = "okay";50         pinctrl-names = "default";51         pinctrl-0 = <&lcd_pins_s0>;52         panel-info {53             ac-bias           = <255>;54             ac-bias-intrpt    = <0>;55             dma-burst-sz      = <16>;56             bpp               = <16>;57             fdd               = <0x80>;58             sync-edge         = <0>;59             sync-ctrl         = <1>;60             raster-order      = <0>;61             fifo-th           = <0>;62             invert-pxl-clk    = <1>;63         };64 65         display-timings {66             native-mode = <&timing0>;67             timing0: 800x480 {68                 clock-frequency = <33260000>;69                 hactive = <800>;70                 vactive = <480>;71                 hfront-porch = <39>;72                 hback-porch = <39>;73                 hsync-len = <47>;74                 vback-porch = <29>;75                 vfront-porch = <13>;76                 vsync-len = <2>;77                 hsync-active = <1>;78                 vsync-active = <1>;79             };80         };81     };

确定平台设备与平台驱动已经相互匹配之后,我们可以直接跟踪驱动的probe
回到drivers/gpu/drm/tilcdc/tilcdc_panel.c
看到:442 struct platform_driver panel_driver = {                            
443     .probe = panel_probe,                                                       
444     .remove = panel_remove,                                                     
445     .driver = {                                                                 
446         .owner = THIS_MODULE,                                                   
447         .name = "panel",                                                        
448         .of_match_table = panel_of_match,                                       
449     },                                                                          
450 };  panel_probe: 
341 static int panel_probe(struct platform_device *pdev)                            
342 {                                                                               
343     struct device_node *bl_node, *node = pdev->dev.of_node;                     
344     struct panel_module *panel_mod;                                             
345     struct tilcdc_module *mod;                                                  
346     struct pinctrl *pinctrl;                                                    
347     int ret;                                                                    
348     /* 如果没有设备树数据就直接跳出来 */                                                                           
349     /* bail out early if no DT data: */                                         
350     if (!node) {                                                                
351         dev_err(&pdev->dev, "device-tree data is missing\n");                   
352         return -ENXIO;                                                          
353     }                                                                           
354                                                                                 
355     panel_mod = devm_kzalloc(&pdev->dev, sizeof(*panel_mod), GFP_KERNEL);       
356     if (!panel_mod)                                                             
357         return -ENOMEM;                                                         
358                                                                                 
359     bl_node = of_parse_phandle(node, "backlight", 0);                           
360     if (bl_node) {                                                              
361         panel_mod->backlight = of_find_backlight_by_node(bl_node);              
362         of_node_put(bl_node);                                                   
363                                                                                 
364         if (!panel_mod->backlight)                                              
365             return -EPROBE_DEFER;                                               
366                                                                                 
367         dev_info(&pdev->dev, "found backlight\n");                              
368     }                                                                           
369                                                                                 
370     panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",      
371                              GPIOD_OUT_LOW);                                    
372     if (IS_ERR(panel_mod->enable_gpio)) {                                       
373         ret = PTR_ERR(panel_mod->enable_gpio);                                  
374         dev_err(&pdev->dev, "failed to request enable GPIO\n");                 
375         goto fail_backlight;                                                    
376     }                                                                           
377                                                                                 
378     if (panel_mod->enable_gpio)                                                 
379         dev_info(&pdev->dev, "found enable GPIO\n");                            
380                                                                                 
381     mod = &panel_mod->base;                                                     
382     pdev->dev.platform_data = mod;                                              
383                                                                                 
384     tilcdc_module_init(mod, "panel", &panel_module_ops);                        
385                                                                                 
386     pinctrl = devm_pinctrl_get_select_default(&pdev->dev);                      
387     if (IS_ERR(pinctrl))                                                        
388         dev_warn(&pdev->dev, "pins are not configured\n");                      
389     /*  对应时序的设置,和设备树中的display-timings 有关   */                                                                        
390     panel_mod->timings = of_get_display_timings(node);                          
391     if (!panel_mod->timings) {                                                  
392         dev_err(&pdev->dev, "could not get panel timings\n");                   
393         ret = -EINVAL;                                                          
394         goto fail_free;                                                         
395     }                                                                           
396      /*  对应的相关信息设置,跟panel-info 这个节点有关  */                                                                           
397     panel_mod->info = of_get_panel_info(node);                                  
398     if (!panel_mod->info) {                                                     
399         dev_err(&pdev->dev, "could not get panel info\n");                      
400         ret = -EINVAL;                                                          
401         goto fail_timings;                                                      
402     }                                                                           
403                                                                                 
404     mod->preferred_bpp = panel_mod->info->bpp;                                  
405                                                                                 
406     return 0;                                                                   
407                                                                                 
408 fail_timings:                                                                   
409     display_timings_release(panel_mod->timings);                                
410                                                                                 
411 fail_free:                                                                      
412     tilcdc_module_cleanup(mod);                                                 
413                                                                                 
414 fail_backlight:                                                                 
415     if (panel_mod->backlight)                                                   
416         put_device(&panel_mod->backlight->dev);                                 
417     return ret;                                                                 
418 }                                                                               /*  这是上面的 of_get_panel_info 传进来的 */
292 static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)      
293 {                                                                               
294     struct device_node *info_np;                                                
295     struct tilcdc_panel_info *info;                                             
296     int ret = 0;                                                                
297                                                                                 
298     if (!np) {                                                                  
299         pr_err("%s: no devicenode given\n", __func__);                          
300         return NULL;                                                            
301     }                                                                           
302                                                                                 
303     info_np = of_get_child_by_name(np, "panel-info");                           
304     if (!info_np) {                                                             
305         pr_err("%s: could not find panel-info node\n", __func__);               
306         return NULL;                                                            
307     }                                                                           
308                                                                                 
309     info = kzalloc(sizeof(*info), GFP_KERNEL);                                  
310     if (!info) {                                                                
311         pr_err("%s: allocation failed\n", __func__);                            
312         of_node_put(info_np);                                                   
313         return NULL;                                                            
314     }                                                                           
315     /*  这里我们可以看到,如果一个出错,ret 就会为真,这是上面的设备树的必需选项的配对  */                                                                           
316     ret |= of_property_read_u32(info_np, "ac-bias", &info->ac_bias);            
317     ret |= of_property_read_u32(info_np, "ac-bias-intrpt", &info->ac_bias_intrpt);
318     ret |= of_property_read_u32(info_np, "dma-burst-sz", &info->dma_burst_sz);  
319     ret |= of_property_read_u32(info_np, "bpp", &info->bpp);                    
320     ret |= of_property_read_u32(info_np, "fdd", &info->fdd);                    
321     ret |= of_property_read_u32(info_np, "sync-edge", &info->sync_edge);        
322     ret |= of_property_read_u32(info_np, "sync-ctrl", &info->sync_ctrl);        
323     ret |= of_property_read_u32(info_np, "raster-order", &info->raster_order);  
324     ret |= of_property_read_u32(info_np, "fifo-th", &info->fifo_th);            
325                                                                                 
326     /* optional: */ /*  这是可选选项,下面第二个则是时钟反转的选项。在设备中添加一个选项即可。 */                                                            
327     info->tft_alt_mode      = of_property_read_bool(info_np, "tft-alt-mode");   
328     info->invert_pxl_clk    = of_property_read_bool(info_np, "invert-pxl-clk"); 
329                                                                                 
330     if (ret) {                                                                  
331         pr_err("%s: error reading panel-info properties\n", __func__);          
332         kfree(info);                                                            
333         of_node_put(info_np);                                                   
334         return NULL;                                                            
335     }                                                                           
336     of_node_put(info_np);                                                       
337                                                                                 
338     return info;                                                                
339 }   /*  设备树修改 */47     panel {                                                                     48         compatible = "ti,tilcdc,panel";                                         49         status = "okay";                                                        50         pinctrl-names = "default";                                              51         pinctrl-0 = <&lcd_pins_s0>;                                             52         panel-info {                                                            53             ac-bias           = <255>;                                          54             ac-bias-intrpt    = <0>;                                            55             dma-burst-sz      = <16>;                                           56             bpp               = <16>;                                           57             fdd               = <0x80>;                                         58             sync-edge         = <0>;                                            59             sync-ctrl         = <1>;                                            60             raster-order      = <0>;                                            61             fifo-th           = <0>;                                            62             invert-pxl-clk    = <1>;    /* 添加这个选项设置为1 */                                        63         };重新编译设备树,重新启动,看效果。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/291807.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Cache占用过多内存导致Linux系统内存不足问题排查

问题描述Linux服务器内存使用量超过阈值&#xff0c;触发报警。问题排查首先&#xff0c;通过free命令观察系统的内存使用情况&#xff0c;显示如下&#xff1a;total used free shared buffers cached Mem: 24675796 24587144 88652 …

第2章 Python与数据分析

《Python数据分析基础教程》学习笔记。 第2章 Python与数据分析 2.1 Python数据分析常用的类库 类库是用来实现各种功能的类的集合。 -1. NumPy NumPy(Numerical Python)是Python科学计算的基础包&#xff0c;提供以下功能&#xff1a; 快速高效的多维数组对象ndarrray是其…

LSPCI具体解释分析

一、PCI简单介绍 PCI是一种外设总线规范。我们先来看一下什么是总线&#xff1a;总线是一种传输信号的路径或信道。典型情况是&#xff0c;总线是连接于一个或多个导体的电气连线&#xff0c;总 线上连接的全部设备可在同一时间收到全部的传输内容。总线由电气接口和编程接…

linux之ip route命令

1.基础知识 1.1 路由 &#xff08;Routing&#xff09; 1.1.1 路由策略 &#xff08;使用 ip rule 命令操作路由策略数据库&#xff09; 基于策略的路由比传统路由在功能上更强大&#xff0c;使用更灵活&#xff0c;它使网络管理员不仅能够根据目的地址而且能够根据报文大小、应…

违反Apache 2.0许可证再分发被指控,火山引擎回应

文 | 白开水不加糖出品 | OSC开源社区&#xff08;ID&#xff1a;oschina2013&#xff09;针对有关违反 Apache 2.0 许可证&#xff0c;重新发行 SkyWalking 的指控&#xff0c;火山引擎方面作出回应称&#xff1a;火山引擎相关负责人表示&#xff0c;火山引擎接到社区反馈后&a…

vue 日期格式化返回指定个数月份_vue过滤器实现日期格式化的案例分析

说明今天将要介绍的是vue中的过滤器&#xff0c;并且将实现一个日期格式化的小案例。大家都知道&#xff0c;我们获取当前日期可以通过Date对象获取。下面我将获取当前时间并打印出来。console.log(new Date());我们获取的是一个标准时间&#xff0c;控制台的输出如下所示。在实…

linux网络编程之IP协议首部格式与其配套使用的四个协议(ARP,RARP,ICMP,IGMP)和TCP、UDP协议头结构总结

首先声明,这篇博客是几篇博客转载然后总结在一起的,只当是学习笔记,不在意是什么原创和转载了,学到东西就好。 1、IP协议首部格式(IP协议处余网络层) IP数据报首部图片格式: 最高位在左边,记为0 bit;最低位在右边,记为31 bit 头部代码结构如下 //定义IP首部typede…

无线安全***--启程

无线安全将来会成为一个值得重视的领域&#xff0c;现在无线的普及大大的方便我们的生活&#xff0c;同时在带来的便利的同时也会给我带来新的威胁&#xff01;下面我来通过cdlinux以及BT5来演示现在比较常见的无线***之战。攻破解我们都知道现在的个人无线局域网基本都会使用w…

Java读取word文件,字体,颜色

在Android读取Word文件时&#xff0c;在网上查看时可以用tm-extractors&#xff0c;但好像没有提到怎么读取Word文档中字体的颜色&#xff0c;字体&#xff0c;上下标等相关的属性。但由于需要&#xff0c;要把doc文档中的内容&#xff08;字体&#xff0c;下划线&#xff0c;颜…

.NET 20周年软件趋势随想

从2000年微软启动.NET战略时&#xff0c;我还是一位大学生&#xff0c;当年著名的黑客Miguel de Icaza , Miguel 为了寻找GNOME项目开发框架经过充分的调研启动了一个志存高远的项目&#xff1a;Mono&#xff0c;一个Microsoft .NET Framework的自由GNU/Linux实现&#xff0c;我…

第二节 安装CentOS

Linux 第二节一、安装VNware workstation 10二、安装CentOS 1.root/123456 用户登录[rootlocalhost ~]# 2.关机 init 0 3.ifconfig -a:查询ip等信息 4.dhclient &#xff1a;生成自动获取IP 5.手动配置网卡&#xff1a;ipad./setup/编辑网卡配置文件&#xff1a; vi /etc/sysc…

c++ console 取实时输入_灵活使用 console 让 js 调试更简单

译者&#xff1a;前端小智原文&#xff1a; https://medium.com/mattburgess/beyond-console-log-2400fdf4a9d8https://medium.freecodecamp.org/10-tips-to-maximize-your-javascript-debugging-experience-b69a75859329Web开发最常用的高度就是 console.log &#xff0c;虽然…

windows之DNS7种资源记录和flushdns命令清除DNS缓存以及nslookup解析域名和ipconfig/all命令查看网络配置使用总结

1、DNS7种资源记录 DNS分为正向查找区域和反向查找区域&#xff0c;然后在分为&#xff0c;主要&#xff0c;辅助&#xff0c;存根区域&#xff0c;在这些区域里&#xff0c;又存在着很多的记录&#xff0c;今天&#xff0c;就让我们来看看这些记录&#xff1a;1&#xff0c;A记…

第2章 C语言概述

学习笔记——《C Primer Plus》 第2章 C语言概述2.1 简单的C程序实例2.2 实例解释2.2.1 快速概要1. #include指令和头文件2. main() 函数3. 声明4. 赋值5. printf() 函数5. return 语句2.3 简单程序的结构2.4 多个函数2.1 简单的C程序实例 #include <stdio.h> int main(…

KMP学习

2019独角兽企业重金招聘Python工程师标准>>> 从头到尾彻底理解KMP 字符串匹配的KMP算法 KMP算法的Next数组详解 package leetcode;import java.util.Arrays;public class ImplementStrStr {public int strStr(String haystack, String needle) {if(haystacknull||ne…

MVC应用程序实现文件库(FlexPaper)

很久之前Insus.NET在实现了《FlexPaper实现文档在线浏览》http://www.cnblogs.com/insus/archive/2011/07/21/2112369.html。 当时也只是实现了显示而已&#xff0c;也没有实现在线转换功能。现在&#xff0c;Insus.NET已经从asp.net转向了asp.net MVC应用程序开发了。因此再想…

海量数据处理面试题集锦

十七道海量数据处理面试题与Bit-map具体解释作者&#xff1a;小桥流水&#xff0c;redfox66&#xff0c;July。前言本博客内以前整理过有关海量数据处理的10道面试题&#xff08;十道海量数据处理面试题与十个方法大总结&#xff09;&#xff0c;此次除了反复了之前的10道面试题…

如何避免在迭代集合为 null 时抛出的空引用异常?

咨询区 Polaris878我在遍历集合时&#xff0c;经常会遇到集合为 null 的情况&#xff0c;比如下面这样&#xff1a;int[] returnArray Do.Something(...);拿到数组后&#xff0c;接下来我用下面的方式进行遍历。foreach (int i in returnArray) {// do some more stuff }说实话…

java之解析DNS的SRV记录

1、导入相应的jar包 导入sjava-2.1.6.jar包&#xff0c;今天上传资源有问题&#xff0c;下次传了之后再补充到这里。 2、关键代码 public static List<String> resoveSrv(String query) {// String s "ramuh.example.com"; // the inputted string, I …

c#队列取值_C# 队列

1 Queue23 usingSystem;4 usingSystem.Collections.Generic;5 usingSystem.Linq;6 usingSystem.Text;7 usingSystem.Threading;89 namespaceDataStructure10 {11 /// 12 ///队列接口13 /// 14 interface IQueue15 {16 void EnQueue(T elem); //入队列操作17 T DeQueue(); //出队…