SM7250(高通5G)平台TP bringup

文章首次写在个人微信公众号【Linux驱动】。

#近况说明
从3月到5月中旬,这段时间一直在做高通5G中端手机平台的项目。硬件平台为SM7250,软件平台为android Q(10),截至目前,搭载这款高通处理器平台的手机还未发布。作为新人,参与到5G终端项目,一个人搞起来LCM和TP模块,从0到1的过程,是有很多感受的。从平台代码的熟悉到现在完成整个项目Display和Touch部分,虽然辛苦,却也开心。废话不多说了。首先介绍一下SM7250对Display和touch部分(我当时拿到的IC 厂商的驱动还没有适配高通的DRM架构)的改动。
#SM7250对display部分的改进

代码路径
display驱动路径: kernel/msm-4.19/techpack/display
displayDTS路径: vendor/qcom/proprietary/devicetree-4.19/qcom
display UEFI路径:
boot_images/QcomPkg/SocPkg/SaipanPkg

采用了DRM架构:

之前一直是FB架构,为啥用这个架构了,如下:
fb 驱动以前主要是嵌入式设备用,android 最开始也是用fb,但是渐渐就发现他不好用了,主要是对多硬件图层的支持不好,不过那时候drm对嵌入式系统也不友好,Google 中间还开发了一个叫做ADF的 驱动框架带代替FB,不过没什么人响应后面 drm 里面加了atomic kms 的功能,对多图层的支持基本能满足android的需求了,而且很多芯片厂家的芯片既要做android 又要做chrome,比如三星的exynos,nVidia的tegra,还有国内的rk3288 rk3399,所以都直接转向drm了,要不然就要维护两套驱动.所以drm 现在就成了android 上的标准图形驱动而且现在如果想超 linux mainline 提交显示驱动的话,要求必须走drm,fb的不会被接受 前几年 freescale 那边有人提交fb的设备驱动 就被要求改成drm.

FB与DRM在代码里面的区别如下:
在这里插入图片描述
DRM代码里面主要的概念和数据:

#Frame buffers (struct drm_framebuffer)
 Frame buffers are abstract memory objects that provide a source of
 pixels to scan out to a CRTC. Implementation depends on the memory
 manager used and the IOMMU capabilities.
#Planes (struct drm_pane)
 A plane represents an image source that can be blended with or overlaid
 on top of a CRTC during the scan out process. Planes are associated 
 with a frame buffer to crop a portion of the image memory (source)
 and optionally scale it to a destination size. The result is then
  blended with or overlaid on top of a CRTC.
#CRTC (struct drm_crtc)
CRT controller (CRTC) is not related only to CRT displays. It 
configures the appropriate display settings,display timings/
resolution, scans out frame buffer content to one or more displays,
 and so on.
#ncoder (struct drm_encoder)
 Takes pixels data from CRTC and converts it to the format suitable
  for any attached connectors. 
 #Connectors (struct drm_connector) 
Represents display interface (HDMI, DisplayPort, DSI, VGA), 
transmits signal to display, detects display, exposes mode, 
and so on.
#Bridge
Associated with an encoder, participates in mode set, device 
power management, connection detection, and so on.

#SM7250对touch部分的改进
主要是对suspend 和resume部分的流程加了DRM的宏控

#if defined(CONFIG_FB)
#if defined(CONFIG_DRM)  //主要后面适配了DRM部分
#include <drm/drm_panel.h>
#elif defined(CONFIG_FB)
 #include <linux/notifier.h>
 #include <linux/fb.h>

#TP的bringup
TP的通信采用SPI,SPI信号采用四条信号线SPI_MOSI, SPI_MISO,SPI_SCLK, SPI_CS ,SPI_CS拉低才有效,主要用来选择SPI从设备,硬件说已经拉低选择我们的TP设备。原理图如下:
在这里插入图片描述
在这里插入图片描述
SPI使用的使用的是GPIO_6 、GPIO_7 、GPIO_8 GPIO_9 这4个gpio —>这是哪个spi总线上的?在资源配置表里面查看:
在这里插入图片描述
默认gpio6 gpio7 是i2c gpio8是tp_reset gpio9是tp_int
在设备数xxx_pinctrl.dtsi 搜索gpio6,gpio7,gpio8 gpio9
查看对应的 qupv3_se7_i2c
在这里插入图片描述
通过总结发现gpio6 gpio7 对应的为 qupv3_se7
查看spi qupv3_se7_spi 的总线地址:spi@984000
在这里插入图片描述
打开spi总线:
在这里插入图片描述
在另外的目录下引用spi总线添加TP 设备资源:
在这里插入图片描述
#TP设备树的注释:

&qupv3_se7_spi {
  status = "ok";
  qcom,spi-touch-active = "focaltech,fts";
  //后面单独分析
  focaltech@0 { //spi 从设备的地址选择0 
     compatible = "focaltech,fts";
     reg = <0x0>;
     spi-max-frequency = <6000000>;
     //spi的最大传输速率 6MHZ 
     interrupt-parent = <&tlmm>;//使用MSM 中断
     interrupts = <68 0x2>; //中断号
     focaltech,reset-gpio = <&tlmm 4 0x01>;        //reset引脚 和初始状态
     focaltech,irq-gpio = <&tlmm 68 0x02>;
     //中断引脚 和初始状态   
     focaltech,max-touch-number = <10>;  
     //最大触点                    
     focaltech,display-coords =  <0 0 1080 2340>;//tp 的分辨率
      左上角坐标:(0,0)  右下角坐标:(10802340)
     qcom,spi-touch-active = "focaltech,fts";
     panel = <&dsi_ft8719p_1080p_video>;

     pinctrl-names = "pmx_ts_active","pmx_ts_suspend";//pinctl
   主要用在某些特殊状态下,比如在使用TP suspend前,需要让中断引脚从
   某个固定的状态到拉高或则拉低,前面某个固定的状态需要通过pinctrl来实现
     pinctrl-0 = <&ts_ft_int_active &ts_ft_reset_active>;
     pinctrl-1 = <&ts_ft_int_suspend &ts_ft_reset_suspend>;
   }
};

TP 中pinctrl在驱动中的使用:
查看设备树里面的pinctrl属性:
在这里插入图片描述
在使用TP的供电是让int 和 reset处于固定的状态(时序调整时用):用pinctrl来实现
在这里插入图片描述
#SM7250平台中使用DRM架构,对TP的影响

主要影响到了TP的suspend流程,使用第三方的TP驱动,无法跑到suspend,简要分析以前平台主要使用include/fb.h里面的参数来控制suspend 和resume流程,使用CONFIG_FB宏 来控制
在这里插入图片描述
使用include/fb.h的参数:
在这里插入图片描述
新平台使用DRM架构,使用CONFIG_DRM这个宏来控制

#sm7250平台对TP的修改
设备树:在这里插入图片描述

  • 4
    点赞
  • 55
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值