[alsa-devel] Shutdown() vector in ALSA

Takashi Iwai tiwai at suse.de
Tue Jun 12 11:11:21 CEST 2007


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


More information about the Alsa-devel mailing list