···482483 reference_rate - reference sample rate, 44100 or 48000 (default)484 multiple - multiple to ref. sample rate, 1 or 2 (default)000485486 This module supports multiple cards.487···1125 dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable)11261127 This module supports multiple cards, autoprobe and ISA PnP.00000000000000011281129 Module snd-korg12121130 -------------------···18091810 The power-management is supported.181100000001812 Module snd-usb-audio1813 --------------------1814···1948 -------------------19491950 Module for sound cards based on the Asus AV100/AV200 chips,1951- i.e., Xonar D1, DX, D2, D2X, HDAV1.3 (Deluxe), Essence ST1952 (Deluxe) and Essence STX.19531954 This module supports autoprobe and multiple cards.
···482483 reference_rate - reference sample rate, 44100 or 48000 (default)484 multiple - multiple to ref. sample rate, 1 or 2 (default)485+ subsystem - override the PCI SSID for probing; the value486+ consists of SSVID << 16 | SSDID. The default is487+ zero, which means no override.488489 This module supports multiple cards.490···1122 dma2 - DMA # for InterWave chip (0,1,3,5,6,7,-1=disable)11231124 This module supports multiple cards, autoprobe and ISA PnP.1125+1126+ Module snd-jazz161127+ -------------------1128+1129+ Module for Media Vision Jazz16 chipset. The chipset consists of 3 chips:1130+ MVD1216 + MVA416 + MVA514.1131+1132+ port - port # for SB DSP chip (0x210,0x220,0x230,0x240,0x250,0x260)1133+ irq - IRQ # for SB DSP chip (3,5,7,9,10,15)1134+ dma8 - DMA # for SB DSP chip (1,3)1135+ dma16 - DMA # for SB DSP chip (5,7)1136+ mpu_port - MPU-401 port # (0x300,0x310,0x320,0x330)1137+ mpu_irq - MPU-401 irq # (2,3,5,7)1138+1139+ This module supports multiple cards.11401141 Module snd-korg12121142 -------------------···17911792 The power-management is supported.17931794+ Module snd-ua1011795+ ----------------1796+1797+ Module for the Edirol UA-101 audio/MIDI interface.1798+1799+ This module supports multiple devices, autoprobe and hotplugging.1800+1801 Module snd-usb-audio1802 --------------------1803···1923 -------------------19241925 Module for sound cards based on the Asus AV100/AV200 chips,1926+ i.e., Xonar D1, DX, D2, D2X, DS, HDAV1.3 (Deluxe), Essence ST1927 (Deluxe) and Essence STX.19281929 This module supports autoprobe and multiple cards.
···46 */4748#include <linux/slab.h>49-#include <linux/vmalloc.h>50#include <linux/delay.h>51#include <sound/core.h>52#include <sound/asoundef.h>53#include <sound/pcm.h>54#include <sound/vx_core.h>55#include "vx_cmd.h"56-57-58-/*59- * we use a vmalloc'ed (sg-)buffer60- */61-62-/* get the physical page pointer on the given offset */63-static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,64- unsigned long offset)65-{66- void *pageptr = subs->runtime->dma_area + offset;67- return vmalloc_to_page(pageptr);68-}69-70-/*71- * allocate a buffer via vmalloc_32().72- * called from hw_params73- * NOTE: this may be called not only once per pcm open!74- */75-static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)76-{77- struct snd_pcm_runtime *runtime = subs->runtime;78- if (runtime->dma_area) {79- /* already allocated */80- if (runtime->dma_bytes >= size)81- return 0; /* already enough large */82- vfree(runtime->dma_area);83- }84- runtime->dma_area = vmalloc_32(size);85- if (! runtime->dma_area)86- return -ENOMEM;87- memset(runtime->dma_area, 0, size);88- runtime->dma_bytes = size;89- return 1; /* changed */90-}91-92-/*93- * free the buffer.94- * called from hw_free callback95- * NOTE: this may be called not only once per pcm open!96- */97-static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)98-{99- struct snd_pcm_runtime *runtime = subs->runtime;100-101- vfree(runtime->dma_area);102- runtime->dma_area = NULL;103- return 0;104-}105106107/*···815static int vx_pcm_hw_params(struct snd_pcm_substream *subs,816 struct snd_pcm_hw_params *hw_params)817{818- return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));0819}820821/*···824 */825static int vx_pcm_hw_free(struct snd_pcm_substream *subs)826{827- return snd_pcm_free_vmalloc_buffer(subs);828}829830/*···904 .prepare = vx_pcm_prepare,905 .trigger = vx_pcm_trigger,906 .pointer = vx_pcm_playback_pointer,907- .page = snd_pcm_get_vmalloc_page,0908};909910···1125 .prepare = vx_pcm_prepare,1126 .trigger = vx_pcm_trigger,1127 .pointer = vx_pcm_capture_pointer,1128- .page = snd_pcm_get_vmalloc_page,01129};11301131
···63 will be called snd-ad1848.6465config SND_ALS10066- tristate "Avance Logic ALS100/ALS120"67 depends on PNP68 select ISAPNP69 select SND_OPL3_LIB70 select SND_MPU401_UART71 select SND_SB16_DSP72 help73- Say Y here to include support for soundcards based on Avance74- Logic ALS100, ALS110, ALS120 and ALS200 chips.07576 To compile this driver as a module, choose M here: the module77 will be called snd-als100.···127128 To compile this driver as a module, choose M here: the module129 will be called snd-cs4236.130-131-config SND_DT019X132- tristate "Diamond Technologies DT-019X, Avance Logic ALS-007"133- depends on PNP134- select ISAPNP135- select SND_OPL3_LIB136- select SND_MPU401_UART137- select SND_SB16_DSP138- help139- Say Y here to include support for soundcards based on the140- Diamond Technologies DT-019X or Avance Logic ALS-007 chips.141-142- To compile this driver as a module, choose M here: the module143- will be called snd-dt019x.144145config SND_ES968146 tristate "Generic ESS ES968 driver"···238239 To compile this driver as a module, choose M here: the module240 will be called snd-interwave-stb.0000000000000000241242config SND_OPL3SA2243 tristate "Yamaha OPL3-SA2/SA3"
···63 will be called snd-ad1848.6465config SND_ALS10066+ tristate "Diamond Tech. DT-019x and Avance Logic ALSxxx"67 depends on PNP68 select ISAPNP69 select SND_OPL3_LIB70 select SND_MPU401_UART71 select SND_SB16_DSP72 help73+ Say Y here to include support for soundcards based on the74+ Diamond Technologies DT-019X or Avance Logic chips: ALS007,75+ ALS100, ALS110, ALS120 and ALS200 chips.7677 To compile this driver as a module, choose M here: the module78 will be called snd-als100.···126127 To compile this driver as a module, choose M here: the module128 will be called snd-cs4236.00000000000000129130config SND_ES968131 tristate "Generic ESS ES968 driver"···251252 To compile this driver as a module, choose M here: the module253 will be called snd-interwave-stb.254+255+config SND_JAZZ16256+ tristate "Media Vision Jazz16 card and compatibles"257+ select SND_OPL3_LIB258+ select SND_MPU401_UART259+ select SND_SB8_DSP260+ help261+ Say Y here to include support for soundcards based on the262+ Media Vision Jazz16 chipset: digital chip MVD1216 (Jazz16),263+ codec MVA416 (CS4216) and mixer MVA514 (ICS2514).264+ Media Vision's Jazz16 cards were sold under names Pro Sonic 16,265+ Premium 3-D and Pro 3-D. There were also OEMs cards with the266+ Jazz16 chipset.267+268+ To compile this driver as a module, choose M here: the module269+ will be called snd-jazz16.270271config SND_OPL3SA2272 tristate "Yamaha OPL3-SA2/SA3"
···2014 case WSS_HW_INTERWAVE:2015 ptexts = gusmax_texts;2016 break;2017+ case WSS_HW_OPTI93X:2018 case WSS_HW_OPL3SA2:2019 ptexts = opl3sa_texts;2020 break;···2246 CS4231_MONO_CTRL, 5, 1, 0),2247};224800000000000000000000000000000000000000000002249int snd_wss_mixer(struct snd_wss *chip)2250{2251 struct snd_card *card;2252 unsigned int idx;2253 int err;2254+ int count = ARRAY_SIZE(snd_wss_controls);22552256 if (snd_BUG_ON(!chip || !chip->pcm))2257 return -EINVAL;···23022303 strcpy(card->mixername, chip->pcm->name);23042305+ /* Use only the first 11 entries on AD1848 */2306+ if (chip->hardware & WSS_HW_AD1848_MASK)2307+ count = 11;2308+ /* There is no loopback on OPTI93X */2309+ else if (chip->hardware == WSS_HW_OPTI93X)2310+ count = 9;000023112312+ for (idx = 0; idx < count; idx++) {2313+ err = snd_ctl_add(card,2314+ snd_ctl_new1(&snd_wss_controls[idx],2315+ chip));2316+ if (err < 0)2317+ return err;000002318 }2319 return 0;2320}
···198 * 5530 only. The 5510/5520 decode is different.199 */200201+static DEFINE_PCI_DEVICE_TABLE(id_tbl) = {202 { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_AUDIO), 0 },203 { }204};
+22-13
sound/oss/soundcard.c
···328 return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);329}330331-static int sound_ioctl(struct inode *inode, struct file *file,332- unsigned int cmd, unsigned long arg)333{334 int len = 0, dtype;335- int dev = iminor(inode);0336 void __user *p = (void __user *)arg;337338 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {···353 if (cmd == OSS_GETVERSION)354 return __put_user(SOUND_VERSION, (int __user *)p);3550356 if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */357 (dev & 0x0f) != SND_DEV_CTL) { 358 dtype = dev & 0x0f;···361 case SND_DEV_DSP:362 case SND_DEV_DSP16:363 case SND_DEV_AUDIO:364- return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,365 cmd, p);366-367 default:368- return sound_mixer_ioctl(dev >> 4, cmd, p);0369 }00370 }0371 switch (dev & 0x0f) {372 case SND_DEV_CTL:373 if (cmd == SOUND_MIXER_GETLEVELS)374- return get_mixer_levels(p);375- if (cmd == SOUND_MIXER_SETLEVELS)376- return set_mixer_levels(p);377- return sound_mixer_ioctl(dev >> 4, cmd, p);00378379 case SND_DEV_SEQ:380 case SND_DEV_SEQ2:381- return sequencer_ioctl(dev, file, cmd, p);0382383 case SND_DEV_DSP:384 case SND_DEV_DSP16:···398 break;399400 }401- return -EINVAL;0402}403404static unsigned int sound_poll(struct file *file, poll_table * wait)···499 .read = sound_read,500 .write = sound_write,501 .poll = sound_poll,502- .ioctl = sound_ioctl,503 .mmap = sound_mmap,504 .open = sound_open,505 .release = sound_release,
···328 return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);329}330331+static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)0332{333 int len = 0, dtype;334+ int dev = iminor(file->f_dentry->d_inode);335+ long ret = -EINVAL;336 void __user *p = (void __user *)arg;337338 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {···353 if (cmd == OSS_GETVERSION)354 return __put_user(SOUND_VERSION, (int __user *)p);355356+ lock_kernel();357 if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */358 (dev & 0x0f) != SND_DEV_CTL) { 359 dtype = dev & 0x0f;···360 case SND_DEV_DSP:361 case SND_DEV_DSP16:362 case SND_DEV_AUDIO:363+ ret = sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,364 cmd, p);365+ break; 366 default:367+ ret = sound_mixer_ioctl(dev >> 4, cmd, p);368+ break;369 }370+ unlock_kernel();371+ return ret;372 }373+374 switch (dev & 0x0f) {375 case SND_DEV_CTL:376 if (cmd == SOUND_MIXER_GETLEVELS)377+ ret = get_mixer_levels(p);378+ else if (cmd == SOUND_MIXER_SETLEVELS)379+ ret = set_mixer_levels(p);380+ else381+ ret = sound_mixer_ioctl(dev >> 4, cmd, p);382+ break;383384 case SND_DEV_SEQ:385 case SND_DEV_SEQ2:386+ ret = sequencer_ioctl(dev, file, cmd, p);387+ break;388389 case SND_DEV_DSP:390 case SND_DEV_DSP16:···390 break;391392 }393+ unlock_kernel();394+ return ret;395}396397static unsigned int sound_poll(struct file *file, poll_table * wait)···490 .read = sound_read,491 .write = sound_write,492 .poll = sound_poll,493+ .unlocked_ioctl = sound_ioctl,494 .mmap = sound_mmap,495 .open = sound_open,496 .release = sound_release,
+1
sound/pci/Kconfig
···789 Say Y here to include support for sound cards based on the790 Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X,791 Essence ST (Deluxe), and Essence STX.0792 Support for the HDAV1.3 (Deluxe) is very experimental.793794 To compile this driver as a module, choose M here: the module
···789 Say Y here to include support for sound cards based on the790 Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X,791 Essence ST (Deluxe), and Essence STX.792+ Support for the DS is experimental.793 Support for the HDAV1.3 (Deluxe) is very experimental.794795 To compile this driver as a module, choose M here: the module
+1-16
sound/pci/ac97/ac97_patch.c
···544 return 0;545}546547-static int patch_wolfson_wm9705_specific(struct snd_ac97 * ac97)548-{549- int err, i;550- for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {551- if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)552- return err;553- }554- snd_ac97_write_cache(ac97, 0x72, 0x0808);555- return 0;556-}557-558-static struct snd_ac97_build_ops patch_wolfson_wm9705_ops = {559- .build_specific = patch_wolfson_wm9705_specific,560-};561-562static int patch_wolfson05(struct snd_ac97 * ac97)563{564 /* WM9705, WM9710 */565- ac97->build_ops = &patch_wolfson_wm9705_ops;566#ifdef CONFIG_TOUCHSCREEN_WM9705567 /* WM9705 touchscreen uses AUX and VIDEO for touch */568 ac97->flags |= AC97_HAS_NO_VIDEO | AC97_HAS_NO_AUX;
···544 return 0;545}546000000000000000547static int patch_wolfson05(struct snd_ac97 * ac97)548{549 /* WM9705, WM9710 */550+ ac97->build_ops = &patch_wolfson_wm9703_ops;551#ifdef CONFIG_TOUCHSCREEN_WM9705552 /* WM9705 touchscreen uses AUX and VIDEO for touch */553 ac97->flags |= AC97_HAS_NO_VIDEO | AC97_HAS_NO_AUX;
···795 .driver_data = SND_BT87X_BOARD_ ## id }796/* driver_data is the card id for that device */797798-static struct pci_device_id snd_bt87x_ids[] = {799 /* Hauppauge WinTV series */800 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, GENERIC),801 /* Hauppauge WinTV series */···964965/* default entries for all Bt87x cards - it's not exported */966/* driver_data is set to 0 to call detection */967-static struct pci_device_id snd_bt87x_default_ids[] __devinitdata = {968 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN),969 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN),970 { }
···795 .driver_data = SND_BT87X_BOARD_ ## id }796/* driver_data is the card id for that device */797798+static DEFINE_PCI_DEVICE_TABLE(snd_bt87x_ids) = {799 /* Hauppauge WinTV series */800 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0x13eb, GENERIC),801 /* Hauppauge WinTV series */···964965/* default entries for all Bt87x cards - it's not exported */966/* driver_data is set to 0 to call detection */967+static DEFINE_PCI_DEVICE_TABLE(snd_bt87x_default_ids) = {968 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN),969 BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN),970 { }
+1-1
sound/pci/ca0106/ca0106_main.c
···1875#endif18761877// PCI IDs1878-static struct pci_device_id snd_ca0106_ids[] = {1879 { PCI_VDEVICE(CREATIVE, 0x0007), 0 }, /* Audigy LS or Live 24bit */1880 { 0, }1881};
···1875#endif18761877// PCI IDs1878+static DEFINE_PCI_DEVICE_TABLE(snd_ca0106_ids) = {1879 { PCI_VDEVICE(CREATIVE, 0x0007), 0 }, /* Audigy LS or Live 24bit */1880 { 0, }1881};
···45 chip->device_id = device_id;46 chip->subdevice_id = subdevice_id;47 chip->bad_board = TRUE;48- chip->dsp_code_to_load = &card_fw[FW_DARLA24_DSP];49 /* Since this card has no ASIC, mark it as loaded so everything50 works OK */51 chip->asic_loaded = TRUE;···56 return err;57 chip->bad_board = FALSE;5859- if ((err = init_line_levels(chip)) < 0)60- return err;61-62 DE_INIT(("init_hw done\n"));63 return err;000000064}6566
···45 chip->device_id = device_id;46 chip->subdevice_id = subdevice_id;47 chip->bad_board = TRUE;48+ chip->dsp_code_to_load = FW_DARLA24_DSP;49 /* Since this card has no ASIC, mark it as loaded so everything50 works OK */51 chip->asic_loaded = TRUE;···56 return err;57 chip->bad_board = FALSE;5800059 DE_INIT(("init_hw done\n"));60 return err;61+}62+63+64+65+static int set_mixer_defaults(struct echoaudio *chip)66+{67+ return init_line_levels(chip);68}6970
···36static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};37static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);3839+40+41static int get_firmware(const struct firmware **fw_entry,42+ struct echoaudio *chip, const short fw_index)43{44 int err;45 char name[30];46+47+#ifdef CONFIG_PM48+ 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+#endif54+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)59 snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err);60+#ifdef CONFIG_PM61+ else62+ chip->fw_cache[fw_index] = *fw_entry;63+#endif64 return err;65}6667+68+69static void free_firmware(const struct firmware *fw_entry)70{71+#ifdef CONFIG_PM72+ DE_ACT(("firmware not released (kept in cache)\n"));73+#else74 release_firmware(fw_entry);75 DE_ACT(("firmware released\n"));76+#endif77+}78+79+80+81+static void free_firmware_cache(struct echoaudio *chip)82+{83+#ifdef CONFIG_PM84+ 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+#endif94}9596···714715 spin_lock(&chip->lock);716 switch (cmd) {717+ case SNDRV_PCM_TRIGGER_RESUME:718+ DE_ACT(("pcm_trigger resume\n"));719 case SNDRV_PCM_TRIGGER_START:720 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:721 DE_ACT(("pcm_trigger start\n"));···737 err = start_transport(chip, channelmask,738 chip->pipe_cyclic_mask);739 break;740+ case SNDRV_PCM_TRIGGER_SUSPEND:741+ DE_ACT(("pcm_trigger suspend\n"));742 case SNDRV_PCM_TRIGGER_STOP:743 DE_ACT(("pcm_trigger stop\n"));744 for (i = 0; i < DSP_MAXPIPES; i++) {···1876 pci_disable_device(chip->pci);18771878 /* release chip data */1879+ free_firmware_cache(chip);1880 kfree(chip);1881 DE_INIT(("Chip freed.\n"));1882 return 0;···1913 return err;1914 pci_set_master(pci);19151916+ /* Allocate chip if needed */1917+ if (!*rchip) {1918+ chip = kzalloc(sizeof(*chip), GFP_KERNEL);1919+ if (!chip) {1920+ pci_disable_device(pci);1921+ return -ENOMEM;1922+ }1923+ DE_INIT(("chip=%p\n", chip));1924+ spin_lock_init(&chip->lock);1925+ chip->card = card;1926+ chip->pci = pci;1927+ chip->irq = -1;1928+ atomic_set(&chip->opencount, 0);1929+ mutex_init(&chip->mode_mutex);1930+ chip->can_set_rate = 1;1931+ } else {1932+ /* If this was called from the resume function, chip is1933+ * already allocated and it contains current card settings.1934+ */1935+ chip = *rchip;1936 }00000019371938 /* PCI resource allocation */1939 chip->dsp_registers_phys = pci_resource_start(pci, 0);···1964 chip->comm_page = (struct comm_page *)chip->commpage_dma_buf.area;19651966 err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);1967+ if (err >= 0)1968+ err = set_mixer_defaults(chip);1969+ if (err < 0) {1970 DE_INIT(("init_hw err=%d\n", err));1971 snd_echo_free(chip);1972 return err;···1975 snd_echo_free(chip);1976 return err;1977 }0001978 *rchip = chip;1979 /* Init done ! */1980 return 0;···20102011 snd_card_set_dev(card, &pci->dev);20122013+ chip = NULL; /* Tells snd_echo_create to allocate chip */2014 if ((err = snd_echo_create(card, pci, &chip)) < 0) {2015 snd_card_free(card);2016 return err;···2149215021512152+#if defined(CONFIG_PM)2153+2154+static int snd_echo_suspend(struct pci_dev *pci, pm_message_t state)2155+{2156+ struct echoaudio *chip = pci_get_drvdata(pci);2157+2158+ DE_INIT(("suspend start\n"));2159+ snd_pcm_suspend_all(chip->analog_pcm);2160+ snd_pcm_suspend_all(chip->digital_pcm);2161+2162+#ifdef ECHOCARD_HAS_MIDI2163+ /* This call can sleep */2164+ if (chip->midi_out)2165+ snd_echo_midi_output_trigger(chip->midi_out, 0);2166+#endif2167+ spin_lock_irq(&chip->lock);2168+ if (wait_handshake(chip)) {2169+ spin_unlock_irq(&chip->lock);2170+ return -EIO;2171+ }2172+ clear_handshake(chip);2173+ if (send_vector(chip, DSP_VC_GO_COMATOSE) < 0) {2174+ spin_unlock_irq(&chip->lock);2175+ return -EIO;2176+ }2177+ spin_unlock_irq(&chip->lock);2178+2179+ chip->dsp_code = NULL;2180+ free_irq(chip->irq, chip);2181+ chip->irq = -1;2182+ pci_save_state(pci);2183+ pci_disable_device(pci);2184+2185+ DE_INIT(("suspend done\n"));2186+ return 0;2187+}2188+2189+2190+2191+static int snd_echo_resume(struct pci_dev *pci)2192+{2193+ struct echoaudio *chip = pci_get_drvdata(pci);2194+ struct comm_page *commpage, *commpage_bak;2195+ u32 pipe_alloc_mask;2196+ int err;2197+2198+ DE_INIT(("resume start\n"));2199+ pci_restore_state(pci);2200+ commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL);2201+ commpage = chip->comm_page;2202+ memcpy(commpage_bak, commpage, sizeof(struct comm_page));2203+2204+ err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);2205+ if (err < 0) {2206+ kfree(commpage_bak);2207+ DE_INIT(("resume init_hw err=%d\n", err));2208+ snd_echo_free(chip);2209+ return err;2210+ }2211+ DE_INIT(("resume init OK\n"));2212+2213+ /* Temporarily set chip->pipe_alloc_mask=0 otherwise2214+ * restore_dsp_settings() fails.2215+ */2216+ pipe_alloc_mask = chip->pipe_alloc_mask;2217+ chip->pipe_alloc_mask = 0;2218+ err = restore_dsp_rettings(chip);2219+ chip->pipe_alloc_mask = pipe_alloc_mask;2220+ if (err < 0) {2221+ kfree(commpage_bak);2222+ return err;2223+ }2224+ DE_INIT(("resume restore OK\n"));2225+2226+ memcpy(&commpage->audio_format, &commpage_bak->audio_format,2227+ sizeof(commpage->audio_format));2228+ memcpy(&commpage->sglist_addr, &commpage_bak->sglist_addr,2229+ sizeof(commpage->sglist_addr));2230+ memcpy(&commpage->midi_output, &commpage_bak->midi_output,2231+ sizeof(commpage->midi_output));2232+ kfree(commpage_bak);2233+2234+ if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,2235+ ECHOCARD_NAME, chip)) {2236+ snd_echo_free(chip);2237+ snd_printk(KERN_ERR "cannot grab irq\n");2238+ return -EBUSY;2239+ }2240+ chip->irq = pci->irq;2241+ DE_INIT(("resume irq=%d\n", chip->irq));2242+2243+#ifdef ECHOCARD_HAS_MIDI2244+ if (chip->midi_input_enabled)2245+ enable_midi_input(chip, TRUE);2246+ if (chip->midi_out)2247+ snd_echo_midi_output_trigger(chip->midi_out, 1);2248+#endif2249+2250+ DE_INIT(("resume done\n"));2251+ return 0;2252+}2253+2254+#endif /* CONFIG_PM */2255+2256+2257+2258static void __devexit snd_echo_remove(struct pci_dev *pci)2259{2260 struct echoaudio *chip;···2171 .id_table = snd_echo_ids,2172 .probe = snd_echo_probe,2173 .remove = __devexit_p(snd_echo_remove),2174+#ifdef CONFIG_PM2175+ .suspend = snd_echo_suspend,2176+ .resume = snd_echo_resume,2177+#endif /* CONFIG_PM */2178};21792180
+8-3
sound/pci/echoaudio/echoaudio.h
···442 u16 device_id, subdevice_id;443 u16 *dsp_code; /* Current DSP code loaded,444 * NULL if nothing loaded */445- const struct firmware *dsp_code_to_load;/* DSP code to load */446- const struct firmware *asic_code; /* Current ASIC code */447 u32 comm_page_phys; /* Physical address of the448 * memory seen by DSP */449 volatile u32 __iomem *dsp_registers; /* DSP's register base */450 u32 active_mask; /* Chs. active mask or451 * punks out */000452453#ifdef ECHOCARD_HAS_MIDI454 u16 mtc_state; /* State for MIDI input parsing state machine */···467static int wait_handshake(struct echoaudio *chip);468static int send_vector(struct echoaudio *chip, u32 command);469static int get_firmware(const struct firmware **fw_entry,470- const struct firmware *frm, struct echoaudio *chip);471static void free_firmware(const struct firmware *fw_entry);472473#ifdef ECHOCARD_HAS_MIDI474static int enable_midi_input(struct echoaudio *chip, char enable);00475static int midi_service_irq(struct echoaudio *chip);476static int __devinit snd_echo_midi_create(struct snd_card *card,477 struct echoaudio *chip);
···442 u16 device_id, subdevice_id;443 u16 *dsp_code; /* Current DSP code loaded,444 * NULL if nothing loaded */445+ short dsp_code_to_load; /* DSP code to load */446+ short asic_code; /* Current ASIC code */447 u32 comm_page_phys; /* Physical address of the448 * memory seen by DSP */449 volatile u32 __iomem *dsp_registers; /* DSP's register base */450 u32 active_mask; /* Chs. active mask or451 * punks out */452+#ifdef CONFIG_PM453+ const struct firmware *fw_cache[8]; /* Cached firmwares */454+#endif455456#ifdef ECHOCARD_HAS_MIDI457 u16 mtc_state; /* State for MIDI input parsing state machine */···464static int wait_handshake(struct echoaudio *chip);465static int send_vector(struct echoaudio *chip, u32 command);466static int get_firmware(const struct firmware **fw_entry,467+ struct echoaudio *chip, const short fw_index);468static void free_firmware(const struct firmware *fw_entry);469470#ifdef ECHOCARD_HAS_MIDI471static int enable_midi_input(struct echoaudio *chip, char enable);472+static void snd_echo_midi_output_trigger(473+ struct snd_rawmidi_substream *substream, int up);474static int midi_service_irq(struct echoaudio *chip);475static int __devinit snd_echo_midi_create(struct snd_card *card,476 struct echoaudio *chip);
+2-3
sound/pci/echoaudio/echoaudio_3g.c
···227 /* Give the DSP a few milliseconds to settle down */228 mdelay(2);229230- err = load_asic_generic(chip, DSP_FNC_LOAD_3G_ASIC,231- &card_fw[FW_3G_ASIC]);232 if (err < 0)233 return err;234235- chip->asic_code = &card_fw[FW_3G_ASIC];236237 /* Now give the new ASIC some time to set up */238 msleep(1000);
···227 /* Give the DSP a few milliseconds to settle down */228 mdelay(2);229230+ err = load_asic_generic(chip, DSP_FNC_LOAD_3G_ASIC, FW_3G_ASIC);0231 if (err < 0)232 return err;233234+ chip->asic_code = FW_3G_ASIC;235236 /* Now give the new ASIC some time to set up */237 msleep(1000);
+92-71
sound/pci/echoaudio/echoaudio_dsp.c
···175#ifdef ECHOCARD_HAS_ASIC176177/* Load ASIC code - done after the DSP is loaded */178-static int load_asic_generic(struct echoaudio *chip, u32 cmd,179- const struct firmware *asic)180{181 const struct firmware *fw;182 int err;183 u32 i, size;184 u8 *code;185186- if ((err = get_firmware(&fw, asic, chip)) < 0) {0187 snd_printk(KERN_WARNING "Firmware not found !\n");188 return err;189 }···245 return 0;246 }247248- if ((i = get_firmware(&fw, &card_fw[FW_361_LOADER], chip)) < 0) {0249 snd_printk(KERN_WARNING "Firmware not found !\n");250 return i;251 }···486 chip->dsp_code = NULL;487 }488489- if ((err = get_firmware(&fw, chip->dsp_code_to_load, chip)) < 0)0490 return err;491 err = load_dsp(chip, (u16 *)fw->data);492 free_firmware(fw);···496497 if ((box_type = load_asic(chip)) < 0)498 return box_type; /* error */499-500- if ((err = restore_dsp_rettings(chip)) < 0)501- return err;502503 return box_type;504}···656657static int restore_dsp_rettings(struct echoaudio *chip)658{659- int err;660 DE_INIT(("restore_dsp_settings\n"));661662 if ((err = check_asic_status(chip)) < 0)663 return err;664665- /* @ Gina20/Darla20 only. Should be harmless for other cards. */666 chip->comm_page->gd_clock_state = GD_CLOCK_UNDEF;667 chip->comm_page->gd_spdif_status = GD_SPDIF_STATUS_UNDEF;668 chip->comm_page->handshake = 0xffffffff;669670- if ((err = set_sample_rate(chip, chip->sample_rate)) < 0)00000000000000000000000000000000000000671 return err;672673- if (chip->meters_enabled)674- if (send_vector(chip, DSP_VC_METERS_ON) < 0)675- return -EIO;0000000000000000000000000676677#ifdef ECHOCARD_HAS_EXTERNAL_CLOCK0678 if (set_input_clock(chip, chip->input_clock) < 0)679 return -EIO;680#endif···748 return -EIO;749#endif750751- if (update_output_line_level(chip) < 0)752- return -EIO;753-754- if (update_input_line_level(chip) < 0)755- return -EIO;756-757-#ifdef ECHOCARD_HAS_VMIXER758- if (update_vmixer_level(chip) < 0)759- return -EIO;760-#endif761-762 if (wait_handshake(chip) < 0)763 return -EIO;764 clear_handshake(chip);00765766 DE_INIT(("restore_dsp_rettings done\n"));767- return send_vector(chip, DSP_VC_UPDATE_FLAGS);768}769770···972 chip->card_name = ECHOCARD_NAME;973 chip->bad_board = TRUE; /* Set TRUE until DSP loaded */974 chip->dsp_code = NULL; /* Current DSP code not loaded */975- chip->digital_mode = DIGITAL_MODE_NONE;976- chip->input_clock = ECHO_CLOCK_INTERNAL;977- chip->output_clock = ECHO_CLOCK_WORD;978 chip->asic_loaded = FALSE;979 memset(chip->comm_page, 0, sizeof(struct comm_page));980···982 chip->comm_page->midi_out_free_count =983 cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE);984 chip->comm_page->sample_rate = cpu_to_le32(44100);985- chip->sample_rate = 44100;986987 /* Set line levels so we don't blast any inputs on startup */988 memset(chip->comm_page->monitors, ECHOGAIN_MUTED, MONITOR_ARRAY_SIZE);···992993994995-/* This function initializes the several volume controls for busses and pipes.996-This MUST be called after the DSP is up and running ! */00997static int init_line_levels(struct echoaudio *chip)998{999- int st, i, o;1000-1001 DE_INIT(("init_line_levels\n"));1002-1003- /* Mute output busses */1004- for (i = 0; i < num_busses_out(chip); i++)1005- if ((st = set_output_gain(chip, i, ECHOGAIN_MUTED)))1006- return st;1007- if ((st = update_output_line_level(chip)))1008- return st;1009-1010-#ifdef ECHOCARD_HAS_VMIXER1011- /* Mute the Vmixer */1012- for (i = 0; i < num_pipes_out(chip); i++)1013- for (o = 0; o < num_busses_out(chip); o++)1014- if ((st = set_vmixer_gain(chip, o, i, ECHOGAIN_MUTED)))1015- return st;1016- if ((st = update_vmixer_level(chip)))1017- return st;1018-#endif /* ECHOCARD_HAS_VMIXER */1019-1020-#ifdef ECHOCARD_HAS_MONITOR1021- /* Mute the monitor mixer */1022- for (o = 0; o < num_busses_out(chip); o++)1023- for (i = 0; i < num_busses_in(chip); i++)1024- if ((st = set_monitor_gain(chip, o, i, ECHOGAIN_MUTED)))1025- return st;1026- if ((st = update_output_line_level(chip)))1027- return st;1028-#endif /* ECHOCARD_HAS_MONITOR */1029-1030-#ifdef ECHOCARD_HAS_INPUT_GAIN1031- for (i = 0; i < num_busses_in(chip); i++)1032- if ((st = set_input_gain(chip, i, ECHOGAIN_MUTED)))1033- return st;1034- if ((st = update_input_line_level(chip)))1035- return st;1036-#endif /* ECHOCARD_HAS_INPUT_GAIN */1037-1038- return 0;1039}10401041
···175#ifdef ECHOCARD_HAS_ASIC176177/* Load ASIC code - done after the DSP is loaded */178+static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic)0179{180 const struct firmware *fw;181 int err;182 u32 i, size;183 u8 *code;184185+ err = get_firmware(&fw, chip, asic);186+ if (err < 0) {187 snd_printk(KERN_WARNING "Firmware not found !\n");188 return err;189 }···245 return 0;246 }247248+ i = get_firmware(&fw, chip, FW_361_LOADER);249+ if (i < 0) {250 snd_printk(KERN_WARNING "Firmware not found !\n");251 return i;252 }···485 chip->dsp_code = NULL;486 }487488+ err = get_firmware(&fw, chip, chip->dsp_code_to_load);489+ if (err < 0)490 return err;491 err = load_dsp(chip, (u16 *)fw->data);492 free_firmware(fw);···494495 if ((box_type = load_asic(chip)) < 0)496 return box_type; /* error */000497498 return box_type;499}···657658static int restore_dsp_rettings(struct echoaudio *chip)659{660+ int i, o, err;661 DE_INIT(("restore_dsp_settings\n"));662663 if ((err = check_asic_status(chip)) < 0)664 return err;665666+ /* Gina20/Darla20 only. Should be harmless for other cards. */667 chip->comm_page->gd_clock_state = GD_CLOCK_UNDEF;668 chip->comm_page->gd_spdif_status = GD_SPDIF_STATUS_UNDEF;669 chip->comm_page->handshake = 0xffffffff;670671+ /* Restore output busses */672+ for (i = 0; i < num_busses_out(chip); i++) {673+ err = set_output_gain(chip, i, chip->output_gain[i]);674+ if (err < 0)675+ return err;676+ }677+678+#ifdef ECHOCARD_HAS_VMIXER679+ for (i = 0; i < num_pipes_out(chip); i++)680+ for (o = 0; o < num_busses_out(chip); o++) {681+ err = set_vmixer_gain(chip, o, i,682+ chip->vmixer_gain[o][i]);683+ if (err < 0)684+ return err;685+ }686+ if (update_vmixer_level(chip) < 0)687+ return -EIO;688+#endif /* ECHOCARD_HAS_VMIXER */689+690+#ifdef ECHOCARD_HAS_MONITOR691+ for (o = 0; o < num_busses_out(chip); o++)692+ for (i = 0; i < num_busses_in(chip); i++) {693+ err = set_monitor_gain(chip, o, i,694+ chip->monitor_gain[o][i]);695+ if (err < 0)696+ return err;697+ }698+#endif /* ECHOCARD_HAS_MONITOR */699+700+#ifdef ECHOCARD_HAS_INPUT_GAIN701+ for (i = 0; i < num_busses_in(chip); i++) {702+ err = set_input_gain(chip, i, chip->input_gain[i]);703+ if (err < 0)704+ return err;705+ }706+#endif /* ECHOCARD_HAS_INPUT_GAIN */707+708+ err = update_output_line_level(chip);709+ if (err < 0)710 return err;711712+ err = update_input_line_level(chip);713+ if (err < 0)714+ return err;715+716+ err = set_sample_rate(chip, chip->sample_rate);717+ if (err < 0)718+ return err;719+720+ if (chip->meters_enabled) {721+ err = send_vector(chip, DSP_VC_METERS_ON);722+ if (err < 0)723+ return err;724+ }725+726+#ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH727+ if (set_digital_mode(chip, chip->digital_mode) < 0)728+ return -EIO;729+#endif730+731+#ifdef ECHOCARD_HAS_DIGITAL_IO732+ if (set_professional_spdif(chip, chip->professional_spdif) < 0)733+ return -EIO;734+#endif735+736+#ifdef ECHOCARD_HAS_PHANTOM_POWER737+ if (set_phantom_power(chip, chip->phantom_power) < 0)738+ return -EIO;739+#endif740741#ifdef ECHOCARD_HAS_EXTERNAL_CLOCK742+ /* set_input_clock() also restores automute setting */743 if (set_input_clock(chip, chip->input_clock) < 0)744 return -EIO;745#endif···685 return -EIO;686#endif68700000000000688 if (wait_handshake(chip) < 0)689 return -EIO;690 clear_handshake(chip);691+ if (send_vector(chip, DSP_VC_UPDATE_FLAGS) < 0)692+ return -EIO;693694 DE_INIT(("restore_dsp_rettings done\n"));695+ return 0;696}697698···918 chip->card_name = ECHOCARD_NAME;919 chip->bad_board = TRUE; /* Set TRUE until DSP loaded */920 chip->dsp_code = NULL; /* Current DSP code not loaded */000921 chip->asic_loaded = FALSE;922 memset(chip->comm_page, 0, sizeof(struct comm_page));923···931 chip->comm_page->midi_out_free_count =932 cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE);933 chip->comm_page->sample_rate = cpu_to_le32(44100);0934935 /* Set line levels so we don't blast any inputs on startup */936 memset(chip->comm_page->monitors, ECHOGAIN_MUTED, MONITOR_ARRAY_SIZE);···942943944945+/* This function initializes the chip structure with default values, ie. all946+ * muted and internal clock source. Then it copies the settings to the DSP.947+ * This MUST be called after the DSP is up and running !948+ */949static int init_line_levels(struct echoaudio *chip)950{00951 DE_INIT(("init_line_levels\n"));952+ memset(chip->output_gain, ECHOGAIN_MUTED, sizeof(chip->output_gain));953+ memset(chip->input_gain, ECHOGAIN_MUTED, sizeof(chip->input_gain));954+ memset(chip->monitor_gain, ECHOGAIN_MUTED, sizeof(chip->monitor_gain));955+ memset(chip->vmixer_gain, ECHOGAIN_MUTED, sizeof(chip->vmixer_gain));956+ chip->input_clock = ECHO_CLOCK_INTERNAL;957+ chip->output_clock = ECHO_CLOCK_WORD;958+ chip->sample_rate = 44100;959+ return restore_dsp_rettings(chip);00000000000000000000000000000960}961962
···50 chip->device_id = device_id;51 chip->subdevice_id = subdevice_id;52 chip->bad_board = TRUE;53- chip->dsp_code_to_load = &card_fw[FW_INDIGO_DSP];54 /* Since this card has no ASIC, mark it as loaded so everything55 works OK */56 chip->asic_loaded = TRUE;···60 return err;61 chip->bad_board = FALSE;6263- if ((err = init_line_levels(chip)) < 0)64- return err;65-66 DE_INIT(("init_hw done\n"));67 return err;000000068}6970
···50 chip->device_id = device_id;51 chip->subdevice_id = subdevice_id;52 chip->bad_board = TRUE;53+ chip->dsp_code_to_load = FW_INDIGO_DSP;54 /* Since this card has no ASIC, mark it as loaded so everything55 works OK */56 chip->asic_loaded = TRUE;···60 return err;61 chip->bad_board = FALSE;6200063 DE_INIT(("init_hw done\n"));64 return err;65+}66+67+68+69+static int set_mixer_defaults(struct echoaudio *chip)70+{71+ return init_line_levels(chip);72}7374
···50 chip->device_id = device_id;51 chip->subdevice_id = subdevice_id;52 chip->bad_board = TRUE;53- chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJ_DSP];54 /* Since this card has no ASIC, mark it as loaded so everything55 works OK */56 chip->asic_loaded = TRUE;···60 return err;61 chip->bad_board = FALSE;6263- if ((err = init_line_levels(chip)) < 0)64- return err;65-66 DE_INIT(("init_hw done\n"));67 return err;000000068}6970
···50 chip->device_id = device_id;51 chip->subdevice_id = subdevice_id;52 chip->bad_board = TRUE;53+ chip->dsp_code_to_load = FW_INDIGO_DJ_DSP;54 /* Since this card has no ASIC, mark it as loaded so everything55 works OK */56 chip->asic_loaded = TRUE;···60 return err;61 chip->bad_board = FALSE;6200063 DE_INIT(("init_hw done\n"));64 return err;65+}66+67+68+69+static int set_mixer_defaults(struct echoaudio *chip)70+{71+ return init_line_levels(chip);72}7374
···48 chip->device_id = device_id;49 chip->subdevice_id = subdevice_id;50 chip->bad_board = TRUE;51- chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJX_DSP];52 /* Since this card has no ASIC, mark it as loaded so everything53 works OK */54 chip->asic_loaded = TRUE;···59 return err;60 chip->bad_board = FALSE;6162- err = init_line_levels(chip);63- if (err < 0)64- return err;65-66 DE_INIT(("init_hw done\n"));67 return err;000000068}
···48 chip->device_id = device_id;49 chip->subdevice_id = subdevice_id;50 chip->bad_board = TRUE;51+ chip->dsp_code_to_load = FW_INDIGO_DJX_DSP;52 /* Since this card has no ASIC, mark it as loaded so everything53 works OK */54 chip->asic_loaded = TRUE;···59 return err;60 chip->bad_board = FALSE;61000062 DE_INIT(("init_hw done\n"));63 return err;64+}65+66+67+68+static int set_mixer_defaults(struct echoaudio *chip)69+{70+ return init_line_levels(chip);71}
···50 chip->device_id = device_id;51 chip->subdevice_id = subdevice_id;52 chip->bad_board = TRUE;53- chip->dsp_code_to_load = &card_fw[FW_INDIGO_IO_DSP];54 /* Since this card has no ASIC, mark it as loaded so everything55 works OK */56 chip->asic_loaded = TRUE;···60 return err;61 chip->bad_board = FALSE;6263- if ((err = init_line_levels(chip)) < 0)64- return err;65-66 DE_INIT(("init_hw done\n"));67 return err;000000068}6970
···50 chip->device_id = device_id;51 chip->subdevice_id = subdevice_id;52 chip->bad_board = TRUE;53+ chip->dsp_code_to_load = FW_INDIGO_IO_DSP;54 /* Since this card has no ASIC, mark it as loaded so everything55 works OK */56 chip->asic_loaded = TRUE;···60 return err;61 chip->bad_board = FALSE;6200063 DE_INIT(("init_hw done\n"));64 return err;65+}66+67+68+69+static int set_mixer_defaults(struct echoaudio *chip)70+{71+ return init_line_levels(chip);72}7374
···48 chip->device_id = device_id;49 chip->subdevice_id = subdevice_id;50 chip->bad_board = TRUE;51- chip->dsp_code_to_load = &card_fw[FW_INDIGO_IOX_DSP];52 /* Since this card has no ASIC, mark it as loaded so everything53 works OK */54 chip->asic_loaded = TRUE;···59 return err;60 chip->bad_board = FALSE;6162- err = init_line_levels(chip);63- if (err < 0)64- return err;65-66 DE_INIT(("init_hw done\n"));67 return err;000000068}
···48 chip->device_id = device_id;49 chip->subdevice_id = subdevice_id;50 chip->bad_board = TRUE;51+ chip->dsp_code_to_load = FW_INDIGO_IOX_DSP;52 /* Since this card has no ASIC, mark it as loaded so everything53 works OK */54 chip->asic_loaded = TRUE;···59 return err;60 chip->bad_board = FALSE;61000062 DE_INIT(("init_hw done\n"));63 return err;64+}65+66+67+68+static int set_mixer_defaults(struct echoaudio *chip)69+{70+ return init_line_levels(chip);71}
···32static int set_input_clock(struct echoaudio *chip, u16 clock);33static int set_professional_spdif(struct echoaudio *chip, char prof);34static int set_digital_mode(struct echoaudio *chip, u8 mode);35-static int load_asic_generic(struct echoaudio *chip, u32 cmd,36- const struct firmware *asic);37static int check_asic_status(struct echoaudio *chip);3839···53 chip->subdevice_id = subdevice_id;54 chip->bad_board = TRUE;55 chip->has_midi = TRUE;56- chip->dsp_code_to_load = &card_fw[FW_LAYLA24_DSP];57 chip->input_clock_types =58 ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF |59 ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_ADAT;···61 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |62 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |63 ECHOCAPS_HAS_DIGITAL_MODE_ADAT;64- chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;65- chip->professional_spdif = FALSE;66- chip->digital_in_automute = TRUE;6768 if ((err = load_firmware(chip)) < 0)69 return err;···69 if ((err = init_line_levels(chip)) < 0)70 return err;7172- err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);73- if (err < 0)74- return err;75- err = set_professional_spdif(chip, TRUE);76-77 DE_INIT(("init_hw done\n"));78 return err;000000000079}8081···124125 /* Load the ASIC for the PCI card */126 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC,127- &card_fw[FW_LAYLA24_1_ASIC]);128 if (err < 0)129 return err;130131- chip->asic_code = &card_fw[FW_LAYLA24_2S_ASIC];132133 /* Now give the new ASIC a little time to set up */134 mdelay(10);135136 /* Do the external one */137 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC,138- &card_fw[FW_LAYLA24_2S_ASIC]);139 if (err < 0)140 return FALSE;141···300/* Depending on what digital mode you want, Layla24 needs different ASICs301loaded. This function checks the ASIC needed for the new mode and sees302if it matches the one already loaded. */303-static int switch_asic(struct echoaudio *chip, const struct firmware *asic)304{305 s8 *monitors;306···336{337 u32 control_reg;338 int err, incompatible_clock;339- const struct firmware *asic;340341 /* Set clock to "internal" if it's not compatible with the new mode */342 incompatible_clock = FALSE;···345 case DIGITAL_MODE_SPDIF_RCA:346 if (chip->input_clock == ECHO_CLOCK_ADAT)347 incompatible_clock = TRUE;348- asic = &card_fw[FW_LAYLA24_2S_ASIC];349 break;350 case DIGITAL_MODE_ADAT:351 if (chip->input_clock == ECHO_CLOCK_SPDIF)352 incompatible_clock = TRUE;353- asic = &card_fw[FW_LAYLA24_2A_ASIC];354 break;355 default:356 DE_ACT(("Digital mode not supported: %d\n", mode));
···32static int set_input_clock(struct echoaudio *chip, u16 clock);33static int set_professional_spdif(struct echoaudio *chip, char prof);34static int set_digital_mode(struct echoaudio *chip, u8 mode);35+static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);036static int check_asic_status(struct echoaudio *chip);3738···54 chip->subdevice_id = subdevice_id;55 chip->bad_board = TRUE;56 chip->has_midi = TRUE;57+ chip->dsp_code_to_load = FW_LAYLA24_DSP;58 chip->input_clock_types =59 ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF |60 ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_ADAT;···62 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |63 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |64 ECHOCAPS_HAS_DIGITAL_MODE_ADAT;0006566 if ((err = load_firmware(chip)) < 0)67 return err;···73 if ((err = init_line_levels(chip)) < 0)74 return err;750000076 DE_INIT(("init_hw done\n"));77 return err;78+}79+80+81+82+static int set_mixer_defaults(struct echoaudio *chip)83+{84+ chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;85+ chip->professional_spdif = FALSE;86+ chip->digital_in_automute = TRUE;87+ return init_line_levels(chip);88}8990···123124 /* Load the ASIC for the PCI card */125 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC,126+ FW_LAYLA24_1_ASIC);127 if (err < 0)128 return err;129130+ chip->asic_code = FW_LAYLA24_2S_ASIC;131132 /* Now give the new ASIC a little time to set up */133 mdelay(10);134135 /* Do the external one */136 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC,137+ FW_LAYLA24_2S_ASIC);138 if (err < 0)139 return FALSE;140···299/* Depending on what digital mode you want, Layla24 needs different ASICs300loaded. This function checks the ASIC needed for the new mode and sees301if it matches the one already loaded. */302+static int switch_asic(struct echoaudio *chip, short asic)303{304 s8 *monitors;305···335{336 u32 control_reg;337 int err, incompatible_clock;338+ short asic;339340 /* Set clock to "internal" if it's not compatible with the new mode */341 incompatible_clock = FALSE;···344 case DIGITAL_MODE_SPDIF_RCA:345 if (chip->input_clock == ECHO_CLOCK_ADAT)346 incompatible_clock = TRUE;347+ asic = FW_LAYLA24_2S_ASIC;348 break;349 case DIGITAL_MODE_ADAT:350 if (chip->input_clock == ECHO_CLOCK_SPDIF)351 incompatible_clock = TRUE;352+ asic = FW_LAYLA24_2A_ASIC;353 break;354 default:355 DE_ACT(("Digital mode not supported: %d\n", mode));
···53 chip->device_id = device_id;54 chip->subdevice_id = subdevice_id;55 chip->bad_board = TRUE;56- chip->dsp_code_to_load = &card_fw[FW_MIA_DSP];57 /* Since this card has no ASIC, mark it as loaded so everything58 works OK */59 chip->asic_loaded = TRUE;···66 return err;67 chip->bad_board = FALSE;6869- if ((err = init_line_levels(chip)))70- return err;71-72 DE_INIT(("init_hw done\n"));73 return err;000000074}7576
···53 chip->device_id = device_id;54 chip->subdevice_id = subdevice_id;55 chip->bad_board = TRUE;56+ chip->dsp_code_to_load = FW_MIA_DSP;57 /* Since this card has no ASIC, mark it as loaded so everything58 works OK */59 chip->asic_loaded = TRUE;···66 return err;67 chip->bad_board = FALSE;6800069 DE_INIT(("init_hw done\n"));70 return err;71+}72+73+74+75+static int set_mixer_defaults(struct echoaudio *chip)76+{77+ return init_line_levels(chip);78}7980
···33static int set_input_clock(struct echoaudio *chip, u16 clock);34static int set_professional_spdif(struct echoaudio *chip, char prof);35static int set_digital_mode(struct echoaudio *chip, u8 mode);36-static int load_asic_generic(struct echoaudio *chip, u32 cmd,37- const struct firmware *asic);38static int check_asic_status(struct echoaudio *chip);3940···6364 /* Mona comes in both '301 and '361 flavors */65 if (chip->device_id == DEVICE_ID_56361)66- chip->dsp_code_to_load = &card_fw[FW_MONA_361_DSP];67 else68- chip->dsp_code_to_load = &card_fw[FW_MONA_301_DSP];69-70- chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;71- chip->professional_spdif = FALSE;72- chip->digital_in_automute = TRUE;7374 if ((err = load_firmware(chip)) < 0)75 return err;76 chip->bad_board = FALSE;7778- if ((err = init_line_levels(chip)) < 0)79- return err;80-81- err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);82- if (err < 0)83- return err;84- err = set_professional_spdif(chip, TRUE);85-86 DE_INIT(("init_hw done\n"));87 return err;000000000088}8990···117{118 u32 control_reg;119 int err;120- const struct firmware *asic;121122 if (chip->asic_loaded)123 return 0;···125 mdelay(10);126127 if (chip->device_id == DEVICE_ID_56361)128- asic = &card_fw[FW_MONA_361_1_ASIC48];129 else130- asic = &card_fw[FW_MONA_301_1_ASIC48];131132 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_PCI_CARD_ASIC, asic);133 if (err < 0)···138139 /* Do the external one */140 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_EXTERNAL_ASIC,141- &card_fw[FW_MONA_2_ASIC]);142 if (err < 0)143 return err;144···162if it matches the one already loaded. */163static int switch_asic(struct echoaudio *chip, char double_speed)164{165- const struct firmware *asic;166 int err;0167168 /* Check the clock detect bits to see if this is169 a single-speed clock or a double-speed clock; load170 a new ASIC if necessary. */171 if (chip->device_id == DEVICE_ID_56361) {172 if (double_speed)173- asic = &card_fw[FW_MONA_361_1_ASIC96];174 else175- asic = &card_fw[FW_MONA_361_1_ASIC48];176 } else {177 if (double_speed)178- asic = &card_fw[FW_MONA_301_1_ASIC96];179 else180- asic = &card_fw[FW_MONA_301_1_ASIC48];181 }182183 if (asic != chip->asic_code) {···197static int set_sample_rate(struct echoaudio *chip, u32 rate)198{199 u32 control_reg, clock;200- const struct firmware *asic;201 char force_write;202203 /* Only set the clock for internal mode. */···215 if (chip->digital_mode == DIGITAL_MODE_ADAT)216 return -EINVAL;217 if (chip->device_id == DEVICE_ID_56361)218- asic = &card_fw[FW_MONA_361_1_ASIC96];219 else220- asic = &card_fw[FW_MONA_301_1_ASIC96];221 } else {222 if (chip->device_id == DEVICE_ID_56361)223- asic = &card_fw[FW_MONA_361_1_ASIC48];224 else225- asic = &card_fw[FW_MONA_301_1_ASIC48];226 }227228 force_write = 0;···407 case DIGITAL_MODE_ADAT:408 /* If the current ASIC is the 96KHz ASIC, switch the ASIC409 and set to 48 KHz */410- if (chip->asic_code == &card_fw[FW_MONA_361_1_ASIC96] ||411- chip->asic_code == &card_fw[FW_MONA_301_1_ASIC96]) {412 set_sample_rate(chip, 48000);413 }414 control_reg |= GML_ADAT_MODE;
···33static int set_input_clock(struct echoaudio *chip, u16 clock);34static int set_professional_spdif(struct echoaudio *chip, char prof);35static int set_digital_mode(struct echoaudio *chip, u8 mode);36+static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);037static int check_asic_status(struct echoaudio *chip);3839···6465 /* Mona comes in both '301 and '361 flavors */66 if (chip->device_id == DEVICE_ID_56361)67+ chip->dsp_code_to_load = FW_MONA_361_DSP;68 else69+ chip->dsp_code_to_load = FW_MONA_301_DSP;00007071 if ((err = load_firmware(chip)) < 0)72 return err;73 chip->bad_board = FALSE;740000000075 DE_INIT(("init_hw done\n"));76 return err;77+}78+79+80+81+static int set_mixer_defaults(struct echoaudio *chip)82+{83+ chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;84+ chip->professional_spdif = FALSE;85+ chip->digital_in_automute = TRUE;86+ return init_line_levels(chip);87}8889···120{121 u32 control_reg;122 int err;123+ short asic;124125 if (chip->asic_loaded)126 return 0;···128 mdelay(10);129130 if (chip->device_id == DEVICE_ID_56361)131+ asic = FW_MONA_361_1_ASIC48;132 else133+ asic = FW_MONA_301_1_ASIC48;134135 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_PCI_CARD_ASIC, asic);136 if (err < 0)···141142 /* Do the external one */143 err = load_asic_generic(chip, DSP_FNC_LOAD_MONA_EXTERNAL_ASIC,144+ FW_MONA_2_ASIC);145 if (err < 0)146 return err;147···165if it matches the one already loaded. */166static int switch_asic(struct echoaudio *chip, char double_speed)167{0168 int err;169+ short asic;170171 /* Check the clock detect bits to see if this is172 a single-speed clock or a double-speed clock; load173 a new ASIC if necessary. */174 if (chip->device_id == DEVICE_ID_56361) {175 if (double_speed)176+ asic = FW_MONA_361_1_ASIC96;177 else178+ asic = FW_MONA_361_1_ASIC48;179 } else {180 if (double_speed)181+ asic = FW_MONA_301_1_ASIC96;182 else183+ asic = FW_MONA_301_1_ASIC48;184 }185186 if (asic != chip->asic_code) {···200static int set_sample_rate(struct echoaudio *chip, u32 rate)201{202 u32 control_reg, clock;203+ short asic;204 char force_write;205206 /* Only set the clock for internal mode. */···218 if (chip->digital_mode == DIGITAL_MODE_ADAT)219 return -EINVAL;220 if (chip->device_id == DEVICE_ID_56361)221+ asic = FW_MONA_361_1_ASIC96;222 else223+ asic = FW_MONA_301_1_ASIC96;224 } else {225 if (chip->device_id == DEVICE_ID_56361)226+ asic = FW_MONA_361_1_ASIC48;227 else228+ asic = FW_MONA_301_1_ASIC48;229 }230231 force_write = 0;···410 case DIGITAL_MODE_ADAT:411 /* If the current ASIC is the 96KHz ASIC, switch the ASIC412 and set to 48 KHz */413+ if (chip->asic_code == FW_MONA_361_1_ASIC96 ||414+ chip->asic_code == FW_MONA_301_1_ASIC96) {415 set_sample_rate(chip, 48000);416 }417 control_reg |= GML_ADAT_MODE;
···824 struct hda_pincfg *pin;825 unsigned int oldcfg;826000827 oldcfg = snd_hda_codec_get_pincfg(codec, nid);828 pin = look_up_pincfg(codec, list, nid);829 if (!pin) {···902 }903}9040000000000000000000905static void init_hda_cache(struct hda_cache_rec *cache,906 unsigned int record_size);907static void free_hda_cache(struct hda_cache_rec *cache);···953#endif954 list_del(&codec->list);955 snd_array_free(&codec->mixers);0956 codec->bus->caddr_tbl[codec->addr] = NULL;957 if (codec->patch_ops.free)958 codec->patch_ops.free(codec);···1008 mutex_init(&codec->control_mutex);1009 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info));1010 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));1011- snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 60);01012 snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16);1013 snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16);1014 if (codec->bus->modelname) {···1732EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);17331734/**1735- * snd_hda_ctl-add - Add a control element and assign to the codec1736 * @codec: HD-audio codec1737 * @nid: corresponding NID (optional)1738 * @kctl: the control element to assign···1747 *1748 * snd_hda_ctl_add() checks the control subdev id field whether1749 * #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower1750- * bits value is taken as the NID to assign.01751 */1752int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,1753 struct snd_kcontrol *kctl)1754{1755 int err;01756 struct hda_nid_item *item;17571758- if (kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) {01759 if (nid == 0)1760- nid = kctl->id.subdevice & 0xffff;1761- kctl->id.subdevice = 0;1762 }00001763 err = snd_ctl_add(codec->bus->card, kctl);1764 if (err < 0)1765 return err;···1774 return -ENOMEM;1775 item->kctl = kctl;1776 item->nid = nid;01777 return 0;1778}1779EXPORT_SYMBOL_HDA(snd_hda_ctl_add);0000000000000000000000000000017801781/**1782 * snd_hda_ctls_clear - Clear all controls assigned to the given codec···1819 for (i = 0; i < codec->mixers.used; i++)1820 snd_ctl_remove(codec->bus->card, items[i].kctl);1821 snd_array_free(&codec->mixers);01822}18231824/* pseudo device locking···35393540 for (; knew->name; knew++) {3541 struct snd_kcontrol *kctl;003542 kctl = snd_ctl_new1(knew, codec);3543 if (!kctl)3544 return -ENOMEM;
···824 struct hda_pincfg *pin;825 unsigned int oldcfg;826827+ if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)828+ return -EINVAL;829+830 oldcfg = snd_hda_codec_get_pincfg(codec, nid);831 pin = look_up_pincfg(codec, list, nid);832 if (!pin) {···899 }900}901902+/**903+ * snd_hda_shutup_pins - Shut up all pins904+ * @codec: the HDA codec905+ *906+ * Clear all pin controls to shup up before suspend for avoiding click noise.907+ * The controls aren't cached so that they can be resumed properly.908+ */909+void snd_hda_shutup_pins(struct hda_codec *codec)910+{911+ int i;912+ for (i = 0; i < codec->init_pins.used; i++) {913+ struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);914+ /* use read here for syncing after issuing each verb */915+ snd_hda_codec_read(codec, pin->nid, 0,916+ AC_VERB_SET_PIN_WIDGET_CONTROL, 0);917+ }918+}919+EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);920+921static void init_hda_cache(struct hda_cache_rec *cache,922 unsigned int record_size);923static void free_hda_cache(struct hda_cache_rec *cache);···931#endif932 list_del(&codec->list);933 snd_array_free(&codec->mixers);934+ snd_array_free(&codec->nids);935 codec->bus->caddr_tbl[codec->addr] = NULL;936 if (codec->patch_ops.free)937 codec->patch_ops.free(codec);···985 mutex_init(&codec->control_mutex);986 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info));987 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));988+ snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32);989+ snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32);990 snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16);991 snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16);992 if (codec->bus->modelname) {···1708EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);17091710/**1711+ * snd_hda_ctl_add - Add a control element and assign to the codec1712 * @codec: HD-audio codec1713 * @nid: corresponding NID (optional)1714 * @kctl: the control element to assign···1723 *1724 * snd_hda_ctl_add() checks the control subdev id field whether1725 * #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower1726+ * bits value is taken as the NID to assign. The #HDA_NID_ITEM_AMP bit1727+ * specifies if kctl->private_value is a HDA amplifier value.1728 */1729int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,1730 struct snd_kcontrol *kctl)1731{1732 int err;1733+ unsigned short flags = 0;1734 struct hda_nid_item *item;17351736+ if (kctl->id.subdevice & HDA_SUBDEV_AMP_FLAG) {1737+ flags |= HDA_NID_ITEM_AMP;1738 if (nid == 0)1739+ nid = get_amp_nid_(kctl->private_value);01740 }1741+ if ((kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) != 0 && nid == 0)1742+ nid = kctl->id.subdevice & 0xffff;1743+ if (kctl->id.subdevice & (HDA_SUBDEV_NID_FLAG|HDA_SUBDEV_AMP_FLAG))1744+ kctl->id.subdevice = 0;1745 err = snd_ctl_add(codec->bus->card, kctl);1746 if (err < 0)1747 return err;···1744 return -ENOMEM;1745 item->kctl = kctl;1746 item->nid = nid;1747+ item->flags = flags;1748 return 0;1749}1750EXPORT_SYMBOL_HDA(snd_hda_ctl_add);1751+1752+/**1753+ * snd_hda_add_nid - Assign a NID to a control element1754+ * @codec: HD-audio codec1755+ * @nid: corresponding NID (optional)1756+ * @kctl: the control element to assign1757+ * @index: index to kctl1758+ *1759+ * Add the given control element to an array inside the codec instance.1760+ * This function is used when #snd_hda_ctl_add cannot be used for 1:11761+ * NID:KCTL mapping - for example "Capture Source" selector.1762+ */1763+int snd_hda_add_nid(struct hda_codec *codec, struct snd_kcontrol *kctl,1764+ unsigned int index, hda_nid_t nid)1765+{1766+ struct hda_nid_item *item;1767+1768+ if (nid > 0) {1769+ item = snd_array_new(&codec->nids);1770+ if (!item)1771+ return -ENOMEM;1772+ item->kctl = kctl;1773+ item->index = index;1774+ item->nid = nid;1775+ return 0;1776+ }1777+ return -EINVAL;1778+}1779+EXPORT_SYMBOL_HDA(snd_hda_add_nid);17801781/**1782 * snd_hda_ctls_clear - Clear all controls assigned to the given codec···1759 for (i = 0; i < codec->mixers.used; i++)1760 snd_ctl_remove(codec->bus->card, items[i].kctl);1761 snd_array_free(&codec->mixers);1762+ snd_array_free(&codec->nids);1763}17641765/* pseudo device locking···34783479 for (; knew->name; knew++) {3480 struct snd_kcontrol *kctl;3481+ if (knew->iface == -1) /* skip this codec private value */3482+ continue;3483 kctl = snd_ctl_new1(knew, codec);3484 if (!kctl)3485 return -ENOMEM;
+2
sound/pci/hda/hda_codec.h
···789 u32 *wcaps;790791 struct snd_array mixers; /* list of assigned mixer elements */0792793 struct hda_cache_rec amp_cache; /* cache for amp access */794 struct hda_cache_rec cmd_cache; /* cache for other commands */···899 unsigned int cfg);900int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,901 hda_nid_t nid, unsigned int cfg); /* for hwdep */0902903/*904 * Mixer
···789 u32 *wcaps;790791 struct snd_array mixers; /* list of assigned mixer elements */792+ struct snd_array nids; /* list of mapped mixer elements */793794 struct hda_cache_rec amp_cache; /* cache for amp access */795 struct hda_cache_rec cmd_cache; /* cache for other commands */···898 unsigned int cfg);899int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,900 hda_nid_t nid, unsigned int cfg); /* for hwdep */901+void snd_hda_shutup_pins(struct hda_codec *codec);902903/*904 * Mixer
+2-1
sound/pci/hda/hda_generic.c
···861 }862863 /* create input MUX if multiple sources are available */864- err = snd_hda_ctl_add(codec, 0, snd_ctl_new1(&cap_sel, codec));0865 if (err < 0)866 return err;867
···861 }862863 /* create input MUX if multiple sources are available */864+ err = snd_hda_ctl_add(codec, spec->adc_node->nid,865+ snd_ctl_new1(&cap_sel, codec));866 if (err < 0)867 return err;868
···949596/* Both VT1720 and VT1724 have the same PCI IDs */97-static const struct pci_device_id snd_vt1724_ids[] = {98 { PCI_VDEVICE(ICE, PCI_DEVICE_ID_VT1724), 0 },99 { 0, }100};
···949596/* Both VT1720 and VT1724 have the same PCI IDs */97+static DEFINE_PCI_DEVICE_TABLE(snd_vt1724_ids) = {98 { PCI_VDEVICE(ICE, PCI_DEVICE_ID_VT1724), 0 },99 { 0, }100};
···21 */2223#include <linux/slab.h>24-#include <linux/vmalloc.h>25#include <linux/delay.h>26#include <sound/core.h>27#include <sound/asoundef.h>28#include "pdaudiocf.h"2930-31-/*32- * we use a vmalloc'ed (sg-)buffer33- */34-35-/* get the physical page pointer on the given offset */36-static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, unsigned long offset)37-{38- void *pageptr = subs->runtime->dma_area + offset;39- return vmalloc_to_page(pageptr);40-}41-42-/*43- * hw_params callback44- * NOTE: this may be called not only once per pcm open!45- */46-static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)47-{48- struct snd_pcm_runtime *runtime = subs->runtime;49- if (runtime->dma_area) {50- if (runtime->dma_bytes >= size)51- return 0; /* already enough large */52- vfree(runtime->dma_area);53- }54- runtime->dma_area = vmalloc_32_user(size);55- if (! runtime->dma_area)56- return -ENOMEM;57- runtime->dma_bytes = size;58- return 0;59-}60-61-/*62- * hw_free callback63- * NOTE: this may be called not only once per pcm open!64- */65-static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)66-{67- struct snd_pcm_runtime *runtime = subs->runtime;68-69- vfree(runtime->dma_area);70- runtime->dma_area = NULL;71- return 0;72-}7374/*75 * clear the SRAM contents···103static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs,104 struct snd_pcm_hw_params *hw_params)105{106- return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));0107}108109/*···112 */113static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs)114{115- return snd_pcm_free_vmalloc_buffer(subs);116}117118/*···276 .prepare = pdacf_pcm_prepare,277 .trigger = pdacf_pcm_trigger,278 .pointer = pdacf_pcm_capture_pointer,279- .page = snd_pcm_get_vmalloc_page,0280};281282
···21 To compile this driver as a module, choose M here: the module22 will be called snd-usb-audio.2300000000000024config SND_USB_USX2Y25 tristate "Tascam US-122, US-224 and US-428 USB driver"26 depends on X86 || PPC || ALPHA
···21 To compile this driver as a module, choose M here: the module22 will be called snd-usb-audio.2324+config SND_USB_UA10125+ tristate "Edirol UA-101 driver (EXPERIMENTAL)"26+ depends on EXPERIMENTAL27+ select SND_PCM28+ select SND_RAWMIDI29+ help30+ Say Y here to include support for the Edirol UA-101 audio/MIDI31+ interface.32+33+ To compile this driver as a module, choose M here: the module34+ will be called snd-ua101.35+36config SND_USB_USX2Y37 tristate "Tascam US-122, US-224 and US-428 USB driver"38 depends on X86 || PPC || ALPHA