HDMI-Audio: Fix Spinlock-Recursion and Null-Pointer issues
authorShreyas Neerebailoor <shreyasx.neerebailoor@intel.com>
Fri, 8 Jun 2012 04:39:38 +0000 (10:09 +0530)
committerbuildbot <buildbot@intel.com>
Wed, 13 Jun 2012 11:39:15 +0000 (04:39 -0700)
commit01ec6649d321de4383bcf4aee4ca9aec3510b233
tree9f2d9d9479320f2ee41d83062c78422e65a34ed6
parent5b9952d4e8d39041dd9507683b190ce13c6a9e48
HDMI-Audio: Fix Spinlock-Recursion and Null-Pointer issues

BZ: 21688 37320

Change to prevent Recursive spinlock in trigger.
In middle of start trigger, if HDMI is Pluged-out, the driver
state is disconnected and unplug function calls snd_pcm_stop to
inform the upper layer about disconnection. This internally calls
snd_pcm_stop and stop trigger. Here the lock is recursively
acquired. Solution is to not call snd_pcm_stop if the
substream is active.

Change to prevent Substream NULL during programming buffer.
During successive quick plug and unplug of HDMI cable,
unplug is processed before Start trigger gets to process.
But the trigger state is saved. On unplug the Stop trigger is
called and because it is disconnected it does nothing. Once
cable is plugged in silence is played and the old saved
start trigger causes to retrieve the substream which is NULL
at this point of time. Solution is to clear Trigger state during
unplug. During Plugin inform the upper layer about the event,
if the substream is still active.

HDMI Audio code ported from R2 branch contains Dummy_playback
code. This workaround is no longer needed in R3. (ICS platform)
This patch removes dummy_playback implemtation. Some variables
are renamed for better readability.

Change-Id: I36f4b655316846f8dbf7e0f8935f6a6cff707624
Signed-off-by: Shreyas Neerebailoor <shreyasx.neerebailoor@intel.com>
Reviewed-on: http://android.intel.com:8080/52079
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
Reviewed-by: Agarwal, Vaibhav <vaibhav.agarwal@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>
sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.c
sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio.h
sound/drivers/intel_mid_hdmi/intel_mid_hdmi_audio_if.c