3 * Cypress TrueTouch(TM) Standard Product (TTSP) I2C touchscreen driver.
4 * For use with Cypress Txx3xx and Txx4xx parts.
5 * Supported parts include:
11 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
12 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * version 2, and only version 2, as published by the
17 * Free Software Foundation.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
28 #include <linux/device.h>
29 #include <linux/export.h>
30 #include <linux/i2c.h>
31 #include <linux/module.h>
32 #include <linux/types.h>
34 int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
35 u8 addr, u8 length, void *values)
37 struct i2c_client *client = to_i2c_client(dev);
38 struct i2c_msg msgs[] = {
54 retval = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
58 return retval != ARRAY_SIZE(msgs) ? -EIO : 0;
60 EXPORT_SYMBOL_GPL(cyttsp_i2c_read_block_data);
62 int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf,
63 u8 addr, u8 length, const void *values)
65 struct i2c_client *client = to_i2c_client(dev);
69 memcpy(&xfer_buf[1], values, length);
71 retval = i2c_master_send(client, xfer_buf, length + 1);
73 return retval < 0 ? retval : 0;
75 EXPORT_SYMBOL_GPL(cyttsp_i2c_write_block_data);
78 MODULE_LICENSE("GPL");
79 MODULE_AUTHOR("Cypress");