规避触摸屏模拟距离传感器失效的问题

问题复现场景:

       通话时长在5-6分钟后,将手或脸部移开,会有几率出现唤不醒的情况,此时通过按power键唤醒后发现TP无法正常工作了。

 

解决办法:

       如果出现上述场景TP失效的话,通过修改resume函数来解决这个问题。原理是出现唤醒异常时,手动按power键唤醒后,rgt_ps_mode状态仍为trueps_detection1(靠近状态),此时我们强制对TP重新上电并reset,并再次写入模拟距离传感器起作用的一些必要参数,使其能够再次正常工作。

       另外在此处的修改还解决了插拔耳机后无法实现模拟距离传感器功能的问题。

resume函数中加入如下代码,

msg2138为例合入代码如下:

static void msg2133_ts_resume(struct early_suspend *handler)

{       

         int ret = 0;       

         unsigned char reg_val[8] = {0};

         struct i2c_client *client = this_client;

         struct msg2133_ts_data *data = i2c_get_clientdata(client);

         int err;

         u8 ps_data[4];

         /*During the call.*/

         if(rgt_ps_mode == true )

         {

                   ret = i2c_master_recv(this_client, reg_val, 8);

                   /* To solve the question that first touch is invalid. Modify the start by tianxiaohui in 2013-04-23*/

                   input_report_key(data->input_dev, BTN_TOUCH, 0);

                   input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, 0);

                   input_sync(data->input_dev);

                   /* To solve the question that first touch is invalid. Modify the end by tianxiaohui in 2013-04-23*/

                  

                   /*Avoid to disable the tp function When wake up failure during awary from the phone.Modify the start by tianxiaohui in 2013-04-23*/           

                   if( data->ps_detection == 1 || ret <= 0 )

                   {

                            rgt_ps_mode=false;

                            data->enable_ps_sensor = 0;

                            data->ps_detection = 0;

                            gpio_set_value(sprd_3rdparty_gpio_tp_rst, 0);

                            msg2133_device_power_on();

                            msleep(20);

                            gpio_set_value(sprd_3rdparty_gpio_tp_rst,1);

                            msleep(100);

/*如果此处不加enable_irq ,则会在插拔耳机时会出现TP失效*/

                            enable_irq(this_client->irq);

 

/*涉及到不同的TP时我们只需要在此处写入对应寄存器的值即可。*/

                            ps_data[0] = 0x52;

                           ps_data[1] = 0x00;//0x01

                     ps_data[2] = 0x4A;//0x24

                     ps_data[3] = 0xA0;

                     rgt_ps_mode = true ;

                            data->enable_ps_sensor = 1;

                     err=i2c_master_send(client, &ps_data[0], 4);

                    if(err>0)

                                     MSG2133_DBG("tp_ps: i2c write sucess, err:%d\n", err);    

                     else

                          MSG2133_DBG("tp_ps: i2c write fail, err:%d\n", err); 

           }

           /*Avoid to disable the tp function When wake up failure during awary from the phone.Modify the end by tianxiaohui in 2013-04-23*/           

           else

                   {

                            return -1;

                   }

         }

 

         else

         {

                   MSG2133_DBG("==%s==start==\n", __func__);

                   gpio_set_value(sprd_3rdparty_gpio_tp_rst, 0);

                   msg2133_device_power_on();

                   msleep(20);

                   gpio_set_value(sprd_3rdparty_gpio_tp_rst,1);

                   msleep(100);

                   enable_irq(this_client->irq);

         }

}

 

FT5306为例合入代码如下:

另外在合入此处代码时,记得将struct ts_eventstruct pixcir_i2c_ts_data两个结构体的声明放在resume函数前。

 

static void pixcir_ts_resume(struct early_suspend *handler)

{       

        

         int ret = 0;       

         unsigned char reg_val[8] = {0};

         struct i2c_client *client = this_client;

         struct pixcir_i2c_ts_data *data = i2c_get_clientdata(client);

         int err;

 

         ret = i2c_master_recv(this_client, reg_val, 8);

         /*During the call.*/

         if(rgt_ps_mode == true )

         {

                   /* To solve the question that first touch is invalid. Modify the start by tianxiaohui in 2013-04-22*/

                   input_report_key(data->input_dev, BTN_TOUCH, 0);

                   input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, 0);

                   input_sync(data->input_dev);

                    /*To solve the question that first touch is invalid. Modify the end by tianxiaohui in 2013-04-22*/

                  

                   /*Avoid to disable the tp function When wake up failure during awary from the phone.Modify the start by tianxiaohui in 2013-04-22*/           

                   if( data->ps_detection == 1 || ret <= 0)

                   {

                            rgt_ps_mode=false;

                            data->enable_ps_sensor = 0;

                            data->ps_detection = 0;

 

                            pixcir_ts_pwron();

                            pixcir_reset();

                            msleep(50);

                            pixcir_i2c_write_data(0x80, 0x12);

                            enable_irq(this_client->irq);

 

                     rgt_ps_mode = true ;

                            data->enable_ps_sensor = 1;

                     err = pixcir_i2c_write_data(0xB0, 0x01);

                     if(err>0)

                                     PIXCIR_DBG("tp_ps: i2c write sucess, err:%d\n", err);

                     else

                          PIXCIR_DBG("tp_ps: i2c write fail, err:%d\n", err);       

           }

           /*Avoid to disable the tp function When wake up failure during awary from the phone.Modify the end by tianxiaohui in 2013-04-22*/           

           else

                   {

                            return -1;

                   }

         }

 

         else

         {

                   pixcir_ts_pwron();

                   pixcir_reset();

        

                   msleep(50);

                   pixcir_i2c_write_data(0x80, 0x12);

                   enable_irq(global_irq);

         }

 

}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值