How to port the tp driver gsl3675 from android4.4.2 to android4.4.3

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to port the tp driver gsl3675 from android4.4.2 to android4.4.3

Jump to solution
1,353 Views
huangkc
Contributor I

Hi all:

       My tp driver gsl3675 is working righit on android4.4.2,imx6q,I want port the driver to android4.4.3 that the kernel use dts.The key modity is as follow.

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi

index bf81f2d..3f12cf3 100755

--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi

+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi

@@ -279,6 +279,9 @@

                lvds0-5vpow-en = <&gpio5 5 0>;

                lvds0-bl-pwm-en = <&gpio4 25 0>;

                lvds0-cab-en = <&gpio5 12 0>;

+             

+               /*tp*/

+               tp-pow-en = <&gpio4 29 0>;            

        };

      

};

@@ -463,6 +466,14 @@

                 interrupts = <8 2>;

                 wakeup-gpios = <&gpio6 8 0>;

         };

+               gsl3675_ts@0x40 {

+                               compatible = "fcar,gsl3675_ts";

+                               reg = <0x40>;

+                               interrupt-parent = <&gpio7>;

+                               interrupts = <19 2>;

+                               int-gpios = <&gpio7 0 0>;               // TP_DEV_EN

+                               wakeup-gpios = <&gpio7 1 0>;    //TP_INT_TO

+                               };

};

 

&i2c3 {

@@ -507,7 +518,7 @@

                vdd-supply = <&reg_sensor>;

                interrupt-parent = <&gpio3>;

                interrupts = <9 2>;

-       };

+       };    

};

 

&iomuxc {

@@ -556,6 +567,11 @@

                                MX6QDL_PAD_DISP0_DAT5__GPIO4_IO26 0x80000000//145 lvds0-pow-en

                                MX6QDL_PAD_DISP0_DAT11__GPIO5_IO05 0x80000000//135 lvds0-5vpow-en

                                MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12 0x80000000//131      lvds0-cab-en

+                             

+                               /*tp*/

+                               MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x80000000//43 TP_INT_TO

+                               MX6QDL_PAD_SD3_DAT4__GPIO7_IO01 0x80000000//42 TP_DEV_EN

+                               MX6QDL_PAD_DISP0_DAT8__GPIO4_IO29 0x80000000//134 TP_POW_EN

                                //huangkc_fcar end

                        >;

                };

diff --git a/drivers/input/touchscreen/gsl3675.c b/drivers/input/touchscreen/gsl3675.c

index f903e38..96f10de 100755

--- a/drivers/input/touchscreen/gsl3675.c

+++ b/drivers/input/touchscreen/gsl3675.c

@@ -20,7 +20,7 @@

#include <linux/io.h>

#include <linux/platform_device.h>

#include <linux/async.h>

-#include <mach/gpio.h>

+//#include <mach/gpio.h>

#include <linux/irq.h>

//#include <mach/board.h>

#include <linux/workqueue.h>

@@ -28,6 +28,8 @@

#include <linux/input/mt.h>

#include <linux/gpio.h>

 

+#include <linux/slab.h>

+#include <linux/of_gpio.h>

 

#include "GSL3675.h"

 

@@ -44,8 +46,10 @@

 

#define GSLX680_I2C_NAME       "gslX680"

#define GSLX680_I2C_ADDR       0x40

-#define IRQ_PORT                       IMX_GPIO_NR(6,8)

-#define WAKE_PORT                      IMX_GPIO_NR(4,22)//RESET TP

+//#define IRQ_PORT                     IMX_GPIO_NR(6,8)

+//#define WAKE_PORT                    IMX_GPIO_NR(4,22)//RESET TP

+static int IRQ_PORT = 0;

+static char WAKE_PORT = 0;

 

#define SCREEN_MAX_X           1280

#define SCREEN_MAX_Y           800

@@ -1035,6 +1039,24 @@ static int __devinit gsl_ts_probe(struct i2c_client *client,

 

        printk("GSLX680 Enter %s\n", __func__);

 

+       //huangkc_fcar begin

+       struct device_node *np = client->dev.of_node; 

+             

+       if (!np)

+       {

+               printk("#####huangkc_fcar failed to of_find_node_by_name gsl3675_ts : fun is %s line is %d \n file is %s\n",__FUNCTION__,__LINE__,__FILE__);

+               return ;

+       }

+     

+       WAKE_PORT = of_get_named_gpio(np, "wakeup-gpios", 0);

+       if (!gpio_is_valid(WAKE_PORT))

+               printk("#####huangkc_fcar gpio WAKE_PORT is not valid : fun is %s line is %d \n file is %s\n",__FUNCTION__,__LINE__,__FILE__);

+             

+       IRQ_PORT = of_get_named_gpio(np, "int-gpios", 0);

+       if (!gpio_is_valid(IRQ_PORT))

+               printk("#####huangkc_fcar gpio IRQ_PORT is not valid : fun is %s line is %d \n file is %s\n",__FUNCTION__,__LINE__,__FILE__);

+       //huangk_fcar end

+     

        if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {

                dev_err(&client->dev, "I2C functionality not supported\n");

                return -ENODEV;

@@ -1145,10 +1167,16 @@ static const struct i2c_device_id gsl_ts_id[] = {

};

MODULE_DEVICE_TABLE(i2c, gsl_ts_id);

 

+static struct of_device_id gsl3675_ts_dt_ids[] = {

+       { .compatible = "fcar,gsl3675_ts" },

+       { /* sentinel */ }

+};

+

static struct i2c_driver gsl_ts_driver = {

        .driver = {

                .name = GSLX680_I2C_NAME,

                .owner = THIS_MODULE,

+               .of_match_table = of_match_ptr(gsl3675_ts_dt_ids),

        },

#ifndef CONFIG_HAS_EARLYSUSPEND

        .suspend        = gsl_ts_suspend,

 

 

in additon,the touch IC gsl3675's power pin TP_POW_EN and reset pin TP_DEV_EN has been pull up  by measuring.

But what is very strange is that i2c communication faile! The log as follow:

==gsl_ts_init==

GSLX680 Enter gsl_ts_probe

==kzalloc success=

[GSLX680] Enter gslX680_ts_init

input: gslX680 as /devices/soc0/soc.0/2100000.aips-bus/21a4000.i2c/i2c-0/0-0040/input/input0

gsl_ts_read set data address fail!

gsl_ts_read set data address fail!

------gslX680 test_i2c error------

gsl_ts_read set data address fail!

#########check mem read 0xb0 = 0 0 0 0 #########

gsl_ts_read set data address fail!

gsl_ts_read set data address fail!

------gslX680 test_i2c error------

[GSLX680] End gsl_ts_probe

 

I also port the driver from other platform which has been proved to work properly,rockchip for example.

But it is make the same mistake on our platform.

 

More detailed code, please refer to the attachment.

 

Please help me to analyze this problem. Thank you

Original Attachment has been moved to: andorid4.4.3.zip

Original Attachment has been moved to: android4.4.2.zip

Labels (2)
0 Kudos
1 Solution
723 Views
igorpadykov
NXP Employee
NXP Employee

Hi huang

I think one needs to check i2c pads pinctrl settings -

SION bit should be set for correct i2c communication.

It may be useful to check signals with oscilloscope

and check I2C registers values, dumping them with printfs or

memtool. Check that in CCM module CCM_CCGRx register

I2c clocks were ungated.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
724 Views
igorpadykov
NXP Employee
NXP Employee

Hi huang

I think one needs to check i2c pads pinctrl settings -

SION bit should be set for correct i2c communication.

It may be useful to check signals with oscilloscope

and check I2C registers values, dumping them with printfs or

memtool. Check that in CCM module CCM_CCGRx register

I2c clocks were ungated.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
723 Views
huangkc
Contributor I

hi igor:

         i2c pads pinctrl settings was error!!By modifying,i2c communication is ok.Thank you

0 Kudos