linux设备树-LCD驱动程序
Posted 大奥特曼打小怪兽
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux设备树-LCD驱动程序相关的知识,希望对你有一定的参考价值。
一、修改设备树
1.1 硬件接线
1.2 修改s3c2440-pinctrl.dtsi
修改内核arch/arm/boot/dts/s3c2440-pinctrl.dtsi文件,在pinctrl节点下添加两个引脚配置节点:
lcd_pinctrl: lcd_pinctrl samsung,pins = "gpc-8", "gpc-9", "gpc-10", "gpc-11", "gpc-12", "gpc-13", "gpc-14", "gpc-15", "gpd-0", "gpd-1", "gpd-2", "gpd-3", "gpd-4", "gpd-5", "gpd-6", "gpd-7", "gpd-8", "gpd-9", "gpd-10", "gpd-11", "gpd-12", "gpd-13", "gpd-14", "gpd-15", "gpc-1", "gpc-2", "gpc-3", "gpc-4"; samsung,pin-function = <EXYNOS_PIN_FUNC_2>; ; lcd_backlight: lcd_backlight samsung,pins = "gpg-4"; samsung,pin-function = <3>; ;
lcd_pinctrl:配置GPC8、GPC9、GPC10等引脚功能为LCD。
lcd_backlight:配置GPG4引脚功能为LCD电源。
1.3 修改s3c2440-smdk2440.dts
在内核arch/arm/boot/dts/s3c2440-smdk2440.dts文件中添加fb0设备节点:
fb0: fb@4d000000 compatible = "tq2440,lcd"; reg = <0x4D000000 0x60>; interrupts = <0 0 16 3>; clocks = <&clocks HCLK_LCD>; clock-names = "lcd"; pinctrl-names = "default"; pinctrl-0 = <&lcd_pinctrl &lcd_backlight>; status = "okay"; lcdcon5 = <0xb09>; type = <0x60>; width = /bits/ 16 <480>; height = /bits/ 16 <272>; pixclock = <100000>; xres = /bits/ 16 <480>; yres = /bits/ 16 <272>; bpp = /bits/ 16 <16>; left_margin = /bits/ 16 <2>; right_margin =/bits/ 16 <2>; hsync_len = /bits/ 16 <41>; upper_margin = /bits/ 16 <2>; lower_margin = /bits/ 16 <2>; vsync_len = /bits/ 16 <10>; ;
当platform设备和驱动匹配,就会调用pinctrl_bind_pins函数,该函数通过调用pinctrl_lookup_state函数获取状态名为default和init的状态,并分别保存到default_state和init_state成员变量中。如果找不到init状态,则选择default状态作为设备引脚的状态。
二、修改驱动程序
参考文章
[6]tq2440_dt/drivers/video/fbdev/s3c2410fb.c
[7] tq2440_dt/arch/arm/boot/dts/s3c2440-tq2440-dt.dts
Linux MIPI DSI驱动调试笔记-设备树DCS格式序列之配置LCD初始化代码
1、MIPI LCD初始化序列描述
在上一篇文章中,我们看到荣品的屏设备树中有这么一段代码,但是里面的数据是什么含义呢?
panel-init-sequence = [
05 78 01 11
05 78 01 29
];
今天来详细记录下我学习在设备树中适配MIPI-DSI LCD
初始化代码的详细过程。Linux提供了配置初始化代码的接口,相应的设备树也就支持了,这部分在内核的文档里有写:
kernel/Documentation/devicetree/bindings/display/panel/simple-panel.txt
这个文档里简单描述了一下:
- panel-init-sequence:
- panel-exit-sequence:
A byte stream formed by simple multiple dcs packets.
byte 0: dcs data type
byte 1: wait number of specified ms after dcs command transmitted
byte 2: packet payload length
byte 3 and beyond: number byte of payload
翻译过来大概的意思是:
以上是关于linux设备树-LCD驱动程序的主要内容,如果未能解决你的问题,请参考以下文章
Linux MIPI DSI驱动调试笔记-设备树DCS格式序列之配置LCD初始化代码
Linux MIPI DSI驱动调试笔记-设备树DCS格式序列之配置LCD初始化代码
Linux MIPI DSI驱动调试笔记-LCD时序参数配置