0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include "cyttsp4_core.h"
0018
0019 #include <linux/i2c.h>
0020 #include <linux/input.h>
0021
0022 #define CYTTSP4_I2C_DATA_SIZE (3 * 256)
0023
0024 static const struct cyttsp4_bus_ops cyttsp4_i2c_bus_ops = {
0025 .bustype = BUS_I2C,
0026 .write = cyttsp_i2c_write_block_data,
0027 .read = cyttsp_i2c_read_block_data,
0028 };
0029
0030 static int cyttsp4_i2c_probe(struct i2c_client *client,
0031 const struct i2c_device_id *id)
0032 {
0033 struct cyttsp4 *ts;
0034
0035 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
0036 dev_err(&client->dev, "I2C functionality not Supported\n");
0037 return -EIO;
0038 }
0039
0040 ts = cyttsp4_probe(&cyttsp4_i2c_bus_ops, &client->dev, client->irq,
0041 CYTTSP4_I2C_DATA_SIZE);
0042
0043 return PTR_ERR_OR_ZERO(ts);
0044 }
0045
0046 static int cyttsp4_i2c_remove(struct i2c_client *client)
0047 {
0048 struct cyttsp4 *ts = i2c_get_clientdata(client);
0049
0050 cyttsp4_remove(ts);
0051
0052 return 0;
0053 }
0054
0055 static const struct i2c_device_id cyttsp4_i2c_id[] = {
0056 { CYTTSP4_I2C_NAME, 0 },
0057 { }
0058 };
0059 MODULE_DEVICE_TABLE(i2c, cyttsp4_i2c_id);
0060
0061 static struct i2c_driver cyttsp4_i2c_driver = {
0062 .driver = {
0063 .name = CYTTSP4_I2C_NAME,
0064 .pm = &cyttsp4_pm_ops,
0065 },
0066 .probe = cyttsp4_i2c_probe,
0067 .remove = cyttsp4_i2c_remove,
0068 .id_table = cyttsp4_i2c_id,
0069 };
0070
0071 module_i2c_driver(cyttsp4_i2c_driver);
0072
0073 MODULE_LICENSE("GPL");
0074 MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) I2C driver");
0075 MODULE_AUTHOR("Cypress");