summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShreyas Neerebailoor <shreyasx.neerebailoor@intel.com>2012-05-18 08:57:35 +0530
committerbuildbot <buildbot@intel.com>2012-06-07 21:22:34 -0700
commit8fcb7d4ab0649bc1a43ae428a7a6bb38416348df (patch)
treef13ddd9f48e3ca4fa10c1a1b7ed1eea5af5d4bc9
parent4e31a1e4b02b8f3ddbd2a984f3945e851ae19bc5 (diff)
downloadkernel-mfld-blackbay-8fcb7d4ab0649bc1a43ae428a7a6bb38416348df.tar.gz
kernel-mfld-blackbay-8fcb7d4ab0649bc1a43ae428a7a6bb38416348df.tar.bz2
kernel-mfld-blackbay-8fcb7d4ab0649bc1a43ae428a7a6bb38416348df.zip
HDMI-Audio: Prevent Suspend if the substream is alive
BZ: 36456 36536 In cases of short and repeated sound clips like alarm, the Stop-Start Triggers may be called in between. On HDMI, if in between Stop and Start trigger, suspend is requested, the device would move to suspend. To prevent this suspend when the clip is still playing, additional check for a valid substream is added. Change-Id: I93ce38d8e27bfbe53568f94114d00b053243bec8 Signed-off-by: Shreyas Neerebailoor <shreyasx.neerebailoor@intel.com> Reviewed-on: http://android.intel.com:8080/51410 Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com> Reviewed-by: Koul, Vinod <vinod.koul@intel.com> Reviewed-by: Gupta, ArvindX K <arvindx.k.gupta@intel.com> Reviewed-by: Hibare, PramodX <pramodx.hibare@intel.com> Tested-by: Hibare, PramodX <pramodx.hibare@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
-rw-r--r--sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.c7
-rw-r--r--sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.c b/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.c
index 8e462cd64ff..1b3943398ee 100644
--- a/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.c
+++ b/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.c
@@ -381,6 +381,12 @@ int snd_intelhad_prog_buffer(struct snd_intelhad *intelhaddata,
struct snd_pcm_substream *substream;
substream = intelhaddata->stream_info.had_substream;
+
+ if (!substream) {
+ pr_err("substream is NULL\n");
+ dump_stack();
+ return 0;
+ }
ring_buf_addr = substream->runtime->dma_addr;
ring_buf_size = snd_pcm_lib_buffer_bytes(substream);
intelhaddata->stream_info.ring_buf_size = ring_buf_size;
@@ -670,6 +676,7 @@ static int snd_intelhad_close(struct snd_pcm_substream *substream)
intelhaddata->stream_info.buffer_rendered = 0;
intelhaddata->stream_info.buffer_ptr = 0;
intelhaddata->stream_info.str_id = 0;
+ intelhaddata->stream_info.had_substream = NULL;
/* Check if following drv_status modification is required - VA */
if (intelhaddata->drv_status != HAD_DRV_DISCONNECTED)
diff --git a/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c b/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c
index f20998f415f..f43831d1b89 100644
--- a/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c
+++ b/sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c
@@ -104,14 +104,16 @@ int hdmi_audio_suspend(void *haddata, hdmi_audio_event_t event)
int caps, retval = 0;
struct had_pvt_data *had_stream;
unsigned long flag_irqs;
+ struct snd_pcm_substream *substream;
struct snd_intelhad *intelhaddata = (struct snd_intelhad *)haddata;
pr_debug("Enter:%s", __func__);
had_stream = intelhaddata->private_data;
+ substream = intelhaddata->stream_info.had_substream;
spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs);
- if (had_stream->stream_status > HAD_RUNNING_SILENCE) {
+ if ((had_stream->stream_status > HAD_RUNNING_SILENCE) || substream) {
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
pr_err("audio stream is active\n");
return -EAGAIN;