]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
pci: hda: Limit sleep time when codec is off
authorSumit Bhattacharya <sumitb@nvidia.com>
Tue, 1 Dec 2015 07:17:07 +0000 (12:47 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Fri, 18 Dec 2015 17:20:33 +0000 (09:20 -0800)
Limit sleep time to 10ms if none of the HDA pcm streams are
active. This will reduce suspend time for HDA when HDMI is
not connected.

Bug 200063987

Change-Id: I27a57486f51dd97dac18967e376c3c05ecd32539
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/839657
Reviewed-by: Sanjay Singh Chauhan <schauhan@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
GVS: Gerrit_Virtual_Submit

sound/pci/hda/hda_codec.c

index 7461cdb7bc349ec3cd638d568f2af1d8752c5d7f..8eda032385a2db9bdde765a3a6b403b368eb2cf1 100644 (file)
@@ -3862,8 +3862,24 @@ static unsigned int hda_set_power_state(struct hda_codec *codec,
 
        /* this delay seems necessary to avoid click noise at power-down */
        if (power_state == AC_PWRST_D3) {
+#ifndef CONFIG_SND_HDA_PLATFORM_NVIDIA_TEGRA
                /* transition time less than 10ms for power down */
                msleep(codec->epss ? 10 : 100);
+#else
+               int pcm, hda_active = 0;
+
+               for (pcm = 0; pcm < codec->num_pcms; pcm++) {
+                       struct hda_pcm *cpcm = &codec->pcm_info[pcm];
+                       if (!cpcm->pcm)
+                               continue;
+                       if (cpcm->pcm->streams[0].substream_opened ||
+                           cpcm->pcm->streams[1].substream_opened) {
+                               hda_active = 1;
+                               break;
+                       }
+               }
+               msleep(codec->epss || !hda_active ? 10 : 100);
+#endif
        }
 
        /* repeat power states setting at most 10 times*/