]> code.ossystems Code Review - openembedded-core.git/blob
db0bf723e93d2d057902079c3d79e7fb7278aadc
[openembedded-core.git] /
1 From 4111c672962a8df130b294961ab552fef6a498d9 Mon Sep 17 00:00:00 2001
2 From: Roger Quadros <roger.quadros@nokia.com>
3 Date: Wed, 17 Mar 2010 12:35:21 +0000
4 Subject: [PATCH 2/10] OMAP: DSS2: Use vdds_sdi regulator supply in SDI
5
6 From: Roger Quadros <roger.quadros@nokia.com>
7
8 Patch-mainline: 2.6.35?
9 Git-repo: http://www.gitorious.org/linux-omap-dss2/linux/commit/1d5c6663d92b37539617d833e6049e5dd21751c4
10
11 This patch enables the use of vdds_sdi regulator in SDI subsystem.
12 We can disable the vdds_sdi voltage when not in use to save
13 power.
14
15 Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
16 Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
17 ---
18  drivers/video/omap2/dss/core.c |    2 +-
19  drivers/video/omap2/dss/dss.h  |    2 +-
20  drivers/video/omap2/dss/sdi.c  |   17 ++++++++++++++++-
21  3 files changed, 18 insertions(+), 3 deletions(-)
22
23 diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
24 index 0988781..97f929b 100644
25 --- a/drivers/video/omap2/dss/core.c
26 +++ b/drivers/video/omap2/dss/core.c
27 @@ -495,7 +495,7 @@ static int omap_dss_probe(struct platform_device *pdev)
28  #endif
29         if (cpu_is_omap34xx()) {
30  #ifdef CONFIG_OMAP2_DSS_SDI
31 -               r = sdi_init(skip_init);
32 +               r = sdi_init(pdev, skip_init);
33                 if (r) {
34                         DSSERR("Failed to initialize SDI\n");
35                         goto fail0;
36 diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
37 index 2bcb124..8490bdf 100644
38 --- a/drivers/video/omap2/dss/dss.h
39 +++ b/drivers/video/omap2/dss/dss.h
40 @@ -231,7 +231,7 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
41                 struct dispc_clock_info *dispc_cinfo);
42  
43  /* SDI */
44 -int sdi_init(bool skip_init);
45 +int sdi_init(struct platform_device *pdev, bool skip_init);
46  void sdi_exit(void);
47  int sdi_init_display(struct omap_dss_device *display);
48  
49 diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
50 index c24f307..025c56c 100644
51 --- a/drivers/video/omap2/dss/sdi.c
52 +++ b/drivers/video/omap2/dss/sdi.c
53 @@ -23,6 +23,8 @@
54  #include <linux/clk.h>
55  #include <linux/delay.h>
56  #include <linux/err.h>
57 +#include <linux/platform_device.h>
58 +#include <linux/regulator/consumer.h>
59  
60  #include <plat/display.h>
61  #include "dss.h"
62 @@ -30,6 +32,7 @@
63  static struct {
64         bool skip_init;
65         bool update_enabled;
66 +       struct regulator *vdds_sdi_reg;
67  } sdi;
68  
69  static void sdi_basic_init(void)
70 @@ -63,6 +66,10 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
71                 goto err1;
72         }
73  
74 +       r = regulator_enable(sdi.vdds_sdi_reg);
75 +       if (r)
76 +               goto err1;
77 +
78         /* In case of skip_init sdi_init has already enabled the clocks */
79         if (!sdi.skip_init)
80                 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
81 @@ -136,6 +143,7 @@ err3:
82         dispc_enable_lcd_out(0);
83  err2:
84         dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
85 +       regulator_disable(sdi.vdds_sdi_reg);
86  err1:
87         omap_dss_stop_device(dssdev);
88  err0:
89 @@ -164,6 +172,8 @@ static void sdi_display_disable(struct omap_dss_device *dssdev)
90  
91         dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
92  
93 +       regulator_disable(sdi.vdds_sdi_reg);
94 +
95         omap_dss_stop_device(dssdev);
96  }
97  
98 @@ -258,11 +268,16 @@ int sdi_init_display(struct omap_dss_device *dssdev)
99         return 0;
100  }
101  
102 -int sdi_init(bool skip_init)
103 +int sdi_init(struct platform_device *pdev, bool skip_init)
104  {
105         /* we store this for first display enable, then clear it */
106         sdi.skip_init = skip_init;
107  
108 +       sdi.vdds_sdi_reg = regulator_get(&pdev->dev, "vdds_sdi");
109 +       if (IS_ERR(sdi.vdds_sdi_reg)) {
110 +               DSSERR("can't get VDDS_SDI regulator\n");
111 +               return PTR_ERR(sdi.vdds_sdi_reg);
112 +       }
113         /*
114          * Enable clocks already here, otherwise there would be a toggle
115          * of them until sdi_display_enable is called.
116 -- 
117 1.6.0.4
118