exynos4412 ft5306驱动

来源:互联网 发布:战地4枪械数据解析 编辑:程序博客网 时间:2024/06/04 20:42

由于不同触摸屏的xy坐标会有不同,有时候xy坐标需要反过来。下面的代码会告诉你怎样调整xy坐标。 
代码分析 
驱动位置:drivers/input/touchscreen/ft5x06_ts.c

static int __init ft5x0x_ts_init(void){    int ret;    int type;    type = get_lcd_type();#if 1        //TP1_EN    //printk("==%s: TP1_EN==\n", __FUNCTION__);        ret = gpio_request(EXYNOS4_GPL0(2), "TP1_EN");        if (ret) {                printk(KERN_ERR "failed to request TP1_EN for "                        "I2C control\n");                //return err;        }        gpio_direction_output(EXYNOS4_GPL0(2), 1);        s3c_gpio_cfgpin(EXYNOS4_GPL0(2), S3C_GPIO_OUTPUT);        gpio_free(EXYNOS4_GPL0(2));        mdelay(5);#endif#if 1        printk("==%s: reset==\n", __FUNCTION__);        ret = gpio_request(EXYNOS4_GPX0(3), "GPX0_3");        if (ret) {                gpio_free(EXYNOS4_GPX0(3));                ret = gpio_request(EXYNOS4_GPX0(3), "GPX0_3");                if(ret)                {                        printk("ft5xox: Failed to request GPX0_3 \n");                }        }        gpio_direction_output(EXYNOS4_GPX0(3), 0);        mdelay(200);        gpio_direction_output(EXYNOS4_GPX0(3), 1);        s3c_gpio_cfgpin(EXYNOS4_GPX0(3), S3C_GPIO_OUTPUT);        gpio_free(EXYNOS4_GPX0(3));        msleep(300);#endif    //type = get_lcd_type();    if(0x00 == type)  //9.7    {        TOUCH_MAX_X = 1024;                TOUCH_MAX_Y = 768;#ifdef CONFIG_VT        //for Ubuntu                touch_size = 1;                scal_xy = 1;#else                touch_size = 0;          scal_xy = 1;#endif    }    else if(0x01 == type) //7.0    {#ifdef CONFIG_VT        //for Ubuntu                TOUCH_MAX_X = 800;//1280;                TOUCH_MAX_Y = 1280;//800;                scal_xy = 1;                touch_size = 0;#else                touch_size = 1;//0;   swap_xy  ===》在这里控制触摸屏的xy坐标翻转#endif    }    else if(0x02 == type)  //4.3    {        ;    }    if(1 == touch_size)    {        swap_xy = 1;    }    else    {        swap_xy = 0;    }    return i2c_add_driver(&ft5x0x_ts_driver);}
阅读全文
0 0
原创粉丝点击