summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorEric Nelson <eric.nelson@boundarydevices.com>2014-05-07 15:28:38 -0700
committerEric Nelson <eric.nelson@boundarydevices.com>2014-05-07 15:33:43 -0700
commite642ab37a60af7f68cca18f337fe1314869f5f9f (patch)
tree1c6d6fb9ad7ff38fadc6a413d03ab34da35f05fa /drivers
parentfe41f1e14c1769c2012b21ac6375ddb1ab15ea52 (diff)
ft5x06: implement proc_read/proc_write to read I2C registers
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/touchscreen/ft5x06_ts.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/ft5x06_ts.c b/drivers/input/touchscreen/ft5x06_ts.c
index fb73cb4d227b..7a97fa40fe89 100644
--- a/drivers/input/touchscreen/ft5x06_ts.c
+++ b/drivers/input/touchscreen/ft5x06_ts.c
@@ -88,6 +88,7 @@ struct ft5x06_ts {
int irq;
unsigned gp;
int buttons;
+ struct proc_dir_entry *procentry;
};
static const char *client_name = "ft5x06";
@@ -240,12 +241,10 @@ static void set_mode(struct ft5x06_ts *ts, int mode)
static int proc_regnum = 0;
static int ft5x06_proc_read
- (char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data)
+ (struct file *f,
+ char __user *ubuf,
+ size_t count,
+ loff_t *off)
{
int ret;
unsigned char startch[1] = { (u8)proc_regnum };
@@ -269,13 +268,18 @@ static int
ft5x06_proc_write
(struct file *file,
const char __user *buffer,
- unsigned long count,
- void *data)
+ size_t count,
+ loff_t *data)
{
proc_regnum = simple_strtoul(buffer,0,0);
return count ;
}
+struct file_operations proc_fops = {
+ .read = ft5x06_proc_read,
+ .write = ft5x06_proc_write,
+};
+
/*-----------------------------------------------------------------------*/
static void irq_reenable_work(struct work_struct *work)
{
@@ -548,6 +552,8 @@ static int ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
err = ts_register(ts);
if (err == 0) {
gts = ts;
+ ts->procentry = proc_create(procentryname, 0x660, NULL,
+ &proc_fops);
return 0;
}
err_create_wq_failed:
@@ -560,6 +566,7 @@ err_create_wq_failed:
static int ts_remove(struct i2c_client *client)
{
struct ft5x06_ts *ts = i2c_get_clientdata(client);
+ remove_proc_entry(procentryname, 0);
if (ts == gts) {
gts = NULL;
ts_deregister(ts);