[alsa-devel] Shutdown() vector in ALSA
why no ALSA driver has shutdown() vector implemented?
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
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 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
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. I know the creative sound cards have a register that one should touch to prevent such a click or thump on poweroff, although I have never actually implemented support for it yet.
James
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
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.
Nobin
On 6/12/07, Takashi Iwai tiwai@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
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@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
If that is the case then i feel it is better to implement shutdown() vector.
On 6/12/07, James Courtier-Dutton James@superbug.co.uk wrote:
Nobin Mathew wrote:
In ubuntu this script mutes all mixer controls.
So there will be no noise (pop/clicks) during shutdown.
That is not always true. Sound cards can still pop/clicks on power down, even with muted mixer controls.
James
At Tue, 12 Jun 2007 16:01:13 +0530, Nobin Mathew wrote:
If that is the case then i feel it is better to implement shutdown() vector.
... and call it in remove, too.
Takashi
On 6/12/07, James Courtier-Dutton James@superbug.co.uk wrote:
Nobin Mathew wrote:
In ubuntu this script mutes all mixer controls.
So there will be no noise (pop/clicks) during shutdown.
That is not always true. Sound cards can still pop/clicks on power down, even with muted mixer controls.
James
participants (3)
-
James Courtier-Dutton
-
Nobin Mathew
-
Takashi Iwai