diff options
author | Eric Nelson <eric.nelson@boundarydevices.com> | 2013-10-24 14:38:13 -0700 |
---|---|---|
committer | Eric Nelson <eric.nelson@boundarydevices.com> | 2013-10-24 15:06:59 -0700 |
commit | 424b30d3417bc8b82eb2e94f3c134292229837aa (patch) | |
tree | 1a51faf50cc2a254b50994554a8f740436ef33e3 | |
parent | 8196edb1d5c7254ebd7b537a8e19ff0aa29c0e44 (diff) |
ft5x06: implement /proc/ft5x06 to allow register reads
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
-rw-r--r-- | drivers/input/touchscreen/ft5x06_ts.c | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/drivers/input/touchscreen/ft5x06_ts.c b/drivers/input/touchscreen/ft5x06_ts.c index 7885c1082e5a..5168739ec3a1 100644 --- a/drivers/input/touchscreen/ft5x06_ts.c +++ b/drivers/input/touchscreen/ft5x06_ts.c @@ -92,29 +92,6 @@ static char const procentryname[] = { static int ts_startup(struct ft5x06_ts *ts); static void ts_shutdown(struct ft5x06_ts *ts); -static int ft5x06_proc_read - (char *page, - char **start, - off_t off, - int count, - int *eof, - void *data) -{ - printk(KERN_ERR "%s\n", __func__); - return 0 ; -} - -static int -ft5x06_proc_write - (struct file *file, - const char __user *buffer, - unsigned long count, - void *data) -{ - printk(KERN_ERR "%s\n", __func__); - return count ; -} - /*-----------------------------------------------------------------------*/ static inline void ts_evt_add(struct ft5x06_ts *ts, unsigned buttons, struct point *p) @@ -252,6 +229,44 @@ static void set_mode(struct ft5x06_ts *ts, int mode) #define WORK_MODE 0 #define FACTORY_MODE 4 +static int proc_regnum = 0; +static int ft5x06_proc_read + (char *page, + char **start, + off_t off, + int count, + int *eof, + void *data) +{ + int ret; + unsigned char startch[1] = { (u8)proc_regnum }; + unsigned char buf[1]; + struct i2c_msg readpkt[2] = { + {gts->client->addr, 0, 1, startch}, + {gts->client->addr, I2C_M_RD, sizeof(buf), buf} + }; + ret = i2c_transfer(gts->client->adapter, readpkt, + ARRAY_SIZE(readpkt)); + if (ret != ARRAY_SIZE(readpkt)) { + printk(KERN_WARNING "%s: i2c_transfer failed\n", + client_name); + } else { + printk (KERN_ERR "ft5x06[0x%02x] == 0x%02x\n", (u8)proc_regnum, buf[0]); + } + return 0 ; +} + +static int +ft5x06_proc_write + (struct file *file, + const char __user *buffer, + unsigned long count, + void *data) +{ + proc_regnum = simple_strtoul(buffer,0,0); + return count ; +} + /*-----------------------------------------------------------------------*/ /* |