diff options
Diffstat (limited to 'drivers/video/omap2/dss/dpi.c')
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 2d71031baa25..69ce31ae2a2f 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -25,7 +25,10 @@ | |||
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/err.h> | ||
28 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/regulator/consumer.h> | ||
29 | 32 | ||
30 | #include <plat/display.h> | 33 | #include <plat/display.h> |
31 | #include <plat/cpu.h> | 34 | #include <plat/cpu.h> |
@@ -34,6 +37,7 @@ | |||
34 | 37 | ||
35 | static struct { | 38 | static struct { |
36 | int update_enabled; | 39 | int update_enabled; |
40 | struct regulator *vdds_dsi_reg; | ||
37 | } dpi; | 41 | } dpi; |
38 | 42 | ||
39 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 43 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
@@ -166,21 +170,27 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
166 | goto err1; | 170 | goto err1; |
167 | } | 171 | } |
168 | 172 | ||
173 | if (cpu_is_omap34xx()) { | ||
174 | r = regulator_enable(dpi.vdds_dsi_reg); | ||
175 | if (r) | ||
176 | goto err2; | ||
177 | } | ||
178 | |||
169 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | 179 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); |
170 | 180 | ||
171 | r = dpi_basic_init(dssdev); | 181 | r = dpi_basic_init(dssdev); |
172 | if (r) | 182 | if (r) |
173 | goto err2; | 183 | goto err3; |
174 | 184 | ||
175 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 185 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
176 | dss_clk_enable(DSS_CLK_FCK2); | 186 | dss_clk_enable(DSS_CLK_FCK2); |
177 | r = dsi_pll_init(dssdev, 0, 1); | 187 | r = dsi_pll_init(dssdev, 0, 1); |
178 | if (r) | 188 | if (r) |
179 | goto err3; | 189 | goto err4; |
180 | #endif | 190 | #endif |
181 | r = dpi_set_mode(dssdev); | 191 | r = dpi_set_mode(dssdev); |
182 | if (r) | 192 | if (r) |
183 | goto err4; | 193 | goto err5; |
184 | 194 | ||
185 | mdelay(2); | 195 | mdelay(2); |
186 | 196 | ||
@@ -188,22 +198,25 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
188 | 198 | ||
189 | r = dssdev->driver->enable(dssdev); | 199 | r = dssdev->driver->enable(dssdev); |
190 | if (r) | 200 | if (r) |
191 | goto err5; | 201 | goto err6; |
192 | 202 | ||
193 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 203 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
194 | 204 | ||
195 | return 0; | 205 | return 0; |
196 | 206 | ||
197 | err5: | 207 | err6: |
198 | dispc_enable_lcd_out(0); | 208 | dispc_enable_lcd_out(0); |
199 | err4: | 209 | err5: |
200 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 210 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
201 | dsi_pll_uninit(); | 211 | dsi_pll_uninit(); |
202 | err3: | 212 | err4: |
203 | dss_clk_disable(DSS_CLK_FCK2); | 213 | dss_clk_disable(DSS_CLK_FCK2); |
204 | #endif | 214 | #endif |
205 | err2: | 215 | err3: |
206 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 216 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
217 | err2: | ||
218 | if (cpu_is_omap34xx()) | ||
219 | regulator_disable(dpi.vdds_dsi_reg); | ||
207 | err1: | 220 | err1: |
208 | omap_dss_stop_device(dssdev); | 221 | omap_dss_stop_device(dssdev); |
209 | err0: | 222 | err0: |
@@ -232,6 +245,9 @@ static void dpi_display_disable(struct omap_dss_device *dssdev) | |||
232 | 245 | ||
233 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 246 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
234 | 247 | ||
248 | if (cpu_is_omap34xx()) | ||
249 | regulator_disable(dpi.vdds_dsi_reg); | ||
250 | |||
235 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | 251 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; |
236 | 252 | ||
237 | omap_dss_stop_device(dssdev); | 253 | omap_dss_stop_device(dssdev); |
@@ -251,6 +267,9 @@ static int dpi_display_suspend(struct omap_dss_device *dssdev) | |||
251 | 267 | ||
252 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 268 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
253 | 269 | ||
270 | if (cpu_is_omap34xx()) | ||
271 | regulator_disable(dpi.vdds_dsi_reg); | ||
272 | |||
254 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | 273 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; |
255 | 274 | ||
256 | return 0; | 275 | return 0; |
@@ -258,11 +277,19 @@ static int dpi_display_suspend(struct omap_dss_device *dssdev) | |||
258 | 277 | ||
259 | static int dpi_display_resume(struct omap_dss_device *dssdev) | 278 | static int dpi_display_resume(struct omap_dss_device *dssdev) |
260 | { | 279 | { |
280 | int r; | ||
281 | |||
261 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) | 282 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) |
262 | return -EINVAL; | 283 | return -EINVAL; |
263 | 284 | ||
264 | DSSDBG("dpi_display_resume\n"); | 285 | DSSDBG("dpi_display_resume\n"); |
265 | 286 | ||
287 | if (cpu_is_omap34xx()) { | ||
288 | r = regulator_enable(dpi.vdds_dsi_reg); | ||
289 | if (r) | ||
290 | goto err0; | ||
291 | } | ||
292 | |||
266 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | 293 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); |
267 | 294 | ||
268 | dispc_enable_lcd_out(1); | 295 | dispc_enable_lcd_out(1); |
@@ -273,6 +300,8 @@ static int dpi_display_resume(struct omap_dss_device *dssdev) | |||
273 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 300 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
274 | 301 | ||
275 | return 0; | 302 | return 0; |
303 | err0: | ||
304 | return r; | ||
276 | } | 305 | } |
277 | 306 | ||
278 | static void dpi_set_timings(struct omap_dss_device *dssdev, | 307 | static void dpi_set_timings(struct omap_dss_device *dssdev, |
@@ -388,8 +417,16 @@ int dpi_init_display(struct omap_dss_device *dssdev) | |||
388 | return 0; | 417 | return 0; |
389 | } | 418 | } |
390 | 419 | ||
391 | int dpi_init(void) | 420 | int dpi_init(struct platform_device *pdev) |
392 | { | 421 | { |
422 | if (cpu_is_omap34xx()) { | ||
423 | dpi.vdds_dsi_reg = dss_get_vdds_dsi(); | ||
424 | if (IS_ERR(dpi.vdds_dsi_reg)) { | ||
425 | DSSERR("can't get VDDS_DSI regulator\n"); | ||
426 | return PTR_ERR(dpi.vdds_dsi_reg); | ||
427 | } | ||
428 | } | ||
429 | |||
393 | return 0; | 430 | return 0; |
394 | } | 431 | } |
395 | 432 | ||