sg3-utils: add newer buildable version
[openembedded.git] / recipes / linux / linux-openmoko-2.6.32 / 0016-Enable-display-before-trying-to-set-mode-or-base.patch
1 From 986df52e3e02a1cdbf43eafccd483f0f86c696bd Mon Sep 17 00:00:00 2001
2 From: Thomas White <taw@bitwiz.org.uk>
3 Date: Sun, 21 Mar 2010 20:55:18 +0100
4 Subject: [PATCH 16/16] Enable display before trying to set mode or base
5
6 This makes it possible to change mode when the screen is switched off.
7
8 Signed-off-by: Thomas White <taw@bitwiz.org.uk>
9 ---
10  drivers/mfd/glamo/glamo-display.c |   56 ++++++++++++++++++------------------
11  1 files changed, 28 insertions(+), 28 deletions(-)
12
13 diff --git a/drivers/mfd/glamo/glamo-display.c b/drivers/mfd/glamo/glamo-display.c
14 index e56cdb4..24a1a31 100644
15 --- a/drivers/mfd/glamo/glamo-display.c
16 +++ b/drivers/mfd/glamo/glamo-display.c
17 @@ -267,9 +267,9 @@ static int glamo_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
18         gdrm = gcrtc->gdrm;     /* Here it is! */
19  
20         if ( !gcrtc->pixel_clock_on ) {
21 -               printk(KERN_WARNING "[glamo-drm] Refusing to set base while "
22 -                                   "pixel clock is off.\n");
23 -               return -EBUSY;
24 +               printk(KERN_WARNING "[glamo-drm] Display is off - "
25 +                                   "enabling it before setting base.\n");
26 +               glamo_lcd_power(gdrm, 1);
27         }
28  
29         gfb = to_glamo_framebuffer(crtc->fb);
30 @@ -304,9 +304,9 @@ static int glamo_crtc_mode_set(struct drm_crtc *crtc,
31         gdrm = gcrtc->gdrm;     /* Here it is! */
32  
33         if ( !gcrtc->pixel_clock_on ) {
34 -               printk(KERN_WARNING "[glamo-drm] Refusing to set mode while "
35 -                                   "pixel clock is off.\n");
36 -               return -EBUSY;
37 +               printk(KERN_WARNING "[glamo-drm] Display is off - "
38 +                                   "enabling it before setting mode.\n");
39 +               glamo_lcd_power(gdrm, 1);
40         }
41  
42         glamo_lcd_cmd_mode(gdrm, 1);
43 @@ -380,28 +380,6 @@ static void glamo_crtc_dpms(struct drm_crtc *crtc, int mode)
44  }
45  
46  
47 -void glamo_lcd_power(struct glamodrm_handle *gdrm, int mode)
48 -{
49 -       struct drm_crtc *crtc = gdrm->crtc;
50 -       struct glamo_crtc *gcrtc = to_glamo_crtc(crtc);
51 -
52 -       if ( mode ) {
53 -               glamo_engine_enable(gdrm->glamo_core, GLAMO_ENGINE_LCD);
54 -               gcrtc->pixel_clock_on = 1;
55 -               jbt6k74_setpower(JBT_POWER_MODE_NORMAL);
56 -               if ( gcrtc->current_mode_set ) {
57 -                       glamo_crtc_mode_set(crtc, &gcrtc->current_mode,
58 -                                           &gcrtc->current_mode, 0, 0,
59 -                                           gcrtc->current_fb);
60 -               }
61 -       } else {
62 -               jbt6k74_setpower(JBT_POWER_MODE_OFF);
63 -               glamo_engine_suspend(gdrm->glamo_core, GLAMO_ENGINE_LCD);
64 -               gcrtc->pixel_clock_on = 0;
65 -       }
66 -}
67 -
68 -
69  static void glamo_crtc_prepare(struct drm_crtc *crtc)
70  {
71  }
72 @@ -862,6 +840,28 @@ int glamo_display_init(struct drm_device *dev)
73  }
74  
75  
76 +void glamo_lcd_power(struct glamodrm_handle *gdrm, int mode)
77 +{
78 +       struct drm_crtc *crtc = gdrm->crtc;
79 +       struct glamo_crtc *gcrtc = to_glamo_crtc(crtc);
80 +
81 +       if ( mode ) {
82 +               glamo_engine_enable(gdrm->glamo_core, GLAMO_ENGINE_LCD);
83 +               gcrtc->pixel_clock_on = 1;
84 +               jbt6k74_setpower(JBT_POWER_MODE_NORMAL);
85 +               if ( gcrtc->current_mode_set ) {
86 +                       glamo_crtc_mode_set(crtc, &gcrtc->current_mode,
87 +                                           &gcrtc->current_mode, 0, 0,
88 +                                           gcrtc->current_fb);
89 +               }
90 +       } else {
91 +               jbt6k74_setpower(JBT_POWER_MODE_OFF);
92 +               glamo_engine_suspend(gdrm->glamo_core, GLAMO_ENGINE_LCD);
93 +               gcrtc->pixel_clock_on = 0;
94 +       }
95 +}
96 +
97 +
98  void glamo_display_suspend(struct glamodrm_handle *gdrm)
99  {
100         /* do nothing */
101 -- 
102 1.7.0.2
103