[alsa-devel] [PATCH] ALSA - hda: hdmi flag to stop playback when monitor is disconnected

Yang, Libin libin.yang at intel.com
Wed Nov 11 16:21:13 CET 2015


> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai at suse.de]
> Sent: Wednesday, November 11, 2015 10:58 PM
> To: Yang, Libin
> Cc: libin.yang at linux.intel.com; David Henningsson; alsa-devel at alsa-
> project.org; mengdong.lin at linux.intel.com
> Subject: Re: [PATCH] ALSA - hda: hdmi flag to stop playback when
> monitor is disconnected
> 
> On Wed, 11 Nov 2015 15:53:05 +0100,
> Yang, Libin wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Takashi Iwai [mailto:tiwai at suse.de]
> > > Sent: Wednesday, November 11, 2015 10:42 PM
> > > To: Yang, Libin
> > > Cc: libin.yang at linux.intel.com; David Henningsson; alsa-devel at alsa-
> > > project.org; mengdong.lin at linux.intel.com
> > > Subject: Re: [PATCH] ALSA - hda: hdmi flag to stop playback when
> > > monitor is disconnected
> > >
> > > On Wed, 11 Nov 2015 15:23:42 +0100,
> > > Yang, Libin wrote:
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Takashi Iwai [mailto:tiwai at suse.de]
> > > > > Sent: Wednesday, November 11, 2015 10:13 PM
> > > > > To: libin.yang at linux.intel.com
> > > > > Cc: David Henningsson; alsa-devel at alsa-project.org;
> > > > > mengdong.lin at linux.intel.com; Yang, Libin
> > > > > Subject: Re: [PATCH] ALSA - hda: hdmi flag to stop playback when
> > > > > monitor is disconnected
> > > > >
> > > > > On Wed, 11 Nov 2015 10:02:14 +0100,
> > > > > Takashi Iwai wrote:
> > > > > >
> > > > > > On Wed, 11 Nov 2015 09:39:09 +0100,
> > > > > > libin.yang at linux.intel.com wrote:
> > > > > > >
> > > > > > > From: Libin Yang <libin.yang at linux.intel.com>
> > > > > > >
> > > > > > > Add a flag that user can decide to stop HDMI/DP playback
> when
> > > > > > > the corresponding monitor is disconnected and refuse to open
> > > PCM
> > > > > > > if there is no monitor connected.
> > > > > > >
> > > > > > > Background:
> > > > > > > When a monitor is disconnected and a new monitor is
> connected,
> > > > > > > the parameters of the 2 monitors may be different. Audio
> driver
> > > > > > > need handle this situation.
> > > > > > >
> > > > > > > Besides, stopping playback when monitor is disconnected will
> > > > > > > help to save the power.
> > > > > > >
> > > > > > > Signed-off-by: Libin Yang <libin.yang at linux.intel.com>
> > > > > >
> > > > > > Thanks.  Below are just nitpicking, so let's test this patch at first,
> > > > > > especially to see whether it has any significant influence on PA,
> then
> > > > > > respin with the fixes.
> > > > > >
> > > > > > David, care to check in your side, too?
> > > > >
> > > > > So I tested this with PA 7.1, and it failed, unfortunately.
> > > > > In short:
> > > > > - PA needs the PCM access at probe.  If it gets an error, the device
> > > > >   will be never enumerated again
> > > >
> > > > Thanks for test.
> > > >
> > > > If so, should we re-write the hdmi_pcm_open() and
> > > > generic_hdmi_playback_pcm_prepare() function to make
> > > > the probe works? Or not support dynamic pcm assignment?
> > > >
> > > > > - PA removes the device when it's disconnected.  The PCM stop
> with
> > > > >   DISCONNECT state leads to the device disappearance.
> > > >
> > > > If we can't use DISCONNECT, what else can we use? Or we can't
> > > > stop PCM when monitor is disconnected?
> > >
> > > One obvious options is: we don't care about it.  Maybe care it only
> > > when really needed, e.g. return an error only in prepare and cleanup,
> > > but not in open.
> >
> > Get it. I will refine the patch.
> >
> > So we will not care the disconnect when playback and
> > not stop the PCM?
> >
> > If we don't stop pcm, how to handle connect a different monitor?
> > It seems userspace must handle such scenario.
> 
> Yes.  The driver just wishes that user-space reacts.
> 
> Of course, you can do more complex.  It's only the question about
> user-space interface, so you can actually stop the stream but makes it
> appearing as if a normal error to user-space.  But I don't think it's
> worth to play with.

Get it. Hope gfx is OK for it :)

> 
> 
> Takashi


More information about the Alsa-devel mailing list