Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of lcd driver Writing in linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the example analysis written by the lcd driver in linux, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Some embedded devices, such as routers, do not require lcd. However, there are other devices that require lcd to display content, such as game consoles, testers, smartwatches, and so on. So, today we'll look at how the lcd driver works on linux.

1. Code directory

Drivers/video

2. View the Makefile file under video

# SPDX-License-Identifier: GPL-2.0obj-$ (CONFIG_VGASTATE) + = vgastate.oobj-$ (CONFIG_HDMI) + = hdmi.oobj-$ (CONFIG_VT) + = console/obj-$ (CONFIG_FB_STI) + = console/obj-$ (CONFIG_LOGO) + = logo/obj-y + = backlight/obj-y + = fbdev/obj-$ (CONFIG_VIDEOMODE_HELPERS) + = display_timing.o videomode.oifeq ($(CONFIG_OF)) Y) obj-$ (CONFIG_VIDEOMODE_HELPERS) + = of_display_timing.o of_videomode.oendif

3. Fbdev is compiled by default. In general, we only need to look at this directory.

Config FB_S3C2410 tristate "S3C2410 LCD framebuffer support" depends on FB & & ARCH_S3C24XX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT-help--- Frame buffer driver for the built-in LCD controller in the Samsung S3C2410 processor. This driver is also available as a module (= code which can be inserted and removed from the running kernel whenever you want). The module will be called s3c2410fb. If you want to compile it as a module, say M here and read. If unsure, say N.config FB_S3C2410_DEBUG bool "S3C2410 lcd debug messages" depends on FB_S3C2410 help Turn on debugging messages. Note that you can set/unset at run time through sysfs

4. Taking s3c2410 as an example, it is concluded that the macro that its lcd mainly depends on is FB_S3C2410.

Obj-y + = core/obj-$ (CONFIG_FB_S3C2410) + = s3c2410fb.o

5. Except that core is compiled by default, we only need to look at the file s3c2410fb.c

Static struct platform_driver s3c2410fb_driver = {.probe = s3c2410fb_probe, .remove = s3c2410fb_remove, .probe = s3c2410fb_suspend, .driver = s3c2410fb_resume, .driver = {.name = "s3c2410-lcd",},}; static struct platform_driver s3c2412fb_driver = {.probe = s3c2412fb_probe, .remove = s3c2410fb_remove, .probe = s3c2410fb_suspend, .remove = s3c2410fb_resume, .driver = {.name = "s3c2412-lcd",} Int _ init s3c2410fb_init (void) {int ret = platform_driver_register (& s3c2410fb_driver); if (ret = = 0) ret = platform_driver_register (& s3c2412fb_driver); return ret;}

6. Not surprisingly, this is another platform device, and then take a look at what its probe function does

Ret = register_framebuffer (fbinfo); if (ret)

< 0) { dev_err(&pdev->

Dev, "Failed to register framebuffer device:% d\ n", ret); goto free_cpufreq;}

7. The most important thing in the whole code is this register action. Of course, we should also read whether there are other function interfaces.

Static struct fb_ops s3c2410fb_ops = {.owner = THIS_MODULE, .fb _ check_var = s3c2410fb_check_var, .fb _ set_par = s3c2410fb_set_par, .fb _ blank = s3c2410fb_blank, .fb _ setcolreg = s3c2410fb_setcolreg, .fb _ fillrect = cfb_fillrect, .fb _ copyarea = cfb_copyarea, .fb _ imageblit = cfb_imageblit,}

In the end, it is the same rule to see if there are any interruptions that need to be dealt with.

Ret = request_irq (irq, s3c2410fb_irq, 0, pdev- > name, info)

9. The following words

Many students think that the driver is very complicated, in fact, it is some format code. Master the basic structure, coupled with chip manuals, hardware protocols, general drivers can be learned in a very short time, there is no problem. In particular, soc, which has been on the market for many years, can be used directly without change. Of course, if we do find a problem, we should also have the ability of debug. There are a lot of contents in the drivers directory, but there is not much you need to know and care about. Just work hard to solve the problem.

The above is all the contents of the article "sample Analysis written by lcd drivers in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report