···4646 */47474848#include <linux/slab.h>4949-#include <linux/vmalloc.h>5049#include <linux/delay.h>5150#include <sound/core.h>5251#include <sound/asoundef.h>5352#include <sound/pcm.h>5453#include <sound/vx_core.h>5554#include "vx_cmd.h"5656-5757-5858-/*5959- * we use a vmalloc'ed (sg-)buffer6060- */6161-6262-/* get the physical page pointer on the given offset */6363-static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,6464- unsigned long offset)6565-{6666- void *pageptr = subs->runtime->dma_area + offset;6767- return vmalloc_to_page(pageptr);6868-}6969-7070-/*7171- * allocate a buffer via vmalloc_32().7272- * called from hw_params7373- * NOTE: this may be called not only once per pcm open!7474- */7575-static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)7676-{7777- struct snd_pcm_runtime *runtime = subs->runtime;7878- if (runtime->dma_area) {7979- /* already allocated */8080- if (runtime->dma_bytes >= size)8181- return 0; /* already enough large */8282- vfree(runtime->dma_area);8383- }8484- runtime->dma_area = vmalloc_32(size);8585- if (! runtime->dma_area)8686- return -ENOMEM;8787- memset(runtime->dma_area, 0, size);8888- runtime->dma_bytes = size;8989- return 1; /* changed */9090-}9191-9292-/*9393- * free the buffer.9494- * called from hw_free callback9595- * NOTE: this may be called not only once per pcm open!9696- */9797-static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)9898-{9999- struct snd_pcm_runtime *runtime = subs->runtime;100100-101101- vfree(runtime->dma_area);102102- runtime->dma_area = NULL;103103- return 0;104104-}105551065610757/*···815865static int vx_pcm_hw_params(struct snd_pcm_substream *subs,816866 struct snd_pcm_hw_params *hw_params)817867{818818- return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));868868+ return snd_pcm_lib_alloc_vmalloc_32_buffer869869+ (subs, params_buffer_bytes(hw_params));819870}820871821872/*···824873 */825874static int vx_pcm_hw_free(struct snd_pcm_substream *subs)826875{827827- return snd_pcm_free_vmalloc_buffer(subs);876876+ return snd_pcm_lib_free_vmalloc_buffer(subs);828877}829878830879/*···904953 .prepare = vx_pcm_prepare,905954 .trigger = vx_pcm_trigger,906955 .pointer = vx_pcm_playback_pointer,907907- .page = snd_pcm_get_vmalloc_page,956956+ .page = snd_pcm_lib_get_vmalloc_page,957957+ .mmap = snd_pcm_lib_mmap_vmalloc,908958};909959910960···11251173 .prepare = vx_pcm_prepare,11261174 .trigger = vx_pcm_trigger,11271175 .pointer = vx_pcm_capture_pointer,11281128- .page = snd_pcm_get_vmalloc_page,11761176+ .page = snd_pcm_lib_get_vmalloc_page,11771177+ .mmap = snd_pcm_lib_mmap_vmalloc,11291178};1130117911311180
+20-17
sound/isa/Kconfig
···6363 will be called snd-ad1848.64646565config SND_ALS1006666- tristate "Avance Logic ALS100/ALS120"6666+ tristate "Diamond Tech. DT-019x and Avance Logic ALSxxx"6767 depends on PNP6868 select ISAPNP6969 select SND_OPL3_LIB7070 select SND_MPU401_UART7171 select SND_SB16_DSP7272 help7373- Say Y here to include support for soundcards based on Avance7474- Logic ALS100, ALS110, ALS120 and ALS200 chips.7373+ Say Y here to include support for soundcards based on the7474+ Diamond Technologies DT-019X or Avance Logic chips: ALS007,7575+ ALS100, ALS110, ALS120 and ALS200 chips.75767677 To compile this driver as a module, choose M here: the module7778 will be called snd-als100.···127126128127 To compile this driver as a module, choose M here: the module129128 will be called snd-cs4236.130130-131131-config SND_DT019X132132- tristate "Diamond Technologies DT-019X, Avance Logic ALS-007"133133- depends on PNP134134- select ISAPNP135135- select SND_OPL3_LIB136136- select SND_MPU401_UART137137- select SND_SB16_DSP138138- help139139- Say Y here to include support for soundcards based on the140140- Diamond Technologies DT-019X or Avance Logic ALS-007 chips.141141-142142- To compile this driver as a module, choose M here: the module143143- will be called snd-dt019x.144129145130config SND_ES968146131 tristate "Generic ESS ES968 driver"···238251239252 To compile this driver as a module, choose M here: the module240253 will be called snd-interwave-stb.254254+255255+config SND_JAZZ16256256+ tristate "Media Vision Jazz16 card and compatibles"257257+ select SND_OPL3_LIB258258+ select SND_MPU401_UART259259+ select SND_SB8_DSP260260+ help261261+ Say Y here to include support for soundcards based on the262262+ Media Vision Jazz16 chipset: digital chip MVD1216 (Jazz16),263263+ codec MVA416 (CS4216) and mixer MVA514 (ICS2514).264264+ Media Vision's Jazz16 cards were sold under names Pro Sonic 16,265265+ Premium 3-D and Pro 3-D. There were also OEMs cards with the266266+ Jazz16 chipset.267267+268268+ To compile this driver as a module, choose M here: the module269269+ will be called snd-jazz16.241270242271config SND_OPL3SA2243272 tristate "Yamaha OPL3-SA2/SA3"
···328328 return mixer_devs[mixdev]->ioctl(mixdev, cmd, arg);329329}330330331331-static int sound_ioctl(struct inode *inode, struct file *file,332332- unsigned int cmd, unsigned long arg)331331+static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)333332{334333 int len = 0, dtype;335335- int dev = iminor(inode);334334+ int dev = iminor(file->f_dentry->d_inode);335335+ long ret = -EINVAL;336336 void __user *p = (void __user *)arg;337337338338 if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {···353353 if (cmd == OSS_GETVERSION)354354 return __put_user(SOUND_VERSION, (int __user *)p);355355356356+ lock_kernel();356357 if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */357358 (dev & 0x0f) != SND_DEV_CTL) { 358359 dtype = dev & 0x0f;···361360 case SND_DEV_DSP:362361 case SND_DEV_DSP16:363362 case SND_DEV_AUDIO:364364- return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,363363+ ret = sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,365364 cmd, p);366366-365365+ break; 367366 default:368368- return sound_mixer_ioctl(dev >> 4, cmd, p);367367+ ret = sound_mixer_ioctl(dev >> 4, cmd, p);368368+ break;369369 }370370+ unlock_kernel();371371+ return ret;370372 }373373+371374 switch (dev & 0x0f) {372375 case SND_DEV_CTL:373376 if (cmd == SOUND_MIXER_GETLEVELS)374374- return get_mixer_levels(p);375375- if (cmd == SOUND_MIXER_SETLEVELS)376376- return set_mixer_levels(p);377377- return sound_mixer_ioctl(dev >> 4, cmd, p);377377+ ret = get_mixer_levels(p);378378+ else if (cmd == SOUND_MIXER_SETLEVELS)379379+ ret = set_mixer_levels(p);380380+ else381381+ ret = sound_mixer_ioctl(dev >> 4, cmd, p);382382+ break;378383379384 case SND_DEV_SEQ:380385 case SND_DEV_SEQ2:381381- return sequencer_ioctl(dev, file, cmd, p);386386+ ret = sequencer_ioctl(dev, file, cmd, p);387387+ break;382388383389 case SND_DEV_DSP:384390 case SND_DEV_DSP16:···398390 break;399391400392 }401401- return -EINVAL;393393+ unlock_kernel();394394+ return ret;402395}403396404397static unsigned int sound_poll(struct file *file, poll_table * wait)···499490 .read = sound_read,500491 .write = sound_write,501492 .poll = sound_poll,502502- .ioctl = sound_ioctl,493493+ .unlocked_ioctl = sound_ioctl,503494 .mmap = sound_mmap,504495 .open = sound_open,505496 .release = sound_release,
+1
sound/pci/Kconfig
···789789 Say Y here to include support for sound cards based on the790790 Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X,791791 Essence ST (Deluxe), and Essence STX.792792+ Support for the DS is experimental.792793 Support for the HDAV1.3 (Deluxe) is very experimental.793794794795 To compile this driver as a module, choose M here: the module
+1-16
sound/pci/ac97/ac97_patch.c
···544544 return 0;545545}546546547547-static int patch_wolfson_wm9705_specific(struct snd_ac97 * ac97)548548-{549549- int err, i;550550- for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {551551- if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)552552- return err;553553- }554554- snd_ac97_write_cache(ac97, 0x72, 0x0808);555555- return 0;556556-}557557-558558-static struct snd_ac97_build_ops patch_wolfson_wm9705_ops = {559559- .build_specific = patch_wolfson_wm9705_specific,560560-};561561-562547static int patch_wolfson05(struct snd_ac97 * ac97)563548{564549 /* WM9705, WM9710 */565565- ac97->build_ops = &patch_wolfson_wm9705_ops;550550+ ac97->build_ops = &patch_wolfson_wm9703_ops;566551#ifdef CONFIG_TOUCHSCREEN_WM9705567552 /* WM9705 touchscreen uses AUX and VIDEO for touch */568553 ac97->flags |= AC97_HAS_NO_VIDEO | AC97_HAS_NO_AUX;
···4545 chip->device_id = device_id;4646 chip->subdevice_id = subdevice_id;4747 chip->bad_board = TRUE;4848- chip->dsp_code_to_load = &card_fw[FW_DARLA24_DSP];4848+ chip->dsp_code_to_load = FW_DARLA24_DSP;4949 /* Since this card has no ASIC, mark it as loaded so everything5050 works OK */5151 chip->asic_loaded = TRUE;···5656 return err;5757 chip->bad_board = FALSE;58585959- if ((err = init_line_levels(chip)) < 0)6060- return err;6161-6259 DE_INIT(("init_hw done\n"));6360 return err;6161+}6262+6363+6464+6565+static int set_mixer_defaults(struct echoaudio *chip)6666+{6767+ return init_line_levels(chip);6468}65696670
···6161 chip->subdevice_id = subdevice_id;6262 chip->bad_board = TRUE;6363 chip->has_midi = TRUE;6464- chip->dsp_code_to_load = &card_fw[FW_ECHO3G_DSP];6464+ chip->dsp_code_to_load = FW_ECHO3G_DSP;65656666 /* Load the DSP code and the ASIC on the PCI card and get6767 what type of external box is attached */···9797 chip->digital_modes = ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |9898 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |9999 ECHOCAPS_HAS_DIGITAL_MODE_ADAT;100100- chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;101101- chip->professional_spdif = FALSE;102102- chip->non_audio_spdif = FALSE;103103- chip->bad_board = FALSE;104104-105105- if ((err = init_line_levels(chip)) < 0)106106- return err;107107- err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);108108- if (err < 0)109109- return err;110110- err = set_phantom_power(chip, 0);111111- if (err < 0)112112- return err;113113- err = set_professional_spdif(chip, TRUE);114100115101 DE_INIT(("init_hw done\n"));116102 return err;103103+}104104+105105+106106+107107+static int set_mixer_defaults(struct echoaudio *chip)108108+{109109+ chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;110110+ chip->professional_spdif = FALSE;111111+ chip->non_audio_spdif = FALSE;112112+ chip->bad_board = FALSE;113113+ chip->phantom_power = FALSE;114114+ return init_line_levels(chip);117115}118116119117
+182-19
sound/pci/echoaudio/echoaudio.c
···3636static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};3737static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);38383939+4040+3941static int get_firmware(const struct firmware **fw_entry,4040- const struct firmware *frm, struct echoaudio *chip)4242+ struct echoaudio *chip, const short fw_index)4143{4244 int err;4345 char name[30];4444- DE_ACT(("firmware requested: %s\n", frm->data));4545- snprintf(name, sizeof(name), "ea/%s", frm->data);4646- if ((err = request_firmware(fw_entry, name, pci_device(chip))) < 0)4646+4747+#ifdef CONFIG_PM4848+ if (chip->fw_cache[fw_index]) {4949+ DE_ACT(("firmware requested: %s is cached\n", card_fw[fw_index].data));5050+ *fw_entry = chip->fw_cache[fw_index];5151+ return 0;5252+ }5353+#endif5454+5555+ DE_ACT(("firmware requested: %s\n", card_fw[fw_index].data));5656+ snprintf(name, sizeof(name), "ea/%s", card_fw[fw_index].data);5757+ err = request_firmware(fw_entry, name, pci_device(chip));5858+ if (err < 0)4759 snd_printk(KERN_ERR "get_firmware(): Firmware not available (%d)\n", err);6060+#ifdef CONFIG_PM6161+ else6262+ chip->fw_cache[fw_index] = *fw_entry;6363+#endif4864 return err;4965}50666767+6868+5169static void free_firmware(const struct firmware *fw_entry)5270{7171+#ifdef CONFIG_PM7272+ DE_ACT(("firmware not released (kept in cache)\n"));7373+#else5374 release_firmware(fw_entry);5475 DE_ACT(("firmware released\n"));7676+#endif7777+}7878+7979+8080+8181+static void free_firmware_cache(struct echoaudio *chip)8282+{8383+#ifdef CONFIG_PM8484+ int i;8585+8686+ for (i = 0; i < 8 ; i++)8787+ if (chip->fw_cache[i]) {8888+ release_firmware(chip->fw_cache[i]);8989+ DE_ACT(("release_firmware(%d)\n", i));9090+ }9191+9292+ DE_ACT(("firmware_cache released\n"));9393+#endif5594}56955796···753714754715 spin_lock(&chip->lock);755716 switch (cmd) {717717+ case SNDRV_PCM_TRIGGER_RESUME:718718+ DE_ACT(("pcm_trigger resume\n"));756719 case SNDRV_PCM_TRIGGER_START:757720 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:758721 DE_ACT(("pcm_trigger start\n"));···778737 err = start_transport(chip, channelmask,779738 chip->pipe_cyclic_mask);780739 break;740740+ case SNDRV_PCM_TRIGGER_SUSPEND:741741+ DE_ACT(("pcm_trigger suspend\n"));781742 case SNDRV_PCM_TRIGGER_STOP:782743 DE_ACT(("pcm_trigger stop\n"));783744 for (i = 0; i < DSP_MAXPIPES; i++) {···19191876 pci_disable_device(chip->pci);1920187719211878 /* release chip data */18791879+ free_firmware_cache(chip);19221880 kfree(chip);19231881 DE_INIT(("Chip freed.\n"));19241882 return 0;···19571913 return err;19581914 pci_set_master(pci);1959191519601960- /* allocate a chip-specific data */19611961- chip = kzalloc(sizeof(*chip), GFP_KERNEL);19621962- if (!chip) {19631963- pci_disable_device(pci);19641964- return -ENOMEM;19161916+ /* Allocate chip if needed */19171917+ if (!*rchip) {19181918+ chip = kzalloc(sizeof(*chip), GFP_KERNEL);19191919+ if (!chip) {19201920+ pci_disable_device(pci);19211921+ return -ENOMEM;19221922+ }19231923+ DE_INIT(("chip=%p\n", chip));19241924+ spin_lock_init(&chip->lock);19251925+ chip->card = card;19261926+ chip->pci = pci;19271927+ chip->irq = -1;19281928+ atomic_set(&chip->opencount, 0);19291929+ mutex_init(&chip->mode_mutex);19301930+ chip->can_set_rate = 1;19311931+ } else {19321932+ /* If this was called from the resume function, chip is19331933+ * already allocated and it contains current card settings.19341934+ */19351935+ chip = *rchip;19651936 }19661966- DE_INIT(("chip=%p\n", chip));19671967-19681968- spin_lock_init(&chip->lock);19691969- chip->card = card;19701970- chip->pci = pci;19711971- chip->irq = -1;1972193719731938 /* PCI resource allocation */19741939 chip->dsp_registers_phys = pci_resource_start(pci, 0);···20171964 chip->comm_page = (struct comm_page *)chip->commpage_dma_buf.area;2018196520191966 err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);20202020- if (err) {19671967+ if (err >= 0)19681968+ err = set_mixer_defaults(chip);19691969+ if (err < 0) {20211970 DE_INIT(("init_hw err=%d\n", err));20221971 snd_echo_free(chip);20231972 return err;···20301975 snd_echo_free(chip);20311976 return err;20321977 }20332033- atomic_set(&chip->opencount, 0);20342034- mutex_init(&chip->mode_mutex);20352035- chip->can_set_rate = 1;20361978 *rchip = chip;20371979 /* Init done ! */20381980 return 0;···2062201020632011 snd_card_set_dev(card, &pci->dev);2064201220132013+ chip = NULL; /* Tells snd_echo_create to allocate chip */20652014 if ((err = snd_echo_create(card, pci, &chip)) < 0) {20662015 snd_card_free(card);20672016 return err;···22022149220321502204215121522152+#if defined(CONFIG_PM)21532153+21542154+static int snd_echo_suspend(struct pci_dev *pci, pm_message_t state)21552155+{21562156+ struct echoaudio *chip = pci_get_drvdata(pci);21572157+21582158+ DE_INIT(("suspend start\n"));21592159+ snd_pcm_suspend_all(chip->analog_pcm);21602160+ snd_pcm_suspend_all(chip->digital_pcm);21612161+21622162+#ifdef ECHOCARD_HAS_MIDI21632163+ /* This call can sleep */21642164+ if (chip->midi_out)21652165+ snd_echo_midi_output_trigger(chip->midi_out, 0);21662166+#endif21672167+ spin_lock_irq(&chip->lock);21682168+ if (wait_handshake(chip)) {21692169+ spin_unlock_irq(&chip->lock);21702170+ return -EIO;21712171+ }21722172+ clear_handshake(chip);21732173+ if (send_vector(chip, DSP_VC_GO_COMATOSE) < 0) {21742174+ spin_unlock_irq(&chip->lock);21752175+ return -EIO;21762176+ }21772177+ spin_unlock_irq(&chip->lock);21782178+21792179+ chip->dsp_code = NULL;21802180+ free_irq(chip->irq, chip);21812181+ chip->irq = -1;21822182+ pci_save_state(pci);21832183+ pci_disable_device(pci);21842184+21852185+ DE_INIT(("suspend done\n"));21862186+ return 0;21872187+}21882188+21892189+21902190+21912191+static int snd_echo_resume(struct pci_dev *pci)21922192+{21932193+ struct echoaudio *chip = pci_get_drvdata(pci);21942194+ struct comm_page *commpage, *commpage_bak;21952195+ u32 pipe_alloc_mask;21962196+ int err;21972197+21982198+ DE_INIT(("resume start\n"));21992199+ pci_restore_state(pci);22002200+ commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL);22012201+ commpage = chip->comm_page;22022202+ memcpy(commpage_bak, commpage, sizeof(struct comm_page));22032203+22042204+ err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);22052205+ if (err < 0) {22062206+ kfree(commpage_bak);22072207+ DE_INIT(("resume init_hw err=%d\n", err));22082208+ snd_echo_free(chip);22092209+ return err;22102210+ }22112211+ DE_INIT(("resume init OK\n"));22122212+22132213+ /* Temporarily set chip->pipe_alloc_mask=0 otherwise22142214+ * restore_dsp_settings() fails.22152215+ */22162216+ pipe_alloc_mask = chip->pipe_alloc_mask;22172217+ chip->pipe_alloc_mask = 0;22182218+ err = restore_dsp_rettings(chip);22192219+ chip->pipe_alloc_mask = pipe_alloc_mask;22202220+ if (err < 0) {22212221+ kfree(commpage_bak);22222222+ return err;22232223+ }22242224+ DE_INIT(("resume restore OK\n"));22252225+22262226+ memcpy(&commpage->audio_format, &commpage_bak->audio_format,22272227+ sizeof(commpage->audio_format));22282228+ memcpy(&commpage->sglist_addr, &commpage_bak->sglist_addr,22292229+ sizeof(commpage->sglist_addr));22302230+ memcpy(&commpage->midi_output, &commpage_bak->midi_output,22312231+ sizeof(commpage->midi_output));22322232+ kfree(commpage_bak);22332233+22342234+ if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,22352235+ ECHOCARD_NAME, chip)) {22362236+ snd_echo_free(chip);22372237+ snd_printk(KERN_ERR "cannot grab irq\n");22382238+ return -EBUSY;22392239+ }22402240+ chip->irq = pci->irq;22412241+ DE_INIT(("resume irq=%d\n", chip->irq));22422242+22432243+#ifdef ECHOCARD_HAS_MIDI22442244+ if (chip->midi_input_enabled)22452245+ enable_midi_input(chip, TRUE);22462246+ if (chip->midi_out)22472247+ snd_echo_midi_output_trigger(chip->midi_out, 1);22482248+#endif22492249+22502250+ DE_INIT(("resume done\n"));22512251+ return 0;22522252+}22532253+22542254+#endif /* CONFIG_PM */22552255+22562256+22572257+22052258static void __devexit snd_echo_remove(struct pci_dev *pci)22062259{22072260 struct echoaudio *chip;···23302171 .id_table = snd_echo_ids,23312172 .probe = snd_echo_probe,23322173 .remove = __devexit_p(snd_echo_remove),21742174+#ifdef CONFIG_PM21752175+ .suspend = snd_echo_suspend,21762176+ .resume = snd_echo_resume,21772177+#endif /* CONFIG_PM */23332178};2334217923352180
+8-3
sound/pci/echoaudio/echoaudio.h
···442442 u16 device_id, subdevice_id;443443 u16 *dsp_code; /* Current DSP code loaded,444444 * NULL if nothing loaded */445445- const struct firmware *dsp_code_to_load;/* DSP code to load */446446- const struct firmware *asic_code; /* Current ASIC code */445445+ short dsp_code_to_load; /* DSP code to load */446446+ short asic_code; /* Current ASIC code */447447 u32 comm_page_phys; /* Physical address of the448448 * memory seen by DSP */449449 volatile u32 __iomem *dsp_registers; /* DSP's register base */450450 u32 active_mask; /* Chs. active mask or451451 * punks out */452452+#ifdef CONFIG_PM453453+ const struct firmware *fw_cache[8]; /* Cached firmwares */454454+#endif452455453456#ifdef ECHOCARD_HAS_MIDI454457 u16 mtc_state; /* State for MIDI input parsing state machine */···467464static int wait_handshake(struct echoaudio *chip);468465static int send_vector(struct echoaudio *chip, u32 command);469466static int get_firmware(const struct firmware **fw_entry,470470- const struct firmware *frm, struct echoaudio *chip);467467+ struct echoaudio *chip, const short fw_index);471468static void free_firmware(const struct firmware *fw_entry);472469473470#ifdef ECHOCARD_HAS_MIDI474471static int enable_midi_input(struct echoaudio *chip, char enable);472472+static void snd_echo_midi_output_trigger(473473+ struct snd_rawmidi_substream *substream, int up);475474static int midi_service_irq(struct echoaudio *chip);476475static int __devinit snd_echo_midi_create(struct snd_card *card,477476 struct echoaudio *chip);
+2-3
sound/pci/echoaudio/echoaudio_3g.c
···227227 /* Give the DSP a few milliseconds to settle down */228228 mdelay(2);229229230230- err = load_asic_generic(chip, DSP_FNC_LOAD_3G_ASIC,231231- &card_fw[FW_3G_ASIC]);230230+ err = load_asic_generic(chip, DSP_FNC_LOAD_3G_ASIC, FW_3G_ASIC);232231 if (err < 0)233232 return err;234233235235- chip->asic_code = &card_fw[FW_3G_ASIC];234234+ chip->asic_code = FW_3G_ASIC;236235237236 /* Now give the new ASIC some time to set up */238237 msleep(1000);
+92-71
sound/pci/echoaudio/echoaudio_dsp.c
···175175#ifdef ECHOCARD_HAS_ASIC176176177177/* Load ASIC code - done after the DSP is loaded */178178-static int load_asic_generic(struct echoaudio *chip, u32 cmd,179179- const struct firmware *asic)178178+static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic)180179{181180 const struct firmware *fw;182181 int err;183182 u32 i, size;184183 u8 *code;185184186186- if ((err = get_firmware(&fw, asic, chip)) < 0) {185185+ err = get_firmware(&fw, chip, asic);186186+ if (err < 0) {187187 snd_printk(KERN_WARNING "Firmware not found !\n");188188 return err;189189 }···245245 return 0;246246 }247247248248- if ((i = get_firmware(&fw, &card_fw[FW_361_LOADER], chip)) < 0) {248248+ i = get_firmware(&fw, chip, FW_361_LOADER);249249+ if (i < 0) {249250 snd_printk(KERN_WARNING "Firmware not found !\n");250251 return i;251252 }···486485 chip->dsp_code = NULL;487486 }488487489489- if ((err = get_firmware(&fw, chip->dsp_code_to_load, chip)) < 0)488488+ err = get_firmware(&fw, chip, chip->dsp_code_to_load);489489+ if (err < 0)490490 return err;491491 err = load_dsp(chip, (u16 *)fw->data);492492 free_firmware(fw);···496494497495 if ((box_type = load_asic(chip)) < 0)498496 return box_type; /* error */499499-500500- if ((err = restore_dsp_rettings(chip)) < 0)501501- return err;502497503498 return box_type;504499}···656657657658static int restore_dsp_rettings(struct echoaudio *chip)658659{659659- int err;660660+ int i, o, err;660661 DE_INIT(("restore_dsp_settings\n"));661662662663 if ((err = check_asic_status(chip)) < 0)663664 return err;664665665665- /* @ Gina20/Darla20 only. Should be harmless for other cards. */666666+ /* Gina20/Darla20 only. Should be harmless for other cards. */666667 chip->comm_page->gd_clock_state = GD_CLOCK_UNDEF;667668 chip->comm_page->gd_spdif_status = GD_SPDIF_STATUS_UNDEF;668669 chip->comm_page->handshake = 0xffffffff;669670670670- if ((err = set_sample_rate(chip, chip->sample_rate)) < 0)671671+ /* Restore output busses */672672+ for (i = 0; i < num_busses_out(chip); i++) {673673+ err = set_output_gain(chip, i, chip->output_gain[i]);674674+ if (err < 0)675675+ return err;676676+ }677677+678678+#ifdef ECHOCARD_HAS_VMIXER679679+ for (i = 0; i < num_pipes_out(chip); i++)680680+ for (o = 0; o < num_busses_out(chip); o++) {681681+ err = set_vmixer_gain(chip, o, i,682682+ chip->vmixer_gain[o][i]);683683+ if (err < 0)684684+ return err;685685+ }686686+ if (update_vmixer_level(chip) < 0)687687+ return -EIO;688688+#endif /* ECHOCARD_HAS_VMIXER */689689+690690+#ifdef ECHOCARD_HAS_MONITOR691691+ for (o = 0; o < num_busses_out(chip); o++)692692+ for (i = 0; i < num_busses_in(chip); i++) {693693+ err = set_monitor_gain(chip, o, i,694694+ chip->monitor_gain[o][i]);695695+ if (err < 0)696696+ return err;697697+ }698698+#endif /* ECHOCARD_HAS_MONITOR */699699+700700+#ifdef ECHOCARD_HAS_INPUT_GAIN701701+ for (i = 0; i < num_busses_in(chip); i++) {702702+ err = set_input_gain(chip, i, chip->input_gain[i]);703703+ if (err < 0)704704+ return err;705705+ }706706+#endif /* ECHOCARD_HAS_INPUT_GAIN */707707+708708+ err = update_output_line_level(chip);709709+ if (err < 0)671710 return err;672711673673- if (chip->meters_enabled)674674- if (send_vector(chip, DSP_VC_METERS_ON) < 0)675675- return -EIO;712712+ err = update_input_line_level(chip);713713+ if (err < 0)714714+ return err;715715+716716+ err = set_sample_rate(chip, chip->sample_rate);717717+ if (err < 0)718718+ return err;719719+720720+ if (chip->meters_enabled) {721721+ err = send_vector(chip, DSP_VC_METERS_ON);722722+ if (err < 0)723723+ return err;724724+ }725725+726726+#ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH727727+ if (set_digital_mode(chip, chip->digital_mode) < 0)728728+ return -EIO;729729+#endif730730+731731+#ifdef ECHOCARD_HAS_DIGITAL_IO732732+ if (set_professional_spdif(chip, chip->professional_spdif) < 0)733733+ return -EIO;734734+#endif735735+736736+#ifdef ECHOCARD_HAS_PHANTOM_POWER737737+ if (set_phantom_power(chip, chip->phantom_power) < 0)738738+ return -EIO;739739+#endif676740677741#ifdef ECHOCARD_HAS_EXTERNAL_CLOCK742742+ /* set_input_clock() also restores automute setting */678743 if (set_input_clock(chip, chip->input_clock) < 0)679744 return -EIO;680745#endif···748685 return -EIO;749686#endif750687751751- if (update_output_line_level(chip) < 0)752752- return -EIO;753753-754754- if (update_input_line_level(chip) < 0)755755- return -EIO;756756-757757-#ifdef ECHOCARD_HAS_VMIXER758758- if (update_vmixer_level(chip) < 0)759759- return -EIO;760760-#endif761761-762688 if (wait_handshake(chip) < 0)763689 return -EIO;764690 clear_handshake(chip);691691+ if (send_vector(chip, DSP_VC_UPDATE_FLAGS) < 0)692692+ return -EIO;765693766694 DE_INIT(("restore_dsp_rettings done\n"));767767- return send_vector(chip, DSP_VC_UPDATE_FLAGS);695695+ return 0;768696}769697770698···972918 chip->card_name = ECHOCARD_NAME;973919 chip->bad_board = TRUE; /* Set TRUE until DSP loaded */974920 chip->dsp_code = NULL; /* Current DSP code not loaded */975975- chip->digital_mode = DIGITAL_MODE_NONE;976976- chip->input_clock = ECHO_CLOCK_INTERNAL;977977- chip->output_clock = ECHO_CLOCK_WORD;978921 chip->asic_loaded = FALSE;979922 memset(chip->comm_page, 0, sizeof(struct comm_page));980923···982931 chip->comm_page->midi_out_free_count =983932 cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE);984933 chip->comm_page->sample_rate = cpu_to_le32(44100);985985- chip->sample_rate = 44100;986934987935 /* Set line levels so we don't blast any inputs on startup */988936 memset(chip->comm_page->monitors, ECHOGAIN_MUTED, MONITOR_ARRAY_SIZE);···992942993943994944995995-/* This function initializes the several volume controls for busses and pipes.996996-This MUST be called after the DSP is up and running ! */945945+/* This function initializes the chip structure with default values, ie. all946946+ * muted and internal clock source. Then it copies the settings to the DSP.947947+ * This MUST be called after the DSP is up and running !948948+ */997949static int init_line_levels(struct echoaudio *chip)998950{999999- int st, i, o;10001000-1001951 DE_INIT(("init_line_levels\n"));10021002-10031003- /* Mute output busses */10041004- for (i = 0; i < num_busses_out(chip); i++)10051005- if ((st = set_output_gain(chip, i, ECHOGAIN_MUTED)))10061006- return st;10071007- if ((st = update_output_line_level(chip)))10081008- return st;10091009-10101010-#ifdef ECHOCARD_HAS_VMIXER10111011- /* Mute the Vmixer */10121012- for (i = 0; i < num_pipes_out(chip); i++)10131013- for (o = 0; o < num_busses_out(chip); o++)10141014- if ((st = set_vmixer_gain(chip, o, i, ECHOGAIN_MUTED)))10151015- return st;10161016- if ((st = update_vmixer_level(chip)))10171017- return st;10181018-#endif /* ECHOCARD_HAS_VMIXER */10191019-10201020-#ifdef ECHOCARD_HAS_MONITOR10211021- /* Mute the monitor mixer */10221022- for (o = 0; o < num_busses_out(chip); o++)10231023- for (i = 0; i < num_busses_in(chip); i++)10241024- if ((st = set_monitor_gain(chip, o, i, ECHOGAIN_MUTED)))10251025- return st;10261026- if ((st = update_output_line_level(chip)))10271027- return st;10281028-#endif /* ECHOCARD_HAS_MONITOR */10291029-10301030-#ifdef ECHOCARD_HAS_INPUT_GAIN10311031- for (i = 0; i < num_busses_in(chip); i++)10321032- if ((st = set_input_gain(chip, i, ECHOGAIN_MUTED)))10331033- return st;10341034- if ((st = update_input_line_level(chip)))10351035- return st;10361036-#endif /* ECHOCARD_HAS_INPUT_GAIN */10371037-10381038- return 0;952952+ memset(chip->output_gain, ECHOGAIN_MUTED, sizeof(chip->output_gain));953953+ memset(chip->input_gain, ECHOGAIN_MUTED, sizeof(chip->input_gain));954954+ memset(chip->monitor_gain, ECHOGAIN_MUTED, sizeof(chip->monitor_gain));955955+ memset(chip->vmixer_gain, ECHOGAIN_MUTED, sizeof(chip->vmixer_gain));956956+ chip->input_clock = ECHO_CLOCK_INTERNAL;957957+ chip->output_clock = ECHO_CLOCK_WORD;958958+ chip->sample_rate = 44100;959959+ return restore_dsp_rettings(chip);1039960}10409611041962
···5050 chip->device_id = device_id;5151 chip->subdevice_id = subdevice_id;5252 chip->bad_board = TRUE;5353- chip->dsp_code_to_load = &card_fw[FW_INDIGO_DSP];5353+ chip->dsp_code_to_load = FW_INDIGO_DSP;5454 /* Since this card has no ASIC, mark it as loaded so everything5555 works OK */5656 chip->asic_loaded = TRUE;···6060 return err;6161 chip->bad_board = FALSE;62626363- if ((err = init_line_levels(chip)) < 0)6464- return err;6565-6663 DE_INIT(("init_hw done\n"));6764 return err;6565+}6666+6767+6868+6969+static int set_mixer_defaults(struct echoaudio *chip)7070+{7171+ return init_line_levels(chip);6872}69737074
···5050 chip->device_id = device_id;5151 chip->subdevice_id = subdevice_id;5252 chip->bad_board = TRUE;5353- chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJ_DSP];5353+ chip->dsp_code_to_load = FW_INDIGO_DJ_DSP;5454 /* Since this card has no ASIC, mark it as loaded so everything5555 works OK */5656 chip->asic_loaded = TRUE;···6060 return err;6161 chip->bad_board = FALSE;62626363- if ((err = init_line_levels(chip)) < 0)6464- return err;6565-6663 DE_INIT(("init_hw done\n"));6764 return err;6565+}6666+6767+6868+6969+static int set_mixer_defaults(struct echoaudio *chip)7070+{7171+ return init_line_levels(chip);6872}69737074
···4848 chip->device_id = device_id;4949 chip->subdevice_id = subdevice_id;5050 chip->bad_board = TRUE;5151- chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJX_DSP];5151+ chip->dsp_code_to_load = FW_INDIGO_DJX_DSP;5252 /* Since this card has no ASIC, mark it as loaded so everything5353 works OK */5454 chip->asic_loaded = TRUE;···5959 return err;6060 chip->bad_board = FALSE;61616262- err = init_line_levels(chip);6363- if (err < 0)6464- return err;6565-6662 DE_INIT(("init_hw done\n"));6763 return err;6464+}6565+6666+6767+6868+static int set_mixer_defaults(struct echoaudio *chip)6969+{7070+ return init_line_levels(chip);6871}
···5050 chip->device_id = device_id;5151 chip->subdevice_id = subdevice_id;5252 chip->bad_board = TRUE;5353- chip->dsp_code_to_load = &card_fw[FW_INDIGO_IO_DSP];5353+ chip->dsp_code_to_load = FW_INDIGO_IO_DSP;5454 /* Since this card has no ASIC, mark it as loaded so everything5555 works OK */5656 chip->asic_loaded = TRUE;···6060 return err;6161 chip->bad_board = FALSE;62626363- if ((err = init_line_levels(chip)) < 0)6464- return err;6565-6663 DE_INIT(("init_hw done\n"));6764 return err;6565+}6666+6767+6868+6969+static int set_mixer_defaults(struct echoaudio *chip)7070+{7171+ return init_line_levels(chip);6872}69737074
···4848 chip->device_id = device_id;4949 chip->subdevice_id = subdevice_id;5050 chip->bad_board = TRUE;5151- chip->dsp_code_to_load = &card_fw[FW_INDIGO_IOX_DSP];5151+ chip->dsp_code_to_load = FW_INDIGO_IOX_DSP;5252 /* Since this card has no ASIC, mark it as loaded so everything5353 works OK */5454 chip->asic_loaded = TRUE;···5959 return err;6060 chip->bad_board = FALSE;61616262- err = init_line_levels(chip);6363- if (err < 0)6464- return err;6565-6662 DE_INIT(("init_hw done\n"));6763 return err;6464+}6565+6666+6767+6868+static int set_mixer_defaults(struct echoaudio *chip)6969+{7070+ return init_line_levels(chip);6871}
···3232static int set_input_clock(struct echoaudio *chip, u16 clock);3333static int set_professional_spdif(struct echoaudio *chip, char prof);3434static int set_digital_mode(struct echoaudio *chip, u8 mode);3535-static int load_asic_generic(struct echoaudio *chip, u32 cmd,3636- const struct firmware *asic);3535+static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);3736static int check_asic_status(struct echoaudio *chip);38373938···5354 chip->subdevice_id = subdevice_id;5455 chip->bad_board = TRUE;5556 chip->has_midi = TRUE;5656- chip->dsp_code_to_load = &card_fw[FW_LAYLA24_DSP];5757+ chip->dsp_code_to_load = FW_LAYLA24_DSP;5758 chip->input_clock_types =5859 ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF |5960 ECHO_CLOCK_BIT_WORD | ECHO_CLOCK_BIT_ADAT;···6162 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |6263 ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |6364 ECHOCAPS_HAS_DIGITAL_MODE_ADAT;6464- chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;6565- chip->professional_spdif = FALSE;6666- chip->digital_in_automute = TRUE;67656866 if ((err = load_firmware(chip)) < 0)6967 return err;···6973 if ((err = init_line_levels(chip)) < 0)7074 return err;71757272- err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);7373- if (err < 0)7474- return err;7575- err = set_professional_spdif(chip, TRUE);7676-7776 DE_INIT(("init_hw done\n"));7877 return err;7878+}7979+8080+8181+8282+static int set_mixer_defaults(struct echoaudio *chip)8383+{8484+ chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;8585+ chip->professional_spdif = FALSE;8686+ chip->digital_in_automute = TRUE;8787+ return init_line_levels(chip);7988}80898190···124123125124 /* Load the ASIC for the PCI card */126125 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_PCI_CARD_ASIC,127127- &card_fw[FW_LAYLA24_1_ASIC]);126126+ FW_LAYLA24_1_ASIC);128127 if (err < 0)129128 return err;130129131131- chip->asic_code = &card_fw[FW_LAYLA24_2S_ASIC];130130+ chip->asic_code = FW_LAYLA24_2S_ASIC;132131133132 /* Now give the new ASIC a little time to set up */134133 mdelay(10);135134136135 /* Do the external one */137136 err = load_asic_generic(chip, DSP_FNC_LOAD_LAYLA24_EXTERNAL_ASIC,138138- &card_fw[FW_LAYLA24_2S_ASIC]);137137+ FW_LAYLA24_2S_ASIC);139138 if (err < 0)140139 return FALSE;141140···300299/* Depending on what digital mode you want, Layla24 needs different ASICs301300loaded. This function checks the ASIC needed for the new mode and sees302301if it matches the one already loaded. */303303-static int switch_asic(struct echoaudio *chip, const struct firmware *asic)302302+static int switch_asic(struct echoaudio *chip, short asic)304303{305304 s8 *monitors;306305···336335{337336 u32 control_reg;338337 int err, incompatible_clock;339339- const struct firmware *asic;338338+ short asic;340339341340 /* Set clock to "internal" if it's not compatible with the new mode */342341 incompatible_clock = FALSE;···345344 case DIGITAL_MODE_SPDIF_RCA:346345 if (chip->input_clock == ECHO_CLOCK_ADAT)347346 incompatible_clock = TRUE;348348- asic = &card_fw[FW_LAYLA24_2S_ASIC];347347+ asic = FW_LAYLA24_2S_ASIC;349348 break;350349 case DIGITAL_MODE_ADAT:351350 if (chip->input_clock == ECHO_CLOCK_SPDIF)352351 incompatible_clock = TRUE;353353- asic = &card_fw[FW_LAYLA24_2A_ASIC];352352+ asic = FW_LAYLA24_2A_ASIC;354353 break;355354 default:356355 DE_ACT(("Digital mode not supported: %d\n", mode));
···5353 chip->device_id = device_id;5454 chip->subdevice_id = subdevice_id;5555 chip->bad_board = TRUE;5656- chip->dsp_code_to_load = &card_fw[FW_MIA_DSP];5656+ chip->dsp_code_to_load = FW_MIA_DSP;5757 /* Since this card has no ASIC, mark it as loaded so everything5858 works OK */5959 chip->asic_loaded = TRUE;···6666 return err;6767 chip->bad_board = FALSE;68686969- if ((err = init_line_levels(chip)))7070- return err;7171-7269 DE_INIT(("init_hw done\n"));7370 return err;7171+}7272+7373+7474+7575+static int set_mixer_defaults(struct echoaudio *chip)7676+{7777+ return init_line_levels(chip);7478}75797680
···824824 struct hda_pincfg *pin;825825 unsigned int oldcfg;826826827827+ if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)828828+ return -EINVAL;829829+827830 oldcfg = snd_hda_codec_get_pincfg(codec, nid);828831 pin = look_up_pincfg(codec, list, nid);829832 if (!pin) {···902899 }903900}904901902902+/**903903+ * snd_hda_shutup_pins - Shut up all pins904904+ * @codec: the HDA codec905905+ *906906+ * Clear all pin controls to shup up before suspend for avoiding click noise.907907+ * The controls aren't cached so that they can be resumed properly.908908+ */909909+void snd_hda_shutup_pins(struct hda_codec *codec)910910+{911911+ int i;912912+ for (i = 0; i < codec->init_pins.used; i++) {913913+ struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);914914+ /* use read here for syncing after issuing each verb */915915+ snd_hda_codec_read(codec, pin->nid, 0,916916+ AC_VERB_SET_PIN_WIDGET_CONTROL, 0);917917+ }918918+}919919+EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);920920+905921static void init_hda_cache(struct hda_cache_rec *cache,906922 unsigned int record_size);907923static void free_hda_cache(struct hda_cache_rec *cache);···953931#endif954932 list_del(&codec->list);955933 snd_array_free(&codec->mixers);934934+ snd_array_free(&codec->nids);956935 codec->bus->caddr_tbl[codec->addr] = NULL;957936 if (codec->patch_ops.free)958937 codec->patch_ops.free(codec);···1008985 mutex_init(&codec->control_mutex);1009986 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info));1010987 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));10111011- snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 60);988988+ snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32);989989+ snd_array_init(&codec->nids, sizeof(struct hda_nid_item), 32);1012990 snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16);1013991 snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16);1014992 if (codec->bus->modelname) {···17321708EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);1733170917341710/**17351735- * snd_hda_ctl-add - Add a control element and assign to the codec17111711+ * snd_hda_ctl_add - Add a control element and assign to the codec17361712 * @codec: HD-audio codec17371713 * @nid: corresponding NID (optional)17381714 * @kctl: the control element to assign···17471723 *17481724 * snd_hda_ctl_add() checks the control subdev id field whether17491725 * #HDA_SUBDEV_NID_FLAG bit is set. If set (and @nid is zero), the lower17501750- * bits value is taken as the NID to assign.17261726+ * bits value is taken as the NID to assign. The #HDA_NID_ITEM_AMP bit17271727+ * specifies if kctl->private_value is a HDA amplifier value.17511728 */17521729int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid,17531730 struct snd_kcontrol *kctl)17541731{17551732 int err;17331733+ unsigned short flags = 0;17561734 struct hda_nid_item *item;1757173517581758- if (kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) {17361736+ if (kctl->id.subdevice & HDA_SUBDEV_AMP_FLAG) {17371737+ flags |= HDA_NID_ITEM_AMP;17591738 if (nid == 0)17601760- nid = kctl->id.subdevice & 0xffff;17611761- kctl->id.subdevice = 0;17391739+ nid = get_amp_nid_(kctl->private_value);17621740 }17411741+ if ((kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) != 0 && nid == 0)17421742+ nid = kctl->id.subdevice & 0xffff;17431743+ if (kctl->id.subdevice & (HDA_SUBDEV_NID_FLAG|HDA_SUBDEV_AMP_FLAG))17441744+ kctl->id.subdevice = 0;17631745 err = snd_ctl_add(codec->bus->card, kctl);17641746 if (err < 0)17651747 return err;···17741744 return -ENOMEM;17751745 item->kctl = kctl;17761746 item->nid = nid;17471747+ item->flags = flags;17771748 return 0;17781749}17791750EXPORT_SYMBOL_HDA(snd_hda_ctl_add);17511751+17521752+/**17531753+ * snd_hda_add_nid - Assign a NID to a control element17541754+ * @codec: HD-audio codec17551755+ * @nid: corresponding NID (optional)17561756+ * @kctl: the control element to assign17571757+ * @index: index to kctl17581758+ *17591759+ * Add the given control element to an array inside the codec instance.17601760+ * This function is used when #snd_hda_ctl_add cannot be used for 1:117611761+ * NID:KCTL mapping - for example "Capture Source" selector.17621762+ */17631763+int snd_hda_add_nid(struct hda_codec *codec, struct snd_kcontrol *kctl,17641764+ unsigned int index, hda_nid_t nid)17651765+{17661766+ struct hda_nid_item *item;17671767+17681768+ if (nid > 0) {17691769+ item = snd_array_new(&codec->nids);17701770+ if (!item)17711771+ return -ENOMEM;17721772+ item->kctl = kctl;17731773+ item->index = index;17741774+ item->nid = nid;17751775+ return 0;17761776+ }17771777+ return -EINVAL;17781778+}17791779+EXPORT_SYMBOL_HDA(snd_hda_add_nid);1780178017811781/**17821782 * snd_hda_ctls_clear - Clear all controls assigned to the given codec···18191759 for (i = 0; i < codec->mixers.used; i++)18201760 snd_ctl_remove(codec->bus->card, items[i].kctl);18211761 snd_array_free(&codec->mixers);17621762+ snd_array_free(&codec->nids);18221763}1823176418241765/* pseudo device locking···3539347835403479 for (; knew->name; knew++) {35413480 struct snd_kcontrol *kctl;34813481+ if (knew->iface == -1) /* skip this codec private value */34823482+ continue;35423483 kctl = snd_ctl_new1(knew, codec);35433484 if (!kctl)35443485 return -ENOMEM;
+2
sound/pci/hda/hda_codec.h
···789789 u32 *wcaps;790790791791 struct snd_array mixers; /* list of assigned mixer elements */792792+ struct snd_array nids; /* list of mapped mixer elements */792793793794 struct hda_cache_rec amp_cache; /* cache for amp access */794795 struct hda_cache_rec cmd_cache; /* cache for other commands */···899898 unsigned int cfg);900899int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,901900 hda_nid_t nid, unsigned int cfg); /* for hwdep */901901+void snd_hda_shutup_pins(struct hda_codec *codec);902902903903/*904904 * Mixer
+2-1
sound/pci/hda/hda_generic.c
···861861 }862862863863 /* create input MUX if multiple sources are available */864864- err = snd_hda_ctl_add(codec, 0, snd_ctl_new1(&cap_sel, codec));864864+ err = snd_hda_ctl_add(codec, spec->adc_node->nid,865865+ snd_ctl_new1(&cap_sel, codec));865866 if (err < 0)866867 return err;867868
···2121 */22222323#include <linux/slab.h>2424-#include <linux/vmalloc.h>2524#include <linux/delay.h>2625#include <sound/core.h>2726#include <sound/asoundef.h>2827#include "pdaudiocf.h"29283030-3131-/*3232- * we use a vmalloc'ed (sg-)buffer3333- */3434-3535-/* get the physical page pointer on the given offset */3636-static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, unsigned long offset)3737-{3838- void *pageptr = subs->runtime->dma_area + offset;3939- return vmalloc_to_page(pageptr);4040-}4141-4242-/*4343- * hw_params callback4444- * NOTE: this may be called not only once per pcm open!4545- */4646-static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)4747-{4848- struct snd_pcm_runtime *runtime = subs->runtime;4949- if (runtime->dma_area) {5050- if (runtime->dma_bytes >= size)5151- return 0; /* already enough large */5252- vfree(runtime->dma_area);5353- }5454- runtime->dma_area = vmalloc_32_user(size);5555- if (! runtime->dma_area)5656- return -ENOMEM;5757- runtime->dma_bytes = size;5858- return 0;5959-}6060-6161-/*6262- * hw_free callback6363- * NOTE: this may be called not only once per pcm open!6464- */6565-static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)6666-{6767- struct snd_pcm_runtime *runtime = subs->runtime;6868-6969- vfree(runtime->dma_area);7070- runtime->dma_area = NULL;7171- return 0;7272-}73297430/*7531 * clear the SRAM contents···103147static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs,104148 struct snd_pcm_hw_params *hw_params)105149{106106- return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));150150+ return snd_pcm_lib_alloc_vmalloc_32_buffer151151+ (subs, params_buffer_bytes(hw_params));107152}108153109154/*···112155 */113156static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs)114157{115115- return snd_pcm_free_vmalloc_buffer(subs);158158+ return snd_pcm_lib_free_vmalloc_buffer(subs);116159}117160118161/*···276319 .prepare = pdacf_pcm_prepare,277320 .trigger = pdacf_pcm_trigger,278321 .pointer = pdacf_pcm_capture_pointer,279279- .page = snd_pcm_get_vmalloc_page,322322+ .page = snd_pcm_lib_get_vmalloc_page,323323+ .mmap = snd_pcm_lib_mmap_vmalloc,280324};281325282326
+12
sound/usb/Kconfig
···2121 To compile this driver as a module, choose M here: the module2222 will be called snd-usb-audio.23232424+config SND_USB_UA1012525+ tristate "Edirol UA-101 driver (EXPERIMENTAL)"2626+ depends on EXPERIMENTAL2727+ select SND_PCM2828+ select SND_RAWMIDI2929+ help3030+ Say Y here to include support for the Edirol UA-101 audio/MIDI3131+ interface.3232+3333+ To compile this driver as a module, choose M here: the module3434+ will be called snd-ua101.3535+2436config SND_USB_USX2Y2537 tristate "Tascam US-122, US-224 and US-428 USB driver"2638 depends on X86 || PPC || ALPHA