I have had a few messages that calibration is not possible because the package TSCalibration2 is not part of the system. I recall that I deleted this but can’t remember where it was located. Doing a search on the original Olimex code finds nothing.
The good new is that there is only 1 change required to add the calibration to the build. See below where I have added this to the olinuxino-a20,mk file
A number of people have been asking on the Olimex forum on how to get the Olimex 7″ LCD working with resistive touch.
As my source uses the Fusion F07A-0102 I thought I would help in how to make changes to the build to swap to the sun7i touch.
As long as you can build my source, you do not have to make any changes to the linux kernel as I left the module build in there for both touch panels. Display driver timing and touch select is a simple change to the FEX file and comment and uncomment in the init file. Here is the process.
Open the FEX file in the following directory:
Locate the entry [rtp_para] and make sure rtp_used=1
Locate the entry [ctp_para] and make sure ctp_used=0
Locate the entry [lcd0_para] and set the values as this:
[lcd0_para] lcd_used = 1 lcd_x = 800 lcd_y = 480 lcd_dclk_freq = 33 lcd_pwm_not_used = 0 lcd_pwm_ch = 0 lcd_pwm_freq = 10000 lcd_pwm_pol = 1 lcd_if = 0 lcd_hbp = 46 lcd_ht = 1055 lcd_vbp = 23 lcd_vt = 1050 lcd_hv_if = 0 lcd_hv_smode = 0 lcd_hv_s888_if = 0 lcd_hv_syuv_if = 0 lcd_hv_vspw = 1 lcd_hv_hspw = 30 lcd_lvds_ch = 0 lcd_lvds_mode = 0 lcd_lvds_bitwidth = 0 lcd_lvds_io_cross = 0 lcd_cpu_if = 0 lcd_frm = 1 lcd_io_cfg0 = 268435456 lcd_gamma_correction_en = 0 lcd_gamma_tbl_0 = 0x0 lcd_gamma_tbl_1 = 0x10101 lcd_gamma_tbl_255 = 0xffffff lcd_bl_en_used = 1 lcd_bl_en = port:PH07<1><0><default><1> lcd_power_used = 1 lcd_power = port:PH08<1><0><default><1> lcd_pwm_used = 1 lcd_pwm = port:PB02<2><0><default><default>
Locate the file init.sun7i.rc in the android4.2/device/softwinner/olinuxino-a20 directory and edit the following line to remove the comment. (delete the #) It will be around line 212
This will start the sun7i touch screen driver using the ANALOG inputs on the CPU.
Comment out this line at around line 215
# insmod /system/vendor/modules/fusion_F0710A.ko
This will disable the CTP driver that I use for capacitive touch.
In the same directory, edit the olinuxino-a20.mk file as below. This is around line 24. The last line here will be fusion_F0710A.ko so change this to sunxi_ts.ko as below.
# for recovery PRODUCT_COPY_FILES += \ device/softwinner/olinuxino-a20/recovery.fstab:recovery.fstab \ device/softwinner/olinuxino-a20/modules/modules/disp.ko:disp.ko \ device/softwinner/olinuxino-a20/modules/modules/lcd.ko:lcd.ko \ device/softwinner/olinuxino-a20/modules/modules/hdmi.ko:hdmi.ko \ device/softwinner/olinuxino-a20/modules/modules/hdcp.ko:hdcp.ko \ device/softwinner/olinuxino-a20/modules/modules/sw_device.ko:sw_device.ko \ device/softwinner/olinuxino-a20/modules/modules/sunxi_ts.ko:sunxi_ts.ko
Open the olinuxino-a20.mk file in the device/softwinner/olinuxino-a20 directory and insert the TSCalibration2 file here. It will autostart when Android starts if there is no calibration data. This will create a file called POINTERCAL in the data directory so you can get it to recalibrate on power up by deleting this file.
PRODUCT_PACKAGES += \ gps.exDroid \ TSCalibration2 \ TelephonyProvider
Now build the Android source with make -j4 and then pack and you should now have an image that will use the resistive touch and drive the LCD with the correct timing. If your LCD is slightly different, you make need to change the FEX settings and then run pack again. No need to do any build if only making changes to the FEX file.