LeMaker Guitar:LCD

From BananaPro/Pi
Revision as of 18:32, 15 June 2016 by Super (Talk | contribs)

Jump to: navigation, search
Other languages:
English • ‎中文(简体)‎

介绍

LVDS (Low-voltage differential signaling), 也叫做 TIA/EIA-644。LVDS 的工作电压低,运行速度高,可以使用较便宜的双绞线传输数据。LeMaker Guitar 默认支持7寸LCD屏。并且HDMI作为主显示设备,LCD作为从显示设备。如果你要使用其它尺寸的LCD屏,需要参考下面的教程修改相关的配置文件。为了让LCD得到更好的显示效果,建议将LCD设置为主显示设备。
更多显示相关的教程,请参考链接:http://wiki.lemaker.org/LeMaker_Guitar:The_instructions_on_display/zh-hans


Linux系统

10.1寸LCD触摸屏

有两种方法支持10.1寸触摸屏。一种方法是直接下载支持10.1寸LCD的Linux系统平台固件包,然后更新系统固件即可;另一种方法是修改LeMaker Guitar BSP源码中的LCD相关的配置文件(uboot和kernel dts文件),并重新编译和生成新的固件包,然后更新系统固件。

基于固件包

第1步: 下载Linux platform firmware package
我们可以从github上下载已经编译好的支持10.1寸LCD显示屏的平台固件包. 下载方法如下:

sudo apt-get update
sudo apt-get install git
sudo mkdir -p /home/lemaker/git
cd /home/lemaker/git
git clone https://github.com/LeMaker/hwpack-actions


第2步: 提取Linux platform firmware package

sudo -s
cd hwpack-actions/lemaker_guitar
tar Jxvf lemaker_guitar_hwpack_lcd101_v1604.tar.xz

lemaker_guitar_hwpack_lcd101_v1604.tar.xz是支持10.1寸LCD显示屏的固件。


第3步: 更新u-boot

cd bootloader
sudo dd if=u-boot-dtb.img of=/dev/mmcblkX bs=512 seek=6144
sync

注意: 假设我们已经在eMMC中安装了操作系统,如果是从SD卡启动系统,mmcblkX表示 mmcblk1;如果从EMMC启动系统,mmcblkX表示mmcblk0


第4步: 更新misc.img

cd ../kernel/
sudo dd if=misc.img of=/dev/mmcblk0p1
sync

or

cd ../kernel/
sudo mkdir /mnt/misc1
sudo mkdir /mnt/misc2
sudo mount -o loop misc.img /mnt/misc1
sudo mount /dev/mmcblk0p1 /mnt/misc2
sudo cp -a /mnt/misc1/* /mnt/misc2/
sync
sudo umount  /mnt/misc1
sudo umount  /mnt/misc2


第5步: 更新驱动模块

cd ../rootfs/
sudo rm -rf /lib/modules
sudo cp -rf lib/* /lib/


Step 6: Reboot system, and then load touchscreen module dirver
We can use the command lsmod to list all driver modules that have been loaded. If we can't find ctp_gt9xx touchscreen driver module, we should type the below command:

sudo reboot
 
sudo modprobe ctp_gt9xx

如果你想每次启动LeMaker Guitar都加载触摸屏驱动,我们应该编辑文件 /etc/modules,添加下面内容

ctp_gt9xx

并且编辑文件/etc/modprobe.d/blacklist-guitar.conf,删除下面的内容:

blacklist ctp_gt9xx

注意:mmcblkX表示mmcbkl0mmcblk1。当操作系统从eMMC NAND Flash启动, /dev/mmcblk0是eMMC NAND Flash的设备文件节点。如插入MicroSD卡,你会发现/dev/mmcblk1变成MicroSD卡的设备文件节点。但是当操作系统从MicroSD启动, /dev/mmcblk0是MicroSD卡的设备文件节点,并且/dev/mmcblk1是eMMC NAND Flash设备文件节点。你必须清楚地知道你想在哪个存储设备上更新系统固件。

基于源代码

第1步:参考http://wiki.lemaker.org/LeMaker_Guitar:How_to_use_LeMaker_Guitar_BSP下载the LeMaker_Guitar_BSP板级支持包。


第2步: 配置10.1寸LCD分辨率(1280 * 800)
编辑kernel dts文件: linux-actions-bsp/linux-actions/arch/arm/boot/dts/lemaker_guitar_bbb.dts,设置refresh = <60>, xres = <1280>, yres = <800>。

lcd0: lcd0@b02a0000 {
		pinctrl-names = "default";
		pinctrl-0 = <&lvds_state_default>;
		lcd_power_gpios = <&gpio 36 0>;    /*GPIOB4*/
		//lcd_reset_gpios = <&gpio 49 0>; /*GPIOB17*/
		port_type = "lvds";
		data_width = <0>;		/* 0:24bit ,1:18bit */
		videomode-0 = <&lcd_mode0>;
		vsync_inversion = <0>;
		hsync_inversion = <0>;
 
		dclk_inversion = <0>;
		lde_inversion = <0>;
		lvds_ctl = <0x000a9523>;	/* last two bit: 3:8bit ,1:6bit */
		lvds_alg_ctl0 = <0xc141a030>;
		lightness = <128>;
		saturation = <7>;
		contrast = <5>;
 
		lcd_mode0:mode@1280x800p60 {
				refresh = <60>;
				xres = <1280>; 
				yres = <800>;    
				pixclock = <14090>;
				left_margin = <80>;
				right_margin = <60>;
				upper_margin = <8>;
				lower_margin = <7>;
				hsync_len = <20>;
				vsync_len = <8>;
				vmode = <0>;
		};
	};
 
ctp_detect {
		compatible = "owl-ctp-detect";
		i2c_adapter_id = <1>;
		tp_vcc = "ldo5";
		//reset_gpios = <&gpio 35 1>;    /*GPIOB(3) 0: high, 1: low*/
		//interrupt-parent = <&sirq>;
		//interrupts =< 0 0x4 >; /*SIRQ0*/
		vol_range = <3100000 3110000>;
 
		ctp_detect_list {
				compatible = "ctp_detect_list";
				ICN83XX =  <0>;
				GSLX6X0 =  <0>;
				FT52-406 = <0>;
				FT5606 =   <0>;
				GT813 =    <0>;
				AW5206 =   <0>;
				AW5209 =   <0>;
				CT36X =    <0>;
				HL3X06 =   <0>;
				ILITEK =   <0>;
				ili2672 =  <0>;
				ft5x06 =   <0>;
				Goodix-TS =<1>;   # Touchscreen driver
				MT395 =    <0>;
				NT1100X =  <0>;
				SSD254X =  <0>;
			};
	};
 
 .
 .
 .
        //Set LCD as a master device
        framebuffer {
                compatible = "actions,framebuffer";
                def_display = "lcd";          
        };
        //Set HDMI display as a master device
 /*     framebuffer {
                compatible = "actions,framebuffer";
                def_display = "hdmi";
                xres = <1280>;
                yres = <720>;
                bpp = <4>;               
        };
 */
 . 
 .
 .

Edit the uboot dts file: linux-actions-bsp/u-boot-actions/arch/arm/dts/lemaker_guitar.dts. set refresh = <60>, xres = <1280>, yres = <800>.

lcd0: lcd0@b02a0000 {
		pinctrl-names = "default";
		pinctrl-0 = <&lvds_state_default>;
		lcd_power_gpios = <&gpio 36 0>;    /*GPIOB4*/
		//lcd_reset_gpios = <&gpio 49 0>; /*GPIOB17*/
		port_type = "lvds";
		data_width = <0>;		/* 0:24bit ,1:18bit */
		videomode-0 = <&lcd_mode0>;
		vsync_inversion = <0>;
		hsync_inversion = <0>;
 
		dclk_inversion = <0>;
		lde_inversion = <0>;
		lvds_ctl = <0x000a9523>;	/* last two bit: 3:8bit ,1:6bit */
		lvds_alg_ctl0 = <0xc141a030>;
		lightness = <128>;
		saturation = <7>;
		contrast = <5>;
 
		lcd_mode0:mode@1280x800p60 {
				refresh = <60>;
				xres = <1280>; 
				yres = <800>;    
				pixclock = <14090>;
				left_margin = <80>;
				right_margin = <60>;
				upper_margin = <8>;
				lower_margin = <7>;
				hsync_len = <20>;
				vsync_len = <8>;
				vmode = <0>;
		};
	};
 
  .
 .
 .
        //Set LCD as a master device
        framebuffer {
                compatible = "actions,framebuffer";
                def_display = "lcd";          
        };
        //Set HDMI display as a master device
 /*     framebuffer {
                compatible = "actions,framebuffer";
                def_display = "hdmi";
                xres = <1280>;
                yres = <720>;
                bpp = <4>;               
        };
 */
 . 
 .
 .


第3步: 编译LeMaker Guitar BSP
参考http://wiki.lemaker.org/LeMaker_Guitar:How_to_use_LeMaker_Guitar_BSP编译LeMaker Guitar BSP,其中包含了上面两个dts文件。

cd linux-actions-bsp/
make


第4步:参考http://wiki.lemaker.org/LeMaker_Guitar:How_to_update_Linux_platform_firmware更新u-boot, misc.img(其中包括kernel.dtb, uImage)和/lib/modules


第5步:重启系统,并加载驱动模块
我们可以使用命令lsmod查看所有已经加载的内核驱动程序。如果不能找到ctp_gt9xx触摸屏驱动程序,我们应该使用下面命令加载驱动程序:

sudo modprobe ctp_gt9xx

如果你想每次重新启动LeMaker Guitar都是有触摸屏,我们应该编辑/etc/modules文件,在文件里面添加以下内容:

ctp_gt9xx

并且编辑文件/etc/modprobe.d/blacklist-guitar.conf,删除以下内容:

blacklist  ctp_gt9xx

How to drive 7 inch LCD and touchscreen

Since the LeMaker official System Image support the 7 inch LCD by default. In the following chapter, we will introduce mainly how to driver the LCD base on the source code and set the LCD as a master device.

第1步: 参考http://wiki.lemaker.org/LeMaker_Guitar:How_to_use_LeMaker_Guitar_BSP下载LeMaker_Guitar_BSP板级支持包。


第2步:配置7寸LCD分辨率(1024* 600)
编辑kernel dts文件:linux-actions-bsp/linux-actions/arch/arm/boot/dts/lemaker_guitar_bbb.dts。设置refresh= <60>, xres = <1024>, yres = <600>。

lcd0: lcd0@b02a0000 {
		pinctrl-names = "default";
		pinctrl-0 = <&lvds_state_default>;
		lcd_power_gpios = <&gpio 36 0>;     /*GPIOB4*/
		lcd_reset_gpios = <&gpio 49 0>;     /*GPIOB17*/
		port_type = "lvds";
		data_width = <0>;		    /* 0:24bit ,1:18bit */
		videomode-0 = <&lcd_mode0>;
		vsync_inversion = <0>;
		hsync_inversion = <0>;
		dclk_inversion = <0>;
		lde_inversion = <0>;
		lvds_ctl = <0x000a9523>;	     /* last two bit: 3:8bit ,1:6bit */
		lvds_alg_ctl0 = <0xc141a030>;
		lightness = <128>;
		saturation = <7>;
		contrast = <5>;
		lcd_mode0:mode@1024x600p60 {
			refresh = <60>;              /* refresh frequency*/
			xres = <1024>;               /* width */
			yres = <600>;                /* height*/
			/*in pico second, 0.000 000 000 001s*/
			pixclock = <20000>;
			left_margin = <56>;
			right_margin = <60>;
			upper_margin = <13>;
			lower_margin = <18>;
			hsync_len = <4>;
			vsync_len = <4>;
			/*0: FB_VMODE_NONINTERLACED, 1:FB_VMODE_INTERLACED*/
			vmode = <0>;
		};
	};
 
ctp_detect {
		compatible = "owl-ctp-detect";
		i2c_adapter_id = <1>;
		tp_vcc = "ldo5";
		//reset_gpios = <&gpio 35 1>;    /*GPIOB(3) 0: high, 1: low*/
		//interrupt-parent = <&sirq>;
		//interrupts =< 0 0x4 >; /*SIRQ0*/
		vol_range = <3100000 3110000>;
 
		ctp_detect_list {
				compatible = "ctp_detect_list";
				ICN83XX =  <0>;
				GSLX6X0 =  <0>;
				FT52-406 = <0>;
				FT5606 =   <0>;
				GT813 =    <0>;
				AW5206 =   <0>;
				AW5209 =   <0>;
				CT36X =    <0>;
				HL3X06 =   <0>;
				ILITEK =   <0>;
				ili2672 =  <0>;
				ft5x06 =   <1>;  # Touchscreen driver
				Goodix-TS =<0>;
				MT395 =    <0>;
				NT1100X =  <0>;
				SSD254X =  <0>;
		};
	};
 
  .
 .
 .
        //Set LCD as a master device
        framebuffer {
                compatible = "actions,framebuffer";
                def_display = "lcd";          
        };
        //Set HDMI display as a master device
 /*     framebuffer {
                compatible = "actions,framebuffer";
                def_display = "hdmi";
                xres = <1280>;
                yres = <720>;
                bpp = <4>;               
        };
 */
 . 
 .
 .

编辑uboot dts 文件:linux-actions-bsp/u-boot-actions/arch/arm/dts/lemaker_guitar.dts。设置refresh = <60>, xres = <1024>, yres = <600>。

lcd0: lcd0@b02a0000 {
		pinctrl-names = "default";
		pinctrl-0 = <&lvds_state_default>;
		lcd_power_gpios = <&gpio 36 0>;     /*GPIOB4*/
		lcd_reset_gpios = <&gpio 49 0>;     /*GPIOB17*/
		port_type = "lvds";
		data_width = <0>;		    /* 0:24bit ,1:18bit */
		videomode-0 = <&lcd_mode0>;
		vsync_inversion = <0>;
		hsync_inversion = <0>;
		dclk_inversion = <0>;
		lde_inversion = <0>;
		lvds_ctl = <0x000a9523>;	     /* last two bit: 3:8bit ,1:6bit */
		lvds_alg_ctl0 = <0xc141a030>;
		lightness = <128>;
		saturation = <7>;
		contrast = <5>;
		lcd_mode0:mode@1024x600p60 {
			refresh = <60>;              /* refresh frequency*/
			xres = <1024>;               /* width */
			yres = <600>;                /* height*/
			/*in pico second, 0.000 000 000 001s*/
			pixclock = <20000>;
			left_margin = <56>;
			right_margin = <60>;
			upper_margin = <13>;
			lower_margin = <18>;
			hsync_len = <4>;
			vsync_len = <4>;
			/*0: FB_VMODE_NONINTERLACED, 1:FB_VMODE_INTERLACED*/
			vmode = <0>;
		};
	};
 
 .
 .
 .
        framebuffer {
                compatible = "actions,framebuffer";
                def_display = "lcd";
                //def_display = "hdmi";
                //xres = <1280>;
                //yres = <720>;
                //bpp = <4>;               
        };
 . 
 .
 .


第3步: 编译LeMaker Guitar BSP
参考 http://wiki.lemaker.org/LeMaker_Guitar:How_to_use_LeMaker_Guitar_BSP编译LeMaker Guitar BSP,其中包含上面的两个dts文件。

cd linux-actions-bsp/
make


第4步: 参考http://wiki.lemaker.org/LeMaker_Guitar:How_to_update_Linux_platform_firmware更新u-boot, misc.img(其中包括kernel.dtb, uImage),和/lib/modules.


第5步:重启系统,然后加载驱动模块
我们可以使用lsmod查看所有已经加载的内核驱动模块。如果不能找到ctp_ft5x06触摸屏驱动模块,我们应该使用下面命令加载驱动模块:

sudo modprobe ctp_ft5x06

如果你想要每次重新启动LeMaker Guitar都使用触摸屏,我们应该编辑文件/etc/modules,然后在里面添加以下内容:

ctp_ft5x06

Android系统

我们已经提供支持10.1寸LCD的Android系统镜像,请点击http://www.lemaker.org/product-guitar-download-19.html下载。