当前位置:网站首页>LCD notes (4) analyze the LCD driver of the kernel
LCD notes (4) analyze the LCD driver of the kernel
2022-07-26 12:31:00 【Cui Guo broke her mouth】
1. Driver framework
Linux The driver = Driver framework + Hardware programming . Based on QEMU Write the LCD The driver , Yes LCD The framework of the driver has been analyzed clearly . The core is :
Distribute fb_info
Set up fb_info
register fb_info
Hardware related settings
1.1 Entry function registration platform_driver

1.2 The device tree has corresponding nodes

2. Write hardware related code
We just need to focus on IMX6ULL Writing hardware related code , involve 3 part :
GPIO Set up
LCD Pin
Backlight pin
The clock is set
determine LCD The clock of the controller
according to LCD Of DCLK Calculate the relevant clock
LCD The setting of the controller itself
Setting up Framebuffer The address of
Set up Framebuffer Data format in 、LCD data format
Set the timing
2.1 GPIO Set up
There are two ways :
Read and write related registers directly
Use the device tree , Set... In the device tree pinctrl
This course focuses on LCD, So use pinctrl Simplify procedures
2.2 The clock is set
IMX6ULL Of LCD Controller involves 2 A clock :
The code of the clock subsystem is directly used in the code .
Specify the frequency in the device tree :
file :arch/arm/boot/dts/100ask_imx6ull-14x14.dts
Code :clock-frequency
Get... From the device tree dot clock, Deposit in display_timing
file :drivers\video\of_display_timing.c
Code :
ret |= parse_timing_property(np, "clock-frequency", &dt->pixelclock);
Use display_timing To set up videomode
file :drivers\video\videomode.c
Code :
void videomode_from_timing(const struct display_timing *dt,
struct videomode *vm)
{
vm->pixelclock = dt->pixelclock.typ;
vm->hactive = dt->hactive.typ;
vm->hfront_porch = dt->hfront_porch.typ;
vm->hback_porch = dt->hback_porch.typ;
vm->hsync_len = dt->hsync_len.typ;
vm->vactive = dt->vactive.typ;
vm->vfront_porch = dt->vfront_porch.typ;
vm->vback_porch = dt->vback_porch.typ;
vm->vsync_len = dt->vsync_len.typ;
vm->flags = dt->flags;
}according to videomode Value , Use the functions of the clock subsystem to set the clock :
file :drivers\video\fbdev\mxc\ldb.c

2.3 LCD Configuration of the controller
Take setting the resolution as an example .
Specify the resolution in the device tree :
file :arch/arm/boot/dts/100ask_imx6ull-14x14.dts
Code :clock-frequency
display-timings {
native-mode = <&timing0>;
timing0: timing0_1024x768 {
hactive = <1024>;
vactive = <600>;Get the resolution from the device tree , Deposit in display_timing
file :drivers\video\of_display_timing.c
Code :
ret |= parse_timing_property(np, "hactive", &dt->hactive);
ret |= parse_timing_property(np, "vactive", &dt->vactive);Use display_timing To set up videomode
file :drivers\video\videomode.c
Code :
void videomode_from_timing(const struct display_timing *dt,
struct videomode *vm)
{
vm->hactive = dt->hactive.typ;
vm->vactive = dt->vactive.typ;according to videomode Value , Set up fb_videomode
file :drivers\video\fbdev\core\fbmon.c
Code :
int fb_videomode_from_videomode(const struct videomode *vm,
struct fb_videomode *fbmode)
{
unsigned int htotal, vtotal;
fbmode->xres = vm->hactive;
fbmode->yres = vm->vactive;according to fb_videomode Value , Set up fb_info Medium var:
file :drivers\video\fbdev\core\modedb.c
Code :
void fb_videomode_to_var(struct fb_var_screeninfo *var,
const struct fb_videomode *mode)
{
var->xres = mode->xres;
var->yres = mode->yres;according to var The resolution of the , Set register
file :drivers\video\fbdev\mxsfb.c
Code :
writel(TRANSFER_COUNT_SET_VCOUNT(fb_info->var.yres) |
TRANSFER_COUNT_SET_HCOUNT(fb_info->var.xres),
host->base + host->devdata->transfer_count);边栏推荐
- Use the jsonobject object in fastjason to simplify post request parameter passing
- .eslintrc.js configuration description
- 论文阅读-MLPD:Multi-Label Pedestrian Detector in Multispectral Domain(海康威视研究院实习项目)
- 详解勒让德变换与共轭函数
- Notes....
- 2022.7.23 ------ leetcode. Jianzhi offer.115
- Ubenwa, a start-up under Mila, received an investment of US $2.5 million to study the AI diagnosis of infant health
- The map function counts the number of occurrences of characters
- 如何组装一个注册中心?
- MATLAB中strjoin函数使用
猜你喜欢

STM32 drives hc05 Bluetooth serial port communication module

Transformer dominates the world? Depth wise conv has something to say

HCIP-9.OSPF的各种拓展

RFID的工作原理

el-form 每行显示两列,底部按钮居中

连锁店收银系统如何帮助鞋店管理好分店?

Sim900a based on STM32 sends short messages in Chinese and English

3D point cloud course (VIII) -- feature point matching

羽毛球馆的两个基础设施你了解多少?

Detailed interpretation of hole convolution (input and output size analysis)
随机推荐
File类的学习过程中出现的问题及解决方法
儿童玩乐场所如何运营?
数据库组成存储过程和函数
Flink's real-time data analysis practice in iFLYTEK AI marketing business
How RFID works
VS code 设置Ctrl+S保存,自动格式化的方法
You Yuxi recommends vite to beginners [why use vite]
FPGA入门学习(二) - 二选一的选择器
Interview JD T5, was pressed on the ground friction, who knows what I experienced?
2022.7.23 ------ leetcode. Jianzhi offer.115
Why is redis so fast? Redis threading model and redis multithreading
[wechat applet] read the article, data request
How to view encrypted information in text form
三维点云课程(八)——特征点匹配
【Mysql约束】
HTAP是有代价的
Ds-112 time relay
代码报错解决问题经验之二:YOLOv5中的test报错
Here blog: running a large language model in a production environment - overview of the reasoning framework
What is the Internet of things? The most comprehensive explanation of common IOT protocols