Linux-2.6.26.5 transplantation LCD Driver LCD touch screen driver tslib-1.4
Before using tslib, your kernel must have an LCD driver and a touch screen driver,
This is an LCD Driver transplant:
(1) Add header files in arch/ARM/mach-s3c2410/mach-smdk2410.c:
# Include <ASM/ARCH/FB. h>
(2) Add the following information to the ARCH/ARM/plat-s3c24xx/common-smdk.c file:
Static struct s3c2410fb_display qt2410_ LCD _cfg [] _ initdata = {
{
. Lcdcon5 = s3c2410_lcdcon5_frm565 |
S3c2410_lcdcon5_invvclk |
S3c2410_lcdcon5_invvline |
S3c2410_lcdcon5_invvframe |
S3c2410_lcdcon5_pwren |
S3c2410_lcdcon5_hwswp,
. Type = s3c2410_lcdconw.tft,
. Width = 320,
. Size = 240,
. Pixclock = 100000,/* hclk/10 */
. Xres = 320,
. Yres = 240,
. Bpp = 16,
. Left_margin = 13,
. Right_margin = 8,
. Hsync_len = 4,
. Upper_margin = 2,
. Lower_margin = 7,
. Vsync_len = 4,
}
};
Static struct s3c2410fb_mach_info qt2410_fb_info _ initdata = {
. Displays = qt2410_ LCD _cfg,
. Num_displays = array_size (qt2410_ LCD _cfg ),
. Default_display = 0,
. Lpcsel = (0xce6 )&~ 7) | 1 <4,
};
Add the following in the smdk_machine_init function:
S3c24xx_fb_set_platdata (& qt2410_fb_info );
(3) Reconfigure the kernel
Root @ farsight:/source/kernel/linux-2.6.26.5 # Make menuconfig
Device Drivers ---> graphics support --->
<*> S3C2410 LCD framebuffer support [] S3C2410 LCD debug messages <*> Virtual Frame Buffer support (only for testing !)
Logo configuration --->
[*] Bootup logo [*] Standard black and white Linux logo [*] standard 16-colo rlinux logo [*] standard 224-color Linux logo
(4) recompile the kernel
Replaying Development Board
At this time, there will be a cute little penguin logo. This indicates that your driver has been successfully transplanted.
Development Board of fs2410 Based on linux-2.26.5 Kernel
The transplantation process based on linux-2.6.26.5 kernel S3C2410 touch screen driver is recorded below:
(1) first Patch: s3c2410_touchscreen.patch, and then modify ARCH/ARM/mach-s3c2410/mach-smdk2410.c to add the following code: Add header file: # include <ASM/ARCH/ts. h>
Add struct: static struct s3c2410_ts_mach_info smdk2410_ts_cfg _ initdata = {
. Delay= 20000,
. Presc = 49,
. Oversampling_shift = 2,
};
Add information that supports the code of the touch screen platform. Find a struct pointer array named * smdk2410_devices [] and add the following to the struct pointer array: & initi_device_ts. Then add set_s3c2410ts_info (& smdk2410_ts_cfg );
Modify driver/input/touchscreen/makefile and add the following content:
OBJ-$ (config_touchscreen_s3c2410) + = s3c2410_ts.o
Then, place the driver s3c2410_ts.c under driver/input/touchscreen/. Next, configure the kernel to support touch screen driver make menuconfig and support touch-level driver.
Device Drivers ---> input device support ---> [*] touchscreens --->
<*> Samsung S3C2410 touchscreen input driver
[*] Samsung S3C2410 touchscreen debug messages
Then make zimage. Of course, we must first support framebuffer.
After the system starts, event0 and mouse0 device nodes are generated in the dev directory, which are the device nodes of the touch screen.
For details about the two patches: s3c2410_touchscreen.patch and s3c2410_ts.c, please download them at this address. If not, please contact me and I will send them to you.
My mailbox is: linweig@126.com
Http://www.rayfile.com/files/09d713cc-dd96-11dd-9f5d-0014221b798a/
Download tslib-1.4.tar.gz. Some source code packages downloaded from the Internet are incorrect. You must find the source code package. You can download it from the csdn website;
If not, I can also send you; my mailbox is: linweig@126.com
Step 1: Decompress tslib-1.4.tar.gz
Tar-zxvf tslib-1.4.tar.gz
Step 2: Enter the decompressed directory
CD tslib-1.4
Step 3: Run autogen. Sh under the tslib-1.4 directory
./Autogen. Sh
Step 4: Execute the MAKEFILE file generated by the autogen. Sh script
The following error occurs when executing make:
Ts_test.o (. Text 0x218): In function 'main': Undefined reference to 'rpl _ malloc'
Find rpl_malloc in the current directory, and find that there is a line of # define malloc rpl_malloc in configure. Analyze configure script related code, the original is ac_cv_func_malloc_0_nonnull caused, OK we won't let it check, generate a cache file arm-linux.cache, cheat configure:
Run the following command:
Echo "ac_cv_func_malloc_0_nonnull = yes"> $ ARCH-linux.cache
./Configure -- Host = arm-softfloat-Linux-GNU -- prefix =/home/Noah/mytslib -- cache-file = $ ARCH-linux.cache
-- Host refers to the first and most of your cross compilers. For example, if your cross compiler is arm-Linux-GCC, -- Host = arm-Linux. for example, arm-softfloat-Linux-GNU-gcc
-- Host = arm-softfloat-Linux-GNU
-- Prefix is the executable file and library file generated after compilation when you execute make install and the directory where the configuration file is installed;
There are many options in the configure file; you can execute./configure-help to select other options, but here these options are enough.
Step 5: Execute make
Step 6: Execute make install
Step 7: Copy all mytslib files under the specified installation directory to the root file you have mounted.
Sudo CP-RF/home/Noah/mytslib/*/rootfs/mytslib
Step 8: Modify the Ts. Cong file in the etc directory under/rootfs/mytslib
VI ts. conf: change # module_raw input in the second line to module_raw input. Note that the # module_raw input must be written in the top level; otherwise, the Ts. conf reading error will occur during program execution.
Step 9: Start Your Development Board
Set the environment variables on the terminal:
Export tslib_root =/mytslib
Export tslib_tsdevice =/dev/event0
Export LD_LIBRARY_PATH =/mytslib/lib: $ LD_LIBRARY_PATH
Export qws_size = 320x240
Export tslib_fbdevice =/dev/fb0
Export tslib_plugindir =/mytslib/lib/TS
Export tslib_consoledevice = none
Export tslib_conffile =/mytslib/etc/ts. conf
Export pointercal_file =/etc/pointercal
Export qws_mouse_proto = tslib:/dev/event0
Export tslib_calibfile =/etc/pointercal
Export qws_display = "linuxfb: mmwidth100: mmheight130: 0"
Export tslib_tseventtyype = h3600
To run tslib correctly, you need to configure the following tslib environment variables:
Tslib_tsdevice // The Name Of The touch screen device.
Tslib_calibfile // The calibration data file, which is generated by the ts_calibrate calibration program.
Slib_conffile // configure the file name.
Tslib_plugindir // plug-in Directory
Tslib_consoledevice // console device file name
Tslib_fbdevice // device name
The actual configuration of the preceding environment variables in actual development can be determined based on the actual situation. These specified device nodes must be connected to your Development Board.
Corresponding to the device node in the/dev directory.
Step 10: run the test file under/rootfs/mytslib/bin.
./Ts_test