diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 09:55:49 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:20:19 -0500 |
commit | a381a7a66486f11606eccb8866e29848f995278f (patch) | |
tree | 4fcc2f971a1f0d509939181b91096a600454b0d6 /sound/core/control.c | |
parent | fd66e0d0591dd12eb0bea1e9f3aa194bb93cebbd (diff) |
[ALSA] Decentralize PM control
Modules: ALSA Core,Control Midlevel,/oss/Makefile
Remove the centralized PM control in the sound core.
Each driver is responsible to get callbacks from bus/driver now.
SND_GENERIC_DRIVER is removed together with this action.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 1a14338bd516..03ae9bb7d38e 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -1023,36 +1023,6 @@ static int snd_ctl_subscribe_events(struct snd_ctl_file *file, int __user *ptr) | |||
1023 | return 0; | 1023 | return 0; |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | #ifdef CONFIG_PM | ||
1027 | /* | ||
1028 | * change the power state | ||
1029 | */ | ||
1030 | static int snd_ctl_set_power_state(struct snd_card *card, unsigned int power_state) | ||
1031 | { | ||
1032 | switch (power_state) { | ||
1033 | case SNDRV_CTL_POWER_D0: | ||
1034 | if (card->power_state != power_state) { | ||
1035 | card->pm_resume(card); | ||
1036 | snd_power_change_state(card, power_state); | ||
1037 | } | ||
1038 | break; | ||
1039 | case SNDRV_CTL_POWER_D3hot: | ||
1040 | if (card->power_state != power_state) { | ||
1041 | card->pm_suspend(card, PMSG_SUSPEND); | ||
1042 | snd_power_change_state(card, power_state); | ||
1043 | } | ||
1044 | break; | ||
1045 | case SNDRV_CTL_POWER_D1: | ||
1046 | case SNDRV_CTL_POWER_D2: | ||
1047 | case SNDRV_CTL_POWER_D3cold: | ||
1048 | /* not supported yet */ | ||
1049 | default: | ||
1050 | return -EINVAL; | ||
1051 | } | ||
1052 | return 0; | ||
1053 | } | ||
1054 | #endif | ||
1055 | |||
1056 | static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 1026 | static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
1057 | { | 1027 | { |
1058 | struct snd_ctl_file *ctl; | 1028 | struct snd_ctl_file *ctl; |
@@ -1092,19 +1062,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg | |||
1092 | case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: | 1062 | case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: |
1093 | return snd_ctl_subscribe_events(ctl, ip); | 1063 | return snd_ctl_subscribe_events(ctl, ip); |
1094 | case SNDRV_CTL_IOCTL_POWER: | 1064 | case SNDRV_CTL_IOCTL_POWER: |
1095 | if (get_user(err, ip)) | 1065 | return -ENOPROTOOPT; |
1096 | return -EFAULT; | ||
1097 | if (!capable(CAP_SYS_ADMIN)) | ||
1098 | return -EPERM; | ||
1099 | #ifdef CONFIG_PM | ||
1100 | if (card->pm_suspend && card->pm_resume) { | ||
1101 | snd_power_lock(card); | ||
1102 | err = snd_ctl_set_power_state(card, err); | ||
1103 | snd_power_unlock(card); | ||
1104 | } else | ||
1105 | #endif | ||
1106 | err = -ENOPROTOOPT; | ||
1107 | return err; | ||
1108 | case SNDRV_CTL_IOCTL_POWER_STATE: | 1066 | case SNDRV_CTL_IOCTL_POWER_STATE: |
1109 | #ifdef CONFIG_PM | 1067 | #ifdef CONFIG_PM |
1110 | return put_user(card->power_state, ip) ? -EFAULT : 0; | 1068 | return put_user(card->power_state, ip) ? -EFAULT : 0; |