搜索

451

主题

662

帖子

4997

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4997
QQ
发表于 2022-10-22 17:20:30 590 浏览 0 回复

T618(UMS512) Android11 TP 功耗配置

问题:
    展锐T618 基线触摸屏 无休眠唤醒功能;

解决方案:
   主要是创建节点: /sys/class/touchscreen_suspend/device/suspend_tp,展锐自行设计,系统层通过对suspend_tp节点进行写0和1后,TP 进行睡眠和唤醒;
   修改代码如下(代码路径:bsp/modules/kernel4.14/input/touchscreen/focaltech_8006/focaltech.c):
  1. static int ft5x0x_i2c_txdata(char *txdata, int length)
  2. @@ -1560,6 +1601,81 @@ static const struct attribute_group ft5x0x_attr_group = {
  3. extern char TP_NAME[20];
  4. extern  unsigned char TP_FW_VER;
  5. #endif
  6. +static int ft_suspend()
  7. +{
  8. +        //int ret = -1;
  9. +        printk("==%s==\n", __FUNCTION__);
  10. +
  11. +        //ret = ft5x0x_write_reg(FT5X0X_REG_PMODE, PMODE_HIBERNATE);
  12. +        //if(ret){
  13. +        //        printk("==ft5x0x_ts_suspend==  ft5x0x_write_reg fail\n");
  14. +        //}
  15. +        ///
  16. +        ft5x0x_irq_disable(g_ft5x0x_ts);
  17. +        ft5x0x_clear_report_data(g_ft5x0x_ts);
  18. +
  19. +        return 0;
  20. +}
  21. +
  22. +//static void ft5x0x_resume(void)
  23. +static int ft_resume()
  24. +{
  25. +        //ret = ft5x0x_write_reg(FT5X0X_REG_PMODE, PMODE_HIBERNATE);
  26. +
  27. +        //ft5x0x_ts_reset();
  28. +
  29. +        ft5x0x_irq_enable(g_ft5x0x_ts);
  30. +        msleep(2);
  31. +        ft5x0x_clear_report_data(g_ft5x0x_ts);
  32. +
  33. +
  34. +        return 0;
  35. +}
  36. +
  37. +static ssize_t suspend_tp_show(struct device *dev,struct device_attribute *attr, char *buf)
  38. +{
  39. +        
  40. +        return sprintf(buf, "ts_suspend_show %d\n", ft_suspend_flag);
  41. +
  42. +
  43. +}
  44. +
  45. +static ssize_t suspend_tp_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t count)
  46. +{
  47. +        //struct goodix_ts_data *pdata = i2c_get_clientdata(i2c_connect_client);
  48. +
  49. +        //printk("ts_suspend_store 11 \n");
  50. +        //if(ft_suspend_flag == 0) {
  51. +        //        ft_suspend_flag = 1;
  52. +        //        return count;
  53. +        //}
  54. +                 
  55. +        printk("%s %d  \n",__func__,__LINE__);
  56. +        
  57. +    if ((buf[0] == '1'))
  58. +    {
  59. +                ft_suspend();
  60. +                ft_suspend_flag = 1;
  61. +        }
  62. +    else if ((buf[0] == '0'))
  63. +    {
  64. +                ft_resume();
  65. +                ft_suspend_flag = 0;
  66. +        }
  67. +        
  68. +    return count;
  69. +}
  70. +
  71. +static DEVICE_ATTR(suspend_tp,0664,suspend_tp_show,suspend_tp_store);
  72. +


  73. static int ft5x0x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
  74. {
  75. @@ -1568,6 +1684,10 @@ static int ft5x0x_ts_probe(struct i2c_client *client, const struct i2c_device_id
  76.          struct ft5x0x_ts_platform_data *pdata = client->dev.platform_data;
  77.          int err = 0;
  78.          unsigned char uc_reg_value;
  79. +    struct class *touchsreen_suspend_class;
  80. +    struct device *touchsreen_suspend_dev;
  81. +
  82. +        
  83. #ifdef __WW6_CDC_COM__
  84.          u8 i;
  85. #endif
  86. @@ -1840,6 +1960,21 @@ focaltech_get_upgrade_array(client);
  87. #ifdef SYSFS_DEBUG        
  88. fts_create_sysfs_ww(client);
  89. #endif
  90. +        printk("[GTP] %s %d\n",__func__,__LINE__);        
  91. +    touchsreen_suspend_class = class_create(THIS_MODULE,"touchscreen_suspend");
  92. +        if(IS_ERR(touchsreen_suspend_class))
  93. +                printk("Failed to create class!\n");
  94. +
  95. +        touchsreen_suspend_dev = device_create(touchsreen_suspend_class, NULL, 0, NULL, "device");
  96. +        if(IS_ERR(touchsreen_suspend_dev))
  97. +                printk("Failed to create device!\n");
  98. +
  99. +        if(device_create_file(touchsreen_suspend_dev, &dev_attr_suspend_tp) < 0) // /sys/class/touchscreen_suspend/device/suspend_tp
  100. +                printk("Failed to create device file(%s)!\n", dev_attr_suspend_tp.attr.name);
  101. +
  102. +        printk("[GTP] %s %d\n",__func__,__LINE__);        
  103. +
  104. +        ft_suspend_flag = 0;
复制代码

参考资料:



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
手机微信同号:13682654092
回复

使用道具 举报

返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


登录或注册
快速回复 返回顶部 返回列表