Repository navigation
Expand file tree
/
Copy pathdiff
More file actions
executable file
·77 lines (66 loc) · 1.57 KB
/
Copy pathdiff
File metadata and controls
executable file
·77 lines (66 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
--- drivers/input/touchscreen/ft5x0x_ts.c 2013-06-06 22:43:29.893111900 -0400
+++ /tmp/ft5x0x_ts.c 2013-08-31 11:57:27.279267682 -0400
@@ -30,6 +30,7 @@
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/gpio.h>
#include "ft5x0x_ts.h"
@@ -39,6 +40,13 @@
//#define CONFIG_FT5X0X_MULTITOUCH 1
#define FT5X06_ID 0x79
+/* Convert GPIO signal to GPIO pin number */
+#define GPIO_TO_PIN(bank, gpio) (32 * (bank) + (gpio))
+#define BUZ_ENABLE GPIO_TO_PIN(3,21)
+
+#define BUZ_MAX 5
+static int buz_count = BUZ_MAX;
+
struct ts_event
{
u16 x1;
@@ -184,7 +192,10 @@
if (event->touch_point == 0)
{
+ buz_count = BUZ_MAX;
ft5x0x_ts_inactivate();
+ gpio_direction_output(BUZ_ENABLE, 0);
+
return 1;
}
@@ -314,12 +325,31 @@
if (ret == 0)
ft5x0x_report_value();
+
+/*
+ if(buz_count-- <= 0) // Close buzzer
+ {
+ buz_count = 0;
+ gpio_direction_output(BUZ_ENABLE, 0);
+ }
+*/
}
static irqreturn_t ft5x0x_ts_interrupt(int irq, void *dev_id)
{
struct ft5x0x_ts_data *ft5x0x_ts = dev_id;
+ if(buz_count == BUZ_MAX) // First touch down
+ {
+ gpio_direction_output(BUZ_ENABLE, 1);
+ }
+ else if(buz_count <= 0) // Time up, close buzzer
+ {
+ buz_count = 0;
+ gpio_direction_output(BUZ_ENABLE, 0);
+ }
+ buz_count --;
+
if (!work_pending(&ft5x0x_ts->pen_event_work))
queue_work(ft5x0x_ts->ts_workqueue, &ft5x0x_ts->pen_event_work);
@@ -417,6 +447,9 @@
goto err_free_input;
}
+ //gpio_request(BUZ_ENABLE , "");
+ gpio_direction_output(BUZ_ENABLE, 0);
+
return 0;
err_free_input: