当前位置:网站首页>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);边栏推荐
- 可移动表空间
- 14.2字节流学习
- Pytorch深度学习快速入门教程 -- 土堆教程笔记(一)
- Map函数统计字符出现的次数
- Detailed interpretation of hole convolution (input and output size analysis)
- Data query where
- [Anhui University] information sharing of postgraduate entrance examination and re examination
- 基于STM32的SIM900A发送中文和英文短信
- 如何组装一个注册中心?
- Oracle AWR 报告脚本:SQL ordered by Elapsed Time
猜你喜欢

行业案例|指标中台如何助力银行业普惠金融可持续发展

基于STM32的SIM900A发送中文和英文短信

Use and optimization of MySQL composite index (multi column index)

FPGA入门学习(一) - 第一个FPGA工程

Removable tablespace

一款超好用的神器Apifox,甩 Swagger 几条街...(荣耀典藏版)

自定义浏览器默认右击菜单栏

三维点云课程(八)——特征点匹配

.NET WebAPI 使用 GroupName 对 Controller 分组呈现 Swagger UI

使用fastJson中的JSONObject对象简化POST请求传参
随机推荐
Hit the blackboard and draw the key points: a detailed explanation of seven common "distributed transactions"
File类的学习过程中出现的问题及解决方法
儿童玩乐场所如何运营?
[Anhui University] information sharing of postgraduate entrance examination and re examination
如何以文本形式查看加密过的信息
X.509、PKCS文件格式介绍
Dry goods semantic web, Web3.0, Web3, metauniverse, these concepts are still confused? (medium)
JDBC从连接池获取连接(Druid连接池)
Emerging security providers to learn about in 2022
Minesweeping games - easy to play addictive (C language version)
Microsoft has shut down two attack methods: Office macro and RDP brute force cracking
Why is redis so fast? Redis threading model and redis multithreading
MySQL之数据查询(聚合函数)
Backtracking - 131. Split palindrome string
数智转型,管理先行|JNPF全力打造“全生命周期管理”平台
Interviewer: how to deal with high concurrency?
Notes....
酷早报:7月25日Web3加密行业新闻大汇总
代码报错解决问题经验之二:YOLOv5中的test报错
yolov7训练危险品识别 pytorch