@@ -57,6 +57,11 @@ struct fpc1020_data {
5757 int screen_on ;
5858};
5959
60+ extern bool home_button_pressed (void );
61+ extern void reset_home_button (bool );
62+
63+ bool reset ;
64+
6065static int fb_notifier_callback (struct notifier_block * self , unsigned long event , void * data );
6166
6267static ssize_t irq_get (struct device * device ,
@@ -84,6 +89,7 @@ static ssize_t irq_set(struct device* device,
8489 return - ENOENT ;
8590 return strnlen (buffer , count );
8691}
92+
8793static DEVICE_ATTR (irq , S_IRUSR | S_IWUSR , irq_get , irq_set ) ;
8894
8995static ssize_t fp_wl_get (struct device * device ,
@@ -111,6 +117,7 @@ static ssize_t fp_wl_set(struct device* device,
111117 }
112118 return strnlen (buffer , count );
113119}
120+
114121static DEVICE_ATTR (wl , S_IRUSR | S_IWUSR , fp_wl_get , fp_wl_set ) ;
115122
116123static ssize_t get_wakeup_status (struct device * device ,
@@ -143,12 +150,13 @@ static ssize_t set_wakeup_status(struct device* device,
143150
144151 return strnlen (buffer , count );
145152}
153+
146154static DEVICE_ATTR (wakeup , S_IRUSR | S_IWUSR , get_wakeup_status , set_wakeup_status ) ;
147155
148156static ssize_t get_key (struct device * device , struct device_attribute * attribute , char * buffer )
149157{
150158 struct fpc1020_data * fpc1020 = dev_get_drvdata (device );
151- return scnprintf (buffer , PAGE_SIZE , "%i\n" , fpc1020 -> report_key );
159+ return scnprintf (buffer , PAGE_SIZE , "%i\n" , fpc1020 -> report_key );
152160}
153161
154162static ssize_t set_key (struct device * device ,
@@ -163,13 +171,26 @@ static ssize_t set_key(struct device* device,
163171 if (!retval ) {
164172 if (val == KEY_HOME )
165173 val = KEY_NAVI_LONG ; //Convert to U-touch long press keyValue
174+ if (val != 0 && home_button_pressed ()) val = 0 ;
175+
176+ pr_info ("home key pressed = %d\n" , (int )home_button_pressed ());
166177 fpc1020 -> report_key = (int )val ;
167178 queue_work (fpc1020 -> fpc1020_wq , & fpc1020 -> input_report_work );
179+
180+ if (val == 0 ) {
181+ pr_info ("calling home key reset" );
182+ reset_home_button (0 );
183+ }
168184 } else
169185 return - ENOENT ;
170186 return strnlen (buffer , count );
187+ }
171188
189+ bool reset_gpio (void )
190+ {
191+ return reset ;
172192}
193+
173194static DEVICE_ATTR (key , S_IRUSR | S_IWUSR , get_key , set_key ) ;
174195
175196static ssize_t get_screen_stat (struct device * device , struct device_attribute * attribute , char * buffer )
@@ -184,6 +205,7 @@ static ssize_t set_screen_stat(struct device* device,
184205{
185206 return 1 ;
186207}
208+
187209static DEVICE_ATTR (screen , S_IRUSR | S_IWUSR , get_screen_stat , set_screen_stat ) ;
188210
189211static struct attribute * attributes [] = {
@@ -194,6 +216,7 @@ static struct attribute *attributes[] = {
194216 & dev_attr_screen .attr ,
195217 NULL
196218};
219+
197220static const struct attribute_group attribute_group = {
198221 .attrs = attributes ,
199222};
@@ -316,7 +339,6 @@ static int fpc1020_manage_sysfs(struct fpc1020_data *fpc1020)
316339 return 0 ;
317340}
318341
319-
320342static int fpc1020_alloc_input_dev (struct fpc1020_data * fpc1020 )
321343{
322344 int retval = 0 ;
0 commit comments