Hypervisor touch架构-passthrough介绍

在另外一篇文章中,我们已经介绍了Hypervisor touch架构中的一种(高通Q+A hypervisor touch框架介绍),这篇文章会介绍另外一种Hypervisor touch方案.

Hypervisor touch Passthrough解决方案

工作的过程

touch驱动工作所需的两个要素i2c/irq,在Guest OS启动之初由QVM passthrough到LA侧。

#QUPv3 QUPV3_1_SE0(QUP_SE_7) I2C Passthrough
pass loc mem:0x89C000,0x4000,rw=0x89C000
pass intr gic:640=640

pass intr gic:241=241

其中:pass loc mem:0x89C000,0x4000,rw=0x89C000,指的是需要passthrough的i2c控制器的寄存器地址,pass intr gic:640=640,指的是i2c控制器的中断号,pass intr gic:241=241指的是direct interrupt的中断号,用于透传GPIO中断。这些值可以通过pinmux和gpio_tlmm_dir_intr_8155.xml配置文件的信息得到。

数据传输链路过程:

1,touch屏幕被触摸产生中断

2,Guest OS la中的touch驱动程序的中断处理函数被触发

3,中断处理函数通过i2c读取触摸数据

4,中断处理函数解析读到的触摸数据,并上报到input子系统

5,上层应用通过event设备节点获取到触摸坐标点

可以看到,这种解决方案与常规的linux驱动的工作方式是一模一样的,区别点只是在于多了一层qvm的passthrough过程。

软件配置

QNX配置

diff --git a/qnx_ap/boards/core/dalconfig/adp_star_sda8155/config/gpio_tlmm_dir_intr_8155.xml b/qnx_ap/boards/core/dalconfig/adp_star_sda8155/config/gpio_tlmm_dir_intr_8155.xml
index e1f1504..8f58a65 100755
--- a/qnx_ap/boards/core/dalconfig/adp_star_sda8155/config/gpio_tlmm_dir_intr_8155.xml
+++ b/qnx_ap/boards/core/dalconfig/adp_star_sda8155/config/gpio_tlmm_dir_intr_8155.xml
@@ -24,8 +24,8 @@
 <driver name="tlmm_drv">
 
    <device id=DALDEVICEID_GPIOINT_DIR_CON_0>
-     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
-        <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         13   </props>
+     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       0   </props>
+        <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         0       </props>
    </device>
    <device id=DALDEVICEID_GPIOINT_DIR_CON_1>
      <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
diff --git a/qnx_ap/target/hypervisor/host/build_files/system.build.tmpl b/qnx_ap/target/hypervisor/host/build_files/system.build.tmpl
index 5196c3f..36ded3c 100755
--- a/qnx_ap/target/hypervisor/host/build_files/system.build.tmpl
+++ b/qnx_ap/target/hypervisor/host/build_files/system.build.tmpl
@@ -444,8 +444,13 @@ pass intr gic:617=617
 #pass loc mem:0x880000,0x4000,rw=0x880000
 #pass intr gic:633=633
 
+#QUPv3 QUPV3_1_SE0(QUP_SE_7) I2C Passthrough
+pass loc mem:0x89C000,0x4000,rw=0x89C000
+pass intr gic:640=640
+
 # Wake up GPIO
 pass intr gic:248=248
+pass intr gic:241=241
 
 # PCIe0 pass-through
 pass loc mem:0x1c00000,0x4000,rw=0x1c00000

android kernel配置

diff --git a/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi b/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi
index 938597bd2..b9bb7e757 100755
--- a/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi
+++ b/arch/arm64/boot/dts/qcom/sa8155-vm.dtsi
@@ -653,5 +653,23 @@
 #include "pm8150-vm.dtsi"
 
 &tlmm {
-       dirconn-list = <37 216 1>;
+       dirconn-list =  <37 216 1>,
+                       <13 209 1>,
+                       <66 210 1>;
+};
+&qupv3_se7_i2c {
+       status = "ok";
+};
+
+&soc {
+       atmel_mxt_64lt@4B{
+               compatible = "atmel,maxtouch";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0x4b 1>;
+               interrupts = <0 782 0x0>;
+               interrupt-names = "atmel_irq";
+               atmel,irq-gpio = <&tlmm 14 0x0>;
+               status = "okay";
+       };
 };

i2c的passthrough比较好理解,需要注意的是这里的中断透传使用的是direct interrupt这种方式,而这种方式在8155上最多只有8个中断源,在文件gpio_tlmm_dir_intr_8155.xml中配置.这种direct interrupt的方式一般在早期版本中会使用,随着版本的迭代更新,会支持更多中断的透传,比如gpio转irq的方式。

gpio_tlmm_dir_intr_8155.xml配置

<driver name="tlmm_drv">

   <device id=DALDEVICEID_GPIOINT_DIR_CON_0>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       0   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         0   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_1>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       0   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         0   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_2>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         15   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_3>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         16   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_4>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         38   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_5>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         97   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_6>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       1   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         30   </props>
   </device>
   <device id=DALDEVICEID_GPIOINT_DIR_CON_7>
     <props name="IRQ_ENABLED" type=DALPROP_ATTR_TYPE_UINT32>       0   </props>
     <props name="TLMM_GPIO" type=DALPROP_ATTR_TYPE_UINT32>         0   </props>
   </device>
   
</driver>

这里面的配置,每一个节点表示一个中断

两种解决方案的对比

Share-devices Passthrough
QNX 和LA可同时接收到touch数据 只有LA侧能接收到touch数据
数据传输链路更长 数据传输链路更短

关于Share-devices 这种方式的触摸延时,我们最近进行了测量,测量方法为:

1,在串行器中断pin脚测量中断触发 t1

2,在android侧接收触摸事件后拉GPIO电平得到 t2

t2 - t1 约为4ms左右,并不是特别长,当然肯定还是不如passthrough的方式快.

猜你喜欢

转载自blog.csdn.net/kill150/article/details/130196371