ili210x.c (201f3c803544c052aa1bab9e562e0ada4aefe03d) | ili210x.c (1bdec5d9818c47e080c19784dfd25d1d9c20807e) |
---|---|
1#include <linux/module.h> 2#include <linux/i2c.h> 3#include <linux/interrupt.h> 4#include <linux/slab.h> 5#include <linux/input.h> 6#include <linux/input/mt.h> 7#include <linux/delay.h> 8#include <linux/workqueue.h> --- 163 unchanged lines hidden (view full) --- 172 173static void ili210x_power_down(void *data) 174{ 175 struct gpio_desc *reset_gpio = data; 176 177 gpiod_set_value_cansleep(reset_gpio, 1); 178} 179 | 1#include <linux/module.h> 2#include <linux/i2c.h> 3#include <linux/interrupt.h> 4#include <linux/slab.h> 5#include <linux/input.h> 6#include <linux/input/mt.h> 7#include <linux/delay.h> 8#include <linux/workqueue.h> --- 163 unchanged lines hidden (view full) --- 172 173static void ili210x_power_down(void *data) 174{ 175 struct gpio_desc *reset_gpio = data; 176 177 gpiod_set_value_cansleep(reset_gpio, 1); 178} 179 |
180static void ili210x_cancel_work(void *data) 181{ 182 struct ili210x *priv = data; 183 184 cancel_delayed_work_sync(&priv->dwork); 185} 186 |
|
180static int ili210x_i2c_probe(struct i2c_client *client, 181 const struct i2c_device_id *id) 182{ 183 struct device *dev = &client->dev; 184 struct ili210x *priv; 185 struct gpio_desc *reset_gpio; 186 struct input_dev *input; 187 struct panel_info panel; --- 73 unchanged lines hidden (view full) --- 261 262 /* Multi touch */ 263 input_mt_init_slots(input, MAX_TOUCHES, 0); 264 input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0); 265 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0); 266 267 i2c_set_clientdata(client, priv); 268 | 187static int ili210x_i2c_probe(struct i2c_client *client, 188 const struct i2c_device_id *id) 189{ 190 struct device *dev = &client->dev; 191 struct ili210x *priv; 192 struct gpio_desc *reset_gpio; 193 struct input_dev *input; 194 struct panel_info panel; --- 73 unchanged lines hidden (view full) --- 268 269 /* Multi touch */ 270 input_mt_init_slots(input, MAX_TOUCHES, 0); 271 input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0); 272 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0); 273 274 i2c_set_clientdata(client, priv); 275 |
269 error = request_irq(client->irq, ili210x_irq, 0, 270 client->name, priv); | 276 error = devm_add_action(dev, ili210x_cancel_work, priv); 277 if (error) 278 return error; 279 280 error = devm_request_irq(dev, client->irq, ili210x_irq, 0, 281 client->name, priv); |
271 if (error) { 272 dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", 273 error); | 282 if (error) { 283 dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", 284 error); |
274 goto err_free_mem; | 285 return error; |
275 } 276 277 error = sysfs_create_group(&dev->kobj, &ili210x_attr_group); 278 if (error) { 279 dev_err(dev, "Unable to create sysfs attributes, err: %d\n", 280 error); | 286 } 287 288 error = sysfs_create_group(&dev->kobj, &ili210x_attr_group); 289 if (error) { 290 dev_err(dev, "Unable to create sysfs attributes, err: %d\n", 291 error); |
281 goto err_free_irq; | 292 return error; |
282 } 283 284 error = input_register_device(priv->input); 285 if (error) { 286 dev_err(dev, "Cannot register input device, err: %d\n", error); 287 goto err_remove_sysfs; 288 } 289 290 device_init_wakeup(dev, 1); 291 292 dev_dbg(dev, 293 "ILI210x initialized (IRQ: %d), firmware version %d.%d.%d", 294 client->irq, firmware.id, firmware.major, firmware.minor); 295 296 return 0; 297 298err_remove_sysfs: 299 sysfs_remove_group(&dev->kobj, &ili210x_attr_group); | 293 } 294 295 error = input_register_device(priv->input); 296 if (error) { 297 dev_err(dev, "Cannot register input device, err: %d\n", error); 298 goto err_remove_sysfs; 299 } 300 301 device_init_wakeup(dev, 1); 302 303 dev_dbg(dev, 304 "ILI210x initialized (IRQ: %d), firmware version %d.%d.%d", 305 client->irq, firmware.id, firmware.major, firmware.minor); 306 307 return 0; 308 309err_remove_sysfs: 310 sysfs_remove_group(&dev->kobj, &ili210x_attr_group); |
300err_free_irq: 301 free_irq(client->irq, priv); 302err_free_mem: | |
303 return error; 304} 305 306static int ili210x_i2c_remove(struct i2c_client *client) 307{ | 311 return error; 312} 313 314static int ili210x_i2c_remove(struct i2c_client *client) 315{ |
308 struct ili210x *priv = i2c_get_clientdata(client); 309 | |
310 sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group); | 316 sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group); |
311 free_irq(priv->client->irq, priv); 312 cancel_delayed_work_sync(&priv->dwork); | |
313 314 return 0; 315} 316 317static int __maybe_unused ili210x_i2c_suspend(struct device *dev) 318{ 319 struct i2c_client *client = to_i2c_client(dev); 320 --- 40 unchanged lines hidden --- | 317 318 return 0; 319} 320 321static int __maybe_unused ili210x_i2c_suspend(struct device *dev) 322{ 323 struct i2c_client *client = to_i2c_client(dev); 324 --- 40 unchanged lines hidden --- |