diff options
Diffstat (limited to 'sound/pci/echoaudio')
33 files changed, 460 insertions, 240 deletions
diff --git a/sound/pci/echoaudio/darla20.c b/sound/pci/echoaudio/darla20.c index 8c6db3aa3c1a..a65bafe0800f 100644 --- a/sound/pci/echoaudio/darla20.c +++ b/sound/pci/echoaudio/darla20.c | |||
| @@ -63,7 +63,7 @@ static const struct firmware card_fw[] = { | |||
| 63 | {0, "darla20_dsp.fw"} | 63 | {0, "darla20_dsp.fw"} |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | static struct pci_device_id snd_echo_ids[] = { | 66 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 67 | {0x1057, 0x1801, 0xECC0, 0x0010, 0, 0, 0}, /* DSP 56301 Darla20 rev.0 */ | 67 | {0x1057, 0x1801, 0xECC0, 0x0010, 0, 0, 0}, /* DSP 56301 Darla20 rev.0 */ |
| 68 | {0,} | 68 | {0,} |
| 69 | }; | 69 | }; |
diff --git a/sound/pci/echoaudio/darla20_dsp.c b/sound/pci/echoaudio/darla20_dsp.c index 29043301ebb8..20c7cbc89bb3 100644 --- a/sound/pci/echoaudio/darla20_dsp.c +++ b/sound/pci/echoaudio/darla20_dsp.c | |||
| @@ -45,7 +45,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 45 | chip->device_id = device_id; | 45 | chip->device_id = device_id; |
| 46 | chip->subdevice_id = subdevice_id; | 46 | chip->subdevice_id = subdevice_id; |
| 47 | chip->bad_board = TRUE; | 47 | chip->bad_board = TRUE; |
| 48 | chip->dsp_code_to_load = &card_fw[FW_DARLA20_DSP]; | 48 | chip->dsp_code_to_load = FW_DARLA20_DSP; |
| 49 | chip->spdif_status = GD_SPDIF_STATUS_UNDEF; | 49 | chip->spdif_status = GD_SPDIF_STATUS_UNDEF; |
| 50 | chip->clock_state = GD_CLOCK_UNDEF; | 50 | chip->clock_state = GD_CLOCK_UNDEF; |
| 51 | /* Since this card has no ASIC, mark it as loaded so everything | 51 | /* Since this card has no ASIC, mark it as loaded so everything |
| @@ -57,15 +57,19 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 57 | return err; | 57 | return err; |
| 58 | chip->bad_board = FALSE; | 58 | chip->bad_board = FALSE; |
| 59 | 59 | ||
| 60 | if ((err = init_line_levels(chip)) < 0) | ||
| 61 | return err; | ||
| 62 | |||
| 63 | DE_INIT(("init_hw done\n")); | 60 | DE_INIT(("init_hw done\n")); |
| 64 | return err; | 61 | return err; |
| 65 | } | 62 | } |
| 66 | 63 | ||
| 67 | 64 | ||
| 68 | 65 | ||
| 66 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 67 | { | ||
| 68 | return init_line_levels(chip); | ||
| 69 | } | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 69 | /* The Darla20 has no external clock sources */ | 73 | /* The Darla20 has no external clock sources */ |
| 70 | static u32 detect_input_clocks(const struct echoaudio *chip) | 74 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 71 | { | 75 | { |
diff --git a/sound/pci/echoaudio/darla24.c b/sound/pci/echoaudio/darla24.c index 04cbf3eaf05a..0a6c50bcd758 100644 --- a/sound/pci/echoaudio/darla24.c +++ b/sound/pci/echoaudio/darla24.c | |||
| @@ -67,7 +67,7 @@ static const struct firmware card_fw[] = { | |||
| 67 | {0, "darla24_dsp.fw"} | 67 | {0, "darla24_dsp.fw"} |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | static struct pci_device_id snd_echo_ids[] = { | 70 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 71 | {0x1057, 0x1801, 0xECC0, 0x0040, 0, 0, 0}, /* DSP 56301 Darla24 rev.0 */ | 71 | {0x1057, 0x1801, 0xECC0, 0x0040, 0, 0, 0}, /* DSP 56301 Darla24 rev.0 */ |
| 72 | {0x1057, 0x1801, 0xECC0, 0x0041, 0, 0, 0}, /* DSP 56301 Darla24 rev.1 */ | 72 | {0x1057, 0x1801, 0xECC0, 0x0041, 0, 0, 0}, /* DSP 56301 Darla24 rev.1 */ |
| 73 | {0,} | 73 | {0,} |
diff --git a/sound/pci/echoaudio/darla24_dsp.c b/sound/pci/echoaudio/darla24_dsp.c index 60228731841f..6da6663e9176 100644 --- a/sound/pci/echoaudio/darla24_dsp.c +++ b/sound/pci/echoaudio/darla24_dsp.c | |||
| @@ -45,7 +45,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 45 | chip->device_id = device_id; | 45 | chip->device_id = device_id; |
| 46 | chip->subdevice_id = subdevice_id; | 46 | chip->subdevice_id = subdevice_id; |
| 47 | chip->bad_board = TRUE; | 47 | chip->bad_board = TRUE; |
| 48 | chip->dsp_code_to_load = &card_fw[FW_DARLA24_DSP]; | 48 | chip->dsp_code_to_load = FW_DARLA24_DSP; |
| 49 | /* Since this card has no ASIC, mark it as loaded so everything | 49 | /* Since this card has no ASIC, mark it as loaded so everything |
| 50 | works OK */ | 50 | works OK */ |
| 51 | chip->asic_loaded = TRUE; | 51 | chip->asic_loaded = TRUE; |
| @@ -56,15 +56,19 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 56 | return err; | 56 | return err; |
| 57 | chip->bad_board = FALSE; | 57 | chip->bad_board = FALSE; |
| 58 | 58 | ||
| 59 | if ((err = init_line_levels(chip)) < 0) | ||
| 60 | return err; | ||
| 61 | |||
| 62 | DE_INIT(("init_hw done\n")); | 59 | DE_INIT(("init_hw done\n")); |
| 63 | return err; | 60 | return err; |
| 64 | } | 61 | } |
| 65 | 62 | ||
| 66 | 63 | ||
| 67 | 64 | ||
| 65 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 66 | { | ||
| 67 | return init_line_levels(chip); | ||
| 68 | } | ||
| 69 | |||
| 70 | |||
| 71 | |||
| 68 | static u32 detect_input_clocks(const struct echoaudio *chip) | 72 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 69 | { | 73 | { |
| 70 | u32 clocks_from_dsp, clock_bits; | 74 | u32 clocks_from_dsp, clock_bits; |
diff --git a/sound/pci/echoaudio/echo3g.c b/sound/pci/echoaudio/echo3g.c index 4022e43a0053..f5142796989b 100644 --- a/sound/pci/echoaudio/echo3g.c +++ b/sound/pci/echoaudio/echo3g.c | |||
| @@ -81,7 +81,7 @@ static const struct firmware card_fw[] = { | |||
| 81 | {0, "3g_asic.fw"} | 81 | {0, "3g_asic.fw"} |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | static struct pci_device_id snd_echo_ids[] = { | 84 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 85 | {0x1057, 0x3410, 0xECC0, 0x0100, 0, 0, 0}, /* Echo 3G */ | 85 | {0x1057, 0x3410, 0xECC0, 0x0100, 0, 0, 0}, /* Echo 3G */ |
| 86 | {0,} | 86 | {0,} |
| 87 | }; | 87 | }; |
diff --git a/sound/pci/echoaudio/echo3g_dsp.c b/sound/pci/echoaudio/echo3g_dsp.c index 57967e580571..3cdc2ee2d1dd 100644 --- a/sound/pci/echoaudio/echo3g_dsp.c +++ b/sound/pci/echoaudio/echo3g_dsp.c | |||
| @@ -61,7 +61,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 61 | chip->subdevice_id = subdevice_id; | 61 | chip->subdevice_id = subdevice_id; |
| 62 | chip->bad_board = TRUE; | 62 | chip->bad_board = TRUE; |
| 63 | chip->has_midi = TRUE; | 63 | chip->has_midi = TRUE; |
| 64 | chip->dsp_code_to_load = &card_fw[FW_ECHO3G_DSP]; | 64 | chip->dsp_code_to_load = FW_ECHO3G_DSP; |
| 65 | 65 | ||
| 66 | /* Load the DSP code and the ASIC on the PCI card and get | 66 | /* Load the DSP code and the ASIC on the PCI card and get |
| 67 | what type of external box is attached */ | 67 | what type of external box is attached */ |
| @@ -97,20 +97,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 97 | chip->digital_modes = ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | | 97 | chip->digital_modes = ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | |
| 98 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | | 98 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | |
| 99 | ECHOCAPS_HAS_DIGITAL_MODE_ADAT; | 99 | ECHOCAPS_HAS_DIGITAL_MODE_ADAT; |
| 100 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 101 | chip->professional_spdif = FALSE; | ||
| 102 | chip->non_audio_spdif = FALSE; | ||
| 103 | chip->bad_board = FALSE; | ||
| 104 | |||
| 105 | if ((err = init_line_levels(chip)) < 0) | ||
| 106 | return err; | ||
| 107 | err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); | ||
| 108 | if (err < 0) | ||
| 109 | return err; | ||
| 110 | err = set_phantom_power(chip, 0); | ||
| 111 | if (err < 0) | ||
| 112 | return err; | ||
| 113 | err = set_professional_spdif(chip, TRUE); | ||
| 114 | 100 | ||
| 115 | DE_INIT(("init_hw done\n")); | 101 | DE_INIT(("init_hw done\n")); |
| 116 | return err; | 102 | return err; |
| @@ -118,6 +104,18 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 118 | 104 | ||
| 119 | 105 | ||
| 120 | 106 | ||
| 107 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 108 | { | ||
| 109 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 110 | chip->professional_spdif = FALSE; | ||
| 111 | chip->non_audio_spdif = FALSE; | ||
| 112 | chip->bad_board = FALSE; | ||
| 113 | chip->phantom_power = FALSE; | ||
| 114 | return init_line_levels(chip); | ||
| 115 | } | ||
| 116 | |||
| 117 | |||
| 118 | |||
| 121 | static int set_phantom_power(struct echoaudio *chip, char on) | 119 | static int set_phantom_power(struct echoaudio *chip, char on) |
| 122 | { | 120 | { |
| 123 | u32 control_reg = le32_to_cpu(chip->comm_page->control_register); | 121 | u32 control_reg = le32_to_cpu(chip->comm_page->control_register); |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 641d7f07392c..8dab82d7d19d 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
| @@ -36,22 +36,61 @@ MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard."); | |||
| 36 | static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999}; | 36 | static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999}; |
| 37 | static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1); | 37 | static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1); |
| 38 | 38 | ||
| 39 | |||
| 40 | |||
| 39 | static int get_firmware(const struct firmware **fw_entry, | 41 | static int get_firmware(const struct firmware **fw_entry, |
| 40 | const struct firmware *frm, struct echoaudio *chip) | 42 | struct echoaudio *chip, const short fw_index) |
| 41 | { | 43 | { |
| 42 | int err; | 44 | int err; |
| 43 | char name[30]; | 45 | char name[30]; |
| 44 | DE_ACT(("firmware requested: %s\n", frm->data)); | 46 | |
| 45 | snprintf(name, sizeof(name), "ea/%s", frm->data); | 47 | #ifdef CONFIG_PM |
| 46 | if ((err = request_firmware(fw_entry, name, pci_device(chip))) < 0) | 48 | if (chip->fw_cache[fw_index]) { |
| 49 | DE_ACT(("firmware requested: %s is cached\n", card_fw[fw_index].data)); | ||
| 50 | *fw_entry = chip->fw_cache[fw_index]; | ||
| 51 | return 0; | ||
| 52 | } | ||
| 53 | #endif | ||
| 54 | |||
| 55 | DE_ACT(("firmware requested: %s\n", card_fw[fw_index].data)); | ||
| 56 | snprintf(name, sizeof(name), "ea/%s", card_fw[fw_index].data); | ||
| 57 | err = request_firmware(fw_entry, name, pci_device(chip)); | ||
| 58 | if (err < 0) | ||
| 47 | snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); | 59 | snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err); |
| 60 | #ifdef CONFIG_PM | ||
| 61 | else | ||
| 62 | chip->fw_cache[fw_index] = *fw_entry; | ||
| 63 | #endif | ||
| 48 | return err; | 64 | return err; |
| 49 | } | 65 | } |
| 50 | 66 | ||
| 67 | |||
| 68 | |||
| 51 | static void free_firmware(const struct firmware *fw_entry) | 69 | static void free_firmware(const struct firmware *fw_entry) |
| 52 | { | 70 | { |
| 71 | #ifdef CONFIG_PM | ||
| 72 | DE_ACT(("firmware not released (kept in cache)\n")); | ||
| 73 | #else | ||
| 53 | release_firmware(fw_entry); | 74 | release_firmware(fw_entry); |
| 54 | DE_ACT(("firmware released\n")); | 75 | DE_ACT(("firmware released\n")); |
| 76 | #endif | ||
| 77 | } | ||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | static void free_firmware_cache(struct echoaudio *chip) | ||
| 82 | { | ||
| 83 | #ifdef CONFIG_PM | ||
| 84 | int i; | ||
| 85 | |||
| 86 | for (i = 0; i < 8 ; i++) | ||
| 87 | if (chip->fw_cache[i]) { | ||
| 88 | release_firmware(chip->fw_cache[i]); | ||
| 89 | DE_ACT(("release_firmware(%d)\n", i)); | ||
| 90 | } | ||
| 91 | |||
| 92 | DE_ACT(("firmware_cache released\n")); | ||
| 93 | #endif | ||
| 55 | } | 94 | } |
| 56 | 95 | ||
| 57 | 96 | ||
| @@ -714,6 +753,8 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 714 | 753 | ||
| 715 | spin_lock(&chip->lock); | 754 | spin_lock(&chip->lock); |
| 716 | switch (cmd) { | 755 | switch (cmd) { |
| 756 | case SNDRV_PCM_TRIGGER_RESUME: | ||
| 757 | DE_ACT(("pcm_trigger resume\n")); | ||
| 717 | case SNDRV_PCM_TRIGGER_START: | 758 | case SNDRV_PCM_TRIGGER_START: |
| 718 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 759 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
| 719 | DE_ACT(("pcm_trigger start\n")); | 760 | DE_ACT(("pcm_trigger start\n")); |
| @@ -737,6 +778,8 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 737 | err = start_transport(chip, channelmask, | 778 | err = start_transport(chip, channelmask, |
| 738 | chip->pipe_cyclic_mask); | 779 | chip->pipe_cyclic_mask); |
| 739 | break; | 780 | break; |
| 781 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| 782 | DE_ACT(("pcm_trigger suspend\n")); | ||
| 740 | case SNDRV_PCM_TRIGGER_STOP: | 783 | case SNDRV_PCM_TRIGGER_STOP: |
| 741 | DE_ACT(("pcm_trigger stop\n")); | 784 | DE_ACT(("pcm_trigger stop\n")); |
| 742 | for (i = 0; i < DSP_MAXPIPES; i++) { | 785 | for (i = 0; i < DSP_MAXPIPES; i++) { |
| @@ -1876,6 +1919,7 @@ static int snd_echo_free(struct echoaudio *chip) | |||
| 1876 | pci_disable_device(chip->pci); | 1919 | pci_disable_device(chip->pci); |
| 1877 | 1920 | ||
| 1878 | /* release chip data */ | 1921 | /* release chip data */ |
| 1922 | free_firmware_cache(chip); | ||
| 1879 | kfree(chip); | 1923 | kfree(chip); |
| 1880 | DE_INIT(("Chip freed.\n")); | 1924 | DE_INIT(("Chip freed.\n")); |
| 1881 | return 0; | 1925 | return 0; |
| @@ -1913,18 +1957,27 @@ static __devinit int snd_echo_create(struct snd_card *card, | |||
| 1913 | return err; | 1957 | return err; |
| 1914 | pci_set_master(pci); | 1958 | pci_set_master(pci); |
| 1915 | 1959 | ||
| 1916 | /* allocate a chip-specific data */ | 1960 | /* Allocate chip if needed */ |
| 1917 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1961 | if (!*rchip) { |
| 1918 | if (!chip) { | 1962 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
| 1919 | pci_disable_device(pci); | 1963 | if (!chip) { |
| 1920 | return -ENOMEM; | 1964 | pci_disable_device(pci); |
| 1965 | return -ENOMEM; | ||
| 1966 | } | ||
| 1967 | DE_INIT(("chip=%p\n", chip)); | ||
| 1968 | spin_lock_init(&chip->lock); | ||
| 1969 | chip->card = card; | ||
| 1970 | chip->pci = pci; | ||
| 1971 | chip->irq = -1; | ||
| 1972 | atomic_set(&chip->opencount, 0); | ||
| 1973 | mutex_init(&chip->mode_mutex); | ||
| 1974 | chip->can_set_rate = 1; | ||
| 1975 | } else { | ||
| 1976 | /* If this was called from the resume function, chip is | ||
| 1977 | * already allocated and it contains current card settings. | ||
| 1978 | */ | ||
| 1979 | chip = *rchip; | ||
| 1921 | } | 1980 | } |
| 1922 | DE_INIT(("chip=%p\n", chip)); | ||
| 1923 | |||
| 1924 | spin_lock_init(&chip->lock); | ||
| 1925 | chip->card = card; | ||
| 1926 | chip->pci = pci; | ||
| 1927 | chip->irq = -1; | ||
| 1928 | 1981 | ||
| 1929 | /* PCI resource allocation */ | 1982 | /* PCI resource allocation */ |
| 1930 | chip->dsp_registers_phys = pci_resource_start(pci, 0); | 1983 | chip->dsp_registers_phys = pci_resource_start(pci, 0); |
| @@ -1964,7 +2017,9 @@ static __devinit int snd_echo_create(struct snd_card *card, | |||
| 1964 | chip->comm_page = (struct comm_page *)chip->commpage_dma_buf.area; | 2017 | chip->comm_page = (struct comm_page *)chip->commpage_dma_buf.area; |
| 1965 | 2018 | ||
| 1966 | err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device); | 2019 | err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device); |
| 1967 | if (err) { | 2020 | if (err >= 0) |
| 2021 | err = set_mixer_defaults(chip); | ||
| 2022 | if (err < 0) { | ||
| 1968 | DE_INIT(("init_hw err=%d\n", err)); | 2023 | DE_INIT(("init_hw err=%d\n", err)); |
| 1969 | snd_echo_free(chip); | 2024 | snd_echo_free(chip); |
| 1970 | return err; | 2025 | return err; |
| @@ -1975,9 +2030,6 @@ static __devinit int snd_echo_create(struct snd_card *card, | |||
| 1975 | snd_echo_free(chip); | 2030 | snd_echo_free(chip); |
| 1976 | return err; | 2031 | return err; |
| 1977 | } | 2032 | } |
| 1978 | atomic_set(&chip->opencount, 0); | ||
| 1979 | mutex_init(&chip->mode_mutex); | ||
| 1980 | chip->can_set_rate = 1; | ||
| 1981 | *rchip = chip; | 2033 | *rchip = chip; |
| 1982 | /* Init done ! */ | 2034 | /* Init done ! */ |
| 1983 | return 0; | 2035 | return 0; |
| @@ -2010,6 +2062,7 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
| 2010 | 2062 | ||
| 2011 | snd_card_set_dev(card, &pci->dev); | 2063 | snd_card_set_dev(card, &pci->dev); |
| 2012 | 2064 | ||
| 2065 | chip = NULL; /* Tells snd_echo_create to allocate chip */ | ||
| 2013 | if ((err = snd_echo_create(card, pci, &chip)) < 0) { | 2066 | if ((err = snd_echo_create(card, pci, &chip)) < 0) { |
| 2014 | snd_card_free(card); | 2067 | snd_card_free(card); |
| 2015 | return err; | 2068 | return err; |
| @@ -2149,6 +2202,112 @@ ctl_error: | |||
| 2149 | 2202 | ||
| 2150 | 2203 | ||
| 2151 | 2204 | ||
| 2205 | #if defined(CONFIG_PM) | ||
| 2206 | |||
| 2207 | static int snd_echo_suspend(struct pci_dev *pci, pm_message_t state) | ||
| 2208 | { | ||
| 2209 | struct echoaudio *chip = pci_get_drvdata(pci); | ||
| 2210 | |||
| 2211 | DE_INIT(("suspend start\n")); | ||
| 2212 | snd_pcm_suspend_all(chip->analog_pcm); | ||
| 2213 | snd_pcm_suspend_all(chip->digital_pcm); | ||
| 2214 | |||
| 2215 | #ifdef ECHOCARD_HAS_MIDI | ||
| 2216 | /* This call can sleep */ | ||
| 2217 | if (chip->midi_out) | ||
| 2218 | snd_echo_midi_output_trigger(chip->midi_out, 0); | ||
| 2219 | #endif | ||
| 2220 | spin_lock_irq(&chip->lock); | ||
| 2221 | if (wait_handshake(chip)) { | ||
| 2222 | spin_unlock_irq(&chip->lock); | ||
| 2223 | return -EIO; | ||
| 2224 | } | ||
| 2225 | clear_handshake(chip); | ||
| 2226 | if (send_vector(chip, DSP_VC_GO_COMATOSE) < 0) { | ||
| 2227 | spin_unlock_irq(&chip->lock); | ||
| 2228 | return -EIO; | ||
| 2229 | } | ||
| 2230 | spin_unlock_irq(&chip->lock); | ||
| 2231 | |||
| 2232 | chip->dsp_code = NULL; | ||
| 2233 | free_irq(chip->irq, chip); | ||
| 2234 | chip->irq = -1; | ||
| 2235 | pci_save_state(pci); | ||
| 2236 | pci_disable_device(pci); | ||
| 2237 | |||
| 2238 | DE_INIT(("suspend done\n")); | ||
| 2239 | return 0; | ||
| 2240 | } | ||
| 2241 | |||
| 2242 | |||
| 2243 | |||
| 2244 | static int snd_echo_resume(struct pci_dev *pci) | ||
| 2245 | { | ||
| 2246 | struct echoaudio *chip = pci_get_drvdata(pci); | ||
| 2247 | struct comm_page *commpage, *commpage_bak; | ||
| 2248 | u32 pipe_alloc_mask; | ||
| 2249 | int err; | ||
| 2250 | |||
| 2251 | DE_INIT(("resume start\n")); | ||
| 2252 | pci_restore_state(pci); | ||
| 2253 | commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); | ||
| 2254 | commpage = chip->comm_page; | ||
| 2255 | memcpy(commpage_bak, commpage, sizeof(struct comm_page)); | ||
| 2256 | |||
| 2257 | err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device); | ||
| 2258 | if (err < 0) { | ||
| 2259 | kfree(commpage_bak); | ||
| 2260 | DE_INIT(("resume init_hw err=%d\n", err)); | ||
| 2261 | snd_echo_free(chip); | ||
| 2262 | return err; | ||
| 2263 | } | ||
| 2264 | DE_INIT(("resume init OK\n")); | ||
| 2265 | |||
| 2266 | /* Temporarily set chip->pipe_alloc_mask=0 otherwise | ||
| 2267 | * restore_dsp_settings() fails. | ||
| 2268 | */ | ||
| 2269 | pipe_alloc_mask = chip->pipe_alloc_mask; | ||
| 2270 | chip->pipe_alloc_mask = 0; | ||
| 2271 | err = restore_dsp_rettings(chip); | ||
| 2272 | chip->pipe_alloc_mask = pipe_alloc_mask; | ||
| 2273 | if (err < 0) { | ||
| 2274 | kfree(commpage_bak); | ||
| 2275 | return err; | ||
| 2276 | } | ||
| 2277 | DE_INIT(("resume restore OK\n")); | ||
| 2278 | |||
| 2279 | memcpy(&commpage->audio_format, &commpage_bak->audio_format, | ||
| 2280 | sizeof(commpage->audio_format)); | ||
| 2281 | memcpy(&commpage->sglist_addr, &commpage_bak->sglist_addr, | ||
| 2282 | sizeof(commpage->sglist_addr)); | ||
| 2283 | memcpy(&commpage->midi_output, &commpage_bak->midi_output, | ||
| 2284 | sizeof(commpage->midi_output)); | ||
| 2285 | kfree(commpage_bak); | ||
| 2286 | |||
| 2287 | if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, | ||
| 2288 | ECHOCARD_NAME, chip)) { | ||
| 2289 | snd_echo_free(chip); | ||
| 2290 | snd_printk(KERN_ERR "cannot grab irq\n"); | ||
| 2291 | return -EBUSY; | ||
| 2292 | } | ||
| 2293 | chip->irq = pci->irq; | ||
| 2294 | DE_INIT(("resume irq=%d\n", chip->irq)); | ||
| 2295 | |||
| 2296 | #ifdef ECHOCARD_HAS_MIDI | ||
| 2297 | if (chip->midi_input_enabled) | ||
| 2298 | enable_midi_input(chip, TRUE); | ||
| 2299 | if (chip->midi_out) | ||
| 2300 | snd_echo_midi_output_trigger(chip->midi_out, 1); | ||
| 2301 | #endif | ||
| 2302 | |||
| 2303 | DE_INIT(("resume done\n")); | ||
| 2304 | return 0; | ||
| 2305 | } | ||
| 2306 | |||
| 2307 | #endif /* CONFIG_PM */ | ||
| 2308 | |||
| 2309 | |||
| 2310 | |||
| 2152 | static void __devexit snd_echo_remove(struct pci_dev *pci) | 2311 | static void __devexit snd_echo_remove(struct pci_dev *pci) |
| 2153 | { | 2312 | { |
| 2154 | struct echoaudio *chip; | 2313 | struct echoaudio *chip; |
| @@ -2171,6 +2330,10 @@ static struct pci_driver driver = { | |||
| 2171 | .id_table = snd_echo_ids, | 2330 | .id_table = snd_echo_ids, |
| 2172 | .probe = snd_echo_probe, | 2331 | .probe = snd_echo_probe, |
| 2173 | .remove = __devexit_p(snd_echo_remove), | 2332 | .remove = __devexit_p(snd_echo_remove), |
| 2333 | #ifdef CONFIG_PM | ||
| 2334 | .suspend = snd_echo_suspend, | ||
| 2335 | .resume = snd_echo_resume, | ||
| 2336 | #endif /* CONFIG_PM */ | ||
| 2174 | }; | 2337 | }; |
| 2175 | 2338 | ||
| 2176 | 2339 | ||
diff --git a/sound/pci/echoaudio/echoaudio.h b/sound/pci/echoaudio/echoaudio.h index f9490ae36c2e..1df974dcb5f4 100644 --- a/sound/pci/echoaudio/echoaudio.h +++ b/sound/pci/echoaudio/echoaudio.h | |||
| @@ -442,13 +442,16 @@ struct echoaudio { | |||
| 442 | u16 device_id, subdevice_id; | 442 | u16 device_id, subdevice_id; |
| 443 | u16 *dsp_code; /* Current DSP code loaded, | 443 | u16 *dsp_code; /* Current DSP code loaded, |
| 444 | * NULL if nothing loaded */ | 444 | * NULL if nothing loaded */ |
| 445 | const struct firmware *dsp_code_to_load;/* DSP code to load */ | 445 | short dsp_code_to_load; /* DSP code to load */ |
| 446 | const struct firmware *asic_code; /* Current ASIC code */ | 446 | short asic_code; /* Current ASIC code */ |
| 447 | u32 comm_page_phys; /* Physical address of the | 447 | u32 comm_page_phys; /* Physical address of the |
| 448 | * memory seen by DSP */ | 448 | * memory seen by DSP */ |
| 449 | volatile u32 __iomem *dsp_registers; /* DSP's register base */ | 449 | volatile u32 __iomem *dsp_registers; /* DSP's register base */ |
| 450 | u32 active_mask; /* Chs. active mask or | 450 | u32 active_mask; /* Chs. active mask or |
| 451 | * punks out */ | 451 | * punks out */ |
| 452 | #ifdef CONFIG_PM | ||
| 453 | const struct firmware *fw_cache[8]; /* Cached firmwares */ | ||
| 454 | #endif | ||
| 452 | 455 | ||
| 453 | #ifdef ECHOCARD_HAS_MIDI | 456 | #ifdef ECHOCARD_HAS_MIDI |
| 454 | u16 mtc_state; /* State for MIDI input parsing state machine */ | 457 | u16 mtc_state; /* State for MIDI input parsing state machine */ |
| @@ -464,11 +467,13 @@ static int load_firmware(struct echoaudio *chip); | |||
| 464 | static int wait_handshake(struct echoaudio *chip); | 467 | static int wait_handshake(struct echoaudio *chip); |
| 465 | static int send_vector(struct echoaudio *chip, u32 command); | 468 | static int send_vector(struct echoaudio *chip, u32 command); |
| 466 | static int get_firmware(const struct firmware **fw_entry, | 469 | static int get_firmware(const struct firmware **fw_entry, |
| 467 | const struct firmware *frm, struct echoaudio *chip); | 470 | struct echoaudio *chip, const short fw_index); |
| 468 | static void free_firmware(const struct firmware *fw_entry); | 471 | static void free_firmware(const struct firmware *fw_entry); |
| 469 | 472 | ||
| 470 | #ifdef ECHOCARD_HAS_MIDI | 473 | #ifdef ECHOCARD_HAS_MIDI |
| 471 | static int enable_midi_input(struct echoaudio *chip, char enable); | 474 | static int enable_midi_input(struct echoaudio *chip, char enable); |
| 475 | static void snd_echo_midi_output_trigger( | ||
| 476 | struct snd_rawmidi_substream *substream, int up); | ||
| 472 | static int midi_service_irq(struct echoaudio *chip); | 477 | static int midi_service_irq(struct echoaudio *chip); |
| 473 | static int __devinit snd_echo_midi_create(struct snd_card *card, | 478 | static int __devinit snd_echo_midi_create(struct snd_card *card, |
| 474 | struct echoaudio *chip); | 479 | struct echoaudio *chip); |
diff --git a/sound/pci/echoaudio/echoaudio_3g.c b/sound/pci/echoaudio/echoaudio_3g.c index e32a74897921..658db44ef746 100644 --- a/sound/pci/echoaudio/echoaudio_3g.c +++ b/sound/pci/echoaudio/echoaudio_3g.c | |||
| @@ -227,12 +227,11 @@ static int load_asic(struct echoaudio *chip) | |||
| 227 | /* Give the DSP a few milliseconds to settle down */ | 227 | /* Give the DSP a few milliseconds to settle down */ |
| 228 | mdelay(2); | 228 | mdelay(2); |
| 229 | 229 | ||
| 230 | err = load_asic_generic(chip, DSP_FNC_LOAD_3G_ASIC, | 230 | err = load_asic_generic(chip, DSP_FNC_LOAD_3G_ASIC, FW_3G_ASIC); |
| 231 | &card_fw[FW_3G_ASIC]); | ||
| 232 | if (err < 0) | 231 | if (err < 0) |
| 233 | return err; | 232 | return err; |
| 234 | 233 | ||
| 235 | chip->asic_code = &card_fw[FW_3G_ASIC]; | 234 | chip->asic_code = FW_3G_ASIC; |
| 236 | 235 | ||
| 237 | /* Now give the new ASIC some time to set up */ | 236 | /* Now give the new ASIC some time to set up */ |
| 238 | msleep(1000); | 237 | msleep(1000); |
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c index 4df51ef5e095..64417a733220 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.c +++ b/sound/pci/echoaudio/echoaudio_dsp.c | |||
| @@ -175,15 +175,15 @@ static inline int check_asic_status(struct echoaudio *chip) | |||
| 175 | #ifdef ECHOCARD_HAS_ASIC | 175 | #ifdef ECHOCARD_HAS_ASIC |
| 176 | 176 | ||
| 177 | /* Load ASIC code - done after the DSP is loaded */ | 177 | /* Load ASIC code - done after the DSP is loaded */ |
| 178 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, | 178 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic) |
| 179 | const struct firmware *asic) | ||
| 180 | { | 179 | { |
| 181 | const struct firmware *fw; | 180 | const struct firmware *fw; |
| 182 | int err; | 181 | int err; |
| 183 | u32 i, size; | 182 | u32 i, size; |
| 184 | u8 *code; | 183 | u8 *code; |
| 185 | 184 | ||
| 186 | if ((err = get_firmware(&fw, asic, chip)) < 0) { | 185 | err = get_firmware(&fw, chip, asic); |
| 186 | if (err < 0) { | ||
| 187 | snd_printk(KERN_WARNING "Firmware not found !\n"); | 187 | snd_printk(KERN_WARNING "Firmware not found !\n"); |
| 188 | return err; | 188 | return err; |
| 189 | } | 189 | } |
| @@ -245,7 +245,8 @@ static int install_resident_loader(struct echoaudio *chip) | |||
| 245 | return 0; | 245 | return 0; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | if ((i = get_firmware(&fw, &card_fw[FW_361_LOADER], chip)) < 0) { | 248 | i = get_firmware(&fw, chip, FW_361_LOADER); |
| 249 | if (i < 0) { | ||
| 249 | snd_printk(KERN_WARNING "Firmware not found !\n"); | 250 | snd_printk(KERN_WARNING "Firmware not found !\n"); |
| 250 | return i; | 251 | return i; |
| 251 | } | 252 | } |
| @@ -485,7 +486,8 @@ static int load_firmware(struct echoaudio *chip) | |||
| 485 | chip->dsp_code = NULL; | 486 | chip->dsp_code = NULL; |
| 486 | } | 487 | } |
| 487 | 488 | ||
| 488 | if ((err = get_firmware(&fw, chip->dsp_code_to_load, chip)) < 0) | 489 | err = get_firmware(&fw, chip, chip->dsp_code_to_load); |
| 490 | if (err < 0) | ||
| 489 | return err; | 491 | return err; |
| 490 | err = load_dsp(chip, (u16 *)fw->data); | 492 | err = load_dsp(chip, (u16 *)fw->data); |
| 491 | free_firmware(fw); | 493 | free_firmware(fw); |
| @@ -495,9 +497,6 @@ static int load_firmware(struct echoaudio *chip) | |||
| 495 | if ((box_type = load_asic(chip)) < 0) | 497 | if ((box_type = load_asic(chip)) < 0) |
| 496 | return box_type; /* error */ | 498 | return box_type; /* error */ |
| 497 | 499 | ||
| 498 | if ((err = restore_dsp_rettings(chip)) < 0) | ||
| 499 | return err; | ||
| 500 | |||
| 501 | return box_type; | 500 | return box_type; |
| 502 | } | 501 | } |
| 503 | 502 | ||
| @@ -657,51 +656,106 @@ static void get_audio_meters(struct echoaudio *chip, long *meters) | |||
| 657 | 656 | ||
| 658 | static int restore_dsp_rettings(struct echoaudio *chip) | 657 | static int restore_dsp_rettings(struct echoaudio *chip) |
| 659 | { | 658 | { |
| 660 | int err; | 659 | int i, o, err; |
| 661 | DE_INIT(("restore_dsp_settings\n")); | 660 | DE_INIT(("restore_dsp_settings\n")); |
| 662 | 661 | ||
| 663 | if ((err = check_asic_status(chip)) < 0) | 662 | if ((err = check_asic_status(chip)) < 0) |
| 664 | return err; | 663 | return err; |
| 665 | 664 | ||
| 666 | /* @ Gina20/Darla20 only. Should be harmless for other cards. */ | 665 | /* Gina20/Darla20 only. Should be harmless for other cards. */ |
| 667 | chip->comm_page->gd_clock_state = GD_CLOCK_UNDEF; | 666 | chip->comm_page->gd_clock_state = GD_CLOCK_UNDEF; |
| 668 | chip->comm_page->gd_spdif_status = GD_SPDIF_STATUS_UNDEF; | 667 | chip->comm_page->gd_spdif_status = GD_SPDIF_STATUS_UNDEF; |
| 669 | chip->comm_page->handshake = 0xffffffff; | 668 | chip->comm_page->handshake = 0xffffffff; |
| 670 | 669 | ||
| 671 | if ((err = set_sample_rate(chip, chip->sample_rate)) < 0) | 670 | /* Restore output busses */ |
| 671 | for (i = 0; i < num_busses_out(chip); i++) { | ||
| 672 | err = set_output_gain(chip, i, chip->output_gain[i]); | ||
| 673 | if (err < 0) | ||
| 674 | return err; | ||
| 675 | } | ||
| 676 | |||
| 677 | #ifdef ECHOCARD_HAS_VMIXER | ||
| 678 | for (i = 0; i < num_pipes_out(chip); i++) | ||
| 679 | for (o = 0; o < num_busses_out(chip); o++) { | ||
| 680 | err = set_vmixer_gain(chip, o, i, | ||
| 681 | chip->vmixer_gain[o][i]); | ||
| 682 | if (err < 0) | ||
| 683 | return err; | ||
| 684 | } | ||
| 685 | if (update_vmixer_level(chip) < 0) | ||
| 686 | return -EIO; | ||
| 687 | #endif /* ECHOCARD_HAS_VMIXER */ | ||
| 688 | |||
| 689 | #ifdef ECHOCARD_HAS_MONITOR | ||
| 690 | for (o = 0; o < num_busses_out(chip); o++) | ||
| 691 | for (i = 0; i < num_busses_in(chip); i++) { | ||
| 692 | err = set_monitor_gain(chip, o, i, | ||
| 693 | chip->monitor_gain[o][i]); | ||
| 694 | if (err < 0) | ||
| 695 | return err; | ||
| 696 | } | ||
| 697 | #endif /* ECHOCARD_HAS_MONITOR */ | ||
| 698 | |||
| 699 | #ifdef ECHOCARD_HAS_INPUT_GAIN | ||
| 700 | for (i = 0; i < num_busses_in(chip); i++) { | ||
| 701 | err = set_input_gain(chip, i, chip->input_gain[i]); | ||
| 702 | if (err < 0) | ||
| 703 | return err; | ||
| 704 | } | ||
| 705 | #endif /* ECHOCARD_HAS_INPUT_GAIN */ | ||
| 706 | |||
| 707 | err = update_output_line_level(chip); | ||
| 708 | if (err < 0) | ||
| 672 | return err; | 709 | return err; |
| 673 | 710 | ||
| 674 | if (chip->meters_enabled) | 711 | err = update_input_line_level(chip); |
| 675 | if (send_vector(chip, DSP_VC_METERS_ON) < 0) | 712 | if (err < 0) |
| 676 | return -EIO; | 713 | return err; |
| 677 | 714 | ||
| 678 | #ifdef ECHOCARD_HAS_EXTERNAL_CLOCK | 715 | err = set_sample_rate(chip, chip->sample_rate); |
| 679 | if (set_input_clock(chip, chip->input_clock) < 0) | 716 | if (err < 0) |
| 717 | return err; | ||
| 718 | |||
| 719 | if (chip->meters_enabled) { | ||
| 720 | err = send_vector(chip, DSP_VC_METERS_ON); | ||
| 721 | if (err < 0) | ||
| 722 | return err; | ||
| 723 | } | ||
| 724 | |||
| 725 | #ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH | ||
| 726 | if (set_digital_mode(chip, chip->digital_mode) < 0) | ||
| 680 | return -EIO; | 727 | return -EIO; |
| 681 | #endif | 728 | #endif |
| 682 | 729 | ||
| 683 | #ifdef ECHOCARD_HAS_OUTPUT_CLOCK_SWITCH | 730 | #ifdef ECHOCARD_HAS_DIGITAL_IO |
| 684 | if (set_output_clock(chip, chip->output_clock) < 0) | 731 | if (set_professional_spdif(chip, chip->professional_spdif) < 0) |
| 685 | return -EIO; | 732 | return -EIO; |
| 686 | #endif | 733 | #endif |
| 687 | 734 | ||
| 688 | if (update_output_line_level(chip) < 0) | 735 | #ifdef ECHOCARD_HAS_PHANTOM_POWER |
| 736 | if (set_phantom_power(chip, chip->phantom_power) < 0) | ||
| 689 | return -EIO; | 737 | return -EIO; |
| 738 | #endif | ||
| 690 | 739 | ||
| 691 | if (update_input_line_level(chip) < 0) | 740 | #ifdef ECHOCARD_HAS_EXTERNAL_CLOCK |
| 741 | /* set_input_clock() also restores automute setting */ | ||
| 742 | if (set_input_clock(chip, chip->input_clock) < 0) | ||
| 692 | return -EIO; | 743 | return -EIO; |
| 744 | #endif | ||
| 693 | 745 | ||
| 694 | #ifdef ECHOCARD_HAS_VMIXER | 746 | #ifdef ECHOCARD_HAS_OUTPUT_CLOCK_SWITCH |
| 695 | if (update_vmixer_level(chip) < 0) | 747 | if (set_output_clock(chip, chip->output_clock) < 0) |
| 696 | return -EIO; | 748 | return -EIO; |
| 697 | #endif | 749 | #endif |
| 698 | 750 | ||
| 699 | if (wait_handshake(chip) < 0) | 751 | if (wait_handshake(chip) < 0) |
| 700 | return -EIO; | 752 | return -EIO; |
| 701 | clear_handshake(chip); | 753 | clear_handshake(chip); |
| 754 | if (send_vector(chip, DSP_VC_UPDATE_FLAGS) < 0) | ||
| 755 | return -EIO; | ||
| 702 | 756 | ||
| 703 | DE_INIT(("restore_dsp_rettings done\n")); | 757 | DE_INIT(("restore_dsp_rettings done\n")); |
| 704 | return send_vector(chip, DSP_VC_UPDATE_FLAGS); | 758 | return 0; |
| 705 | } | 759 | } |
| 706 | 760 | ||
| 707 | 761 | ||
| @@ -918,9 +972,6 @@ static int init_dsp_comm_page(struct echoaudio *chip) | |||
| 918 | chip->card_name = ECHOCARD_NAME; | 972 | chip->card_name = ECHOCARD_NAME; |
| 919 | chip->bad_board = TRUE; /* Set TRUE until DSP loaded */ | 973 | chip->bad_board = TRUE; /* Set TRUE until DSP loaded */ |
| 920 | chip->dsp_code = NULL; /* Current DSP code not loaded */ | 974 | chip->dsp_code = NULL; /* Current DSP code not loaded */ |
| 921 | chip->digital_mode = DIGITAL_MODE_NONE; | ||
| 922 | chip->input_clock = ECHO_CLOCK_INTERNAL; | ||
| 923 | chip->output_clock = ECHO_CLOCK_WORD; | ||
| 924 | chip->asic_loaded = FALSE; | 975 | chip->asic_loaded = FALSE; |
| 925 | memset(chip->comm_page, 0, sizeof(struct comm_page)); | 976 | memset(chip->comm_page, 0, sizeof(struct comm_page)); |
| 926 | 977 | ||
| @@ -931,7 +982,6 @@ static int init_dsp_comm_page(struct echoaudio *chip) | |||
| 931 | chip->comm_page->midi_out_free_count = | 982 | chip->comm_page->midi_out_free_count = |
| 932 | cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE); | 983 | cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE); |
| 933 | chip->comm_page->sample_rate = cpu_to_le32(44100); | 984 | chip->comm_page->sample_rate = cpu_to_le32(44100); |
| 934 | chip->sample_rate = 44100; | ||
| 935 | 985 | ||
| 936 | /* Set line levels so we don't blast any inputs on startup */ | 986 | /* Set line levels so we don't blast any inputs on startup */ |
| 937 | memset(chip->comm_page->monitors, ECHOGAIN_MUTED, MONITOR_ARRAY_SIZE); | 987 | memset(chip->comm_page->monitors, ECHOGAIN_MUTED, MONITOR_ARRAY_SIZE); |
| @@ -942,50 +992,21 @@ static int init_dsp_comm_page(struct echoaudio *chip) | |||
| 942 | 992 | ||
| 943 | 993 | ||
| 944 | 994 | ||
| 945 | /* This function initializes the several volume controls for busses and pipes. | 995 | /* This function initializes the chip structure with default values, ie. all |
| 946 | This MUST be called after the DSP is up and running ! */ | 996 | * muted and internal clock source. Then it copies the settings to the DSP. |
| 997 | * This MUST be called after the DSP is up and running ! | ||
| 998 | */ | ||
| 947 | static int init_line_levels(struct echoaudio *chip) | 999 | static int init_line_levels(struct echoaudio *chip) |
| 948 | { | 1000 | { |
| 949 | int st, i, o; | ||
| 950 | |||
| 951 | DE_INIT(("init_line_levels\n")); | 1001 | DE_INIT(("init_line_levels\n")); |
| 952 | 1002 | memset(chip->output_gain, ECHOGAIN_MUTED, sizeof(chip->output_gain)); | |
| 953 | /* Mute output busses */ | 1003 | memset(chip->input_gain, ECHOGAIN_MUTED, sizeof(chip->input_gain)); |
| 954 | for (i = 0; i < num_busses_out(chip); i++) | 1004 | memset(chip->monitor_gain, ECHOGAIN_MUTED, sizeof(chip->monitor_gain)); |
| 955 | if ((st = set_output_gain(chip, i, ECHOGAIN_MUTED))) | 1005 | memset(chip->vmixer_gain, ECHOGAIN_MUTED, sizeof(chip->vmixer_gain)); |
| 956 | return st; | 1006 | chip->input_clock = ECHO_CLOCK_INTERNAL; |
| 957 | if ((st = update_output_line_level(chip))) | 1007 | chip->output_clock = ECHO_CLOCK_WORD; |
| 958 | return st; | 1008 | chip->sample_rate = 44100; |
| 959 | 1009 | return restore_dsp_rettings(chip); | |
| 960 | #ifdef ECHOCARD_HAS_VMIXER | ||
| 961 | /* Mute the Vmixer */ | ||
| 962 | for (i = 0; i < num_pipes_out(chip); i++) | ||
| 963 | for (o = 0; o < num_busses_out(chip); o++) | ||
| 964 | if ((st = set_vmixer_gain(chip, o, i, ECHOGAIN_MUTED))) | ||
| 965 | return st; | ||
| 966 | if ((st = update_vmixer_level(chip))) | ||
| 967 | return st; | ||
| 968 | #endif /* ECHOCARD_HAS_VMIXER */ | ||
| 969 | |||
| 970 | #ifdef ECHOCARD_HAS_MONITOR | ||
| 971 | /* Mute the monitor mixer */ | ||
| 972 | for (o = 0; o < num_busses_out(chip); o++) | ||
| 973 | for (i = 0; i < num_busses_in(chip); i++) | ||
| 974 | if ((st = set_monitor_gain(chip, o, i, ECHOGAIN_MUTED))) | ||
| 975 | return st; | ||
| 976 | if ((st = update_output_line_level(chip))) | ||
| 977 | return st; | ||
| 978 | #endif /* ECHOCARD_HAS_MONITOR */ | ||
| 979 | |||
| 980 | #ifdef ECHOCARD_HAS_INPUT_GAIN | ||
| 981 | for (i = 0; i < num_busses_in(chip); i++) | ||
| 982 | if ((st = set_input_gain(chip, i, ECHOGAIN_MUTED))) | ||
| 983 | return st; | ||
| 984 | if ((st = update_input_line_level(chip))) | ||
| 985 | return st; | ||
| 986 | #endif /* ECHOCARD_HAS_INPUT_GAIN */ | ||
| 987 | |||
| 988 | return 0; | ||
| 989 | } | 1010 | } |
| 990 | 1011 | ||
| 991 | 1012 | ||
diff --git a/sound/pci/echoaudio/gina20.c b/sound/pci/echoaudio/gina20.c index c0e64b8f52a4..2364f8a1bc21 100644 --- a/sound/pci/echoaudio/gina20.c +++ b/sound/pci/echoaudio/gina20.c | |||
| @@ -67,7 +67,7 @@ static const struct firmware card_fw[] = { | |||
| 67 | {0, "gina20_dsp.fw"} | 67 | {0, "gina20_dsp.fw"} |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | static struct pci_device_id snd_echo_ids[] = { | 70 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 71 | {0x1057, 0x1801, 0xECC0, 0x0020, 0, 0, 0}, /* DSP 56301 Gina20 rev.0 */ | 71 | {0x1057, 0x1801, 0xECC0, 0x0020, 0, 0, 0}, /* DSP 56301 Gina20 rev.0 */ |
| 72 | {0,} | 72 | {0,} |
| 73 | }; | 73 | }; |
diff --git a/sound/pci/echoaudio/gina20_dsp.c b/sound/pci/echoaudio/gina20_dsp.c index 3f1e7475faea..d1615a0579d1 100644 --- a/sound/pci/echoaudio/gina20_dsp.c +++ b/sound/pci/echoaudio/gina20_dsp.c | |||
| @@ -49,7 +49,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 49 | chip->device_id = device_id; | 49 | chip->device_id = device_id; |
| 50 | chip->subdevice_id = subdevice_id; | 50 | chip->subdevice_id = subdevice_id; |
| 51 | chip->bad_board = TRUE; | 51 | chip->bad_board = TRUE; |
| 52 | chip->dsp_code_to_load = &card_fw[FW_GINA20_DSP]; | 52 | chip->dsp_code_to_load = FW_GINA20_DSP; |
| 53 | chip->spdif_status = GD_SPDIF_STATUS_UNDEF; | 53 | chip->spdif_status = GD_SPDIF_STATUS_UNDEF; |
| 54 | chip->clock_state = GD_CLOCK_UNDEF; | 54 | chip->clock_state = GD_CLOCK_UNDEF; |
| 55 | /* Since this card has no ASIC, mark it as loaded so everything | 55 | /* Since this card has no ASIC, mark it as loaded so everything |
| @@ -62,17 +62,20 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 62 | return err; | 62 | return err; |
| 63 | chip->bad_board = FALSE; | 63 | chip->bad_board = FALSE; |
| 64 | 64 | ||
| 65 | if ((err = init_line_levels(chip)) < 0) | ||
| 66 | return err; | ||
| 67 | |||
| 68 | err = set_professional_spdif(chip, TRUE); | ||
| 69 | |||
| 70 | DE_INIT(("init_hw done\n")); | 65 | DE_INIT(("init_hw done\n")); |
| 71 | return err; | 66 | return err; |
| 72 | } | 67 | } |
| 73 | 68 | ||
| 74 | 69 | ||
| 75 | 70 | ||
| 71 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 72 | { | ||
| 73 | chip->professional_spdif = FALSE; | ||
| 74 | return init_line_levels(chip); | ||
| 75 | } | ||
| 76 | |||
| 77 | |||
| 78 | |||
| 76 | static u32 detect_input_clocks(const struct echoaudio *chip) | 79 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 77 | { | 80 | { |
| 78 | u32 clocks_from_dsp, clock_bits; | 81 | u32 clocks_from_dsp, clock_bits; |
diff --git a/sound/pci/echoaudio/gina24.c b/sound/pci/echoaudio/gina24.c index c36a78dd0b5e..616b55825a19 100644 --- a/sound/pci/echoaudio/gina24.c +++ b/sound/pci/echoaudio/gina24.c | |||
| @@ -85,7 +85,7 @@ static const struct firmware card_fw[] = { | |||
| 85 | {0, "gina24_361_asic.fw"} | 85 | {0, "gina24_361_asic.fw"} |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | static struct pci_device_id snd_echo_ids[] = { | 88 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 89 | {0x1057, 0x1801, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56301 Gina24 rev.0 */ | 89 | {0x1057, 0x1801, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56301 Gina24 rev.0 */ |
| 90 | {0x1057, 0x1801, 0xECC0, 0x0051, 0, 0, 0}, /* DSP 56301 Gina24 rev.1 */ | 90 | {0x1057, 0x1801, 0xECC0, 0x0051, 0, 0, 0}, /* DSP 56301 Gina24 rev.1 */ |
| 91 | {0x1057, 0x3410, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56361 Gina24 rev.0 */ | 91 | {0x1057, 0x3410, 0xECC0, 0x0050, 0, 0, 0}, /* DSP 56361 Gina24 rev.0 */ |
diff --git a/sound/pci/echoaudio/gina24_dsp.c b/sound/pci/echoaudio/gina24_dsp.c index 2fef37a2a5b9..98f7cfa81b5f 100644 --- a/sound/pci/echoaudio/gina24_dsp.c +++ b/sound/pci/echoaudio/gina24_dsp.c | |||
| @@ -33,8 +33,7 @@ static int write_control_reg(struct echoaudio *chip, u32 value, char force); | |||
| 33 | static int set_input_clock(struct echoaudio *chip, u16 clock); | 33 | static int set_input_clock(struct echoaudio *chip, u16 clock); |
| 34 | static int set_professional_spdif(struct echoaudio *chip, char prof); | 34 | static int set_professional_spdif(struct echoaudio *chip, char prof); |
| 35 | static int set_digital_mode(struct echoaudio *chip, u8 mode); | 35 | static int set_digital_mode(struct echoaudio *chip, u8 mode); |
| 36 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, | 36 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic); |
| 37 | const struct firmware *asic); | ||
| 38 | static int check_asic_status(struct echoaudio *chip); | 37 | static int check_asic_status(struct echoaudio *chip); |
| 39 | 38 | ||
| 40 | 39 | ||
| @@ -58,19 +57,16 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 58 | ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF | | 57 | ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF | |
| 59 | ECHO_CLOCK_BIT_ESYNC | ECHO_CLOCK_BIT_ESYNC96 | | 58 | ECHO_CLOCK_BIT_ESYNC | ECHO_CLOCK_BIT_ESYNC96 | |
| 60 | ECHO_CLOCK_BIT_ADAT; | 59 | ECHO_CLOCK_BIT_ADAT; |
| 61 | chip->professional_spdif = FALSE; | ||
| 62 | chip->digital_in_automute = TRUE; | ||
| 63 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 64 | 60 | ||
| 65 | /* Gina24 comes in both '301 and '361 flavors */ | 61 | /* Gina24 comes in both '301 and '361 flavors */ |
| 66 | if (chip->device_id == DEVICE_ID_56361) { | 62 | if (chip->device_id == DEVICE_ID_56361) { |
| 67 | chip->dsp_code_to_load = &card_fw[FW_GINA24_361_DSP]; | 63 | chip->dsp_code_to_load = FW_GINA24_361_DSP; |
| 68 | chip->digital_modes = | 64 | chip->digital_modes = |
| 69 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | | 65 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | |
| 70 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | | 66 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | |
| 71 | ECHOCAPS_HAS_DIGITAL_MODE_ADAT; | 67 | ECHOCAPS_HAS_DIGITAL_MODE_ADAT; |
| 72 | } else { | 68 | } else { |
| 73 | chip->dsp_code_to_load = &card_fw[FW_GINA24_301_DSP]; | 69 | chip->dsp_code_to_load = FW_GINA24_301_DSP; |
| 74 | chip->digital_modes = | 70 | chip->digital_modes = |
| 75 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | | 71 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | |
| 76 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | | 72 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | |
| @@ -82,19 +78,22 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 82 | return err; | 78 | return err; |
| 83 | chip->bad_board = FALSE; | 79 | chip->bad_board = FALSE; |
| 84 | 80 | ||
| 85 | if ((err = init_line_levels(chip)) < 0) | ||
| 86 | return err; | ||
| 87 | err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); | ||
| 88 | if (err < 0) | ||
| 89 | return err; | ||
| 90 | err = set_professional_spdif(chip, TRUE); | ||
| 91 | |||
| 92 | DE_INIT(("init_hw done\n")); | 81 | DE_INIT(("init_hw done\n")); |
| 93 | return err; | 82 | return err; |
| 94 | } | 83 | } |
| 95 | 84 | ||
| 96 | 85 | ||
| 97 | 86 | ||
| 87 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 88 | { | ||
| 89 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 90 | chip->professional_spdif = FALSE; | ||
| 91 | chip->digital_in_automute = TRUE; | ||
| 92 | return init_line_levels(chip); | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
| 96 | |||
| 98 | static u32 detect_input_clocks(const struct echoaudio *chip) | 97 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 99 | { | 98 | { |
| 100 | u32 clocks_from_dsp, clock_bits; | 99 | u32 clocks_from_dsp, clock_bits; |
| @@ -125,7 +124,7 @@ static int load_asic(struct echoaudio *chip) | |||
| 125 | { | 124 | { |
| 126 | u32 control_reg; | 125 | u32 control_reg; |
| 127 | int err; | 126 | int err; |
| 128 | const struct firmware *fw; | 127 | short asic; |
| 129 | 128 | ||
| 130 | if (chip->asic_loaded) | 129 | if (chip->asic_loaded) |
| 131 | return 1; | 130 | return 1; |
| @@ -135,14 +134,15 @@ static int load_asic(struct echoaudio *chip) | |||
| 135 | 134 | ||
| 136 | /* Pick the correct ASIC for '301 or '361 Gina24 */ | 135 | /* Pick the correct ASIC for '301 or '361 Gina24 */ |
| 137 | if (chip->device_id == DEVICE_ID_56361) | 136 | if (chip->device_id == DEVICE_ID_56361) |
| 138 | fw = &card_fw[FW_GINA24_361_ASIC]; | 137 | asic = FW_GINA24_361_ASIC; |
| 139 | else | 138 | else |
| 140 | fw = &card_fw[FW_GINA24_301_ASIC]; | 139 | asic = FW_GINA24_301_ASIC; |
| 141 | 140 | ||
| 142 | if ((err = load_asic_generic(chip, DSP_FNC_LOAD_GINA24_ASIC, fw)) < 0) | 141 | err = load_asic_generic(chip, DSP_FNC_LOAD_GINA24_ASIC, asic); |
| 142 | if (err < 0) | ||
| 143 | return err; | 143 | return err; |
| 144 | 144 | ||
| 145 | chip->asic_code = fw; | 145 | chip->asic_code = asic; |
| 146 | 146 | ||
| 147 | /* Now give the new ASIC a little time to set up */ | 147 | /* Now give the new ASIC a little time to set up */ |
| 148 | mdelay(10); | 148 | mdelay(10); |
diff --git a/sound/pci/echoaudio/indigo.c b/sound/pci/echoaudio/indigo.c index 0a58a7c1fd7c..776175c0bdad 100644 --- a/sound/pci/echoaudio/indigo.c +++ b/sound/pci/echoaudio/indigo.c | |||
| @@ -68,7 +68,7 @@ static const struct firmware card_fw[] = { | |||
| 68 | {0, "indigo_dsp.fw"} | 68 | {0, "indigo_dsp.fw"} |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | static struct pci_device_id snd_echo_ids[] = { | 71 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 72 | {0x1057, 0x3410, 0xECC0, 0x0090, 0, 0, 0}, /* Indigo */ | 72 | {0x1057, 0x3410, 0xECC0, 0x0090, 0, 0, 0}, /* Indigo */ |
| 73 | {0,} | 73 | {0,} |
| 74 | }; | 74 | }; |
diff --git a/sound/pci/echoaudio/indigo_dsp.c b/sound/pci/echoaudio/indigo_dsp.c index 0b2cd9c86277..5e85f14fe5a8 100644 --- a/sound/pci/echoaudio/indigo_dsp.c +++ b/sound/pci/echoaudio/indigo_dsp.c | |||
| @@ -50,7 +50,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 50 | chip->device_id = device_id; | 50 | chip->device_id = device_id; |
| 51 | chip->subdevice_id = subdevice_id; | 51 | chip->subdevice_id = subdevice_id; |
| 52 | chip->bad_board = TRUE; | 52 | chip->bad_board = TRUE; |
| 53 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_DSP]; | 53 | chip->dsp_code_to_load = FW_INDIGO_DSP; |
| 54 | /* Since this card has no ASIC, mark it as loaded so everything | 54 | /* Since this card has no ASIC, mark it as loaded so everything |
| 55 | works OK */ | 55 | works OK */ |
| 56 | chip->asic_loaded = TRUE; | 56 | chip->asic_loaded = TRUE; |
| @@ -60,15 +60,19 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 60 | return err; | 60 | return err; |
| 61 | chip->bad_board = FALSE; | 61 | chip->bad_board = FALSE; |
| 62 | 62 | ||
| 63 | if ((err = init_line_levels(chip)) < 0) | ||
| 64 | return err; | ||
| 65 | |||
| 66 | DE_INIT(("init_hw done\n")); | 63 | DE_INIT(("init_hw done\n")); |
| 67 | return err; | 64 | return err; |
| 68 | } | 65 | } |
| 69 | 66 | ||
| 70 | 67 | ||
| 71 | 68 | ||
| 69 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 70 | { | ||
| 71 | return init_line_levels(chip); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 72 | static u32 detect_input_clocks(const struct echoaudio *chip) | 76 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 73 | { | 77 | { |
| 74 | return ECHO_CLOCK_BIT_INTERNAL; | 78 | return ECHO_CLOCK_BIT_INTERNAL; |
diff --git a/sound/pci/echoaudio/indigo_express_dsp.c b/sound/pci/echoaudio/indigo_express_dsp.c index 9ab625e15652..2e4ab3e34a74 100644 --- a/sound/pci/echoaudio/indigo_express_dsp.c +++ b/sound/pci/echoaudio/indigo_express_dsp.c | |||
| @@ -61,6 +61,7 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate) | |||
| 61 | 61 | ||
| 62 | control_reg |= clock; | 62 | control_reg |= clock; |
| 63 | if (control_reg != old_control_reg) { | 63 | if (control_reg != old_control_reg) { |
| 64 | DE_ACT(("set_sample_rate: %d clock %d\n", rate, clock)); | ||
| 64 | chip->comm_page->control_register = cpu_to_le32(control_reg); | 65 | chip->comm_page->control_register = cpu_to_le32(control_reg); |
| 65 | chip->sample_rate = rate; | 66 | chip->sample_rate = rate; |
| 66 | clear_handshake(chip); | 67 | clear_handshake(chip); |
diff --git a/sound/pci/echoaudio/indigodj.c b/sound/pci/echoaudio/indigodj.c index 2db24d29332b..8816b0bd2ba6 100644 --- a/sound/pci/echoaudio/indigodj.c +++ b/sound/pci/echoaudio/indigodj.c | |||
| @@ -68,7 +68,7 @@ static const struct firmware card_fw[] = { | |||
| 68 | {0, "indigo_dj_dsp.fw"} | 68 | {0, "indigo_dj_dsp.fw"} |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | static struct pci_device_id snd_echo_ids[] = { | 71 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 72 | {0x1057, 0x3410, 0xECC0, 0x00B0, 0, 0, 0}, /* Indigo DJ*/ | 72 | {0x1057, 0x3410, 0xECC0, 0x00B0, 0, 0, 0}, /* Indigo DJ*/ |
| 73 | {0,} | 73 | {0,} |
| 74 | }; | 74 | }; |
diff --git a/sound/pci/echoaudio/indigodj_dsp.c b/sound/pci/echoaudio/indigodj_dsp.c index 08392916691e..68f3c8ccc1bf 100644 --- a/sound/pci/echoaudio/indigodj_dsp.c +++ b/sound/pci/echoaudio/indigodj_dsp.c | |||
| @@ -50,7 +50,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 50 | chip->device_id = device_id; | 50 | chip->device_id = device_id; |
| 51 | chip->subdevice_id = subdevice_id; | 51 | chip->subdevice_id = subdevice_id; |
| 52 | chip->bad_board = TRUE; | 52 | chip->bad_board = TRUE; |
| 53 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJ_DSP]; | 53 | chip->dsp_code_to_load = FW_INDIGO_DJ_DSP; |
| 54 | /* Since this card has no ASIC, mark it as loaded so everything | 54 | /* Since this card has no ASIC, mark it as loaded so everything |
| 55 | works OK */ | 55 | works OK */ |
| 56 | chip->asic_loaded = TRUE; | 56 | chip->asic_loaded = TRUE; |
| @@ -60,15 +60,19 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 60 | return err; | 60 | return err; |
| 61 | chip->bad_board = FALSE; | 61 | chip->bad_board = FALSE; |
| 62 | 62 | ||
| 63 | if ((err = init_line_levels(chip)) < 0) | ||
| 64 | return err; | ||
| 65 | |||
| 66 | DE_INIT(("init_hw done\n")); | 63 | DE_INIT(("init_hw done\n")); |
| 67 | return err; | 64 | return err; |
| 68 | } | 65 | } |
| 69 | 66 | ||
| 70 | 67 | ||
| 71 | 68 | ||
| 69 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 70 | { | ||
| 71 | return init_line_levels(chip); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 72 | static u32 detect_input_clocks(const struct echoaudio *chip) | 76 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 73 | { | 77 | { |
| 74 | return ECHO_CLOCK_BIT_INTERNAL; | 78 | return ECHO_CLOCK_BIT_INTERNAL; |
diff --git a/sound/pci/echoaudio/indigodjx.c b/sound/pci/echoaudio/indigodjx.c index 2e44316530a2..b1e3652f2f48 100644 --- a/sound/pci/echoaudio/indigodjx.c +++ b/sound/pci/echoaudio/indigodjx.c | |||
| @@ -68,7 +68,7 @@ static const struct firmware card_fw[] = { | |||
| 68 | {0, "indigo_djx_dsp.fw"} | 68 | {0, "indigo_djx_dsp.fw"} |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | static struct pci_device_id snd_echo_ids[] = { | 71 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 72 | {0x1057, 0x3410, 0xECC0, 0x00E0, 0, 0, 0}, /* Indigo DJx*/ | 72 | {0x1057, 0x3410, 0xECC0, 0x00E0, 0, 0, 0}, /* Indigo DJx*/ |
| 73 | {0,} | 73 | {0,} |
| 74 | }; | 74 | }; |
diff --git a/sound/pci/echoaudio/indigodjx_dsp.c b/sound/pci/echoaudio/indigodjx_dsp.c index f591fc2ed960..bb9632c752a9 100644 --- a/sound/pci/echoaudio/indigodjx_dsp.c +++ b/sound/pci/echoaudio/indigodjx_dsp.c | |||
| @@ -48,7 +48,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 48 | chip->device_id = device_id; | 48 | chip->device_id = device_id; |
| 49 | chip->subdevice_id = subdevice_id; | 49 | chip->subdevice_id = subdevice_id; |
| 50 | chip->bad_board = TRUE; | 50 | chip->bad_board = TRUE; |
| 51 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJX_DSP]; | 51 | chip->dsp_code_to_load = FW_INDIGO_DJX_DSP; |
| 52 | /* Since this card has no ASIC, mark it as loaded so everything | 52 | /* Since this card has no ASIC, mark it as loaded so everything |
| 53 | works OK */ | 53 | works OK */ |
| 54 | chip->asic_loaded = TRUE; | 54 | chip->asic_loaded = TRUE; |
| @@ -59,10 +59,13 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 59 | return err; | 59 | return err; |
| 60 | chip->bad_board = FALSE; | 60 | chip->bad_board = FALSE; |
| 61 | 61 | ||
| 62 | err = init_line_levels(chip); | ||
| 63 | if (err < 0) | ||
| 64 | return err; | ||
| 65 | |||
| 66 | DE_INIT(("init_hw done\n")); | 62 | DE_INIT(("init_hw done\n")); |
| 67 | return err; | 63 | return err; |
| 68 | } | 64 | } |
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 69 | { | ||
| 70 | return init_line_levels(chip); | ||
| 71 | } | ||
diff --git a/sound/pci/echoaudio/indigoio.c b/sound/pci/echoaudio/indigoio.c index a60c0a0a89b7..1035125336d6 100644 --- a/sound/pci/echoaudio/indigoio.c +++ b/sound/pci/echoaudio/indigoio.c | |||
| @@ -69,7 +69,7 @@ static const struct firmware card_fw[] = { | |||
| 69 | {0, "indigo_io_dsp.fw"} | 69 | {0, "indigo_io_dsp.fw"} |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | static struct pci_device_id snd_echo_ids[] = { | 72 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 73 | {0x1057, 0x3410, 0xECC0, 0x00A0, 0, 0, 0}, /* Indigo IO*/ | 73 | {0x1057, 0x3410, 0xECC0, 0x00A0, 0, 0, 0}, /* Indigo IO*/ |
| 74 | {0,} | 74 | {0,} |
| 75 | }; | 75 | }; |
diff --git a/sound/pci/echoaudio/indigoio_dsp.c b/sound/pci/echoaudio/indigoio_dsp.c index 0604c8a85223..beb9a5b69892 100644 --- a/sound/pci/echoaudio/indigoio_dsp.c +++ b/sound/pci/echoaudio/indigoio_dsp.c | |||
| @@ -50,7 +50,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 50 | chip->device_id = device_id; | 50 | chip->device_id = device_id; |
| 51 | chip->subdevice_id = subdevice_id; | 51 | chip->subdevice_id = subdevice_id; |
| 52 | chip->bad_board = TRUE; | 52 | chip->bad_board = TRUE; |
| 53 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_IO_DSP]; | 53 | chip->dsp_code_to_load = FW_INDIGO_IO_DSP; |
| 54 | /* Since this card has no ASIC, mark it as loaded so everything | 54 | /* Since this card has no ASIC, mark it as loaded so everything |
| 55 | works OK */ | 55 | works OK */ |
| 56 | chip->asic_loaded = TRUE; | 56 | chip->asic_loaded = TRUE; |
| @@ -60,15 +60,19 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 60 | return err; | 60 | return err; |
| 61 | chip->bad_board = FALSE; | 61 | chip->bad_board = FALSE; |
| 62 | 62 | ||
| 63 | if ((err = init_line_levels(chip)) < 0) | ||
| 64 | return err; | ||
| 65 | |||
| 66 | DE_INIT(("init_hw done\n")); | 63 | DE_INIT(("init_hw done\n")); |
| 67 | return err; | 64 | return err; |
| 68 | } | 65 | } |
| 69 | 66 | ||
| 70 | 67 | ||
| 71 | 68 | ||
| 69 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 70 | { | ||
| 71 | return init_line_levels(chip); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 72 | static u32 detect_input_clocks(const struct echoaudio *chip) | 76 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 73 | { | 77 | { |
| 74 | return ECHO_CLOCK_BIT_INTERNAL; | 78 | return ECHO_CLOCK_BIT_INTERNAL; |
diff --git a/sound/pci/echoaudio/indigoiox.c b/sound/pci/echoaudio/indigoiox.c index eb3819f9654a..60b7cb2753cf 100644 --- a/sound/pci/echoaudio/indigoiox.c +++ b/sound/pci/echoaudio/indigoiox.c | |||
| @@ -69,7 +69,7 @@ static const struct firmware card_fw[] = { | |||
| 69 | {0, "indigo_iox_dsp.fw"} | 69 | {0, "indigo_iox_dsp.fw"} |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | static struct pci_device_id snd_echo_ids[] = { | 72 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 73 | {0x1057, 0x3410, 0xECC0, 0x00D0, 0, 0, 0}, /* Indigo IOx */ | 73 | {0x1057, 0x3410, 0xECC0, 0x00D0, 0, 0, 0}, /* Indigo IOx */ |
| 74 | {0,} | 74 | {0,} |
| 75 | }; | 75 | }; |
diff --git a/sound/pci/echoaudio/indigoiox_dsp.c b/sound/pci/echoaudio/indigoiox_dsp.c index f357521c79e6..394c6e76bcbc 100644 --- a/sound/pci/echoaudio/indigoiox_dsp.c +++ b/sound/pci/echoaudio/indigoiox_dsp.c | |||
| @@ -48,7 +48,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 48 | chip->device_id = device_id; | 48 | chip->device_id = device_id; |
| 49 | chip->subdevice_id = subdevice_id; | 49 | chip->subdevice_id = subdevice_id; |
| 50 | chip->bad_board = TRUE; | 50 | chip->bad_board = TRUE; |
| 51 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_IOX_DSP]; | 51 | chip->dsp_code_to_load = FW_INDIGO_IOX_DSP; |
| 52 | /* Since this card has no ASIC, mark it as loaded so everything | 52 | /* Since this card has no ASIC, mark it as loaded so everything |
| 53 | works OK */ | 53 | works OK */ |
| 54 | chip->asic_loaded = TRUE; | 54 | chip->asic_loaded = TRUE; |
| @@ -59,10 +59,13 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 59 | return err; | 59 | return err; |
| 60 | chip->bad_board = FALSE; | 60 | chip->bad_board = FALSE; |
| 61 | 61 | ||
| 62 | err = init_line_levels(chip); | ||
| 63 | if (err < 0) | ||
| 64 | return err; | ||
| 65 | |||
| 66 | DE_INIT(("init_hw done\n")); | 62 | DE_INIT(("init_hw done\n")); |
| 67 | return err; | 63 | return err; |
| 68 | } | 64 | } |
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 69 | { | ||
| 70 | return init_line_levels(chip); | ||
| 71 | } | ||
diff --git a/sound/pci/echoaudio/layla20.c b/sound/pci/echoaudio/layla20.c index 506194688995..8c3f5c5b5301 100644 --- a/sound/pci/echoaudio/layla20.c +++ b/sound/pci/echoaudio/layla20.c | |||
| @@ -76,7 +76,7 @@ static const struct firmware card_fw[] = { | |||
| 76 | {0, "layla20_asic.fw"} | 76 | {0, "layla20_asic.fw"} |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | static struct pci_device_id snd_echo_ids[] = { | 79 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 80 | {0x1057, 0x1801, 0xECC0, 0x0030, 0, 0, 0}, /* DSP 56301 Layla20 rev.0 */ | 80 | {0x1057, 0x1801, 0xECC0, 0x0030, 0, 0, 0}, /* DSP 56301 Layla20 rev.0 */ |
| 81 | {0x1057, 0x1801, 0xECC0, 0x0031, 0, 0, 0}, /* DSP 56301 Layla20 rev.1 */ | 81 | {0x1057, 0x1801, 0xECC0, 0x0031, 0, 0, 0}, /* DSP 56301 Layla20 rev.1 */ |
| 82 | {0,} | 82 | {0,} |
diff --git a/sound/pci/echoaudio/layla20_dsp.c b/sound/pci/echoaudio/layla20_dsp.c index 83750e9fd7b4..53ce94605044 100644 --- a/sound/pci/echoaudio/layla20_dsp.c +++ b/sound/pci/echoaudio/layla20_dsp.c | |||
| @@ -31,8 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | static int read_dsp(struct echoaudio *chip, u32 *data); | 32 | static int read_dsp(struct echoaudio *chip, u32 *data); |
| 33 | static int set_professional_spdif(struct echoaudio *chip, char prof); | 33 | static int set_professional_spdif(struct echoaudio *chip, char prof); |
| 34 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, | 34 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic); |
| 35 | const struct firmware *asic); | ||
| 36 | static int check_asic_status(struct echoaudio *chip); | 35 | static int check_asic_status(struct echoaudio *chip); |
| 37 | static int update_flags(struct echoaudio *chip); | 36 | static int update_flags(struct echoaudio *chip); |
| 38 | 37 | ||
| @@ -54,7 +53,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 54 | chip->subdevice_id = subdevice_id; | 53 | chip->subdevice_id = subdevice_id; |
| 55 | chip->bad_board = TRUE; | 54 | chip->bad_board = TRUE; |
| 56 | chip->has_midi = TRUE; | 55 | chip->has_midi = TRUE; |
| 57 | chip->dsp_code_to_load = &card_fw[FW_LAYLA20_DSP]; | 56 | chip->dsp_code_to_load = FW_LAYLA20_DSP; |
| 58 | chip->input_clock_types = | 57 | chip->input_clock_types = |
| 59 | ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF | | 58 | ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF | |
| 60 | ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_SUPER; | 59 | ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_SUPER; |
| @@ -65,17 +64,20 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 65 | return err; | 64 | return err; |
| 66 | chip->bad_board = FALSE; | 65 | chip->bad_board = FALSE; |
| 67 | 66 | ||
| 68 | if ((err = init_line_levels(chip)) < 0) | ||
| 69 | return err; | ||
| 70 | |||
| 71 | err = set_professional_spdif(chip, TRUE); | ||
| 72 | |||
| 73 | DE_INIT(("init_hw done\n")); | 67 | DE_INIT(("init_hw done\n")); |
| 74 | return err; | 68 | return err; |
| 75 | } | 69 | } |
| 76 | 70 | ||
| 77 | 71 | ||
| 78 | 72 | ||
| 73 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 74 | { | ||
| 75 | chip->professional_spdif = FALSE; | ||
| 76 | return init_line_levels(chip); | ||
| 77 | } | ||
| 78 | |||
| 79 | |||
| 80 | |||
| 79 | static u32 detect_input_clocks(const struct echoaudio *chip) | 81 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 80 | { | 82 | { |
| 81 | u32 clocks_from_dsp, clock_bits; | 83 | u32 clocks_from_dsp, clock_bits; |
| @@ -144,7 +146,7 @@ static int load_asic(struct echoaudio *chip) | |||
| 144 | return 0; | 146 | return 0; |
| 145 | 147 | ||
| 146 | err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA_ASIC, | 148 | err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA_ASIC, |
| 147 | &card_fw[FW_LAYLA20_ASIC]); | 149 | FW_LAYLA20_ASIC); |
| 148 | if (err < 0) | 150 | if (err < 0) |
| 149 | return err; | 151 | return err; |
| 150 | 152 | ||
diff --git a/sound/pci/echoaudio/layla24.c b/sound/pci/echoaudio/layla24.c index e09e3ea7781e..ed1cc0abc2b8 100644 --- a/sound/pci/echoaudio/layla24.c +++ b/sound/pci/echoaudio/layla24.c | |||
| @@ -87,7 +87,7 @@ static const struct firmware card_fw[] = { | |||
| 87 | {0, "layla24_2S_asic.fw"} | 87 | {0, "layla24_2S_asic.fw"} |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | static struct pci_device_id snd_echo_ids[] = { | 90 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 91 | {0x1057, 0x3410, 0xECC0, 0x0060, 0, 0, 0}, /* DSP 56361 Layla24 rev.0 */ | 91 | {0x1057, 0x3410, 0xECC0, 0x0060, 0, 0, 0}, /* DSP 56361 Layla24 rev.0 */ |
| 92 | {0,} | 92 | {0,} |
| 93 | }; | 93 | }; |
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c index d61b5cbcccad..8c041647f285 100644 --- a/sound/pci/echoaudio/layla24_dsp.c +++ b/sound/pci/echoaudio/layla24_dsp.c | |||
| @@ -32,8 +32,7 @@ static int write_control_reg(struct echoaudio *chip, u32 value, char force); | |||
| 32 | static int set_input_clock(struct echoaudio *chip, u16 clock); | 32 | static int set_input_clock(struct echoaudio *chip, u16 clock); |
| 33 | static int set_professional_spdif(struct echoaudio *chip, char prof); | 33 | static int set_professional_spdif(struct echoaudio *chip, char prof); |
| 34 | static int set_digital_mode(struct echoaudio *chip, u8 mode); | 34 | static int set_digital_mode(struct echoaudio *chip, u8 mode); |
| 35 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, | 35 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic); |
| 36 | const struct firmware *asic); | ||
| 37 | static int check_asic_status(struct echoaudio *chip); | 36 | static int check_asic_status(struct echoaudio *chip); |
| 38 | 37 | ||
| 39 | 38 | ||
| @@ -54,7 +53,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 54 | chip->subdevice_id = subdevice_id; | 53 | chip->subdevice_id = subdevice_id; |
| 55 | chip->bad_board = TRUE; | 54 | chip->bad_board = TRUE; |
| 56 | chip->has_midi = TRUE; | 55 | chip->has_midi = TRUE; |
| 57 | chip->dsp_code_to_load = &card_fw[FW_LAYLA24_DSP]; | 56 | chip->dsp_code_to_load = FW_LAYLA24_DSP; |
| 58 | chip->input_clock_types = | 57 | chip->input_clock_types = |
| 59 | ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF | | 58 | ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF | |
| 60 | ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_ADAT; | 59 | ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_ADAT; |
| @@ -62,9 +61,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 62 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | | 61 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA | |
| 63 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | | 62 | ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL | |
| 64 | ECHOCAPS_HAS_DIGITAL_MODE_ADAT; | 63 | ECHOCAPS_HAS_DIGITAL_MODE_ADAT; |
| 65 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 66 | chip->professional_spdif = FALSE; | ||
| 67 | chip->digital_in_automute = TRUE; | ||
| 68 | 64 | ||
| 69 | if ((err = load_firmware(chip)) < 0) | 65 | if ((err = load_firmware(chip)) < 0) |
| 70 | return err; | 66 | return err; |
| @@ -73,17 +69,22 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 73 | if ((err = init_line_levels(chip)) < 0) | 69 | if ((err = init_line_levels(chip)) < 0) |
| 74 | return err; | 70 | return err; |
| 75 | 71 | ||
| 76 | err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); | ||
| 77 | if (err < 0) | ||
| 78 | return err; | ||
| 79 | err = set_professional_spdif(chip, TRUE); | ||
| 80 | |||
| 81 | DE_INIT(("init_hw done\n")); | 72 | DE_INIT(("init_hw done\n")); |
| 82 | return err; | 73 | return err; |
| 83 | } | 74 | } |
| 84 | 75 | ||
| 85 | 76 | ||
| 86 | 77 | ||
| 78 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 79 | { | ||
| 80 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 81 | chip->professional_spdif = FALSE; | ||
| 82 | chip->digital_in_automute = TRUE; | ||
| 83 | return init_line_levels(chip); | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 87 | |||
| 87 | static u32 detect_input_clocks(const struct echoaudio *chip) | 88 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 88 | { | 89 | { |
| 89 | u32 clocks_from_dsp, clock_bits; | 90 | u32 clocks_from_dsp, clock_bits; |
| @@ -123,18 +124,18 @@ static int load_asic(struct echoaudio *chip) | |||
| 123 | 124 | ||
| 124 | /* Load the ASIC for the PCI card */ | 125 | /* Load the ASIC for the PCI card */ |
| 125 | err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC, | 126 | err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC, |
| 126 | &card_fw[FW_LAYLA24_1_ASIC]); | 127 | FW_LAYLA24_1_ASIC); |
| 127 | if (err < 0) | 128 | if (err < 0) |
| 128 | return err; | 129 | return err; |
| 129 | 130 | ||
| 130 | chip->asic_code = &card_fw[FW_LAYLA24_2S_ASIC]; | 131 | chip->asic_code = FW_LAYLA24_2S_ASIC; |
| 131 | 132 | ||
| 132 | /* Now give the new ASIC a little time to set up */ | 133 | /* Now give the new ASIC a little time to set up */ |
| 133 | mdelay(10); | 134 | mdelay(10); |
| 134 | 135 | ||
| 135 | /* Do the external one */ | 136 | /* Do the external one */ |
| 136 | err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC, | 137 | err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC, |
| 137 | &card_fw[FW_LAYLA24_2S_ASIC]); | 138 | FW_LAYLA24_2S_ASIC); |
| 138 | if (err < 0) | 139 | if (err < 0) |
| 139 | return FALSE; | 140 | return FALSE; |
| 140 | 141 | ||
| @@ -299,7 +300,7 @@ static int set_input_clock(struct echoaudio *chip, u16 clock) | |||
| 299 | /* Depending on what digital mode you want, Layla24 needs different ASICs | 300 | /* Depending on what digital mode you want, Layla24 needs different ASICs |
| 300 | loaded. This function checks the ASIC needed for the new mode and sees | 301 | loaded. This function checks the ASIC needed for the new mode and sees |
| 301 | if it matches the one already loaded. */ | 302 | if it matches the one already loaded. */ |
| 302 | static int switch_asic(struct echoaudio *chip, const struct firmware *asic) | 303 | static int switch_asic(struct echoaudio *chip, short asic) |
| 303 | { | 304 | { |
| 304 | s8 *monitors; | 305 | s8 *monitors; |
| 305 | 306 | ||
| @@ -335,7 +336,7 @@ static int dsp_set_digital_mode(struct echoaudio *chip, u8 mode) | |||
| 335 | { | 336 | { |
| 336 | u32 control_reg; | 337 | u32 control_reg; |
| 337 | int err, incompatible_clock; | 338 | int err, incompatible_clock; |
| 338 | const struct firmware *asic; | 339 | short asic; |
| 339 | 340 | ||
| 340 | /* Set clock to "internal" if it's not compatible with the new mode */ | 341 | /* Set clock to "internal" if it's not compatible with the new mode */ |
| 341 | incompatible_clock = FALSE; | 342 | incompatible_clock = FALSE; |
| @@ -344,12 +345,12 @@ static int dsp_set_digital_mode(struct echoaudio *chip, u8 mode) | |||
| 344 | case DIGITAL_MODE_SPDIF_RCA: | 345 | case DIGITAL_MODE_SPDIF_RCA: |
| 345 | if (chip->input_clock == ECHO_CLOCK_ADAT) | 346 | if (chip->input_clock == ECHO_CLOCK_ADAT) |
| 346 | incompatible_clock = TRUE; | 347 | incompatible_clock = TRUE; |
| 347 | asic = &card_fw[FW_LAYLA24_2S_ASIC]; | 348 | asic = FW_LAYLA24_2S_ASIC; |
| 348 | break; | 349 | break; |
| 349 | case DIGITAL_MODE_ADAT: | 350 | case DIGITAL_MODE_ADAT: |
| 350 | if (chip->input_clock == ECHO_CLOCK_SPDIF) | 351 | if (chip->input_clock == ECHO_CLOCK_SPDIF) |
| 351 | incompatible_clock = TRUE; | 352 | incompatible_clock = TRUE; |
| 352 | asic = &card_fw[FW_LAYLA24_2A_ASIC]; | 353 | asic = FW_LAYLA24_2A_ASIC; |
| 353 | break; | 354 | break; |
| 354 | default: | 355 | default: |
| 355 | DE_ACT(("Digital mode not supported: %d\n", mode)); | 356 | DE_ACT(("Digital mode not supported: %d\n", mode)); |
diff --git a/sound/pci/echoaudio/mia.c b/sound/pci/echoaudio/mia.c index f05c8c097aa8..cc2bbfc65327 100644 --- a/sound/pci/echoaudio/mia.c +++ b/sound/pci/echoaudio/mia.c | |||
| @@ -77,7 +77,7 @@ static const struct firmware card_fw[] = { | |||
| 77 | {0, "mia_dsp.fw"} | 77 | {0, "mia_dsp.fw"} |
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | static struct pci_device_id snd_echo_ids[] = { | 80 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 81 | {0x1057, 0x3410, 0xECC0, 0x0080, 0, 0, 0}, /* DSP 56361 Mia rev.0 */ | 81 | {0x1057, 0x3410, 0xECC0, 0x0080, 0, 0, 0}, /* DSP 56361 Mia rev.0 */ |
| 82 | {0x1057, 0x3410, 0xECC0, 0x0081, 0, 0, 0}, /* DSP 56361 Mia rev.1 */ | 82 | {0x1057, 0x3410, 0xECC0, 0x0081, 0, 0, 0}, /* DSP 56361 Mia rev.1 */ |
| 83 | {0,} | 83 | {0,} |
diff --git a/sound/pci/echoaudio/mia_dsp.c b/sound/pci/echoaudio/mia_dsp.c index 551405114cbc..6ebfa6e7ab9e 100644 --- a/sound/pci/echoaudio/mia_dsp.c +++ b/sound/pci/echoaudio/mia_dsp.c | |||
| @@ -53,7 +53,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 53 | chip->device_id = device_id; | 53 | chip->device_id = device_id; |
| 54 | chip->subdevice_id = subdevice_id; | 54 | chip->subdevice_id = subdevice_id; |
| 55 | chip->bad_board = TRUE; | 55 | chip->bad_board = TRUE; |
| 56 | chip->dsp_code_to_load = &card_fw[FW_MIA_DSP]; | 56 | chip->dsp_code_to_load = FW_MIA_DSP; |
| 57 | /* Since this card has no ASIC, mark it as loaded so everything | 57 | /* Since this card has no ASIC, mark it as loaded so everything |
| 58 | works OK */ | 58 | works OK */ |
| 59 | chip->asic_loaded = TRUE; | 59 | chip->asic_loaded = TRUE; |
| @@ -66,15 +66,19 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 66 | return err; | 66 | return err; |
| 67 | chip->bad_board = FALSE; | 67 | chip->bad_board = FALSE; |
| 68 | 68 | ||
| 69 | if ((err = init_line_levels(chip))) | ||
| 70 | return err; | ||
| 71 | |||
| 72 | DE_INIT(("init_hw done\n")); | 69 | DE_INIT(("init_hw done\n")); |
| 73 | return err; | 70 | return err; |
| 74 | } | 71 | } |
| 75 | 72 | ||
| 76 | 73 | ||
| 77 | 74 | ||
| 75 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 76 | { | ||
| 77 | return init_line_levels(chip); | ||
| 78 | } | ||
| 79 | |||
| 80 | |||
| 81 | |||
| 78 | static u32 detect_input_clocks(const struct echoaudio *chip) | 82 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 79 | { | 83 | { |
| 80 | u32 clocks_from_dsp, clock_bits; | 84 | u32 clocks_from_dsp, clock_bits; |
diff --git a/sound/pci/echoaudio/mona.c b/sound/pci/echoaudio/mona.c index b05bad944901..3e7e01824b40 100644 --- a/sound/pci/echoaudio/mona.c +++ b/sound/pci/echoaudio/mona.c | |||
| @@ -92,7 +92,7 @@ static const struct firmware card_fw[] = { | |||
| 92 | {0, "mona_2_asic.fw"} | 92 | {0, "mona_2_asic.fw"} |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static struct pci_device_id snd_echo_ids[] = { | 95 | static DEFINE_PCI_DEVICE_TABLE(snd_echo_ids) = { |
| 96 | {0x1057, 0x1801, 0xECC0, 0x0070, 0, 0, 0}, /* DSP 56301 Mona rev.0 */ | 96 | {0x1057, 0x1801, 0xECC0, 0x0070, 0, 0, 0}, /* DSP 56301 Mona rev.0 */ |
| 97 | {0x1057, 0x1801, 0xECC0, 0x0071, 0, 0, 0}, /* DSP 56301 Mona rev.1 */ | 97 | {0x1057, 0x1801, 0xECC0, 0x0071, 0, 0, 0}, /* DSP 56301 Mona rev.1 */ |
| 98 | {0x1057, 0x1801, 0xECC0, 0x0072, 0, 0, 0}, /* DSP 56301 Mona rev.2 */ | 98 | {0x1057, 0x1801, 0xECC0, 0x0072, 0, 0, 0}, /* DSP 56301 Mona rev.2 */ |
diff --git a/sound/pci/echoaudio/mona_dsp.c b/sound/pci/echoaudio/mona_dsp.c index eaa619bd2a03..6e6a7eb555b8 100644 --- a/sound/pci/echoaudio/mona_dsp.c +++ b/sound/pci/echoaudio/mona_dsp.c | |||
| @@ -33,8 +33,7 @@ static int write_control_reg(struct echoaudio *chip, u32 value, char force); | |||
| 33 | static int set_input_clock(struct echoaudio *chip, u16 clock); | 33 | static int set_input_clock(struct echoaudio *chip, u16 clock); |
| 34 | static int set_professional_spdif(struct echoaudio *chip, char prof); | 34 | static int set_professional_spdif(struct echoaudio *chip, char prof); |
| 35 | static int set_digital_mode(struct echoaudio *chip, u8 mode); | 35 | static int set_digital_mode(struct echoaudio *chip, u8 mode); |
| 36 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, | 36 | static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic); |
| 37 | const struct firmware *asic); | ||
| 38 | static int check_asic_status(struct echoaudio *chip); | 37 | static int check_asic_status(struct echoaudio *chip); |
| 39 | 38 | ||
| 40 | 39 | ||
| @@ -64,32 +63,30 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
| 64 | 63 | ||
| 65 | /* Mona comes in both '301 and '361 flavors */ | 64 | /* Mona comes in both '301 and '361 flavors */ |
| 66 | if (chip->device_id == DEVICE_ID_56361) | 65 | if (chip->device_id == DEVICE_ID_56361) |
| 67 | chip->dsp_code_to_load = &card_fw[FW_MONA_361_DSP]; | 66 | chip->dsp_code_to_load = FW_MONA_361_DSP; |
| 68 | else | 67 | else |
| 69 | chip->dsp_code_to_load = &card_fw[FW_MONA_301_DSP]; | 68 | chip->dsp_code_to_load = FW_MONA_301_DSP; |
| 70 | |||
| 71 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 72 | chip->professional_spdif = FALSE; | ||
| 73 | chip->digital_in_automute = TRUE; | ||
| 74 | 69 | ||
| 75 | if ((err = load_firmware(chip)) < 0) | 70 | if ((err = load_firmware(chip)) < 0) |
| 76 | return err; | 71 | return err; |
| 77 | chip->bad_board = FALSE; | 72 | chip->bad_board = FALSE; |
| 78 | 73 | ||
| 79 | if ((err = init_line_levels(chip)) < 0) | ||
| 80 | return err; | ||
| 81 | |||
| 82 | err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA); | ||
| 83 | if (err < 0) | ||
| 84 | return err; | ||
| 85 | err = set_professional_spdif(chip, TRUE); | ||
| 86 | |||
| 87 | DE_INIT(("init_hw done\n")); | 74 | DE_INIT(("init_hw done\n")); |
| 88 | return err; | 75 | return err; |
| 89 | } | 76 | } |
| 90 | 77 | ||
| 91 | 78 | ||
| 92 | 79 | ||
| 80 | static int set_mixer_defaults(struct echoaudio *chip) | ||
| 81 | { | ||
| 82 | chip->digital_mode = DIGITAL_MODE_SPDIF_RCA; | ||
| 83 | chip->professional_spdif = FALSE; | ||
| 84 | chip->digital_in_automute = TRUE; | ||
| 85 | return init_line_levels(chip); | ||
| 86 | } | ||
| 87 | |||
| 88 | |||
| 89 | |||
| 93 | static u32 detect_input_clocks(const struct echoaudio *chip) | 90 | static u32 detect_input_clocks(const struct echoaudio *chip) |
| 94 | { | 91 | { |
| 95 | u32 clocks_from_dsp, clock_bits; | 92 | u32 clocks_from_dsp, clock_bits; |
| @@ -120,7 +117,7 @@ static int load_asic(struct echoaudio *chip) | |||
| 120 | { | 117 | { |
| 121 | u32 control_reg; | 118 | u32 control_reg; |
| 122 | int err; | 119 | int err; |
| 123 | const struct firmware *asic; | 120 | short asic; |
| 124 | 121 | ||
| 125 | if (chip->asic_loaded) | 122 | if (chip->asic_loaded) |
| 126 | return 0; | 123 | return 0; |
| @@ -128,9 +125,9 @@ static int load_asic(struct echoaudio *chip) | |||
| 128 | mdelay(10); | 125 | mdelay(10); |
| 129 | 126 | ||
| 130 | if (chip->device_id == DEVICE_ID_56361) | 127 | if (chip->device_id == DEVICE_ID_56361) |
| 131 | asic = &card_fw[FW_MONA_361_1_ASIC48]; | 128 | asic = FW_MONA_361_1_ASIC48; |
| 132 | else | 129 | else |
| 133 | asic = &card_fw[FW_MONA_301_1_ASIC48]; | 130 | asic = FW_MONA_301_1_ASIC48; |
| 134 | 131 | ||
| 135 | err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_PCI_CARD_ASIC, asic); | 132 | err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_PCI_CARD_ASIC, asic); |
| 136 | if (err < 0) | 133 | if (err < 0) |
| @@ -141,7 +138,7 @@ static int load_asic(struct echoaudio *chip) | |||
| 141 | 138 | ||
| 142 | /* Do the external one */ | 139 | /* Do the external one */ |
| 143 | err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_EXTERNAL_ASIC, | 140 | err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_EXTERNAL_ASIC, |
| 144 | &card_fw[FW_MONA_2_ASIC]); | 141 | FW_MONA_2_ASIC); |
| 145 | if (err < 0) | 142 | if (err < 0) |
| 146 | return err; | 143 | return err; |
| 147 | 144 | ||
| @@ -165,22 +162,22 @@ loaded. This function checks the ASIC needed for the new mode and sees | |||
| 165 | if it matches the one already loaded. */ | 162 | if it matches the one already loaded. */ |
| 166 | static int switch_asic(struct echoaudio *chip, char double_speed) | 163 | static int switch_asic(struct echoaudio *chip, char double_speed) |
| 167 | { | 164 | { |
| 168 | const struct firmware *asic; | ||
| 169 | int err; | 165 | int err; |
| 166 | short asic; | ||
| 170 | 167 | ||
| 171 | /* Check the clock detect bits to see if this is | 168 | /* Check the clock detect bits to see if this is |
| 172 | a single-speed clock or a double-speed clock; load | 169 | a single-speed clock or a double-speed clock; load |
| 173 | a new ASIC if necessary. */ | 170 | a new ASIC if necessary. */ |
| 174 | if (chip->device_id == DEVICE_ID_56361) { | 171 | if (chip->device_id == DEVICE_ID_56361) { |
| 175 | if (double_speed) | 172 | if (double_speed) |
| 176 | asic = &card_fw[FW_MONA_361_1_ASIC96]; | 173 | asic = FW_MONA_361_1_ASIC96; |
| 177 | else | 174 | else |
| 178 | asic = &card_fw[FW_MONA_361_1_ASIC48]; | 175 | asic = FW_MONA_361_1_ASIC48; |
| 179 | } else { | 176 | } else { |
| 180 | if (double_speed) | 177 | if (double_speed) |
| 181 | asic = &card_fw[FW_MONA_301_1_ASIC96]; | 178 | asic = FW_MONA_301_1_ASIC96; |
| 182 | else | 179 | else |
| 183 | asic = &card_fw[FW_MONA_301_1_ASIC48]; | 180 | asic = FW_MONA_301_1_ASIC48; |
| 184 | } | 181 | } |
| 185 | 182 | ||
| 186 | if (asic != chip->asic_code) { | 183 | if (asic != chip->asic_code) { |
| @@ -200,7 +197,7 @@ static int switch_asic(struct echoaudio *chip, char double_speed) | |||
| 200 | static int set_sample_rate(struct echoaudio *chip, u32 rate) | 197 | static int set_sample_rate(struct echoaudio *chip, u32 rate) |
| 201 | { | 198 | { |
| 202 | u32 control_reg, clock; | 199 | u32 control_reg, clock; |
| 203 | const struct firmware *asic; | 200 | short asic; |
| 204 | char force_write; | 201 | char force_write; |
| 205 | 202 | ||
| 206 | /* Only set the clock for internal mode. */ | 203 | /* Only set the clock for internal mode. */ |
| @@ -218,14 +215,14 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate) | |||
| 218 | if (chip->digital_mode == DIGITAL_MODE_ADAT) | 215 | if (chip->digital_mode == DIGITAL_MODE_ADAT) |
| 219 | return -EINVAL; | 216 | return -EINVAL; |
| 220 | if (chip->device_id == DEVICE_ID_56361) | 217 | if (chip->device_id == DEVICE_ID_56361) |
| 221 | asic = &card_fw[FW_MONA_361_1_ASIC96]; | 218 | asic = FW_MONA_361_1_ASIC96; |
| 222 | else | 219 | else |
| 223 | asic = &card_fw[FW_MONA_301_1_ASIC96]; | 220 | asic = FW_MONA_301_1_ASIC96; |
| 224 | } else { | 221 | } else { |
| 225 | if (chip->device_id == DEVICE_ID_56361) | 222 | if (chip->device_id == DEVICE_ID_56361) |
| 226 | asic = &card_fw[FW_MONA_361_1_ASIC48]; | 223 | asic = FW_MONA_361_1_ASIC48; |
| 227 | else | 224 | else |
| 228 | asic = &card_fw[FW_MONA_301_1_ASIC48]; | 225 | asic = FW_MONA_301_1_ASIC48; |
| 229 | } | 226 | } |
| 230 | 227 | ||
| 231 | force_write = 0; | 228 | force_write = 0; |
| @@ -410,8 +407,8 @@ static int dsp_set_digital_mode(struct echoaudio *chip, u8 mode) | |||
| 410 | case DIGITAL_MODE_ADAT: | 407 | case DIGITAL_MODE_ADAT: |
| 411 | /* If the current ASIC is the 96KHz ASIC, switch the ASIC | 408 | /* If the current ASIC is the 96KHz ASIC, switch the ASIC |
| 412 | and set to 48 KHz */ | 409 | and set to 48 KHz */ |
| 413 | if (chip->asic_code == &card_fw[FW_MONA_361_1_ASIC96] || | 410 | if (chip->asic_code == FW_MONA_361_1_ASIC96 || |
| 414 | chip->asic_code == &card_fw[FW_MONA_301_1_ASIC96]) { | 411 | chip->asic_code == FW_MONA_301_1_ASIC96) { |
| 415 | set_sample_rate(chip, 48000); | 412 | set_sample_rate(chip, 48000); |
| 416 | } | 413 | } |
| 417 | control_reg |= GML_ADAT_MODE; | 414 | control_reg |= GML_ADAT_MODE; |
