diff options
Diffstat (limited to 'drivers/video/omap2/dss/hdmi_panel.c')
-rw-r--r-- | drivers/video/omap2/dss/hdmi_panel.c | 82 |
1 files changed, 15 insertions, 67 deletions
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c index 69fb115bab32..dfb8eda81b61 100644 --- a/drivers/video/omap2/dss/hdmi_panel.c +++ b/drivers/video/omap2/dss/hdmi_panel.c | |||
@@ -280,58 +280,6 @@ static void hdmi_panel_disable(struct omap_dss_device *dssdev) | |||
280 | mutex_unlock(&hdmi.lock); | 280 | mutex_unlock(&hdmi.lock); |
281 | } | 281 | } |
282 | 282 | ||
283 | static int hdmi_panel_suspend(struct omap_dss_device *dssdev) | ||
284 | { | ||
285 | int r = 0; | ||
286 | |||
287 | mutex_lock(&hdmi.lock); | ||
288 | |||
289 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | ||
290 | r = -EINVAL; | ||
291 | goto err; | ||
292 | } | ||
293 | |||
294 | /* | ||
295 | * TODO: notify audio users that the display was suspended. For now, | ||
296 | * disable audio locally to not break our audio state machine. | ||
297 | */ | ||
298 | hdmi_panel_audio_disable(dssdev); | ||
299 | |||
300 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
301 | omapdss_hdmi_display_disable(dssdev); | ||
302 | |||
303 | err: | ||
304 | mutex_unlock(&hdmi.lock); | ||
305 | |||
306 | return r; | ||
307 | } | ||
308 | |||
309 | static int hdmi_panel_resume(struct omap_dss_device *dssdev) | ||
310 | { | ||
311 | int r = 0; | ||
312 | |||
313 | mutex_lock(&hdmi.lock); | ||
314 | |||
315 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
316 | r = -EINVAL; | ||
317 | goto err; | ||
318 | } | ||
319 | |||
320 | r = omapdss_hdmi_display_enable(dssdev); | ||
321 | if (r) { | ||
322 | DSSERR("failed to power on\n"); | ||
323 | goto err; | ||
324 | } | ||
325 | /* TODO: notify audio users that the panel resumed. */ | ||
326 | |||
327 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
328 | |||
329 | err: | ||
330 | mutex_unlock(&hdmi.lock); | ||
331 | |||
332 | return r; | ||
333 | } | ||
334 | |||
335 | static void hdmi_get_timings(struct omap_dss_device *dssdev, | 283 | static void hdmi_get_timings(struct omap_dss_device *dssdev, |
336 | struct omap_video_timings *timings) | 284 | struct omap_video_timings *timings) |
337 | { | 285 | { |
@@ -379,20 +327,22 @@ static int hdmi_check_timings(struct omap_dss_device *dssdev, | |||
379 | static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) | 327 | static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) |
380 | { | 328 | { |
381 | int r; | 329 | int r; |
330 | bool need_enable; | ||
382 | 331 | ||
383 | mutex_lock(&hdmi.lock); | 332 | mutex_lock(&hdmi.lock); |
384 | 333 | ||
385 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | 334 | need_enable = dssdev->state == OMAP_DSS_DISPLAY_DISABLED; |
386 | r = omapdss_hdmi_display_enable(dssdev); | 335 | |
336 | if (need_enable) { | ||
337 | r = omapdss_hdmi_core_enable(dssdev); | ||
387 | if (r) | 338 | if (r) |
388 | goto err; | 339 | goto err; |
389 | } | 340 | } |
390 | 341 | ||
391 | r = omapdss_hdmi_read_edid(buf, len); | 342 | r = omapdss_hdmi_read_edid(buf, len); |
392 | 343 | ||
393 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | 344 | if (need_enable) |
394 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | 345 | omapdss_hdmi_core_disable(dssdev); |
395 | omapdss_hdmi_display_disable(dssdev); | ||
396 | err: | 346 | err: |
397 | mutex_unlock(&hdmi.lock); | 347 | mutex_unlock(&hdmi.lock); |
398 | 348 | ||
@@ -402,20 +352,22 @@ err: | |||
402 | static bool hdmi_detect(struct omap_dss_device *dssdev) | 352 | static bool hdmi_detect(struct omap_dss_device *dssdev) |
403 | { | 353 | { |
404 | int r; | 354 | int r; |
355 | bool need_enable; | ||
405 | 356 | ||
406 | mutex_lock(&hdmi.lock); | 357 | mutex_lock(&hdmi.lock); |
407 | 358 | ||
408 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | 359 | need_enable = dssdev->state == OMAP_DSS_DISPLAY_DISABLED; |
409 | r = omapdss_hdmi_display_enable(dssdev); | 360 | |
361 | if (need_enable) { | ||
362 | r = omapdss_hdmi_core_enable(dssdev); | ||
410 | if (r) | 363 | if (r) |
411 | goto err; | 364 | goto err; |
412 | } | 365 | } |
413 | 366 | ||
414 | r = omapdss_hdmi_detect(); | 367 | r = omapdss_hdmi_detect(); |
415 | 368 | ||
416 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | 369 | if (need_enable) |
417 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | 370 | omapdss_hdmi_core_disable(dssdev); |
418 | omapdss_hdmi_display_disable(dssdev); | ||
419 | err: | 371 | err: |
420 | mutex_unlock(&hdmi.lock); | 372 | mutex_unlock(&hdmi.lock); |
421 | 373 | ||
@@ -427,8 +379,6 @@ static struct omap_dss_driver hdmi_driver = { | |||
427 | .remove = hdmi_panel_remove, | 379 | .remove = hdmi_panel_remove, |
428 | .enable = hdmi_panel_enable, | 380 | .enable = hdmi_panel_enable, |
429 | .disable = hdmi_panel_disable, | 381 | .disable = hdmi_panel_disable, |
430 | .suspend = hdmi_panel_suspend, | ||
431 | .resume = hdmi_panel_resume, | ||
432 | .get_timings = hdmi_get_timings, | 382 | .get_timings = hdmi_get_timings, |
433 | .set_timings = hdmi_set_timings, | 383 | .set_timings = hdmi_set_timings, |
434 | .check_timings = hdmi_check_timings, | 384 | .check_timings = hdmi_check_timings, |
@@ -454,9 +404,7 @@ int hdmi_panel_init(void) | |||
454 | spin_lock_init(&hdmi.audio_lock); | 404 | spin_lock_init(&hdmi.audio_lock); |
455 | #endif | 405 | #endif |
456 | 406 | ||
457 | omap_dss_register_driver(&hdmi_driver); | 407 | return omap_dss_register_driver(&hdmi_driver); |
458 | |||
459 | return 0; | ||
460 | } | 408 | } |
461 | 409 | ||
462 | void hdmi_panel_exit(void) | 410 | void hdmi_panel_exit(void) |