aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c3
-rw-r--r--sound/core/pcm_native.c8
-rw-r--r--sound/isa/sb/emu8000.c11
-rw-r--r--sound/oss/dev_table.c16
-rw-r--r--sound/oss/sound_config.h2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/ac97/ac97_codec.c10
-rw-r--r--sound/pci/ac97/ac97_id.h2
-rw-r--r--sound/pci/ac97/ac97_patch.c1
-rw-r--r--sound/pci/ctxfi/ctatc.c15
-rw-r--r--sound/pci/ctxfi/ctvmem.c38
-rw-r--r--sound/pci/ctxfi/ctvmem.h8
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_sigmatel.c18
-rw-r--r--sound/pci/ice1712/aureon.c12
-rw-r--r--sound/soc/codecs/ac97.c6
-rw-r--r--sound/soc/codecs/wm8510.c14
-rw-r--r--sound/soc/codecs/wm8940.c14
-rw-r--r--sound/soc/codecs/wm8974.c14
-rw-r--r--sound/soc/sh/fsi-ak4642.c30
-rw-r--r--sound/usb/usbmidi.c18
24 files changed, 155 insertions, 132 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index c5699863643b..656e474dca47 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -441,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
441 struct snd_pcm_hw_params *params) 441 struct snd_pcm_hw_params *params)
442{ 442{
443 int err; 443 int err;
444 struct aaci *aaci = substream->private_data;
444 445
445 aaci_pcm_hw_free(substream); 446 aaci_pcm_hw_free(substream);
446 if (aacirun->pcm_open) { 447 if (aacirun->pcm_open) {
@@ -560,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
560static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, 561static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
561 struct snd_pcm_hw_params *params) 562 struct snd_pcm_hw_params *params)
562{ 563{
563 struct aaci *aaci = substream->private_data;
564 struct aaci_runtime *aacirun = substream->runtime->private_data; 564 struct aaci_runtime *aacirun = substream->runtime->private_data;
565 unsigned int channels = params_channels(params); 565 unsigned int channels = params_channels(params);
566 int ret; 566 int ret;
@@ -659,7 +659,6 @@ static struct snd_pcm_ops aaci_playback_ops = {
659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
660 struct snd_pcm_hw_params *params) 660 struct snd_pcm_hw_params *params)
661{ 661{
662 struct aaci *aaci = substream->private_data;
663 struct aaci_runtime *aacirun = substream->runtime->private_data; 662 struct aaci_runtime *aacirun = substream->runtime->private_data;
664 int ret; 663 int ret;
665 664
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 9cbaf90d3d88..053c6d612a2a 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1956,13 +1956,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1956 1956
1957 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 1957 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
1958 hw->rate_min, hw->rate_max); 1958 hw->rate_min, hw->rate_max);
1959 if (err < 0) 1959 if (err < 0)
1960 return err; 1960 return err;
1961 1961
1962 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1962 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1963 hw->period_bytes_min, hw->period_bytes_max); 1963 hw->period_bytes_min, hw->period_bytes_max);
1964 if (err < 0) 1964 if (err < 0)
1965 return err; 1965 return err;
1966 1966
1967 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 1967 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
1968 hw->periods_min, hw->periods_max); 1968 hw->periods_min, hw->periods_max);
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 751762f1c59a..0c40951b6523 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -377,12 +377,13 @@ init_arrays(struct snd_emu8000 *emu)
377static void __devinit 377static void __devinit
378size_dram(struct snd_emu8000 *emu) 378size_dram(struct snd_emu8000 *emu)
379{ 379{
380 int i, size; 380 int i, size, detected_size;
381 381
382 if (emu->dram_checked) 382 if (emu->dram_checked)
383 return; 383 return;
384 384
385 size = 0; 385 size = 0;
386 detected_size = 0;
386 387
387 /* write out a magic number */ 388 /* write out a magic number */
388 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE); 389 snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE);
@@ -393,6 +394,8 @@ size_dram(struct snd_emu8000 *emu)
393 394
394 while (size < EMU8000_MAX_DRAM) { 395 while (size < EMU8000_MAX_DRAM) {
395 396
397 size += 512 * 1024; /* increment 512kbytes */
398
396 /* Write a unique data on the test address. 399 /* Write a unique data on the test address.
397 * if the address is out of range, the data is written on 400 * if the address is out of range, the data is written on
398 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is 401 * 0x200000(=EMU8000_DRAM_OFFSET). Then the id word is
@@ -414,7 +417,7 @@ size_dram(struct snd_emu8000 *emu)
414 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 417 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
415 break; /* no memory at this address */ 418 break; /* no memory at this address */
416 419
417 size += 512 * 1024; /* increment 512kbytes */ 420 detected_size = size;
418 421
419 snd_emu8000_read_wait(emu); 422 snd_emu8000_read_wait(emu);
420 423
@@ -442,9 +445,9 @@ size_dram(struct snd_emu8000 *emu)
442 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 445 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE);
443 446
444 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n", 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n",
445 emu->port1, size/1024); 448 emu->port1, detected_size/1024);
446 449
447 emu->mem_size = size; 450 emu->mem_size = detected_size;
448 emu->dram_checked = 1; 451 emu->dram_checked = 1;
449} 452}
450 453
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c
index 08274c995d06..727bdb9ba2dc 100644
--- a/sound/oss/dev_table.c
+++ b/sound/oss/dev_table.c
@@ -67,14 +67,15 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
67 return -(EBUSY); 67 return -(EBUSY);
68 } 68 }
69 d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver))); 69 d = (struct audio_driver *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_driver)));
70 70 sound_nblocks++;
71 if (sound_nblocks < 1024) 71 if (sound_nblocks >= MAX_MEM_BLOCKS)
72 sound_nblocks++; 72 sound_nblocks = MAX_MEM_BLOCKS - 1;
73 73
74 op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); 74 op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations)));
75 sound_nblocks++;
76 if (sound_nblocks >= MAX_MEM_BLOCKS)
77 sound_nblocks = MAX_MEM_BLOCKS - 1;
75 78
76 if (sound_nblocks < 1024)
77 sound_nblocks++;
78 if (d == NULL || op == NULL) { 79 if (d == NULL || op == NULL) {
79 printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name); 80 printk(KERN_ERR "Sound: Can't allocate driver for (%s)\n", name);
80 sound_unload_audiodev(num); 81 sound_unload_audiodev(num);
@@ -128,9 +129,10 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
128 until you unload sound! */ 129 until you unload sound! */
129 130
130 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); 131 op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations)));
132 sound_nblocks++;
133 if (sound_nblocks >= MAX_MEM_BLOCKS)
134 sound_nblocks = MAX_MEM_BLOCKS - 1;
131 135
132 if (sound_nblocks < 1024)
133 sound_nblocks++;
134 if (op == NULL) { 136 if (op == NULL) {
135 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); 137 printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name);
136 return -ENOMEM; 138 return -ENOMEM;
diff --git a/sound/oss/sound_config.h b/sound/oss/sound_config.h
index 55271fbe7f49..9d35c4c65b9b 100644
--- a/sound/oss/sound_config.h
+++ b/sound/oss/sound_config.h
@@ -142,4 +142,6 @@ static inline int translate_mode(struct file *file)
142#define TIMER_ARMED 121234 142#define TIMER_ARMED 121234
143#define TIMER_NOT_ARMED 1 143#define TIMER_NOT_ARMED 1
144 144
145#define MAX_MEM_BLOCKS 1024
146
145#endif 147#endif
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 61aaedae6b7e..c62530943888 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -56,7 +56,7 @@
56/* 56/*
57 * Table for permanently allocated memory (used when unloading the module) 57 * Table for permanently allocated memory (used when unloading the module)
58 */ 58 */
59void * sound_mem_blocks[1024]; 59void * sound_mem_blocks[MAX_MEM_BLOCKS];
60int sound_nblocks = 0; 60int sound_nblocks = 0;
61 61
62/* Persistent DMA buffers */ 62/* Persistent DMA buffers */
@@ -574,7 +574,7 @@ static int __init oss_init(void)
574 NULL, "%s%d", dev_list[i].name, j); 574 NULL, "%s%d", dev_list[i].name, j);
575 } 575 }
576 576
577 if (sound_nblocks >= 1024) 577 if (sound_nblocks >= MAX_MEM_BLOCKS - 1)
578 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n"); 578 printk(KERN_ERR "Sound warning: Deallocation table was too small.\n");
579 579
580 return 0; 580 return 0;
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index c11920623009..a7630e9edf8a 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -83,6 +83,7 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL }, 83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL },
84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL }, 84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL },
85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL }, 85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL },
86{ 0x53544d00, 0xffffff00, "STMicroelectronics", NULL, NULL },
86{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL }, 87{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL },
87{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL }, 88{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL },
88{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL }, 89{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL },
@@ -161,6 +162,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
161{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix 162{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix
162{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, 163{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL },
163{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH }, 164{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH },
165{ 0x53544d02, 0xffffffff, "ST7597", NULL, NULL },
164{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL }, 166{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL },
165{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL }, 167{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL },
166{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL }, 168{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL },
@@ -213,6 +215,14 @@ static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg)
213{ 215{
214 /* filter some registers for buggy codecs */ 216 /* filter some registers for buggy codecs */
215 switch (ac97->id) { 217 switch (ac97->id) {
218 case AC97_ID_ST_AC97_ID4:
219 if (reg == 0x08)
220 return 0;
221 /* fall through */
222 case AC97_ID_ST7597:
223 if (reg == 0x22 || reg == 0x7a)
224 return 1;
225 /* fall through */
216 case AC97_ID_AK4540: 226 case AC97_ID_AK4540:
217 case AC97_ID_AK4542: 227 case AC97_ID_AK4542:
218 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) 228 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c)
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h
index c129492c82b3..d603147c4a96 100644
--- a/sound/pci/ac97/ac97_id.h
+++ b/sound/pci/ac97/ac97_id.h
@@ -62,3 +62,5 @@
62#define AC97_ID_CM9761_78 0x434d4978 62#define AC97_ID_CM9761_78 0x434d4978
63#define AC97_ID_CM9761_82 0x434d4982 63#define AC97_ID_CM9761_82 0x434d4982
64#define AC97_ID_CM9761_83 0x434d4983 64#define AC97_ID_CM9761_83 0x434d4983
65#define AC97_ID_ST7597 0x53544d02
66#define AC97_ID_ST_AC97_ID4 0x53544d04
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index e288a5595f34..1caf5e3c1f6a 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1855,6 +1855,7 @@ static unsigned int ad1981_jacks_blacklist[] = {
1855 0x10140554, /* Thinkpad T42p/R50p */ 1855 0x10140554, /* Thinkpad T42p/R50p */
1856 0x10140567, /* Thinkpad T43p 2668-G7U */ 1856 0x10140567, /* Thinkpad T43p 2668-G7U */
1857 0x10140581, /* Thinkpad X41-2527 */ 1857 0x10140581, /* Thinkpad X41-2527 */
1858 0x10280160, /* Dell Dimension 2400 */
1858 0x104380b0, /* Asus A7V8X-MX */ 1859 0x104380b0, /* Asus A7V8X-MX */
1859 0x11790241, /* Toshiba Satellite A-15 S127 */ 1860 0x11790241, /* Toshiba Satellite A-15 S127 */
1860 0x144dc01a, /* Samsung NP-X20C004/SEG */ 1861 0x144dc01a, /* Samsung NP-X20C004/SEG */
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index cb65bd0dd35b..459c1f62783b 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -166,18 +166,7 @@ static void ct_unmap_audio_buffer(struct ct_atc *atc, struct ct_atc_pcm *apcm)
166 166
167static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index) 167static unsigned long atc_get_ptp_phys(struct ct_atc *atc, int index)
168{ 168{
169 struct ct_vm *vm; 169 return atc->vm->get_ptp_phys(atc->vm, index);
170 void *kvirt_addr;
171 unsigned long phys_addr;
172
173 vm = atc->vm;
174 kvirt_addr = vm->get_ptp_virt(vm, index);
175 if (kvirt_addr == NULL)
176 phys_addr = (~0UL);
177 else
178 phys_addr = virt_to_phys(kvirt_addr);
179
180 return phys_addr;
181} 170}
182 171
183static unsigned int convert_format(snd_pcm_format_t snd_format) 172static unsigned int convert_format(snd_pcm_format_t snd_format)
@@ -1669,7 +1658,7 @@ int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1669 } 1658 }
1670 1659
1671 /* Set up device virtual memory management object */ 1660 /* Set up device virtual memory management object */
1672 err = ct_vm_create(&atc->vm); 1661 err = ct_vm_create(&atc->vm, pci);
1673 if (err < 0) 1662 if (err < 0)
1674 goto error1; 1663 goto error1;
1675 1664
diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c
index 6b78752e9503..65da6e466f80 100644
--- a/sound/pci/ctxfi/ctvmem.c
+++ b/sound/pci/ctxfi/ctvmem.c
@@ -138,7 +138,7 @@ ct_vm_map(struct ct_vm *vm, struct snd_pcm_substream *substream, int size)
138 return NULL; 138 return NULL;
139 } 139 }
140 140
141 ptp = vm->ptp[0]; 141 ptp = (unsigned long *)vm->ptp[0].area;
142 pte_start = (block->addr >> CT_PAGE_SHIFT); 142 pte_start = (block->addr >> CT_PAGE_SHIFT);
143 pages = block->size >> CT_PAGE_SHIFT; 143 pages = block->size >> CT_PAGE_SHIFT;
144 for (i = 0; i < pages; i++) { 144 for (i = 0; i < pages; i++) {
@@ -158,25 +158,25 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block)
158} 158}
159 159
160/* * 160/* *
161 * return the host (kmalloced) addr of the @index-th device 161 * return the host physical addr of the @index-th device
162 * page talbe page on success, or NULL on failure. 162 * page table page on success, or ~0UL on failure.
163 * The first returned NULL indicates the termination. 163 * The first returned ~0UL indicates the termination.
164 * */ 164 * */
165static void * 165static dma_addr_t
166ct_get_ptp_virt(struct ct_vm *vm, int index) 166ct_get_ptp_phys(struct ct_vm *vm, int index)
167{ 167{
168 void *addr; 168 dma_addr_t addr;
169 169
170 addr = (index >= CT_PTP_NUM) ? NULL : vm->ptp[index]; 170 addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
171 171
172 return addr; 172 return addr;
173} 173}
174 174
175int ct_vm_create(struct ct_vm **rvm) 175int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
176{ 176{
177 struct ct_vm *vm; 177 struct ct_vm *vm;
178 struct ct_vm_block *block; 178 struct ct_vm_block *block;
179 int i; 179 int i, err = 0;
180 180
181 *rvm = NULL; 181 *rvm = NULL;
182 182
@@ -188,23 +188,21 @@ int ct_vm_create(struct ct_vm **rvm)
188 188
189 /* Allocate page table pages */ 189 /* Allocate page table pages */
190 for (i = 0; i < CT_PTP_NUM; i++) { 190 for (i = 0; i < CT_PTP_NUM; i++) {
191 vm->ptp[i] = kmalloc(PAGE_SIZE, GFP_KERNEL); 191 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
192 if (!vm->ptp[i]) 192 snd_dma_pci_data(pci),
193 PAGE_SIZE, &vm->ptp[i]);
194 if (err < 0)
193 break; 195 break;
194 } 196 }
195 if (!i) { 197 if (err < 0) {
196 /* no page table pages are allocated */ 198 /* no page table pages are allocated */
197 kfree(vm); 199 ct_vm_destroy(vm);
198 return -ENOMEM; 200 return -ENOMEM;
199 } 201 }
200 vm->size = CT_ADDRS_PER_PAGE * i; 202 vm->size = CT_ADDRS_PER_PAGE * i;
201 /* Initialise remaining ptps */
202 for (; i < CT_PTP_NUM; i++)
203 vm->ptp[i] = NULL;
204
205 vm->map = ct_vm_map; 203 vm->map = ct_vm_map;
206 vm->unmap = ct_vm_unmap; 204 vm->unmap = ct_vm_unmap;
207 vm->get_ptp_virt = ct_get_ptp_virt; 205 vm->get_ptp_phys = ct_get_ptp_phys;
208 INIT_LIST_HEAD(&vm->unused); 206 INIT_LIST_HEAD(&vm->unused);
209 INIT_LIST_HEAD(&vm->used); 207 INIT_LIST_HEAD(&vm->used);
210 block = kzalloc(sizeof(*block), GFP_KERNEL); 208 block = kzalloc(sizeof(*block), GFP_KERNEL);
@@ -242,7 +240,7 @@ void ct_vm_destroy(struct ct_vm *vm)
242 240
243 /* free allocated page table pages */ 241 /* free allocated page table pages */
244 for (i = 0; i < CT_PTP_NUM; i++) 242 for (i = 0; i < CT_PTP_NUM; i++)
245 kfree(vm->ptp[i]); 243 snd_dma_free_pages(&vm->ptp[i]);
246 244
247 vm->size = 0; 245 vm->size = 0;
248 246
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
index 01e4fd0386a3..b23adfca4de6 100644
--- a/sound/pci/ctxfi/ctvmem.h
+++ b/sound/pci/ctxfi/ctvmem.h
@@ -22,6 +22,8 @@
22 22
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/pci.h>
26#include <sound/memalloc.h>
25 27
26/* The chip can handle the page table of 4k pages 28/* The chip can handle the page table of 4k pages
27 * (emu20k1 can handle even 8k pages, but we don't use it right now) 29 * (emu20k1 can handle even 8k pages, but we don't use it right now)
@@ -41,7 +43,7 @@ struct snd_pcm_substream;
41 43
42/* Virtual memory management object for card device */ 44/* Virtual memory management object for card device */
43struct ct_vm { 45struct ct_vm {
44 void *ptp[CT_PTP_NUM]; /* Device page table pages */ 46 struct snd_dma_buffer ptp[CT_PTP_NUM]; /* Device page table pages */
45 unsigned int size; /* Available addr space in bytes */ 47 unsigned int size; /* Available addr space in bytes */
46 struct list_head unused; /* List of unused blocks */ 48 struct list_head unused; /* List of unused blocks */
47 struct list_head used; /* List of used blocks */ 49 struct list_head used; /* List of used blocks */
@@ -52,10 +54,10 @@ struct ct_vm {
52 int size); 54 int size);
53 /* Unmap device logical addr area. */ 55 /* Unmap device logical addr area. */
54 void (*unmap)(struct ct_vm *, struct ct_vm_block *block); 56 void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
55 void *(*get_ptp_virt)(struct ct_vm *vm, int index); 57 dma_addr_t (*get_ptp_phys)(struct ct_vm *vm, int index);
56}; 58};
57 59
58int ct_vm_create(struct ct_vm **rvm); 60int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci);
59void ct_vm_destroy(struct ct_vm *vm); 61void ct_vm_destroy(struct ct_vm *vm);
60 62
61#endif /* CTVMEM_H */ 63#endif /* CTVMEM_H */
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 5fe34a8d8c81..e4581a42ace5 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work)
42 return; 42 return;
43 43
44 /* generate tone */ 44 /* generate tone */
45 snd_hda_codec_write_cache(codec, beep->nid, 0, 45 snd_hda_codec_write(codec, beep->nid, 0,
46 AC_VERB_SET_BEEP_CONTROL, beep->tone); 46 AC_VERB_SET_BEEP_CONTROL, beep->tone);
47} 47}
48 48
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep)
119 beep->dev = NULL; 119 beep->dev = NULL;
120 cancel_work_sync(&beep->beep_work); 120 cancel_work_sync(&beep->beep_work);
121 /* turn off beep for sure */ 121 /* turn off beep for sure */
122 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 122 snd_hda_codec_write(beep->codec, beep->nid, 0,
123 AC_VERB_SET_BEEP_CONTROL, 0); 123 AC_VERB_SET_BEEP_CONTROL, 0);
124} 124}
125 125
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
192 beep->enabled = enable; 192 beep->enabled = enable;
193 if (!enable) { 193 if (!enable) {
194 /* turn off beep */ 194 /* turn off beep */
195 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 195 snd_hda_codec_write(beep->codec, beep->nid, 0,
196 AC_VERB_SET_BEEP_CONTROL, 0); 196 AC_VERB_SET_BEEP_CONTROL, 0);
197 } 197 }
198 if (beep->mode == HDA_BEEP_MODE_SWREG) { 198 if (beep->mode == HDA_BEEP_MODE_SWREG) {
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
239 mutex_init(&beep->mutex); 239 mutex_init(&beep->mutex);
240 240
241 if (beep->mode == HDA_BEEP_MODE_ON) { 241 if (beep->mode == HDA_BEEP_MODE_ON) {
242 beep->enabled = 1; 242 int err = snd_hda_do_attach(beep);
243 snd_hda_do_register(&beep->register_work); 243 if (err < 0) {
244 kfree(beep);
245 codec->beep = NULL;
246 return err;
247 }
244 } 248 }
245 249
246 return 0; 250 return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
253 if (beep) { 257 if (beep) {
254 cancel_work_sync(&beep->register_work); 258 cancel_work_sync(&beep->register_work);
255 cancel_delayed_work(&beep->unregister_work); 259 cancel_delayed_work(&beep->unregister_work);
256 if (beep->enabled) 260 if (beep->dev)
257 snd_hda_do_detach(beep); 261 snd_hda_do_detach(beep);
258 codec->beep = NULL; 262 codec->beep = NULL;
259 kfree(beep); 263 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d02ea8926e7e..26ceace88c96 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1351,11 +1351,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1351 */ 1351 */
1352u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) 1352u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1353{ 1353{
1354 u32 pincap = snd_hda_query_pin_caps(codec, nid); 1354 u32 pincap;
1355
1356 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1357 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1358 1355
1356 if (!codec->no_trigger_sense) {
1357 pincap = snd_hda_query_pin_caps(codec, nid);
1358 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1359 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1360 }
1359 return snd_hda_codec_read(codec, nid, 0, 1361 return snd_hda_codec_read(codec, nid, 0,
1360 AC_VERB_GET_PIN_SENSE, 0); 1362 AC_VERB_GET_PIN_SENSE, 0);
1361} 1363}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 11c4aa8ee996..0c8f05cc56be 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -818,6 +818,7 @@ struct hda_codec {
818 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 818 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
819 * (e.g. Conexant codecs) 819 * (e.g. Conexant codecs)
820 */ 820 */
821 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
821#ifdef CONFIG_SND_HDA_POWER_SAVE 822#ifdef CONFIG_SND_HDA_POWER_SAVE
822 unsigned int power_on :1; /* current (global) power-state */ 823 unsigned int power_on :1; /* current (global) power-state */
823 unsigned int power_transition :1; /* power-state in transition */ 824 unsigned int power_transition :1; /* power-state in transition */
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 865715e3f938..214301d568fa 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1276,6 +1276,8 @@ static int patch_ad1986a(struct hda_codec *codec)
1276 */ 1276 */
1277 spec->multiout.no_share_stream = 1; 1277 spec->multiout.no_share_stream = 1;
1278 1278
1279 codec->no_trigger_sense = 1;
1280
1279 return 0; 1281 return 0;
1280} 1282}
1281 1283
@@ -1461,6 +1463,8 @@ static int patch_ad1983(struct hda_codec *codec)
1461 1463
1462 codec->patch_ops = ad198x_patch_ops; 1464 codec->patch_ops = ad198x_patch_ops;
1463 1465
1466 codec->no_trigger_sense = 1;
1467
1464 return 0; 1468 return 0;
1465} 1469}
1466 1470
@@ -1904,6 +1908,9 @@ static int patch_ad1981(struct hda_codec *codec)
1904 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1908 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1905 break; 1909 break;
1906 } 1910 }
1911
1912 codec->no_trigger_sense = 1;
1913
1907 return 0; 1914 return 0;
1908} 1915}
1909 1916
@@ -3220,6 +3227,8 @@ static int patch_ad1988(struct hda_codec *codec)
3220#endif 3227#endif
3221 spec->vmaster_nid = 0x04; 3228 spec->vmaster_nid = 0x04;
3222 3229
3230 codec->no_trigger_sense = 1;
3231
3223 return 0; 3232 return 0;
3224} 3233}
3225 3234
@@ -3432,6 +3441,8 @@ static int patch_ad1884(struct hda_codec *codec)
3432 3441
3433 codec->patch_ops = ad198x_patch_ops; 3442 codec->patch_ops = ad198x_patch_ops;
3434 3443
3444 codec->no_trigger_sense = 1;
3445
3435 return 0; 3446 return 0;
3436} 3447}
3437 3448
@@ -4392,6 +4403,8 @@ static int patch_ad1884a(struct hda_codec *codec)
4392 break; 4403 break;
4393 } 4404 }
4394 4405
4406 codec->no_trigger_sense = 1;
4407
4395 return 0; 4408 return 0;
4396} 4409}
4397 4410
@@ -4728,6 +4741,9 @@ static int patch_ad1882(struct hda_codec *codec)
4728 spec->mixers[2] = ad1882_6stack_mixers; 4741 spec->mixers[2] = ad1882_6stack_mixers;
4729 break; 4742 break;
4730 } 4743 }
4744
4745 codec->no_trigger_sense = 1;
4746
4731 return 0; 4747 return 0;
4732} 4748}
4733 4749
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index e28c810bc00c..117919aa17f4 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4460,14 +4460,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4460{ 4460{
4461 if (!nid) 4461 if (!nid)
4462 return 0; 4462 return 0;
4463 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4463 return snd_hda_jack_detect(codec, nid);
4464 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4465 * the pincap gives TRIG_REQ bit.
4466 */
4467 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4468 AC_PINSENSE_PRESENCE)
4469 return 1;
4470 return 0;
4471} 4464}
4472 4465
4473static void stac92xx_line_out_detect(struct hda_codec *codec, 4466static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4969,6 +4962,7 @@ static int patch_stac9200(struct hda_codec *codec)
4969 if (spec == NULL) 4962 if (spec == NULL)
4970 return -ENOMEM; 4963 return -ENOMEM;
4971 4964
4965 codec->no_trigger_sense = 1;
4972 codec->spec = spec; 4966 codec->spec = spec;
4973 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4967 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4974 spec->pin_nids = stac9200_pin_nids; 4968 spec->pin_nids = stac9200_pin_nids;
@@ -5031,6 +5025,7 @@ static int patch_stac925x(struct hda_codec *codec)
5031 if (spec == NULL) 5025 if (spec == NULL)
5032 return -ENOMEM; 5026 return -ENOMEM;
5033 5027
5028 codec->no_trigger_sense = 1;
5034 codec->spec = spec; 5029 codec->spec = spec;
5035 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5030 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5036 spec->pin_nids = stac925x_pin_nids; 5031 spec->pin_nids = stac925x_pin_nids;
@@ -5115,6 +5110,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5115 if (spec == NULL) 5110 if (spec == NULL)
5116 return -ENOMEM; 5111 return -ENOMEM;
5117 5112
5113 codec->no_trigger_sense = 1;
5118 codec->spec = spec; 5114 codec->spec = spec;
5119 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5115 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5120 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5116 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5262,6 +5258,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5262 if (spec == NULL) 5258 if (spec == NULL)
5263 return -ENOMEM; 5259 return -ENOMEM;
5264 5260
5261 codec->no_trigger_sense = 1;
5265 codec->spec = spec; 5262 codec->spec = spec;
5266 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5263 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5267 spec->digbeep_nid = 0x21; 5264 spec->digbeep_nid = 0x21;
@@ -5473,6 +5470,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5473 if (spec == NULL) 5470 if (spec == NULL)
5474 return -ENOMEM; 5471 return -ENOMEM;
5475 5472
5473 codec->no_trigger_sense = 1;
5476 codec->spec = spec; 5474 codec->spec = spec;
5477 codec->patch_ops = stac92xx_patch_ops; 5475 codec->patch_ops = stac92xx_patch_ops;
5478 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5476 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5725,6 +5723,7 @@ static int patch_stac922x(struct hda_codec *codec)
5725 if (spec == NULL) 5723 if (spec == NULL)
5726 return -ENOMEM; 5724 return -ENOMEM;
5727 5725
5726 codec->no_trigger_sense = 1;
5728 codec->spec = spec; 5727 codec->spec = spec;
5729 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5728 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5730 spec->pin_nids = stac922x_pin_nids; 5729 spec->pin_nids = stac922x_pin_nids;
@@ -5828,6 +5827,7 @@ static int patch_stac927x(struct hda_codec *codec)
5828 if (spec == NULL) 5827 if (spec == NULL)
5829 return -ENOMEM; 5828 return -ENOMEM;
5830 5829
5830 codec->no_trigger_sense = 1;
5831 codec->spec = spec; 5831 codec->spec = spec;
5832 codec->slave_dig_outs = stac927x_slave_dig_outs; 5832 codec->slave_dig_outs = stac927x_slave_dig_outs;
5833 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5833 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5962,6 +5962,7 @@ static int patch_stac9205(struct hda_codec *codec)
5962 if (spec == NULL) 5962 if (spec == NULL)
5963 return -ENOMEM; 5963 return -ENOMEM;
5964 5964
5965 codec->no_trigger_sense = 1;
5965 codec->spec = spec; 5966 codec->spec = spec;
5966 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5967 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5967 spec->pin_nids = stac9205_pin_nids; 5968 spec->pin_nids = stac9205_pin_nids;
@@ -6117,6 +6118,7 @@ static int patch_stac9872(struct hda_codec *codec)
6117 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6118 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6118 if (spec == NULL) 6119 if (spec == NULL)
6119 return -ENOMEM; 6120 return -ENOMEM;
6121 codec->no_trigger_sense = 1;
6120 codec->spec = spec; 6122 codec->spec = spec;
6121 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6123 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6122 spec->pin_nids = stac9872_pin_nids; 6124 spec->pin_nids = stac9872_pin_nids;
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 765d7bd4c3d4..9e66f6d306f8 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -703,11 +703,13 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho
703{ 703{
704 unsigned char nvol; 704 unsigned char nvol;
705 705
706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) 706 if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) {
707 nvol = 0; 707 nvol = 0;
708 else 708 } else {
709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) / 709 nvol = ((vol % WM_VOL_CNT) * (master % WM_VOL_CNT)) /
710 WM_VOL_MAX; 710 WM_VOL_MAX;
711 nvol += 0x1b;
712 }
711 713
712 wm_put(ice, index, nvol); 714 wm_put(ice, index, nvol);
713 wm_put_nocache(ice, index, 0x180 | nvol); 715 wm_put_nocache(ice, index, 0x180 | nvol);
@@ -778,7 +780,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
778 for (ch = 0; ch < 2; ch++) { 780 for (ch = 0; ch < 2; ch++) {
779 unsigned int vol = ucontrol->value.integer.value[ch]; 781 unsigned int vol = ucontrol->value.integer.value[ch];
780 if (vol > WM_VOL_MAX) 782 if (vol > WM_VOL_MAX)
781 continue; 783 vol = WM_VOL_MAX;
782 vol |= spec->master[ch] & WM_VOL_MUTE; 784 vol |= spec->master[ch] & WM_VOL_MUTE;
783 if (vol != spec->master[ch]) { 785 if (vol != spec->master[ch]) {
784 int dac; 786 int dac;
@@ -834,8 +836,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *
834 for (i = 0; i < voices; i++) { 836 for (i = 0; i < voices; i++) {
835 unsigned int vol = ucontrol->value.integer.value[i]; 837 unsigned int vol = ucontrol->value.integer.value[i];
836 if (vol > WM_VOL_MAX) 838 if (vol > WM_VOL_MAX)
837 continue; 839 vol = WM_VOL_MAX;
838 vol |= spec->vol[ofs+i]; 840 vol |= spec->vol[ofs+i] & WM_VOL_MUTE;
839 if (vol != spec->vol[ofs+i]) { 841 if (vol != spec->vol[ofs+i]) {
840 spec->vol[ofs+i] = vol; 842 spec->vol[ofs+i] = vol;
841 idx = WM_DAC_ATTEN + ofs + i; 843 idx = WM_DAC_ATTEN + ofs + i;
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 69bd0acc81c8..a1bbe16b7f96 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -102,6 +102,12 @@ static int ac97_soc_probe(struct platform_device *pdev)
102 INIT_LIST_HEAD(&codec->dapm_widgets); 102 INIT_LIST_HEAD(&codec->dapm_widgets);
103 INIT_LIST_HEAD(&codec->dapm_paths); 103 INIT_LIST_HEAD(&codec->dapm_paths);
104 104
105 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
106 if (ret < 0) {
107 printk(KERN_ERR "ASoC: failed to init gen ac97 glue\n");
108 goto err;
109 }
110
105 /* register pcms */ 111 /* register pcms */
106 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 112 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
107 if (ret < 0) 113 if (ret < 0)
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 265e68c75df8..af8cb6995a1f 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -424,23 +424,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
424 424
425 /* filter coefficient */ 425 /* filter coefficient */
426 switch (params_rate(params)) { 426 switch (params_rate(params)) {
427 case SNDRV_PCM_RATE_8000: 427 case 8000:
428 adn |= 0x5 << 1; 428 adn |= 0x5 << 1;
429 break; 429 break;
430 case SNDRV_PCM_RATE_11025: 430 case 11025:
431 adn |= 0x4 << 1; 431 adn |= 0x4 << 1;
432 break; 432 break;
433 case SNDRV_PCM_RATE_16000: 433 case 16000:
434 adn |= 0x3 << 1; 434 adn |= 0x3 << 1;
435 break; 435 break;
436 case SNDRV_PCM_RATE_22050: 436 case 22050:
437 adn |= 0x2 << 1; 437 adn |= 0x2 << 1;
438 break; 438 break;
439 case SNDRV_PCM_RATE_32000: 439 case 32000:
440 adn |= 0x1 << 1; 440 adn |= 0x1 << 1;
441 break; 441 break;
442 case SNDRV_PCM_RATE_44100: 442 case 44100:
443 case SNDRV_PCM_RATE_48000: 443 case 48000:
444 break; 444 break;
445 } 445 }
446 446
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 3d850b97037a..31e39ffd1d8e 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -378,23 +378,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
378 iface |= (1 << 9); 378 iface |= (1 << 9);
379 379
380 switch (params_rate(params)) { 380 switch (params_rate(params)) {
381 case SNDRV_PCM_RATE_8000: 381 case 8000:
382 addcntrl |= (0x5 << 1); 382 addcntrl |= (0x5 << 1);
383 break; 383 break;
384 case SNDRV_PCM_RATE_11025: 384 case 11025:
385 addcntrl |= (0x4 << 1); 385 addcntrl |= (0x4 << 1);
386 break; 386 break;
387 case SNDRV_PCM_RATE_16000: 387 case 16000:
388 addcntrl |= (0x3 << 1); 388 addcntrl |= (0x3 << 1);
389 break; 389 break;
390 case SNDRV_PCM_RATE_22050: 390 case 22050:
391 addcntrl |= (0x2 << 1); 391 addcntrl |= (0x2 << 1);
392 break; 392 break;
393 case SNDRV_PCM_RATE_32000: 393 case 32000:
394 addcntrl |= (0x1 << 1); 394 addcntrl |= (0x1 << 1);
395 break; 395 break;
396 case SNDRV_PCM_RATE_44100: 396 case 44100:
397 case SNDRV_PCM_RATE_48000: 397 case 48000:
398 break; 398 break;
399 } 399 }
400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl); 400 ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl);
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index a808675388fc..8812751da8c9 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -482,23 +482,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
482 482
483 /* filter coefficient */ 483 /* filter coefficient */
484 switch (params_rate(params)) { 484 switch (params_rate(params)) {
485 case SNDRV_PCM_RATE_8000: 485 case 8000:
486 adn |= 0x5 << 1; 486 adn |= 0x5 << 1;
487 break; 487 break;
488 case SNDRV_PCM_RATE_11025: 488 case 11025:
489 adn |= 0x4 << 1; 489 adn |= 0x4 << 1;
490 break; 490 break;
491 case SNDRV_PCM_RATE_16000: 491 case 16000:
492 adn |= 0x3 << 1; 492 adn |= 0x3 << 1;
493 break; 493 break;
494 case SNDRV_PCM_RATE_22050: 494 case 22050:
495 adn |= 0x2 << 1; 495 adn |= 0x2 << 1;
496 break; 496 break;
497 case SNDRV_PCM_RATE_32000: 497 case 32000:
498 adn |= 0x1 << 1; 498 adn |= 0x1 << 1;
499 break; 499 break;
500 case SNDRV_PCM_RATE_44100: 500 case 44100:
501 case SNDRV_PCM_RATE_48000: 501 case 48000:
502 break; 502 break;
503 } 503 }
504 504
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index c7af09729c6e..5263ab18f827 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -42,42 +42,12 @@ static struct snd_soc_device fsi_snd_devdata = {
42 .codec_dev = &soc_codec_dev_ak4642, 42 .codec_dev = &soc_codec_dev_ak4642,
43}; 43};
44 44
45#define AK4642_BUS 0
46#define AK4642_ADR 0x12
47static int ak4642_add_i2c_device(void)
48{
49 struct i2c_board_info info;
50 struct i2c_adapter *adapter;
51 struct i2c_client *client;
52
53 memset(&info, 0, sizeof(struct i2c_board_info));
54 info.addr = AK4642_ADR;
55 strlcpy(info.type, "ak4642", I2C_NAME_SIZE);
56
57 adapter = i2c_get_adapter(AK4642_BUS);
58 if (!adapter) {
59 printk(KERN_DEBUG "can't get i2c adapter\n");
60 return -ENODEV;
61 }
62
63 client = i2c_new_device(adapter, &info);
64 i2c_put_adapter(adapter);
65 if (!client) {
66 printk(KERN_DEBUG "can't add i2c device\n");
67 return -ENODEV;
68 }
69
70 return 0;
71}
72
73static struct platform_device *fsi_snd_device; 45static struct platform_device *fsi_snd_device;
74 46
75static int __init fsi_ak4642_init(void) 47static int __init fsi_ak4642_init(void)
76{ 48{
77 int ret = -ENOMEM; 49 int ret = -ENOMEM;
78 50
79 ak4642_add_i2c_device();
80
81 fsi_snd_device = platform_device_alloc("soc-audio", -1); 51 fsi_snd_device = platform_device_alloc("soc-audio", -1);
82 if (!fsi_snd_device) 52 if (!fsi_snd_device)
83 goto out; 53 goto out;
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 8f5bc1e8dabc..b2da478a0fae 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -1162,10 +1162,22 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
1162 pipe = usb_sndintpipe(umidi->dev, ep_info->out_ep); 1162 pipe = usb_sndintpipe(umidi->dev, ep_info->out_ep);
1163 else 1163 else
1164 pipe = usb_sndbulkpipe(umidi->dev, ep_info->out_ep); 1164 pipe = usb_sndbulkpipe(umidi->dev, ep_info->out_ep);
1165 if (umidi->usb_id == USB_ID(0x0a92, 0x1020)) /* ESI M4U */ 1165 switch (umidi->usb_id) {
1166 ep->max_transfer = 4; 1166 default:
1167 else
1168 ep->max_transfer = usb_maxpacket(umidi->dev, pipe, 1); 1167 ep->max_transfer = usb_maxpacket(umidi->dev, pipe, 1);
1168 break;
1169 /*
1170 * Various chips declare a packet size larger than 4 bytes, but
1171 * do not actually work with larger packets:
1172 */
1173 case USB_ID(0x0a92, 0x1020): /* ESI M4U */
1174 case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */
1175 case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */
1176 case USB_ID(0x15ca, 0x1806): /* Textech USB Midi Cable */
1177 case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */
1178 ep->max_transfer = 4;
1179 break;
1180 }
1169 for (i = 0; i < OUTPUT_URBS; ++i) { 1181 for (i = 0; i < OUTPUT_URBS; ++i) {
1170 buffer = usb_buffer_alloc(umidi->dev, 1182 buffer = usb_buffer_alloc(umidi->dev,
1171 ep->max_transfer, GFP_KERNEL, 1183 ep->max_transfer, GFP_KERNEL,