| @@ -63,6 +63,9 @@ struct tpo_td043_device { · 62 unmodified lines |
| 63 | 63 | u32 power_on_resume:1; |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | +/* used to pass spi_device from SPI to DSS portion of the driver */ |
| 67 | +static struct tpo_td043_device *g_tpo_td043; |
| 68 | + |
| 66 | 69 | static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) |
| 67 | 70 | { |
| 68 | 71 | struct spi_message m; |
| @@ -403,7 +406,7 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev) · 334 unmodified lines |
| 403 | 406 | |
| 404 | 407 | static int tpo_td043_probe(struct omap_dss_device *dssdev) |
| 405 | 408 | { |
| 406 | | − struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); |
| 409 | + struct tpo_td043_device *tpo_td043 = g_tpo_td043; |
| 407 | 410 | int nreset_gpio = dssdev->reset_gpio; |
| 408 | 411 | int ret = 0; |
| 409 | 412 | |
| @@ -440,6 +443,8 @@ static int tpo_td043_probe(struct omap_dss_device *dssdev) · 30 unmodified lines |
| 440 | 443 | if (ret) |
| 441 | 444 | dev_warn(&dssdev->dev, "failed to create sysfs files\n"); |
| 442 | 445 | |
| 446 | + dev_set_drvdata(&dssdev->dev, tpo_td043); |
| 447 | + |
| 443 | 448 | return 0; |
| 444 | 449 | |
| 445 | 450 | fail_gpio_req: |
| @@ -505,6 +510,9 @@ static int tpo_td043_spi_probe(struct spi_device *spi) · 59 unmodified lines |
| 505 | 510 | return -ENODEV; |
| 506 | 511 | } |
| 507 | 512 | |
| 513 | + if (g_tpo_td043 != NULL) |
| 514 | + return -EBUSY; |
| 515 | + |
| 508 | 516 | spi->bits_per_word = 16; |
| 509 | 517 | spi->mode = SPI_MODE_0; |
| 510 | 518 | |
| @@ -521,7 +529,7 @@ static int tpo_td043_spi_probe(struct spi_device *spi) · 10 unmodified lines |
| 521 | 529 | tpo_td043->spi = spi; |
| 522 | 530 | tpo_td043->nreset_gpio = dssdev->reset_gpio; |
| 523 | 531 | dev_set_drvdata(&spi->dev, tpo_td043); |
| 524 | | − dev_set_drvdata(&dssdev->dev, tpo_td043); |
| 532 | + g_tpo_td043 = tpo_td043; |
| 525 | 533 | |
| 526 | 534 | omap_dss_register_driver(&tpo_td043_driver); |
| 527 | 535 | |
| @@ -534,6 +542,7 @@ static int tpo_td043_spi_remove(struct spi_device *spi) · 6 unmodified lines |
| 534 | 542 | |
| 535 | 543 | omap_dss_unregister_driver(&tpo_td043_driver); |
| 536 | 544 | kfree(tpo_td043); |
| 545 | + g_tpo_td043 = NULL; |
| 537 | 546 | |
| 538 | 547 | return 0; |
| 539 | 548 | } |