9 static struct i2c_device_id ct36x_ts_id[] = {
14 static struct i2c_board_info i2c_board_info[] = {
16 I2C_BOARD_INFO(DRIVER_NAME, 0x01),
17 .platform_data = NULL,
21 struct i2c_driver ct36x_ts_driver = {
26 .id_table = ct36x_ts_id,
27 .probe = ct36x_ts_probe,
28 .suspend = ct36x_ts_suspend,
29 .resume = ct36x_ts_resume,
30 .remove = __devexit_p(ct36x_ts_remove),
33 void ct36x_platform_get_cfg(struct ct36x_ts_info *ct36x_ts)
36 ct36x_ts->i2c_bus = CT36X_TS_I2C_BUS;
37 ct36x_ts->i2c_address = CT36X_TS_I2C_ADDRESS;
40 ct36x_ts->rst = CT36X_TS_RST_PIN;
41 ct36x_ts->ss = CT36X_TS_IRQ_PIN;
44 ct36x_ts->irq = gpio_to_irq(ct36x_ts->ss);
49 int ct36x_platform_set_dev(struct ct36x_ts_info *ct36x_ts)
51 struct i2c_adapter *adapter;
52 struct i2c_client *client;
54 adapter = i2c_get_adapter(ct36x_ts->i2c_bus);
56 printk("Unable to get i2c adapter on bus %d.\n", ct36x_ts->i2c_bus);
60 client = i2c_new_device(adapter, i2c_board_info);
61 i2c_put_adapter(adapter);
63 printk("Unable to create i2c device on bus %d.\n", ct36x_ts->i2c_bus);
67 ct36x_ts->client = client;
68 i2c_set_clientdata(client, ct36x_ts);
73 int ct36x_platform_get_resource(struct ct36x_ts_info *ct36x_ts)
78 err = gpio_request(ct36x_ts->rst, "ct36x_ts_rst");
82 gpio_direction_output(ct36x_ts->rst, 1);
83 gpio_set_value(ct36x_ts->rst, 1);
86 err = gpio_request(ct36x_ts->ss, "ct36x_ts_int");
90 gpio_direction_input(ct36x_ts->ss);
95 void ct36x_platform_put_resource(struct ct36x_ts_info *ct36x_ts)
97 gpio_free(ct36x_ts->rst);
98 gpio_free(ct36x_ts->ss);