From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Javier Martinez Canillas <martinez.javier@gmail.com>
Cc: Henrik Rydberg <rydberg@euromail.se>,
Mohan Pallaka <mpallaka@codeaurora.org>,
Kevin McNeely <kev@cypress.com>,
Shubhrajyoti Datta <omaplinuxkernel@gmail.com>,
linux-input@vger.kernel.org
Subject: [PATCH 5/7] Input: cyttsp - set up bus type in input device
Date: Mon, 14 Nov 2011 00:16:07 -0800 [thread overview]
Message-ID: <20111114081607.10141.91821.stgit@hammer.corenet.prv> (raw)
In-Reply-To: <20111114080939.10141.46174.stgit@hammer.corenet.prv>
Also clean up input device initialization.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/touchscreen/cyttsp_core.c | 7 +++----
drivers/input/touchscreen/cyttsp_core.h | 2 ++
drivers/input/touchscreen/cyttsp_i2c.c | 2 ++
drivers/input/touchscreen/cyttsp_spi.c | 4 +++-
4 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 4bc9fcd..764efd6 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -719,18 +719,17 @@ void *cyttsp_core_init(const struct cyttsp_bus_ops *bus_ops,
}
ts->input = input_device;
+ snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
+
input_device->name = ts->platform_data->name;
- snprintf(ts->phys, sizeof(ts->phys), "%s", dev_name(dev));
input_device->phys = ts->phys;
+ input_device->id.bustype = bus_ops->bustype;
input_device->dev.parent = ts->dev;
input_device->open = cyttsp_open;
input_device->close = cyttsp_close;
input_set_drvdata(input_device, ts);
- __set_bit(EV_SYN, input_device->evbit);
- __set_bit(EV_KEY, input_device->evbit);
__set_bit(EV_ABS, input_device->evbit);
-
input_set_abs_params(input_device, ABS_MT_POSITION_X,
0, ts->platform_data->maxx, 0, 0);
input_set_abs_params(input_device, ABS_MT_POSITION_Y,
diff --git a/drivers/input/touchscreen/cyttsp_core.h b/drivers/input/touchscreen/cyttsp_core.h
index 36f94ec..979a2f1 100644
--- a/drivers/input/touchscreen/cyttsp_core.h
+++ b/drivers/input/touchscreen/cyttsp_core.h
@@ -36,12 +36,14 @@
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/module.h>
+#include <linux/types.h>
#include <linux/input/cyttsp.h>
#define CY_NUM_RETRY 4 /* max number of retries for read ops */
struct cyttsp_bus_ops {
+ u16 bustype;
int (*write)(struct device *dev,
u8 addr, u8 length, const void *values);
int (*read)(struct device *dev, u8 addr, u8 length, void *values);
diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c
index 5911d9c..3c2dd9d 100644
--- a/drivers/input/touchscreen/cyttsp_i2c.c
+++ b/drivers/input/touchscreen/cyttsp_i2c.c
@@ -32,6 +32,7 @@
#include "cyttsp_core.h"
#include <linux/i2c.h>
+#include <linux/input.h>
#include <linux/slab.h>
#define CY_I2C_DATA_SIZE 128
@@ -80,6 +81,7 @@ static int ttsp_i2c_write_block_data(struct device *dev,
}
static const struct cyttsp_bus_ops cyttsp_i2c_bus_ops = {
+ .bustype = BUS_I2C,
.write = ttsp_i2c_write_block_data,
.read = ttsp_i2c_read_block_data,
};
diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
index 4540262..4c689c7 100644
--- a/drivers/input/touchscreen/cyttsp_spi.c
+++ b/drivers/input/touchscreen/cyttsp_spi.c
@@ -31,8 +31,9 @@
#include "cyttsp_core.h"
-#include <linux/spi/spi.h>
#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/spi/spi.h>
#define CY_SPI_WR_OP 0x00 /* r/~w */
#define CY_SPI_RD_OP 0x01
@@ -179,6 +180,7 @@ static int ttsp_spi_write_block_data(struct device *dev,
}
static const struct cyttsp_bus_ops cyttsp_spi_bus_ops = {
+ .bustype = BUS_SPI,
.write = ttsp_spi_write_block_data,
.read = ttsp_spi_read_block_data,
};
next prev parent reply other threads:[~2011-11-14 8:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 8:15 [PATCH 0/7] A few patches to cyttsp Dmitry Torokhov
2011-11-14 8:15 ` [PATCH 1/7] Input: cyttsp - move up into main touchscreen directory Dmitry Torokhov
2011-11-14 8:15 ` [PATCH 2/7] Input: cyttsp - rework Kconfig entries Dmitry Torokhov
2011-11-14 8:15 ` [PATCH 3/7] Input: cyttsp - guard PM methods with CONFIG_PM_SLEEP Dmitry Torokhov
2011-11-14 8:16 ` [PATCH 4/7] Input: cyttsp - device does not belong in bus structure Dmitry Torokhov
2011-11-14 8:16 ` Dmitry Torokhov [this message]
2011-11-14 8:16 ` [PATCH 6/7] Input: cyttsp - use unified structure for ts object Dmitry Torokhov
2011-11-14 8:16 ` [PATCH 7/7] Input: cyttsp - consolidate PM methods Dmitry Torokhov
2011-11-16 19:17 ` [PATCH 0/7] A few patches to cyttsp Javier Martinez Canillas
2011-11-16 19:38 ` Dmitry Torokhov
2011-11-16 20:17 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111114081607.10141.91821.stgit@hammer.corenet.prv \
--to=dmitry.torokhov@gmail.com \
--cc=kev@cypress.com \
--cc=linux-input@vger.kernel.org \
--cc=martinez.javier@gmail.com \
--cc=mpallaka@codeaurora.org \
--cc=omaplinuxkernel@gmail.com \
--cc=rydberg@euromail.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).