diff options
author | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-01-12 08:12:07 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-02-24 07:31:28 -0500 |
commit | 37ac60e414052f1d9301368437db8f0cb9e323fe (patch) | |
tree | d6b30b58deae82a6d5f2ac2f4d9cf18ed3bc57da /drivers/video | |
parent | 18946f62c6cc8cf051bafca8b7fa72309e8a1067 (diff) |
OMAP: DSS2: move enable/disable/suspend/resume
Move enable/disable/suspend/resume from omap_dss_device to
omap_dss_driver.
This is part of a larger patch-set, which moves the control from omapdss
driver to the display driver.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/displays/panel-generic.c | 56 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c | 67 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | 42 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-taal.c | 79 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-toppoly-tdo35s.c | 56 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-tpo-td043mtea1.c | 61 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 12 | ||||
-rw-r--r-- | drivers/video/omap2/dss/display.c | 14 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 102 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 136 | ||||
-rw-r--r-- | drivers/video/omap2/dss/rfbi.c | 22 | ||||
-rw-r--r-- | drivers/video/omap2/dss/sdi.c | 75 | ||||
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 251 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 12 |
14 files changed, 454 insertions, 531 deletions
diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c index eb48d1afd800..c59e4baed8b2 100644 --- a/drivers/video/omap2/displays/panel-generic.c +++ b/drivers/video/omap2/displays/panel-generic.c | |||
@@ -35,6 +35,35 @@ static struct omap_video_timings generic_panel_timings = { | |||
35 | .vbp = 7, | 35 | .vbp = 7, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static int generic_panel_power_on(struct omap_dss_device *dssdev) | ||
39 | { | ||
40 | int r; | ||
41 | |||
42 | r = omapdss_dpi_display_enable(dssdev); | ||
43 | if (r) | ||
44 | goto err0; | ||
45 | |||
46 | if (dssdev->platform_enable) { | ||
47 | r = dssdev->platform_enable(dssdev); | ||
48 | if (r) | ||
49 | goto err1; | ||
50 | } | ||
51 | |||
52 | return 0; | ||
53 | err1: | ||
54 | omapdss_dpi_display_disable(dssdev); | ||
55 | err0: | ||
56 | return r; | ||
57 | } | ||
58 | |||
59 | static void generic_panel_power_off(struct omap_dss_device *dssdev) | ||
60 | { | ||
61 | if (dssdev->platform_disable) | ||
62 | dssdev->platform_disable(dssdev); | ||
63 | |||
64 | omapdss_dpi_display_disable(dssdev); | ||
65 | } | ||
66 | |||
38 | static int generic_panel_probe(struct omap_dss_device *dssdev) | 67 | static int generic_panel_probe(struct omap_dss_device *dssdev) |
39 | { | 68 | { |
40 | dssdev->panel.config = OMAP_DSS_LCD_TFT; | 69 | dssdev->panel.config = OMAP_DSS_LCD_TFT; |
@@ -51,27 +80,40 @@ static int generic_panel_enable(struct omap_dss_device *dssdev) | |||
51 | { | 80 | { |
52 | int r = 0; | 81 | int r = 0; |
53 | 82 | ||
54 | if (dssdev->platform_enable) | 83 | r = generic_panel_power_on(dssdev); |
55 | r = dssdev->platform_enable(dssdev); | 84 | if (r) |
85 | return r; | ||
56 | 86 | ||
57 | return r; | 87 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
88 | |||
89 | return 0; | ||
58 | } | 90 | } |
59 | 91 | ||
60 | static void generic_panel_disable(struct omap_dss_device *dssdev) | 92 | static void generic_panel_disable(struct omap_dss_device *dssdev) |
61 | { | 93 | { |
62 | if (dssdev->platform_disable) | 94 | generic_panel_power_off(dssdev); |
63 | dssdev->platform_disable(dssdev); | 95 | |
96 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
64 | } | 97 | } |
65 | 98 | ||
66 | static int generic_panel_suspend(struct omap_dss_device *dssdev) | 99 | static int generic_panel_suspend(struct omap_dss_device *dssdev) |
67 | { | 100 | { |
68 | generic_panel_disable(dssdev); | 101 | generic_panel_power_off(dssdev); |
102 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
69 | return 0; | 103 | return 0; |
70 | } | 104 | } |
71 | 105 | ||
72 | static int generic_panel_resume(struct omap_dss_device *dssdev) | 106 | static int generic_panel_resume(struct omap_dss_device *dssdev) |
73 | { | 107 | { |
74 | return generic_panel_enable(dssdev); | 108 | int r = 0; |
109 | |||
110 | r = generic_panel_power_on(dssdev); | ||
111 | if (r) | ||
112 | return r; | ||
113 | |||
114 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
115 | |||
116 | return 0; | ||
75 | } | 117 | } |
76 | 118 | ||
77 | static struct omap_dss_driver generic_driver = { | 119 | static struct omap_dss_driver generic_driver = { |
diff --git a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c index e75798edbb59..10267461991c 100644 --- a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c +++ b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c | |||
@@ -39,6 +39,41 @@ static struct omap_video_timings sharp_lq_timings = { | |||
39 | .vbp = 2, | 39 | .vbp = 2, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev) | ||
43 | { | ||
44 | int r; | ||
45 | |||
46 | r = omapdss_dpi_display_enable(dssdev); | ||
47 | if (r) | ||
48 | goto err0; | ||
49 | |||
50 | /* wait couple of vsyncs until enabling the LCD */ | ||
51 | msleep(50); | ||
52 | |||
53 | if (dssdev->platform_enable) { | ||
54 | r = dssdev->platform_enable(dssdev); | ||
55 | if (r) | ||
56 | goto err1; | ||
57 | } | ||
58 | |||
59 | return 0; | ||
60 | err1: | ||
61 | omapdss_dpi_display_disable(dssdev); | ||
62 | err0: | ||
63 | return r; | ||
64 | } | ||
65 | |||
66 | static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev) | ||
67 | { | ||
68 | if (dssdev->platform_disable) | ||
69 | dssdev->platform_disable(dssdev); | ||
70 | |||
71 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
72 | msleep(100); | ||
73 | |||
74 | omapdss_dpi_display_disable(dssdev); | ||
75 | } | ||
76 | |||
42 | static int sharp_lq_panel_probe(struct omap_dss_device *dssdev) | 77 | static int sharp_lq_panel_probe(struct omap_dss_device *dssdev) |
43 | { | 78 | { |
44 | 79 | ||
@@ -58,36 +93,40 @@ static int sharp_lq_panel_enable(struct omap_dss_device *dssdev) | |||
58 | { | 93 | { |
59 | int r = 0; | 94 | int r = 0; |
60 | 95 | ||
96 | r = sharp_lq_panel_power_on(dssdev); | ||
97 | if (r) | ||
98 | return r; | ||
61 | 99 | ||
62 | /* wait couple of vsyncs until enabling the LCD */ | 100 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
63 | msleep(50); | ||
64 | |||
65 | if (dssdev->platform_enable) | ||
66 | r = dssdev->platform_enable(dssdev); | ||
67 | 101 | ||
68 | return r; | 102 | return 0; |
69 | } | 103 | } |
70 | 104 | ||
71 | static void sharp_lq_panel_disable(struct omap_dss_device *dssdev) | 105 | static void sharp_lq_panel_disable(struct omap_dss_device *dssdev) |
72 | { | 106 | { |
107 | sharp_lq_panel_power_off(dssdev); | ||
73 | 108 | ||
74 | if (dssdev->platform_disable) | 109 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; |
75 | dssdev->platform_disable(dssdev); | ||
76 | |||
77 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
78 | |||
79 | msleep(100); | ||
80 | } | 110 | } |
81 | 111 | ||
82 | static int sharp_lq_panel_suspend(struct omap_dss_device *dssdev) | 112 | static int sharp_lq_panel_suspend(struct omap_dss_device *dssdev) |
83 | { | 113 | { |
84 | sharp_lq_panel_disable(dssdev); | 114 | sharp_lq_panel_power_off(dssdev); |
115 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
85 | return 0; | 116 | return 0; |
86 | } | 117 | } |
87 | 118 | ||
88 | static int sharp_lq_panel_resume(struct omap_dss_device *dssdev) | 119 | static int sharp_lq_panel_resume(struct omap_dss_device *dssdev) |
89 | { | 120 | { |
90 | return sharp_lq_panel_enable(dssdev); | 121 | int r = 0; |
122 | |||
123 | r = sharp_lq_panel_power_on(dssdev); | ||
124 | if (r) | ||
125 | return r; | ||
126 | |||
127 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
128 | |||
129 | return 0; | ||
91 | } | 130 | } |
92 | 131 | ||
93 | static struct omap_dss_driver sharp_lq_driver = { | 132 | static struct omap_dss_driver sharp_lq_driver = { |
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c index e207d66908d6..8d51a5e6341c 100644 --- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/regulator/consumer.h> | ||
24 | #include <linux/err.h> | 23 | #include <linux/err.h> |
25 | 24 | ||
26 | #include <plat/display.h> | 25 | #include <plat/display.h> |
@@ -54,20 +53,31 @@ static void sharp_ls_panel_remove(struct omap_dss_device *dssdev) | |||
54 | { | 53 | { |
55 | } | 54 | } |
56 | 55 | ||
57 | static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) | 56 | static int sharp_ls_power_on(struct omap_dss_device *dssdev) |
58 | { | 57 | { |
59 | int r = 0; | 58 | int r = 0; |
60 | 59 | ||
60 | r = omapdss_dpi_display_enable(dssdev); | ||
61 | if (r) | ||
62 | goto err0; | ||
63 | |||
61 | /* wait couple of vsyncs until enabling the LCD */ | 64 | /* wait couple of vsyncs until enabling the LCD */ |
62 | msleep(50); | 65 | msleep(50); |
63 | 66 | ||
64 | if (dssdev->platform_enable) | 67 | if (dssdev->platform_enable) { |
65 | r = dssdev->platform_enable(dssdev); | 68 | r = dssdev->platform_enable(dssdev); |
69 | if (r) | ||
70 | goto err1; | ||
71 | } | ||
66 | 72 | ||
73 | return 0; | ||
74 | err1: | ||
75 | omapdss_dpi_display_disable(dssdev); | ||
76 | err0: | ||
67 | return r; | 77 | return r; |
68 | } | 78 | } |
69 | 79 | ||
70 | static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | 80 | static void sharp_ls_power_off(struct omap_dss_device *dssdev) |
71 | { | 81 | { |
72 | if (dssdev->platform_disable) | 82 | if (dssdev->platform_disable) |
73 | dssdev->platform_disable(dssdev); | 83 | dssdev->platform_disable(dssdev); |
@@ -75,17 +85,37 @@ static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | |||
75 | /* wait at least 5 vsyncs after disabling the LCD */ | 85 | /* wait at least 5 vsyncs after disabling the LCD */ |
76 | 86 | ||
77 | msleep(100); | 87 | msleep(100); |
88 | |||
89 | omapdss_dpi_display_disable(dssdev); | ||
90 | } | ||
91 | |||
92 | static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) | ||
93 | { | ||
94 | int r; | ||
95 | r = sharp_ls_power_on(dssdev); | ||
96 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
97 | return r; | ||
98 | } | ||
99 | |||
100 | static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | ||
101 | { | ||
102 | sharp_ls_power_off(dssdev); | ||
103 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
78 | } | 104 | } |
79 | 105 | ||
80 | static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) | 106 | static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) |
81 | { | 107 | { |
82 | sharp_ls_panel_disable(dssdev); | 108 | sharp_ls_power_off(dssdev); |
109 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
83 | return 0; | 110 | return 0; |
84 | } | 111 | } |
85 | 112 | ||
86 | static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) | 113 | static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) |
87 | { | 114 | { |
88 | return sharp_ls_panel_enable(dssdev); | 115 | int r; |
116 | r = sharp_ls_power_on(dssdev); | ||
117 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
118 | return r; | ||
89 | } | 119 | } |
90 | 120 | ||
91 | static struct omap_dss_driver sharp_ls_driver = { | 121 | static struct omap_dss_driver sharp_ls_driver = { |
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 58293203fc05..484a61844763 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -620,14 +620,12 @@ static void taal_remove(struct omap_dss_device *dssdev) | |||
620 | kfree(td); | 620 | kfree(td); |
621 | } | 621 | } |
622 | 622 | ||
623 | static int taal_enable(struct omap_dss_device *dssdev) | 623 | static int taal_power_on(struct omap_dss_device *dssdev) |
624 | { | 624 | { |
625 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 625 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
626 | u8 id1, id2, id3; | 626 | u8 id1, id2, id3; |
627 | int r; | 627 | int r; |
628 | 628 | ||
629 | dev_dbg(&dssdev->dev, "enable\n"); | ||
630 | |||
631 | if (dssdev->platform_enable) { | 629 | if (dssdev->platform_enable) { |
632 | r = dssdev->platform_enable(dssdev); | 630 | r = dssdev->platform_enable(dssdev); |
633 | if (r) | 631 | if (r) |
@@ -637,6 +635,16 @@ static int taal_enable(struct omap_dss_device *dssdev) | |||
637 | /* it seems we have to wait a bit until taal is ready */ | 635 | /* it seems we have to wait a bit until taal is ready */ |
638 | msleep(5); | 636 | msleep(5); |
639 | 637 | ||
638 | dsi_bus_lock(); | ||
639 | |||
640 | r = omapdss_dsi_display_enable(dssdev); | ||
641 | if (r) { | ||
642 | dev_err(&dssdev->dev, "failed to enable DSI\n"); | ||
643 | goto err0; | ||
644 | } | ||
645 | |||
646 | omapdss_dsi_vc_enable_hs(TCH, false); | ||
647 | |||
640 | r = taal_sleep_out(td); | 648 | r = taal_sleep_out(td); |
641 | if (r) | 649 | if (r) |
642 | goto err; | 650 | goto err; |
@@ -675,19 +683,27 @@ static int taal_enable(struct omap_dss_device *dssdev) | |||
675 | td->intro_printed = true; | 683 | td->intro_printed = true; |
676 | } | 684 | } |
677 | 685 | ||
686 | omapdss_dsi_vc_enable_hs(TCH, true); | ||
687 | |||
688 | dsi_bus_unlock(); | ||
689 | |||
678 | return 0; | 690 | return 0; |
679 | err: | 691 | err: |
692 | dsi_bus_unlock(); | ||
693 | |||
694 | omapdss_dsi_display_disable(dssdev); | ||
695 | err0: | ||
680 | if (dssdev->platform_disable) | 696 | if (dssdev->platform_disable) |
681 | dssdev->platform_disable(dssdev); | 697 | dssdev->platform_disable(dssdev); |
682 | 698 | ||
683 | return r; | 699 | return r; |
684 | } | 700 | } |
685 | 701 | ||
686 | static void taal_disable(struct omap_dss_device *dssdev) | 702 | static void taal_power_off(struct omap_dss_device *dssdev) |
687 | { | 703 | { |
688 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 704 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
689 | 705 | ||
690 | dev_dbg(&dssdev->dev, "disable\n"); | 706 | dsi_bus_lock(); |
691 | 707 | ||
692 | cancel_delayed_work(&td->esd_work); | 708 | cancel_delayed_work(&td->esd_work); |
693 | 709 | ||
@@ -697,32 +713,67 @@ static void taal_disable(struct omap_dss_device *dssdev) | |||
697 | /* wait a bit so that the message goes through */ | 713 | /* wait a bit so that the message goes through */ |
698 | msleep(10); | 714 | msleep(10); |
699 | 715 | ||
716 | omapdss_dsi_display_disable(dssdev); | ||
717 | |||
700 | if (dssdev->platform_disable) | 718 | if (dssdev->platform_disable) |
701 | dssdev->platform_disable(dssdev); | 719 | dssdev->platform_disable(dssdev); |
702 | 720 | ||
703 | td->enabled = 0; | 721 | td->enabled = 0; |
722 | |||
723 | dsi_bus_unlock(); | ||
724 | } | ||
725 | |||
726 | static int taal_enable(struct omap_dss_device *dssdev) | ||
727 | { | ||
728 | int r; | ||
729 | dev_dbg(&dssdev->dev, "enable\n"); | ||
730 | |||
731 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) | ||
732 | return -EINVAL; | ||
733 | |||
734 | r = taal_power_on(dssdev); | ||
735 | if (r) | ||
736 | return r; | ||
737 | |||
738 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
739 | |||
740 | return r; | ||
741 | } | ||
742 | |||
743 | static void taal_disable(struct omap_dss_device *dssdev) | ||
744 | { | ||
745 | dev_dbg(&dssdev->dev, "disable\n"); | ||
746 | |||
747 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | ||
748 | taal_power_off(dssdev); | ||
749 | |||
750 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
704 | } | 751 | } |
705 | 752 | ||
706 | static int taal_suspend(struct omap_dss_device *dssdev) | 753 | static int taal_suspend(struct omap_dss_device *dssdev) |
707 | { | 754 | { |
708 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 755 | dev_dbg(&dssdev->dev, "suspend\n"); |
709 | struct backlight_device *bldev = td->bldev; | ||
710 | 756 | ||
711 | bldev->props.power = FB_BLANK_POWERDOWN; | 757 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) |
712 | taal_bl_update_status(bldev); | 758 | return -EINVAL; |
759 | |||
760 | taal_power_off(dssdev); | ||
761 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
713 | 762 | ||
714 | return 0; | 763 | return 0; |
715 | } | 764 | } |
716 | 765 | ||
717 | static int taal_resume(struct omap_dss_device *dssdev) | 766 | static int taal_resume(struct omap_dss_device *dssdev) |
718 | { | 767 | { |
719 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 768 | int r; |
720 | struct backlight_device *bldev = td->bldev; | 769 | dev_dbg(&dssdev->dev, "resume\n"); |
721 | 770 | ||
722 | bldev->props.power = FB_BLANK_UNBLANK; | 771 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) |
723 | taal_bl_update_status(bldev); | 772 | return -EINVAL; |
724 | 773 | ||
725 | return 0; | 774 | r = taal_power_on(dssdev); |
775 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
776 | return r; | ||
726 | } | 777 | } |
727 | 778 | ||
728 | static void taal_framedone_cb(int err, void *data) | 779 | static void taal_framedone_cb(int err, void *data) |
diff --git a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c index e744b8c83817..fa434ca6e4b7 100644 --- a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c +++ b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c | |||
@@ -42,6 +42,35 @@ static struct omap_video_timings toppoly_tdo_panel_timings = { | |||
42 | .vbp = 2, | 42 | .vbp = 2, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static int toppoly_tdo_panel_power_on(struct omap_dss_device *dssdev) | ||
46 | { | ||
47 | int r; | ||
48 | |||
49 | r = omapdss_dpi_display_enable(dssdev); | ||
50 | if (r) | ||
51 | goto err0; | ||
52 | |||
53 | if (dssdev->platform_enable) { | ||
54 | r = dssdev->platform_enable(dssdev); | ||
55 | if (r) | ||
56 | goto err1; | ||
57 | } | ||
58 | |||
59 | return 0; | ||
60 | err1: | ||
61 | omapdss_dpi_display_disable(dssdev); | ||
62 | err0: | ||
63 | return r; | ||
64 | } | ||
65 | |||
66 | static void toppoly_tdo_panel_power_off(struct omap_dss_device *dssdev) | ||
67 | { | ||
68 | if (dssdev->platform_disable) | ||
69 | dssdev->platform_disable(dssdev); | ||
70 | |||
71 | omapdss_dpi_display_disable(dssdev); | ||
72 | } | ||
73 | |||
45 | static int toppoly_tdo_panel_probe(struct omap_dss_device *dssdev) | 74 | static int toppoly_tdo_panel_probe(struct omap_dss_device *dssdev) |
46 | { | 75 | { |
47 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | 76 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | |
@@ -59,27 +88,40 @@ static int toppoly_tdo_panel_enable(struct omap_dss_device *dssdev) | |||
59 | { | 88 | { |
60 | int r = 0; | 89 | int r = 0; |
61 | 90 | ||
62 | if (dssdev->platform_enable) | 91 | r = toppoly_tdo_panel_power_on(dssdev); |
63 | r = dssdev->platform_enable(dssdev); | 92 | if (r) |
93 | return r; | ||
64 | 94 | ||
65 | return r; | 95 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
96 | |||
97 | return 0; | ||
66 | } | 98 | } |
67 | 99 | ||
68 | static void toppoly_tdo_panel_disable(struct omap_dss_device *dssdev) | 100 | static void toppoly_tdo_panel_disable(struct omap_dss_device *dssdev) |
69 | { | 101 | { |
70 | if (dssdev->platform_disable) | 102 | toppoly_tdo_panel_power_off(dssdev); |
71 | dssdev->platform_disable(dssdev); | 103 | |
104 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
72 | } | 105 | } |
73 | 106 | ||
74 | static int toppoly_tdo_panel_suspend(struct omap_dss_device *dssdev) | 107 | static int toppoly_tdo_panel_suspend(struct omap_dss_device *dssdev) |
75 | { | 108 | { |
76 | toppoly_tdo_panel_disable(dssdev); | 109 | toppoly_tdo_panel_power_off(dssdev); |
110 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
77 | return 0; | 111 | return 0; |
78 | } | 112 | } |
79 | 113 | ||
80 | static int toppoly_tdo_panel_resume(struct omap_dss_device *dssdev) | 114 | static int toppoly_tdo_panel_resume(struct omap_dss_device *dssdev) |
81 | { | 115 | { |
82 | return toppoly_tdo_panel_enable(dssdev); | 116 | int r = 0; |
117 | |||
118 | r = toppoly_tdo_panel_power_on(dssdev); | ||
119 | if (r) | ||
120 | return r; | ||
121 | |||
122 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
123 | |||
124 | return 0; | ||
83 | } | 125 | } |
84 | 126 | ||
85 | static struct omap_dss_driver generic_driver = { | 127 | static struct omap_dss_driver generic_driver = { |
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c index f297a46f2b1a..c6e4a7e9f532 100644 --- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c +++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c | |||
@@ -262,18 +262,20 @@ static const struct omap_video_timings tpo_td043_timings = { | |||
262 | .vbp = 34, | 262 | .vbp = 34, |
263 | }; | 263 | }; |
264 | 264 | ||
265 | static int tpo_td043_enable(struct omap_dss_device *dssdev) | 265 | static int generic_panel_power_on(struct omap_dss_device *dssdev) |
266 | { | 266 | { |
267 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | 267 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); |
268 | int nreset_gpio = dssdev->reset_gpio; | 268 | int nreset_gpio = dssdev->reset_gpio; |
269 | int ret; | 269 | int r; |
270 | 270 | ||
271 | dev_dbg(&dssdev->dev, "enable\n"); | 271 | r = omapdss_dpi_display_enable(dssdev); |
272 | if (r) | ||
273 | goto err0; | ||
272 | 274 | ||
273 | if (dssdev->platform_enable) { | 275 | if (dssdev->platform_enable) { |
274 | ret = dssdev->platform_enable(dssdev); | 276 | r = dssdev->platform_enable(dssdev); |
275 | if (ret) | 277 | if (r) |
276 | return ret; | 278 | goto err1; |
277 | } | 279 | } |
278 | 280 | ||
279 | regulator_enable(tpo_td043->vcc_reg); | 281 | regulator_enable(tpo_td043->vcc_reg); |
@@ -294,15 +296,17 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev) | |||
294 | tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma); | 296 | tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma); |
295 | 297 | ||
296 | return 0; | 298 | return 0; |
299 | err1: | ||
300 | omapdss_dpi_display_disable(dssdev); | ||
301 | err0: | ||
302 | return r; | ||
297 | } | 303 | } |
298 | 304 | ||
299 | static void tpo_td043_disable(struct omap_dss_device *dssdev) | 305 | static void generic_panel_power_off(struct omap_dss_device *dssdev) |
300 | { | 306 | { |
301 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | 307 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); |
302 | int nreset_gpio = dssdev->reset_gpio; | 308 | int nreset_gpio = dssdev->reset_gpio; |
303 | 309 | ||
304 | dev_dbg(&dssdev->dev, "disable\n"); | ||
305 | |||
306 | tpo_td043_write(tpo_td043->spi, 3, | 310 | tpo_td043_write(tpo_td043->spi, 3, |
307 | TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM); | 311 | TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM); |
308 | 312 | ||
@@ -318,17 +322,52 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev) | |||
318 | 322 | ||
319 | if (dssdev->platform_disable) | 323 | if (dssdev->platform_disable) |
320 | dssdev->platform_disable(dssdev); | 324 | dssdev->platform_disable(dssdev); |
325 | |||
326 | omapdss_dpi_display_disable(dssdev); | ||
327 | } | ||
328 | |||
329 | static int tpo_td043_enable(struct omap_dss_device *dssdev) | ||
330 | { | ||
331 | int ret; | ||
332 | |||
333 | dev_dbg(&dssdev->dev, "enable\n"); | ||
334 | |||
335 | ret = generic_panel_power_on(dssdev); | ||
336 | if (ret) | ||
337 | return ret; | ||
338 | |||
339 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static void tpo_td043_disable(struct omap_dss_device *dssdev) | ||
345 | { | ||
346 | dev_dbg(&dssdev->dev, "disable\n"); | ||
347 | |||
348 | generic_panel_power_off(dssdev); | ||
349 | |||
350 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
321 | } | 351 | } |
322 | 352 | ||
323 | static int tpo_td043_suspend(struct omap_dss_device *dssdev) | 353 | static int tpo_td043_suspend(struct omap_dss_device *dssdev) |
324 | { | 354 | { |
325 | tpo_td043_disable(dssdev); | 355 | generic_panel_power_off(dssdev); |
356 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
326 | return 0; | 357 | return 0; |
327 | } | 358 | } |
328 | 359 | ||
329 | static int tpo_td043_resume(struct omap_dss_device *dssdev) | 360 | static int tpo_td043_resume(struct omap_dss_device *dssdev) |
330 | { | 361 | { |
331 | return tpo_td043_enable(dssdev); | 362 | int r = 0; |
363 | |||
364 | r = generic_panel_power_on(dssdev); | ||
365 | if (r) | ||
366 | return r; | ||
367 | |||
368 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
369 | |||
370 | return 0; | ||
332 | } | 371 | } |
333 | 372 | ||
334 | static int tpo_td043_probe(struct omap_dss_device *dssdev) | 373 | static int tpo_td043_probe(struct omap_dss_device *dssdev) |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 5a5c31c163c7..e777e352dbcd 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -2872,12 +2872,13 @@ static void dispc_error_worker(struct work_struct *work) | |||
2872 | manager = mgr; | 2872 | manager = mgr; |
2873 | enable = mgr->device->state == | 2873 | enable = mgr->device->state == |
2874 | OMAP_DSS_DISPLAY_ACTIVE; | 2874 | OMAP_DSS_DISPLAY_ACTIVE; |
2875 | mgr->device->disable(mgr->device); | 2875 | mgr->device->driver->disable(mgr->device); |
2876 | break; | 2876 | break; |
2877 | } | 2877 | } |
2878 | } | 2878 | } |
2879 | 2879 | ||
2880 | if (manager) { | 2880 | if (manager) { |
2881 | struct omap_dss_device *dssdev = manager->device; | ||
2881 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { | 2882 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { |
2882 | struct omap_overlay *ovl; | 2883 | struct omap_overlay *ovl; |
2883 | ovl = omap_dss_get_overlay(i); | 2884 | ovl = omap_dss_get_overlay(i); |
@@ -2892,7 +2893,7 @@ static void dispc_error_worker(struct work_struct *work) | |||
2892 | dispc_go(manager->id); | 2893 | dispc_go(manager->id); |
2893 | mdelay(50); | 2894 | mdelay(50); |
2894 | if (enable) | 2895 | if (enable) |
2895 | manager->device->enable(manager->device); | 2896 | dssdev->driver->enable(dssdev); |
2896 | } | 2897 | } |
2897 | } | 2898 | } |
2898 | 2899 | ||
@@ -2910,12 +2911,13 @@ static void dispc_error_worker(struct work_struct *work) | |||
2910 | manager = mgr; | 2911 | manager = mgr; |
2911 | enable = mgr->device->state == | 2912 | enable = mgr->device->state == |
2912 | OMAP_DSS_DISPLAY_ACTIVE; | 2913 | OMAP_DSS_DISPLAY_ACTIVE; |
2913 | mgr->device->disable(mgr->device); | 2914 | mgr->device->driver->disable(mgr->device); |
2914 | break; | 2915 | break; |
2915 | } | 2916 | } |
2916 | } | 2917 | } |
2917 | 2918 | ||
2918 | if (manager) { | 2919 | if (manager) { |
2920 | struct omap_dss_device *dssdev = manager->device; | ||
2919 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { | 2921 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { |
2920 | struct omap_overlay *ovl; | 2922 | struct omap_overlay *ovl; |
2921 | ovl = omap_dss_get_overlay(i); | 2923 | ovl = omap_dss_get_overlay(i); |
@@ -2930,7 +2932,7 @@ static void dispc_error_worker(struct work_struct *work) | |||
2930 | dispc_go(manager->id); | 2932 | dispc_go(manager->id); |
2931 | mdelay(50); | 2933 | mdelay(50); |
2932 | if (enable) | 2934 | if (enable) |
2933 | manager->device->enable(manager->device); | 2935 | dssdev->driver->enable(dssdev); |
2934 | } | 2936 | } |
2935 | } | 2937 | } |
2936 | 2938 | ||
@@ -2941,7 +2943,7 @@ static void dispc_error_worker(struct work_struct *work) | |||
2941 | mgr = omap_dss_get_overlay_manager(i); | 2943 | mgr = omap_dss_get_overlay_manager(i); |
2942 | 2944 | ||
2943 | if (mgr->caps & OMAP_DSS_OVL_CAP_DISPC) | 2945 | if (mgr->caps & OMAP_DSS_OVL_CAP_DISPC) |
2944 | mgr->device->disable(mgr->device); | 2946 | mgr->device->driver->disable(mgr->device); |
2945 | } | 2947 | } |
2946 | } | 2948 | } |
2947 | 2949 | ||
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 86996d8d65be..29ec5a4a46bc 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -53,11 +53,11 @@ static ssize_t display_enabled_store(struct device *dev, | |||
53 | 53 | ||
54 | if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { | 54 | if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { |
55 | if (enabled) { | 55 | if (enabled) { |
56 | r = dssdev->enable(dssdev); | 56 | r = dssdev->driver->enable(dssdev); |
57 | if (r) | 57 | if (r) |
58 | return r; | 58 | return r; |
59 | } else { | 59 | } else { |
60 | dssdev->disable(dssdev); | 60 | dssdev->driver->disable(dssdev); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
@@ -485,13 +485,13 @@ static int dss_suspend_device(struct device *dev, void *data) | |||
485 | return 0; | 485 | return 0; |
486 | } | 486 | } |
487 | 487 | ||
488 | if (!dssdev->suspend) { | 488 | if (!dssdev->driver->suspend) { |
489 | DSSERR("display '%s' doesn't implement suspend\n", | 489 | DSSERR("display '%s' doesn't implement suspend\n", |
490 | dssdev->name); | 490 | dssdev->name); |
491 | return -ENOSYS; | 491 | return -ENOSYS; |
492 | } | 492 | } |
493 | 493 | ||
494 | r = dssdev->suspend(dssdev); | 494 | r = dssdev->driver->suspend(dssdev); |
495 | if (r) | 495 | if (r) |
496 | return r; | 496 | return r; |
497 | 497 | ||
@@ -520,8 +520,8 @@ static int dss_resume_device(struct device *dev, void *data) | |||
520 | int r; | 520 | int r; |
521 | struct omap_dss_device *dssdev = to_dss_device(dev); | 521 | struct omap_dss_device *dssdev = to_dss_device(dev); |
522 | 522 | ||
523 | if (dssdev->activate_after_resume && dssdev->resume) { | 523 | if (dssdev->activate_after_resume && dssdev->driver->resume) { |
524 | r = dssdev->resume(dssdev); | 524 | r = dssdev->driver->resume(dssdev); |
525 | if (r) | 525 | if (r) |
526 | return r; | 526 | return r; |
527 | } | 527 | } |
@@ -541,7 +541,7 @@ int dss_resume_all_devices(void) | |||
541 | static int dss_disable_device(struct device *dev, void *data) | 541 | static int dss_disable_device(struct device *dev, void *data) |
542 | { | 542 | { |
543 | struct omap_dss_device *dssdev = to_dss_device(dev); | 543 | struct omap_dss_device *dssdev = to_dss_device(dev); |
544 | dssdev->disable(dssdev); | 544 | dssdev->driver->disable(dssdev); |
545 | return 0; | 545 | return 0; |
546 | } | 546 | } |
547 | 547 | ||
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 48ff7ea470aa..1eef8b72dbb9 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -153,7 +153,7 @@ static int dpi_basic_init(struct omap_dss_device *dssdev) | |||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | static int dpi_display_enable(struct omap_dss_device *dssdev) | 156 | int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) |
157 | { | 157 | { |
158 | int r; | 158 | int r; |
159 | 159 | ||
@@ -163,57 +163,42 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
163 | goto err0; | 163 | goto err0; |
164 | } | 164 | } |
165 | 165 | ||
166 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
167 | DSSERR("display already enabled\n"); | ||
168 | r = -EINVAL; | ||
169 | goto err1; | ||
170 | } | ||
171 | |||
172 | if (cpu_is_omap34xx()) { | 166 | if (cpu_is_omap34xx()) { |
173 | r = regulator_enable(dpi.vdds_dsi_reg); | 167 | r = regulator_enable(dpi.vdds_dsi_reg); |
174 | if (r) | 168 | if (r) |
175 | goto err2; | 169 | goto err1; |
176 | } | 170 | } |
177 | 171 | ||
178 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | 172 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); |
179 | 173 | ||
180 | r = dpi_basic_init(dssdev); | 174 | r = dpi_basic_init(dssdev); |
181 | if (r) | 175 | if (r) |
182 | goto err3; | 176 | goto err2; |
183 | 177 | ||
184 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 178 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
185 | dss_clk_enable(DSS_CLK_FCK2); | 179 | dss_clk_enable(DSS_CLK_FCK2); |
186 | r = dsi_pll_init(dssdev, 0, 1); | 180 | r = dsi_pll_init(dssdev, 0, 1); |
187 | if (r) | 181 | if (r) |
188 | goto err4; | 182 | goto err3; |
189 | #endif | 183 | #endif |
190 | r = dpi_set_mode(dssdev); | 184 | r = dpi_set_mode(dssdev); |
191 | if (r) | 185 | if (r) |
192 | goto err5; | 186 | goto err4; |
193 | 187 | ||
194 | mdelay(2); | 188 | mdelay(2); |
195 | 189 | ||
196 | dssdev->manager->enable(dssdev->manager); | 190 | dssdev->manager->enable(dssdev->manager); |
197 | 191 | ||
198 | r = dssdev->driver->enable(dssdev); | ||
199 | if (r) | ||
200 | goto err6; | ||
201 | |||
202 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
203 | |||
204 | return 0; | 192 | return 0; |
205 | 193 | ||
206 | err6: | 194 | err4: |
207 | dssdev->manager->disable(dssdev->manager); | ||
208 | err5: | ||
209 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 195 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
210 | dsi_pll_uninit(); | 196 | dsi_pll_uninit(); |
211 | err4: | 197 | err3: |
212 | dss_clk_disable(DSS_CLK_FCK2); | 198 | dss_clk_disable(DSS_CLK_FCK2); |
213 | #endif | 199 | #endif |
214 | err3: | ||
215 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
216 | err2: | 200 | err2: |
201 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
217 | if (cpu_is_omap34xx()) | 202 | if (cpu_is_omap34xx()) |
218 | regulator_disable(dpi.vdds_dsi_reg); | 203 | regulator_disable(dpi.vdds_dsi_reg); |
219 | err1: | 204 | err1: |
@@ -221,19 +206,10 @@ err1: | |||
221 | err0: | 206 | err0: |
222 | return r; | 207 | return r; |
223 | } | 208 | } |
209 | EXPORT_SYMBOL(omapdss_dpi_display_enable); | ||
224 | 210 | ||
225 | static int dpi_display_resume(struct omap_dss_device *dssdev); | 211 | void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) |
226 | |||
227 | static void dpi_display_disable(struct omap_dss_device *dssdev) | ||
228 | { | 212 | { |
229 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
230 | return; | ||
231 | |||
232 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
233 | dpi_display_resume(dssdev); | ||
234 | |||
235 | dssdev->driver->disable(dssdev); | ||
236 | |||
237 | dssdev->manager->disable(dssdev->manager); | 213 | dssdev->manager->disable(dssdev->manager); |
238 | 214 | ||
239 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 215 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
@@ -247,61 +223,9 @@ static void dpi_display_disable(struct omap_dss_device *dssdev) | |||
247 | if (cpu_is_omap34xx()) | 223 | if (cpu_is_omap34xx()) |
248 | regulator_disable(dpi.vdds_dsi_reg); | 224 | regulator_disable(dpi.vdds_dsi_reg); |
249 | 225 | ||
250 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
251 | |||
252 | omap_dss_stop_device(dssdev); | 226 | omap_dss_stop_device(dssdev); |
253 | } | 227 | } |
254 | 228 | EXPORT_SYMBOL(omapdss_dpi_display_disable); | |
255 | static int dpi_display_suspend(struct omap_dss_device *dssdev) | ||
256 | { | ||
257 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
258 | return -EINVAL; | ||
259 | |||
260 | DSSDBG("dpi_display_suspend\n"); | ||
261 | |||
262 | if (dssdev->driver->suspend) | ||
263 | dssdev->driver->suspend(dssdev); | ||
264 | |||
265 | dssdev->manager->disable(dssdev->manager); | ||
266 | |||
267 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
268 | |||
269 | if (cpu_is_omap34xx()) | ||
270 | regulator_disable(dpi.vdds_dsi_reg); | ||
271 | |||
272 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
273 | |||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static int dpi_display_resume(struct omap_dss_device *dssdev) | ||
278 | { | ||
279 | int r; | ||
280 | |||
281 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) | ||
282 | return -EINVAL; | ||
283 | |||
284 | DSSDBG("dpi_display_resume\n"); | ||
285 | |||
286 | if (cpu_is_omap34xx()) { | ||
287 | r = regulator_enable(dpi.vdds_dsi_reg); | ||
288 | if (r) | ||
289 | goto err0; | ||
290 | } | ||
291 | |||
292 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
293 | |||
294 | dssdev->manager->enable(dssdev->manager); | ||
295 | |||
296 | if (dssdev->driver->resume) | ||
297 | dssdev->driver->resume(dssdev); | ||
298 | |||
299 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
300 | |||
301 | return 0; | ||
302 | err0: | ||
303 | return r; | ||
304 | } | ||
305 | 229 | ||
306 | static void dpi_set_timings(struct omap_dss_device *dssdev, | 230 | static void dpi_set_timings(struct omap_dss_device *dssdev, |
307 | struct omap_video_timings *timings) | 231 | struct omap_video_timings *timings) |
@@ -379,10 +303,6 @@ int dpi_init_display(struct omap_dss_device *dssdev) | |||
379 | { | 303 | { |
380 | DSSDBG("init_display\n"); | 304 | DSSDBG("init_display\n"); |
381 | 305 | ||
382 | dssdev->enable = dpi_display_enable; | ||
383 | dssdev->disable = dpi_display_disable; | ||
384 | dssdev->suspend = dpi_display_suspend; | ||
385 | dssdev->resume = dpi_display_resume; | ||
386 | dssdev->set_timings = dpi_set_timings; | 306 | dssdev->set_timings = dpi_set_timings; |
387 | dssdev->check_timings = dpi_check_timings; | 307 | dssdev->check_timings = dpi_check_timings; |
388 | dssdev->get_timings = dpi_get_timings; | 308 | dssdev->get_timings = dpi_get_timings; |
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 203b18bbddae..41cdefbaf7f3 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -3106,18 +3106,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
3106 | dsi_if_enable(1); | 3106 | dsi_if_enable(1); |
3107 | dsi_force_tx_stop_mode_io(); | 3107 | dsi_force_tx_stop_mode_io(); |
3108 | 3108 | ||
3109 | if (dssdev->driver->enable) { | ||
3110 | r = dssdev->driver->enable(dssdev); | ||
3111 | if (r) | ||
3112 | goto err4; | ||
3113 | } | ||
3114 | |||
3115 | /* enable high-speed after initial config */ | ||
3116 | omapdss_dsi_vc_enable_hs(0, 1); | ||
3117 | |||
3118 | return 0; | 3109 | return 0; |
3119 | err4: | ||
3120 | dsi_if_enable(0); | ||
3121 | err3: | 3110 | err3: |
3122 | dsi_complexio_uninit(); | 3111 | dsi_complexio_uninit(); |
3123 | err2: | 3112 | err2: |
@@ -3131,9 +3120,6 @@ err0: | |||
3131 | 3120 | ||
3132 | static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) | 3121 | static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) |
3133 | { | 3122 | { |
3134 | if (dssdev->driver->disable) | ||
3135 | dssdev->driver->disable(dssdev); | ||
3136 | |||
3137 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); | 3123 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3138 | dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); | 3124 | dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3139 | dsi_complexio_uninit(); | 3125 | dsi_complexio_uninit(); |
@@ -3156,14 +3142,15 @@ static int dsi_core_init(void) | |||
3156 | return 0; | 3142 | return 0; |
3157 | } | 3143 | } |
3158 | 3144 | ||
3159 | static int dsi_display_enable(struct omap_dss_device *dssdev) | 3145 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev) |
3160 | { | 3146 | { |
3161 | int r = 0; | 3147 | int r = 0; |
3162 | 3148 | ||
3163 | DSSDBG("dsi_display_enable\n"); | 3149 | DSSDBG("dsi_display_enable\n"); |
3164 | 3150 | ||
3151 | WARN_ON(!dsi_bus_is_locked()); | ||
3152 | |||
3165 | mutex_lock(&dsi.lock); | 3153 | mutex_lock(&dsi.lock); |
3166 | dsi_bus_lock(); | ||
3167 | 3154 | ||
3168 | r = omap_dss_start_device(dssdev); | 3155 | r = omap_dss_start_device(dssdev); |
3169 | if (r) { | 3156 | if (r) { |
@@ -3171,90 +3158,49 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) | |||
3171 | goto err0; | 3158 | goto err0; |
3172 | } | 3159 | } |
3173 | 3160 | ||
3174 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
3175 | DSSERR("dssdev already enabled\n"); | ||
3176 | r = -EINVAL; | ||
3177 | goto err1; | ||
3178 | } | ||
3179 | |||
3180 | enable_clocks(1); | 3161 | enable_clocks(1); |
3181 | dsi_enable_pll_clock(1); | 3162 | dsi_enable_pll_clock(1); |
3182 | 3163 | ||
3183 | r = _dsi_reset(); | 3164 | r = _dsi_reset(); |
3184 | if (r) | 3165 | if (r) |
3185 | goto err2; | 3166 | goto err1; |
3186 | 3167 | ||
3187 | dsi_core_init(); | 3168 | dsi_core_init(); |
3188 | 3169 | ||
3189 | r = dsi_display_init_dispc(dssdev); | 3170 | r = dsi_display_init_dispc(dssdev); |
3190 | if (r) | 3171 | if (r) |
3191 | goto err2; | 3172 | goto err1; |
3192 | 3173 | ||
3193 | r = dsi_display_init_dsi(dssdev); | 3174 | r = dsi_display_init_dsi(dssdev); |
3194 | if (r) | 3175 | if (r) |
3195 | goto err3; | 3176 | goto err2; |
3196 | |||
3197 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
3198 | 3177 | ||
3199 | dsi.use_ext_te = dssdev->phy.dsi.ext_te; | 3178 | dsi.use_ext_te = dssdev->phy.dsi.ext_te; |
3200 | 3179 | ||
3201 | dsi_bus_unlock(); | ||
3202 | mutex_unlock(&dsi.lock); | 3180 | mutex_unlock(&dsi.lock); |
3203 | 3181 | ||
3204 | return 0; | 3182 | return 0; |
3205 | 3183 | ||
3206 | err3: | ||
3207 | dsi_display_uninit_dispc(dssdev); | ||
3208 | err2: | 3184 | err2: |
3185 | dsi_display_uninit_dispc(dssdev); | ||
3186 | err1: | ||
3209 | enable_clocks(0); | 3187 | enable_clocks(0); |
3210 | dsi_enable_pll_clock(0); | 3188 | dsi_enable_pll_clock(0); |
3211 | err1: | ||
3212 | omap_dss_stop_device(dssdev); | 3189 | omap_dss_stop_device(dssdev); |
3213 | err0: | 3190 | err0: |
3214 | dsi_bus_unlock(); | ||
3215 | mutex_unlock(&dsi.lock); | 3191 | mutex_unlock(&dsi.lock); |
3216 | DSSDBG("dsi_display_enable FAILED\n"); | 3192 | DSSDBG("dsi_display_enable FAILED\n"); |
3217 | return r; | 3193 | return r; |
3218 | } | 3194 | } |
3195 | EXPORT_SYMBOL(omapdss_dsi_display_enable); | ||
3219 | 3196 | ||
3220 | static void dsi_display_disable(struct omap_dss_device *dssdev) | 3197 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev) |
3221 | { | 3198 | { |
3222 | DSSDBG("dsi_display_disable\n"); | 3199 | DSSDBG("dsi_display_disable\n"); |
3223 | 3200 | ||
3224 | mutex_lock(&dsi.lock); | 3201 | WARN_ON(!dsi_bus_is_locked()); |
3225 | dsi_bus_lock(); | ||
3226 | |||
3227 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
3228 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
3229 | goto end; | ||
3230 | |||
3231 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
3232 | |||
3233 | dsi_display_uninit_dispc(dssdev); | ||
3234 | |||
3235 | dsi_display_uninit_dsi(dssdev); | ||
3236 | |||
3237 | enable_clocks(0); | ||
3238 | dsi_enable_pll_clock(0); | ||
3239 | |||
3240 | omap_dss_stop_device(dssdev); | ||
3241 | end: | ||
3242 | dsi_bus_unlock(); | ||
3243 | mutex_unlock(&dsi.lock); | ||
3244 | } | ||
3245 | |||
3246 | static int dsi_display_suspend(struct omap_dss_device *dssdev) | ||
3247 | { | ||
3248 | DSSDBG("dsi_display_suspend\n"); | ||
3249 | 3202 | ||
3250 | mutex_lock(&dsi.lock); | 3203 | mutex_lock(&dsi.lock); |
3251 | dsi_bus_lock(); | ||
3252 | |||
3253 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
3254 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
3255 | goto end; | ||
3256 | |||
3257 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
3258 | 3204 | ||
3259 | dsi_display_uninit_dispc(dssdev); | 3205 | dsi_display_uninit_dispc(dssdev); |
3260 | 3206 | ||
@@ -3262,63 +3208,12 @@ static int dsi_display_suspend(struct omap_dss_device *dssdev) | |||
3262 | 3208 | ||
3263 | enable_clocks(0); | 3209 | enable_clocks(0); |
3264 | dsi_enable_pll_clock(0); | 3210 | dsi_enable_pll_clock(0); |
3265 | end: | ||
3266 | dsi_bus_unlock(); | ||
3267 | mutex_unlock(&dsi.lock); | ||
3268 | 3211 | ||
3269 | return 0; | 3212 | omap_dss_stop_device(dssdev); |
3270 | } | ||
3271 | |||
3272 | static int dsi_display_resume(struct omap_dss_device *dssdev) | ||
3273 | { | ||
3274 | int r; | ||
3275 | |||
3276 | DSSDBG("dsi_display_resume\n"); | ||
3277 | |||
3278 | mutex_lock(&dsi.lock); | ||
3279 | dsi_bus_lock(); | ||
3280 | |||
3281 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
3282 | DSSERR("dssdev not suspended\n"); | ||
3283 | r = -EINVAL; | ||
3284 | goto err0; | ||
3285 | } | ||
3286 | |||
3287 | enable_clocks(1); | ||
3288 | dsi_enable_pll_clock(1); | ||
3289 | |||
3290 | r = _dsi_reset(); | ||
3291 | if (r) | ||
3292 | goto err1; | ||
3293 | |||
3294 | dsi_core_init(); | ||
3295 | |||
3296 | r = dsi_display_init_dispc(dssdev); | ||
3297 | if (r) | ||
3298 | goto err1; | ||
3299 | |||
3300 | r = dsi_display_init_dsi(dssdev); | ||
3301 | if (r) | ||
3302 | goto err2; | ||
3303 | |||
3304 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
3305 | |||
3306 | dsi_bus_unlock(); | ||
3307 | mutex_unlock(&dsi.lock); | ||
3308 | |||
3309 | return 0; | ||
3310 | 3213 | ||
3311 | err2: | ||
3312 | dsi_display_uninit_dispc(dssdev); | ||
3313 | err1: | ||
3314 | enable_clocks(0); | ||
3315 | dsi_enable_pll_clock(0); | ||
3316 | err0: | ||
3317 | dsi_bus_unlock(); | ||
3318 | mutex_unlock(&dsi.lock); | 3214 | mutex_unlock(&dsi.lock); |
3319 | DSSDBG("dsi_display_resume FAILED\n"); | ||
3320 | return r; | ||
3321 | } | 3215 | } |
3216 | EXPORT_SYMBOL(omapdss_dsi_display_disable); | ||
3322 | 3217 | ||
3323 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) | 3218 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) |
3324 | { | 3219 | { |
@@ -3344,11 +3239,6 @@ int dsi_init_display(struct omap_dss_device *dssdev) | |||
3344 | { | 3239 | { |
3345 | DSSDBG("DSI init\n"); | 3240 | DSSDBG("DSI init\n"); |
3346 | 3241 | ||
3347 | dssdev->enable = dsi_display_enable; | ||
3348 | dssdev->disable = dsi_display_disable; | ||
3349 | dssdev->suspend = dsi_display_suspend; | ||
3350 | dssdev->resume = dsi_display_resume; | ||
3351 | |||
3352 | /* XXX these should be figured out dynamically */ | 3242 | /* XXX these should be figured out dynamically */ |
3353 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | | 3243 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | |
3354 | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; | 3244 | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index a6b33160666a..cc23f53cc62d 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -1001,8 +1001,7 @@ void rfbi_exit(void) | |||
1001 | iounmap(rfbi.base); | 1001 | iounmap(rfbi.base); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* struct omap_display support */ | 1004 | int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) |
1005 | static int rfbi_display_enable(struct omap_dss_device *dssdev) | ||
1006 | { | 1005 | { |
1007 | int r; | 1006 | int r; |
1008 | 1007 | ||
@@ -1033,38 +1032,25 @@ static int rfbi_display_enable(struct omap_dss_device *dssdev) | |||
1033 | &dssdev->ctrl.rfbi_timings); | 1032 | &dssdev->ctrl.rfbi_timings); |
1034 | 1033 | ||
1035 | 1034 | ||
1036 | if (dssdev->driver->enable) { | ||
1037 | r = dssdev->driver->enable(dssdev); | ||
1038 | if (r) | ||
1039 | goto err2; | ||
1040 | } | ||
1041 | |||
1042 | return 0; | 1035 | return 0; |
1043 | err2: | ||
1044 | omap_dispc_unregister_isr(framedone_callback, NULL, | ||
1045 | DISPC_IRQ_FRAMEDONE); | ||
1046 | err1: | 1036 | err1: |
1047 | omap_dss_stop_device(dssdev); | 1037 | omap_dss_stop_device(dssdev); |
1048 | err0: | 1038 | err0: |
1049 | return r; | 1039 | return r; |
1050 | } | 1040 | } |
1041 | EXPORT_SYMBOL(omapdss_rfbi_display_enable); | ||
1051 | 1042 | ||
1052 | static void rfbi_display_disable(struct omap_dss_device *dssdev) | 1043 | void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) |
1053 | { | 1044 | { |
1054 | dssdev->driver->disable(dssdev); | ||
1055 | omap_dispc_unregister_isr(framedone_callback, NULL, | 1045 | omap_dispc_unregister_isr(framedone_callback, NULL, |
1056 | DISPC_IRQ_FRAMEDONE); | 1046 | DISPC_IRQ_FRAMEDONE); |
1057 | omap_dss_stop_device(dssdev); | 1047 | omap_dss_stop_device(dssdev); |
1058 | } | 1048 | } |
1049 | EXPORT_SYMBOL(omapdss_rfbi_display_disable); | ||
1059 | 1050 | ||
1060 | int rfbi_init_display(struct omap_dss_device *dssdev) | 1051 | int rfbi_init_display(struct omap_dss_device *dssdev) |
1061 | { | 1052 | { |
1062 | dssdev->enable = rfbi_display_enable; | ||
1063 | dssdev->disable = rfbi_display_disable; | ||
1064 | |||
1065 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; | 1053 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; |
1066 | |||
1067 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 1054 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; |
1068 | |||
1069 | return 0; | 1055 | return 0; |
1070 | } | 1056 | } |
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 6bd9b0cf76a8..929ceb3ddd9d 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c | |||
@@ -41,7 +41,7 @@ static void sdi_basic_init(void) | |||
41 | dispc_lcd_enable_signal_polarity(1); | 41 | dispc_lcd_enable_signal_polarity(1); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int sdi_display_enable(struct omap_dss_device *dssdev) | 44 | int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) |
45 | { | 45 | { |
46 | struct omap_video_timings *t = &dssdev->panel.timings; | 46 | struct omap_video_timings *t = &dssdev->panel.timings; |
47 | struct dss_clock_info dss_cinfo; | 47 | struct dss_clock_info dss_cinfo; |
@@ -57,12 +57,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) | |||
57 | goto err0; | 57 | goto err0; |
58 | } | 58 | } |
59 | 59 | ||
60 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
61 | DSSERR("dssdev already enabled\n"); | ||
62 | r = -EINVAL; | ||
63 | goto err1; | ||
64 | } | ||
65 | |||
66 | /* In case of skip_init sdi_init has already enabled the clocks */ | 60 | /* In case of skip_init sdi_init has already enabled the clocks */ |
67 | if (!sdi.skip_init) | 61 | if (!sdi.skip_init) |
68 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | 62 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); |
@@ -127,8 +121,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) | |||
127 | goto err3; | 121 | goto err3; |
128 | } | 122 | } |
129 | 123 | ||
130 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
131 | |||
132 | sdi.skip_init = 0; | 124 | sdi.skip_init = 0; |
133 | 125 | ||
134 | return 0; | 126 | return 0; |
@@ -141,18 +133,10 @@ err1: | |||
141 | err0: | 133 | err0: |
142 | return r; | 134 | return r; |
143 | } | 135 | } |
136 | EXPORT_SYMBOL(omapdss_sdi_display_enable); | ||
144 | 137 | ||
145 | static int sdi_display_resume(struct omap_dss_device *dssdev); | 138 | void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) |
146 | |||
147 | static void sdi_display_disable(struct omap_dss_device *dssdev) | ||
148 | { | 139 | { |
149 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
150 | return; | ||
151 | |||
152 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
153 | if (sdi_display_resume(dssdev)) | ||
154 | return; | ||
155 | |||
156 | if (dssdev->driver->disable) | 140 | if (dssdev->driver->disable) |
157 | dssdev->driver->disable(dssdev); | 141 | dssdev->driver->disable(dssdev); |
158 | 142 | ||
@@ -162,56 +146,9 @@ static void sdi_display_disable(struct omap_dss_device *dssdev) | |||
162 | 146 | ||
163 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 147 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
164 | 148 | ||
165 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
166 | |||
167 | omap_dss_stop_device(dssdev); | 149 | omap_dss_stop_device(dssdev); |
168 | } | 150 | } |
169 | 151 | EXPORT_SYMBOL(omapdss_sdi_display_disable); | |
170 | static int sdi_display_suspend(struct omap_dss_device *dssdev) | ||
171 | { | ||
172 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
173 | return -EINVAL; | ||
174 | |||
175 | if (dssdev->driver->suspend) | ||
176 | dssdev->driver->suspend(dssdev); | ||
177 | |||
178 | dssdev->manager->disable(dssdev->manager); | ||
179 | |||
180 | dss_sdi_disable(); | ||
181 | |||
182 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
183 | |||
184 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
185 | |||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static int sdi_display_resume(struct omap_dss_device *dssdev) | ||
190 | { | ||
191 | int r; | ||
192 | |||
193 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) | ||
194 | return -EINVAL; | ||
195 | |||
196 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
197 | |||
198 | r = dss_sdi_enable(); | ||
199 | if (r) | ||
200 | goto err; | ||
201 | mdelay(2); | ||
202 | |||
203 | dssdev->manager->enable(dssdev->manager); | ||
204 | |||
205 | if (dssdev->driver->resume) | ||
206 | dssdev->driver->resume(dssdev); | ||
207 | |||
208 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
209 | |||
210 | return 0; | ||
211 | err: | ||
212 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
213 | return r; | ||
214 | } | ||
215 | 152 | ||
216 | static void sdi_get_timings(struct omap_dss_device *dssdev, | 153 | static void sdi_get_timings(struct omap_dss_device *dssdev, |
217 | struct omap_video_timings *timings) | 154 | struct omap_video_timings *timings) |
@@ -223,10 +160,6 @@ int sdi_init_display(struct omap_dss_device *dssdev) | |||
223 | { | 160 | { |
224 | DSSDBG("SDI init\n"); | 161 | DSSDBG("SDI init\n"); |
225 | 162 | ||
226 | dssdev->enable = sdi_display_enable; | ||
227 | dssdev->disable = sdi_display_disable; | ||
228 | dssdev->suspend = sdi_display_suspend; | ||
229 | dssdev->resume = sdi_display_resume; | ||
230 | dssdev->get_timings = sdi_get_timings; | 163 | dssdev->get_timings = sdi_get_timings; |
231 | 164 | ||
232 | return 0; | 165 | return 0; |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 0d0dc94417fc..a0ab52c841ee 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -400,6 +400,56 @@ static const struct venc_config *venc_timings_to_config( | |||
400 | BUG(); | 400 | BUG(); |
401 | } | 401 | } |
402 | 402 | ||
403 | static void venc_power_on(struct omap_dss_device *dssdev) | ||
404 | { | ||
405 | u32 l; | ||
406 | |||
407 | venc_enable_clocks(1); | ||
408 | |||
409 | venc_reset(); | ||
410 | venc_write_config(venc_timings_to_config(&dssdev->panel.timings)); | ||
411 | |||
412 | dss_set_venc_output(dssdev->phy.venc.type); | ||
413 | dss_set_dac_pwrdn_bgz(1); | ||
414 | |||
415 | l = 0; | ||
416 | |||
417 | if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) | ||
418 | l |= 1 << 1; | ||
419 | else /* S-Video */ | ||
420 | l |= (1 << 0) | (1 << 2); | ||
421 | |||
422 | if (dssdev->phy.venc.invert_polarity == false) | ||
423 | l |= 1 << 3; | ||
424 | |||
425 | venc_write_reg(VENC_OUTPUT_CONTROL, l); | ||
426 | |||
427 | dispc_set_digit_size(dssdev->panel.timings.x_res, | ||
428 | dssdev->panel.timings.y_res/2); | ||
429 | |||
430 | regulator_enable(venc.vdda_dac_reg); | ||
431 | |||
432 | if (dssdev->platform_enable) | ||
433 | dssdev->platform_enable(dssdev); | ||
434 | |||
435 | dssdev->manager->enable(dssdev->manager); | ||
436 | } | ||
437 | |||
438 | static void venc_power_off(struct omap_dss_device *dssdev) | ||
439 | { | ||
440 | venc_write_reg(VENC_OUTPUT_CONTROL, 0); | ||
441 | dss_set_dac_pwrdn_bgz(0); | ||
442 | |||
443 | dssdev->manager->disable(dssdev->manager); | ||
444 | |||
445 | if (dssdev->platform_disable) | ||
446 | dssdev->platform_disable(dssdev); | ||
447 | |||
448 | regulator_disable(venc.vdda_dac_reg); | ||
449 | |||
450 | venc_enable_clocks(0); | ||
451 | } | ||
452 | |||
403 | 453 | ||
404 | 454 | ||
405 | 455 | ||
@@ -420,23 +470,66 @@ static int venc_panel_enable(struct omap_dss_device *dssdev) | |||
420 | { | 470 | { |
421 | int r = 0; | 471 | int r = 0; |
422 | 472 | ||
473 | DSSDBG("venc_enable_display\n"); | ||
474 | |||
475 | mutex_lock(&venc.venc_lock); | ||
476 | |||
477 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
478 | r = -EINVAL; | ||
479 | goto err1; | ||
480 | } | ||
481 | |||
482 | if (dssdev->platform_enable) { | ||
483 | r = dssdev->platform_enable(dssdev); | ||
484 | if (r) | ||
485 | goto err2; | ||
486 | } | ||
487 | |||
488 | venc_power_on(dssdev); | ||
489 | |||
490 | venc.wss_data = 0; | ||
491 | |||
492 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
493 | |||
423 | /* wait couple of vsyncs until enabling the LCD */ | 494 | /* wait couple of vsyncs until enabling the LCD */ |
424 | msleep(50); | 495 | msleep(50); |
425 | 496 | ||
426 | if (dssdev->platform_enable) | 497 | mutex_unlock(&venc.venc_lock); |
427 | r = dssdev->platform_enable(dssdev); | ||
428 | 498 | ||
429 | return r; | 499 | return r; |
500 | err2: | ||
501 | venc_power_off(dssdev); | ||
502 | err1: | ||
503 | mutex_unlock(&venc.venc_lock); | ||
504 | return r; | ||
430 | } | 505 | } |
431 | 506 | ||
432 | static void venc_panel_disable(struct omap_dss_device *dssdev) | 507 | static void venc_panel_disable(struct omap_dss_device *dssdev) |
433 | { | 508 | { |
434 | if (dssdev->platform_disable) | 509 | DSSDBG("venc_disable_display\n"); |
435 | dssdev->platform_disable(dssdev); | ||
436 | 510 | ||
437 | /* wait at least 5 vsyncs after disabling the LCD */ | 511 | mutex_lock(&venc.venc_lock); |
512 | |||
513 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
514 | goto end; | ||
438 | 515 | ||
516 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) { | ||
517 | /* suspended is the same as disabled with venc */ | ||
518 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
519 | goto end; | ||
520 | } | ||
521 | |||
522 | venc_power_off(dssdev); | ||
523 | |||
524 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
439 | msleep(100); | 525 | msleep(100); |
526 | |||
527 | if (dssdev->platform_disable) | ||
528 | dssdev->platform_disable(dssdev); | ||
529 | |||
530 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
531 | end: | ||
532 | mutex_unlock(&venc.venc_lock); | ||
440 | } | 533 | } |
441 | 534 | ||
442 | static int venc_panel_suspend(struct omap_dss_device *dssdev) | 535 | static int venc_panel_suspend(struct omap_dss_device *dssdev) |
@@ -526,146 +619,6 @@ void venc_exit(void) | |||
526 | iounmap(venc.base); | 619 | iounmap(venc.base); |
527 | } | 620 | } |
528 | 621 | ||
529 | static void venc_power_on(struct omap_dss_device *dssdev) | ||
530 | { | ||
531 | u32 l; | ||
532 | |||
533 | venc_enable_clocks(1); | ||
534 | |||
535 | venc_reset(); | ||
536 | venc_write_config(venc_timings_to_config(&dssdev->panel.timings)); | ||
537 | |||
538 | dss_set_venc_output(dssdev->phy.venc.type); | ||
539 | dss_set_dac_pwrdn_bgz(1); | ||
540 | |||
541 | l = 0; | ||
542 | |||
543 | if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) | ||
544 | l |= 1 << 1; | ||
545 | else /* S-Video */ | ||
546 | l |= (1 << 0) | (1 << 2); | ||
547 | |||
548 | if (dssdev->phy.venc.invert_polarity == false) | ||
549 | l |= 1 << 3; | ||
550 | |||
551 | venc_write_reg(VENC_OUTPUT_CONTROL, l); | ||
552 | |||
553 | dispc_set_digit_size(dssdev->panel.timings.x_res, | ||
554 | dssdev->panel.timings.y_res/2); | ||
555 | |||
556 | regulator_enable(venc.vdda_dac_reg); | ||
557 | |||
558 | if (dssdev->platform_enable) | ||
559 | dssdev->platform_enable(dssdev); | ||
560 | |||
561 | dssdev->manager->enable(dssdev->manager); | ||
562 | } | ||
563 | |||
564 | static void venc_power_off(struct omap_dss_device *dssdev) | ||
565 | { | ||
566 | venc_write_reg(VENC_OUTPUT_CONTROL, 0); | ||
567 | dss_set_dac_pwrdn_bgz(0); | ||
568 | |||
569 | dssdev->manager->disable(dssdev->manager); | ||
570 | |||
571 | if (dssdev->platform_disable) | ||
572 | dssdev->platform_disable(dssdev); | ||
573 | |||
574 | regulator_disable(venc.vdda_dac_reg); | ||
575 | |||
576 | venc_enable_clocks(0); | ||
577 | } | ||
578 | |||
579 | static int venc_enable_display(struct omap_dss_device *dssdev) | ||
580 | { | ||
581 | int r = 0; | ||
582 | |||
583 | DSSDBG("venc_enable_display\n"); | ||
584 | |||
585 | mutex_lock(&venc.venc_lock); | ||
586 | |||
587 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
588 | r = -EINVAL; | ||
589 | goto err; | ||
590 | } | ||
591 | |||
592 | venc_power_on(dssdev); | ||
593 | |||
594 | venc.wss_data = 0; | ||
595 | |||
596 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
597 | err: | ||
598 | mutex_unlock(&venc.venc_lock); | ||
599 | |||
600 | return r; | ||
601 | } | ||
602 | |||
603 | static void venc_disable_display(struct omap_dss_device *dssdev) | ||
604 | { | ||
605 | DSSDBG("venc_disable_display\n"); | ||
606 | |||
607 | mutex_lock(&venc.venc_lock); | ||
608 | |||
609 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
610 | goto end; | ||
611 | |||
612 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) { | ||
613 | /* suspended is the same as disabled with venc */ | ||
614 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
615 | goto end; | ||
616 | } | ||
617 | |||
618 | venc_power_off(dssdev); | ||
619 | |||
620 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
621 | end: | ||
622 | mutex_unlock(&venc.venc_lock); | ||
623 | } | ||
624 | |||
625 | static int venc_display_suspend(struct omap_dss_device *dssdev) | ||
626 | { | ||
627 | int r = 0; | ||
628 | |||
629 | DSSDBG("venc_display_suspend\n"); | ||
630 | |||
631 | mutex_lock(&venc.venc_lock); | ||
632 | |||
633 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | ||
634 | r = -EINVAL; | ||
635 | goto err; | ||
636 | } | ||
637 | |||
638 | venc_power_off(dssdev); | ||
639 | |||
640 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
641 | err: | ||
642 | mutex_unlock(&venc.venc_lock); | ||
643 | |||
644 | return r; | ||
645 | } | ||
646 | |||
647 | static int venc_display_resume(struct omap_dss_device *dssdev) | ||
648 | { | ||
649 | int r = 0; | ||
650 | |||
651 | DSSDBG("venc_display_resume\n"); | ||
652 | |||
653 | mutex_lock(&venc.venc_lock); | ||
654 | |||
655 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
656 | r = -EINVAL; | ||
657 | goto err; | ||
658 | } | ||
659 | |||
660 | venc_power_on(dssdev); | ||
661 | |||
662 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
663 | err: | ||
664 | mutex_unlock(&venc.venc_lock); | ||
665 | |||
666 | return r; | ||
667 | } | ||
668 | |||
669 | static void venc_get_timings(struct omap_dss_device *dssdev, | 622 | static void venc_get_timings(struct omap_dss_device *dssdev, |
670 | struct omap_video_timings *timings) | 623 | struct omap_video_timings *timings) |
671 | { | 624 | { |
@@ -684,8 +637,8 @@ static void venc_set_timings(struct omap_dss_device *dssdev, | |||
684 | dssdev->panel.timings = *timings; | 637 | dssdev->panel.timings = *timings; |
685 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { | 638 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
686 | /* turn the venc off and on to get new timings to use */ | 639 | /* turn the venc off and on to get new timings to use */ |
687 | venc_disable_display(dssdev); | 640 | venc_panel_disable(dssdev); |
688 | venc_enable_display(dssdev); | 641 | venc_panel_enable(dssdev); |
689 | } | 642 | } |
690 | } | 643 | } |
691 | 644 | ||
@@ -738,10 +691,6 @@ int venc_init_display(struct omap_dss_device *dssdev) | |||
738 | { | 691 | { |
739 | DSSDBG("init_display\n"); | 692 | DSSDBG("init_display\n"); |
740 | 693 | ||
741 | dssdev->enable = venc_enable_display; | ||
742 | dssdev->disable = venc_disable_display; | ||
743 | dssdev->suspend = venc_display_suspend; | ||
744 | dssdev->resume = venc_display_resume; | ||
745 | dssdev->get_timings = venc_get_timings; | 694 | dssdev->get_timings = venc_get_timings; |
746 | dssdev->set_timings = venc_set_timings; | 695 | dssdev->set_timings = venc_set_timings; |
747 | dssdev->check_timings = venc_check_timings; | 696 | dssdev->check_timings = venc_check_timings; |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 3dbbddc2d51e..b327ee0e60d5 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -1223,8 +1223,8 @@ static int omapfb_blank(int blank, struct fb_info *fbi) | |||
1223 | if (display->state != OMAP_DSS_DISPLAY_SUSPENDED) | 1223 | if (display->state != OMAP_DSS_DISPLAY_SUSPENDED) |
1224 | goto exit; | 1224 | goto exit; |
1225 | 1225 | ||
1226 | if (display->resume) | 1226 | if (display->driver->resume) |
1227 | r = display->resume(display); | 1227 | r = display->driver->resume(display); |
1228 | 1228 | ||
1229 | if (r == 0 && display->driver->get_update_mode && | 1229 | if (r == 0 && display->driver->get_update_mode && |
1230 | display->driver->get_update_mode(display) == | 1230 | display->driver->get_update_mode(display) == |
@@ -1242,8 +1242,8 @@ static int omapfb_blank(int blank, struct fb_info *fbi) | |||
1242 | if (display->state != OMAP_DSS_DISPLAY_ACTIVE) | 1242 | if (display->state != OMAP_DSS_DISPLAY_ACTIVE) |
1243 | goto exit; | 1243 | goto exit; |
1244 | 1244 | ||
1245 | if (display->suspend) | 1245 | if (display->driver->suspend) |
1246 | r = display->suspend(display); | 1246 | r = display->driver->suspend(display); |
1247 | 1247 | ||
1248 | break; | 1248 | break; |
1249 | 1249 | ||
@@ -1831,7 +1831,7 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) | |||
1831 | 1831 | ||
1832 | for (i = 0; i < fbdev->num_displays; i++) { | 1832 | for (i = 0; i < fbdev->num_displays; i++) { |
1833 | if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED) | 1833 | if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED) |
1834 | fbdev->displays[i]->disable(fbdev->displays[i]); | 1834 | fbdev->displays[i]->driver->disable(fbdev->displays[i]); |
1835 | 1835 | ||
1836 | omap_dss_put_device(fbdev->displays[i]); | 1836 | omap_dss_put_device(fbdev->displays[i]); |
1837 | } | 1837 | } |
@@ -2197,7 +2197,7 @@ static int omapfb_probe(struct platform_device *pdev) | |||
2197 | #ifndef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE | 2197 | #ifndef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE |
2198 | u16 w, h; | 2198 | u16 w, h; |
2199 | #endif | 2199 | #endif |
2200 | r = def_display->enable(def_display); | 2200 | r = def_display->driver->enable(def_display); |
2201 | if (r) { | 2201 | if (r) { |
2202 | dev_warn(fbdev->dev, "Failed to enable display '%s'\n", | 2202 | dev_warn(fbdev->dev, "Failed to enable display '%s'\n", |
2203 | def_display->name); | 2203 | def_display->name); |