tsc2005.c (a636df9673e1e4627722777fe6075943372e76be) | tsc2005.c (273cf48aa95a86ee368a10b9a2a6b0c62544ffe5) |
---|---|
1/* 2 * TSC2005 touchscreen driver 3 * 4 * Copyright (C) 2006-2010 Nokia Corporation 5 * 6 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com> 7 * based on TSC2301 driver by Klaus K. Pedersen <klaus.k.pedersen@nokia.com> 8 * --- 20 unchanged lines hidden (view full) --- 29#include <linux/interrupt.h> 30#include <linux/delay.h> 31#include <linux/pm.h> 32#include <linux/of.h> 33#include <linux/of_gpio.h> 34#include <linux/spi/spi.h> 35#include <linux/spi/tsc2005.h> 36#include <linux/regulator/consumer.h> | 1/* 2 * TSC2005 touchscreen driver 3 * 4 * Copyright (C) 2006-2010 Nokia Corporation 5 * 6 * Author: Lauri Leukkunen <lauri.leukkunen@nokia.com> 7 * based on TSC2301 driver by Klaus K. Pedersen <klaus.k.pedersen@nokia.com> 8 * --- 20 unchanged lines hidden (view full) --- 29#include <linux/interrupt.h> 30#include <linux/delay.h> 31#include <linux/pm.h> 32#include <linux/of.h> 33#include <linux/of_gpio.h> 34#include <linux/spi/spi.h> 35#include <linux/spi/tsc2005.h> 36#include <linux/regulator/consumer.h> |
37#include <linux/regmap.h> |
|
37 38/* 39 * The touchscreen interface operates as follows: 40 * 41 * 1) Pen is pressed against the touchscreen. 42 * 2) TSC2005 performs AD conversion. 43 * 3) After the conversion is done TSC2005 drives DAV line down. 44 * 4) GPIO IRQ is received and tsc2005_irq_thread() is scheduled. --- 70 unchanged lines hidden (view full) --- 115#define TSC2005_DEF_X_FUZZ 4 116#define TSC2005_DEF_Y_FUZZ 8 117#define TSC2005_DEF_P_FUZZ 2 118#define TSC2005_DEF_RESISTOR 280 119 120#define TSC2005_SPI_MAX_SPEED_HZ 10000000 121#define TSC2005_PENUP_TIME_MS 40 122 | 38 39/* 40 * The touchscreen interface operates as follows: 41 * 42 * 1) Pen is pressed against the touchscreen. 43 * 2) TSC2005 performs AD conversion. 44 * 3) After the conversion is done TSC2005 drives DAV line down. 45 * 4) GPIO IRQ is received and tsc2005_irq_thread() is scheduled. --- 70 unchanged lines hidden (view full) --- 116#define TSC2005_DEF_X_FUZZ 4 117#define TSC2005_DEF_Y_FUZZ 8 118#define TSC2005_DEF_P_FUZZ 2 119#define TSC2005_DEF_RESISTOR 280 120 121#define TSC2005_SPI_MAX_SPEED_HZ 10000000 122#define TSC2005_PENUP_TIME_MS 40 123 |
123struct tsc2005_spi_rd { 124 struct spi_transfer spi_xfer; 125 u32 spi_tx; 126 u32 spi_rx; | 124static const struct regmap_range tsc2005_writable_ranges[] = { 125 regmap_reg_range(TSC2005_REG_AUX_HIGH, TSC2005_REG_CFR2), |
127}; 128 | 126}; 127 |
128static const struct regmap_access_table tsc2005_writable_table = { 129 .yes_ranges = tsc2005_writable_ranges, 130 .n_yes_ranges = ARRAY_SIZE(tsc2005_writable_ranges), 131}; 132 133static struct regmap_config tsc2005_regmap_config = { 134 .reg_bits = 8, 135 .val_bits = 16, 136 .reg_stride = 0x08, 137 .max_register = 0x78, 138 .read_flag_mask = TSC2005_REG_READ, 139 .write_flag_mask = TSC2005_REG_PND0, 140 .wr_table = &tsc2005_writable_table, 141 .use_single_rw = true, 142}; 143 144struct tsc2005_data { 145 u16 x; 146 u16 y; 147 u16 z1; 148 u16 z2; 149} __packed; 150#define TSC2005_DATA_REGS 4 151 |
|
129struct tsc2005 { 130 struct spi_device *spi; | 152struct tsc2005 { 153 struct spi_device *spi; |
154 struct regmap *regmap; |
|
131 | 155 |
132 struct spi_message spi_read_msg; 133 struct tsc2005_spi_rd spi_x; 134 struct tsc2005_spi_rd spi_y; 135 struct tsc2005_spi_rd spi_z1; 136 struct tsc2005_spi_rd spi_z2; 137 | |
138 struct input_dev *idev; 139 char phys[32]; 140 141 struct mutex mutex; 142 143 /* raw copy of previous x,y,z */ 144 int in_x; 145 int in_y; --- 39 unchanged lines hidden (view full) --- 185 dev_err(&ts->spi->dev, "%s: failed, command: %x, error: %d\n", 186 __func__, cmd, error); 187 return error; 188 } 189 190 return 0; 191} 192 | 156 struct input_dev *idev; 157 char phys[32]; 158 159 struct mutex mutex; 160 161 /* raw copy of previous x,y,z */ 162 int in_x; 163 int in_y; --- 39 unchanged lines hidden (view full) --- 203 dev_err(&ts->spi->dev, "%s: failed, command: %x, error: %d\n", 204 __func__, cmd, error); 205 return error; 206 } 207 208 return 0; 209} 210 |
193static int tsc2005_write(struct tsc2005 *ts, u8 reg, u16 value) 194{ 195 u32 tx = ((reg | TSC2005_REG_PND0) << 16) | value; 196 struct spi_transfer xfer = { 197 .tx_buf = &tx, 198 .len = 4, 199 .bits_per_word = 24, 200 }; 201 struct spi_message msg; 202 int error; 203 204 spi_message_init(&msg); 205 spi_message_add_tail(&xfer, &msg); 206 207 error = spi_sync(ts->spi, &msg); 208 if (error) { 209 dev_err(&ts->spi->dev, 210 "%s: failed, register: %x, value: %x, error: %d\n", 211 __func__, reg, value, error); 212 return error; 213 } 214 215 return 0; 216} 217 218static void tsc2005_setup_read(struct tsc2005_spi_rd *rd, u8 reg, bool last) 219{ 220 memset(rd, 0, sizeof(*rd)); 221 222 rd->spi_tx = (reg | TSC2005_REG_READ) << 16; 223 rd->spi_xfer.tx_buf = &rd->spi_tx; 224 rd->spi_xfer.rx_buf = &rd->spi_rx; 225 rd->spi_xfer.len = 4; 226 rd->spi_xfer.bits_per_word = 24; 227 rd->spi_xfer.cs_change = !last; 228} 229 230static int tsc2005_read(struct tsc2005 *ts, u8 reg, u16 *value) 231{ 232 struct tsc2005_spi_rd spi_rd; 233 struct spi_message msg; 234 int error; 235 236 tsc2005_setup_read(&spi_rd, reg, true); 237 238 spi_message_init(&msg); 239 spi_message_add_tail(&spi_rd.spi_xfer, &msg); 240 241 error = spi_sync(ts->spi, &msg); 242 if (error) 243 return error; 244 245 *value = spi_rd.spi_rx; 246 return 0; 247} 248 | |
249static void tsc2005_update_pen_state(struct tsc2005 *ts, 250 int x, int y, int pressure) 251{ 252 if (pressure) { 253 input_report_abs(ts->idev, ABS_X, x); 254 input_report_abs(ts->idev, ABS_Y, y); 255 input_report_abs(ts->idev, ABS_PRESSURE, pressure); 256 if (!ts->pen_down) { --- 12 unchanged lines hidden (view full) --- 269 pressure); 270} 271 272static irqreturn_t tsc2005_irq_thread(int irq, void *_ts) 273{ 274 struct tsc2005 *ts = _ts; 275 unsigned long flags; 276 unsigned int pressure; | 211static void tsc2005_update_pen_state(struct tsc2005 *ts, 212 int x, int y, int pressure) 213{ 214 if (pressure) { 215 input_report_abs(ts->idev, ABS_X, x); 216 input_report_abs(ts->idev, ABS_Y, y); 217 input_report_abs(ts->idev, ABS_PRESSURE, pressure); 218 if (!ts->pen_down) { --- 12 unchanged lines hidden (view full) --- 231 pressure); 232} 233 234static irqreturn_t tsc2005_irq_thread(int irq, void *_ts) 235{ 236 struct tsc2005 *ts = _ts; 237 unsigned long flags; 238 unsigned int pressure; |
277 u32 x, y; 278 u32 z1, z2; | 239 struct tsc2005_data tsdata; |
279 int error; 280 281 /* read the coordinates */ | 240 int error; 241 242 /* read the coordinates */ |
282 error = spi_sync(ts->spi, &ts->spi_read_msg); | 243 error = regmap_bulk_read(ts->regmap, TSC2005_REG_X, &tsdata, 244 TSC2005_DATA_REGS); |
283 if (unlikely(error)) 284 goto out; 285 | 245 if (unlikely(error)) 246 goto out; 247 |
286 x = ts->spi_x.spi_rx; 287 y = ts->spi_y.spi_rx; 288 z1 = ts->spi_z1.spi_rx; 289 z2 = ts->spi_z2.spi_rx; 290 | |
291 /* validate position */ | 248 /* validate position */ |
292 if (unlikely(x > MAX_12BIT || y > MAX_12BIT)) | 249 if (unlikely(tsdata.x > MAX_12BIT || tsdata.y > MAX_12BIT)) |
293 goto out; 294 295 /* Skip reading if the pressure components are out of range */ | 250 goto out; 251 252 /* Skip reading if the pressure components are out of range */ |
296 if (unlikely(z1 == 0 || z2 > MAX_12BIT || z1 >= z2)) | 253 if (unlikely(tsdata.z1 == 0 || tsdata.z2 > MAX_12BIT)) |
297 goto out; | 254 goto out; |
255 if (unlikely(tsdata.z1 >= tsdata.z2)) 256 goto out; |
|
298 299 /* 300 * Skip point if this is a pen down with the exact same values as 301 * the value before pen-up - that implies SPI fed us stale data 302 */ 303 if (!ts->pen_down && | 257 258 /* 259 * Skip point if this is a pen down with the exact same values as 260 * the value before pen-up - that implies SPI fed us stale data 261 */ 262 if (!ts->pen_down && |
304 ts->in_x == x && ts->in_y == y && 305 ts->in_z1 == z1 && ts->in_z2 == z2) { | 263 ts->in_x == tsdata.x && ts->in_y == tsdata.y && 264 ts->in_z1 == tsdata.z1 && ts->in_z2 == tsdata.z2) { |
306 goto out; 307 } 308 309 /* 310 * At this point we are happy we have a valid and useful reading. 311 * Remember it for later comparisons. We may now begin downsampling. 312 */ | 265 goto out; 266 } 267 268 /* 269 * At this point we are happy we have a valid and useful reading. 270 * Remember it for later comparisons. We may now begin downsampling. 271 */ |
313 ts->in_x = x; 314 ts->in_y = y; 315 ts->in_z1 = z1; 316 ts->in_z2 = z2; | 272 ts->in_x = tsdata.x; 273 ts->in_y = tsdata.y; 274 ts->in_z1 = tsdata.z1; 275 ts->in_z2 = tsdata.z2; |
317 318 /* Compute touch pressure resistance using equation #1 */ | 276 277 /* Compute touch pressure resistance using equation #1 */ |
319 pressure = x * (z2 - z1) / z1; | 278 pressure = tsdata.x * (tsdata.z2 - tsdata.z1) / tsdata.z1; |
320 pressure = pressure * ts->x_plate_ohm / 4096; 321 if (unlikely(pressure > MAX_12BIT)) 322 goto out; 323 324 spin_lock_irqsave(&ts->lock, flags); 325 | 279 pressure = pressure * ts->x_plate_ohm / 4096; 280 if (unlikely(pressure > MAX_12BIT)) 281 goto out; 282 283 spin_lock_irqsave(&ts->lock, flags); 284 |
326 tsc2005_update_pen_state(ts, x, y, pressure); | 285 tsc2005_update_pen_state(ts, tsdata.x, tsdata.y, pressure); |
327 mod_timer(&ts->penup_timer, 328 jiffies + msecs_to_jiffies(TSC2005_PENUP_TIME_MS)); 329 330 spin_unlock_irqrestore(&ts->lock, flags); 331 332 ts->last_valid_interrupt = jiffies; 333out: 334 return IRQ_HANDLED; --- 6 unchanged lines hidden (view full) --- 341 342 spin_lock_irqsave(&ts->lock, flags); 343 tsc2005_update_pen_state(ts, 0, 0, 0); 344 spin_unlock_irqrestore(&ts->lock, flags); 345} 346 347static void tsc2005_start_scan(struct tsc2005 *ts) 348{ | 286 mod_timer(&ts->penup_timer, 287 jiffies + msecs_to_jiffies(TSC2005_PENUP_TIME_MS)); 288 289 spin_unlock_irqrestore(&ts->lock, flags); 290 291 ts->last_valid_interrupt = jiffies; 292out: 293 return IRQ_HANDLED; --- 6 unchanged lines hidden (view full) --- 300 301 spin_lock_irqsave(&ts->lock, flags); 302 tsc2005_update_pen_state(ts, 0, 0, 0); 303 spin_unlock_irqrestore(&ts->lock, flags); 304} 305 306static void tsc2005_start_scan(struct tsc2005 *ts) 307{ |
349 tsc2005_write(ts, TSC2005_REG_CFR0, TSC2005_CFR0_INITVALUE); 350 tsc2005_write(ts, TSC2005_REG_CFR1, TSC2005_CFR1_INITVALUE); 351 tsc2005_write(ts, TSC2005_REG_CFR2, TSC2005_CFR2_INITVALUE); | 308 regmap_write(ts->regmap, TSC2005_REG_CFR0, TSC2005_CFR0_INITVALUE); 309 regmap_write(ts->regmap, TSC2005_REG_CFR1, TSC2005_CFR1_INITVALUE); 310 regmap_write(ts->regmap, TSC2005_REG_CFR2, TSC2005_CFR2_INITVALUE); |
352 tsc2005_cmd(ts, TSC2005_CMD_NORMAL); 353} 354 355static void tsc2005_stop_scan(struct tsc2005 *ts) 356{ 357 tsc2005_cmd(ts, TSC2005_CMD_STOP); 358} 359 --- 33 unchanged lines hidden (view full) --- 393} 394 395static ssize_t tsc2005_selftest_show(struct device *dev, 396 struct device_attribute *attr, 397 char *buf) 398{ 399 struct spi_device *spi = to_spi_device(dev); 400 struct tsc2005 *ts = spi_get_drvdata(spi); | 311 tsc2005_cmd(ts, TSC2005_CMD_NORMAL); 312} 313 314static void tsc2005_stop_scan(struct tsc2005 *ts) 315{ 316 tsc2005_cmd(ts, TSC2005_CMD_STOP); 317} 318 --- 33 unchanged lines hidden (view full) --- 352} 353 354static ssize_t tsc2005_selftest_show(struct device *dev, 355 struct device_attribute *attr, 356 char *buf) 357{ 358 struct spi_device *spi = to_spi_device(dev); 359 struct tsc2005 *ts = spi_get_drvdata(spi); |
401 u16 temp_high; 402 u16 temp_high_orig; 403 u16 temp_high_test; | 360 unsigned int temp_high; 361 unsigned int temp_high_orig; 362 unsigned int temp_high_test; |
404 bool success = true; 405 int error; 406 407 mutex_lock(&ts->mutex); 408 409 /* 410 * Test TSC2005 communications via temp high register. 411 */ 412 __tsc2005_disable(ts); 413 | 363 bool success = true; 364 int error; 365 366 mutex_lock(&ts->mutex); 367 368 /* 369 * Test TSC2005 communications via temp high register. 370 */ 371 __tsc2005_disable(ts); 372 |
414 error = tsc2005_read(ts, TSC2005_REG_TEMP_HIGH, &temp_high_orig); | 373 error = regmap_read(ts->regmap, TSC2005_REG_TEMP_HIGH, &temp_high_orig); |
415 if (error) { 416 dev_warn(dev, "selftest failed: read error %d\n", error); 417 success = false; 418 goto out; 419 } 420 421 temp_high_test = (temp_high_orig - 1) & MAX_12BIT; 422 | 374 if (error) { 375 dev_warn(dev, "selftest failed: read error %d\n", error); 376 success = false; 377 goto out; 378 } 379 380 temp_high_test = (temp_high_orig - 1) & MAX_12BIT; 381 |
423 error = tsc2005_write(ts, TSC2005_REG_TEMP_HIGH, temp_high_test); | 382 error = regmap_write(ts->regmap, TSC2005_REG_TEMP_HIGH, temp_high_test); |
424 if (error) { 425 dev_warn(dev, "selftest failed: write error %d\n", error); 426 success = false; 427 goto out; 428 } 429 | 383 if (error) { 384 dev_warn(dev, "selftest failed: write error %d\n", error); 385 success = false; 386 goto out; 387 } 388 |
430 error = tsc2005_read(ts, TSC2005_REG_TEMP_HIGH, &temp_high); | 389 error = regmap_read(ts->regmap, TSC2005_REG_TEMP_HIGH, &temp_high); |
431 if (error) { 432 dev_warn(dev, "selftest failed: read error %d after write\n", 433 error); 434 success = false; 435 goto out; 436 } 437 438 if (temp_high != temp_high_test) { --- 6 unchanged lines hidden (view full) --- 445 tsc2005_set_reset(ts, false); 446 usleep_range(100, 500); /* only 10us required */ 447 tsc2005_set_reset(ts, true); 448 449 if (!success) 450 goto out; 451 452 /* test that the reset really happened */ | 390 if (error) { 391 dev_warn(dev, "selftest failed: read error %d after write\n", 392 error); 393 success = false; 394 goto out; 395 } 396 397 if (temp_high != temp_high_test) { --- 6 unchanged lines hidden (view full) --- 404 tsc2005_set_reset(ts, false); 405 usleep_range(100, 500); /* only 10us required */ 406 tsc2005_set_reset(ts, true); 407 408 if (!success) 409 goto out; 410 411 /* test that the reset really happened */ |
453 error = tsc2005_read(ts, TSC2005_REG_TEMP_HIGH, &temp_high); | 412 error = regmap_read(ts->regmap, TSC2005_REG_TEMP_HIGH, &temp_high); |
454 if (error) { 455 dev_warn(dev, "selftest failed: read error %d after reset\n", 456 error); 457 success = false; 458 goto out; 459 } 460 461 if (temp_high != temp_high_orig) { --- 36 unchanged lines hidden (view full) --- 498 .is_visible = tsc2005_attr_is_visible, 499 .attrs = tsc2005_attrs, 500}; 501 502static void tsc2005_esd_work(struct work_struct *work) 503{ 504 struct tsc2005 *ts = container_of(work, struct tsc2005, esd_work.work); 505 int error; | 413 if (error) { 414 dev_warn(dev, "selftest failed: read error %d after reset\n", 415 error); 416 success = false; 417 goto out; 418 } 419 420 if (temp_high != temp_high_orig) { --- 36 unchanged lines hidden (view full) --- 457 .is_visible = tsc2005_attr_is_visible, 458 .attrs = tsc2005_attrs, 459}; 460 461static void tsc2005_esd_work(struct work_struct *work) 462{ 463 struct tsc2005 *ts = container_of(work, struct tsc2005, esd_work.work); 464 int error; |
506 u16 r; | 465 unsigned int r; |
507 508 if (!mutex_trylock(&ts->mutex)) { 509 /* 510 * If the mutex is taken, it means that disable or enable is in 511 * progress. In that case just reschedule the work. If the work 512 * is not needed, it will be canceled by disable. 513 */ 514 goto reschedule; 515 } 516 517 if (time_is_after_jiffies(ts->last_valid_interrupt + 518 msecs_to_jiffies(ts->esd_timeout))) 519 goto out; 520 521 /* We should be able to read register without disabling interrupts. */ | 466 467 if (!mutex_trylock(&ts->mutex)) { 468 /* 469 * If the mutex is taken, it means that disable or enable is in 470 * progress. In that case just reschedule the work. If the work 471 * is not needed, it will be canceled by disable. 472 */ 473 goto reschedule; 474 } 475 476 if (time_is_after_jiffies(ts->last_valid_interrupt + 477 msecs_to_jiffies(ts->esd_timeout))) 478 goto out; 479 480 /* We should be able to read register without disabling interrupts. */ |
522 error = tsc2005_read(ts, TSC2005_REG_CFR0, &r); | 481 error = regmap_read(ts->regmap, TSC2005_REG_CFR0, &r); |
523 if (!error && 524 !((r ^ TSC2005_CFR0_INITVALUE) & TSC2005_CFR0_RW_MASK)) { 525 goto out; 526 } 527 528 /* 529 * If we could not read our known value from configuration register 0 530 * then we should reset the controller as if from power-up and start --- 47 unchanged lines hidden (view full) --- 578 if (!ts->suspended) 579 __tsc2005_disable(ts); 580 581 ts->opened = false; 582 583 mutex_unlock(&ts->mutex); 584} 585 | 482 if (!error && 483 !((r ^ TSC2005_CFR0_INITVALUE) & TSC2005_CFR0_RW_MASK)) { 484 goto out; 485 } 486 487 /* 488 * If we could not read our known value from configuration register 0 489 * then we should reset the controller as if from power-up and start --- 47 unchanged lines hidden (view full) --- 537 if (!ts->suspended) 538 __tsc2005_disable(ts); 539 540 ts->opened = false; 541 542 mutex_unlock(&ts->mutex); 543} 544 |
586static void tsc2005_setup_spi_xfer(struct tsc2005 *ts) 587{ 588 tsc2005_setup_read(&ts->spi_x, TSC2005_REG_X, false); 589 tsc2005_setup_read(&ts->spi_y, TSC2005_REG_Y, false); 590 tsc2005_setup_read(&ts->spi_z1, TSC2005_REG_Z1, false); 591 tsc2005_setup_read(&ts->spi_z2, TSC2005_REG_Z2, true); 592 593 spi_message_init(&ts->spi_read_msg); 594 spi_message_add_tail(&ts->spi_x.spi_xfer, &ts->spi_read_msg); 595 spi_message_add_tail(&ts->spi_y.spi_xfer, &ts->spi_read_msg); 596 spi_message_add_tail(&ts->spi_z1.spi_xfer, &ts->spi_read_msg); 597 spi_message_add_tail(&ts->spi_z2.spi_xfer, &ts->spi_read_msg); 598} 599 | |
600static int tsc2005_probe(struct spi_device *spi) 601{ 602 const struct tsc2005_platform_data *pdata = dev_get_platdata(&spi->dev); 603 struct device_node *np = spi->dev.of_node; 604 605 struct tsc2005 *ts; 606 struct input_dev *input_dev; 607 unsigned int max_x = MAX_12BIT; --- 48 unchanged lines hidden (view full) --- 656 657 input_dev = devm_input_allocate_device(&spi->dev); 658 if (!input_dev) 659 return -ENOMEM; 660 661 ts->spi = spi; 662 ts->idev = input_dev; 663 | 545static int tsc2005_probe(struct spi_device *spi) 546{ 547 const struct tsc2005_platform_data *pdata = dev_get_platdata(&spi->dev); 548 struct device_node *np = spi->dev.of_node; 549 550 struct tsc2005 *ts; 551 struct input_dev *input_dev; 552 unsigned int max_x = MAX_12BIT; --- 48 unchanged lines hidden (view full) --- 601 602 input_dev = devm_input_allocate_device(&spi->dev); 603 if (!input_dev) 604 return -ENOMEM; 605 606 ts->spi = spi; 607 ts->idev = input_dev; 608 |
609 ts->regmap = devm_regmap_init_spi(spi, &tsc2005_regmap_config); 610 if (IS_ERR(ts->regmap)) 611 return PTR_ERR(ts->regmap); 612 |
|
664 ts->x_plate_ohm = x_plate_ohm; 665 ts->esd_timeout = esd_timeout; 666 667 if (np) { 668 ts->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); 669 if (ts->reset_gpio == -EPROBE_DEFER) 670 return ts->reset_gpio; 671 if (ts->reset_gpio < 0) { --- 23 unchanged lines hidden (view full) --- 695 696 mutex_init(&ts->mutex); 697 698 spin_lock_init(&ts->lock); 699 setup_timer(&ts->penup_timer, tsc2005_penup_timer, (unsigned long)ts); 700 701 INIT_DELAYED_WORK(&ts->esd_work, tsc2005_esd_work); 702 | 613 ts->x_plate_ohm = x_plate_ohm; 614 ts->esd_timeout = esd_timeout; 615 616 if (np) { 617 ts->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); 618 if (ts->reset_gpio == -EPROBE_DEFER) 619 return ts->reset_gpio; 620 if (ts->reset_gpio < 0) { --- 23 unchanged lines hidden (view full) --- 644 645 mutex_init(&ts->mutex); 646 647 spin_lock_init(&ts->lock); 648 setup_timer(&ts->penup_timer, tsc2005_penup_timer, (unsigned long)ts); 649 650 INIT_DELAYED_WORK(&ts->esd_work, tsc2005_esd_work); 651 |
703 tsc2005_setup_spi_xfer(ts); 704 | |
705 snprintf(ts->phys, sizeof(ts->phys), 706 "%s/input-ts", dev_name(&spi->dev)); 707 708 input_dev->name = "TSC2005 touchscreen"; 709 input_dev->phys = ts->phys; 710 input_dev->id.bustype = BUS_SPI; 711 input_dev->dev.parent = &spi->dev; 712 input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); --- 123 unchanged lines hidden --- | 652 snprintf(ts->phys, sizeof(ts->phys), 653 "%s/input-ts", dev_name(&spi->dev)); 654 655 input_dev->name = "TSC2005 touchscreen"; 656 input_dev->phys = ts->phys; 657 input_dev->id.bustype = BUS_SPI; 658 input_dev->dev.parent = &spi->dev; 659 input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); --- 123 unchanged lines hidden --- |