diff options
author | Sumit Bhattacharya <sumitb@nvidia.com> | 2012-02-08 18:15:50 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-03-02 17:39:23 -0800 |
commit | 1de7d65987afa175e552e300a2ef435bada02f08 (patch) | |
tree | bb9778db486113f8ae66f90cd76180ea0893d67c /sound/pci/hda/patch_hdmi.c | |
parent | 27fb4ae633b456346593c60e7dc77c4c85a625a7 (diff) |
ALSA: HDA: Prevent delay in opening hdmi pcm
When monitor is plugged in instead of reading the complete ELD buffer
only read the relavant bytes required to update pcm info. Go through
the complete ELD buffer once LPCM sad ELD information is updated in
ELD structure. This is required to reduce the delay in getting a valid
PCM information which in turn delays opening of HDMI PCM stream.
Also if a valid LPCM SAD ELD information is not available when
hdmi_pcm_open is called then instead of looping inside hdmi_pcm_open
return error to unblock other operations. User space should retry to
open HDA PCM device after some time.
Bug 931930
Bug 913739
Bug 906076
Change-Id: Iaaef3f0e361ae406c92605b056bd4dff9c2b7856
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/83143
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Diffstat (limited to 'sound/pci/hda/patch_hdmi.c')
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index b03efbc17132..493d368572ae 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -829,6 +829,21 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, per_pin = &spec->pins[pin_idx]; eld = &per_pin->sink_eld; +#ifdef CONFIG_SND_HDA_PLATFORM_NVIDIA_TEGRA + if ((codec->preset->id == 0x10de0020) && + (!eld->monitor_present || !eld->lpcm_sad_ready)) { + if (!eld->monitor_present) { + if (tegra_hdmi_setup_hda_presence() < 0) { + snd_printk(KERN_WARNING + "HDMI: No HDMI device connected\n"); + return -ENODEV; + } + } + if (!eld->lpcm_sad_ready) + return -EAGAIN; + } +#endif + /* Dynamically assign converter to stream */ for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) { per_cvt = &spec->cvts[cvt_idx]; @@ -870,36 +885,8 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, hinfo->formats = per_cvt->formats; hinfo->maxbps = per_cvt->maxbps; -#ifdef CONFIG_SND_HDA_PLATFORM_NVIDIA_TEGRA - if ((codec->preset->id == 0x10de0020) && - (!eld->eld_valid || !eld->sad_count)) { - int err = 0; - unsigned long timeout; - - if (!eld->eld_valid) { - err = tegra_hdmi_setup_hda_presence(); - if (err < 0) { - snd_printk(KERN_WARNING - "HDMI: No HDMI device connected\n"); - return -ENODEV; - } - } - - timeout = jiffies + msecs_to_jiffies(5000); - for (;;) { - if (eld->eld_valid && eld->sad_count) - break; - - if (time_after(jiffies, timeout)) - break; - - mdelay(10); - } - } -#endif - /* Restrict capabilities by ELD if this isn't disabled */ - if (!static_hdmi_pcm && eld->eld_valid) { + if (!static_hdmi_pcm && (eld->eld_valid || eld->lpcm_sad_ready)) { snd_hdmi_eld_update_pcm_info(eld, hinfo); if (hinfo->channels_min > hinfo->channels_max || !hinfo->rates || !hinfo->formats) |