[alsa-devel] Shutdown() vector in ALSA

Takashi Iwai tiwai at suse.de
Tue Jun 12 12:06:51 CEST 2007


At Tue, 12 Jun 2007 15:27:30 +0530,
Nobin Mathew wrote:
> 
> In ubuntu this script mutes all mixer controls.
> 
> So there will be no noise (pop/clicks) during shutdown.
> 
> since I am writing an ASoC driver, it is better to provide shutdown
> vector which will shutdown the system properly.
> 
> If SIGTERM is handled properly in the application then this is also
> not needed, in this case closing the substream will take care of
> proper shutdown (DAPM)
> 
> But we need to take care of applications which will not handle SIGTERM properly.

Yeah, I understand it would be good for some rare cases.
The patch will be welcome, as usual :)


thanks,

Takashi

> 
> Nobin
> 
> 
> On 6/12/07, Takashi Iwai <tiwai at suse.de> wrote:
> > At Tue, 12 Jun 2007 10:15:56 +0100,
> > James Courtier-Dutton wrote:
> > >
> > > Takashi Iwai wrote:
> > > > At Tue, 12 Jun 2007 14:26:08 +0530,
> > > > Nobin Mathew wrote:
> > > >> why no ALSA driver has shutdown() vector implemented?
> > > >
> > > > Because no hardware required it, so far.
> > > > The shutdown callback is called only when the device is powered off
> > > > while the driver is still active.
> > > >
> > > >> Is this vector needed to ensure the proper shutdown of the system?
> > > >>
> > > >> What all needs to be taken care if i want to implement shutdown(),
> > > >> except hardware shutdown.
> > > >>
> > > >>
> > > >> struct snd_shutdown_f_ops {
> > > >>    struct file_operations f_ops;
> > > >>    struct snd_shutdown_f_ops *next;
> > > >> };
> > > >>
> > > >> what this operations means? defined in sound/core/init.c
> > > >
> > > > This has nothing to do with the driver's shutdown callback.
> > > >
> > > >
> > > >> Is there any need to call these functions?
> > > >> snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
> > > >> for (i = 0; i < chip->pcm_devs; i++)
> > > >>    snd_pcm_suspend_all(chip->pcm[i]);
> > > >
> > > > At shutdown, the user processes will be terminated sooner or later.
> > > > Thus no freezing is necessary at all.
> > > >
> > > > What I may be concerned would be a case like the hardware can be
> > > > damaged by an accidental turn-off, or, some termination is required
> > > > to make the device in a cold state (e.g. otherwise the firwmare won't
> > > > be loaded at the next time).
> > > > In other cases, usually the init script does necessary things at
> > > > shutdown.
> > > >
> > > >
> > > > Takashi
> > >
> > > It might be nice to implement it, purely to help prevent the click or
> > > thump on the speakers at shutdown.
> >
> > It's already done in init script on SUSE distro since long time
> > ago...
> >
> >
> > Takashi
> >
> 


More information about the Alsa-devel mailing list