return 0;
}
+#ifdef CONFIG_PM
+/*
+ * change the power state
+ */
+static int snd_ctl_set_power_state(snd_card_t *card, unsigned int power_state)
+{
+ switch (power_state) {
+ case SNDRV_CTL_POWER_D0:
+ case SNDRV_CTL_POWER_D1:
+ case SNDRV_CTL_POWER_D2:
+ if (card->power_state != power_state)
+ /* FIXME: pass the correct state value */
+ card->pm_resume(card, 0);
+ break;
+ case SNDRV_CTL_POWER_D3hot:
+ case SNDRV_CTL_POWER_D3cold:
+ if (card->power_state != power_state)
+ /* FIXME: pass the correct state value */
+ card->pm_suspend(card, 0);
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+#endif
+
static int snd_ctl_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
#ifdef CONFIG_PM
- if (card->set_power_state) {
+ if (card->pm_suspend && card->pm_resume) {
snd_power_lock(card);
- err = card->set_power_state(card, err);
+ err = snd_ctl_set_power_state(card, err);
snd_power_unlock(card);
} else
#endif