Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jyri Sarha and committed by
Tomi Valkeinen
c1899cb3 1915d7fa

+30 -40
+14 -19
drivers/gpu/drm/omapdrm/dss/hdmi4.c
··· 615 615 void (*abort_cb)(struct device *dev)) 616 616 { 617 617 struct omap_hdmi *hd = dev_get_drvdata(dev); 618 - int ret = 0; 619 618 620 619 mutex_lock(&hd->lock); 621 620 622 - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 623 - ret = -EPERM; 624 - goto out; 625 - } 621 + WARN_ON(hd->audio_abort_cb != NULL); 626 622 627 623 hd->audio_abort_cb = abort_cb; 628 624 629 - out: 630 625 mutex_unlock(&hd->lock); 631 626 632 - return ret; 627 + return 0; 633 628 } 634 629 635 630 static int hdmi_audio_shutdown(struct device *dev) ··· 645 650 struct omap_hdmi *hd = dev_get_drvdata(dev); 646 651 unsigned long flags; 647 652 648 - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); 649 - 650 653 spin_lock_irqsave(&hd->audio_playing_lock, flags); 651 654 652 - if (hd->display_enabled) 655 + if (hd->display_enabled) { 656 + if (!hdmi_mode_has_audio(&hd->cfg)) 657 + DSSERR("%s: Video mode does not support audio\n", 658 + __func__); 653 659 hdmi_start_audio_stream(hd); 660 + } 654 661 hd->audio_playing = true; 655 662 656 663 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); ··· 683 686 684 687 mutex_lock(&hd->lock); 685 688 686 - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 687 - ret = -EPERM; 688 - goto out; 689 + if (hd->display_enabled) { 690 + ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, 691 + hd->cfg.vm.pixelclock); 692 + if (ret) 693 + goto out; 689 694 } 690 695 691 - ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, 692 - hd->cfg.vm.pixelclock); 693 - if (!ret) { 694 - hd->audio_configured = true; 695 - hd->audio_config = *dss_audio; 696 - } 696 + hd->audio_configured = true; 697 + hd->audio_config = *dss_audio; 697 698 out: 698 699 mutex_unlock(&hd->lock); 699 700
+16 -21
drivers/gpu/drm/omapdrm/dss/hdmi5.c
··· 606 606 void (*abort_cb)(struct device *dev)) 607 607 { 608 608 struct omap_hdmi *hd = dev_get_drvdata(dev); 609 - int ret = 0; 610 609 611 610 mutex_lock(&hd->lock); 612 611 613 - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 614 - ret = -EPERM; 615 - goto out; 616 - } 612 + WARN_ON(hd->audio_abort_cb != NULL); 617 613 618 614 hd->audio_abort_cb = abort_cb; 619 615 620 - out: 621 616 mutex_unlock(&hd->lock); 622 617 623 - return ret; 618 + return 0; 624 619 } 625 620 626 621 static int hdmi_audio_shutdown(struct device *dev) ··· 636 641 struct omap_hdmi *hd = dev_get_drvdata(dev); 637 642 unsigned long flags; 638 643 639 - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); 640 - 641 644 spin_lock_irqsave(&hd->audio_playing_lock, flags); 642 645 643 - if (hd->display_enabled) 646 + if (hd->display_enabled) { 647 + if (!hdmi_mode_has_audio(&hd->cfg)) 648 + DSSERR("%s: Video mode does not support audio\n", 649 + __func__); 644 650 hdmi_start_audio_stream(hd); 651 + } 645 652 hd->audio_playing = true; 646 653 647 654 spin_unlock_irqrestore(&hd->audio_playing_lock, flags); ··· 655 658 struct omap_hdmi *hd = dev_get_drvdata(dev); 656 659 unsigned long flags; 657 660 658 - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); 661 + if (!hdmi_mode_has_audio(&hd->cfg)) 662 + DSSERR("%s: Video mode does not support audio\n", __func__); 659 663 660 664 spin_lock_irqsave(&hd->audio_playing_lock, flags); 661 665 ··· 675 677 676 678 mutex_lock(&hd->lock); 677 679 678 - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { 679 - ret = -EPERM; 680 - goto out; 680 + if (hd->display_enabled) { 681 + ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, 682 + hd->cfg.vm.pixelclock); 683 + if (ret) 684 + goto out; 681 685 } 682 686 683 - ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, 684 - hd->cfg.vm.pixelclock); 685 - 686 - if (!ret) { 687 - hd->audio_configured = true; 688 - hd->audio_config = *dss_audio; 689 - } 687 + hd->audio_configured = true; 688 + hd->audio_config = *dss_audio; 690 689 out: 691 690 mutex_unlock(&hd->lock); 692 691