LS1028 适配单八璐LVDS 7寸屏幕

文章详细描述了如何修改Linux系统屏体手册中的时序参数以适应特定屏幕,包括调整分辨率、刷新率和DP时钟。同时,文章还涉及了设备树中触摸驱动的移植,包括添加设备树配置、驱动文件的拷贝以及配置Kconfig和Makefile。在移植过程中遇到了屏体时钟不匹配的错误,并提供了相应的解决方法。
摘要由CSDN通过智能技术生成

查看屏体手册

1、屏体手册参数

该屏幕的时钟频率范围为44.9Mhz-63Mhz;屏幕分辨为1024x600
在这里插入图片描述
在这里插入图片描述

2、数据格式

该屏幕是支持单六路和单八路两种模式,当SELB为low时为单八路模式,当SELB位High时为单六路模式;该lvds屏幕的数据格式是VESA模式的;
OK1028A-C芯片原生DP信号由LT7211转为LVDS信号,目前的固件配置是单port,8位,VESA格式。
在这里插入图片描述
在这里插入图片描述

软件修改

1、修改时序参数

时序参数需要修改:
文件路径:packages/linux/OK1028-linux- kernel/drivers/gpu/drm/bridge/cadence/cdns-dp-core.c

        { DRM_MODE("1024x600", DRM_MODE_TYPE_DRIVER, 51200, 1024, 1040,
                   1184, 1344, 0, 600, 601, 632, 635, 0,
                   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
          .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },

参数值的含义,可以参考 DRM_MODE 的宏定义,在头文件include/drm/drm_modes.h:

#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
        .name = nm, .status = 0, .type = (t), .clock = (c), \
        .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
        .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
        .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
        .vscan = (vs), .flags = (f)

各参数的具体含义:

.hdisplay			:1280       [horizontal display size ]
.hysnc_start(hss)	:1328    	[horizontal sync start
.hsync_end(hse)		:1360    	[horizontal sync end]
.htotal(ht)			:1440       [horizontal total size]
.hskew(hsk)			:0          [horizontal skew]    
.vdisplay(vd)		:800        [vertical display size]
.vsync_start(vss)	:803       	[vertical sync start]
.vsync_end(vse)		:809       	[vertical sync end]
.vtotal(vt)			:823        [vertical total size]
.vscan(vs)			:0          [vertical scan?!]
.flags(f)=

在这里插入图片描述
屏体书册参数:
在这里插入图片描述
在这里插入图片描述

.name(nm)			:1024x600
.clock(c)			:51200
.hdisplay(hd)		:1024
.hysnc_start(hss)	:1040
.hsync_end(hse)		:1184
.htotal(ht)			:1344
.hskew(hsk)			:0
.vdisplay(vd)		:600
.vsync_start(vss)	:601
.vsync_end(vse)		:623
.vtotal(vt)			:635

2、修改dtsi里面的DP时钟

dp时钟的计算方法:
在这里插入图片描述
fpll_phi=fpll_VCO/PLLDV[RFDHI]
DP像素时钟=fpll_VCO=fpll_phi * PLLDV[RFDHI]
fpll_VCO 需要在设备数中指定,系统启动后无法修改,位于 650MHz-1300MHz 之间。PLLDV[RFDHI] 的范围为 1-64,只需要保证 VCO 可以整除 lvds 的像素时钟,且位于 1-64 之间即可。
例如飞凌默认的屏幕时钟为 71100khz,这里指定的 vco-frequency=1066500000hz,PLLDV[RFDHI]=15
设备树路径:OK1028-linux-fs/packages/linux/OK1028-linux-kernel/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi

 dpclk: clock-controller@f1f0000 {
                compatible = "fsl,ls1028a-plldig";
                reg = <0x0 0xf1f0000 0x0 0xffff>;
                #clock-cells = <0>;
                vco-frequency = <768000000>;
                clocks = <&osc_27m>;
        };

3、修改启动参数

路径:OK1028-linux-fs/configs/board/ls1028ardb/manifest

distroboot=\
'env exists dtb || setenv dtb OK1028A-C.dtb;'\
'env exists kernel_image || setenv kernel_image Image;'\
'env exists devpart_boot || setenv devpart_boot 2;'\
'env exists devpart_root || setenv devpart_root 3;'\
'env exists dpmode || setenv dpmode video=1024x600-32@60;'\
'env exists logo || setenv logo logo.bmp;'\
'env exists scr_w || setenv scr_w 1024;'\
'env exists scr_h || setenv scr_h 600;'\
'env exists fb_base_addr || setenv fb_base_addr 0xf0000000;'\
'env exists bmp_load_addr || setenv bmp_load_addr 0xef800000;'\
'part uuid $devtype $devnum:$devpart_root partuuidr;'\
'setenv bootargs console=ttyS0,115200 earlycon=uart8250,mmio,0x21c0500 root=PARTUUID=$partuuidr rw rootwait $dpmode cma=256M iommu.passthrough=1 arm-smmu.disable_bypass=0 $othbootargs;'\
'load $devtype $d

修改报错:

第一次修改后报错

[    2.958280] pxlclk doesn't support 83496000 Hz hwdev 69818182 HZ
[    2.966256] pxlclk doesn't support 83496000 Hz hwdev 69818182 HZ
第二次修改报错
[    2.955431] pxlclk doesn't support 48924000 Hz hwdev 69818182 HZ

原因:

第一次修改验证,并没有正常显示,查看打印信息发现有报错像素时钟修改不正确。

移植屏幕触摸驱动——FT7311

经过使用命令查看芯片使用的是i2c的地址为38
在这里插入图片描述

1.添加设备树:

添加设备树关于触摸芯片的配置,并将之前的gt928的触摸芯片关闭。
设备树路径:arch/arm64/boot/dts/freescale/OK1028A-C.dts

&i2c0 {
        status = "okay";

        gt928:gt928_ts@14 {
                compatible = "goodix,gt928";
                reg = <0x14>;
                interrupt-parent = <&gpio2>;
                interrupts = <30 2>;
                goodix,rst-gpio = <&gpio2 31 0>;
                goodix,irq-gpio = <&gpio2 30 0>;
                status = "disabled";
        };

        focaltech: focaltech@38 {
                compatible = "focaltech,fts";
                reg = <0x38>;
                focaltech,irq-gpio = <&gpio2 30 0>;
                focaltech,reset-gpio = <&gpio2 31 0>;
                focaltech,key-x-coord = <1024>;
                focaltech,key-y-coord = <600>;
                focaltech,max-touch-number = <5>;
                status = "okay";
        };

2.移植驱动

将驱动文件拷贝到源码的OK1028-linux-fs/packages/linux/OK1028-linux-kernel/drivers/input/touchscreen/focaltech_touch目录下
在这里插入图片描述

添加dfconfig配置文件选项
路径:arch/arm64/configs/ok1028_defconfig
在这里插入图片描述

配置focaltech_touch目录的上一级Kconfig文件,将配置文件指向下一级目录。
在这里插入图片描述

配置移植驱动的Kconfig

#
# Focaltech Touchscreen driver configuration
#

config TOUCHSCREEN_FTS
        bool "Focaltech Touchscreen"
                depends on I2C
                default n
                help
                  Say Y here if you have Focaltech touch panel.
                  If unsure, say N.

添加Makefile规则

# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the focaltech touchscreen drivers.
#

# Each configuration option enables a list of files.

obj-y   +=  focaltech_core.o
obj-y   +=  focaltech_ex_fun.o
obj-y   +=  focaltech_ex_mode.o
obj-y   +=  focaltech_flash.o
obj-y   +=  focaltech_gesture.o
obj-y   +=  focaltech_esdcheck.o
obj-y   +=  focaltech_i2c.o
obj-y   +=  focaltech_point_report_check.o
obj-y   +=  focaltech_flash/
#obj-y   +=  focaltech_test/

设备树介绍:

路径:Documentation/devicetree/bindings/input/touchscreen/focaltech-ts.txt

FocalTech touch controller

The focaltech controller is connected to host processor via i2c.
The controller generates interrupts when the user touches the panel.
The host controller is expected to read the touch coordinates over
i2c and pass the coordinates to the rest of the system.

Required properties:
 - compatible           : should be "focaltech,fts"
 - reg                  : i2c slave address of the device, should be <0x38>
 - interrupt-parent     : parent of interrupt
 - interrupts           : irq gpio, "0x02" stands for that the irq triggered by falling edge.
 - focaltech,irq-gpio   : irq gpio, same as "interrupts" node.
 - focaltech,reset-gpio : reset gpio
 - focaltech,num-max-touches    : maximum number of touches support
 - focaltech,display-coords     : display resolution in pixels. A four tuple consisting of minX, minY, maxX and maxY.

Optional properties:
 - focaltech,have-key           : specify if virtual keys are supported
 - focaltech,key-number         : number of keys
 - focaltech,keys               : virtual key codes mapping to the coords
 - focaltech,key-y-coord        : constant y coordinate of keys, depends on the y resolution
 - focaltech,key-x-coords       : constant x coordinates of keys, depends on the x resolution
 - focaltech,swap-xy            : swap x-y coordinates
 - focaltech,panel-type         : set panel type, default is FT5416 panel
 - focaltech,scaling-down-half  : scale down the x-y coordiantes to half


Example:
        i2c@f9927000 {
                focaltech@38{
                        compatible = "focaltech,fts";
                        reg = <0x38>;
                        interrupt-parent = <&msm_gpio>;
                        interrupts = <13 0x02>;
                        focaltech,reset-gpio = <&msm_gpio 12 0x01>;
                        focaltech,irq-gpio = <&msm_gpio 13 0x02>;
                        focaltech,max-touch-number = <5>;
                        focaltech,display-coords =  <0 0 1080 1920>;

                        focaltech,have-key;
                        focaltech,key-number = <3>;
                        focaltech,keys = <139 102 158>;
                        focaltech,key-y-coord = <2000>;
                        focaltech,key-x-coords = <200 600 800>;
                        focaltech,swap-xy;
                };
        };

编译过程中的报错信息:

在这里插入图片描述
当时看到报错信息以后,就直接去看源码是不是有语法错误,下面就是报错的源文件,看了好半天都没有看出来错误,有知道错误来源的小伙伴吗?请多多指教。后来是在是看不出来,就直接把这个文件屏蔽了。
在这里插入图片描述

解决办法:

# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the focaltech touchscreen drivers.
#

# Each configuration option enables a list of files.

obj-y   +=  focaltech_core.o
obj-y   +=  focaltech_ex_fun.o
obj-y   +=  focaltech_ex_mode.o
obj-y   +=  focaltech_flash.o
obj-y   +=  focaltech_gesture.o
obj-y   +=  focaltech_esdcheck.o
obj-y   +=  focaltech_i2c.o
obj-y   +=  focaltech_point_report_check.o
obj-y   +=  focaltech_flash/
#obj-y   +=  focaltech_test/

到这里就基本移植结束了,因为前面有其他工程师调试过此驱动,所以到我这边直接移植上并没有出现很多离谱的情况。
在这里还有一个没有用的文件就是focaltech_flash文件夹里面还有一个升级程序,是真的用不到,鉴于他没有报错,就放过这个程序了。下面是文件列表。
在这里插入图片描述

最终结果:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值