diff options
Diffstat (limited to 'drivers/video/omap2/displays/panel-taal.c')
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index e52631efe7e2..df720c31288f 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | 34 | ||
35 | #include <plat/display.h> | 35 | #include <plat/display.h> |
36 | #include <plat/nokia-dsi-panel.h> | ||
36 | 37 | ||
37 | /* DSI Virtual channel. Hardcoded for now. */ | 38 | /* DSI Virtual channel. Hardcoded for now. */ |
38 | #define TCH 0 | 39 | #define TCH 0 |
@@ -85,7 +86,6 @@ struct taal_data { | |||
85 | bool mirror; | 86 | bool mirror; |
86 | 87 | ||
87 | bool te_enabled; | 88 | bool te_enabled; |
88 | bool use_ext_te; | ||
89 | 89 | ||
90 | atomic_t do_update; | 90 | atomic_t do_update; |
91 | struct { | 91 | struct { |
@@ -107,6 +107,12 @@ struct taal_data { | |||
107 | struct delayed_work esd_work; | 107 | struct delayed_work esd_work; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | static inline struct nokia_dsi_panel_data | ||
111 | *get_panel_data(const struct omap_dss_device *dssdev) | ||
112 | { | ||
113 | return (struct nokia_dsi_panel_data *) dssdev->data; | ||
114 | } | ||
115 | |||
110 | static void taal_esd_work(struct work_struct *work); | 116 | static void taal_esd_work(struct work_struct *work); |
111 | 117 | ||
112 | static void hw_guard_start(struct taal_data *td, int guard_msec) | 118 | static void hw_guard_start(struct taal_data *td, int guard_msec) |
@@ -288,6 +294,7 @@ static int taal_bl_update_status(struct backlight_device *dev) | |||
288 | { | 294 | { |
289 | struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev); | 295 | struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev); |
290 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 296 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
297 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
291 | int r; | 298 | int r; |
292 | int level; | 299 | int level; |
293 | 300 | ||
@@ -310,10 +317,10 @@ static int taal_bl_update_status(struct backlight_device *dev) | |||
310 | r = 0; | 317 | r = 0; |
311 | } | 318 | } |
312 | } else { | 319 | } else { |
313 | if (!dssdev->set_backlight) | 320 | if (!panel_data->set_backlight) |
314 | r = -EINVAL; | 321 | r = -EINVAL; |
315 | else | 322 | else |
316 | r = dssdev->set_backlight(dssdev, level); | 323 | r = panel_data->set_backlight(dssdev, level); |
317 | } | 324 | } |
318 | 325 | ||
319 | mutex_unlock(&td->lock); | 326 | mutex_unlock(&td->lock); |
@@ -503,16 +510,18 @@ static struct attribute_group taal_attr_group = { | |||
503 | 510 | ||
504 | static void taal_hw_reset(struct omap_dss_device *dssdev) | 511 | static void taal_hw_reset(struct omap_dss_device *dssdev) |
505 | { | 512 | { |
506 | if (dssdev->reset_gpio == -1) | 513 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); |
514 | |||
515 | if (panel_data->reset_gpio == -1) | ||
507 | return; | 516 | return; |
508 | 517 | ||
509 | gpio_set_value(dssdev->reset_gpio, 1); | 518 | gpio_set_value(panel_data->reset_gpio, 1); |
510 | udelay(10); | 519 | udelay(10); |
511 | /* reset the panel */ | 520 | /* reset the panel */ |
512 | gpio_set_value(dssdev->reset_gpio, 0); | 521 | gpio_set_value(panel_data->reset_gpio, 0); |
513 | /* assert reset for at least 10us */ | 522 | /* assert reset for at least 10us */ |
514 | udelay(10); | 523 | udelay(10); |
515 | gpio_set_value(dssdev->reset_gpio, 1); | 524 | gpio_set_value(panel_data->reset_gpio, 1); |
516 | /* wait 5ms after releasing reset */ | 525 | /* wait 5ms after releasing reset */ |
517 | msleep(5); | 526 | msleep(5); |
518 | } | 527 | } |
@@ -522,6 +531,7 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
522 | struct backlight_properties props; | 531 | struct backlight_properties props; |
523 | struct taal_data *td; | 532 | struct taal_data *td; |
524 | struct backlight_device *bldev; | 533 | struct backlight_device *bldev; |
534 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
525 | int r; | 535 | int r; |
526 | 536 | ||
527 | const struct omap_video_timings taal_panel_timings = { | 537 | const struct omap_video_timings taal_panel_timings = { |
@@ -531,6 +541,11 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
531 | 541 | ||
532 | dev_dbg(&dssdev->dev, "probe\n"); | 542 | dev_dbg(&dssdev->dev, "probe\n"); |
533 | 543 | ||
544 | if (!panel_data || !panel_data->name) { | ||
545 | r = -EINVAL; | ||
546 | goto err; | ||
547 | } | ||
548 | |||
534 | dssdev->panel.config = OMAP_DSS_LCD_TFT; | 549 | dssdev->panel.config = OMAP_DSS_LCD_TFT; |
535 | dssdev->panel.timings = taal_panel_timings; | 550 | dssdev->panel.timings = taal_panel_timings; |
536 | dssdev->ctrl.pixel_size = 24; | 551 | dssdev->ctrl.pixel_size = 24; |
@@ -561,7 +576,7 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
561 | /* if no platform set_backlight() defined, presume DSI backlight | 576 | /* if no platform set_backlight() defined, presume DSI backlight |
562 | * control */ | 577 | * control */ |
563 | memset(&props, 0, sizeof(struct backlight_properties)); | 578 | memset(&props, 0, sizeof(struct backlight_properties)); |
564 | if (!dssdev->set_backlight) | 579 | if (!panel_data->set_backlight) |
565 | td->use_dsi_bl = true; | 580 | td->use_dsi_bl = true; |
566 | 581 | ||
567 | if (td->use_dsi_bl) | 582 | if (td->use_dsi_bl) |
@@ -586,8 +601,8 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
586 | 601 | ||
587 | taal_bl_update_status(bldev); | 602 | taal_bl_update_status(bldev); |
588 | 603 | ||
589 | if (dssdev->phy.dsi.ext_te) { | 604 | if (panel_data->use_ext_te) { |
590 | int gpio = dssdev->phy.dsi.ext_te_gpio; | 605 | int gpio = panel_data->ext_te_gpio; |
591 | 606 | ||
592 | r = gpio_request(gpio, "taal irq"); | 607 | r = gpio_request(gpio, "taal irq"); |
593 | if (r) { | 608 | if (r) { |
@@ -610,8 +625,6 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
610 | INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work, | 625 | INIT_DELAYED_WORK_DEFERRABLE(&td->te_timeout_work, |
611 | taal_te_timeout_work_callback); | 626 | taal_te_timeout_work_callback); |
612 | 627 | ||
613 | td->use_ext_te = true; | ||
614 | |||
615 | dev_dbg(&dssdev->dev, "Using GPIO TE\n"); | 628 | dev_dbg(&dssdev->dev, "Using GPIO TE\n"); |
616 | } | 629 | } |
617 | 630 | ||
@@ -623,11 +636,11 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
623 | 636 | ||
624 | return 0; | 637 | return 0; |
625 | err_sysfs: | 638 | err_sysfs: |
626 | if (td->use_ext_te) | 639 | if (panel_data->use_ext_te) |
627 | free_irq(gpio_to_irq(dssdev->phy.dsi.ext_te_gpio), dssdev); | 640 | free_irq(gpio_to_irq(panel_data->ext_te_gpio), dssdev); |
628 | err_irq: | 641 | err_irq: |
629 | if (td->use_ext_te) | 642 | if (panel_data->use_ext_te) |
630 | gpio_free(dssdev->phy.dsi.ext_te_gpio); | 643 | gpio_free(panel_data->ext_te_gpio); |
631 | err_gpio: | 644 | err_gpio: |
632 | backlight_device_unregister(bldev); | 645 | backlight_device_unregister(bldev); |
633 | err_bl: | 646 | err_bl: |
@@ -641,14 +654,15 @@ err: | |||
641 | static void taal_remove(struct omap_dss_device *dssdev) | 654 | static void taal_remove(struct omap_dss_device *dssdev) |
642 | { | 655 | { |
643 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 656 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
657 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
644 | struct backlight_device *bldev; | 658 | struct backlight_device *bldev; |
645 | 659 | ||
646 | dev_dbg(&dssdev->dev, "remove\n"); | 660 | dev_dbg(&dssdev->dev, "remove\n"); |
647 | 661 | ||
648 | sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group); | 662 | sysfs_remove_group(&dssdev->dev.kobj, &taal_attr_group); |
649 | 663 | ||
650 | if (td->use_ext_te) { | 664 | if (panel_data->use_ext_te) { |
651 | int gpio = dssdev->phy.dsi.ext_te_gpio; | 665 | int gpio = panel_data->ext_te_gpio; |
652 | free_irq(gpio_to_irq(gpio), dssdev); | 666 | free_irq(gpio_to_irq(gpio), dssdev); |
653 | gpio_free(gpio); | 667 | gpio_free(gpio); |
654 | } | 668 | } |
@@ -958,6 +972,7 @@ static int taal_update(struct omap_dss_device *dssdev, | |||
958 | u16 x, u16 y, u16 w, u16 h) | 972 | u16 x, u16 y, u16 w, u16 h) |
959 | { | 973 | { |
960 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 974 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
975 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
961 | int r; | 976 | int r; |
962 | 977 | ||
963 | dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h); | 978 | dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h); |
@@ -978,7 +993,7 @@ static int taal_update(struct omap_dss_device *dssdev, | |||
978 | if (r) | 993 | if (r) |
979 | goto err; | 994 | goto err; |
980 | 995 | ||
981 | if (td->te_enabled && td->use_ext_te) { | 996 | if (td->te_enabled && panel_data->use_ext_te) { |
982 | td->update_region.x = x; | 997 | td->update_region.x = x; |
983 | td->update_region.y = y; | 998 | td->update_region.y = y; |
984 | td->update_region.w = w; | 999 | td->update_region.w = w; |
@@ -1021,6 +1036,7 @@ static int taal_sync(struct omap_dss_device *dssdev) | |||
1021 | 1036 | ||
1022 | static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) | 1037 | static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) |
1023 | { | 1038 | { |
1039 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
1024 | int r; | 1040 | int r; |
1025 | 1041 | ||
1026 | if (enable) | 1042 | if (enable) |
@@ -1028,7 +1044,7 @@ static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) | |||
1028 | else | 1044 | else |
1029 | r = taal_dcs_write_0(DCS_TEAR_OFF); | 1045 | r = taal_dcs_write_0(DCS_TEAR_OFF); |
1030 | 1046 | ||
1031 | if (!td->use_ext_te) | 1047 | if (!panel_data->use_ext_te) |
1032 | omapdss_dsi_enable_te(dssdev, enable); | 1048 | omapdss_dsi_enable_te(dssdev, enable); |
1033 | 1049 | ||
1034 | /* XXX for some reason, DSI TE breaks if we don't wait here. | 1050 | /* XXX for some reason, DSI TE breaks if we don't wait here. |
@@ -1272,6 +1288,7 @@ static void taal_esd_work(struct work_struct *work) | |||
1272 | struct taal_data *td = container_of(work, struct taal_data, | 1288 | struct taal_data *td = container_of(work, struct taal_data, |
1273 | esd_work.work); | 1289 | esd_work.work); |
1274 | struct omap_dss_device *dssdev = td->dssdev; | 1290 | struct omap_dss_device *dssdev = td->dssdev; |
1291 | struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev); | ||
1275 | u8 state1, state2; | 1292 | u8 state1, state2; |
1276 | int r; | 1293 | int r; |
1277 | 1294 | ||
@@ -1312,7 +1329,7 @@ static void taal_esd_work(struct work_struct *work) | |||
1312 | } | 1329 | } |
1313 | /* Self-diagnostics result is also shown on TE GPIO line. We need | 1330 | /* Self-diagnostics result is also shown on TE GPIO line. We need |
1314 | * to re-enable TE after self diagnostics */ | 1331 | * to re-enable TE after self diagnostics */ |
1315 | if (td->use_ext_te && td->te_enabled) { | 1332 | if (td->te_enabled && panel_data->use_ext_te) { |
1316 | r = taal_dcs_write_1(DCS_TEAR_ON, 0); | 1333 | r = taal_dcs_write_1(DCS_TEAR_ON, 0); |
1317 | if (r) | 1334 | if (r) |
1318 | goto err; | 1335 | goto err; |