@@ -272,6 +272,10 @@ void operate_mode_switch(struct touchpanel_data *ts)
272272 ts -> ts_ops -> tp_refresh_switch (ts -> chip_data , ts -> lcd_fps );
273273 }
274274
275+ if (ts -> oos_edge_limit_support ) {
276+ ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_LIMIT_SWITCH , ts -> limit_switch );
277+ }
278+
275279 ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_NORMAL , true);
276280 }
277281}
@@ -2761,6 +2765,226 @@ static const struct file_operations proc_limit_area_ops = {
27612765 .owner = THIS_MODULE ,
27622766};
27632767
2768+ static ssize_t proc_limit_switch_write (struct file * file , const char __user * buffer , size_t count , loff_t * ppos )
2769+ {
2770+ int value = 0 ;
2771+ char buf [4 ] = {0 };
2772+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2773+
2774+ if (count > 4 ) {
2775+ TPD_INFO ("%s:count > 4\n" , __func__ );
2776+ return count ;
2777+ }
2778+
2779+ if (!ts ) {
2780+ TPD_INFO ("%s: ts is NULL\n" , __func__ );
2781+ return count ;
2782+ }
2783+
2784+ if (copy_from_user (buf , buffer , count )) {
2785+ TPD_INFO ("%s: read proc input error.\n" , __func__ );
2786+ return count ;
2787+ }
2788+ sscanf (buf , "%d" , & value );
2789+ ts -> limit_switch = value ;
2790+
2791+ TPD_DEBUG ("%s: ts->limit_switch = %d\n" , __func__ , value );
2792+ if (ts -> is_suspended == 0 ) {
2793+ mutex_lock (& ts -> mutex );
2794+ ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_LIMIT_SWITCH , ts -> limit_switch );
2795+ mutex_unlock (& ts -> mutex );
2796+ }
2797+ return count ;
2798+ }
2799+
2800+ static ssize_t proc_limit_switch_read (struct file * file , char __user * user_buf , size_t count , loff_t * ppos )
2801+ {
2802+ int ret = 0 ;
2803+ char page [4 ] = {0 };
2804+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2805+
2806+ if (!ts ) {
2807+ sprintf (page , "%d\n" , -1 ); /*no support*/
2808+ } else {
2809+ sprintf (page , "%d\n" , ts -> limit_switch ); /*support*/
2810+ }
2811+ ret = simple_read_from_buffer (user_buf , count , ppos , page , strlen (page ));
2812+ return ret ;
2813+ }
2814+
2815+ static ssize_t proc_dead_zone_write (struct file * file , const char __user * buffer , size_t count , loff_t * ppos )
2816+ {
2817+ char buf [8 ] = {0 };
2818+ int data [6 ] = {0 };
2819+ int ret = -1 ;
2820+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2821+
2822+ if (!ts ) {
2823+ TPD_INFO ("%s: ts is NULL\n" , __func__ );
2824+ return count ;
2825+ }
2826+
2827+ ret = copy_from_user (buf , buffer , count );
2828+ if (ret ) {
2829+ TPD_INFO ("%s: read proc input error.\n" , __func__ );
2830+ return count ;
2831+ }
2832+
2833+ if (sscanf (buf , "%d,%d" , & data [0 ], & data [1 ]) == 2 ) {
2834+ if (data [0 ] > 50 || data [1 ] > 50 ) {
2835+ TPD_INFO ("data not allow\n" );
2836+ return count ;
2837+ }
2838+ ts -> dead_zone_l = data [0 ];
2839+ ts -> dead_zone_p = data [1 ];
2840+ }
2841+ TPD_INFO ("data[0] is %d, data[1] is %d\n" , data [0 ], data [1 ]);
2842+
2843+ if (ts -> is_suspended == 0 ) {
2844+ mutex_lock (& ts -> mutex );
2845+ ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_LIMIT_SWITCH , ts -> limit_switch );
2846+ mutex_unlock (& ts -> mutex );
2847+ }
2848+ return count ;
2849+ }
2850+
2851+ static ssize_t proc_dead_zone_read (struct file * file , char __user * user_buf , size_t count , loff_t * ppos )
2852+ {
2853+ int ret = 0 ;
2854+ char page [9 ] = {0 };
2855+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2856+
2857+ if (!ts ) {
2858+ sprintf (page , "%d\n" , -1 ); /*no support*/
2859+ } else {
2860+ sprintf (page , "%d,%d\n" , ts -> dead_zone_l , ts -> dead_zone_p );
2861+ }
2862+ ret = simple_read_from_buffer (user_buf , count , ppos , page , strlen (page ));
2863+ return ret ;
2864+ }
2865+
2866+ static const struct file_operations proc_limit_switch_fops = {
2867+ .write = proc_limit_switch_write ,
2868+ .read = proc_limit_switch_read ,
2869+ .open = simple_open ,
2870+ .owner = THIS_MODULE ,
2871+ };
2872+
2873+ static const struct file_operations proc_tp_dead_zone_fops = {
2874+ .write = proc_dead_zone_write ,
2875+ .read = proc_dead_zone_read ,
2876+ .open = simple_open ,
2877+ .owner = THIS_MODULE ,
2878+ };
2879+
2880+ static ssize_t proc_corner_dead_zone_l_write (struct file * file , const char __user * buffer , size_t count , loff_t * ppos )
2881+ {
2882+ char buf [8 ] = {0 };
2883+ int data [6 ] = {0 };
2884+ int ret = -1 ;
2885+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2886+
2887+ if (!ts ) {
2888+ TPD_INFO ("%s: ts is NULL\n" , __func__ );
2889+ return count ;
2890+ }
2891+
2892+ ret = copy_from_user (buf , buffer , count );
2893+ if (ret ) {
2894+ TPD_INFO ("%s: read proc input error.\n" , __func__ );
2895+ return count ;
2896+ }
2897+
2898+ if (sscanf (buf , "%d,%d" , & data [0 ], & data [1 ]) == 2 ) {
2899+ ts -> corner_dead_zone_xl = data [0 ];
2900+ ts -> corner_dead_zone_yl = data [1 ];
2901+ }
2902+ TPD_INFO ("data[0] is %d, data[1] is %d\n" , data [0 ], data [1 ]);
2903+
2904+ if (ts -> is_suspended == 0 ) {
2905+ mutex_lock (& ts -> mutex );
2906+ ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_LIMIT_SWITCH , ts -> limit_switch );
2907+ mutex_unlock (& ts -> mutex );
2908+ }
2909+ return count ;
2910+ }
2911+
2912+ static ssize_t proc_corner_dead_zone_l_read (struct file * file , char __user * user_buf , size_t count , loff_t * ppos )
2913+ {
2914+ int ret = 0 ;
2915+ char page [9 ] = {0 };
2916+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2917+
2918+ if (!ts ) {
2919+ sprintf (page , "%d\n" , -1 );
2920+ } else {
2921+ sprintf (page , "%d,%d\n" , ts -> corner_dead_zone_xl , ts -> corner_dead_zone_yl );
2922+ }
2923+ ret = simple_read_from_buffer (user_buf , count , ppos , page , strlen (page ));
2924+ return ret ;
2925+ }
2926+
2927+ static const struct file_operations proc_tp_corner_dead_zone_l_fops = {
2928+ .write = proc_corner_dead_zone_l_write ,
2929+ .read = proc_corner_dead_zone_l_read ,
2930+ .open = simple_open ,
2931+ .owner = THIS_MODULE ,
2932+ };
2933+
2934+ static ssize_t proc_corner_dead_zone_p_write (struct file * file , const char __user * buffer , size_t count , loff_t * ppos )
2935+ {
2936+ char buf [8 ] = {0 };
2937+ int data [6 ] = {0 };
2938+ int ret = -1 ;
2939+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2940+
2941+ if (!ts ) {
2942+ TPD_INFO ("%s: ts is NULL\n" , __func__ );
2943+ return count ;
2944+ }
2945+
2946+ ret = copy_from_user (buf , buffer , count );
2947+ if (ret ) {
2948+ TPD_INFO ("%s: read proc input error.\n" , __func__ );
2949+ return count ;
2950+ }
2951+
2952+ if (sscanf (buf , "%d,%d" , & data [0 ], & data [1 ]) == 2 ) {
2953+ ts -> corner_dead_zone_xp = data [0 ];
2954+ ts -> corner_dead_zone_yp = data [1 ];
2955+ }
2956+ TPD_INFO ("data[0] is %d, data[1] is %d\n" , data [0 ], data [1 ]);
2957+
2958+ if (ts -> is_suspended == 0 ) {
2959+ mutex_lock (& ts -> mutex );
2960+ ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_LIMIT_SWITCH , ts -> limit_switch );
2961+ mutex_unlock (& ts -> mutex );
2962+ }
2963+ return count ;
2964+ }
2965+
2966+ static ssize_t proc_corner_dead_zone_p_read (struct file * file , char __user * user_buf , size_t count , loff_t * ppos )
2967+ {
2968+ int ret = 0 ;
2969+ char page [9 ] = {0 };
2970+ struct touchpanel_data * ts = PDE_DATA (file_inode (file ));
2971+
2972+ if (!ts ) {
2973+ sprintf (page , "%d\n" , -1 );
2974+ } else {
2975+ sprintf (page , "%d,%d\n" , ts -> corner_dead_zone_xp , ts -> corner_dead_zone_yp );
2976+ }
2977+ ret = simple_read_from_buffer (user_buf , count , ppos , page , strlen (page ));
2978+ return ret ;
2979+ }
2980+
2981+ static const struct file_operations proc_tp_corner_dead_zone_p_fops = {
2982+ .write = proc_corner_dead_zone_p_write ,
2983+ .read = proc_corner_dead_zone_p_read ,
2984+ .open = simple_open ,
2985+ .owner = THIS_MODULE ,
2986+ };
2987+
27642988static ssize_t proc_limit_control_read (struct file * file , char __user * user_buf , size_t count , loff_t * ppos )
27652989{
27662990 ssize_t ret = 0 ;
@@ -2916,6 +3140,15 @@ static ssize_t proc_dir_control_write(struct file *file, const char __user *buff
29163140 ts -> edge_limit .limit_area , ts -> edge_limit .left_y1 , ts -> edge_limit .right_y1 , ts -> edge_limit .left_y2 , ts -> edge_limit .right_y2 , ts -> edge_limit .left_y3 , ts -> edge_limit .right_y3 );
29173141 }
29183142
3143+ if (ts -> oos_edge_limit_support ) {
3144+ ts -> limit_switch = temp ;
3145+
3146+ TPD_INFO ("%s: ts->limit_switch = %d\n" , __func__ , temp );
3147+ if (ts -> is_suspended == 0 ) {
3148+ ts -> ts_ops -> mode_switch (ts -> chip_data , MODE_LIMIT_SWITCH , ts -> limit_switch );
3149+ }
3150+ }
3151+
29193152 mutex_unlock (& ts -> mutex );
29203153
29213154 return count ;
@@ -4712,6 +4945,38 @@ static int init_touchpanel_proc(struct touchpanel_data *ts)
47124945 }
47134946 }
47144947
4948+ if (ts -> oos_edge_limit_support ) {
4949+ prEntry_tmp = proc_create_data ("tpedge_limit_enable" , 0666 , prEntry_tp , & proc_limit_switch_fops , ts );
4950+ if (prEntry_tmp == NULL ) {
4951+ ret = - ENOMEM ;
4952+ TPD_INFO ("%s: Couldn't create proc entry, %d\n" , __func__ , __LINE__ );
4953+ }
4954+
4955+ prEntry_tmp = proc_create_data ("tp_switch_dead_zone" , 0666 , prEntry_tp , & proc_tp_dead_zone_fops , ts );
4956+ if (prEntry_tmp == NULL ) {
4957+ ret = - ENOMEM ;
4958+ TPD_INFO ("%s: Couldn't create proc entry, %d\n" , __func__ , __LINE__ );
4959+ }
4960+
4961+ prEntry_tmp = proc_create_data ("tp_switch_corner_dead_l_zone" , 0666 , prEntry_tp , & proc_tp_corner_dead_zone_l_fops , ts );
4962+ if (prEntry_tmp == NULL ) {
4963+ ret = - ENOMEM ;
4964+ TPD_INFO ("%s: Couldn't create proc entry, %d\n" , __func__ , __LINE__ );
4965+ }
4966+
4967+ prEntry_tmp = proc_create_data ("tp_switch_corner_dead_p_zone" , 0666 , prEntry_tp , & proc_tp_corner_dead_zone_p_fops , ts );
4968+ if (prEntry_tmp == NULL ) {
4969+ ret = - ENOMEM ;
4970+ TPD_INFO ("%s: Couldn't create proc entry, %d\n" , __func__ , __LINE__ );
4971+ }
4972+
4973+ prEntry_tmp = proc_create_data ("oplus_tp_direction" , 0666 , prEntry_tp , & touch_dir_proc_fops , ts );
4974+ if (prEntry_tmp == NULL ) {
4975+ ret = - ENOMEM ;
4976+ TPD_INFO ("%s: Couldn't create proc entry, %d\n" , __func__ , __LINE__ );
4977+ }
4978+ }
4979+
47154980 //proc files-step2-4:/proc/touchpanel/double_tap_enable (black gesture related interface)
47164981 if (ts -> black_gesture_support ) {
47174982 prEntry_tmp = proc_create_data ("double_tap_enable" , 0666 , prEntry_tp , & proc_gesture_control_fops , ts );
@@ -6487,6 +6752,7 @@ static int init_parse_dts(struct device *dev, struct touchpanel_data *ts)
64876752 }
64886753 ts -> register_is_16bit = of_property_read_bool (np , "register-is-16bit" );
64896754 ts -> edge_limit_support = of_property_read_bool (np , "edge_limit_support" );
6755+ ts -> oos_edge_limit_support = of_property_read_bool (np , "oos_edge_limit_support" );
64906756 ts -> fw_edge_limit_support = of_property_read_bool (np , "fw_edge_limit_support" );
64916757 ts -> drlimit_remove_support = of_property_read_bool (np , "drlimit_remove_support" );
64926758 ts -> glove_mode_support = of_property_read_bool (np , "glove_mode_support" );
@@ -6530,6 +6796,7 @@ static int init_parse_dts(struct device *dev, struct touchpanel_data *ts)
65306796 ts -> report_rate_white_list_support = of_property_read_bool (np , "report_rate_white_list_support" );
65316797 ts -> lcd_tp_refresh_support = of_property_read_bool (np , "lcd_tp_refresh_support" );
65326798 ts -> smooth_level_support = of_property_read_bool (np , "smooth_level_support" );
6799+ ts -> project_info = of_property_read_bool (np , "project_info" );
65336800 ts -> pen_support = of_property_read_bool (np , "pen_support" );
65346801 ts -> exception_upload_support = of_property_read_bool (np , "exception_upload_support" );
65356802 /*set disable suspend irq handler parameter, for of_property_read_bool return 1 when success and return 0 when item is not exist*/
@@ -7690,6 +7957,21 @@ int register_common_touch_device(struct touchpanel_data *pdata)
76907957 } else {
76917958 ts -> irq = ts -> client -> irq ;
76927959 }
7960+ if (ts -> project_info == 1 ) {
7961+ ts -> dead_zone_l = 25 ;
7962+ ts -> dead_zone_p = 25 ;
7963+ } else {
7964+ ts -> dead_zone_l = 20 ;
7965+ ts -> dead_zone_p = 20 ;
7966+ }
7967+ if (ts -> int_mode == UNBANNABLE ) {
7968+ ts -> dead_zone_l = 10 ;
7969+ ts -> dead_zone_p = 10 ;
7970+ ts -> corner_dead_zone_xl = 0x88 ;
7971+ ts -> corner_dead_zone_yl = 0x44 ;
7972+ ts -> corner_dead_zone_xp = 0x24 ;
7973+ ts -> corner_dead_zone_yp = 0xF5 ;
7974+ }
76937975 tp_register_times ++ ;
76947976 g_tp = ts ;
76957977 complete (& ts -> pm_complete );
0 commit comments