IMX6Q Ft5216触屏驱动移植

触摸屏为ft5216

复位:TOUCH_RES--->NANDF_D1    MX6QDL_PAD_NANDF_D1__GPIO2_IO01
中断:TOUCH_INT1---->NANDF_D5  MX6QDL_PAD_NANDF_D5__GPIO2_IO05

I2C3 地址为0x38
参考:kernel_imx/arch/arm/boot/dts/imx6qdl-tx6.dtsi

1.dts修改
&i2c3 {
    clock-frequency = <100000>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_i2c3>;
    status = "okay";
    edt-ft5x06@38 {
        compatible = "edt,edt-ft5x06";
        reg = <0x38>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_edt_ft5x06>;
        interrupt-parent = <&gpio2>;
        interrupts = <5 0>;
        reset-gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
    
    
    
    };
........
};

    pinctrl_edt_ft5x06: edt-ft5x06grp{
            fsl,pins = <
            MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x1b0b0 /*Interrupt*/
            MX6QDL_PAD_NANDF_D1__GPIO2_IO01 0x1b0b0 /*Reset*/
            >;
        };
2.驱动,跟根屏的大小和原点调整x,y的范围和方向
--- a/kernel_imx/drivers/input/touchscreen/edt-ft5x06.c
+++ b/kernel_imx/drivers/input/touchscreen/edt-ft5x06.c
@@ -71,6 +71,9 @@
 #define EDT_RAW_DATA_RETRIES           100
 #define EDT_RAW_DATA_DELAY             1 /* msec */
 
+#define MAX_SCREEN_X 1024
+#define MAX_SCREEN_Y 600
+
 enum edt_ver {
        M06,
        M09,
@@ -236,7 +239,8 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id)
                y = ((buf[2] << 8) | buf[3]) & 0x0fff;
                id = (buf[2] >> 4) & 0x0f;
                down = type != TOUCH_EVENT_UP;
-
+               x = MAX_SCREEN_X - x;
+               y = MAX_SCREEN_Y - y;
                input_mt_slot(tsdata->input, id);
                input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER, down);
 
@@ -1038,12 +1042,12 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
        __set_bit(EV_KEY, input->evbit);
        __set_bit(EV_ABS, input->evbit);
        __set_bit(BTN_TOUCH, input->keybit);
-       input_set_abs_params(input, ABS_X, 0, tsdata->num_x * 64 - 1, 0, 0);
-       input_set_abs_params(input, ABS_Y, 0, tsdata->num_y * 64 - 1, 0, 0);
+       input_set_abs_params(input, ABS_X, 0, MAX_SCREEN_X, 0, 0);
+       input_set_abs_params(input, ABS_Y, 0, MAX_SCREEN_Y, 0, 0);
        input_set_abs_params(input, ABS_MT_POSITION_X,
-                            0, tsdata->num_x * 64 - 1, 0, 0);
+                            0, MAX_SCREEN_X, 0, 0);
        input_set_abs_params(input, ABS_MT_POSITION_Y,
-                            0, tsdata->num_y * 64 - 1, 0, 0);
+  

3.idc配置文件
system/usr/idc/EP0790M09.idc
文件名字为input_dev->name
 # cat EP0790M09.idc                                  
touch.deviceType = touchScreen
touch.orientationAware = 1

touch.size.calibration = none
touch.orientation.calibration = none


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值