aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-03-16 06:05:04 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2018-03-01 02:18:18 -0500
commitc1899cb368c1d280af48661c6edaa975cf653533 (patch)
tree1864ef3d42ffe7308a0fe1aaaca5e89c34aca4fa
parent1915d7fa93397b3dc8bf9c6973d8662c0a661daf (diff)
drm/omap: Allow HDMI audio setup even if we do not have video configured
Allow HDMI audio setup even if we do not have video configured. Audio will get configured at the same time with video if the video is configured soon enough. If it is not the audio DMA will timeout in couple of seconds and audio playback will be aborted. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4.c33
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5.c37
2 files changed, 30 insertions, 40 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 1f7897c58f2f..97c88861d67a 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -615,21 +615,16 @@ static int hdmi_audio_startup(struct device *dev,
615 void (*abort_cb)(struct device *dev)) 615 void (*abort_cb)(struct device *dev))
616{ 616{
617 struct omap_hdmi *hd = dev_get_drvdata(dev); 617 struct omap_hdmi *hd = dev_get_drvdata(dev);
618 int ret = 0;
619 618
620 mutex_lock(&hd->lock); 619 mutex_lock(&hd->lock);
621 620
622 if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 621 WARN_ON(hd->audio_abort_cb != NULL);
623 ret = -EPERM;
624 goto out;
625 }
626 622
627 hd->audio_abort_cb = abort_cb; 623 hd->audio_abort_cb = abort_cb;
628 624
629out:
630 mutex_unlock(&hd->lock); 625 mutex_unlock(&hd->lock);
631 626
632 return ret; 627 return 0;
633} 628}
634 629
635static int hdmi_audio_shutdown(struct device *dev) 630static int hdmi_audio_shutdown(struct device *dev)
@@ -650,12 +645,14 @@ static int hdmi_audio_start(struct device *dev)
650 struct omap_hdmi *hd = dev_get_drvdata(dev); 645 struct omap_hdmi *hd = dev_get_drvdata(dev);
651 unsigned long flags; 646 unsigned long flags;
652 647
653 WARN_ON(!hdmi_mode_has_audio(&hd->cfg));
654
655 spin_lock_irqsave(&hd->audio_playing_lock, flags); 648 spin_lock_irqsave(&hd->audio_playing_lock, flags);
656 649
657 if (hd->display_enabled) 650 if (hd->display_enabled) {
651 if (!hdmi_mode_has_audio(&hd->cfg))
652 DSSERR("%s: Video mode does not support audio\n",
653 __func__);
658 hdmi_start_audio_stream(hd); 654 hdmi_start_audio_stream(hd);
655 }
659 hd->audio_playing = true; 656 hd->audio_playing = true;
660 657
661 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); 658 spin_unlock_irqrestore(&hd->audio_playing_lock, flags);
@@ -686,17 +683,15 @@ static int hdmi_audio_config(struct device *dev,
686 683
687 mutex_lock(&hd->lock); 684 mutex_lock(&hd->lock);
688 685
689 if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 686 if (hd->display_enabled) {
690 ret = -EPERM; 687 ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio,
691 goto out; 688 hd->cfg.vm.pixelclock);
689 if (ret)
690 goto out;
692 } 691 }
693 692
694 ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, 693 hd->audio_configured = true;
695 hd->cfg.vm.pixelclock); 694 hd->audio_config = *dss_audio;
696 if (!ret) {
697 hd->audio_configured = true;
698 hd->audio_config = *dss_audio;
699 }
700out: 695out:
701 mutex_unlock(&hd->lock); 696 mutex_unlock(&hd->lock);
702 697
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 4a0178ab8016..d28da9ac3e90 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -606,21 +606,16 @@ static int hdmi_audio_startup(struct device *dev,
606 void (*abort_cb)(struct device *dev)) 606 void (*abort_cb)(struct device *dev))
607{ 607{
608 struct omap_hdmi *hd = dev_get_drvdata(dev); 608 struct omap_hdmi *hd = dev_get_drvdata(dev);
609 int ret = 0;
610 609
611 mutex_lock(&hd->lock); 610 mutex_lock(&hd->lock);
612 611
613 if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 612 WARN_ON(hd->audio_abort_cb != NULL);
614 ret = -EPERM;
615 goto out;
616 }
617 613
618 hd->audio_abort_cb = abort_cb; 614 hd->audio_abort_cb = abort_cb;
619 615
620out:
621 mutex_unlock(&hd->lock); 616 mutex_unlock(&hd->lock);
622 617
623 return ret; 618 return 0;
624} 619}
625 620
626static int hdmi_audio_shutdown(struct device *dev) 621static int hdmi_audio_shutdown(struct device *dev)
@@ -641,12 +636,14 @@ static int hdmi_audio_start(struct device *dev)
641 struct omap_hdmi *hd = dev_get_drvdata(dev); 636 struct omap_hdmi *hd = dev_get_drvdata(dev);
642 unsigned long flags; 637 unsigned long flags;
643 638
644 WARN_ON(!hdmi_mode_has_audio(&hd->cfg));
645
646 spin_lock_irqsave(&hd->audio_playing_lock, flags); 639 spin_lock_irqsave(&hd->audio_playing_lock, flags);
647 640
648 if (hd->display_enabled) 641 if (hd->display_enabled) {
642 if (!hdmi_mode_has_audio(&hd->cfg))
643 DSSERR("%s: Video mode does not support audio\n",
644 __func__);
649 hdmi_start_audio_stream(hd); 645 hdmi_start_audio_stream(hd);
646 }
650 hd->audio_playing = true; 647 hd->audio_playing = true;
651 648
652 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); 649 spin_unlock_irqrestore(&hd->audio_playing_lock, flags);
@@ -658,7 +655,8 @@ static void hdmi_audio_stop(struct device *dev)
658 struct omap_hdmi *hd = dev_get_drvdata(dev); 655 struct omap_hdmi *hd = dev_get_drvdata(dev);
659 unsigned long flags; 656 unsigned long flags;
660 657
661 WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); 658 if (!hdmi_mode_has_audio(&hd->cfg))
659 DSSERR("%s: Video mode does not support audio\n", __func__);
662 660
663 spin_lock_irqsave(&hd->audio_playing_lock, flags); 661 spin_lock_irqsave(&hd->audio_playing_lock, flags);
664 662
@@ -677,18 +675,15 @@ static int hdmi_audio_config(struct device *dev,
677 675
678 mutex_lock(&hd->lock); 676 mutex_lock(&hd->lock);
679 677
680 if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 678 if (hd->display_enabled) {
681 ret = -EPERM; 679 ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio,
682 goto out; 680 hd->cfg.vm.pixelclock);
681 if (ret)
682 goto out;
683 } 683 }
684 684
685 ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, 685 hd->audio_configured = true;
686 hd->cfg.vm.pixelclock); 686 hd->audio_config = *dss_audio;
687
688 if (!ret) {
689 hd->audio_configured = true;
690 hd->audio_config = *dss_audio;
691 }
692out: 687out:
693 mutex_unlock(&hd->lock); 688 mutex_unlock(&hd->lock);
694 689