Commit e75d80d8d4834b5d4044c8cacf9ede66f87754cf

Authored by Jyri Sarha
Committed by Jacob Stiffler
1 parent be2eb0bd39

OMAPDSS: hdmi: Reconfigure and restart audio when display is enabled

Reconfigure and restart audio when display is enabled, if audio
playback was active before. The audio configuration is stored when is
is successfully applied and a boolean is set when playback has started
and unset when stopped. This data is used to reconfigure the audio
when display is re-enabled. Abort audio playback if reconfiguration
fails.

Signed-off-by: Jyri Sarha <jsarha@ti.com>

Showing 3 changed files with 38 additions and 1 deletions Side-by-side Diff

drivers/video/fbdev/omap2/dss/hdmi.h
... ... @@ -332,6 +332,8 @@
332 332  
333 333 void (*audio_abort_cb)(struct device *dev);
334 334 int wp_idlemode;
  335 + bool audio_playing;
  336 + struct omap_dss_audio audio_config;
335 337 };
336 338  
337 339 #endif
drivers/video/fbdev/omap2/dss/hdmi4.c
... ... @@ -381,6 +381,18 @@
381 381  
382 382 hdmi.display_enabled = true;
383 383  
  384 + if (hdmi.audio_abort_cb && hdmi.audio_playing) {
  385 + hdmi4_audio_stop(&hdmi.core, &hdmi.wp);
  386 + r = hdmi4_audio_config(&hdmi.core, &hdmi.wp, &hdmi.audio_config,
  387 + hdmi.cfg.timings.pixelclock);
  388 + if (!r)
  389 + r = hdmi4_audio_start(&hdmi.core, &hdmi.wp);
  390 + if (r) {
  391 + DSSERR("Error restoring audio stream");
  392 + hdmi.audio_abort_cb(&hdmi.pdev->dev);
  393 + }
  394 + }
  395 +
384 396 mutex_unlock(&hdmi.lock);
385 397 return 0;
386 398  
387 399  
... ... @@ -608,8 +620,10 @@
608 620  
609 621 ret = hdmi_wp_audio_enable(&hd->wp, enable);
610 622  
611   - if (!enable)
  623 + if (!enable) {
612 624 hd->audio_abort_cb = NULL;
  625 + hd->audio_playing = false;
  626 + }
613 627  
614 628 mutex_unlock(&hd->lock);
615 629  
... ... @@ -625,6 +639,8 @@
625 639 ret = hdmi4_audio_start(&hd->core, &hd->wp);
626 640 else
627 641 hdmi4_audio_stop(&hd->core, &hd->wp);
  642 + if (!ret)
  643 + hd->audio_playing = enable;
628 644  
629 645 return ret;
630 646 }
... ... @@ -640,6 +656,8 @@
640 656 else
641 657 ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio,
642 658 hd->cfg.timings.pixelclock);
  659 + if (!ret)
  660 + hd->audio_config = *dss_audio;
643 661 mutex_unlock(&hd->lock);
644 662  
645 663 return ret;
drivers/video/fbdev/omap2/dss/hdmi5.c
... ... @@ -409,6 +409,18 @@
409 409  
410 410 hdmi.display_enabled = true;
411 411  
  412 + if (hdmi.audio_abort_cb && hdmi.audio_playing) {
  413 + hdmi_wp_audio_core_req_enable(&hdmi.wp, false);
  414 + r = hdmi5_audio_config(&hdmi.core, &hdmi.wp, &hdmi.audio_config,
  415 + hdmi.cfg.timings.pixelclock);
  416 + if (!r)
  417 + r = hdmi_wp_audio_core_req_enable(&hdmi.wp, true);
  418 + if (r) {
  419 + DSSERR("Error restoring audio stream");
  420 + hdmi.audio_abort_cb(&hdmi.pdev->dev);
  421 + }
  422 + }
  423 +
412 424 mutex_unlock(&hdmi.lock);
413 425 return 0;
414 426  
... ... @@ -649,6 +661,7 @@
649 661 3, 2);
650 662  
651 663 hd->audio_abort_cb = NULL;
  664 + hd->audio_playing = false;
652 665 }
653 666  
654 667 mutex_unlock(&hd->lock);
... ... @@ -660,6 +673,8 @@
660 673 {
661 674 struct omap_hdmi *hd = dev_get_drvdata(dev);
662 675  
  676 + hd->audio_playing = enable;
  677 +
663 678 return hdmi_wp_audio_core_req_enable(&hd->wp, enable);
664 679 }
665 680  
... ... @@ -674,6 +689,8 @@
674 689 else
675 690 ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio,
676 691 hd->cfg.timings.pixelclock);
  692 + if (!ret)
  693 + hd->audio_config = *dss_audio;
677 694 mutex_unlock(&hd->lock);
678 695  
679 696 return ret;