diff options
Diffstat (limited to 'sound/pci')
111 files changed, 870 insertions, 1219 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 50dd0086cfb1..edfc1b8d553e 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -793,6 +793,15 @@ config SND_RME9652 | |||
793 | To compile this driver as a module, choose M here: the module | 793 | To compile this driver as a module, choose M here: the module |
794 | will be called snd-rme9652. | 794 | will be called snd-rme9652. |
795 | 795 | ||
796 | config SND_SE6X | ||
797 | tristate "Studio Evolution SE6X" | ||
798 | depends on SND_OXYGEN=n && SND_VIRTUOSO=n # PCI ID conflict | ||
799 | select SND_OXYGEN_LIB | ||
800 | select SND_PCM | ||
801 | select SND_MPU401_UART | ||
802 | help | ||
803 | Say Y or M here only if you actually have this sound card. | ||
804 | |||
796 | config SND_SIS7019 | 805 | config SND_SIS7019 |
797 | tristate "SiS 7019 Audio Accelerator" | 806 | tristate "SiS 7019 Audio Accelerator" |
798 | depends on X86_32 | 807 | depends on X86_32 |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 1610c38337af..850a8c984c25 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -40,14 +40,13 @@ | |||
40 | #include <linux/compiler.h> | 40 | #include <linux/compiler.h> |
41 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
42 | #include <linux/module.h> | 42 | #include <linux/module.h> |
43 | #include <linux/io.h> | ||
43 | 44 | ||
44 | #include <sound/core.h> | 45 | #include <sound/core.h> |
45 | #include <sound/pcm.h> | 46 | #include <sound/pcm.h> |
46 | #include <sound/initval.h> | 47 | #include <sound/initval.h> |
47 | #include <sound/ac97_codec.h> | 48 | #include <sound/ac97_codec.h> |
48 | 49 | ||
49 | #include <asm/io.h> | ||
50 | |||
51 | #include "ad1889.h" | 50 | #include "ad1889.h" |
52 | #include "ac97/ac97_id.h" | 51 | #include "ac97/ac97_id.h" |
53 | 52 | ||
@@ -623,14 +622,11 @@ snd_ad1889_interrupt(int irq, void *dev_id) | |||
623 | } | 622 | } |
624 | 623 | ||
625 | static int | 624 | static int |
626 | snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, struct snd_pcm **rpcm) | 625 | snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device) |
627 | { | 626 | { |
628 | int err; | 627 | int err; |
629 | struct snd_pcm *pcm; | 628 | struct snd_pcm *pcm; |
630 | 629 | ||
631 | if (rpcm) | ||
632 | *rpcm = NULL; | ||
633 | |||
634 | err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm); | 630 | err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm); |
635 | if (err < 0) | 631 | if (err < 0) |
636 | return err; | 632 | return err; |
@@ -658,9 +654,6 @@ snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, struct snd_pcm **rpcm) | |||
658 | return err; | 654 | return err; |
659 | } | 655 | } |
660 | 656 | ||
661 | if (rpcm) | ||
662 | *rpcm = pcm; | ||
663 | |||
664 | return 0; | 657 | return 0; |
665 | } | 658 | } |
666 | 659 | ||
@@ -859,12 +852,9 @@ snd_ad1889_free(struct snd_ad1889 *chip) | |||
859 | free_irq(chip->irq, chip); | 852 | free_irq(chip->irq, chip); |
860 | 853 | ||
861 | skip_hw: | 854 | skip_hw: |
862 | if (chip->iobase) | 855 | iounmap(chip->iobase); |
863 | iounmap(chip->iobase); | ||
864 | |||
865 | pci_release_regions(chip->pci); | 856 | pci_release_regions(chip->pci); |
866 | pci_disable_device(chip->pci); | 857 | pci_disable_device(chip->pci); |
867 | |||
868 | kfree(chip); | 858 | kfree(chip); |
869 | return 0; | 859 | return 0; |
870 | } | 860 | } |
@@ -1016,7 +1006,7 @@ snd_ad1889_probe(struct pci_dev *pci, | |||
1016 | if (err < 0) | 1006 | if (err < 0) |
1017 | goto free_and_ret; | 1007 | goto free_and_ret; |
1018 | 1008 | ||
1019 | err = snd_ad1889_pcm_init(chip, 0, NULL); | 1009 | err = snd_ad1889_pcm_init(chip, 0); |
1020 | if (err < 0) | 1010 | if (err < 0) |
1021 | goto free_and_ret; | 1011 | goto free_and_ret; |
1022 | 1012 | ||
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index af89e42b2160..c8d499575c01 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -25,7 +25,7 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <asm/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
@@ -1873,7 +1873,6 @@ static int snd_ali_mixer(struct snd_ali *codec) | |||
1873 | #ifdef CONFIG_PM_SLEEP | 1873 | #ifdef CONFIG_PM_SLEEP |
1874 | static int ali_suspend(struct device *dev) | 1874 | static int ali_suspend(struct device *dev) |
1875 | { | 1875 | { |
1876 | struct pci_dev *pci = to_pci_dev(dev); | ||
1877 | struct snd_card *card = dev_get_drvdata(dev); | 1876 | struct snd_card *card = dev_get_drvdata(dev); |
1878 | struct snd_ali *chip = card->private_data; | 1877 | struct snd_ali *chip = card->private_data; |
1879 | struct snd_ali_image *im; | 1878 | struct snd_ali_image *im; |
@@ -1914,16 +1913,11 @@ static int ali_suspend(struct device *dev) | |||
1914 | outl(0xffffffff, ALI_REG(chip, ALI_STOP)); | 1913 | outl(0xffffffff, ALI_REG(chip, ALI_STOP)); |
1915 | 1914 | ||
1916 | spin_unlock_irq(&chip->reg_lock); | 1915 | spin_unlock_irq(&chip->reg_lock); |
1917 | |||
1918 | pci_disable_device(pci); | ||
1919 | pci_save_state(pci); | ||
1920 | pci_set_power_state(pci, PCI_D3hot); | ||
1921 | return 0; | 1916 | return 0; |
1922 | } | 1917 | } |
1923 | 1918 | ||
1924 | static int ali_resume(struct device *dev) | 1919 | static int ali_resume(struct device *dev) |
1925 | { | 1920 | { |
1926 | struct pci_dev *pci = to_pci_dev(dev); | ||
1927 | struct snd_card *card = dev_get_drvdata(dev); | 1921 | struct snd_card *card = dev_get_drvdata(dev); |
1928 | struct snd_ali *chip = card->private_data; | 1922 | struct snd_ali *chip = card->private_data; |
1929 | struct snd_ali_image *im; | 1923 | struct snd_ali_image *im; |
@@ -1933,15 +1927,6 @@ static int ali_resume(struct device *dev) | |||
1933 | if (!im) | 1927 | if (!im) |
1934 | return 0; | 1928 | return 0; |
1935 | 1929 | ||
1936 | pci_set_power_state(pci, PCI_D0); | ||
1937 | pci_restore_state(pci); | ||
1938 | if (pci_enable_device(pci) < 0) { | ||
1939 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1940 | snd_card_disconnect(card); | ||
1941 | return -EIO; | ||
1942 | } | ||
1943 | pci_set_master(pci); | ||
1944 | |||
1945 | spin_lock_irq(&chip->reg_lock); | 1930 | spin_lock_irq(&chip->reg_lock); |
1946 | 1931 | ||
1947 | for (i = 0; i < ALI_CHANNELS; i++) { | 1932 | for (i = 0; i < ALI_CHANNELS; i++) { |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 7bb6ac565107..57e034f208dc 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -37,8 +37,7 @@ | |||
37 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | 40 | #include <linux/io.h> | |
41 | #include <asm/io.h> | ||
42 | 41 | ||
43 | #include <sound/core.h> | 42 | #include <sound/core.h> |
44 | #include <sound/control.h> | 43 | #include <sound/control.h> |
@@ -728,35 +727,20 @@ static int snd_als300_create(struct snd_card *card, | |||
728 | #ifdef CONFIG_PM_SLEEP | 727 | #ifdef CONFIG_PM_SLEEP |
729 | static int snd_als300_suspend(struct device *dev) | 728 | static int snd_als300_suspend(struct device *dev) |
730 | { | 729 | { |
731 | struct pci_dev *pci = to_pci_dev(dev); | ||
732 | struct snd_card *card = dev_get_drvdata(dev); | 730 | struct snd_card *card = dev_get_drvdata(dev); |
733 | struct snd_als300 *chip = card->private_data; | 731 | struct snd_als300 *chip = card->private_data; |
734 | 732 | ||
735 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 733 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
736 | snd_pcm_suspend_all(chip->pcm); | 734 | snd_pcm_suspend_all(chip->pcm); |
737 | snd_ac97_suspend(chip->ac97); | 735 | snd_ac97_suspend(chip->ac97); |
738 | |||
739 | pci_disable_device(pci); | ||
740 | pci_save_state(pci); | ||
741 | pci_set_power_state(pci, PCI_D3hot); | ||
742 | return 0; | 736 | return 0; |
743 | } | 737 | } |
744 | 738 | ||
745 | static int snd_als300_resume(struct device *dev) | 739 | static int snd_als300_resume(struct device *dev) |
746 | { | 740 | { |
747 | struct pci_dev *pci = to_pci_dev(dev); | ||
748 | struct snd_card *card = dev_get_drvdata(dev); | 741 | struct snd_card *card = dev_get_drvdata(dev); |
749 | struct snd_als300 *chip = card->private_data; | 742 | struct snd_als300 *chip = card->private_data; |
750 | 743 | ||
751 | pci_set_power_state(pci, PCI_D0); | ||
752 | pci_restore_state(pci); | ||
753 | if (pci_enable_device(pci) < 0) { | ||
754 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
755 | snd_card_disconnect(card); | ||
756 | return -EIO; | ||
757 | } | ||
758 | pci_set_master(pci); | ||
759 | |||
760 | snd_als300_init(chip); | 744 | snd_als300_init(chip); |
761 | snd_ac97_resume(chip->ac97); | 745 | snd_ac97_resume(chip->ac97); |
762 | 746 | ||
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index d3e6424ee656..a3dea464134d 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -65,7 +65,7 @@ | |||
65 | * - power management? (card can do voice wakeup according to datasheet!!) | 65 | * - power management? (card can do voice wakeup according to datasheet!!) |
66 | */ | 66 | */ |
67 | 67 | ||
68 | #include <asm/io.h> | 68 | #include <linux/io.h> |
69 | #include <linux/init.h> | 69 | #include <linux/init.h> |
70 | #include <linux/pci.h> | 70 | #include <linux/pci.h> |
71 | #include <linux/gameport.h> | 71 | #include <linux/gameport.h> |
@@ -988,7 +988,6 @@ static void snd_card_als4000_remove(struct pci_dev *pci) | |||
988 | #ifdef CONFIG_PM_SLEEP | 988 | #ifdef CONFIG_PM_SLEEP |
989 | static int snd_als4000_suspend(struct device *dev) | 989 | static int snd_als4000_suspend(struct device *dev) |
990 | { | 990 | { |
991 | struct pci_dev *pci = to_pci_dev(dev); | ||
992 | struct snd_card *card = dev_get_drvdata(dev); | 991 | struct snd_card *card = dev_get_drvdata(dev); |
993 | struct snd_card_als4000 *acard = card->private_data; | 992 | struct snd_card_als4000 *acard = card->private_data; |
994 | struct snd_sb *chip = acard->chip; | 993 | struct snd_sb *chip = acard->chip; |
@@ -997,29 +996,15 @@ static int snd_als4000_suspend(struct device *dev) | |||
997 | 996 | ||
998 | snd_pcm_suspend_all(chip->pcm); | 997 | snd_pcm_suspend_all(chip->pcm); |
999 | snd_sbmixer_suspend(chip); | 998 | snd_sbmixer_suspend(chip); |
1000 | |||
1001 | pci_disable_device(pci); | ||
1002 | pci_save_state(pci); | ||
1003 | pci_set_power_state(pci, PCI_D3hot); | ||
1004 | return 0; | 999 | return 0; |
1005 | } | 1000 | } |
1006 | 1001 | ||
1007 | static int snd_als4000_resume(struct device *dev) | 1002 | static int snd_als4000_resume(struct device *dev) |
1008 | { | 1003 | { |
1009 | struct pci_dev *pci = to_pci_dev(dev); | ||
1010 | struct snd_card *card = dev_get_drvdata(dev); | 1004 | struct snd_card *card = dev_get_drvdata(dev); |
1011 | struct snd_card_als4000 *acard = card->private_data; | 1005 | struct snd_card_als4000 *acard = card->private_data; |
1012 | struct snd_sb *chip = acard->chip; | 1006 | struct snd_sb *chip = acard->chip; |
1013 | 1007 | ||
1014 | pci_set_power_state(pci, PCI_D0); | ||
1015 | pci_restore_state(pci); | ||
1016 | if (pci_enable_device(pci) < 0) { | ||
1017 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1018 | snd_card_disconnect(card); | ||
1019 | return -EIO; | ||
1020 | } | ||
1021 | pci_set_master(pci); | ||
1022 | |||
1023 | snd_als4000_configure(chip); | 1008 | snd_als4000_configure(chip); |
1024 | snd_sbdsp_reset(chip); | 1009 | snd_sbdsp_reset(chip); |
1025 | snd_sbmixer_resume(chip); | 1010 | snd_sbmixer_resume(chip); |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index e9273fb2a505..e5cd7be85355 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -540,9 +540,8 @@ static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream * | |||
540 | expiry = HZ / 200; | 540 | expiry = HZ / 200; |
541 | 541 | ||
542 | expiry = max(expiry, 1); /* don't let it be zero! */ | 542 | expiry = max(expiry, 1); /* don't let it be zero! */ |
543 | dpcm->timer.expires = jiffies + expiry; | 543 | mod_timer(&dpcm->timer, jiffies + expiry); |
544 | dpcm->respawn_timer = 1; | 544 | dpcm->respawn_timer = 1; |
545 | add_timer(&dpcm->timer); | ||
546 | } | 545 | } |
547 | 546 | ||
548 | static void snd_card_asihpi_pcm_timer_stop(struct snd_pcm_substream *substream) | 547 | static void snd_card_asihpi_pcm_timer_stop(struct snd_pcm_substream *substream) |
@@ -1064,9 +1063,8 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) | |||
1064 | If internal and other stream playing, can't switch | 1063 | If internal and other stream playing, can't switch |
1065 | */ | 1064 | */ |
1066 | 1065 | ||
1067 | init_timer(&dpcm->timer); | 1066 | setup_timer(&dpcm->timer, snd_card_asihpi_timer_function, |
1068 | dpcm->timer.data = (unsigned long) dpcm; | 1067 | (unsigned long) dpcm); |
1069 | dpcm->timer.function = snd_card_asihpi_timer_function; | ||
1070 | dpcm->substream = substream; | 1068 | dpcm->substream = substream; |
1071 | runtime->private_data = dpcm; | 1069 | runtime->private_data = dpcm; |
1072 | runtime->private_free = snd_card_asihpi_runtime_free; | 1070 | runtime->private_free = snd_card_asihpi_runtime_free; |
@@ -1246,9 +1244,8 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) | |||
1246 | if (err) | 1244 | if (err) |
1247 | return -EIO; | 1245 | return -EIO; |
1248 | 1246 | ||
1249 | init_timer(&dpcm->timer); | 1247 | setup_timer(&dpcm->timer, snd_card_asihpi_timer_function, |
1250 | dpcm->timer.data = (unsigned long) dpcm; | 1248 | (unsigned long) dpcm); |
1251 | dpcm->timer.function = snd_card_asihpi_timer_function; | ||
1252 | dpcm->substream = substream; | 1249 | dpcm->substream = substream; |
1253 | runtime->private_data = dpcm; | 1250 | runtime->private_data = dpcm; |
1254 | runtime->private_free = snd_card_asihpi_runtime_free; | 1251 | runtime->private_free = snd_card_asihpi_runtime_free; |
@@ -2832,14 +2829,11 @@ static int snd_asihpi_hpi_ioctl(struct snd_hwdep *hw, struct file *file, | |||
2832 | /* results in /dev/snd/hwC#D0 file for each card with index # | 2829 | /* results in /dev/snd/hwC#D0 file for each card with index # |
2833 | also /proc/asound/hwdep will contain '#-00: asihpi (HPI) for each card' | 2830 | also /proc/asound/hwdep will contain '#-00: asihpi (HPI) for each card' |
2834 | */ | 2831 | */ |
2835 | static int snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi, | 2832 | static int snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi, int device) |
2836 | int device, struct snd_hwdep **rhwdep) | ||
2837 | { | 2833 | { |
2838 | struct snd_hwdep *hw; | 2834 | struct snd_hwdep *hw; |
2839 | int err; | 2835 | int err; |
2840 | 2836 | ||
2841 | if (rhwdep) | ||
2842 | *rhwdep = NULL; | ||
2843 | err = snd_hwdep_new(asihpi->card, "HPI", device, &hw); | 2837 | err = snd_hwdep_new(asihpi->card, "HPI", device, &hw); |
2844 | if (err < 0) | 2838 | if (err < 0) |
2845 | return err; | 2839 | return err; |
@@ -2849,8 +2843,6 @@ static int snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi, | |||
2849 | hw->ops.ioctl = snd_asihpi_hpi_ioctl; | 2843 | hw->ops.ioctl = snd_asihpi_hpi_ioctl; |
2850 | hw->ops.release = snd_asihpi_hpi_release; | 2844 | hw->ops.release = snd_asihpi_hpi_release; |
2851 | hw->private_data = asihpi; | 2845 | hw->private_data = asihpi; |
2852 | if (rhwdep) | ||
2853 | *rhwdep = hw; | ||
2854 | return 0; | 2846 | return 0; |
2855 | } | 2847 | } |
2856 | 2848 | ||
@@ -2993,7 +2985,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev, | |||
2993 | 2985 | ||
2994 | /* always create, can be enabled or disabled dynamically | 2986 | /* always create, can be enabled or disabled dynamically |
2995 | by enable_hwdep module param*/ | 2987 | by enable_hwdep module param*/ |
2996 | snd_asihpi_hpi_new(asihpi, 0, NULL); | 2988 | snd_asihpi_hpi_new(asihpi, 0); |
2997 | 2989 | ||
2998 | strcpy(card->driver, "ASIHPI"); | 2990 | strcpy(card->driver, "ASIHPI"); |
2999 | 2991 | ||
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index 2414d7a2239d..2d6364825d4d 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* operational/messaging errors */ | 48 | /* operational/messaging errors */ |
49 | #define HPI6000_ERROR_MSG_RESP_IDLE_TIMEOUT 901 | 49 | #define HPI6000_ERROR_MSG_RESP_IDLE_TIMEOUT 901 |
50 | 50 | #define HPI6000_ERROR_RESP_GET_LEN 902 | |
51 | #define HPI6000_ERROR_MSG_RESP_GET_RESP_ACK 903 | 51 | #define HPI6000_ERROR_MSG_RESP_GET_RESP_ACK 903 |
52 | #define HPI6000_ERROR_MSG_GET_ADR 904 | 52 | #define HPI6000_ERROR_MSG_GET_ADR 904 |
53 | #define HPI6000_ERROR_RESP_GET_ADR 905 | 53 | #define HPI6000_ERROR_RESP_GET_ADR 905 |
@@ -1365,7 +1365,10 @@ static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, | |||
1365 | length = hpi_read_word(pdo, HPI_HIF_ADDR(length)); | 1365 | length = hpi_read_word(pdo, HPI_HIF_ADDR(length)); |
1366 | } while (hpi6000_check_PCI2040_error_flag(pao, H6READ) && --timeout); | 1366 | } while (hpi6000_check_PCI2040_error_flag(pao, H6READ) && --timeout); |
1367 | if (!timeout) | 1367 | if (!timeout) |
1368 | length = sizeof(struct hpi_response); | 1368 | return HPI6000_ERROR_RESP_GET_LEN; |
1369 | |||
1370 | if (length > phr->size) | ||
1371 | return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL; | ||
1369 | 1372 | ||
1370 | /* get the response */ | 1373 | /* get the response */ |
1371 | p_data = (u32 *)phr; | 1374 | p_data = (u32 *)phr; |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 6aa677e60555..6610bd096fc9 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/moduleparam.h> | 30 | #include <linux/moduleparam.h> |
31 | #include <asm/uaccess.h> | 31 | #include <linux/uaccess.h> |
32 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
33 | #include <linux/stringify.h> | 33 | #include <linux/stringify.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
@@ -153,6 +153,8 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
153 | goto out; | 153 | goto out; |
154 | } | 154 | } |
155 | 155 | ||
156 | res_max_size = min_t(size_t, res_max_size, sizeof(*hr)); | ||
157 | |||
156 | switch (hm->h.function) { | 158 | switch (hm->h.function) { |
157 | case HPI_SUBSYS_CREATE_ADAPTER: | 159 | case HPI_SUBSYS_CREATE_ADAPTER: |
158 | case HPI_ADAPTER_DELETE: | 160 | case HPI_ADAPTER_DELETE: |
@@ -539,10 +541,8 @@ void asihpi_adapter_remove(struct pci_dev *pci_dev) | |||
539 | hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); | 541 | hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); |
540 | 542 | ||
541 | /* unmap PCI memory space, mapped during device init. */ | 543 | /* unmap PCI memory space, mapped during device init. */ |
542 | for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { | 544 | for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; ++idx) |
543 | if (pci.ap_mem_base[idx]) | 545 | iounmap(pci.ap_mem_base[idx]); |
544 | iounmap(pci.ap_mem_base[idx]); | ||
545 | } | ||
546 | 546 | ||
547 | if (pa->irq) | 547 | if (pa->irq) |
548 | free_irq(pa->irq, pa); | 548 | free_irq(pa->irq, pa); |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 9c1c4452a8ee..d5f15c9bbeda 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -1474,7 +1474,6 @@ static int snd_atiixp_mixer_new(struct atiixp *chip, int clock, | |||
1474 | */ | 1474 | */ |
1475 | static int snd_atiixp_suspend(struct device *dev) | 1475 | static int snd_atiixp_suspend(struct device *dev) |
1476 | { | 1476 | { |
1477 | struct pci_dev *pci = to_pci_dev(dev); | ||
1478 | struct snd_card *card = dev_get_drvdata(dev); | 1477 | struct snd_card *card = dev_get_drvdata(dev); |
1479 | struct atiixp *chip = card->private_data; | 1478 | struct atiixp *chip = card->private_data; |
1480 | int i; | 1479 | int i; |
@@ -1492,29 +1491,15 @@ static int snd_atiixp_suspend(struct device *dev) | |||
1492 | snd_ac97_suspend(chip->ac97[i]); | 1491 | snd_ac97_suspend(chip->ac97[i]); |
1493 | snd_atiixp_aclink_down(chip); | 1492 | snd_atiixp_aclink_down(chip); |
1494 | snd_atiixp_chip_stop(chip); | 1493 | snd_atiixp_chip_stop(chip); |
1495 | |||
1496 | pci_disable_device(pci); | ||
1497 | pci_save_state(pci); | ||
1498 | pci_set_power_state(pci, PCI_D3hot); | ||
1499 | return 0; | 1494 | return 0; |
1500 | } | 1495 | } |
1501 | 1496 | ||
1502 | static int snd_atiixp_resume(struct device *dev) | 1497 | static int snd_atiixp_resume(struct device *dev) |
1503 | { | 1498 | { |
1504 | struct pci_dev *pci = to_pci_dev(dev); | ||
1505 | struct snd_card *card = dev_get_drvdata(dev); | 1499 | struct snd_card *card = dev_get_drvdata(dev); |
1506 | struct atiixp *chip = card->private_data; | 1500 | struct atiixp *chip = card->private_data; |
1507 | int i; | 1501 | int i; |
1508 | 1502 | ||
1509 | pci_set_power_state(pci, PCI_D0); | ||
1510 | pci_restore_state(pci); | ||
1511 | if (pci_enable_device(pci) < 0) { | ||
1512 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1513 | snd_card_disconnect(card); | ||
1514 | return -EIO; | ||
1515 | } | ||
1516 | pci_set_master(pci); | ||
1517 | |||
1518 | snd_atiixp_aclink_reset(chip); | 1503 | snd_atiixp_aclink_reset(chip); |
1519 | snd_atiixp_chip_start(chip); | 1504 | snd_atiixp_chip_start(chip); |
1520 | 1505 | ||
@@ -1585,8 +1570,7 @@ static int snd_atiixp_free(struct atiixp *chip) | |||
1585 | __hw_end: | 1570 | __hw_end: |
1586 | if (chip->irq >= 0) | 1571 | if (chip->irq >= 0) |
1587 | free_irq(chip->irq, chip); | 1572 | free_irq(chip->irq, chip); |
1588 | if (chip->remap_addr) | 1573 | iounmap(chip->remap_addr); |
1589 | iounmap(chip->remap_addr); | ||
1590 | pci_release_regions(chip->pci); | 1574 | pci_release_regions(chip->pci); |
1591 | pci_disable_device(chip->pci); | 1575 | pci_disable_device(chip->pci); |
1592 | kfree(chip); | 1576 | kfree(chip); |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index b2f63e0727de..0a38e08164ab 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -1120,7 +1120,6 @@ static int snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock) | |||
1120 | */ | 1120 | */ |
1121 | static int snd_atiixp_suspend(struct device *dev) | 1121 | static int snd_atiixp_suspend(struct device *dev) |
1122 | { | 1122 | { |
1123 | struct pci_dev *pci = to_pci_dev(dev); | ||
1124 | struct snd_card *card = dev_get_drvdata(dev); | 1123 | struct snd_card *card = dev_get_drvdata(dev); |
1125 | struct atiixp_modem *chip = card->private_data; | 1124 | struct atiixp_modem *chip = card->private_data; |
1126 | int i; | 1125 | int i; |
@@ -1132,29 +1131,15 @@ static int snd_atiixp_suspend(struct device *dev) | |||
1132 | snd_ac97_suspend(chip->ac97[i]); | 1131 | snd_ac97_suspend(chip->ac97[i]); |
1133 | snd_atiixp_aclink_down(chip); | 1132 | snd_atiixp_aclink_down(chip); |
1134 | snd_atiixp_chip_stop(chip); | 1133 | snd_atiixp_chip_stop(chip); |
1135 | |||
1136 | pci_disable_device(pci); | ||
1137 | pci_save_state(pci); | ||
1138 | pci_set_power_state(pci, PCI_D3hot); | ||
1139 | return 0; | 1134 | return 0; |
1140 | } | 1135 | } |
1141 | 1136 | ||
1142 | static int snd_atiixp_resume(struct device *dev) | 1137 | static int snd_atiixp_resume(struct device *dev) |
1143 | { | 1138 | { |
1144 | struct pci_dev *pci = to_pci_dev(dev); | ||
1145 | struct snd_card *card = dev_get_drvdata(dev); | 1139 | struct snd_card *card = dev_get_drvdata(dev); |
1146 | struct atiixp_modem *chip = card->private_data; | 1140 | struct atiixp_modem *chip = card->private_data; |
1147 | int i; | 1141 | int i; |
1148 | 1142 | ||
1149 | pci_set_power_state(pci, PCI_D0); | ||
1150 | pci_restore_state(pci); | ||
1151 | if (pci_enable_device(pci) < 0) { | ||
1152 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1153 | snd_card_disconnect(card); | ||
1154 | return -EIO; | ||
1155 | } | ||
1156 | pci_set_master(pci); | ||
1157 | |||
1158 | snd_atiixp_aclink_reset(chip); | 1143 | snd_atiixp_aclink_reset(chip); |
1159 | snd_atiixp_chip_start(chip); | 1144 | snd_atiixp_chip_start(chip); |
1160 | 1145 | ||
@@ -1211,8 +1196,7 @@ static int snd_atiixp_free(struct atiixp_modem *chip) | |||
1211 | __hw_end: | 1196 | __hw_end: |
1212 | if (chip->irq >= 0) | 1197 | if (chip->irq >= 0) |
1213 | free_irq(chip->irq, chip); | 1198 | free_irq(chip->irq, chip); |
1214 | if (chip->remap_addr) | 1199 | iounmap(chip->remap_addr); |
1215 | iounmap(chip->remap_addr); | ||
1216 | pci_release_regions(chip->pci); | 1200 | pci_release_regions(chip->pci); |
1217 | pci_disable_device(chip->pci); | 1201 | pci_disable_device(chip->pci); |
1218 | kfree(chip); | 1202 | kfree(chip); |
diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h index 3a8fefefea77..bcc648bf6478 100644 --- a/sound/pci/au88x0/au88x0.h +++ b/sound/pci/au88x0/au88x0.h | |||
@@ -17,9 +17,8 @@ | |||
17 | #ifndef __SOUND_AU88X0_H | 17 | #ifndef __SOUND_AU88X0_H |
18 | #define __SOUND_AU88X0_H | 18 | #define __SOUND_AU88X0_H |
19 | 19 | ||
20 | #ifdef __KERNEL__ | ||
21 | #include <linux/pci.h> | 20 | #include <linux/pci.h> |
22 | #include <asm/io.h> | 21 | #include <linux/io.h> |
23 | #include <sound/core.h> | 22 | #include <sound/core.h> |
24 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
25 | #include <sound/rawmidi.h> | 24 | #include <sound/rawmidi.h> |
@@ -27,7 +26,6 @@ | |||
27 | #include <sound/hwdep.h> | 26 | #include <sound/hwdep.h> |
28 | #include <sound/ac97_codec.h> | 27 | #include <sound/ac97_codec.h> |
29 | #include <sound/tlv.h> | 28 | #include <sound/tlv.h> |
30 | #endif | ||
31 | 29 | ||
32 | #ifndef CHIP_AU8820 | 30 | #ifndef CHIP_AU8820 |
33 | #include "au88x0_eq.h" | 31 | #include "au88x0_eq.h" |
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index e1cf01949fda..8d2fee7b33bd 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c | |||
@@ -229,9 +229,7 @@ static int snd_aw2_dev_free(struct snd_device *device) | |||
229 | if (chip->irq >= 0) | 229 | if (chip->irq >= 0) |
230 | free_irq(chip->irq, (void *)chip); | 230 | free_irq(chip->irq, (void *)chip); |
231 | /* release the i/o ports & memory */ | 231 | /* release the i/o ports & memory */ |
232 | if (chip->iobase_virt) | 232 | iounmap(chip->iobase_virt); |
233 | iounmap(chip->iobase_virt); | ||
234 | |||
235 | pci_release_regions(chip->pci); | 233 | pci_release_regions(chip->pci); |
236 | /* disable the PCI entry */ | 234 | /* disable the PCI entry */ |
237 | pci_disable_device(chip->pci); | 235 | pci_disable_device(chip->pci); |
diff --git a/sound/pci/aw2/aw2-saa7146.c b/sound/pci/aw2/aw2-saa7146.c index 6d24e9536777..1d7890459334 100644 --- a/sound/pci/aw2/aw2-saa7146.c +++ b/sound/pci/aw2/aw2-saa7146.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <asm/io.h> | 30 | #include <linux/io.h> |
31 | #include <sound/core.h> | 31 | #include <sound/core.h> |
32 | #include <sound/initval.h> | 32 | #include <sound/initval.h> |
33 | #include <sound/pcm.h> | 33 | #include <sound/pcm.h> |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index fdbb9c05c77b..a40a2b4c8fd7 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -179,7 +179,7 @@ | |||
179 | * - use MMIO (memory-mapped I/O)? Slightly faster access, e.g. for gameport. | 179 | * - use MMIO (memory-mapped I/O)? Slightly faster access, e.g. for gameport. |
180 | */ | 180 | */ |
181 | 181 | ||
182 | #include <asm/io.h> | 182 | #include <linux/io.h> |
183 | #include <linux/init.h> | 183 | #include <linux/init.h> |
184 | #include <linux/bug.h> /* WARN_ONCE */ | 184 | #include <linux/bug.h> /* WARN_ONCE */ |
185 | #include <linux/pci.h> | 185 | #include <linux/pci.h> |
@@ -2694,7 +2694,6 @@ snd_azf3328_resume_ac97(const struct snd_azf3328 *chip) | |||
2694 | static int | 2694 | static int |
2695 | snd_azf3328_suspend(struct device *dev) | 2695 | snd_azf3328_suspend(struct device *dev) |
2696 | { | 2696 | { |
2697 | struct pci_dev *pci = to_pci_dev(dev); | ||
2698 | struct snd_card *card = dev_get_drvdata(dev); | 2697 | struct snd_card *card = dev_get_drvdata(dev); |
2699 | struct snd_azf3328 *chip = card->private_data; | 2698 | struct snd_azf3328 *chip = card->private_data; |
2700 | u16 *saved_regs_ctrl_u16; | 2699 | u16 *saved_regs_ctrl_u16; |
@@ -2720,29 +2719,15 @@ snd_azf3328_suspend(struct device *dev) | |||
2720 | ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu); | 2719 | ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu); |
2721 | snd_azf3328_suspend_regs(chip, chip->opl3_io, | 2720 | snd_azf3328_suspend_regs(chip, chip->opl3_io, |
2722 | ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3); | 2721 | ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3); |
2723 | |||
2724 | pci_disable_device(pci); | ||
2725 | pci_save_state(pci); | ||
2726 | pci_set_power_state(pci, PCI_D3hot); | ||
2727 | return 0; | 2722 | return 0; |
2728 | } | 2723 | } |
2729 | 2724 | ||
2730 | static int | 2725 | static int |
2731 | snd_azf3328_resume(struct device *dev) | 2726 | snd_azf3328_resume(struct device *dev) |
2732 | { | 2727 | { |
2733 | struct pci_dev *pci = to_pci_dev(dev); | ||
2734 | struct snd_card *card = dev_get_drvdata(dev); | 2728 | struct snd_card *card = dev_get_drvdata(dev); |
2735 | const struct snd_azf3328 *chip = card->private_data; | 2729 | const struct snd_azf3328 *chip = card->private_data; |
2736 | 2730 | ||
2737 | pci_set_power_state(pci, PCI_D0); | ||
2738 | pci_restore_state(pci); | ||
2739 | if (pci_enable_device(pci) < 0) { | ||
2740 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2741 | snd_card_disconnect(card); | ||
2742 | return -EIO; | ||
2743 | } | ||
2744 | pci_set_master(pci); | ||
2745 | |||
2746 | snd_azf3328_resume_regs(chip, chip->saved_regs_game, chip->game_io, | 2731 | snd_azf3328_resume_regs(chip, chip->saved_regs_game, chip->game_io, |
2747 | ARRAY_SIZE(chip->saved_regs_game)); | 2732 | ARRAY_SIZE(chip->saved_regs_game)); |
2748 | snd_azf3328_resume_regs(chip, chip->saved_regs_mpu, chip->mpu_io, | 2733 | snd_azf3328_resume_regs(chip, chip->saved_regs_mpu, chip->mpu_io, |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 058b9973c09c..5925b7170e25 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/bitops.h> | 29 | #include <linux/bitops.h> |
30 | #include <asm/io.h> | 30 | #include <linux/io.h> |
31 | #include <sound/core.h> | 31 | #include <sound/core.h> |
32 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
33 | #include <sound/pcm_params.h> | 33 | #include <sound/pcm_params.h> |
@@ -690,8 +690,7 @@ static int snd_bt87x_free(struct snd_bt87x *chip) | |||
690 | snd_bt87x_stop(chip); | 690 | snd_bt87x_stop(chip); |
691 | if (chip->irq >= 0) | 691 | if (chip->irq >= 0) |
692 | free_irq(chip->irq, chip); | 692 | free_irq(chip->irq, chip); |
693 | if (chip->mmio) | 693 | iounmap(chip->mmio); |
694 | iounmap(chip->mmio); | ||
695 | pci_release_regions(chip->pci); | 694 | pci_release_regions(chip->pci); |
696 | pci_disable_device(chip->pci); | 695 | pci_disable_device(chip->pci); |
697 | kfree(chip); | 696 | kfree(chip); |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 96af33965b51..dd75b7536fa2 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -1910,7 +1910,6 @@ static void snd_ca0106_remove(struct pci_dev *pci) | |||
1910 | #ifdef CONFIG_PM_SLEEP | 1910 | #ifdef CONFIG_PM_SLEEP |
1911 | static int snd_ca0106_suspend(struct device *dev) | 1911 | static int snd_ca0106_suspend(struct device *dev) |
1912 | { | 1912 | { |
1913 | struct pci_dev *pci = to_pci_dev(dev); | ||
1914 | struct snd_card *card = dev_get_drvdata(dev); | 1913 | struct snd_card *card = dev_get_drvdata(dev); |
1915 | struct snd_ca0106 *chip = card->private_data; | 1914 | struct snd_ca0106 *chip = card->private_data; |
1916 | int i; | 1915 | int i; |
@@ -1923,30 +1922,15 @@ static int snd_ca0106_suspend(struct device *dev) | |||
1923 | snd_ca0106_mixer_suspend(chip); | 1922 | snd_ca0106_mixer_suspend(chip); |
1924 | 1923 | ||
1925 | ca0106_stop_chip(chip); | 1924 | ca0106_stop_chip(chip); |
1926 | |||
1927 | pci_disable_device(pci); | ||
1928 | pci_save_state(pci); | ||
1929 | pci_set_power_state(pci, PCI_D3hot); | ||
1930 | return 0; | 1925 | return 0; |
1931 | } | 1926 | } |
1932 | 1927 | ||
1933 | static int snd_ca0106_resume(struct device *dev) | 1928 | static int snd_ca0106_resume(struct device *dev) |
1934 | { | 1929 | { |
1935 | struct pci_dev *pci = to_pci_dev(dev); | ||
1936 | struct snd_card *card = dev_get_drvdata(dev); | 1930 | struct snd_card *card = dev_get_drvdata(dev); |
1937 | struct snd_ca0106 *chip = card->private_data; | 1931 | struct snd_ca0106 *chip = card->private_data; |
1938 | int i; | 1932 | int i; |
1939 | 1933 | ||
1940 | pci_set_power_state(pci, PCI_D0); | ||
1941 | pci_restore_state(pci); | ||
1942 | |||
1943 | if (pci_enable_device(pci) < 0) { | ||
1944 | snd_card_disconnect(card); | ||
1945 | return -EIO; | ||
1946 | } | ||
1947 | |||
1948 | pci_set_master(pci); | ||
1949 | |||
1950 | ca0106_init_chip(chip, 1); | 1934 | ca0106_init_chip(chip, 1); |
1951 | 1935 | ||
1952 | if (chip->details->ac97) | 1936 | if (chip->details->ac97) |
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c index 68c0eb0a2807..025805cba779 100644 --- a/sound/pci/ca0106/ca0106_mixer.c +++ b/sound/pci/ca0106/ca0106_mixer.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #include <sound/ac97_codec.h> | 70 | #include <sound/ac97_codec.h> |
71 | #include <sound/info.h> | 71 | #include <sound/info.h> |
72 | #include <sound/tlv.h> | 72 | #include <sound/tlv.h> |
73 | #include <asm/io.h> | 73 | #include <linux/io.h> |
74 | 74 | ||
75 | #include "ca0106.h" | 75 | #include "ca0106.h" |
76 | 76 | ||
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index 4f9c2821bb31..2c5c28adbefd 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c | |||
@@ -64,13 +64,13 @@ | |||
64 | #include <linux/init.h> | 64 | #include <linux/init.h> |
65 | #include <linux/interrupt.h> | 65 | #include <linux/interrupt.h> |
66 | #include <linux/moduleparam.h> | 66 | #include <linux/moduleparam.h> |
67 | #include <linux/io.h> | ||
67 | #include <sound/core.h> | 68 | #include <sound/core.h> |
68 | #include <sound/initval.h> | 69 | #include <sound/initval.h> |
69 | #include <sound/pcm.h> | 70 | #include <sound/pcm.h> |
70 | #include <sound/ac97_codec.h> | 71 | #include <sound/ac97_codec.h> |
71 | #include <sound/info.h> | 72 | #include <sound/info.h> |
72 | #include <sound/asoundef.h> | 73 | #include <sound/asoundef.h> |
73 | #include <asm/io.h> | ||
74 | 74 | ||
75 | #include "ca0106.h" | 75 | #include "ca0106.h" |
76 | 76 | ||
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 85ed40339db9..1d0f2cad2f5a 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -20,7 +20,7 @@ | |||
20 | /* Does not work. Warning may block system in capture mode */ | 20 | /* Does not work. Warning may block system in capture mode */ |
21 | /* #define USE_VAR48KRATE */ | 21 | /* #define USE_VAR48KRATE */ |
22 | 22 | ||
23 | #include <asm/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
@@ -3347,7 +3347,6 @@ static unsigned char saved_mixers[] = { | |||
3347 | 3347 | ||
3348 | static int snd_cmipci_suspend(struct device *dev) | 3348 | static int snd_cmipci_suspend(struct device *dev) |
3349 | { | 3349 | { |
3350 | struct pci_dev *pci = to_pci_dev(dev); | ||
3351 | struct snd_card *card = dev_get_drvdata(dev); | 3350 | struct snd_card *card = dev_get_drvdata(dev); |
3352 | struct cmipci *cm = card->private_data; | 3351 | struct cmipci *cm = card->private_data; |
3353 | int i; | 3352 | int i; |
@@ -3366,29 +3365,15 @@ static int snd_cmipci_suspend(struct device *dev) | |||
3366 | 3365 | ||
3367 | /* disable ints */ | 3366 | /* disable ints */ |
3368 | snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); | 3367 | snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); |
3369 | |||
3370 | pci_disable_device(pci); | ||
3371 | pci_save_state(pci); | ||
3372 | pci_set_power_state(pci, PCI_D3hot); | ||
3373 | return 0; | 3368 | return 0; |
3374 | } | 3369 | } |
3375 | 3370 | ||
3376 | static int snd_cmipci_resume(struct device *dev) | 3371 | static int snd_cmipci_resume(struct device *dev) |
3377 | { | 3372 | { |
3378 | struct pci_dev *pci = to_pci_dev(dev); | ||
3379 | struct snd_card *card = dev_get_drvdata(dev); | 3373 | struct snd_card *card = dev_get_drvdata(dev); |
3380 | struct cmipci *cm = card->private_data; | 3374 | struct cmipci *cm = card->private_data; |
3381 | int i; | 3375 | int i; |
3382 | 3376 | ||
3383 | pci_set_power_state(pci, PCI_D0); | ||
3384 | pci_restore_state(pci); | ||
3385 | if (pci_enable_device(pci) < 0) { | ||
3386 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
3387 | snd_card_disconnect(card); | ||
3388 | return -EIO; | ||
3389 | } | ||
3390 | pci_set_master(pci); | ||
3391 | |||
3392 | /* reset / initialize to a sane state */ | 3377 | /* reset / initialize to a sane state */ |
3393 | snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); | 3378 | snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); |
3394 | snd_cmipci_ch_reset(cm, CM_CH_PLAY); | 3379 | snd_cmipci_ch_reset(cm, CM_CH_PLAY); |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 4c49b5c8a7b3..c296fd0dbc9c 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -973,14 +973,11 @@ static struct snd_pcm_ops snd_cs4281_capture_ops = { | |||
973 | .pointer = snd_cs4281_pointer, | 973 | .pointer = snd_cs4281_pointer, |
974 | }; | 974 | }; |
975 | 975 | ||
976 | static int snd_cs4281_pcm(struct cs4281 *chip, int device, | 976 | static int snd_cs4281_pcm(struct cs4281 *chip, int device) |
977 | struct snd_pcm **rpcm) | ||
978 | { | 977 | { |
979 | struct snd_pcm *pcm; | 978 | struct snd_pcm *pcm; |
980 | int err; | 979 | int err; |
981 | 980 | ||
982 | if (rpcm) | ||
983 | *rpcm = NULL; | ||
984 | err = snd_pcm_new(chip->card, "CS4281", device, 1, 1, &pcm); | 981 | err = snd_pcm_new(chip->card, "CS4281", device, 1, 1, &pcm); |
985 | if (err < 0) | 982 | if (err < 0) |
986 | return err; | 983 | return err; |
@@ -996,8 +993,6 @@ static int snd_cs4281_pcm(struct cs4281 *chip, int device, | |||
996 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 993 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
997 | snd_dma_pci_data(chip->pci), 64*1024, 512*1024); | 994 | snd_dma_pci_data(chip->pci), 64*1024, 512*1024); |
998 | 995 | ||
999 | if (rpcm) | ||
1000 | *rpcm = pcm; | ||
1001 | return 0; | 996 | return 0; |
1002 | } | 997 | } |
1003 | 998 | ||
@@ -1321,10 +1316,8 @@ static int snd_cs4281_free(struct cs4281 *chip) | |||
1321 | 1316 | ||
1322 | if (chip->irq >= 0) | 1317 | if (chip->irq >= 0) |
1323 | free_irq(chip->irq, chip); | 1318 | free_irq(chip->irq, chip); |
1324 | if (chip->ba0) | 1319 | iounmap(chip->ba0); |
1325 | iounmap(chip->ba0); | 1320 | iounmap(chip->ba1); |
1326 | if (chip->ba1) | ||
1327 | iounmap(chip->ba1); | ||
1328 | pci_release_regions(chip->pci); | 1321 | pci_release_regions(chip->pci); |
1329 | pci_disable_device(chip->pci); | 1322 | pci_disable_device(chip->pci); |
1330 | 1323 | ||
@@ -1788,14 +1781,11 @@ static struct snd_rawmidi_ops snd_cs4281_midi_input = | |||
1788 | .trigger = snd_cs4281_midi_input_trigger, | 1781 | .trigger = snd_cs4281_midi_input_trigger, |
1789 | }; | 1782 | }; |
1790 | 1783 | ||
1791 | static int snd_cs4281_midi(struct cs4281 *chip, int device, | 1784 | static int snd_cs4281_midi(struct cs4281 *chip, int device) |
1792 | struct snd_rawmidi **rrawmidi) | ||
1793 | { | 1785 | { |
1794 | struct snd_rawmidi *rmidi; | 1786 | struct snd_rawmidi *rmidi; |
1795 | int err; | 1787 | int err; |
1796 | 1788 | ||
1797 | if (rrawmidi) | ||
1798 | *rrawmidi = NULL; | ||
1799 | if ((err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi)) < 0) | 1789 | if ((err = snd_rawmidi_new(chip->card, "CS4281", device, 1, 1, &rmidi)) < 0) |
1800 | return err; | 1790 | return err; |
1801 | strcpy(rmidi->name, "CS4281"); | 1791 | strcpy(rmidi->name, "CS4281"); |
@@ -1804,8 +1794,6 @@ static int snd_cs4281_midi(struct cs4281 *chip, int device, | |||
1804 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; | 1794 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; |
1805 | rmidi->private_data = chip; | 1795 | rmidi->private_data = chip; |
1806 | chip->rmidi = rmidi; | 1796 | chip->rmidi = rmidi; |
1807 | if (rrawmidi) | ||
1808 | *rrawmidi = rmidi; | ||
1809 | return 0; | 1797 | return 0; |
1810 | } | 1798 | } |
1811 | 1799 | ||
@@ -1941,11 +1929,11 @@ static int snd_cs4281_probe(struct pci_dev *pci, | |||
1941 | snd_card_free(card); | 1929 | snd_card_free(card); |
1942 | return err; | 1930 | return err; |
1943 | } | 1931 | } |
1944 | if ((err = snd_cs4281_pcm(chip, 0, NULL)) < 0) { | 1932 | if ((err = snd_cs4281_pcm(chip, 0)) < 0) { |
1945 | snd_card_free(card); | 1933 | snd_card_free(card); |
1946 | return err; | 1934 | return err; |
1947 | } | 1935 | } |
1948 | if ((err = snd_cs4281_midi(chip, 0, NULL)) < 0) { | 1936 | if ((err = snd_cs4281_midi(chip, 0)) < 0) { |
1949 | snd_card_free(card); | 1937 | snd_card_free(card); |
1950 | return err; | 1938 | return err; |
1951 | } | 1939 | } |
@@ -2008,7 +1996,6 @@ static int saved_regs[SUSPEND_REGISTERS] = { | |||
2008 | 1996 | ||
2009 | static int cs4281_suspend(struct device *dev) | 1997 | static int cs4281_suspend(struct device *dev) |
2010 | { | 1998 | { |
2011 | struct pci_dev *pci = to_pci_dev(dev); | ||
2012 | struct snd_card *card = dev_get_drvdata(dev); | 1999 | struct snd_card *card = dev_get_drvdata(dev); |
2013 | struct cs4281 *chip = card->private_data; | 2000 | struct cs4281 *chip = card->private_data; |
2014 | u32 ulCLK; | 2001 | u32 ulCLK; |
@@ -2047,30 +2034,16 @@ static int cs4281_suspend(struct device *dev) | |||
2047 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); | 2034 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); |
2048 | ulCLK &= ~CLKCR1_CKRA; | 2035 | ulCLK &= ~CLKCR1_CKRA; |
2049 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); | 2036 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); |
2050 | |||
2051 | pci_disable_device(pci); | ||
2052 | pci_save_state(pci); | ||
2053 | pci_set_power_state(pci, PCI_D3hot); | ||
2054 | return 0; | 2037 | return 0; |
2055 | } | 2038 | } |
2056 | 2039 | ||
2057 | static int cs4281_resume(struct device *dev) | 2040 | static int cs4281_resume(struct device *dev) |
2058 | { | 2041 | { |
2059 | struct pci_dev *pci = to_pci_dev(dev); | ||
2060 | struct snd_card *card = dev_get_drvdata(dev); | 2042 | struct snd_card *card = dev_get_drvdata(dev); |
2061 | struct cs4281 *chip = card->private_data; | 2043 | struct cs4281 *chip = card->private_data; |
2062 | unsigned int i; | 2044 | unsigned int i; |
2063 | u32 ulCLK; | 2045 | u32 ulCLK; |
2064 | 2046 | ||
2065 | pci_set_power_state(pci, PCI_D0); | ||
2066 | pci_restore_state(pci); | ||
2067 | if (pci_enable_device(pci) < 0) { | ||
2068 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2069 | snd_card_disconnect(card); | ||
2070 | return -EIO; | ||
2071 | } | ||
2072 | pci_set_master(pci); | ||
2073 | |||
2074 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); | 2047 | ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); |
2075 | ulCLK |= CLKCR1_CKRA; | 2048 | ulCLK |= CLKCR1_CKRA; |
2076 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); | 2049 | snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK); |
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 6a6858c07826..655fbea1692c 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -100,16 +100,16 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, | |||
100 | } | 100 | } |
101 | card->private_data = chip; | 101 | card->private_data = chip; |
102 | chip->accept_valid = mmap_valid[dev]; | 102 | chip->accept_valid = mmap_valid[dev]; |
103 | if ((err = snd_cs46xx_pcm(chip, 0, NULL)) < 0) { | 103 | if ((err = snd_cs46xx_pcm(chip, 0)) < 0) { |
104 | snd_card_free(card); | 104 | snd_card_free(card); |
105 | return err; | 105 | return err; |
106 | } | 106 | } |
107 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 107 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
108 | if ((err = snd_cs46xx_pcm_rear(chip,1, NULL)) < 0) { | 108 | if ((err = snd_cs46xx_pcm_rear(chip, 1)) < 0) { |
109 | snd_card_free(card); | 109 | snd_card_free(card); |
110 | return err; | 110 | return err; |
111 | } | 111 | } |
112 | if ((err = snd_cs46xx_pcm_iec958(chip,2,NULL)) < 0) { | 112 | if ((err = snd_cs46xx_pcm_iec958(chip, 2)) < 0) { |
113 | snd_card_free(card); | 113 | snd_card_free(card); |
114 | return err; | 114 | return err; |
115 | } | 115 | } |
@@ -120,13 +120,13 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, | |||
120 | } | 120 | } |
121 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 121 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
122 | if (chip->nr_ac97_codecs ==2) { | 122 | if (chip->nr_ac97_codecs ==2) { |
123 | if ((err = snd_cs46xx_pcm_center_lfe(chip,3,NULL)) < 0) { | 123 | if ((err = snd_cs46xx_pcm_center_lfe(chip, 3)) < 0) { |
124 | snd_card_free(card); | 124 | snd_card_free(card); |
125 | return err; | 125 | return err; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | #endif | 128 | #endif |
129 | if ((err = snd_cs46xx_midi(chip, 0, NULL)) < 0) { | 129 | if ((err = snd_cs46xx_midi(chip, 0)) < 0) { |
130 | snd_card_free(card); | 130 | snd_card_free(card); |
131 | return err; | 131 | return err; |
132 | } | 132 | } |
diff --git a/sound/pci/cs46xx/cs46xx.h b/sound/pci/cs46xx/cs46xx.h index c49a082c378b..9c9f89a8be5f 100644 --- a/sound/pci/cs46xx/cs46xx.h +++ b/sound/pci/cs46xx/cs46xx.h | |||
@@ -1737,12 +1737,12 @@ int snd_cs46xx_create(struct snd_card *card, | |||
1737 | struct snd_cs46xx **rcodec); | 1737 | struct snd_cs46xx **rcodec); |
1738 | extern const struct dev_pm_ops snd_cs46xx_pm; | 1738 | extern const struct dev_pm_ops snd_cs46xx_pm; |
1739 | 1739 | ||
1740 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1740 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device); |
1741 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1741 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device); |
1742 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1742 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device); |
1743 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1743 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device); |
1744 | int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device); | 1744 | int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device); |
1745 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi); | 1745 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device); |
1746 | int snd_cs46xx_start_dsp(struct snd_cs46xx *chip); | 1746 | int snd_cs46xx_start_dsp(struct snd_cs46xx *chip); |
1747 | int snd_cs46xx_gameport(struct snd_cs46xx *chip); | 1747 | int snd_cs46xx_gameport(struct snd_cs46xx *chip); |
1748 | 1748 | ||
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 32b44f25b5c8..8d74004b1ed2 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <linux/module.h> | 57 | #include <linux/module.h> |
58 | #include <linux/firmware.h> | 58 | #include <linux/firmware.h> |
59 | #include <linux/vmalloc.h> | 59 | #include <linux/vmalloc.h> |
60 | #include <linux/io.h> | ||
60 | 61 | ||
61 | #include <sound/core.h> | 62 | #include <sound/core.h> |
62 | #include <sound/control.h> | 63 | #include <sound/control.h> |
@@ -65,8 +66,6 @@ | |||
65 | #include <sound/pcm_params.h> | 66 | #include <sound/pcm_params.h> |
66 | #include "cs46xx.h" | 67 | #include "cs46xx.h" |
67 | 68 | ||
68 | #include <asm/io.h> | ||
69 | |||
70 | #include "cs46xx_lib.h" | 69 | #include "cs46xx_lib.h" |
71 | #include "dsp_spos.h" | 70 | #include "dsp_spos.h" |
72 | 71 | ||
@@ -1778,13 +1777,11 @@ static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = { | |||
1778 | #define MAX_PLAYBACK_CHANNELS 1 | 1777 | #define MAX_PLAYBACK_CHANNELS 1 |
1779 | #endif | 1778 | #endif |
1780 | 1779 | ||
1781 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) | 1780 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device) |
1782 | { | 1781 | { |
1783 | struct snd_pcm *pcm; | 1782 | struct snd_pcm *pcm; |
1784 | int err; | 1783 | int err; |
1785 | 1784 | ||
1786 | if (rpcm) | ||
1787 | *rpcm = NULL; | ||
1788 | if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) | 1785 | if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) |
1789 | return err; | 1786 | return err; |
1790 | 1787 | ||
@@ -1801,23 +1798,16 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) | |||
1801 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1798 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1802 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1799 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1803 | 1800 | ||
1804 | if (rpcm) | ||
1805 | *rpcm = pcm; | ||
1806 | |||
1807 | return 0; | 1801 | return 0; |
1808 | } | 1802 | } |
1809 | 1803 | ||
1810 | 1804 | ||
1811 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 1805 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
1812 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, | 1806 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device) |
1813 | struct snd_pcm **rpcm) | ||
1814 | { | 1807 | { |
1815 | struct snd_pcm *pcm; | 1808 | struct snd_pcm *pcm; |
1816 | int err; | 1809 | int err; |
1817 | 1810 | ||
1818 | if (rpcm) | ||
1819 | *rpcm = NULL; | ||
1820 | |||
1821 | if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) | 1811 | if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) |
1822 | return err; | 1812 | return err; |
1823 | 1813 | ||
@@ -1833,21 +1823,14 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, | |||
1833 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1823 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1834 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1824 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1835 | 1825 | ||
1836 | if (rpcm) | ||
1837 | *rpcm = pcm; | ||
1838 | |||
1839 | return 0; | 1826 | return 0; |
1840 | } | 1827 | } |
1841 | 1828 | ||
1842 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, | 1829 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device) |
1843 | struct snd_pcm **rpcm) | ||
1844 | { | 1830 | { |
1845 | struct snd_pcm *pcm; | 1831 | struct snd_pcm *pcm; |
1846 | int err; | 1832 | int err; |
1847 | 1833 | ||
1848 | if (rpcm) | ||
1849 | *rpcm = NULL; | ||
1850 | |||
1851 | if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) | 1834 | if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) |
1852 | return err; | 1835 | return err; |
1853 | 1836 | ||
@@ -1863,21 +1846,14 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, | |||
1863 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1846 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1864 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1847 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1865 | 1848 | ||
1866 | if (rpcm) | ||
1867 | *rpcm = pcm; | ||
1868 | |||
1869 | return 0; | 1849 | return 0; |
1870 | } | 1850 | } |
1871 | 1851 | ||
1872 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, | 1852 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device) |
1873 | struct snd_pcm **rpcm) | ||
1874 | { | 1853 | { |
1875 | struct snd_pcm *pcm; | 1854 | struct snd_pcm *pcm; |
1876 | int err; | 1855 | int err; |
1877 | 1856 | ||
1878 | if (rpcm) | ||
1879 | *rpcm = NULL; | ||
1880 | |||
1881 | if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) | 1857 | if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) |
1882 | return err; | 1858 | return err; |
1883 | 1859 | ||
@@ -1893,9 +1869,6 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, | |||
1893 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1869 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1894 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1870 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1895 | 1871 | ||
1896 | if (rpcm) | ||
1897 | *rpcm = pcm; | ||
1898 | |||
1899 | return 0; | 1872 | return 0; |
1900 | } | 1873 | } |
1901 | #endif | 1874 | #endif |
@@ -2724,13 +2697,11 @@ static struct snd_rawmidi_ops snd_cs46xx_midi_input = | |||
2724 | .trigger = snd_cs46xx_midi_input_trigger, | 2697 | .trigger = snd_cs46xx_midi_input_trigger, |
2725 | }; | 2698 | }; |
2726 | 2699 | ||
2727 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi) | 2700 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device) |
2728 | { | 2701 | { |
2729 | struct snd_rawmidi *rmidi; | 2702 | struct snd_rawmidi *rmidi; |
2730 | int err; | 2703 | int err; |
2731 | 2704 | ||
2732 | if (rrawmidi) | ||
2733 | *rrawmidi = NULL; | ||
2734 | if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) | 2705 | if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) |
2735 | return err; | 2706 | return err; |
2736 | strcpy(rmidi->name, "CS46XX"); | 2707 | strcpy(rmidi->name, "CS46XX"); |
@@ -2739,8 +2710,6 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rr | |||
2739 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; | 2710 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; |
2740 | rmidi->private_data = chip; | 2711 | rmidi->private_data = chip; |
2741 | chip->rmidi = rmidi; | 2712 | chip->rmidi = rmidi; |
2742 | if (rrawmidi) | ||
2743 | *rrawmidi = NULL; | ||
2744 | return 0; | 2713 | return 0; |
2745 | } | 2714 | } |
2746 | 2715 | ||
@@ -2979,8 +2948,8 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) | |||
2979 | 2948 | ||
2980 | for (idx = 0; idx < 5; idx++) { | 2949 | for (idx = 0; idx < 5; idx++) { |
2981 | struct snd_cs46xx_region *region = &chip->region.idx[idx]; | 2950 | struct snd_cs46xx_region *region = &chip->region.idx[idx]; |
2982 | if (region->remap_addr) | 2951 | |
2983 | iounmap(region->remap_addr); | 2952 | iounmap(region->remap_addr); |
2984 | release_and_free_resource(region->resource); | 2953 | release_and_free_resource(region->resource); |
2985 | } | 2954 | } |
2986 | 2955 | ||
@@ -3804,7 +3773,6 @@ static unsigned int saved_regs[] = { | |||
3804 | 3773 | ||
3805 | static int snd_cs46xx_suspend(struct device *dev) | 3774 | static int snd_cs46xx_suspend(struct device *dev) |
3806 | { | 3775 | { |
3807 | struct pci_dev *pci = to_pci_dev(dev); | ||
3808 | struct snd_card *card = dev_get_drvdata(dev); | 3776 | struct snd_card *card = dev_get_drvdata(dev); |
3809 | struct snd_cs46xx *chip = card->private_data; | 3777 | struct snd_cs46xx *chip = card->private_data; |
3810 | int i, amp_saved; | 3778 | int i, amp_saved; |
@@ -3829,16 +3797,11 @@ static int snd_cs46xx_suspend(struct device *dev) | |||
3829 | /* disable CLKRUN */ | 3797 | /* disable CLKRUN */ |
3830 | chip->active_ctrl(chip, -chip->amplifier); | 3798 | chip->active_ctrl(chip, -chip->amplifier); |
3831 | chip->amplifier = amp_saved; /* restore the status */ | 3799 | chip->amplifier = amp_saved; /* restore the status */ |
3832 | |||
3833 | pci_disable_device(pci); | ||
3834 | pci_save_state(pci); | ||
3835 | pci_set_power_state(pci, PCI_D3hot); | ||
3836 | return 0; | 3800 | return 0; |
3837 | } | 3801 | } |
3838 | 3802 | ||
3839 | static int snd_cs46xx_resume(struct device *dev) | 3803 | static int snd_cs46xx_resume(struct device *dev) |
3840 | { | 3804 | { |
3841 | struct pci_dev *pci = to_pci_dev(dev); | ||
3842 | struct snd_card *card = dev_get_drvdata(dev); | 3805 | struct snd_card *card = dev_get_drvdata(dev); |
3843 | struct snd_cs46xx *chip = card->private_data; | 3806 | struct snd_cs46xx *chip = card->private_data; |
3844 | int amp_saved; | 3807 | int amp_saved; |
@@ -3847,15 +3810,6 @@ static int snd_cs46xx_resume(struct device *dev) | |||
3847 | #endif | 3810 | #endif |
3848 | unsigned int tmp; | 3811 | unsigned int tmp; |
3849 | 3812 | ||
3850 | pci_set_power_state(pci, PCI_D0); | ||
3851 | pci_restore_state(pci); | ||
3852 | if (pci_enable_device(pci) < 0) { | ||
3853 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
3854 | snd_card_disconnect(card); | ||
3855 | return -EIO; | ||
3856 | } | ||
3857 | pci_set_master(pci); | ||
3858 | |||
3859 | amp_saved = chip->amplifier; | 3813 | amp_saved = chip->amplifier; |
3860 | chip->amplifier = 0; | 3814 | chip->amplifier = 0; |
3861 | chip->active_ctrl(chip, 1); /* force to on */ | 3815 | chip->active_ctrl(chip, 1); /* force to on */ |
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 1c4a0fb3ffef..5c99efb004c0 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c | |||
@@ -20,7 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | 22 | ||
23 | #include <asm/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index 8284bc9b5858..2c90c0bded69 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include <asm/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index b1025507a467..0a8cf94c4858 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -223,7 +223,7 @@ static int snd_cs5530_create(struct snd_card *card, | |||
223 | return err; | 223 | return err; |
224 | } | 224 | } |
225 | 225 | ||
226 | err = snd_sb16dsp_pcm(chip->sb, 0, &chip->sb->pcm); | 226 | err = snd_sb16dsp_pcm(chip->sb, 0); |
227 | if (err < 0) { | 227 | if (err < 0) { |
228 | dev_err(card->dev, "Could not create PCM\n"); | 228 | dev_err(card->dev, "Could not create PCM\n"); |
229 | snd_cs5530_free(chip); | 229 | snd_cs5530_free(chip); |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 16288e4d338a..802c33f1cc59 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <asm/io.h> | 30 | #include <linux/io.h> |
31 | #include <sound/core.h> | 31 | #include <sound/core.h> |
32 | #include <sound/control.h> | 32 | #include <sound/control.h> |
33 | #include <sound/pcm.h> | 33 | #include <sound/pcm.h> |
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index 34cc60057d0c..06ac5d8da362 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c | |||
@@ -57,7 +57,6 @@ static void snd_cs5535audio_stop_hardware(struct cs5535audio *cs5535au) | |||
57 | 57 | ||
58 | static int snd_cs5535audio_suspend(struct device *dev) | 58 | static int snd_cs5535audio_suspend(struct device *dev) |
59 | { | 59 | { |
60 | struct pci_dev *pci = to_pci_dev(dev); | ||
61 | struct snd_card *card = dev_get_drvdata(dev); | 60 | struct snd_card *card = dev_get_drvdata(dev); |
62 | struct cs5535audio *cs5535au = card->private_data; | 61 | struct cs5535audio *cs5535au = card->private_data; |
63 | int i; | 62 | int i; |
@@ -72,34 +71,17 @@ static int snd_cs5535audio_suspend(struct device *dev) | |||
72 | } | 71 | } |
73 | /* save important regs, then disable aclink in hw */ | 72 | /* save important regs, then disable aclink in hw */ |
74 | snd_cs5535audio_stop_hardware(cs5535au); | 73 | snd_cs5535audio_stop_hardware(cs5535au); |
75 | |||
76 | if (pci_save_state(pci)) { | ||
77 | dev_err(dev, "pci_save_state failed!\n"); | ||
78 | return -EIO; | ||
79 | } | ||
80 | pci_disable_device(pci); | ||
81 | pci_set_power_state(pci, PCI_D3hot); | ||
82 | return 0; | 74 | return 0; |
83 | } | 75 | } |
84 | 76 | ||
85 | static int snd_cs5535audio_resume(struct device *dev) | 77 | static int snd_cs5535audio_resume(struct device *dev) |
86 | { | 78 | { |
87 | struct pci_dev *pci = to_pci_dev(dev); | ||
88 | struct snd_card *card = dev_get_drvdata(dev); | 79 | struct snd_card *card = dev_get_drvdata(dev); |
89 | struct cs5535audio *cs5535au = card->private_data; | 80 | struct cs5535audio *cs5535au = card->private_data; |
90 | u32 tmp; | 81 | u32 tmp; |
91 | int timeout; | 82 | int timeout; |
92 | int i; | 83 | int i; |
93 | 84 | ||
94 | pci_set_power_state(pci, PCI_D0); | ||
95 | pci_restore_state(pci); | ||
96 | if (pci_enable_device(pci) < 0) { | ||
97 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
98 | snd_card_disconnect(card); | ||
99 | return -EIO; | ||
100 | } | ||
101 | pci_set_master(pci); | ||
102 | |||
103 | /* set LNK_WRM_RST to reset AC link */ | 85 | /* set LNK_WRM_RST to reset AC link */ |
104 | cs_writel(cs5535au, ACC_CODEC_CNTL, ACC_CODEC_CNTL_LNK_WRM_RST); | 86 | cs_writel(cs5535au, ACC_CODEC_CNTL, ACC_CODEC_CNTL_LNK_WRM_RST); |
105 | 87 | ||
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index b425aa8ee578..1cac55fd1139 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c | |||
@@ -1985,10 +1985,7 @@ static int hw_card_shutdown(struct hw *hw) | |||
1985 | free_irq(hw->irq, hw); | 1985 | free_irq(hw->irq, hw); |
1986 | 1986 | ||
1987 | hw->irq = -1; | 1987 | hw->irq = -1; |
1988 | 1988 | iounmap(hw->mem_base); | |
1989 | if (hw->mem_base) | ||
1990 | iounmap(hw->mem_base); | ||
1991 | |||
1992 | hw->mem_base = NULL; | 1989 | hw->mem_base = NULL; |
1993 | 1990 | ||
1994 | if (hw->io_base) | 1991 | if (hw->io_base) |
@@ -2099,20 +2096,11 @@ static int hw_suspend(struct hw *hw) | |||
2099 | pci_write_config_dword(pci, UAA_CFG_SPACE_FLAG, 0x0); | 2096 | pci_write_config_dword(pci, UAA_CFG_SPACE_FLAG, 0x0); |
2100 | } | 2097 | } |
2101 | 2098 | ||
2102 | pci_disable_device(pci); | ||
2103 | pci_save_state(pci); | ||
2104 | pci_set_power_state(pci, PCI_D3hot); | ||
2105 | |||
2106 | return 0; | 2099 | return 0; |
2107 | } | 2100 | } |
2108 | 2101 | ||
2109 | static int hw_resume(struct hw *hw, struct card_conf *info) | 2102 | static int hw_resume(struct hw *hw, struct card_conf *info) |
2110 | { | 2103 | { |
2111 | struct pci_dev *pci = hw->pci; | ||
2112 | |||
2113 | pci_set_power_state(pci, PCI_D0); | ||
2114 | pci_restore_state(pci); | ||
2115 | |||
2116 | /* Re-initialize card hardware. */ | 2104 | /* Re-initialize card hardware. */ |
2117 | return hw_card_init(hw, info); | 2105 | return hw_card_init(hw, info); |
2118 | } | 2106 | } |
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 253899d13790..955ad871e9a8 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c | |||
@@ -2110,10 +2110,7 @@ static int hw_card_shutdown(struct hw *hw) | |||
2110 | free_irq(hw->irq, hw); | 2110 | free_irq(hw->irq, hw); |
2111 | 2111 | ||
2112 | hw->irq = -1; | 2112 | hw->irq = -1; |
2113 | 2113 | iounmap(hw->mem_base); | |
2114 | if (hw->mem_base) | ||
2115 | iounmap(hw->mem_base); | ||
2116 | |||
2117 | hw->mem_base = NULL; | 2114 | hw->mem_base = NULL; |
2118 | 2115 | ||
2119 | if (hw->io_base) | 2116 | if (hw->io_base) |
@@ -2209,24 +2206,12 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) | |||
2209 | #ifdef CONFIG_PM_SLEEP | 2206 | #ifdef CONFIG_PM_SLEEP |
2210 | static int hw_suspend(struct hw *hw) | 2207 | static int hw_suspend(struct hw *hw) |
2211 | { | 2208 | { |
2212 | struct pci_dev *pci = hw->pci; | ||
2213 | |||
2214 | hw_card_stop(hw); | 2209 | hw_card_stop(hw); |
2215 | |||
2216 | pci_disable_device(pci); | ||
2217 | pci_save_state(pci); | ||
2218 | pci_set_power_state(pci, PCI_D3hot); | ||
2219 | |||
2220 | return 0; | 2210 | return 0; |
2221 | } | 2211 | } |
2222 | 2212 | ||
2223 | static int hw_resume(struct hw *hw, struct card_conf *info) | 2213 | static int hw_resume(struct hw *hw, struct card_conf *info) |
2224 | { | 2214 | { |
2225 | struct pci_dev *pci = hw->pci; | ||
2226 | |||
2227 | pci_set_power_state(pci, PCI_D0); | ||
2228 | pci_restore_state(pci); | ||
2229 | |||
2230 | /* Re-initialize card hardware. */ | 2215 | /* Re-initialize card hardware. */ |
2231 | return hw_card_init(hw, info); | 2216 | return hw_card_init(hw, info); |
2232 | } | 2217 | } |
diff --git a/sound/pci/echoaudio/darla20.c b/sound/pci/echoaudio/darla20.c index 4632946205a8..c95da6301677 100644 --- a/sound/pci/echoaudio/darla20.c +++ b/sound/pci/echoaudio/darla20.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/module.h> | 43 | #include <linux/module.h> |
44 | #include <linux/firmware.h> | 44 | #include <linux/firmware.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/io.h> | ||
46 | #include <sound/core.h> | 47 | #include <sound/core.h> |
47 | #include <sound/info.h> | 48 | #include <sound/info.h> |
48 | #include <sound/control.h> | 49 | #include <sound/control.h> |
@@ -51,7 +52,6 @@ | |||
51 | #include <sound/pcm_params.h> | 52 | #include <sound/pcm_params.h> |
52 | #include <sound/asoundef.h> | 53 | #include <sound/asoundef.h> |
53 | #include <sound/initval.h> | 54 | #include <sound/initval.h> |
54 | #include <asm/io.h> | ||
55 | #include <linux/atomic.h> | 55 | #include <linux/atomic.h> |
56 | #include "echoaudio.h" | 56 | #include "echoaudio.h" |
57 | 57 | ||
diff --git a/sound/pci/echoaudio/darla24.c b/sound/pci/echoaudio/darla24.c index f81c839cc887..3013b4daa19e 100644 --- a/sound/pci/echoaudio/darla24.c +++ b/sound/pci/echoaudio/darla24.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/module.h> | 47 | #include <linux/module.h> |
48 | #include <linux/firmware.h> | 48 | #include <linux/firmware.h> |
49 | #include <linux/slab.h> | 49 | #include <linux/slab.h> |
50 | #include <linux/io.h> | ||
50 | #include <sound/core.h> | 51 | #include <sound/core.h> |
51 | #include <sound/info.h> | 52 | #include <sound/info.h> |
52 | #include <sound/control.h> | 53 | #include <sound/control.h> |
@@ -55,7 +56,6 @@ | |||
55 | #include <sound/pcm_params.h> | 56 | #include <sound/pcm_params.h> |
56 | #include <sound/asoundef.h> | 57 | #include <sound/asoundef.h> |
57 | #include <sound/initval.h> | 58 | #include <sound/initval.h> |
58 | #include <asm/io.h> | ||
59 | #include <linux/atomic.h> | 59 | #include <linux/atomic.h> |
60 | #include "echoaudio.h" | 60 | #include "echoaudio.h" |
61 | 61 | ||
diff --git a/sound/pci/echoaudio/echo3g.c b/sound/pci/echoaudio/echo3g.c index 3a5346c33d76..1f34a07b0b19 100644 --- a/sound/pci/echoaudio/echo3g.c +++ b/sound/pci/echoaudio/echo3g.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/module.h> | 54 | #include <linux/module.h> |
55 | #include <linux/firmware.h> | 55 | #include <linux/firmware.h> |
56 | #include <linux/slab.h> | 56 | #include <linux/slab.h> |
57 | #include <linux/io.h> | ||
57 | #include <sound/core.h> | 58 | #include <sound/core.h> |
58 | #include <sound/info.h> | 59 | #include <sound/info.h> |
59 | #include <sound/control.h> | 60 | #include <sound/control.h> |
@@ -63,7 +64,6 @@ | |||
63 | #include <sound/asoundef.h> | 64 | #include <sound/asoundef.h> |
64 | #include <sound/initval.h> | 65 | #include <sound/initval.h> |
65 | #include <sound/rawmidi.h> | 66 | #include <sound/rawmidi.h> |
66 | #include <asm/io.h> | ||
67 | #include <linux/atomic.h> | 67 | #include <linux/atomic.h> |
68 | #include "echoaudio.h" | 68 | #include "echoaudio.h" |
69 | 69 | ||
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 21228adaa70c..a962de03ebb6 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -1872,12 +1872,8 @@ static int snd_echo_free(struct echoaudio *chip) | |||
1872 | if (chip->comm_page) | 1872 | if (chip->comm_page) |
1873 | snd_dma_free_pages(&chip->commpage_dma_buf); | 1873 | snd_dma_free_pages(&chip->commpage_dma_buf); |
1874 | 1874 | ||
1875 | if (chip->dsp_registers) | 1875 | iounmap(chip->dsp_registers); |
1876 | iounmap(chip->dsp_registers); | ||
1877 | |||
1878 | release_and_free_resource(chip->iores); | 1876 | release_and_free_resource(chip->iores); |
1879 | |||
1880 | |||
1881 | pci_disable_device(chip->pci); | 1877 | pci_disable_device(chip->pci); |
1882 | 1878 | ||
1883 | /* release chip data */ | 1879 | /* release chip data */ |
@@ -2162,7 +2158,6 @@ ctl_error: | |||
2162 | 2158 | ||
2163 | static int snd_echo_suspend(struct device *dev) | 2159 | static int snd_echo_suspend(struct device *dev) |
2164 | { | 2160 | { |
2165 | struct pci_dev *pci = to_pci_dev(dev); | ||
2166 | struct echoaudio *chip = dev_get_drvdata(dev); | 2161 | struct echoaudio *chip = dev_get_drvdata(dev); |
2167 | 2162 | ||
2168 | snd_pcm_suspend_all(chip->analog_pcm); | 2163 | snd_pcm_suspend_all(chip->analog_pcm); |
@@ -2188,9 +2183,6 @@ static int snd_echo_suspend(struct device *dev) | |||
2188 | chip->dsp_code = NULL; | 2183 | chip->dsp_code = NULL; |
2189 | free_irq(chip->irq, chip); | 2184 | free_irq(chip->irq, chip); |
2190 | chip->irq = -1; | 2185 | chip->irq = -1; |
2191 | pci_save_state(pci); | ||
2192 | pci_disable_device(pci); | ||
2193 | |||
2194 | return 0; | 2186 | return 0; |
2195 | } | 2187 | } |
2196 | 2188 | ||
@@ -2204,7 +2196,6 @@ static int snd_echo_resume(struct device *dev) | |||
2204 | u32 pipe_alloc_mask; | 2196 | u32 pipe_alloc_mask; |
2205 | int err; | 2197 | int err; |
2206 | 2198 | ||
2207 | pci_restore_state(pci); | ||
2208 | commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); | 2199 | commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); |
2209 | if (commpage_bak == NULL) | 2200 | if (commpage_bak == NULL) |
2210 | return -ENOMEM; | 2201 | return -ENOMEM; |
diff --git a/sound/pci/echoaudio/gina20.c b/sound/pci/echoaudio/gina20.c index 9cb81c500824..4fa32a2e97db 100644 --- a/sound/pci/echoaudio/gina20.c +++ b/sound/pci/echoaudio/gina20.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/module.h> | 47 | #include <linux/module.h> |
48 | #include <linux/firmware.h> | 48 | #include <linux/firmware.h> |
49 | #include <linux/slab.h> | 49 | #include <linux/slab.h> |
50 | #include <linux/io.h> | ||
50 | #include <sound/core.h> | 51 | #include <sound/core.h> |
51 | #include <sound/info.h> | 52 | #include <sound/info.h> |
52 | #include <sound/control.h> | 53 | #include <sound/control.h> |
@@ -55,7 +56,6 @@ | |||
55 | #include <sound/pcm_params.h> | 56 | #include <sound/pcm_params.h> |
56 | #include <sound/asoundef.h> | 57 | #include <sound/asoundef.h> |
57 | #include <sound/initval.h> | 58 | #include <sound/initval.h> |
58 | #include <asm/io.h> | ||
59 | #include <linux/atomic.h> | 59 | #include <linux/atomic.h> |
60 | #include "echoaudio.h" | 60 | #include "echoaudio.h" |
61 | 61 | ||
diff --git a/sound/pci/echoaudio/gina24.c b/sound/pci/echoaudio/gina24.c index 35d3e6eac990..b1bcacaef257 100644 --- a/sound/pci/echoaudio/gina24.c +++ b/sound/pci/echoaudio/gina24.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/firmware.h> | 54 | #include <linux/firmware.h> |
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
56 | #include <linux/io.h> | ||
56 | #include <sound/core.h> | 57 | #include <sound/core.h> |
57 | #include <sound/info.h> | 58 | #include <sound/info.h> |
58 | #include <sound/control.h> | 59 | #include <sound/control.h> |
@@ -61,7 +62,6 @@ | |||
61 | #include <sound/pcm_params.h> | 62 | #include <sound/pcm_params.h> |
62 | #include <sound/asoundef.h> | 63 | #include <sound/asoundef.h> |
63 | #include <sound/initval.h> | 64 | #include <sound/initval.h> |
64 | #include <asm/io.h> | ||
65 | #include <linux/atomic.h> | 65 | #include <linux/atomic.h> |
66 | #include "echoaudio.h" | 66 | #include "echoaudio.h" |
67 | 67 | ||
diff --git a/sound/pci/echoaudio/indigo.c b/sound/pci/echoaudio/indigo.c index 8d91842d1268..175af9b1435f 100644 --- a/sound/pci/echoaudio/indigo.c +++ b/sound/pci/echoaudio/indigo.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/firmware.h> | 46 | #include <linux/firmware.h> |
47 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
48 | #include <linux/io.h> | ||
48 | #include <sound/core.h> | 49 | #include <sound/core.h> |
49 | #include <sound/info.h> | 50 | #include <sound/info.h> |
50 | #include <sound/control.h> | 51 | #include <sound/control.h> |
@@ -53,7 +54,6 @@ | |||
53 | #include <sound/pcm_params.h> | 54 | #include <sound/pcm_params.h> |
54 | #include <sound/asoundef.h> | 55 | #include <sound/asoundef.h> |
55 | #include <sound/initval.h> | 56 | #include <sound/initval.h> |
56 | #include <asm/io.h> | ||
57 | #include <linux/atomic.h> | 57 | #include <linux/atomic.h> |
58 | #include "echoaudio.h" | 58 | #include "echoaudio.h" |
59 | 59 | ||
diff --git a/sound/pci/echoaudio/indigodj.c b/sound/pci/echoaudio/indigodj.c index 289cb969f5b9..8c60314e4901 100644 --- a/sound/pci/echoaudio/indigodj.c +++ b/sound/pci/echoaudio/indigodj.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/firmware.h> | 46 | #include <linux/firmware.h> |
47 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
48 | #include <linux/io.h> | ||
48 | #include <sound/core.h> | 49 | #include <sound/core.h> |
49 | #include <sound/info.h> | 50 | #include <sound/info.h> |
50 | #include <sound/control.h> | 51 | #include <sound/control.h> |
@@ -53,7 +54,6 @@ | |||
53 | #include <sound/pcm_params.h> | 54 | #include <sound/pcm_params.h> |
54 | #include <sound/asoundef.h> | 55 | #include <sound/asoundef.h> |
55 | #include <sound/initval.h> | 56 | #include <sound/initval.h> |
56 | #include <asm/io.h> | ||
57 | #include <linux/atomic.h> | 57 | #include <linux/atomic.h> |
58 | #include "echoaudio.h" | 58 | #include "echoaudio.h" |
59 | 59 | ||
diff --git a/sound/pci/echoaudio/indigoio.c b/sound/pci/echoaudio/indigoio.c index 405a3f2e496f..f7618edfd79c 100644 --- a/sound/pci/echoaudio/indigoio.c +++ b/sound/pci/echoaudio/indigoio.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
48 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
49 | #include <linux/io.h> | ||
49 | #include <sound/core.h> | 50 | #include <sound/core.h> |
50 | #include <sound/info.h> | 51 | #include <sound/info.h> |
51 | #include <sound/control.h> | 52 | #include <sound/control.h> |
@@ -54,7 +55,6 @@ | |||
54 | #include <sound/pcm_params.h> | 55 | #include <sound/pcm_params.h> |
55 | #include <sound/asoundef.h> | 56 | #include <sound/asoundef.h> |
56 | #include <sound/initval.h> | 57 | #include <sound/initval.h> |
57 | #include <asm/io.h> | ||
58 | #include <linux/atomic.h> | 58 | #include <linux/atomic.h> |
59 | #include "echoaudio.h" | 59 | #include "echoaudio.h" |
60 | 60 | ||
diff --git a/sound/pci/echoaudio/layla20.c b/sound/pci/echoaudio/layla20.c index b392dd776b71..12e5d2164dc4 100644 --- a/sound/pci/echoaudio/layla20.c +++ b/sound/pci/echoaudio/layla20.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/module.h> | 52 | #include <linux/module.h> |
53 | #include <linux/firmware.h> | 53 | #include <linux/firmware.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/io.h> | ||
55 | #include <sound/core.h> | 56 | #include <sound/core.h> |
56 | #include <sound/info.h> | 57 | #include <sound/info.h> |
57 | #include <sound/control.h> | 58 | #include <sound/control.h> |
@@ -61,7 +62,6 @@ | |||
61 | #include <sound/asoundef.h> | 62 | #include <sound/asoundef.h> |
62 | #include <sound/initval.h> | 63 | #include <sound/initval.h> |
63 | #include <sound/rawmidi.h> | 64 | #include <sound/rawmidi.h> |
64 | #include <asm/io.h> | ||
65 | #include <linux/atomic.h> | 65 | #include <linux/atomic.h> |
66 | #include "echoaudio.h" | 66 | #include "echoaudio.h" |
67 | 67 | ||
diff --git a/sound/pci/echoaudio/layla24.c b/sound/pci/echoaudio/layla24.c index bc7f730b0ec6..6e4023728ef5 100644 --- a/sound/pci/echoaudio/layla24.c +++ b/sound/pci/echoaudio/layla24.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/module.h> | 54 | #include <linux/module.h> |
55 | #include <linux/firmware.h> | 55 | #include <linux/firmware.h> |
56 | #include <linux/slab.h> | 56 | #include <linux/slab.h> |
57 | #include <linux/io.h> | ||
57 | #include <sound/core.h> | 58 | #include <sound/core.h> |
58 | #include <sound/info.h> | 59 | #include <sound/info.h> |
59 | #include <sound/control.h> | 60 | #include <sound/control.h> |
@@ -63,7 +64,6 @@ | |||
63 | #include <sound/asoundef.h> | 64 | #include <sound/asoundef.h> |
64 | #include <sound/initval.h> | 65 | #include <sound/initval.h> |
65 | #include <sound/rawmidi.h> | 66 | #include <sound/rawmidi.h> |
66 | #include <asm/io.h> | ||
67 | #include <linux/atomic.h> | 67 | #include <linux/atomic.h> |
68 | #include "echoaudio.h" | 68 | #include "echoaudio.h" |
69 | 69 | ||
diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index 27a9a6e5db2d..2f7562f1aefb 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/firmware.h> | 54 | #include <linux/firmware.h> |
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
56 | #include <linux/io.h> | ||
56 | #include <sound/core.h> | 57 | #include <sound/core.h> |
57 | #include <sound/info.h> | 58 | #include <sound/info.h> |
58 | #include <sound/control.h> | 59 | #include <sound/control.h> |
@@ -62,7 +63,6 @@ | |||
62 | #include <sound/asoundef.h> | 63 | #include <sound/asoundef.h> |
63 | #include <sound/initval.h> | 64 | #include <sound/initval.h> |
64 | #include <sound/rawmidi.h> | 65 | #include <sound/rawmidi.h> |
65 | #include <asm/io.h> | ||
66 | #include <linux/atomic.h> | 66 | #include <linux/atomic.h> |
67 | #include "echoaudio.h" | 67 | #include "echoaudio.h" |
68 | 68 | ||
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c index d913749d154a..a8fe58335ddc 100644 --- a/sound/pci/echoaudio/midi.c +++ b/sound/pci/echoaudio/midi.c | |||
@@ -257,9 +257,8 @@ static void snd_echo_midi_output_trigger(struct snd_rawmidi_substream *substream | |||
257 | spin_lock_irq(&chip->lock); | 257 | spin_lock_irq(&chip->lock); |
258 | if (up) { | 258 | if (up) { |
259 | if (!chip->tinuse) { | 259 | if (!chip->tinuse) { |
260 | init_timer(&chip->timer); | 260 | setup_timer(&chip->timer, snd_echo_midi_output_write, |
261 | chip->timer.function = snd_echo_midi_output_write; | 261 | (unsigned long)chip); |
262 | chip->timer.data = (unsigned long)chip; | ||
263 | chip->tinuse = 1; | 262 | chip->tinuse = 1; |
264 | } | 263 | } |
265 | } else { | 264 | } else { |
diff --git a/sound/pci/echoaudio/mona.c b/sound/pci/echoaudio/mona.c index 3d13875c303d..34d499466393 100644 --- a/sound/pci/echoaudio/mona.c +++ b/sound/pci/echoaudio/mona.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/module.h> | 51 | #include <linux/module.h> |
52 | #include <linux/firmware.h> | 52 | #include <linux/firmware.h> |
53 | #include <linux/slab.h> | 53 | #include <linux/slab.h> |
54 | #include <linux/io.h> | ||
54 | #include <sound/core.h> | 55 | #include <sound/core.h> |
55 | #include <sound/info.h> | 56 | #include <sound/info.h> |
56 | #include <sound/control.h> | 57 | #include <sound/control.h> |
@@ -59,7 +60,6 @@ | |||
59 | #include <sound/pcm_params.h> | 60 | #include <sound/pcm_params.h> |
60 | #include <sound/asoundef.h> | 61 | #include <sound/asoundef.h> |
61 | #include <sound/initval.h> | 62 | #include <sound/initval.h> |
62 | #include <asm/io.h> | ||
63 | #include <linux/atomic.h> | 63 | #include <linux/atomic.h> |
64 | #include "echoaudio.h" | 64 | #include "echoaudio.h" |
65 | 65 | ||
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 4c171636efcd..37d0220a094c 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -132,11 +132,11 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci, | |||
132 | goto error; | 132 | goto error; |
133 | card->private_data = emu; | 133 | card->private_data = emu; |
134 | emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f; | 134 | emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f; |
135 | if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0) | 135 | if ((err = snd_emu10k1_pcm(emu, 0)) < 0) |
136 | goto error; | 136 | goto error; |
137 | if ((err = snd_emu10k1_pcm_mic(emu, 1, NULL)) < 0) | 137 | if ((err = snd_emu10k1_pcm_mic(emu, 1)) < 0) |
138 | goto error; | 138 | goto error; |
139 | if ((err = snd_emu10k1_pcm_efx(emu, 2, NULL)) < 0) | 139 | if ((err = snd_emu10k1_pcm_efx(emu, 2)) < 0) |
140 | goto error; | 140 | goto error; |
141 | /* This stores the periods table. */ | 141 | /* This stores the periods table. */ |
142 | if (emu->card_capabilities->ca0151_chip) { /* P16V */ | 142 | if (emu->card_capabilities->ca0151_chip) { /* P16V */ |
@@ -151,10 +151,10 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci, | |||
151 | if ((err = snd_emu10k1_timer(emu, 0)) < 0) | 151 | if ((err = snd_emu10k1_timer(emu, 0)) < 0) |
152 | goto error; | 152 | goto error; |
153 | 153 | ||
154 | if ((err = snd_emu10k1_pcm_multi(emu, 3, NULL)) < 0) | 154 | if ((err = snd_emu10k1_pcm_multi(emu, 3)) < 0) |
155 | goto error; | 155 | goto error; |
156 | if (emu->card_capabilities->ca0151_chip) { /* P16V */ | 156 | if (emu->card_capabilities->ca0151_chip) { /* P16V */ |
157 | if ((err = snd_p16v_pcm(emu, 4, NULL)) < 0) | 157 | if ((err = snd_p16v_pcm(emu, 4)) < 0) |
158 | goto error; | 158 | goto error; |
159 | } | 159 | } |
160 | if (emu->audigy) { | 160 | if (emu->audigy) { |
@@ -164,7 +164,7 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci, | |||
164 | if ((err = snd_emu10k1_midi(emu)) < 0) | 164 | if ((err = snd_emu10k1_midi(emu)) < 0) |
165 | goto error; | 165 | goto error; |
166 | } | 166 | } |
167 | if ((err = snd_emu10k1_fx8010_new(emu, 0, NULL)) < 0) | 167 | if ((err = snd_emu10k1_fx8010_new(emu, 0)) < 0) |
168 | goto error; | 168 | goto error; |
169 | #ifdef ENABLE_SYNTH | 169 | #ifdef ENABLE_SYNTH |
170 | if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH, | 170 | if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH, |
@@ -210,7 +210,6 @@ static void snd_card_emu10k1_remove(struct pci_dev *pci) | |||
210 | #ifdef CONFIG_PM_SLEEP | 210 | #ifdef CONFIG_PM_SLEEP |
211 | static int snd_emu10k1_suspend(struct device *dev) | 211 | static int snd_emu10k1_suspend(struct device *dev) |
212 | { | 212 | { |
213 | struct pci_dev *pci = to_pci_dev(dev); | ||
214 | struct snd_card *card = dev_get_drvdata(dev); | 213 | struct snd_card *card = dev_get_drvdata(dev); |
215 | struct snd_emu10k1 *emu = card->private_data; | 214 | struct snd_emu10k1 *emu = card->private_data; |
216 | 215 | ||
@@ -232,28 +231,14 @@ static int snd_emu10k1_suspend(struct device *dev) | |||
232 | snd_p16v_suspend(emu); | 231 | snd_p16v_suspend(emu); |
233 | 232 | ||
234 | snd_emu10k1_done(emu); | 233 | snd_emu10k1_done(emu); |
235 | |||
236 | pci_disable_device(pci); | ||
237 | pci_save_state(pci); | ||
238 | pci_set_power_state(pci, PCI_D3hot); | ||
239 | return 0; | 234 | return 0; |
240 | } | 235 | } |
241 | 236 | ||
242 | static int snd_emu10k1_resume(struct device *dev) | 237 | static int snd_emu10k1_resume(struct device *dev) |
243 | { | 238 | { |
244 | struct pci_dev *pci = to_pci_dev(dev); | ||
245 | struct snd_card *card = dev_get_drvdata(dev); | 239 | struct snd_card *card = dev_get_drvdata(dev); |
246 | struct snd_emu10k1 *emu = card->private_data; | 240 | struct snd_emu10k1 *emu = card->private_data; |
247 | 241 | ||
248 | pci_set_power_state(pci, PCI_D0); | ||
249 | pci_restore_state(pci); | ||
250 | if (pci_enable_device(pci) < 0) { | ||
251 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
252 | snd_card_disconnect(card); | ||
253 | return -EIO; | ||
254 | } | ||
255 | pci_set_master(pci); | ||
256 | |||
257 | snd_emu10k1_resume_init(emu); | 242 | snd_emu10k1_resume_init(emu); |
258 | snd_emu10k1_efx_resume(emu); | 243 | snd_emu10k1_efx_resume(emu); |
259 | snd_ac97_resume(emu->ac97); | 244 | snd_ac97_resume(emu->ac97); |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 15933f92f63a..6d1b98d14327 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -847,15 +847,13 @@ static const struct snd_pcm_chmap_elem clfe_map[] = { | |||
847 | { } | 847 | { } |
848 | }; | 848 | }; |
849 | 849 | ||
850 | static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) | 850 | static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device) |
851 | { | 851 | { |
852 | struct snd_pcm *pcm; | 852 | struct snd_pcm *pcm; |
853 | const struct snd_pcm_chmap_elem *map = NULL; | 853 | const struct snd_pcm_chmap_elem *map = NULL; |
854 | int err; | 854 | int err; |
855 | int capture = 0; | 855 | int capture = 0; |
856 | 856 | ||
857 | if (rpcm) | ||
858 | *rpcm = NULL; | ||
859 | if (device == 0) | 857 | if (device == 0) |
860 | capture = 1; | 858 | capture = 1; |
861 | 859 | ||
@@ -896,15 +894,8 @@ static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **r | |||
896 | snd_dma_pci_data(emu->pci), | 894 | snd_dma_pci_data(emu->pci), |
897 | 32*1024, 32*1024); | 895 | 32*1024, 32*1024); |
898 | 896 | ||
899 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, | 897 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, |
900 | 1 << 2, NULL); | 898 | 1 << 2, NULL); |
901 | if (err < 0) | ||
902 | return err; | ||
903 | |||
904 | if (rpcm) | ||
905 | *rpcm = pcm; | ||
906 | |||
907 | return 0; | ||
908 | } | 899 | } |
909 | 900 | ||
910 | static int snd_emu10k1x_create(struct snd_card *card, | 901 | static int snd_emu10k1x_create(struct snd_card *card, |
@@ -1583,15 +1574,15 @@ static int snd_emu10k1x_probe(struct pci_dev *pci, | |||
1583 | return err; | 1574 | return err; |
1584 | } | 1575 | } |
1585 | 1576 | ||
1586 | if ((err = snd_emu10k1x_pcm(chip, 0, NULL)) < 0) { | 1577 | if ((err = snd_emu10k1x_pcm(chip, 0)) < 0) { |
1587 | snd_card_free(card); | 1578 | snd_card_free(card); |
1588 | return err; | 1579 | return err; |
1589 | } | 1580 | } |
1590 | if ((err = snd_emu10k1x_pcm(chip, 1, NULL)) < 0) { | 1581 | if ((err = snd_emu10k1x_pcm(chip, 1)) < 0) { |
1591 | snd_card_free(card); | 1582 | snd_card_free(card); |
1592 | return err; | 1583 | return err; |
1593 | } | 1584 | } |
1594 | if ((err = snd_emu10k1x_pcm(chip, 2, NULL)) < 0) { | 1585 | if ((err = snd_emu10k1x_pcm(chip, 2)) < 0) { |
1595 | snd_card_free(card); | 1586 | snd_card_free(card); |
1596 | return err; | 1587 | return err; |
1597 | } | 1588 | } |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index eb5c0aba41c1..56fc47bd6dba 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -2641,14 +2641,11 @@ static int snd_emu10k1_fx8010_release(struct snd_hwdep * hw, struct file *file) | |||
2641 | return 0; | 2641 | return 0; |
2642 | } | 2642 | } |
2643 | 2643 | ||
2644 | int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, | 2644 | int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device) |
2645 | struct snd_hwdep **rhwdep) | ||
2646 | { | 2645 | { |
2647 | struct snd_hwdep *hw; | 2646 | struct snd_hwdep *hw; |
2648 | int err; | 2647 | int err; |
2649 | 2648 | ||
2650 | if (rhwdep) | ||
2651 | *rhwdep = NULL; | ||
2652 | if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0) | 2649 | if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0) |
2653 | return err; | 2650 | return err; |
2654 | strcpy(hw->name, "EMU10K1 (FX8010)"); | 2651 | strcpy(hw->name, "EMU10K1 (FX8010)"); |
@@ -2657,8 +2654,6 @@ int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, | |||
2657 | hw->ops.ioctl = snd_emu10k1_fx8010_ioctl; | 2654 | hw->ops.ioctl = snd_emu10k1_fx8010_ioctl; |
2658 | hw->ops.release = snd_emu10k1_fx8010_release; | 2655 | hw->ops.release = snd_emu10k1_fx8010_release; |
2659 | hw->private_data = emu; | 2656 | hw->private_data = emu; |
2660 | if (rhwdep) | ||
2661 | *rhwdep = hw; | ||
2662 | return 0; | 2657 | return 0; |
2663 | } | 2658 | } |
2664 | 2659 | ||
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index f82481bd2542..0dc07385af0e 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -1400,15 +1400,12 @@ static struct snd_pcm_ops snd_emu10k1_efx_playback_ops = { | |||
1400 | .page = snd_pcm_sgbuf_ops_page, | 1400 | .page = snd_pcm_sgbuf_ops_page, |
1401 | }; | 1401 | }; |
1402 | 1402 | ||
1403 | int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) | 1403 | int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device) |
1404 | { | 1404 | { |
1405 | struct snd_pcm *pcm; | 1405 | struct snd_pcm *pcm; |
1406 | struct snd_pcm_substream *substream; | 1406 | struct snd_pcm_substream *substream; |
1407 | int err; | 1407 | int err; |
1408 | 1408 | ||
1409 | if (rpcm) | ||
1410 | *rpcm = NULL; | ||
1411 | |||
1412 | if ((err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm)) < 0) | 1409 | if ((err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm)) < 0) |
1413 | return err; | 1410 | return err; |
1414 | 1411 | ||
@@ -1429,22 +1426,15 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) | |||
1429 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) | 1426 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) |
1430 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); | 1427 | snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); |
1431 | 1428 | ||
1432 | if (rpcm) | ||
1433 | *rpcm = pcm; | ||
1434 | |||
1435 | return 0; | 1429 | return 0; |
1436 | } | 1430 | } |
1437 | 1431 | ||
1438 | int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device, | 1432 | int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device) |
1439 | struct snd_pcm **rpcm) | ||
1440 | { | 1433 | { |
1441 | struct snd_pcm *pcm; | 1434 | struct snd_pcm *pcm; |
1442 | struct snd_pcm_substream *substream; | 1435 | struct snd_pcm_substream *substream; |
1443 | int err; | 1436 | int err; |
1444 | 1437 | ||
1445 | if (rpcm) | ||
1446 | *rpcm = NULL; | ||
1447 | |||
1448 | if ((err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm)) < 0) | 1438 | if ((err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm)) < 0) |
1449 | return err; | 1439 | return err; |
1450 | 1440 | ||
@@ -1461,9 +1451,6 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device, | |||
1461 | if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) | 1451 | if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) |
1462 | return err; | 1452 | return err; |
1463 | 1453 | ||
1464 | if (rpcm) | ||
1465 | *rpcm = pcm; | ||
1466 | |||
1467 | return 0; | 1454 | return 0; |
1468 | } | 1455 | } |
1469 | 1456 | ||
@@ -1479,15 +1466,11 @@ static struct snd_pcm_ops snd_emu10k1_capture_mic_ops = { | |||
1479 | .pointer = snd_emu10k1_capture_pointer, | 1466 | .pointer = snd_emu10k1_capture_pointer, |
1480 | }; | 1467 | }; |
1481 | 1468 | ||
1482 | int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device, | 1469 | int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device) |
1483 | struct snd_pcm **rpcm) | ||
1484 | { | 1470 | { |
1485 | struct snd_pcm *pcm; | 1471 | struct snd_pcm *pcm; |
1486 | int err; | 1472 | int err; |
1487 | 1473 | ||
1488 | if (rpcm) | ||
1489 | *rpcm = NULL; | ||
1490 | |||
1491 | if ((err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm)) < 0) | 1474 | if ((err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm)) < 0) |
1492 | return err; | 1475 | return err; |
1493 | 1476 | ||
@@ -1501,8 +1484,6 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device, | |||
1501 | 1484 | ||
1502 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); | 1485 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); |
1503 | 1486 | ||
1504 | if (rpcm) | ||
1505 | *rpcm = pcm; | ||
1506 | return 0; | 1487 | return 0; |
1507 | } | 1488 | } |
1508 | 1489 | ||
@@ -1822,16 +1803,12 @@ static struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = { | |||
1822 | .ack = snd_emu10k1_fx8010_playback_transfer, | 1803 | .ack = snd_emu10k1_fx8010_playback_transfer, |
1823 | }; | 1804 | }; |
1824 | 1805 | ||
1825 | int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device, | 1806 | int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device) |
1826 | struct snd_pcm **rpcm) | ||
1827 | { | 1807 | { |
1828 | struct snd_pcm *pcm; | 1808 | struct snd_pcm *pcm; |
1829 | struct snd_kcontrol *kctl; | 1809 | struct snd_kcontrol *kctl; |
1830 | int err; | 1810 | int err; |
1831 | 1811 | ||
1832 | if (rpcm) | ||
1833 | *rpcm = NULL; | ||
1834 | |||
1835 | if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0) | 1812 | if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0) |
1836 | return err; | 1813 | return err; |
1837 | 1814 | ||
@@ -1843,8 +1820,6 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device, | |||
1843 | pcm->info_flags = 0; | 1820 | pcm->info_flags = 0; |
1844 | strcpy(pcm->name, "Multichannel Capture/PT Playback"); | 1821 | strcpy(pcm->name, "Multichannel Capture/PT Playback"); |
1845 | emu->pcm_efx = pcm; | 1822 | emu->pcm_efx = pcm; |
1846 | if (rpcm) | ||
1847 | *rpcm = pcm; | ||
1848 | 1823 | ||
1849 | /* EFX capture - record the "FXBUS2" channels, by default we connect the EXTINs | 1824 | /* EFX capture - record the "FXBUS2" channels, by default we connect the EXTINs |
1850 | * to these | 1825 | * to these |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 7ef3898a7806..3c60b433de9f 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -166,11 +166,8 @@ static struct snd_pcm_hardware snd_p16v_capture_hw = { | |||
166 | static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) | 166 | static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) |
167 | { | 167 | { |
168 | struct snd_emu10k1_pcm *epcm = runtime->private_data; | 168 | struct snd_emu10k1_pcm *epcm = runtime->private_data; |
169 | 169 | ||
170 | if (epcm) { | 170 | kfree(epcm); |
171 | /* dev_dbg(emu->card->dev, "epcm free: %p\n", epcm); */ | ||
172 | kfree(epcm); | ||
173 | } | ||
174 | } | 171 | } |
175 | 172 | ||
176 | /* open_playback callback */ | 173 | /* open_playback callback */ |
@@ -640,7 +637,7 @@ int snd_p16v_free(struct snd_emu10k1 *chip) | |||
640 | return 0; | 637 | return 0; |
641 | } | 638 | } |
642 | 639 | ||
643 | int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) | 640 | int snd_p16v_pcm(struct snd_emu10k1 *emu, int device) |
644 | { | 641 | { |
645 | struct snd_pcm *pcm; | 642 | struct snd_pcm *pcm; |
646 | struct snd_pcm_substream *substream; | 643 | struct snd_pcm_substream *substream; |
@@ -649,8 +646,6 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) | |||
649 | 646 | ||
650 | /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */ | 647 | /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */ |
651 | emu->p16v_device_offset = device; | 648 | emu->p16v_device_offset = device; |
652 | if (rpcm) | ||
653 | *rpcm = NULL; | ||
654 | 649 | ||
655 | if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0) | 650 | if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0) |
656 | return err; | 651 | return err; |
@@ -694,9 +689,6 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) | |||
694 | */ | 689 | */ |
695 | } | 690 | } |
696 | 691 | ||
697 | if (rpcm) | ||
698 | *rpcm = pcm; | ||
699 | |||
700 | return 0; | 692 | return 0; |
701 | } | 693 | } |
702 | 694 | ||
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index d94cb3ca7a64..0dc44ebb0032 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * by Kurt J. Bosch | 26 | * by Kurt J. Bosch |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <asm/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
@@ -1268,14 +1268,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = { | |||
1268 | { } | 1268 | { } |
1269 | }; | 1269 | }; |
1270 | 1270 | ||
1271 | static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device, | 1271 | static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device) |
1272 | struct snd_pcm **rpcm) | ||
1273 | { | 1272 | { |
1274 | struct snd_pcm *pcm; | 1273 | struct snd_pcm *pcm; |
1275 | int err; | 1274 | int err; |
1276 | 1275 | ||
1277 | if (rpcm) | ||
1278 | *rpcm = NULL; | ||
1279 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); | 1276 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); |
1280 | if (err < 0) | 1277 | if (err < 0) |
1281 | return err; | 1278 | return err; |
@@ -1302,22 +1299,14 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device, | |||
1302 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1299 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1303 | snd_pcm_std_chmaps, 2, 0, NULL); | 1300 | snd_pcm_std_chmaps, 2, 0, NULL); |
1304 | #endif | 1301 | #endif |
1305 | if (err < 0) | 1302 | return err; |
1306 | return err; | ||
1307 | |||
1308 | if (rpcm) | ||
1309 | *rpcm = pcm; | ||
1310 | return 0; | ||
1311 | } | 1303 | } |
1312 | 1304 | ||
1313 | static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device, | 1305 | static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device) |
1314 | struct snd_pcm **rpcm) | ||
1315 | { | 1306 | { |
1316 | struct snd_pcm *pcm; | 1307 | struct snd_pcm *pcm; |
1317 | int err; | 1308 | int err; |
1318 | 1309 | ||
1319 | if (rpcm) | ||
1320 | *rpcm = NULL; | ||
1321 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); | 1310 | err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); |
1322 | if (err < 0) | 1311 | if (err < 0) |
1323 | return err; | 1312 | return err; |
@@ -1342,12 +1331,7 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device, | |||
1342 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1331 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1343 | surround_map, 2, 0, NULL); | 1332 | surround_map, 2, 0, NULL); |
1344 | #endif | 1333 | #endif |
1345 | if (err < 0) | 1334 | return err; |
1346 | return err; | ||
1347 | |||
1348 | if (rpcm) | ||
1349 | *rpcm = pcm; | ||
1350 | return 0; | ||
1351 | } | 1335 | } |
1352 | 1336 | ||
1353 | /* | 1337 | /* |
@@ -2049,7 +2033,6 @@ static void snd_ensoniq_chip_init(struct ensoniq *ensoniq) | |||
2049 | #ifdef CONFIG_PM_SLEEP | 2033 | #ifdef CONFIG_PM_SLEEP |
2050 | static int snd_ensoniq_suspend(struct device *dev) | 2034 | static int snd_ensoniq_suspend(struct device *dev) |
2051 | { | 2035 | { |
2052 | struct pci_dev *pci = to_pci_dev(dev); | ||
2053 | struct snd_card *card = dev_get_drvdata(dev); | 2036 | struct snd_card *card = dev_get_drvdata(dev); |
2054 | struct ensoniq *ensoniq = card->private_data; | 2037 | struct ensoniq *ensoniq = card->private_data; |
2055 | 2038 | ||
@@ -2070,28 +2053,14 @@ static int snd_ensoniq_suspend(struct device *dev) | |||
2070 | udelay(100); | 2053 | udelay(100); |
2071 | snd_ak4531_suspend(ensoniq->u.es1370.ak4531); | 2054 | snd_ak4531_suspend(ensoniq->u.es1370.ak4531); |
2072 | #endif | 2055 | #endif |
2073 | |||
2074 | pci_disable_device(pci); | ||
2075 | pci_save_state(pci); | ||
2076 | pci_set_power_state(pci, PCI_D3hot); | ||
2077 | return 0; | 2056 | return 0; |
2078 | } | 2057 | } |
2079 | 2058 | ||
2080 | static int snd_ensoniq_resume(struct device *dev) | 2059 | static int snd_ensoniq_resume(struct device *dev) |
2081 | { | 2060 | { |
2082 | struct pci_dev *pci = to_pci_dev(dev); | ||
2083 | struct snd_card *card = dev_get_drvdata(dev); | 2061 | struct snd_card *card = dev_get_drvdata(dev); |
2084 | struct ensoniq *ensoniq = card->private_data; | 2062 | struct ensoniq *ensoniq = card->private_data; |
2085 | 2063 | ||
2086 | pci_set_power_state(pci, PCI_D0); | ||
2087 | pci_restore_state(pci); | ||
2088 | if (pci_enable_device(pci) < 0) { | ||
2089 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2090 | snd_card_disconnect(card); | ||
2091 | return -EIO; | ||
2092 | } | ||
2093 | pci_set_master(pci); | ||
2094 | |||
2095 | snd_ensoniq_chip_init(ensoniq); | 2064 | snd_ensoniq_chip_init(ensoniq); |
2096 | 2065 | ||
2097 | #ifdef CHIP1371 | 2066 | #ifdef CHIP1371 |
@@ -2362,14 +2331,11 @@ static struct snd_rawmidi_ops snd_ensoniq_midi_input = | |||
2362 | .trigger = snd_ensoniq_midi_input_trigger, | 2331 | .trigger = snd_ensoniq_midi_input_trigger, |
2363 | }; | 2332 | }; |
2364 | 2333 | ||
2365 | static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device, | 2334 | static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device) |
2366 | struct snd_rawmidi **rrawmidi) | ||
2367 | { | 2335 | { |
2368 | struct snd_rawmidi *rmidi; | 2336 | struct snd_rawmidi *rmidi; |
2369 | int err; | 2337 | int err; |
2370 | 2338 | ||
2371 | if (rrawmidi) | ||
2372 | *rrawmidi = NULL; | ||
2373 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) | 2339 | if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) |
2374 | return err; | 2340 | return err; |
2375 | strcpy(rmidi->name, CHIP_NAME); | 2341 | strcpy(rmidi->name, CHIP_NAME); |
@@ -2379,8 +2345,6 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device, | |||
2379 | SNDRV_RAWMIDI_INFO_DUPLEX; | 2345 | SNDRV_RAWMIDI_INFO_DUPLEX; |
2380 | rmidi->private_data = ensoniq; | 2346 | rmidi->private_data = ensoniq; |
2381 | ensoniq->rmidi = rmidi; | 2347 | ensoniq->rmidi = rmidi; |
2382 | if (rrawmidi) | ||
2383 | *rrawmidi = rmidi; | ||
2384 | return 0; | 2348 | return 0; |
2385 | } | 2349 | } |
2386 | 2350 | ||
@@ -2462,15 +2426,15 @@ static int snd_audiopci_probe(struct pci_dev *pci, | |||
2462 | return err; | 2426 | return err; |
2463 | } | 2427 | } |
2464 | #endif | 2428 | #endif |
2465 | if ((err = snd_ensoniq_pcm(ensoniq, 0, NULL)) < 0) { | 2429 | if ((err = snd_ensoniq_pcm(ensoniq, 0)) < 0) { |
2466 | snd_card_free(card); | 2430 | snd_card_free(card); |
2467 | return err; | 2431 | return err; |
2468 | } | 2432 | } |
2469 | if ((err = snd_ensoniq_pcm2(ensoniq, 1, NULL)) < 0) { | 2433 | if ((err = snd_ensoniq_pcm2(ensoniq, 1)) < 0) { |
2470 | snd_card_free(card); | 2434 | snd_card_free(card); |
2471 | return err; | 2435 | return err; |
2472 | } | 2436 | } |
2473 | if ((err = snd_ensoniq_midi(ensoniq, 0, NULL)) < 0) { | 2437 | if ((err = snd_ensoniq_midi(ensoniq, 0)) < 0) { |
2474 | snd_card_free(card); | 2438 | snd_card_free(card); |
2475 | return err; | 2439 | return err; |
2476 | } | 2440 | } |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 0fc46eb4e251..e1858d9d23d8 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/module.h> | 55 | #include <linux/module.h> |
56 | #include <linux/delay.h> | 56 | #include <linux/delay.h> |
57 | #include <linux/dma-mapping.h> | 57 | #include <linux/dma-mapping.h> |
58 | #include <linux/io.h> | ||
58 | #include <sound/core.h> | 59 | #include <sound/core.h> |
59 | #include <sound/control.h> | 60 | #include <sound/control.h> |
60 | #include <sound/pcm.h> | 61 | #include <sound/pcm.h> |
@@ -63,8 +64,6 @@ | |||
63 | #include <sound/initval.h> | 64 | #include <sound/initval.h> |
64 | #include <sound/tlv.h> | 65 | #include <sound/tlv.h> |
65 | 66 | ||
66 | #include <asm/io.h> | ||
67 | |||
68 | MODULE_AUTHOR("Jaromir Koutek <miri@punknet.cz>"); | 67 | MODULE_AUTHOR("Jaromir Koutek <miri@punknet.cz>"); |
69 | MODULE_DESCRIPTION("ESS Solo-1"); | 68 | MODULE_DESCRIPTION("ESS Solo-1"); |
70 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
@@ -1454,7 +1453,6 @@ static unsigned char saved_regs[SAVED_REG_SIZE+1] = { | |||
1454 | 1453 | ||
1455 | static int es1938_suspend(struct device *dev) | 1454 | static int es1938_suspend(struct device *dev) |
1456 | { | 1455 | { |
1457 | struct pci_dev *pci = to_pci_dev(dev); | ||
1458 | struct snd_card *card = dev_get_drvdata(dev); | 1456 | struct snd_card *card = dev_get_drvdata(dev); |
1459 | struct es1938 *chip = card->private_data; | 1457 | struct es1938 *chip = card->private_data; |
1460 | unsigned char *s, *d; | 1458 | unsigned char *s, *d; |
@@ -1471,9 +1469,6 @@ static int es1938_suspend(struct device *dev) | |||
1471 | free_irq(chip->irq, chip); | 1469 | free_irq(chip->irq, chip); |
1472 | chip->irq = -1; | 1470 | chip->irq = -1; |
1473 | } | 1471 | } |
1474 | pci_disable_device(pci); | ||
1475 | pci_save_state(pci); | ||
1476 | pci_set_power_state(pci, PCI_D3hot); | ||
1477 | return 0; | 1472 | return 0; |
1478 | } | 1473 | } |
1479 | 1474 | ||
@@ -1484,14 +1479,6 @@ static int es1938_resume(struct device *dev) | |||
1484 | struct es1938 *chip = card->private_data; | 1479 | struct es1938 *chip = card->private_data; |
1485 | unsigned char *s, *d; | 1480 | unsigned char *s, *d; |
1486 | 1481 | ||
1487 | pci_set_power_state(pci, PCI_D0); | ||
1488 | pci_restore_state(pci); | ||
1489 | if (pci_enable_device(pci) < 0) { | ||
1490 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1491 | snd_card_disconnect(card); | ||
1492 | return -EIO; | ||
1493 | } | ||
1494 | |||
1495 | if (request_irq(pci->irq, snd_es1938_interrupt, | 1482 | if (request_irq(pci->irq, snd_es1938_interrupt, |
1496 | IRQF_SHARED, KBUILD_MODNAME, chip)) { | 1483 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1497 | dev_err(dev, "unable to grab IRQ %d, disabling device\n", | 1484 | dev_err(dev, "unable to grab IRQ %d, disabling device\n", |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 6039700f8579..059f3846d7b8 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -94,7 +94,7 @@ | |||
94 | * places. | 94 | * places. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | #include <asm/io.h> | 97 | #include <linux/io.h> |
98 | #include <linux/delay.h> | 98 | #include <linux/delay.h> |
99 | #include <linux/interrupt.h> | 99 | #include <linux/interrupt.h> |
100 | #include <linux/init.h> | 100 | #include <linux/init.h> |
@@ -2383,7 +2383,6 @@ static void snd_es1968_start_irq(struct es1968 *chip) | |||
2383 | */ | 2383 | */ |
2384 | static int es1968_suspend(struct device *dev) | 2384 | static int es1968_suspend(struct device *dev) |
2385 | { | 2385 | { |
2386 | struct pci_dev *pci = to_pci_dev(dev); | ||
2387 | struct snd_card *card = dev_get_drvdata(dev); | 2386 | struct snd_card *card = dev_get_drvdata(dev); |
2388 | struct es1968 *chip = card->private_data; | 2387 | struct es1968 *chip = card->private_data; |
2389 | 2388 | ||
@@ -2396,16 +2395,11 @@ static int es1968_suspend(struct device *dev) | |||
2396 | snd_pcm_suspend_all(chip->pcm); | 2395 | snd_pcm_suspend_all(chip->pcm); |
2397 | snd_ac97_suspend(chip->ac97); | 2396 | snd_ac97_suspend(chip->ac97); |
2398 | snd_es1968_bob_stop(chip); | 2397 | snd_es1968_bob_stop(chip); |
2399 | |||
2400 | pci_disable_device(pci); | ||
2401 | pci_save_state(pci); | ||
2402 | pci_set_power_state(pci, PCI_D3hot); | ||
2403 | return 0; | 2398 | return 0; |
2404 | } | 2399 | } |
2405 | 2400 | ||
2406 | static int es1968_resume(struct device *dev) | 2401 | static int es1968_resume(struct device *dev) |
2407 | { | 2402 | { |
2408 | struct pci_dev *pci = to_pci_dev(dev); | ||
2409 | struct snd_card *card = dev_get_drvdata(dev); | 2403 | struct snd_card *card = dev_get_drvdata(dev); |
2410 | struct es1968 *chip = card->private_data; | 2404 | struct es1968 *chip = card->private_data; |
2411 | struct esschan *es; | 2405 | struct esschan *es; |
@@ -2413,16 +2407,6 @@ static int es1968_resume(struct device *dev) | |||
2413 | if (! chip->do_pm) | 2407 | if (! chip->do_pm) |
2414 | return 0; | 2408 | return 0; |
2415 | 2409 | ||
2416 | /* restore all our config */ | ||
2417 | pci_set_power_state(pci, PCI_D0); | ||
2418 | pci_restore_state(pci); | ||
2419 | if (pci_enable_device(pci) < 0) { | ||
2420 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2421 | snd_card_disconnect(card); | ||
2422 | return -EIO; | ||
2423 | } | ||
2424 | pci_set_master(pci); | ||
2425 | |||
2426 | snd_es1968_chip_init(chip); | 2410 | snd_es1968_chip_init(chip); |
2427 | 2411 | ||
2428 | /* need to restore the base pointers.. */ | 2412 | /* need to restore the base pointers.. */ |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index d167afffce5f..1fdd92b6f18f 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -2,8 +2,6 @@ | |||
2 | * The driver for the ForteMedia FM801 based soundcards | 2 | * The driver for the ForteMedia FM801 based soundcards |
3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
4 | * | 4 | * |
5 | * Support FM only card by Andy Shevchenko <andy@smile.org.ua> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
@@ -14,10 +12,6 @@ | |||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
16 | * | 14 | * |
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | 15 | */ |
22 | 16 | ||
23 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
@@ -704,13 +698,11 @@ static struct snd_pcm_ops snd_fm801_capture_ops = { | |||
704 | .pointer = snd_fm801_capture_pointer, | 698 | .pointer = snd_fm801_capture_pointer, |
705 | }; | 699 | }; |
706 | 700 | ||
707 | static int snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pcm **rpcm) | 701 | static int snd_fm801_pcm(struct fm801 *chip, int device) |
708 | { | 702 | { |
709 | struct snd_pcm *pcm; | 703 | struct snd_pcm *pcm; |
710 | int err; | 704 | int err; |
711 | 705 | ||
712 | if (rpcm) | ||
713 | *rpcm = NULL; | ||
714 | if ((err = snd_pcm_new(chip->card, "FM801", device, 1, 1, &pcm)) < 0) | 706 | if ((err = snd_pcm_new(chip->card, "FM801", device, 1, 1, &pcm)) < 0) |
715 | return err; | 707 | return err; |
716 | 708 | ||
@@ -726,16 +718,10 @@ static int snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pcm **rpcm) | |||
726 | snd_dma_pci_data(chip->pci), | 718 | snd_dma_pci_data(chip->pci), |
727 | chip->multichannel ? 128*1024 : 64*1024, 128*1024); | 719 | chip->multichannel ? 128*1024 : 64*1024, 128*1024); |
728 | 720 | ||
729 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 721 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
730 | snd_pcm_alt_chmaps, | 722 | snd_pcm_alt_chmaps, |
731 | chip->multichannel ? 6 : 2, 0, | 723 | chip->multichannel ? 6 : 2, 0, |
732 | NULL); | 724 | NULL); |
733 | if (err < 0) | ||
734 | return err; | ||
735 | |||
736 | if (rpcm) | ||
737 | *rpcm = pcm; | ||
738 | return 0; | ||
739 | } | 725 | } |
740 | 726 | ||
741 | /* | 727 | /* |
@@ -1186,12 +1172,6 @@ static int snd_fm801_free(struct fm801 *chip) | |||
1186 | v4l2_device_unregister(&chip->v4l2_dev); | 1172 | v4l2_device_unregister(&chip->v4l2_dev); |
1187 | } | 1173 | } |
1188 | #endif | 1174 | #endif |
1189 | if (chip->irq >= 0) | ||
1190 | free_irq(chip->irq, chip); | ||
1191 | pci_release_regions(chip->pci); | ||
1192 | pci_disable_device(chip->pci); | ||
1193 | |||
1194 | kfree(chip); | ||
1195 | return 0; | 1175 | return 0; |
1196 | } | 1176 | } |
1197 | 1177 | ||
@@ -1214,28 +1194,23 @@ static int snd_fm801_create(struct snd_card *card, | |||
1214 | }; | 1194 | }; |
1215 | 1195 | ||
1216 | *rchip = NULL; | 1196 | *rchip = NULL; |
1217 | if ((err = pci_enable_device(pci)) < 0) | 1197 | if ((err = pcim_enable_device(pci)) < 0) |
1218 | return err; | 1198 | return err; |
1219 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1199 | chip = devm_kzalloc(&pci->dev, sizeof(*chip), GFP_KERNEL); |
1220 | if (chip == NULL) { | 1200 | if (chip == NULL) |
1221 | pci_disable_device(pci); | ||
1222 | return -ENOMEM; | 1201 | return -ENOMEM; |
1223 | } | ||
1224 | spin_lock_init(&chip->reg_lock); | 1202 | spin_lock_init(&chip->reg_lock); |
1225 | chip->card = card; | 1203 | chip->card = card; |
1226 | chip->pci = pci; | 1204 | chip->pci = pci; |
1227 | chip->irq = -1; | 1205 | chip->irq = -1; |
1228 | chip->tea575x_tuner = tea575x_tuner; | 1206 | chip->tea575x_tuner = tea575x_tuner; |
1229 | if ((err = pci_request_regions(pci, "FM801")) < 0) { | 1207 | if ((err = pci_request_regions(pci, "FM801")) < 0) |
1230 | kfree(chip); | ||
1231 | pci_disable_device(pci); | ||
1232 | return err; | 1208 | return err; |
1233 | } | ||
1234 | chip->port = pci_resource_start(pci, 0); | 1209 | chip->port = pci_resource_start(pci, 0); |
1235 | if ((tea575x_tuner & TUNER_ONLY) == 0) { | 1210 | if ((tea575x_tuner & TUNER_ONLY) == 0) { |
1236 | if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, | 1211 | if (devm_request_irq(&pci->dev, pci->irq, snd_fm801_interrupt, |
1237 | KBUILD_MODNAME, chip)) { | 1212 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1238 | dev_err(card->dev, "unable to grab IRQ %d\n", chip->irq); | 1213 | dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
1239 | snd_fm801_free(chip); | 1214 | snd_fm801_free(chip); |
1240 | return -EBUSY; | 1215 | return -EBUSY; |
1241 | } | 1216 | } |
@@ -1250,12 +1225,6 @@ static int snd_fm801_create(struct snd_card *card, | |||
1250 | /* init might set tuner access method */ | 1225 | /* init might set tuner access method */ |
1251 | tea575x_tuner = chip->tea575x_tuner; | 1226 | tea575x_tuner = chip->tea575x_tuner; |
1252 | 1227 | ||
1253 | if (chip->irq >= 0 && (tea575x_tuner & TUNER_ONLY)) { | ||
1254 | pci_clear_master(pci); | ||
1255 | free_irq(chip->irq, chip); | ||
1256 | chip->irq = -1; | ||
1257 | } | ||
1258 | |||
1259 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1228 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
1260 | snd_fm801_free(chip); | 1229 | snd_fm801_free(chip); |
1261 | return err; | 1230 | return err; |
@@ -1340,7 +1309,7 @@ static int snd_card_fm801_probe(struct pci_dev *pci, | |||
1340 | if (chip->tea575x_tuner & TUNER_ONLY) | 1309 | if (chip->tea575x_tuner & TUNER_ONLY) |
1341 | goto __fm801_tuner_only; | 1310 | goto __fm801_tuner_only; |
1342 | 1311 | ||
1343 | if ((err = snd_fm801_pcm(chip, 0, NULL)) < 0) { | 1312 | if ((err = snd_fm801_pcm(chip, 0)) < 0) { |
1344 | snd_card_free(card); | 1313 | snd_card_free(card); |
1345 | return err; | 1314 | return err; |
1346 | } | 1315 | } |
@@ -1392,7 +1361,6 @@ static unsigned char saved_regs[] = { | |||
1392 | 1361 | ||
1393 | static int snd_fm801_suspend(struct device *dev) | 1362 | static int snd_fm801_suspend(struct device *dev) |
1394 | { | 1363 | { |
1395 | struct pci_dev *pci = to_pci_dev(dev); | ||
1396 | struct snd_card *card = dev_get_drvdata(dev); | 1364 | struct snd_card *card = dev_get_drvdata(dev); |
1397 | struct fm801 *chip = card->private_data; | 1365 | struct fm801 *chip = card->private_data; |
1398 | int i; | 1366 | int i; |
@@ -1404,29 +1372,15 @@ static int snd_fm801_suspend(struct device *dev) | |||
1404 | for (i = 0; i < ARRAY_SIZE(saved_regs); i++) | 1372 | for (i = 0; i < ARRAY_SIZE(saved_regs); i++) |
1405 | chip->saved_regs[i] = inw(chip->port + saved_regs[i]); | 1373 | chip->saved_regs[i] = inw(chip->port + saved_regs[i]); |
1406 | /* FIXME: tea575x suspend */ | 1374 | /* FIXME: tea575x suspend */ |
1407 | |||
1408 | pci_disable_device(pci); | ||
1409 | pci_save_state(pci); | ||
1410 | pci_set_power_state(pci, PCI_D3hot); | ||
1411 | return 0; | 1375 | return 0; |
1412 | } | 1376 | } |
1413 | 1377 | ||
1414 | static int snd_fm801_resume(struct device *dev) | 1378 | static int snd_fm801_resume(struct device *dev) |
1415 | { | 1379 | { |
1416 | struct pci_dev *pci = to_pci_dev(dev); | ||
1417 | struct snd_card *card = dev_get_drvdata(dev); | 1380 | struct snd_card *card = dev_get_drvdata(dev); |
1418 | struct fm801 *chip = card->private_data; | 1381 | struct fm801 *chip = card->private_data; |
1419 | int i; | 1382 | int i; |
1420 | 1383 | ||
1421 | pci_set_power_state(pci, PCI_D0); | ||
1422 | pci_restore_state(pci); | ||
1423 | if (pci_enable_device(pci) < 0) { | ||
1424 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1425 | snd_card_disconnect(card); | ||
1426 | return -EIO; | ||
1427 | } | ||
1428 | pci_set_master(pci); | ||
1429 | |||
1430 | snd_fm801_chip_init(chip, 1); | 1384 | snd_fm801_chip_init(chip, 1); |
1431 | snd_ac97_resume(chip->ac97); | 1385 | snd_ac97_resume(chip->ac97); |
1432 | snd_ac97_resume(chip->ac97_sec); | 1386 | snd_ac97_resume(chip->ac97_sec); |
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index ebf4c2fb99df..7f0f2c5a4e97 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -107,6 +107,7 @@ config SND_HDA_PATCH_LOADER | |||
107 | config SND_HDA_CODEC_REALTEK | 107 | config SND_HDA_CODEC_REALTEK |
108 | tristate "Build Realtek HD-audio codec support" | 108 | tristate "Build Realtek HD-audio codec support" |
109 | select SND_HDA_GENERIC | 109 | select SND_HDA_GENERIC |
110 | select INPUT | ||
110 | help | 111 | help |
111 | Say Y or M here to include Realtek HD-audio codec support in | 112 | Say Y or M here to include Realtek HD-audio codec support in |
112 | snd-hda-intel driver, such as ALC880. | 113 | snd-hda-intel driver, such as ALC880. |
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 1ede82200ee5..3f8706bb3d16 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c | |||
@@ -409,10 +409,10 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | |||
409 | /* | 409 | /* |
410 | * debug prints of the parsed results | 410 | * debug prints of the parsed results |
411 | */ | 411 | */ |
412 | codec_info(codec, "autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n", | 412 | codec_info(codec, "autoconfig for %s: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n", |
413 | cfg->line_outs, cfg->line_out_pins[0], cfg->line_out_pins[1], | 413 | codec->chip_name, cfg->line_outs, cfg->line_out_pins[0], |
414 | cfg->line_out_pins[2], cfg->line_out_pins[3], | 414 | cfg->line_out_pins[1], cfg->line_out_pins[2], |
415 | cfg->line_out_pins[4], | 415 | cfg->line_out_pins[3], cfg->line_out_pins[4], |
416 | cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" : | 416 | cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" : |
417 | (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ? | 417 | (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ? |
418 | "speaker" : "line")); | 418 | "speaker" : "line")); |
@@ -920,6 +920,8 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec, | |||
920 | codec->fixup_id = pq->value; | 920 | codec->fixup_id = pq->value; |
921 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 921 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
922 | codec->fixup_name = pq->name; | 922 | codec->fixup_name = pq->name; |
923 | codec_dbg(codec, "%s: picked fixup %s (pin match)\n", | ||
924 | codec->chip_name, codec->fixup_name); | ||
923 | #endif | 925 | #endif |
924 | codec->fixup_list = fixlist; | 926 | codec->fixup_list = fixlist; |
925 | return; | 927 | return; |
@@ -960,6 +962,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
960 | codec->fixup_list = NULL; | 962 | codec->fixup_list = NULL; |
961 | codec->fixup_name = NULL; | 963 | codec->fixup_name = NULL; |
962 | codec->fixup_id = HDA_FIXUP_ID_NO_FIXUP; | 964 | codec->fixup_id = HDA_FIXUP_ID_NO_FIXUP; |
965 | codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n", | ||
966 | codec->chip_name); | ||
963 | return; | 967 | return; |
964 | } | 968 | } |
965 | 969 | ||
@@ -969,6 +973,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
969 | codec->fixup_id = models->id; | 973 | codec->fixup_id = models->id; |
970 | codec->fixup_name = models->name; | 974 | codec->fixup_name = models->name; |
971 | codec->fixup_list = fixlist; | 975 | codec->fixup_list = fixlist; |
976 | codec_dbg(codec, "%s: picked fixup %s (model specified)\n", | ||
977 | codec->chip_name, codec->fixup_name); | ||
972 | return; | 978 | return; |
973 | } | 979 | } |
974 | models++; | 980 | models++; |
@@ -980,6 +986,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
980 | id = q->value; | 986 | id = q->value; |
981 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 987 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
982 | name = q->name; | 988 | name = q->name; |
989 | codec_dbg(codec, "%s: picked fixup %s (PCI SSID%s)\n", | ||
990 | codec->chip_name, name, q->subdevice_mask ? "" : " - vendor generic"); | ||
983 | #endif | 991 | #endif |
984 | } | 992 | } |
985 | } | 993 | } |
@@ -992,6 +1000,8 @@ void snd_hda_pick_fixup(struct hda_codec *codec, | |||
992 | id = q->value; | 1000 | id = q->value; |
993 | #ifdef CONFIG_SND_DEBUG_VERBOSE | 1001 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
994 | name = q->name; | 1002 | name = q->name; |
1003 | codec_dbg(codec, "%s: picked fixup %s (codec SSID)\n", | ||
1004 | codec->chip_name, name); | ||
995 | #endif | 1005 | #endif |
996 | break; | 1006 | break; |
997 | } | 1007 | } |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 0cfc9c8c4b4e..a2ce773bdc62 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -657,6 +657,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
657 | azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); | 657 | azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); |
658 | if (start) { | 658 | if (start) { |
659 | azx_timecounter_init(substream, 0, 0); | 659 | azx_timecounter_init(substream, 0, 0); |
660 | snd_pcm_gettime(substream->runtime, &substream->runtime->trigger_tstamp); | ||
661 | substream->runtime->trigger_tstamp_latched = true; | ||
662 | |||
660 | if (nsync > 1) { | 663 | if (nsync > 1) { |
661 | cycle_t cycle_last; | 664 | cycle_t cycle_last; |
662 | 665 | ||
@@ -939,7 +942,8 @@ static int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, | |||
939 | chip->card->dev, | 942 | chip->card->dev, |
940 | size, MAX_PREALLOC_SIZE); | 943 | size, MAX_PREALLOC_SIZE); |
941 | /* link to codec */ | 944 | /* link to codec */ |
942 | pcm->dev = &codec->dev; | 945 | for (s = 0; s < 2; s++) |
946 | pcm->streams[s].dev.parent = &codec->dev; | ||
943 | return 0; | 947 | return 0; |
944 | } | 948 | } |
945 | 949 | ||
@@ -957,7 +961,6 @@ static int azx_alloc_cmd_io(struct azx *chip) | |||
957 | dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n"); | 961 | dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n"); |
958 | return err; | 962 | return err; |
959 | } | 963 | } |
960 | EXPORT_SYMBOL_GPL(azx_alloc_cmd_io); | ||
961 | 964 | ||
962 | static void azx_init_cmd_io(struct azx *chip) | 965 | static void azx_init_cmd_io(struct azx *chip) |
963 | { | 966 | { |
@@ -1022,7 +1025,6 @@ static void azx_init_cmd_io(struct azx *chip) | |||
1022 | azx_writeb(chip, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN); | 1025 | azx_writeb(chip, RIRBCTL, AZX_RBCTL_DMA_EN | AZX_RBCTL_IRQ_EN); |
1023 | spin_unlock_irq(&chip->reg_lock); | 1026 | spin_unlock_irq(&chip->reg_lock); |
1024 | } | 1027 | } |
1025 | EXPORT_SYMBOL_GPL(azx_init_cmd_io); | ||
1026 | 1028 | ||
1027 | static void azx_free_cmd_io(struct azx *chip) | 1029 | static void azx_free_cmd_io(struct azx *chip) |
1028 | { | 1030 | { |
@@ -1032,7 +1034,6 @@ static void azx_free_cmd_io(struct azx *chip) | |||
1032 | azx_writeb(chip, CORBCTL, 0); | 1034 | azx_writeb(chip, CORBCTL, 0); |
1033 | spin_unlock_irq(&chip->reg_lock); | 1035 | spin_unlock_irq(&chip->reg_lock); |
1034 | } | 1036 | } |
1035 | EXPORT_SYMBOL_GPL(azx_free_cmd_io); | ||
1036 | 1037 | ||
1037 | static unsigned int azx_command_addr(u32 cmd) | 1038 | static unsigned int azx_command_addr(u32 cmd) |
1038 | { | 1039 | { |
@@ -1312,7 +1313,6 @@ static int azx_send_cmd(struct hda_bus *bus, unsigned int val) | |||
1312 | else | 1313 | else |
1313 | return azx_corb_send_cmd(bus, val); | 1314 | return azx_corb_send_cmd(bus, val); |
1314 | } | 1315 | } |
1315 | EXPORT_SYMBOL_GPL(azx_send_cmd); | ||
1316 | 1316 | ||
1317 | /* get a response */ | 1317 | /* get a response */ |
1318 | static unsigned int azx_get_response(struct hda_bus *bus, | 1318 | static unsigned int azx_get_response(struct hda_bus *bus, |
@@ -1326,7 +1326,6 @@ static unsigned int azx_get_response(struct hda_bus *bus, | |||
1326 | else | 1326 | else |
1327 | return azx_rirb_get_response(bus, addr); | 1327 | return azx_rirb_get_response(bus, addr); |
1328 | } | 1328 | } |
1329 | EXPORT_SYMBOL_GPL(azx_get_response); | ||
1330 | 1329 | ||
1331 | #ifdef CONFIG_SND_HDA_DSP_LOADER | 1330 | #ifdef CONFIG_SND_HDA_DSP_LOADER |
1332 | /* | 1331 | /* |
@@ -1993,4 +1992,4 @@ void azx_notifier_unregister(struct azx *chip) | |||
1993 | EXPORT_SYMBOL_GPL(azx_notifier_unregister); | 1992 | EXPORT_SYMBOL_GPL(azx_notifier_unregister); |
1994 | 1993 | ||
1995 | MODULE_LICENSE("GPL"); | 1994 | MODULE_LICENSE("GPL"); |
1996 | MODULE_DESCRIPTION("Common HDA driver funcitons"); | 1995 | MODULE_DESCRIPTION("Common HDA driver functions"); |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 014a7849e8fd..11b5a42b4ec8 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -109,7 +109,6 @@ int snd_hda_create_hwdep(struct hda_codec *codec) | |||
109 | hwdep->iface = SNDRV_HWDEP_IFACE_HDA; | 109 | hwdep->iface = SNDRV_HWDEP_IFACE_HDA; |
110 | hwdep->private_data = codec; | 110 | hwdep->private_data = codec; |
111 | hwdep->exclusive = 1; | 111 | hwdep->exclusive = 1; |
112 | hwdep->groups = snd_hda_dev_attr_groups; | ||
113 | 112 | ||
114 | hwdep->ops.open = hda_hwdep_open; | 113 | hwdep->ops.open = hda_hwdep_open; |
115 | hwdep->ops.ioctl = hda_hwdep_ioctl; | 114 | hwdep->ops.ioctl = hda_hwdep_ioctl; |
@@ -118,7 +117,11 @@ int snd_hda_create_hwdep(struct hda_codec *codec) | |||
118 | #endif | 117 | #endif |
119 | 118 | ||
120 | /* link to codec */ | 119 | /* link to codec */ |
121 | hwdep->dev = &codec->dev; | 120 | hwdep->dev.parent = &codec->dev; |
121 | |||
122 | /* for sysfs */ | ||
123 | hwdep->dev.groups = snd_hda_dev_attr_groups; | ||
124 | dev_set_drvdata(&hwdep->dev, codec); | ||
122 | 125 | ||
123 | return 0; | 126 | return 0; |
124 | } | 127 | } |
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index d4d0375ac181..714894527e06 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c | |||
@@ -18,10 +18,12 @@ | |||
18 | 18 | ||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/pci.h> | ||
22 | #include <linux/component.h> | ||
23 | #include <drm/i915_component.h> | ||
21 | #include <sound/core.h> | 24 | #include <sound/core.h> |
22 | #include <drm/i915_powerwell.h> | ||
23 | #include "hda_priv.h" | 25 | #include "hda_priv.h" |
24 | #include "hda_i915.h" | 26 | #include "hda_intel.h" |
25 | 27 | ||
26 | /* Intel HSW/BDW display HDA controller Extended Mode registers. | 28 | /* Intel HSW/BDW display HDA controller Extended Mode registers. |
27 | * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display | 29 | * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display |
@@ -31,32 +33,33 @@ | |||
31 | #define AZX_REG_EM4 0x100c | 33 | #define AZX_REG_EM4 0x100c |
32 | #define AZX_REG_EM5 0x1010 | 34 | #define AZX_REG_EM5 0x1010 |
33 | 35 | ||
34 | static int (*get_power)(void); | 36 | int hda_display_power(struct hda_intel *hda, bool enable) |
35 | static int (*put_power)(void); | ||
36 | static int (*get_cdclk)(void); | ||
37 | |||
38 | int hda_display_power(bool enable) | ||
39 | { | 37 | { |
40 | if (!get_power || !put_power) | 38 | struct i915_audio_component *acomp = &hda->audio_component; |
39 | |||
40 | if (!acomp->ops) | ||
41 | return -ENODEV; | 41 | return -ENODEV; |
42 | 42 | ||
43 | pr_debug("HDA display power %s \n", | 43 | dev_dbg(&hda->chip.pci->dev, "display power %s\n", |
44 | enable ? "Enable" : "Disable"); | 44 | enable ? "enable" : "disable"); |
45 | if (enable) | 45 | if (enable) |
46 | return get_power(); | 46 | acomp->ops->get_power(acomp->dev); |
47 | else | 47 | else |
48 | return put_power(); | 48 | acomp->ops->put_power(acomp->dev); |
49 | |||
50 | return 0; | ||
49 | } | 51 | } |
50 | 52 | ||
51 | void haswell_set_bclk(struct azx *chip) | 53 | void haswell_set_bclk(struct hda_intel *hda) |
52 | { | 54 | { |
53 | int cdclk_freq; | 55 | int cdclk_freq; |
54 | unsigned int bclk_m, bclk_n; | 56 | unsigned int bclk_m, bclk_n; |
57 | struct i915_audio_component *acomp = &hda->audio_component; | ||
55 | 58 | ||
56 | if (!get_cdclk) | 59 | if (!acomp->ops) |
57 | return; | 60 | return; |
58 | 61 | ||
59 | cdclk_freq = get_cdclk(); | 62 | cdclk_freq = acomp->ops->get_cdclk_freq(acomp->dev); |
60 | switch (cdclk_freq) { | 63 | switch (cdclk_freq) { |
61 | case 337500: | 64 | case 337500: |
62 | bclk_m = 16; | 65 | bclk_m = 16; |
@@ -80,51 +83,108 @@ void haswell_set_bclk(struct azx *chip) | |||
80 | break; | 83 | break; |
81 | } | 84 | } |
82 | 85 | ||
83 | azx_writew(chip, EM4, bclk_m); | 86 | azx_writew(&hda->chip, EM4, bclk_m); |
84 | azx_writew(chip, EM5, bclk_n); | 87 | azx_writew(&hda->chip, EM5, bclk_n); |
85 | } | 88 | } |
86 | 89 | ||
87 | 90 | static int hda_component_master_bind(struct device *dev) | |
88 | int hda_i915_init(void) | ||
89 | { | 91 | { |
90 | int err = 0; | 92 | struct snd_card *card = dev_get_drvdata(dev); |
91 | 93 | struct azx *chip = card->private_data; | |
92 | get_power = symbol_request(i915_request_power_well); | 94 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
93 | if (!get_power) { | 95 | struct i915_audio_component *acomp = &hda->audio_component; |
94 | pr_warn("hda-i915: get_power symbol get fail\n"); | 96 | int ret; |
95 | return -ENODEV; | 97 | |
98 | ret = component_bind_all(dev, acomp); | ||
99 | if (ret < 0) | ||
100 | return ret; | ||
101 | |||
102 | if (WARN_ON(!(acomp->dev && acomp->ops && acomp->ops->get_power && | ||
103 | acomp->ops->put_power && acomp->ops->get_cdclk_freq))) { | ||
104 | ret = -EINVAL; | ||
105 | goto out_unbind; | ||
96 | } | 106 | } |
97 | 107 | ||
98 | put_power = symbol_request(i915_release_power_well); | 108 | /* |
99 | if (!put_power) { | 109 | * Atm, we don't support dynamic unbinding initiated by the child |
100 | symbol_put(i915_request_power_well); | 110 | * component, so pin its containing module until we unbind. |
101 | get_power = NULL; | 111 | */ |
102 | return -ENODEV; | 112 | if (!try_module_get(acomp->ops->owner)) { |
113 | ret = -ENODEV; | ||
114 | goto out_unbind; | ||
103 | } | 115 | } |
104 | 116 | ||
105 | get_cdclk = symbol_request(i915_get_cdclk_freq); | 117 | return 0; |
106 | if (!get_cdclk) /* may have abnormal BCLK and audio playback rate */ | ||
107 | pr_warn("hda-i915: get_cdclk symbol get fail\n"); | ||
108 | 118 | ||
109 | pr_debug("HDA driver get symbol successfully from i915 module\n"); | 119 | out_unbind: |
120 | component_unbind_all(dev, acomp); | ||
110 | 121 | ||
111 | return err; | 122 | return ret; |
112 | } | 123 | } |
113 | 124 | ||
114 | int hda_i915_exit(void) | 125 | static void hda_component_master_unbind(struct device *dev) |
115 | { | 126 | { |
116 | if (get_power) { | 127 | struct snd_card *card = dev_get_drvdata(dev); |
117 | symbol_put(i915_request_power_well); | 128 | struct azx *chip = card->private_data; |
118 | get_power = NULL; | 129 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
119 | } | 130 | struct i915_audio_component *acomp = &hda->audio_component; |
120 | if (put_power) { | 131 | |
121 | symbol_put(i915_release_power_well); | 132 | module_put(acomp->ops->owner); |
122 | put_power = NULL; | 133 | component_unbind_all(dev, acomp); |
123 | } | 134 | WARN_ON(acomp->ops || acomp->dev); |
124 | if (get_cdclk) { | 135 | } |
125 | symbol_put(i915_get_cdclk_freq); | 136 | |
126 | get_cdclk = NULL; | 137 | static const struct component_master_ops hda_component_master_ops = { |
138 | .bind = hda_component_master_bind, | ||
139 | .unbind = hda_component_master_unbind, | ||
140 | }; | ||
141 | |||
142 | static int hda_component_master_match(struct device *dev, void *data) | ||
143 | { | ||
144 | /* i915 is the only supported component */ | ||
145 | return !strcmp(dev->driver->name, "i915"); | ||
146 | } | ||
147 | |||
148 | int hda_i915_init(struct hda_intel *hda) | ||
149 | { | ||
150 | struct component_match *match = NULL; | ||
151 | struct device *dev = &hda->chip.pci->dev; | ||
152 | struct i915_audio_component *acomp = &hda->audio_component; | ||
153 | int ret; | ||
154 | |||
155 | component_match_add(dev, &match, hda_component_master_match, hda); | ||
156 | ret = component_master_add_with_match(dev, &hda_component_master_ops, | ||
157 | match); | ||
158 | if (ret < 0) | ||
159 | goto out_err; | ||
160 | |||
161 | /* | ||
162 | * Atm, we don't support deferring the component binding, so make sure | ||
163 | * i915 is loaded and that the binding successfully completes. | ||
164 | */ | ||
165 | request_module("i915"); | ||
166 | |||
167 | if (!acomp->ops) { | ||
168 | ret = -ENODEV; | ||
169 | goto out_master_del; | ||
127 | } | 170 | } |
128 | 171 | ||
172 | dev_dbg(dev, "bound to i915 component master\n"); | ||
173 | |||
174 | return 0; | ||
175 | out_master_del: | ||
176 | component_master_del(dev, &hda_component_master_ops); | ||
177 | out_err: | ||
178 | dev_err(dev, "failed to add i915 component master (%d)\n", ret); | ||
179 | |||
180 | return ret; | ||
181 | } | ||
182 | |||
183 | int hda_i915_exit(struct hda_intel *hda) | ||
184 | { | ||
185 | struct device *dev = &hda->chip.pci->dev; | ||
186 | |||
187 | component_master_del(dev, &hda_component_master_ops); | ||
188 | |||
129 | return 0; | 189 | return 0; |
130 | } | 190 | } |
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h deleted file mode 100644 index e6072c627583..000000000000 --- a/sound/pci/hda/hda_i915.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify it | ||
3 | * under the terms of the GNU General Public License as published by the Free | ||
4 | * Software Foundation; either version 2 of the License, or (at your option) | ||
5 | * any later version. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
8 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
9 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
10 | * more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License along with | ||
13 | * this program; if not, write to the Free Software Foundation, Inc., 59 | ||
14 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
15 | */ | ||
16 | #ifndef __SOUND_HDA_I915_H | ||
17 | #define __SOUND_HDA_I915_H | ||
18 | |||
19 | #ifdef CONFIG_SND_HDA_I915 | ||
20 | int hda_display_power(bool enable); | ||
21 | void haswell_set_bclk(struct azx *chip); | ||
22 | int hda_i915_init(void); | ||
23 | int hda_i915_exit(void); | ||
24 | #else | ||
25 | static inline int hda_display_power(bool enable) { return 0; } | ||
26 | static inline void haswell_set_bclk(struct azx *chip) { return; } | ||
27 | static inline int hda_i915_init(void) | ||
28 | { | ||
29 | return -ENODEV; | ||
30 | } | ||
31 | static inline int hda_i915_exit(void) | ||
32 | { | ||
33 | return 0; | ||
34 | } | ||
35 | #endif | ||
36 | |||
37 | #endif | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d426a0bd6a5f..4ca3d5d02436 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -63,7 +63,7 @@ | |||
63 | #include "hda_codec.h" | 63 | #include "hda_codec.h" |
64 | #include "hda_controller.h" | 64 | #include "hda_controller.h" |
65 | #include "hda_priv.h" | 65 | #include "hda_priv.h" |
66 | #include "hda_i915.h" | 66 | #include "hda_intel.h" |
67 | 67 | ||
68 | /* position fix mode */ | 68 | /* position fix mode */ |
69 | enum { | 69 | enum { |
@@ -354,31 +354,6 @@ static char *driver_short_names[] = { | |||
354 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", | 354 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
355 | }; | 355 | }; |
356 | 356 | ||
357 | struct hda_intel { | ||
358 | struct azx chip; | ||
359 | |||
360 | /* for pending irqs */ | ||
361 | struct work_struct irq_pending_work; | ||
362 | |||
363 | /* sync probing */ | ||
364 | struct completion probe_wait; | ||
365 | struct work_struct probe_work; | ||
366 | |||
367 | /* card list (for power_save trigger) */ | ||
368 | struct list_head list; | ||
369 | |||
370 | /* extra flags */ | ||
371 | unsigned int irq_pending_warned:1; | ||
372 | |||
373 | /* VGA-switcheroo setup */ | ||
374 | unsigned int use_vga_switcheroo:1; | ||
375 | unsigned int vga_switcheroo_registered:1; | ||
376 | unsigned int init_failed:1; /* delayed init failed */ | ||
377 | |||
378 | /* secondary power domain for hdmi audio under vga device */ | ||
379 | struct dev_pm_domain hdmi_pm_domain; | ||
380 | }; | ||
381 | |||
382 | #ifdef CONFIG_X86 | 357 | #ifdef CONFIG_X86 |
383 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) | 358 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) |
384 | { | 359 | { |
@@ -795,7 +770,6 @@ static int param_set_xint(const char *val, const struct kernel_param *kp) | |||
795 | */ | 770 | */ |
796 | static int azx_suspend(struct device *dev) | 771 | static int azx_suspend(struct device *dev) |
797 | { | 772 | { |
798 | struct pci_dev *pci = to_pci_dev(dev); | ||
799 | struct snd_card *card = dev_get_drvdata(dev); | 773 | struct snd_card *card = dev_get_drvdata(dev); |
800 | struct azx *chip; | 774 | struct azx *chip; |
801 | struct hda_intel *hda; | 775 | struct hda_intel *hda; |
@@ -824,11 +798,8 @@ static int azx_suspend(struct device *dev) | |||
824 | 798 | ||
825 | if (chip->msi) | 799 | if (chip->msi) |
826 | pci_disable_msi(chip->pci); | 800 | pci_disable_msi(chip->pci); |
827 | pci_disable_device(pci); | ||
828 | pci_save_state(pci); | ||
829 | pci_set_power_state(pci, PCI_D3hot); | ||
830 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 801 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
831 | hda_display_power(false); | 802 | hda_display_power(hda, false); |
832 | return 0; | 803 | return 0; |
833 | } | 804 | } |
834 | 805 | ||
@@ -848,18 +819,9 @@ static int azx_resume(struct device *dev) | |||
848 | return 0; | 819 | return 0; |
849 | 820 | ||
850 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 821 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
851 | hda_display_power(true); | 822 | hda_display_power(hda, true); |
852 | haswell_set_bclk(chip); | 823 | haswell_set_bclk(hda); |
853 | } | ||
854 | pci_set_power_state(pci, PCI_D0); | ||
855 | pci_restore_state(pci); | ||
856 | if (pci_enable_device(pci) < 0) { | ||
857 | dev_err(chip->card->dev, | ||
858 | "pci_enable_device failed, disabling device\n"); | ||
859 | snd_card_disconnect(card); | ||
860 | return -EIO; | ||
861 | } | 824 | } |
862 | pci_set_master(pci); | ||
863 | if (chip->msi) | 825 | if (chip->msi) |
864 | if (pci_enable_msi(pci) < 0) | 826 | if (pci_enable_msi(pci) < 0) |
865 | chip->msi = 0; | 827 | chip->msi = 0; |
@@ -901,7 +863,7 @@ static int azx_runtime_suspend(struct device *dev) | |||
901 | azx_enter_link_reset(chip); | 863 | azx_enter_link_reset(chip); |
902 | azx_clear_irq_pending(chip); | 864 | azx_clear_irq_pending(chip); |
903 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 865 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
904 | hda_display_power(false); | 866 | hda_display_power(hda, false); |
905 | 867 | ||
906 | return 0; | 868 | return 0; |
907 | } | 869 | } |
@@ -927,8 +889,8 @@ static int azx_runtime_resume(struct device *dev) | |||
927 | return 0; | 889 | return 0; |
928 | 890 | ||
929 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 891 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
930 | hda_display_power(true); | 892 | hda_display_power(hda, true); |
931 | haswell_set_bclk(chip); | 893 | haswell_set_bclk(hda); |
932 | } | 894 | } |
933 | 895 | ||
934 | /* Read STATESTS before controller reset */ | 896 | /* Read STATESTS before controller reset */ |
@@ -1138,8 +1100,7 @@ static int azx_free(struct azx *chip) | |||
1138 | free_irq(chip->irq, (void*)chip); | 1100 | free_irq(chip->irq, (void*)chip); |
1139 | if (chip->msi) | 1101 | if (chip->msi) |
1140 | pci_disable_msi(chip->pci); | 1102 | pci_disable_msi(chip->pci); |
1141 | if (chip->remap_addr) | 1103 | iounmap(chip->remap_addr); |
1142 | iounmap(chip->remap_addr); | ||
1143 | 1104 | ||
1144 | azx_free_stream_pages(chip); | 1105 | azx_free_stream_pages(chip); |
1145 | if (chip->region_requested) | 1106 | if (chip->region_requested) |
@@ -1150,8 +1111,8 @@ static int azx_free(struct azx *chip) | |||
1150 | release_firmware(chip->fw); | 1111 | release_firmware(chip->fw); |
1151 | #endif | 1112 | #endif |
1152 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 1113 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
1153 | hda_display_power(false); | 1114 | hda_display_power(hda, false); |
1154 | hda_i915_exit(); | 1115 | hda_i915_exit(hda); |
1155 | } | 1116 | } |
1156 | kfree(hda); | 1117 | kfree(hda); |
1157 | 1118 | ||
@@ -1629,8 +1590,12 @@ static int azx_first_init(struct azx *chip) | |||
1629 | /* initialize chip */ | 1590 | /* initialize chip */ |
1630 | azx_init_pci(chip); | 1591 | azx_init_pci(chip); |
1631 | 1592 | ||
1632 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 1593 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
1633 | haswell_set_bclk(chip); | 1594 | struct hda_intel *hda; |
1595 | |||
1596 | hda = container_of(chip, struct hda_intel, chip); | ||
1597 | haswell_set_bclk(hda); | ||
1598 | } | ||
1634 | 1599 | ||
1635 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); | 1600 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); |
1636 | 1601 | ||
@@ -1910,13 +1875,10 @@ static int azx_probe_continue(struct azx *chip) | |||
1910 | /* Request power well for Haswell HDA controller and codec */ | 1875 | /* Request power well for Haswell HDA controller and codec */ |
1911 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { | 1876 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
1912 | #ifdef CONFIG_SND_HDA_I915 | 1877 | #ifdef CONFIG_SND_HDA_I915 |
1913 | err = hda_i915_init(); | 1878 | err = hda_i915_init(hda); |
1914 | if (err < 0) { | 1879 | if (err < 0) |
1915 | dev_err(chip->card->dev, | ||
1916 | "Error request power-well from i915\n"); | ||
1917 | goto out_free; | 1880 | goto out_free; |
1918 | } | 1881 | err = hda_display_power(hda, true); |
1919 | err = hda_display_power(true); | ||
1920 | if (err < 0) { | 1882 | if (err < 0) { |
1921 | dev_err(chip->card->dev, | 1883 | dev_err(chip->card->dev, |
1922 | "Cannot turn on display power on i915\n"); | 1884 | "Cannot turn on display power on i915\n"); |
@@ -2004,7 +1966,7 @@ static const struct pci_device_id azx_ids[] = { | |||
2004 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, | 1966 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
2005 | /* Panther Point */ | 1967 | /* Panther Point */ |
2006 | { PCI_DEVICE(0x8086, 0x1e20), | 1968 | { PCI_DEVICE(0x8086, 0x1e20), |
2007 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 1969 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
2008 | /* Lynx Point */ | 1970 | /* Lynx Point */ |
2009 | { PCI_DEVICE(0x8086, 0x8c20), | 1971 | { PCI_DEVICE(0x8086, 0x8c20), |
2010 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 1972 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
diff --git a/sound/pci/hda/hda_intel.h b/sound/pci/hda/hda_intel.h new file mode 100644 index 000000000000..348611835476 --- /dev/null +++ b/sound/pci/hda/hda_intel.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify it | ||
3 | * under the terms of the GNU General Public License as published by the Free | ||
4 | * Software Foundation; either version 2 of the License, or (at your option) | ||
5 | * any later version. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
8 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
9 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
10 | * more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License along with | ||
13 | * this program; if not, write to the Free Software Foundation, Inc., 59 | ||
14 | * Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
15 | */ | ||
16 | #ifndef __SOUND_HDA_INTEL_H | ||
17 | #define __SOUND_HDA_INTEL_H | ||
18 | |||
19 | #include <drm/i915_component.h> | ||
20 | #include "hda_priv.h" | ||
21 | |||
22 | struct hda_intel { | ||
23 | struct azx chip; | ||
24 | |||
25 | /* for pending irqs */ | ||
26 | struct work_struct irq_pending_work; | ||
27 | |||
28 | /* sync probing */ | ||
29 | struct completion probe_wait; | ||
30 | struct work_struct probe_work; | ||
31 | |||
32 | /* card list (for power_save trigger) */ | ||
33 | struct list_head list; | ||
34 | |||
35 | /* extra flags */ | ||
36 | unsigned int irq_pending_warned:1; | ||
37 | |||
38 | /* VGA-switcheroo setup */ | ||
39 | unsigned int use_vga_switcheroo:1; | ||
40 | unsigned int vga_switcheroo_registered:1; | ||
41 | unsigned int init_failed:1; /* delayed init failed */ | ||
42 | |||
43 | /* secondary power domain for hdmi audio under vga device */ | ||
44 | struct dev_pm_domain hdmi_pm_domain; | ||
45 | |||
46 | /* i915 component interface */ | ||
47 | struct i915_audio_component audio_component; | ||
48 | }; | ||
49 | |||
50 | #ifdef CONFIG_SND_HDA_I915 | ||
51 | int hda_display_power(struct hda_intel *hda, bool enable); | ||
52 | void haswell_set_bclk(struct hda_intel *hda); | ||
53 | int hda_i915_init(struct hda_intel *hda); | ||
54 | int hda_i915_exit(struct hda_intel *hda); | ||
55 | #else | ||
56 | static inline int hda_display_power(struct hda_intel *hda, bool enable) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | static inline void haswell_set_bclk(struct hda_intel *hda) { return; } | ||
61 | static inline int hda_i915_init(struct hda_intel *hda) | ||
62 | { | ||
63 | return -ENODEV; | ||
64 | } | ||
65 | static inline int hda_i915_exit(struct hda_intel *hda) | ||
66 | { | ||
67 | return 0; | ||
68 | } | ||
69 | #endif | ||
70 | |||
71 | #endif | ||
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 166e3e84b963..daf458299753 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #ifndef __SOUND_HDA_PRIV_H | 15 | #ifndef __SOUND_HDA_PRIV_H |
16 | #define __SOUND_HDA_PRIV_H | 16 | #define __SOUND_HDA_PRIV_H |
17 | 17 | ||
18 | #include <linux/clocksource.h> | 18 | #include <linux/timecounter.h> |
19 | #include <sound/core.h> | 19 | #include <sound/core.h> |
20 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
21 | 21 | ||
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 227990bc02e3..375e94f4cf52 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c | |||
@@ -329,8 +329,8 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) | |||
329 | 329 | ||
330 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 330 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
331 | hda->regs = devm_ioremap_resource(dev, res); | 331 | hda->regs = devm_ioremap_resource(dev, res); |
332 | if (IS_ERR(chip->remap_addr)) | 332 | if (IS_ERR(hda->regs)) |
333 | return PTR_ERR(chip->remap_addr); | 333 | return PTR_ERR(hda->regs); |
334 | 334 | ||
335 | chip->remap_addr = hda->regs + HDA_BAR0; | 335 | chip->remap_addr = hda->regs + HDA_BAR0; |
336 | chip->addr = res->start + HDA_BAR0; | 336 | chip->addr = res->start + HDA_BAR0; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index a9d78e275138..d285904cdb64 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -739,39 +739,6 @@ static int patch_ad1981(struct hda_codec *codec) | |||
739 | * E/F quad mic array | 739 | * E/F quad mic array |
740 | */ | 740 | */ |
741 | 741 | ||
742 | #ifdef ENABLE_AD_STATIC_QUIRKS | ||
743 | static int ad198x_ch_mode_info(struct snd_kcontrol *kcontrol, | ||
744 | struct snd_ctl_elem_info *uinfo) | ||
745 | { | ||
746 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
747 | struct ad198x_spec *spec = codec->spec; | ||
748 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, | ||
749 | spec->num_channel_mode); | ||
750 | } | ||
751 | |||
752 | static int ad198x_ch_mode_get(struct snd_kcontrol *kcontrol, | ||
753 | struct snd_ctl_elem_value *ucontrol) | ||
754 | { | ||
755 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
756 | struct ad198x_spec *spec = codec->spec; | ||
757 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, | ||
758 | spec->num_channel_mode, spec->multiout.max_channels); | ||
759 | } | ||
760 | |||
761 | static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol, | ||
762 | struct snd_ctl_elem_value *ucontrol) | ||
763 | { | ||
764 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
765 | struct ad198x_spec *spec = codec->spec; | ||
766 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, | ||
767 | spec->num_channel_mode, | ||
768 | &spec->multiout.max_channels); | ||
769 | if (err >= 0 && spec->need_dac_fix) | ||
770 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | ||
771 | return err; | ||
772 | } | ||
773 | #endif /* ENABLE_AD_STATIC_QUIRKS */ | ||
774 | |||
775 | static int ad1988_auto_smux_enum_info(struct snd_kcontrol *kcontrol, | 742 | static int ad1988_auto_smux_enum_info(struct snd_kcontrol *kcontrol, |
776 | struct snd_ctl_elem_info *uinfo) | 743 | struct snd_ctl_elem_info *uinfo) |
777 | { | 744 | { |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 65f1f4e18ea5..b2b24a8b3dac 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/dmi.h> | 30 | #include <linux/dmi.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/input.h> | ||
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/jack.h> | 34 | #include <sound/jack.h> |
34 | #include "hda_codec.h" | 35 | #include "hda_codec.h" |
@@ -120,6 +121,7 @@ struct alc_spec { | |||
120 | hda_nid_t pll_nid; | 121 | hda_nid_t pll_nid; |
121 | unsigned int pll_coef_idx, pll_coef_bit; | 122 | unsigned int pll_coef_idx, pll_coef_bit; |
122 | unsigned int coef0; | 123 | unsigned int coef0; |
124 | struct input_dev *kb_dev; | ||
123 | }; | 125 | }; |
124 | 126 | ||
125 | /* | 127 | /* |
@@ -3472,6 +3474,79 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, | |||
3472 | } | 3474 | } |
3473 | } | 3475 | } |
3474 | 3476 | ||
3477 | static void gpio2_mic_hotkey_event(struct hda_codec *codec, | ||
3478 | struct hda_jack_callback *event) | ||
3479 | { | ||
3480 | struct alc_spec *spec = codec->spec; | ||
3481 | |||
3482 | /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore | ||
3483 | send both key on and key off event for every interrupt. */ | ||
3484 | input_report_key(spec->kb_dev, KEY_MICMUTE, 1); | ||
3485 | input_sync(spec->kb_dev); | ||
3486 | input_report_key(spec->kb_dev, KEY_MICMUTE, 0); | ||
3487 | input_sync(spec->kb_dev); | ||
3488 | } | ||
3489 | |||
3490 | static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, | ||
3491 | const struct hda_fixup *fix, int action) | ||
3492 | { | ||
3493 | /* GPIO1 = set according to SKU external amp | ||
3494 | GPIO2 = mic mute hotkey | ||
3495 | GPIO3 = mute LED | ||
3496 | GPIO4 = mic mute LED */ | ||
3497 | static const struct hda_verb gpio_init[] = { | ||
3498 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e }, | ||
3499 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a }, | ||
3500 | { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 }, | ||
3501 | {} | ||
3502 | }; | ||
3503 | |||
3504 | struct alc_spec *spec = codec->spec; | ||
3505 | |||
3506 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
3507 | spec->kb_dev = input_allocate_device(); | ||
3508 | if (!spec->kb_dev) { | ||
3509 | codec_err(codec, "Out of memory (input_allocate_device)\n"); | ||
3510 | return; | ||
3511 | } | ||
3512 | spec->kb_dev->name = "Microphone Mute Button"; | ||
3513 | spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
3514 | spec->kb_dev->keybit[BIT_WORD(KEY_MICMUTE)] = BIT_MASK(KEY_MICMUTE); | ||
3515 | if (input_register_device(spec->kb_dev)) { | ||
3516 | codec_err(codec, "input_register_device failed\n"); | ||
3517 | input_free_device(spec->kb_dev); | ||
3518 | spec->kb_dev = NULL; | ||
3519 | return; | ||
3520 | } | ||
3521 | |||
3522 | snd_hda_add_verbs(codec, gpio_init); | ||
3523 | snd_hda_codec_write_cache(codec, codec->afg, 0, | ||
3524 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04); | ||
3525 | snd_hda_jack_detect_enable_callback(codec, codec->afg, | ||
3526 | gpio2_mic_hotkey_event); | ||
3527 | |||
3528 | spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook; | ||
3529 | spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook; | ||
3530 | spec->gpio_led = 0; | ||
3531 | spec->mute_led_polarity = 0; | ||
3532 | spec->gpio_mute_led_mask = 0x08; | ||
3533 | spec->gpio_mic_led_mask = 0x10; | ||
3534 | return; | ||
3535 | } | ||
3536 | |||
3537 | if (!spec->kb_dev) | ||
3538 | return; | ||
3539 | |||
3540 | switch (action) { | ||
3541 | case HDA_FIXUP_ACT_PROBE: | ||
3542 | spec->init_amp = ALC_INIT_DEFAULT; | ||
3543 | break; | ||
3544 | case HDA_FIXUP_ACT_FREE: | ||
3545 | input_unregister_device(spec->kb_dev); | ||
3546 | spec->kb_dev = NULL; | ||
3547 | } | ||
3548 | } | ||
3549 | |||
3475 | static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, | 3550 | static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, |
3476 | const struct hda_fixup *fix, int action) | 3551 | const struct hda_fixup *fix, int action) |
3477 | { | 3552 | { |
@@ -4341,6 +4416,8 @@ enum { | |||
4341 | ALC282_FIXUP_ASPIRE_V5_PINS, | 4416 | ALC282_FIXUP_ASPIRE_V5_PINS, |
4342 | ALC280_FIXUP_HP_GPIO4, | 4417 | ALC280_FIXUP_HP_GPIO4, |
4343 | ALC286_FIXUP_HP_GPIO_LED, | 4418 | ALC286_FIXUP_HP_GPIO_LED, |
4419 | ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, | ||
4420 | ALC280_FIXUP_HP_DOCK_PINS, | ||
4344 | }; | 4421 | }; |
4345 | 4422 | ||
4346 | static const struct hda_fixup alc269_fixups[] = { | 4423 | static const struct hda_fixup alc269_fixups[] = { |
@@ -4814,6 +4891,21 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4814 | .type = HDA_FIXUP_FUNC, | 4891 | .type = HDA_FIXUP_FUNC, |
4815 | .v.func = alc286_fixup_hp_gpio_led, | 4892 | .v.func = alc286_fixup_hp_gpio_led, |
4816 | }, | 4893 | }, |
4894 | [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = { | ||
4895 | .type = HDA_FIXUP_FUNC, | ||
4896 | .v.func = alc280_fixup_hp_gpio2_mic_hotkey, | ||
4897 | }, | ||
4898 | [ALC280_FIXUP_HP_DOCK_PINS] = { | ||
4899 | .type = HDA_FIXUP_PINS, | ||
4900 | .v.pins = (const struct hda_pintbl[]) { | ||
4901 | { 0x1b, 0x21011020 }, /* line-out */ | ||
4902 | { 0x1a, 0x01a1903c }, /* headset mic */ | ||
4903 | { 0x18, 0x2181103f }, /* line-in */ | ||
4904 | { }, | ||
4905 | }, | ||
4906 | .chained = true, | ||
4907 | .chain_id = ALC280_FIXUP_HP_GPIO4 | ||
4908 | }, | ||
4817 | }; | 4909 | }; |
4818 | 4910 | ||
4819 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 4911 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -4843,7 +4935,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4843 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), | 4935 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
4844 | SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), | 4936 | SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), |
4845 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), | 4937 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), |
4938 | SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY), | ||
4846 | /* ALC282 */ | 4939 | /* ALC282 */ |
4940 | SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4847 | SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4941 | SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4848 | SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4942 | SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4849 | SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | 4943 | SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), |
@@ -4856,6 +4950,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4856 | SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4950 | SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4857 | SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4951 | SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4858 | SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED), | 4952 | SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED), |
4953 | SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS), | ||
4954 | SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS), | ||
4859 | SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4955 | SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4860 | SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4956 | SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4861 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4957 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 605d14003d25..87eff3173ce9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -79,6 +79,7 @@ enum { | |||
79 | STAC_ALIENWARE_M17X, | 79 | STAC_ALIENWARE_M17X, |
80 | STAC_92HD89XX_HP_FRONT_JACK, | 80 | STAC_92HD89XX_HP_FRONT_JACK, |
81 | STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, | 81 | STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, |
82 | STAC_92HD73XX_ASUS_MOBO, | ||
82 | STAC_92HD73XX_MODELS | 83 | STAC_92HD73XX_MODELS |
83 | }; | 84 | }; |
84 | 85 | ||
@@ -99,6 +100,7 @@ enum { | |||
99 | STAC_HP_ENVY_BASS, | 100 | STAC_HP_ENVY_BASS, |
100 | STAC_HP_BNB13_EQ, | 101 | STAC_HP_BNB13_EQ, |
101 | STAC_HP_ENVY_TS_BASS, | 102 | STAC_HP_ENVY_TS_BASS, |
103 | STAC_92HD83XXX_GPIO10_EAPD, | ||
102 | STAC_92HD83XXX_MODELS | 104 | STAC_92HD83XXX_MODELS |
103 | }; | 105 | }; |
104 | 106 | ||
@@ -1910,7 +1912,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { | |||
1910 | [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { | 1912 | [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { |
1911 | .type = HDA_FIXUP_PINS, | 1913 | .type = HDA_FIXUP_PINS, |
1912 | .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, | 1914 | .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, |
1913 | } | 1915 | }, |
1916 | [STAC_92HD73XX_ASUS_MOBO] = { | ||
1917 | .type = HDA_FIXUP_PINS, | ||
1918 | .v.pins = (const struct hda_pintbl[]) { | ||
1919 | /* enable 5.1 and SPDIF out */ | ||
1920 | { 0x0c, 0x01014411 }, | ||
1921 | { 0x0d, 0x01014410 }, | ||
1922 | { 0x0e, 0x01014412 }, | ||
1923 | { 0x22, 0x014b1180 }, | ||
1924 | { } | ||
1925 | } | ||
1926 | }, | ||
1914 | }; | 1927 | }; |
1915 | 1928 | ||
1916 | static const struct hda_model_fixup stac92hd73xx_models[] = { | 1929 | static const struct hda_model_fixup stac92hd73xx_models[] = { |
@@ -1922,6 +1935,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { | |||
1922 | { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, | 1935 | { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, |
1923 | { .id = STAC_DELL_EQ, .name = "dell-eq" }, | 1936 | { .id = STAC_DELL_EQ, .name = "dell-eq" }, |
1924 | { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, | 1937 | { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, |
1938 | { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, | ||
1925 | {} | 1939 | {} |
1926 | }; | 1940 | }; |
1927 | 1941 | ||
@@ -1974,6 +1988,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { | |||
1974 | "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), | 1988 | "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), |
1975 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, | 1989 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, |
1976 | "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), | 1990 | "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), |
1991 | SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10", | ||
1992 | STAC_92HD73XX_ASUS_MOBO), | ||
1977 | {} /* terminator */ | 1993 | {} /* terminator */ |
1978 | }; | 1994 | }; |
1979 | 1995 | ||
@@ -2141,6 +2157,19 @@ static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, | |||
2141 | spec->headset_jack = 1; | 2157 | spec->headset_jack = 1; |
2142 | } | 2158 | } |
2143 | 2159 | ||
2160 | static void stac92hd83xxx_fixup_gpio10_eapd(struct hda_codec *codec, | ||
2161 | const struct hda_fixup *fix, | ||
2162 | int action) | ||
2163 | { | ||
2164 | struct sigmatel_spec *spec = codec->spec; | ||
2165 | |||
2166 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | ||
2167 | return; | ||
2168 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = | ||
2169 | spec->gpio_data = 0x10; | ||
2170 | spec->eapd_switch = 0; | ||
2171 | } | ||
2172 | |||
2144 | static const struct hda_verb hp_bnb13_eq_verbs[] = { | 2173 | static const struct hda_verb hp_bnb13_eq_verbs[] = { |
2145 | /* 44.1KHz base */ | 2174 | /* 44.1KHz base */ |
2146 | { 0x22, 0x7A6, 0x3E }, | 2175 | { 0x22, 0x7A6, 0x3E }, |
@@ -2656,6 +2685,10 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = { | |||
2656 | {} | 2685 | {} |
2657 | }, | 2686 | }, |
2658 | }, | 2687 | }, |
2688 | [STAC_92HD83XXX_GPIO10_EAPD] = { | ||
2689 | .type = HDA_FIXUP_FUNC, | ||
2690 | .v.func = stac92hd83xxx_fixup_gpio10_eapd, | ||
2691 | }, | ||
2659 | }; | 2692 | }; |
2660 | 2693 | ||
2661 | static const struct hda_model_fixup stac92hd83xxx_models[] = { | 2694 | static const struct hda_model_fixup stac92hd83xxx_models[] = { |
@@ -2861,6 +2894,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = { | |||
2861 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a, | 2894 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a, |
2862 | "HP Mini", STAC_92HD83XXX_HP_LED), | 2895 | "HP Mini", STAC_92HD83XXX_HP_LED), |
2863 | SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP), | 2896 | SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP), |
2897 | SND_PCI_QUIRK(PCI_VENDOR_ID_TOSHIBA, 0xfa91, | ||
2898 | "Toshiba Satellite S50D", STAC_92HD83XXX_GPIO10_EAPD), | ||
2864 | {} /* terminator */ | 2899 | {} /* terminator */ |
2865 | }; | 2900 | }; |
2866 | 2901 | ||
diff --git a/sound/pci/ice1712/ak4xxx.c b/sound/pci/ice1712/ak4xxx.c index 3981823f9094..179ef7a5f0d1 100644 --- a/sound/pci/ice1712/ak4xxx.c +++ b/sound/pci/ice1712/ak4xxx.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <asm/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index b039b46152c6..f7b1523e8a82 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -880,13 +880,11 @@ static struct snd_pcm_ops snd_ice1712_capture_ops = { | |||
880 | .pointer = snd_ice1712_capture_pointer, | 880 | .pointer = snd_ice1712_capture_pointer, |
881 | }; | 881 | }; |
882 | 882 | ||
883 | static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) | 883 | static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device) |
884 | { | 884 | { |
885 | struct snd_pcm *pcm; | 885 | struct snd_pcm *pcm; |
886 | int err; | 886 | int err; |
887 | 887 | ||
888 | if (rpcm) | ||
889 | *rpcm = NULL; | ||
890 | err = snd_pcm_new(ice->card, "ICE1712 consumer", device, 1, 1, &pcm); | 888 | err = snd_pcm_new(ice->card, "ICE1712 consumer", device, 1, 1, &pcm); |
891 | if (err < 0) | 889 | if (err < 0) |
892 | return err; | 890 | return err; |
@@ -902,22 +900,17 @@ static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm * | |||
902 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 900 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
903 | snd_dma_pci_data(ice->pci), 64*1024, 64*1024); | 901 | snd_dma_pci_data(ice->pci), 64*1024, 64*1024); |
904 | 902 | ||
905 | if (rpcm) | ||
906 | *rpcm = pcm; | ||
907 | |||
908 | dev_warn(ice->card->dev, | 903 | dev_warn(ice->card->dev, |
909 | "Consumer PCM code does not work well at the moment --jk\n"); | 904 | "Consumer PCM code does not work well at the moment --jk\n"); |
910 | 905 | ||
911 | return 0; | 906 | return 0; |
912 | } | 907 | } |
913 | 908 | ||
914 | static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) | 909 | static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device) |
915 | { | 910 | { |
916 | struct snd_pcm *pcm; | 911 | struct snd_pcm *pcm; |
917 | int err; | 912 | int err; |
918 | 913 | ||
919 | if (rpcm) | ||
920 | *rpcm = NULL; | ||
921 | err = snd_pcm_new(ice->card, "ICE1712 consumer (DS)", device, 6, 0, &pcm); | 914 | err = snd_pcm_new(ice->card, "ICE1712 consumer (DS)", device, 6, 0, &pcm); |
922 | if (err < 0) | 915 | if (err < 0) |
923 | return err; | 916 | return err; |
@@ -932,9 +925,6 @@ static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pc | |||
932 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 925 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
933 | snd_dma_pci_data(ice->pci), 64*1024, 128*1024); | 926 | snd_dma_pci_data(ice->pci), 64*1024, 128*1024); |
934 | 927 | ||
935 | if (rpcm) | ||
936 | *rpcm = pcm; | ||
937 | |||
938 | return 0; | 928 | return 0; |
939 | } | 929 | } |
940 | 930 | ||
@@ -1260,13 +1250,11 @@ static struct snd_pcm_ops snd_ice1712_capture_pro_ops = { | |||
1260 | .pointer = snd_ice1712_capture_pro_pointer, | 1250 | .pointer = snd_ice1712_capture_pro_pointer, |
1261 | }; | 1251 | }; |
1262 | 1252 | ||
1263 | static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) | 1253 | static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device) |
1264 | { | 1254 | { |
1265 | struct snd_pcm *pcm; | 1255 | struct snd_pcm *pcm; |
1266 | int err; | 1256 | int err; |
1267 | 1257 | ||
1268 | if (rpcm) | ||
1269 | *rpcm = NULL; | ||
1270 | err = snd_pcm_new(ice->card, "ICE1712 multi", device, 1, 1, &pcm); | 1258 | err = snd_pcm_new(ice->card, "ICE1712 multi", device, 1, 1, &pcm); |
1271 | if (err < 0) | 1259 | if (err < 0) |
1272 | return err; | 1260 | return err; |
@@ -1282,8 +1270,6 @@ static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd | |||
1282 | snd_dma_pci_data(ice->pci), 256*1024, 256*1024); | 1270 | snd_dma_pci_data(ice->pci), 256*1024, 256*1024); |
1283 | 1271 | ||
1284 | ice->pcm_pro = pcm; | 1272 | ice->pcm_pro = pcm; |
1285 | if (rpcm) | ||
1286 | *rpcm = pcm; | ||
1287 | 1273 | ||
1288 | if (ice->cs8427) { | 1274 | if (ice->cs8427) { |
1289 | /* assign channels to iec958 */ | 1275 | /* assign channels to iec958 */ |
@@ -2691,14 +2677,14 @@ static int snd_ice1712_probe(struct pci_dev *pci, | |||
2691 | c = &no_matched; | 2677 | c = &no_matched; |
2692 | __found: | 2678 | __found: |
2693 | 2679 | ||
2694 | err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL); | 2680 | err = snd_ice1712_pcm_profi(ice, pcm_dev++); |
2695 | if (err < 0) { | 2681 | if (err < 0) { |
2696 | snd_card_free(card); | 2682 | snd_card_free(card); |
2697 | return err; | 2683 | return err; |
2698 | } | 2684 | } |
2699 | 2685 | ||
2700 | if (ice_has_con_ac97(ice)) { | 2686 | if (ice_has_con_ac97(ice)) { |
2701 | err = snd_ice1712_pcm(ice, pcm_dev++, NULL); | 2687 | err = snd_ice1712_pcm(ice, pcm_dev++); |
2702 | if (err < 0) { | 2688 | if (err < 0) { |
2703 | snd_card_free(card); | 2689 | snd_card_free(card); |
2704 | return err; | 2690 | return err; |
@@ -2726,7 +2712,7 @@ static int snd_ice1712_probe(struct pci_dev *pci, | |||
2726 | } | 2712 | } |
2727 | 2713 | ||
2728 | if (ice_has_con_ac97(ice)) { | 2714 | if (ice_has_con_ac97(ice)) { |
2729 | err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL); | 2715 | err = snd_ice1712_pcm_ds(ice, pcm_dev++); |
2730 | if (err < 0) { | 2716 | if (err < 0) { |
2731 | snd_card_free(card); | 2717 | snd_card_free(card); |
2732 | return err; | 2718 | return err; |
@@ -2798,7 +2784,6 @@ static void snd_ice1712_remove(struct pci_dev *pci) | |||
2798 | #ifdef CONFIG_PM_SLEEP | 2784 | #ifdef CONFIG_PM_SLEEP |
2799 | static int snd_ice1712_suspend(struct device *dev) | 2785 | static int snd_ice1712_suspend(struct device *dev) |
2800 | { | 2786 | { |
2801 | struct pci_dev *pci = to_pci_dev(dev); | ||
2802 | struct snd_card *card = dev_get_drvdata(dev); | 2787 | struct snd_card *card = dev_get_drvdata(dev); |
2803 | struct snd_ice1712 *ice = card->private_data; | 2788 | struct snd_ice1712 *ice = card->private_data; |
2804 | 2789 | ||
@@ -2820,16 +2805,11 @@ static int snd_ice1712_suspend(struct device *dev) | |||
2820 | 2805 | ||
2821 | if (ice->pm_suspend) | 2806 | if (ice->pm_suspend) |
2822 | ice->pm_suspend(ice); | 2807 | ice->pm_suspend(ice); |
2823 | |||
2824 | pci_disable_device(pci); | ||
2825 | pci_save_state(pci); | ||
2826 | pci_set_power_state(pci, PCI_D3hot); | ||
2827 | return 0; | 2808 | return 0; |
2828 | } | 2809 | } |
2829 | 2810 | ||
2830 | static int snd_ice1712_resume(struct device *dev) | 2811 | static int snd_ice1712_resume(struct device *dev) |
2831 | { | 2812 | { |
2832 | struct pci_dev *pci = to_pci_dev(dev); | ||
2833 | struct snd_card *card = dev_get_drvdata(dev); | 2813 | struct snd_card *card = dev_get_drvdata(dev); |
2834 | struct snd_ice1712 *ice = card->private_data; | 2814 | struct snd_ice1712 *ice = card->private_data; |
2835 | int rate; | 2815 | int rate; |
@@ -2837,16 +2817,6 @@ static int snd_ice1712_resume(struct device *dev) | |||
2837 | if (!ice->pm_suspend_enabled) | 2817 | if (!ice->pm_suspend_enabled) |
2838 | return 0; | 2818 | return 0; |
2839 | 2819 | ||
2840 | pci_set_power_state(pci, PCI_D0); | ||
2841 | pci_restore_state(pci); | ||
2842 | |||
2843 | if (pci_enable_device(pci) < 0) { | ||
2844 | snd_card_disconnect(card); | ||
2845 | return -EIO; | ||
2846 | } | ||
2847 | |||
2848 | pci_set_master(pci); | ||
2849 | |||
2850 | if (ice->cur_rate) | 2820 | if (ice->cur_rate) |
2851 | rate = ice->cur_rate; | 2821 | rate = ice->cur_rate; |
2852 | else | 2822 | else |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index d73da157ea14..0b22c00642bb 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2798,7 +2798,6 @@ static void snd_vt1724_remove(struct pci_dev *pci) | |||
2798 | #ifdef CONFIG_PM_SLEEP | 2798 | #ifdef CONFIG_PM_SLEEP |
2799 | static int snd_vt1724_suspend(struct device *dev) | 2799 | static int snd_vt1724_suspend(struct device *dev) |
2800 | { | 2800 | { |
2801 | struct pci_dev *pci = to_pci_dev(dev); | ||
2802 | struct snd_card *card = dev_get_drvdata(dev); | 2801 | struct snd_card *card = dev_get_drvdata(dev); |
2803 | struct snd_ice1712 *ice = card->private_data; | 2802 | struct snd_ice1712 *ice = card->private_data; |
2804 | 2803 | ||
@@ -2821,32 +2820,17 @@ static int snd_vt1724_suspend(struct device *dev) | |||
2821 | 2820 | ||
2822 | if (ice->pm_suspend) | 2821 | if (ice->pm_suspend) |
2823 | ice->pm_suspend(ice); | 2822 | ice->pm_suspend(ice); |
2824 | |||
2825 | pci_disable_device(pci); | ||
2826 | pci_save_state(pci); | ||
2827 | pci_set_power_state(pci, PCI_D3hot); | ||
2828 | return 0; | 2823 | return 0; |
2829 | } | 2824 | } |
2830 | 2825 | ||
2831 | static int snd_vt1724_resume(struct device *dev) | 2826 | static int snd_vt1724_resume(struct device *dev) |
2832 | { | 2827 | { |
2833 | struct pci_dev *pci = to_pci_dev(dev); | ||
2834 | struct snd_card *card = dev_get_drvdata(dev); | 2828 | struct snd_card *card = dev_get_drvdata(dev); |
2835 | struct snd_ice1712 *ice = card->private_data; | 2829 | struct snd_ice1712 *ice = card->private_data; |
2836 | 2830 | ||
2837 | if (!ice->pm_suspend_enabled) | 2831 | if (!ice->pm_suspend_enabled) |
2838 | return 0; | 2832 | return 0; |
2839 | 2833 | ||
2840 | pci_set_power_state(pci, PCI_D0); | ||
2841 | pci_restore_state(pci); | ||
2842 | |||
2843 | if (pci_enable_device(pci) < 0) { | ||
2844 | snd_card_disconnect(card); | ||
2845 | return -EIO; | ||
2846 | } | ||
2847 | |||
2848 | pci_set_master(pci); | ||
2849 | |||
2850 | snd_vt1724_chip_reset(ice); | 2834 | snd_vt1724_chip_reset(ice); |
2851 | 2835 | ||
2852 | if (snd_vt1724_chip_init(ice) < 0) { | 2836 | if (snd_vt1724_chip_init(ice) < 0) { |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index a1536c1a7ed4..4f0213427152 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -491,15 +491,17 @@ static int juli_resume(struct snd_ice1712 *ice) | |||
491 | /* akm4358 un-reset, un-mute */ | 491 | /* akm4358 un-reset, un-mute */ |
492 | snd_akm4xxx_reset(ak, 0); | 492 | snd_akm4xxx_reset(ak, 0); |
493 | /* reinit ak4114 */ | 493 | /* reinit ak4114 */ |
494 | snd_ak4114_reinit(spec->ak4114); | 494 | snd_ak4114_resume(spec->ak4114); |
495 | return 0; | 495 | return 0; |
496 | } | 496 | } |
497 | 497 | ||
498 | static int juli_suspend(struct snd_ice1712 *ice) | 498 | static int juli_suspend(struct snd_ice1712 *ice) |
499 | { | 499 | { |
500 | struct snd_akm4xxx *ak = ice->akm; | 500 | struct snd_akm4xxx *ak = ice->akm; |
501 | struct juli_spec *spec = ice->spec; | ||
501 | /* akm4358 reset and soft-mute */ | 502 | /* akm4358 reset and soft-mute */ |
502 | snd_akm4xxx_reset(ak, 1); | 503 | snd_akm4xxx_reset(ak, 1); |
504 | snd_ak4114_suspend(spec->ak4114); | ||
503 | return 0; | 505 | return 0; |
504 | } | 506 | } |
505 | #endif | 507 | #endif |
diff --git a/sound/pci/ice1712/wm8766.c b/sound/pci/ice1712/wm8766.c index 21b373b2e260..f7ac8d5e862c 100644 --- a/sound/pci/ice1712/wm8766.c +++ b/sound/pci/ice1712/wm8766.c | |||
@@ -183,22 +183,6 @@ void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac) | |||
183 | snd_wm8766_write(wm, WM8766_REG_IFCTRL, val | dac); | 183 | snd_wm8766_write(wm, WM8766_REG_IFCTRL, val | dac); |
184 | } | 184 | } |
185 | 185 | ||
186 | void snd_wm8766_set_master_mode(struct snd_wm8766 *wm, u16 mode) | ||
187 | { | ||
188 | u16 val = wm->regs[WM8766_REG_DACCTRL3] & ~WM8766_DAC3_MSTR_MASK; | ||
189 | |||
190 | mode &= WM8766_DAC3_MSTR_MASK; | ||
191 | snd_wm8766_write(wm, WM8766_REG_DACCTRL3, val | mode); | ||
192 | } | ||
193 | |||
194 | void snd_wm8766_set_power(struct snd_wm8766 *wm, u16 power) | ||
195 | { | ||
196 | u16 val = wm->regs[WM8766_REG_DACCTRL3] & ~WM8766_DAC3_POWER_MASK; | ||
197 | |||
198 | power &= WM8766_DAC3_POWER_MASK; | ||
199 | snd_wm8766_write(wm, WM8766_REG_DACCTRL3, val | power); | ||
200 | } | ||
201 | |||
202 | void snd_wm8766_volume_restore(struct snd_wm8766 *wm) | 186 | void snd_wm8766_volume_restore(struct snd_wm8766 *wm) |
203 | { | 187 | { |
204 | u16 val = wm->regs[WM8766_REG_DACR1]; | 188 | u16 val = wm->regs[WM8766_REG_DACR1]; |
diff --git a/sound/pci/ice1712/wm8766.h b/sound/pci/ice1712/wm8766.h index c119f84bd2c2..18c8d9d47b38 100644 --- a/sound/pci/ice1712/wm8766.h +++ b/sound/pci/ice1712/wm8766.h | |||
@@ -155,8 +155,6 @@ struct snd_wm8766 { | |||
155 | void snd_wm8766_init(struct snd_wm8766 *wm); | 155 | void snd_wm8766_init(struct snd_wm8766 *wm); |
156 | void snd_wm8766_resume(struct snd_wm8766 *wm); | 156 | void snd_wm8766_resume(struct snd_wm8766 *wm); |
157 | void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac); | 157 | void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac); |
158 | void snd_wm8766_set_master_mode(struct snd_wm8766 *wm, u16 mode); | ||
159 | void snd_wm8766_set_power(struct snd_wm8766 *wm, u16 power); | ||
160 | void snd_wm8766_volume_restore(struct snd_wm8766 *wm); | 158 | void snd_wm8766_volume_restore(struct snd_wm8766 *wm); |
161 | int snd_wm8766_build_controls(struct snd_wm8766 *wm); | 159 | int snd_wm8766_build_controls(struct snd_wm8766 *wm); |
162 | 160 | ||
diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c index e66c0da62014..ebd2fe4b4a57 100644 --- a/sound/pci/ice1712/wm8776.c +++ b/sound/pci/ice1712/wm8776.c | |||
@@ -452,21 +452,6 @@ void snd_wm8776_resume(struct snd_wm8776 *wm) | |||
452 | snd_wm8776_write(wm, i, wm->regs[i]); | 452 | snd_wm8776_write(wm, i, wm->regs[i]); |
453 | } | 453 | } |
454 | 454 | ||
455 | void snd_wm8776_set_dac_if(struct snd_wm8776 *wm, u16 dac) | ||
456 | { | ||
457 | snd_wm8776_write(wm, WM8776_REG_DACIFCTRL, dac); | ||
458 | } | ||
459 | |||
460 | void snd_wm8776_set_adc_if(struct snd_wm8776 *wm, u16 adc) | ||
461 | { | ||
462 | snd_wm8776_write(wm, WM8776_REG_ADCIFCTRL, adc); | ||
463 | } | ||
464 | |||
465 | void snd_wm8776_set_master_mode(struct snd_wm8776 *wm, u16 mode) | ||
466 | { | ||
467 | snd_wm8776_write(wm, WM8776_REG_MSTRCTRL, mode); | ||
468 | } | ||
469 | |||
470 | void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power) | 455 | void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power) |
471 | { | 456 | { |
472 | snd_wm8776_write(wm, WM8776_REG_PWRDOWN, power); | 457 | snd_wm8776_write(wm, WM8776_REG_PWRDOWN, power); |
diff --git a/sound/pci/ice1712/wm8776.h b/sound/pci/ice1712/wm8776.h index 93a2d6971154..42acef05540c 100644 --- a/sound/pci/ice1712/wm8776.h +++ b/sound/pci/ice1712/wm8776.h | |||
@@ -216,9 +216,6 @@ struct snd_wm8776 { | |||
216 | 216 | ||
217 | void snd_wm8776_init(struct snd_wm8776 *wm); | 217 | void snd_wm8776_init(struct snd_wm8776 *wm); |
218 | void snd_wm8776_resume(struct snd_wm8776 *wm); | 218 | void snd_wm8776_resume(struct snd_wm8776 *wm); |
219 | void snd_wm8776_set_dac_if(struct snd_wm8776 *wm, u16 dac); | ||
220 | void snd_wm8776_set_adc_if(struct snd_wm8776 *wm, u16 adc); | ||
221 | void snd_wm8776_set_master_mode(struct snd_wm8776 *wm, u16 mode); | ||
222 | void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power); | 219 | void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power); |
223 | void snd_wm8776_volume_restore(struct snd_wm8776 *wm); | 220 | void snd_wm8776_volume_restore(struct snd_wm8776 *wm); |
224 | int snd_wm8776_build_controls(struct snd_wm8776 *wm); | 221 | int snd_wm8776_build_controls(struct snd_wm8776 *wm); |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 4a28252a42b9..2c5484eeb963 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <asm/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
@@ -2654,7 +2654,6 @@ static int snd_intel8x0_free(struct intel8x0 *chip) | |||
2654 | */ | 2654 | */ |
2655 | static int intel8x0_suspend(struct device *dev) | 2655 | static int intel8x0_suspend(struct device *dev) |
2656 | { | 2656 | { |
2657 | struct pci_dev *pci = to_pci_dev(dev); | ||
2658 | struct snd_card *card = dev_get_drvdata(dev); | 2657 | struct snd_card *card = dev_get_drvdata(dev); |
2659 | struct intel8x0 *chip = card->private_data; | 2658 | struct intel8x0 *chip = card->private_data; |
2660 | int i; | 2659 | int i; |
@@ -2682,12 +2681,6 @@ static int intel8x0_suspend(struct device *dev) | |||
2682 | free_irq(chip->irq, chip); | 2681 | free_irq(chip->irq, chip); |
2683 | chip->irq = -1; | 2682 | chip->irq = -1; |
2684 | } | 2683 | } |
2685 | pci_disable_device(pci); | ||
2686 | pci_save_state(pci); | ||
2687 | /* The call below may disable built-in speaker on some laptops | ||
2688 | * after S2RAM. So, don't touch it. | ||
2689 | */ | ||
2690 | /* pci_set_power_state(pci, PCI_D3hot); */ | ||
2691 | return 0; | 2684 | return 0; |
2692 | } | 2685 | } |
2693 | 2686 | ||
@@ -2698,14 +2691,6 @@ static int intel8x0_resume(struct device *dev) | |||
2698 | struct intel8x0 *chip = card->private_data; | 2691 | struct intel8x0 *chip = card->private_data; |
2699 | int i; | 2692 | int i; |
2700 | 2693 | ||
2701 | pci_set_power_state(pci, PCI_D0); | ||
2702 | pci_restore_state(pci); | ||
2703 | if (pci_enable_device(pci) < 0) { | ||
2704 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2705 | snd_card_disconnect(card); | ||
2706 | return -EIO; | ||
2707 | } | ||
2708 | pci_set_master(pci); | ||
2709 | snd_intel8x0_chip_init(chip, 0); | 2694 | snd_intel8x0_chip_init(chip, 0); |
2710 | if (request_irq(pci->irq, snd_intel8x0_interrupt, | 2695 | if (request_irq(pci->irq, snd_intel8x0_interrupt, |
2711 | IRQF_SHARED, KBUILD_MODNAME, chip)) { | 2696 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 6b40235be13c..7577f31cd504 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <asm/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
@@ -1023,7 +1023,6 @@ static int snd_intel8x0m_free(struct intel8x0m *chip) | |||
1023 | */ | 1023 | */ |
1024 | static int intel8x0m_suspend(struct device *dev) | 1024 | static int intel8x0m_suspend(struct device *dev) |
1025 | { | 1025 | { |
1026 | struct pci_dev *pci = to_pci_dev(dev); | ||
1027 | struct snd_card *card = dev_get_drvdata(dev); | 1026 | struct snd_card *card = dev_get_drvdata(dev); |
1028 | struct intel8x0m *chip = card->private_data; | 1027 | struct intel8x0m *chip = card->private_data; |
1029 | int i; | 1028 | int i; |
@@ -1036,9 +1035,6 @@ static int intel8x0m_suspend(struct device *dev) | |||
1036 | free_irq(chip->irq, chip); | 1035 | free_irq(chip->irq, chip); |
1037 | chip->irq = -1; | 1036 | chip->irq = -1; |
1038 | } | 1037 | } |
1039 | pci_disable_device(pci); | ||
1040 | pci_save_state(pci); | ||
1041 | pci_set_power_state(pci, PCI_D3hot); | ||
1042 | return 0; | 1038 | return 0; |
1043 | } | 1039 | } |
1044 | 1040 | ||
@@ -1048,14 +1044,6 @@ static int intel8x0m_resume(struct device *dev) | |||
1048 | struct snd_card *card = dev_get_drvdata(dev); | 1044 | struct snd_card *card = dev_get_drvdata(dev); |
1049 | struct intel8x0m *chip = card->private_data; | 1045 | struct intel8x0m *chip = card->private_data; |
1050 | 1046 | ||
1051 | pci_set_power_state(pci, PCI_D0); | ||
1052 | pci_restore_state(pci); | ||
1053 | if (pci_enable_device(pci) < 0) { | ||
1054 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1055 | snd_card_disconnect(card); | ||
1056 | return -EIO; | ||
1057 | } | ||
1058 | pci_set_master(pci); | ||
1059 | if (request_irq(pci->irq, snd_intel8x0m_interrupt, | 1047 | if (request_irq(pci->irq, snd_intel8x0m_interrupt, |
1060 | IRQF_SHARED, KBUILD_MODNAME, chip)) { | 1048 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1061 | dev_err(dev, "unable to grab IRQ %d, disabling device\n", | 1049 | dev_err(dev, "unable to grab IRQ %d, disabling device\n", |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 59d21c9401d2..7acbc21d642a 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/firmware.h> | 30 | #include <linux/firmware.h> |
31 | #include <linux/io.h> | ||
31 | 32 | ||
32 | #include <sound/core.h> | 33 | #include <sound/core.h> |
33 | #include <sound/info.h> | 34 | #include <sound/info.h> |
@@ -36,8 +37,6 @@ | |||
36 | #include <sound/pcm_params.h> | 37 | #include <sound/pcm_params.h> |
37 | #include <sound/initval.h> | 38 | #include <sound/initval.h> |
38 | 39 | ||
39 | #include <asm/io.h> | ||
40 | |||
41 | // ---------------------------------------------------------------------------- | 40 | // ---------------------------------------------------------------------------- |
42 | // Debug Stuff | 41 | // Debug Stuff |
43 | // ---------------------------------------------------------------------------- | 42 | // ---------------------------------------------------------------------------- |
@@ -585,8 +584,7 @@ static void snd_korg1212_SendStop(struct snd_korg1212 *korg1212) | |||
585 | korg1212->sharedBufferPtr->cardCommand = 0xffffffff; | 584 | korg1212->sharedBufferPtr->cardCommand = 0xffffffff; |
586 | /* program the timer */ | 585 | /* program the timer */ |
587 | korg1212->stop_pending_cnt = HZ; | 586 | korg1212->stop_pending_cnt = HZ; |
588 | korg1212->timer.expires = jiffies + 1; | 587 | mod_timer(&korg1212->timer, jiffies + 1); |
589 | add_timer(&korg1212->timer); | ||
590 | } | 588 | } |
591 | } | 589 | } |
592 | 590 | ||
@@ -617,8 +615,7 @@ static void snd_korg1212_timer_func(unsigned long data) | |||
617 | } else { | 615 | } else { |
618 | if (--korg1212->stop_pending_cnt > 0) { | 616 | if (--korg1212->stop_pending_cnt > 0) { |
619 | /* reprogram timer */ | 617 | /* reprogram timer */ |
620 | korg1212->timer.expires = jiffies + 1; | 618 | mod_timer(&korg1212->timer, jiffies + 1); |
621 | add_timer(&korg1212->timer); | ||
622 | } else { | 619 | } else { |
623 | snd_printd("korg1212_timer_func timeout\n"); | 620 | snd_printd("korg1212_timer_func timeout\n"); |
624 | korg1212->sharedBufferPtr->cardCommand = 0; | 621 | korg1212->sharedBufferPtr->cardCommand = 0; |
@@ -2172,9 +2169,8 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci, | |||
2172 | init_waitqueue_head(&korg1212->wait); | 2169 | init_waitqueue_head(&korg1212->wait); |
2173 | spin_lock_init(&korg1212->lock); | 2170 | spin_lock_init(&korg1212->lock); |
2174 | mutex_init(&korg1212->open_mutex); | 2171 | mutex_init(&korg1212->open_mutex); |
2175 | init_timer(&korg1212->timer); | 2172 | setup_timer(&korg1212->timer, snd_korg1212_timer_func, |
2176 | korg1212->timer.function = snd_korg1212_timer_func; | 2173 | (unsigned long)korg1212); |
2177 | korg1212->timer.data = (unsigned long)korg1212; | ||
2178 | 2174 | ||
2179 | korg1212->irq = -1; | 2175 | korg1212->irq = -1; |
2180 | korg1212->clkSource = K1212_CLKIDX_Local; | 2176 | korg1212->clkSource = K1212_CLKIDX_Local; |
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c index 4cf4be5ef82a..9ff600084973 100644 --- a/sound/pci/lola/lola.c +++ b/sound/pci/lola/lola.c | |||
@@ -551,10 +551,8 @@ static void lola_free(struct lola *chip) | |||
551 | lola_free_mixer(chip); | 551 | lola_free_mixer(chip); |
552 | if (chip->irq >= 0) | 552 | if (chip->irq >= 0) |
553 | free_irq(chip->irq, (void *)chip); | 553 | free_irq(chip->irq, (void *)chip); |
554 | if (chip->bar[0].remap_addr) | 554 | iounmap(chip->bar[0].remap_addr); |
555 | iounmap(chip->bar[0].remap_addr); | 555 | iounmap(chip->bar[1].remap_addr); |
556 | if (chip->bar[1].remap_addr) | ||
557 | iounmap(chip->bar[1].remap_addr); | ||
558 | if (chip->rb.area) | 556 | if (chip->rb.area) |
559 | snd_dma_free_pages(&chip->rb); | 557 | snd_dma_free_pages(&chip->rb); |
560 | pci_release_regions(chip->pci); | 558 | pci_release_regions(chip->pci); |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 98823d11d485..9be660993bd0 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #define CARD_NAME "ESS Maestro3/Allegro/Canyon3D-2" | 31 | #define CARD_NAME "ESS Maestro3/Allegro/Canyon3D-2" |
32 | #define DRIVER_NAME "Maestro3" | 32 | #define DRIVER_NAME "Maestro3" |
33 | 33 | ||
34 | #include <asm/io.h> | 34 | #include <linux/io.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
@@ -2395,7 +2395,6 @@ static int snd_m3_free(struct snd_m3 *chip) | |||
2395 | #ifdef CONFIG_PM_SLEEP | 2395 | #ifdef CONFIG_PM_SLEEP |
2396 | static int m3_suspend(struct device *dev) | 2396 | static int m3_suspend(struct device *dev) |
2397 | { | 2397 | { |
2398 | struct pci_dev *pci = to_pci_dev(dev); | ||
2399 | struct snd_card *card = dev_get_drvdata(dev); | 2398 | struct snd_card *card = dev_get_drvdata(dev); |
2400 | struct snd_m3 *chip = card->private_data; | 2399 | struct snd_m3 *chip = card->private_data; |
2401 | int i, dsp_index; | 2400 | int i, dsp_index; |
@@ -2421,16 +2420,11 @@ static int m3_suspend(struct device *dev) | |||
2421 | for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++) | 2420 | for (i = REV_B_DATA_MEMORY_BEGIN ; i <= REV_B_DATA_MEMORY_END; i++) |
2422 | chip->suspend_mem[dsp_index++] = | 2421 | chip->suspend_mem[dsp_index++] = |
2423 | snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i); | 2422 | snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i); |
2424 | |||
2425 | pci_disable_device(pci); | ||
2426 | pci_save_state(pci); | ||
2427 | pci_set_power_state(pci, PCI_D3hot); | ||
2428 | return 0; | 2423 | return 0; |
2429 | } | 2424 | } |
2430 | 2425 | ||
2431 | static int m3_resume(struct device *dev) | 2426 | static int m3_resume(struct device *dev) |
2432 | { | 2427 | { |
2433 | struct pci_dev *pci = to_pci_dev(dev); | ||
2434 | struct snd_card *card = dev_get_drvdata(dev); | 2428 | struct snd_card *card = dev_get_drvdata(dev); |
2435 | struct snd_m3 *chip = card->private_data; | 2429 | struct snd_m3 *chip = card->private_data; |
2436 | int i, dsp_index; | 2430 | int i, dsp_index; |
@@ -2438,15 +2432,6 @@ static int m3_resume(struct device *dev) | |||
2438 | if (chip->suspend_mem == NULL) | 2432 | if (chip->suspend_mem == NULL) |
2439 | return 0; | 2433 | return 0; |
2440 | 2434 | ||
2441 | pci_set_power_state(pci, PCI_D0); | ||
2442 | pci_restore_state(pci); | ||
2443 | if (pci_enable_device(pci) < 0) { | ||
2444 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2445 | snd_card_disconnect(card); | ||
2446 | return -EIO; | ||
2447 | } | ||
2448 | pci_set_master(pci); | ||
2449 | |||
2450 | /* first lets just bring everything back. .*/ | 2435 | /* first lets just bring everything back. .*/ |
2451 | snd_m3_outw(chip, 0, 0x54); | 2436 | snd_m3_outw(chip, 0, 0x54); |
2452 | snd_m3_outw(chip, 0, 0x56); | 2437 | snd_m3_outw(chip, 0, 0x56); |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 1faf47e81570..c3a9f39f8d61 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1114,10 +1114,9 @@ static int snd_mixart_free(struct mixart_mgr *mgr) | |||
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | /* release the i/o ports */ | 1116 | /* release the i/o ports */ |
1117 | for (i = 0; i < 2; i++) { | 1117 | for (i = 0; i < 2; ++i) |
1118 | if (mgr->mem[i].virt) | 1118 | iounmap(mgr->mem[i].virt); |
1119 | iounmap(mgr->mem[i].virt); | 1119 | |
1120 | } | ||
1121 | pci_release_regions(mgr->pci); | 1120 | pci_release_regions(mgr->pci); |
1122 | 1121 | ||
1123 | /* free flowarray */ | 1122 | /* free flowarray */ |
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c index fe80313674d9..dccf3db48fe0 100644 --- a/sound/pci/mixart/mixart_core.c +++ b/sound/pci/mixart/mixart_core.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/io.h> | ||
26 | 27 | ||
27 | #include <asm/io.h> | ||
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include "mixart.h" | 29 | #include "mixart.h" |
30 | #include "mixart_hwdep.h" | 30 | #include "mixart_hwdep.h" |
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 9996a4dead0f..5bfd3ac80db5 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <asm/io.h> | 29 | #include <linux/io.h> |
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
31 | #include "mixart.h" | 31 | #include "mixart.h" |
32 | #include "mixart_mixer.h" | 32 | #include "mixart_mixer.h" |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 4e41a4e29a1e..4735e27cc773 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <asm/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
@@ -1392,7 +1392,6 @@ snd_nm256_peek_for_sig(struct nm256 *chip) | |||
1392 | */ | 1392 | */ |
1393 | static int nm256_suspend(struct device *dev) | 1393 | static int nm256_suspend(struct device *dev) |
1394 | { | 1394 | { |
1395 | struct pci_dev *pci = to_pci_dev(dev); | ||
1396 | struct snd_card *card = dev_get_drvdata(dev); | 1395 | struct snd_card *card = dev_get_drvdata(dev); |
1397 | struct nm256 *chip = card->private_data; | 1396 | struct nm256 *chip = card->private_data; |
1398 | 1397 | ||
@@ -1400,15 +1399,11 @@ static int nm256_suspend(struct device *dev) | |||
1400 | snd_pcm_suspend_all(chip->pcm); | 1399 | snd_pcm_suspend_all(chip->pcm); |
1401 | snd_ac97_suspend(chip->ac97); | 1400 | snd_ac97_suspend(chip->ac97); |
1402 | chip->coeffs_current = 0; | 1401 | chip->coeffs_current = 0; |
1403 | pci_disable_device(pci); | ||
1404 | pci_save_state(pci); | ||
1405 | pci_set_power_state(pci, PCI_D3hot); | ||
1406 | return 0; | 1402 | return 0; |
1407 | } | 1403 | } |
1408 | 1404 | ||
1409 | static int nm256_resume(struct device *dev) | 1405 | static int nm256_resume(struct device *dev) |
1410 | { | 1406 | { |
1411 | struct pci_dev *pci = to_pci_dev(dev); | ||
1412 | struct snd_card *card = dev_get_drvdata(dev); | 1407 | struct snd_card *card = dev_get_drvdata(dev); |
1413 | struct nm256 *chip = card->private_data; | 1408 | struct nm256 *chip = card->private_data; |
1414 | int i; | 1409 | int i; |
@@ -1416,15 +1411,6 @@ static int nm256_resume(struct device *dev) | |||
1416 | /* Perform a full reset on the hardware */ | 1411 | /* Perform a full reset on the hardware */ |
1417 | chip->in_resume = 1; | 1412 | chip->in_resume = 1; |
1418 | 1413 | ||
1419 | pci_set_power_state(pci, PCI_D0); | ||
1420 | pci_restore_state(pci); | ||
1421 | if (pci_enable_device(pci) < 0) { | ||
1422 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1423 | snd_card_disconnect(card); | ||
1424 | return -EIO; | ||
1425 | } | ||
1426 | pci_set_master(pci); | ||
1427 | |||
1428 | snd_nm256_init_chip(chip); | 1414 | snd_nm256_init_chip(chip); |
1429 | 1415 | ||
1430 | /* restore ac97 */ | 1416 | /* restore ac97 */ |
@@ -1460,10 +1446,8 @@ static int snd_nm256_free(struct nm256 *chip) | |||
1460 | if (chip->irq >= 0) | 1446 | if (chip->irq >= 0) |
1461 | free_irq(chip->irq, chip); | 1447 | free_irq(chip->irq, chip); |
1462 | 1448 | ||
1463 | if (chip->cport) | 1449 | iounmap(chip->cport); |
1464 | iounmap(chip->cport); | 1450 | iounmap(chip->buffer); |
1465 | if (chip->buffer) | ||
1466 | iounmap(chip->buffer); | ||
1467 | release_and_free_resource(chip->res_cport); | 1451 | release_and_free_resource(chip->res_cport); |
1468 | release_and_free_resource(chip->res_buffer); | 1452 | release_and_free_resource(chip->res_buffer); |
1469 | 1453 | ||
diff --git a/sound/pci/oxygen/Makefile b/sound/pci/oxygen/Makefile index 8f4c409f7e45..ab085d753661 100644 --- a/sound/pci/oxygen/Makefile +++ b/sound/pci/oxygen/Makefile | |||
@@ -1,8 +1,10 @@ | |||
1 | snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o | 1 | snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o |
2 | snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o | 2 | snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o |
3 | snd-se6x-objs := se6x.o | ||
3 | snd-virtuoso-objs := virtuoso.o xonar_lib.o \ | 4 | snd-virtuoso-objs := virtuoso.o xonar_lib.o \ |
4 | xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o | 5 | xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o |
5 | 6 | ||
6 | obj-$(CONFIG_SND_OXYGEN_LIB) += snd-oxygen-lib.o | 7 | obj-$(CONFIG_SND_OXYGEN_LIB) += snd-oxygen-lib.o |
7 | obj-$(CONFIG_SND_OXYGEN) += snd-oxygen.o | 8 | obj-$(CONFIG_SND_OXYGEN) += snd-oxygen.o |
9 | obj-$(CONFIG_SND_SE6X) += snd-se6x.o | ||
8 | obj-$(CONFIG_SND_VIRTUOSO) += snd-virtuoso.o | 10 | obj-$(CONFIG_SND_VIRTUOSO) += snd-virtuoso.o |
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index c10ab077afd8..293d0b9a50c3 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -35,7 +35,7 @@ | |||
35 | #define CAPTURE_1_FROM_SPDIF 0x0080 | 35 | #define CAPTURE_1_FROM_SPDIF 0x0080 |
36 | #define CAPTURE_2_FROM_I2S_2 0x0100 | 36 | #define CAPTURE_2_FROM_I2S_2 0x0100 |
37 | #define CAPTURE_2_FROM_AC97_1 0x0200 | 37 | #define CAPTURE_2_FROM_AC97_1 0x0200 |
38 | /* CAPTURE_3_FROM_I2S_3 not implemented */ | 38 | #define CAPTURE_3_FROM_I2S_3 0x0400 |
39 | #define MIDI_OUTPUT 0x0800 | 39 | #define MIDI_OUTPUT 0x0800 |
40 | #define MIDI_INPUT 0x1000 | 40 | #define MIDI_INPUT 0x1000 |
41 | #define AC97_CD_INPUT 0x2000 | 41 | #define AC97_CD_INPUT 0x2000 |
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 4b8a32c37e31..c7851da37749 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c | |||
@@ -20,9 +20,9 @@ | |||
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/export.h> | 22 | #include <linux/export.h> |
23 | #include <linux/io.h> | ||
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
24 | #include <sound/mpu401.h> | 25 | #include <sound/mpu401.h> |
25 | #include <asm/io.h> | ||
26 | #include "oxygen.h" | 26 | #include "oxygen.h" |
27 | 27 | ||
28 | u8 oxygen_read8(struct oxygen *chip, unsigned int reg) | 28 | u8 oxygen_read8(struct oxygen *chip, unsigned int reg) |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index b67e30602473..ffff3b25fd73 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -319,11 +319,12 @@ static void oxygen_restore_eeprom(struct oxygen *chip, | |||
319 | 319 | ||
320 | static void configure_pcie_bridge(struct pci_dev *pci) | 320 | static void configure_pcie_bridge(struct pci_dev *pci) |
321 | { | 321 | { |
322 | enum { PEX811X, PI7C9X110 }; | 322 | enum { PEX811X, PI7C9X110, XIO2001 }; |
323 | static const struct pci_device_id bridge_ids[] = { | 323 | static const struct pci_device_id bridge_ids[] = { |
324 | { PCI_VDEVICE(PLX, 0x8111), .driver_data = PEX811X }, | 324 | { PCI_VDEVICE(PLX, 0x8111), .driver_data = PEX811X }, |
325 | { PCI_VDEVICE(PLX, 0x8112), .driver_data = PEX811X }, | 325 | { PCI_VDEVICE(PLX, 0x8112), .driver_data = PEX811X }, |
326 | { PCI_DEVICE(0x12d8, 0xe110), .driver_data = PI7C9X110 }, | 326 | { PCI_DEVICE(0x12d8, 0xe110), .driver_data = PI7C9X110 }, |
327 | { PCI_VDEVICE(TI, 0x8240), .driver_data = XIO2001 }, | ||
327 | { } | 328 | { } |
328 | }; | 329 | }; |
329 | struct pci_dev *bridge; | 330 | struct pci_dev *bridge; |
@@ -357,6 +358,14 @@ static void configure_pcie_bridge(struct pci_dev *pci) | |||
357 | tmp |= 1; /* park the PCI arbiter to the sound chip */ | 358 | tmp |= 1; /* park the PCI arbiter to the sound chip */ |
358 | pci_write_config_dword(bridge, 0x40, tmp); | 359 | pci_write_config_dword(bridge, 0x40, tmp); |
359 | break; | 360 | break; |
361 | |||
362 | case XIO2001: /* Texas Instruments XIO2001 PCIe/PCI bridge */ | ||
363 | pci_read_config_dword(bridge, 0xe8, &tmp); | ||
364 | tmp &= ~0xf; /* request length limit: 64 bytes */ | ||
365 | tmp &= ~(0xf << 8); | ||
366 | tmp |= 1 << 8; /* request count limit: one buffer */ | ||
367 | pci_write_config_dword(bridge, 0xe8, tmp); | ||
368 | break; | ||
360 | } | 369 | } |
361 | } | 370 | } |
362 | 371 | ||
@@ -441,9 +450,18 @@ static void oxygen_init(struct oxygen *chip) | |||
441 | oxygen_write16(chip, OXYGEN_I2S_B_FORMAT, | 450 | oxygen_write16(chip, OXYGEN_I2S_B_FORMAT, |
442 | OXYGEN_I2S_MASTER | | 451 | OXYGEN_I2S_MASTER | |
443 | OXYGEN_I2S_MUTE_MCLK); | 452 | OXYGEN_I2S_MUTE_MCLK); |
444 | oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, | 453 | if (chip->model.device_config & CAPTURE_3_FROM_I2S_3) |
445 | OXYGEN_I2S_MASTER | | 454 | oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, |
446 | OXYGEN_I2S_MUTE_MCLK); | 455 | OXYGEN_RATE_48000 | |
456 | chip->model.adc_i2s_format | | ||
457 | OXYGEN_I2S_MCLK(chip->model.adc_mclks) | | ||
458 | OXYGEN_I2S_BITS_16 | | ||
459 | OXYGEN_I2S_MASTER | | ||
460 | OXYGEN_I2S_BCLK_64); | ||
461 | else | ||
462 | oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, | ||
463 | OXYGEN_I2S_MASTER | | ||
464 | OXYGEN_I2S_MUTE_MCLK); | ||
447 | oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL, | 465 | oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL, |
448 | OXYGEN_SPDIF_OUT_ENABLE | | 466 | OXYGEN_SPDIF_OUT_ENABLE | |
449 | OXYGEN_SPDIF_LOOPBACK); | 467 | OXYGEN_SPDIF_LOOPBACK); |
@@ -728,7 +746,6 @@ EXPORT_SYMBOL(oxygen_pci_remove); | |||
728 | #ifdef CONFIG_PM_SLEEP | 746 | #ifdef CONFIG_PM_SLEEP |
729 | static int oxygen_pci_suspend(struct device *dev) | 747 | static int oxygen_pci_suspend(struct device *dev) |
730 | { | 748 | { |
731 | struct pci_dev *pci = to_pci_dev(dev); | ||
732 | struct snd_card *card = dev_get_drvdata(dev); | 749 | struct snd_card *card = dev_get_drvdata(dev); |
733 | struct oxygen *chip = card->private_data; | 750 | struct oxygen *chip = card->private_data; |
734 | unsigned int i, saved_interrupt_mask; | 751 | unsigned int i, saved_interrupt_mask; |
@@ -736,8 +753,7 @@ static int oxygen_pci_suspend(struct device *dev) | |||
736 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 753 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
737 | 754 | ||
738 | for (i = 0; i < PCM_COUNT; ++i) | 755 | for (i = 0; i < PCM_COUNT; ++i) |
739 | if (chip->streams[i]) | 756 | snd_pcm_suspend(chip->streams[i]); |
740 | snd_pcm_suspend(chip->streams[i]); | ||
741 | 757 | ||
742 | if (chip->model.suspend) | 758 | if (chip->model.suspend) |
743 | chip->model.suspend(chip); | 759 | chip->model.suspend(chip); |
@@ -753,10 +769,6 @@ static int oxygen_pci_suspend(struct device *dev) | |||
753 | flush_work(&chip->spdif_input_bits_work); | 769 | flush_work(&chip->spdif_input_bits_work); |
754 | flush_work(&chip->gpio_work); | 770 | flush_work(&chip->gpio_work); |
755 | chip->interrupt_mask = saved_interrupt_mask; | 771 | chip->interrupt_mask = saved_interrupt_mask; |
756 | |||
757 | pci_disable_device(pci); | ||
758 | pci_save_state(pci); | ||
759 | pci_set_power_state(pci, PCI_D3hot); | ||
760 | return 0; | 772 | return 0; |
761 | } | 773 | } |
762 | 774 | ||
@@ -788,20 +800,10 @@ static void oxygen_restore_ac97(struct oxygen *chip, unsigned int codec) | |||
788 | 800 | ||
789 | static int oxygen_pci_resume(struct device *dev) | 801 | static int oxygen_pci_resume(struct device *dev) |
790 | { | 802 | { |
791 | struct pci_dev *pci = to_pci_dev(dev); | ||
792 | struct snd_card *card = dev_get_drvdata(dev); | 803 | struct snd_card *card = dev_get_drvdata(dev); |
793 | struct oxygen *chip = card->private_data; | 804 | struct oxygen *chip = card->private_data; |
794 | unsigned int i; | 805 | unsigned int i; |
795 | 806 | ||
796 | pci_set_power_state(pci, PCI_D0); | ||
797 | pci_restore_state(pci); | ||
798 | if (pci_enable_device(pci) < 0) { | ||
799 | dev_err(dev, "cannot reenable device"); | ||
800 | snd_card_disconnect(card); | ||
801 | return -EIO; | ||
802 | } | ||
803 | pci_set_master(pci); | ||
804 | |||
805 | oxygen_write16(chip, OXYGEN_DMA_STATUS, 0); | 807 | oxygen_write16(chip, OXYGEN_DMA_STATUS, 0); |
806 | oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0); | 808 | oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0); |
807 | for (i = 0; i < OXYGEN_IO_SIZE; ++i) | 809 | for (i = 0; i < OXYGEN_IO_SIZE; ++i) |
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 5988e044c519..6492bca8c70f 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -786,6 +786,9 @@ static const struct snd_kcontrol_new controls[] = { | |||
786 | .get = upmix_get, | 786 | .get = upmix_get, |
787 | .put = upmix_put, | 787 | .put = upmix_put, |
788 | }, | 788 | }, |
789 | }; | ||
790 | |||
791 | static const struct snd_kcontrol_new spdif_output_controls[] = { | ||
789 | { | 792 | { |
790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 793 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
791 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), | 794 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), |
@@ -938,6 +941,33 @@ static const struct { | |||
938 | }, | 941 | }, |
939 | }, | 942 | }, |
940 | { | 943 | { |
944 | .pcm_dev = CAPTURE_3_FROM_I2S_3, | ||
945 | .controls = { | ||
946 | { | ||
947 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
948 | .name = "Analog Input Monitor Playback Switch", | ||
949 | .index = 2, | ||
950 | .info = snd_ctl_boolean_mono_info, | ||
951 | .get = monitor_get, | ||
952 | .put = monitor_put, | ||
953 | .private_value = OXYGEN_ADC_MONITOR_C, | ||
954 | }, | ||
955 | { | ||
956 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
957 | .name = "Analog Input Monitor Playback Volume", | ||
958 | .index = 2, | ||
959 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
960 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
961 | .info = monitor_volume_info, | ||
962 | .get = monitor_get, | ||
963 | .put = monitor_put, | ||
964 | .private_value = OXYGEN_ADC_MONITOR_C_HALF_VOL | ||
965 | | (1 << 8), | ||
966 | .tlv = { .p = monitor_db_scale, }, | ||
967 | }, | ||
968 | }, | ||
969 | }, | ||
970 | { | ||
941 | .pcm_dev = CAPTURE_1_FROM_SPDIF, | 971 | .pcm_dev = CAPTURE_1_FROM_SPDIF, |
942 | .controls = { | 972 | .controls = { |
943 | { | 973 | { |
@@ -1073,6 +1103,12 @@ int oxygen_mixer_init(struct oxygen *chip) | |||
1073 | err = add_controls(chip, controls, ARRAY_SIZE(controls)); | 1103 | err = add_controls(chip, controls, ARRAY_SIZE(controls)); |
1074 | if (err < 0) | 1104 | if (err < 0) |
1075 | return err; | 1105 | return err; |
1106 | if (chip->model.device_config & PLAYBACK_1_TO_SPDIF) { | ||
1107 | err = add_controls(chip, spdif_output_controls, | ||
1108 | ARRAY_SIZE(spdif_output_controls)); | ||
1109 | if (err < 0) | ||
1110 | return err; | ||
1111 | } | ||
1076 | if (chip->model.device_config & CAPTURE_1_FROM_SPDIF) { | 1112 | if (chip->model.device_config & CAPTURE_1_FROM_SPDIF) { |
1077 | err = add_controls(chip, spdif_input_controls, | 1113 | err = add_controls(chip, spdif_input_controls, |
1078 | ARRAY_SIZE(spdif_input_controls)); | 1114 | ARRAY_SIZE(spdif_input_controls)); |
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index 02828240ba15..aa2ebd1d6d12 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -144,9 +144,11 @@ static int oxygen_open(struct snd_pcm_substream *substream, | |||
144 | runtime->hw = *oxygen_hardware[channel]; | 144 | runtime->hw = *oxygen_hardware[channel]; |
145 | switch (channel) { | 145 | switch (channel) { |
146 | case PCM_C: | 146 | case PCM_C: |
147 | runtime->hw.rates &= ~(SNDRV_PCM_RATE_32000 | | 147 | if (chip->model.device_config & CAPTURE_1_FROM_SPDIF) { |
148 | SNDRV_PCM_RATE_64000); | 148 | runtime->hw.rates &= ~(SNDRV_PCM_RATE_32000 | |
149 | runtime->hw.rate_min = 44100; | 149 | SNDRV_PCM_RATE_64000); |
150 | runtime->hw.rate_min = 44100; | ||
151 | } | ||
150 | /* fall through */ | 152 | /* fall through */ |
151 | case PCM_A: | 153 | case PCM_A: |
152 | case PCM_B: | 154 | case PCM_B: |
@@ -430,17 +432,36 @@ static int oxygen_rec_c_hw_params(struct snd_pcm_substream *substream, | |||
430 | struct snd_pcm_hw_params *hw_params) | 432 | struct snd_pcm_hw_params *hw_params) |
431 | { | 433 | { |
432 | struct oxygen *chip = snd_pcm_substream_chip(substream); | 434 | struct oxygen *chip = snd_pcm_substream_chip(substream); |
435 | bool is_spdif; | ||
433 | int err; | 436 | int err; |
434 | 437 | ||
435 | err = oxygen_hw_params(substream, hw_params); | 438 | err = oxygen_hw_params(substream, hw_params); |
436 | if (err < 0) | 439 | if (err < 0) |
437 | return err; | 440 | return err; |
438 | 441 | ||
442 | is_spdif = chip->model.device_config & CAPTURE_1_FROM_SPDIF; | ||
443 | |||
439 | spin_lock_irq(&chip->reg_lock); | 444 | spin_lock_irq(&chip->reg_lock); |
440 | oxygen_write8_masked(chip, OXYGEN_REC_FORMAT, | 445 | oxygen_write8_masked(chip, OXYGEN_REC_FORMAT, |
441 | oxygen_format(hw_params) << OXYGEN_REC_FORMAT_C_SHIFT, | 446 | oxygen_format(hw_params) << OXYGEN_REC_FORMAT_C_SHIFT, |
442 | OXYGEN_REC_FORMAT_C_MASK); | 447 | OXYGEN_REC_FORMAT_C_MASK); |
448 | if (!is_spdif) | ||
449 | oxygen_write16_masked(chip, OXYGEN_I2S_C_FORMAT, | ||
450 | oxygen_rate(hw_params) | | ||
451 | chip->model.adc_i2s_format | | ||
452 | get_mclk(chip, PCM_B, hw_params) | | ||
453 | oxygen_i2s_bits(hw_params), | ||
454 | OXYGEN_I2S_RATE_MASK | | ||
455 | OXYGEN_I2S_FORMAT_MASK | | ||
456 | OXYGEN_I2S_MCLK_MASK | | ||
457 | OXYGEN_I2S_BITS_MASK); | ||
443 | spin_unlock_irq(&chip->reg_lock); | 458 | spin_unlock_irq(&chip->reg_lock); |
459 | |||
460 | if (!is_spdif) { | ||
461 | mutex_lock(&chip->mutex); | ||
462 | chip->model.set_adc_params(chip, hw_params); | ||
463 | mutex_unlock(&chip->mutex); | ||
464 | } | ||
444 | return 0; | 465 | return 0; |
445 | } | 466 | } |
446 | 467 | ||
@@ -676,11 +697,6 @@ static struct snd_pcm_ops oxygen_ac97_ops = { | |||
676 | .pointer = oxygen_pointer, | 697 | .pointer = oxygen_pointer, |
677 | }; | 698 | }; |
678 | 699 | ||
679 | static void oxygen_pcm_free(struct snd_pcm *pcm) | ||
680 | { | ||
681 | snd_pcm_lib_preallocate_free_for_all(pcm); | ||
682 | } | ||
683 | |||
684 | int oxygen_pcm_init(struct oxygen *chip) | 700 | int oxygen_pcm_init(struct oxygen *chip) |
685 | { | 701 | { |
686 | struct snd_pcm *pcm; | 702 | struct snd_pcm *pcm; |
@@ -705,7 +721,6 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
705 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | 721 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
706 | &oxygen_rec_b_ops); | 722 | &oxygen_rec_b_ops); |
707 | pcm->private_data = chip; | 723 | pcm->private_data = chip; |
708 | pcm->private_free = oxygen_pcm_free; | ||
709 | strcpy(pcm->name, "Multichannel"); | 724 | strcpy(pcm->name, "Multichannel"); |
710 | if (outs) | 725 | if (outs) |
711 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, | 726 | snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
@@ -734,7 +749,6 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
734 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | 749 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
735 | &oxygen_rec_c_ops); | 750 | &oxygen_rec_c_ops); |
736 | pcm->private_data = chip; | 751 | pcm->private_data = chip; |
737 | pcm->private_free = oxygen_pcm_free; | ||
738 | strcpy(pcm->name, "Digital"); | 752 | strcpy(pcm->name, "Digital"); |
739 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 753 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
740 | snd_dma_pci_data(chip->pci), | 754 | snd_dma_pci_data(chip->pci), |
@@ -765,12 +779,29 @@ int oxygen_pcm_init(struct oxygen *chip) | |||
765 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | 779 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
766 | &oxygen_rec_b_ops); | 780 | &oxygen_rec_b_ops); |
767 | pcm->private_data = chip; | 781 | pcm->private_data = chip; |
768 | pcm->private_free = oxygen_pcm_free; | ||
769 | strcpy(pcm->name, outs ? "Front Panel" : "Analog 2"); | 782 | strcpy(pcm->name, outs ? "Front Panel" : "Analog 2"); |
770 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 783 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
771 | snd_dma_pci_data(chip->pci), | 784 | snd_dma_pci_data(chip->pci), |
772 | DEFAULT_BUFFER_BYTES, | 785 | DEFAULT_BUFFER_BYTES, |
773 | BUFFER_BYTES_MAX); | 786 | BUFFER_BYTES_MAX); |
774 | } | 787 | } |
788 | |||
789 | ins = !!(chip->model.device_config & CAPTURE_3_FROM_I2S_3); | ||
790 | if (ins) { | ||
791 | err = snd_pcm_new(chip->card, "Analog3", 3, 0, ins, &pcm); | ||
792 | if (err < 0) | ||
793 | return err; | ||
794 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, | ||
795 | &oxygen_rec_c_ops); | ||
796 | oxygen_write8_masked(chip, OXYGEN_REC_ROUTING, | ||
797 | OXYGEN_REC_C_ROUTE_I2S_ADC_3, | ||
798 | OXYGEN_REC_C_ROUTE_MASK); | ||
799 | pcm->private_data = chip; | ||
800 | strcpy(pcm->name, "Analog 3"); | ||
801 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
802 | snd_dma_pci_data(chip->pci), | ||
803 | DEFAULT_BUFFER_BYTES, | ||
804 | BUFFER_BYTES_MAX); | ||
805 | } | ||
775 | return 0; | 806 | return 0; |
776 | } | 807 | } |
diff --git a/sound/pci/oxygen/se6x.c b/sound/pci/oxygen/se6x.c new file mode 100644 index 000000000000..f70d514c1084 --- /dev/null +++ b/sound/pci/oxygen/se6x.c | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * C-Media CMI8787 driver for the Studio Evolution SE6X | ||
3 | * | ||
4 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> | ||
5 | * | ||
6 | * This driver is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License, version 2. | ||
8 | * | ||
9 | * This driver is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this driver; if not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * CMI8787: | ||
20 | * | ||
21 | * SPI -> microcontroller (not actually used) | ||
22 | * GPIO 0 -> do. | ||
23 | * GPIO 2 -> do. | ||
24 | * | ||
25 | * DAC0 -> both PCM1792A (L+R, each in mono mode) | ||
26 | * ADC1 <- 1st PCM1804 | ||
27 | * ADC2 <- 2nd PCM1804 | ||
28 | * ADC3 <- 3rd PCM1804 | ||
29 | */ | ||
30 | |||
31 | #include <linux/pci.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <sound/core.h> | ||
34 | #include <sound/control.h> | ||
35 | #include <sound/initval.h> | ||
36 | #include <sound/pcm.h> | ||
37 | #include "oxygen.h" | ||
38 | |||
39 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | ||
40 | MODULE_DESCRIPTION("Studio Evolution SE6X driver"); | ||
41 | MODULE_LICENSE("GPL v2"); | ||
42 | MODULE_SUPPORTED_DEVICE("{{Studio Evolution,SE6X}}"); | ||
43 | |||
44 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | ||
45 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | ||
46 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | ||
47 | |||
48 | module_param_array(index, int, NULL, 0444); | ||
49 | MODULE_PARM_DESC(index, "card index"); | ||
50 | module_param_array(id, charp, NULL, 0444); | ||
51 | MODULE_PARM_DESC(id, "ID string"); | ||
52 | module_param_array(enable, bool, NULL, 0444); | ||
53 | MODULE_PARM_DESC(enable, "enable card"); | ||
54 | |||
55 | static const struct pci_device_id se6x_ids[] = { | ||
56 | { OXYGEN_PCI_SUBID(0x13f6, 0x8788) }, | ||
57 | { } | ||
58 | }; | ||
59 | MODULE_DEVICE_TABLE(pci, se6x_ids); | ||
60 | |||
61 | static void se6x_init(struct oxygen *chip) | ||
62 | { | ||
63 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, 0x005); | ||
64 | |||
65 | snd_component_add(chip->card, "PCM1792A"); | ||
66 | snd_component_add(chip->card, "PCM1804"); | ||
67 | } | ||
68 | |||
69 | static int se6x_control_filter(struct snd_kcontrol_new *template) | ||
70 | { | ||
71 | /* no DAC volume/mute */ | ||
72 | if (!strncmp(template->name, "Master Playback ", 16)) | ||
73 | return 1; | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static void se6x_cleanup(struct oxygen *chip) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | static void set_pcm1792a_params(struct oxygen *chip, | ||
82 | struct snd_pcm_hw_params *params) | ||
83 | { | ||
84 | /* nothing to do (the microcontroller monitors DAC_LRCK) */ | ||
85 | } | ||
86 | |||
87 | static void set_pcm1804_params(struct oxygen *chip, | ||
88 | struct snd_pcm_hw_params *params) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | static unsigned int se6x_adjust_dac_routing(struct oxygen *chip, | ||
93 | unsigned int play_routing) | ||
94 | { | ||
95 | /* route the same stereo pair to DAC0 and DAC1 */ | ||
96 | return ( play_routing & OXYGEN_PLAY_DAC0_SOURCE_MASK) | | ||
97 | ((play_routing << 2) & OXYGEN_PLAY_DAC1_SOURCE_MASK); | ||
98 | } | ||
99 | |||
100 | static const struct oxygen_model model_se6x = { | ||
101 | .shortname = "Studio Evolution SE6X", | ||
102 | .longname = "C-Media Oxygen HD Audio", | ||
103 | .chip = "CMI8787", | ||
104 | .init = se6x_init, | ||
105 | .control_filter = se6x_control_filter, | ||
106 | .cleanup = se6x_cleanup, | ||
107 | .set_dac_params = set_pcm1792a_params, | ||
108 | .set_adc_params = set_pcm1804_params, | ||
109 | .adjust_dac_routing = se6x_adjust_dac_routing, | ||
110 | .device_config = PLAYBACK_0_TO_I2S | | ||
111 | CAPTURE_0_FROM_I2S_1 | | ||
112 | CAPTURE_2_FROM_I2S_2 | | ||
113 | CAPTURE_3_FROM_I2S_3, | ||
114 | .dac_channels_pcm = 2, | ||
115 | .function_flags = OXYGEN_FUNCTION_SPI, | ||
116 | .dac_mclks = OXYGEN_MCLKS(256, 128, 128), | ||
117 | .adc_mclks = OXYGEN_MCLKS(256, 256, 128), | ||
118 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | ||
119 | .adc_i2s_format = OXYGEN_I2S_FORMAT_I2S, | ||
120 | }; | ||
121 | |||
122 | static int se6x_get_model(struct oxygen *chip, | ||
123 | const struct pci_device_id *pci_id) | ||
124 | { | ||
125 | chip->model = model_se6x; | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static int se6x_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | ||
130 | { | ||
131 | static int dev; | ||
132 | int err; | ||
133 | |||
134 | if (dev >= SNDRV_CARDS) | ||
135 | return -ENODEV; | ||
136 | if (!enable[dev]) { | ||
137 | ++dev; | ||
138 | return -ENOENT; | ||
139 | } | ||
140 | err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, | ||
141 | se6x_ids, se6x_get_model); | ||
142 | if (err >= 0) | ||
143 | ++dev; | ||
144 | return err; | ||
145 | } | ||
146 | |||
147 | static struct pci_driver se6x_driver = { | ||
148 | .name = KBUILD_MODNAME, | ||
149 | .id_table = se6x_ids, | ||
150 | .probe = se6x_probe, | ||
151 | .remove = oxygen_pci_remove, | ||
152 | #ifdef CONFIG_PM_SLEEP | ||
153 | .driver = { | ||
154 | .pm = &oxygen_pci_pm, | ||
155 | }, | ||
156 | #endif | ||
157 | .shutdown = oxygen_pci_shutdown, | ||
158 | }; | ||
159 | |||
160 | module_pci_driver(se6x_driver); | ||
diff --git a/sound/pci/pcxhr/pcxhr_core.c b/sound/pci/pcxhr/pcxhr_core.c index 181f7729d409..c5194f5b150a 100644 --- a/sound/pci/pcxhr/pcxhr_core.c +++ b/sound/pci/pcxhr/pcxhr_core.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/firmware.h> | 24 | #include <linux/firmware.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <asm/io.h> | 27 | #include <linux/io.h> |
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include "pcxhr.h" | 29 | #include "pcxhr.h" |
30 | #include "pcxhr_mixer.h" | 30 | #include "pcxhr_mixer.h" |
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index 15a8ce5f1f48..80633055e17e 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <asm/io.h> | 28 | #include <linux/io.h> |
29 | #include <sound/core.h> | 29 | #include <sound/core.h> |
30 | #include <sound/hwdep.h> | 30 | #include <sound/hwdep.h> |
31 | #include "pcxhr.h" | 31 | #include "pcxhr.h" |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 6abc2ac8fffb..94639d6b5fb5 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -99,7 +99,7 @@ | |||
99 | #include <linux/firmware.h> | 99 | #include <linux/firmware.h> |
100 | #include <linux/kernel.h> | 100 | #include <linux/kernel.h> |
101 | #include <linux/module.h> | 101 | #include <linux/module.h> |
102 | #include <asm/io.h> | 102 | #include <linux/io.h> |
103 | #include <sound/core.h> | 103 | #include <sound/core.h> |
104 | #include <sound/info.h> | 104 | #include <sound/info.h> |
105 | #include <sound/control.h> | 105 | #include <sound/control.h> |
@@ -1153,7 +1153,6 @@ static void riptide_handleirq(unsigned long dev_id) | |||
1153 | #ifdef CONFIG_PM_SLEEP | 1153 | #ifdef CONFIG_PM_SLEEP |
1154 | static int riptide_suspend(struct device *dev) | 1154 | static int riptide_suspend(struct device *dev) |
1155 | { | 1155 | { |
1156 | struct pci_dev *pci = to_pci_dev(dev); | ||
1157 | struct snd_card *card = dev_get_drvdata(dev); | 1156 | struct snd_card *card = dev_get_drvdata(dev); |
1158 | struct snd_riptide *chip = card->private_data; | 1157 | struct snd_riptide *chip = card->private_data; |
1159 | 1158 | ||
@@ -1161,27 +1160,14 @@ static int riptide_suspend(struct device *dev) | |||
1161 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 1160 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1162 | snd_pcm_suspend_all(chip->pcm); | 1161 | snd_pcm_suspend_all(chip->pcm); |
1163 | snd_ac97_suspend(chip->ac97); | 1162 | snd_ac97_suspend(chip->ac97); |
1164 | pci_disable_device(pci); | ||
1165 | pci_save_state(pci); | ||
1166 | pci_set_power_state(pci, PCI_D3hot); | ||
1167 | return 0; | 1163 | return 0; |
1168 | } | 1164 | } |
1169 | 1165 | ||
1170 | static int riptide_resume(struct device *dev) | 1166 | static int riptide_resume(struct device *dev) |
1171 | { | 1167 | { |
1172 | struct pci_dev *pci = to_pci_dev(dev); | ||
1173 | struct snd_card *card = dev_get_drvdata(dev); | 1168 | struct snd_card *card = dev_get_drvdata(dev); |
1174 | struct snd_riptide *chip = card->private_data; | 1169 | struct snd_riptide *chip = card->private_data; |
1175 | 1170 | ||
1176 | pci_set_power_state(pci, PCI_D0); | ||
1177 | pci_restore_state(pci); | ||
1178 | if (pci_enable_device(pci) < 0) { | ||
1179 | printk(KERN_ERR "riptide: pci_enable_device failed, " | ||
1180 | "disabling device\n"); | ||
1181 | snd_card_disconnect(card); | ||
1182 | return -EIO; | ||
1183 | } | ||
1184 | pci_set_master(pci); | ||
1185 | snd_riptide_initialize(chip); | 1171 | snd_riptide_initialize(chip); |
1186 | snd_ac97_resume(chip->ac97); | 1172 | snd_ac97_resume(chip->ac97); |
1187 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 1173 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
@@ -1706,14 +1692,11 @@ static struct snd_pcm_ops snd_riptide_capture_ops = { | |||
1706 | .pointer = snd_riptide_pointer, | 1692 | .pointer = snd_riptide_pointer, |
1707 | }; | 1693 | }; |
1708 | 1694 | ||
1709 | static int | 1695 | static int snd_riptide_pcm(struct snd_riptide *chip, int device) |
1710 | snd_riptide_pcm(struct snd_riptide *chip, int device, struct snd_pcm **rpcm) | ||
1711 | { | 1696 | { |
1712 | struct snd_pcm *pcm; | 1697 | struct snd_pcm *pcm; |
1713 | int err; | 1698 | int err; |
1714 | 1699 | ||
1715 | if (rpcm) | ||
1716 | *rpcm = NULL; | ||
1717 | if ((err = | 1700 | if ((err = |
1718 | snd_pcm_new(chip->card, "RIPTIDE", device, PLAYBACK_SUBSTREAMS, 1, | 1701 | snd_pcm_new(chip->card, "RIPTIDE", device, PLAYBACK_SUBSTREAMS, 1, |
1719 | &pcm)) < 0) | 1702 | &pcm)) < 0) |
@@ -1729,8 +1712,6 @@ snd_riptide_pcm(struct snd_riptide *chip, int device, struct snd_pcm **rpcm) | |||
1729 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1712 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1730 | snd_dma_pci_data(chip->pci), | 1713 | snd_dma_pci_data(chip->pci), |
1731 | 64 * 1024, 128 * 1024); | 1714 | 64 * 1024, 128 * 1024); |
1732 | if (rpcm) | ||
1733 | *rpcm = pcm; | ||
1734 | return 0; | 1715 | return 0; |
1735 | } | 1716 | } |
1736 | 1717 | ||
@@ -2030,32 +2011,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) | |||
2030 | { | 2011 | { |
2031 | static int dev; | 2012 | static int dev; |
2032 | struct gameport *gameport; | 2013 | struct gameport *gameport; |
2014 | int ret; | ||
2033 | 2015 | ||
2034 | if (dev >= SNDRV_CARDS) | 2016 | if (dev >= SNDRV_CARDS) |
2035 | return -ENODEV; | 2017 | return -ENODEV; |
2018 | |||
2036 | if (!enable[dev]) { | 2019 | if (!enable[dev]) { |
2037 | dev++; | 2020 | ret = -ENOENT; |
2038 | return -ENOENT; | 2021 | goto inc_dev; |
2039 | } | 2022 | } |
2040 | 2023 | ||
2041 | if (!joystick_port[dev++]) | 2024 | if (!joystick_port[dev]) { |
2042 | return 0; | 2025 | ret = 0; |
2026 | goto inc_dev; | ||
2027 | } | ||
2043 | 2028 | ||
2044 | gameport = gameport_allocate_port(); | 2029 | gameport = gameport_allocate_port(); |
2045 | if (!gameport) | 2030 | if (!gameport) { |
2046 | return -ENOMEM; | 2031 | ret = -ENOMEM; |
2032 | goto inc_dev; | ||
2033 | } | ||
2047 | if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { | 2034 | if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { |
2048 | snd_printk(KERN_WARNING | 2035 | snd_printk(KERN_WARNING |
2049 | "Riptide: cannot grab gameport 0x%x\n", | 2036 | "Riptide: cannot grab gameport 0x%x\n", |
2050 | joystick_port[dev]); | 2037 | joystick_port[dev]); |
2051 | gameport_free_port(gameport); | 2038 | gameport_free_port(gameport); |
2052 | return -EBUSY; | 2039 | ret = -EBUSY; |
2040 | goto inc_dev; | ||
2053 | } | 2041 | } |
2054 | 2042 | ||
2055 | gameport->io = joystick_port[dev]; | 2043 | gameport->io = joystick_port[dev]; |
2056 | gameport_register_port(gameport); | 2044 | gameport_register_port(gameport); |
2057 | pci_set_drvdata(pci, gameport); | 2045 | pci_set_drvdata(pci, gameport); |
2058 | return 0; | 2046 | |
2047 | ret = 0; | ||
2048 | inc_dev: | ||
2049 | dev++; | ||
2050 | return ret; | ||
2059 | } | 2051 | } |
2060 | 2052 | ||
2061 | static void snd_riptide_joystick_remove(struct pci_dev *pci) | 2053 | static void snd_riptide_joystick_remove(struct pci_dev *pci) |
@@ -2092,7 +2084,7 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2092 | if (err < 0) | 2084 | if (err < 0) |
2093 | goto error; | 2085 | goto error; |
2094 | card->private_data = chip; | 2086 | card->private_data = chip; |
2095 | err = snd_riptide_pcm(chip, 0, NULL); | 2087 | err = snd_riptide_pcm(chip, 0); |
2096 | if (err < 0) | 2088 | if (err < 0) |
2097 | goto error; | 2089 | goto error; |
2098 | err = snd_riptide_mixer(chip); | 2090 | err = snd_riptide_mixer(chip); |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 6c60dcd2e5a1..23d7f5d30c41 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -75,6 +75,7 @@ | |||
75 | #include <linux/interrupt.h> | 75 | #include <linux/interrupt.h> |
76 | #include <linux/pci.h> | 76 | #include <linux/pci.h> |
77 | #include <linux/module.h> | 77 | #include <linux/module.h> |
78 | #include <linux/io.h> | ||
78 | 79 | ||
79 | #include <sound/core.h> | 80 | #include <sound/core.h> |
80 | #include <sound/info.h> | 81 | #include <sound/info.h> |
@@ -85,8 +86,6 @@ | |||
85 | #include <sound/asoundef.h> | 86 | #include <sound/asoundef.h> |
86 | #include <sound/initval.h> | 87 | #include <sound/initval.h> |
87 | 88 | ||
88 | #include <asm/io.h> | ||
89 | |||
90 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 89 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
91 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 90 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
92 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 91 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ |
@@ -632,7 +631,7 @@ snd_rme32_setframelog(struct rme32 * rme32, int n_channels, int is_playback) | |||
632 | } | 631 | } |
633 | } | 632 | } |
634 | 633 | ||
635 | static int snd_rme32_setformat(struct rme32 * rme32, int format) | 634 | static int snd_rme32_setformat(struct rme32 *rme32, snd_pcm_format_t format) |
636 | { | 635 | { |
637 | switch (format) { | 636 | switch (format) { |
638 | case SNDRV_PCM_FORMAT_S16_LE: | 637 | case SNDRV_PCM_FORMAT_S16_LE: |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 2f1a85185a16..2306ccf7281e 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
32 | #include <linux/io.h> | ||
32 | 33 | ||
33 | #include <sound/core.h> | 34 | #include <sound/core.h> |
34 | #include <sound/info.h> | 35 | #include <sound/info.h> |
@@ -38,8 +39,6 @@ | |||
38 | #include <sound/asoundef.h> | 39 | #include <sound/asoundef.h> |
39 | #include <sound/initval.h> | 40 | #include <sound/initval.h> |
40 | 41 | ||
41 | #include <asm/io.h> | ||
42 | |||
43 | /* note, two last pcis should be equal, it is not a bug */ | 42 | /* note, two last pcis should be equal, it is not a bug */ |
44 | 43 | ||
45 | MODULE_AUTHOR("Anders Torger <torger@ludd.luth.se>"); | 44 | MODULE_AUTHOR("Anders Torger <torger@ludd.luth.se>"); |
@@ -922,8 +921,7 @@ snd_rme96_setframelog(struct rme96 *rme96, | |||
922 | } | 921 | } |
923 | 922 | ||
924 | static int | 923 | static int |
925 | snd_rme96_playback_setformat(struct rme96 *rme96, | 924 | snd_rme96_playback_setformat(struct rme96 *rme96, snd_pcm_format_t format) |
926 | int format) | ||
927 | { | 925 | { |
928 | switch (format) { | 926 | switch (format) { |
929 | case SNDRV_PCM_FORMAT_S16_LE: | 927 | case SNDRV_PCM_FORMAT_S16_LE: |
@@ -940,8 +938,7 @@ snd_rme96_playback_setformat(struct rme96 *rme96, | |||
940 | } | 938 | } |
941 | 939 | ||
942 | static int | 940 | static int |
943 | snd_rme96_capture_setformat(struct rme96 *rme96, | 941 | snd_rme96_capture_setformat(struct rme96 *rme96, snd_pcm_format_t format) |
944 | int format) | ||
945 | { | 942 | { |
946 | switch (format) { | 943 | switch (format) { |
947 | case SNDRV_PCM_FORMAT_S16_LE: | 944 | case SNDRV_PCM_FORMAT_S16_LE: |
@@ -2358,7 +2355,6 @@ snd_rme96_create_switches(struct snd_card *card, | |||
2358 | 2355 | ||
2359 | static int rme96_suspend(struct device *dev) | 2356 | static int rme96_suspend(struct device *dev) |
2360 | { | 2357 | { |
2361 | struct pci_dev *pci = to_pci_dev(dev); | ||
2362 | struct snd_card *card = dev_get_drvdata(dev); | 2358 | struct snd_card *card = dev_get_drvdata(dev); |
2363 | struct rme96 *rme96 = card->private_data; | 2359 | struct rme96 *rme96 = card->private_data; |
2364 | 2360 | ||
@@ -2381,26 +2377,14 @@ static int rme96_suspend(struct device *dev) | |||
2381 | /* disable the DAC */ | 2377 | /* disable the DAC */ |
2382 | rme96->areg &= ~RME96_AR_DAC_EN; | 2378 | rme96->areg &= ~RME96_AR_DAC_EN; |
2383 | writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG); | 2379 | writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG); |
2384 | |||
2385 | pci_disable_device(pci); | ||
2386 | pci_save_state(pci); | ||
2387 | |||
2388 | return 0; | 2380 | return 0; |
2389 | } | 2381 | } |
2390 | 2382 | ||
2391 | static int rme96_resume(struct device *dev) | 2383 | static int rme96_resume(struct device *dev) |
2392 | { | 2384 | { |
2393 | struct pci_dev *pci = to_pci_dev(dev); | ||
2394 | struct snd_card *card = dev_get_drvdata(dev); | 2385 | struct snd_card *card = dev_get_drvdata(dev); |
2395 | struct rme96 *rme96 = card->private_data; | 2386 | struct rme96 *rme96 = card->private_data; |
2396 | 2387 | ||
2397 | pci_restore_state(pci); | ||
2398 | if (pci_enable_device(pci) < 0) { | ||
2399 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2400 | snd_card_disconnect(card); | ||
2401 | return -EIO; | ||
2402 | } | ||
2403 | |||
2404 | /* reset playback and record buffer pointers */ | 2388 | /* reset playback and record buffer pointers */ |
2405 | writel(0, rme96->iobase + RME96_IO_SET_PLAY_POS | 2389 | writel(0, rme96->iobase + RME96_IO_SET_PLAY_POS |
2406 | + rme96->playback_pointer); | 2390 | + rme96->playback_pointer); |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index cf5a6c8b9a63..c19e021ccf66 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/math64.h> | 30 | #include <linux/math64.h> |
31 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
32 | #include <linux/io.h> | ||
32 | 33 | ||
33 | #include <sound/core.h> | 34 | #include <sound/core.h> |
34 | #include <sound/control.h> | 35 | #include <sound/control.h> |
@@ -42,7 +43,6 @@ | |||
42 | 43 | ||
43 | #include <asm/byteorder.h> | 44 | #include <asm/byteorder.h> |
44 | #include <asm/current.h> | 45 | #include <asm/current.h> |
45 | #include <asm/io.h> | ||
46 | 46 | ||
47 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 47 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
48 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 48 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
@@ -1428,10 +1428,8 @@ static void snd_hdsp_midi_output_timer(unsigned long data) | |||
1428 | leaving istimer wherever it was set before. | 1428 | leaving istimer wherever it was set before. |
1429 | */ | 1429 | */ |
1430 | 1430 | ||
1431 | if (hmidi->istimer) { | 1431 | if (hmidi->istimer) |
1432 | hmidi->timer.expires = 1 + jiffies; | 1432 | mod_timer(&hmidi->timer, 1 + jiffies); |
1433 | add_timer(&hmidi->timer); | ||
1434 | } | ||
1435 | 1433 | ||
1436 | spin_unlock_irqrestore (&hmidi->lock, flags); | 1434 | spin_unlock_irqrestore (&hmidi->lock, flags); |
1437 | } | 1435 | } |
@@ -1445,11 +1443,9 @@ static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream | |||
1445 | spin_lock_irqsave (&hmidi->lock, flags); | 1443 | spin_lock_irqsave (&hmidi->lock, flags); |
1446 | if (up) { | 1444 | if (up) { |
1447 | if (!hmidi->istimer) { | 1445 | if (!hmidi->istimer) { |
1448 | init_timer(&hmidi->timer); | 1446 | setup_timer(&hmidi->timer, snd_hdsp_midi_output_timer, |
1449 | hmidi->timer.function = snd_hdsp_midi_output_timer; | 1447 | (unsigned long) hmidi); |
1450 | hmidi->timer.data = (unsigned long) hmidi; | 1448 | mod_timer(&hmidi->timer, 1 + jiffies); |
1451 | hmidi->timer.expires = 1 + jiffies; | ||
1452 | add_timer(&hmidi->timer); | ||
1453 | hmidi->istimer++; | 1449 | hmidi->istimer++; |
1454 | } | 1450 | } |
1455 | } else { | 1451 | } else { |
@@ -5309,9 +5305,7 @@ static int snd_hdsp_free(struct hdsp *hdsp) | |||
5309 | 5305 | ||
5310 | release_firmware(hdsp->firmware); | 5306 | release_firmware(hdsp->firmware); |
5311 | vfree(hdsp->fw_uploaded); | 5307 | vfree(hdsp->fw_uploaded); |
5312 | 5308 | iounmap(hdsp->iobase); | |
5313 | if (hdsp->iobase) | ||
5314 | iounmap(hdsp->iobase); | ||
5315 | 5309 | ||
5316 | if (hdsp->port) | 5310 | if (hdsp->port) |
5317 | pci_release_regions(hdsp->pci); | 5311 | pci_release_regions(hdsp->pci); |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 3342705a5715..ca67f896d117 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -136,7 +136,7 @@ | |||
136 | #include <linux/slab.h> | 136 | #include <linux/slab.h> |
137 | #include <linux/pci.h> | 137 | #include <linux/pci.h> |
138 | #include <linux/math64.h> | 138 | #include <linux/math64.h> |
139 | #include <asm/io.h> | 139 | #include <linux/io.h> |
140 | 140 | ||
141 | #include <sound/core.h> | 141 | #include <sound/core.h> |
142 | #include <sound/control.h> | 142 | #include <sound/control.h> |
@@ -1957,10 +1957,8 @@ static void snd_hdspm_midi_output_timer(unsigned long data) | |||
1957 | leaving istimer wherever it was set before. | 1957 | leaving istimer wherever it was set before. |
1958 | */ | 1958 | */ |
1959 | 1959 | ||
1960 | if (hmidi->istimer) { | 1960 | if (hmidi->istimer) |
1961 | hmidi->timer.expires = 1 + jiffies; | 1961 | mod_timer(&hmidi->timer, 1 + jiffies); |
1962 | add_timer(&hmidi->timer); | ||
1963 | } | ||
1964 | 1962 | ||
1965 | spin_unlock_irqrestore (&hmidi->lock, flags); | 1963 | spin_unlock_irqrestore (&hmidi->lock, flags); |
1966 | } | 1964 | } |
@@ -1975,11 +1973,9 @@ snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) | |||
1975 | spin_lock_irqsave (&hmidi->lock, flags); | 1973 | spin_lock_irqsave (&hmidi->lock, flags); |
1976 | if (up) { | 1974 | if (up) { |
1977 | if (!hmidi->istimer) { | 1975 | if (!hmidi->istimer) { |
1978 | init_timer(&hmidi->timer); | 1976 | setup_timer(&hmidi->timer, snd_hdspm_midi_output_timer, |
1979 | hmidi->timer.function = snd_hdspm_midi_output_timer; | 1977 | (unsigned long) hmidi); |
1980 | hmidi->timer.data = (unsigned long) hmidi; | 1978 | mod_timer(&hmidi->timer, 1 + jiffies); |
1981 | hmidi->timer.expires = 1 + jiffies; | ||
1982 | add_timer(&hmidi->timer); | ||
1983 | hmidi->istimer++; | 1979 | hmidi->istimer++; |
1984 | } | 1980 | } |
1985 | } else { | 1981 | } else { |
@@ -6086,6 +6082,9 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream) | |||
6086 | snd_pcm_hw_constraint_minmax(runtime, | 6082 | snd_pcm_hw_constraint_minmax(runtime, |
6087 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, | 6083 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, |
6088 | 64, 8192); | 6084 | 64, 8192); |
6085 | snd_pcm_hw_constraint_minmax(runtime, | ||
6086 | SNDRV_PCM_HW_PARAM_PERIODS, | ||
6087 | 2, 2); | ||
6089 | break; | 6088 | break; |
6090 | } | 6089 | } |
6091 | 6090 | ||
@@ -6160,6 +6159,9 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream) | |||
6160 | snd_pcm_hw_constraint_minmax(runtime, | 6159 | snd_pcm_hw_constraint_minmax(runtime, |
6161 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, | 6160 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, |
6162 | 64, 8192); | 6161 | 64, 8192); |
6162 | snd_pcm_hw_constraint_minmax(runtime, | ||
6163 | SNDRV_PCM_HW_PARAM_PERIODS, | ||
6164 | 2, 2); | ||
6163 | break; | 6165 | break; |
6164 | } | 6166 | } |
6165 | 6167 | ||
@@ -6965,9 +6967,7 @@ static int snd_hdspm_free(struct hdspm * hdspm) | |||
6965 | free_irq(hdspm->irq, (void *) hdspm); | 6967 | free_irq(hdspm->irq, (void *) hdspm); |
6966 | 6968 | ||
6967 | kfree(hdspm->mixer); | 6969 | kfree(hdspm->mixer); |
6968 | 6970 | iounmap(hdspm->iobase); | |
6969 | if (hdspm->iobase) | ||
6970 | iounmap(hdspm->iobase); | ||
6971 | 6971 | ||
6972 | if (hdspm->port) | 6972 | if (hdspm->port) |
6973 | pci_release_regions(hdspm->pci); | 6973 | pci_release_regions(hdspm->pci); |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 6521521853b8..fdbc0aa2776a 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/io.h> | ||
28 | 29 | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/control.h> | 31 | #include <sound/control.h> |
@@ -34,7 +35,6 @@ | |||
34 | #include <sound/initval.h> | 35 | #include <sound/initval.h> |
35 | 36 | ||
36 | #include <asm/current.h> | 37 | #include <asm/current.h> |
37 | #include <asm/io.h> | ||
38 | 38 | ||
39 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 39 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
40 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 40 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
@@ -1756,8 +1756,7 @@ static int snd_rme9652_free(struct snd_rme9652 *rme9652) | |||
1756 | 1756 | ||
1757 | if (rme9652->irq >= 0) | 1757 | if (rme9652->irq >= 0) |
1758 | free_irq(rme9652->irq, (void *)rme9652); | 1758 | free_irq(rme9652->irq, (void *)rme9652); |
1759 | if (rme9652->iobase) | 1759 | iounmap(rme9652->iobase); |
1760 | iounmap(rme9652->iobase); | ||
1761 | if (rme9652->port) | 1760 | if (rme9652->port) |
1762 | pci_release_regions(rme9652->pci); | 1761 | pci_release_regions(rme9652->pci); |
1763 | 1762 | ||
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 7f6a0a0d115a..efe669b80256 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -1064,12 +1064,9 @@ static int sis_chip_free(struct sis7019 *sis) | |||
1064 | if (sis->irq >= 0) | 1064 | if (sis->irq >= 0) |
1065 | free_irq(sis->irq, sis); | 1065 | free_irq(sis->irq, sis); |
1066 | 1066 | ||
1067 | if (sis->ioaddr) | 1067 | iounmap(sis->ioaddr); |
1068 | iounmap(sis->ioaddr); | ||
1069 | |||
1070 | pci_release_regions(sis->pci); | 1068 | pci_release_regions(sis->pci); |
1071 | pci_disable_device(sis->pci); | 1069 | pci_disable_device(sis->pci); |
1072 | |||
1073 | sis_free_suspend(sis); | 1070 | sis_free_suspend(sis); |
1074 | return 0; | 1071 | return 0; |
1075 | } | 1072 | } |
@@ -1211,7 +1208,6 @@ static int sis_chip_init(struct sis7019 *sis) | |||
1211 | #ifdef CONFIG_PM_SLEEP | 1208 | #ifdef CONFIG_PM_SLEEP |
1212 | static int sis_suspend(struct device *dev) | 1209 | static int sis_suspend(struct device *dev) |
1213 | { | 1210 | { |
1214 | struct pci_dev *pci = to_pci_dev(dev); | ||
1215 | struct snd_card *card = dev_get_drvdata(dev); | 1211 | struct snd_card *card = dev_get_drvdata(dev); |
1216 | struct sis7019 *sis = card->private_data; | 1212 | struct sis7019 *sis = card->private_data; |
1217 | void __iomem *ioaddr = sis->ioaddr; | 1213 | void __iomem *ioaddr = sis->ioaddr; |
@@ -1240,9 +1236,6 @@ static int sis_suspend(struct device *dev) | |||
1240 | ioaddr += 4096; | 1236 | ioaddr += 4096; |
1241 | } | 1237 | } |
1242 | 1238 | ||
1243 | pci_disable_device(pci); | ||
1244 | pci_save_state(pci); | ||
1245 | pci_set_power_state(pci, PCI_D3hot); | ||
1246 | return 0; | 1239 | return 0; |
1247 | } | 1240 | } |
1248 | 1241 | ||
@@ -1254,14 +1247,6 @@ static int sis_resume(struct device *dev) | |||
1254 | void __iomem *ioaddr = sis->ioaddr; | 1247 | void __iomem *ioaddr = sis->ioaddr; |
1255 | int i; | 1248 | int i; |
1256 | 1249 | ||
1257 | pci_set_power_state(pci, PCI_D0); | ||
1258 | pci_restore_state(pci); | ||
1259 | |||
1260 | if (pci_enable_device(pci) < 0) { | ||
1261 | dev_err(&pci->dev, "unable to re-enable device\n"); | ||
1262 | goto error; | ||
1263 | } | ||
1264 | |||
1265 | if (sis_chip_init(sis)) { | 1250 | if (sis_chip_init(sis)) { |
1266 | dev_err(&pci->dev, "unable to re-init controller\n"); | 1251 | dev_err(&pci->dev, "unable to re-init controller\n"); |
1267 | goto error; | 1252 | goto error; |
@@ -1284,7 +1269,6 @@ static int sis_resume(struct device *dev) | |||
1284 | memset(sis->suspend_state[0], 0, 4096); | 1269 | memset(sis->suspend_state[0], 0, 4096); |
1285 | 1270 | ||
1286 | sis->irq = pci->irq; | 1271 | sis->irq = pci->irq; |
1287 | pci_set_master(pci); | ||
1288 | 1272 | ||
1289 | if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) | 1273 | if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) |
1290 | snd_ac97_resume(sis->ac97[0]); | 1274 | snd_ac97_resume(sis->ac97[0]); |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 313a7328bf9c..0f40624a4275 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/gameport.h> | 30 | #include <linux/gameport.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/io.h> | ||
33 | 34 | ||
34 | #include <sound/core.h> | 35 | #include <sound/core.h> |
35 | #include <sound/pcm.h> | 36 | #include <sound/pcm.h> |
@@ -39,8 +40,6 @@ | |||
39 | #include <sound/opl3.h> | 40 | #include <sound/opl3.h> |
40 | #include <sound/initval.h> | 41 | #include <sound/initval.h> |
41 | 42 | ||
42 | #include <asm/io.h> | ||
43 | |||
44 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 43 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
45 | MODULE_DESCRIPTION("S3 SonicVibes PCI"); | 44 | MODULE_DESCRIPTION("S3 SonicVibes PCI"); |
46 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
@@ -880,8 +879,7 @@ static struct snd_pcm_ops snd_sonicvibes_capture_ops = { | |||
880 | .pointer = snd_sonicvibes_capture_pointer, | 879 | .pointer = snd_sonicvibes_capture_pointer, |
881 | }; | 880 | }; |
882 | 881 | ||
883 | static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device, | 882 | static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device) |
884 | struct snd_pcm **rpcm) | ||
885 | { | 883 | { |
886 | struct snd_pcm *pcm; | 884 | struct snd_pcm *pcm; |
887 | int err; | 885 | int err; |
@@ -902,8 +900,6 @@ static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device, | |||
902 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 900 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
903 | snd_dma_pci_data(sonic->pci), 64*1024, 128*1024); | 901 | snd_dma_pci_data(sonic->pci), 64*1024, 128*1024); |
904 | 902 | ||
905 | if (rpcm) | ||
906 | *rpcm = pcm; | ||
907 | return 0; | 903 | return 0; |
908 | } | 904 | } |
909 | 905 | ||
@@ -1491,7 +1487,7 @@ static int snd_sonic_probe(struct pci_dev *pci, | |||
1491 | (unsigned long long)pci_resource_start(pci, 1), | 1487 | (unsigned long long)pci_resource_start(pci, 1), |
1492 | sonic->irq); | 1488 | sonic->irq); |
1493 | 1489 | ||
1494 | if ((err = snd_sonicvibes_pcm(sonic, 0, NULL)) < 0) { | 1490 | if ((err = snd_sonicvibes_pcm(sonic, 0)) < 0) { |
1495 | snd_card_free(card); | 1491 | snd_card_free(card); |
1496 | return err; | 1492 | return err; |
1497 | } | 1493 | } |
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index a54cd6879b31..cedf13b64803 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -127,21 +127,21 @@ static int snd_trident_probe(struct pci_dev *pci, | |||
127 | sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d", | 127 | sprintf(card->longname, "%s PCI Audio at 0x%lx, irq %d", |
128 | card->shortname, trident->port, trident->irq); | 128 | card->shortname, trident->port, trident->irq); |
129 | 129 | ||
130 | if ((err = snd_trident_pcm(trident, pcm_dev++, NULL)) < 0) { | 130 | if ((err = snd_trident_pcm(trident, pcm_dev++)) < 0) { |
131 | snd_card_free(card); | 131 | snd_card_free(card); |
132 | return err; | 132 | return err; |
133 | } | 133 | } |
134 | switch (trident->device) { | 134 | switch (trident->device) { |
135 | case TRIDENT_DEVICE_ID_DX: | 135 | case TRIDENT_DEVICE_ID_DX: |
136 | case TRIDENT_DEVICE_ID_NX: | 136 | case TRIDENT_DEVICE_ID_NX: |
137 | if ((err = snd_trident_foldback_pcm(trident, pcm_dev++, NULL)) < 0) { | 137 | if ((err = snd_trident_foldback_pcm(trident, pcm_dev++)) < 0) { |
138 | snd_card_free(card); | 138 | snd_card_free(card); |
139 | return err; | 139 | return err; |
140 | } | 140 | } |
141 | break; | 141 | break; |
142 | } | 142 | } |
143 | if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) { | 143 | if (trident->device == TRIDENT_DEVICE_ID_NX || trident->device == TRIDENT_DEVICE_ID_SI7018) { |
144 | if ((err = snd_trident_spdif_pcm(trident, pcm_dev++, NULL)) < 0) { | 144 | if ((err = snd_trident_spdif_pcm(trident, pcm_dev++)) < 0) { |
145 | snd_card_free(card); | 145 | snd_card_free(card); |
146 | return err; | 146 | return err; |
147 | } | 147 | } |
diff --git a/sound/pci/trident/trident.h b/sound/pci/trident/trident.h index 5f110eb56e47..9624e5937719 100644 --- a/sound/pci/trident/trident.h +++ b/sound/pci/trident/trident.h | |||
@@ -420,9 +420,9 @@ int snd_trident_create(struct snd_card *card, | |||
420 | struct snd_trident ** rtrident); | 420 | struct snd_trident ** rtrident); |
421 | int snd_trident_create_gameport(struct snd_trident *trident); | 421 | int snd_trident_create_gameport(struct snd_trident *trident); |
422 | 422 | ||
423 | int snd_trident_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm); | 423 | int snd_trident_pcm(struct snd_trident *trident, int device); |
424 | int snd_trident_foldback_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm); | 424 | int snd_trident_foldback_pcm(struct snd_trident *trident, int device); |
425 | int snd_trident_spdif_pcm(struct snd_trident * trident, int device, struct snd_pcm **rpcm); | 425 | int snd_trident_spdif_pcm(struct snd_trident *trident, int device); |
426 | int snd_trident_attach_synthesizer(struct snd_trident * trident); | 426 | int snd_trident_attach_synthesizer(struct snd_trident * trident); |
427 | struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, | 427 | struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, |
428 | int client, int port); | 428 | int client, int port); |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 57cd757acfe7..b72be035f785 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/gameport.h> | 36 | #include <linux/gameport.h> |
37 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
38 | #include <linux/export.h> | 38 | #include <linux/export.h> |
39 | #include <linux/io.h> | ||
39 | 40 | ||
40 | #include <sound/core.h> | 41 | #include <sound/core.h> |
41 | #include <sound/info.h> | 42 | #include <sound/info.h> |
@@ -44,8 +45,6 @@ | |||
44 | #include "trident.h" | 45 | #include "trident.h" |
45 | #include <sound/asoundef.h> | 46 | #include <sound/asoundef.h> |
46 | 47 | ||
47 | #include <asm/io.h> | ||
48 | |||
49 | static int snd_trident_pcm_mixer_build(struct snd_trident *trident, | 48 | static int snd_trident_pcm_mixer_build(struct snd_trident *trident, |
50 | struct snd_trident_voice * voice, | 49 | struct snd_trident_voice * voice, |
51 | struct snd_pcm_substream *substream); | 50 | struct snd_pcm_substream *substream); |
@@ -2172,14 +2171,11 @@ static struct snd_pcm_ops snd_trident_spdif_7018_ops = { | |||
2172 | 2171 | ||
2173 | ---------------------------------------------------------------------------*/ | 2172 | ---------------------------------------------------------------------------*/ |
2174 | 2173 | ||
2175 | int snd_trident_pcm(struct snd_trident *trident, | 2174 | int snd_trident_pcm(struct snd_trident *trident, int device) |
2176 | int device, struct snd_pcm **rpcm) | ||
2177 | { | 2175 | { |
2178 | struct snd_pcm *pcm; | 2176 | struct snd_pcm *pcm; |
2179 | int err; | 2177 | int err; |
2180 | 2178 | ||
2181 | if (rpcm) | ||
2182 | *rpcm = NULL; | ||
2183 | if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, trident->ChanPCM, 1, &pcm)) < 0) | 2179 | if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, trident->ChanPCM, 1, &pcm)) < 0) |
2184 | return err; | 2180 | return err; |
2185 | 2181 | ||
@@ -2214,8 +2210,6 @@ int snd_trident_pcm(struct snd_trident *trident, | |||
2214 | snd_dma_pci_data(trident->pci), 64*1024, 128*1024); | 2210 | snd_dma_pci_data(trident->pci), 64*1024, 128*1024); |
2215 | } | 2211 | } |
2216 | 2212 | ||
2217 | if (rpcm) | ||
2218 | *rpcm = pcm; | ||
2219 | return 0; | 2213 | return 0; |
2220 | } | 2214 | } |
2221 | 2215 | ||
@@ -2230,16 +2224,13 @@ int snd_trident_pcm(struct snd_trident *trident, | |||
2230 | 2224 | ||
2231 | ---------------------------------------------------------------------------*/ | 2225 | ---------------------------------------------------------------------------*/ |
2232 | 2226 | ||
2233 | int snd_trident_foldback_pcm(struct snd_trident *trident, | 2227 | int snd_trident_foldback_pcm(struct snd_trident *trident, int device) |
2234 | int device, struct snd_pcm **rpcm) | ||
2235 | { | 2228 | { |
2236 | struct snd_pcm *foldback; | 2229 | struct snd_pcm *foldback; |
2237 | int err; | 2230 | int err; |
2238 | int num_chan = 3; | 2231 | int num_chan = 3; |
2239 | struct snd_pcm_substream *substream; | 2232 | struct snd_pcm_substream *substream; |
2240 | 2233 | ||
2241 | if (rpcm) | ||
2242 | *rpcm = NULL; | ||
2243 | if (trident->device == TRIDENT_DEVICE_ID_NX) | 2234 | if (trident->device == TRIDENT_DEVICE_ID_NX) |
2244 | num_chan = 4; | 2235 | num_chan = 4; |
2245 | if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, 0, num_chan, &foldback)) < 0) | 2236 | if ((err = snd_pcm_new(trident->card, "trident_dx_nx", device, 0, num_chan, &foldback)) < 0) |
@@ -2271,8 +2262,6 @@ int snd_trident_foldback_pcm(struct snd_trident *trident, | |||
2271 | snd_pcm_lib_preallocate_pages_for_all(foldback, SNDRV_DMA_TYPE_DEV, | 2262 | snd_pcm_lib_preallocate_pages_for_all(foldback, SNDRV_DMA_TYPE_DEV, |
2272 | snd_dma_pci_data(trident->pci), 64*1024, 128*1024); | 2263 | snd_dma_pci_data(trident->pci), 64*1024, 128*1024); |
2273 | 2264 | ||
2274 | if (rpcm) | ||
2275 | *rpcm = foldback; | ||
2276 | return 0; | 2265 | return 0; |
2277 | } | 2266 | } |
2278 | 2267 | ||
@@ -2287,14 +2276,11 @@ int snd_trident_foldback_pcm(struct snd_trident *trident, | |||
2287 | 2276 | ||
2288 | ---------------------------------------------------------------------------*/ | 2277 | ---------------------------------------------------------------------------*/ |
2289 | 2278 | ||
2290 | int snd_trident_spdif_pcm(struct snd_trident *trident, | 2279 | int snd_trident_spdif_pcm(struct snd_trident *trident, int device) |
2291 | int device, struct snd_pcm **rpcm) | ||
2292 | { | 2280 | { |
2293 | struct snd_pcm *spdif; | 2281 | struct snd_pcm *spdif; |
2294 | int err; | 2282 | int err; |
2295 | 2283 | ||
2296 | if (rpcm) | ||
2297 | *rpcm = NULL; | ||
2298 | if ((err = snd_pcm_new(trident->card, "trident_dx_nx IEC958", device, 1, 0, &spdif)) < 0) | 2284 | if ((err = snd_pcm_new(trident->card, "trident_dx_nx IEC958", device, 1, 0, &spdif)) < 0) |
2299 | return err; | 2285 | return err; |
2300 | 2286 | ||
@@ -2310,8 +2296,6 @@ int snd_trident_spdif_pcm(struct snd_trident *trident, | |||
2310 | 2296 | ||
2311 | snd_pcm_lib_preallocate_pages_for_all(spdif, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), 64*1024, 128*1024); | 2297 | snd_pcm_lib_preallocate_pages_for_all(spdif, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), 64*1024, 128*1024); |
2312 | 2298 | ||
2313 | if (rpcm) | ||
2314 | *rpcm = spdif; | ||
2315 | return 0; | 2299 | return 0; |
2316 | } | 2300 | } |
2317 | 2301 | ||
@@ -3926,7 +3910,6 @@ static void snd_trident_clear_voices(struct snd_trident * trident, unsigned shor | |||
3926 | #ifdef CONFIG_PM_SLEEP | 3910 | #ifdef CONFIG_PM_SLEEP |
3927 | static int snd_trident_suspend(struct device *dev) | 3911 | static int snd_trident_suspend(struct device *dev) |
3928 | { | 3912 | { |
3929 | struct pci_dev *pci = to_pci_dev(dev); | ||
3930 | struct snd_card *card = dev_get_drvdata(dev); | 3913 | struct snd_card *card = dev_get_drvdata(dev); |
3931 | struct snd_trident *trident = card->private_data; | 3914 | struct snd_trident *trident = card->private_data; |
3932 | 3915 | ||
@@ -3938,28 +3921,14 @@ static int snd_trident_suspend(struct device *dev) | |||
3938 | 3921 | ||
3939 | snd_ac97_suspend(trident->ac97); | 3922 | snd_ac97_suspend(trident->ac97); |
3940 | snd_ac97_suspend(trident->ac97_sec); | 3923 | snd_ac97_suspend(trident->ac97_sec); |
3941 | |||
3942 | pci_disable_device(pci); | ||
3943 | pci_save_state(pci); | ||
3944 | pci_set_power_state(pci, PCI_D3hot); | ||
3945 | return 0; | 3924 | return 0; |
3946 | } | 3925 | } |
3947 | 3926 | ||
3948 | static int snd_trident_resume(struct device *dev) | 3927 | static int snd_trident_resume(struct device *dev) |
3949 | { | 3928 | { |
3950 | struct pci_dev *pci = to_pci_dev(dev); | ||
3951 | struct snd_card *card = dev_get_drvdata(dev); | 3929 | struct snd_card *card = dev_get_drvdata(dev); |
3952 | struct snd_trident *trident = card->private_data; | 3930 | struct snd_trident *trident = card->private_data; |
3953 | 3931 | ||
3954 | pci_set_power_state(pci, PCI_D0); | ||
3955 | pci_restore_state(pci); | ||
3956 | if (pci_enable_device(pci) < 0) { | ||
3957 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
3958 | snd_card_disconnect(card); | ||
3959 | return -EIO; | ||
3960 | } | ||
3961 | pci_set_master(pci); | ||
3962 | |||
3963 | switch (trident->device) { | 3932 | switch (trident->device) { |
3964 | case TRIDENT_DEVICE_ID_DX: | 3933 | case TRIDENT_DEVICE_ID_DX: |
3965 | snd_trident_4d_dx_init(trident); | 3934 | snd_trident_4d_dx_init(trident); |
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index 04c474658e3c..b9ebb51893c5 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <asm/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/time.h> | 28 | #include <linux/time.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index e088467fb736..8622283e89f3 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * - Optimize position calculation for the 823x chips. | 46 | * - Optimize position calculation for the 823x chips. |
47 | */ | 47 | */ |
48 | 48 | ||
49 | #include <asm/io.h> | 49 | #include <linux/io.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/interrupt.h> | 51 | #include <linux/interrupt.h> |
52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
@@ -2271,7 +2271,6 @@ static int snd_via82xx_chip_init(struct via82xx *chip) | |||
2271 | */ | 2271 | */ |
2272 | static int snd_via82xx_suspend(struct device *dev) | 2272 | static int snd_via82xx_suspend(struct device *dev) |
2273 | { | 2273 | { |
2274 | struct pci_dev *pci = to_pci_dev(dev); | ||
2275 | struct snd_card *card = dev_get_drvdata(dev); | 2274 | struct snd_card *card = dev_get_drvdata(dev); |
2276 | struct via82xx *chip = card->private_data; | 2275 | struct via82xx *chip = card->private_data; |
2277 | int i; | 2276 | int i; |
@@ -2291,28 +2290,15 @@ static int snd_via82xx_suspend(struct device *dev) | |||
2291 | chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); | 2290 | chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); |
2292 | } | 2291 | } |
2293 | 2292 | ||
2294 | pci_disable_device(pci); | ||
2295 | pci_save_state(pci); | ||
2296 | pci_set_power_state(pci, PCI_D3hot); | ||
2297 | return 0; | 2293 | return 0; |
2298 | } | 2294 | } |
2299 | 2295 | ||
2300 | static int snd_via82xx_resume(struct device *dev) | 2296 | static int snd_via82xx_resume(struct device *dev) |
2301 | { | 2297 | { |
2302 | struct pci_dev *pci = to_pci_dev(dev); | ||
2303 | struct snd_card *card = dev_get_drvdata(dev); | 2298 | struct snd_card *card = dev_get_drvdata(dev); |
2304 | struct via82xx *chip = card->private_data; | 2299 | struct via82xx *chip = card->private_data; |
2305 | int i; | 2300 | int i; |
2306 | 2301 | ||
2307 | pci_set_power_state(pci, PCI_D0); | ||
2308 | pci_restore_state(pci); | ||
2309 | if (pci_enable_device(pci) < 0) { | ||
2310 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2311 | snd_card_disconnect(card); | ||
2312 | return -EIO; | ||
2313 | } | ||
2314 | pci_set_master(pci); | ||
2315 | |||
2316 | snd_via82xx_chip_init(chip); | 2302 | snd_via82xx_chip_init(chip); |
2317 | 2303 | ||
2318 | if (chip->chip_type == TYPE_VIA686) { | 2304 | if (chip->chip_type == TYPE_VIA686) { |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index fd46ffe12e4f..99b9137bc677 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -31,7 +31,7 @@ | |||
31 | * modems. | 31 | * modems. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <asm/io.h> | 34 | #include <linux/io.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
@@ -1031,7 +1031,6 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip) | |||
1031 | */ | 1031 | */ |
1032 | static int snd_via82xx_suspend(struct device *dev) | 1032 | static int snd_via82xx_suspend(struct device *dev) |
1033 | { | 1033 | { |
1034 | struct pci_dev *pci = to_pci_dev(dev); | ||
1035 | struct snd_card *card = dev_get_drvdata(dev); | 1034 | struct snd_card *card = dev_get_drvdata(dev); |
1036 | struct via82xx_modem *chip = card->private_data; | 1035 | struct via82xx_modem *chip = card->private_data; |
1037 | int i; | 1036 | int i; |
@@ -1043,29 +1042,15 @@ static int snd_via82xx_suspend(struct device *dev) | |||
1043 | snd_via82xx_channel_reset(chip, &chip->devs[i]); | 1042 | snd_via82xx_channel_reset(chip, &chip->devs[i]); |
1044 | synchronize_irq(chip->irq); | 1043 | synchronize_irq(chip->irq); |
1045 | snd_ac97_suspend(chip->ac97); | 1044 | snd_ac97_suspend(chip->ac97); |
1046 | |||
1047 | pci_disable_device(pci); | ||
1048 | pci_save_state(pci); | ||
1049 | pci_set_power_state(pci, PCI_D3hot); | ||
1050 | return 0; | 1045 | return 0; |
1051 | } | 1046 | } |
1052 | 1047 | ||
1053 | static int snd_via82xx_resume(struct device *dev) | 1048 | static int snd_via82xx_resume(struct device *dev) |
1054 | { | 1049 | { |
1055 | struct pci_dev *pci = to_pci_dev(dev); | ||
1056 | struct snd_card *card = dev_get_drvdata(dev); | 1050 | struct snd_card *card = dev_get_drvdata(dev); |
1057 | struct via82xx_modem *chip = card->private_data; | 1051 | struct via82xx_modem *chip = card->private_data; |
1058 | int i; | 1052 | int i; |
1059 | 1053 | ||
1060 | pci_set_power_state(pci, PCI_D0); | ||
1061 | pci_restore_state(pci); | ||
1062 | if (pci_enable_device(pci) < 0) { | ||
1063 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
1064 | snd_card_disconnect(card); | ||
1065 | return -EIO; | ||
1066 | } | ||
1067 | pci_set_master(pci); | ||
1068 | |||
1069 | snd_via82xx_chip_init(chip); | 1054 | snd_via82xx_chip_init(chip); |
1070 | 1055 | ||
1071 | snd_ac97_resume(chip->ac97); | 1056 | snd_ac97_resume(chip->ac97); |
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index c5a25e39e3a8..ecbaf473fc1e 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c | |||
@@ -259,32 +259,17 @@ static void snd_vx222_remove(struct pci_dev *pci) | |||
259 | #ifdef CONFIG_PM_SLEEP | 259 | #ifdef CONFIG_PM_SLEEP |
260 | static int snd_vx222_suspend(struct device *dev) | 260 | static int snd_vx222_suspend(struct device *dev) |
261 | { | 261 | { |
262 | struct pci_dev *pci = to_pci_dev(dev); | ||
263 | struct snd_card *card = dev_get_drvdata(dev); | 262 | struct snd_card *card = dev_get_drvdata(dev); |
264 | struct snd_vx222 *vx = card->private_data; | 263 | struct snd_vx222 *vx = card->private_data; |
265 | int err; | ||
266 | 264 | ||
267 | err = snd_vx_suspend(&vx->core); | 265 | return snd_vx_suspend(&vx->core); |
268 | pci_disable_device(pci); | ||
269 | pci_save_state(pci); | ||
270 | pci_set_power_state(pci, PCI_D3hot); | ||
271 | return err; | ||
272 | } | 266 | } |
273 | 267 | ||
274 | static int snd_vx222_resume(struct device *dev) | 268 | static int snd_vx222_resume(struct device *dev) |
275 | { | 269 | { |
276 | struct pci_dev *pci = to_pci_dev(dev); | ||
277 | struct snd_card *card = dev_get_drvdata(dev); | 270 | struct snd_card *card = dev_get_drvdata(dev); |
278 | struct snd_vx222 *vx = card->private_data; | 271 | struct snd_vx222 *vx = card->private_data; |
279 | 272 | ||
280 | pci_set_power_state(pci, PCI_D0); | ||
281 | pci_restore_state(pci); | ||
282 | if (pci_enable_device(pci) < 0) { | ||
283 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
284 | snd_card_disconnect(card); | ||
285 | return -EIO; | ||
286 | } | ||
287 | pci_set_master(pci); | ||
288 | return snd_vx_resume(&vx->core); | 273 | return snd_vx_resume(&vx->core); |
289 | } | 274 | } |
290 | 275 | ||
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 52c1a8d5b88a..af83b3b38052 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c | |||
@@ -24,11 +24,11 @@ | |||
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
26 | #include <linux/mutex.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/io.h> | ||
27 | 28 | ||
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include <sound/control.h> | 30 | #include <sound/control.h> |
30 | #include <sound/tlv.h> | 31 | #include <sound/tlv.h> |
31 | #include <asm/io.h> | ||
32 | #include "vx222.h" | 32 | #include "vx222.h" |
33 | 33 | ||
34 | 34 | ||
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 47a192369e8f..812e27a1bcbc 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -283,11 +283,11 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
283 | card->shortname, | 283 | card->shortname, |
284 | chip->reg_area_phys, | 284 | chip->reg_area_phys, |
285 | chip->irq); | 285 | chip->irq); |
286 | if ((err = snd_ymfpci_pcm(chip, 0, NULL)) < 0) { | 286 | if ((err = snd_ymfpci_pcm(chip, 0)) < 0) { |
287 | snd_card_free(card); | 287 | snd_card_free(card); |
288 | return err; | 288 | return err; |
289 | } | 289 | } |
290 | if ((err = snd_ymfpci_pcm_spdif(chip, 1, NULL)) < 0) { | 290 | if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) { |
291 | snd_card_free(card); | 291 | snd_card_free(card); |
292 | return err; | 292 | return err; |
293 | } | 293 | } |
@@ -297,12 +297,12 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
297 | return err; | 297 | return err; |
298 | } | 298 | } |
299 | if (chip->ac97->ext_id & AC97_EI_SDAC) { | 299 | if (chip->ac97->ext_id & AC97_EI_SDAC) { |
300 | err = snd_ymfpci_pcm_4ch(chip, 2, NULL); | 300 | err = snd_ymfpci_pcm_4ch(chip, 2); |
301 | if (err < 0) { | 301 | if (err < 0) { |
302 | snd_card_free(card); | 302 | snd_card_free(card); |
303 | return err; | 303 | return err; |
304 | } | 304 | } |
305 | err = snd_ymfpci_pcm2(chip, 3, NULL); | 305 | err = snd_ymfpci_pcm2(chip, 3); |
306 | if (err < 0) { | 306 | if (err < 0) { |
307 | snd_card_free(card); | 307 | snd_card_free(card); |
308 | return err; | 308 | return err; |
diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h index 4631a2348915..149d4cb46998 100644 --- a/sound/pci/ymfpci/ymfpci.h +++ b/sound/pci/ymfpci/ymfpci.h | |||
@@ -379,10 +379,10 @@ void snd_ymfpci_free_gameport(struct snd_ymfpci *chip); | |||
379 | 379 | ||
380 | extern const struct dev_pm_ops snd_ymfpci_pm; | 380 | extern const struct dev_pm_ops snd_ymfpci_pm; |
381 | 381 | ||
382 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 382 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device); |
383 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 383 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device); |
384 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 384 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device); |
385 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); | 385 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device); |
386 | int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch); | 386 | int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch); |
387 | int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); | 387 | int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); |
388 | 388 | ||
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 81c916a5eb96..4c26076dbf78 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/io.h> | ||
30 | 31 | ||
31 | #include <sound/core.h> | 32 | #include <sound/core.h> |
32 | #include <sound/control.h> | 33 | #include <sound/control.h> |
@@ -36,7 +37,6 @@ | |||
36 | #include <sound/asoundef.h> | 37 | #include <sound/asoundef.h> |
37 | #include <sound/mpu401.h> | 38 | #include <sound/mpu401.h> |
38 | 39 | ||
39 | #include <asm/io.h> | ||
40 | #include <asm/byteorder.h> | 40 | #include <asm/byteorder.h> |
41 | 41 | ||
42 | /* | 42 | /* |
@@ -1145,13 +1145,11 @@ static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = { | |||
1145 | .pointer = snd_ymfpci_capture_pointer, | 1145 | .pointer = snd_ymfpci_capture_pointer, |
1146 | }; | 1146 | }; |
1147 | 1147 | ||
1148 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | 1148 | int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device) |
1149 | { | 1149 | { |
1150 | struct snd_pcm *pcm; | 1150 | struct snd_pcm *pcm; |
1151 | int err; | 1151 | int err; |
1152 | 1152 | ||
1153 | if (rpcm) | ||
1154 | *rpcm = NULL; | ||
1155 | if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) | 1153 | if ((err = snd_pcm_new(chip->card, "YMFPCI", device, 32, 1, &pcm)) < 0) |
1156 | return err; | 1154 | return err; |
1157 | pcm->private_data = chip; | 1155 | pcm->private_data = chip; |
@@ -1167,14 +1165,8 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | |||
1167 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1165 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1168 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1166 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1169 | 1167 | ||
1170 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1168 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1171 | snd_pcm_std_chmaps, 2, 0, NULL); | 1169 | snd_pcm_std_chmaps, 2, 0, NULL); |
1172 | if (err < 0) | ||
1173 | return err; | ||
1174 | |||
1175 | if (rpcm) | ||
1176 | *rpcm = pcm; | ||
1177 | return 0; | ||
1178 | } | 1170 | } |
1179 | 1171 | ||
1180 | static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { | 1172 | static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { |
@@ -1188,13 +1180,11 @@ static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = { | |||
1188 | .pointer = snd_ymfpci_capture_pointer, | 1180 | .pointer = snd_ymfpci_capture_pointer, |
1189 | }; | 1181 | }; |
1190 | 1182 | ||
1191 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | 1183 | int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device) |
1192 | { | 1184 | { |
1193 | struct snd_pcm *pcm; | 1185 | struct snd_pcm *pcm; |
1194 | int err; | 1186 | int err; |
1195 | 1187 | ||
1196 | if (rpcm) | ||
1197 | *rpcm = NULL; | ||
1198 | if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) | 1188 | if ((err = snd_pcm_new(chip->card, "YMFPCI - PCM2", device, 0, 1, &pcm)) < 0) |
1199 | return err; | 1189 | return err; |
1200 | pcm->private_data = chip; | 1190 | pcm->private_data = chip; |
@@ -1210,8 +1200,6 @@ int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm) | |||
1210 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1200 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1211 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1201 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1212 | 1202 | ||
1213 | if (rpcm) | ||
1214 | *rpcm = pcm; | ||
1215 | return 0; | 1203 | return 0; |
1216 | } | 1204 | } |
1217 | 1205 | ||
@@ -1226,14 +1214,11 @@ static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = { | |||
1226 | .pointer = snd_ymfpci_playback_pointer, | 1214 | .pointer = snd_ymfpci_playback_pointer, |
1227 | }; | 1215 | }; |
1228 | 1216 | ||
1229 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, | 1217 | int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device) |
1230 | struct snd_pcm **rpcm) | ||
1231 | { | 1218 | { |
1232 | struct snd_pcm *pcm; | 1219 | struct snd_pcm *pcm; |
1233 | int err; | 1220 | int err; |
1234 | 1221 | ||
1235 | if (rpcm) | ||
1236 | *rpcm = NULL; | ||
1237 | if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) | 1222 | if ((err = snd_pcm_new(chip->card, "YMFPCI - IEC958", device, 1, 0, &pcm)) < 0) |
1238 | return err; | 1223 | return err; |
1239 | pcm->private_data = chip; | 1224 | pcm->private_data = chip; |
@@ -1248,8 +1233,6 @@ int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, | |||
1248 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1233 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1249 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1234 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1250 | 1235 | ||
1251 | if (rpcm) | ||
1252 | *rpcm = pcm; | ||
1253 | return 0; | 1236 | return 0; |
1254 | } | 1237 | } |
1255 | 1238 | ||
@@ -1272,14 +1255,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = { | |||
1272 | { } | 1255 | { } |
1273 | }; | 1256 | }; |
1274 | 1257 | ||
1275 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, | 1258 | int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device) |
1276 | struct snd_pcm **rpcm) | ||
1277 | { | 1259 | { |
1278 | struct snd_pcm *pcm; | 1260 | struct snd_pcm *pcm; |
1279 | int err; | 1261 | int err; |
1280 | 1262 | ||
1281 | if (rpcm) | ||
1282 | *rpcm = NULL; | ||
1283 | if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) | 1263 | if ((err = snd_pcm_new(chip->card, "YMFPCI - Rear", device, 1, 0, &pcm)) < 0) |
1284 | return err; | 1264 | return err; |
1285 | pcm->private_data = chip; | 1265 | pcm->private_data = chip; |
@@ -1294,14 +1274,8 @@ int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, | |||
1294 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1274 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1295 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1275 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1296 | 1276 | ||
1297 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | 1277 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
1298 | surround_map, 2, 0, NULL); | 1278 | surround_map, 2, 0, NULL); |
1299 | if (err < 0) | ||
1300 | return err; | ||
1301 | |||
1302 | if (rpcm) | ||
1303 | *rpcm = pcm; | ||
1304 | return 0; | ||
1305 | } | 1279 | } |
1306 | 1280 | ||
1307 | static int snd_ymfpci_spdif_default_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1281 | static int snd_ymfpci_spdif_default_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
@@ -2272,8 +2246,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip) | |||
2272 | release_and_free_resource(chip->mpu_res); | 2246 | release_and_free_resource(chip->mpu_res); |
2273 | release_and_free_resource(chip->fm_res); | 2247 | release_and_free_resource(chip->fm_res); |
2274 | snd_ymfpci_free_gameport(chip); | 2248 | snd_ymfpci_free_gameport(chip); |
2275 | if (chip->reg_area_virt) | 2249 | iounmap(chip->reg_area_virt); |
2276 | iounmap(chip->reg_area_virt); | ||
2277 | if (chip->work_ptr.area) | 2250 | if (chip->work_ptr.area) |
2278 | snd_dma_free_pages(&chip->work_ptr); | 2251 | snd_dma_free_pages(&chip->work_ptr); |
2279 | 2252 | ||
@@ -2326,7 +2299,6 @@ static int saved_regs_index[] = { | |||
2326 | 2299 | ||
2327 | static int snd_ymfpci_suspend(struct device *dev) | 2300 | static int snd_ymfpci_suspend(struct device *dev) |
2328 | { | 2301 | { |
2329 | struct pci_dev *pci = to_pci_dev(dev); | ||
2330 | struct snd_card *card = dev_get_drvdata(dev); | 2302 | struct snd_card *card = dev_get_drvdata(dev); |
2331 | struct snd_ymfpci *chip = card->private_data; | 2303 | struct snd_ymfpci *chip = card->private_data; |
2332 | unsigned int i; | 2304 | unsigned int i; |
@@ -2347,9 +2319,6 @@ static int snd_ymfpci_suspend(struct device *dev) | |||
2347 | snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); | 2319 | snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); |
2348 | snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); | 2320 | snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); |
2349 | snd_ymfpci_disable_dsp(chip); | 2321 | snd_ymfpci_disable_dsp(chip); |
2350 | pci_disable_device(pci); | ||
2351 | pci_save_state(pci); | ||
2352 | pci_set_power_state(pci, PCI_D3hot); | ||
2353 | return 0; | 2322 | return 0; |
2354 | } | 2323 | } |
2355 | 2324 | ||
@@ -2360,14 +2329,6 @@ static int snd_ymfpci_resume(struct device *dev) | |||
2360 | struct snd_ymfpci *chip = card->private_data; | 2329 | struct snd_ymfpci *chip = card->private_data; |
2361 | unsigned int i; | 2330 | unsigned int i; |
2362 | 2331 | ||
2363 | pci_set_power_state(pci, PCI_D0); | ||
2364 | pci_restore_state(pci); | ||
2365 | if (pci_enable_device(pci) < 0) { | ||
2366 | dev_err(dev, "pci_enable_device failed, disabling device\n"); | ||
2367 | snd_card_disconnect(card); | ||
2368 | return -EIO; | ||
2369 | } | ||
2370 | pci_set_master(pci); | ||
2371 | snd_ymfpci_aclink_reset(pci); | 2332 | snd_ymfpci_aclink_reset(pci); |
2372 | snd_ymfpci_codec_ready(chip, 0); | 2333 | snd_ymfpci_codec_ready(chip, 0); |
2373 | snd_ymfpci_download_image(chip); | 2334 | snd_ymfpci_download_image(chip); |