经过前面的移植,我们的板子已经可以成功进入linux,但是这个时候看不到画面的,还需要进一步调通LCD显示和触摸屏驱动。
1.uboot环境变量。
为了LCD能显示需要如下设置uboot变量:
$setenv mynetargs 'setenv bootargs console=${console},${baudrate} ${smp} video=${myvideo} root=/dev/nfs ip=dhcp rw nfsroot=${serverip}:${nfsroot},v3,tcp''
$setenv myvideo 'mxcfb0:dev=lcd,CLAA-WVGA,if=RGB24'
2.修改dts。
mxcfb1,2,4分别是ldb,hdmi,ldb接口,只有mxxcfb3是lcd接口,所以紧保留mxcfb3打开。
$vi arch/arm/boot/dts/imx6q-sabresd.dts
修改如下内容:
&mxcfb1 {
status = "disabled";
};
&mxcfb2 {
status = "disabled";
};
&mxcfb3 {
status = "okay";
};
&mxcfb4 {
status = "disabled";
};
&sata {
status = "okay";
};
$vi arch/arm/boot/imx6qdl-sabresd.dtsi
如上设置了uboot环境变量则该文件下面两处通常不用再修改,如果颜 {MOD}或分辨率不对,则修改如下:
mxcfb3: fb@2 {
compatible = "fsl,mxc_sdc_fb";
disp_dev = "lcd";
interface_pix_fmt = "RGB24";
//把默认 {MOD}彩格式从RGB565改成RGB24
mode_str ="CLAA-WVGA";
default_bpp = <16>;
int_clk = <0>;
late_init = <0>;
status = "disabled";
};
lcd@0 {
compatible = "fsl,lcd";
ipu_id = <0>;
disp_id = <0>;
default_ifmt = "RGB24";
//把默认 {MOD}彩格式从RGB565改成RGB24
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu1>;
status = "okay";
};
此时进入系统会不断报max11801的错误,这是因为NXP的imx6q sabresd板子用的触摸芯片是max11801而天嵌E9则不是,查看原理图E9板子上触摸控制芯片并没有焊接,而是直接在LCD显示屏排线中留了用于触摸芯片通讯的I2C两管脚以及触摸芯片的中断管脚和使能管脚,我手上的天嵌配套屏幕是7存LCD电容屏,查看天嵌源码发现天嵌提供触摸驱动只是个module文件,可以在屏幕版面背面找到ft5216芯片,这个就是这里实际的触摸芯片,在内核中搜索并没有该芯片,只是找到了个ft5x06的驱动,实测该驱动可用于ft5216,结合Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt文件做如下修改:
$vi arch/arm/boot/dts/imx6qdl-sabresd.dtsi
mma8451@1c {
compatible = "fsl,mma8451";
reg = <0x1c>;
position = <0>;
vdd-supply = <®_sensor>;
vddio-supply = <®_sensor>;
interrupt-parent = <&gpio1>;
interrupts = <18 8>;
interrupt-route = <1>;
};
ft5216@38 {
//在i2c节点下添加ft5216配置节点
compatible = "edt,edt-ft5206";
reg = <0x38>;
interrupt-parent = <&gpio1>;
interrupts = <9 0>;
status = "okay";
};
3.修改内核
$source /opt/fsl-imx-x11/4.1.15-2.0.1/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
$make menuconfig
取消max11801驱动
Symbol: TOUCHSCREEN_MAX11801 [=n]
Type : tristate
Prompt: MAX11801 based touchscreens
Location:
-> Device Drivers
-> Input device support
-> Generic input layer (needed for keyboard, mouse, ...) (INPUT [=y])
-> Touchscreens (INPUT_TOUCHSCREEN [=y])
[*]选中ft5x06驱动
Symbol: TOUCHSCREEN_EDT_FT5X06 [=y]
Type : tristate
Prompt: EDT FocalTech FT5x06 I2C Touchscreen support
Location:
-> Device Drivers
-> Input device support
-> Generic input layer (needed for keyboard, mouse, ...) (INPUT [=y])
-> Touchscreens (INPUT_TOUCHSCREEN [=y])
Defined at drivers/input/touchscreen/Kconfig:597
Depends on: !UML && INPUT [=y] && INPUT_TOUCHSCREEN [=y] && I2C [=y]
重新生成dtb和zImage
$make imx6q-sabresd.dtb
$make zImage
$cp arch/arm/boot/imx6q-sabresd.dtb arch/arm/boot/zImage /opt/tftpboot/
重启板子,即可进入qt5视窗,校准触摸后,触摸屏幕光标可移动。