diff options
Diffstat (limited to 'drivers/input/touchscreen/cyttsp_i2c.c')
-rw-r--r-- | drivers/input/touchscreen/cyttsp_i2c.c | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c index 4dbdf44b8fc5..63104a86a9bd 100644 --- a/drivers/input/touchscreen/cyttsp_i2c.c +++ b/drivers/input/touchscreen/cyttsp_i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Source for: | 2 | * cyttsp_i2c.c |
3 | * Cypress TrueTouch(TM) Standard Product (TTSP) I2C touchscreen driver. | 3 | * Cypress TrueTouch(TM) Standard Product (TTSP) I2C touchscreen driver. |
4 | * For use with Cypress Txx3xx parts. | 4 | * For use with Cypress Txx3xx parts. |
5 | * Supported parts include: | 5 | * Supported parts include: |
@@ -19,11 +19,7 @@ | |||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
21 | * | 21 | * |
22 | * You should have received a copy of the GNU General Public License along | 22 | * Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com> |
23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
25 | * | ||
26 | * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com> | ||
27 | * | 23 | * |
28 | */ | 24 | */ |
29 | 25 | ||
@@ -34,47 +30,6 @@ | |||
34 | 30 | ||
35 | #define CY_I2C_DATA_SIZE 128 | 31 | #define CY_I2C_DATA_SIZE 128 |
36 | 32 | ||
37 | static int cyttsp_i2c_read_block_data(struct cyttsp *ts, | ||
38 | u8 addr, u8 length, void *values) | ||
39 | { | ||
40 | struct i2c_client *client = to_i2c_client(ts->dev); | ||
41 | struct i2c_msg msgs[] = { | ||
42 | { | ||
43 | .addr = client->addr, | ||
44 | .flags = 0, | ||
45 | .len = 1, | ||
46 | .buf = &addr, | ||
47 | }, | ||
48 | { | ||
49 | .addr = client->addr, | ||
50 | .flags = I2C_M_RD, | ||
51 | .len = length, | ||
52 | .buf = values, | ||
53 | }, | ||
54 | }; | ||
55 | int retval; | ||
56 | |||
57 | retval = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
58 | if (retval < 0) | ||
59 | return retval; | ||
60 | |||
61 | return retval != ARRAY_SIZE(msgs) ? -EIO : 0; | ||
62 | } | ||
63 | |||
64 | static int cyttsp_i2c_write_block_data(struct cyttsp *ts, | ||
65 | u8 addr, u8 length, const void *values) | ||
66 | { | ||
67 | struct i2c_client *client = to_i2c_client(ts->dev); | ||
68 | int retval; | ||
69 | |||
70 | ts->xfer_buf[0] = addr; | ||
71 | memcpy(&ts->xfer_buf[1], values, length); | ||
72 | |||
73 | retval = i2c_master_send(client, ts->xfer_buf, length + 1); | ||
74 | |||
75 | return retval < 0 ? retval : 0; | ||
76 | } | ||
77 | |||
78 | static const struct cyttsp_bus_ops cyttsp_i2c_bus_ops = { | 33 | static const struct cyttsp_bus_ops cyttsp_i2c_bus_ops = { |
79 | .bustype = BUS_I2C, | 34 | .bustype = BUS_I2C, |
80 | .write = cyttsp_i2c_write_block_data, | 35 | .write = cyttsp_i2c_write_block_data, |
@@ -98,7 +53,6 @@ static int cyttsp_i2c_probe(struct i2c_client *client, | |||
98 | return PTR_ERR(ts); | 53 | return PTR_ERR(ts); |
99 | 54 | ||
100 | i2c_set_clientdata(client, ts); | 55 | i2c_set_clientdata(client, ts); |
101 | |||
102 | return 0; | 56 | return 0; |
103 | } | 57 | } |
104 | 58 | ||