Pull sgi-drivers-makefile-cleanup into release branch
[firefly-linux-kernel-4.4.55.git] / sound / pci / ymfpci / ymfpci_main.c
index 62c9f25e8e71d45919ec6a5155bf201545120835..a1aa74b79b3d9c2086aa6acc21df188cbbcf12b9 100644 (file)
@@ -1229,6 +1229,7 @@ static int snd_ymfpci_spdif_default_get(struct snd_kcontrol *kcontrol,
        spin_lock_irq(&chip->reg_lock);
        ucontrol->value.iec958.status[0] = (chip->spdif_bits >> 0) & 0xff;
        ucontrol->value.iec958.status[1] = (chip->spdif_bits >> 8) & 0xff;
+       ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS_48000;
        spin_unlock_irq(&chip->reg_lock);
        return 0;
 }
@@ -1303,6 +1304,7 @@ static int snd_ymfpci_spdif_stream_get(struct snd_kcontrol *kcontrol,
        spin_lock_irq(&chip->reg_lock);
        ucontrol->value.iec958.status[0] = (chip->spdif_pcm_bits >> 0) & 0xff;
        ucontrol->value.iec958.status[1] = (chip->spdif_pcm_bits >> 8) & 0xff;
+       ucontrol->value.iec958.status[3] = IEC958_AES3_CON_FS_48000;
        spin_unlock_irq(&chip->reg_lock);
        return 0;
 }
@@ -2175,11 +2177,13 @@ static int saved_regs_index[] = {
 };
 #define YDSXGR_NUM_SAVED_REGS  ARRAY_SIZE(saved_regs_index)
 
-static int snd_ymfpci_suspend(struct snd_card *card, pm_message_t state)
+int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
 {
-       struct snd_ymfpci *chip = card->pm_private_data;
+       struct snd_card *card = pci_get_drvdata(pci);
+       struct snd_ymfpci *chip = card->private_data;
        unsigned int i;
        
+       snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
        snd_pcm_suspend_all(chip->pcm);
        snd_pcm_suspend_all(chip->pcm2);
        snd_pcm_suspend_all(chip->pcm_spdif);
@@ -2190,18 +2194,21 @@ static int snd_ymfpci_suspend(struct snd_card *card, pm_message_t state)
        chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
        snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
        snd_ymfpci_disable_dsp(chip);
-       pci_disable_device(chip->pci);
+       pci_disable_device(pci);
+       pci_save_state(pci);
        return 0;
 }
 
-static int snd_ymfpci_resume(struct snd_card *card)
+int snd_ymfpci_resume(struct pci_dev *pci)
 {
-       struct snd_ymfpci *chip = card->pm_private_data;
+       struct snd_card *card = pci_get_drvdata(pci);
+       struct snd_ymfpci *chip = card->private_data;
        unsigned int i;
 
-       pci_enable_device(chip->pci);
-       pci_set_master(chip->pci);
-       snd_ymfpci_aclink_reset(chip->pci);
+       pci_restore_state(pci);
+       pci_enable_device(pci);
+       pci_set_master(pci);
+       snd_ymfpci_aclink_reset(pci);
        snd_ymfpci_codec_ready(chip, 0);
        snd_ymfpci_download_image(chip);
        udelay(100);
@@ -2218,6 +2225,7 @@ static int snd_ymfpci_resume(struct snd_card *card)
                chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT);
                spin_unlock_irq(&chip->reg_lock);
        }
+       snd_power_change_state(card, SNDRV_CTL_POWER_D0);
        return 0;
 }
 #endif /* CONFIG_PM */
@@ -2296,7 +2304,6 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
                snd_ymfpci_free(chip);
                return -ENOMEM;
        }
-       snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
 #endif
 
        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {