diff options
162 files changed, 6326 insertions, 2011 deletions
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 59ccc63838c1..403e7b4dcdd4 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt | |||
@@ -56,3 +56,12 @@ This file details changes in 2.6 which affect PCMCIA card driver authors: | |||
56 | memory regions in-use. The name argument should be a pointer to | 56 | memory regions in-use. The name argument should be a pointer to |
57 | your driver name. Eg, for pcnet_cs, name should point to the | 57 | your driver name. Eg, for pcnet_cs, name should point to the |
58 | string "pcnet_cs". | 58 | string "pcnet_cs". |
59 | |||
60 | * CardServices is gone | ||
61 | CardServices() in 2.4 is just a big switch statement to call various | ||
62 | services. In 2.6, all of those entry points are exported and called | ||
63 | directly (except for pcmcia_report_error(), just use cs_error() instead). | ||
64 | |||
65 | * struct pcmcia_driver | ||
66 | You need to use struct pcmcia_driver and pcmcia_{un,}register_driver | ||
67 | instead of {un,}register_pccard_driver | ||
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 104a994b8289..a18ecb92b356 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -636,11 +636,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
636 | 3stack-digout 3-jack in back, a HP out and a SPDIF out | 636 | 3stack-digout 3-jack in back, a HP out and a SPDIF out |
637 | 5stack 5-jack in back, 2-jack in front | 637 | 5stack 5-jack in back, 2-jack in front |
638 | 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out | 638 | 5stack-digout 5-jack in back, 2-jack in front, a SPDIF out |
639 | 6stack 6-jack in back, 2-jack in front | ||
640 | 6stack-digout 6-jack with a SPDIF out | ||
639 | w810 3-jack | 641 | w810 3-jack |
640 | z71v 3-jack (HP shared SPDIF) | 642 | z71v 3-jack (HP shared SPDIF) |
641 | asus 3-jack | 643 | asus 3-jack |
642 | uniwill 3-jack | 644 | uniwill 3-jack |
643 | F1734 2-jack | 645 | F1734 2-jack |
646 | test for testing/debugging purpose, almost all controls can be | ||
647 | adjusted. Appearing only when compiled with | ||
648 | $CONFIG_SND_DEBUG=y | ||
644 | 649 | ||
645 | CMI9880 | 650 | CMI9880 |
646 | minimal 3-jack in back | 651 | minimal 3-jack in back |
@@ -1054,6 +1059,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1054 | 1059 | ||
1055 | The power-management is supported. | 1060 | The power-management is supported. |
1056 | 1061 | ||
1062 | Module snd-pxa2xx-ac97 (on arm only) | ||
1063 | ------------------------------------ | ||
1064 | |||
1065 | Module for AC97 driver for the Intel PXA2xx chip | ||
1066 | |||
1067 | For ARM architecture only. | ||
1068 | |||
1057 | Module snd-rme32 | 1069 | Module snd-rme32 |
1058 | ---------------- | 1070 | ---------------- |
1059 | 1071 | ||
@@ -1173,6 +1185,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1173 | 1185 | ||
1174 | Module supports up to 8 cards. | 1186 | Module supports up to 8 cards. |
1175 | 1187 | ||
1188 | Module snd-sun-dbri (on sparc only) | ||
1189 | ----------------------------------- | ||
1190 | |||
1191 | Module for DBRI sound chips found on Sparcs. | ||
1192 | |||
1193 | Module supports up to 8 cards. | ||
1194 | |||
1176 | Module snd-wavefront | 1195 | Module snd-wavefront |
1177 | -------------------- | 1196 | -------------------- |
1178 | 1197 | ||
@@ -1371,7 +1390,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1371 | Module snd-vxpocket | 1390 | Module snd-vxpocket |
1372 | ------------------- | 1391 | ------------------- |
1373 | 1392 | ||
1374 | Module for Digigram VX-Pocket VX2 PCMCIA card. | 1393 | Module for Digigram VX-Pocket VX2 and 440 PCMCIA cards. |
1375 | 1394 | ||
1376 | ibl - Capture IBL size. (default = 0, minimum size) | 1395 | ibl - Capture IBL size. (default = 0, minimum size) |
1377 | 1396 | ||
@@ -1391,29 +1410,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1391 | 1410 | ||
1392 | Note: the driver is build only when CONFIG_ISA is set. | 1411 | Note: the driver is build only when CONFIG_ISA is set. |
1393 | 1412 | ||
1394 | Module snd-vxp440 | ||
1395 | ----------------- | ||
1396 | |||
1397 | Module for Digigram VX-Pocket 440 PCMCIA card. | ||
1398 | |||
1399 | ibl - Capture IBL size. (default = 0, minimum size) | ||
1400 | |||
1401 | Module supports up to 8 cards. The module is compiled only when | ||
1402 | PCMCIA is supported on kernel. | ||
1403 | |||
1404 | To activate the driver via the card manager, you'll need to set | ||
1405 | up /etc/pcmcia/vxp440.conf. See the sound/pcmcia/vx/vxp440.c. | ||
1406 | |||
1407 | When the driver is compiled as a module and the hotplug firmware | ||
1408 | is supported, the firmware data is loaded via hotplug automatically. | ||
1409 | Install the necessary firmware files in alsa-firmware package. | ||
1410 | When no hotplug fw loader is available, you need to load the | ||
1411 | firmware via vxloader utility in alsa-tools package. | ||
1412 | |||
1413 | About capture IBL, see the description of snd-vx222 module. | ||
1414 | |||
1415 | Note: the driver is build only when CONFIG_ISA is set. | ||
1416 | |||
1417 | Module snd-ymfpci | 1413 | Module snd-ymfpci |
1418 | ----------------- | 1414 | ----------------- |
1419 | 1415 | ||
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index b9e6be00cadf..476c0c22fbb7 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -47,7 +47,7 @@ Timing | |||
47 | notsc | 47 | notsc |
48 | Don't use the CPU time stamp counter to read the wall time. | 48 | Don't use the CPU time stamp counter to read the wall time. |
49 | This can be used to work around timing problems on multiprocessor systems | 49 | This can be used to work around timing problems on multiprocessor systems |
50 | with not properly synchronized CPUs. Only useful with a SMP kernel | 50 | with not properly synchronized CPUs. |
51 | 51 | ||
52 | report_lost_ticks | 52 | report_lost_ticks |
53 | Report when timer interrupts are lost because some code turned off | 53 | Report when timer interrupts are lost because some code turned off |
@@ -74,6 +74,9 @@ Idle loop | |||
74 | event. This will make the CPUs eat a lot more power, but may be useful | 74 | event. This will make the CPUs eat a lot more power, but may be useful |
75 | to get slightly better performance in multiprocessor benchmarks. It also | 75 | to get slightly better performance in multiprocessor benchmarks. It also |
76 | makes some profiling using performance counters more accurate. | 76 | makes some profiling using performance counters more accurate. |
77 | Please note that on systems with MONITOR/MWAIT support (like Intel EM64T | ||
78 | CPUs) this option has no performance advantage over the normal idle loop. | ||
79 | It may also interact badly with hyperthreading. | ||
77 | 80 | ||
78 | Rebooting | 81 | Rebooting |
79 | 82 | ||
@@ -178,6 +181,5 @@ Debugging | |||
178 | Misc | 181 | Misc |
179 | 182 | ||
180 | noreplacement Don't replace instructions with more appropiate ones | 183 | noreplacement Don't replace instructions with more appropiate ones |
181 | for the CPU. This may be useful on asymmetric MP systems | 184 | for the CPU. This may be useful on asymmetric MP systems |
182 | where some CPU have less capabilities than the others. | 185 | where some CPU have less capabilities than the others. |
183 | |||
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 13 | 3 | SUBLEVEL = 13 |
4 | EXTRAVERSION =-rc3 | 4 | EXTRAVERSION =-rc4 |
5 | NAME=Woozy Numbat | 5 | NAME=Woozy Numbat |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c index 1d768b263269..6c55b50cf048 100644 --- a/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/arch/i386/kernel/cpu/intel_cacheinfo.c | |||
@@ -128,7 +128,7 @@ static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le | |||
128 | cpuid_count(4, index, &eax, &ebx, &ecx, &edx); | 128 | cpuid_count(4, index, &eax, &ebx, &ecx, &edx); |
129 | cache_eax.full = eax; | 129 | cache_eax.full = eax; |
130 | if (cache_eax.split.type == CACHE_TYPE_NULL) | 130 | if (cache_eax.split.type == CACHE_TYPE_NULL) |
131 | return -1; | 131 | return -EIO; /* better error ? */ |
132 | 132 | ||
133 | this_leaf->eax.full = eax; | 133 | this_leaf->eax.full = eax; |
134 | this_leaf->ebx.full = ebx; | 134 | this_leaf->ebx.full = ebx; |
@@ -334,6 +334,7 @@ static int __devinit detect_cache_attributes(unsigned int cpu) | |||
334 | struct _cpuid4_info *this_leaf; | 334 | struct _cpuid4_info *this_leaf; |
335 | unsigned long j; | 335 | unsigned long j; |
336 | int retval; | 336 | int retval; |
337 | cpumask_t oldmask; | ||
337 | 338 | ||
338 | if (num_cache_leaves == 0) | 339 | if (num_cache_leaves == 0) |
339 | return -ENOENT; | 340 | return -ENOENT; |
@@ -345,19 +346,26 @@ static int __devinit detect_cache_attributes(unsigned int cpu) | |||
345 | memset(cpuid4_info[cpu], 0, | 346 | memset(cpuid4_info[cpu], 0, |
346 | sizeof(struct _cpuid4_info) * num_cache_leaves); | 347 | sizeof(struct _cpuid4_info) * num_cache_leaves); |
347 | 348 | ||
349 | oldmask = current->cpus_allowed; | ||
350 | retval = set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
351 | if (retval) | ||
352 | goto out; | ||
353 | |||
348 | /* Do cpuid and store the results */ | 354 | /* Do cpuid and store the results */ |
355 | retval = 0; | ||
349 | for (j = 0; j < num_cache_leaves; j++) { | 356 | for (j = 0; j < num_cache_leaves; j++) { |
350 | this_leaf = CPUID4_INFO_IDX(cpu, j); | 357 | this_leaf = CPUID4_INFO_IDX(cpu, j); |
351 | retval = cpuid4_cache_lookup(j, this_leaf); | 358 | retval = cpuid4_cache_lookup(j, this_leaf); |
352 | if (unlikely(retval < 0)) | 359 | if (unlikely(retval < 0)) |
353 | goto err_out; | 360 | break; |
354 | cache_shared_cpu_map_setup(cpu, j); | 361 | cache_shared_cpu_map_setup(cpu, j); |
355 | } | 362 | } |
356 | return 0; | 363 | set_cpus_allowed(current, oldmask); |
357 | 364 | ||
358 | err_out: | 365 | out: |
359 | free_cache_attributes(cpu); | 366 | if (retval) |
360 | return -ENOMEM; | 367 | free_cache_attributes(cpu); |
368 | return retval; | ||
361 | } | 369 | } |
362 | 370 | ||
363 | #ifdef CONFIG_SYSFS | 371 | #ifdef CONFIG_SYSFS |
diff --git a/arch/i386/kernel/numaq.c b/arch/i386/kernel/numaq.c index e51edf0a6564..5f5b075f860a 100644 --- a/arch/i386/kernel/numaq.c +++ b/arch/i386/kernel/numaq.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/nodemask.h> | 31 | #include <linux/nodemask.h> |
32 | #include <asm/numaq.h> | 32 | #include <asm/numaq.h> |
33 | #include <asm/topology.h> | 33 | #include <asm/topology.h> |
34 | #include <asm/processor.h> | ||
34 | 35 | ||
35 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) | 36 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) |
36 | 37 | ||
@@ -77,3 +78,11 @@ int __init get_memcfg_numaq(void) | |||
77 | smp_dump_qct(); | 78 | smp_dump_qct(); |
78 | return 1; | 79 | return 1; |
79 | } | 80 | } |
81 | |||
82 | static int __init numaq_dsc_disable(void) | ||
83 | { | ||
84 | printk(KERN_DEBUG "NUMAQ: disabling TSC\n"); | ||
85 | tsc_disable = 1; | ||
86 | return 0; | ||
87 | } | ||
88 | core_initcall(numaq_dsc_disable); | ||
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index 766b104ac1a1..d291fb7f1357 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c | |||
@@ -550,6 +550,13 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route | |||
550 | static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 550 | static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) |
551 | { | 551 | { |
552 | /* FIXME: We should move some of the quirk fixup stuff here */ | 552 | /* FIXME: We should move some of the quirk fixup stuff here */ |
553 | |||
554 | if (router->device == PCI_DEVICE_ID_VIA_82C686 && | ||
555 | device == PCI_DEVICE_ID_VIA_82C586_0) { | ||
556 | /* Asus k7m bios wrongly reports 82C686A as 586-compatible */ | ||
557 | device = PCI_DEVICE_ID_VIA_82C686; | ||
558 | } | ||
559 | |||
553 | switch(device) | 560 | switch(device) |
554 | { | 561 | { |
555 | case PCI_DEVICE_ID_VIA_82C586_0: | 562 | case PCI_DEVICE_ID_VIA_82C586_0: |
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile index d6c31a95b887..de17d4c6e02d 100644 --- a/arch/um/drivers/Makefile +++ b/arch/um/drivers/Makefile | |||
@@ -19,6 +19,8 @@ harddog-objs := harddog_kern.o harddog_user.o | |||
19 | 19 | ||
20 | LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) | 20 | LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) |
21 | 21 | ||
22 | targets := pcap_kern.o pcap_user.o | ||
23 | |||
22 | $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o | 24 | $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o |
23 | $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) | 25 | $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) |
24 | #XXX: The call below does not work because the flags are added before the | 26 | #XXX: The call below does not work because the flags are added before the |
@@ -26,7 +28,7 @@ $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o | |||
26 | #$(call if_changed,ld) | 28 | #$(call if_changed,ld) |
27 | 29 | ||
28 | # When the above is fixed, don't forget to add this too! | 30 | # When the above is fixed, don't forget to add this too! |
29 | #targets := $(obj)/pcap.o | 31 | #targets += $(obj)/pcap.o |
30 | 32 | ||
31 | obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o | 33 | obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o |
32 | obj-$(CONFIG_SSL) += ssl.o | 34 | obj-$(CONFIG_SSL) += ssl.o |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 404de41a4f67..c190c2414197 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -557,7 +557,7 @@ static int create_proc_mconsole(void) | |||
557 | 557 | ||
558 | ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); | 558 | ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); |
559 | if(ent == NULL){ | 559 | if(ent == NULL){ |
560 | printk("create_proc_mconsole : create_proc_entry failed\n"); | 560 | printk(KERN_INFO "create_proc_mconsole : create_proc_entry failed\n"); |
561 | return(0); | 561 | return(0); |
562 | } | 562 | } |
563 | 563 | ||
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c index 0ea87f24b36f..d21ebad666b4 100644 --- a/arch/um/kernel/exitcode.c +++ b/arch/um/kernel/exitcode.c | |||
@@ -48,7 +48,7 @@ static int make_proc_exitcode(void) | |||
48 | 48 | ||
49 | ent = create_proc_entry("exitcode", 0600, &proc_root); | 49 | ent = create_proc_entry("exitcode", 0600, &proc_root); |
50 | if(ent == NULL){ | 50 | if(ent == NULL){ |
51 | printk("make_proc_exitcode : Failed to register " | 51 | printk(KERN_WARNING "make_proc_exitcode : Failed to register " |
52 | "/proc/exitcode\n"); | 52 | "/proc/exitcode\n"); |
53 | return(0); | 53 | return(0); |
54 | } | 54 | } |
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 8b01a5584e80..67acd92c5322 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c | |||
@@ -131,7 +131,7 @@ int start_fork_tramp(void *thread_arg, unsigned long temp_stack, | |||
131 | return(arg.pid); | 131 | return(arg.pid); |
132 | } | 132 | } |
133 | 133 | ||
134 | static int ptrace_child(void) | 134 | static int ptrace_child(void *arg) |
135 | { | 135 | { |
136 | int ret; | 136 | int ret; |
137 | int pid = os_getpid(), ppid = getppid(); | 137 | int pid = os_getpid(), ppid = getppid(); |
@@ -160,16 +160,20 @@ static int ptrace_child(void) | |||
160 | _exit(ret); | 160 | _exit(ret); |
161 | } | 161 | } |
162 | 162 | ||
163 | static int start_ptraced_child(void) | 163 | static int start_ptraced_child(void **stack_out) |
164 | { | 164 | { |
165 | void *stack; | ||
166 | unsigned long sp; | ||
165 | int pid, n, status; | 167 | int pid, n, status; |
166 | 168 | ||
167 | pid = fork(); | 169 | stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, |
168 | if(pid == 0) | 170 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); |
169 | ptrace_child(); | 171 | if(stack == MAP_FAILED) |
170 | 172 | panic("check_ptrace : mmap failed, errno = %d", errno); | |
173 | sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); | ||
174 | pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL); | ||
171 | if(pid < 0) | 175 | if(pid < 0) |
172 | panic("check_ptrace : fork failed, errno = %d", errno); | 176 | panic("check_ptrace : clone failed, errno = %d", errno); |
173 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); | 177 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); |
174 | if(n < 0) | 178 | if(n < 0) |
175 | panic("check_ptrace : wait failed, errno = %d", errno); | 179 | panic("check_ptrace : wait failed, errno = %d", errno); |
@@ -177,6 +181,7 @@ static int start_ptraced_child(void) | |||
177 | panic("check_ptrace : expected SIGSTOP, got status = %d", | 181 | panic("check_ptrace : expected SIGSTOP, got status = %d", |
178 | status); | 182 | status); |
179 | 183 | ||
184 | *stack_out = stack; | ||
180 | return(pid); | 185 | return(pid); |
181 | } | 186 | } |
182 | 187 | ||
@@ -184,12 +189,12 @@ static int start_ptraced_child(void) | |||
184 | * just avoid using sysemu, not panic, but only if SYSEMU features are broken. | 189 | * just avoid using sysemu, not panic, but only if SYSEMU features are broken. |
185 | * So only for SYSEMU features we test mustpanic, while normal host features | 190 | * So only for SYSEMU features we test mustpanic, while normal host features |
186 | * must work anyway!*/ | 191 | * must work anyway!*/ |
187 | static int stop_ptraced_child(int pid, int exitcode, int mustexit) | 192 | static int stop_ptraced_child(int pid, void *stack, int exitcode, int mustpanic) |
188 | { | 193 | { |
189 | int status, n, ret = 0; | 194 | int status, n, ret = 0; |
190 | 195 | ||
191 | if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) | 196 | if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) |
192 | panic("stop_ptraced_child : ptrace failed, errno = %d", errno); | 197 | panic("check_ptrace : ptrace failed, errno = %d", errno); |
193 | CATCH_EINTR(n = waitpid(pid, &status, 0)); | 198 | CATCH_EINTR(n = waitpid(pid, &status, 0)); |
194 | if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { | 199 | if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { |
195 | int exit_with = WEXITSTATUS(status); | 200 | int exit_with = WEXITSTATUS(status); |
@@ -200,13 +205,15 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit) | |||
200 | printk("check_ptrace : child exited with exitcode %d, while " | 205 | printk("check_ptrace : child exited with exitcode %d, while " |
201 | "expecting %d; status 0x%x", exit_with, | 206 | "expecting %d; status 0x%x", exit_with, |
202 | exitcode, status); | 207 | exitcode, status); |
203 | if (mustexit) | 208 | if (mustpanic) |
204 | panic("\n"); | 209 | panic("\n"); |
205 | else | 210 | else |
206 | printk("\n"); | 211 | printk("\n"); |
207 | ret = -1; | 212 | ret = -1; |
208 | } | 213 | } |
209 | 214 | ||
215 | if(munmap(stack, PAGE_SIZE) < 0) | ||
216 | panic("check_ptrace : munmap failed, errno = %d", errno); | ||
210 | return ret; | 217 | return ret; |
211 | } | 218 | } |
212 | 219 | ||
@@ -242,11 +249,12 @@ __uml_setup("nosysemu", nosysemu_cmd_param, | |||
242 | 249 | ||
243 | static void __init check_sysemu(void) | 250 | static void __init check_sysemu(void) |
244 | { | 251 | { |
252 | void *stack; | ||
245 | int pid, syscall, n, status, count=0; | 253 | int pid, syscall, n, status, count=0; |
246 | 254 | ||
247 | printk("Checking syscall emulation patch for ptrace..."); | 255 | printk("Checking syscall emulation patch for ptrace..."); |
248 | sysemu_supported = 0; | 256 | sysemu_supported = 0; |
249 | pid = start_ptraced_child(); | 257 | pid = start_ptraced_child(&stack); |
250 | 258 | ||
251 | if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) | 259 | if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) |
252 | goto fail; | 260 | goto fail; |
@@ -264,7 +272,7 @@ static void __init check_sysemu(void) | |||
264 | panic("check_sysemu : failed to modify system " | 272 | panic("check_sysemu : failed to modify system " |
265 | "call return, errno = %d", errno); | 273 | "call return, errno = %d", errno); |
266 | 274 | ||
267 | if (stop_ptraced_child(pid, 0, 0) < 0) | 275 | if (stop_ptraced_child(pid, stack, 0, 0) < 0) |
268 | goto fail_stopped; | 276 | goto fail_stopped; |
269 | 277 | ||
270 | sysemu_supported = 1; | 278 | sysemu_supported = 1; |
@@ -272,7 +280,7 @@ static void __init check_sysemu(void) | |||
272 | set_using_sysemu(!force_sysemu_disabled); | 280 | set_using_sysemu(!force_sysemu_disabled); |
273 | 281 | ||
274 | printk("Checking advanced syscall emulation patch for ptrace..."); | 282 | printk("Checking advanced syscall emulation patch for ptrace..."); |
275 | pid = start_ptraced_child(); | 283 | pid = start_ptraced_child(&stack); |
276 | while(1){ | 284 | while(1){ |
277 | count++; | 285 | count++; |
278 | if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) | 286 | if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) |
@@ -297,7 +305,7 @@ static void __init check_sysemu(void) | |||
297 | break; | 305 | break; |
298 | } | 306 | } |
299 | } | 307 | } |
300 | if (stop_ptraced_child(pid, 0, 0) < 0) | 308 | if (stop_ptraced_child(pid, stack, 0, 0) < 0) |
301 | goto fail_stopped; | 309 | goto fail_stopped; |
302 | 310 | ||
303 | sysemu_supported = 2; | 311 | sysemu_supported = 2; |
@@ -308,17 +316,18 @@ static void __init check_sysemu(void) | |||
308 | return; | 316 | return; |
309 | 317 | ||
310 | fail: | 318 | fail: |
311 | stop_ptraced_child(pid, 1, 0); | 319 | stop_ptraced_child(pid, stack, 1, 0); |
312 | fail_stopped: | 320 | fail_stopped: |
313 | printk("missing\n"); | 321 | printk("missing\n"); |
314 | } | 322 | } |
315 | 323 | ||
316 | void __init check_ptrace(void) | 324 | void __init check_ptrace(void) |
317 | { | 325 | { |
326 | void *stack; | ||
318 | int pid, syscall, n, status; | 327 | int pid, syscall, n, status; |
319 | 328 | ||
320 | printk("Checking that ptrace can change system call numbers..."); | 329 | printk("Checking that ptrace can change system call numbers..."); |
321 | pid = start_ptraced_child(); | 330 | pid = start_ptraced_child(&stack); |
322 | 331 | ||
323 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) | 332 | if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) |
324 | panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno); | 333 | panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno); |
@@ -345,7 +354,7 @@ void __init check_ptrace(void) | |||
345 | break; | 354 | break; |
346 | } | 355 | } |
347 | } | 356 | } |
348 | stop_ptraced_child(pid, 0, 1); | 357 | stop_ptraced_child(pid, stack, 0, 1); |
349 | printk("OK\n"); | 358 | printk("OK\n"); |
350 | check_sysemu(); | 359 | check_sysemu(); |
351 | } | 360 | } |
@@ -380,10 +389,11 @@ extern void *__syscall_stub_start, __syscall_stub_end; | |||
380 | static inline void check_skas3_ptrace_support(void) | 389 | static inline void check_skas3_ptrace_support(void) |
381 | { | 390 | { |
382 | struct ptrace_faultinfo fi; | 391 | struct ptrace_faultinfo fi; |
392 | void *stack; | ||
383 | int pid, n; | 393 | int pid, n; |
384 | 394 | ||
385 | printf("Checking for the skas3 patch in the host..."); | 395 | printf("Checking for the skas3 patch in the host..."); |
386 | pid = start_ptraced_child(); | 396 | pid = start_ptraced_child(&stack); |
387 | 397 | ||
388 | n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); | 398 | n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); |
389 | if (n < 0) { | 399 | if (n < 0) { |
@@ -402,7 +412,7 @@ static inline void check_skas3_ptrace_support(void) | |||
402 | } | 412 | } |
403 | 413 | ||
404 | init_registers(pid); | 414 | init_registers(pid); |
405 | stop_ptraced_child(pid, 1, 1); | 415 | stop_ptraced_child(pid, stack, 1, 1); |
406 | } | 416 | } |
407 | 417 | ||
408 | int can_do_skas(void) | 418 | int can_do_skas(void) |
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index d4036ed680bc..c23d8a08d0ff 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c | |||
@@ -412,7 +412,7 @@ int __init make_proc_sysemu(void) | |||
412 | 412 | ||
413 | if (ent == NULL) | 413 | if (ent == NULL) |
414 | { | 414 | { |
415 | printk("Failed to register /proc/sysemu\n"); | 415 | printk(KERN_WARNING "Failed to register /proc/sysemu\n"); |
416 | return(0); | 416 | return(0); |
417 | } | 417 | } |
418 | 418 | ||
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index ba671dab8878..6dd9e5bf18ed 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -64,7 +64,7 @@ void wait_stub_done(int pid, int sig, char * fname) | |||
64 | (WSTOPSIG(status) == SIGVTALRM)); | 64 | (WSTOPSIG(status) == SIGVTALRM)); |
65 | 65 | ||
66 | if((n < 0) || !WIFSTOPPED(status) || | 66 | if((n < 0) || !WIFSTOPPED(status) || |
67 | (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status != SIGTRAP))){ | 67 | (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ |
68 | panic("%s : failed to wait for SIGUSR1/SIGTRAP, " | 68 | panic("%s : failed to wait for SIGUSR1/SIGTRAP, " |
69 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", | 69 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", |
70 | fname, pid, n, errno, status); | 70 | fname, pid, n, errno, status); |
diff --git a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c index 0dee1d95c806..9950a6716fe5 100644 --- a/arch/um/kernel/skas/trap_user.c +++ b/arch/um/kernel/skas/trap_user.c | |||
@@ -58,7 +58,6 @@ void user_signal(int sig, union uml_pt_regs *regs, int pid) | |||
58 | int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || | 58 | int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || |
59 | (sig == SIGILL) || (sig == SIGTRAP)); | 59 | (sig == SIGILL) || (sig == SIGTRAP)); |
60 | 60 | ||
61 | regs->skas.is_user = 1; | ||
62 | if (segv) | 61 | if (segv) |
63 | get_skas_faultinfo(pid, ®s->skas.faultinfo); | 62 | get_skas_faultinfo(pid, ®s->skas.faultinfo); |
64 | info = &sig_info[sig]; | 63 | info = &sig_info[sig]; |
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c index a8b4ef601f59..4e08f7545d63 100644 --- a/arch/um/kernel/time_kern.c +++ b/arch/um/kernel/time_kern.c | |||
@@ -137,7 +137,10 @@ long um_stime(int __user *tptr) | |||
137 | void timer_handler(int sig, union uml_pt_regs *regs) | 137 | void timer_handler(int sig, union uml_pt_regs *regs) |
138 | { | 138 | { |
139 | local_irq_disable(); | 139 | local_irq_disable(); |
140 | update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), (regs)->skas.is_user)); | 140 | irq_enter(); |
141 | update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), | ||
142 | (regs)->skas.is_user)); | ||
143 | irq_exit(); | ||
141 | local_irq_enable(); | 144 | local_irq_enable(); |
142 | if(current_thread->cpu == 0) | 145 | if(current_thread->cpu == 0) |
143 | timer_irq(regs); | 146 | timer_irq(regs); |
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c index 75d7af9ae1d2..56d3f870926b 100644 --- a/arch/um/os-Linux/user_syms.c +++ b/arch/um/os-Linux/user_syms.c | |||
@@ -83,6 +83,9 @@ EXPORT_SYMBOL_PROTO(statfs64); | |||
83 | 83 | ||
84 | EXPORT_SYMBOL_PROTO(getuid); | 84 | EXPORT_SYMBOL_PROTO(getuid); |
85 | 85 | ||
86 | EXPORT_SYMBOL_PROTO(fsync); | ||
87 | EXPORT_SYMBOL_PROTO(fdatasync); | ||
88 | |||
86 | /* | 89 | /* |
87 | * Overrides for Emacs so that we follow Linus's tabbing style. | 90 | * Overrides for Emacs so that we follow Linus's tabbing style. |
88 | * Emacs will notice this stuff at the end of the file and automatically | 91 | * Emacs will notice this stuff at the end of the file and automatically |
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c index b251442ad0b1..68aeabe3a654 100644 --- a/arch/um/sys-i386/stub_segv.c +++ b/arch/um/sys-i386/stub_segv.c | |||
@@ -21,10 +21,10 @@ stub_segv_handler(int sig) | |||
21 | __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid)); | 21 | __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid)); |
22 | __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;" | 22 | __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;" |
23 | "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1)); | 23 | "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1)); |
24 | /* Pop the frame pointer and return address since we need to leave | 24 | /* Load pointer to sigcontext into esp, since we need to leave |
25 | * the stack in its original form when we do the sigreturn here, by | 25 | * the stack in its original form when we do the sigreturn here, by |
26 | * hand. | 26 | * hand. |
27 | */ | 27 | */ |
28 | __asm__("popl %%eax ; popl %%eax ; popl %%eax ; movl %0, %%eax ; " | 28 | __asm__("mov %0,%%esp ; movl %1, %%eax ; " |
29 | "int $0x80" : : "g" (__NR_sigreturn)); | 29 | "int $0x80" : : "a" (sc), "g" (__NR_sigreturn)); |
30 | } | 30 | } |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 4b8326177c52..660a03a89e66 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -329,12 +329,15 @@ config HPET_EMULATE_RTC | |||
329 | 329 | ||
330 | config GART_IOMMU | 330 | config GART_IOMMU |
331 | bool "IOMMU support" | 331 | bool "IOMMU support" |
332 | default y | ||
332 | depends on PCI | 333 | depends on PCI |
333 | help | 334 | help |
334 | Support the K8 IOMMU. Needed to run systems with more than 4GB of memory | 335 | Support the IOMMU. Needed to run systems with more than 3GB of memory |
335 | properly with 32-bit PCI devices that do not support DAC (Double Address | 336 | properly with 32-bit PCI devices that do not support DAC (Double Address |
336 | Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. | 337 | Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. |
337 | Normally the kernel will take the right choice by itself. | 338 | Normally the kernel will take the right choice by itself. |
339 | This option includes a driver for the AMD Opteron/Athlon64 IOMMU | ||
340 | and a software emulation used on some other systems. | ||
338 | If unsure, say Y. | 341 | If unsure, say Y. |
339 | 342 | ||
340 | # need this always enabled with GART_IOMMU for the VIA workaround | 343 | # need this always enabled with GART_IOMMU for the VIA workaround |
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 428915697675..4c6ed96d5f7c 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile | |||
@@ -21,18 +21,6 @@ | |||
21 | # | 21 | # |
22 | # $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ | 22 | # $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ |
23 | 23 | ||
24 | # | ||
25 | # early bootup linking needs 32bit. You can either use real 32bit tools | ||
26 | # here or 64bit tools in 32bit mode. | ||
27 | # | ||
28 | IA32_CC := $(CC) $(CPPFLAGS) -m32 -O2 -fomit-frame-pointer | ||
29 | IA32_LD := $(LD) -m elf_i386 | ||
30 | IA32_AS := $(CC) $(AFLAGS) -m32 -Wa,--32 -traditional -c | ||
31 | IA32_OBJCOPY := $(CROSS_COMPILE)objcopy | ||
32 | IA32_CPP := $(CROSS_COMPILE)gcc -m32 -E | ||
33 | export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP | ||
34 | |||
35 | |||
36 | LDFLAGS := -m elf_x86_64 | 24 | LDFLAGS := -m elf_x86_64 |
37 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 25 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
38 | LDFLAGS_vmlinux := | 26 | LDFLAGS_vmlinux := |
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig index 569595b74c7c..776f3c866b70 100644 --- a/arch/x86_64/defconfig +++ b/arch/x86_64/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.12-rc4 | 3 | # Linux kernel version: 2.6.13-rc3 |
4 | # Fri May 13 06:39:11 2005 | 4 | # Fri Jul 22 16:47:31 2005 |
5 | # | 5 | # |
6 | CONFIG_X86_64=y | 6 | CONFIG_X86_64=y |
7 | CONFIG_64BIT=y | 7 | CONFIG_64BIT=y |
@@ -84,14 +84,27 @@ CONFIG_X86_IO_APIC=y | |||
84 | CONFIG_X86_LOCAL_APIC=y | 84 | CONFIG_X86_LOCAL_APIC=y |
85 | CONFIG_MTRR=y | 85 | CONFIG_MTRR=y |
86 | CONFIG_SMP=y | 86 | CONFIG_SMP=y |
87 | # CONFIG_PREEMPT is not set | ||
88 | CONFIG_SCHED_SMT=y | 87 | CONFIG_SCHED_SMT=y |
88 | CONFIG_PREEMPT_NONE=y | ||
89 | # CONFIG_PREEMPT_VOLUNTARY is not set | ||
90 | # CONFIG_PREEMPT is not set | ||
91 | CONFIG_PREEMPT_BKL=y | ||
89 | CONFIG_K8_NUMA=y | 92 | CONFIG_K8_NUMA=y |
90 | # CONFIG_NUMA_EMU is not set | 93 | # CONFIG_NUMA_EMU is not set |
91 | CONFIG_DISCONTIGMEM=y | 94 | CONFIG_ARCH_DISCONTIGMEM_ENABLE=y |
92 | CONFIG_NUMA=y | 95 | CONFIG_NUMA=y |
96 | CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y | ||
97 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | ||
98 | CONFIG_SELECT_MEMORY_MODEL=y | ||
99 | # CONFIG_FLATMEM_MANUAL is not set | ||
100 | CONFIG_DISCONTIGMEM_MANUAL=y | ||
101 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
102 | CONFIG_DISCONTIGMEM=y | ||
103 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
104 | CONFIG_NEED_MULTIPLE_NODES=y | ||
105 | CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y | ||
93 | CONFIG_HAVE_DEC_LOCK=y | 106 | CONFIG_HAVE_DEC_LOCK=y |
94 | CONFIG_NR_CPUS=8 | 107 | CONFIG_NR_CPUS=32 |
95 | CONFIG_HPET_TIMER=y | 108 | CONFIG_HPET_TIMER=y |
96 | CONFIG_X86_PM_TIMER=y | 109 | CONFIG_X86_PM_TIMER=y |
97 | CONFIG_HPET_EMULATE_RTC=y | 110 | CONFIG_HPET_EMULATE_RTC=y |
@@ -99,7 +112,13 @@ CONFIG_GART_IOMMU=y | |||
99 | CONFIG_SWIOTLB=y | 112 | CONFIG_SWIOTLB=y |
100 | CONFIG_X86_MCE=y | 113 | CONFIG_X86_MCE=y |
101 | CONFIG_X86_MCE_INTEL=y | 114 | CONFIG_X86_MCE_INTEL=y |
115 | CONFIG_PHYSICAL_START=0x100000 | ||
116 | # CONFIG_KEXEC is not set | ||
102 | CONFIG_SECCOMP=y | 117 | CONFIG_SECCOMP=y |
118 | # CONFIG_HZ_100 is not set | ||
119 | CONFIG_HZ_250=y | ||
120 | # CONFIG_HZ_1000 is not set | ||
121 | CONFIG_HZ=250 | ||
103 | CONFIG_GENERIC_HARDIRQS=y | 122 | CONFIG_GENERIC_HARDIRQS=y |
104 | CONFIG_GENERIC_IRQ_PROBE=y | 123 | CONFIG_GENERIC_IRQ_PROBE=y |
105 | CONFIG_ISA_DMA_API=y | 124 | CONFIG_ISA_DMA_API=y |
@@ -118,12 +137,11 @@ CONFIG_PM_STD_PARTITION="" | |||
118 | CONFIG_ACPI=y | 137 | CONFIG_ACPI=y |
119 | CONFIG_ACPI_BOOT=y | 138 | CONFIG_ACPI_BOOT=y |
120 | CONFIG_ACPI_INTERPRETER=y | 139 | CONFIG_ACPI_INTERPRETER=y |
121 | CONFIG_ACPI_SLEEP=y | ||
122 | CONFIG_ACPI_SLEEP_PROC_FS=y | ||
123 | CONFIG_ACPI_AC=y | 140 | CONFIG_ACPI_AC=y |
124 | CONFIG_ACPI_BATTERY=y | 141 | CONFIG_ACPI_BATTERY=y |
125 | CONFIG_ACPI_BUTTON=y | 142 | CONFIG_ACPI_BUTTON=y |
126 | # CONFIG_ACPI_VIDEO is not set | 143 | # CONFIG_ACPI_VIDEO is not set |
144 | CONFIG_ACPI_HOTKEY=m | ||
127 | CONFIG_ACPI_FAN=y | 145 | CONFIG_ACPI_FAN=y |
128 | CONFIG_ACPI_PROCESSOR=y | 146 | CONFIG_ACPI_PROCESSOR=y |
129 | CONFIG_ACPI_THERMAL=y | 147 | CONFIG_ACPI_THERMAL=y |
@@ -154,6 +172,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y | |||
154 | # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set | 172 | # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set |
155 | CONFIG_CPU_FREQ_GOV_USERSPACE=y | 173 | CONFIG_CPU_FREQ_GOV_USERSPACE=y |
156 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y | 174 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y |
175 | # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set | ||
157 | 176 | ||
158 | # | 177 | # |
159 | # CPUFreq processor drivers | 178 | # CPUFreq processor drivers |
@@ -204,6 +223,76 @@ CONFIG_SYSVIPC_COMPAT=y | |||
204 | CONFIG_UID16=y | 223 | CONFIG_UID16=y |
205 | 224 | ||
206 | # | 225 | # |
226 | # Networking | ||
227 | # | ||
228 | CONFIG_NET=y | ||
229 | |||
230 | # | ||
231 | # Networking options | ||
232 | # | ||
233 | CONFIG_PACKET=y | ||
234 | # CONFIG_PACKET_MMAP is not set | ||
235 | CONFIG_UNIX=y | ||
236 | # CONFIG_NET_KEY is not set | ||
237 | CONFIG_INET=y | ||
238 | CONFIG_IP_MULTICAST=y | ||
239 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
240 | CONFIG_IP_FIB_HASH=y | ||
241 | # CONFIG_IP_PNP is not set | ||
242 | # CONFIG_NET_IPIP is not set | ||
243 | # CONFIG_NET_IPGRE is not set | ||
244 | # CONFIG_IP_MROUTE is not set | ||
245 | # CONFIG_ARPD is not set | ||
246 | # CONFIG_SYN_COOKIES is not set | ||
247 | # CONFIG_INET_AH is not set | ||
248 | # CONFIG_INET_ESP is not set | ||
249 | # CONFIG_INET_IPCOMP is not set | ||
250 | # CONFIG_INET_TUNNEL is not set | ||
251 | CONFIG_IP_TCPDIAG=y | ||
252 | CONFIG_IP_TCPDIAG_IPV6=y | ||
253 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
254 | CONFIG_TCP_CONG_BIC=y | ||
255 | CONFIG_IPV6=y | ||
256 | # CONFIG_IPV6_PRIVACY is not set | ||
257 | # CONFIG_INET6_AH is not set | ||
258 | # CONFIG_INET6_ESP is not set | ||
259 | # CONFIG_INET6_IPCOMP is not set | ||
260 | # CONFIG_INET6_TUNNEL is not set | ||
261 | # CONFIG_IPV6_TUNNEL is not set | ||
262 | # CONFIG_NETFILTER is not set | ||
263 | |||
264 | # | ||
265 | # SCTP Configuration (EXPERIMENTAL) | ||
266 | # | ||
267 | # CONFIG_IP_SCTP is not set | ||
268 | # CONFIG_ATM is not set | ||
269 | # CONFIG_BRIDGE is not set | ||
270 | # CONFIG_VLAN_8021Q is not set | ||
271 | # CONFIG_DECNET is not set | ||
272 | # CONFIG_LLC2 is not set | ||
273 | # CONFIG_IPX is not set | ||
274 | # CONFIG_ATALK is not set | ||
275 | # CONFIG_X25 is not set | ||
276 | # CONFIG_LAPB is not set | ||
277 | # CONFIG_NET_DIVERT is not set | ||
278 | # CONFIG_ECONET is not set | ||
279 | # CONFIG_WAN_ROUTER is not set | ||
280 | # CONFIG_NET_SCHED is not set | ||
281 | # CONFIG_NET_CLS_ROUTE is not set | ||
282 | |||
283 | # | ||
284 | # Network testing | ||
285 | # | ||
286 | # CONFIG_NET_PKTGEN is not set | ||
287 | CONFIG_NETPOLL=y | ||
288 | # CONFIG_NETPOLL_RX is not set | ||
289 | # CONFIG_NETPOLL_TRAP is not set | ||
290 | CONFIG_NET_POLL_CONTROLLER=y | ||
291 | # CONFIG_HAMRADIO is not set | ||
292 | # CONFIG_IRDA is not set | ||
293 | # CONFIG_BT is not set | ||
294 | |||
295 | # | ||
207 | # Device Drivers | 296 | # Device Drivers |
208 | # | 297 | # |
209 | 298 | ||
@@ -308,6 +397,7 @@ CONFIG_BLK_DEV_AMD74XX=y | |||
308 | # CONFIG_BLK_DEV_HPT366 is not set | 397 | # CONFIG_BLK_DEV_HPT366 is not set |
309 | # CONFIG_BLK_DEV_SC1200 is not set | 398 | # CONFIG_BLK_DEV_SC1200 is not set |
310 | CONFIG_BLK_DEV_PIIX=y | 399 | CONFIG_BLK_DEV_PIIX=y |
400 | # CONFIG_BLK_DEV_IT821X is not set | ||
311 | # CONFIG_BLK_DEV_NS87415 is not set | 401 | # CONFIG_BLK_DEV_NS87415 is not set |
312 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set | 402 | # CONFIG_BLK_DEV_PDC202XX_OLD is not set |
313 | CONFIG_BLK_DEV_PDC202XX_NEW=y | 403 | CONFIG_BLK_DEV_PDC202XX_NEW=y |
@@ -338,6 +428,7 @@ CONFIG_BLK_DEV_SD=y | |||
338 | # CONFIG_CHR_DEV_OSST is not set | 428 | # CONFIG_CHR_DEV_OSST is not set |
339 | # CONFIG_BLK_DEV_SR is not set | 429 | # CONFIG_BLK_DEV_SR is not set |
340 | # CONFIG_CHR_DEV_SG is not set | 430 | # CONFIG_CHR_DEV_SG is not set |
431 | # CONFIG_CHR_DEV_SCH is not set | ||
341 | 432 | ||
342 | # | 433 | # |
343 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | 434 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs |
@@ -372,7 +463,6 @@ CONFIG_AIC79XX_DEBUG_MASK=0 | |||
372 | # CONFIG_MEGARAID_NEWGEN is not set | 463 | # CONFIG_MEGARAID_NEWGEN is not set |
373 | # CONFIG_MEGARAID_LEGACY is not set | 464 | # CONFIG_MEGARAID_LEGACY is not set |
374 | CONFIG_SCSI_SATA=y | 465 | CONFIG_SCSI_SATA=y |
375 | # CONFIG_SCSI_SATA_AHCI is not set | ||
376 | # CONFIG_SCSI_SATA_SVW is not set | 466 | # CONFIG_SCSI_SATA_SVW is not set |
377 | CONFIG_SCSI_ATA_PIIX=y | 467 | CONFIG_SCSI_ATA_PIIX=y |
378 | # CONFIG_SCSI_SATA_NV is not set | 468 | # CONFIG_SCSI_SATA_NV is not set |
@@ -410,14 +500,21 @@ CONFIG_SCSI_QLA2XXX=y | |||
410 | # | 500 | # |
411 | # Multi-device support (RAID and LVM) | 501 | # Multi-device support (RAID and LVM) |
412 | # | 502 | # |
413 | # CONFIG_MD is not set | 503 | CONFIG_MD=y |
504 | # CONFIG_BLK_DEV_MD is not set | ||
505 | CONFIG_BLK_DEV_DM=y | ||
506 | # CONFIG_DM_CRYPT is not set | ||
507 | # CONFIG_DM_SNAPSHOT is not set | ||
508 | # CONFIG_DM_MIRROR is not set | ||
509 | # CONFIG_DM_ZERO is not set | ||
510 | # CONFIG_DM_MULTIPATH is not set | ||
414 | 511 | ||
415 | # | 512 | # |
416 | # Fusion MPT device support | 513 | # Fusion MPT device support |
417 | # | 514 | # |
418 | CONFIG_FUSION=y | 515 | # CONFIG_FUSION is not set |
419 | CONFIG_FUSION_MAX_SGE=40 | 516 | # CONFIG_FUSION_SPI is not set |
420 | # CONFIG_FUSION_CTL is not set | 517 | # CONFIG_FUSION_FC is not set |
421 | 518 | ||
422 | # | 519 | # |
423 | # IEEE 1394 (FireWire) support | 520 | # IEEE 1394 (FireWire) support |
@@ -430,75 +527,8 @@ CONFIG_FUSION_MAX_SGE=40 | |||
430 | # CONFIG_I2O is not set | 527 | # CONFIG_I2O is not set |
431 | 528 | ||
432 | # | 529 | # |
433 | # Networking support | 530 | # Network device support |
434 | # | ||
435 | CONFIG_NET=y | ||
436 | |||
437 | # | ||
438 | # Networking options | ||
439 | # | ||
440 | CONFIG_PACKET=y | ||
441 | # CONFIG_PACKET_MMAP is not set | ||
442 | CONFIG_UNIX=y | ||
443 | # CONFIG_NET_KEY is not set | ||
444 | CONFIG_INET=y | ||
445 | CONFIG_IP_MULTICAST=y | ||
446 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
447 | # CONFIG_IP_PNP is not set | ||
448 | # CONFIG_NET_IPIP is not set | ||
449 | # CONFIG_NET_IPGRE is not set | ||
450 | # CONFIG_IP_MROUTE is not set | ||
451 | # CONFIG_ARPD is not set | ||
452 | # CONFIG_SYN_COOKIES is not set | ||
453 | # CONFIG_INET_AH is not set | ||
454 | # CONFIG_INET_ESP is not set | ||
455 | # CONFIG_INET_IPCOMP is not set | ||
456 | # CONFIG_INET_TUNNEL is not set | ||
457 | CONFIG_IP_TCPDIAG=y | ||
458 | CONFIG_IP_TCPDIAG_IPV6=y | ||
459 | CONFIG_IPV6=y | ||
460 | # CONFIG_IPV6_PRIVACY is not set | ||
461 | # CONFIG_INET6_AH is not set | ||
462 | # CONFIG_INET6_ESP is not set | ||
463 | # CONFIG_INET6_IPCOMP is not set | ||
464 | # CONFIG_INET6_TUNNEL is not set | ||
465 | # CONFIG_IPV6_TUNNEL is not set | ||
466 | # CONFIG_NETFILTER is not set | ||
467 | |||
468 | # | ||
469 | # SCTP Configuration (EXPERIMENTAL) | ||
470 | # | 531 | # |
471 | # CONFIG_IP_SCTP is not set | ||
472 | # CONFIG_ATM is not set | ||
473 | # CONFIG_BRIDGE is not set | ||
474 | # CONFIG_VLAN_8021Q is not set | ||
475 | # CONFIG_DECNET is not set | ||
476 | # CONFIG_LLC2 is not set | ||
477 | # CONFIG_IPX is not set | ||
478 | # CONFIG_ATALK is not set | ||
479 | # CONFIG_X25 is not set | ||
480 | # CONFIG_LAPB is not set | ||
481 | # CONFIG_NET_DIVERT is not set | ||
482 | # CONFIG_ECONET is not set | ||
483 | # CONFIG_WAN_ROUTER is not set | ||
484 | |||
485 | # | ||
486 | # QoS and/or fair queueing | ||
487 | # | ||
488 | # CONFIG_NET_SCHED is not set | ||
489 | # CONFIG_NET_CLS_ROUTE is not set | ||
490 | |||
491 | # | ||
492 | # Network testing | ||
493 | # | ||
494 | # CONFIG_NET_PKTGEN is not set | ||
495 | CONFIG_NETPOLL=y | ||
496 | # CONFIG_NETPOLL_RX is not set | ||
497 | # CONFIG_NETPOLL_TRAP is not set | ||
498 | CONFIG_NET_POLL_CONTROLLER=y | ||
499 | # CONFIG_HAMRADIO is not set | ||
500 | # CONFIG_IRDA is not set | ||
501 | # CONFIG_BT is not set | ||
502 | CONFIG_NETDEVICES=y | 532 | CONFIG_NETDEVICES=y |
503 | # CONFIG_DUMMY is not set | 533 | # CONFIG_DUMMY is not set |
504 | # CONFIG_BONDING is not set | 534 | # CONFIG_BONDING is not set |
@@ -517,7 +547,9 @@ CONFIG_NET_ETHERNET=y | |||
517 | CONFIG_MII=y | 547 | CONFIG_MII=y |
518 | # CONFIG_HAPPYMEAL is not set | 548 | # CONFIG_HAPPYMEAL is not set |
519 | # CONFIG_SUNGEM is not set | 549 | # CONFIG_SUNGEM is not set |
520 | # CONFIG_NET_VENDOR_3COM is not set | 550 | CONFIG_NET_VENDOR_3COM=y |
551 | CONFIG_VORTEX=y | ||
552 | # CONFIG_TYPHOON is not set | ||
521 | 553 | ||
522 | # | 554 | # |
523 | # Tulip family network device support | 555 | # Tulip family network device support |
@@ -532,7 +564,7 @@ CONFIG_NET_PCI=y | |||
532 | CONFIG_FORCEDETH=y | 564 | CONFIG_FORCEDETH=y |
533 | # CONFIG_DGRS is not set | 565 | # CONFIG_DGRS is not set |
534 | # CONFIG_EEPRO100 is not set | 566 | # CONFIG_EEPRO100 is not set |
535 | # CONFIG_E100 is not set | 567 | CONFIG_E100=y |
536 | # CONFIG_FEALNX is not set | 568 | # CONFIG_FEALNX is not set |
537 | # CONFIG_NATSEMI is not set | 569 | # CONFIG_NATSEMI is not set |
538 | # CONFIG_NE2K_PCI is not set | 570 | # CONFIG_NE2K_PCI is not set |
@@ -553,14 +585,15 @@ CONFIG_8139TOO=y | |||
553 | # CONFIG_ACENIC is not set | 585 | # CONFIG_ACENIC is not set |
554 | # CONFIG_DL2K is not set | 586 | # CONFIG_DL2K is not set |
555 | CONFIG_E1000=y | 587 | CONFIG_E1000=y |
556 | # CONFIG_E1000_NAPI is not set | ||
557 | # CONFIG_NS83820 is not set | 588 | # CONFIG_NS83820 is not set |
558 | # CONFIG_HAMACHI is not set | 589 | # CONFIG_HAMACHI is not set |
559 | # CONFIG_YELLOWFIN is not set | 590 | # CONFIG_YELLOWFIN is not set |
560 | # CONFIG_R8169 is not set | 591 | # CONFIG_R8169 is not set |
592 | # CONFIG_SKGE is not set | ||
561 | # CONFIG_SK98LIN is not set | 593 | # CONFIG_SK98LIN is not set |
562 | # CONFIG_VIA_VELOCITY is not set | 594 | # CONFIG_VIA_VELOCITY is not set |
563 | CONFIG_TIGON3=y | 595 | CONFIG_TIGON3=y |
596 | # CONFIG_BNX2 is not set | ||
564 | 597 | ||
565 | # | 598 | # |
566 | # Ethernet (10000 Mbit) | 599 | # Ethernet (10000 Mbit) |
@@ -647,7 +680,6 @@ CONFIG_SERIO_I8042=y | |||
647 | CONFIG_SERIO_LIBPS2=y | 680 | CONFIG_SERIO_LIBPS2=y |
648 | # CONFIG_SERIO_RAW is not set | 681 | # CONFIG_SERIO_RAW is not set |
649 | # CONFIG_GAMEPORT is not set | 682 | # CONFIG_GAMEPORT is not set |
650 | CONFIG_SOUND_GAMEPORT=y | ||
651 | 683 | ||
652 | # | 684 | # |
653 | # Character devices | 685 | # Character devices |
@@ -716,6 +748,7 @@ CONFIG_MAX_RAW_DEVS=256 | |||
716 | # I2C support | 748 | # I2C support |
717 | # | 749 | # |
718 | # CONFIG_I2C is not set | 750 | # CONFIG_I2C is not set |
751 | # CONFIG_I2C_SENSOR is not set | ||
719 | 752 | ||
720 | # | 753 | # |
721 | # Dallas's 1-wire bus | 754 | # Dallas's 1-wire bus |
@@ -723,6 +756,12 @@ CONFIG_MAX_RAW_DEVS=256 | |||
723 | # CONFIG_W1 is not set | 756 | # CONFIG_W1 is not set |
724 | 757 | ||
725 | # | 758 | # |
759 | # Hardware Monitoring support | ||
760 | # | ||
761 | CONFIG_HWMON=y | ||
762 | # CONFIG_HWMON_DEBUG_CHIP is not set | ||
763 | |||
764 | # | ||
726 | # Misc devices | 765 | # Misc devices |
727 | # | 766 | # |
728 | # CONFIG_IBM_ASM is not set | 767 | # CONFIG_IBM_ASM is not set |
@@ -808,6 +847,7 @@ CONFIG_USB_DEVICEFS=y | |||
808 | CONFIG_USB_EHCI_HCD=y | 847 | CONFIG_USB_EHCI_HCD=y |
809 | # CONFIG_USB_EHCI_SPLIT_ISO is not set | 848 | # CONFIG_USB_EHCI_SPLIT_ISO is not set |
810 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 849 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
850 | # CONFIG_USB_ISP116X_HCD is not set | ||
811 | CONFIG_USB_OHCI_HCD=y | 851 | CONFIG_USB_OHCI_HCD=y |
812 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | 852 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set |
813 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | 853 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y |
@@ -846,12 +886,15 @@ CONFIG_USB_HIDINPUT=y | |||
846 | # CONFIG_USB_HIDDEV is not set | 886 | # CONFIG_USB_HIDDEV is not set |
847 | # CONFIG_USB_AIPTEK is not set | 887 | # CONFIG_USB_AIPTEK is not set |
848 | # CONFIG_USB_WACOM is not set | 888 | # CONFIG_USB_WACOM is not set |
889 | # CONFIG_USB_ACECAD is not set | ||
849 | # CONFIG_USB_KBTAB is not set | 890 | # CONFIG_USB_KBTAB is not set |
850 | # CONFIG_USB_POWERMATE is not set | 891 | # CONFIG_USB_POWERMATE is not set |
851 | # CONFIG_USB_MTOUCH is not set | 892 | # CONFIG_USB_MTOUCH is not set |
893 | # CONFIG_USB_ITMTOUCH is not set | ||
852 | # CONFIG_USB_EGALAX is not set | 894 | # CONFIG_USB_EGALAX is not set |
853 | # CONFIG_USB_XPAD is not set | 895 | # CONFIG_USB_XPAD is not set |
854 | # CONFIG_USB_ATI_REMOTE is not set | 896 | # CONFIG_USB_ATI_REMOTE is not set |
897 | # CONFIG_USB_KEYSPAN_REMOTE is not set | ||
855 | 898 | ||
856 | # | 899 | # |
857 | # USB Imaging devices | 900 | # USB Imaging devices |
@@ -902,10 +945,11 @@ CONFIG_USB_MON=y | |||
902 | # CONFIG_USB_PHIDGETSERVO is not set | 945 | # CONFIG_USB_PHIDGETSERVO is not set |
903 | # CONFIG_USB_IDMOUSE is not set | 946 | # CONFIG_USB_IDMOUSE is not set |
904 | # CONFIG_USB_SISUSBVGA is not set | 947 | # CONFIG_USB_SISUSBVGA is not set |
948 | # CONFIG_USB_LD is not set | ||
905 | # CONFIG_USB_TEST is not set | 949 | # CONFIG_USB_TEST is not set |
906 | 950 | ||
907 | # | 951 | # |
908 | # USB ATM/DSL drivers | 952 | # USB DSL modem support |
909 | # | 953 | # |
910 | 954 | ||
911 | # | 955 | # |
@@ -924,6 +968,10 @@ CONFIG_USB_MON=y | |||
924 | # CONFIG_INFINIBAND is not set | 968 | # CONFIG_INFINIBAND is not set |
925 | 969 | ||
926 | # | 970 | # |
971 | # SN Devices | ||
972 | # | ||
973 | |||
974 | # | ||
927 | # Firmware Drivers | 975 | # Firmware Drivers |
928 | # | 976 | # |
929 | # CONFIG_EDD is not set | 977 | # CONFIG_EDD is not set |
@@ -935,6 +983,7 @@ CONFIG_EXT2_FS=y | |||
935 | CONFIG_EXT2_FS_XATTR=y | 983 | CONFIG_EXT2_FS_XATTR=y |
936 | CONFIG_EXT2_FS_POSIX_ACL=y | 984 | CONFIG_EXT2_FS_POSIX_ACL=y |
937 | # CONFIG_EXT2_FS_SECURITY is not set | 985 | # CONFIG_EXT2_FS_SECURITY is not set |
986 | # CONFIG_EXT2_FS_XIP is not set | ||
938 | CONFIG_EXT3_FS=y | 987 | CONFIG_EXT3_FS=y |
939 | CONFIG_EXT3_FS_XATTR=y | 988 | CONFIG_EXT3_FS_XATTR=y |
940 | CONFIG_EXT3_FS_POSIX_ACL=y | 989 | CONFIG_EXT3_FS_POSIX_ACL=y |
@@ -957,6 +1006,7 @@ CONFIG_FS_POSIX_ACL=y | |||
957 | # CONFIG_XFS_FS is not set | 1006 | # CONFIG_XFS_FS is not set |
958 | # CONFIG_MINIX_FS is not set | 1007 | # CONFIG_MINIX_FS is not set |
959 | # CONFIG_ROMFS_FS is not set | 1008 | # CONFIG_ROMFS_FS is not set |
1009 | CONFIG_INOTIFY=y | ||
960 | # CONFIG_QUOTA is not set | 1010 | # CONFIG_QUOTA is not set |
961 | CONFIG_DNOTIFY=y | 1011 | CONFIG_DNOTIFY=y |
962 | CONFIG_AUTOFS_FS=y | 1012 | CONFIG_AUTOFS_FS=y |
@@ -986,7 +1036,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | |||
986 | CONFIG_PROC_FS=y | 1036 | CONFIG_PROC_FS=y |
987 | CONFIG_PROC_KCORE=y | 1037 | CONFIG_PROC_KCORE=y |
988 | CONFIG_SYSFS=y | 1038 | CONFIG_SYSFS=y |
989 | # CONFIG_DEVFS_FS is not set | ||
990 | # CONFIG_DEVPTS_FS_XATTR is not set | 1039 | # CONFIG_DEVPTS_FS_XATTR is not set |
991 | CONFIG_TMPFS=y | 1040 | CONFIG_TMPFS=y |
992 | # CONFIG_TMPFS_XATTR is not set | 1041 | # CONFIG_TMPFS_XATTR is not set |
@@ -1016,15 +1065,18 @@ CONFIG_RAMFS=y | |||
1016 | # | 1065 | # |
1017 | CONFIG_NFS_FS=y | 1066 | CONFIG_NFS_FS=y |
1018 | CONFIG_NFS_V3=y | 1067 | CONFIG_NFS_V3=y |
1068 | # CONFIG_NFS_V3_ACL is not set | ||
1019 | # CONFIG_NFS_V4 is not set | 1069 | # CONFIG_NFS_V4 is not set |
1020 | # CONFIG_NFS_DIRECTIO is not set | 1070 | # CONFIG_NFS_DIRECTIO is not set |
1021 | CONFIG_NFSD=y | 1071 | CONFIG_NFSD=y |
1022 | CONFIG_NFSD_V3=y | 1072 | CONFIG_NFSD_V3=y |
1073 | # CONFIG_NFSD_V3_ACL is not set | ||
1023 | # CONFIG_NFSD_V4 is not set | 1074 | # CONFIG_NFSD_V4 is not set |
1024 | CONFIG_NFSD_TCP=y | 1075 | CONFIG_NFSD_TCP=y |
1025 | CONFIG_LOCKD=y | 1076 | CONFIG_LOCKD=y |
1026 | CONFIG_LOCKD_V4=y | 1077 | CONFIG_LOCKD_V4=y |
1027 | CONFIG_EXPORTFS=y | 1078 | CONFIG_EXPORTFS=y |
1079 | CONFIG_NFS_COMMON=y | ||
1028 | CONFIG_SUNRPC=y | 1080 | CONFIG_SUNRPC=y |
1029 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 1081 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
1030 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 1082 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile index a12b19da4b59..f76217d8f579 100644 --- a/arch/x86_64/ia32/Makefile +++ b/arch/x86_64/ia32/Makefile | |||
@@ -4,14 +4,14 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ | 5 | obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ |
6 | ia32_signal.o tls32.o \ | 6 | ia32_signal.o tls32.o \ |
7 | ia32_binfmt.o fpu32.o ptrace32.o syscall32.o | 7 | ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o |
8 | 8 | ||
9 | sysv-$(CONFIG_SYSVIPC) := ipc32.o | 9 | sysv-$(CONFIG_SYSVIPC) := ipc32.o |
10 | obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) | 10 | obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) |
11 | 11 | ||
12 | obj-$(CONFIG_IA32_AOUT) += ia32_aout.o | 12 | obj-$(CONFIG_IA32_AOUT) += ia32_aout.o |
13 | 13 | ||
14 | $(obj)/syscall32.o: $(src)/syscall32.c \ | 14 | $(obj)/syscall32_syscall.o: \ |
15 | $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so) | 15 | $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so) |
16 | 16 | ||
17 | # Teach kbuild about targets | 17 | # Teach kbuild about targets |
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c index 816a3b89f13d..adbc5f8089e9 100644 --- a/arch/x86_64/ia32/syscall32.c +++ b/arch/x86_64/ia32/syscall32.c | |||
@@ -14,16 +14,6 @@ | |||
14 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
15 | #include <asm/ia32_unistd.h> | 15 | #include <asm/ia32_unistd.h> |
16 | 16 | ||
17 | /* 32bit VDSOs mapped into user space. */ | ||
18 | asm(".section \".init.data\",\"aw\"\n" | ||
19 | "syscall32_syscall:\n" | ||
20 | ".incbin \"arch/x86_64/ia32/vsyscall-syscall.so\"\n" | ||
21 | "syscall32_syscall_end:\n" | ||
22 | "syscall32_sysenter:\n" | ||
23 | ".incbin \"arch/x86_64/ia32/vsyscall-sysenter.so\"\n" | ||
24 | "syscall32_sysenter_end:\n" | ||
25 | ".previous"); | ||
26 | |||
27 | extern unsigned char syscall32_syscall[], syscall32_syscall_end[]; | 17 | extern unsigned char syscall32_syscall[], syscall32_syscall_end[]; |
28 | extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[]; | 18 | extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[]; |
29 | extern int sysctl_vsyscall32; | 19 | extern int sysctl_vsyscall32; |
diff --git a/arch/x86_64/ia32/syscall32_syscall.S b/arch/x86_64/ia32/syscall32_syscall.S new file mode 100644 index 000000000000..8f8271bdf135 --- /dev/null +++ b/arch/x86_64/ia32/syscall32_syscall.S | |||
@@ -0,0 +1,17 @@ | |||
1 | /* 32bit VDSOs mapped into user space. */ | ||
2 | |||
3 | .section ".init.data","aw" | ||
4 | |||
5 | .globl syscall32_syscall | ||
6 | .globl syscall32_syscall_end | ||
7 | |||
8 | syscall32_syscall: | ||
9 | .incbin "arch/x86_64/ia32/vsyscall-syscall.so" | ||
10 | syscall32_syscall_end: | ||
11 | |||
12 | .globl syscall32_sysenter | ||
13 | .globl syscall32_sysenter_end | ||
14 | |||
15 | syscall32_sysenter: | ||
16 | .incbin "arch/x86_64/ia32/vsyscall-sysenter.so" | ||
17 | syscall32_sysenter_end: | ||
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 28817490fdc6..096d470e280f 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S | |||
@@ -76,7 +76,7 @@ | |||
76 | 76 | ||
77 | .macro FAKE_STACK_FRAME child_rip | 77 | .macro FAKE_STACK_FRAME child_rip |
78 | /* push in order ss, rsp, eflags, cs, rip */ | 78 | /* push in order ss, rsp, eflags, cs, rip */ |
79 | xorq %rax, %rax | 79 | xorl %eax, %eax |
80 | pushq %rax /* ss */ | 80 | pushq %rax /* ss */ |
81 | CFI_ADJUST_CFA_OFFSET 8 | 81 | CFI_ADJUST_CFA_OFFSET 8 |
82 | pushq %rax /* rsp */ | 82 | pushq %rax /* rsp */ |
@@ -423,7 +423,7 @@ ENTRY(stub_rt_sigreturn) | |||
423 | testl $3,CS(%rdi) | 423 | testl $3,CS(%rdi) |
424 | je 1f | 424 | je 1f |
425 | swapgs | 425 | swapgs |
426 | 1: addl $1,%gs:pda_irqcount # RED-PEN should check preempt count | 426 | 1: incl %gs:pda_irqcount # RED-PEN should check preempt count |
427 | movq %gs:pda_irqstackptr,%rax | 427 | movq %gs:pda_irqstackptr,%rax |
428 | cmoveq %rax,%rsp | 428 | cmoveq %rax,%rsp |
429 | pushq %rdi # save old stack | 429 | pushq %rdi # save old stack |
@@ -436,7 +436,7 @@ ENTRY(common_interrupt) | |||
436 | ret_from_intr: | 436 | ret_from_intr: |
437 | popq %rdi | 437 | popq %rdi |
438 | cli | 438 | cli |
439 | subl $1,%gs:pda_irqcount | 439 | decl %gs:pda_irqcount |
440 | #ifdef CONFIG_DEBUG_INFO | 440 | #ifdef CONFIG_DEBUG_INFO |
441 | movq RBP(%rdi),%rbp | 441 | movq RBP(%rdi),%rbp |
442 | #endif | 442 | #endif |
@@ -494,7 +494,7 @@ retint_signal: | |||
494 | sti | 494 | sti |
495 | SAVE_REST | 495 | SAVE_REST |
496 | movq $-1,ORIG_RAX(%rsp) | 496 | movq $-1,ORIG_RAX(%rsp) |
497 | xorq %rsi,%rsi # oldset | 497 | xorl %esi,%esi # oldset |
498 | movq %rsp,%rdi # &pt_regs | 498 | movq %rsp,%rdi # &pt_regs |
499 | call do_notify_resume | 499 | call do_notify_resume |
500 | RESTORE_REST | 500 | RESTORE_REST |
@@ -752,7 +752,7 @@ child_rip: | |||
752 | movq %rsi, %rdi | 752 | movq %rsi, %rdi |
753 | call *%rax | 753 | call *%rax |
754 | # exit | 754 | # exit |
755 | xorq %rdi, %rdi | 755 | xorl %edi, %edi |
756 | call do_exit | 756 | call do_exit |
757 | 757 | ||
758 | /* | 758 | /* |
@@ -918,3 +918,15 @@ ENTRY(machine_check) | |||
918 | ENTRY(call_debug) | 918 | ENTRY(call_debug) |
919 | zeroentry do_call_debug | 919 | zeroentry do_call_debug |
920 | 920 | ||
921 | ENTRY(call_softirq) | ||
922 | movq %gs:pda_irqstackptr,%rax | ||
923 | pushq %r15 | ||
924 | movq %rsp,%r15 | ||
925 | incl %gs:pda_irqcount | ||
926 | cmove %rax,%rsp | ||
927 | call __do_softirq | ||
928 | movq %r15,%rsp | ||
929 | decl %gs:pda_irqcount | ||
930 | popq %r15 | ||
931 | ret | ||
932 | |||
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c index 69b9c25a8fc4..30c843a5efdd 100644 --- a/arch/x86_64/kernel/genapic.c +++ b/arch/x86_64/kernel/genapic.c | |||
@@ -31,6 +31,7 @@ u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; | |||
31 | 31 | ||
32 | extern struct genapic apic_cluster; | 32 | extern struct genapic apic_cluster; |
33 | extern struct genapic apic_flat; | 33 | extern struct genapic apic_flat; |
34 | extern struct genapic apic_physflat; | ||
34 | 35 | ||
35 | struct genapic *genapic = &apic_flat; | 36 | struct genapic *genapic = &apic_flat; |
36 | 37 | ||
@@ -44,12 +45,7 @@ void __init clustered_apic_check(void) | |||
44 | u8 clusters, max_cluster; | 45 | u8 clusters, max_cluster; |
45 | u8 id; | 46 | u8 id; |
46 | u8 cluster_cnt[NUM_APIC_CLUSTERS]; | 47 | u8 cluster_cnt[NUM_APIC_CLUSTERS]; |
47 | 48 | int num_cpus = 0; | |
48 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { | ||
49 | /* AMD always uses flat mode right now */ | ||
50 | genapic = &apic_flat; | ||
51 | goto print; | ||
52 | } | ||
53 | 49 | ||
54 | #if defined(CONFIG_ACPI_BUS) | 50 | #if defined(CONFIG_ACPI_BUS) |
55 | /* | 51 | /* |
@@ -64,15 +60,34 @@ void __init clustered_apic_check(void) | |||
64 | #endif | 60 | #endif |
65 | 61 | ||
66 | memset(cluster_cnt, 0, sizeof(cluster_cnt)); | 62 | memset(cluster_cnt, 0, sizeof(cluster_cnt)); |
67 | |||
68 | for (i = 0; i < NR_CPUS; i++) { | 63 | for (i = 0; i < NR_CPUS; i++) { |
69 | id = bios_cpu_apicid[i]; | 64 | id = bios_cpu_apicid[i]; |
70 | if (id != BAD_APICID) | 65 | if (id == BAD_APICID) |
71 | cluster_cnt[APIC_CLUSTERID(id)]++; | 66 | continue; |
67 | num_cpus++; | ||
68 | cluster_cnt[APIC_CLUSTERID(id)]++; | ||
72 | } | 69 | } |
73 | 70 | ||
71 | /* Don't use clustered mode on AMD platforms. */ | ||
72 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { | ||
73 | genapic = &apic_physflat; | ||
74 | #ifndef CONFIG_CPU_HOTPLUG | ||
75 | /* In the CPU hotplug case we cannot use broadcast mode | ||
76 | because that opens a race when a CPU is removed. | ||
77 | Stay at physflat mode in this case. | ||
78 | It is bad to do this unconditionally though. Once | ||
79 | we have ACPI platform support for CPU hotplug | ||
80 | we should detect hotplug capablity from ACPI tables and | ||
81 | only do this when really needed. -AK */ | ||
82 | if (num_cpus <= 8) | ||
83 | genapic = &apic_flat; | ||
84 | #endif | ||
85 | goto print; | ||
86 | } | ||
87 | |||
74 | clusters = 0; | 88 | clusters = 0; |
75 | max_cluster = 0; | 89 | max_cluster = 0; |
90 | |||
76 | for (i = 0; i < NUM_APIC_CLUSTERS; i++) { | 91 | for (i = 0; i < NUM_APIC_CLUSTERS; i++) { |
77 | if (cluster_cnt[i] > 0) { | 92 | if (cluster_cnt[i] > 0) { |
78 | ++clusters; | 93 | ++clusters; |
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c index 282846965080..adc96282a9e2 100644 --- a/arch/x86_64/kernel/genapic_flat.c +++ b/arch/x86_64/kernel/genapic_flat.c | |||
@@ -2,13 +2,11 @@ | |||
2 | * Copyright 2004 James Cleverdon, IBM. | 2 | * Copyright 2004 James Cleverdon, IBM. |
3 | * Subject to the GNU Public License, v.2 | 3 | * Subject to the GNU Public License, v.2 |
4 | * | 4 | * |
5 | * Flat APIC subarch code. Maximum 8 CPUs, logical delivery. | 5 | * Flat APIC subarch code. |
6 | * | 6 | * |
7 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | 7 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by |
8 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | 8 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and |
9 | * James Cleverdon. | 9 | * James Cleverdon. |
10 | * Ashok Raj <ashok.raj@intel.com> | ||
11 | * Removed IPI broadcast shortcut to support CPU hotplug | ||
12 | */ | 10 | */ |
13 | #include <linux/config.h> | 11 | #include <linux/config.h> |
14 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
@@ -20,47 +18,6 @@ | |||
20 | #include <asm/smp.h> | 18 | #include <asm/smp.h> |
21 | #include <asm/ipi.h> | 19 | #include <asm/ipi.h> |
22 | 20 | ||
23 | /* | ||
24 | * The following permit choosing broadcast IPI shortcut v.s sending IPI only | ||
25 | * to online cpus via the send_IPI_mask varient. | ||
26 | * The mask version is my preferred option, since it eliminates a lot of | ||
27 | * other extra code that would need to be written to cleanup intrs sent | ||
28 | * to a CPU while offline. | ||
29 | * | ||
30 | * Sending broadcast introduces lots of trouble in CPU hotplug situations. | ||
31 | * These IPI's are delivered to cpu's irrespective of their offline status | ||
32 | * and could pickup stale intr data when these CPUS are turned online. | ||
33 | * | ||
34 | * Not using broadcast is a cleaner approach IMO, but Andi Kleen disagrees with | ||
35 | * the idea of not using broadcast IPI's anymore. Hence the run time check | ||
36 | * is introduced, on his request so we can choose an alternate mechanism. | ||
37 | * | ||
38 | * Initial wacky performance tests that collect cycle counts show | ||
39 | * no increase in using mask v.s broadcast version. In fact they seem | ||
40 | * identical in terms of cycle counts. | ||
41 | * | ||
42 | * if we need to use broadcast, we need to do the following. | ||
43 | * | ||
44 | * cli; | ||
45 | * hold call_lock; | ||
46 | * clear any pending IPI, just ack and clear all pending intr | ||
47 | * set cpu_online_map; | ||
48 | * release call_lock; | ||
49 | * sti; | ||
50 | * | ||
51 | * The complicated dummy irq processing shown above is not required if | ||
52 | * we didnt sent IPI's to wrong CPU's in the first place. | ||
53 | * | ||
54 | * - Ashok Raj <ashok.raj@intel.com> | ||
55 | */ | ||
56 | #ifdef CONFIG_HOTPLUG_CPU | ||
57 | #define DEFAULT_SEND_IPI (1) | ||
58 | #else | ||
59 | #define DEFAULT_SEND_IPI (0) | ||
60 | #endif | ||
61 | |||
62 | static int no_broadcast=DEFAULT_SEND_IPI; | ||
63 | |||
64 | static cpumask_t flat_target_cpus(void) | 21 | static cpumask_t flat_target_cpus(void) |
65 | { | 22 | { |
66 | return cpu_online_map; | 23 | return cpu_online_map; |
@@ -119,37 +76,15 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector) | |||
119 | local_irq_restore(flags); | 76 | local_irq_restore(flags); |
120 | } | 77 | } |
121 | 78 | ||
122 | static inline void __local_flat_send_IPI_allbutself(int vector) | ||
123 | { | ||
124 | if (no_broadcast) { | ||
125 | cpumask_t mask = cpu_online_map; | ||
126 | int this_cpu = get_cpu(); | ||
127 | |||
128 | cpu_clear(this_cpu, mask); | ||
129 | flat_send_IPI_mask(mask, vector); | ||
130 | put_cpu(); | ||
131 | } | ||
132 | else | ||
133 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL); | ||
134 | } | ||
135 | |||
136 | static inline void __local_flat_send_IPI_all(int vector) | ||
137 | { | ||
138 | if (no_broadcast) | ||
139 | flat_send_IPI_mask(cpu_online_map, vector); | ||
140 | else | ||
141 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); | ||
142 | } | ||
143 | |||
144 | static void flat_send_IPI_allbutself(int vector) | 79 | static void flat_send_IPI_allbutself(int vector) |
145 | { | 80 | { |
146 | if (((num_online_cpus()) - 1) >= 1) | 81 | if (((num_online_cpus()) - 1) >= 1) |
147 | __local_flat_send_IPI_allbutself(vector); | 82 | __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); |
148 | } | 83 | } |
149 | 84 | ||
150 | static void flat_send_IPI_all(int vector) | 85 | static void flat_send_IPI_all(int vector) |
151 | { | 86 | { |
152 | __local_flat_send_IPI_all(vector); | 87 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); |
153 | } | 88 | } |
154 | 89 | ||
155 | static int flat_apic_id_registered(void) | 90 | static int flat_apic_id_registered(void) |
@@ -170,16 +105,6 @@ static unsigned int phys_pkg_id(int index_msb) | |||
170 | return ((ebx >> 24) & 0xFF) >> index_msb; | 105 | return ((ebx >> 24) & 0xFF) >> index_msb; |
171 | } | 106 | } |
172 | 107 | ||
173 | static __init int no_ipi_broadcast(char *str) | ||
174 | { | ||
175 | get_option(&str, &no_broadcast); | ||
176 | printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" : | ||
177 | "IPI Broadcast"); | ||
178 | return 1; | ||
179 | } | ||
180 | |||
181 | __setup("no_ipi_broadcast", no_ipi_broadcast); | ||
182 | |||
183 | struct genapic apic_flat = { | 108 | struct genapic apic_flat = { |
184 | .name = "flat", | 109 | .name = "flat", |
185 | .int_delivery_mode = dest_LowestPrio, | 110 | .int_delivery_mode = dest_LowestPrio, |
@@ -195,11 +120,62 @@ struct genapic apic_flat = { | |||
195 | .phys_pkg_id = phys_pkg_id, | 120 | .phys_pkg_id = phys_pkg_id, |
196 | }; | 121 | }; |
197 | 122 | ||
198 | static int __init print_ipi_mode(void) | 123 | /* |
124 | * Physflat mode is used when there are more than 8 CPUs on a AMD system. | ||
125 | * We cannot use logical delivery in this case because the mask | ||
126 | * overflows, so use physical mode. | ||
127 | */ | ||
128 | |||
129 | static cpumask_t physflat_target_cpus(void) | ||
130 | { | ||
131 | return cpumask_of_cpu(0); | ||
132 | } | ||
133 | |||
134 | static void physflat_send_IPI_mask(cpumask_t cpumask, int vector) | ||
135 | { | ||
136 | send_IPI_mask_sequence(cpumask, vector); | ||
137 | } | ||
138 | |||
139 | static void physflat_send_IPI_allbutself(int vector) | ||
140 | { | ||
141 | cpumask_t allbutme = cpu_online_map; | ||
142 | int me = get_cpu(); | ||
143 | cpu_clear(me, allbutme); | ||
144 | physflat_send_IPI_mask(allbutme, vector); | ||
145 | put_cpu(); | ||
146 | } | ||
147 | |||
148 | static void physflat_send_IPI_all(int vector) | ||
199 | { | 149 | { |
200 | printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : | 150 | physflat_send_IPI_mask(cpu_online_map, vector); |
201 | "Shortcut"); | ||
202 | return 0; | ||
203 | } | 151 | } |
204 | 152 | ||
205 | late_initcall(print_ipi_mode); | 153 | static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) |
154 | { | ||
155 | int cpu; | ||
156 | |||
157 | /* | ||
158 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
159 | * May as well be the first. | ||
160 | */ | ||
161 | cpu = first_cpu(cpumask); | ||
162 | if ((unsigned)cpu < NR_CPUS) | ||
163 | return x86_cpu_to_apicid[cpu]; | ||
164 | else | ||
165 | return BAD_APICID; | ||
166 | } | ||
167 | |||
168 | struct genapic apic_physflat = { | ||
169 | .name = "physical flat", | ||
170 | .int_delivery_mode = dest_LowestPrio, | ||
171 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | ||
172 | .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_LOWEST, | ||
173 | .target_cpus = physflat_target_cpus, | ||
174 | .apic_id_registered = flat_apic_id_registered, | ||
175 | .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/ | ||
176 | .send_IPI_all = physflat_send_IPI_all, | ||
177 | .send_IPI_allbutself = physflat_send_IPI_allbutself, | ||
178 | .send_IPI_mask = physflat_send_IPI_mask, | ||
179 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, | ||
180 | .phys_pkg_id = phys_pkg_id, | ||
181 | }; | ||
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S index 8d765aa77a26..98ff5eb32b9a 100644 --- a/arch/x86_64/kernel/head.S +++ b/arch/x86_64/kernel/head.S | |||
@@ -137,14 +137,14 @@ startup_64: | |||
137 | wrmsr | 137 | wrmsr |
138 | 138 | ||
139 | /* Setup cr0 */ | 139 | /* Setup cr0 */ |
140 | xorq %rax, %rax | 140 | #define CR0_PM 1 /* protected mode */ |
141 | btsq $31, %rax /* Enable paging */ | 141 | #define CR0_MP (1<<1) |
142 | btsq $0, %rax /* Enable protected mode */ | 142 | #define CR0_ET (1<<4) |
143 | btsq $1, %rax /* Enable MP */ | 143 | #define CR0_NE (1<<5) |
144 | btsq $4, %rax /* Enable ET */ | 144 | #define CR0_WP (1<<16) |
145 | btsq $5, %rax /* Enable NE */ | 145 | #define CR0_AM (1<<18) |
146 | btsq $16, %rax /* Enable WP */ | 146 | #define CR0_PAGING (1<<31) |
147 | btsq $18, %rax /* Enable AM */ | 147 | movl $CR0_PM|CR0_MP|CR0_ET|CR0_NE|CR0_WP|CR0_AM|CR0_PAGING,%eax |
148 | /* Make changes effective */ | 148 | /* Make changes effective */ |
149 | movq %rax, %cr0 | 149 | movq %rax, %cr0 |
150 | 150 | ||
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c index cc3fb85f5145..849a20aec7ca 100644 --- a/arch/x86_64/kernel/irq.c +++ b/arch/x86_64/kernel/irq.c | |||
@@ -135,3 +135,22 @@ void fixup_irqs(cpumask_t map) | |||
135 | local_irq_disable(); | 135 | local_irq_disable(); |
136 | } | 136 | } |
137 | #endif | 137 | #endif |
138 | |||
139 | extern void call_softirq(void); | ||
140 | |||
141 | asmlinkage void do_softirq(void) | ||
142 | { | ||
143 | __u32 pending; | ||
144 | unsigned long flags; | ||
145 | |||
146 | if (in_interrupt()) | ||
147 | return; | ||
148 | |||
149 | local_irq_save(flags); | ||
150 | pending = local_softirq_pending(); | ||
151 | /* Switch to interrupt stack */ | ||
152 | if (pending) | ||
153 | call_softirq(); | ||
154 | local_irq_restore(flags); | ||
155 | } | ||
156 | EXPORT_SYMBOL(do_softirq); | ||
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index 21e70625a495..3b267c91bb0c 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/sysdev.h> | 15 | #include <linux/sysdev.h> |
16 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/cpu.h> | ||
19 | #include <linux/percpu.h> | ||
18 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
19 | #include <asm/msr.h> | 21 | #include <asm/msr.h> |
20 | #include <asm/mce.h> | 22 | #include <asm/mce.h> |
@@ -514,10 +516,7 @@ static struct sysdev_class mce_sysclass = { | |||
514 | set_kset_name("machinecheck"), | 516 | set_kset_name("machinecheck"), |
515 | }; | 517 | }; |
516 | 518 | ||
517 | static struct sys_device device_mce = { | 519 | static DEFINE_PER_CPU(struct sys_device, device_mce); |
518 | .id = 0, | ||
519 | .cls = &mce_sysclass, | ||
520 | }; | ||
521 | 520 | ||
522 | /* Why are there no generic functions for this? */ | 521 | /* Why are there no generic functions for this? */ |
523 | #define ACCESSOR(name, var, start) \ | 522 | #define ACCESSOR(name, var, start) \ |
@@ -542,27 +541,83 @@ ACCESSOR(bank4ctl,bank[4],mce_restart()) | |||
542 | ACCESSOR(tolerant,tolerant,) | 541 | ACCESSOR(tolerant,tolerant,) |
543 | ACCESSOR(check_interval,check_interval,mce_restart()) | 542 | ACCESSOR(check_interval,check_interval,mce_restart()) |
544 | 543 | ||
545 | static __cpuinit int mce_init_device(void) | 544 | /* Per cpu sysdev init. All of the cpus still share the same ctl bank */ |
545 | static __cpuinit int mce_create_device(unsigned int cpu) | ||
546 | { | 546 | { |
547 | int err; | 547 | int err; |
548 | if (!mce_available(&cpu_data[cpu])) | ||
549 | return -EIO; | ||
550 | |||
551 | per_cpu(device_mce,cpu).id = cpu; | ||
552 | per_cpu(device_mce,cpu).cls = &mce_sysclass; | ||
553 | |||
554 | err = sysdev_register(&per_cpu(device_mce,cpu)); | ||
555 | |||
556 | if (!err) { | ||
557 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl); | ||
558 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl); | ||
559 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl); | ||
560 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl); | ||
561 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl); | ||
562 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant); | ||
563 | sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval); | ||
564 | } | ||
565 | return err; | ||
566 | } | ||
567 | |||
568 | #ifdef CONFIG_HOTPLUG_CPU | ||
569 | static __cpuinit void mce_remove_device(unsigned int cpu) | ||
570 | { | ||
571 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl); | ||
572 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl); | ||
573 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl); | ||
574 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl); | ||
575 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl); | ||
576 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant); | ||
577 | sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval); | ||
578 | sysdev_unregister(&per_cpu(device_mce,cpu)); | ||
579 | } | ||
580 | #endif | ||
581 | |||
582 | /* Get notified when a cpu comes on/off. Be hotplug friendly. */ | ||
583 | static __cpuinit int | ||
584 | mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | ||
585 | { | ||
586 | unsigned int cpu = (unsigned long)hcpu; | ||
587 | |||
588 | switch (action) { | ||
589 | case CPU_ONLINE: | ||
590 | mce_create_device(cpu); | ||
591 | break; | ||
592 | #ifdef CONFIG_HOTPLUG_CPU | ||
593 | case CPU_DEAD: | ||
594 | mce_remove_device(cpu); | ||
595 | break; | ||
596 | #endif | ||
597 | } | ||
598 | return NOTIFY_OK; | ||
599 | } | ||
600 | |||
601 | static struct notifier_block mce_cpu_notifier = { | ||
602 | .notifier_call = mce_cpu_callback, | ||
603 | }; | ||
604 | |||
605 | static __init int mce_init_device(void) | ||
606 | { | ||
607 | int err; | ||
608 | int i = 0; | ||
609 | |||
548 | if (!mce_available(&boot_cpu_data)) | 610 | if (!mce_available(&boot_cpu_data)) |
549 | return -EIO; | 611 | return -EIO; |
550 | err = sysdev_class_register(&mce_sysclass); | 612 | err = sysdev_class_register(&mce_sysclass); |
551 | if (!err) | 613 | |
552 | err = sysdev_register(&device_mce); | 614 | for_each_online_cpu(i) { |
553 | if (!err) { | 615 | mce_create_device(i); |
554 | /* could create per CPU objects, but it is not worth it. */ | 616 | } |
555 | sysdev_create_file(&device_mce, &attr_bank0ctl); | 617 | |
556 | sysdev_create_file(&device_mce, &attr_bank1ctl); | 618 | register_cpu_notifier(&mce_cpu_notifier); |
557 | sysdev_create_file(&device_mce, &attr_bank2ctl); | ||
558 | sysdev_create_file(&device_mce, &attr_bank3ctl); | ||
559 | sysdev_create_file(&device_mce, &attr_bank4ctl); | ||
560 | sysdev_create_file(&device_mce, &attr_tolerant); | ||
561 | sysdev_create_file(&device_mce, &attr_check_interval); | ||
562 | } | ||
563 | |||
564 | misc_register(&mce_log_device); | 619 | misc_register(&mce_log_device); |
565 | return err; | 620 | return err; |
566 | |||
567 | } | 621 | } |
622 | |||
568 | device_initcall(mce_init_device); | 623 | device_initcall(mce_init_device); |
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 9c5aa2a790c7..08abf9f5b159 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c | |||
@@ -109,7 +109,7 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
109 | 109 | ||
110 | static void __init MP_processor_info (struct mpc_config_processor *m) | 110 | static void __init MP_processor_info (struct mpc_config_processor *m) |
111 | { | 111 | { |
112 | int ver; | 112 | int ver, cpu; |
113 | static int found_bsp=0; | 113 | static int found_bsp=0; |
114 | 114 | ||
115 | if (!(m->mpc_cpuflag & CPU_ENABLED)) | 115 | if (!(m->mpc_cpuflag & CPU_ENABLED)) |
@@ -131,7 +131,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m) | |||
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | 133 | ||
134 | num_processors++; | 134 | cpu = num_processors++; |
135 | 135 | ||
136 | if (m->mpc_apicid > MAX_APICS) { | 136 | if (m->mpc_apicid > MAX_APICS) { |
137 | printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", | 137 | printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", |
@@ -155,13 +155,18 @@ static void __init MP_processor_info (struct mpc_config_processor *m) | |||
155 | * in same order as logical cpu numbers. Hence the first | 155 | * in same order as logical cpu numbers. Hence the first |
156 | * entry is BSP, and so on. | 156 | * entry is BSP, and so on. |
157 | */ | 157 | */ |
158 | cpu = 0; | ||
159 | |||
158 | bios_cpu_apicid[0] = m->mpc_apicid; | 160 | bios_cpu_apicid[0] = m->mpc_apicid; |
159 | x86_cpu_to_apicid[0] = m->mpc_apicid; | 161 | x86_cpu_to_apicid[0] = m->mpc_apicid; |
160 | found_bsp = 1; | 162 | found_bsp = 1; |
161 | } else { | 163 | } else |
162 | bios_cpu_apicid[num_processors - found_bsp] = m->mpc_apicid; | 164 | cpu = num_processors - found_bsp; |
163 | x86_cpu_to_apicid[num_processors - found_bsp] = m->mpc_apicid; | 165 | bios_cpu_apicid[cpu] = m->mpc_apicid; |
164 | } | 166 | x86_cpu_to_apicid[cpu] = m->mpc_apicid; |
167 | |||
168 | cpu_set(cpu, cpu_possible_map); | ||
169 | cpu_set(cpu, cpu_present_map); | ||
165 | } | 170 | } |
166 | 171 | ||
167 | static void __init MP_bus_info (struct mpc_config_bus *m) | 172 | static void __init MP_bus_info (struct mpc_config_bus *m) |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 5fd03225058a..0aa526298e92 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -765,8 +765,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
765 | int cpu = smp_processor_id(); | 765 | int cpu = smp_processor_id(); |
766 | int node = 0; | 766 | int node = 0; |
767 | unsigned bits; | 767 | unsigned bits; |
768 | if (c->x86_num_cores == 1) | ||
769 | return; | ||
770 | 768 | ||
771 | bits = 0; | 769 | bits = 0; |
772 | while ((1 << bits) < c->x86_num_cores) | 770 | while ((1 << bits) < c->x86_num_cores) |
@@ -1081,8 +1079,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
1081 | else | 1079 | else |
1082 | mtrr_ap_init(); | 1080 | mtrr_ap_init(); |
1083 | #ifdef CONFIG_NUMA | 1081 | #ifdef CONFIG_NUMA |
1084 | if (c != &boot_cpu_data) | 1082 | numa_add_cpu(smp_processor_id()); |
1085 | numa_add_cpu(c - cpu_data); | ||
1086 | #endif | 1083 | #endif |
1087 | } | 1084 | } |
1088 | 1085 | ||
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index f2b9c6bc999a..34082c1cc41e 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/bootmem.h> | 13 | #include <linux/bootmem.h> |
14 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
15 | #include <linux/module.h> | ||
15 | #include <asm/bootsetup.h> | 16 | #include <asm/bootsetup.h> |
16 | #include <asm/pda.h> | 17 | #include <asm/pda.h> |
17 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
@@ -22,10 +23,8 @@ | |||
22 | #include <asm/smp.h> | 23 | #include <asm/smp.h> |
23 | #include <asm/i387.h> | 24 | #include <asm/i387.h> |
24 | #include <asm/percpu.h> | 25 | #include <asm/percpu.h> |
25 | #include <asm/mtrr.h> | ||
26 | #include <asm/proto.h> | 26 | #include <asm/proto.h> |
27 | #include <asm/mman.h> | 27 | #include <asm/sections.h> |
28 | #include <asm/numa.h> | ||
29 | 28 | ||
30 | char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; | 29 | char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; |
31 | 30 | ||
@@ -33,11 +32,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | |||
33 | 32 | ||
34 | struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; | 33 | struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; |
35 | 34 | ||
36 | extern struct task_struct init_task; | ||
37 | |||
38 | extern unsigned char __per_cpu_start[], __per_cpu_end[]; | ||
39 | |||
40 | extern struct desc_ptr cpu_gdt_descr[]; | ||
41 | struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; | 35 | struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; |
42 | 36 | ||
43 | char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); | 37 | char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); |
@@ -101,7 +95,7 @@ void __init setup_per_cpu_areas(void) | |||
101 | #endif | 95 | #endif |
102 | 96 | ||
103 | for (i = 0; i < NR_CPUS; i++) { | 97 | for (i = 0; i < NR_CPUS; i++) { |
104 | unsigned char *ptr; | 98 | char *ptr; |
105 | 99 | ||
106 | if (!NODE_DATA(cpu_to_node(i))) { | 100 | if (!NODE_DATA(cpu_to_node(i))) { |
107 | printk("cpu with no node %d, num_online_nodes %d\n", | 101 | printk("cpu with no node %d, num_online_nodes %d\n", |
@@ -190,11 +184,7 @@ void __cpuinit check_efer(void) | |||
190 | */ | 184 | */ |
191 | void __cpuinit cpu_init (void) | 185 | void __cpuinit cpu_init (void) |
192 | { | 186 | { |
193 | #ifdef CONFIG_SMP | ||
194 | int cpu = stack_smp_processor_id(); | 187 | int cpu = stack_smp_processor_id(); |
195 | #else | ||
196 | int cpu = smp_processor_id(); | ||
197 | #endif | ||
198 | struct tss_struct *t = &per_cpu(init_tss, cpu); | 188 | struct tss_struct *t = &per_cpu(init_tss, cpu); |
199 | unsigned long v; | 189 | unsigned long v; |
200 | char *estacks = NULL; | 190 | char *estacks = NULL; |
@@ -214,7 +204,7 @@ void __cpuinit cpu_init (void) | |||
214 | 204 | ||
215 | printk("Initializing CPU#%d\n", cpu); | 205 | printk("Initializing CPU#%d\n", cpu); |
216 | 206 | ||
217 | clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | 207 | clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); |
218 | 208 | ||
219 | /* | 209 | /* |
220 | * Initialize the per-CPU GDT with the boot GDT, | 210 | * Initialize the per-CPU GDT with the boot GDT, |
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c index ccae392886af..6ee74db52303 100644 --- a/arch/x86_64/kernel/smp.c +++ b/arch/x86_64/kernel/smp.c | |||
@@ -129,10 +129,9 @@ asmlinkage void smp_invalidate_interrupt (void) | |||
129 | } else | 129 | } else |
130 | leave_mm(cpu); | 130 | leave_mm(cpu); |
131 | } | 131 | } |
132 | out: | ||
132 | ack_APIC_irq(); | 133 | ack_APIC_irq(); |
133 | cpu_clear(cpu, flush_cpumask); | 134 | cpu_clear(cpu, flush_cpumask); |
134 | |||
135 | out: | ||
136 | put_cpu_no_resched(); | 135 | put_cpu_no_resched(); |
137 | } | 136 | } |
138 | 137 | ||
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index e773a794ec45..6d23354443c0 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -113,24 +113,6 @@ struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; | |||
113 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) | 113 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * cpu_possible_map should be static, it cannot change as cpu's | ||
117 | * are onlined, or offlined. The reason is per-cpu data-structures | ||
118 | * are allocated by some modules at init time, and dont expect to | ||
119 | * do this dynamically on cpu arrival/departure. | ||
120 | * cpu_present_map on the other hand can change dynamically. | ||
121 | * In case when cpu_hotplug is not compiled, then we resort to current | ||
122 | * behaviour, which is cpu_possible == cpu_present. | ||
123 | * If cpu-hotplug is supported, then we need to preallocate for all | ||
124 | * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. | ||
125 | * - Ashok Raj | ||
126 | */ | ||
127 | #ifdef CONFIG_HOTPLUG_CPU | ||
128 | #define fixup_cpu_possible_map(x) cpu_set((x), cpu_possible_map) | ||
129 | #else | ||
130 | #define fixup_cpu_possible_map(x) | ||
131 | #endif | ||
132 | |||
133 | /* | ||
134 | * Currently trivial. Write the real->protected mode | 116 | * Currently trivial. Write the real->protected mode |
135 | * bootstrap into the page concerned. The caller | 117 | * bootstrap into the page concerned. The caller |
136 | * has made sure it's suitably aligned. | 118 | * has made sure it's suitably aligned. |
@@ -773,8 +755,9 @@ do_rest: | |||
773 | initial_code = start_secondary; | 755 | initial_code = start_secondary; |
774 | clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); | 756 | clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); |
775 | 757 | ||
776 | printk(KERN_INFO "Booting processor %d/%d rip %lx rsp %lx\n", cpu, apicid, | 758 | printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu, |
777 | start_rip, init_rsp); | 759 | cpus_weight(cpu_present_map), |
760 | apicid); | ||
778 | 761 | ||
779 | /* | 762 | /* |
780 | * This grunge runs the startup process for | 763 | * This grunge runs the startup process for |
@@ -924,6 +907,27 @@ static __init void enforce_max_cpus(unsigned max_cpus) | |||
924 | } | 907 | } |
925 | } | 908 | } |
926 | 909 | ||
910 | #ifdef CONFIG_HOTPLUG_CPU | ||
911 | /* | ||
912 | * cpu_possible_map should be static, it cannot change as cpu's | ||
913 | * are onlined, or offlined. The reason is per-cpu data-structures | ||
914 | * are allocated by some modules at init time, and dont expect to | ||
915 | * do this dynamically on cpu arrival/departure. | ||
916 | * cpu_present_map on the other hand can change dynamically. | ||
917 | * In case when cpu_hotplug is not compiled, then we resort to current | ||
918 | * behaviour, which is cpu_possible == cpu_present. | ||
919 | * If cpu-hotplug is supported, then we need to preallocate for all | ||
920 | * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. | ||
921 | * - Ashok Raj | ||
922 | */ | ||
923 | static void prefill_possible_map(void) | ||
924 | { | ||
925 | int i; | ||
926 | for (i = 0; i < NR_CPUS; i++) | ||
927 | cpu_set(i, cpu_possible_map); | ||
928 | } | ||
929 | #endif | ||
930 | |||
927 | /* | 931 | /* |
928 | * Various sanity checks. | 932 | * Various sanity checks. |
929 | */ | 933 | */ |
@@ -987,25 +991,15 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
987 | */ | 991 | */ |
988 | void __init smp_prepare_cpus(unsigned int max_cpus) | 992 | void __init smp_prepare_cpus(unsigned int max_cpus) |
989 | { | 993 | { |
990 | int i; | ||
991 | |||
992 | nmi_watchdog_default(); | 994 | nmi_watchdog_default(); |
993 | current_cpu_data = boot_cpu_data; | 995 | current_cpu_data = boot_cpu_data; |
994 | current_thread_info()->cpu = 0; /* needed? */ | 996 | current_thread_info()->cpu = 0; /* needed? */ |
995 | 997 | ||
996 | enforce_max_cpus(max_cpus); | 998 | enforce_max_cpus(max_cpus); |
997 | 999 | ||
998 | /* | 1000 | #ifdef CONFIG_HOTPLUG_CPU |
999 | * Fill in cpu_present_mask | 1001 | prefill_possible_map(); |
1000 | */ | 1002 | #endif |
1001 | for (i = 0; i < NR_CPUS; i++) { | ||
1002 | int apicid = cpu_present_to_apicid(i); | ||
1003 | if (physid_isset(apicid, phys_cpu_present_map)) { | ||
1004 | cpu_set(i, cpu_present_map); | ||
1005 | cpu_set(i, cpu_possible_map); | ||
1006 | } | ||
1007 | fixup_cpu_possible_map(i); | ||
1008 | } | ||
1009 | 1003 | ||
1010 | if (smp_sanity_check(max_cpus) < 0) { | 1004 | if (smp_sanity_check(max_cpus) < 0) { |
1011 | printk(KERN_INFO "SMP disabled\n"); | 1005 | printk(KERN_INFO "SMP disabled\n"); |
@@ -1189,8 +1183,7 @@ void __cpu_die(unsigned int cpu) | |||
1189 | printk ("CPU %d is now offline\n", cpu); | 1183 | printk ("CPU %d is now offline\n", cpu); |
1190 | return; | 1184 | return; |
1191 | } | 1185 | } |
1192 | current->state = TASK_UNINTERRUPTIBLE; | 1186 | msleep(100); |
1193 | schedule_timeout(HZ/10); | ||
1194 | } | 1187 | } |
1195 | printk(KERN_ERR "CPU %u didn't die...\n", cpu); | 1188 | printk(KERN_ERR "CPU %u didn't die...\n", cpu); |
1196 | } | 1189 | } |
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 102736630002..6ead433a3885 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c | |||
@@ -594,9 +594,6 @@ asmlinkage void default_do_nmi(struct pt_regs *regs) | |||
594 | if (!cpu) | 594 | if (!cpu) |
595 | reason = get_nmi_reason(); | 595 | reason = get_nmi_reason(); |
596 | 596 | ||
597 | if (!cpu_online(cpu)) | ||
598 | return; | ||
599 | |||
600 | if (!(reason & 0xc0)) { | 597 | if (!(reason & 0xc0)) { |
601 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) | 598 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) |
602 | == NOTIFY_STOP) | 599 | == NOTIFY_STOP) |
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c index 33a873a3c223..841bd738a189 100644 --- a/arch/x86_64/lib/delay.c +++ b/arch/x86_64/lib/delay.c | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <asm/smp.h> | 18 | #include <asm/smp.h> |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | int x86_udelay_tsc = 0; /* Delay via TSC */ | ||
22 | |||
23 | int read_current_timer(unsigned long *timer_value) | 21 | int read_current_timer(unsigned long *timer_value) |
24 | { | 22 | { |
25 | rdtscll(*timer_value); | 23 | rdtscll(*timer_value); |
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index 2f187986f940..13792721037e 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/vt_kern.h> /* For unblank_screen() */ | 23 | #include <linux/vt_kern.h> /* For unblank_screen() */ |
24 | #include <linux/compiler.h> | 24 | #include <linux/compiler.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/kprobes.h> | ||
27 | 26 | ||
28 | #include <asm/system.h> | 27 | #include <asm/system.h> |
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c index ac61c186eb02..70cb2904a90f 100644 --- a/arch/x86_64/mm/numa.c +++ b/arch/x86_64/mm/numa.c | |||
@@ -36,34 +36,36 @@ int numa_off __initdata; | |||
36 | int __init compute_hash_shift(struct node *nodes, int numnodes) | 36 | int __init compute_hash_shift(struct node *nodes, int numnodes) |
37 | { | 37 | { |
38 | int i; | 38 | int i; |
39 | int shift = 24; | 39 | int shift = 20; |
40 | u64 addr; | 40 | unsigned long addr,maxend=0; |
41 | 41 | ||
42 | /* When in doubt use brute force. */ | 42 | for (i = 0; i < numnodes; i++) |
43 | while (shift < 48) { | 43 | if ((nodes[i].start != nodes[i].end) && (nodes[i].end > maxend)) |
44 | memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); | 44 | maxend = nodes[i].end; |
45 | for (i = 0; i < numnodes; i++) { | 45 | |
46 | if (nodes[i].start == nodes[i].end) | 46 | while ((1UL << shift) < (maxend / NODEMAPSIZE)) |
47 | continue; | 47 | shift++; |
48 | for (addr = nodes[i].start; | 48 | |
49 | addr < nodes[i].end; | 49 | printk (KERN_DEBUG"Using %d for the hash shift. Max adder is %lx \n", |
50 | addr += (1UL << shift)) { | 50 | shift,maxend); |
51 | if (memnodemap[addr >> shift] != 0xff && | 51 | memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); |
52 | memnodemap[addr >> shift] != i) { | 52 | for (i = 0; i < numnodes; i++) { |
53 | printk(KERN_INFO | 53 | if (nodes[i].start == nodes[i].end) |
54 | "node %d shift %d addr %Lx conflict %d\n", | 54 | continue; |
55 | i, shift, addr, memnodemap[addr>>shift]); | 55 | for (addr = nodes[i].start; |
56 | goto next; | 56 | addr < nodes[i].end; |
57 | } | 57 | addr += (1UL << shift)) { |
58 | memnodemap[addr >> shift] = i; | 58 | if (memnodemap[addr >> shift] != 0xff) { |
59 | printk(KERN_INFO | ||
60 | "Your memory is not aligned you need to rebuild your kernel " | ||
61 | "with a bigger NODEMAPSIZE shift=%d adder=%lu\n", | ||
62 | shift,addr); | ||
63 | return -1; | ||
59 | } | 64 | } |
65 | memnodemap[addr >> shift] = i; | ||
60 | } | 66 | } |
61 | return shift; | ||
62 | next: | ||
63 | shift++; | ||
64 | } | 67 | } |
65 | memset(memnodemap,0,sizeof(*memnodemap) * NODEMAPSIZE); | 68 | return shift; |
66 | return -1; | ||
67 | } | 69 | } |
68 | 70 | ||
69 | #ifdef CONFIG_SPARSEMEM | 71 | #ifdef CONFIG_SPARSEMEM |
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 5d01b31472e1..8e3d097a9ddd 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -20,6 +20,9 @@ | |||
20 | 20 | ||
21 | static struct acpi_table_slit *acpi_slit; | 21 | static struct acpi_table_slit *acpi_slit; |
22 | 22 | ||
23 | /* Internal processor count */ | ||
24 | static unsigned int __initdata num_processors = 0; | ||
25 | |||
23 | static nodemask_t nodes_parsed __initdata; | 26 | static nodemask_t nodes_parsed __initdata; |
24 | static nodemask_t nodes_found __initdata; | 27 | static nodemask_t nodes_found __initdata; |
25 | static struct node nodes[MAX_NUMNODES] __initdata; | 28 | static struct node nodes[MAX_NUMNODES] __initdata; |
@@ -101,16 +104,18 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) | |||
101 | bad_srat(); | 104 | bad_srat(); |
102 | return; | 105 | return; |
103 | } | 106 | } |
104 | if (pa->apic_id >= NR_CPUS) { | 107 | if (num_processors >= NR_CPUS) { |
105 | printk(KERN_ERR "SRAT: lapic %u too large.\n", | 108 | printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n", |
106 | pa->apic_id); | 109 | num_processors, pa->apic_id, NR_CPUS); |
107 | bad_srat(); | 110 | bad_srat(); |
108 | return; | 111 | return; |
109 | } | 112 | } |
110 | cpu_to_node[pa->apic_id] = node; | 113 | cpu_to_node[num_processors] = node; |
111 | acpi_numa = 1; | 114 | acpi_numa = 1; |
112 | printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", | 115 | printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n", |
113 | pxm, pa->apic_id, node); | 116 | pxm, pa->apic_id, num_processors, node); |
117 | |||
118 | num_processors++; | ||
114 | } | 119 | } |
115 | 120 | ||
116 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ | 121 | /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ |
@@ -124,7 +129,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) | |||
124 | 129 | ||
125 | if (srat_disabled() || ma->flags.enabled == 0) | 130 | if (srat_disabled() || ma->flags.enabled == 0) |
126 | return; | 131 | return; |
127 | /* hotplug bit is ignored for now */ | ||
128 | pxm = ma->proximity_domain; | 132 | pxm = ma->proximity_domain; |
129 | node = setup_node(pxm); | 133 | node = setup_node(pxm); |
130 | if (node < 0) { | 134 | if (node < 0) { |
@@ -134,6 +138,10 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) | |||
134 | } | 138 | } |
135 | start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); | 139 | start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); |
136 | end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); | 140 | end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); |
141 | /* It is fine to add this area to the nodes data it will be used later*/ | ||
142 | if (ma->flags.hot_pluggable == 1) | ||
143 | printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n", | ||
144 | start, end); | ||
137 | i = conflicting_nodes(start, end); | 145 | i = conflicting_nodes(start, end); |
138 | if (i >= 0) { | 146 | if (i >= 0) { |
139 | printk(KERN_ERR | 147 | printk(KERN_ERR |
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c index 7e7d0c2a0025..c2c38b579939 100644 --- a/arch/x86_64/pci/k8-bus.c +++ b/arch/x86_64/pci/k8-bus.c | |||
@@ -29,7 +29,7 @@ __init static int | |||
29 | fill_mp_bus_to_cpumask(void) | 29 | fill_mp_bus_to_cpumask(void) |
30 | { | 30 | { |
31 | struct pci_dev *nb_dev = NULL; | 31 | struct pci_dev *nb_dev = NULL; |
32 | int i, j, printed; | 32 | int i, j; |
33 | u32 ldtbus, nid; | 33 | u32 ldtbus, nid; |
34 | static int lbnr[3] = { | 34 | static int lbnr[3] = { |
35 | LDT_BUS_NUMBER_REGISTER_0, | 35 | LDT_BUS_NUMBER_REGISTER_0, |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 3e9fb6e4a52a..418b1469d75d 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1135,7 +1135,7 @@ static int revalidate_allvol(ctlr_info_t *host) | |||
1135 | /* this is for the online array utilities */ | 1135 | /* this is for the online array utilities */ |
1136 | if (!drv->heads && i) | 1136 | if (!drv->heads && i) |
1137 | continue; | 1137 | continue; |
1138 | blk_queue_hardsect_size(host->queue, drv->block_size); | 1138 | blk_queue_hardsect_size(drv->queue, drv->block_size); |
1139 | set_capacity(disk, drv->nr_blocks); | 1139 | set_capacity(disk, drv->nr_blocks); |
1140 | add_disk(disk); | 1140 | add_disk(disk); |
1141 | } | 1141 | } |
@@ -1691,7 +1691,7 @@ static int cciss_revalidate(struct gendisk *disk) | |||
1691 | cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); | 1691 | cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); |
1692 | cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); | 1692 | cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); |
1693 | 1693 | ||
1694 | blk_queue_hardsect_size(h->queue, drv->block_size); | 1694 | blk_queue_hardsect_size(drv->queue, drv->block_size); |
1695 | set_capacity(disk, drv->nr_blocks); | 1695 | set_capacity(disk, drv->nr_blocks); |
1696 | 1696 | ||
1697 | kfree(size_buff); | 1697 | kfree(size_buff); |
@@ -2248,12 +2248,12 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2248 | * them up. We will also keep track of the next queue to run so | 2248 | * them up. We will also keep track of the next queue to run so |
2249 | * that every queue gets a chance to be started first. | 2249 | * that every queue gets a chance to be started first. |
2250 | */ | 2250 | */ |
2251 | for (j=0; j < NWD; j++){ | 2251 | for (j=0; j < h->highest_lun + 1; j++){ |
2252 | int curr_queue = (start_queue + j) % NWD; | 2252 | int curr_queue = (start_queue + j) % (h->highest_lun + 1); |
2253 | /* make sure the disk has been added and the drive is real | 2253 | /* make sure the disk has been added and the drive is real |
2254 | * because this can be called from the middle of init_one. | 2254 | * because this can be called from the middle of init_one. |
2255 | */ | 2255 | */ |
2256 | if(!(h->gendisk[curr_queue]->queue) || | 2256 | if(!(h->drv[curr_queue].queue) || |
2257 | !(h->drv[curr_queue].heads)) | 2257 | !(h->drv[curr_queue].heads)) |
2258 | continue; | 2258 | continue; |
2259 | blk_start_queue(h->gendisk[curr_queue]->queue); | 2259 | blk_start_queue(h->gendisk[curr_queue]->queue); |
@@ -2264,14 +2264,14 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) | |||
2264 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) | 2264 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) |
2265 | { | 2265 | { |
2266 | if (curr_queue == start_queue){ | 2266 | if (curr_queue == start_queue){ |
2267 | h->next_to_run = (start_queue + 1) % NWD; | 2267 | h->next_to_run = (start_queue + 1) % (h->highest_lun + 1); |
2268 | goto cleanup; | 2268 | goto cleanup; |
2269 | } else { | 2269 | } else { |
2270 | h->next_to_run = curr_queue; | 2270 | h->next_to_run = curr_queue; |
2271 | goto cleanup; | 2271 | goto cleanup; |
2272 | } | 2272 | } |
2273 | } else { | 2273 | } else { |
2274 | curr_queue = (curr_queue + 1) % NWD; | 2274 | curr_queue = (curr_queue + 1) % (h->highest_lun + 1); |
2275 | } | 2275 | } |
2276 | } | 2276 | } |
2277 | 2277 | ||
@@ -2279,7 +2279,6 @@ cleanup: | |||
2279 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); | 2279 | spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); |
2280 | return IRQ_HANDLED; | 2280 | return IRQ_HANDLED; |
2281 | } | 2281 | } |
2282 | |||
2283 | /* | 2282 | /* |
2284 | * We cannot read the structure directly, for portablity we must use | 2283 | * We cannot read the structure directly, for portablity we must use |
2285 | * the io functions. | 2284 | * the io functions. |
@@ -2789,13 +2788,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2789 | } | 2788 | } |
2790 | 2789 | ||
2791 | spin_lock_init(&hba[i]->lock); | 2790 | spin_lock_init(&hba[i]->lock); |
2792 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); | ||
2793 | if (!q) | ||
2794 | goto clean4; | ||
2795 | |||
2796 | q->backing_dev_info.ra_pages = READ_AHEAD; | ||
2797 | hba[i]->queue = q; | ||
2798 | q->queuedata = hba[i]; | ||
2799 | 2791 | ||
2800 | /* Initialize the pdev driver private data. | 2792 | /* Initialize the pdev driver private data. |
2801 | have it point to hba[i]. */ | 2793 | have it point to hba[i]. */ |
@@ -2817,6 +2809,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2817 | 2809 | ||
2818 | cciss_procinit(i); | 2810 | cciss_procinit(i); |
2819 | 2811 | ||
2812 | for(j=0; j < NWD; j++) { /* mfm */ | ||
2813 | drive_info_struct *drv = &(hba[i]->drv[j]); | ||
2814 | struct gendisk *disk = hba[i]->gendisk[j]; | ||
2815 | |||
2816 | q = blk_init_queue(do_cciss_request, &hba[i]->lock); | ||
2817 | if (!q) { | ||
2818 | printk(KERN_ERR | ||
2819 | "cciss: unable to allocate queue for disk %d\n", | ||
2820 | j); | ||
2821 | break; | ||
2822 | } | ||
2823 | drv->queue = q; | ||
2824 | |||
2825 | q->backing_dev_info.ra_pages = READ_AHEAD; | ||
2820 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); | 2826 | blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); |
2821 | 2827 | ||
2822 | /* This is a hardware imposed limit. */ | 2828 | /* This is a hardware imposed limit. */ |
@@ -2827,26 +2833,23 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2827 | 2833 | ||
2828 | blk_queue_max_sectors(q, 512); | 2834 | blk_queue_max_sectors(q, 512); |
2829 | 2835 | ||
2830 | 2836 | q->queuedata = hba[i]; | |
2831 | for(j=0; j<NWD; j++) { | ||
2832 | drive_info_struct *drv = &(hba[i]->drv[j]); | ||
2833 | struct gendisk *disk = hba[i]->gendisk[j]; | ||
2834 | |||
2835 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); | 2837 | sprintf(disk->disk_name, "cciss/c%dd%d", i, j); |
2836 | sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); | 2838 | sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); |
2837 | disk->major = hba[i]->major; | 2839 | disk->major = hba[i]->major; |
2838 | disk->first_minor = j << NWD_SHIFT; | 2840 | disk->first_minor = j << NWD_SHIFT; |
2839 | disk->fops = &cciss_fops; | 2841 | disk->fops = &cciss_fops; |
2840 | disk->queue = hba[i]->queue; | 2842 | disk->queue = q; |
2841 | disk->private_data = drv; | 2843 | disk->private_data = drv; |
2842 | /* we must register the controller even if no disks exist */ | 2844 | /* we must register the controller even if no disks exist */ |
2843 | /* this is for the online array utilities */ | 2845 | /* this is for the online array utilities */ |
2844 | if(!drv->heads && j) | 2846 | if(!drv->heads && j) |
2845 | continue; | 2847 | continue; |
2846 | blk_queue_hardsect_size(hba[i]->queue, drv->block_size); | 2848 | blk_queue_hardsect_size(q, drv->block_size); |
2847 | set_capacity(disk, drv->nr_blocks); | 2849 | set_capacity(disk, drv->nr_blocks); |
2848 | add_disk(disk); | 2850 | add_disk(disk); |
2849 | } | 2851 | } |
2852 | |||
2850 | return(1); | 2853 | return(1); |
2851 | 2854 | ||
2852 | clean4: | 2855 | clean4: |
@@ -2912,10 +2915,10 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev) | |||
2912 | for (j = 0; j < NWD; j++) { | 2915 | for (j = 0; j < NWD; j++) { |
2913 | struct gendisk *disk = hba[i]->gendisk[j]; | 2916 | struct gendisk *disk = hba[i]->gendisk[j]; |
2914 | if (disk->flags & GENHD_FL_UP) | 2917 | if (disk->flags & GENHD_FL_UP) |
2918 | blk_cleanup_queue(disk->queue); | ||
2915 | del_gendisk(disk); | 2919 | del_gendisk(disk); |
2916 | } | 2920 | } |
2917 | 2921 | ||
2918 | blk_cleanup_queue(hba[i]->queue); | ||
2919 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), | 2922 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), |
2920 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 2923 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
2921 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), | 2924 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), |
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 8fb19206eddb..566587d0a500 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -29,6 +29,7 @@ typedef struct _drive_info_struct | |||
29 | { | 29 | { |
30 | __u32 LunID; | 30 | __u32 LunID; |
31 | int usage_count; | 31 | int usage_count; |
32 | struct request_queue *queue; | ||
32 | sector_t nr_blocks; | 33 | sector_t nr_blocks; |
33 | int block_size; | 34 | int block_size; |
34 | int heads; | 35 | int heads; |
@@ -72,7 +73,6 @@ struct ctlr_info | |||
72 | unsigned int maxQsinceinit; | 73 | unsigned int maxQsinceinit; |
73 | unsigned int maxSG; | 74 | unsigned int maxSG; |
74 | spinlock_t lock; | 75 | spinlock_t lock; |
75 | struct request_queue *queue; | ||
76 | 76 | ||
77 | //* pointers to command and error info pool */ | 77 | //* pointers to command and error info pool */ |
78 | CommandList_struct *cmd_pool; | 78 | CommandList_struct *cmd_pool; |
@@ -260,7 +260,7 @@ struct board_type { | |||
260 | struct access_method *access; | 260 | struct access_method *access; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | #define CCISS_LOCK(i) (hba[i]->queue->queue_lock) | 263 | #define CCISS_LOCK(i) (&hba[i]->lock) |
264 | 264 | ||
265 | #endif /* CCISS_H */ | 265 | #endif /* CCISS_H */ |
266 | 266 | ||
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c index 53c95c0bbf46..ae1fb45dbb40 100644 --- a/drivers/firmware/pcdp.c +++ b/drivers/firmware/pcdp.c | |||
@@ -25,14 +25,22 @@ setup_serial_console(struct pcdp_uart *uart) | |||
25 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 25 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
26 | int mmio; | 26 | int mmio; |
27 | static char options[64], *p = options; | 27 | static char options[64], *p = options; |
28 | char parity; | ||
28 | 29 | ||
29 | mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY); | 30 | mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY); |
30 | p += sprintf(p, "console=uart,%s,0x%lx", | 31 | p += sprintf(p, "console=uart,%s,0x%lx", |
31 | mmio ? "mmio" : "io", uart->addr.address); | 32 | mmio ? "mmio" : "io", uart->addr.address); |
32 | if (uart->baud) | 33 | if (uart->baud) { |
33 | p += sprintf(p, ",%lu", uart->baud); | 34 | p += sprintf(p, ",%lu", uart->baud); |
34 | if (uart->bits) | 35 | if (uart->bits) { |
35 | p += sprintf(p, "n%d", uart->bits); | 36 | switch (uart->parity) { |
37 | case 0x2: parity = 'e'; break; | ||
38 | case 0x3: parity = 'o'; break; | ||
39 | default: parity = 'n'; | ||
40 | } | ||
41 | p += sprintf(p, "%c%d", parity, uart->bits); | ||
42 | } | ||
43 | } | ||
36 | 44 | ||
37 | return early_serial_console_init(options); | 45 | return early_serial_console_init(options); |
38 | #else | 46 | #else |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index aac59751e1b4..03747439ac9c 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -465,7 +465,7 @@ static struct pcmcia_device_id ide_ids[] = { | |||
465 | PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591), | 465 | PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591), |
466 | PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4), | 466 | PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4), |
467 | PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde), | 467 | PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde), |
468 | PCMCIA_DEVICE_PROD_ID12("EXP", "CD", 0x6f58c983, 0xaae5994f), | 468 | PCMCIA_DEVICE_PROD_ID12("EXP", "CD+GAME", 0x6f58c983, 0x63c13aaf), |
469 | PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591), | 469 | PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591), |
470 | PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728), | 470 | PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728), |
471 | PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), | 471 | PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), |
@@ -481,6 +481,7 @@ static struct pcmcia_device_id ide_ids[] = { | |||
481 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), | 481 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), |
482 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), | 482 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), |
483 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 483 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |
484 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), | ||
484 | PCMCIA_DEVICE_NULL, | 485 | PCMCIA_DEVICE_NULL, |
485 | }; | 486 | }; |
486 | MODULE_DEVICE_TABLE(pcmcia, ide_ids); | 487 | MODULE_DEVICE_TABLE(pcmcia, ide_ids); |
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c index 546ec61c407f..61d07c732f49 100644 --- a/drivers/infiniband/core/ucm.c +++ b/drivers/infiniband/core/ucm.c | |||
@@ -49,6 +49,11 @@ MODULE_AUTHOR("Libor Michalek"); | |||
49 | MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); | 49 | MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access"); |
50 | MODULE_LICENSE("Dual BSD/GPL"); | 50 | MODULE_LICENSE("Dual BSD/GPL"); |
51 | 51 | ||
52 | static int ucm_debug_level; | ||
53 | |||
54 | module_param_named(debug_level, ucm_debug_level, int, 0644); | ||
55 | MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0"); | ||
56 | |||
52 | enum { | 57 | enum { |
53 | IB_UCM_MAJOR = 231, | 58 | IB_UCM_MAJOR = 231, |
54 | IB_UCM_MINOR = 255 | 59 | IB_UCM_MINOR = 255 |
@@ -56,6 +61,14 @@ enum { | |||
56 | 61 | ||
57 | #define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR) | 62 | #define IB_UCM_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_MINOR) |
58 | 63 | ||
64 | #define PFX "UCM: " | ||
65 | |||
66 | #define ucm_dbg(format, arg...) \ | ||
67 | do { \ | ||
68 | if (ucm_debug_level > 0) \ | ||
69 | printk(KERN_DEBUG PFX format, ## arg); \ | ||
70 | } while (0) | ||
71 | |||
59 | static struct semaphore ctx_id_mutex; | 72 | static struct semaphore ctx_id_mutex; |
60 | static struct idr ctx_id_table; | 73 | static struct idr ctx_id_table; |
61 | static int ctx_id_rover = 0; | 74 | static int ctx_id_rover = 0; |
@@ -107,7 +120,7 @@ static void ib_ucm_ctx_put(struct ib_ucm_context *ctx) | |||
107 | 120 | ||
108 | up(&ctx->file->mutex); | 121 | up(&ctx->file->mutex); |
109 | 122 | ||
110 | printk(KERN_ERR "UCM: Destroyed CM ID <%d>\n", ctx->id); | 123 | ucm_dbg("Destroyed CM ID <%d>\n", ctx->id); |
111 | 124 | ||
112 | ib_destroy_cm_id(ctx->cm_id); | 125 | ib_destroy_cm_id(ctx->cm_id); |
113 | kfree(ctx); | 126 | kfree(ctx); |
@@ -145,7 +158,7 @@ retry: | |||
145 | if (result) | 158 | if (result) |
146 | goto error; | 159 | goto error; |
147 | 160 | ||
148 | printk(KERN_ERR "UCM: Allocated CM ID <%d>\n", ctx->id); | 161 | ucm_dbg("Allocated CM ID <%d>\n", ctx->id); |
149 | 162 | ||
150 | return ctx; | 163 | return ctx; |
151 | error: | 164 | error: |
@@ -378,10 +391,8 @@ static int ib_ucm_event_process(struct ib_cm_event *evt, | |||
378 | 391 | ||
379 | return 0; | 392 | return 0; |
380 | error: | 393 | error: |
381 | if (uvt->info) | 394 | kfree(uvt->info); |
382 | kfree(uvt->info); | 395 | kfree(uvt->data); |
383 | if (uvt->data) | ||
384 | kfree(uvt->data); | ||
385 | return result; | 396 | return result; |
386 | } | 397 | } |
387 | 398 | ||
@@ -407,8 +418,7 @@ static int ib_ucm_event_handler(struct ib_cm_id *cm_id, | |||
407 | break; | 418 | break; |
408 | } | 419 | } |
409 | 420 | ||
410 | printk(KERN_ERR "UCM: Event. CM ID <%d> event <%d>\n", | 421 | ucm_dbg("Event. CM ID <%d> event <%d>\n", id, event->event); |
411 | id, event->event); | ||
412 | 422 | ||
413 | ctx = ib_ucm_ctx_get(id); | 423 | ctx = ib_ucm_ctx_get(id); |
414 | if (!ctx) | 424 | if (!ctx) |
@@ -551,10 +561,8 @@ user: | |||
551 | list_del(&uevent->file_list); | 561 | list_del(&uevent->file_list); |
552 | list_del(&uevent->ctx_list); | 562 | list_del(&uevent->ctx_list); |
553 | 563 | ||
554 | if (uevent->data) | 564 | kfree(uevent->data); |
555 | kfree(uevent->data); | 565 | kfree(uevent->info); |
556 | if (uevent->info) | ||
557 | kfree(uevent->info); | ||
558 | kfree(uevent); | 566 | kfree(uevent); |
559 | done: | 567 | done: |
560 | up(&file->mutex); | 568 | up(&file->mutex); |
@@ -846,12 +854,9 @@ static ssize_t ib_ucm_send_req(struct ib_ucm_file *file, | |||
846 | up(&ctx->file->mutex); | 854 | up(&ctx->file->mutex); |
847 | ib_ucm_ctx_put(ctx); /* func reference */ | 855 | ib_ucm_ctx_put(ctx); /* func reference */ |
848 | done: | 856 | done: |
849 | if (param.private_data) | 857 | kfree(param.private_data); |
850 | kfree(param.private_data); | 858 | kfree(param.primary_path); |
851 | if (param.primary_path) | 859 | kfree(param.alternate_path); |
852 | kfree(param.primary_path); | ||
853 | if (param.alternate_path) | ||
854 | kfree(param.alternate_path); | ||
855 | 860 | ||
856 | return result; | 861 | return result; |
857 | } | 862 | } |
@@ -900,8 +905,7 @@ static ssize_t ib_ucm_send_rep(struct ib_ucm_file *file, | |||
900 | up(&ctx->file->mutex); | 905 | up(&ctx->file->mutex); |
901 | ib_ucm_ctx_put(ctx); /* func reference */ | 906 | ib_ucm_ctx_put(ctx); /* func reference */ |
902 | done: | 907 | done: |
903 | if (param.private_data) | 908 | kfree(param.private_data); |
904 | kfree(param.private_data); | ||
905 | 909 | ||
906 | return result; | 910 | return result; |
907 | } | 911 | } |
@@ -939,8 +943,7 @@ static ssize_t ib_ucm_send_private_data(struct ib_ucm_file *file, | |||
939 | up(&ctx->file->mutex); | 943 | up(&ctx->file->mutex); |
940 | ib_ucm_ctx_put(ctx); /* func reference */ | 944 | ib_ucm_ctx_put(ctx); /* func reference */ |
941 | done: | 945 | done: |
942 | if (private_data) | 946 | kfree(private_data); |
943 | kfree(private_data); | ||
944 | 947 | ||
945 | return result; | 948 | return result; |
946 | } | 949 | } |
@@ -1009,10 +1012,8 @@ static ssize_t ib_ucm_send_info(struct ib_ucm_file *file, | |||
1009 | up(&ctx->file->mutex); | 1012 | up(&ctx->file->mutex); |
1010 | ib_ucm_ctx_put(ctx); /* func reference */ | 1013 | ib_ucm_ctx_put(ctx); /* func reference */ |
1011 | done: | 1014 | done: |
1012 | if (data) | 1015 | kfree(data); |
1013 | kfree(data); | 1016 | kfree(info); |
1014 | if (info) | ||
1015 | kfree(info); | ||
1016 | 1017 | ||
1017 | return result; | 1018 | return result; |
1018 | } | 1019 | } |
@@ -1063,8 +1064,7 @@ static ssize_t ib_ucm_send_mra(struct ib_ucm_file *file, | |||
1063 | up(&ctx->file->mutex); | 1064 | up(&ctx->file->mutex); |
1064 | ib_ucm_ctx_put(ctx); /* func reference */ | 1065 | ib_ucm_ctx_put(ctx); /* func reference */ |
1065 | done: | 1066 | done: |
1066 | if (data) | 1067 | kfree(data); |
1067 | kfree(data); | ||
1068 | 1068 | ||
1069 | return result; | 1069 | return result; |
1070 | } | 1070 | } |
@@ -1105,10 +1105,8 @@ static ssize_t ib_ucm_send_lap(struct ib_ucm_file *file, | |||
1105 | up(&ctx->file->mutex); | 1105 | up(&ctx->file->mutex); |
1106 | ib_ucm_ctx_put(ctx); /* func reference */ | 1106 | ib_ucm_ctx_put(ctx); /* func reference */ |
1107 | done: | 1107 | done: |
1108 | if (data) | 1108 | kfree(data); |
1109 | kfree(data); | 1109 | kfree(path); |
1110 | if (path) | ||
1111 | kfree(path); | ||
1112 | 1110 | ||
1113 | return result; | 1111 | return result; |
1114 | } | 1112 | } |
@@ -1157,10 +1155,8 @@ static ssize_t ib_ucm_send_sidr_req(struct ib_ucm_file *file, | |||
1157 | up(&ctx->file->mutex); | 1155 | up(&ctx->file->mutex); |
1158 | ib_ucm_ctx_put(ctx); /* func reference */ | 1156 | ib_ucm_ctx_put(ctx); /* func reference */ |
1159 | done: | 1157 | done: |
1160 | if (param.private_data) | 1158 | kfree(param.private_data); |
1161 | kfree(param.private_data); | 1159 | kfree(param.path); |
1162 | if (param.path) | ||
1163 | kfree(param.path); | ||
1164 | 1160 | ||
1165 | return result; | 1161 | return result; |
1166 | } | 1162 | } |
@@ -1209,10 +1205,8 @@ static ssize_t ib_ucm_send_sidr_rep(struct ib_ucm_file *file, | |||
1209 | up(&ctx->file->mutex); | 1205 | up(&ctx->file->mutex); |
1210 | ib_ucm_ctx_put(ctx); /* func reference */ | 1206 | ib_ucm_ctx_put(ctx); /* func reference */ |
1211 | done: | 1207 | done: |
1212 | if (param.private_data) | 1208 | kfree(param.private_data); |
1213 | kfree(param.private_data); | 1209 | kfree(param.info); |
1214 | if (param.info) | ||
1215 | kfree(param.info); | ||
1216 | 1210 | ||
1217 | return result; | 1211 | return result; |
1218 | } | 1212 | } |
@@ -1252,8 +1246,8 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf, | |||
1252 | if (copy_from_user(&hdr, buf, sizeof(hdr))) | 1246 | if (copy_from_user(&hdr, buf, sizeof(hdr))) |
1253 | return -EFAULT; | 1247 | return -EFAULT; |
1254 | 1248 | ||
1255 | printk(KERN_ERR "UCM: Write. cmd <%d> in <%d> out <%d> len <%Zu>\n", | 1249 | ucm_dbg("Write. cmd <%d> in <%d> out <%d> len <%Zu>\n", |
1256 | hdr.cmd, hdr.in, hdr.out, len); | 1250 | hdr.cmd, hdr.in, hdr.out, len); |
1257 | 1251 | ||
1258 | if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) | 1252 | if (hdr.cmd < 0 || hdr.cmd >= ARRAY_SIZE(ucm_cmd_table)) |
1259 | return -EINVAL; | 1253 | return -EINVAL; |
@@ -1300,7 +1294,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp) | |||
1300 | filp->private_data = file; | 1294 | filp->private_data = file; |
1301 | file->filp = filp; | 1295 | file->filp = filp; |
1302 | 1296 | ||
1303 | printk(KERN_ERR "UCM: Created struct\n"); | 1297 | ucm_dbg("Created struct\n"); |
1304 | 1298 | ||
1305 | return 0; | 1299 | return 0; |
1306 | } | 1300 | } |
@@ -1326,7 +1320,7 @@ static int ib_ucm_close(struct inode *inode, struct file *filp) | |||
1326 | 1320 | ||
1327 | kfree(file); | 1321 | kfree(file); |
1328 | 1322 | ||
1329 | printk(KERN_ERR "UCM: Deleted struct\n"); | 1323 | ucm_dbg("Deleted struct\n"); |
1330 | return 0; | 1324 | return 0; |
1331 | } | 1325 | } |
1332 | 1326 | ||
@@ -1348,7 +1342,7 @@ static int __init ib_ucm_init(void) | |||
1348 | 1342 | ||
1349 | result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm"); | 1343 | result = register_chrdev_region(IB_UCM_DEV, 1, "infiniband_cm"); |
1350 | if (result) { | 1344 | if (result) { |
1351 | printk(KERN_ERR "UCM: Error <%d> registering dev\n", result); | 1345 | ucm_dbg("Error <%d> registering dev\n", result); |
1352 | goto err_chr; | 1346 | goto err_chr; |
1353 | } | 1347 | } |
1354 | 1348 | ||
@@ -1356,14 +1350,14 @@ static int __init ib_ucm_init(void) | |||
1356 | 1350 | ||
1357 | result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1); | 1351 | result = cdev_add(&ib_ucm_cdev, IB_UCM_DEV, 1); |
1358 | if (result) { | 1352 | if (result) { |
1359 | printk(KERN_ERR "UCM: Error <%d> adding cdev\n", result); | 1353 | ucm_dbg("Error <%d> adding cdev\n", result); |
1360 | goto err_cdev; | 1354 | goto err_cdev; |
1361 | } | 1355 | } |
1362 | 1356 | ||
1363 | ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm"); | 1357 | ib_ucm_class = class_create(THIS_MODULE, "infiniband_cm"); |
1364 | if (IS_ERR(ib_ucm_class)) { | 1358 | if (IS_ERR(ib_ucm_class)) { |
1365 | result = PTR_ERR(ib_ucm_class); | 1359 | result = PTR_ERR(ib_ucm_class); |
1366 | printk(KERN_ERR "UCM: Error <%d> creating class\n", result); | 1360 | ucm_dbg("Error <%d> creating class\n", result); |
1367 | goto err_class; | 1361 | goto err_class; |
1368 | } | 1362 | } |
1369 | 1363 | ||
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index 57347f1e82c1..7696022f9a4e 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h | |||
@@ -61,6 +61,7 @@ struct ib_uverbs_event_file { | |||
61 | int fd; | 61 | int fd; |
62 | int is_async; | 62 | int is_async; |
63 | wait_queue_head_t poll_wait; | 63 | wait_queue_head_t poll_wait; |
64 | struct fasync_struct *async_queue; | ||
64 | struct list_head event_list; | 65 | struct list_head event_list; |
65 | }; | 66 | }; |
66 | 67 | ||
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index fbbe03d8c901..eb99e693dec2 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -257,11 +257,19 @@ static void ib_uverbs_event_release(struct ib_uverbs_event_file *file) | |||
257 | spin_unlock_irq(&file->lock); | 257 | spin_unlock_irq(&file->lock); |
258 | } | 258 | } |
259 | 259 | ||
260 | static int ib_uverbs_event_fasync(int fd, struct file *filp, int on) | ||
261 | { | ||
262 | struct ib_uverbs_event_file *file = filp->private_data; | ||
263 | |||
264 | return fasync_helper(fd, filp, on, &file->async_queue); | ||
265 | } | ||
266 | |||
260 | static int ib_uverbs_event_close(struct inode *inode, struct file *filp) | 267 | static int ib_uverbs_event_close(struct inode *inode, struct file *filp) |
261 | { | 268 | { |
262 | struct ib_uverbs_event_file *file = filp->private_data; | 269 | struct ib_uverbs_event_file *file = filp->private_data; |
263 | 270 | ||
264 | ib_uverbs_event_release(file); | 271 | ib_uverbs_event_release(file); |
272 | ib_uverbs_event_fasync(-1, filp, 0); | ||
265 | kref_put(&file->uverbs_file->ref, ib_uverbs_release_file); | 273 | kref_put(&file->uverbs_file->ref, ib_uverbs_release_file); |
266 | 274 | ||
267 | return 0; | 275 | return 0; |
@@ -276,7 +284,8 @@ static struct file_operations uverbs_event_fops = { | |||
276 | */ | 284 | */ |
277 | .read = ib_uverbs_event_read, | 285 | .read = ib_uverbs_event_read, |
278 | .poll = ib_uverbs_event_poll, | 286 | .poll = ib_uverbs_event_poll, |
279 | .release = ib_uverbs_event_close | 287 | .release = ib_uverbs_event_close, |
288 | .fasync = ib_uverbs_event_fasync | ||
280 | }; | 289 | }; |
281 | 290 | ||
282 | void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) | 291 | void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) |
@@ -296,6 +305,7 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) | |||
296 | spin_unlock_irqrestore(&file->comp_file[0].lock, flags); | 305 | spin_unlock_irqrestore(&file->comp_file[0].lock, flags); |
297 | 306 | ||
298 | wake_up_interruptible(&file->comp_file[0].poll_wait); | 307 | wake_up_interruptible(&file->comp_file[0].poll_wait); |
308 | kill_fasync(&file->comp_file[0].async_queue, SIGIO, POLL_IN); | ||
299 | } | 309 | } |
300 | 310 | ||
301 | static void ib_uverbs_async_handler(struct ib_uverbs_file *file, | 311 | static void ib_uverbs_async_handler(struct ib_uverbs_file *file, |
@@ -316,6 +326,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file, | |||
316 | spin_unlock_irqrestore(&file->async_file.lock, flags); | 326 | spin_unlock_irqrestore(&file->async_file.lock, flags); |
317 | 327 | ||
318 | wake_up_interruptible(&file->async_file.poll_wait); | 328 | wake_up_interruptible(&file->async_file.poll_wait); |
329 | kill_fasync(&file->async_file.async_queue, SIGIO, POLL_IN); | ||
319 | } | 330 | } |
320 | 331 | ||
321 | void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr) | 332 | void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr) |
@@ -350,6 +361,7 @@ static int ib_uverbs_event_init(struct ib_uverbs_event_file *file, | |||
350 | INIT_LIST_HEAD(&file->event_list); | 361 | INIT_LIST_HEAD(&file->event_list); |
351 | init_waitqueue_head(&file->poll_wait); | 362 | init_waitqueue_head(&file->poll_wait); |
352 | file->uverbs_file = uverbs_file; | 363 | file->uverbs_file = uverbs_file; |
364 | file->async_queue = NULL; | ||
353 | 365 | ||
354 | file->fd = get_unused_fd(); | 366 | file->fd = get_unused_fd(); |
355 | if (file->fd < 0) | 367 | if (file->fd < 0) |
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index b5aea7b869f6..5687c3014522 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -373,8 +373,12 @@ static int handle_error_cqe(struct mthca_dev *dev, struct mthca_cq *cq, | |||
373 | * If we're at the end of the WQE chain, or we've used up our | 373 | * If we're at the end of the WQE chain, or we've used up our |
374 | * doorbell count, free the CQE. Otherwise just update it for | 374 | * doorbell count, free the CQE. Otherwise just update it for |
375 | * the next poll operation. | 375 | * the next poll operation. |
376 | * | ||
377 | * This does not apply to mem-free HCAs: they don't use the | ||
378 | * doorbell count field, and so we should always free the CQE. | ||
376 | */ | 379 | */ |
377 | if (!(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) | 380 | if (mthca_is_memfree(dev) || |
381 | !(new_wqe & cpu_to_be32(0x3f)) || (!cqe->db_cnt && dbd)) | ||
378 | return 0; | 382 | return 0; |
379 | 383 | ||
380 | cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd); | 384 | cqe->db_cnt = cpu_to_be16(be16_to_cpu(cqe->db_cnt) - dbd); |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 7a58ce90e179..81919a7b4935 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -349,9 +349,9 @@ static int mthca_mmap_uar(struct ib_ucontext *context, | |||
349 | 349 | ||
350 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 350 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
351 | 351 | ||
352 | if (remap_pfn_range(vma, vma->vm_start, | 352 | if (io_remap_pfn_range(vma, vma->vm_start, |
353 | to_mucontext(context)->uar.pfn, | 353 | to_mucontext(context)->uar.pfn, |
354 | PAGE_SIZE, vma->vm_page_prot)) | 354 | PAGE_SIZE, vma->vm_page_prot)) |
355 | return -EAGAIN; | 355 | return -EAGAIN; |
356 | 356 | ||
357 | return 0; | 357 | return 0; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 8238766746b2..eee82363167d 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -81,7 +81,7 @@ void ipoib_free_ah(struct kref *kref) | |||
81 | 81 | ||
82 | unsigned long flags; | 82 | unsigned long flags; |
83 | 83 | ||
84 | if (ah->last_send <= priv->tx_tail) { | 84 | if ((int) priv->tx_tail - (int) ah->last_send >= 0) { |
85 | ipoib_dbg(priv, "Freeing ah %p\n", ah->ah); | 85 | ipoib_dbg(priv, "Freeing ah %p\n", ah->ah); |
86 | ib_destroy_ah(ah->ah); | 86 | ib_destroy_ah(ah->ah); |
87 | kfree(ah); | 87 | kfree(ah); |
@@ -355,7 +355,7 @@ static void __ipoib_reap_ah(struct net_device *dev) | |||
355 | 355 | ||
356 | spin_lock_irq(&priv->lock); | 356 | spin_lock_irq(&priv->lock); |
357 | list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) | 357 | list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list) |
358 | if (ah->last_send <= priv->tx_tail) { | 358 | if ((int) priv->tx_tail - (int) ah->last_send >= 0) { |
359 | list_del(&ah->list); | 359 | list_del(&ah->list); |
360 | list_add_tail(&ah->list, &remove_list); | 360 | list_add_tail(&ah->list, &remove_list); |
361 | } | 361 | } |
@@ -486,7 +486,7 @@ int ipoib_ib_dev_stop(struct net_device *dev) | |||
486 | * assume the HW is wedged and just free up | 486 | * assume the HW is wedged and just free up |
487 | * all our pending work requests. | 487 | * all our pending work requests. |
488 | */ | 488 | */ |
489 | while (priv->tx_tail < priv->tx_head) { | 489 | while ((int) priv->tx_tail - (int) priv->tx_head < 0) { |
490 | tx_req = &priv->tx_ring[priv->tx_tail & | 490 | tx_req = &priv->tx_ring[priv->tx_tail & |
491 | (IPOIB_TX_RING_SIZE - 1)]; | 491 | (IPOIB_TX_RING_SIZE - 1)]; |
492 | dma_unmap_single(priv->ca->dma_device, | 492 | dma_unmap_single(priv->ca->dma_device, |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index a5a4c0ed8a14..a6d3baa46f61 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -869,11 +869,17 @@ static void suspend_targets(struct dm_table *t, unsigned postsuspend) | |||
869 | 869 | ||
870 | void dm_table_presuspend_targets(struct dm_table *t) | 870 | void dm_table_presuspend_targets(struct dm_table *t) |
871 | { | 871 | { |
872 | if (!t) | ||
873 | return; | ||
874 | |||
872 | return suspend_targets(t, 0); | 875 | return suspend_targets(t, 0); |
873 | } | 876 | } |
874 | 877 | ||
875 | void dm_table_postsuspend_targets(struct dm_table *t) | 878 | void dm_table_postsuspend_targets(struct dm_table *t) |
876 | { | 879 | { |
880 | if (!t) | ||
881 | return; | ||
882 | |||
877 | return suspend_targets(t, 1); | 883 | return suspend_targets(t, 1); |
878 | } | 884 | } |
879 | 885 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 54fabbf06678..d487d9deb98e 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -55,10 +55,10 @@ union map_info *dm_get_mapinfo(struct bio *bio) | |||
55 | */ | 55 | */ |
56 | #define DMF_BLOCK_IO 0 | 56 | #define DMF_BLOCK_IO 0 |
57 | #define DMF_SUSPENDED 1 | 57 | #define DMF_SUSPENDED 1 |
58 | #define DMF_FS_LOCKED 2 | ||
59 | 58 | ||
60 | struct mapped_device { | 59 | struct mapped_device { |
61 | struct rw_semaphore lock; | 60 | struct rw_semaphore io_lock; |
61 | struct semaphore suspend_lock; | ||
62 | rwlock_t map_lock; | 62 | rwlock_t map_lock; |
63 | atomic_t holders; | 63 | atomic_t holders; |
64 | 64 | ||
@@ -248,16 +248,16 @@ static inline void free_tio(struct mapped_device *md, struct target_io *tio) | |||
248 | */ | 248 | */ |
249 | static int queue_io(struct mapped_device *md, struct bio *bio) | 249 | static int queue_io(struct mapped_device *md, struct bio *bio) |
250 | { | 250 | { |
251 | down_write(&md->lock); | 251 | down_write(&md->io_lock); |
252 | 252 | ||
253 | if (!test_bit(DMF_BLOCK_IO, &md->flags)) { | 253 | if (!test_bit(DMF_BLOCK_IO, &md->flags)) { |
254 | up_write(&md->lock); | 254 | up_write(&md->io_lock); |
255 | return 1; | 255 | return 1; |
256 | } | 256 | } |
257 | 257 | ||
258 | bio_list_add(&md->deferred, bio); | 258 | bio_list_add(&md->deferred, bio); |
259 | 259 | ||
260 | up_write(&md->lock); | 260 | up_write(&md->io_lock); |
261 | return 0; /* deferred successfully */ | 261 | return 0; /* deferred successfully */ |
262 | } | 262 | } |
263 | 263 | ||
@@ -568,14 +568,14 @@ static int dm_request(request_queue_t *q, struct bio *bio) | |||
568 | int r; | 568 | int r; |
569 | struct mapped_device *md = q->queuedata; | 569 | struct mapped_device *md = q->queuedata; |
570 | 570 | ||
571 | down_read(&md->lock); | 571 | down_read(&md->io_lock); |
572 | 572 | ||
573 | /* | 573 | /* |
574 | * If we're suspended we have to queue | 574 | * If we're suspended we have to queue |
575 | * this io for later. | 575 | * this io for later. |
576 | */ | 576 | */ |
577 | while (test_bit(DMF_BLOCK_IO, &md->flags)) { | 577 | while (test_bit(DMF_BLOCK_IO, &md->flags)) { |
578 | up_read(&md->lock); | 578 | up_read(&md->io_lock); |
579 | 579 | ||
580 | if (bio_rw(bio) == READA) { | 580 | if (bio_rw(bio) == READA) { |
581 | bio_io_error(bio, bio->bi_size); | 581 | bio_io_error(bio, bio->bi_size); |
@@ -594,11 +594,11 @@ static int dm_request(request_queue_t *q, struct bio *bio) | |||
594 | * We're in a while loop, because someone could suspend | 594 | * We're in a while loop, because someone could suspend |
595 | * before we get to the following read lock. | 595 | * before we get to the following read lock. |
596 | */ | 596 | */ |
597 | down_read(&md->lock); | 597 | down_read(&md->io_lock); |
598 | } | 598 | } |
599 | 599 | ||
600 | __split_bio(md, bio); | 600 | __split_bio(md, bio); |
601 | up_read(&md->lock); | 601 | up_read(&md->io_lock); |
602 | return 0; | 602 | return 0; |
603 | } | 603 | } |
604 | 604 | ||
@@ -610,7 +610,7 @@ static int dm_flush_all(request_queue_t *q, struct gendisk *disk, | |||
610 | int ret = -ENXIO; | 610 | int ret = -ENXIO; |
611 | 611 | ||
612 | if (map) { | 612 | if (map) { |
613 | ret = dm_table_flush_all(md->map); | 613 | ret = dm_table_flush_all(map); |
614 | dm_table_put(map); | 614 | dm_table_put(map); |
615 | } | 615 | } |
616 | 616 | ||
@@ -747,7 +747,8 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent) | |||
747 | goto bad1; | 747 | goto bad1; |
748 | 748 | ||
749 | memset(md, 0, sizeof(*md)); | 749 | memset(md, 0, sizeof(*md)); |
750 | init_rwsem(&md->lock); | 750 | init_rwsem(&md->io_lock); |
751 | init_MUTEX(&md->suspend_lock); | ||
751 | rwlock_init(&md->map_lock); | 752 | rwlock_init(&md->map_lock); |
752 | atomic_set(&md->holders, 1); | 753 | atomic_set(&md->holders, 1); |
753 | atomic_set(&md->event_nr, 0); | 754 | atomic_set(&md->event_nr, 0); |
@@ -825,18 +826,13 @@ static void event_callback(void *context) | |||
825 | wake_up(&md->eventq); | 826 | wake_up(&md->eventq); |
826 | } | 827 | } |
827 | 828 | ||
828 | static void __set_size(struct gendisk *disk, sector_t size) | 829 | static void __set_size(struct mapped_device *md, sector_t size) |
829 | { | 830 | { |
830 | struct block_device *bdev; | 831 | set_capacity(md->disk, size); |
831 | 832 | ||
832 | set_capacity(disk, size); | 833 | down(&md->frozen_bdev->bd_inode->i_sem); |
833 | bdev = bdget_disk(disk, 0); | 834 | i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
834 | if (bdev) { | 835 | up(&md->frozen_bdev->bd_inode->i_sem); |
835 | down(&bdev->bd_inode->i_sem); | ||
836 | i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | ||
837 | up(&bdev->bd_inode->i_sem); | ||
838 | bdput(bdev); | ||
839 | } | ||
840 | } | 836 | } |
841 | 837 | ||
842 | static int __bind(struct mapped_device *md, struct dm_table *t) | 838 | static int __bind(struct mapped_device *md, struct dm_table *t) |
@@ -845,17 +841,18 @@ static int __bind(struct mapped_device *md, struct dm_table *t) | |||
845 | sector_t size; | 841 | sector_t size; |
846 | 842 | ||
847 | size = dm_table_get_size(t); | 843 | size = dm_table_get_size(t); |
848 | __set_size(md->disk, size); | 844 | __set_size(md, size); |
849 | if (size == 0) | 845 | if (size == 0) |
850 | return 0; | 846 | return 0; |
851 | 847 | ||
848 | dm_table_get(t); | ||
849 | dm_table_event_callback(t, event_callback, md); | ||
850 | |||
852 | write_lock(&md->map_lock); | 851 | write_lock(&md->map_lock); |
853 | md->map = t; | 852 | md->map = t; |
853 | dm_table_set_restrictions(t, q); | ||
854 | write_unlock(&md->map_lock); | 854 | write_unlock(&md->map_lock); |
855 | 855 | ||
856 | dm_table_get(t); | ||
857 | dm_table_event_callback(md->map, event_callback, md); | ||
858 | dm_table_set_restrictions(t, q); | ||
859 | return 0; | 856 | return 0; |
860 | } | 857 | } |
861 | 858 | ||
@@ -935,7 +932,7 @@ void dm_put(struct mapped_device *md) | |||
935 | struct dm_table *map = dm_get_table(md); | 932 | struct dm_table *map = dm_get_table(md); |
936 | 933 | ||
937 | if (atomic_dec_and_test(&md->holders)) { | 934 | if (atomic_dec_and_test(&md->holders)) { |
938 | if (!test_bit(DMF_SUSPENDED, &md->flags) && map) { | 935 | if (!dm_suspended(md)) { |
939 | dm_table_presuspend_targets(map); | 936 | dm_table_presuspend_targets(map); |
940 | dm_table_postsuspend_targets(map); | 937 | dm_table_postsuspend_targets(map); |
941 | } | 938 | } |
@@ -968,17 +965,17 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table) | |||
968 | { | 965 | { |
969 | int r = -EINVAL; | 966 | int r = -EINVAL; |
970 | 967 | ||
971 | down_write(&md->lock); | 968 | down(&md->suspend_lock); |
972 | 969 | ||
973 | /* device must be suspended */ | 970 | /* device must be suspended */ |
974 | if (!test_bit(DMF_SUSPENDED, &md->flags)) | 971 | if (!dm_suspended(md)) |
975 | goto out; | 972 | goto out; |
976 | 973 | ||
977 | __unbind(md); | 974 | __unbind(md); |
978 | r = __bind(md, table); | 975 | r = __bind(md, table); |
979 | 976 | ||
980 | out: | 977 | out: |
981 | up_write(&md->lock); | 978 | up(&md->suspend_lock); |
982 | return r; | 979 | return r; |
983 | } | 980 | } |
984 | 981 | ||
@@ -986,16 +983,13 @@ out: | |||
986 | * Functions to lock and unlock any filesystem running on the | 983 | * Functions to lock and unlock any filesystem running on the |
987 | * device. | 984 | * device. |
988 | */ | 985 | */ |
989 | static int __lock_fs(struct mapped_device *md) | 986 | static int lock_fs(struct mapped_device *md) |
990 | { | 987 | { |
991 | int error = -ENOMEM; | 988 | int r = -ENOMEM; |
992 | |||
993 | if (test_and_set_bit(DMF_FS_LOCKED, &md->flags)) | ||
994 | return 0; | ||
995 | 989 | ||
996 | md->frozen_bdev = bdget_disk(md->disk, 0); | 990 | md->frozen_bdev = bdget_disk(md->disk, 0); |
997 | if (!md->frozen_bdev) { | 991 | if (!md->frozen_bdev) { |
998 | DMWARN("bdget failed in __lock_fs"); | 992 | DMWARN("bdget failed in lock_fs"); |
999 | goto out; | 993 | goto out; |
1000 | } | 994 | } |
1001 | 995 | ||
@@ -1003,13 +997,13 @@ static int __lock_fs(struct mapped_device *md) | |||
1003 | 997 | ||
1004 | md->frozen_sb = freeze_bdev(md->frozen_bdev); | 998 | md->frozen_sb = freeze_bdev(md->frozen_bdev); |
1005 | if (IS_ERR(md->frozen_sb)) { | 999 | if (IS_ERR(md->frozen_sb)) { |
1006 | error = PTR_ERR(md->frozen_sb); | 1000 | r = PTR_ERR(md->frozen_sb); |
1007 | goto out_bdput; | 1001 | goto out_bdput; |
1008 | } | 1002 | } |
1009 | 1003 | ||
1010 | /* don't bdput right now, we don't want the bdev | 1004 | /* don't bdput right now, we don't want the bdev |
1011 | * to go away while it is locked. We'll bdput | 1005 | * to go away while it is locked. We'll bdput |
1012 | * in __unlock_fs | 1006 | * in unlock_fs |
1013 | */ | 1007 | */ |
1014 | return 0; | 1008 | return 0; |
1015 | 1009 | ||
@@ -1018,15 +1012,11 @@ out_bdput: | |||
1018 | md->frozen_sb = NULL; | 1012 | md->frozen_sb = NULL; |
1019 | md->frozen_bdev = NULL; | 1013 | md->frozen_bdev = NULL; |
1020 | out: | 1014 | out: |
1021 | clear_bit(DMF_FS_LOCKED, &md->flags); | 1015 | return r; |
1022 | return error; | ||
1023 | } | 1016 | } |
1024 | 1017 | ||
1025 | static void __unlock_fs(struct mapped_device *md) | 1018 | static void unlock_fs(struct mapped_device *md) |
1026 | { | 1019 | { |
1027 | if (!test_and_clear_bit(DMF_FS_LOCKED, &md->flags)) | ||
1028 | return; | ||
1029 | |||
1030 | thaw_bdev(md->frozen_bdev, md->frozen_sb); | 1020 | thaw_bdev(md->frozen_bdev, md->frozen_sb); |
1031 | bdput(md->frozen_bdev); | 1021 | bdput(md->frozen_bdev); |
1032 | 1022 | ||
@@ -1043,50 +1033,37 @@ static void __unlock_fs(struct mapped_device *md) | |||
1043 | */ | 1033 | */ |
1044 | int dm_suspend(struct mapped_device *md) | 1034 | int dm_suspend(struct mapped_device *md) |
1045 | { | 1035 | { |
1046 | struct dm_table *map; | 1036 | struct dm_table *map = NULL; |
1047 | DECLARE_WAITQUEUE(wait, current); | 1037 | DECLARE_WAITQUEUE(wait, current); |
1048 | int error = -EINVAL; | 1038 | int r = -EINVAL; |
1049 | 1039 | ||
1050 | /* Flush I/O to the device. */ | 1040 | down(&md->suspend_lock); |
1051 | down_read(&md->lock); | 1041 | |
1052 | if (test_bit(DMF_BLOCK_IO, &md->flags)) | 1042 | if (dm_suspended(md)) |
1053 | goto out_read_unlock; | 1043 | goto out; |
1054 | 1044 | ||
1055 | map = dm_get_table(md); | 1045 | map = dm_get_table(md); |
1056 | if (map) | ||
1057 | /* This does not get reverted if there's an error later. */ | ||
1058 | dm_table_presuspend_targets(map); | ||
1059 | 1046 | ||
1060 | error = __lock_fs(md); | 1047 | /* This does not get reverted if there's an error later. */ |
1061 | if (error) { | 1048 | dm_table_presuspend_targets(map); |
1062 | dm_table_put(map); | ||
1063 | goto out_read_unlock; | ||
1064 | } | ||
1065 | 1049 | ||
1066 | up_read(&md->lock); | 1050 | /* Flush I/O to the device. */ |
1051 | r = lock_fs(md); | ||
1052 | if (r) | ||
1053 | goto out; | ||
1067 | 1054 | ||
1068 | /* | 1055 | /* |
1069 | * First we set the BLOCK_IO flag so no more ios will be mapped. | 1056 | * First we set the BLOCK_IO flag so no more ios will be mapped. |
1070 | * | ||
1071 | * If the flag is already set we know another thread is trying to | ||
1072 | * suspend as well, so we leave the fs locked for this thread. | ||
1073 | */ | 1057 | */ |
1074 | error = -EINVAL; | 1058 | down_write(&md->io_lock); |
1075 | down_write(&md->lock); | 1059 | set_bit(DMF_BLOCK_IO, &md->flags); |
1076 | if (test_and_set_bit(DMF_BLOCK_IO, &md->flags)) { | ||
1077 | if (map) | ||
1078 | dm_table_put(map); | ||
1079 | goto out_write_unlock; | ||
1080 | } | ||
1081 | 1060 | ||
1082 | add_wait_queue(&md->wait, &wait); | 1061 | add_wait_queue(&md->wait, &wait); |
1083 | up_write(&md->lock); | 1062 | up_write(&md->io_lock); |
1084 | 1063 | ||
1085 | /* unplug */ | 1064 | /* unplug */ |
1086 | if (map) { | 1065 | if (map) |
1087 | dm_table_unplug_all(map); | 1066 | dm_table_unplug_all(map); |
1088 | dm_table_put(map); | ||
1089 | } | ||
1090 | 1067 | ||
1091 | /* | 1068 | /* |
1092 | * Then we wait for the already mapped ios to | 1069 | * Then we wait for the already mapped ios to |
@@ -1102,62 +1079,67 @@ int dm_suspend(struct mapped_device *md) | |||
1102 | } | 1079 | } |
1103 | set_current_state(TASK_RUNNING); | 1080 | set_current_state(TASK_RUNNING); |
1104 | 1081 | ||
1105 | down_write(&md->lock); | 1082 | down_write(&md->io_lock); |
1106 | remove_wait_queue(&md->wait, &wait); | 1083 | remove_wait_queue(&md->wait, &wait); |
1107 | 1084 | ||
1108 | /* were we interrupted ? */ | 1085 | /* were we interrupted ? */ |
1109 | error = -EINTR; | 1086 | r = -EINTR; |
1110 | if (atomic_read(&md->pending)) | 1087 | if (atomic_read(&md->pending)) { |
1111 | goto out_unfreeze; | 1088 | up_write(&md->io_lock); |
1112 | 1089 | unlock_fs(md); | |
1113 | set_bit(DMF_SUSPENDED, &md->flags); | 1090 | clear_bit(DMF_BLOCK_IO, &md->flags); |
1091 | goto out; | ||
1092 | } | ||
1093 | up_write(&md->io_lock); | ||
1114 | 1094 | ||
1115 | map = dm_get_table(md); | 1095 | dm_table_postsuspend_targets(map); |
1116 | if (map) | ||
1117 | dm_table_postsuspend_targets(map); | ||
1118 | dm_table_put(map); | ||
1119 | up_write(&md->lock); | ||
1120 | 1096 | ||
1121 | return 0; | 1097 | set_bit(DMF_SUSPENDED, &md->flags); |
1122 | 1098 | ||
1123 | out_unfreeze: | 1099 | r = 0; |
1124 | __unlock_fs(md); | ||
1125 | clear_bit(DMF_BLOCK_IO, &md->flags); | ||
1126 | out_write_unlock: | ||
1127 | up_write(&md->lock); | ||
1128 | return error; | ||
1129 | 1100 | ||
1130 | out_read_unlock: | 1101 | out: |
1131 | up_read(&md->lock); | 1102 | dm_table_put(map); |
1132 | return error; | 1103 | up(&md->suspend_lock); |
1104 | return r; | ||
1133 | } | 1105 | } |
1134 | 1106 | ||
1135 | int dm_resume(struct mapped_device *md) | 1107 | int dm_resume(struct mapped_device *md) |
1136 | { | 1108 | { |
1109 | int r = -EINVAL; | ||
1137 | struct bio *def; | 1110 | struct bio *def; |
1138 | struct dm_table *map = dm_get_table(md); | 1111 | struct dm_table *map = NULL; |
1139 | 1112 | ||
1140 | down_write(&md->lock); | 1113 | down(&md->suspend_lock); |
1141 | if (!map || | 1114 | if (!dm_suspended(md)) |
1142 | !test_bit(DMF_SUSPENDED, &md->flags) || | 1115 | goto out; |
1143 | !dm_table_get_size(map)) { | 1116 | |
1144 | up_write(&md->lock); | 1117 | map = dm_get_table(md); |
1145 | dm_table_put(map); | 1118 | if (!map || !dm_table_get_size(map)) |
1146 | return -EINVAL; | 1119 | goto out; |
1147 | } | ||
1148 | 1120 | ||
1149 | dm_table_resume_targets(map); | 1121 | dm_table_resume_targets(map); |
1150 | clear_bit(DMF_SUSPENDED, &md->flags); | 1122 | |
1123 | down_write(&md->io_lock); | ||
1151 | clear_bit(DMF_BLOCK_IO, &md->flags); | 1124 | clear_bit(DMF_BLOCK_IO, &md->flags); |
1152 | 1125 | ||
1153 | def = bio_list_get(&md->deferred); | 1126 | def = bio_list_get(&md->deferred); |
1154 | __flush_deferred_io(md, def); | 1127 | __flush_deferred_io(md, def); |
1155 | up_write(&md->lock); | 1128 | up_write(&md->io_lock); |
1156 | __unlock_fs(md); | 1129 | |
1130 | unlock_fs(md); | ||
1131 | |||
1132 | clear_bit(DMF_SUSPENDED, &md->flags); | ||
1133 | |||
1157 | dm_table_unplug_all(map); | 1134 | dm_table_unplug_all(map); |
1135 | |||
1136 | r = 0; | ||
1137 | |||
1138 | out: | ||
1158 | dm_table_put(map); | 1139 | dm_table_put(map); |
1140 | up(&md->suspend_lock); | ||
1159 | 1141 | ||
1160 | return 0; | 1142 | return r; |
1161 | } | 1143 | } |
1162 | 1144 | ||
1163 | /*----------------------------------------------------------------- | 1145 | /*----------------------------------------------------------------- |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index b96d6fb1929e..2c6dc24c3728 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1450,6 +1450,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1450 | /* Write the contents of the packet */ | 1450 | /* Write the contents of the packet */ |
1451 | outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); | 1451 | outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); |
1452 | spin_unlock_irq(&lp->lock); | 1452 | spin_unlock_irq(&lp->lock); |
1453 | lp->stats.tx_bytes += skb->len; | ||
1453 | dev->trans_start = jiffies; | 1454 | dev->trans_start = jiffies; |
1454 | dev_kfree_skb (skb); | 1455 | dev_kfree_skb (skb); |
1455 | 1456 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index cb7f051a60ad..5e5d2c3c7ce4 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -162,7 +162,6 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); | |||
162 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); | 162 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); |
163 | static void e1000_restore_vlan(struct e1000_adapter *adapter); | 163 | static void e1000_restore_vlan(struct e1000_adapter *adapter); |
164 | 164 | ||
165 | static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr); | ||
166 | static int e1000_suspend(struct pci_dev *pdev, uint32_t state); | 165 | static int e1000_suspend(struct pci_dev *pdev, uint32_t state); |
167 | #ifdef CONFIG_PM | 166 | #ifdef CONFIG_PM |
168 | static int e1000_resume(struct pci_dev *pdev); | 167 | static int e1000_resume(struct pci_dev *pdev); |
@@ -173,12 +172,6 @@ static int e1000_resume(struct pci_dev *pdev); | |||
173 | static void e1000_netpoll (struct net_device *netdev); | 172 | static void e1000_netpoll (struct net_device *netdev); |
174 | #endif | 173 | #endif |
175 | 174 | ||
176 | struct notifier_block e1000_notifier_reboot = { | ||
177 | .notifier_call = e1000_notify_reboot, | ||
178 | .next = NULL, | ||
179 | .priority = 0 | ||
180 | }; | ||
181 | |||
182 | /* Exported from other modules */ | 175 | /* Exported from other modules */ |
183 | 176 | ||
184 | extern void e1000_check_options(struct e1000_adapter *adapter); | 177 | extern void e1000_check_options(struct e1000_adapter *adapter); |
@@ -221,9 +214,7 @@ e1000_init_module(void) | |||
221 | printk(KERN_INFO "%s\n", e1000_copyright); | 214 | printk(KERN_INFO "%s\n", e1000_copyright); |
222 | 215 | ||
223 | ret = pci_module_init(&e1000_driver); | 216 | ret = pci_module_init(&e1000_driver); |
224 | if(ret >= 0) { | 217 | |
225 | register_reboot_notifier(&e1000_notifier_reboot); | ||
226 | } | ||
227 | return ret; | 218 | return ret; |
228 | } | 219 | } |
229 | 220 | ||
@@ -239,7 +230,6 @@ module_init(e1000_init_module); | |||
239 | static void __exit | 230 | static void __exit |
240 | e1000_exit_module(void) | 231 | e1000_exit_module(void) |
241 | { | 232 | { |
242 | unregister_reboot_notifier(&e1000_notifier_reboot); | ||
243 | pci_unregister_driver(&e1000_driver); | 233 | pci_unregister_driver(&e1000_driver); |
244 | } | 234 | } |
245 | 235 | ||
@@ -3652,23 +3642,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx) | |||
3652 | } | 3642 | } |
3653 | 3643 | ||
3654 | static int | 3644 | static int |
3655 | e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) | ||
3656 | { | ||
3657 | struct pci_dev *pdev = NULL; | ||
3658 | |||
3659 | switch(event) { | ||
3660 | case SYS_DOWN: | ||
3661 | case SYS_HALT: | ||
3662 | case SYS_POWER_OFF: | ||
3663 | while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) { | ||
3664 | if(pci_dev_driver(pdev) == &e1000_driver) | ||
3665 | e1000_suspend(pdev, 3); | ||
3666 | } | ||
3667 | } | ||
3668 | return NOTIFY_DONE; | ||
3669 | } | ||
3670 | |||
3671 | static int | ||
3672 | e1000_suspend(struct pci_dev *pdev, uint32_t state) | 3645 | e1000_suspend(struct pci_dev *pdev, uint32_t state) |
3673 | { | 3646 | { |
3674 | struct net_device *netdev = pci_get_drvdata(pdev); | 3647 | struct net_device *netdev = pci_get_drvdata(pdev); |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index dbb941004ae9..980d7e5d66cb 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1671,7 +1671,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1671 | 1671 | ||
1672 | static struct pcmcia_device_id nmclan_ids[] = { | 1672 | static struct pcmcia_device_id nmclan_ids[] = { |
1673 | PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), | 1673 | PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), |
1674 | PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet", 0x0ebf1d60, 0x00b2e941), | 1674 | PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf), |
1675 | PCMCIA_DEVICE_NULL, | 1675 | PCMCIA_DEVICE_NULL, |
1676 | }; | 1676 | }; |
1677 | MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); | 1677 | MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index e1664aef3dfd..9f22d138e3ad 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1639,7 +1639,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1639 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab), | 1639 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab), |
1640 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101), | 1640 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101), |
1641 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), | 1641 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), |
1642 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), | 1642 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4), |
1643 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), | 1643 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), |
1644 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), | 1644 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), |
1645 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), | 1645 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), |
@@ -1683,7 +1683,6 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1683 | PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11), | 1683 | PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11), |
1684 | PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff), | 1684 | PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff), |
1685 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), | 1685 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), |
1686 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM", 0xbb7fbdd7, 0x5ba10d49), | ||
1687 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), | 1686 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), |
1688 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), | 1687 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), |
1689 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), | 1688 | PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), |
@@ -1719,6 +1718,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1719 | PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e), | 1718 | PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e), |
1720 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398), | 1719 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398), |
1721 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b), | 1720 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b), |
1721 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660+", 0x1a424a1c, 0x50dcd0ec), | ||
1722 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), | 1722 | PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), |
1723 | PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), | 1723 | PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), |
1724 | PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), | 1724 | PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), |
@@ -1737,6 +1737,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1737 | PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), | 1737 | PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), |
1738 | PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), | 1738 | PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), |
1739 | PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), | 1739 | PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), |
1740 | PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494), | ||
1740 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), | 1741 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), |
1741 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), | 1742 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), |
1742 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), | 1743 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), |
@@ -1753,7 +1754,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1753 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), | 1754 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), |
1754 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), | 1755 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), |
1755 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), | 1756 | PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), |
1756 | PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline ", 0x0733cc81, 0x5e07cfa0), | 1757 | PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a), |
1757 | PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), | 1758 | PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), |
1758 | PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), | 1759 | PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), |
1759 | PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), | 1760 | PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 0d8bb4cccbb7..d652e1eddb45 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -2332,8 +2332,8 @@ static struct pcmcia_device_id smc91c92_ids[] = { | |||
2332 | PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), | 2332 | PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), |
2333 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), | 2333 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), |
2334 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), | 2334 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), |
2335 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), | 2335 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9), |
2336 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), | 2336 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed), |
2337 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020), | 2337 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020), |
2338 | PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023), | 2338 | PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023), |
2339 | PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb), | 2339 | PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb), |
@@ -2343,8 +2343,8 @@ static struct pcmcia_device_id smc91c92_ids[] = { | |||
2343 | PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9), | 2343 | PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9), |
2344 | PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953), | 2344 | PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953), |
2345 | PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a), | 2345 | PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a), |
2346 | PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), | 2346 | PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Four of Diamonds Ethernet", 0xc2f80cd, 0xb3466314), |
2347 | PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), | 2347 | PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Seven of Diamonds Ethernet", 0xc2f80cd, 0x194b650a), |
2348 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc), | 2348 | PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc), |
2349 | PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9), | 2349 | PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9), |
2350 | PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d), | 2350 | PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d), |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 9f33bad174e9..ce143f08638a 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1985,7 +1985,7 @@ static struct pcmcia_device_id xirc2ps_ids[] = { | |||
1985 | PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), | 1985 | PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), |
1986 | PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), | 1986 | PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), |
1987 | PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), | 1987 | PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), |
1988 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), | 1988 | PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf), |
1989 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a), | 1989 | PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a), |
1990 | PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2), | 1990 | PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2), |
1991 | PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37), | 1991 | PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37), |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 368d2f962f67..1cc1492083c9 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -621,8 +621,6 @@ static struct pcmcia_device_id orinoco_cs_ids[] = { | |||
621 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), | 621 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), |
622 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), | 622 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), |
623 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), | 623 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), |
624 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), | ||
625 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), | ||
626 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), | 624 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), |
627 | PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), | 625 | PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), |
628 | PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), | 626 | PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), |
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index 0a5c95807cf2..470ef756252e 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c | |||
@@ -388,6 +388,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
388 | struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); | 388 | struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); |
389 | memset(skt, 0, sizeof(*skt)); | 389 | memset(skt, 0, sizeof(*skt)); |
390 | 390 | ||
391 | skt->socket.resource_ops = &pccard_static_ops; | ||
391 | skt->socket.ops = &au1x00_pcmcia_operations; | 392 | skt->socket.ops = &au1x00_pcmcia_operations; |
392 | skt->socket.owner = ops->owner; | 393 | skt->socket.owner = ops->owner; |
393 | skt->socket.dev.dev = dev; | 394 | skt->socket.dev.dev = dev; |
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index dd7651ff5b43..3afb682255a0 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -88,31 +88,38 @@ EXPORT_SYMBOL(release_cis_mem); | |||
88 | static void __iomem * | 88 | static void __iomem * |
89 | set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) | 89 | set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) |
90 | { | 90 | { |
91 | pccard_mem_map *mem = &s->cis_mem; | 91 | pccard_mem_map *mem = &s->cis_mem; |
92 | int ret; | 92 | int ret; |
93 | |||
94 | if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) { | ||
95 | mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); | ||
96 | if (mem->res == NULL) { | ||
97 | printk(KERN_NOTICE "cs: unable to map card memory!\n"); | ||
98 | return NULL; | ||
99 | } | ||
100 | s->cis_virt = NULL; | ||
101 | } | ||
93 | 102 | ||
94 | if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { | 103 | if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt)) |
95 | mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); | 104 | s->cis_virt = ioremap(mem->res->start, s->map_size); |
96 | if (mem->res == NULL) { | 105 | |
97 | printk(KERN_NOTICE "cs: unable to map card memory!\n"); | 106 | mem->card_start = card_offset; |
98 | return NULL; | 107 | mem->flags = flags; |
108 | |||
109 | ret = s->ops->set_mem_map(s, mem); | ||
110 | if (ret) { | ||
111 | iounmap(s->cis_virt); | ||
112 | s->cis_virt = NULL; | ||
113 | return NULL; | ||
99 | } | 114 | } |
100 | s->cis_virt = ioremap(mem->res->start, s->map_size); | ||
101 | } | ||
102 | mem->card_start = card_offset; | ||
103 | mem->flags = flags; | ||
104 | ret = s->ops->set_mem_map(s, mem); | ||
105 | if (ret) { | ||
106 | iounmap(s->cis_virt); | ||
107 | return NULL; | ||
108 | } | ||
109 | 115 | ||
110 | if (s->features & SS_CAP_STATIC_MAP) { | 116 | if (s->features & SS_CAP_STATIC_MAP) { |
111 | if (s->cis_virt) | 117 | if (s->cis_virt) |
112 | iounmap(s->cis_virt); | 118 | iounmap(s->cis_virt); |
113 | s->cis_virt = ioremap(mem->static_start, s->map_size); | 119 | s->cis_virt = ioremap(mem->static_start, s->map_size); |
114 | } | 120 | } |
115 | return s->cis_virt; | 121 | |
122 | return s->cis_virt; | ||
116 | } | 123 | } |
117 | 124 | ||
118 | /*====================================================================== | 125 | /*====================================================================== |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 3e3c6f12bbe6..d63f22a5bf7e 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -206,8 +206,8 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
206 | u32 hash; | 206 | u32 hash; |
207 | 207 | ||
208 | if (!p_drv->attach || !p_drv->event || !p_drv->detach) | 208 | if (!p_drv->attach || !p_drv->event || !p_drv->detach) |
209 | printk(KERN_DEBUG "pcmcia: %s does misses a callback function", | 209 | printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback " |
210 | p_drv->drv.name); | 210 | "function\n", p_drv->drv.name); |
211 | 211 | ||
212 | while (did && did->match_flags) { | 212 | while (did && did->match_flags) { |
213 | for (i=0; i<4; i++) { | 213 | for (i=0; i<4; i++) { |
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h index b1f6e3d9ee06..a234ce1967a3 100644 --- a/drivers/pcmcia/o2micro.h +++ b/drivers/pcmcia/o2micro.h | |||
@@ -120,11 +120,16 @@ | |||
120 | #define O2_MODE_E_LED_OUT 0x08 | 120 | #define O2_MODE_E_LED_OUT 0x08 |
121 | #define O2_MODE_E_SKTA_ACTV 0x10 | 121 | #define O2_MODE_E_SKTA_ACTV 0x10 |
122 | 122 | ||
123 | #define O2_RESERVED1 0x94 | ||
124 | #define O2_RESERVED2 0xD4 | ||
125 | #define O2_RES_READ_PREFETCH 0x02 | ||
126 | #define O2_RES_WRITE_BURST 0x08 | ||
127 | |||
123 | static int o2micro_override(struct yenta_socket *socket) | 128 | static int o2micro_override(struct yenta_socket *socket) |
124 | { | 129 | { |
125 | /* | 130 | /* |
126 | * 'reserved' register at 0x94/D4. chaning it to 0xCA (8 bit) enables | 131 | * 'reserved' register at 0x94/D4. allows setting read prefetch and write |
127 | * read prefetching which for example makes the RME Hammerfall DSP | 132 | * bursting. read prefetching for example makes the RME Hammerfall DSP |
128 | * working. for some bridges it is at 0x94, for others at 0xD4. it's | 133 | * working. for some bridges it is at 0x94, for others at 0xD4. it's |
129 | * ok to write to both registers on all O2 bridges. | 134 | * ok to write to both registers on all O2 bridges. |
130 | * from Eric Still, 02Micro. | 135 | * from Eric Still, 02Micro. |
@@ -132,20 +137,35 @@ static int o2micro_override(struct yenta_socket *socket) | |||
132 | u8 a, b; | 137 | u8 a, b; |
133 | 138 | ||
134 | if (PCI_FUNC(socket->dev->devfn) == 0) { | 139 | if (PCI_FUNC(socket->dev->devfn) == 0) { |
135 | a = config_readb(socket, 0x94); | 140 | a = config_readb(socket, O2_RESERVED1); |
136 | b = config_readb(socket, 0xD4); | 141 | b = config_readb(socket, O2_RESERVED2); |
137 | 142 | ||
138 | printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); | 143 | printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); |
139 | 144 | ||
140 | switch (socket->dev->device) { | 145 | switch (socket->dev->device) { |
146 | /* | ||
147 | * older bridges have problems with both read prefetch and write | ||
148 | * bursting depending on the combination of the chipset, bridge | ||
149 | * and the cardbus card. so disable them to be on the safe side. | ||
150 | */ | ||
151 | case PCI_DEVICE_ID_O2_6729: | ||
152 | case PCI_DEVICE_ID_O2_6730: | ||
153 | case PCI_DEVICE_ID_O2_6812: | ||
141 | case PCI_DEVICE_ID_O2_6832: | 154 | case PCI_DEVICE_ID_O2_6832: |
142 | printk(KERN_INFO "Yenta O2: old bridge, not enabling read prefetch / write burst\n"); | 155 | case PCI_DEVICE_ID_O2_6836: |
156 | printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n"); | ||
157 | config_writeb(socket, O2_RESERVED1, | ||
158 | a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); | ||
159 | config_writeb(socket, O2_RESERVED2, | ||
160 | b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); | ||
143 | break; | 161 | break; |
144 | 162 | ||
145 | default: | 163 | default: |
146 | printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); | 164 | printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); |
147 | config_writeb(socket, 0x94, a | 0x0a); | 165 | config_writeb(socket, O2_RESERVED1, |
148 | config_writeb(socket, 0xD4, b | 0x0a); | 166 | a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); |
167 | config_writeb(socket, O2_RESERVED2, | ||
168 | b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); | ||
149 | } | 169 | } |
150 | } | 170 | } |
151 | 171 | ||
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 184f4f88b2a0..6f9fdb276402 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -800,7 +800,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
800 | } else { | 800 | } else { |
801 | int try; | 801 | int try; |
802 | u32 mask = s->irq_mask; | 802 | u32 mask = s->irq_mask; |
803 | void *data = NULL; | 803 | void *data = &p_dev->dev.driver; /* something unique to this device */ |
804 | 804 | ||
805 | for (try = 0; try < 64; try++) { | 805 | for (try = 0; try < 64; try++) { |
806 | irq = try % 32; | 806 | irq = try % 32; |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 6837491f021c..744e469a9eda 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -1107,6 +1107,8 @@ static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) | |||
1107 | pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); | 1107 | pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); |
1108 | pci_disable_device(dev); | 1108 | pci_disable_device(dev); |
1109 | 1109 | ||
1110 | free_irq(dev->irq, socket); | ||
1111 | |||
1110 | /* | 1112 | /* |
1111 | * Some laptops (IBM T22) do not like us putting the Cardbus | 1113 | * Some laptops (IBM T22) do not like us putting the Cardbus |
1112 | * bridge into D3. At a guess, some other laptop will | 1114 | * bridge into D3. At a guess, some other laptop will |
@@ -1132,6 +1134,13 @@ static int yenta_dev_resume (struct pci_dev *dev) | |||
1132 | pci_enable_device(dev); | 1134 | pci_enable_device(dev); |
1133 | pci_set_master(dev); | 1135 | pci_set_master(dev); |
1134 | 1136 | ||
1137 | if (socket->cb_irq) | ||
1138 | if (request_irq(socket->cb_irq, yenta_interrupt, | ||
1139 | SA_SHIRQ, "yenta", socket)) { | ||
1140 | printk(KERN_WARNING "Yenta: request_irq() failed on resume!\n"); | ||
1141 | socket->cb_irq = 0; | ||
1142 | } | ||
1143 | |||
1135 | if (socket->type && socket->type->restore_state) | 1144 | if (socket->type && socket->type->restore_state) |
1136 | socket->type->restore_state(socket); | 1145 | socket->type->restore_state(socket); |
1137 | } | 1146 | } |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 3be546439252..a2cfade2c1c6 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -38,6 +38,7 @@ enum { | |||
38 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 38 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
39 | ICH5_PMR = 0x90, /* port mapping register */ | 39 | ICH5_PMR = 0x90, /* port mapping register */ |
40 | ICH5_PCS = 0x92, /* port control and status */ | 40 | ICH5_PCS = 0x92, /* port control and status */ |
41 | PIIX_SCC = 0x0A, /* sub-class code register */ | ||
41 | 42 | ||
42 | PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ | 43 | PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ |
43 | PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ | 44 | PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ |
@@ -62,6 +63,8 @@ enum { | |||
62 | ich6_sata_rm = 4, | 63 | ich6_sata_rm = 4, |
63 | ich7_sata = 5, | 64 | ich7_sata = 5, |
64 | esb2_sata = 6, | 65 | esb2_sata = 6, |
66 | |||
67 | PIIX_AHCI_DEVICE = 6, | ||
65 | }; | 68 | }; |
66 | 69 | ||
67 | static int piix_init_one (struct pci_dev *pdev, | 70 | static int piix_init_one (struct pci_dev *pdev, |
@@ -574,11 +577,11 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
574 | addr = pci_resource_start(pdev, AHCI_PCI_BAR); | 577 | addr = pci_resource_start(pdev, AHCI_PCI_BAR); |
575 | if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) | 578 | if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) |
576 | return 0; | 579 | return 0; |
577 | 580 | ||
578 | mmio = ioremap(addr, 64); | 581 | mmio = ioremap(addr, 64); |
579 | if (!mmio) | 582 | if (!mmio) |
580 | return -ENOMEM; | 583 | return -ENOMEM; |
581 | 584 | ||
582 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 585 | tmp = readl(mmio + AHCI_GLOBAL_CTL); |
583 | if (tmp & AHCI_ENABLE) { | 586 | if (tmp & AHCI_ENABLE) { |
584 | tmp &= ~AHCI_ENABLE; | 587 | tmp &= ~AHCI_ENABLE; |
@@ -588,7 +591,7 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
588 | if (tmp & AHCI_ENABLE) | 591 | if (tmp & AHCI_ENABLE) |
589 | rc = -EIO; | 592 | rc = -EIO; |
590 | } | 593 | } |
591 | 594 | ||
592 | iounmap(mmio); | 595 | iounmap(mmio); |
593 | return rc; | 596 | return rc; |
594 | } | 597 | } |
@@ -626,9 +629,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
626 | port_info[1] = NULL; | 629 | port_info[1] = NULL; |
627 | 630 | ||
628 | if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { | 631 | if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { |
629 | int rc = piix_disable_ahci(pdev); | 632 | u8 tmp; |
630 | if (rc) | 633 | pci_read_config_byte(pdev, PIIX_SCC, &tmp); |
631 | return rc; | 634 | if (tmp == PIIX_AHCI_DEVICE) { |
635 | int rc = piix_disable_ahci(pdev); | ||
636 | if (rc) | ||
637 | return rc; | ||
638 | } | ||
632 | } | 639 | } |
633 | 640 | ||
634 | if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { | 641 | if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { |
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig index 6c73b84c6e64..c1c1c687bcbd 100644 --- a/drivers/scsi/qla2xxx/Kconfig +++ b/drivers/scsi/qla2xxx/Kconfig | |||
@@ -7,6 +7,7 @@ config SCSI_QLA21XX | |||
7 | tristate "QLogic ISP2100 host adapter family support" | 7 | tristate "QLogic ISP2100 host adapter family support" |
8 | depends on SCSI_QLA2XXX | 8 | depends on SCSI_QLA2XXX |
9 | select SCSI_FC_ATTRS | 9 | select SCSI_FC_ATTRS |
10 | select FW_LOADER | ||
10 | ---help--- | 11 | ---help--- |
11 | This driver supports the QLogic 21xx (ISP2100) host adapter family. | 12 | This driver supports the QLogic 21xx (ISP2100) host adapter family. |
12 | 13 | ||
@@ -14,6 +15,7 @@ config SCSI_QLA22XX | |||
14 | tristate "QLogic ISP2200 host adapter family support" | 15 | tristate "QLogic ISP2200 host adapter family support" |
15 | depends on SCSI_QLA2XXX | 16 | depends on SCSI_QLA2XXX |
16 | select SCSI_FC_ATTRS | 17 | select SCSI_FC_ATTRS |
18 | select FW_LOADER | ||
17 | ---help--- | 19 | ---help--- |
18 | This driver supports the QLogic 22xx (ISP2200) host adapter family. | 20 | This driver supports the QLogic 22xx (ISP2200) host adapter family. |
19 | 21 | ||
@@ -21,6 +23,7 @@ config SCSI_QLA2300 | |||
21 | tristate "QLogic ISP2300 host adapter family support" | 23 | tristate "QLogic ISP2300 host adapter family support" |
22 | depends on SCSI_QLA2XXX | 24 | depends on SCSI_QLA2XXX |
23 | select SCSI_FC_ATTRS | 25 | select SCSI_FC_ATTRS |
26 | select FW_LOADER | ||
24 | ---help--- | 27 | ---help--- |
25 | This driver supports the QLogic 2300 (ISP2300 and ISP2312) host | 28 | This driver supports the QLogic 2300 (ISP2300 and ISP2312) host |
26 | adapter family. | 29 | adapter family. |
@@ -29,6 +32,7 @@ config SCSI_QLA2322 | |||
29 | tristate "QLogic ISP2322 host adapter family support" | 32 | tristate "QLogic ISP2322 host adapter family support" |
30 | depends on SCSI_QLA2XXX | 33 | depends on SCSI_QLA2XXX |
31 | select SCSI_FC_ATTRS | 34 | select SCSI_FC_ATTRS |
35 | select FW_LOADER | ||
32 | ---help--- | 36 | ---help--- |
33 | This driver supports the QLogic 2322 (ISP2322) host adapter family. | 37 | This driver supports the QLogic 2322 (ISP2322) host adapter family. |
34 | 38 | ||
@@ -36,6 +40,16 @@ config SCSI_QLA6312 | |||
36 | tristate "QLogic ISP63xx host adapter family support" | 40 | tristate "QLogic ISP63xx host adapter family support" |
37 | depends on SCSI_QLA2XXX | 41 | depends on SCSI_QLA2XXX |
38 | select SCSI_FC_ATTRS | 42 | select SCSI_FC_ATTRS |
43 | select FW_LOADER | ||
39 | ---help--- | 44 | ---help--- |
40 | This driver supports the QLogic 63xx (ISP6312 and ISP6322) host | 45 | This driver supports the QLogic 63xx (ISP6312 and ISP6322) host |
41 | adapter family. | 46 | adapter family. |
47 | |||
48 | config SCSI_QLA24XX | ||
49 | tristate "QLogic ISP24xx host adapter family support" | ||
50 | depends on SCSI_QLA2XXX | ||
51 | select SCSI_FC_ATTRS | ||
52 | select FW_LOADER | ||
53 | ---help--- | ||
54 | This driver supports the QLogic 24xx (ISP2422 and ISP2432) host | ||
55 | adapter family. | ||
diff --git a/drivers/scsi/qla2xxx/Makefile b/drivers/scsi/qla2xxx/Makefile index 00d2e3c21ef6..b169687d08ff 100644 --- a/drivers/scsi/qla2xxx/Makefile +++ b/drivers/scsi/qla2xxx/Makefile | |||
@@ -1,5 +1,4 @@ | |||
1 | EXTRA_CFLAGS += -DUNIQUE_FW_NAME | 1 | EXTRA_CFLAGS += -DUNIQUE_FW_NAME |
2 | EXTRA_CFLAGS += -DCONFIG_SCSI_QLA24XX -DCONFIG_SCSI_QLA24XX_MODULE | ||
3 | 2 | ||
4 | qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ | 3 | qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \ |
5 | qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o | 4 | qla_dbg.o qla_sup.o qla_rscn.o qla_attr.o |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index de0136cc5938..1ae0b381c162 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -790,19 +790,19 @@ static struct pcmcia_device_id serial_ids[] = { | |||
790 | PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), | 790 | PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), |
791 | PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), | 791 | PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), |
792 | PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), | 792 | PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), |
793 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), | 793 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4), |
794 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), | 794 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), |
795 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), | 795 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), |
796 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), | 796 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), |
797 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), | 797 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), |
798 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), | 798 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), |
799 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), | 799 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), |
800 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), | 800 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9), |
801 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), | 801 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed), |
802 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), | 802 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), |
803 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), | 803 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), |
804 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), | 804 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), |
805 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), | 805 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf), |
806 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), | 806 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), |
807 | PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), | 807 | PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), |
808 | PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070), | 808 | PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070), |
@@ -840,7 +840,7 @@ static struct pcmcia_device_id serial_ids[] = { | |||
840 | PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed), | 840 | PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed), |
841 | PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65), | 841 | PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65), |
842 | PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6), | 842 | PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6), |
843 | PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400", 0x816cc815, 0x23539b80), | 843 | PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400+", 0x816cc815, 0x412729fb), |
844 | PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f), | 844 | PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f), |
845 | PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f), | 845 | PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f), |
846 | PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383), | 846 | PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383), |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 63b505cce4ec..ed1d4d1ac4f7 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -244,15 +244,15 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf) | |||
244 | 244 | ||
245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ | 245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ |
246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ | 246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ |
247 | /* 255 rows at 16 chars equals 4096 */ | 247 | /* 256 rows at 16 chars equals 4096, the normal page size */ |
248 | /* PAGE_SIZE can be 4096 or larger */ | 248 | /* the code will automatically adjust for different page sizes */ |
249 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, | 249 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, |
250 | size_t count) | 250 | size_t count) |
251 | { | 251 | { |
252 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 252 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); |
253 | int rc, i, start, length, transp = 0; | 253 | int rc, i, start, length, transp = 0; |
254 | 254 | ||
255 | if ((count > 4096) || ((count % 16) != 0) || (PAGE_SIZE < 4096)) | 255 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) |
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | 257 | ||
258 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) | 258 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) |
@@ -317,18 +317,18 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf) | |||
317 | !fb_info->cmap.green) | 317 | !fb_info->cmap.green) |
318 | return -EINVAL; | 318 | return -EINVAL; |
319 | 319 | ||
320 | if (PAGE_SIZE < 4096) | 320 | if (fb_info->cmap.len > PAGE_SIZE / 16) |
321 | return -EINVAL; | 321 | return -EINVAL; |
322 | 322 | ||
323 | /* don't mess with the format, the buffer is PAGE_SIZE */ | 323 | /* don't mess with the format, the buffer is PAGE_SIZE */ |
324 | /* 255 entries at 16 chars per line equals 4096 = PAGE_SIZE */ | 324 | /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */ |
325 | for (i = 0; i < fb_info->cmap.len; i++) { | 325 | for (i = 0; i < fb_info->cmap.len; i++) { |
326 | sprintf(&buf[ i * 16], "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, | 326 | snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, |
327 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), | 327 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), |
328 | fb_info->cmap.red[i], fb_info->cmap.blue[i], | 328 | fb_info->cmap.red[i], fb_info->cmap.blue[i], |
329 | fb_info->cmap.green[i]); | 329 | fb_info->cmap.green[i]); |
330 | } | 330 | } |
331 | return 4096; | 331 | return 16 * fb_info->cmap.len; |
332 | } | 332 | } |
333 | 333 | ||
334 | static ssize_t store_blank(struct class_device *class_device, const char * buf, | 334 | static ssize_t store_blank(struct class_device *class_device, const char * buf, |
@@ -261,6 +261,7 @@ inline void __bio_clone(struct bio *bio, struct bio *bio_src) | |||
261 | */ | 261 | */ |
262 | bio->bi_vcnt = bio_src->bi_vcnt; | 262 | bio->bi_vcnt = bio_src->bi_vcnt; |
263 | bio->bi_size = bio_src->bi_size; | 263 | bio->bi_size = bio_src->bi_size; |
264 | bio->bi_idx = bio_src->bi_idx; | ||
264 | bio_phys_segments(q, bio); | 265 | bio_phys_segments(q, bio); |
265 | bio_hw_segments(q, bio); | 266 | bio_hw_segments(q, bio); |
266 | } | 267 | } |
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h index c1516d013bf6..67bca0d4a33b 100644 --- a/fs/hostfs/hostfs.h +++ b/fs/hostfs/hostfs.h | |||
@@ -69,6 +69,7 @@ extern int read_file(int fd, unsigned long long *offset, char *buf, int len); | |||
69 | extern int write_file(int fd, unsigned long long *offset, const char *buf, | 69 | extern int write_file(int fd, unsigned long long *offset, const char *buf, |
70 | int len); | 70 | int len); |
71 | extern int lseek_file(int fd, long long offset, int whence); | 71 | extern int lseek_file(int fd, long long offset, int whence); |
72 | extern int fsync_file(int fd, int datasync); | ||
72 | extern int file_create(char *name, int ur, int uw, int ux, int gr, | 73 | extern int file_create(char *name, int ur, int uw, int ux, int gr, |
73 | int gw, int gx, int or, int ow, int ox); | 74 | int gw, int gx, int or, int ow, int ox); |
74 | extern int set_attr(const char *file, struct hostfs_iattr *attrs); | 75 | extern int set_attr(const char *file, struct hostfs_iattr *attrs); |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 88e68caa3784..b2d18200a003 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -382,7 +382,7 @@ int hostfs_file_open(struct inode *ino, struct file *file) | |||
382 | 382 | ||
383 | int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 383 | int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) |
384 | { | 384 | { |
385 | return(0); | 385 | return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync); |
386 | } | 386 | } |
387 | 387 | ||
388 | static struct file_operations hostfs_file_fops = { | 388 | static struct file_operations hostfs_file_fops = { |
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c index 4796e8490f7d..b97809deba66 100644 --- a/fs/hostfs/hostfs_user.c +++ b/fs/hostfs/hostfs_user.c | |||
@@ -153,10 +153,24 @@ int lseek_file(int fd, long long offset, int whence) | |||
153 | int ret; | 153 | int ret; |
154 | 154 | ||
155 | ret = lseek64(fd, offset, whence); | 155 | ret = lseek64(fd, offset, whence); |
156 | if(ret < 0) return(-errno); | 156 | if(ret < 0) |
157 | return(-errno); | ||
157 | return(0); | 158 | return(0); |
158 | } | 159 | } |
159 | 160 | ||
161 | int fsync_file(int fd, int datasync) | ||
162 | { | ||
163 | int ret; | ||
164 | if (datasync) | ||
165 | ret = fdatasync(fd); | ||
166 | else | ||
167 | ret = fsync(fd); | ||
168 | |||
169 | if (ret < 0) | ||
170 | return -errno; | ||
171 | return 0; | ||
172 | } | ||
173 | |||
160 | void close_file(void *stream) | 174 | void close_file(void *stream) |
161 | { | 175 | { |
162 | close(*((int *) stream)); | 176 | close(*((int *) stream)); |
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 195ccdc069e6..450eae22c39a 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h | |||
@@ -11,5 +11,6 @@ extern char _sinittext[], _einittext[]; | |||
11 | extern char _sextratext[] __attribute__((weak)); | 11 | extern char _sextratext[] __attribute__((weak)); |
12 | extern char _eextratext[] __attribute__((weak)); | 12 | extern char _eextratext[] __attribute__((weak)); |
13 | extern char _end[]; | 13 | extern char _end[]; |
14 | extern char __per_cpu_start[], __per_cpu_end[]; | ||
14 | 15 | ||
15 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ | 16 | #endif /* _ASM_GENERIC_SECTIONS_H_ */ |
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 9db0b712d57a..1caee1039363 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h | |||
@@ -311,6 +311,20 @@ static inline int find_first_zero_bit(const unsigned long *addr, unsigned size) | |||
311 | int find_next_zero_bit(const unsigned long *addr, int size, int offset); | 311 | int find_next_zero_bit(const unsigned long *addr, int size, int offset); |
312 | 312 | ||
313 | /** | 313 | /** |
314 | * __ffs - find first bit in word. | ||
315 | * @word: The word to search | ||
316 | * | ||
317 | * Undefined if no bit exists, so code should check against 0 first. | ||
318 | */ | ||
319 | static inline unsigned long __ffs(unsigned long word) | ||
320 | { | ||
321 | __asm__("bsfl %1,%0" | ||
322 | :"=r" (word) | ||
323 | :"rm" (word)); | ||
324 | return word; | ||
325 | } | ||
326 | |||
327 | /** | ||
314 | * find_first_bit - find the first set bit in a memory region | 328 | * find_first_bit - find the first set bit in a memory region |
315 | * @addr: The address to start the search at | 329 | * @addr: The address to start the search at |
316 | * @size: The maximum size to search | 330 | * @size: The maximum size to search |
@@ -320,22 +334,16 @@ int find_next_zero_bit(const unsigned long *addr, int size, int offset); | |||
320 | */ | 334 | */ |
321 | static inline int find_first_bit(const unsigned long *addr, unsigned size) | 335 | static inline int find_first_bit(const unsigned long *addr, unsigned size) |
322 | { | 336 | { |
323 | int d0, d1; | 337 | int x = 0; |
324 | int res; | 338 | do { |
325 | 339 | if (*addr) | |
326 | /* This looks at memory. Mark it volatile to tell gcc not to move it around */ | 340 | return __ffs(*addr) + x; |
327 | __asm__ __volatile__( | 341 | addr++; |
328 | "xorl %%eax,%%eax\n\t" | 342 | if (x >= size) |
329 | "repe; scasl\n\t" | 343 | break; |
330 | "jz 1f\n\t" | 344 | x += (sizeof(*addr)<<3); |
331 | "leal -4(%%edi),%%edi\n\t" | 345 | } while (1); |
332 | "bsfl (%%edi),%%eax\n" | 346 | return x; |
333 | "1:\tsubl %%ebx,%%edi\n\t" | ||
334 | "shll $3,%%edi\n\t" | ||
335 | "addl %%edi,%%eax" | ||
336 | :"=a" (res), "=&c" (d0), "=&D" (d1) | ||
337 | :"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory"); | ||
338 | return res; | ||
339 | } | 347 | } |
340 | 348 | ||
341 | /** | 349 | /** |
@@ -360,20 +368,6 @@ static inline unsigned long ffz(unsigned long word) | |||
360 | return word; | 368 | return word; |
361 | } | 369 | } |
362 | 370 | ||
363 | /** | ||
364 | * __ffs - find first bit in word. | ||
365 | * @word: The word to search | ||
366 | * | ||
367 | * Undefined if no bit exists, so code should check against 0 first. | ||
368 | */ | ||
369 | static inline unsigned long __ffs(unsigned long word) | ||
370 | { | ||
371 | __asm__("bsfl %1,%0" | ||
372 | :"=r" (word) | ||
373 | :"rm" (word)); | ||
374 | return word; | ||
375 | } | ||
376 | |||
377 | /* | 371 | /* |
378 | * fls: find last bit set. | 372 | * fls: find last bit set. |
379 | */ | 373 | */ |
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index edad9b4712fa..a283738b80b3 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h | |||
@@ -37,9 +37,6 @@ extern int smp_num_siblings; | |||
37 | extern cpumask_t cpu_sibling_map[]; | 37 | extern cpumask_t cpu_sibling_map[]; |
38 | extern cpumask_t cpu_core_map[]; | 38 | extern cpumask_t cpu_core_map[]; |
39 | 39 | ||
40 | extern void smp_flush_tlb(void); | ||
41 | extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); | ||
42 | extern void smp_invalidate_rcv(void); /* Process an NMI */ | ||
43 | extern void (*mtrr_hook) (void); | 40 | extern void (*mtrr_hook) (void); |
44 | extern void zap_low_mappings (void); | 41 | extern void zap_low_mappings (void); |
45 | extern void lock_ipi_call_lock(void); | 42 | extern void lock_ipi_call_lock(void); |
diff --git a/include/asm-um/vm86.h b/include/asm-um/vm86.h new file mode 100644 index 000000000000..7801f82de1f4 --- /dev/null +++ b/include/asm-um/vm86.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_VM86_H | ||
2 | #define __UM_VM86_H | ||
3 | |||
4 | #include "asm/arch/vm86.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index a31bb99be53f..05a0d374404b 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -348,8 +348,7 @@ static inline int sched_find_first_bit(const unsigned long *b) | |||
348 | return __ffs(b[0]); | 348 | return __ffs(b[0]); |
349 | if (b[1]) | 349 | if (b[1]) |
350 | return __ffs(b[1]) + 64; | 350 | return __ffs(b[1]) + 64; |
351 | if (b[2]) | 351 | return __ffs(b[2]) + 128; |
352 | return __ffs(b[2]) + 128; | ||
353 | } | 352 | } |
354 | 353 | ||
355 | /** | 354 | /** |
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h index 3d2a666a5dd5..eed785667289 100644 --- a/include/asm-x86_64/bug.h +++ b/include/asm-x86_64/bug.h | |||
@@ -8,17 +8,24 @@ | |||
8 | * this frame. | 8 | * this frame. |
9 | */ | 9 | */ |
10 | struct bug_frame { | 10 | struct bug_frame { |
11 | unsigned char ud2[2]; | 11 | unsigned char ud2[2]; |
12 | unsigned char mov; | ||
12 | /* should use 32bit offset instead, but the assembler doesn't | 13 | /* should use 32bit offset instead, but the assembler doesn't |
13 | like it */ | 14 | like it */ |
14 | char *filename; | 15 | char *filename; |
16 | unsigned char ret; | ||
15 | unsigned short line; | 17 | unsigned short line; |
16 | } __attribute__((packed)); | 18 | } __attribute__((packed)); |
17 | 19 | ||
18 | #ifdef CONFIG_BUG | 20 | #ifdef CONFIG_BUG |
19 | #define HAVE_ARCH_BUG | 21 | #define HAVE_ARCH_BUG |
20 | #define BUG() \ | 22 | /* We turn the bug frame into valid instructions to not confuse |
21 | asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ | 23 | the disassembler. Thanks to Jan Beulich & Suresh Siddha |
24 | for nice instruction selection. | ||
25 | The magic numbers generate mov $64bitimm,%eax ; ret $offset. */ | ||
26 | #define BUG() \ | ||
27 | asm volatile( \ | ||
28 | "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \ | ||
22 | "i"(__LINE__), "i" (__stringify(__FILE__))) | 29 | "i"(__LINE__), "i" (__stringify(__FILE__))) |
23 | void out_of_line_bug(void); | 30 | void out_of_line_bug(void); |
24 | #else | 31 | #else |
diff --git a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h index 6aefb9c0280d..c89b58bebee2 100644 --- a/include/asm-x86_64/desc.h +++ b/include/asm-x86_64/desc.h | |||
@@ -75,6 +75,7 @@ struct desc_ptr { | |||
75 | */ | 75 | */ |
76 | extern struct desc_struct default_ldt[]; | 76 | extern struct desc_struct default_ldt[]; |
77 | extern struct gate_struct idt_table[]; | 77 | extern struct gate_struct idt_table[]; |
78 | extern struct desc_ptr cpu_gdt_descr[]; | ||
78 | 79 | ||
79 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) | 80 | static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) |
80 | { | 81 | { |
diff --git a/include/asm-x86_64/ipi.h b/include/asm-x86_64/ipi.h index d1841847ed89..5e166b9d3bde 100644 --- a/include/asm-x86_64/ipi.h +++ b/include/asm-x86_64/ipi.h | |||
@@ -82,30 +82,27 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector) | |||
82 | */ | 82 | */ |
83 | local_irq_save(flags); | 83 | local_irq_save(flags); |
84 | 84 | ||
85 | for (query_cpu = 0; query_cpu < NR_CPUS; ++query_cpu) { | 85 | for_each_cpu_mask(query_cpu, mask) { |
86 | if (cpu_isset(query_cpu, mask)) { | 86 | /* |
87 | 87 | * Wait for idle. | |
88 | /* | 88 | */ |
89 | * Wait for idle. | 89 | apic_wait_icr_idle(); |
90 | */ | 90 | |
91 | apic_wait_icr_idle(); | 91 | /* |
92 | 92 | * prepare target chip field | |
93 | /* | 93 | */ |
94 | * prepare target chip field | 94 | cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); |
95 | */ | 95 | apic_write_around(APIC_ICR2, cfg); |
96 | cfg = __prepare_ICR2(x86_cpu_to_apicid[query_cpu]); | 96 | |
97 | apic_write_around(APIC_ICR2, cfg); | 97 | /* |
98 | 98 | * program the ICR | |
99 | /* | 99 | */ |
100 | * program the ICR | 100 | cfg = __prepare_ICR(0, vector, APIC_DEST_PHYSICAL); |
101 | */ | 101 | |
102 | cfg = __prepare_ICR(0, vector, APIC_DEST_PHYSICAL); | 102 | /* |
103 | 103 | * Send the IPI. The write to APIC_ICR fires this off. | |
104 | /* | 104 | */ |
105 | * Send the IPI. The write to APIC_ICR fires this off. | 105 | apic_write_around(APIC_ICR, cfg); |
106 | */ | ||
107 | apic_write_around(APIC_ICR, cfg); | ||
108 | } | ||
109 | } | 106 | } |
110 | local_irq_restore(flags); | 107 | local_irq_restore(flags); |
111 | } | 108 | } |
diff --git a/include/asm-x86_64/irq.h b/include/asm-x86_64/irq.h index eb3b7aa9eb9f..4482657777bb 100644 --- a/include/asm-x86_64/irq.h +++ b/include/asm-x86_64/irq.h | |||
@@ -57,4 +57,6 @@ int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *); | |||
57 | extern void fixup_irqs(cpumask_t map); | 57 | extern void fixup_irqs(cpumask_t map); |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #define __ARCH_HAS_DO_SOFTIRQ 1 | ||
61 | |||
60 | #endif /* _ASM_IRQ_H */ | 62 | #endif /* _ASM_IRQ_H */ |
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h index bc700232728d..ba15279a79d0 100644 --- a/include/asm-x86_64/msr.h +++ b/include/asm-x86_64/msr.h | |||
@@ -218,7 +218,7 @@ extern inline unsigned int cpuid_edx(unsigned int op) | |||
218 | #define MSR_K7_PERFCTR3 0xC0010007 | 218 | #define MSR_K7_PERFCTR3 0xC0010007 |
219 | #define MSR_K8_TOP_MEM1 0xC001001A | 219 | #define MSR_K8_TOP_MEM1 0xC001001A |
220 | #define MSR_K8_TOP_MEM2 0xC001001D | 220 | #define MSR_K8_TOP_MEM2 0xC001001D |
221 | #define MSR_K8_SYSCFG 0xC0000010 | 221 | #define MSR_K8_SYSCFG 0xC0010010 |
222 | 222 | ||
223 | /* K6 MSRs */ | 223 | /* K6 MSRs */ |
224 | #define MSR_K6_EFER 0xC0000080 | 224 | #define MSR_K6_EFER 0xC0000080 |
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index aeb1b73e21e1..18ac762e1ab8 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
@@ -46,10 +46,7 @@ extern int pic_mode; | |||
46 | extern void lock_ipi_call_lock(void); | 46 | extern void lock_ipi_call_lock(void); |
47 | extern void unlock_ipi_call_lock(void); | 47 | extern void unlock_ipi_call_lock(void); |
48 | extern int smp_num_siblings; | 48 | extern int smp_num_siblings; |
49 | extern void smp_flush_tlb(void); | ||
50 | extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); | ||
51 | extern void smp_send_reschedule(int cpu); | 49 | extern void smp_send_reschedule(int cpu); |
52 | extern void smp_invalidate_rcv(void); /* Process an NMI */ | ||
53 | extern void zap_low_mappings(void); | 50 | extern void zap_low_mappings(void); |
54 | void smp_stop_cpu(void); | 51 | void smp_stop_cpu(void); |
55 | extern cpumask_t cpu_sibling_map[NR_CPUS]; | 52 | extern cpumask_t cpu_sibling_map[NR_CPUS]; |
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 76165736e43a..8606e170a7dc 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h | |||
@@ -116,12 +116,12 @@ struct alt_instr { | |||
116 | /* | 116 | /* |
117 | * Alternative inline assembly with input. | 117 | * Alternative inline assembly with input. |
118 | * | 118 | * |
119 | * Pecularities: | 119 | * Peculiarities: |
120 | * No memory clobber here. | 120 | * No memory clobber here. |
121 | * Argument numbers start with 1. | 121 | * Argument numbers start with 1. |
122 | * Best is to use constraints that are fixed size (like (%1) ... "r") | 122 | * Best is to use constraints that are fixed size (like (%1) ... "r") |
123 | * If you use variable sized constraints like "m" or "g" in the | 123 | * If you use variable sized constraints like "m" or "g" in the |
124 | * replacement maake sure to pad to the worst case length. | 124 | * replacement make sure to pad to the worst case length. |
125 | */ | 125 | */ |
126 | #define alternative_input(oldinstr, newinstr, feature, input...) \ | 126 | #define alternative_input(oldinstr, newinstr, feature, input...) \ |
127 | asm volatile ("661:\n\t" oldinstr "\n662:\n" \ | 127 | asm volatile ("661:\n\t" oldinstr "\n662:\n" \ |
@@ -335,9 +335,6 @@ void cpu_idle_wait(void); | |||
335 | void disable_hlt(void); | 335 | void disable_hlt(void); |
336 | void enable_hlt(void); | 336 | void enable_hlt(void); |
337 | 337 | ||
338 | #define HAVE_EAT_KEY | ||
339 | void eat_key(void); | ||
340 | |||
341 | extern unsigned long arch_align_stack(unsigned long sp); | 338 | extern unsigned long arch_align_stack(unsigned long sp); |
342 | 339 | ||
343 | #endif | 340 | #endif |
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h index 061742382520..505b0cf906de 100644 --- a/include/asm-x86_64/tlbflush.h +++ b/include/asm-x86_64/tlbflush.h | |||
@@ -56,8 +56,9 @@ extern unsigned long pgkern_mask; | |||
56 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages | 56 | * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages |
57 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | 57 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables |
58 | * | 58 | * |
59 | * ..but the x86_64 has somewhat limited tlb flushing capabilities, | 59 | * x86-64 can only flush individual pages or full VMs. For a range flush |
60 | * and page-granular flushes are available only on i486 and up. | 60 | * we always do the full VM. Might be worth trying if for a small |
61 | * range a few INVLPGs in a row are a win. | ||
61 | */ | 62 | */ |
62 | 63 | ||
63 | #ifndef CONFIG_SMP | 64 | #ifndef CONFIG_SMP |
@@ -115,7 +116,9 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st | |||
115 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | 116 | static inline void flush_tlb_pgtables(struct mm_struct *mm, |
116 | unsigned long start, unsigned long end) | 117 | unsigned long start, unsigned long end) |
117 | { | 118 | { |
118 | /* x86_64 does not keep any page table caches in TLB */ | 119 | /* x86_64 does not keep any page table caches in a software TLB. |
120 | The CPUs do in their hardware TLBs, but they are handled | ||
121 | by the normal TLB flushing algorithms. */ | ||
119 | } | 122 | } |
120 | 123 | ||
121 | #endif /* _X8664_TLBFLUSH_H */ | 124 | #endif /* _X8664_TLBFLUSH_H */ |
diff --git a/include/sound/core.h b/include/sound/core.h index f8c4ef0aa352..38b357fc8958 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -126,25 +126,26 @@ struct snd_monitor_file { | |||
126 | struct snd_monitor_file *next; | 126 | struct snd_monitor_file *next; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | struct snd_shutdown_f_ops; /* define it later */ | 129 | struct snd_shutdown_f_ops; /* define it later in init.c */ |
130 | 130 | ||
131 | /* main structure for soundcard */ | 131 | /* main structure for soundcard */ |
132 | 132 | ||
133 | struct _snd_card { | 133 | struct _snd_card { |
134 | int number; /* number of soundcard (index to snd_cards) */ | 134 | int number; /* number of soundcard (index to |
135 | snd_cards) */ | ||
135 | 136 | ||
136 | char id[16]; /* id string of this card */ | 137 | char id[16]; /* id string of this card */ |
137 | char driver[16]; /* driver name */ | 138 | char driver[16]; /* driver name */ |
138 | char shortname[32]; /* short name of this soundcard */ | 139 | char shortname[32]; /* short name of this soundcard */ |
139 | char longname[80]; /* name of this soundcard */ | 140 | char longname[80]; /* name of this soundcard */ |
140 | char mixername[80]; /* mixer name */ | 141 | char mixername[80]; /* mixer name */ |
141 | char components[80]; /* card components delimited with space */ | 142 | char components[80]; /* card components delimited with |
142 | 143 | space */ | |
143 | struct module *module; /* top-level module */ | 144 | struct module *module; /* top-level module */ |
144 | 145 | ||
145 | void *private_data; /* private data for soundcard */ | 146 | void *private_data; /* private data for soundcard */ |
146 | void (*private_free) (snd_card_t *card); /* callback for freeing of private data */ | 147 | void (*private_free) (snd_card_t *card); /* callback for freeing of |
147 | 148 | private data */ | |
148 | struct list_head devices; /* devices */ | 149 | struct list_head devices; /* devices */ |
149 | 150 | ||
150 | unsigned int last_numid; /* last used numeric ID */ | 151 | unsigned int last_numid; /* last used numeric ID */ |
@@ -160,7 +161,8 @@ struct _snd_card { | |||
160 | struct proc_dir_entry *proc_root_link; /* number link to real id */ | 161 | struct proc_dir_entry *proc_root_link; /* number link to real id */ |
161 | 162 | ||
162 | struct snd_monitor_file *files; /* all files associated to this card */ | 163 | struct snd_monitor_file *files; /* all files associated to this card */ |
163 | struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown state */ | 164 | struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown |
165 | state */ | ||
164 | spinlock_t files_lock; /* lock the files for this card */ | 166 | spinlock_t files_lock; /* lock the files for this card */ |
165 | int shutdown; /* this card is going down */ | 167 | int shutdown; /* this card is going down */ |
166 | wait_queue_head_t shutdown_sleep; | 168 | wait_queue_head_t shutdown_sleep; |
@@ -196,8 +198,6 @@ static inline void snd_power_unlock(snd_card_t *card) | |||
196 | up(&card->power_lock); | 198 | up(&card->power_lock); |
197 | } | 199 | } |
198 | 200 | ||
199 | int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file); | ||
200 | |||
201 | static inline unsigned int snd_power_get_state(snd_card_t *card) | 201 | static inline unsigned int snd_power_get_state(snd_card_t *card) |
202 | { | 202 | { |
203 | return card->power_state; | 203 | return card->power_state; |
@@ -208,6 +208,10 @@ static inline void snd_power_change_state(snd_card_t *card, unsigned int state) | |||
208 | card->power_state = state; | 208 | card->power_state = state; |
209 | wake_up(&card->power_sleep); | 209 | wake_up(&card->power_sleep); |
210 | } | 210 | } |
211 | |||
212 | /* init.c */ | ||
213 | int snd_power_wait(snd_card_t *card, unsigned int power_state, struct file *file); | ||
214 | |||
211 | int snd_card_set_pm_callback(snd_card_t *card, | 215 | int snd_card_set_pm_callback(snd_card_t *card, |
212 | int (*suspend)(snd_card_t *, pm_message_t), | 216 | int (*suspend)(snd_card_t *, pm_message_t), |
213 | int (*resume)(snd_card_t *), | 217 | int (*resume)(snd_card_t *), |
@@ -238,15 +242,14 @@ static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct fi | |||
238 | 242 | ||
239 | #endif /* CONFIG_PM */ | 243 | #endif /* CONFIG_PM */ |
240 | 244 | ||
241 | /* device.c */ | ||
242 | |||
243 | struct _snd_minor { | 245 | struct _snd_minor { |
244 | struct list_head list; /* list of all minors per card */ | 246 | struct list_head list; /* list of all minors per card */ |
245 | int number; /* minor number */ | 247 | int number; /* minor number */ |
246 | int device; /* device number */ | 248 | int device; /* device number */ |
247 | const char *comment; /* for /proc/asound/devices */ | 249 | const char *comment; /* for /proc/asound/devices */ |
248 | struct file_operations *f_ops; /* file operations */ | 250 | struct file_operations *f_ops; /* file operations */ |
249 | char name[0]; /* device name (keep at the end of structure) */ | 251 | char name[0]; /* device name (keep at the end of |
252 | structure) */ | ||
250 | }; | 253 | }; |
251 | 254 | ||
252 | typedef struct _snd_minor snd_minor_t; | 255 | typedef struct _snd_minor snd_minor_t; |
@@ -287,12 +290,12 @@ void snd_memory_init(void); | |||
287 | void snd_memory_done(void); | 290 | void snd_memory_done(void); |
288 | int snd_memory_info_init(void); | 291 | int snd_memory_info_init(void); |
289 | int snd_memory_info_done(void); | 292 | int snd_memory_info_done(void); |
290 | void *snd_hidden_kmalloc(size_t size, int flags); | 293 | void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags); |
291 | void *snd_hidden_kcalloc(size_t n, size_t size, int flags); | 294 | void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags); |
292 | void snd_hidden_kfree(const void *obj); | 295 | void snd_hidden_kfree(const void *obj); |
293 | void *snd_hidden_vmalloc(unsigned long size); | 296 | void *snd_hidden_vmalloc(unsigned long size); |
294 | void snd_hidden_vfree(void *obj); | 297 | void snd_hidden_vfree(void *obj); |
295 | char *snd_hidden_kstrdup(const char *s, int flags); | 298 | char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags); |
296 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) | 299 | #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags) |
297 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) | 300 | #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags) |
298 | #define kfree(obj) snd_hidden_kfree(obj) | 301 | #define kfree(obj) snd_hidden_kfree(obj) |
@@ -411,7 +414,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
411 | printk(fmt ,##args) | 414 | printk(fmt ,##args) |
412 | #endif | 415 | #endif |
413 | /** | 416 | /** |
414 | * snd_assert - run-time assersion macro | 417 | * snd_assert - run-time assertion macro |
415 | * @expr: expression | 418 | * @expr: expression |
416 | * @args...: the action | 419 | * @args...: the action |
417 | * | 420 | * |
@@ -427,7 +430,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
427 | }\ | 430 | }\ |
428 | } while (0) | 431 | } while (0) |
429 | /** | 432 | /** |
430 | * snd_runtime_check - run-time assersion macro | 433 | * snd_runtime_check - run-time assertion macro |
431 | * @expr: expression | 434 | * @expr: expression |
432 | * @args...: the action | 435 | * @args...: the action |
433 | * | 436 | * |
diff --git a/include/sound/driver.h b/include/sound/driver.h index 948e9a1aebef..0d12456ec3ae 100644 --- a/include/sound/driver.h +++ b/include/sound/driver.h | |||
@@ -51,7 +51,7 @@ | |||
51 | #ifdef CONFIG_SND_DEBUG_MEMORY | 51 | #ifdef CONFIG_SND_DEBUG_MEMORY |
52 | #include <linux/slab.h> | 52 | #include <linux/slab.h> |
53 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
54 | void *snd_wrapper_kmalloc(size_t, int); | 54 | void *snd_wrapper_kmalloc(size_t, unsigned int __nocast); |
55 | #undef kmalloc | 55 | #undef kmalloc |
56 | void snd_wrapper_kfree(const void *); | 56 | void snd_wrapper_kfree(const void *); |
57 | #undef kfree | 57 | #undef kfree |
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index c50b91958ff9..c2ef3f023687 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
@@ -1167,6 +1167,7 @@ int snd_emu10k1_create(snd_card_t * card, | |||
1167 | unsigned short extout_mask, | 1167 | unsigned short extout_mask, |
1168 | long max_cache_bytes, | 1168 | long max_cache_bytes, |
1169 | int enable_ir, | 1169 | int enable_ir, |
1170 | uint subsystem, | ||
1170 | emu10k1_t ** remu); | 1171 | emu10k1_t ** remu); |
1171 | 1172 | ||
1172 | int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); | 1173 | int snd_emu10k1_pcm(emu10k1_t * emu, int device, snd_pcm_t ** rpcm); |
diff --git a/include/sound/version.h b/include/sound/version.h index 46acfa8c9988..c085136f391f 100644 --- a/include/sound/version.h +++ b/include/sound/version.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* include/version.h. Generated by configure. */ | 1 | /* include/version.h. Generated by configure. */ |
2 | #define CONFIG_SND_VERSION "1.0.9" | 2 | #define CONFIG_SND_VERSION "1.0.9b" |
3 | #define CONFIG_SND_DATE " (Sun May 29 07:31:02 2005 UTC)" | 3 | #define CONFIG_SND_DATE " (Thu Jul 28 12:20:13 2005 UTC)" |
diff --git a/init/main.c b/init/main.c index b5e421e39ede..c9c311cf1771 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <asm/io.h> | 51 | #include <asm/io.h> |
52 | #include <asm/bugs.h> | 52 | #include <asm/bugs.h> |
53 | #include <asm/setup.h> | 53 | #include <asm/setup.h> |
54 | #include <asm/sections.h> | ||
54 | 55 | ||
55 | /* | 56 | /* |
56 | * This is one of the first .c files built. Error out early | 57 | * This is one of the first .c files built. Error out early |
@@ -323,8 +324,6 @@ static void __init setup_per_cpu_areas(void) | |||
323 | { | 324 | { |
324 | unsigned long size, i; | 325 | unsigned long size, i; |
325 | char *ptr; | 326 | char *ptr; |
326 | /* Created by linker magic */ | ||
327 | extern char __per_cpu_start[], __per_cpu_end[]; | ||
328 | 327 | ||
329 | /* Copy section for each CPU (we discard the original) */ | 328 | /* Copy section for each CPU (we discard the original) */ |
330 | size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); | 329 | size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 5b7b4736d82b..10b2ad749d14 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -896,21 +896,10 @@ static int adjust_abs_time(struct k_clock *clock, struct timespec *tp, | |||
896 | jiffies_64_f = get_jiffies_64(); | 896 | jiffies_64_f = get_jiffies_64(); |
897 | } | 897 | } |
898 | /* | 898 | /* |
899 | * Take away now to get delta | 899 | * Take away now to get delta and normalize |
900 | */ | 900 | */ |
901 | oc.tv_sec -= now.tv_sec; | 901 | set_normalized_timespec(&oc, oc.tv_sec - now.tv_sec, |
902 | oc.tv_nsec -= now.tv_nsec; | 902 | oc.tv_nsec - now.tv_nsec); |
903 | /* | ||
904 | * Normalize... | ||
905 | */ | ||
906 | while ((oc.tv_nsec - NSEC_PER_SEC) >= 0) { | ||
907 | oc.tv_nsec -= NSEC_PER_SEC; | ||
908 | oc.tv_sec++; | ||
909 | } | ||
910 | while ((oc.tv_nsec) < 0) { | ||
911 | oc.tv_nsec += NSEC_PER_SEC; | ||
912 | oc.tv_sec--; | ||
913 | } | ||
914 | }else{ | 903 | }else{ |
915 | jiffies_64_f = get_jiffies_64(); | 904 | jiffies_64_f = get_jiffies_64(); |
916 | } | 905 | } |
diff --git a/kernel/softirq.c b/kernel/softirq.c index b4ab6af1dea8..31007d6542cc 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -86,7 +86,7 @@ restart: | |||
86 | /* Reset the pending bitmask before enabling irqs */ | 86 | /* Reset the pending bitmask before enabling irqs */ |
87 | local_softirq_pending() = 0; | 87 | local_softirq_pending() = 0; |
88 | 88 | ||
89 | local_irq_enable(); | 89 | //local_irq_enable(); |
90 | 90 | ||
91 | h = softirq_vec; | 91 | h = softirq_vec; |
92 | 92 | ||
@@ -99,7 +99,7 @@ restart: | |||
99 | pending >>= 1; | 99 | pending >>= 1; |
100 | } while (pending); | 100 | } while (pending); |
101 | 101 | ||
102 | local_irq_disable(); | 102 | //local_irq_disable(); |
103 | 103 | ||
104 | pending = local_softirq_pending(); | 104 | pending = local_softirq_pending(); |
105 | if (pending && --max_restart) | 105 | if (pending && --max_restart) |
diff --git a/net/core/dev.c b/net/core/dev.c index ff9dc029233a..52a3bf7ae177 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -901,8 +901,7 @@ int dev_close(struct net_device *dev) | |||
901 | smp_mb__after_clear_bit(); /* Commit netif_running(). */ | 901 | smp_mb__after_clear_bit(); /* Commit netif_running(). */ |
902 | while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) { | 902 | while (test_bit(__LINK_STATE_RX_SCHED, &dev->state)) { |
903 | /* No hurry. */ | 903 | /* No hurry. */ |
904 | current->state = TASK_INTERRUPTIBLE; | 904 | msleep(1); |
905 | schedule_timeout(1); | ||
906 | } | 905 | } |
907 | 906 | ||
908 | /* | 907 | /* |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index ad6b12043874..9f5aabd58fa9 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -178,17 +178,31 @@ const char *dbg_print_ptype(int val) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | 180 | ||
181 | /* Main Window Initialization */ | 181 | void replace_button_icon(GladeXML * xml, GdkDrawable * window, |
182 | GtkStyle * style, gchar * btn_name, gchar ** xpm) | ||
183 | { | ||
184 | GdkPixmap *pixmap; | ||
185 | GdkBitmap *mask; | ||
186 | GtkToolButton *button; | ||
187 | GtkWidget *image; | ||
182 | 188 | ||
189 | pixmap = gdk_pixmap_create_from_xpm_d(window, &mask, | ||
190 | &style->bg[GTK_STATE_NORMAL], | ||
191 | xpm); | ||
192 | |||
193 | button = GTK_TOOL_BUTTON(glade_xml_get_widget(xml, btn_name)); | ||
194 | image = gtk_image_new_from_pixmap(pixmap, mask); | ||
195 | gtk_widget_show(image); | ||
196 | gtk_tool_button_set_icon_widget(button, image); | ||
197 | } | ||
183 | 198 | ||
199 | /* Main Window Initialization */ | ||
184 | void init_main_window(const gchar * glade_file) | 200 | void init_main_window(const gchar * glade_file) |
185 | { | 201 | { |
186 | GladeXML *xml; | 202 | GladeXML *xml; |
187 | GtkWidget *widget; | 203 | GtkWidget *widget; |
188 | GtkTextBuffer *txtbuf; | 204 | GtkTextBuffer *txtbuf; |
189 | char title[256]; | 205 | char title[256]; |
190 | GdkPixmap *pixmap; | ||
191 | GdkBitmap *mask; | ||
192 | GtkStyle *style; | 206 | GtkStyle *style; |
193 | 207 | ||
194 | xml = glade_xml_new(glade_file, "window1", NULL); | 208 | xml = glade_xml_new(glade_file, "window1", NULL); |
@@ -221,36 +235,22 @@ void init_main_window(const gchar * glade_file) | |||
221 | style = gtk_widget_get_style(main_wnd); | 235 | style = gtk_widget_get_style(main_wnd); |
222 | widget = glade_xml_get_widget(xml, "toolbar1"); | 236 | widget = glade_xml_get_widget(xml, "toolbar1"); |
223 | 237 | ||
224 | pixmap = gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, | 238 | #if 0 /* Use stock Gtk icons instead */ |
225 | &style->bg[GTK_STATE_NORMAL], | 239 | replace_button_icon(xml, main_wnd->window, style, |
226 | (gchar **) xpm_single_view); | 240 | "button1", (gchar **) xpm_back); |
227 | gtk_image_set_from_pixmap(GTK_IMAGE | 241 | replace_button_icon(xml, main_wnd->window, style, |
228 | (((GtkToolbarChild | 242 | "button2", (gchar **) xpm_load); |
229 | *) (g_list_nth(GTK_TOOLBAR(widget)-> | 243 | replace_button_icon(xml, main_wnd->window, style, |
230 | children, | 244 | "button3", (gchar **) xpm_save); |
231 | 5)->data))->icon), | 245 | #endif |
232 | pixmap, mask); | 246 | replace_button_icon(xml, main_wnd->window, style, |
233 | pixmap = | 247 | "button4", (gchar **) xpm_single_view); |
234 | gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, | 248 | replace_button_icon(xml, main_wnd->window, style, |
235 | &style->bg[GTK_STATE_NORMAL], | 249 | "button5", (gchar **) xpm_split_view); |
236 | (gchar **) xpm_split_view); | 250 | replace_button_icon(xml, main_wnd->window, style, |
237 | gtk_image_set_from_pixmap(GTK_IMAGE | 251 | "button6", (gchar **) xpm_tree_view); |
238 | (((GtkToolbarChild | 252 | |
239 | *) (g_list_nth(GTK_TOOLBAR(widget)-> | 253 | #if 0 |
240 | children, | ||
241 | 6)->data))->icon), | ||
242 | pixmap, mask); | ||
243 | pixmap = | ||
244 | gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, | ||
245 | &style->bg[GTK_STATE_NORMAL], | ||
246 | (gchar **) xpm_tree_view); | ||
247 | gtk_image_set_from_pixmap(GTK_IMAGE | ||
248 | (((GtkToolbarChild | ||
249 | *) (g_list_nth(GTK_TOOLBAR(widget)-> | ||
250 | children, | ||
251 | 7)->data))->icon), | ||
252 | pixmap, mask); | ||
253 | |||
254 | switch (view_mode) { | 254 | switch (view_mode) { |
255 | case SINGLE_VIEW: | 255 | case SINGLE_VIEW: |
256 | widget = glade_xml_get_widget(xml, "button4"); | 256 | widget = glade_xml_get_widget(xml, "button4"); |
@@ -265,7 +265,7 @@ void init_main_window(const gchar * glade_file) | |||
265 | g_signal_emit_by_name(widget, "clicked"); | 265 | g_signal_emit_by_name(widget, "clicked"); |
266 | break; | 266 | break; |
267 | } | 267 | } |
268 | 268 | #endif | |
269 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | 269 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); |
270 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", | 270 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", |
271 | "foreground", "red", | 271 | "foreground", "red", |
@@ -322,7 +322,7 @@ void init_left_tree(void) | |||
322 | gtk_tree_view_set_model(view, model1); | 322 | gtk_tree_view_set_model(view, model1); |
323 | gtk_tree_view_set_headers_visible(view, TRUE); | 323 | gtk_tree_view_set_headers_visible(view, TRUE); |
324 | gtk_tree_view_set_rules_hint(view, FALSE); | 324 | gtk_tree_view_set_rules_hint(view, FALSE); |
325 | 325 | ||
326 | column = gtk_tree_view_column_new(); | 326 | column = gtk_tree_view_column_new(); |
327 | gtk_tree_view_append_column(view, column); | 327 | gtk_tree_view_append_column(view, column); |
328 | gtk_tree_view_column_set_title(column, _("Options")); | 328 | gtk_tree_view_column_set_title(column, _("Options")); |
@@ -334,11 +334,11 @@ void init_left_tree(void) | |||
334 | renderer, | 334 | renderer, |
335 | "active", COL_BTNACT, | 335 | "active", COL_BTNACT, |
336 | "inconsistent", COL_BTNINC, | 336 | "inconsistent", COL_BTNINC, |
337 | "visible", COL_BTNVIS, | 337 | "visible", COL_BTNVIS, |
338 | "radio", COL_BTNRAD, NULL); | 338 | "radio", COL_BTNRAD, NULL); |
339 | renderer = gtk_cell_renderer_text_new(); | 339 | renderer = gtk_cell_renderer_text_new(); |
340 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | 340 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), |
341 | renderer, FALSE); | 341 | renderer, FALSE); |
342 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | 342 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), |
343 | renderer, | 343 | renderer, |
344 | "text", COL_OPTION, | 344 | "text", COL_OPTION, |
@@ -386,7 +386,7 @@ void init_right_tree(void) | |||
386 | renderer, | 386 | renderer, |
387 | "active", COL_BTNACT, | 387 | "active", COL_BTNACT, |
388 | "inconsistent", COL_BTNINC, | 388 | "inconsistent", COL_BTNINC, |
389 | "visible", COL_BTNVIS, | 389 | "visible", COL_BTNVIS, |
390 | "radio", COL_BTNRAD, NULL); | 390 | "radio", COL_BTNRAD, NULL); |
391 | /*g_signal_connect(G_OBJECT(renderer), "toggled", | 391 | /*g_signal_connect(G_OBJECT(renderer), "toggled", |
392 | G_CALLBACK(renderer_toggled), NULL); */ | 392 | G_CALLBACK(renderer_toggled), NULL); */ |
@@ -806,7 +806,7 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) | |||
806 | } | 806 | } |
807 | 807 | ||
808 | 808 | ||
809 | void on_back_pressed(GtkButton * button, gpointer user_data) | 809 | void on_back_clicked(GtkButton * button, gpointer user_data) |
810 | { | 810 | { |
811 | enum prop_type ptype; | 811 | enum prop_type ptype; |
812 | 812 | ||
@@ -821,13 +821,13 @@ void on_back_pressed(GtkButton * button, gpointer user_data) | |||
821 | } | 821 | } |
822 | 822 | ||
823 | 823 | ||
824 | void on_load_pressed(GtkButton * button, gpointer user_data) | 824 | void on_load_clicked(GtkButton * button, gpointer user_data) |
825 | { | 825 | { |
826 | on_load1_activate(NULL, user_data); | 826 | on_load1_activate(NULL, user_data); |
827 | } | 827 | } |
828 | 828 | ||
829 | 829 | ||
830 | void on_save_pressed(GtkButton * button, gpointer user_data) | 830 | void on_save_clicked(GtkButton * button, gpointer user_data) |
831 | { | 831 | { |
832 | on_save1_activate(NULL, user_data); | 832 | on_save1_activate(NULL, user_data); |
833 | } | 833 | } |
@@ -850,9 +850,12 @@ void on_split_clicked(GtkButton * button, gpointer user_data) | |||
850 | gtk_widget_show(tree1_w); | 850 | gtk_widget_show(tree1_w); |
851 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | 851 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); |
852 | gtk_paned_set_position(GTK_PANED(hpaned), w / 2); | 852 | gtk_paned_set_position(GTK_PANED(hpaned), w / 2); |
853 | if (tree2) | 853 | if (tree2) |
854 | gtk_tree_store_clear(tree2); | 854 | gtk_tree_store_clear(tree2); |
855 | display_list(); | 855 | display_list(); |
856 | |||
857 | /* Disable back btn, like in full mode. */ | ||
858 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
856 | } | 859 | } |
857 | 860 | ||
858 | 861 | ||
@@ -868,13 +871,13 @@ void on_full_clicked(GtkButton * button, gpointer user_data) | |||
868 | } | 871 | } |
869 | 872 | ||
870 | 873 | ||
871 | void on_collapse_pressed(GtkButton * button, gpointer user_data) | 874 | void on_collapse_clicked(GtkButton * button, gpointer user_data) |
872 | { | 875 | { |
873 | gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); | 876 | gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); |
874 | } | 877 | } |
875 | 878 | ||
876 | 879 | ||
877 | void on_expand_pressed(GtkButton * button, gpointer user_data) | 880 | void on_expand_clicked(GtkButton * button, gpointer user_data) |
878 | { | 881 | { |
879 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | 882 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); |
880 | } | 883 | } |
@@ -1242,13 +1245,13 @@ static gchar **fill_row(struct menu *menu) | |||
1242 | row[COL_VALUE] = | 1245 | row[COL_VALUE] = |
1243 | g_strdup(menu_get_prompt(def_menu)); | 1246 | g_strdup(menu_get_prompt(def_menu)); |
1244 | } | 1247 | } |
1245 | if(sym->flags & SYMBOL_CHOICEVAL) | 1248 | if (sym->flags & SYMBOL_CHOICEVAL) |
1246 | row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); | 1249 | row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); |
1247 | 1250 | ||
1248 | stype = sym_get_type(sym); | 1251 | stype = sym_get_type(sym); |
1249 | switch (stype) { | 1252 | switch (stype) { |
1250 | case S_BOOLEAN: | 1253 | case S_BOOLEAN: |
1251 | if(GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE) | 1254 | if (GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE) |
1252 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | 1255 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); |
1253 | if (sym_is_choice(sym)) | 1256 | if (sym_is_choice(sym)) |
1254 | break; | 1257 | break; |
@@ -1423,7 +1426,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) | |||
1423 | child2); | 1426 | child2); |
1424 | gtk_tree_store_remove(tree2, &tmp); | 1427 | gtk_tree_store_remove(tree2, &tmp); |
1425 | if (!valid) | 1428 | if (!valid) |
1426 | return; // next parent | 1429 | return; // next parent |
1427 | else | 1430 | else |
1428 | goto reparse; // next child | 1431 | goto reparse; // next child |
1429 | } else | 1432 | } else |
@@ -1448,7 +1451,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) | |||
1448 | child2); | 1451 | child2); |
1449 | gtk_tree_store_remove(tree2, &tmp); | 1452 | gtk_tree_store_remove(tree2, &tmp); |
1450 | if (!valid) | 1453 | if (!valid) |
1451 | return; // next parent | 1454 | return; // next parent |
1452 | else | 1455 | else |
1453 | goto reparse; // next child | 1456 | goto reparse; // next child |
1454 | } | 1457 | } |
@@ -1486,12 +1489,12 @@ static void display_tree(struct menu *menu) | |||
1486 | if (sym) | 1489 | if (sym) |
1487 | sym->flags &= ~SYMBOL_CHANGED; | 1490 | sym->flags &= ~SYMBOL_CHANGED; |
1488 | 1491 | ||
1489 | if ((view_mode == SPLIT_VIEW) && !(child->flags & MENU_ROOT) && | 1492 | if ((view_mode == SPLIT_VIEW) |
1490 | (tree == tree1)) | 1493 | && !(child->flags & MENU_ROOT) && (tree == tree1)) |
1491 | continue; | 1494 | continue; |
1492 | 1495 | ||
1493 | if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) && | 1496 | if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) |
1494 | (tree == tree2)) | 1497 | && (tree == tree2)) |
1495 | continue; | 1498 | continue; |
1496 | 1499 | ||
1497 | if (menu_is_visible(child) || show_all) | 1500 | if (menu_is_visible(child) || show_all) |
@@ -1513,11 +1516,12 @@ static void display_tree(struct menu *menu) | |||
1513 | && (tree == tree2)) | 1516 | && (tree == tree2)) |
1514 | continue; | 1517 | continue; |
1515 | /* | 1518 | /* |
1516 | if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) || | 1519 | if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) |
1517 | (view_mode == FULL_VIEW) | 1520 | || (view_mode == FULL_VIEW) |
1518 | || (view_mode == SPLIT_VIEW))*/ | 1521 | || (view_mode == SPLIT_VIEW))*/ |
1519 | if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) | 1522 | if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) |
1520 | || (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW)) { | 1523 | || (view_mode == FULL_VIEW) |
1524 | || (view_mode == SPLIT_VIEW)) { | ||
1521 | indent++; | 1525 | indent++; |
1522 | display_tree(child); | 1526 | display_tree(child); |
1523 | indent--; | 1527 | indent--; |
@@ -1530,9 +1534,9 @@ static void display_tree_part(void) | |||
1530 | { | 1534 | { |
1531 | if (tree2) | 1535 | if (tree2) |
1532 | gtk_tree_store_clear(tree2); | 1536 | gtk_tree_store_clear(tree2); |
1533 | if(view_mode == SINGLE_VIEW) | 1537 | if (view_mode == SINGLE_VIEW) |
1534 | display_tree(current); | 1538 | display_tree(current); |
1535 | else if(view_mode == SPLIT_VIEW) | 1539 | else if (view_mode == SPLIT_VIEW) |
1536 | display_tree(browsed); | 1540 | display_tree(browsed); |
1537 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | 1541 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); |
1538 | } | 1542 | } |
@@ -1551,24 +1555,22 @@ static void display_list(void) | |||
1551 | 1555 | ||
1552 | void fixup_rootmenu(struct menu *menu) | 1556 | void fixup_rootmenu(struct menu *menu) |
1553 | { | 1557 | { |
1554 | struct menu *child; | 1558 | struct menu *child; |
1555 | static int menu_cnt = 0; | 1559 | static int menu_cnt = 0; |
1556 | 1560 | ||
1557 | menu->flags |= MENU_ROOT; | 1561 | menu->flags |= MENU_ROOT; |
1558 | for (child = menu->list; child; child = child->next) { | 1562 | for (child = menu->list; child; child = child->next) { |
1559 | if (child->prompt && child->prompt->type == P_MENU) { | 1563 | if (child->prompt && child->prompt->type == P_MENU) { |
1560 | menu_cnt++; | 1564 | menu_cnt++; |
1561 | fixup_rootmenu(child); | 1565 | fixup_rootmenu(child); |
1562 | menu_cnt--; | 1566 | menu_cnt--; |
1563 | } else if (!menu_cnt) | 1567 | } else if (!menu_cnt) |
1564 | fixup_rootmenu(child); | 1568 | fixup_rootmenu(child); |
1565 | } | 1569 | } |
1566 | } | 1570 | } |
1567 | 1571 | ||
1568 | 1572 | ||
1569 | /* Main */ | 1573 | /* Main */ |
1570 | |||
1571 | |||
1572 | int main(int ac, char *av[]) | 1574 | int main(int ac, char *av[]) |
1573 | { | 1575 | { |
1574 | const char *name; | 1576 | const char *name; |
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade index ace4706ab251..f8744ed64967 100644 --- a/scripts/kconfig/gconf.glade +++ b/scripts/kconfig/gconf.glade | |||
@@ -13,6 +13,11 @@ | |||
13 | <property name="default_height">480</property> | 13 | <property name="default_height">480</property> |
14 | <property name="resizable">True</property> | 14 | <property name="resizable">True</property> |
15 | <property name="destroy_with_parent">False</property> | 15 | <property name="destroy_with_parent">False</property> |
16 | <property name="decorated">True</property> | ||
17 | <property name="skip_taskbar_hint">False</property> | ||
18 | <property name="skip_pager_hint">False</property> | ||
19 | <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> | ||
20 | <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> | ||
16 | <signal name="destroy" handler="on_window1_destroy" object="window1"/> | 21 | <signal name="destroy" handler="on_window1_destroy" object="window1"/> |
17 | <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> | 22 | <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> |
18 | <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> | 23 | <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> |
@@ -46,7 +51,7 @@ | |||
46 | <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 51 | <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
47 | 52 | ||
48 | <child internal-child="image"> | 53 | <child internal-child="image"> |
49 | <widget class="GtkImage" id="image27"> | 54 | <widget class="GtkImage" id="image39"> |
50 | <property name="visible">True</property> | 55 | <property name="visible">True</property> |
51 | <property name="stock">gtk-open</property> | 56 | <property name="stock">gtk-open</property> |
52 | <property name="icon_size">1</property> | 57 | <property name="icon_size">1</property> |
@@ -69,7 +74,7 @@ | |||
69 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 74 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
70 | 75 | ||
71 | <child internal-child="image"> | 76 | <child internal-child="image"> |
72 | <widget class="GtkImage" id="image28"> | 77 | <widget class="GtkImage" id="image40"> |
73 | <property name="visible">True</property> | 78 | <property name="visible">True</property> |
74 | <property name="stock">gtk-save</property> | 79 | <property name="stock">gtk-save</property> |
75 | <property name="icon_size">1</property> | 80 | <property name="icon_size">1</property> |
@@ -91,7 +96,7 @@ | |||
91 | <signal name="activate" handler="on_save_as1_activate"/> | 96 | <signal name="activate" handler="on_save_as1_activate"/> |
92 | 97 | ||
93 | <child internal-child="image"> | 98 | <child internal-child="image"> |
94 | <widget class="GtkImage" id="image29"> | 99 | <widget class="GtkImage" id="image41"> |
95 | <property name="visible">True</property> | 100 | <property name="visible">True</property> |
96 | <property name="stock">gtk-save-as</property> | 101 | <property name="stock">gtk-save-as</property> |
97 | <property name="icon_size">1</property> | 102 | <property name="icon_size">1</property> |
@@ -105,7 +110,7 @@ | |||
105 | </child> | 110 | </child> |
106 | 111 | ||
107 | <child> | 112 | <child> |
108 | <widget class="GtkMenuItem" id="separator1"> | 113 | <widget class="GtkSeparatorMenuItem" id="separator1"> |
109 | <property name="visible">True</property> | 114 | <property name="visible">True</property> |
110 | </widget> | 115 | </widget> |
111 | </child> | 116 | </child> |
@@ -119,7 +124,7 @@ | |||
119 | <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 124 | <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
120 | 125 | ||
121 | <child internal-child="image"> | 126 | <child internal-child="image"> |
122 | <widget class="GtkImage" id="image30"> | 127 | <widget class="GtkImage" id="image42"> |
123 | <property name="visible">True</property> | 128 | <property name="visible">True</property> |
124 | <property name="stock">gtk-quit</property> | 129 | <property name="stock">gtk-quit</property> |
125 | <property name="icon_size">1</property> | 130 | <property name="icon_size">1</property> |
@@ -179,7 +184,7 @@ | |||
179 | </child> | 184 | </child> |
180 | 185 | ||
181 | <child> | 186 | <child> |
182 | <widget class="GtkMenuItem" id="separator2"> | 187 | <widget class="GtkSeparatorMenuItem" id="separator2"> |
183 | <property name="visible">True</property> | 188 | <property name="visible">True</property> |
184 | </widget> | 189 | </widget> |
185 | </child> | 190 | </child> |
@@ -228,7 +233,7 @@ | |||
228 | <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 233 | <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
229 | 234 | ||
230 | <child internal-child="image"> | 235 | <child internal-child="image"> |
231 | <widget class="GtkImage" id="image31"> | 236 | <widget class="GtkImage" id="image43"> |
232 | <property name="visible">True</property> | 237 | <property name="visible">True</property> |
233 | <property name="stock">gtk-dialog-question</property> | 238 | <property name="stock">gtk-dialog-question</property> |
234 | <property name="icon_size">1</property> | 239 | <property name="icon_size">1</property> |
@@ -250,7 +255,7 @@ | |||
250 | <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> | 255 | <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> |
251 | 256 | ||
252 | <child internal-child="image"> | 257 | <child internal-child="image"> |
253 | <widget class="GtkImage" id="image32"> | 258 | <widget class="GtkImage" id="image44"> |
254 | <property name="visible">True</property> | 259 | <property name="visible">True</property> |
255 | <property name="stock">gtk-properties</property> | 260 | <property name="stock">gtk-properties</property> |
256 | <property name="icon_size">1</property> | 261 | <property name="icon_size">1</property> |
@@ -271,7 +276,7 @@ | |||
271 | <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | 276 | <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> |
272 | 277 | ||
273 | <child internal-child="image"> | 278 | <child internal-child="image"> |
274 | <widget class="GtkImage" id="image33"> | 279 | <widget class="GtkImage" id="image45"> |
275 | <property name="visible">True</property> | 280 | <property name="visible">True</property> |
276 | <property name="stock">gtk-justify-fill</property> | 281 | <property name="stock">gtk-justify-fill</property> |
277 | <property name="icon_size">1</property> | 282 | <property name="icon_size">1</property> |
@@ -308,109 +313,207 @@ | |||
308 | <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> | 313 | <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> |
309 | <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> | 314 | <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> |
310 | <property name="tooltips">True</property> | 315 | <property name="tooltips">True</property> |
316 | <property name="show_arrow">True</property> | ||
311 | 317 | ||
312 | <child> | 318 | <child> |
313 | <widget class="button" id="button1"> | 319 | <widget class="GtkToolButton" id="button1"> |
314 | <property name="visible">True</property> | 320 | <property name="visible">True</property> |
315 | <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> | 321 | <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> |
316 | <property name="label" translatable="yes">Back</property> | 322 | <property name="label" translatable="yes">Back</property> |
317 | <property name="use_underline">True</property> | 323 | <property name="use_underline">True</property> |
318 | <property name="stock_pixmap">gtk-undo</property> | 324 | <property name="stock_id">gtk-undo</property> |
319 | <signal name="pressed" handler="on_back_pressed"/> | 325 | <property name="visible_horizontal">True</property> |
326 | <property name="visible_vertical">True</property> | ||
327 | <property name="is_important">False</property> | ||
328 | <signal name="clicked" handler="on_back_clicked"/> | ||
320 | </widget> | 329 | </widget> |
330 | <packing> | ||
331 | <property name="expand">False</property> | ||
332 | <property name="homogeneous">True</property> | ||
333 | </packing> | ||
321 | </child> | 334 | </child> |
322 | 335 | ||
323 | <child> | 336 | <child> |
324 | <widget class="GtkVSeparator" id="vseparator1"> | 337 | <widget class="GtkToolItem" id="toolitem1"> |
325 | <property name="visible">True</property> | 338 | <property name="visible">True</property> |
339 | <property name="visible_horizontal">True</property> | ||
340 | <property name="visible_vertical">True</property> | ||
341 | <property name="is_important">False</property> | ||
342 | |||
343 | <child> | ||
344 | <widget class="GtkVSeparator" id="vseparator1"> | ||
345 | <property name="visible">True</property> | ||
346 | </widget> | ||
347 | </child> | ||
326 | </widget> | 348 | </widget> |
349 | <packing> | ||
350 | <property name="expand">False</property> | ||
351 | <property name="homogeneous">False</property> | ||
352 | </packing> | ||
327 | </child> | 353 | </child> |
328 | 354 | ||
329 | <child> | 355 | <child> |
330 | <widget class="button" id="button2"> | 356 | <widget class="GtkToolButton" id="button2"> |
331 | <property name="visible">True</property> | 357 | <property name="visible">True</property> |
332 | <property name="tooltip" translatable="yes">Load a config file</property> | 358 | <property name="tooltip" translatable="yes">Load a config file</property> |
333 | <property name="label" translatable="yes">Load</property> | 359 | <property name="label" translatable="yes">Load</property> |
334 | <property name="use_underline">True</property> | 360 | <property name="use_underline">True</property> |
335 | <property name="stock_pixmap">gtk-open</property> | 361 | <property name="stock_id">gtk-open</property> |
336 | <signal name="pressed" handler="on_load_pressed"/> | 362 | <property name="visible_horizontal">True</property> |
363 | <property name="visible_vertical">True</property> | ||
364 | <property name="is_important">False</property> | ||
365 | <signal name="clicked" handler="on_load_clicked"/> | ||
337 | </widget> | 366 | </widget> |
367 | <packing> | ||
368 | <property name="expand">False</property> | ||
369 | <property name="homogeneous">True</property> | ||
370 | </packing> | ||
338 | </child> | 371 | </child> |
339 | 372 | ||
340 | <child> | 373 | <child> |
341 | <widget class="button" id="button3"> | 374 | <widget class="GtkToolButton" id="button3"> |
342 | <property name="visible">True</property> | 375 | <property name="visible">True</property> |
343 | <property name="tooltip" translatable="yes">Save a config file</property> | 376 | <property name="tooltip" translatable="yes">Save a config file</property> |
344 | <property name="label" translatable="yes">Save</property> | 377 | <property name="label" translatable="yes">Save</property> |
345 | <property name="use_underline">True</property> | 378 | <property name="use_underline">True</property> |
346 | <property name="stock_pixmap">gtk-save</property> | 379 | <property name="stock_id">gtk-save</property> |
347 | <signal name="pressed" handler="on_save_pressed"/> | 380 | <property name="visible_horizontal">True</property> |
381 | <property name="visible_vertical">True</property> | ||
382 | <property name="is_important">False</property> | ||
383 | <signal name="clicked" handler="on_save_clicked"/> | ||
348 | </widget> | 384 | </widget> |
385 | <packing> | ||
386 | <property name="expand">False</property> | ||
387 | <property name="homogeneous">True</property> | ||
388 | </packing> | ||
349 | </child> | 389 | </child> |
350 | 390 | ||
351 | <child> | 391 | <child> |
352 | <widget class="GtkVSeparator" id="vseparator2"> | 392 | <widget class="GtkToolItem" id="toolitem2"> |
353 | <property name="visible">True</property> | 393 | <property name="visible">True</property> |
394 | <property name="visible_horizontal">True</property> | ||
395 | <property name="visible_vertical">True</property> | ||
396 | <property name="is_important">False</property> | ||
397 | |||
398 | <child> | ||
399 | <widget class="GtkVSeparator" id="vseparator2"> | ||
400 | <property name="visible">True</property> | ||
401 | </widget> | ||
402 | </child> | ||
354 | </widget> | 403 | </widget> |
404 | <packing> | ||
405 | <property name="expand">False</property> | ||
406 | <property name="homogeneous">False</property> | ||
407 | </packing> | ||
355 | </child> | 408 | </child> |
356 | 409 | ||
357 | <child> | 410 | <child> |
358 | <widget class="button" id="button4"> | 411 | <widget class="GtkToolButton" id="button4"> |
359 | <property name="visible">True</property> | 412 | <property name="visible">True</property> |
360 | <property name="tooltip" translatable="yes">Single view</property> | 413 | <property name="tooltip" translatable="yes">Single view</property> |
361 | <property name="label" translatable="yes">Single</property> | 414 | <property name="label" translatable="yes">Single</property> |
362 | <property name="use_underline">True</property> | 415 | <property name="use_underline">True</property> |
363 | <property name="stock_pixmap">gtk-missing-image</property> | 416 | <property name="stock_id">gtk-missing-image</property> |
417 | <property name="visible_horizontal">True</property> | ||
418 | <property name="visible_vertical">True</property> | ||
419 | <property name="is_important">False</property> | ||
364 | <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> | 420 | <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> |
365 | </widget> | 421 | </widget> |
422 | <packing> | ||
423 | <property name="expand">False</property> | ||
424 | <property name="homogeneous">True</property> | ||
425 | </packing> | ||
366 | </child> | 426 | </child> |
367 | 427 | ||
368 | <child> | 428 | <child> |
369 | <widget class="button" id="button5"> | 429 | <widget class="GtkToolButton" id="button5"> |
370 | <property name="visible">True</property> | 430 | <property name="visible">True</property> |
371 | <property name="tooltip" translatable="yes">Split view</property> | 431 | <property name="tooltip" translatable="yes">Split view</property> |
372 | <property name="label" translatable="yes">Split</property> | 432 | <property name="label" translatable="yes">Split</property> |
373 | <property name="use_underline">True</property> | 433 | <property name="use_underline">True</property> |
374 | <property name="stock_pixmap">gtk-missing-image</property> | 434 | <property name="stock_id">gtk-missing-image</property> |
435 | <property name="visible_horizontal">True</property> | ||
436 | <property name="visible_vertical">True</property> | ||
437 | <property name="is_important">False</property> | ||
375 | <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> | 438 | <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> |
376 | </widget> | 439 | </widget> |
440 | <packing> | ||
441 | <property name="expand">False</property> | ||
442 | <property name="homogeneous">True</property> | ||
443 | </packing> | ||
377 | </child> | 444 | </child> |
378 | 445 | ||
379 | <child> | 446 | <child> |
380 | <widget class="button" id="button6"> | 447 | <widget class="GtkToolButton" id="button6"> |
381 | <property name="visible">True</property> | 448 | <property name="visible">True</property> |
382 | <property name="tooltip" translatable="yes">Full view</property> | 449 | <property name="tooltip" translatable="yes">Full view</property> |
383 | <property name="label" translatable="yes">Full</property> | 450 | <property name="label" translatable="yes">Full</property> |
384 | <property name="use_underline">True</property> | 451 | <property name="use_underline">True</property> |
385 | <property name="stock_pixmap">gtk-missing-image</property> | 452 | <property name="stock_id">gtk-missing-image</property> |
453 | <property name="visible_horizontal">True</property> | ||
454 | <property name="visible_vertical">True</property> | ||
455 | <property name="is_important">False</property> | ||
386 | <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> | 456 | <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> |
387 | </widget> | 457 | </widget> |
458 | <packing> | ||
459 | <property name="expand">False</property> | ||
460 | <property name="homogeneous">True</property> | ||
461 | </packing> | ||
388 | </child> | 462 | </child> |
389 | 463 | ||
390 | <child> | 464 | <child> |
391 | <widget class="GtkVSeparator" id="vseparator3"> | 465 | <widget class="GtkToolItem" id="toolitem3"> |
392 | <property name="visible">True</property> | 466 | <property name="visible">True</property> |
467 | <property name="visible_horizontal">True</property> | ||
468 | <property name="visible_vertical">True</property> | ||
469 | <property name="is_important">False</property> | ||
470 | |||
471 | <child> | ||
472 | <widget class="GtkVSeparator" id="vseparator3"> | ||
473 | <property name="visible">True</property> | ||
474 | </widget> | ||
475 | </child> | ||
393 | </widget> | 476 | </widget> |
477 | <packing> | ||
478 | <property name="expand">False</property> | ||
479 | <property name="homogeneous">False</property> | ||
480 | </packing> | ||
394 | </child> | 481 | </child> |
395 | 482 | ||
396 | <child> | 483 | <child> |
397 | <widget class="button" id="button7"> | 484 | <widget class="GtkToolButton" id="button7"> |
398 | <property name="visible">True</property> | 485 | <property name="visible">True</property> |
399 | <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> | 486 | <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> |
400 | <property name="label" translatable="yes">Collapse</property> | 487 | <property name="label" translatable="yes">Collapse</property> |
401 | <property name="use_underline">True</property> | 488 | <property name="use_underline">True</property> |
402 | <signal name="pressed" handler="on_collapse_pressed"/> | 489 | <property name="stock_id">gtk-remove</property> |
490 | <property name="visible_horizontal">True</property> | ||
491 | <property name="visible_vertical">True</property> | ||
492 | <property name="is_important">False</property> | ||
493 | <signal name="clicked" handler="on_collapse_clicked"/> | ||
403 | </widget> | 494 | </widget> |
495 | <packing> | ||
496 | <property name="expand">False</property> | ||
497 | <property name="homogeneous">True</property> | ||
498 | </packing> | ||
404 | </child> | 499 | </child> |
405 | 500 | ||
406 | <child> | 501 | <child> |
407 | <widget class="button" id="button8"> | 502 | <widget class="GtkToolButton" id="button8"> |
408 | <property name="visible">True</property> | 503 | <property name="visible">True</property> |
409 | <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> | 504 | <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> |
410 | <property name="label" translatable="yes">Expand</property> | 505 | <property name="label" translatable="yes">Expand</property> |
411 | <property name="use_underline">True</property> | 506 | <property name="use_underline">True</property> |
412 | <signal name="pressed" handler="on_expand_pressed"/> | 507 | <property name="stock_id">gtk-add</property> |
508 | <property name="visible_horizontal">True</property> | ||
509 | <property name="visible_vertical">True</property> | ||
510 | <property name="is_important">False</property> | ||
511 | <signal name="clicked" handler="on_expand_clicked"/> | ||
413 | </widget> | 512 | </widget> |
513 | <packing> | ||
514 | <property name="expand">False</property> | ||
515 | <property name="homogeneous">True</property> | ||
516 | </packing> | ||
414 | </child> | 517 | </child> |
415 | </widget> | 518 | </widget> |
416 | </child> | 519 | </child> |
@@ -505,6 +608,8 @@ | |||
505 | <property name="visible">True</property> | 608 | <property name="visible">True</property> |
506 | <property name="can_focus">True</property> | 609 | <property name="can_focus">True</property> |
507 | <property name="editable">False</property> | 610 | <property name="editable">False</property> |
611 | <property name="overwrite">False</property> | ||
612 | <property name="accepts_tab">True</property> | ||
508 | <property name="justification">GTK_JUSTIFY_LEFT</property> | 613 | <property name="justification">GTK_JUSTIFY_LEFT</property> |
509 | <property name="wrap_mode">GTK_WRAP_WORD</property> | 614 | <property name="wrap_mode">GTK_WRAP_WORD</property> |
510 | <property name="cursor_visible">True</property> | 615 | <property name="cursor_visible">True</property> |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 6be273851144..2253f388234f 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -826,7 +826,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
826 | sid = sbsec->def_sid; | 826 | sid = sbsec->def_sid; |
827 | rc = 0; | 827 | rc = 0; |
828 | } else { | 828 | } else { |
829 | rc = security_context_to_sid(context, rc, &sid); | 829 | rc = security_context_to_sid_default(context, rc, &sid, |
830 | sbsec->def_sid); | ||
830 | if (rc) { | 831 | if (rc) { |
831 | printk(KERN_WARNING "%s: context_to_sid(%s) " | 832 | printk(KERN_WARNING "%s: context_to_sid(%s) " |
832 | "returned %d for dev=%s ino=%ld\n", | 833 | "returned %d for dev=%s ino=%ld\n", |
@@ -3125,12 +3126,12 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address, | |||
3125 | 3126 | ||
3126 | if (sk->sk_family == PF_INET) { | 3127 | if (sk->sk_family == PF_INET) { |
3127 | addr4 = (struct sockaddr_in *)address; | 3128 | addr4 = (struct sockaddr_in *)address; |
3128 | if (addrlen != sizeof(struct sockaddr_in)) | 3129 | if (addrlen < sizeof(struct sockaddr_in)) |
3129 | return -EINVAL; | 3130 | return -EINVAL; |
3130 | snum = ntohs(addr4->sin_port); | 3131 | snum = ntohs(addr4->sin_port); |
3131 | } else { | 3132 | } else { |
3132 | addr6 = (struct sockaddr_in6 *)address; | 3133 | addr6 = (struct sockaddr_in6 *)address; |
3133 | if (addrlen != sizeof(struct sockaddr_in6)) | 3134 | if (addrlen < SIN6_LEN_RFC2133) |
3134 | return -EINVAL; | 3135 | return -EINVAL; |
3135 | snum = ntohs(addr6->sin6_port); | 3136 | snum = ntohs(addr6->sin6_port); |
3136 | } | 3137 | } |
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index fa187c9a351d..71c0a19c9753 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h | |||
@@ -65,6 +65,8 @@ int security_sid_to_context(u32 sid, char **scontext, | |||
65 | int security_context_to_sid(char *scontext, u32 scontext_len, | 65 | int security_context_to_sid(char *scontext, u32 scontext_len, |
66 | u32 *out_sid); | 66 | u32 *out_sid); |
67 | 67 | ||
68 | int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *out_sid, u32 def_sid); | ||
69 | |||
68 | int security_get_user_sids(u32 callsid, char *username, | 70 | int security_get_user_sids(u32 callsid, char *username, |
69 | u32 **sids, u32 *nel); | 71 | u32 **sids, u32 *nel); |
70 | 72 | ||
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index 756036bcc243..d4c32c39ccc9 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include "sidtab.h" | ||
18 | #include "mls.h" | 19 | #include "mls.h" |
19 | #include "policydb.h" | 20 | #include "policydb.h" |
20 | #include "services.h" | 21 | #include "services.h" |
@@ -208,6 +209,26 @@ int mls_context_isvalid(struct policydb *p, struct context *c) | |||
208 | } | 209 | } |
209 | 210 | ||
210 | /* | 211 | /* |
212 | * Copies the MLS range from `src' into `dst'. | ||
213 | */ | ||
214 | static inline int mls_copy_context(struct context *dst, | ||
215 | struct context *src) | ||
216 | { | ||
217 | int l, rc = 0; | ||
218 | |||
219 | /* Copy the MLS range from the source context */ | ||
220 | for (l = 0; l < 2; l++) { | ||
221 | dst->range.level[l].sens = src->range.level[l].sens; | ||
222 | rc = ebitmap_cpy(&dst->range.level[l].cat, | ||
223 | &src->range.level[l].cat); | ||
224 | if (rc) | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | return rc; | ||
229 | } | ||
230 | |||
231 | /* | ||
211 | * Set the MLS fields in the security context structure | 232 | * Set the MLS fields in the security context structure |
212 | * `context' based on the string representation in | 233 | * `context' based on the string representation in |
213 | * the string `*scontext'. Update `*scontext' to | 234 | * the string `*scontext'. Update `*scontext' to |
@@ -216,10 +237,20 @@ int mls_context_isvalid(struct policydb *p, struct context *c) | |||
216 | * | 237 | * |
217 | * This function modifies the string in place, inserting | 238 | * This function modifies the string in place, inserting |
218 | * NULL characters to terminate the MLS fields. | 239 | * NULL characters to terminate the MLS fields. |
240 | * | ||
241 | * If a def_sid is provided and no MLS field is present, | ||
242 | * copy the MLS field of the associated default context. | ||
243 | * Used for upgraded to MLS systems where objects may lack | ||
244 | * MLS fields. | ||
245 | * | ||
246 | * Policy read-lock must be held for sidtab lookup. | ||
247 | * | ||
219 | */ | 248 | */ |
220 | int mls_context_to_sid(char oldc, | 249 | int mls_context_to_sid(char oldc, |
221 | char **scontext, | 250 | char **scontext, |
222 | struct context *context) | 251 | struct context *context, |
252 | struct sidtab *s, | ||
253 | u32 def_sid) | ||
223 | { | 254 | { |
224 | 255 | ||
225 | char delim; | 256 | char delim; |
@@ -231,9 +262,23 @@ int mls_context_to_sid(char oldc, | |||
231 | if (!selinux_mls_enabled) | 262 | if (!selinux_mls_enabled) |
232 | return 0; | 263 | return 0; |
233 | 264 | ||
234 | /* No MLS component to the security context. */ | 265 | /* |
235 | if (!oldc) | 266 | * No MLS component to the security context, try and map to |
267 | * default if provided. | ||
268 | */ | ||
269 | if (!oldc) { | ||
270 | struct context *defcon; | ||
271 | |||
272 | if (def_sid == SECSID_NULL) | ||
273 | goto out; | ||
274 | |||
275 | defcon = sidtab_search(s, def_sid); | ||
276 | if (!defcon) | ||
277 | goto out; | ||
278 | |||
279 | rc = mls_copy_context(context, defcon); | ||
236 | goto out; | 280 | goto out; |
281 | } | ||
237 | 282 | ||
238 | /* Extract low sensitivity. */ | 283 | /* Extract low sensitivity. */ |
239 | scontextp = p = *scontext; | 284 | scontextp = p = *scontext; |
@@ -334,26 +379,6 @@ out: | |||
334 | } | 379 | } |
335 | 380 | ||
336 | /* | 381 | /* |
337 | * Copies the MLS range from `src' into `dst'. | ||
338 | */ | ||
339 | static inline int mls_copy_context(struct context *dst, | ||
340 | struct context *src) | ||
341 | { | ||
342 | int l, rc = 0; | ||
343 | |||
344 | /* Copy the MLS range from the source context */ | ||
345 | for (l = 0; l < 2; l++) { | ||
346 | dst->range.level[l].sens = src->range.level[l].sens; | ||
347 | rc = ebitmap_cpy(&dst->range.level[l].cat, | ||
348 | &src->range.level[l].cat); | ||
349 | if (rc) | ||
350 | break; | ||
351 | } | ||
352 | |||
353 | return rc; | ||
354 | } | ||
355 | |||
356 | /* | ||
357 | * Copies the effective MLS range from `src' into `dst'. | 382 | * Copies the effective MLS range from `src' into `dst'. |
358 | */ | 383 | */ |
359 | static inline int mls_scopy_context(struct context *dst, | 384 | static inline int mls_scopy_context(struct context *dst, |
diff --git a/security/selinux/ss/mls.h b/security/selinux/ss/mls.h index 0d37beaa85e2..03de697c8058 100644 --- a/security/selinux/ss/mls.h +++ b/security/selinux/ss/mls.h | |||
@@ -23,7 +23,9 @@ int mls_context_isvalid(struct policydb *p, struct context *c); | |||
23 | 23 | ||
24 | int mls_context_to_sid(char oldc, | 24 | int mls_context_to_sid(char oldc, |
25 | char **scontext, | 25 | char **scontext, |
26 | struct context *context); | 26 | struct context *context, |
27 | struct sidtab *s, | ||
28 | u32 def_sid); | ||
27 | 29 | ||
28 | int mls_convert_context(struct policydb *oldp, | 30 | int mls_convert_context(struct policydb *oldp, |
29 | struct policydb *newp, | 31 | struct policydb *newp, |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 922bb45054aa..014120474e69 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -601,18 +601,7 @@ out: | |||
601 | 601 | ||
602 | } | 602 | } |
603 | 603 | ||
604 | /** | 604 | static int security_context_to_sid_core(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid) |
605 | * security_context_to_sid - Obtain a SID for a given security context. | ||
606 | * @scontext: security context | ||
607 | * @scontext_len: length in bytes | ||
608 | * @sid: security identifier, SID | ||
609 | * | ||
610 | * Obtains a SID associated with the security context that | ||
611 | * has the string representation specified by @scontext. | ||
612 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient | ||
613 | * memory is available, or 0 on success. | ||
614 | */ | ||
615 | int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid) | ||
616 | { | 605 | { |
617 | char *scontext2; | 606 | char *scontext2; |
618 | struct context context; | 607 | struct context context; |
@@ -703,7 +692,7 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid) | |||
703 | 692 | ||
704 | context.type = typdatum->value; | 693 | context.type = typdatum->value; |
705 | 694 | ||
706 | rc = mls_context_to_sid(oldc, &p, &context); | 695 | rc = mls_context_to_sid(oldc, &p, &context, &sidtab, def_sid); |
707 | if (rc) | 696 | if (rc) |
708 | goto out_unlock; | 697 | goto out_unlock; |
709 | 698 | ||
@@ -727,6 +716,46 @@ out: | |||
727 | return rc; | 716 | return rc; |
728 | } | 717 | } |
729 | 718 | ||
719 | /** | ||
720 | * security_context_to_sid - Obtain a SID for a given security context. | ||
721 | * @scontext: security context | ||
722 | * @scontext_len: length in bytes | ||
723 | * @sid: security identifier, SID | ||
724 | * | ||
725 | * Obtains a SID associated with the security context that | ||
726 | * has the string representation specified by @scontext. | ||
727 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient | ||
728 | * memory is available, or 0 on success. | ||
729 | */ | ||
730 | int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid) | ||
731 | { | ||
732 | return security_context_to_sid_core(scontext, scontext_len, | ||
733 | sid, SECSID_NULL); | ||
734 | } | ||
735 | |||
736 | /** | ||
737 | * security_context_to_sid_default - Obtain a SID for a given security context, | ||
738 | * falling back to specified default if needed. | ||
739 | * | ||
740 | * @scontext: security context | ||
741 | * @scontext_len: length in bytes | ||
742 | * @sid: security identifier, SID | ||
743 | * @def_sid: default SID to assign on errror | ||
744 | * | ||
745 | * Obtains a SID associated with the security context that | ||
746 | * has the string representation specified by @scontext. | ||
747 | * The default SID is passed to the MLS layer to be used to allow | ||
748 | * kernel labeling of the MLS field if the MLS field is not present | ||
749 | * (for upgrading to MLS without full relabel). | ||
750 | * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient | ||
751 | * memory is available, or 0 on success. | ||
752 | */ | ||
753 | int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *sid, u32 def_sid) | ||
754 | { | ||
755 | return security_context_to_sid_core(scontext, scontext_len, | ||
756 | sid, def_sid); | ||
757 | } | ||
758 | |||
730 | static int compute_sid_handle_invalid_context( | 759 | static int compute_sid_handle_invalid_context( |
731 | struct context *scontext, | 760 | struct context *scontext, |
732 | struct context *tcontext, | 761 | struct context *tcontext, |
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 34c1740aa6e9..2e4a5e0d16db 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig | |||
@@ -20,5 +20,17 @@ config SND_ARMAACI | |||
20 | select SND_PCM | 20 | select SND_PCM |
21 | select SND_AC97_CODEC | 21 | select SND_AC97_CODEC |
22 | 22 | ||
23 | endmenu | 23 | config SND_PXA2XX_PCM |
24 | tristate | ||
25 | select SND_PCM | ||
26 | |||
27 | config SND_PXA2XX_AC97 | ||
28 | tristate "AC97 driver for the Intel PXA2xx chip" | ||
29 | depends on ARCH_PXA && SND | ||
30 | select SND_PXA2XX_PCM | ||
31 | select SND_AC97_CODEC | ||
32 | help | ||
33 | Say Y or M if you want to support any AC97 codec attached to | ||
34 | the PXA2xx AC97 interface. | ||
24 | 35 | ||
36 | endmenu | ||
diff --git a/sound/arm/Makefile b/sound/arm/Makefile index f74ec28e1068..103f136926d9 100644 --- a/sound/arm/Makefile +++ b/sound/arm/Makefile | |||
@@ -3,9 +3,11 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | snd-sa11xx-uda1341-objs := sa11xx-uda1341.o | 5 | snd-sa11xx-uda1341-objs := sa11xx-uda1341.o |
6 | snd-aaci-objs := aaci.o devdma.o | ||
7 | snd-pxa2xx-pcm-objs := pxa2xx-pcm.o | ||
8 | snd-pxa2xx-ac97-objs := pxa2xx-ac97.o | ||
6 | 9 | ||
7 | # Toplevel Module Dependency | ||
8 | obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o | 10 | obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o |
9 | |||
10 | obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o | 11 | obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o |
11 | snd-aaci-objs := aaci.o devdma.o | 12 | obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o |
13 | obj-$(CONFIG_SND_PXA2XX_AC97) += snd-pxa2xx-ac97.o | ||
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c new file mode 100644 index 000000000000..46052304e230 --- /dev/null +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -0,0 +1,410 @@ | |||
1 | /* | ||
2 | * linux/sound/pxa2xx-ac97.c -- AC97 support for the Intel PXA2xx chip. | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Dec 02, 2004 | ||
6 | * Copyright: MontaVista Software Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/wait.h> | ||
19 | #include <linux/delay.h> | ||
20 | |||
21 | #include <sound/driver.h> | ||
22 | #include <sound/core.h> | ||
23 | #include <sound/pcm.h> | ||
24 | #include <sound/ac97_codec.h> | ||
25 | #include <sound/initval.h> | ||
26 | |||
27 | #include <asm/irq.h> | ||
28 | #include <asm/semaphore.h> | ||
29 | #include <asm/hardware.h> | ||
30 | #include <asm/arch/pxa-regs.h> | ||
31 | #include <asm/arch/audio.h> | ||
32 | |||
33 | #include "pxa2xx-pcm.h" | ||
34 | |||
35 | |||
36 | static DECLARE_MUTEX(car_mutex); | ||
37 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); | ||
38 | static volatile long gsr_bits; | ||
39 | |||
40 | static unsigned short pxa2xx_ac97_read(ac97_t *ac97, unsigned short reg) | ||
41 | { | ||
42 | unsigned short val = -1; | ||
43 | volatile u32 *reg_addr; | ||
44 | |||
45 | down(&car_mutex); | ||
46 | if (CAR & CAR_CAIP) { | ||
47 | printk(KERN_CRIT"%s: CAR_CAIP already set\n", __FUNCTION__); | ||
48 | goto out; | ||
49 | } | ||
50 | |||
51 | /* set up primary or secondary codec space */ | ||
52 | reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; | ||
53 | reg_addr += (reg >> 1); | ||
54 | |||
55 | /* start read access across the ac97 link */ | ||
56 | gsr_bits = 0; | ||
57 | val = *reg_addr; | ||
58 | if (reg == AC97_GPIO_STATUS) | ||
59 | goto out; | ||
60 | wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1); | ||
61 | if (!gsr_bits & GSR_SDONE) { | ||
62 | printk(KERN_ERR "%s: read error (ac97_reg=%d GSR=%#lx)\n", | ||
63 | __FUNCTION__, reg, gsr_bits); | ||
64 | val = -1; | ||
65 | goto out; | ||
66 | } | ||
67 | |||
68 | /* valid data now */ | ||
69 | gsr_bits = 0; | ||
70 | val = *reg_addr; | ||
71 | /* but we've just started another cycle... */ | ||
72 | wait_event_timeout(gsr_wq, gsr_bits & GSR_SDONE, 1); | ||
73 | |||
74 | out: up(&car_mutex); | ||
75 | return val; | ||
76 | } | ||
77 | |||
78 | static void pxa2xx_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) | ||
79 | { | ||
80 | volatile u32 *reg_addr; | ||
81 | |||
82 | down(&car_mutex); | ||
83 | |||
84 | if (CAR & CAR_CAIP) { | ||
85 | printk(KERN_CRIT "%s: CAR_CAIP already set\n", __FUNCTION__); | ||
86 | goto out; | ||
87 | } | ||
88 | |||
89 | /* set up primary or secondary codec space */ | ||
90 | reg_addr = (ac97->num & 1) ? &SAC_REG_BASE : &PAC_REG_BASE; | ||
91 | reg_addr += (reg >> 1); | ||
92 | gsr_bits = 0; | ||
93 | *reg_addr = val; | ||
94 | wait_event_timeout(gsr_wq, gsr_bits & GSR_CDONE, 1); | ||
95 | if (!gsr_bits & GSR_SDONE) | ||
96 | printk(KERN_ERR "%s: write error (ac97_reg=%d GSR=%#lx)\n", | ||
97 | __FUNCTION__, reg, gsr_bits); | ||
98 | |||
99 | out: up(&car_mutex); | ||
100 | } | ||
101 | |||
102 | static void pxa2xx_ac97_reset(ac97_t *ac97) | ||
103 | { | ||
104 | /* First, try cold reset */ | ||
105 | GCR &= GCR_COLD_RST; /* clear everything but nCRST */ | ||
106 | GCR &= ~GCR_COLD_RST; /* then assert nCRST */ | ||
107 | |||
108 | gsr_bits = 0; | ||
109 | #ifdef CONFIG_PXA27x | ||
110 | /* PXA27x Developers Manual section 13.5.2.2.1 */ | ||
111 | pxa_set_cken(1 << 31, 1); | ||
112 | udelay(5); | ||
113 | pxa_set_cken(1 << 31, 0); | ||
114 | GCR = GCR_COLD_RST; | ||
115 | udelay(50); | ||
116 | #else | ||
117 | GCR = GCR_COLD_RST; | ||
118 | GCR |= GCR_CDONE_IE|GCR_SDONE_IE; | ||
119 | wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1); | ||
120 | #endif | ||
121 | |||
122 | if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) { | ||
123 | printk(KERN_INFO "%s: cold reset timeout (GSR=%#lx)\n", | ||
124 | __FUNCTION__, gsr_bits); | ||
125 | |||
126 | /* let's try warm reset */ | ||
127 | gsr_bits = 0; | ||
128 | #ifdef CONFIG_PXA27x | ||
129 | /* warm reset broken on Bulverde, | ||
130 | so manually keep AC97 reset high */ | ||
131 | pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH); | ||
132 | udelay(10); | ||
133 | GCR |= GCR_WARM_RST; | ||
134 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); | ||
135 | udelay(50); | ||
136 | #else | ||
137 | GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;; | ||
138 | wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1); | ||
139 | #endif | ||
140 | |||
141 | if (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR))) | ||
142 | printk(KERN_INFO "%s: warm reset timeout (GSR=%#lx)\n", | ||
143 | __FUNCTION__, gsr_bits); | ||
144 | } | ||
145 | |||
146 | GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN); | ||
147 | GCR |= GCR_SDONE_IE|GCR_CDONE_IE; | ||
148 | } | ||
149 | |||
150 | static irqreturn_t pxa2xx_ac97_irq(int irq, void *dev_id, struct pt_regs *regs) | ||
151 | { | ||
152 | long status; | ||
153 | |||
154 | status = GSR; | ||
155 | if (status) { | ||
156 | GSR = status; | ||
157 | gsr_bits |= status; | ||
158 | wake_up(&gsr_wq); | ||
159 | |||
160 | #ifdef CONFIG_PXA27x | ||
161 | /* Although we don't use those we still need to clear them | ||
162 | since they tend to spuriously trigger when MMC is used | ||
163 | (hardware bug? go figure)... */ | ||
164 | MISR = MISR_EOC; | ||
165 | PISR = PISR_EOC; | ||
166 | MCSR = MCSR_EOC; | ||
167 | #endif | ||
168 | |||
169 | return IRQ_HANDLED; | ||
170 | } | ||
171 | |||
172 | return IRQ_NONE; | ||
173 | } | ||
174 | |||
175 | static ac97_bus_ops_t pxa2xx_ac97_ops = { | ||
176 | .read = pxa2xx_ac97_read, | ||
177 | .write = pxa2xx_ac97_write, | ||
178 | .reset = pxa2xx_ac97_reset, | ||
179 | }; | ||
180 | |||
181 | static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_out = { | ||
182 | .name = "AC97 PCM out", | ||
183 | .dev_addr = __PREG(PCDR), | ||
184 | .drcmr = &DRCMRTXPCDR, | ||
185 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | ||
186 | DCMD_BURST32 | DCMD_WIDTH4, | ||
187 | }; | ||
188 | |||
189 | static pxa2xx_pcm_dma_params_t pxa2xx_ac97_pcm_in = { | ||
190 | .name = "AC97 PCM in", | ||
191 | .dev_addr = __PREG(PCDR), | ||
192 | .drcmr = &DRCMRRXPCDR, | ||
193 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | ||
194 | DCMD_BURST32 | DCMD_WIDTH4, | ||
195 | }; | ||
196 | |||
197 | static snd_pcm_t *pxa2xx_ac97_pcm; | ||
198 | static ac97_t *pxa2xx_ac97_ac97; | ||
199 | |||
200 | static int pxa2xx_ac97_pcm_startup(snd_pcm_substream_t *substream) | ||
201 | { | ||
202 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
203 | pxa2xx_audio_ops_t *platform_ops; | ||
204 | int r; | ||
205 | |||
206 | runtime->hw.channels_min = 2; | ||
207 | runtime->hw.channels_max = 2; | ||
208 | |||
209 | r = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
210 | AC97_RATES_FRONT_DAC : AC97_RATES_ADC; | ||
211 | runtime->hw.rates = pxa2xx_ac97_ac97->rates[r]; | ||
212 | snd_pcm_limit_hw_rates(runtime); | ||
213 | |||
214 | platform_ops = substream->pcm->card->dev->platform_data; | ||
215 | if (platform_ops && platform_ops->startup) | ||
216 | return platform_ops->startup(substream, platform_ops->priv); | ||
217 | else | ||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static void pxa2xx_ac97_pcm_shutdown(snd_pcm_substream_t *substream) | ||
222 | { | ||
223 | pxa2xx_audio_ops_t *platform_ops; | ||
224 | |||
225 | platform_ops = substream->pcm->card->dev->platform_data; | ||
226 | if (platform_ops && platform_ops->shutdown) | ||
227 | platform_ops->shutdown(substream, platform_ops->priv); | ||
228 | } | ||
229 | |||
230 | static int pxa2xx_ac97_pcm_prepare(snd_pcm_substream_t *substream) | ||
231 | { | ||
232 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
233 | int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
234 | AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; | ||
235 | return snd_ac97_set_rate(pxa2xx_ac97_ac97, reg, runtime->rate); | ||
236 | } | ||
237 | |||
238 | static pxa2xx_pcm_client_t pxa2xx_ac97_pcm_client = { | ||
239 | .playback_params = &pxa2xx_ac97_pcm_out, | ||
240 | .capture_params = &pxa2xx_ac97_pcm_in, | ||
241 | .startup = pxa2xx_ac97_pcm_startup, | ||
242 | .shutdown = pxa2xx_ac97_pcm_shutdown, | ||
243 | .prepare = pxa2xx_ac97_pcm_prepare, | ||
244 | }; | ||
245 | |||
246 | #ifdef CONFIG_PM | ||
247 | |||
248 | static int pxa2xx_ac97_do_suspend(snd_card_t *card, unsigned int state) | ||
249 | { | ||
250 | if (card->power_state != SNDRV_CTL_POWER_D3cold) { | ||
251 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | ||
252 | snd_pcm_suspend_all(pxa2xx_ac97_pcm); | ||
253 | snd_ac97_suspend(pxa2xx_ac97_ac97); | ||
254 | snd_power_change_state(card, SNDRV_CTL_POWER_D3cold); | ||
255 | if (platform_ops && platform_ops->suspend) | ||
256 | platform_ops->suspend(platform_ops->priv); | ||
257 | GCR |= GCR_ACLINK_OFF; | ||
258 | pxa_set_cken(CKEN2_AC97, 0); | ||
259 | } | ||
260 | |||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static int pxa2xx_ac97_do_resume(snd_card_t *card, unsigned int state) | ||
265 | { | ||
266 | if (card->power_state != SNDRV_CTL_POWER_D0) { | ||
267 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | ||
268 | pxa_set_cken(CKEN2_AC97, 1); | ||
269 | if (platform_ops && platform_ops->resume) | ||
270 | platform_ops->resume(platform_ops->priv); | ||
271 | snd_ac97_resume(pxa2xx_ac97_ac97); | ||
272 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
273 | } | ||
274 | |||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static int pxa2xx_ac97_suspend(struct device *_dev, u32 state, u32 level) | ||
279 | { | ||
280 | snd_card_t *card = dev_get_drvdata(_dev); | ||
281 | int ret = 0; | ||
282 | |||
283 | if (card && level == SUSPEND_DISABLE) | ||
284 | ret = pxa2xx_ac97_do_suspend(card, SNDRV_CTL_POWER_D3cold); | ||
285 | |||
286 | return ret; | ||
287 | } | ||
288 | |||
289 | static int pxa2xx_ac97_resume(struct device *_dev, u32 level) | ||
290 | { | ||
291 | snd_card_t *card = dev_get_drvdata(_dev); | ||
292 | int ret = 0; | ||
293 | |||
294 | if (card && level == RESUME_ENABLE) | ||
295 | ret = pxa2xx_ac97_do_resume(card, SNDRV_CTL_POWER_D0); | ||
296 | |||
297 | return ret; | ||
298 | } | ||
299 | |||
300 | #else | ||
301 | #define pxa2xx_ac97_suspend NULL | ||
302 | #define pxa2xx_ac97_resume NULL | ||
303 | #endif | ||
304 | |||
305 | static int pxa2xx_ac97_probe(struct device *dev) | ||
306 | { | ||
307 | snd_card_t *card; | ||
308 | ac97_bus_t *ac97_bus; | ||
309 | ac97_template_t ac97_template; | ||
310 | int ret; | ||
311 | |||
312 | ret = -ENOMEM; | ||
313 | card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, | ||
314 | THIS_MODULE, 0); | ||
315 | if (!card) | ||
316 | goto err; | ||
317 | |||
318 | card->dev = dev; | ||
319 | strncpy(card->driver, dev->driver->name, sizeof(card->driver)); | ||
320 | |||
321 | ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); | ||
322 | if (ret) | ||
323 | goto err; | ||
324 | |||
325 | ret = request_irq(IRQ_AC97, pxa2xx_ac97_irq, 0, "AC97", NULL); | ||
326 | if (ret < 0) | ||
327 | goto err; | ||
328 | |||
329 | pxa_gpio_mode(GPIO31_SYNC_AC97_MD); | ||
330 | pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); | ||
331 | pxa_gpio_mode(GPIO28_BITCLK_AC97_MD); | ||
332 | pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD); | ||
333 | #ifdef CONFIG_PXA27x | ||
334 | /* Use GPIO 113 as AC97 Reset on Bulverde */ | ||
335 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); | ||
336 | #endif | ||
337 | pxa_set_cken(CKEN2_AC97, 1); | ||
338 | |||
339 | ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus); | ||
340 | if (ret) | ||
341 | goto err; | ||
342 | memset(&ac97_template, 0, sizeof(ac97_template)); | ||
343 | ret = snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97); | ||
344 | if (ret) | ||
345 | goto err; | ||
346 | |||
347 | snprintf(card->shortname, sizeof(card->shortname), | ||
348 | "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97)); | ||
349 | snprintf(card->longname, sizeof(card->longname), | ||
350 | "%s (%s)", dev->driver->name, card->mixername); | ||
351 | |||
352 | snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, | ||
353 | pxa2xx_ac97_do_resume, NULL); | ||
354 | ret = snd_card_register(card); | ||
355 | if (ret == 0) { | ||
356 | dev_set_drvdata(dev, card); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | err: | ||
361 | if (card) | ||
362 | snd_card_free(card); | ||
363 | if (CKEN & CKEN2_AC97) { | ||
364 | GCR |= GCR_ACLINK_OFF; | ||
365 | free_irq(IRQ_AC97, NULL); | ||
366 | pxa_set_cken(CKEN2_AC97, 0); | ||
367 | } | ||
368 | return ret; | ||
369 | } | ||
370 | |||
371 | static int pxa2xx_ac97_remove(struct device *dev) | ||
372 | { | ||
373 | snd_card_t *card = dev_get_drvdata(dev); | ||
374 | |||
375 | if (card) { | ||
376 | snd_card_free(card); | ||
377 | dev_set_drvdata(dev, NULL); | ||
378 | GCR |= GCR_ACLINK_OFF; | ||
379 | free_irq(IRQ_AC97, NULL); | ||
380 | pxa_set_cken(CKEN2_AC97, 0); | ||
381 | } | ||
382 | |||
383 | return 0; | ||
384 | } | ||
385 | |||
386 | static struct device_driver pxa2xx_ac97_driver = { | ||
387 | .name = "pxa2xx-ac97", | ||
388 | .bus = &platform_bus_type, | ||
389 | .probe = pxa2xx_ac97_probe, | ||
390 | .remove = pxa2xx_ac97_remove, | ||
391 | .suspend = pxa2xx_ac97_suspend, | ||
392 | .resume = pxa2xx_ac97_resume, | ||
393 | }; | ||
394 | |||
395 | static int __init pxa2xx_ac97_init(void) | ||
396 | { | ||
397 | return driver_register(&pxa2xx_ac97_driver); | ||
398 | } | ||
399 | |||
400 | static void __exit pxa2xx_ac97_exit(void) | ||
401 | { | ||
402 | driver_unregister(&pxa2xx_ac97_driver); | ||
403 | } | ||
404 | |||
405 | module_init(pxa2xx_ac97_init); | ||
406 | module_exit(pxa2xx_ac97_exit); | ||
407 | |||
408 | MODULE_AUTHOR("Nicolas Pitre"); | ||
409 | MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip"); | ||
410 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/arm/pxa2xx-pcm.c b/sound/arm/pxa2xx-pcm.c new file mode 100644 index 000000000000..b1eb53b02eae --- /dev/null +++ b/sound/arm/pxa2xx-pcm.c | |||
@@ -0,0 +1,367 @@ | |||
1 | /* | ||
2 | * linux/sound/arm/pxa2xx-pcm.c -- ALSA PCM interface for the Intel PXA2xx chip | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Nov 30, 2004 | ||
6 | * Copyright: (C) 2004 MontaVista Software, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/dma-mapping.h> | ||
18 | |||
19 | #include <sound/driver.h> | ||
20 | #include <sound/core.h> | ||
21 | #include <sound/pcm.h> | ||
22 | #include <sound/pcm_params.h> | ||
23 | |||
24 | #include <asm/dma.h> | ||
25 | #include <asm/hardware.h> | ||
26 | #include <asm/arch/pxa-regs.h> | ||
27 | |||
28 | #include "pxa2xx-pcm.h" | ||
29 | |||
30 | |||
31 | static const snd_pcm_hardware_t pxa2xx_pcm_hardware = { | ||
32 | .info = SNDRV_PCM_INFO_MMAP | | ||
33 | SNDRV_PCM_INFO_MMAP_VALID | | ||
34 | SNDRV_PCM_INFO_INTERLEAVED | | ||
35 | SNDRV_PCM_INFO_PAUSE, | ||
36 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
37 | .period_bytes_min = 32, | ||
38 | .period_bytes_max = 8192 - 32, | ||
39 | .periods_min = 1, | ||
40 | .periods_max = PAGE_SIZE/sizeof(pxa_dma_desc), | ||
41 | .buffer_bytes_max = 128 * 1024, | ||
42 | .fifo_size = 32, | ||
43 | }; | ||
44 | |||
45 | struct pxa2xx_runtime_data { | ||
46 | int dma_ch; | ||
47 | pxa2xx_pcm_dma_params_t *params; | ||
48 | pxa_dma_desc *dma_desc_array; | ||
49 | dma_addr_t dma_desc_array_phys; | ||
50 | }; | ||
51 | |||
52 | static int pxa2xx_pcm_hw_params(snd_pcm_substream_t *substream, | ||
53 | snd_pcm_hw_params_t *params) | ||
54 | { | ||
55 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
56 | struct pxa2xx_runtime_data *rtd = runtime->private_data; | ||
57 | size_t totsize = params_buffer_bytes(params); | ||
58 | size_t period = params_period_bytes(params); | ||
59 | pxa_dma_desc *dma_desc; | ||
60 | dma_addr_t dma_buff_phys, next_desc_phys; | ||
61 | |||
62 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | ||
63 | runtime->dma_bytes = totsize; | ||
64 | |||
65 | dma_desc = rtd->dma_desc_array; | ||
66 | next_desc_phys = rtd->dma_desc_array_phys; | ||
67 | dma_buff_phys = runtime->dma_addr; | ||
68 | do { | ||
69 | next_desc_phys += sizeof(pxa_dma_desc); | ||
70 | dma_desc->ddadr = next_desc_phys; | ||
71 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
72 | dma_desc->dsadr = dma_buff_phys; | ||
73 | dma_desc->dtadr = rtd->params->dev_addr; | ||
74 | } else { | ||
75 | dma_desc->dsadr = rtd->params->dev_addr; | ||
76 | dma_desc->dtadr = dma_buff_phys; | ||
77 | } | ||
78 | if (period > totsize) | ||
79 | period = totsize; | ||
80 | dma_desc->dcmd = rtd->params->dcmd | period | DCMD_ENDIRQEN; | ||
81 | dma_desc++; | ||
82 | dma_buff_phys += period; | ||
83 | } while (totsize -= period); | ||
84 | dma_desc[-1].ddadr = rtd->dma_desc_array_phys; | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int pxa2xx_pcm_hw_free(snd_pcm_substream_t *substream) | ||
90 | { | ||
91 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | ||
92 | |||
93 | *rtd->params->drcmr = 0; | ||
94 | snd_pcm_set_runtime_buffer(substream, NULL); | ||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | static int pxa2xx_pcm_prepare(snd_pcm_substream_t *substream) | ||
99 | { | ||
100 | pxa2xx_pcm_client_t *client = substream->private_data; | ||
101 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
102 | struct pxa2xx_runtime_data *rtd = runtime->private_data; | ||
103 | |||
104 | DCSR(rtd->dma_ch) &= ~DCSR_RUN; | ||
105 | DCSR(rtd->dma_ch) = 0; | ||
106 | DCMD(rtd->dma_ch) = 0; | ||
107 | *rtd->params->drcmr = rtd->dma_ch | DRCMR_MAPVLD; | ||
108 | |||
109 | return client->prepare(substream); | ||
110 | } | ||
111 | |||
112 | static int pxa2xx_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | ||
113 | { | ||
114 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | ||
115 | int ret = 0; | ||
116 | |||
117 | switch (cmd) { | ||
118 | case SNDRV_PCM_TRIGGER_START: | ||
119 | DDADR(rtd->dma_ch) = rtd->dma_desc_array_phys; | ||
120 | DCSR(rtd->dma_ch) = DCSR_RUN; | ||
121 | break; | ||
122 | |||
123 | case SNDRV_PCM_TRIGGER_STOP: | ||
124 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
125 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
126 | DCSR(rtd->dma_ch) &= ~DCSR_RUN; | ||
127 | break; | ||
128 | |||
129 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
130 | DCSR(rtd->dma_ch) |= DCSR_RUN; | ||
131 | break; | ||
132 | |||
133 | default: | ||
134 | ret = -EINVAL; | ||
135 | } | ||
136 | |||
137 | return ret; | ||
138 | } | ||
139 | |||
140 | static void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id, struct pt_regs *regs) | ||
141 | { | ||
142 | snd_pcm_substream_t *substream = dev_id; | ||
143 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | ||
144 | int dcsr; | ||
145 | |||
146 | dcsr = DCSR(dma_ch); | ||
147 | DCSR(dma_ch) = dcsr & ~DCSR_STOPIRQEN; | ||
148 | |||
149 | if (dcsr & DCSR_ENDINTR) { | ||
150 | snd_pcm_period_elapsed(substream); | ||
151 | } else { | ||
152 | printk( KERN_ERR "%s: DMA error on channel %d (DCSR=%#x)\n", | ||
153 | rtd->params->name, dma_ch, dcsr ); | ||
154 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | static snd_pcm_uframes_t pxa2xx_pcm_pointer(snd_pcm_substream_t *substream) | ||
159 | { | ||
160 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
161 | struct pxa2xx_runtime_data *rtd = runtime->private_data; | ||
162 | dma_addr_t ptr = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
163 | DSADR(rtd->dma_ch) : DTADR(rtd->dma_ch); | ||
164 | snd_pcm_uframes_t x = bytes_to_frames(runtime, ptr - runtime->dma_addr); | ||
165 | if (x == runtime->buffer_size) | ||
166 | x = 0; | ||
167 | return x; | ||
168 | } | ||
169 | |||
170 | static int | ||
171 | pxa2xx_pcm_hw_rule_mult32(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *rule) | ||
172 | { | ||
173 | snd_interval_t *i = hw_param_interval(params, rule->var); | ||
174 | int changed = 0; | ||
175 | |||
176 | if (i->min & 31) { | ||
177 | i->min = (i->min & ~31) + 32; | ||
178 | i->openmin = 0; | ||
179 | changed = 1; | ||
180 | } | ||
181 | |||
182 | if (i->max & 31) { | ||
183 | i->max &= ~31; | ||
184 | i->openmax = 0; | ||
185 | changed = 1; | ||
186 | } | ||
187 | |||
188 | return changed; | ||
189 | } | ||
190 | |||
191 | static int pxa2xx_pcm_open(snd_pcm_substream_t *substream) | ||
192 | { | ||
193 | pxa2xx_pcm_client_t *client = substream->private_data; | ||
194 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
195 | struct pxa2xx_runtime_data *rtd; | ||
196 | int ret; | ||
197 | |||
198 | runtime->hw = pxa2xx_pcm_hardware; | ||
199 | |||
200 | /* | ||
201 | * For mysterious reasons (and despite what the manual says) | ||
202 | * playback samples are lost if the DMA count is not a multiple | ||
203 | * of the DMA burst size. Let's add a rule to enforce that. | ||
204 | */ | ||
205 | ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, | ||
206 | pxa2xx_pcm_hw_rule_mult32, NULL, | ||
207 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -1); | ||
208 | if (ret) | ||
209 | goto out; | ||
210 | ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, | ||
211 | pxa2xx_pcm_hw_rule_mult32, NULL, | ||
212 | SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1); | ||
213 | if (ret) | ||
214 | goto out; | ||
215 | |||
216 | ret = -ENOMEM; | ||
217 | rtd = kmalloc(sizeof(*rtd), GFP_KERNEL); | ||
218 | if (!rtd) | ||
219 | goto out; | ||
220 | rtd->dma_desc_array = | ||
221 | dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE, | ||
222 | &rtd->dma_desc_array_phys, GFP_KERNEL); | ||
223 | if (!rtd->dma_desc_array) | ||
224 | goto err1; | ||
225 | |||
226 | rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
227 | client->playback_params : client->capture_params; | ||
228 | ret = pxa_request_dma(rtd->params->name, DMA_PRIO_LOW, | ||
229 | pxa2xx_pcm_dma_irq, substream); | ||
230 | if (ret < 0) | ||
231 | goto err2; | ||
232 | rtd->dma_ch = ret; | ||
233 | |||
234 | runtime->private_data = rtd; | ||
235 | ret = client->startup(substream); | ||
236 | if (!ret) | ||
237 | goto out; | ||
238 | |||
239 | pxa_free_dma(rtd->dma_ch); | ||
240 | err2: | ||
241 | dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE, | ||
242 | rtd->dma_desc_array, rtd->dma_desc_array_phys); | ||
243 | err1: | ||
244 | kfree(rtd); | ||
245 | out: | ||
246 | return ret; | ||
247 | } | ||
248 | |||
249 | static int pxa2xx_pcm_close(snd_pcm_substream_t *substream) | ||
250 | { | ||
251 | pxa2xx_pcm_client_t *client = substream->private_data; | ||
252 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | ||
253 | |||
254 | pxa_free_dma(rtd->dma_ch); | ||
255 | client->shutdown(substream); | ||
256 | dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE, | ||
257 | rtd->dma_desc_array, rtd->dma_desc_array_phys); | ||
258 | kfree(rtd); | ||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static int | ||
263 | pxa2xx_pcm_mmap(snd_pcm_substream_t *substream, struct vm_area_struct *vma) | ||
264 | { | ||
265 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
266 | return dma_mmap_writecombine(substream->pcm->card->dev, vma, | ||
267 | runtime->dma_area, | ||
268 | runtime->dma_addr, | ||
269 | runtime->dma_bytes); | ||
270 | } | ||
271 | |||
272 | static snd_pcm_ops_t pxa2xx_pcm_ops = { | ||
273 | .open = pxa2xx_pcm_open, | ||
274 | .close = pxa2xx_pcm_close, | ||
275 | .ioctl = snd_pcm_lib_ioctl, | ||
276 | .hw_params = pxa2xx_pcm_hw_params, | ||
277 | .hw_free = pxa2xx_pcm_hw_free, | ||
278 | .prepare = pxa2xx_pcm_prepare, | ||
279 | .trigger = pxa2xx_pcm_trigger, | ||
280 | .pointer = pxa2xx_pcm_pointer, | ||
281 | .mmap = pxa2xx_pcm_mmap, | ||
282 | }; | ||
283 | |||
284 | static int pxa2xx_pcm_preallocate_dma_buffer(snd_pcm_t *pcm, int stream) | ||
285 | { | ||
286 | snd_pcm_substream_t *substream = pcm->streams[stream].substream; | ||
287 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
288 | size_t size = pxa2xx_pcm_hardware.buffer_bytes_max; | ||
289 | buf->dev.type = SNDRV_DMA_TYPE_DEV; | ||
290 | buf->dev.dev = pcm->card->dev; | ||
291 | buf->private_data = NULL; | ||
292 | buf->area = dma_alloc_writecombine(pcm->card->dev, size, | ||
293 | &buf->addr, GFP_KERNEL); | ||
294 | if (!buf->area) | ||
295 | return -ENOMEM; | ||
296 | buf->bytes = size; | ||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | static void pxa2xx_pcm_free_dma_buffers(snd_pcm_t *pcm) | ||
301 | { | ||
302 | snd_pcm_substream_t *substream; | ||
303 | struct snd_dma_buffer *buf; | ||
304 | int stream; | ||
305 | |||
306 | for (stream = 0; stream < 2; stream++) { | ||
307 | substream = pcm->streams[stream].substream; | ||
308 | if (!substream) | ||
309 | continue; | ||
310 | buf = &substream->dma_buffer; | ||
311 | if (!buf->area) | ||
312 | continue; | ||
313 | dma_free_writecombine(pcm->card->dev, buf->bytes, | ||
314 | buf->area, buf->addr); | ||
315 | buf->area = NULL; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | static u64 pxa2xx_pcm_dmamask = 0xffffffff; | ||
320 | |||
321 | int pxa2xx_pcm_new(snd_card_t *card, pxa2xx_pcm_client_t *client, snd_pcm_t **rpcm) | ||
322 | { | ||
323 | snd_pcm_t *pcm; | ||
324 | int play = client->playback_params ? 1 : 0; | ||
325 | int capt = client->capture_params ? 1 : 0; | ||
326 | int ret; | ||
327 | |||
328 | ret = snd_pcm_new(card, "PXA2xx-PCM", 0, play, capt, &pcm); | ||
329 | if (ret) | ||
330 | goto out; | ||
331 | |||
332 | pcm->private_data = client; | ||
333 | pcm->private_free = pxa2xx_pcm_free_dma_buffers; | ||
334 | |||
335 | if (!card->dev->dma_mask) | ||
336 | card->dev->dma_mask = &pxa2xx_pcm_dmamask; | ||
337 | if (!card->dev->coherent_dma_mask) | ||
338 | card->dev->coherent_dma_mask = 0xffffffff; | ||
339 | |||
340 | if (play) { | ||
341 | int stream = SNDRV_PCM_STREAM_PLAYBACK; | ||
342 | snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); | ||
343 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); | ||
344 | if (ret) | ||
345 | goto out; | ||
346 | } | ||
347 | if (capt) { | ||
348 | int stream = SNDRV_PCM_STREAM_CAPTURE; | ||
349 | snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops); | ||
350 | ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream); | ||
351 | if (ret) | ||
352 | goto out; | ||
353 | } | ||
354 | |||
355 | if (rpcm) | ||
356 | *rpcm = pcm; | ||
357 | ret = 0; | ||
358 | |||
359 | out: | ||
360 | return ret; | ||
361 | } | ||
362 | |||
363 | EXPORT_SYMBOL(pxa2xx_pcm_new); | ||
364 | |||
365 | MODULE_AUTHOR("Nicolas Pitre"); | ||
366 | MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); | ||
367 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/arm/pxa2xx-pcm.h b/sound/arm/pxa2xx-pcm.h new file mode 100644 index 000000000000..43517597cab9 --- /dev/null +++ b/sound/arm/pxa2xx-pcm.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * linux/sound/arm/pxa2xx-pcm.h -- ALSA PCM interface for the Intel PXA2xx chip | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Nov 30, 2004 | ||
6 | * Copyright: MontaVista Software, Inc. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | typedef struct { | ||
14 | char *name; /* stream identifier */ | ||
15 | u32 dcmd; /* DMA descriptor dcmd field */ | ||
16 | volatile u32 *drcmr; /* the DMA request channel to use */ | ||
17 | u32 dev_addr; /* device physical address for DMA */ | ||
18 | } pxa2xx_pcm_dma_params_t; | ||
19 | |||
20 | typedef struct { | ||
21 | pxa2xx_pcm_dma_params_t *playback_params; | ||
22 | pxa2xx_pcm_dma_params_t *capture_params; | ||
23 | int (*startup)(snd_pcm_substream_t *); | ||
24 | void (*shutdown)(snd_pcm_substream_t *); | ||
25 | int (*prepare)(snd_pcm_substream_t *); | ||
26 | } pxa2xx_pcm_client_t; | ||
27 | |||
28 | extern int pxa2xx_pcm_new(snd_card_t *, pxa2xx_pcm_client_t *, snd_pcm_t **); | ||
29 | |||
diff --git a/sound/core/device.c b/sound/core/device.c index 18c71f913d2a..ca00ad7740c9 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -28,7 +28,7 @@ | |||
28 | /** | 28 | /** |
29 | * snd_device_new - create an ALSA device component | 29 | * snd_device_new - create an ALSA device component |
30 | * @card: the card instance | 30 | * @card: the card instance |
31 | * @type: the device type, SNDRV_DEV_TYPE_XXX | 31 | * @type: the device type, SNDRV_DEV_XXX |
32 | * @device_data: the data pointer of this device | 32 | * @device_data: the data pointer of this device |
33 | * @ops: the operator table | 33 | * @ops: the operator table |
34 | * | 34 | * |
@@ -46,7 +46,9 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type, | |||
46 | { | 46 | { |
47 | snd_device_t *dev; | 47 | snd_device_t *dev; |
48 | 48 | ||
49 | snd_assert(card != NULL && device_data != NULL && ops != NULL, return -ENXIO); | 49 | snd_assert(card != NULL, return -ENXIO); |
50 | snd_assert(device_data != NULL, return -ENXIO); | ||
51 | snd_assert(ops != NULL, return -ENXIO); | ||
50 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); | 52 | dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); |
51 | if (dev == NULL) | 53 | if (dev == NULL) |
52 | return -ENOMEM; | 54 | return -ENOMEM; |
@@ -102,7 +104,7 @@ int snd_device_free(snd_card_t *card, void *device_data) | |||
102 | } | 104 | } |
103 | 105 | ||
104 | /** | 106 | /** |
105 | * snd_device_free - disconnect the device | 107 | * snd_device_disconnect - disconnect the device |
106 | * @card: the card instance | 108 | * @card: the card instance |
107 | * @device_data: the data pointer to disconnect | 109 | * @device_data: the data pointer to disconnect |
108 | * | 110 | * |
@@ -118,7 +120,7 @@ int snd_device_disconnect(snd_card_t *card, void *device_data) | |||
118 | { | 120 | { |
119 | struct list_head *list; | 121 | struct list_head *list; |
120 | snd_device_t *dev; | 122 | snd_device_t *dev; |
121 | 123 | ||
122 | snd_assert(card != NULL, return -ENXIO); | 124 | snd_assert(card != NULL, return -ENXIO); |
123 | snd_assert(device_data != NULL, return -ENXIO); | 125 | snd_assert(device_data != NULL, return -ENXIO); |
124 | list_for_each(list, &card->devices) { | 126 | list_for_each(list, &card->devices) { |
@@ -154,8 +156,9 @@ int snd_device_register(snd_card_t *card, void *device_data) | |||
154 | struct list_head *list; | 156 | struct list_head *list; |
155 | snd_device_t *dev; | 157 | snd_device_t *dev; |
156 | int err; | 158 | int err; |
157 | 159 | ||
158 | snd_assert(card != NULL && device_data != NULL, return -ENXIO); | 160 | snd_assert(card != NULL, return -ENXIO); |
161 | snd_assert(device_data != NULL, return -ENXIO); | ||
159 | list_for_each(list, &card->devices) { | 162 | list_for_each(list, &card->devices) { |
160 | dev = snd_device(list); | 163 | dev = snd_device(list); |
161 | if (dev->device_data != device_data) | 164 | if (dev->device_data != device_data) |
diff --git a/sound/core/info.c b/sound/core/info.c index 5e122bbe7c92..7f8bdf7b0058 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -702,7 +702,7 @@ int snd_info_get_line(snd_info_buffer_t * buffer, char *line, int len) | |||
702 | } | 702 | } |
703 | 703 | ||
704 | /** | 704 | /** |
705 | * snd_info_get_line - parse a string token | 705 | * snd_info_get_str - parse a string token |
706 | * @dest: the buffer to store the string token | 706 | * @dest: the buffer to store the string token |
707 | * @src: the original string | 707 | * @src: the original string |
708 | * @len: the max. length of token - 1 | 708 | * @len: the max. length of token - 1 |
@@ -939,7 +939,8 @@ int snd_info_unregister(snd_info_entry_t * entry) | |||
939 | { | 939 | { |
940 | struct proc_dir_entry *root; | 940 | struct proc_dir_entry *root; |
941 | 941 | ||
942 | snd_assert(entry != NULL && entry->p != NULL, return -ENXIO); | 942 | snd_assert(entry != NULL, return -ENXIO); |
943 | snd_assert(entry->p != NULL, return -ENXIO); | ||
943 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; | 944 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; |
944 | snd_assert(root, return -ENXIO); | 945 | snd_assert(root, return -ENXIO); |
945 | down(&info_mutex); | 946 | down(&info_mutex); |
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index dbc23e35fa06..02132561c3f8 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -105,7 +105,8 @@ struct snd_mem_list { | |||
105 | */ | 105 | */ |
106 | 106 | ||
107 | static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, | 107 | static void *snd_dma_hack_alloc_coherent(struct device *dev, size_t size, |
108 | dma_addr_t *dma_handle, int flags) | 108 | dma_addr_t *dma_handle, |
109 | unsigned int __nocast flags) | ||
109 | { | 110 | { |
110 | void *ret; | 111 | void *ret; |
111 | u64 dma_mask, coherent_dma_mask; | 112 | u64 dma_mask, coherent_dma_mask; |
diff --git a/sound/core/memory.c b/sound/core/memory.c index c1fb28e84330..f6895577bf86 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c | |||
@@ -89,7 +89,7 @@ void snd_memory_done(void) | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | static void *__snd_kmalloc(size_t size, int flags, void *caller) | 92 | static void *__snd_kmalloc(size_t size, unsigned int __nocast flags, void *caller) |
93 | { | 93 | { |
94 | unsigned long cpu_flags; | 94 | unsigned long cpu_flags; |
95 | struct snd_alloc_track *t; | 95 | struct snd_alloc_track *t; |
@@ -111,12 +111,12 @@ static void *__snd_kmalloc(size_t size, int flags, void *caller) | |||
111 | } | 111 | } |
112 | 112 | ||
113 | #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); | 113 | #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); |
114 | void *snd_hidden_kmalloc(size_t size, int flags) | 114 | void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags) |
115 | { | 115 | { |
116 | return _snd_kmalloc(size, flags); | 116 | return _snd_kmalloc(size, flags); |
117 | } | 117 | } |
118 | 118 | ||
119 | void *snd_hidden_kcalloc(size_t n, size_t size, int flags) | 119 | void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags) |
120 | { | 120 | { |
121 | void *ret = NULL; | 121 | void *ret = NULL; |
122 | if (n != 0 && size > INT_MAX / n) | 122 | if (n != 0 && size > INT_MAX / n) |
@@ -184,7 +184,7 @@ void snd_hidden_vfree(void *obj) | |||
184 | snd_wrapper_vfree(obj); | 184 | snd_wrapper_vfree(obj); |
185 | } | 185 | } |
186 | 186 | ||
187 | char *snd_hidden_kstrdup(const char *s, int flags) | 187 | char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags) |
188 | { | 188 | { |
189 | int len; | 189 | int len; |
190 | char *buf; | 190 | char *buf; |
diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile index 64cb50d7b589..402e2b4a34c6 100644 --- a/sound/core/seq/Makefile +++ b/sound/core/seq/Makefile | |||
@@ -38,7 +38,7 @@ obj-$(CONFIG_SND_VIRMIDI) += snd-seq-virmidi.o snd-seq-midi-event.o | |||
38 | obj-$(call sequencer,$(CONFIG_SND_RAWMIDI)) += snd-seq-midi.o snd-seq-midi-event.o | 38 | obj-$(call sequencer,$(CONFIG_SND_RAWMIDI)) += snd-seq-midi.o snd-seq-midi-event.o |
39 | obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o | 39 | obj-$(call sequencer,$(CONFIG_SND_OPL3_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o |
40 | obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o | 40 | obj-$(call sequencer,$(CONFIG_SND_OPL4_LIB)) += snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o |
41 | obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-seq-instr.o | 41 | obj-$(call sequencer,$(CONFIG_SND_GUS_SYNTH)) += snd-seq-midi-emul.o snd-seq-instr.o |
42 | obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-seq-midi-emul.o snd-seq-virmidi.o | 42 | obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-seq-midi-emul.o snd-seq-virmidi.o |
43 | obj-$(call sequencer,$(CONFIG_SND_EMU10K1)) += snd-seq-midi-emul.o snd-seq-virmidi.o | 43 | obj-$(call sequencer,$(CONFIG_SND_EMU10K1)) += snd-seq-midi-emul.o snd-seq-virmidi.o |
44 | obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-seq-midi-emul.o snd-seq-instr.o | 44 | obj-$(call sequencer,$(CONFIG_SND_TRIDENT)) += snd-seq-midi-emul.o snd-seq-instr.o |
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c index 0779c41ca037..32e91c6b25fe 100644 --- a/sound/core/seq/instr/ainstr_gf1.c +++ b/sound/core/seq/instr/ainstr_gf1.c | |||
@@ -50,7 +50,8 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops, | |||
50 | { | 50 | { |
51 | gf1_wave_t *wp, *prev; | 51 | gf1_wave_t *wp, *prev; |
52 | gf1_xwave_t xp; | 52 | gf1_xwave_t xp; |
53 | int err, gfp_mask; | 53 | int err; |
54 | unsigned int gfp_mask; | ||
54 | unsigned int real_size; | 55 | unsigned int real_size; |
55 | 56 | ||
56 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; | 57 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; |
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c index 39ff72b2aab3..2622b8679ca7 100644 --- a/sound/core/seq/instr/ainstr_iw.c +++ b/sound/core/seq/instr/ainstr_iw.c | |||
@@ -58,7 +58,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype, | |||
58 | iwffff_xenv_t *ex, | 58 | iwffff_xenv_t *ex, |
59 | char __user **data, | 59 | char __user **data, |
60 | long *len, | 60 | long *len, |
61 | int gfp_mask) | 61 | unsigned int __nocast gfp_mask) |
62 | { | 62 | { |
63 | __u32 stype; | 63 | __u32 stype; |
64 | iwffff_env_record_t *rp, *rp_last; | 64 | iwffff_env_record_t *rp, *rp_last; |
@@ -128,7 +128,8 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops, | |||
128 | { | 128 | { |
129 | iwffff_wave_t *wp, *prev; | 129 | iwffff_wave_t *wp, *prev; |
130 | iwffff_xwave_t xp; | 130 | iwffff_xwave_t xp; |
131 | int err, gfp_mask; | 131 | int err; |
132 | unsigned int gfp_mask; | ||
132 | unsigned int real_size; | 133 | unsigned int real_size; |
133 | 134 | ||
134 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; | 135 | gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL; |
@@ -234,7 +235,8 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr, | |||
234 | iwffff_xinstrument_t ix; | 235 | iwffff_xinstrument_t ix; |
235 | iwffff_layer_t *lp, *prev_lp; | 236 | iwffff_layer_t *lp, *prev_lp; |
236 | iwffff_xlayer_t lx; | 237 | iwffff_xlayer_t lx; |
237 | int err, gfp_mask; | 238 | int err; |
239 | unsigned int gfp_mask; | ||
238 | 240 | ||
239 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) | 241 | if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE) |
240 | return -EINVAL; | 242 | return -EINVAL; |
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 57be9155eb62..4374829ea770 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c | |||
@@ -134,7 +134,7 @@ static int event_process_midi(snd_seq_event_t * ev, int direct, | |||
134 | seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; | 134 | seq_midisynth_t *msynth = (seq_midisynth_t *) private_data; |
135 | unsigned char msg[10]; /* buffer for constructing midi messages */ | 135 | unsigned char msg[10]; /* buffer for constructing midi messages */ |
136 | snd_rawmidi_substream_t *substream; | 136 | snd_rawmidi_substream_t *substream; |
137 | int res; | 137 | int len; |
138 | 138 | ||
139 | snd_assert(msynth != NULL, return -EINVAL); | 139 | snd_assert(msynth != NULL, return -EINVAL); |
140 | substream = msynth->output_rfile.output; | 140 | substream = msynth->output_rfile.output; |
@@ -146,20 +146,16 @@ static int event_process_midi(snd_seq_event_t * ev, int direct, | |||
146 | snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); | 146 | snd_printd("seq_midi: invalid sysex event flags = 0x%x\n", ev->flags); |
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | res = snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); | 149 | snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream); |
150 | snd_midi_event_reset_decode(msynth->parser); | 150 | snd_midi_event_reset_decode(msynth->parser); |
151 | if (res < 0) | ||
152 | return res; | ||
153 | } else { | 151 | } else { |
154 | if (msynth->parser == NULL) | 152 | if (msynth->parser == NULL) |
155 | return -EIO; | 153 | return -EIO; |
156 | res = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); | 154 | len = snd_midi_event_decode(msynth->parser, msg, sizeof(msg), ev); |
157 | if (res < 0) | 155 | if (len < 0) |
158 | return res; | 156 | return 0; |
159 | if ((res = dump_midi(substream, msg, res)) < 0) { | 157 | if (dump_midi(substream, msg, len) < 0) |
160 | snd_midi_event_reset_decode(msynth->parser); | 158 | snd_midi_event_reset_decode(msynth->parser); |
161 | return res; | ||
162 | } | ||
163 | } | 159 | } |
164 | return 0; | 160 | return 0; |
165 | } | 161 | } |
diff --git a/sound/core/wrappers.c b/sound/core/wrappers.c index 9f393023c327..508e6d67ee19 100644 --- a/sound/core/wrappers.c +++ b/sound/core/wrappers.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | 28 | ||
29 | #ifdef CONFIG_SND_DEBUG_MEMORY | 29 | #ifdef CONFIG_SND_DEBUG_MEMORY |
30 | void *snd_wrapper_kmalloc(size_t size, int flags) | 30 | void *snd_wrapper_kmalloc(size_t size, unsigned int __nocast flags) |
31 | { | 31 | { |
32 | return kmalloc(size, flags); | 32 | return kmalloc(size, flags); |
33 | } | 33 | } |
diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c index 18114713c3b3..4fc38bde34f4 100644 --- a/sound/drivers/vx/vx_uer.c +++ b/sound/drivers/vx/vx_uer.c | |||
@@ -162,34 +162,24 @@ static int vx_read_uer_status(vx_core_t *chip, int *mode) | |||
162 | 162 | ||
163 | static int vx_calc_clock_from_freq(vx_core_t *chip, int freq) | 163 | static int vx_calc_clock_from_freq(vx_core_t *chip, int freq) |
164 | { | 164 | { |
165 | #define XX_FECH48000 0x0000004B | 165 | int hexfreq; |
166 | #define XX_FECH32000 0x00000171 | 166 | |
167 | #define XX_FECH24000 0x0000024B | 167 | snd_assert(freq > 0, return 0); |
168 | #define XX_FECH16000 0x00000371 | 168 | |
169 | #define XX_FECH12000 0x0000044B | 169 | hexfreq = (28224000 * 10) / freq; |
170 | #define XX_FECH8000 0x00000571 | 170 | hexfreq = (hexfreq + 5) / 10; |
171 | #define XX_FECH44100 0x0000007F | 171 | |
172 | #define XX_FECH29400 0x0000016F | 172 | /* max freq = 55125 Hz */ |
173 | #define XX_FECH22050 0x0000027F | 173 | snd_assert(hexfreq > 0x00000200, return 0); |
174 | #define XX_FECH14000 0x000003EF | 174 | |
175 | #define XX_FECH11025 0x0000047F | 175 | if (hexfreq <= 0x03ff) |
176 | #define XX_FECH7350 0x000005BF | 176 | return hexfreq - 0x00000201; |
177 | 177 | if (hexfreq <= 0x07ff) | |
178 | switch (freq) { | 178 | return (hexfreq / 2) - 1; |
179 | case 48000: return XX_FECH48000; | 179 | if (hexfreq <= 0x0fff) |
180 | case 44100: return XX_FECH44100; | 180 | return (hexfreq / 4) + 0x000001ff; |
181 | case 32000: return XX_FECH32000; | 181 | |
182 | case 29400: return XX_FECH29400; | 182 | return 0x5fe; /* min freq = 6893 Hz */ |
183 | case 24000: return XX_FECH24000; | ||
184 | case 22050: return XX_FECH22050; | ||
185 | case 16000: return XX_FECH16000; | ||
186 | case 14000: return XX_FECH14000; | ||
187 | case 12000: return XX_FECH12000; | ||
188 | case 11025: return XX_FECH11025; | ||
189 | case 8000: return XX_FECH8000; | ||
190 | case 7350: return XX_FECH7350; | ||
191 | default: return freq; /* The value is already correct */ | ||
192 | } | ||
193 | } | 183 | } |
194 | 184 | ||
195 | 185 | ||
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index f5e6018ea3f4..5adde308a00f 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -554,7 +554,6 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags) | |||
554 | if (snd_pcm_running(ak4114->capture_substream)) { | 554 | if (snd_pcm_running(ak4114->capture_substream)) { |
555 | // printk("rate changed (%i <- %i)\n", runtime->rate, res); | 555 | // printk("rate changed (%i <- %i)\n", runtime->rate, res); |
556 | snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING); | 556 | snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING); |
557 | wake_up(&runtime->sleep); | ||
558 | res = 1; | 557 | res = 1; |
559 | } | 558 | } |
560 | snd_pcm_stream_unlock_irqrestore(ak4114->capture_substream, _flags); | 559 | snd_pcm_stream_unlock_irqrestore(ak4114->capture_substream, _flags); |
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 94bbd344be5e..a636d9ce3502 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c | |||
@@ -417,11 +417,13 @@ static int snd_gus_check_version(snd_gus_card_t * gus) | |||
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) | ||
420 | static void snd_gus_seq_dev_free(snd_seq_device_t *seq_dev) | 421 | static void snd_gus_seq_dev_free(snd_seq_device_t *seq_dev) |
421 | { | 422 | { |
422 | snd_gus_card_t *gus = seq_dev->private_data; | 423 | snd_gus_card_t *gus = seq_dev->private_data; |
423 | gus->seq_dev = NULL; | 424 | gus->seq_dev = NULL; |
424 | } | 425 | } |
426 | #endif | ||
425 | 427 | ||
426 | int snd_gus_initialize(snd_gus_card_t *gus) | 428 | int snd_gus_initialize(snd_gus_card_t *gus) |
427 | { | 429 | { |
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c index 0e13623f69f0..32379688eed4 100644 --- a/sound/isa/wavefront/wavefront_fx.c +++ b/sound/isa/wavefront/wavefront_fx.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | /* weird stuff, derived from port I/O tracing with dosemu */ | 35 | /* weird stuff, derived from port I/O tracing with dosemu */ |
36 | 36 | ||
37 | unsigned char page_zero[] __initdata = { | 37 | static unsigned char page_zero[] __initdata = { |
38 | 0x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, | 38 | 0x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, |
39 | 0x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00, | 39 | 0x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00, |
40 | 0x00, 0x14, 0x02, 0x76, 0x00, 0x60, 0x00, 0x80, 0x02, 0x00, 0x00, | 40 | 0x00, 0x14, 0x02, 0x76, 0x00, 0x60, 0x00, 0x80, 0x02, 0x00, 0x00, |
@@ -61,7 +61,7 @@ unsigned char page_zero[] __initdata = { | |||
61 | 0x1d, 0x02, 0xdf | 61 | 0x1d, 0x02, 0xdf |
62 | }; | 62 | }; |
63 | 63 | ||
64 | unsigned char page_one[] __initdata = { | 64 | static unsigned char page_one[] __initdata = { |
65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, | 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00, |
66 | 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00, | 66 | 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00, |
67 | 0x02, 0x20, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, | 67 | 0x02, 0x20, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x01, |
@@ -88,7 +88,7 @@ unsigned char page_one[] __initdata = { | |||
88 | 0x60, 0x00, 0x1b | 88 | 0x60, 0x00, 0x1b |
89 | }; | 89 | }; |
90 | 90 | ||
91 | unsigned char page_two[] __initdata = { | 91 | static unsigned char page_two[] __initdata = { |
92 | 0xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4, | 92 | 0xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4, |
93 | 0x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, | 93 | 0x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, |
94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 94 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -103,7 +103,7 @@ unsigned char page_two[] __initdata = { | |||
103 | 0x46, 0x05, 0x46, 0x07, 0x46, 0x07, 0x44 | 103 | 0x46, 0x05, 0x46, 0x07, 0x46, 0x07, 0x44 |
104 | }; | 104 | }; |
105 | 105 | ||
106 | unsigned char page_three[] __initdata = { | 106 | static unsigned char page_three[] __initdata = { |
107 | 0x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06, | 107 | 0x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06, |
108 | 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 108 | 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -118,7 +118,7 @@ unsigned char page_three[] __initdata = { | |||
118 | 0x02, 0x00, 0x42, 0x00, 0xc0, 0x00, 0x40 | 118 | 0x02, 0x00, 0x42, 0x00, 0xc0, 0x00, 0x40 |
119 | }; | 119 | }; |
120 | 120 | ||
121 | unsigned char page_four[] __initdata = { | 121 | static unsigned char page_four[] __initdata = { |
122 | 0x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02, | 122 | 0x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02, |
123 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 123 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -133,7 +133,7 @@ unsigned char page_four[] __initdata = { | |||
133 | 0x02, 0x62, 0x02, 0x20, 0x01, 0x21, 0x01 | 133 | 0x02, 0x62, 0x02, 0x20, 0x01, 0x21, 0x01 |
134 | }; | 134 | }; |
135 | 135 | ||
136 | unsigned char page_six[] __initdata = { | 136 | static unsigned char page_six[] __initdata = { |
137 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, | 137 | 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, |
138 | 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e, | 138 | 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e, |
139 | 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x00, | 139 | 0x00, 0x00, 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x14, 0x00, 0x00, |
@@ -154,7 +154,7 @@ unsigned char page_six[] __initdata = { | |||
154 | 0x80, 0x00, 0x7e, 0x80, 0x80 | 154 | 0x80, 0x00, 0x7e, 0x80, 0x80 |
155 | }; | 155 | }; |
156 | 156 | ||
157 | unsigned char page_seven[] __initdata = { | 157 | static unsigned char page_seven[] __initdata = { |
158 | 0x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, | 158 | 0x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, |
159 | 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, | 159 | 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, |
160 | 0x08, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0f, | 160 | 0x08, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0f, |
@@ -181,7 +181,7 @@ unsigned char page_seven[] __initdata = { | |||
181 | 0x00, 0x02, 0x00 | 181 | 0x00, 0x02, 0x00 |
182 | }; | 182 | }; |
183 | 183 | ||
184 | unsigned char page_zero_v2[] __initdata = { | 184 | static unsigned char page_zero_v2[] __initdata = { |
185 | 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 185 | 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
187 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 187 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -193,7 +193,7 @@ unsigned char page_zero_v2[] __initdata = { | |||
193 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 193 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
194 | }; | 194 | }; |
195 | 195 | ||
196 | unsigned char page_one_v2[] __initdata = { | 196 | static unsigned char page_one_v2[] __initdata = { |
197 | 0x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, | 197 | 0x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, |
198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -205,21 +205,21 @@ unsigned char page_one_v2[] __initdata = { | |||
205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 205 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
206 | }; | 206 | }; |
207 | 207 | ||
208 | unsigned char page_two_v2[] __initdata = { | 208 | static unsigned char page_two_v2[] __initdata = { |
209 | 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 209 | 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
210 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 210 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
213 | 0x00, 0x00, 0x00, 0x00 | 213 | 0x00, 0x00, 0x00, 0x00 |
214 | }; | 214 | }; |
215 | unsigned char page_three_v2[] __initdata = { | 215 | static unsigned char page_three_v2[] __initdata = { |
216 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 216 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
217 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 217 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
218 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 218 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
219 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 219 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
220 | 0x00, 0x00, 0x00, 0x00 | 220 | 0x00, 0x00, 0x00, 0x00 |
221 | }; | 221 | }; |
222 | unsigned char page_four_v2[] __initdata = { | 222 | static unsigned char page_four_v2[] __initdata = { |
223 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 223 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
224 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 224 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
225 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 225 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -227,7 +227,7 @@ unsigned char page_four_v2[] __initdata = { | |||
227 | 0x00, 0x00, 0x00, 0x00 | 227 | 0x00, 0x00, 0x00, 0x00 |
228 | }; | 228 | }; |
229 | 229 | ||
230 | unsigned char page_seven_v2[] __initdata = { | 230 | static unsigned char page_seven_v2[] __initdata = { |
231 | 0x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 231 | 0x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
232 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 232 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
@@ -239,7 +239,7 @@ unsigned char page_seven_v2[] __initdata = { | |||
239 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 239 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
240 | }; | 240 | }; |
241 | 241 | ||
242 | unsigned char mod_v2[] __initdata = { | 242 | static unsigned char mod_v2[] __initdata = { |
243 | 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, | 243 | 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02, |
244 | 0x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05, | 244 | 0x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05, |
245 | 0x02, 0x00, 0x01, 0x06, 0x02, 0x00, 0x01, 0x07, 0x02, 0x00, 0xb0, | 245 | 0x02, 0x00, 0x01, 0x06, 0x02, 0x00, 0x01, 0x07, 0x02, 0x00, 0xb0, |
@@ -269,7 +269,7 @@ unsigned char mod_v2[] __initdata = { | |||
269 | 0x02, 0x01, 0x01, 0x04, 0x02, 0x01, 0x01, 0x05, 0x02, 0x01, 0x01, | 269 | 0x02, 0x01, 0x01, 0x04, 0x02, 0x01, 0x01, 0x05, 0x02, 0x01, 0x01, |
270 | 0x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01 | 270 | 0x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01 |
271 | }; | 271 | }; |
272 | unsigned char coefficients[] __initdata = { | 272 | static unsigned char coefficients[] __initdata = { |
273 | 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03, | 273 | 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03, |
274 | 0x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, | 274 | 0x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, |
275 | 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x07, 0x41, 0x00, 0x00, 0x01, | 275 | 0x00, 0x00, 0x07, 0x40, 0x00, 0x00, 0x07, 0x41, 0x00, 0x00, 0x01, |
@@ -305,14 +305,14 @@ unsigned char coefficients[] __initdata = { | |||
305 | 0x06, 0x6c, 0x4c, 0x6c, 0x06, 0x50, 0x52, 0xe2, 0x06, 0x42, 0x02, | 305 | 0x06, 0x6c, 0x4c, 0x6c, 0x06, 0x50, 0x52, 0xe2, 0x06, 0x42, 0x02, |
306 | 0xba | 306 | 0xba |
307 | }; | 307 | }; |
308 | unsigned char coefficients2[] __initdata = { | 308 | static unsigned char coefficients2[] __initdata = { |
309 | 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f, | 309 | 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f, |
310 | 0xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d, | 310 | 0xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d, |
311 | 0x04, 0xcc, 0x07, 0x7c, 0x00, 0x00, 0x07, 0x7e, 0x00, 0x00, 0x07, | 311 | 0x04, 0xcc, 0x07, 0x7c, 0x00, 0x00, 0x07, 0x7e, 0x00, 0x00, 0x07, |
312 | 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x47, 0x00, 0x00, | 312 | 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x47, 0x00, 0x00, |
313 | 0x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00 | 313 | 0x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00 |
314 | }; | 314 | }; |
315 | unsigned char coefficients3[] __initdata = { | 315 | static unsigned char coefficients3[] __initdata = { |
316 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00, | 316 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00, |
317 | 0x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc, | 317 | 0x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc, |
318 | 0x00, 0xcc, 0x00, 0xf5, 0x00, 0xf5, 0x01, 0x1e, 0x01, 0x1e, 0x01, | 318 | 0x00, 0xcc, 0x00, 0xf5, 0x00, 0xf5, 0x01, 0x1e, 0x01, 0x1e, 0x01, |
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index a4b72cd2eea0..6983eea226da 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -367,6 +367,7 @@ int snd_ac97_update(ac97_t *ac97, unsigned short reg, unsigned short value) | |||
367 | ac97->regs[reg] = value; | 367 | ac97->regs[reg] = value; |
368 | ac97->bus->ops->write(ac97, reg, value); | 368 | ac97->bus->ops->write(ac97, reg, value); |
369 | } | 369 | } |
370 | set_bit(reg, ac97->reg_accessed); | ||
370 | up(&ac97->reg_mutex); | 371 | up(&ac97->reg_mutex); |
371 | return change; | 372 | return change; |
372 | } | 373 | } |
@@ -410,6 +411,7 @@ int snd_ac97_update_bits_nolock(ac97_t *ac97, unsigned short reg, | |||
410 | ac97->regs[reg] = new; | 411 | ac97->regs[reg] = new; |
411 | ac97->bus->ops->write(ac97, reg, new); | 412 | ac97->bus->ops->write(ac97, reg, new); |
412 | } | 413 | } |
414 | set_bit(reg, ac97->reg_accessed); | ||
413 | return change; | 415 | return change; |
414 | } | 416 | } |
415 | 417 | ||
@@ -1076,6 +1078,11 @@ static void check_volume_resolution(ac97_t *ac97, int reg, unsigned char *lo_max | |||
1076 | for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { | 1078 | for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { |
1077 | unsigned short val; | 1079 | unsigned short val; |
1078 | snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); | 1080 | snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); |
1081 | /* Do the read twice due to buffers on some ac97 codecs. | ||
1082 | * e.g. The STAC9704 returns exactly what you wrote the the register | ||
1083 | * if you read it immediately. This causes the detect routine to fail. | ||
1084 | */ | ||
1085 | val = snd_ac97_read(ac97, reg); | ||
1079 | val = snd_ac97_read(ac97, reg); | 1086 | val = snd_ac97_read(ac97, reg); |
1080 | if (! *lo_max && (val & 0x7f) == cbit[i]) | 1087 | if (! *lo_max && (val & 0x7f) == cbit[i]) |
1081 | *lo_max = max[i]; | 1088 | *lo_max = max[i]; |
@@ -2224,7 +2231,7 @@ void snd_ac97_restore_iec958(ac97_t *ac97) | |||
2224 | */ | 2231 | */ |
2225 | void snd_ac97_resume(ac97_t *ac97) | 2232 | void snd_ac97_resume(ac97_t *ac97) |
2226 | { | 2233 | { |
2227 | int i; | 2234 | unsigned long end_time; |
2228 | 2235 | ||
2229 | if (ac97->bus->ops->reset) { | 2236 | if (ac97->bus->ops->reset) { |
2230 | ac97->bus->ops->reset(ac97); | 2237 | ac97->bus->ops->reset(ac97); |
@@ -2242,26 +2249,26 @@ void snd_ac97_resume(ac97_t *ac97) | |||
2242 | snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]); | 2249 | snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]); |
2243 | if (ac97_is_audio(ac97)) { | 2250 | if (ac97_is_audio(ac97)) { |
2244 | ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101); | 2251 | ac97->bus->ops->write(ac97, AC97_MASTER, 0x8101); |
2245 | for (i = HZ/10; i >= 0; i--) { | 2252 | end_time = jiffies + msecs_to_jiffies(100); |
2253 | do { | ||
2246 | if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) | 2254 | if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) |
2247 | break; | 2255 | break; |
2248 | set_current_state(TASK_UNINTERRUPTIBLE); | 2256 | set_current_state(TASK_UNINTERRUPTIBLE); |
2249 | schedule_timeout(1); | 2257 | schedule_timeout(1); |
2250 | } | 2258 | } while (time_after_eq(end_time, jiffies)); |
2251 | /* FIXME: extra delay */ | 2259 | /* FIXME: extra delay */ |
2252 | ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); | 2260 | ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); |
2253 | if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) { | 2261 | if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) |
2254 | set_current_state(TASK_UNINTERRUPTIBLE); | 2262 | msleep(250); |
2255 | schedule_timeout(HZ/4); | ||
2256 | } | ||
2257 | } else { | 2263 | } else { |
2258 | for (i = HZ/10; i >= 0; i--) { | 2264 | end_time = jiffies + msecs_to_jiffies(100); |
2265 | do { | ||
2259 | unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); | 2266 | unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); |
2260 | if (val != 0xffff && (val & 1) != 0) | 2267 | if (val != 0xffff && (val & 1) != 0) |
2261 | break; | 2268 | break; |
2262 | set_current_state(TASK_UNINTERRUPTIBLE); | 2269 | set_current_state(TASK_UNINTERRUPTIBLE); |
2263 | schedule_timeout(1); | 2270 | schedule_timeout(1); |
2264 | } | 2271 | } while (time_after_eq(end_time, jiffies)); |
2265 | } | 2272 | } |
2266 | __reset_ready: | 2273 | __reset_ready: |
2267 | 2274 | ||
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index a15eb8522b7c..66edc857d3e6 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -1528,6 +1528,9 @@ static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = { | |||
1528 | }, | 1528 | }, |
1529 | AC97_SURROUND_JACK_MODE_CTL, | 1529 | AC97_SURROUND_JACK_MODE_CTL, |
1530 | AC97_CHANNEL_MODE_CTL, | 1530 | AC97_CHANNEL_MODE_CTL, |
1531 | |||
1532 | AC97_SINGLE("Headphone Jack Sense", AC97_AD_JACK_SPDIF, 10, 1, 0), | ||
1533 | AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0), | ||
1531 | }; | 1534 | }; |
1532 | 1535 | ||
1533 | static int patch_ad1888_specific(ac97_t *ac97) | 1536 | static int patch_ad1888_specific(ac97_t *ac97) |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index eb5c36d31a52..f08ae71f902d 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -399,7 +399,7 @@ static int snd_ali_codec_ready( ali_t *codec, | |||
399 | unsigned long end_time; | 399 | unsigned long end_time; |
400 | unsigned int res; | 400 | unsigned int res; |
401 | 401 | ||
402 | end_time = jiffies + 10 * (HZ >> 2); | 402 | end_time = jiffies + 10 * msecs_to_jiffies(250); |
403 | do { | 403 | do { |
404 | res = snd_ali_5451_peek(codec,port); | 404 | res = snd_ali_5451_peek(codec,port); |
405 | if (! (res & 0x8000)) | 405 | if (! (res & 0x8000)) |
@@ -422,7 +422,7 @@ static int snd_ali_stimer_ready(ali_t *codec, int sched) | |||
422 | dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); | 422 | dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); |
423 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | 423 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); |
424 | 424 | ||
425 | end_time = jiffies + 10 * (HZ >> 2); | 425 | end_time = jiffies + 10 * msecs_to_jiffies(250); |
426 | do { | 426 | do { |
427 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | 427 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); |
428 | if (dwChk2 != dwChk1) | 428 | if (dwChk2 != dwChk1) |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index a6b4b8d589fd..8d2002951bd7 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -265,6 +265,7 @@ struct snd_atiixp { | |||
265 | */ | 265 | */ |
266 | static struct pci_device_id snd_atiixp_ids[] = { | 266 | static struct pci_device_id snd_atiixp_ids[] = { |
267 | { 0x1002, 0x434d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ | 267 | { 0x1002, 0x434d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */ |
268 | { 0x1002, 0x4378, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB400 */ | ||
268 | { 0, } | 269 | { 0, } |
269 | }; | 270 | }; |
270 | 271 | ||
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 4725b4a010be..f5a4ac1ceef9 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -306,7 +306,7 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address."); | |||
306 | #define CM_REG_FM_PCI 0x50 | 306 | #define CM_REG_FM_PCI 0x50 |
307 | 307 | ||
308 | /* | 308 | /* |
309 | * for CMI-8338 .. this is not valid for CMI-8738. | 309 | * access from SB-mixer port |
310 | */ | 310 | */ |
311 | #define CM_REG_EXTENT_IND 0xf0 | 311 | #define CM_REG_EXTENT_IND 0xf0 |
312 | #define CM_VPHONE_MASK 0xe0 /* Phone volume control (0-3) << 5 */ | 312 | #define CM_VPHONE_MASK 0xe0 /* Phone volume control (0-3) << 5 */ |
@@ -315,6 +315,7 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address."); | |||
315 | #define CM_VSPKM 0x08 /* Speaker mute control, default high */ | 315 | #define CM_VSPKM 0x08 /* Speaker mute control, default high */ |
316 | #define CM_RLOOPREN 0x04 /* Rec. R-channel enable */ | 316 | #define CM_RLOOPREN 0x04 /* Rec. R-channel enable */ |
317 | #define CM_RLOOPLEN 0x02 /* Rec. L-channel enable */ | 317 | #define CM_RLOOPLEN 0x02 /* Rec. L-channel enable */ |
318 | #define CM_VADMIC3 0x01 /* Mic record boost */ | ||
318 | 319 | ||
319 | /* | 320 | /* |
320 | * CMI-8338 spec ver 0.5 (this is not valid for CMI-8738): | 321 | * CMI-8338 spec ver 0.5 (this is not valid for CMI-8738): |
@@ -2135,8 +2136,12 @@ static snd_kcontrol_new_t snd_cmipci_mixers[] __devinitdata = { | |||
2135 | CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), | 2136 | CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), |
2136 | CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), | 2137 | CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), |
2137 | CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), | 2138 | CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), |
2138 | CMIPCI_MIXER_SW_MONO("Mic Boost", CM_REG_MIXER2, CM_MICGAINZ_SHIFT, 1), | 2139 | CMIPCI_MIXER_SW_MONO("Mic Boost Playback Switch", CM_REG_MIXER2, CM_MICGAINZ_SHIFT, 1), |
2139 | CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), | 2140 | CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), |
2141 | CMIPCI_SB_VOL_MONO("Phone Playback Volume", CM_REG_EXTENT_IND, 5, 7), | ||
2142 | CMIPCI_DOUBLE("Phone Playback Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 4, 4, 1, 0, 0), | ||
2143 | CMIPCI_DOUBLE("PC Speaker Playnack Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 3, 3, 1, 0, 0), | ||
2144 | CMIPCI_DOUBLE("Mic Boost Capture Switch", CM_REG_EXTENT_IND, CM_REG_EXTENT_IND, 0, 0, 1, 0, 0), | ||
2140 | }; | 2145 | }; |
2141 | 2146 | ||
2142 | /* | 2147 | /* |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index fd4c50c88bc9..ff28af1f658e 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -2400,8 +2400,7 @@ static void snd_cs46xx_codec_reset (ac97_t * ac97) | |||
2400 | if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05) | 2400 | if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05) |
2401 | return; | 2401 | return; |
2402 | 2402 | ||
2403 | set_current_state(TASK_UNINTERRUPTIBLE); | 2403 | msleep(10); |
2404 | schedule_timeout(HZ/100); | ||
2405 | } while (time_after_eq(end_time, jiffies)); | 2404 | } while (time_after_eq(end_time, jiffies)); |
2406 | 2405 | ||
2407 | snd_printk("CS46xx secondary codec dont respond!\n"); | 2406 | snd_printk("CS46xx secondary codec dont respond!\n"); |
@@ -2435,8 +2434,7 @@ static int __devinit cs46xx_detect_codec(cs46xx_t *chip, int codec) | |||
2435 | err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97[codec]); | 2434 | err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97[codec]); |
2436 | return err; | 2435 | return err; |
2437 | } | 2436 | } |
2438 | set_current_state(TASK_INTERRUPTIBLE); | 2437 | msleep(10); |
2439 | schedule_timeout(HZ/100); | ||
2440 | } | 2438 | } |
2441 | snd_printdd("snd_cs46xx: codec %d detection timeout\n", codec); | 2439 | snd_printdd("snd_cs46xx: codec %d detection timeout\n", codec); |
2442 | return -ENXIO; | 2440 | return -ENXIO; |
@@ -3018,8 +3016,7 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip) | |||
3018 | /* | 3016 | /* |
3019 | * Wait until the PLL has stabilized. | 3017 | * Wait until the PLL has stabilized. |
3020 | */ | 3018 | */ |
3021 | set_current_state(TASK_UNINTERRUPTIBLE); | 3019 | msleep(100); |
3022 | schedule_timeout(HZ/10); /* 100ms */ | ||
3023 | 3020 | ||
3024 | /* | 3021 | /* |
3025 | * Turn on clocking of the core so that we can setup the serial ports. | 3022 | * Turn on clocking of the core so that we can setup the serial ports. |
@@ -3072,8 +3069,7 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip) | |||
3072 | */ | 3069 | */ |
3073 | if (snd_cs46xx_peekBA0(chip, BA0_ACSTS) & ACSTS_CRDY) | 3070 | if (snd_cs46xx_peekBA0(chip, BA0_ACSTS) & ACSTS_CRDY) |
3074 | goto ok1; | 3071 | goto ok1; |
3075 | set_current_state(TASK_UNINTERRUPTIBLE); | 3072 | msleep(10); |
3076 | schedule_timeout((HZ+99)/100); | ||
3077 | } | 3073 | } |
3078 | 3074 | ||
3079 | 3075 | ||
@@ -3122,8 +3118,7 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip) | |||
3122 | */ | 3118 | */ |
3123 | if ((snd_cs46xx_peekBA0(chip, BA0_ACISV) & (ACISV_ISV3 | ACISV_ISV4)) == (ACISV_ISV3 | ACISV_ISV4)) | 3119 | if ((snd_cs46xx_peekBA0(chip, BA0_ACISV) & (ACISV_ISV3 | ACISV_ISV4)) == (ACISV_ISV3 | ACISV_ISV4)) |
3124 | goto ok2; | 3120 | goto ok2; |
3125 | set_current_state(TASK_UNINTERRUPTIBLE); | 3121 | msleep(10); |
3126 | schedule_timeout((HZ+99)/100); | ||
3127 | } | 3122 | } |
3128 | 3123 | ||
3129 | #ifndef CONFIG_SND_CS46XX_NEW_DSP | 3124 | #ifndef CONFIG_SND_CS46XX_NEW_DSP |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 2085a998eaeb..b17142cabead 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -52,6 +52,7 @@ static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; | |||
52 | static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; | 52 | static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; |
53 | static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; | 53 | static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; |
54 | static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | 54 | static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; |
55 | static uint subsystem[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* Force card subsystem model */ | ||
55 | 56 | ||
56 | module_param_array(index, int, NULL, 0444); | 57 | module_param_array(index, int, NULL, 0444); |
57 | MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); | 58 | MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard."); |
@@ -71,7 +72,8 @@ module_param_array(max_buffer_size, int, NULL, 0444); | |||
71 | MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB."); | 72 | MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB."); |
72 | module_param_array(enable_ir, bool, NULL, 0444); | 73 | module_param_array(enable_ir, bool, NULL, 0444); |
73 | MODULE_PARM_DESC(enable_ir, "Enable IR."); | 74 | MODULE_PARM_DESC(enable_ir, "Enable IR."); |
74 | 75 | module_param_array(subsystem, uint, NULL, 0444); | |
76 | MODULE_PARM_DESC(subsystem, "Force card subsystem model."); | ||
75 | /* | 77 | /* |
76 | * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 | 78 | * Class 0401: 1102:0008 (rev 00) Subsystem: 1102:1001 -> Audigy2 Value Model:SB0400 |
77 | */ | 79 | */ |
@@ -122,7 +124,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
122 | max_buffer_size[dev] = 1024; | 124 | max_buffer_size[dev] = 1024; |
123 | if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev], | 125 | if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev], |
124 | (long)max_buffer_size[dev] * 1024 * 1024, | 126 | (long)max_buffer_size[dev] * 1024 * 1024, |
125 | enable_ir[dev], | 127 | enable_ir[dev], subsystem[dev], |
126 | &emu)) < 0) { | 128 | &emu)) < 0) { |
127 | snd_card_free(card); | 129 | snd_card_free(card); |
128 | return err; | 130 | return err; |
@@ -140,7 +142,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
140 | return err; | 142 | return err; |
141 | } | 143 | } |
142 | /* This stores the periods table. */ | 144 | /* This stores the periods table. */ |
143 | if (emu->audigy && emu->revision == 4) { /* P16V */ | 145 | if (emu->card_capabilities->ca0151_chip) { /* P16V */ |
144 | if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 1024, &emu->p16v_buffer) < 0) { | 146 | if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 1024, &emu->p16v_buffer) < 0) { |
145 | snd_p16v_free(emu); | 147 | snd_p16v_free(emu); |
146 | return -ENOMEM; | 148 | return -ENOMEM; |
@@ -161,7 +163,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
161 | snd_card_free(card); | 163 | snd_card_free(card); |
162 | return err; | 164 | return err; |
163 | } | 165 | } |
164 | if (emu->audigy && emu->revision == 4) { /* P16V */ | 166 | if (emu->card_capabilities->ca0151_chip) { /* P16V */ |
165 | if ((err = snd_p16v_pcm(emu, 4, NULL)) < 0) { | 167 | if ((err = snd_p16v_pcm(emu, 4, NULL)) < 0) { |
166 | snd_card_free(card); | 168 | snd_card_free(card); |
167 | return err; | 169 | return err; |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index a341e758acde..746b51ef3966 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -191,7 +191,7 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir) | |||
191 | /* Set playback routing. */ | 191 | /* Set playback routing. */ |
192 | snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, 0x78e4); | 192 | snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, 0x78e4); |
193 | } | 193 | } |
194 | if (emu->audigy && (emu->serial == 0x10011102) ) { /* audigy2 Value */ | 194 | if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ |
195 | /* Hacks for Alice3 to work independent of haP16V driver */ | 195 | /* Hacks for Alice3 to work independent of haP16V driver */ |
196 | u32 tmp; | 196 | u32 tmp; |
197 | 197 | ||
@@ -253,6 +253,8 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir) | |||
253 | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); | 253 | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); |
254 | else | 254 | else |
255 | outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); | 255 | outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); |
256 | /* FIXME: Remove all these emu->model and replace it with a card recognition parameter, | ||
257 | * e.g. card_capabilities->joystick */ | ||
256 | } else if (emu->model == 0x20 || | 258 | } else if (emu->model == 0x20 || |
257 | emu->model == 0xc400 || | 259 | emu->model == 0xc400 || |
258 | (emu->model == 0x21 && emu->revision < 6)) | 260 | (emu->model == 0x21 && emu->revision < 6)) |
@@ -299,12 +301,12 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir) | |||
299 | if (emu->audigy) { | 301 | if (emu->audigy) { |
300 | outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); | 302 | outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); |
301 | 303 | ||
302 | if (emu->revision == 4) { /* audigy2 */ | 304 | if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ |
303 | /* Unmute Analog now. Set GPO6 to 1 for Apollo. | 305 | /* Unmute Analog now. Set GPO6 to 1 for Apollo. |
304 | * This has to be done after init ALice3 I2SOut beyond 48KHz. | 306 | * This has to be done after init ALice3 I2SOut beyond 48KHz. |
305 | * So, sequence is important. */ | 307 | * So, sequence is important. */ |
306 | outl(inl(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG); | 308 | outl(inl(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG); |
307 | } else if (emu->serial == 0x10011102) { /* audigy2 value */ | 309 | } else if (emu->card_capabilities->ca0108_chip) { /* audigy2 value */ |
308 | /* Unmute Analog now. */ | 310 | /* Unmute Analog now. */ |
309 | outl(inl(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG); | 311 | outl(inl(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG); |
310 | } else { | 312 | } else { |
@@ -614,6 +616,7 @@ static int snd_emu10k1_dev_free(snd_device_t *device) | |||
614 | 616 | ||
615 | static emu_chip_details_t emu_chip_details[] = { | 617 | static emu_chip_details_t emu_chip_details[] = { |
616 | /* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/ | 618 | /* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/ |
619 | /* Tested by James@superbug.co.uk 3rd July 2005 */ | ||
617 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102, | 620 | {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102, |
618 | .driver = "Audigy2", .name = "Audigy 2 Value [SB0400]", | 621 | .driver = "Audigy2", .name = "Audigy 2 Value [SB0400]", |
619 | .id = "Audigy2", | 622 | .id = "Audigy2", |
@@ -627,6 +630,14 @@ static emu_chip_details_t emu_chip_details[] = { | |||
627 | .emu10k2_chip = 1, | 630 | .emu10k2_chip = 1, |
628 | .ca0108_chip = 1, | 631 | .ca0108_chip = 1, |
629 | .ac97_chip = 1} , | 632 | .ac97_chip = 1} , |
633 | /* Tested by James@superbug.co.uk 8th July 2005. No sound available yet. */ | ||
634 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, | ||
635 | .driver = "Audigy2", .name = "E-mu 1212m [4001]", | ||
636 | .id = "EMU1212m", | ||
637 | .emu10k2_chip = 1, | ||
638 | .ca0102_chip = 1, | ||
639 | .ecard = 1} , | ||
640 | /* Tested by James@superbug.co.uk 3rd July 2005 */ | ||
630 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, | 641 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, |
631 | .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", | 642 | .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", |
632 | .id = "Audigy2", | 643 | .id = "Audigy2", |
@@ -687,18 +698,18 @@ static emu_chip_details_t emu_chip_details[] = { | |||
687 | .ca0151_chip = 1, | 698 | .ca0151_chip = 1, |
688 | .spdif_bug = 1, | 699 | .spdif_bug = 1, |
689 | .ac97_chip = 1} , | 700 | .ac97_chip = 1} , |
690 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10020052, | 701 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102, |
691 | .driver = "Audigy", .name = "Audigy 1 ES [SB0160]", | 702 | .driver = "Audigy", .name = "Audigy 1 [SB0090]", |
692 | .id = "Audigy", | 703 | .id = "Audigy", |
693 | .emu10k2_chip = 1, | 704 | .emu10k2_chip = 1, |
694 | .ca0102_chip = 1, | 705 | .ca0102_chip = 1, |
695 | .spdif_bug = 1, | ||
696 | .ac97_chip = 1} , | 706 | .ac97_chip = 1} , |
697 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102, | 707 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102, |
698 | .driver = "Audigy", .name = "Audigy 1 [SB0090]", | 708 | .driver = "Audigy", .name = "Audigy 1 ES [SB0160]", |
699 | .id = "Audigy", | 709 | .id = "Audigy", |
700 | .emu10k2_chip = 1, | 710 | .emu10k2_chip = 1, |
701 | .ca0102_chip = 1, | 711 | .ca0102_chip = 1, |
712 | .spdif_bug = 1, | ||
702 | .ac97_chip = 1} , | 713 | .ac97_chip = 1} , |
703 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102, | 714 | {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102, |
704 | .driver = "Audigy", .name = "Audigy 1 [SB0090]", | 715 | .driver = "Audigy", .name = "Audigy 1 [SB0090]", |
@@ -712,54 +723,49 @@ static emu_chip_details_t emu_chip_details[] = { | |||
712 | .emu10k2_chip = 1, | 723 | .emu10k2_chip = 1, |
713 | .ca0102_chip = 1, | 724 | .ca0102_chip = 1, |
714 | .ac97_chip = 1} , | 725 | .ac97_chip = 1} , |
715 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102, | 726 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102, |
716 | .driver = "EMU10K1", .name = "E-mu APS [4001]", | 727 | .driver = "EMU10K1", .name = "SBLive! [SB0105]", |
717 | .id = "APS", | ||
718 | .emu10k1_chip = 1, | ||
719 | .ecard = 1} , | ||
720 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, | ||
721 | .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", | ||
722 | .id = "Live", | 728 | .id = "Live", |
723 | .emu10k1_chip = 1, | 729 | .emu10k1_chip = 1, |
724 | .ac97_chip = 1, | 730 | .ac97_chip = 1, |
725 | .sblive51 = 1} , | 731 | .sblive51 = 1} , |
726 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, | 732 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102, |
727 | .driver = "EMU10K1", .name = "SB Live 5.1", | 733 | .driver = "EMU10K1", .name = "SBLive! Value [SB0103]", |
728 | .id = "Live", | 734 | .id = "Live", |
729 | .emu10k1_chip = 1, | 735 | .emu10k1_chip = 1, |
730 | .ac97_chip = 1, | 736 | .ac97_chip = 1, |
731 | .sblive51 = 1} , | 737 | .sblive51 = 1} , |
732 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102, | 738 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102, |
733 | .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]", | 739 | .driver = "EMU10K1", .name = "SBLive! Value [SB0101]", |
734 | .id = "Live", | ||
735 | .emu10k1_chip = 1, | ||
736 | .ac97_chip = 1} , | ||
737 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102, | ||
738 | .driver = "EMU10K1", .name = "SBLive! [CT4620]", | ||
739 | .id = "Live", | 740 | .id = "Live", |
740 | .emu10k1_chip = 1, | 741 | .emu10k1_chip = 1, |
741 | .ac97_chip = 1, | 742 | .ac97_chip = 1, |
742 | .sblive51 = 1} , | 743 | .sblive51 = 1} , |
743 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102, | 744 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, |
744 | .driver = "EMU10K1", .name = "SBLive! Value [CT4670]", | 745 | .driver = "EMU10K1", .name = "SB Live 5.1", |
745 | .id = "Live", | 746 | .id = "Live", |
746 | .emu10k1_chip = 1, | 747 | .emu10k1_chip = 1, |
747 | .ac97_chip = 1, | 748 | .ac97_chip = 1, |
748 | .sblive51 = 1} , | 749 | .sblive51 = 1} , |
749 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102, | 750 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, |
750 | .driver = "EMU10K1", .name = "SBLive! Value [CT4780]", | 751 | .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", |
751 | .id = "Live", | 752 | .id = "Live", |
752 | .emu10k1_chip = 1, | 753 | .emu10k1_chip = 1, |
753 | .ac97_chip = 1, | 754 | .ac97_chip = 1, |
754 | .sblive51 = 1} , | 755 | .sblive51 = 1} , |
755 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102, | 756 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, |
756 | .driver = "EMU10K1", .name = "SB PCI512 [CT4790]", | 757 | .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", |
757 | .id = "Live", | 758 | .id = "Live", |
758 | .emu10k1_chip = 1, | 759 | .emu10k1_chip = 1, |
759 | .ac97_chip = 1, | 760 | .ac97_chip = 1, |
760 | .sblive51 = 1} , | 761 | .sblive51 = 1} , |
761 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102, | 762 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102, |
762 | .driver = "EMU10K1", .name = "SBLive! Value [CT4830]", | 763 | .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]", |
764 | .id = "Live", | ||
765 | .emu10k1_chip = 1, | ||
766 | .ac97_chip = 1} , | ||
767 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102, | ||
768 | .driver = "EMU10K1", .name = "SBLive! Value [CT4871]", | ||
763 | .id = "Live", | 769 | .id = "Live", |
764 | .emu10k1_chip = 1, | 770 | .emu10k1_chip = 1, |
765 | .ac97_chip = 1, | 771 | .ac97_chip = 1, |
@@ -770,50 +776,50 @@ static emu_chip_details_t emu_chip_details[] = { | |||
770 | .emu10k1_chip = 1, | 776 | .emu10k1_chip = 1, |
771 | .ac97_chip = 1, | 777 | .ac97_chip = 1, |
772 | .sblive51 = 1} , | 778 | .sblive51 = 1} , |
773 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102, | 779 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102, |
774 | .driver = "EMU10K1", .name = "SBLive! Value [CT4832]", | 780 | .driver = "EMU10K1", .name = "SBLive! Value [CT4870]", |
775 | .id = "Live", | 781 | .id = "Live", |
776 | .emu10k1_chip = 1, | 782 | .emu10k1_chip = 1, |
777 | .ac97_chip = 1, | 783 | .ac97_chip = 1, |
778 | .sblive51 = 1} , | 784 | .sblive51 = 1} , |
779 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, | 785 | /* Tested by James@superbug.co.uk 3rd July 2005 */ |
780 | .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", | 786 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102, |
787 | .driver = "EMU10K1", .name = "SBLive! Value [CT4832]", | ||
781 | .id = "Live", | 788 | .id = "Live", |
782 | .emu10k1_chip = 1, | 789 | .emu10k1_chip = 1, |
783 | .ac97_chip = 1, | 790 | .ac97_chip = 1, |
784 | .sblive51 = 1} , | 791 | .sblive51 = 1} , |
785 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102, | 792 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102, |
786 | .driver = "EMU10K1", .name = "SBLive! Value [CT4870]", | 793 | .driver = "EMU10K1", .name = "SBLive! Value [CT4830]", |
787 | .id = "Live", | 794 | .id = "Live", |
788 | .emu10k1_chip = 1, | 795 | .emu10k1_chip = 1, |
789 | .ac97_chip = 1, | 796 | .ac97_chip = 1, |
790 | .sblive51 = 1} , | 797 | .sblive51 = 1} , |
791 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102, | 798 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102, |
792 | .driver = "EMU10K1", .name = "SBLive! Value [CT4871]", | 799 | .driver = "EMU10K1", .name = "SB PCI512 [CT4790]", |
793 | .id = "Live", | 800 | .id = "Live", |
794 | .emu10k1_chip = 1, | 801 | .emu10k1_chip = 1, |
795 | .ac97_chip = 1, | 802 | .ac97_chip = 1, |
796 | .sblive51 = 1} , | 803 | .sblive51 = 1} , |
797 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, | 804 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102, |
798 | .driver = "EMU10K1", .name = "SBLive! Value [SB0060]", | 805 | .driver = "EMU10K1", .name = "SBLive! Value [CT4780]", |
799 | .id = "Live", | 806 | .id = "Live", |
800 | .emu10k1_chip = 1, | 807 | .emu10k1_chip = 1, |
801 | .ac97_chip = 1, | 808 | .ac97_chip = 1, |
802 | .sblive51 = 1} , | 809 | .sblive51 = 1} , |
803 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102, | 810 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102, |
804 | .driver = "EMU10K1", .name = "SBLive! Value [SB0101]", | 811 | .driver = "EMU10K1", .name = "E-mu APS [4001]", |
805 | .id = "Live", | 812 | .id = "APS", |
806 | .emu10k1_chip = 1, | 813 | .emu10k1_chip = 1, |
807 | .ac97_chip = 1, | 814 | .ecard = 1} , |
808 | .sblive51 = 1} , | 815 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102, |
809 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102, | 816 | .driver = "EMU10K1", .name = "SBLive! [CT4620]", |
810 | .driver = "EMU10K1", .name = "SBLive! Value [SB0103]", | ||
811 | .id = "Live", | 817 | .id = "Live", |
812 | .emu10k1_chip = 1, | 818 | .emu10k1_chip = 1, |
813 | .ac97_chip = 1, | 819 | .ac97_chip = 1, |
814 | .sblive51 = 1} , | 820 | .sblive51 = 1} , |
815 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102, | 821 | {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102, |
816 | .driver = "EMU10K1", .name = "SBLive! [SB0105]", | 822 | .driver = "EMU10K1", .name = "SBLive! Value [CT4670]", |
817 | .id = "Live", | 823 | .id = "Live", |
818 | .emu10k1_chip = 1, | 824 | .emu10k1_chip = 1, |
819 | .ac97_chip = 1, | 825 | .ac97_chip = 1, |
@@ -833,6 +839,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card, | |||
833 | unsigned short extout_mask, | 839 | unsigned short extout_mask, |
834 | long max_cache_bytes, | 840 | long max_cache_bytes, |
835 | int enable_ir, | 841 | int enable_ir, |
842 | uint subsystem, | ||
836 | emu10k1_t ** remu) | 843 | emu10k1_t ** remu) |
837 | { | 844 | { |
838 | emu10k1_t *emu; | 845 | emu10k1_t *emu; |
@@ -878,10 +885,16 @@ int __devinit snd_emu10k1_create(snd_card_t * card, | |||
878 | 885 | ||
879 | for (c = emu_chip_details; c->vendor; c++) { | 886 | for (c = emu_chip_details; c->vendor; c++) { |
880 | if (c->vendor == pci->vendor && c->device == pci->device) { | 887 | if (c->vendor == pci->vendor && c->device == pci->device) { |
881 | if (c->subsystem && c->subsystem != emu->serial) | 888 | if (subsystem) { |
882 | continue; | 889 | if (c->subsystem && (c->subsystem == subsystem) ) { |
883 | if (c->revision && c->revision != emu->revision) | 890 | break; |
884 | continue; | 891 | } else continue; |
892 | } else { | ||
893 | if (c->subsystem && (c->subsystem != emu->serial) ) | ||
894 | continue; | ||
895 | if (c->revision && c->revision != emu->revision) | ||
896 | continue; | ||
897 | } | ||
885 | break; | 898 | break; |
886 | } | 899 | } |
887 | } | 900 | } |
@@ -892,10 +905,14 @@ int __devinit snd_emu10k1_create(snd_card_t * card, | |||
892 | return -ENOENT; | 905 | return -ENOENT; |
893 | } | 906 | } |
894 | emu->card_capabilities = c; | 907 | emu->card_capabilities = c; |
895 | if (c->subsystem != 0) | 908 | if (c->subsystem && !subsystem) |
896 | snd_printdd("Sound card name=%s\n", c->name); | 909 | snd_printdd("Sound card name=%s\n", c->name); |
897 | else | 910 | else if (subsystem) |
898 | snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x\n", c->name, pci->vendor, pci->device, emu->serial); | 911 | snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n", |
912 | c->name, pci->vendor, pci->device, emu->serial, c->subsystem); | ||
913 | else | ||
914 | snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n", | ||
915 | c->name, pci->vendor, pci->device, emu->serial); | ||
899 | 916 | ||
900 | if (!*card->id && c->id) { | 917 | if (!*card->id && c->id) { |
901 | int i, n = 0; | 918 | int i, n = 0; |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 98f980189892..a1691330d3b6 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -822,7 +822,7 @@ static int snd_p16v_volume_put_analog_unknown(snd_kcontrol_t * kcontrol, | |||
822 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_front = | 822 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_front = |
823 | { | 823 | { |
824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
825 | .name = "HD Analog Front Volume", | 825 | .name = "HD Analog Front Playback Volume", |
826 | .info = snd_p16v_volume_info, | 826 | .info = snd_p16v_volume_info, |
827 | .get = snd_p16v_volume_get_analog_front, | 827 | .get = snd_p16v_volume_get_analog_front, |
828 | .put = snd_p16v_volume_put_analog_front | 828 | .put = snd_p16v_volume_put_analog_front |
@@ -831,7 +831,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_front = | |||
831 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe = | 831 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe = |
832 | { | 832 | { |
833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 833 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
834 | .name = "HD Analog Center/LFE Volume", | 834 | .name = "HD Analog Center/LFE Playback Volume", |
835 | .info = snd_p16v_volume_info, | 835 | .info = snd_p16v_volume_info, |
836 | .get = snd_p16v_volume_get_analog_center_lfe, | 836 | .get = snd_p16v_volume_get_analog_center_lfe, |
837 | .put = snd_p16v_volume_put_analog_center_lfe | 837 | .put = snd_p16v_volume_put_analog_center_lfe |
@@ -840,7 +840,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe = | |||
840 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown = | 840 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown = |
841 | { | 841 | { |
842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
843 | .name = "HD Analog Unknown Volume", | 843 | .name = "HD Analog Unknown Playback Volume", |
844 | .info = snd_p16v_volume_info, | 844 | .info = snd_p16v_volume_info, |
845 | .get = snd_p16v_volume_get_analog_unknown, | 845 | .get = snd_p16v_volume_get_analog_unknown, |
846 | .put = snd_p16v_volume_put_analog_unknown | 846 | .put = snd_p16v_volume_put_analog_unknown |
@@ -849,7 +849,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown = | |||
849 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear = | 849 | static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear = |
850 | { | 850 | { |
851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
852 | .name = "HD Analog Rear Volume", | 852 | .name = "HD Analog Rear Playback Volume", |
853 | .info = snd_p16v_volume_info, | 853 | .info = snd_p16v_volume_info, |
854 | .get = snd_p16v_volume_get_analog_rear, | 854 | .get = snd_p16v_volume_get_analog_rear, |
855 | .put = snd_p16v_volume_put_analog_rear | 855 | .put = snd_p16v_volume_put_analog_rear |
@@ -858,7 +858,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear = | |||
858 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front = | 858 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front = |
859 | { | 859 | { |
860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
861 | .name = "HD SPDIF Front Volume", | 861 | .name = "HD SPDIF Front Playback Volume", |
862 | .info = snd_p16v_volume_info, | 862 | .info = snd_p16v_volume_info, |
863 | .get = snd_p16v_volume_get_spdif_front, | 863 | .get = snd_p16v_volume_get_spdif_front, |
864 | .put = snd_p16v_volume_put_spdif_front | 864 | .put = snd_p16v_volume_put_spdif_front |
@@ -867,7 +867,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front = | |||
867 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe = | 867 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe = |
868 | { | 868 | { |
869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
870 | .name = "HD SPDIF Center/LFE Volume", | 870 | .name = "HD SPDIF Center/LFE Playback Volume", |
871 | .info = snd_p16v_volume_info, | 871 | .info = snd_p16v_volume_info, |
872 | .get = snd_p16v_volume_get_spdif_center_lfe, | 872 | .get = snd_p16v_volume_get_spdif_center_lfe, |
873 | .put = snd_p16v_volume_put_spdif_center_lfe | 873 | .put = snd_p16v_volume_put_spdif_center_lfe |
@@ -876,7 +876,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe = | |||
876 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown = | 876 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown = |
877 | { | 877 | { |
878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
879 | .name = "HD SPDIF Unknown Volume", | 879 | .name = "HD SPDIF Unknown Playback Volume", |
880 | .info = snd_p16v_volume_info, | 880 | .info = snd_p16v_volume_info, |
881 | .get = snd_p16v_volume_get_spdif_unknown, | 881 | .get = snd_p16v_volume_get_spdif_unknown, |
882 | .put = snd_p16v_volume_put_spdif_unknown | 882 | .put = snd_p16v_volume_put_spdif_unknown |
@@ -885,7 +885,7 @@ static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown = | |||
885 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_rear = | 885 | static snd_kcontrol_new_t snd_p16v_volume_control_spdif_rear = |
886 | { | 886 | { |
887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
888 | .name = "HD SPDIF Rear Volume", | 888 | .name = "HD SPDIF Rear Playback Volume", |
889 | .info = snd_p16v_volume_info, | 889 | .info = snd_p16v_volume_info, |
890 | .get = snd_p16v_volume_get_spdif_rear, | 890 | .get = snd_p16v_volume_get_spdif_rear, |
891 | .put = snd_p16v_volume_put_spdif_rear | 891 | .put = snd_p16v_volume_put_spdif_rear |
@@ -936,7 +936,7 @@ static int snd_p16v_capture_source_put(snd_kcontrol_t * kcontrol, | |||
936 | static snd_kcontrol_new_t snd_p16v_capture_source __devinitdata = | 936 | static snd_kcontrol_new_t snd_p16v_capture_source __devinitdata = |
937 | { | 937 | { |
938 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 938 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
939 | .name = "HD Capture source", | 939 | .name = "HD source Capture", |
940 | .info = snd_p16v_capture_source_info, | 940 | .info = snd_p16v_capture_source_info, |
941 | .get = snd_p16v_capture_source_get, | 941 | .get = snd_p16v_capture_source_get, |
942 | .put = snd_p16v_capture_source_put | 942 | .put = snd_p16v_capture_source_put |
@@ -985,7 +985,7 @@ static int snd_p16v_capture_channel_put(snd_kcontrol_t * kcontrol, | |||
985 | static snd_kcontrol_new_t snd_p16v_capture_channel __devinitdata = | 985 | static snd_kcontrol_new_t snd_p16v_capture_channel __devinitdata = |
986 | { | 986 | { |
987 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 987 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
988 | .name = "HD Capture channel", | 988 | .name = "HD channel Capture", |
989 | .info = snd_p16v_capture_channel_info, | 989 | .info = snd_p16v_capture_channel_info, |
990 | .get = snd_p16v_capture_channel_get, | 990 | .get = snd_p16v_capture_channel_get, |
991 | .put = snd_p16v_capture_channel_put | 991 | .put = snd_p16v_capture_channel_put |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 4e63498a58b2..78a81f3912a1 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -685,6 +685,15 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97, | |||
685 | return 0; | 685 | return 0; |
686 | } | 686 | } |
687 | 687 | ||
688 | static void snd_es1371_codec_wait(ac97_t *ac97) | ||
689 | { | ||
690 | msleep(750); | ||
691 | snd_es1371_codec_read(ac97, AC97_RESET); | ||
692 | snd_es1371_codec_read(ac97, AC97_VENDOR_ID1); | ||
693 | snd_es1371_codec_read(ac97, AC97_VENDOR_ID2); | ||
694 | msleep(50); | ||
695 | } | ||
696 | |||
688 | static void snd_es1371_adc_rate(ensoniq_t * ensoniq, unsigned int rate) | 697 | static void snd_es1371_adc_rate(ensoniq_t * ensoniq, unsigned int rate) |
689 | { | 698 | { |
690 | unsigned int n, truncm, freq, result; | 699 | unsigned int n, truncm, freq, result; |
@@ -1585,6 +1594,7 @@ static int snd_ensoniq_1371_mixer(ensoniq_t * ensoniq) | |||
1585 | static ac97_bus_ops_t ops = { | 1594 | static ac97_bus_ops_t ops = { |
1586 | .write = snd_es1371_codec_write, | 1595 | .write = snd_es1371_codec_write, |
1587 | .read = snd_es1371_codec_read, | 1596 | .read = snd_es1371_codec_read, |
1597 | .wait = snd_es1371_codec_wait, | ||
1588 | }; | 1598 | }; |
1589 | 1599 | ||
1590 | if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0) | 1600 | if ((err = snd_ac97_bus(card, 0, &ops, NULL, &pbus)) < 0) |
@@ -2008,21 +2018,11 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
2008 | if (pci->vendor == es1371_ac97_reset_hack[idx].vid && | 2018 | if (pci->vendor == es1371_ac97_reset_hack[idx].vid && |
2009 | pci->device == es1371_ac97_reset_hack[idx].did && | 2019 | pci->device == es1371_ac97_reset_hack[idx].did && |
2010 | ensoniq->rev == es1371_ac97_reset_hack[idx].rev) { | 2020 | ensoniq->rev == es1371_ac97_reset_hack[idx].rev) { |
2011 | unsigned long tmo; | ||
2012 | signed long tmo2; | ||
2013 | |||
2014 | ensoniq->cssr |= ES_1371_ST_AC97_RST; | 2021 | ensoniq->cssr |= ES_1371_ST_AC97_RST; |
2015 | outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); | 2022 | outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); |
2016 | /* need to delay around 20ms(bleech) to give | 2023 | /* need to delay around 20ms(bleech) to give |
2017 | some CODECs enough time to wakeup */ | 2024 | some CODECs enough time to wakeup */ |
2018 | tmo = jiffies + (HZ / 50) + 1; | 2025 | msleep(20); |
2019 | while (1) { | ||
2020 | tmo2 = tmo - jiffies; | ||
2021 | if (tmo2 <= 0) | ||
2022 | break; | ||
2023 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
2024 | schedule_timeout(tmo2); | ||
2025 | } | ||
2026 | break; | 2026 | break; |
2027 | } | 2027 | } |
2028 | /* AC'97 warm reset to start the bitclk */ | 2028 | /* AC'97 warm reset to start the bitclk */ |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 327a341e276b..9d7a28783930 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -664,11 +664,6 @@ static inline u16 maestro_read(es1968_t *chip, u16 reg) | |||
664 | return result; | 664 | return result; |
665 | } | 665 | } |
666 | 666 | ||
667 | #define big_mdelay(msec) do {\ | ||
668 | set_current_state(TASK_UNINTERRUPTIBLE);\ | ||
669 | schedule_timeout(((msec) * HZ + 999) / 1000);\ | ||
670 | } while (0) | ||
671 | |||
672 | /* Wait for the codec bus to be free */ | 667 | /* Wait for the codec bus to be free */ |
673 | static int snd_es1968_ac97_wait(es1968_t *chip) | 668 | static int snd_es1968_ac97_wait(es1968_t *chip) |
674 | { | 669 | { |
@@ -1809,8 +1804,7 @@ static void __devinit es1968_measure_clock(es1968_t *chip) | |||
1809 | snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR); | 1804 | snd_es1968_trigger_apu(chip, apu, ESM_APU_16BITLINEAR); |
1810 | do_gettimeofday(&start_time); | 1805 | do_gettimeofday(&start_time); |
1811 | spin_unlock_irq(&chip->reg_lock); | 1806 | spin_unlock_irq(&chip->reg_lock); |
1812 | set_current_state(TASK_UNINTERRUPTIBLE); | 1807 | msleep(50); |
1813 | schedule_timeout(HZ / 20); /* 50 msec */ | ||
1814 | spin_lock_irq(&chip->reg_lock); | 1808 | spin_lock_irq(&chip->reg_lock); |
1815 | offset = __apu_get_register(chip, apu, 5); | 1809 | offset = __apu_get_register(chip, apu, 5); |
1816 | do_gettimeofday(&stop_time); | 1810 | do_gettimeofday(&stop_time); |
@@ -2093,7 +2087,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2093 | outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */ | 2087 | outw(0x0000, ioaddr + 0x60); /* write 0 to gpio 0 */ |
2094 | udelay(20); | 2088 | udelay(20); |
2095 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */ | 2089 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio 1 */ |
2096 | big_mdelay(20); | 2090 | msleep(20); |
2097 | 2091 | ||
2098 | outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */ | 2092 | outw(save_68 | 0x1, ioaddr + 0x68); /* now restore .. */ |
2099 | outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38); | 2093 | outw((inw(ioaddr + 0x38) & 0xfffc) | 0x1, ioaddr + 0x38); |
@@ -2109,7 +2103,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2109 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */ | 2103 | outw(0x0001, ioaddr + 0x60); /* write 1 to gpio */ |
2110 | udelay(20); | 2104 | udelay(20); |
2111 | outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */ | 2105 | outw(0x0009, ioaddr + 0x60); /* write 9 to gpio */ |
2112 | big_mdelay(500); | 2106 | msleep(500); |
2113 | //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); | 2107 | //outw(inw(ioaddr + 0x38) & 0xfffc, ioaddr + 0x38); |
2114 | outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); | 2108 | outw(inw(ioaddr + 0x3a) & 0xfffc, ioaddr + 0x3a); |
2115 | outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); | 2109 | outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); |
@@ -2135,7 +2129,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2135 | 2129 | ||
2136 | if (w > 10000) { | 2130 | if (w > 10000) { |
2137 | outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */ | 2131 | outb(inb(ioaddr + 0x37) | 0x08, ioaddr + 0x37); /* do a software reset */ |
2138 | big_mdelay(500); /* oh my.. */ | 2132 | msleep(500); /* oh my.. */ |
2139 | outb(inb(ioaddr + 0x37) & ~0x08, | 2133 | outb(inb(ioaddr + 0x37) & ~0x08, |
2140 | ioaddr + 0x37); | 2134 | ioaddr + 0x37); |
2141 | udelay(1); | 2135 | udelay(1); |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 59991560d492..dd0d99d2ad27 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -262,6 +262,9 @@ enum { | |||
262 | #define AC_PINCTL_OUT_EN (1<<6) | 262 | #define AC_PINCTL_OUT_EN (1<<6) |
263 | #define AC_PINCTL_HP_EN (1<<7) | 263 | #define AC_PINCTL_HP_EN (1<<7) |
264 | 264 | ||
265 | /* Unsolicited response - 8bit */ | ||
266 | #define AC_USRSP_EN (1<<7) | ||
267 | |||
265 | /* configuration default - 32bit */ | 268 | /* configuration default - 32bit */ |
266 | #define AC_DEFCFG_SEQUENCE (0xf<<0) | 269 | #define AC_DEFCFG_SEQUENCE (0xf<<0) |
267 | #define AC_DEFCFG_DEF_ASSOC (0xf<<4) | 270 | #define AC_DEFCFG_DEF_ASSOC (0xf<<4) |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 5e0cca36ed57..288ab0764830 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -178,6 +178,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
178 | #define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */ | 178 | #define ICH6_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */ |
179 | #define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */ | 179 | #define ICH6_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */ |
180 | 180 | ||
181 | /* GCTL unsolicited response enable bit */ | ||
182 | #define ICH6_GCTL_UREN (1<<8) | ||
183 | |||
181 | /* GCTL reset bit */ | 184 | /* GCTL reset bit */ |
182 | #define ICH6_GCTL_RESET (1<<0) | 185 | #define ICH6_GCTL_RESET (1<<0) |
183 | 186 | ||
@@ -562,6 +565,9 @@ static int azx_reset(azx_t *chip) | |||
562 | return -EBUSY; | 565 | return -EBUSY; |
563 | } | 566 | } |
564 | 567 | ||
568 | /* Accept unsolicited responses */ | ||
569 | azx_writel(chip, GCTL, azx_readl(chip, GCTL) | ICH6_GCTL_UREN); | ||
570 | |||
565 | /* detect codecs */ | 571 | /* detect codecs */ |
566 | if (! chip->codec_mask) { | 572 | if (! chip->codec_mask) { |
567 | chip->codec_mask = azx_readw(chip, STATESTS); | 573 | chip->codec_mask = azx_readw(chip, STATESTS); |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 2d6e3e3d0a38..86f195f19eef 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -408,7 +408,7 @@ static int cmi9880_fill_multi_dac_nids(struct hda_codec *codec, const struct aut | |||
408 | /* search for an empty channel */ | 408 | /* search for an empty channel */ |
409 | for (j = 0; j < cfg->line_outs; j++) { | 409 | for (j = 0; j < cfg->line_outs; j++) { |
410 | if (! assigned[j]) { | 410 | if (! assigned[j]) { |
411 | spec->dac_nids[i] = i + 0x03; | 411 | spec->dac_nids[i] = j + 0x03; |
412 | assigned[j] = 1; | 412 | assigned[j] = 1; |
413 | break; | 413 | break; |
414 | } | 414 | } |
@@ -444,11 +444,10 @@ static int cmi9880_fill_multi_init(struct hda_codec *codec, const struct auto_pi | |||
444 | len = snd_hda_get_connections(codec, nid, conn, 4); | 444 | len = snd_hda_get_connections(codec, nid, conn, 4); |
445 | for (k = 0; k < len; k++) | 445 | for (k = 0; k < len; k++) |
446 | if (conn[k] == spec->dac_nids[i]) { | 446 | if (conn[k] == spec->dac_nids[i]) { |
447 | spec->multi_init[j].param = j; | 447 | spec->multi_init[j].param = k; |
448 | break; | 448 | break; |
449 | } | 449 | } |
450 | j++; | 450 | j++; |
451 | break; | ||
452 | } | 451 | } |
453 | } | 452 | } |
454 | return 0; | 453 | return 0; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index bab89843d850..9b8569900787 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -40,6 +40,7 @@ enum { | |||
40 | ALC880_W810, | 40 | ALC880_W810, |
41 | ALC880_Z71V, | 41 | ALC880_Z71V, |
42 | ALC880_AUTO, | 42 | ALC880_AUTO, |
43 | ALC880_6ST, | ||
43 | ALC880_6ST_DIG, | 44 | ALC880_6ST_DIG, |
44 | ALC880_F1734, | 45 | ALC880_F1734, |
45 | ALC880_ASUS, | 46 | ALC880_ASUS, |
@@ -119,6 +120,7 @@ struct alc_spec { | |||
119 | unsigned int num_kctl_alloc, num_kctl_used; | 120 | unsigned int num_kctl_alloc, num_kctl_used; |
120 | snd_kcontrol_new_t *kctl_alloc; | 121 | snd_kcontrol_new_t *kctl_alloc; |
121 | struct hda_input_mux private_imux; | 122 | struct hda_input_mux private_imux; |
123 | hda_nid_t private_dac_nids[4]; | ||
122 | }; | 124 | }; |
123 | 125 | ||
124 | 126 | ||
@@ -1547,9 +1549,10 @@ static struct hda_board_config alc880_cfg_tbl[] = { | |||
1547 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, | 1549 | { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, |
1548 | { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, | 1550 | { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, |
1549 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG }, | 1551 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG }, |
1550 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, | 1552 | /* { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, */ /* conflict with 6stack */ |
1551 | { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG }, | 1553 | { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG }, |
1552 | { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, | 1554 | /* note subvendor = 0 below */ |
1555 | /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */ | ||
1553 | 1556 | ||
1554 | { .modelname = "w810", .config = ALC880_W810 }, | 1557 | { .modelname = "w810", .config = ALC880_W810 }, |
1555 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, | 1558 | { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, |
@@ -1557,7 +1560,10 @@ static struct hda_board_config alc880_cfg_tbl[] = { | |||
1557 | { .modelname = "z71v", .config = ALC880_Z71V }, | 1560 | { .modelname = "z71v", .config = ALC880_Z71V }, |
1558 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, | 1561 | { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, |
1559 | 1562 | ||
1560 | { .modelname = "6statack-digout", .config = ALC880_6ST_DIG }, | 1563 | { .modelname = "6stack", .config = ALC880_6ST }, |
1564 | { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_6ST }, /* Acer APFV */ | ||
1565 | |||
1566 | { .modelname = "6stack-digout", .config = ALC880_6ST_DIG }, | ||
1561 | { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, | 1567 | { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, |
1562 | { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG }, | 1568 | { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG }, |
1563 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG }, | 1569 | { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG }, |
@@ -1644,6 +1650,15 @@ static struct alc_config_preset alc880_presets[] = { | |||
1644 | .channel_mode = alc880_fivestack_modes, | 1650 | .channel_mode = alc880_fivestack_modes, |
1645 | .input_mux = &alc880_capture_source, | 1651 | .input_mux = &alc880_capture_source, |
1646 | }, | 1652 | }, |
1653 | [ALC880_6ST] = { | ||
1654 | .mixers = { alc880_six_stack_mixer }, | ||
1655 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, | ||
1656 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | ||
1657 | .dac_nids = alc880_6st_dac_nids, | ||
1658 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | ||
1659 | .channel_mode = alc880_sixstack_modes, | ||
1660 | .input_mux = &alc880_6stack_capture_source, | ||
1661 | }, | ||
1647 | [ALC880_6ST_DIG] = { | 1662 | [ALC880_6ST_DIG] = { |
1648 | .mixers = { alc880_six_stack_mixer }, | 1663 | .mixers = { alc880_six_stack_mixer }, |
1649 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, | 1664 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, |
@@ -1656,7 +1671,8 @@ static struct alc_config_preset alc880_presets[] = { | |||
1656 | }, | 1671 | }, |
1657 | [ALC880_W810] = { | 1672 | [ALC880_W810] = { |
1658 | .mixers = { alc880_w810_base_mixer }, | 1673 | .mixers = { alc880_w810_base_mixer }, |
1659 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs }, | 1674 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs, |
1675 | alc880_gpio2_init_verbs }, | ||
1660 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), | 1676 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
1661 | .dac_nids = alc880_w810_dac_nids, | 1677 | .dac_nids = alc880_w810_dac_nids, |
1662 | .dig_out_nid = ALC880_DIGOUT_NID, | 1678 | .dig_out_nid = ALC880_DIGOUT_NID, |
@@ -1666,8 +1682,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
1666 | }, | 1682 | }, |
1667 | [ALC880_Z71V] = { | 1683 | [ALC880_Z71V] = { |
1668 | .mixers = { alc880_z71v_mixer }, | 1684 | .mixers = { alc880_z71v_mixer }, |
1669 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs, | 1685 | .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs }, |
1670 | alc880_gpio2_init_verbs }, | ||
1671 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), | 1686 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
1672 | .dac_nids = alc880_z71v_dac_nids, | 1687 | .dac_nids = alc880_z71v_dac_nids, |
1673 | .dig_out_nid = ALC880_DIGOUT_NID, | 1688 | .dig_out_nid = ALC880_DIGOUT_NID, |
@@ -1809,6 +1824,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pi | |||
1809 | int i, j; | 1824 | int i, j; |
1810 | 1825 | ||
1811 | memset(assigned, 0, sizeof(assigned)); | 1826 | memset(assigned, 0, sizeof(assigned)); |
1827 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
1812 | 1828 | ||
1813 | /* check the pins hardwired to audio widget */ | 1829 | /* check the pins hardwired to audio widget */ |
1814 | for (i = 0; i < cfg->line_outs; i++) { | 1830 | for (i = 0; i < cfg->line_outs; i++) { |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 013be2ea513a..9d503da7320d 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -30,32 +30,37 @@ | |||
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
32 | #include <sound/core.h> | 32 | #include <sound/core.h> |
33 | #include <sound/asoundef.h> | ||
33 | #include "hda_codec.h" | 34 | #include "hda_codec.h" |
34 | #include "hda_local.h" | 35 | #include "hda_local.h" |
35 | 36 | ||
36 | #undef STAC_TEST | 37 | #undef STAC_TEST |
37 | 38 | ||
39 | #define NUM_CONTROL_ALLOC 32 | ||
40 | #define STAC_HP_EVENT 0x37 | ||
41 | #define STAC_UNSOL_ENABLE (AC_USRSP_EN | STAC_HP_EVENT) | ||
42 | |||
38 | struct sigmatel_spec { | 43 | struct sigmatel_spec { |
44 | snd_kcontrol_new_t *mixers[4]; | ||
45 | unsigned int num_mixers; | ||
46 | |||
47 | unsigned int surr_switch: 1; | ||
48 | |||
39 | /* playback */ | 49 | /* playback */ |
40 | struct hda_multi_out multiout; | 50 | struct hda_multi_out multiout; |
41 | hda_nid_t playback_nid; | 51 | hda_nid_t dac_nids[4]; |
42 | 52 | ||
43 | /* capture */ | 53 | /* capture */ |
44 | hda_nid_t *adc_nids; | 54 | hda_nid_t *adc_nids; |
45 | unsigned int num_adcs; | 55 | unsigned int num_adcs; |
46 | hda_nid_t *mux_nids; | 56 | hda_nid_t *mux_nids; |
47 | unsigned int num_muxes; | 57 | unsigned int num_muxes; |
48 | hda_nid_t capture_nid; | ||
49 | hda_nid_t dig_in_nid; | 58 | hda_nid_t dig_in_nid; |
50 | 59 | ||
51 | /* power management*/ | 60 | #ifdef STAC_TEST |
52 | hda_nid_t *pstate_nids; | ||
53 | unsigned int num_pstates; | ||
54 | |||
55 | /* pin widgets */ | 61 | /* pin widgets */ |
56 | hda_nid_t *pin_nids; | 62 | hda_nid_t *pin_nids; |
57 | unsigned int num_pins; | 63 | unsigned int num_pins; |
58 | #ifdef STAC_TEST | ||
59 | unsigned int *pin_configs; | 64 | unsigned int *pin_configs; |
60 | #endif | 65 | #endif |
61 | 66 | ||
@@ -64,16 +69,20 @@ struct sigmatel_spec { | |||
64 | snd_kcontrol_new_t *mixer; | 69 | snd_kcontrol_new_t *mixer; |
65 | 70 | ||
66 | /* capture source */ | 71 | /* capture source */ |
67 | struct hda_input_mux input_mux; | 72 | struct hda_input_mux *input_mux; |
68 | char input_labels[HDA_MAX_NUM_INPUTS][16]; | ||
69 | unsigned int cur_mux[2]; | 73 | unsigned int cur_mux[2]; |
70 | 74 | ||
71 | /* channel mode */ | 75 | /* channel mode */ |
72 | unsigned int num_ch_modes; | 76 | unsigned int num_ch_modes; |
73 | unsigned int cur_ch_mode; | 77 | unsigned int cur_ch_mode; |
74 | const struct sigmatel_channel_mode *channel_modes; | ||
75 | 78 | ||
76 | struct hda_pcm pcm_rec[1]; /* PCM information */ | 79 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
80 | |||
81 | /* dynamic controls and input_mux */ | ||
82 | struct auto_pin_cfg autocfg; | ||
83 | unsigned int num_kctl_alloc, num_kctl_used; | ||
84 | snd_kcontrol_new_t *kctl_alloc; | ||
85 | struct hda_input_mux private_imux; | ||
77 | }; | 86 | }; |
78 | 87 | ||
79 | static hda_nid_t stac9200_adc_nids[1] = { | 88 | static hda_nid_t stac9200_adc_nids[1] = { |
@@ -88,14 +97,6 @@ static hda_nid_t stac9200_dac_nids[1] = { | |||
88 | 0x02, | 97 | 0x02, |
89 | }; | 98 | }; |
90 | 99 | ||
91 | static hda_nid_t stac9200_pstate_nids[3] = { | ||
92 | 0x01, 0x02, 0x03, | ||
93 | }; | ||
94 | |||
95 | static hda_nid_t stac9200_pin_nids[8] = { | ||
96 | 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, | ||
97 | }; | ||
98 | |||
99 | static hda_nid_t stac922x_adc_nids[2] = { | 100 | static hda_nid_t stac922x_adc_nids[2] = { |
100 | 0x06, 0x07, | 101 | 0x06, 0x07, |
101 | }; | 102 | }; |
@@ -104,24 +105,22 @@ static hda_nid_t stac922x_mux_nids[2] = { | |||
104 | 0x12, 0x13, | 105 | 0x12, 0x13, |
105 | }; | 106 | }; |
106 | 107 | ||
107 | static hda_nid_t stac922x_dac_nids[4] = { | 108 | #ifdef STAC_TEST |
108 | 0x02, 0x03, 0x04, 0x05, | 109 | static hda_nid_t stac9200_pin_nids[8] = { |
109 | }; | 110 | 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, |
110 | |||
111 | static hda_nid_t stac922x_pstate_nids[8] = { | ||
112 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, | ||
113 | }; | 111 | }; |
114 | 112 | ||
115 | static hda_nid_t stac922x_pin_nids[10] = { | 113 | static hda_nid_t stac922x_pin_nids[10] = { |
116 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | 114 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
117 | 0x0f, 0x10, 0x11, 0x15, 0x1b, | 115 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
118 | }; | 116 | }; |
117 | #endif | ||
119 | 118 | ||
120 | static int stac92xx_mux_enum_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 119 | static int stac92xx_mux_enum_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) |
121 | { | 120 | { |
122 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 121 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
123 | struct sigmatel_spec *spec = codec->spec; | 122 | struct sigmatel_spec *spec = codec->spec; |
124 | return snd_hda_input_mux_info(&spec->input_mux, uinfo); | 123 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
125 | } | 124 | } |
126 | 125 | ||
127 | static int stac92xx_mux_enum_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 126 | static int stac92xx_mux_enum_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) |
@@ -140,26 +139,64 @@ static int stac92xx_mux_enum_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
140 | struct sigmatel_spec *spec = codec->spec; | 139 | struct sigmatel_spec *spec = codec->spec; |
141 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 140 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
142 | 141 | ||
143 | return snd_hda_input_mux_put(codec, &spec->input_mux, ucontrol, | 142 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
144 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); | 143 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
145 | } | 144 | } |
146 | 145 | ||
147 | static struct hda_verb stac9200_ch2_init[] = { | 146 | static struct hda_verb stac9200_core_init[] = { |
148 | /* set dac0mux for dac converter */ | 147 | /* set dac0mux for dac converter */ |
149 | { 0x07, 0x701, 0x00}, | 148 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
150 | {} | 149 | {} |
151 | }; | 150 | }; |
152 | 151 | ||
153 | static struct hda_verb stac922x_ch2_init[] = { | 152 | static struct hda_verb stac922x_core_init[] = { |
154 | /* set master volume and direct control */ | 153 | /* set master volume and direct control */ |
155 | { 0x16, 0x70f, 0xff}, | 154 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
156 | {} | 155 | {} |
157 | }; | 156 | }; |
158 | 157 | ||
159 | struct sigmatel_channel_mode { | 158 | static int stac922x_channel_modes[3] = {2, 6, 8}; |
160 | unsigned int channels; | 159 | |
161 | const struct hda_verb *sequence; | 160 | static int stac922x_ch_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) |
162 | }; | 161 | { |
162 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
163 | struct sigmatel_spec *spec = codec->spec; | ||
164 | |||
165 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
166 | uinfo->count = 1; | ||
167 | uinfo->value.enumerated.items = spec->num_ch_modes; | ||
168 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
169 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
170 | sprintf(uinfo->value.enumerated.name, "%dch", | ||
171 | stac922x_channel_modes[uinfo->value.enumerated.item]); | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static int stac922x_ch_mode_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | ||
176 | { | ||
177 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
178 | struct sigmatel_spec *spec = codec->spec; | ||
179 | |||
180 | ucontrol->value.enumerated.item[0] = spec->cur_ch_mode; | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static int stac922x_ch_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | ||
185 | { | ||
186 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
187 | struct sigmatel_spec *spec = codec->spec; | ||
188 | |||
189 | if (ucontrol->value.enumerated.item[0] >= spec->num_ch_modes) | ||
190 | ucontrol->value.enumerated.item[0] = spec->num_ch_modes; | ||
191 | if (ucontrol->value.enumerated.item[0] == spec->cur_ch_mode && | ||
192 | ! codec->in_resume) | ||
193 | return 0; | ||
194 | |||
195 | spec->cur_ch_mode = ucontrol->value.enumerated.item[0]; | ||
196 | spec->multiout.max_channels = stac922x_channel_modes[spec->cur_ch_mode]; | ||
197 | |||
198 | return 1; | ||
199 | } | ||
163 | 200 | ||
164 | static snd_kcontrol_new_t stac9200_mixer[] = { | 201 | static snd_kcontrol_new_t stac9200_mixer[] = { |
165 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), | 202 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
@@ -174,13 +211,12 @@ static snd_kcontrol_new_t stac9200_mixer[] = { | |||
174 | }, | 211 | }, |
175 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), | 212 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
176 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), | 213 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
177 | HDA_CODEC_VOLUME("Input Mux Volume", 0x0c, 0, HDA_OUTPUT), | 214 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), |
178 | { } /* end */ | 215 | { } /* end */ |
179 | }; | 216 | }; |
180 | 217 | ||
218 | /* This needs to be generated dynamically based on sequence */ | ||
181 | static snd_kcontrol_new_t stac922x_mixer[] = { | 219 | static snd_kcontrol_new_t stac922x_mixer[] = { |
182 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
183 | HDA_CODEC_MUTE("PCM Playback Switch", 0x2, 0x0, HDA_OUTPUT), | ||
184 | { | 220 | { |
185 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 221 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
186 | .name = "Input Source", | 222 | .name = "Input Source", |
@@ -195,14 +231,38 @@ static snd_kcontrol_new_t stac922x_mixer[] = { | |||
195 | { } /* end */ | 231 | { } /* end */ |
196 | }; | 232 | }; |
197 | 233 | ||
234 | static snd_kcontrol_new_t stac922x_ch_mode_mixer[] = { | ||
235 | { | ||
236 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
237 | .name = "Channel Mode", | ||
238 | .info = stac922x_ch_mode_info, | ||
239 | .get = stac922x_ch_mode_get, | ||
240 | .put = stac922x_ch_mode_put, | ||
241 | }, | ||
242 | { } /* end */ | ||
243 | }; | ||
244 | |||
198 | static int stac92xx_build_controls(struct hda_codec *codec) | 245 | static int stac92xx_build_controls(struct hda_codec *codec) |
199 | { | 246 | { |
200 | struct sigmatel_spec *spec = codec->spec; | 247 | struct sigmatel_spec *spec = codec->spec; |
201 | int err; | 248 | int err; |
249 | int i; | ||
202 | 250 | ||
203 | err = snd_hda_add_new_ctls(codec, spec->mixer); | 251 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
204 | if (err < 0) | 252 | if (err < 0) |
205 | return err; | 253 | return err; |
254 | |||
255 | for (i = 0; i < spec->num_mixers; i++) { | ||
256 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | ||
257 | if (err < 0) | ||
258 | return err; | ||
259 | } | ||
260 | |||
261 | if (spec->surr_switch) { | ||
262 | err = snd_hda_add_new_ctls(codec, stac922x_ch_mode_mixer); | ||
263 | if (err < 0) | ||
264 | return err; | ||
265 | } | ||
206 | if (spec->multiout.dig_out_nid) { | 266 | if (spec->multiout.dig_out_nid) { |
207 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 267 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
208 | if (err < 0) | 268 | if (err < 0) |
@@ -222,9 +282,9 @@ static unsigned int stac9200_pin_configs[8] = { | |||
222 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, | 282 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
223 | }; | 283 | }; |
224 | 284 | ||
225 | static unsigned int stac922x_pin_configs[14] = { | 285 | static unsigned int stac922x_pin_configs[10] = { |
226 | 0x40000100, 0x40000100, 0x40000100, 0x01114010, | 286 | 0x01014010, 0x01014011, 0x01014012, 0x0221401f, |
227 | 0x01813122, 0x40000100, 0x01447010, 0x01c47010, | 287 | 0x01813122, 0x01014014, 0x01441030, 0x01c41030, |
228 | 0x40000100, 0x40000100, | 288 | 0x40000100, 0x40000100, |
229 | }; | 289 | }; |
230 | 290 | ||
@@ -255,180 +315,66 @@ static void stac92xx_set_config_regs(struct hda_codec *codec) | |||
255 | } | 315 | } |
256 | #endif | 316 | #endif |
257 | 317 | ||
258 | static int stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, unsigned int value) | ||
259 | { | ||
260 | unsigned int pin_ctl; | ||
261 | |||
262 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | ||
263 | AC_VERB_GET_PIN_WIDGET_CONTROL, | ||
264 | 0x00); | ||
265 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
266 | pin_ctl | value); | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static int stac92xx_set_vref(struct hda_codec *codec, hda_nid_t nid) | ||
272 | { | ||
273 | unsigned int vref_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) >> AC_PINCAP_VREF_SHIFT; | ||
274 | unsigned int vref_ctl = AC_PINCTL_VREF_HIZ; | ||
275 | |||
276 | if (vref_caps & AC_PINCAP_VREF_100) | ||
277 | vref_ctl = AC_PINCTL_VREF_100; | ||
278 | else if (vref_caps & AC_PINCAP_VREF_80) | ||
279 | vref_ctl = AC_PINCTL_VREF_80; | ||
280 | else if (vref_caps & AC_PINCAP_VREF_50) | ||
281 | vref_ctl = AC_PINCTL_VREF_50; | ||
282 | else if (vref_caps & AC_PINCAP_VREF_GRD) | ||
283 | vref_ctl = AC_PINCTL_VREF_GRD; | ||
284 | |||
285 | stac92xx_set_pinctl(codec, nid, vref_ctl); | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | /* | 318 | /* |
291 | * retrieve the default device type from the default config value | 319 | * Analog playback callbacks |
292 | */ | 320 | */ |
293 | #define get_defcfg_type(cfg) ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT) | 321 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
294 | #define get_defcfg_location(cfg) ((cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT) | 322 | struct hda_codec *codec, |
295 | 323 | snd_pcm_substream_t *substream) | |
296 | static int stac92xx_config_pin(struct hda_codec *codec, hda_nid_t nid, unsigned int pin_cfg) | ||
297 | { | 324 | { |
298 | struct sigmatel_spec *spec = codec->spec; | 325 | struct sigmatel_spec *spec = codec->spec; |
299 | u32 location = get_defcfg_location(pin_cfg); | 326 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
300 | char *label; | ||
301 | const char *type = NULL; | ||
302 | int ainput = 0; | ||
303 | |||
304 | switch(get_defcfg_type(pin_cfg)) { | ||
305 | case AC_JACK_HP_OUT: | ||
306 | /* Enable HP amp */ | ||
307 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_HP_EN); | ||
308 | /* Fall through */ | ||
309 | case AC_JACK_SPDIF_OUT: | ||
310 | case AC_JACK_LINE_OUT: | ||
311 | case AC_JACK_SPEAKER: | ||
312 | /* Enable output */ | ||
313 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | ||
314 | break; | ||
315 | case AC_JACK_SPDIF_IN: | ||
316 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN); | ||
317 | break; | ||
318 | case AC_JACK_MIC_IN: | ||
319 | if ((location & 0x0f) == AC_JACK_LOC_FRONT) | ||
320 | type = "Front Mic"; | ||
321 | else | ||
322 | type = "Mic"; | ||
323 | ainput = 1; | ||
324 | /* Set vref */ | ||
325 | stac92xx_set_vref(codec, nid); | ||
326 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN); | ||
327 | break; | ||
328 | case AC_JACK_CD: | ||
329 | type = "CD"; | ||
330 | ainput = 1; | ||
331 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN); | ||
332 | break; | ||
333 | case AC_JACK_LINE_IN: | ||
334 | if ((location & 0x0f) == AC_JACK_LOC_FRONT) | ||
335 | type = "Front Line"; | ||
336 | else | ||
337 | type = "Line"; | ||
338 | ainput = 1; | ||
339 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN); | ||
340 | break; | ||
341 | case AC_JACK_AUX: | ||
342 | if ((location & 0x0f) == AC_JACK_LOC_FRONT) | ||
343 | type = "Front Aux"; | ||
344 | else | ||
345 | type = "Aux"; | ||
346 | ainput = 1; | ||
347 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_IN_EN); | ||
348 | break; | ||
349 | } | ||
350 | |||
351 | if (ainput) { | ||
352 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; | ||
353 | int i, j, num_cons, index = -1; | ||
354 | if (!type) | ||
355 | type = "Input"; | ||
356 | label = spec->input_labels[spec->input_mux.num_items]; | ||
357 | strcpy(label, type); | ||
358 | spec->input_mux.items[spec->input_mux.num_items].label = label; | ||
359 | for (i=0; i<spec->num_muxes; i++) { | ||
360 | num_cons = snd_hda_get_connections(codec, spec->mux_nids[i], con_lst, HDA_MAX_NUM_INPUTS); | ||
361 | for (j=0; j<num_cons; j++) | ||
362 | if (con_lst[j] == nid) { | ||
363 | index = j; | ||
364 | break; | ||
365 | } | ||
366 | if (index >= 0) | ||
367 | break; | ||
368 | } | ||
369 | spec->input_mux.items[spec->input_mux.num_items].index = index; | ||
370 | spec->input_mux.num_items++; | ||
371 | } | ||
372 | |||
373 | return 0; | ||
374 | } | 327 | } |
375 | 328 | ||
376 | static int stac92xx_config_pins(struct hda_codec *codec) | 329 | /* |
330 | * set up the i/o for analog out | ||
331 | * when the digital out is available, copy the front out to digital out, too. | ||
332 | */ | ||
333 | static int stac92xx_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_out *mout, | ||
334 | unsigned int stream_tag, | ||
335 | unsigned int format, | ||
336 | snd_pcm_substream_t *substream) | ||
377 | { | 337 | { |
378 | struct sigmatel_spec *spec = codec->spec; | 338 | hda_nid_t *nids = mout->dac_nids; |
339 | int chs = substream->runtime->channels; | ||
379 | int i; | 340 | int i; |
380 | unsigned int pin_cfg; | ||
381 | 341 | ||
382 | for (i=0; i < spec->num_pins; i++) { | 342 | down(&codec->spdif_mutex); |
383 | /* Default to disabled */ | 343 | if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { |
384 | snd_hda_codec_write(codec, spec->pin_nids[i], 0, | 344 | if (chs == 2 && |
385 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 345 | snd_hda_is_supported_format(codec, mout->dig_out_nid, format) && |
386 | 0x00); | 346 | ! (codec->spdif_status & IEC958_AES0_NONAUDIO)) { |
387 | 347 | mout->dig_out_used = HDA_DIG_ANALOG_DUP; | |
388 | pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0, | 348 | /* setup digital receiver */ |
389 | AC_VERB_GET_CONFIG_DEFAULT, | 349 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, |
390 | 0x00); | 350 | stream_tag, 0, format); |
391 | if (((pin_cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT) == AC_JACK_PORT_NONE) | 351 | } else { |
392 | continue; /* Move on */ | 352 | mout->dig_out_used = 0; |
393 | 353 | snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); | |
394 | stac92xx_config_pin(codec, spec->pin_nids[i], pin_cfg); | 354 | } |
395 | } | 355 | } |
396 | 356 | up(&codec->spdif_mutex); | |
397 | return 0; | 357 | |
398 | } | 358 | /* front */ |
399 | 359 | snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format); | |
400 | static int stac92xx_init(struct hda_codec *codec) | 360 | if (mout->hp_nid) |
401 | { | 361 | /* headphone out will just decode front left/right (stereo) */ |
402 | struct sigmatel_spec *spec = codec->spec; | 362 | snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, 0, format); |
403 | int i; | 363 | /* surrounds */ |
404 | 364 | if (mout->max_channels > 2) | |
405 | for (i=0; i < spec->num_pstates; i++) | 365 | for (i = 1; i < mout->num_dacs; i++) { |
406 | snd_hda_codec_write(codec, spec->pstate_nids[i], 0, | 366 | if ((mout->max_channels == 6) && (i == 3)) |
407 | AC_VERB_SET_POWER_STATE, 0x00); | 367 | break; |
408 | 368 | if (chs >= (i + 1) * 2) /* independent out */ | |
409 | mdelay(100); | 369 | snd_hda_codec_setup_stream(codec, nids[i], stream_tag, i * 2, |
410 | 370 | format); | |
411 | snd_hda_sequence_write(codec, spec->init); | 371 | else /* copy front */ |
412 | 372 | snd_hda_codec_setup_stream(codec, nids[i], stream_tag, 0, | |
413 | #ifdef STAC_TEST | 373 | format); |
414 | stac92xx_set_config_regs(codec); | 374 | } |
415 | #endif | ||
416 | |||
417 | stac92xx_config_pins(codec); | ||
418 | |||
419 | return 0; | 375 | return 0; |
420 | } | 376 | } |
421 | 377 | ||
422 | /* | ||
423 | * Analog playback callbacks | ||
424 | */ | ||
425 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
426 | struct hda_codec *codec, | ||
427 | snd_pcm_substream_t *substream) | ||
428 | { | ||
429 | struct sigmatel_spec *spec = codec->spec; | ||
430 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); | ||
431 | } | ||
432 | 378 | ||
433 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 379 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
434 | struct hda_codec *codec, | 380 | struct hda_codec *codec, |
@@ -437,7 +383,7 @@ static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
437 | snd_pcm_substream_t *substream) | 383 | snd_pcm_substream_t *substream) |
438 | { | 384 | { |
439 | struct sigmatel_spec *spec = codec->spec; | 385 | struct sigmatel_spec *spec = codec->spec; |
440 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, | 386 | return stac92xx_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, |
441 | format, substream); | 387 | format, substream); |
442 | } | 388 | } |
443 | 389 | ||
@@ -516,7 +462,7 @@ static struct hda_pcm_stream stac92xx_pcm_digital_capture = { | |||
516 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { | 462 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
517 | .substreams = 1, | 463 | .substreams = 1, |
518 | .channels_min = 2, | 464 | .channels_min = 2, |
519 | .channels_max = 2, | 465 | .channels_max = 8, |
520 | .nid = 0x02, /* NID to query formats and rates */ | 466 | .nid = 0x02, /* NID to query formats and rates */ |
521 | .ops = { | 467 | .ops = { |
522 | .open = stac92xx_playback_pcm_open, | 468 | .open = stac92xx_playback_pcm_open, |
@@ -544,11 +490,9 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
544 | codec->num_pcms = 1; | 490 | codec->num_pcms = 1; |
545 | codec->pcm_info = info; | 491 | codec->pcm_info = info; |
546 | 492 | ||
547 | info->name = "STAC92xx"; | 493 | info->name = "STAC92xx Analog"; |
548 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; | 494 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
549 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->playback_nid; | ||
550 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; | 495 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
551 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->capture_nid; | ||
552 | 496 | ||
553 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | 497 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
554 | codec->num_pcms++; | 498 | codec->num_pcms++; |
@@ -567,21 +511,413 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
567 | return 0; | 511 | return 0; |
568 | } | 512 | } |
569 | 513 | ||
514 | enum { | ||
515 | STAC_CTL_WIDGET_VOL, | ||
516 | STAC_CTL_WIDGET_MUTE, | ||
517 | }; | ||
518 | |||
519 | static snd_kcontrol_new_t stac92xx_control_templates[] = { | ||
520 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | ||
521 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | ||
522 | }; | ||
523 | |||
524 | /* add dynamic controls */ | ||
525 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) | ||
526 | { | ||
527 | snd_kcontrol_new_t *knew; | ||
528 | |||
529 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { | ||
530 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; | ||
531 | |||
532 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ | ||
533 | if (! knew) | ||
534 | return -ENOMEM; | ||
535 | if (spec->kctl_alloc) { | ||
536 | memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); | ||
537 | kfree(spec->kctl_alloc); | ||
538 | } | ||
539 | spec->kctl_alloc = knew; | ||
540 | spec->num_kctl_alloc = num; | ||
541 | } | ||
542 | |||
543 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | ||
544 | *knew = stac92xx_control_templates[type]; | ||
545 | knew->name = kstrdup(name, GFP_KERNEL); | ||
546 | if (! knew->name) | ||
547 | return -ENOMEM; | ||
548 | knew->private_value = val; | ||
549 | spec->num_kctl_used++; | ||
550 | return 0; | ||
551 | } | ||
552 | |||
553 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
554 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct auto_pin_cfg *cfg) | ||
555 | { | ||
556 | struct sigmatel_spec *spec = codec->spec; | ||
557 | hda_nid_t nid; | ||
558 | int i; | ||
559 | |||
560 | /* check the pins hardwired to audio widget */ | ||
561 | for (i = 0; i < cfg->line_outs; i++) { | ||
562 | nid = cfg->line_out_pins[i]; | ||
563 | spec->multiout.dac_nids[i] = snd_hda_codec_read(codec, nid, 0, | ||
564 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; | ||
565 | } | ||
566 | |||
567 | spec->multiout.num_dacs = cfg->line_outs; | ||
568 | |||
569 | return 0; | ||
570 | } | ||
571 | |||
572 | /* add playback controls from the parsed DAC table */ | ||
573 | static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, const struct auto_pin_cfg *cfg) | ||
574 | { | ||
575 | char name[32]; | ||
576 | static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; | ||
577 | hda_nid_t nid; | ||
578 | int i, err; | ||
579 | |||
580 | for (i = 0; i < cfg->line_outs; i++) { | ||
581 | if (! spec->multiout.dac_nids[i]) | ||
582 | continue; | ||
583 | |||
584 | nid = spec->multiout.dac_nids[i]; | ||
585 | |||
586 | if (i == 2) { | ||
587 | /* Center/LFE */ | ||
588 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Center Playback Volume", | ||
589 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) | ||
590 | return err; | ||
591 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "LFE Playback Volume", | ||
592 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) | ||
593 | return err; | ||
594 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Center Playback Switch", | ||
595 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) | ||
596 | return err; | ||
597 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "LFE Playback Switch", | ||
598 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) | ||
599 | return err; | ||
600 | } else { | ||
601 | sprintf(name, "%s Playback Volume", chname[i]); | ||
602 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, | ||
603 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | ||
604 | return err; | ||
605 | sprintf(name, "%s Playback Switch", chname[i]); | ||
606 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, | ||
607 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | ||
608 | return err; | ||
609 | } | ||
610 | } | ||
611 | |||
612 | return 0; | ||
613 | } | ||
614 | |||
615 | /* add playback controls for HP output */ | ||
616 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, struct auto_pin_cfg *cfg) | ||
617 | { | ||
618 | struct sigmatel_spec *spec = codec->spec; | ||
619 | hda_nid_t pin = cfg->hp_pin; | ||
620 | hda_nid_t nid; | ||
621 | int i, err; | ||
622 | unsigned int wid_caps; | ||
623 | |||
624 | if (! pin) | ||
625 | return 0; | ||
626 | |||
627 | wid_caps = snd_hda_param_read(codec, pin, AC_PAR_AUDIO_WIDGET_CAP); | ||
628 | if (wid_caps & AC_WCAP_UNSOL_CAP) | ||
629 | /* Enable unsolicited responses on the HP widget */ | ||
630 | snd_hda_codec_write(codec, pin, 0, | ||
631 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
632 | STAC_UNSOL_ENABLE); | ||
633 | |||
634 | nid = snd_hda_codec_read(codec, pin, 0, AC_VERB_GET_CONNECT_LIST, 0) & 0xff; | ||
635 | for (i = 0; i < cfg->line_outs; i++) { | ||
636 | if (! spec->multiout.dac_nids[i]) | ||
637 | continue; | ||
638 | if (spec->multiout.dac_nids[i] == nid) | ||
639 | return 0; | ||
640 | } | ||
641 | |||
642 | spec->multiout.hp_nid = nid; | ||
643 | |||
644 | /* control HP volume/switch on the output mixer amp */ | ||
645 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Headphone Playback Volume", | ||
646 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | ||
647 | return err; | ||
648 | if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Headphone Playback Switch", | ||
649 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | ||
650 | return err; | ||
651 | |||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | /* create playback/capture controls for input pins */ | ||
656 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) | ||
657 | { | ||
658 | struct sigmatel_spec *spec = codec->spec; | ||
659 | static char *labels[AUTO_PIN_LAST] = { | ||
660 | "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux" | ||
661 | }; | ||
662 | struct hda_input_mux *imux = &spec->private_imux; | ||
663 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; | ||
664 | int i, j, k; | ||
665 | |||
666 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
667 | int index = -1; | ||
668 | if (cfg->input_pins[i]) { | ||
669 | imux->items[imux->num_items].label = labels[i]; | ||
670 | |||
671 | for (j=0; j<spec->num_muxes; j++) { | ||
672 | int num_cons = snd_hda_get_connections(codec, spec->mux_nids[j], con_lst, HDA_MAX_NUM_INPUTS); | ||
673 | for (k=0; k<num_cons; k++) | ||
674 | if (con_lst[k] == cfg->input_pins[i]) { | ||
675 | index = k; | ||
676 | break; | ||
677 | } | ||
678 | if (index >= 0) | ||
679 | break; | ||
680 | } | ||
681 | imux->items[imux->num_items].index = index; | ||
682 | imux->num_items++; | ||
683 | } | ||
684 | } | ||
685 | |||
686 | return 0; | ||
687 | } | ||
688 | |||
689 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) | ||
690 | |||
691 | { | ||
692 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | ||
693 | } | ||
694 | |||
695 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) | ||
696 | { | ||
697 | struct sigmatel_spec *spec = codec->spec; | ||
698 | int i; | ||
699 | |||
700 | for (i = 0; i < spec->autocfg.line_outs; i++) { | ||
701 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
702 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | ||
703 | } | ||
704 | } | ||
705 | |||
706 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) | ||
707 | { | ||
708 | struct sigmatel_spec *spec = codec->spec; | ||
709 | hda_nid_t pin; | ||
710 | |||
711 | pin = spec->autocfg.hp_pin; | ||
712 | if (pin) /* connect to front */ | ||
713 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); | ||
714 | } | ||
715 | |||
716 | static int stac922x_parse_auto_config(struct hda_codec *codec) | ||
717 | { | ||
718 | struct sigmatel_spec *spec = codec->spec; | ||
719 | int err; | ||
720 | |||
721 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg)) < 0) | ||
722 | return err; | ||
723 | if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) | ||
724 | return err; | ||
725 | if (! spec->autocfg.line_outs && ! spec->autocfg.hp_pin) | ||
726 | return 0; /* can't find valid pin config */ | ||
727 | |||
728 | if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || | ||
729 | (err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg)) < 0 || | ||
730 | (err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) | ||
731 | return err; | ||
732 | |||
733 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
734 | if (spec->multiout.max_channels > 2) { | ||
735 | spec->surr_switch = 1; | ||
736 | spec->cur_ch_mode = 1; | ||
737 | spec->num_ch_modes = 2; | ||
738 | if (spec->multiout.max_channels == 8) { | ||
739 | spec->cur_ch_mode++; | ||
740 | spec->num_ch_modes++; | ||
741 | } | ||
742 | } | ||
743 | |||
744 | if (spec->autocfg.dig_out_pin) { | ||
745 | spec->multiout.dig_out_nid = 0x08; | ||
746 | stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_out_pin, AC_PINCTL_OUT_EN); | ||
747 | } | ||
748 | if (spec->autocfg.dig_in_pin) { | ||
749 | spec->dig_in_nid = 0x09; | ||
750 | stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_in_pin, AC_PINCTL_IN_EN); | ||
751 | } | ||
752 | |||
753 | if (spec->kctl_alloc) | ||
754 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | ||
755 | |||
756 | spec->input_mux = &spec->private_imux; | ||
757 | |||
758 | return 1; | ||
759 | } | ||
760 | |||
761 | static int stac9200_parse_auto_config(struct hda_codec *codec) | ||
762 | { | ||
763 | struct sigmatel_spec *spec = codec->spec; | ||
764 | int err; | ||
765 | |||
766 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg)) < 0) | ||
767 | return err; | ||
768 | |||
769 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) | ||
770 | return err; | ||
771 | |||
772 | if (spec->autocfg.dig_out_pin) { | ||
773 | spec->multiout.dig_out_nid = 0x05; | ||
774 | stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_out_pin, AC_PINCTL_OUT_EN); | ||
775 | } | ||
776 | if (spec->autocfg.dig_in_pin) { | ||
777 | spec->dig_in_nid = 0x04; | ||
778 | stac92xx_auto_set_pinctl(codec, spec->autocfg.dig_in_pin, AC_PINCTL_IN_EN); | ||
779 | } | ||
780 | |||
781 | if (spec->kctl_alloc) | ||
782 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | ||
783 | |||
784 | spec->input_mux = &spec->private_imux; | ||
785 | |||
786 | return 1; | ||
787 | } | ||
788 | |||
789 | static int stac92xx_init_pstate(struct hda_codec *codec) | ||
790 | { | ||
791 | hda_nid_t nid, nid_start; | ||
792 | int nodes; | ||
793 | |||
794 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_POWER_STATE, 0x00); | ||
795 | |||
796 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid_start); | ||
797 | for (nid = nid_start; nid < nodes + nid_start; nid++) { | ||
798 | unsigned int wid_caps = snd_hda_param_read(codec, nid, | ||
799 | AC_PAR_AUDIO_WIDGET_CAP); | ||
800 | if (wid_caps & AC_WCAP_POWER) | ||
801 | snd_hda_codec_write(codec, nid, 0, | ||
802 | AC_VERB_SET_POWER_STATE, 0x00); | ||
803 | } | ||
804 | |||
805 | mdelay(100); | ||
806 | |||
807 | return 0; | ||
808 | } | ||
809 | |||
810 | static int stac92xx_init(struct hda_codec *codec) | ||
811 | { | ||
812 | struct sigmatel_spec *spec = codec->spec; | ||
813 | |||
814 | stac92xx_init_pstate(codec); | ||
815 | |||
816 | snd_hda_sequence_write(codec, spec->init); | ||
817 | |||
818 | stac92xx_auto_init_multi_out(codec); | ||
819 | stac92xx_auto_init_hp_out(codec); | ||
820 | |||
821 | return 0; | ||
822 | } | ||
823 | |||
570 | static void stac92xx_free(struct hda_codec *codec) | 824 | static void stac92xx_free(struct hda_codec *codec) |
571 | { | 825 | { |
572 | kfree(codec->spec); | 826 | struct sigmatel_spec *spec = codec->spec; |
827 | int i; | ||
828 | |||
829 | if (! spec) | ||
830 | return; | ||
831 | |||
832 | if (spec->kctl_alloc) { | ||
833 | for (i = 0; i < spec->num_kctl_used; i++) | ||
834 | kfree(spec->kctl_alloc[i].name); | ||
835 | kfree(spec->kctl_alloc); | ||
836 | } | ||
837 | |||
838 | kfree(spec); | ||
839 | } | ||
840 | |||
841 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | ||
842 | unsigned int flag) | ||
843 | { | ||
844 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | ||
845 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | ||
846 | snd_hda_codec_write(codec, nid, 0, | ||
847 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
848 | pin_ctl | flag); | ||
849 | } | ||
850 | |||
851 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | ||
852 | unsigned int flag) | ||
853 | { | ||
854 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | ||
855 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | ||
856 | snd_hda_codec_write(codec, nid, 0, | ||
857 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
858 | pin_ctl & ~flag); | ||
859 | } | ||
860 | |||
861 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | ||
862 | { | ||
863 | struct sigmatel_spec *spec = codec->spec; | ||
864 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
865 | int i, presence; | ||
866 | |||
867 | if ((res >> 26) != STAC_HP_EVENT) | ||
868 | return; | ||
869 | |||
870 | presence = snd_hda_codec_read(codec, cfg->hp_pin, 0, | ||
871 | AC_VERB_GET_PIN_SENSE, 0x00) >> 31; | ||
872 | |||
873 | if (presence) { | ||
874 | /* disable lineouts, enable hp */ | ||
875 | for (i = 0; i < cfg->line_outs; i++) | ||
876 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | ||
877 | AC_PINCTL_OUT_EN); | ||
878 | stac92xx_set_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN); | ||
879 | } else { | ||
880 | /* enable lineouts, disable hp */ | ||
881 | for (i = 0; i < cfg->line_outs; i++) | ||
882 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | ||
883 | AC_PINCTL_OUT_EN); | ||
884 | stac92xx_reset_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN); | ||
885 | } | ||
886 | } | ||
887 | |||
888 | #ifdef CONFIG_PM | ||
889 | static int stac92xx_resume(struct hda_codec *codec) | ||
890 | { | ||
891 | struct sigmatel_spec *spec = codec->spec; | ||
892 | int i; | ||
893 | |||
894 | stac92xx_init(codec); | ||
895 | for (i = 0; i < spec->num_mixers; i++) | ||
896 | snd_hda_resume_ctls(codec, spec->mixers[i]); | ||
897 | if (spec->multiout.dig_out_nid) | ||
898 | snd_hda_resume_spdif_out(codec); | ||
899 | if (spec->dig_in_nid) | ||
900 | snd_hda_resume_spdif_in(codec); | ||
901 | |||
902 | return 0; | ||
573 | } | 903 | } |
904 | #endif | ||
574 | 905 | ||
575 | static struct hda_codec_ops stac92xx_patch_ops = { | 906 | static struct hda_codec_ops stac92xx_patch_ops = { |
576 | .build_controls = stac92xx_build_controls, | 907 | .build_controls = stac92xx_build_controls, |
577 | .build_pcms = stac92xx_build_pcms, | 908 | .build_pcms = stac92xx_build_pcms, |
578 | .init = stac92xx_init, | 909 | .init = stac92xx_init, |
579 | .free = stac92xx_free, | 910 | .free = stac92xx_free, |
911 | .unsol_event = stac92xx_unsol_event, | ||
912 | #ifdef CONFIG_PM | ||
913 | .resume = stac92xx_resume, | ||
914 | #endif | ||
580 | }; | 915 | }; |
581 | 916 | ||
582 | static int patch_stac9200(struct hda_codec *codec) | 917 | static int patch_stac9200(struct hda_codec *codec) |
583 | { | 918 | { |
584 | struct sigmatel_spec *spec; | 919 | struct sigmatel_spec *spec; |
920 | int err; | ||
585 | 921 | ||
586 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 922 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
587 | if (spec == NULL) | 923 | if (spec == NULL) |
@@ -589,26 +925,27 @@ static int patch_stac9200(struct hda_codec *codec) | |||
589 | 925 | ||
590 | codec->spec = spec; | 926 | codec->spec = spec; |
591 | 927 | ||
928 | #ifdef STAC_TEST | ||
929 | spec->pin_nids = stac9200_pin_nids; | ||
930 | spec->num_pins = 8; | ||
931 | spec->pin_configs = stac9200_pin_configs; | ||
932 | stac92xx_set_config_regs(codec); | ||
933 | #endif | ||
592 | spec->multiout.max_channels = 2; | 934 | spec->multiout.max_channels = 2; |
593 | spec->multiout.num_dacs = 1; | 935 | spec->multiout.num_dacs = 1; |
594 | spec->multiout.dac_nids = stac9200_dac_nids; | 936 | spec->multiout.dac_nids = stac9200_dac_nids; |
595 | spec->multiout.dig_out_nid = 0x05; | ||
596 | spec->dig_in_nid = 0x04; | ||
597 | spec->adc_nids = stac9200_adc_nids; | 937 | spec->adc_nids = stac9200_adc_nids; |
598 | spec->mux_nids = stac9200_mux_nids; | 938 | spec->mux_nids = stac9200_mux_nids; |
599 | spec->num_muxes = 1; | 939 | spec->num_muxes = 1; |
600 | spec->input_mux.num_items = 0; | 940 | |
601 | spec->pstate_nids = stac9200_pstate_nids; | 941 | spec->init = stac9200_core_init; |
602 | spec->num_pstates = 3; | ||
603 | spec->pin_nids = stac9200_pin_nids; | ||
604 | #ifdef STAC_TEST | ||
605 | spec->pin_configs = stac9200_pin_configs; | ||
606 | #endif | ||
607 | spec->num_pins = 8; | ||
608 | spec->init = stac9200_ch2_init; | ||
609 | spec->mixer = stac9200_mixer; | 942 | spec->mixer = stac9200_mixer; |
610 | spec->playback_nid = 0x02; | 943 | |
611 | spec->capture_nid = 0x03; | 944 | err = stac9200_parse_auto_config(codec); |
945 | if (err < 0) { | ||
946 | stac92xx_free(codec); | ||
947 | return err; | ||
948 | } | ||
612 | 949 | ||
613 | codec->patch_ops = stac92xx_patch_ops; | 950 | codec->patch_ops = stac92xx_patch_ops; |
614 | 951 | ||
@@ -618,6 +955,7 @@ static int patch_stac9200(struct hda_codec *codec) | |||
618 | static int patch_stac922x(struct hda_codec *codec) | 955 | static int patch_stac922x(struct hda_codec *codec) |
619 | { | 956 | { |
620 | struct sigmatel_spec *spec; | 957 | struct sigmatel_spec *spec; |
958 | int err; | ||
621 | 959 | ||
622 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 960 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
623 | if (spec == NULL) | 961 | if (spec == NULL) |
@@ -625,26 +963,26 @@ static int patch_stac922x(struct hda_codec *codec) | |||
625 | 963 | ||
626 | codec->spec = spec; | 964 | codec->spec = spec; |
627 | 965 | ||
628 | spec->multiout.max_channels = 2; | ||
629 | spec->multiout.num_dacs = 4; | ||
630 | spec->multiout.dac_nids = stac922x_dac_nids; | ||
631 | spec->multiout.dig_out_nid = 0x08; | ||
632 | spec->dig_in_nid = 0x09; | ||
633 | spec->adc_nids = stac922x_adc_nids; | ||
634 | spec->mux_nids = stac922x_mux_nids; | ||
635 | spec->num_muxes = 2; | ||
636 | spec->input_mux.num_items = 0; | ||
637 | spec->pstate_nids = stac922x_pstate_nids; | ||
638 | spec->num_pstates = 8; | ||
639 | spec->pin_nids = stac922x_pin_nids; | ||
640 | #ifdef STAC_TEST | 966 | #ifdef STAC_TEST |
967 | spec->num_pins = 10; | ||
968 | spec->pin_nids = stac922x_pin_nids; | ||
641 | spec->pin_configs = stac922x_pin_configs; | 969 | spec->pin_configs = stac922x_pin_configs; |
970 | stac92xx_set_config_regs(codec); | ||
642 | #endif | 971 | #endif |
643 | spec->num_pins = 10; | 972 | spec->adc_nids = stac922x_adc_nids; |
644 | spec->init = stac922x_ch2_init; | 973 | spec->mux_nids = stac922x_mux_nids; |
974 | spec->num_muxes = 2; | ||
975 | |||
976 | spec->init = stac922x_core_init; | ||
645 | spec->mixer = stac922x_mixer; | 977 | spec->mixer = stac922x_mixer; |
646 | spec->playback_nid = 0x02; | 978 | |
647 | spec->capture_nid = 0x06; | 979 | spec->multiout.dac_nids = spec->dac_nids; |
980 | |||
981 | err = stac922x_parse_auto_config(codec); | ||
982 | if (err < 0) { | ||
983 | stac92xx_free(codec); | ||
984 | return err; | ||
985 | } | ||
648 | 986 | ||
649 | codec->patch_ops = stac92xx_patch_ops; | 987 | codec->patch_ops = stac92xx_patch_ops; |
650 | 988 | ||
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index cc16f95f9cef..7c806bd9cc90 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -424,6 +424,7 @@ struct _snd_intel8x0 { | |||
424 | unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ | 424 | unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ |
425 | 425 | ||
426 | int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ | 426 | int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ |
427 | unsigned int sdm_saved; /* SDM reg value */ | ||
427 | 428 | ||
428 | ac97_bus_t *ac97_bus; | 429 | ac97_bus_t *ac97_bus; |
429 | ac97_t *ac97[3]; | 430 | ac97_t *ac97[3]; |
@@ -2373,6 +2374,8 @@ static int intel8x0_suspend(snd_card_t *card, pm_message_t state) | |||
2373 | for (i = 0; i < 3; i++) | 2374 | for (i = 0; i < 3; i++) |
2374 | if (chip->ac97[i]) | 2375 | if (chip->ac97[i]) |
2375 | snd_ac97_suspend(chip->ac97[i]); | 2376 | snd_ac97_suspend(chip->ac97[i]); |
2377 | if (chip->device_type == DEVICE_INTEL_ICH4) | ||
2378 | chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); | ||
2376 | pci_disable_device(chip->pci); | 2379 | pci_disable_device(chip->pci); |
2377 | return 0; | 2380 | return 0; |
2378 | } | 2381 | } |
@@ -2386,6 +2389,16 @@ static int intel8x0_resume(snd_card_t *card) | |||
2386 | pci_set_master(chip->pci); | 2389 | pci_set_master(chip->pci); |
2387 | snd_intel8x0_chip_init(chip, 0); | 2390 | snd_intel8x0_chip_init(chip, 0); |
2388 | 2391 | ||
2392 | /* re-initialize mixer stuff */ | ||
2393 | if (chip->device_type == DEVICE_INTEL_ICH4) { | ||
2394 | /* enable separate SDINs for ICH4 */ | ||
2395 | iputbyte(chip, ICHREG(SDM), chip->sdm_saved); | ||
2396 | /* use slot 10/11 for SPDIF */ | ||
2397 | iputdword(chip, ICHREG(GLOB_CNT), | ||
2398 | (igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_PCM_SPDIF_MASK) | | ||
2399 | ICH_PCM_SPDIF_1011); | ||
2400 | } | ||
2401 | |||
2389 | /* refill nocache */ | 2402 | /* refill nocache */ |
2390 | if (chip->fix_nocache) | 2403 | if (chip->fix_nocache) |
2391 | fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1); | 2404 | fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1); |
@@ -2451,8 +2464,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip) | |||
2451 | } | 2464 | } |
2452 | do_gettimeofday(&start_time); | 2465 | do_gettimeofday(&start_time); |
2453 | spin_unlock_irq(&chip->reg_lock); | 2466 | spin_unlock_irq(&chip->reg_lock); |
2454 | set_current_state(TASK_UNINTERRUPTIBLE); | 2467 | msleep(50); |
2455 | schedule_timeout(HZ / 20); | ||
2456 | spin_lock_irq(&chip->reg_lock); | 2468 | spin_lock_irq(&chip->reg_lock); |
2457 | /* check the position */ | 2469 | /* check the position */ |
2458 | pos = ichdev->fragsize1; | 2470 | pos = ichdev->fragsize1; |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 52c585901c54..39b5e7db1543 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -1050,11 +1050,6 @@ static struct m3_hv_quirk m3_hv_quirk_list[] = { | |||
1050 | * lowlevel functions | 1050 | * lowlevel functions |
1051 | */ | 1051 | */ |
1052 | 1052 | ||
1053 | #define big_mdelay(msec) do {\ | ||
1054 | set_current_state(TASK_UNINTERRUPTIBLE);\ | ||
1055 | schedule_timeout(((msec) * HZ) / 1000);\ | ||
1056 | } while (0) | ||
1057 | |||
1058 | static inline void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg) | 1053 | static inline void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg) |
1059 | { | 1054 | { |
1060 | outw(value, chip->iobase + reg); | 1055 | outw(value, chip->iobase + reg); |
@@ -1096,7 +1091,7 @@ static void snd_m3_assp_write(m3_t *chip, u16 region, u16 index, u16 data) | |||
1096 | static void snd_m3_assp_halt(m3_t *chip) | 1091 | static void snd_m3_assp_halt(m3_t *chip) |
1097 | { | 1092 | { |
1098 | chip->reset_state = snd_m3_inb(chip, DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK; | 1093 | chip->reset_state = snd_m3_inb(chip, DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK; |
1099 | big_mdelay(10); | 1094 | msleep(10); |
1100 | snd_m3_outb(chip, chip->reset_state & ~REGB_ENABLE_RESET, DSP_PORT_CONTROL_REG_B); | 1095 | snd_m3_outb(chip, chip->reset_state & ~REGB_ENABLE_RESET, DSP_PORT_CONTROL_REG_B); |
1101 | } | 1096 | } |
1102 | 1097 | ||
@@ -2108,9 +2103,9 @@ static void snd_m3_ac97_reset(m3_t *chip) | |||
2108 | */ | 2103 | */ |
2109 | tmp = inw(io + RING_BUS_CTRL_A); | 2104 | tmp = inw(io + RING_BUS_CTRL_A); |
2110 | outw(RAC_SDFS_ENABLE|LAC_SDFS_ENABLE, io + RING_BUS_CTRL_A); | 2105 | outw(RAC_SDFS_ENABLE|LAC_SDFS_ENABLE, io + RING_BUS_CTRL_A); |
2111 | big_mdelay(20); | 2106 | msleep(20); |
2112 | outw(tmp, io + RING_BUS_CTRL_A); | 2107 | outw(tmp, io + RING_BUS_CTRL_A); |
2113 | big_mdelay(50); | 2108 | msleep(50); |
2114 | #endif | 2109 | #endif |
2115 | } | 2110 | } |
2116 | 2111 | ||
@@ -2525,9 +2520,13 @@ static void | |||
2525 | snd_m3_enable_ints(m3_t *chip) | 2520 | snd_m3_enable_ints(m3_t *chip) |
2526 | { | 2521 | { |
2527 | unsigned long io = chip->iobase; | 2522 | unsigned long io = chip->iobase; |
2523 | unsigned short val; | ||
2528 | 2524 | ||
2529 | /* TODO: MPU401 not supported yet */ | 2525 | /* TODO: MPU401 not supported yet */ |
2530 | outw(ASSP_INT_ENABLE | HV_INT_ENABLE /*| MPU401_INT_ENABLE*/, io + HOST_INT_CTRL); | 2526 | val = ASSP_INT_ENABLE /*| MPU401_INT_ENABLE*/; |
2527 | if (chip->hv_quirk && (chip->hv_quirk->config & HV_CTRL_ENABLE)) | ||
2528 | val |= HV_INT_ENABLE; | ||
2529 | outw(val, io + HOST_INT_CTRL); | ||
2531 | outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE, | 2530 | outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE, |
2532 | io + ASSP_CONTROL_C); | 2531 | io + ASSP_CONTROL_C); |
2533 | } | 2532 | } |
@@ -2589,7 +2588,7 @@ static int m3_suspend(snd_card_t *card, pm_message_t state) | |||
2589 | snd_pcm_suspend_all(chip->pcm); | 2588 | snd_pcm_suspend_all(chip->pcm); |
2590 | snd_ac97_suspend(chip->ac97); | 2589 | snd_ac97_suspend(chip->ac97); |
2591 | 2590 | ||
2592 | big_mdelay(10); /* give the assp a chance to idle.. */ | 2591 | msleep(10); /* give the assp a chance to idle.. */ |
2593 | 2592 | ||
2594 | snd_m3_assp_halt(chip); | 2593 | snd_m3_assp_halt(chip); |
2595 | 2594 | ||
@@ -2697,6 +2696,8 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, | |||
2697 | } | 2696 | } |
2698 | 2697 | ||
2699 | spin_lock_init(&chip->reg_lock); | 2698 | spin_lock_init(&chip->reg_lock); |
2699 | spin_lock_init(&chip->ac97_lock); | ||
2700 | |||
2700 | switch (pci->device) { | 2701 | switch (pci->device) { |
2701 | case PCI_DEVICE_ID_ESS_ALLEGRO: | 2702 | case PCI_DEVICE_ID_ESS_ALLEGRO: |
2702 | case PCI_DEVICE_ID_ESS_ALLEGRO_1: | 2703 | case PCI_DEVICE_ID_ESS_ALLEGRO_1: |
@@ -2765,6 +2766,8 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, | |||
2765 | snd_m3_assp_init(chip); | 2766 | snd_m3_assp_init(chip); |
2766 | snd_m3_amp_enable(chip, 1); | 2767 | snd_m3_amp_enable(chip, 1); |
2767 | 2768 | ||
2769 | tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); | ||
2770 | |||
2768 | if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, | 2771 | if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, |
2769 | card->driver, (void *)chip)) { | 2772 | card->driver, (void *)chip)) { |
2770 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2773 | snd_printk("unable to grab IRQ %d\n", pci->irq); |
@@ -2786,9 +2789,6 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, | |||
2786 | return err; | 2789 | return err; |
2787 | } | 2790 | } |
2788 | 2791 | ||
2789 | spin_lock_init(&chip->ac97_lock); | ||
2790 | tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); | ||
2791 | |||
2792 | if ((err = snd_m3_mixer(chip)) < 0) | 2792 | if ((err = snd_m3_mixer(chip)) < 0) |
2793 | return err; | 2793 | return err; |
2794 | 2794 | ||
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 082c0d0f73d2..6c868d913634 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -445,9 +445,9 @@ static int snd_mixart_trigger(snd_pcm_substream_t *subs, int cmd) | |||
445 | 445 | ||
446 | static int mixart_sync_nonblock_events(mixart_mgr_t *mgr) | 446 | static int mixart_sync_nonblock_events(mixart_mgr_t *mgr) |
447 | { | 447 | { |
448 | int timeout = HZ; | 448 | unsigned long timeout = jiffies + HZ; |
449 | while (atomic_read(&mgr->msg_processed) > 0) { | 449 | while (atomic_read(&mgr->msg_processed) > 0) { |
450 | if (! timeout--) { | 450 | if (time_after(jiffies, timeout)) { |
451 | snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); | 451 | snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); |
452 | return -EBUSY; | 452 | return -EBUSY; |
453 | } | 453 | } |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index a673cc438b91..796621de5009 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -445,6 +445,7 @@ struct _hdsp { | |||
445 | u32 control2_register; /* cached value */ | 445 | u32 control2_register; /* cached value */ |
446 | u32 creg_spdif; | 446 | u32 creg_spdif; |
447 | u32 creg_spdif_stream; | 447 | u32 creg_spdif_stream; |
448 | int clock_source_locked; | ||
448 | char *card_name; /* digiface/multiface */ | 449 | char *card_name; /* digiface/multiface */ |
449 | HDSP_IO_Type io_type; /* ditto, but for code use */ | 450 | HDSP_IO_Type io_type; /* ditto, but for code use */ |
450 | unsigned short firmware_rev; | 451 | unsigned short firmware_rev; |
@@ -678,8 +679,7 @@ static int snd_hdsp_load_firmware_from_cache(hdsp_t *hdsp) { | |||
678 | } | 679 | } |
679 | 680 | ||
680 | if ((1000 / HZ) < 3000) { | 681 | if ((1000 / HZ) < 3000) { |
681 | set_current_state(TASK_UNINTERRUPTIBLE); | 682 | ssleep(3); |
682 | schedule_timeout((3000 * HZ + 999) / 1000); | ||
683 | } else { | 683 | } else { |
684 | mdelay(3000); | 684 | mdelay(3000); |
685 | } | 685 | } |
@@ -2095,6 +2095,34 @@ static int snd_hdsp_put_clock_source(snd_kcontrol_t * kcontrol, snd_ctl_elem_val | |||
2095 | return change; | 2095 | return change; |
2096 | } | 2096 | } |
2097 | 2097 | ||
2098 | static int snd_hdsp_info_clock_source_lock(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | ||
2099 | { | ||
2100 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
2101 | uinfo->count = 1; | ||
2102 | uinfo->value.integer.min = 0; | ||
2103 | uinfo->value.integer.max = 1; | ||
2104 | return 0; | ||
2105 | } | ||
2106 | |||
2107 | static int snd_hdsp_get_clock_source_lock(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | ||
2108 | { | ||
2109 | hdsp_t *hdsp = snd_kcontrol_chip(kcontrol); | ||
2110 | |||
2111 | ucontrol->value.integer.value[0] = hdsp->clock_source_locked; | ||
2112 | return 0; | ||
2113 | } | ||
2114 | |||
2115 | static int snd_hdsp_put_clock_source_lock(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | ||
2116 | { | ||
2117 | hdsp_t *hdsp = snd_kcontrol_chip(kcontrol); | ||
2118 | int change; | ||
2119 | |||
2120 | change = (int)ucontrol->value.integer.value[0] != hdsp->clock_source_locked; | ||
2121 | if (change) | ||
2122 | hdsp->clock_source_locked = ucontrol->value.integer.value[0]; | ||
2123 | return change; | ||
2124 | } | ||
2125 | |||
2098 | #define HDSP_DA_GAIN(xname, xindex) \ | 2126 | #define HDSP_DA_GAIN(xname, xindex) \ |
2099 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 2127 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ |
2100 | .name = xname, \ | 2128 | .name = xname, \ |
@@ -3117,6 +3145,15 @@ HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0), | |||
3117 | HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), | 3145 | HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), |
3118 | /* 'Sample Clock Source' complies with the alsa control naming scheme */ | 3146 | /* 'Sample Clock Source' complies with the alsa control naming scheme */ |
3119 | HDSP_CLOCK_SOURCE("Sample Clock Source", 0), | 3147 | HDSP_CLOCK_SOURCE("Sample Clock Source", 0), |
3148 | { | ||
3149 | /* FIXME: should be PCM or MIXER? */ | ||
3150 | /* .iface = SNDRV_CTL_ELEM_IFACE_PCM, */ | ||
3151 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3152 | .name = "Sample Clock Source Locking", | ||
3153 | .info = snd_hdsp_info_clock_source_lock, | ||
3154 | .get = snd_hdsp_get_clock_source_lock, | ||
3155 | .put = snd_hdsp_put_clock_source_lock, | ||
3156 | }, | ||
3120 | HDSP_SYSTEM_CLOCK_MODE("System Clock Mode", 0), | 3157 | HDSP_SYSTEM_CLOCK_MODE("System Clock Mode", 0), |
3121 | HDSP_PREF_SYNC_REF("Preferred Sync Reference", 0), | 3158 | HDSP_PREF_SYNC_REF("Preferred Sync Reference", 0), |
3122 | HDSP_AUTOSYNC_REF("AutoSync Reference", 0), | 3159 | HDSP_AUTOSYNC_REF("AutoSync Reference", 0), |
@@ -3349,6 +3386,7 @@ snd_hdsp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
3349 | snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); | 3386 | snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); |
3350 | 3387 | ||
3351 | snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); | 3388 | snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); |
3389 | snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No"); | ||
3352 | 3390 | ||
3353 | snd_iprintf(buffer, "\n"); | 3391 | snd_iprintf(buffer, "\n"); |
3354 | 3392 | ||
@@ -3853,13 +3891,14 @@ static int snd_hdsp_hw_params(snd_pcm_substream_t *substream, | |||
3853 | */ | 3891 | */ |
3854 | 3892 | ||
3855 | spin_lock_irq(&hdsp->lock); | 3893 | spin_lock_irq(&hdsp->lock); |
3856 | if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) { | 3894 | if (! hdsp->clock_source_locked) { |
3857 | spin_unlock_irq(&hdsp->lock); | 3895 | if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) { |
3858 | _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE); | 3896 | spin_unlock_irq(&hdsp->lock); |
3859 | return err; | 3897 | _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE); |
3860 | } else { | 3898 | return err; |
3861 | spin_unlock_irq(&hdsp->lock); | 3899 | } |
3862 | } | 3900 | } |
3901 | spin_unlock_irq(&hdsp->lock); | ||
3863 | 3902 | ||
3864 | if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) { | 3903 | if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) { |
3865 | _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); | 3904 | _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); |
@@ -4284,13 +4323,17 @@ static int snd_hdsp_playback_open(snd_pcm_substream_t *substream) | |||
4284 | 4323 | ||
4285 | snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); | 4324 | snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); |
4286 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hdsp_hw_constraints_period_sizes); | 4325 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hdsp_hw_constraints_period_sizes); |
4287 | if (hdsp->io_type == H9632) { | 4326 | if (hdsp->clock_source_locked) { |
4288 | runtime->hw.channels_min = hdsp->qs_out_channels; | 4327 | runtime->hw.rate_min = runtime->hw.rate_max = hdsp->system_sample_rate; |
4289 | runtime->hw.channels_max = hdsp->ss_out_channels; | 4328 | } else if (hdsp->io_type == H9632) { |
4290 | runtime->hw.rate_max = 192000; | 4329 | runtime->hw.rate_max = 192000; |
4291 | runtime->hw.rates = SNDRV_PCM_RATE_KNOT; | 4330 | runtime->hw.rates = SNDRV_PCM_RATE_KNOT; |
4292 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hdsp_hw_constraints_9632_sample_rates); | 4331 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hdsp_hw_constraints_9632_sample_rates); |
4293 | } | 4332 | } |
4333 | if (hdsp->io_type == H9632) { | ||
4334 | runtime->hw.channels_min = hdsp->qs_out_channels; | ||
4335 | runtime->hw.channels_max = hdsp->ss_out_channels; | ||
4336 | } | ||
4294 | 4337 | ||
4295 | snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | 4338 | snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, |
4296 | snd_hdsp_hw_rule_out_channels, hdsp, | 4339 | snd_hdsp_hw_rule_out_channels, hdsp, |
@@ -5036,8 +5079,7 @@ static int __devinit snd_hdsp_create(snd_card_t *card, | |||
5036 | if (!is_9652 && !is_9632) { | 5079 | if (!is_9652 && !is_9632) { |
5037 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ | 5080 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ |
5038 | if ((1000 / HZ) < 2000) { | 5081 | if ((1000 / HZ) < 2000) { |
5039 | set_current_state(TASK_UNINTERRUPTIBLE); | 5082 | ssleep(2); |
5040 | schedule_timeout((2000 * HZ + 999) / 1000); | ||
5041 | } else { | 5083 | } else { |
5042 | mdelay(2000); | 5084 | mdelay(2000); |
5043 | } | 5085 | } |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index a09b0fb49e81..29d89bfba0a4 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -472,6 +472,7 @@ void snd_trident_write_voice_regs(trident_t * trident, | |||
472 | break; | 472 | break; |
473 | default: | 473 | default: |
474 | snd_BUG(); | 474 | snd_BUG(); |
475 | return; | ||
475 | } | 476 | } |
476 | 477 | ||
477 | outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); | 478 | outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); |
@@ -3152,8 +3153,7 @@ static int snd_trident_gameport_open(struct gameport *gameport, int mode) | |||
3152 | switch (mode) { | 3153 | switch (mode) { |
3153 | case GAMEPORT_MODE_COOKED: | 3154 | case GAMEPORT_MODE_COOKED: |
3154 | outb(GAMEPORT_MODE_ADC, TRID_REG(chip, GAMEPORT_GCR)); | 3155 | outb(GAMEPORT_MODE_ADC, TRID_REG(chip, GAMEPORT_GCR)); |
3155 | set_current_state(TASK_UNINTERRUPTIBLE); | 3156 | msleep(20); |
3156 | schedule_timeout(1 + 20 * HZ / 1000); /* 20msec */ | ||
3157 | return 0; | 3157 | return 0; |
3158 | case GAMEPORT_MODE_RAW: | 3158 | case GAMEPORT_MODE_RAW: |
3159 | outb(0, TRID_REG(chip, GAMEPORT_GCR)); | 3159 | outb(0, TRID_REG(chip, GAMEPORT_GCR)); |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 42c48f0ce8e8..4889600387c8 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -547,8 +547,7 @@ static void snd_via82xx_codec_wait(ac97_t *ac97) | |||
547 | int err; | 547 | int err; |
548 | err = snd_via82xx_codec_ready(chip, ac97->num); | 548 | err = snd_via82xx_codec_ready(chip, ac97->num); |
549 | /* here we need to wait fairly for long time.. */ | 549 | /* here we need to wait fairly for long time.. */ |
550 | set_current_state(TASK_UNINTERRUPTIBLE); | 550 | msleep(500); |
551 | schedule_timeout(HZ/2); | ||
552 | } | 551 | } |
553 | 552 | ||
554 | static void snd_via82xx_codec_write(ac97_t *ac97, | 553 | static void snd_via82xx_codec_write(ac97_t *ac97, |
@@ -1847,7 +1846,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip) | |||
1847 | static int snd_via82xx_chip_init(via82xx_t *chip) | 1846 | static int snd_via82xx_chip_init(via82xx_t *chip) |
1848 | { | 1847 | { |
1849 | unsigned int val; | 1848 | unsigned int val; |
1850 | int max_count; | 1849 | unsigned long end_time; |
1851 | unsigned char pval; | 1850 | unsigned char pval; |
1852 | 1851 | ||
1853 | #if 0 /* broken on K7M? */ | 1852 | #if 0 /* broken on K7M? */ |
@@ -1889,14 +1888,14 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1889 | } | 1888 | } |
1890 | 1889 | ||
1891 | /* wait until codec ready */ | 1890 | /* wait until codec ready */ |
1892 | max_count = ((3 * HZ) / 4) + 1; | 1891 | end_time = jiffies + msecs_to_jiffies(750); |
1893 | do { | 1892 | do { |
1894 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); | 1893 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); |
1895 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ | 1894 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ |
1896 | break; | 1895 | break; |
1897 | set_current_state(TASK_UNINTERRUPTIBLE); | 1896 | set_current_state(TASK_UNINTERRUPTIBLE); |
1898 | schedule_timeout(1); | 1897 | schedule_timeout(1); |
1899 | } while (--max_count > 0); | 1898 | } while (time_before(jiffies, end_time)); |
1900 | 1899 | ||
1901 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) | 1900 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) |
1902 | snd_printk("AC'97 codec is not ready [0x%x]\n", val); | 1901 | snd_printk("AC'97 codec is not ready [0x%x]\n", val); |
@@ -1905,7 +1904,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1905 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | | 1904 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | |
1906 | VIA_REG_AC97_SECONDARY_VALID | | 1905 | VIA_REG_AC97_SECONDARY_VALID | |
1907 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); | 1906 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); |
1908 | max_count = ((3 * HZ) / 4) + 1; | 1907 | end_time = jiffies + msecs_to_jiffies(750); |
1909 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | | 1908 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | |
1910 | VIA_REG_AC97_SECONDARY_VALID | | 1909 | VIA_REG_AC97_SECONDARY_VALID | |
1911 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); | 1910 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); |
@@ -1916,7 +1915,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1916 | } | 1915 | } |
1917 | set_current_state(TASK_INTERRUPTIBLE); | 1916 | set_current_state(TASK_INTERRUPTIBLE); |
1918 | schedule_timeout(1); | 1917 | schedule_timeout(1); |
1919 | } while (--max_count > 0); | 1918 | } while (time_before(jiffies, end_time)); |
1920 | /* This is ok, the most of motherboards have only one codec */ | 1919 | /* This is ok, the most of motherboards have only one codec */ |
1921 | 1920 | ||
1922 | __ac97_ok2: | 1921 | __ac97_ok2: |
@@ -2178,7 +2177,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) | |||
2178 | { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ | 2177 | { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ |
2179 | { .subvendor = 0x147b, .subdevice = 0x1415, .action = VIA_DXS_NO_VRA }, /* Abit AV8 */ | 2178 | { .subvendor = 0x147b, .subdevice = 0x1415, .action = VIA_DXS_NO_VRA }, /* Abit AV8 */ |
2180 | { .subvendor = 0x14ff, .subdevice = 0x0403, .action = VIA_DXS_ENABLE }, /* Twinhead mobo */ | 2179 | { .subvendor = 0x14ff, .subdevice = 0x0403, .action = VIA_DXS_ENABLE }, /* Twinhead mobo */ |
2181 | { .subvendor = 0x14ff, .subdevice = 0x0408, .action = VIA_DXS_NO_VRA }, /* Twinhead mobo */ | 2180 | { .subvendor = 0x14ff, .subdevice = 0x0408, .action = VIA_DXS_SRC }, /* Twinhead laptop */ |
2182 | { .subvendor = 0x1584, .subdevice = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */ | 2181 | { .subvendor = 0x1584, .subdevice = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */ |
2183 | { .subvendor = 0x1584, .subdevice = 0x8123, .action = VIA_DXS_NO_VRA }, /* Uniwill (Targa Visionary XP-210) */ | 2182 | { .subvendor = 0x1584, .subdevice = 0x8123, .action = VIA_DXS_NO_VRA }, /* Uniwill (Targa Visionary XP-210) */ |
2184 | { .subvendor = 0x161f, .subdevice = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */ | 2183 | { .subvendor = 0x161f, .subdevice = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */ |
@@ -2187,6 +2186,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) | |||
2187 | { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */ | 2186 | { .subvendor = 0x1695, .subdevice = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */ |
2188 | { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */ | 2187 | { .subvendor = 0x1849, .subdevice = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */ |
2189 | { .subvendor = 0x1919, .subdevice = 0x200a, .action = VIA_DXS_NO_VRA }, /* Soltek SL-K8Tpro-939 */ | 2188 | { .subvendor = 0x1919, .subdevice = 0x200a, .action = VIA_DXS_NO_VRA }, /* Soltek SL-K8Tpro-939 */ |
2189 | { .subvendor = 0x4005, .subdevice = 0x4710, .action = VIA_DXS_SRC }, /* MSI K7T266 Pro2 (MS-6380 V2.0) BIOS 3.7 */ | ||
2190 | { } /* terminator */ | 2190 | { } /* terminator */ |
2191 | }; | 2191 | }; |
2192 | struct dxs_whitelist *w; | 2192 | struct dxs_whitelist *w; |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 5896d289f9ac..4a9779cc9733 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -408,8 +408,7 @@ static void snd_via82xx_codec_wait(ac97_t *ac97) | |||
408 | int err; | 408 | int err; |
409 | err = snd_via82xx_codec_ready(chip, ac97->num); | 409 | err = snd_via82xx_codec_ready(chip, ac97->num); |
410 | /* here we need to wait fairly for long time.. */ | 410 | /* here we need to wait fairly for long time.. */ |
411 | set_current_state(TASK_UNINTERRUPTIBLE); | 411 | msleep(500); |
412 | schedule_timeout(HZ/2); | ||
413 | } | 412 | } |
414 | 413 | ||
415 | static void snd_via82xx_codec_write(ac97_t *ac97, | 414 | static void snd_via82xx_codec_write(ac97_t *ac97, |
@@ -923,7 +922,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip) | |||
923 | static int snd_via82xx_chip_init(via82xx_t *chip) | 922 | static int snd_via82xx_chip_init(via82xx_t *chip) |
924 | { | 923 | { |
925 | unsigned int val; | 924 | unsigned int val; |
926 | int max_count; | 925 | unsigned long end_time; |
927 | unsigned char pval; | 926 | unsigned char pval; |
928 | 927 | ||
929 | pci_read_config_byte(chip->pci, VIA_MC97_CTRL, &pval); | 928 | pci_read_config_byte(chip->pci, VIA_MC97_CTRL, &pval); |
@@ -962,14 +961,14 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
962 | } | 961 | } |
963 | 962 | ||
964 | /* wait until codec ready */ | 963 | /* wait until codec ready */ |
965 | max_count = ((3 * HZ) / 4) + 1; | 964 | end_time = jiffies + msecs_to_jiffies(750); |
966 | do { | 965 | do { |
967 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); | 966 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); |
968 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ | 967 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ |
969 | break; | 968 | break; |
970 | set_current_state(TASK_UNINTERRUPTIBLE); | 969 | set_current_state(TASK_UNINTERRUPTIBLE); |
971 | schedule_timeout(1); | 970 | schedule_timeout(1); |
972 | } while (--max_count > 0); | 971 | } while (time_before(jiffies, end_time)); |
973 | 972 | ||
974 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) | 973 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) |
975 | snd_printk("AC'97 codec is not ready [0x%x]\n", val); | 974 | snd_printk("AC'97 codec is not ready [0x%x]\n", val); |
@@ -977,7 +976,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
977 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | | 976 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | |
978 | VIA_REG_AC97_SECONDARY_VALID | | 977 | VIA_REG_AC97_SECONDARY_VALID | |
979 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); | 978 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); |
980 | max_count = ((3 * HZ) / 4) + 1; | 979 | end_time = jiffies + msecs_to_jiffies(750); |
981 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | | 980 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | |
982 | VIA_REG_AC97_SECONDARY_VALID | | 981 | VIA_REG_AC97_SECONDARY_VALID | |
983 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); | 982 | (VIA_REG_AC97_CODEC_ID_SECONDARY << VIA_REG_AC97_CODEC_ID_SHIFT)); |
@@ -988,7 +987,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
988 | } | 987 | } |
989 | set_current_state(TASK_INTERRUPTIBLE); | 988 | set_current_state(TASK_INTERRUPTIBLE); |
990 | schedule_timeout(1); | 989 | schedule_timeout(1); |
991 | } while (--max_count > 0); | 990 | } while (time_before(jiffies, end_time)); |
992 | /* This is ok, the most of motherboards have only one codec */ | 991 | /* This is ok, the most of motherboards have only one codec */ |
993 | 992 | ||
994 | __ac97_ok2: | 993 | __ac97_ok2: |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 2ae79610ecb5..d54f88a1b525 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -84,16 +84,16 @@ static inline void snd_ymfpci_writel(ymfpci_t *chip, u32 offset, u32 val) | |||
84 | 84 | ||
85 | static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary) | 85 | static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary) |
86 | { | 86 | { |
87 | signed long end_time; | 87 | unsigned long end_time; |
88 | u32 reg = secondary ? YDSXGR_SECSTATUSADR : YDSXGR_PRISTATUSADR; | 88 | u32 reg = secondary ? YDSXGR_SECSTATUSADR : YDSXGR_PRISTATUSADR; |
89 | 89 | ||
90 | end_time = (jiffies + ((3 * HZ) / 4)) + 1; | 90 | end_time = jiffies + msecs_to_jiffies(750); |
91 | do { | 91 | do { |
92 | if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) | 92 | if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) |
93 | return 0; | 93 | return 0; |
94 | set_current_state(TASK_UNINTERRUPTIBLE); | 94 | set_current_state(TASK_UNINTERRUPTIBLE); |
95 | schedule_timeout(1); | 95 | schedule_timeout(1); |
96 | } while (end_time - (signed long)jiffies >= 0); | 96 | } while (time_before(jiffies, end_time)); |
97 | snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); | 97 | snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); |
98 | return -EBUSY; | 98 | return -EBUSY; |
99 | } | 99 | } |
diff --git a/sound/pcmcia/Kconfig b/sound/pcmcia/Kconfig index 3611e298834f..5d1b0b762efa 100644 --- a/sound/pcmcia/Kconfig +++ b/sound/pcmcia/Kconfig | |||
@@ -8,23 +8,12 @@ config SND_VXPOCKET | |||
8 | depends on SND && PCMCIA && ISA | 8 | depends on SND && PCMCIA && ISA |
9 | select SND_VX_LIB | 9 | select SND_VX_LIB |
10 | help | 10 | help |
11 | Say Y here to include support for Digigram VXpocket | 11 | Say Y here to include support for Digigram VXpocket and |
12 | soundcards. | 12 | VXpocket 440 soundcards. |
13 | 13 | ||
14 | To compile this driver as a module, choose M here: the module | 14 | To compile this driver as a module, choose M here: the module |
15 | will be called snd-vxpocket. | 15 | will be called snd-vxpocket. |
16 | 16 | ||
17 | config SND_VXP440 | ||
18 | tristate "Digigram VXpocket 440" | ||
19 | depends on SND && PCMCIA && ISA | ||
20 | select SND_VX_LIB | ||
21 | help | ||
22 | Say Y here to include support for Digigram VXpocket 440 | ||
23 | soundcards. | ||
24 | |||
25 | To compile this driver as a module, choose M here: the module | ||
26 | will be called snd-vxp440. | ||
27 | |||
28 | config SND_PDAUDIOCF | 17 | config SND_PDAUDIOCF |
29 | tristate "Sound Core PDAudioCF" | 18 | tristate "Sound Core PDAudioCF" |
30 | depends on SND && PCMCIA && ISA | 19 | depends on SND && PCMCIA && ISA |
diff --git a/sound/pcmcia/vx/Makefile b/sound/pcmcia/vx/Makefile index f35dfa1af094..54971f01e968 100644 --- a/sound/pcmcia/vx/Makefile +++ b/sound/pcmcia/vx/Makefile | |||
@@ -3,9 +3,6 @@ | |||
3 | # Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> | 3 | # Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> |
4 | # | 4 | # |
5 | 5 | ||
6 | snd-vx-cs-objs := vx_entry.o vxp_ops.o vxp_mixer.o | 6 | snd-vxpocket-objs := vxpocket.o vxp_ops.o vxp_mixer.o |
7 | snd-vxpocket-objs := vxpocket.o | ||
8 | snd-vxp440-objs := vxp440.o | ||
9 | 7 | ||
10 | obj-$(CONFIG_SND_VXPOCKET) += snd-vxpocket.o snd-vx-cs.o | 8 | obj-$(CONFIG_SND_VXPOCKET) += snd-vxpocket.o |
11 | obj-$(CONFIG_SND_VXP440) += snd-vxp440.o snd-vx-cs.o | ||
diff --git a/sound/pcmcia/vx/vx_entry.c b/sound/pcmcia/vx/vx_entry.c deleted file mode 100644 index df7a39ba9680..000000000000 --- a/sound/pcmcia/vx/vx_entry.c +++ /dev/null | |||
@@ -1,375 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for Digigram VXpocket soundcards | ||
3 | * | ||
4 | * PCMCIA entry part | ||
5 | * | ||
6 | * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <sound/driver.h> | ||
24 | #include <sound/core.h> | ||
25 | #include "vxpocket.h" | ||
26 | #include <pcmcia/ciscode.h> | ||
27 | #include <pcmcia/cisreg.h> | ||
28 | |||
29 | |||
30 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | ||
31 | MODULE_DESCRIPTION("Common routines for Digigram PCMCIA VX drivers"); | ||
32 | MODULE_LICENSE("GPL"); | ||
33 | |||
34 | /* | ||
35 | * prototypes | ||
36 | */ | ||
37 | static void vxpocket_config(dev_link_t *link); | ||
38 | |||
39 | |||
40 | static void vxpocket_release(dev_link_t *link) | ||
41 | { | ||
42 | if (link->state & DEV_CONFIG) { | ||
43 | /* release cs resources */ | ||
44 | pcmcia_release_configuration(link->handle); | ||
45 | pcmcia_release_io(link->handle, &link->io); | ||
46 | pcmcia_release_irq(link->handle, &link->irq); | ||
47 | link->state &= ~DEV_CONFIG; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | /* | ||
52 | * destructor | ||
53 | */ | ||
54 | static int snd_vxpocket_free(vx_core_t *chip) | ||
55 | { | ||
56 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
57 | struct snd_vxp_entry *hw; | ||
58 | dev_link_t *link = &vxp->link; | ||
59 | |||
60 | vxpocket_release(link); | ||
61 | |||
62 | /* Break the link with Card Services */ | ||
63 | if (link->handle) | ||
64 | pcmcia_deregister_client(link->handle); | ||
65 | |||
66 | hw = vxp->hw_entry; | ||
67 | if (hw) | ||
68 | hw->card_list[vxp->index] = NULL; | ||
69 | chip->card = NULL; | ||
70 | kfree(chip->dev); | ||
71 | |||
72 | snd_vx_free_firmware(chip); | ||
73 | kfree(chip); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static int snd_vxpocket_dev_free(snd_device_t *device) | ||
78 | { | ||
79 | vx_core_t *chip = device->device_data; | ||
80 | return snd_vxpocket_free(chip); | ||
81 | } | ||
82 | |||
83 | /* | ||
84 | * snd_vxpocket_attach - attach callback for cs | ||
85 | * @hw: the hardware information | ||
86 | */ | ||
87 | dev_link_t *snd_vxpocket_attach(struct snd_vxp_entry *hw) | ||
88 | { | ||
89 | client_reg_t client_reg; /* Register with cardmgr */ | ||
90 | dev_link_t *link; /* Info for cardmgr */ | ||
91 | int i, ret; | ||
92 | vx_core_t *chip; | ||
93 | struct snd_vxpocket *vxp; | ||
94 | snd_card_t *card; | ||
95 | static snd_device_ops_t ops = { | ||
96 | .dev_free = snd_vxpocket_dev_free, | ||
97 | }; | ||
98 | |||
99 | snd_printdd(KERN_DEBUG "vxpocket_attach called\n"); | ||
100 | /* find an empty slot from the card list */ | ||
101 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
102 | if (! hw->card_list[i]) | ||
103 | break; | ||
104 | } | ||
105 | if (i >= SNDRV_CARDS) { | ||
106 | snd_printk(KERN_ERR "vxpocket: too many cards found\n"); | ||
107 | return NULL; | ||
108 | } | ||
109 | if (! hw->enable_table[i]) | ||
110 | return NULL; /* disabled explicitly */ | ||
111 | |||
112 | /* ok, create a card instance */ | ||
113 | card = snd_card_new(hw->index_table[i], hw->id_table[i], THIS_MODULE, 0); | ||
114 | if (card == NULL) { | ||
115 | snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); | ||
116 | return NULL; | ||
117 | } | ||
118 | |||
119 | chip = snd_vx_create(card, hw->hardware, hw->ops, | ||
120 | sizeof(struct snd_vxpocket) - sizeof(vx_core_t)); | ||
121 | if (! chip) | ||
122 | return NULL; | ||
123 | |||
124 | #ifdef SND_VX_FW_LOADER | ||
125 | /* fake a device here since pcmcia doesn't give a valid device... */ | ||
126 | chip->dev = kcalloc(1, sizeof(*chip->dev), GFP_KERNEL); | ||
127 | if (! chip->dev) { | ||
128 | snd_printk(KERN_ERR "vxp: can't malloc chip->dev\n"); | ||
129 | kfree(chip); | ||
130 | snd_card_free(card); | ||
131 | return NULL; | ||
132 | } | ||
133 | device_initialize(chip->dev); | ||
134 | sprintf(chip->dev->bus_id, "vxpocket%d", i); | ||
135 | #endif | ||
136 | |||
137 | if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) { | ||
138 | kfree(chip); | ||
139 | snd_card_free(card); | ||
140 | return NULL; | ||
141 | } | ||
142 | |||
143 | vxp = (struct snd_vxpocket *)chip; | ||
144 | vxp->index = i; | ||
145 | vxp->hw_entry = hw; | ||
146 | chip->ibl.size = hw->ibl[i]; | ||
147 | hw->card_list[i] = chip; | ||
148 | |||
149 | link = &vxp->link; | ||
150 | link->priv = chip; | ||
151 | |||
152 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
153 | link->io.NumPorts1 = 16; | ||
154 | |||
155 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | ||
156 | // link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; | ||
157 | |||
158 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
159 | link->irq.Handler = &snd_vx_irq_handler; | ||
160 | link->irq.Instance = chip; | ||
161 | |||
162 | link->conf.Attributes = CONF_ENABLE_IRQ; | ||
163 | link->conf.Vcc = 50; | ||
164 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
165 | link->conf.ConfigIndex = 1; | ||
166 | link->conf.Present = PRESENT_OPTION; | ||
167 | |||
168 | /* Register with Card Services */ | ||
169 | memset(&client_reg, 0, sizeof(client_reg)); | ||
170 | client_reg.dev_info = hw->dev_info; | ||
171 | client_reg.Version = 0x0210; | ||
172 | client_reg.event_callback_args.client_data = link; | ||
173 | |||
174 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
175 | if (ret != CS_SUCCESS) { | ||
176 | cs_error(link->handle, RegisterClient, ret); | ||
177 | snd_card_free(card); | ||
178 | return NULL; | ||
179 | } | ||
180 | |||
181 | /* Chain drivers */ | ||
182 | link->next = hw->dev_list; | ||
183 | hw->dev_list = link; | ||
184 | |||
185 | /* snd_card_set_pm_callback(card, snd_vxpocket_suspend, snd_vxpocket_resume, chip); */ | ||
186 | |||
187 | return link; | ||
188 | } | ||
189 | |||
190 | |||
191 | /** | ||
192 | * snd_vxpocket_assign_resources - initialize the hardware and card instance. | ||
193 | * @port: i/o port for the card | ||
194 | * @irq: irq number for the card | ||
195 | * | ||
196 | * this function assigns the specified port and irq, boot the card, | ||
197 | * create pcm and control instances, and initialize the rest hardware. | ||
198 | * | ||
199 | * returns 0 if successful, or a negative error code. | ||
200 | */ | ||
201 | static int snd_vxpocket_assign_resources(vx_core_t *chip, int port, int irq) | ||
202 | { | ||
203 | int err; | ||
204 | snd_card_t *card = chip->card; | ||
205 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
206 | |||
207 | snd_printdd(KERN_DEBUG "vxpocket assign resources: port = 0x%x, irq = %d\n", port, irq); | ||
208 | vxp->port = port; | ||
209 | |||
210 | sprintf(card->shortname, "Digigram %s", card->driver); | ||
211 | sprintf(card->longname, "%s at 0x%x, irq %i", | ||
212 | card->shortname, port, irq); | ||
213 | |||
214 | chip->irq = irq; | ||
215 | |||
216 | if ((err = snd_vx_setup_firmware(chip)) < 0) | ||
217 | return err; | ||
218 | |||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | |||
223 | /* | ||
224 | * snd_vxpocket_detach - detach callback for cs | ||
225 | * @hw: the hardware information | ||
226 | */ | ||
227 | void snd_vxpocket_detach(struct snd_vxp_entry *hw, dev_link_t *link) | ||
228 | { | ||
229 | vx_core_t *chip; | ||
230 | |||
231 | if (! link) | ||
232 | return; | ||
233 | |||
234 | chip = link->priv; | ||
235 | |||
236 | snd_printdd(KERN_DEBUG "vxpocket_detach called\n"); | ||
237 | /* Remove the interface data from the linked list */ | ||
238 | if (hw) { | ||
239 | dev_link_t **linkp; | ||
240 | /* Locate device structure */ | ||
241 | for (linkp = &hw->dev_list; *linkp; linkp = &(*linkp)->next) | ||
242 | if (*linkp == link) { | ||
243 | *linkp = link->next; | ||
244 | break; | ||
245 | } | ||
246 | } | ||
247 | chip->chip_status |= VX_STAT_IS_STALE; /* to be sure */ | ||
248 | snd_card_disconnect(chip->card); | ||
249 | snd_card_free_in_thread(chip->card); | ||
250 | } | ||
251 | |||
252 | /* | ||
253 | * configuration callback | ||
254 | */ | ||
255 | |||
256 | #define CS_CHECK(fn, ret) \ | ||
257 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
258 | |||
259 | static void vxpocket_config(dev_link_t *link) | ||
260 | { | ||
261 | client_handle_t handle = link->handle; | ||
262 | vx_core_t *chip = link->priv; | ||
263 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
264 | tuple_t tuple; | ||
265 | cisparse_t *parse = NULL; | ||
266 | u_short buf[32]; | ||
267 | int last_fn, last_ret; | ||
268 | |||
269 | snd_printdd(KERN_DEBUG "vxpocket_config called\n"); | ||
270 | parse = kmalloc(sizeof(*parse), GFP_KERNEL); | ||
271 | if (! parse) { | ||
272 | snd_printk(KERN_ERR "vx: cannot allocate\n"); | ||
273 | return; | ||
274 | } | ||
275 | tuple.Attributes = 0; | ||
276 | tuple.TupleData = (cisdata_t *)buf; | ||
277 | tuple.TupleDataMax = sizeof(buf); | ||
278 | tuple.TupleOffset = 0; | ||
279 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
280 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | ||
281 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
282 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); | ||
283 | link->conf.ConfigBase = parse->config.base; | ||
284 | link->conf.Present = parse->config.rmask[0]; | ||
285 | |||
286 | /* Configure card */ | ||
287 | link->state |= DEV_CONFIG; | ||
288 | |||
289 | CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io)); | ||
290 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | ||
291 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | ||
292 | |||
293 | if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) | ||
294 | goto failed; | ||
295 | |||
296 | link->dev = &vxp->node; | ||
297 | link->state &= ~DEV_CONFIG_PENDING; | ||
298 | kfree(parse); | ||
299 | return; | ||
300 | |||
301 | cs_failed: | ||
302 | cs_error(link->handle, last_fn, last_ret); | ||
303 | failed: | ||
304 | pcmcia_release_configuration(link->handle); | ||
305 | pcmcia_release_io(link->handle, &link->io); | ||
306 | pcmcia_release_irq(link->handle, &link->irq); | ||
307 | link->state &= ~DEV_CONFIG; | ||
308 | kfree(parse); | ||
309 | } | ||
310 | |||
311 | |||
312 | /* | ||
313 | * event callback | ||
314 | */ | ||
315 | int vxpocket_event(event_t event, int priority, event_callback_args_t *args) | ||
316 | { | ||
317 | dev_link_t *link = args->client_data; | ||
318 | vx_core_t *chip = link->priv; | ||
319 | |||
320 | switch (event) { | ||
321 | case CS_EVENT_CARD_REMOVAL: | ||
322 | snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n"); | ||
323 | link->state &= ~DEV_PRESENT; | ||
324 | if (link->state & DEV_CONFIG) { | ||
325 | chip->chip_status |= VX_STAT_IS_STALE; | ||
326 | } | ||
327 | break; | ||
328 | case CS_EVENT_CARD_INSERTION: | ||
329 | snd_printdd(KERN_DEBUG "CARD_INSERTION..\n"); | ||
330 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
331 | vxpocket_config(link); | ||
332 | break; | ||
333 | #ifdef CONFIG_PM | ||
334 | case CS_EVENT_PM_SUSPEND: | ||
335 | snd_printdd(KERN_DEBUG "SUSPEND\n"); | ||
336 | link->state |= DEV_SUSPEND; | ||
337 | if (chip && chip->card->pm_suspend) { | ||
338 | snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n"); | ||
339 | chip->card->pm_suspend(chip->card, PMSG_SUSPEND); | ||
340 | } | ||
341 | /* Fall through... */ | ||
342 | case CS_EVENT_RESET_PHYSICAL: | ||
343 | snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n"); | ||
344 | if (link->state & DEV_CONFIG) | ||
345 | pcmcia_release_configuration(link->handle); | ||
346 | break; | ||
347 | case CS_EVENT_PM_RESUME: | ||
348 | snd_printdd(KERN_DEBUG "RESUME\n"); | ||
349 | link->state &= ~DEV_SUSPEND; | ||
350 | /* Fall through... */ | ||
351 | case CS_EVENT_CARD_RESET: | ||
352 | snd_printdd(KERN_DEBUG "CARD_RESET\n"); | ||
353 | if (DEV_OK(link)) { | ||
354 | //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
355 | snd_printdd(KERN_DEBUG "requestconfig...\n"); | ||
356 | pcmcia_request_configuration(link->handle, &link->conf); | ||
357 | if (chip && chip->card->pm_resume) { | ||
358 | snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); | ||
359 | chip->card->pm_resume(chip->card); | ||
360 | } | ||
361 | } | ||
362 | snd_printdd(KERN_DEBUG "resume done!\n"); | ||
363 | break; | ||
364 | #endif | ||
365 | } | ||
366 | return 0; | ||
367 | } | ||
368 | |||
369 | /* | ||
370 | * exported stuffs | ||
371 | */ | ||
372 | EXPORT_SYMBOL(snd_vxpocket_ops); | ||
373 | EXPORT_SYMBOL(snd_vxpocket_attach); | ||
374 | EXPORT_SYMBOL(vxpocket_event); | ||
375 | EXPORT_SYMBOL(snd_vxpocket_detach); | ||
diff --git a/sound/pcmcia/vx/vxp440.c b/sound/pcmcia/vx/vxp440.c deleted file mode 100644 index 59190a833001..000000000000 --- a/sound/pcmcia/vx/vxp440.c +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #define COMPILE_VXP440 | ||
2 | |||
3 | /* | ||
4 | add the following as /etc/pcmcia/vxp440.conf: | ||
5 | |||
6 | device "snd-vxp440" | ||
7 | class "audio" module "snd-vxp440" | ||
8 | |||
9 | card "Digigram VX-POCKET440" | ||
10 | manfid 0x01f1, 0x0100 | ||
11 | bind "snd-vxp440" | ||
12 | */ | ||
13 | |||
14 | #include "vxpocket.c" | ||
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 62d6fa128148..3a82161d3b24 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c | |||
@@ -24,21 +24,17 @@ | |||
24 | #include <linux/moduleparam.h> | 24 | #include <linux/moduleparam.h> |
25 | #include <sound/core.h> | 25 | #include <sound/core.h> |
26 | #include "vxpocket.h" | 26 | #include "vxpocket.h" |
27 | #include <pcmcia/ciscode.h> | ||
28 | #include <pcmcia/cisreg.h> | ||
27 | #include <sound/initval.h> | 29 | #include <sound/initval.h> |
28 | 30 | ||
29 | /* | 31 | /* |
30 | */ | 32 | */ |
31 | 33 | ||
32 | #ifdef COMPILE_VXP440 | ||
33 | #define CARD_NAME "VXPocket440" | ||
34 | #else | ||
35 | #define CARD_NAME "VXPocket" | ||
36 | #endif | ||
37 | |||
38 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); | 34 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); |
39 | MODULE_DESCRIPTION("Digigram " CARD_NAME); | 35 | MODULE_DESCRIPTION("Digigram VXPocket"); |
40 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
41 | MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); | 37 | MODULE_SUPPORTED_DEVICE("{{Digigram,VXPocket},{Digigram,VXPocket440}}"); |
42 | 38 | ||
43 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 39 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
44 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 40 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
@@ -46,82 +42,405 @@ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ | |||
46 | static int ibl[SNDRV_CARDS]; | 42 | static int ibl[SNDRV_CARDS]; |
47 | 43 | ||
48 | module_param_array(index, int, NULL, 0444); | 44 | module_param_array(index, int, NULL, 0444); |
49 | MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); | 45 | MODULE_PARM_DESC(index, "Index value for VXPocket soundcard."); |
50 | module_param_array(id, charp, NULL, 0444); | 46 | module_param_array(id, charp, NULL, 0444); |
51 | MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); | 47 | MODULE_PARM_DESC(id, "ID string for VXPocket soundcard."); |
52 | module_param_array(enable, bool, NULL, 0444); | 48 | module_param_array(enable, bool, NULL, 0444); |
53 | MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); | 49 | MODULE_PARM_DESC(enable, "Enable VXPocket soundcard."); |
54 | module_param_array(ibl, int, NULL, 0444); | 50 | module_param_array(ibl, int, NULL, 0444); |
55 | MODULE_PARM_DESC(ibl, "Capture IBL size for " CARD_NAME " soundcard."); | 51 | MODULE_PARM_DESC(ibl, "Capture IBL size for VXPocket soundcard."); |
56 | 52 | ||
57 | 53 | ||
58 | /* | 54 | /* |
59 | */ | 55 | */ |
60 | 56 | ||
61 | #ifdef COMPILE_VXP440 | 57 | static unsigned int card_alloc; |
58 | static dev_link_t *dev_list; /* Linked list of devices */ | ||
59 | static dev_info_t dev_info = "snd-vxpocket"; | ||
62 | 60 | ||
63 | /* 1 DSP, 1 sync UER, 1 sync World Clock (NIY) */ | ||
64 | /* SMPTE (NIY) */ | ||
65 | /* 2 stereo analog input (line/micro) */ | ||
66 | /* 2 stereo analog output */ | ||
67 | /* Only output levels can be modified */ | ||
68 | /* UER, but only for the first two inputs and outputs. */ | ||
69 | 61 | ||
70 | #define NUM_CODECS 2 | 62 | static int vxpocket_event(event_t event, int priority, event_callback_args_t *args); |
71 | #define CARD_TYPE VX_TYPE_VXP440 | ||
72 | #define DEV_INFO "snd-vxp440" | ||
73 | 63 | ||
74 | #else | ||
75 | 64 | ||
76 | /* 1 DSP, 1 sync UER */ | 65 | /* |
77 | /* 1 programmable clock (NIY) */ | 66 | */ |
78 | /* 1 stereo analog input (line/micro) */ | 67 | static void vxpocket_release(dev_link_t *link) |
79 | /* 1 stereo analog output */ | 68 | { |
80 | /* Only output levels can be modified */ | 69 | if (link->state & DEV_CONFIG) { |
70 | /* release cs resources */ | ||
71 | pcmcia_release_configuration(link->handle); | ||
72 | pcmcia_release_io(link->handle, &link->io); | ||
73 | pcmcia_release_irq(link->handle, &link->irq); | ||
74 | link->state &= ~DEV_CONFIG; | ||
75 | } | ||
76 | if (link->handle) { | ||
77 | /* Break the link with Card Services */ | ||
78 | pcmcia_deregister_client(link->handle); | ||
79 | link->handle = NULL; | ||
80 | } | ||
81 | } | ||
81 | 82 | ||
82 | #define NUM_CODECS 1 | 83 | /* |
83 | #define CARD_TYPE VX_TYPE_VXPOCKET | 84 | * destructor, called from snd_card_free_in_thread() |
84 | #define DEV_INFO "snd-vxpocket" | 85 | */ |
86 | static int snd_vxpocket_dev_free(snd_device_t *device) | ||
87 | { | ||
88 | vx_core_t *chip = device->device_data; | ||
85 | 89 | ||
86 | #endif | 90 | snd_vx_free_firmware(chip); |
91 | kfree(chip); | ||
92 | return 0; | ||
93 | } | ||
87 | 94 | ||
88 | static dev_info_t dev_info = DEV_INFO; | ||
89 | 95 | ||
90 | static struct snd_vx_hardware vxp_hw = { | 96 | /* |
91 | .name = CARD_NAME, | 97 | * Hardware information |
92 | .type = CARD_TYPE, | 98 | */ |
99 | |||
100 | /* VX-pocket V2 | ||
101 | * | ||
102 | * 1 DSP, 1 sync UER | ||
103 | * 1 programmable clock (NIY) | ||
104 | * 1 stereo analog input (line/micro) | ||
105 | * 1 stereo analog output | ||
106 | * Only output levels can be modified | ||
107 | */ | ||
108 | |||
109 | static struct snd_vx_hardware vxpocket_hw = { | ||
110 | .name = "VXPocket", | ||
111 | .type = VX_TYPE_VXPOCKET, | ||
93 | 112 | ||
94 | /* hardware specs */ | 113 | /* hardware specs */ |
95 | .num_codecs = NUM_CODECS, | 114 | .num_codecs = 1, |
96 | .num_ins = NUM_CODECS, | 115 | .num_ins = 1, |
97 | .num_outs = NUM_CODECS, | 116 | .num_outs = 1, |
98 | .output_level_max = VX_ANALOG_OUT_LEVEL_MAX, | 117 | .output_level_max = VX_ANALOG_OUT_LEVEL_MAX, |
99 | }; | 118 | }; |
100 | 119 | ||
101 | static struct snd_vxp_entry hw_entry = { | 120 | /* VX-pocket 440 |
102 | .dev_info = &dev_info, | 121 | * |
122 | * 1 DSP, 1 sync UER, 1 sync World Clock (NIY) | ||
123 | * SMPTE (NIY) | ||
124 | * 2 stereo analog input (line/micro) | ||
125 | * 2 stereo analog output | ||
126 | * Only output levels can be modified | ||
127 | * UER, but only for the first two inputs and outputs. | ||
128 | */ | ||
103 | 129 | ||
104 | /* module parameters */ | 130 | static struct snd_vx_hardware vxp440_hw = { |
105 | .index_table = index, | 131 | .name = "VXPocket440", |
106 | .id_table = id, | 132 | .type = VX_TYPE_VXP440, |
107 | .enable_table = enable, | 133 | |
108 | .ibl = ibl, | 134 | /* hardware specs */ |
135 | .num_codecs = 2, | ||
136 | .num_ins = 2, | ||
137 | .num_outs = 2, | ||
138 | .output_level_max = VX_ANALOG_OUT_LEVEL_MAX, | ||
139 | }; | ||
140 | |||
141 | |||
142 | /* | ||
143 | * create vxpocket instance | ||
144 | */ | ||
145 | static struct snd_vxpocket *snd_vxpocket_new(snd_card_t *card, int ibl) | ||
146 | { | ||
147 | client_reg_t client_reg; /* Register with cardmgr */ | ||
148 | dev_link_t *link; /* Info for cardmgr */ | ||
149 | vx_core_t *chip; | ||
150 | struct snd_vxpocket *vxp; | ||
151 | int ret; | ||
152 | static snd_device_ops_t ops = { | ||
153 | .dev_free = snd_vxpocket_dev_free, | ||
154 | }; | ||
155 | |||
156 | chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, | ||
157 | sizeof(struct snd_vxpocket) - sizeof(vx_core_t)); | ||
158 | if (! chip) | ||
159 | return NULL; | ||
160 | |||
161 | if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) { | ||
162 | kfree(chip); | ||
163 | return NULL; | ||
164 | } | ||
165 | chip->ibl.size = ibl; | ||
166 | |||
167 | vxp = (struct snd_vxpocket *)chip; | ||
168 | |||
169 | link = &vxp->link; | ||
170 | link->priv = chip; | ||
171 | |||
172 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
173 | link->io.NumPorts1 = 16; | ||
174 | |||
175 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | ||
176 | |||
177 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
178 | link->irq.Handler = &snd_vx_irq_handler; | ||
179 | link->irq.Instance = chip; | ||
180 | |||
181 | link->conf.Attributes = CONF_ENABLE_IRQ; | ||
182 | link->conf.Vcc = 50; | ||
183 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
184 | link->conf.ConfigIndex = 1; | ||
185 | link->conf.Present = PRESENT_OPTION; | ||
186 | |||
187 | /* Register with Card Services */ | ||
188 | memset(&client_reg, 0, sizeof(client_reg)); | ||
189 | client_reg.dev_info = &dev_info; | ||
190 | client_reg.EventMask = | ||
191 | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | ||
192 | #ifdef CONFIG_PM | ||
193 | | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | ||
194 | | CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME | ||
195 | #endif | ||
196 | ; | ||
197 | client_reg.event_handler = &vxpocket_event; | ||
198 | client_reg.Version = 0x0210; | ||
199 | client_reg.event_callback_args.client_data = link; | ||
200 | |||
201 | ret = pcmcia_register_client(&link->handle, &client_reg); | ||
202 | if (ret != CS_SUCCESS) { | ||
203 | cs_error(link->handle, RegisterClient, ret); | ||
204 | return NULL; | ||
205 | } | ||
206 | |||
207 | return vxp; | ||
208 | } | ||
209 | |||
210 | |||
211 | /** | ||
212 | * snd_vxpocket_assign_resources - initialize the hardware and card instance. | ||
213 | * @port: i/o port for the card | ||
214 | * @irq: irq number for the card | ||
215 | * | ||
216 | * this function assigns the specified port and irq, boot the card, | ||
217 | * create pcm and control instances, and initialize the rest hardware. | ||
218 | * | ||
219 | * returns 0 if successful, or a negative error code. | ||
220 | */ | ||
221 | static int snd_vxpocket_assign_resources(vx_core_t *chip, int port, int irq) | ||
222 | { | ||
223 | int err; | ||
224 | snd_card_t *card = chip->card; | ||
225 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
226 | |||
227 | snd_printdd(KERN_DEBUG "vxpocket assign resources: port = 0x%x, irq = %d\n", port, irq); | ||
228 | vxp->port = port; | ||
229 | |||
230 | sprintf(card->shortname, "Digigram %s", card->driver); | ||
231 | sprintf(card->longname, "%s at 0x%x, irq %i", | ||
232 | card->shortname, port, irq); | ||
233 | |||
234 | chip->irq = irq; | ||
235 | |||
236 | if ((err = snd_vx_setup_firmware(chip)) < 0) | ||
237 | return err; | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | |||
243 | /* | ||
244 | * configuration callback | ||
245 | */ | ||
246 | |||
247 | #define CS_CHECK(fn, ret) \ | ||
248 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
249 | |||
250 | static void vxpocket_config(dev_link_t *link) | ||
251 | { | ||
252 | client_handle_t handle = link->handle; | ||
253 | vx_core_t *chip = link->priv; | ||
254 | struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
255 | tuple_t tuple; | ||
256 | cisparse_t *parse; | ||
257 | u_short buf[32]; | ||
258 | int last_fn, last_ret; | ||
259 | |||
260 | snd_printdd(KERN_DEBUG "vxpocket_config called\n"); | ||
261 | parse = kmalloc(sizeof(*parse), GFP_KERNEL); | ||
262 | if (! parse) { | ||
263 | snd_printk(KERN_ERR "vx: cannot allocate\n"); | ||
264 | return; | ||
265 | } | ||
266 | tuple.Attributes = 0; | ||
267 | tuple.TupleData = (cisdata_t *)buf; | ||
268 | tuple.TupleDataMax = sizeof(buf); | ||
269 | tuple.TupleOffset = 0; | ||
270 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
271 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | ||
272 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
273 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); | ||
274 | link->conf.ConfigBase = parse->config.base; | ||
275 | link->conf.Present = parse->config.rmask[0]; | ||
276 | |||
277 | /* redefine hardware record according to the VERSION1 string */ | ||
278 | tuple.DesiredTuple = CISTPL_VERS_1; | ||
279 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | ||
280 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
281 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, parse)); | ||
282 | if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) { | ||
283 | snd_printdd("VX-pocket is detected\n"); | ||
284 | } else { | ||
285 | snd_printdd("VX-pocket 440 is detected\n"); | ||
286 | /* overwrite the hardware information */ | ||
287 | chip->hw = &vxp440_hw; | ||
288 | chip->type = vxp440_hw.type; | ||
289 | strcpy(chip->card->driver, vxp440_hw.name); | ||
290 | } | ||
291 | |||
292 | /* Configure card */ | ||
293 | link->state |= DEV_CONFIG; | ||
294 | |||
295 | CS_CHECK(RequestIO, pcmcia_request_io(handle, &link->io)); | ||
296 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | ||
297 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | ||
298 | |||
299 | chip->dev = &handle_to_dev(link->handle); | ||
300 | |||
301 | if (snd_vxpocket_assign_resources(chip, link->io.BasePort1, link->irq.AssignedIRQ) < 0) | ||
302 | goto failed; | ||
303 | |||
304 | link->dev = &vxp->node; | ||
305 | link->state &= ~DEV_CONFIG_PENDING; | ||
306 | kfree(parse); | ||
307 | return; | ||
308 | |||
309 | cs_failed: | ||
310 | cs_error(link->handle, last_fn, last_ret); | ||
311 | failed: | ||
312 | pcmcia_release_configuration(link->handle); | ||
313 | pcmcia_release_io(link->handle, &link->io); | ||
314 | pcmcia_release_irq(link->handle, &link->irq); | ||
315 | link->state &= ~DEV_CONFIG; | ||
316 | kfree(parse); | ||
317 | } | ||
318 | |||
319 | |||
320 | /* | ||
321 | * event callback | ||
322 | */ | ||
323 | static int vxpocket_event(event_t event, int priority, event_callback_args_t *args) | ||
324 | { | ||
325 | dev_link_t *link = args->client_data; | ||
326 | vx_core_t *chip = link->priv; | ||
327 | |||
328 | switch (event) { | ||
329 | case CS_EVENT_CARD_REMOVAL: | ||
330 | snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n"); | ||
331 | link->state &= ~DEV_PRESENT; | ||
332 | if (link->state & DEV_CONFIG) | ||
333 | chip->chip_status |= VX_STAT_IS_STALE; | ||
334 | break; | ||
335 | case CS_EVENT_CARD_INSERTION: | ||
336 | snd_printdd(KERN_DEBUG "CARD_INSERTION..\n"); | ||
337 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
338 | vxpocket_config(link); | ||
339 | break; | ||
340 | #ifdef CONFIG_PM | ||
341 | case CS_EVENT_PM_SUSPEND: | ||
342 | snd_printdd(KERN_DEBUG "SUSPEND\n"); | ||
343 | link->state |= DEV_SUSPEND; | ||
344 | if (chip && chip->card->pm_suspend) { | ||
345 | snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n"); | ||
346 | chip->card->pm_suspend(chip->card, PMSG_SUSPEND); | ||
347 | } | ||
348 | /* Fall through... */ | ||
349 | case CS_EVENT_RESET_PHYSICAL: | ||
350 | snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n"); | ||
351 | if (link->state & DEV_CONFIG) | ||
352 | pcmcia_release_configuration(link->handle); | ||
353 | break; | ||
354 | case CS_EVENT_PM_RESUME: | ||
355 | snd_printdd(KERN_DEBUG "RESUME\n"); | ||
356 | link->state &= ~DEV_SUSPEND; | ||
357 | /* Fall through... */ | ||
358 | case CS_EVENT_CARD_RESET: | ||
359 | snd_printdd(KERN_DEBUG "CARD_RESET\n"); | ||
360 | if (DEV_OK(link)) { | ||
361 | //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; | ||
362 | snd_printdd(KERN_DEBUG "requestconfig...\n"); | ||
363 | pcmcia_request_configuration(link->handle, &link->conf); | ||
364 | if (chip && chip->card->pm_resume) { | ||
365 | snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); | ||
366 | chip->card->pm_resume(chip->card); | ||
367 | } | ||
368 | } | ||
369 | snd_printdd(KERN_DEBUG "resume done!\n"); | ||
370 | break; | ||
371 | #endif | ||
372 | } | ||
373 | return 0; | ||
374 | } | ||
109 | 375 | ||
110 | /* h/w config */ | ||
111 | .hardware = &vxp_hw, | ||
112 | .ops = &snd_vxpocket_ops, | ||
113 | }; | ||
114 | 376 | ||
115 | /* | 377 | /* |
116 | */ | 378 | */ |
117 | static dev_link_t *vxp_attach(void) | 379 | static dev_link_t *vxp_attach(void) |
118 | { | 380 | { |
119 | return snd_vxpocket_attach(&hw_entry); | 381 | snd_card_t *card; |
382 | struct snd_vxpocket *vxp; | ||
383 | int i; | ||
384 | |||
385 | /* find an empty slot from the card list */ | ||
386 | for (i = 0; i < SNDRV_CARDS; i++) { | ||
387 | if (! card_alloc & (1 << i)) | ||
388 | break; | ||
389 | } | ||
390 | if (i >= SNDRV_CARDS) { | ||
391 | snd_printk(KERN_ERR "vxpocket: too many cards found\n"); | ||
392 | return NULL; | ||
393 | } | ||
394 | if (! enable[i]) | ||
395 | return NULL; /* disabled explicitly */ | ||
396 | |||
397 | /* ok, create a card instance */ | ||
398 | card = snd_card_new(index[i], id[i], THIS_MODULE, 0); | ||
399 | if (card == NULL) { | ||
400 | snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); | ||
401 | return NULL; | ||
402 | } | ||
403 | |||
404 | vxp = snd_vxpocket_new(card, ibl[i]); | ||
405 | if (! vxp) { | ||
406 | snd_card_free(card); | ||
407 | return NULL; | ||
408 | } | ||
409 | |||
410 | vxp->index = index[i]; | ||
411 | card_alloc |= 1 << i; | ||
412 | |||
413 | /* Chain drivers */ | ||
414 | vxp->link.next = dev_list; | ||
415 | dev_list = &vxp->link; | ||
416 | |||
417 | return &vxp->link; | ||
120 | } | 418 | } |
121 | 419 | ||
122 | static void vxp_detach(dev_link_t *link) | 420 | static void vxp_detach(dev_link_t *link) |
123 | { | 421 | { |
124 | snd_vxpocket_detach(&hw_entry, link); | 422 | struct snd_vxpocket *vxp; |
423 | vx_core_t *chip; | ||
424 | dev_link_t **linkp; | ||
425 | |||
426 | if (! link) | ||
427 | return; | ||
428 | |||
429 | vxp = link->priv; | ||
430 | chip = (vx_core_t *)vxp; | ||
431 | card_alloc &= ~(1 << vxp->index); | ||
432 | |||
433 | /* Remove the interface data from the linked list */ | ||
434 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) | ||
435 | if (*linkp == link) { | ||
436 | *linkp = link->next; | ||
437 | break; | ||
438 | } | ||
439 | |||
440 | chip->chip_status |= VX_STAT_IS_STALE; /* to be sure */ | ||
441 | snd_card_disconnect(chip->card); | ||
442 | vxpocket_release(link); | ||
443 | snd_card_free_in_thread(chip->card); | ||
125 | } | 444 | } |
126 | 445 | ||
127 | /* | 446 | /* |
@@ -137,7 +456,7 @@ MODULE_DEVICE_TABLE(pcmcia, vxp_ids); | |||
137 | static struct pcmcia_driver vxp_cs_driver = { | 456 | static struct pcmcia_driver vxp_cs_driver = { |
138 | .owner = THIS_MODULE, | 457 | .owner = THIS_MODULE, |
139 | .drv = { | 458 | .drv = { |
140 | .name = DEV_INFO, | 459 | .name = "snd-vxpocket", |
141 | }, | 460 | }, |
142 | .attach = vxp_attach, | 461 | .attach = vxp_attach, |
143 | .detach = vxp_detach, | 462 | .detach = vxp_detach, |
@@ -152,7 +471,7 @@ static int __init init_vxpocket(void) | |||
152 | static void __exit exit_vxpocket(void) | 471 | static void __exit exit_vxpocket(void) |
153 | { | 472 | { |
154 | pcmcia_unregister_driver(&vxp_cs_driver); | 473 | pcmcia_unregister_driver(&vxp_cs_driver); |
155 | BUG_ON(hw_entry.dev_list != NULL); | 474 | BUG_ON(dev_list != NULL); |
156 | } | 475 | } |
157 | 476 | ||
158 | module_init(init_vxpocket); | 477 | module_init(init_vxpocket); |
diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h index 4462c04a4e8f..70754aa3dd11 100644 --- a/sound/pcmcia/vx/vxpocket.h +++ b/sound/pcmcia/vx/vxpocket.h | |||
@@ -28,24 +28,6 @@ | |||
28 | #include <pcmcia/cistpl.h> | 28 | #include <pcmcia/cistpl.h> |
29 | #include <pcmcia/ds.h> | 29 | #include <pcmcia/ds.h> |
30 | 30 | ||
31 | struct snd_vxp_entry { | ||
32 | dev_info_t *dev_info; | ||
33 | |||
34 | /* module parameters */ | ||
35 | int *index_table; | ||
36 | char **id_table; | ||
37 | int *enable_table; | ||
38 | int *ibl; | ||
39 | |||
40 | /* h/w config */ | ||
41 | struct snd_vx_hardware *hardware; | ||
42 | struct snd_vx_ops *ops; | ||
43 | |||
44 | /* slots */ | ||
45 | vx_core_t *card_list[SNDRV_CARDS]; | ||
46 | dev_link_t *dev_list; /* Linked list of devices */ | ||
47 | }; | ||
48 | |||
49 | struct snd_vxpocket { | 31 | struct snd_vxpocket { |
50 | 32 | ||
51 | vx_core_t core; | 33 | vx_core_t core; |
@@ -57,8 +39,7 @@ struct snd_vxpocket { | |||
57 | unsigned int regCDSP; /* current CDSP register */ | 39 | unsigned int regCDSP; /* current CDSP register */ |
58 | unsigned int regDIALOG; /* current DIALOG register */ | 40 | unsigned int regDIALOG; /* current DIALOG register */ |
59 | 41 | ||
60 | int index; | 42 | int index; /* card index */ |
61 | struct snd_vxp_entry *hw_entry; | ||
62 | 43 | ||
63 | /* pcmcia stuff */ | 44 | /* pcmcia stuff */ |
64 | dev_link_t link; | 45 | dev_link_t link; |
@@ -70,12 +51,6 @@ extern struct snd_vx_ops snd_vxpocket_ops; | |||
70 | void vx_set_mic_boost(vx_core_t *chip, int boost); | 51 | void vx_set_mic_boost(vx_core_t *chip, int boost); |
71 | void vx_set_mic_level(vx_core_t *chip, int level); | 52 | void vx_set_mic_level(vx_core_t *chip, int level); |
72 | 53 | ||
73 | /* | ||
74 | * pcmcia stuff | ||
75 | */ | ||
76 | dev_link_t *snd_vxpocket_attach(struct snd_vxp_entry *hw); | ||
77 | void snd_vxpocket_detach(struct snd_vxp_entry *hw, dev_link_t *link); | ||
78 | |||
79 | int vxp_add_mic_controls(vx_core_t *chip); | 54 | int vxp_add_mic_controls(vx_core_t *chip); |
80 | 55 | ||
81 | /* Constants used to access the CDSP register (0x08). */ | 56 | /* Constants used to access the CDSP register (0x08). */ |
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 061e52d3d771..758ca1bcbcf2 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c | |||
@@ -103,7 +103,7 @@ static void screamer_recalibrate(pmac_t *chip) | |||
103 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); | 103 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); |
104 | if (chip->manufacturer == 0x1) | 104 | if (chip->manufacturer == 0x1) |
105 | /* delay for broken crystal part */ | 105 | /* delay for broken crystal part */ |
106 | big_mdelay(750); | 106 | msleep(750); |
107 | snd_pmac_awacs_write_noreg(chip, 1, | 107 | snd_pmac_awacs_write_noreg(chip, 1, |
108 | chip->awacs_reg[1] | MASK_RECALIBRATE | MASK_CMUTE | MASK_AMUTE); | 108 | chip->awacs_reg[1] | MASK_RECALIBRATE | MASK_CMUTE | MASK_AMUTE); |
109 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); | 109 | snd_pmac_awacs_write_noreg(chip, 1, chip->awacs_reg[1]); |
@@ -653,10 +653,10 @@ static void snd_pmac_awacs_resume(pmac_t *chip) | |||
653 | { | 653 | { |
654 | if (machine_is_compatible("PowerBook3,1") | 654 | if (machine_is_compatible("PowerBook3,1") |
655 | || machine_is_compatible("PowerBook3,2")) { | 655 | || machine_is_compatible("PowerBook3,2")) { |
656 | big_mdelay(100); | 656 | msleep(100); |
657 | snd_pmac_awacs_write_reg(chip, 1, | 657 | snd_pmac_awacs_write_reg(chip, 1, |
658 | chip->awacs_reg[1] & ~MASK_PAROUT); | 658 | chip->awacs_reg[1] & ~MASK_PAROUT); |
659 | big_mdelay(300); | 659 | msleep(300); |
660 | } | 660 | } |
661 | 661 | ||
662 | awacs_restore_all_regs(chip); | 662 | awacs_restore_all_regs(chip); |
diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h index 582db5220119..ae3bb6c6edff 100644 --- a/sound/ppc/pmac.h +++ b/sound/ppc/pmac.h | |||
@@ -212,9 +212,4 @@ int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *ui | |||
212 | 212 | ||
213 | int snd_pmac_add_automute(pmac_t *chip); | 213 | int snd_pmac_add_automute(pmac_t *chip); |
214 | 214 | ||
215 | #define big_mdelay(msec) do {\ | ||
216 | set_current_state(TASK_UNINTERRUPTIBLE);\ | ||
217 | schedule_timeout(((msec) * HZ + 999) / 1000);\ | ||
218 | } while (0) | ||
219 | |||
220 | #endif /* __PMAC_H */ | 215 | #endif /* __PMAC_H */ |
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c index 36c5d5d45bb1..b94437c024b1 100644 --- a/sound/ppc/tumbler.c +++ b/sound/ppc/tumbler.c | |||
@@ -945,7 +945,7 @@ static void device_change_handler(void *self) | |||
945 | check_mute(chip, &mix->line_mute, 0, mix->auto_mute_notify, | 945 | check_mute(chip, &mix->line_mute, 0, mix->auto_mute_notify, |
946 | chip->lineout_sw_ctl); | 946 | chip->lineout_sw_ctl); |
947 | if (mix->anded_reset) | 947 | if (mix->anded_reset) |
948 | big_mdelay(10); | 948 | msleep(10); |
949 | check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, | 949 | check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, |
950 | chip->speaker_sw_ctl); | 950 | chip->speaker_sw_ctl); |
951 | mix->drc_enable = 0; | 951 | mix->drc_enable = 0; |
@@ -954,7 +954,7 @@ static void device_change_handler(void *self) | |||
954 | check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, | 954 | check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, |
955 | chip->speaker_sw_ctl); | 955 | chip->speaker_sw_ctl); |
956 | if (mix->anded_reset) | 956 | if (mix->anded_reset) |
957 | big_mdelay(10); | 957 | msleep(10); |
958 | check_mute(chip, &mix->hp_mute, 1, mix->auto_mute_notify, | 958 | check_mute(chip, &mix->hp_mute, 1, mix->auto_mute_notify, |
959 | chip->master_sw_ctl); | 959 | chip->master_sw_ctl); |
960 | if (mix->line_mute.addr != 0) | 960 | if (mix->line_mute.addr != 0) |
@@ -1109,22 +1109,22 @@ static void tumbler_reset_audio(pmac_t *chip) | |||
1109 | DBG("(I) codec anded reset !\n"); | 1109 | DBG("(I) codec anded reset !\n"); |
1110 | write_audio_gpio(&mix->hp_mute, 0); | 1110 | write_audio_gpio(&mix->hp_mute, 0); |
1111 | write_audio_gpio(&mix->amp_mute, 0); | 1111 | write_audio_gpio(&mix->amp_mute, 0); |
1112 | big_mdelay(200); | 1112 | msleep(200); |
1113 | write_audio_gpio(&mix->hp_mute, 1); | 1113 | write_audio_gpio(&mix->hp_mute, 1); |
1114 | write_audio_gpio(&mix->amp_mute, 1); | 1114 | write_audio_gpio(&mix->amp_mute, 1); |
1115 | big_mdelay(100); | 1115 | msleep(100); |
1116 | write_audio_gpio(&mix->hp_mute, 0); | 1116 | write_audio_gpio(&mix->hp_mute, 0); |
1117 | write_audio_gpio(&mix->amp_mute, 0); | 1117 | write_audio_gpio(&mix->amp_mute, 0); |
1118 | big_mdelay(100); | 1118 | msleep(100); |
1119 | } else { | 1119 | } else { |
1120 | DBG("(I) codec normal reset !\n"); | 1120 | DBG("(I) codec normal reset !\n"); |
1121 | 1121 | ||
1122 | write_audio_gpio(&mix->audio_reset, 0); | 1122 | write_audio_gpio(&mix->audio_reset, 0); |
1123 | big_mdelay(200); | 1123 | msleep(200); |
1124 | write_audio_gpio(&mix->audio_reset, 1); | 1124 | write_audio_gpio(&mix->audio_reset, 1); |
1125 | big_mdelay(100); | 1125 | msleep(100); |
1126 | write_audio_gpio(&mix->audio_reset, 0); | 1126 | write_audio_gpio(&mix->audio_reset, 0); |
1127 | big_mdelay(100); | 1127 | msleep(100); |
1128 | } | 1128 | } |
1129 | } | 1129 | } |
1130 | 1130 | ||
diff --git a/sound/sparc/Kconfig b/sound/sparc/Kconfig index 2358df1c45a9..25a8a558ef92 100644 --- a/sound/sparc/Kconfig +++ b/sound/sparc/Kconfig | |||
@@ -7,12 +7,30 @@ config SND_SUN_AMD7930 | |||
7 | tristate "Sun AMD7930" | 7 | tristate "Sun AMD7930" |
8 | depends on SBUS && SND | 8 | depends on SBUS && SND |
9 | select SND_PCM | 9 | select SND_PCM |
10 | help | ||
11 | Say Y here to include support for AMD7930 sound device on Sun. | ||
12 | |||
13 | To compile this driver as a module, choose M here: the module | ||
14 | will be called snd-sun-amd7930. | ||
10 | 15 | ||
11 | # dep_tristate 'Sun DBRI' CONFIG_SND_SUN_DBRI $CONFIG_SND | ||
12 | config SND_SUN_CS4231 | 16 | config SND_SUN_CS4231 |
13 | tristate "Sun CS4231" | 17 | tristate "Sun CS4231" |
14 | depends on SND | 18 | depends on SND |
15 | select SND_PCM | 19 | select SND_PCM |
20 | help | ||
21 | Say Y here to include support for CS4231 sound device on Sun. | ||
16 | 22 | ||
17 | endmenu | 23 | To compile this driver as a module, choose M here: the module |
24 | will be called snd-sun-cs4231. | ||
25 | |||
26 | config SND_SUN_DBRI | ||
27 | tristate "Sun DBRI" | ||
28 | depends on SND && SBUS | ||
29 | select SND_PCM | ||
30 | help | ||
31 | Say Y here to include support for DBRI sound device on Sun. | ||
32 | |||
33 | To compile this driver as a module, choose M here: the module | ||
34 | will be called snd-sun-dbri. | ||
18 | 35 | ||
36 | endmenu | ||
diff --git a/sound/sparc/Makefile b/sound/sparc/Makefile index 6809cc92d276..3cd89c67c2f2 100644 --- a/sound/sparc/Makefile +++ b/sound/sparc/Makefile | |||
@@ -4,9 +4,9 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | snd-sun-amd7930-objs := amd7930.o | 6 | snd-sun-amd7930-objs := amd7930.o |
7 | #snd-sun-dbri-objs := dbri.o | ||
8 | snd-sun-cs4231-objs := cs4231.o | 7 | snd-sun-cs4231-objs := cs4231.o |
8 | snd-sun-dbri-objs := dbri.o | ||
9 | 9 | ||
10 | obj-$(CONFIG_SND_SUN_AMD7930) += snd-sun-amd7930.o | 10 | obj-$(CONFIG_SND_SUN_AMD7930) += snd-sun-amd7930.o |
11 | #obj-$(CONFIG_SND_SUN_DBRI) += snd-sun-dbri.o | ||
12 | obj-$(CONFIG_SND_SUN_CS4231) += snd-sun-cs4231.o | 11 | obj-$(CONFIG_SND_SUN_CS4231) += snd-sun-cs4231.o |
12 | obj-$(CONFIG_SND_SUN_DBRI) += snd-sun-dbri.o | ||
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c new file mode 100644 index 000000000000..941c7b1e7ebb --- /dev/null +++ b/sound/sparc/dbri.c | |||
@@ -0,0 +1,2729 @@ | |||
1 | /* | ||
2 | * Driver for DBRI sound chip found on Sparcs. | ||
3 | * Copyright (C) 2004 Martin Habets (mhabets@users.sourceforge.net) | ||
4 | * | ||
5 | * Based entirely upon drivers/sbus/audio/dbri.c which is: | ||
6 | * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) | ||
7 | * Copyright (C) 1998, 1999 Brent Baccala (baccala@freesoft.org) | ||
8 | * | ||
9 | * This is the lowlevel driver for the DBRI & MMCODEC duo used for ISDN & AUDIO | ||
10 | * on Sun SPARCstation 10, 20, LX and Voyager models. | ||
11 | * | ||
12 | * - DBRI: AT&T T5900FX Dual Basic Rates ISDN Interface. It is a 32 channel | ||
13 | * data time multiplexer with ISDN support (aka T7259) | ||
14 | * Interfaces: SBus,ISDN NT & TE, CHI, 4 bits parallel. | ||
15 | * CHI: (spelled ki) Concentration Highway Interface (AT&T or Intel bus ?). | ||
16 | * Documentation: | ||
17 | * - "STP 4000SBus Dual Basic Rate ISDN (DBRI) Tranceiver" from | ||
18 | * Sparc Technology Business (courtesy of Sun Support) | ||
19 | * - Data sheet of the T7903, a newer but very similar ISA bus equivalent | ||
20 | * available from the Lucent (formarly AT&T microelectronics) home | ||
21 | * page. | ||
22 | * - http://www.freesoft.org/Linux/DBRI/ | ||
23 | * - MMCODEC: Crystal Semiconductor CS4215 16 bit Multimedia Audio Codec | ||
24 | * Interfaces: CHI, Audio In & Out, 2 bits parallel | ||
25 | * Documentation: from the Crystal Semiconductor home page. | ||
26 | * | ||
27 | * The DBRI is a 32 pipe machine, each pipe can transfer some bits between | ||
28 | * memory and a serial device (long pipes, nr 0-15) or between two serial | ||
29 | * devices (short pipes, nr 16-31), or simply send a fixed data to a serial | ||
30 | * device (short pipes). | ||
31 | * A timeslot defines the bit-offset and nr of bits read from a serial device. | ||
32 | * The timeslots are linked to 6 circular lists, one for each direction for | ||
33 | * each serial device (NT,TE,CHI). A timeslot is associated to 1 or 2 pipes | ||
34 | * (the second one is a monitor/tee pipe, valid only for serial input). | ||
35 | * | ||
36 | * The mmcodec is connected via the CHI bus and needs the data & some | ||
37 | * parameters (volume, balance, output selection) timemultiplexed in 8 byte | ||
38 | * chunks. It also has a control mode, which serves for audio format setting. | ||
39 | * | ||
40 | * Looking at the CS4215 data sheet it is easy to set up 2 or 4 codecs on | ||
41 | * the same CHI bus, so I thought perhaps it is possible to use the onboard | ||
42 | * & the speakerbox codec simultanously, giving 2 (not very independent :-) | ||
43 | * audio devices. But the SUN HW group decided against it, at least on my | ||
44 | * LX the speakerbox connector has at least 1 pin missing and 1 wrongly | ||
45 | * connected. | ||
46 | */ | ||
47 | |||
48 | #include <sound/driver.h> | ||
49 | #include <linux/interrupt.h> | ||
50 | #include <linux/delay.h> | ||
51 | |||
52 | #include <sound/core.h> | ||
53 | #include <sound/pcm.h> | ||
54 | #include <sound/pcm_params.h> | ||
55 | #include <sound/info.h> | ||
56 | #include <sound/control.h> | ||
57 | #include <sound/initval.h> | ||
58 | |||
59 | #include <asm/irq.h> | ||
60 | #include <asm/io.h> | ||
61 | #include <asm/sbus.h> | ||
62 | #include <asm/atomic.h> | ||
63 | |||
64 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); | ||
65 | MODULE_DESCRIPTION("Sun DBRI"); | ||
66 | MODULE_LICENSE("GPL"); | ||
67 | MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}"); | ||
68 | |||
69 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | ||
70 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | ||
71 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | ||
72 | |||
73 | module_param_array(index, int, NULL, 0444); | ||
74 | MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard."); | ||
75 | module_param_array(id, charp, NULL, 0444); | ||
76 | MODULE_PARM_DESC(id, "ID string for Sun DBRI soundcard."); | ||
77 | module_param_array(enable, bool, NULL, 0444); | ||
78 | MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard."); | ||
79 | |||
80 | #define DBRI_DEBUG | ||
81 | |||
82 | #define D_INT (1<<0) | ||
83 | #define D_GEN (1<<1) | ||
84 | #define D_CMD (1<<2) | ||
85 | #define D_MM (1<<3) | ||
86 | #define D_USR (1<<4) | ||
87 | #define D_DESC (1<<5) | ||
88 | |||
89 | static int dbri_debug = 0; | ||
90 | module_param(dbri_debug, int, 0444); | ||
91 | MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard."); | ||
92 | |||
93 | #ifdef DBRI_DEBUG | ||
94 | static char *cmds[] = { | ||
95 | "WAIT", "PAUSE", "JUMP", "IIQ", "REX", "SDP", "CDP", "DTS", | ||
96 | "SSP", "CHI", "NT", "TE", "CDEC", "TEST", "CDM", "RESRV" | ||
97 | }; | ||
98 | |||
99 | #define dprintk(a, x...) if(dbri_debug & a) printk(KERN_DEBUG x) | ||
100 | |||
101 | #define DBRI_CMD(cmd, intr, value) ((cmd << 28) | \ | ||
102 | (1 << 27) | \ | ||
103 | value) | ||
104 | #else | ||
105 | #define dprintk(a, x...) | ||
106 | |||
107 | #define DBRI_CMD(cmd, intr, value) ((cmd << 28) | \ | ||
108 | (intr << 27) | \ | ||
109 | value) | ||
110 | #endif /* DBRI_DEBUG */ | ||
111 | |||
112 | /*************************************************************************** | ||
113 | CS4215 specific definitions and structures | ||
114 | ****************************************************************************/ | ||
115 | |||
116 | struct cs4215 { | ||
117 | __u8 data[4]; /* Data mode: Time slots 5-8 */ | ||
118 | __u8 ctrl[4]; /* Ctrl mode: Time slots 1-4 */ | ||
119 | __u8 onboard; | ||
120 | __u8 offset; /* Bit offset from frame sync to time slot 1 */ | ||
121 | volatile __u32 status; | ||
122 | volatile __u32 version; | ||
123 | __u8 precision; /* In bits, either 8 or 16 */ | ||
124 | __u8 channels; /* 1 or 2 */ | ||
125 | }; | ||
126 | |||
127 | /* | ||
128 | * Control mode first | ||
129 | */ | ||
130 | |||
131 | /* Time Slot 1, Status register */ | ||
132 | #define CS4215_CLB (1<<2) /* Control Latch Bit */ | ||
133 | #define CS4215_OLB (1<<3) /* 1: line: 2.0V, speaker 4V */ | ||
134 | /* 0: line: 2.8V, speaker 8V */ | ||
135 | #define CS4215_MLB (1<<4) /* 1: Microphone: 20dB gain disabled */ | ||
136 | #define CS4215_RSRVD_1 (1<<5) | ||
137 | |||
138 | /* Time Slot 2, Data Format Register */ | ||
139 | #define CS4215_DFR_LINEAR16 0 | ||
140 | #define CS4215_DFR_ULAW 1 | ||
141 | #define CS4215_DFR_ALAW 2 | ||
142 | #define CS4215_DFR_LINEAR8 3 | ||
143 | #define CS4215_DFR_STEREO (1<<2) | ||
144 | static struct { | ||
145 | unsigned short freq; | ||
146 | unsigned char xtal; | ||
147 | unsigned char csval; | ||
148 | } CS4215_FREQ[] = { | ||
149 | { 8000, (1 << 4), (0 << 3) }, | ||
150 | { 16000, (1 << 4), (1 << 3) }, | ||
151 | { 27429, (1 << 4), (2 << 3) }, /* Actually 24428.57 */ | ||
152 | { 32000, (1 << 4), (3 << 3) }, | ||
153 | /* { NA, (1 << 4), (4 << 3) }, */ | ||
154 | /* { NA, (1 << 4), (5 << 3) }, */ | ||
155 | { 48000, (1 << 4), (6 << 3) }, | ||
156 | { 9600, (1 << 4), (7 << 3) }, | ||
157 | { 5513, (2 << 4), (0 << 3) }, /* Actually 5512.5 */ | ||
158 | { 11025, (2 << 4), (1 << 3) }, | ||
159 | { 18900, (2 << 4), (2 << 3) }, | ||
160 | { 22050, (2 << 4), (3 << 3) }, | ||
161 | { 37800, (2 << 4), (4 << 3) }, | ||
162 | { 44100, (2 << 4), (5 << 3) }, | ||
163 | { 33075, (2 << 4), (6 << 3) }, | ||
164 | { 6615, (2 << 4), (7 << 3) }, | ||
165 | { 0, 0, 0} | ||
166 | }; | ||
167 | |||
168 | #define CS4215_HPF (1<<7) /* High Pass Filter, 1: Enabled */ | ||
169 | |||
170 | #define CS4215_12_MASK 0xfcbf /* Mask off reserved bits in slot 1 & 2 */ | ||
171 | |||
172 | /* Time Slot 3, Serial Port Control register */ | ||
173 | #define CS4215_XEN (1<<0) /* 0: Enable serial output */ | ||
174 | #define CS4215_XCLK (1<<1) /* 1: Master mode: Generate SCLK */ | ||
175 | #define CS4215_BSEL_64 (0<<2) /* Bitrate: 64 bits per frame */ | ||
176 | #define CS4215_BSEL_128 (1<<2) | ||
177 | #define CS4215_BSEL_256 (2<<2) | ||
178 | #define CS4215_MCK_MAST (0<<4) /* Master clock */ | ||
179 | #define CS4215_MCK_XTL1 (1<<4) /* 24.576 MHz clock source */ | ||
180 | #define CS4215_MCK_XTL2 (2<<4) /* 16.9344 MHz clock source */ | ||
181 | #define CS4215_MCK_CLK1 (3<<4) /* Clockin, 256 x Fs */ | ||
182 | #define CS4215_MCK_CLK2 (4<<4) /* Clockin, see DFR */ | ||
183 | |||
184 | /* Time Slot 4, Test Register */ | ||
185 | #define CS4215_DAD (1<<0) /* 0:Digital-Dig loop, 1:Dig-Analog-Dig loop */ | ||
186 | #define CS4215_ENL (1<<1) /* Enable Loopback Testing */ | ||
187 | |||
188 | /* Time Slot 5, Parallel Port Register */ | ||
189 | /* Read only here and the same as the in data mode */ | ||
190 | |||
191 | /* Time Slot 6, Reserved */ | ||
192 | |||
193 | /* Time Slot 7, Version Register */ | ||
194 | #define CS4215_VERSION_MASK 0xf /* Known versions 0/C, 1/D, 2/E */ | ||
195 | |||
196 | /* Time Slot 8, Reserved */ | ||
197 | |||
198 | /* | ||
199 | * Data mode | ||
200 | */ | ||
201 | /* Time Slot 1-2: Left Channel Data, 2-3: Right Channel Data */ | ||
202 | |||
203 | /* Time Slot 5, Output Setting */ | ||
204 | #define CS4215_LO(v) v /* Left Output Attenuation 0x3f: -94.5 dB */ | ||
205 | #define CS4215_LE (1<<6) /* Line Out Enable */ | ||
206 | #define CS4215_HE (1<<7) /* Headphone Enable */ | ||
207 | |||
208 | /* Time Slot 6, Output Setting */ | ||
209 | #define CS4215_RO(v) v /* Right Output Attenuation 0x3f: -94.5 dB */ | ||
210 | #define CS4215_SE (1<<6) /* Speaker Enable */ | ||
211 | #define CS4215_ADI (1<<7) /* A/D Data Invalid: Busy in calibration */ | ||
212 | |||
213 | /* Time Slot 7, Input Setting */ | ||
214 | #define CS4215_LG(v) v /* Left Gain Setting 0xf: 22.5 dB */ | ||
215 | #define CS4215_IS (1<<4) /* Input Select: 1=Microphone, 0=Line */ | ||
216 | #define CS4215_OVR (1<<5) /* 1: Overrange condition occurred */ | ||
217 | #define CS4215_PIO0 (1<<6) /* Parallel I/O 0 */ | ||
218 | #define CS4215_PIO1 (1<<7) | ||
219 | |||
220 | /* Time Slot 8, Input Setting */ | ||
221 | #define CS4215_RG(v) v /* Right Gain Setting 0xf: 22.5 dB */ | ||
222 | #define CS4215_MA(v) (v<<4) /* Monitor Path Attenuation 0xf: mute */ | ||
223 | |||
224 | /*************************************************************************** | ||
225 | DBRI specific definitions and structures | ||
226 | ****************************************************************************/ | ||
227 | |||
228 | /* DBRI main registers */ | ||
229 | #define REG0 0x00UL /* Status and Control */ | ||
230 | #define REG1 0x04UL /* Mode and Interrupt */ | ||
231 | #define REG2 0x08UL /* Parallel IO */ | ||
232 | #define REG3 0x0cUL /* Test */ | ||
233 | #define REG8 0x20UL /* Command Queue Pointer */ | ||
234 | #define REG9 0x24UL /* Interrupt Queue Pointer */ | ||
235 | |||
236 | #define DBRI_NO_CMDS 64 | ||
237 | #define DBRI_NO_INTS 1 /* Note: the value of this define was | ||
238 | * originally 2. The ringbuffer to store | ||
239 | * interrupts in dma is currently broken. | ||
240 | * This is a temporary fix until the ringbuffer | ||
241 | * is fixed. | ||
242 | */ | ||
243 | #define DBRI_INT_BLK 64 | ||
244 | #define DBRI_NO_DESCS 64 | ||
245 | #define DBRI_NO_PIPES 32 | ||
246 | |||
247 | #define DBRI_MM_ONB 1 | ||
248 | #define DBRI_MM_SB 2 | ||
249 | |||
250 | #define DBRI_REC 0 | ||
251 | #define DBRI_PLAY 1 | ||
252 | #define DBRI_NO_STREAMS 2 | ||
253 | |||
254 | /* One transmit/receive descriptor */ | ||
255 | struct dbri_mem { | ||
256 | volatile __u32 word1; | ||
257 | volatile __u32 ba; /* Transmit/Receive Buffer Address */ | ||
258 | volatile __u32 nda; /* Next Descriptor Address */ | ||
259 | volatile __u32 word4; | ||
260 | }; | ||
261 | |||
262 | /* This structure is in a DMA region where it can accessed by both | ||
263 | * the CPU and the DBRI | ||
264 | */ | ||
265 | struct dbri_dma { | ||
266 | volatile s32 cmd[DBRI_NO_CMDS]; /* Place for commands */ | ||
267 | volatile s32 intr[DBRI_NO_INTS * DBRI_INT_BLK]; /* Interrupt field */ | ||
268 | struct dbri_mem desc[DBRI_NO_DESCS]; /* Xmit/receive descriptors */ | ||
269 | }; | ||
270 | |||
271 | #define dbri_dma_off(member, elem) \ | ||
272 | ((u32)(unsigned long) \ | ||
273 | (&(((struct dbri_dma *)0)->member[elem]))) | ||
274 | |||
275 | enum in_or_out { PIPEinput, PIPEoutput }; | ||
276 | |||
277 | struct dbri_pipe { | ||
278 | u32 sdp; /* SDP command word */ | ||
279 | enum in_or_out direction; | ||
280 | int nextpipe; /* Next pipe in linked list */ | ||
281 | int prevpipe; | ||
282 | int cycle; /* Offset of timeslot (bits) */ | ||
283 | int length; /* Length of timeslot (bits) */ | ||
284 | int first_desc; /* Index of first descriptor */ | ||
285 | int desc; /* Index of active descriptor */ | ||
286 | volatile __u32 *recv_fixed_ptr; /* Ptr to receive fixed data */ | ||
287 | }; | ||
288 | |||
289 | struct dbri_desc { | ||
290 | int inuse; /* Boolean flag */ | ||
291 | int next; /* Index of next desc, or -1 */ | ||
292 | unsigned int len; | ||
293 | }; | ||
294 | |||
295 | /* Per stream (playback or record) information */ | ||
296 | typedef struct dbri_streaminfo { | ||
297 | snd_pcm_substream_t *substream; | ||
298 | u32 dvma_buffer; /* Device view of Alsa DMA buffer */ | ||
299 | int left; /* # of bytes left in DMA buffer */ | ||
300 | int size; /* Size of DMA buffer */ | ||
301 | size_t offset; /* offset in user buffer */ | ||
302 | int pipe; /* Data pipe used */ | ||
303 | int left_gain; /* mixer elements */ | ||
304 | int right_gain; | ||
305 | int balance; | ||
306 | } dbri_streaminfo_t; | ||
307 | |||
308 | /* This structure holds the information for both chips (DBRI & CS4215) */ | ||
309 | typedef struct snd_dbri { | ||
310 | snd_card_t *card; /* ALSA card */ | ||
311 | snd_pcm_t *pcm; | ||
312 | |||
313 | int regs_size, irq; /* Needed for unload */ | ||
314 | struct sbus_dev *sdev; /* SBUS device info */ | ||
315 | spinlock_t lock; | ||
316 | |||
317 | volatile struct dbri_dma *dma; /* Pointer to our DMA block */ | ||
318 | u32 dma_dvma; /* DBRI visible DMA address */ | ||
319 | |||
320 | void __iomem *regs; /* dbri HW regs */ | ||
321 | int dbri_version; /* 'e' and up is OK */ | ||
322 | int dbri_irqp; /* intr queue pointer */ | ||
323 | int wait_seen; | ||
324 | |||
325 | struct dbri_pipe pipes[DBRI_NO_PIPES]; /* DBRI's 32 data pipes */ | ||
326 | struct dbri_desc descs[DBRI_NO_DESCS]; | ||
327 | |||
328 | int chi_in_pipe; | ||
329 | int chi_out_pipe; | ||
330 | int chi_bpf; | ||
331 | |||
332 | struct cs4215 mm; /* mmcodec special info */ | ||
333 | /* per stream (playback/record) info */ | ||
334 | struct dbri_streaminfo stream_info[DBRI_NO_STREAMS]; | ||
335 | |||
336 | struct snd_dbri *next; | ||
337 | } snd_dbri_t; | ||
338 | |||
339 | /* Needed for the ALSA macros to work */ | ||
340 | #define chip_t snd_dbri_t | ||
341 | |||
342 | #define DBRI_MAX_VOLUME 63 /* Output volume */ | ||
343 | #define DBRI_MAX_GAIN 15 /* Input gain */ | ||
344 | #define DBRI_RIGHT_BALANCE 255 | ||
345 | #define DBRI_MID_BALANCE (DBRI_RIGHT_BALANCE >> 1) | ||
346 | |||
347 | /* DBRI Reg0 - Status Control Register - defines. (Page 17) */ | ||
348 | #define D_P (1<<15) /* Program command & queue pointer valid */ | ||
349 | #define D_G (1<<14) /* Allow 4-Word SBus Burst */ | ||
350 | #define D_S (1<<13) /* Allow 16-Word SBus Burst */ | ||
351 | #define D_E (1<<12) /* Allow 8-Word SBus Burst */ | ||
352 | #define D_X (1<<7) /* Sanity Timer Disable */ | ||
353 | #define D_T (1<<6) /* Permit activation of the TE interface */ | ||
354 | #define D_N (1<<5) /* Permit activation of the NT interface */ | ||
355 | #define D_C (1<<4) /* Permit activation of the CHI interface */ | ||
356 | #define D_F (1<<3) /* Force Sanity Timer Time-Out */ | ||
357 | #define D_D (1<<2) /* Disable Master Mode */ | ||
358 | #define D_H (1<<1) /* Halt for Analysis */ | ||
359 | #define D_R (1<<0) /* Soft Reset */ | ||
360 | |||
361 | /* DBRI Reg1 - Mode and Interrupt Register - defines. (Page 18) */ | ||
362 | #define D_LITTLE_END (1<<8) /* Byte Order */ | ||
363 | #define D_BIG_END (0<<8) /* Byte Order */ | ||
364 | #define D_MRR (1<<4) /* Multiple Error Ack on SBus (readonly) */ | ||
365 | #define D_MLE (1<<3) /* Multiple Late Error on SBus (readonly) */ | ||
366 | #define D_LBG (1<<2) /* Lost Bus Grant on SBus (readonly) */ | ||
367 | #define D_MBE (1<<1) /* Burst Error on SBus (readonly) */ | ||
368 | #define D_IR (1<<0) /* Interrupt Indicator (readonly) */ | ||
369 | |||
370 | /* DBRI Reg2 - Parallel IO Register - defines. (Page 18) */ | ||
371 | #define D_ENPIO3 (1<<7) /* Enable Pin 3 */ | ||
372 | #define D_ENPIO2 (1<<6) /* Enable Pin 2 */ | ||
373 | #define D_ENPIO1 (1<<5) /* Enable Pin 1 */ | ||
374 | #define D_ENPIO0 (1<<4) /* Enable Pin 0 */ | ||
375 | #define D_ENPIO (0xf0) /* Enable all the pins */ | ||
376 | #define D_PIO3 (1<<3) /* Pin 3: 1: Data mode, 0: Ctrl mode */ | ||
377 | #define D_PIO2 (1<<2) /* Pin 2: 1: Onboard PDN */ | ||
378 | #define D_PIO1 (1<<1) /* Pin 1: 0: Reset */ | ||
379 | #define D_PIO0 (1<<0) /* Pin 0: 1: Speakerbox PDN */ | ||
380 | |||
381 | /* DBRI Commands (Page 20) */ | ||
382 | #define D_WAIT 0x0 /* Stop execution */ | ||
383 | #define D_PAUSE 0x1 /* Flush long pipes */ | ||
384 | #define D_JUMP 0x2 /* New command queue */ | ||
385 | #define D_IIQ 0x3 /* Initialize Interrupt Queue */ | ||
386 | #define D_REX 0x4 /* Report command execution via interrupt */ | ||
387 | #define D_SDP 0x5 /* Setup Data Pipe */ | ||
388 | #define D_CDP 0x6 /* Continue Data Pipe (reread NULL Pointer) */ | ||
389 | #define D_DTS 0x7 /* Define Time Slot */ | ||
390 | #define D_SSP 0x8 /* Set short Data Pipe */ | ||
391 | #define D_CHI 0x9 /* Set CHI Global Mode */ | ||
392 | #define D_NT 0xa /* NT Command */ | ||
393 | #define D_TE 0xb /* TE Command */ | ||
394 | #define D_CDEC 0xc /* Codec setup */ | ||
395 | #define D_TEST 0xd /* No comment */ | ||
396 | #define D_CDM 0xe /* CHI Data mode command */ | ||
397 | |||
398 | /* Special bits for some commands */ | ||
399 | #define D_PIPE(v) ((v)<<0) /* Pipe Nr: 0-15 long, 16-21 short */ | ||
400 | |||
401 | /* Setup Data Pipe */ | ||
402 | /* IRM */ | ||
403 | #define D_SDP_2SAME (1<<18) /* Report 2nd time in a row value rcvd */ | ||
404 | #define D_SDP_CHANGE (2<<18) /* Report any changes */ | ||
405 | #define D_SDP_EVERY (3<<18) /* Report any changes */ | ||
406 | #define D_SDP_EOL (1<<17) /* EOL interrupt enable */ | ||
407 | #define D_SDP_IDLE (1<<16) /* HDLC idle interrupt enable */ | ||
408 | |||
409 | /* Pipe data MODE */ | ||
410 | #define D_SDP_MEM (0<<13) /* To/from memory */ | ||
411 | #define D_SDP_HDLC (2<<13) | ||
412 | #define D_SDP_HDLC_D (3<<13) /* D Channel (prio control) */ | ||
413 | #define D_SDP_SER (4<<13) /* Serial to serial */ | ||
414 | #define D_SDP_FIXED (6<<13) /* Short only */ | ||
415 | #define D_SDP_MODE(v) ((v)&(7<<13)) | ||
416 | |||
417 | #define D_SDP_TO_SER (1<<12) /* Direction */ | ||
418 | #define D_SDP_FROM_SER (0<<12) /* Direction */ | ||
419 | #define D_SDP_MSB (1<<11) /* Bit order within Byte */ | ||
420 | #define D_SDP_LSB (0<<11) /* Bit order within Byte */ | ||
421 | #define D_SDP_P (1<<10) /* Pointer Valid */ | ||
422 | #define D_SDP_A (1<<8) /* Abort */ | ||
423 | #define D_SDP_C (1<<7) /* Clear */ | ||
424 | |||
425 | /* Define Time Slot */ | ||
426 | #define D_DTS_VI (1<<17) /* Valid Input Time-Slot Descriptor */ | ||
427 | #define D_DTS_VO (1<<16) /* Valid Output Time-Slot Descriptor */ | ||
428 | #define D_DTS_INS (1<<15) /* Insert Time Slot */ | ||
429 | #define D_DTS_DEL (0<<15) /* Delete Time Slot */ | ||
430 | #define D_DTS_PRVIN(v) ((v)<<10) /* Previous In Pipe */ | ||
431 | #define D_DTS_PRVOUT(v) ((v)<<5) /* Previous Out Pipe */ | ||
432 | |||
433 | /* Time Slot defines */ | ||
434 | #define D_TS_LEN(v) ((v)<<24) /* Number of bits in this time slot */ | ||
435 | #define D_TS_CYCLE(v) ((v)<<14) /* Bit Count at start of TS */ | ||
436 | #define D_TS_DI (1<<13) /* Data Invert */ | ||
437 | #define D_TS_1CHANNEL (0<<10) /* Single Channel / Normal mode */ | ||
438 | #define D_TS_MONITOR (2<<10) /* Monitor pipe */ | ||
439 | #define D_TS_NONCONTIG (3<<10) /* Non contiguous mode */ | ||
440 | #define D_TS_ANCHOR (7<<10) /* Starting short pipes */ | ||
441 | #define D_TS_MON(v) ((v)<<5) /* Monitor Pipe */ | ||
442 | #define D_TS_NEXT(v) ((v)<<0) /* Pipe Nr: 0-15 long, 16-21 short */ | ||
443 | |||
444 | /* Concentration Highway Interface Modes */ | ||
445 | #define D_CHI_CHICM(v) ((v)<<16) /* Clock mode */ | ||
446 | #define D_CHI_IR (1<<15) /* Immediate Interrupt Report */ | ||
447 | #define D_CHI_EN (1<<14) /* CHIL Interrupt enabled */ | ||
448 | #define D_CHI_OD (1<<13) /* Open Drain Enable */ | ||
449 | #define D_CHI_FE (1<<12) /* Sample CHIFS on Rising Frame Edge */ | ||
450 | #define D_CHI_FD (1<<11) /* Frame Drive */ | ||
451 | #define D_CHI_BPF(v) ((v)<<0) /* Bits per Frame */ | ||
452 | |||
453 | /* NT: These are here for completeness */ | ||
454 | #define D_NT_FBIT (1<<17) /* Frame Bit */ | ||
455 | #define D_NT_NBF (1<<16) /* Number of bad frames to loose framing */ | ||
456 | #define D_NT_IRM_IMM (1<<15) /* Interrupt Report & Mask: Immediate */ | ||
457 | #define D_NT_IRM_EN (1<<14) /* Interrupt Report & Mask: Enable */ | ||
458 | #define D_NT_ISNT (1<<13) /* Configfure interface as NT */ | ||
459 | #define D_NT_FT (1<<12) /* Fixed Timing */ | ||
460 | #define D_NT_EZ (1<<11) /* Echo Channel is Zeros */ | ||
461 | #define D_NT_IFA (1<<10) /* Inhibit Final Activation */ | ||
462 | #define D_NT_ACT (1<<9) /* Activate Interface */ | ||
463 | #define D_NT_MFE (1<<8) /* Multiframe Enable */ | ||
464 | #define D_NT_RLB(v) ((v)<<5) /* Remote Loopback */ | ||
465 | #define D_NT_LLB(v) ((v)<<2) /* Local Loopback */ | ||
466 | #define D_NT_FACT (1<<1) /* Force Activation */ | ||
467 | #define D_NT_ABV (1<<0) /* Activate Bipolar Violation */ | ||
468 | |||
469 | /* Codec Setup */ | ||
470 | #define D_CDEC_CK(v) ((v)<<24) /* Clock Select */ | ||
471 | #define D_CDEC_FED(v) ((v)<<12) /* FSCOD Falling Edge Delay */ | ||
472 | #define D_CDEC_RED(v) ((v)<<0) /* FSCOD Rising Edge Delay */ | ||
473 | |||
474 | /* Test */ | ||
475 | #define D_TEST_RAM(v) ((v)<<16) /* RAM Pointer */ | ||
476 | #define D_TEST_SIZE(v) ((v)<<11) /* */ | ||
477 | #define D_TEST_ROMONOFF 0x5 /* Toggle ROM opcode monitor on/off */ | ||
478 | #define D_TEST_PROC 0x6 /* MicroProcessor test */ | ||
479 | #define D_TEST_SER 0x7 /* Serial-Controller test */ | ||
480 | #define D_TEST_RAMREAD 0x8 /* Copy from Ram to system memory */ | ||
481 | #define D_TEST_RAMWRITE 0x9 /* Copy into Ram from system memory */ | ||
482 | #define D_TEST_RAMBIST 0xa /* RAM Built-In Self Test */ | ||
483 | #define D_TEST_MCBIST 0xb /* Microcontroller Built-In Self Test */ | ||
484 | #define D_TEST_DUMP 0xe /* ROM Dump */ | ||
485 | |||
486 | /* CHI Data Mode */ | ||
487 | #define D_CDM_THI (1<<8) /* Transmit Data on CHIDR Pin */ | ||
488 | #define D_CDM_RHI (1<<7) /* Receive Data on CHIDX Pin */ | ||
489 | #define D_CDM_RCE (1<<6) /* Receive on Rising Edge of CHICK */ | ||
490 | #define D_CDM_XCE (1<<2) /* Transmit Data on Rising Edge of CHICK */ | ||
491 | #define D_CDM_XEN (1<<1) /* Transmit Highway Enable */ | ||
492 | #define D_CDM_REN (1<<0) /* Receive Highway Enable */ | ||
493 | |||
494 | /* The Interrupts */ | ||
495 | #define D_INTR_BRDY 1 /* Buffer Ready for processing */ | ||
496 | #define D_INTR_MINT 2 /* Marked Interrupt in RD/TD */ | ||
497 | #define D_INTR_IBEG 3 /* Flag to idle transition detected (HDLC) */ | ||
498 | #define D_INTR_IEND 4 /* Idle to flag transition detected (HDLC) */ | ||
499 | #define D_INTR_EOL 5 /* End of List */ | ||
500 | #define D_INTR_CMDI 6 /* Command has bean read */ | ||
501 | #define D_INTR_XCMP 8 /* Transmission of frame complete */ | ||
502 | #define D_INTR_SBRI 9 /* BRI status change info */ | ||
503 | #define D_INTR_FXDT 10 /* Fixed data change */ | ||
504 | #define D_INTR_CHIL 11 /* CHI lost frame sync (channel 36 only) */ | ||
505 | #define D_INTR_COLL 11 /* Unrecoverable D-Channel collision */ | ||
506 | #define D_INTR_DBYT 12 /* Dropped by frame slip */ | ||
507 | #define D_INTR_RBYT 13 /* Repeated by frame slip */ | ||
508 | #define D_INTR_LINT 14 /* Lost Interrupt */ | ||
509 | #define D_INTR_UNDR 15 /* DMA underrun */ | ||
510 | |||
511 | #define D_INTR_TE 32 | ||
512 | #define D_INTR_NT 34 | ||
513 | #define D_INTR_CHI 36 | ||
514 | #define D_INTR_CMD 38 | ||
515 | |||
516 | #define D_INTR_GETCHAN(v) (((v)>>24) & 0x3f) | ||
517 | #define D_INTR_GETCODE(v) (((v)>>20) & 0xf) | ||
518 | #define D_INTR_GETCMD(v) (((v)>>16) & 0xf) | ||
519 | #define D_INTR_GETVAL(v) ((v) & 0xffff) | ||
520 | #define D_INTR_GETRVAL(v) ((v) & 0xfffff) | ||
521 | |||
522 | #define D_P_0 0 /* TE receive anchor */ | ||
523 | #define D_P_1 1 /* TE transmit anchor */ | ||
524 | #define D_P_2 2 /* NT transmit anchor */ | ||
525 | #define D_P_3 3 /* NT receive anchor */ | ||
526 | #define D_P_4 4 /* CHI send data */ | ||
527 | #define D_P_5 5 /* CHI receive data */ | ||
528 | #define D_P_6 6 /* */ | ||
529 | #define D_P_7 7 /* */ | ||
530 | #define D_P_8 8 /* */ | ||
531 | #define D_P_9 9 /* */ | ||
532 | #define D_P_10 10 /* */ | ||
533 | #define D_P_11 11 /* */ | ||
534 | #define D_P_12 12 /* */ | ||
535 | #define D_P_13 13 /* */ | ||
536 | #define D_P_14 14 /* */ | ||
537 | #define D_P_15 15 /* */ | ||
538 | #define D_P_16 16 /* CHI anchor pipe */ | ||
539 | #define D_P_17 17 /* CHI send */ | ||
540 | #define D_P_18 18 /* CHI receive */ | ||
541 | #define D_P_19 19 /* CHI receive */ | ||
542 | #define D_P_20 20 /* CHI receive */ | ||
543 | #define D_P_21 21 /* */ | ||
544 | #define D_P_22 22 /* */ | ||
545 | #define D_P_23 23 /* */ | ||
546 | #define D_P_24 24 /* */ | ||
547 | #define D_P_25 25 /* */ | ||
548 | #define D_P_26 26 /* */ | ||
549 | #define D_P_27 27 /* */ | ||
550 | #define D_P_28 28 /* */ | ||
551 | #define D_P_29 29 /* */ | ||
552 | #define D_P_30 30 /* */ | ||
553 | #define D_P_31 31 /* */ | ||
554 | |||
555 | /* Transmit descriptor defines */ | ||
556 | #define DBRI_TD_F (1<<31) /* End of Frame */ | ||
557 | #define DBRI_TD_D (1<<30) /* Do not append CRC */ | ||
558 | #define DBRI_TD_CNT(v) ((v)<<16) /* Number of valid bytes in the buffer */ | ||
559 | #define DBRI_TD_B (1<<15) /* Final interrupt */ | ||
560 | #define DBRI_TD_M (1<<14) /* Marker interrupt */ | ||
561 | #define DBRI_TD_I (1<<13) /* Transmit Idle Characters */ | ||
562 | #define DBRI_TD_FCNT(v) (v) /* Flag Count */ | ||
563 | #define DBRI_TD_UNR (1<<3) /* Underrun: transmitter is out of data */ | ||
564 | #define DBRI_TD_ABT (1<<2) /* Abort: frame aborted */ | ||
565 | #define DBRI_TD_TBC (1<<0) /* Transmit buffer Complete */ | ||
566 | #define DBRI_TD_STATUS(v) ((v)&0xff) /* Transmit status */ | ||
567 | /* Maximum buffer size per TD: almost 8Kb */ | ||
568 | #define DBRI_TD_MAXCNT ((1 << 13) - 1) | ||
569 | |||
570 | /* Receive descriptor defines */ | ||
571 | #define DBRI_RD_F (1<<31) /* End of Frame */ | ||
572 | #define DBRI_RD_C (1<<30) /* Completed buffer */ | ||
573 | #define DBRI_RD_B (1<<15) /* Final interrupt */ | ||
574 | #define DBRI_RD_M (1<<14) /* Marker interrupt */ | ||
575 | #define DBRI_RD_BCNT(v) (v) /* Buffer size */ | ||
576 | #define DBRI_RD_CRC (1<<7) /* 0: CRC is correct */ | ||
577 | #define DBRI_RD_BBC (1<<6) /* 1: Bad Byte received */ | ||
578 | #define DBRI_RD_ABT (1<<5) /* Abort: frame aborted */ | ||
579 | #define DBRI_RD_OVRN (1<<3) /* Overrun: data lost */ | ||
580 | #define DBRI_RD_STATUS(v) ((v)&0xff) /* Receive status */ | ||
581 | #define DBRI_RD_CNT(v) (((v)>>16)&0x1fff) /* Valid bytes in the buffer */ | ||
582 | |||
583 | /* stream_info[] access */ | ||
584 | /* Translate the ALSA direction into the array index */ | ||
585 | #define DBRI_STREAMNO(substream) \ | ||
586 | (substream->stream == \ | ||
587 | SNDRV_PCM_STREAM_PLAYBACK? DBRI_PLAY: DBRI_REC) | ||
588 | |||
589 | /* Return a pointer to dbri_streaminfo */ | ||
590 | #define DBRI_STREAM(dbri, substream) &dbri->stream_info[DBRI_STREAMNO(substream)] | ||
591 | |||
592 | static snd_dbri_t *dbri_list = NULL; /* All DBRI devices */ | ||
593 | |||
594 | /* | ||
595 | * Short data pipes transmit LSB first. The CS4215 receives MSB first. Grrr. | ||
596 | * So we have to reverse the bits. Note: not all bit lengths are supported | ||
597 | */ | ||
598 | static __u32 reverse_bytes(__u32 b, int len) | ||
599 | { | ||
600 | switch (len) { | ||
601 | case 32: | ||
602 | b = ((b & 0xffff0000) >> 16) | ((b & 0x0000ffff) << 16); | ||
603 | case 16: | ||
604 | b = ((b & 0xff00ff00) >> 8) | ((b & 0x00ff00ff) << 8); | ||
605 | case 8: | ||
606 | b = ((b & 0xf0f0f0f0) >> 4) | ((b & 0x0f0f0f0f) << 4); | ||
607 | case 4: | ||
608 | b = ((b & 0xcccccccc) >> 2) | ((b & 0x33333333) << 2); | ||
609 | case 2: | ||
610 | b = ((b & 0xaaaaaaaa) >> 1) | ((b & 0x55555555) << 1); | ||
611 | case 1: | ||
612 | case 0: | ||
613 | break; | ||
614 | default: | ||
615 | printk(KERN_ERR "DBRI reverse_bytes: unsupported length\n"); | ||
616 | }; | ||
617 | |||
618 | return b; | ||
619 | } | ||
620 | |||
621 | /* | ||
622 | **************************************************************************** | ||
623 | ************** DBRI initialization and command synchronization ************* | ||
624 | **************************************************************************** | ||
625 | |||
626 | Commands are sent to the DBRI by building a list of them in memory, | ||
627 | then writing the address of the first list item to DBRI register 8. | ||
628 | The list is terminated with a WAIT command, which can generate a | ||
629 | CPU interrupt if required. | ||
630 | |||
631 | Since the DBRI can run in parallel with the CPU, several means of | ||
632 | synchronization present themselves. The original scheme (Rudolf's) | ||
633 | was to set a flag when we "cmdlock"ed the DBRI, clear the flag when | ||
634 | an interrupt signaled completion, and wait on a wait_queue if a routine | ||
635 | attempted to cmdlock while the flag was set. The problems arose when | ||
636 | we tried to cmdlock from inside an interrupt handler, which might | ||
637 | cause scheduling in an interrupt (if we waited), etc, etc | ||
638 | |||
639 | A more sophisticated scheme might involve a circular command buffer | ||
640 | or an array of command buffers. A routine could fill one with | ||
641 | commands and link it onto a list. When a interrupt signaled | ||
642 | completion of the current command buffer, look on the list for | ||
643 | the next one. | ||
644 | |||
645 | I've decided to implement something much simpler - after each command, | ||
646 | the CPU waits for the DBRI to finish the command by polling the P bit | ||
647 | in DBRI register 0. I've tried to implement this in such a way | ||
648 | that might make implementing a more sophisticated scheme easier. | ||
649 | |||
650 | Every time a routine wants to write commands to the DBRI, it must | ||
651 | first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd | ||
652 | in return. After the commands have been writen, dbri_cmdsend() is | ||
653 | called with the final pointer value. | ||
654 | |||
655 | */ | ||
656 | |||
657 | enum dbri_lock_t { NoGetLock, GetLock }; | ||
658 | |||
659 | static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get) | ||
660 | { | ||
661 | #ifndef SMP | ||
662 | if ((get == GetLock) && spin_is_locked(&dbri->lock)) { | ||
663 | printk(KERN_ERR "DBRI: cmdlock called while in spinlock."); | ||
664 | } | ||
665 | #endif | ||
666 | |||
667 | /*if (get == GetLock) spin_lock(&dbri->lock); */ | ||
668 | return &dbri->dma->cmd[0]; | ||
669 | } | ||
670 | |||
671 | static void dbri_process_interrupt_buffer(snd_dbri_t *); | ||
672 | |||
673 | static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd) | ||
674 | { | ||
675 | int MAXLOOPS = 1000000; | ||
676 | int maxloops = MAXLOOPS; | ||
677 | volatile s32 *ptr; | ||
678 | |||
679 | for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) { | ||
680 | dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr); | ||
681 | } | ||
682 | |||
683 | if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) { | ||
684 | printk("DBRI: Command buffer overflow! (bug in driver)\n"); | ||
685 | /* Ignore the last part. */ | ||
686 | cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3]; | ||
687 | } | ||
688 | |||
689 | *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0); | ||
690 | *(cmd++) = DBRI_CMD(D_WAIT, 1, 0); | ||
691 | dbri->wait_seen = 0; | ||
692 | sbus_writel(dbri->dma_dvma, dbri->regs + REG8); | ||
693 | while ((--maxloops) > 0 && (sbus_readl(dbri->regs + REG0) & D_P)) | ||
694 | barrier(); | ||
695 | if (maxloops == 0) { | ||
696 | printk(KERN_ERR "DBRI: Chip never completed command buffer\n"); | ||
697 | dprintk(D_CMD, "DBRI: Chip never completed command buffer\n"); | ||
698 | } else { | ||
699 | while ((--maxloops) > 0 && (!dbri->wait_seen)) | ||
700 | dbri_process_interrupt_buffer(dbri); | ||
701 | if (maxloops == 0) { | ||
702 | printk(KERN_ERR "DBRI: Chip never acked WAIT\n"); | ||
703 | dprintk(D_CMD, "DBRI: Chip never acked WAIT\n"); | ||
704 | } else { | ||
705 | dprintk(D_CMD, "Chip completed command " | ||
706 | "buffer (%d)\n", MAXLOOPS - maxloops); | ||
707 | } | ||
708 | } | ||
709 | |||
710 | /*spin_unlock(&dbri->lock); */ | ||
711 | } | ||
712 | |||
713 | /* Lock must be held when calling this */ | ||
714 | static void dbri_reset(snd_dbri_t * dbri) | ||
715 | { | ||
716 | int i; | ||
717 | |||
718 | dprintk(D_GEN, "reset 0:%x 2:%x 8:%x 9:%x\n", | ||
719 | sbus_readl(dbri->regs + REG0), | ||
720 | sbus_readl(dbri->regs + REG2), | ||
721 | sbus_readl(dbri->regs + REG8), sbus_readl(dbri->regs + REG9)); | ||
722 | |||
723 | sbus_writel(D_R, dbri->regs + REG0); /* Soft Reset */ | ||
724 | for (i = 0; (sbus_readl(dbri->regs + REG0) & D_R) && i < 64; i++) | ||
725 | udelay(10); | ||
726 | } | ||
727 | |||
728 | /* Lock must not be held before calling this */ | ||
729 | static void dbri_initialize(snd_dbri_t * dbri) | ||
730 | { | ||
731 | volatile s32 *cmd; | ||
732 | u32 dma_addr, tmp; | ||
733 | unsigned long flags; | ||
734 | int n; | ||
735 | |||
736 | spin_lock_irqsave(&dbri->lock, flags); | ||
737 | |||
738 | dbri_reset(dbri); | ||
739 | |||
740 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
741 | dprintk(D_GEN, "init: cmd: %p, int: %p\n", | ||
742 | &dbri->dma->cmd[0], &dbri->dma->intr[0]); | ||
743 | |||
744 | /* | ||
745 | * Initialize the interrupt ringbuffer. | ||
746 | */ | ||
747 | for (n = 0; n < DBRI_NO_INTS - 1; n++) { | ||
748 | dma_addr = dbri->dma_dvma; | ||
749 | dma_addr += dbri_dma_off(intr, ((n + 1) & DBRI_INT_BLK)); | ||
750 | dbri->dma->intr[n * DBRI_INT_BLK] = dma_addr; | ||
751 | } | ||
752 | dma_addr = dbri->dma_dvma + dbri_dma_off(intr, 0); | ||
753 | dbri->dma->intr[n * DBRI_INT_BLK] = dma_addr; | ||
754 | dbri->dbri_irqp = 1; | ||
755 | |||
756 | /* Initialize pipes */ | ||
757 | for (n = 0; n < DBRI_NO_PIPES; n++) | ||
758 | dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1; | ||
759 | |||
760 | /* We should query the openprom to see what burst sizes this | ||
761 | * SBus supports. For now, just disable all SBus bursts */ | ||
762 | tmp = sbus_readl(dbri->regs + REG0); | ||
763 | tmp &= ~(D_G | D_S | D_E); | ||
764 | sbus_writel(tmp, dbri->regs + REG0); | ||
765 | |||
766 | /* | ||
767 | * Set up the interrupt queue | ||
768 | */ | ||
769 | dma_addr = dbri->dma_dvma + dbri_dma_off(intr, 0); | ||
770 | *(cmd++) = DBRI_CMD(D_IIQ, 0, 0); | ||
771 | *(cmd++) = dma_addr; | ||
772 | |||
773 | dbri_cmdsend(dbri, cmd); | ||
774 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
775 | } | ||
776 | |||
777 | /* | ||
778 | **************************************************************************** | ||
779 | ************************** DBRI data pipe management *********************** | ||
780 | **************************************************************************** | ||
781 | |||
782 | While DBRI control functions use the command and interrupt buffers, the | ||
783 | main data path takes the form of data pipes, which can be short (command | ||
784 | and interrupt driven), or long (attached to DMA buffers). These functions | ||
785 | provide a rudimentary means of setting up and managing the DBRI's pipes, | ||
786 | but the calling functions have to make sure they respect the pipes' linked | ||
787 | list ordering, among other things. The transmit and receive functions | ||
788 | here interface closely with the transmit and receive interrupt code. | ||
789 | |||
790 | */ | ||
791 | static int pipe_active(snd_dbri_t * dbri, int pipe) | ||
792 | { | ||
793 | return ((pipe >= 0) && (dbri->pipes[pipe].desc != -1)); | ||
794 | } | ||
795 | |||
796 | /* reset_pipe(dbri, pipe) | ||
797 | * | ||
798 | * Called on an in-use pipe to clear anything being transmitted or received | ||
799 | * Lock must be held before calling this. | ||
800 | */ | ||
801 | static void reset_pipe(snd_dbri_t * dbri, int pipe) | ||
802 | { | ||
803 | int sdp; | ||
804 | int desc; | ||
805 | volatile int *cmd; | ||
806 | |||
807 | if (pipe < 0 || pipe > 31) { | ||
808 | printk("DBRI: reset_pipe called with illegal pipe number\n"); | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | sdp = dbri->pipes[pipe].sdp; | ||
813 | if (sdp == 0) { | ||
814 | printk("DBRI: reset_pipe called on uninitialized pipe\n"); | ||
815 | return; | ||
816 | } | ||
817 | |||
818 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
819 | *(cmd++) = DBRI_CMD(D_SDP, 0, sdp | D_SDP_C | D_SDP_P); | ||
820 | *(cmd++) = 0; | ||
821 | dbri_cmdsend(dbri, cmd); | ||
822 | |||
823 | desc = dbri->pipes[pipe].first_desc; | ||
824 | while (desc != -1) { | ||
825 | dbri->descs[desc].inuse = 0; | ||
826 | desc = dbri->descs[desc].next; | ||
827 | } | ||
828 | |||
829 | dbri->pipes[pipe].desc = -1; | ||
830 | dbri->pipes[pipe].first_desc = -1; | ||
831 | } | ||
832 | |||
833 | /* FIXME: direction as an argument? */ | ||
834 | static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp) | ||
835 | { | ||
836 | if (pipe < 0 || pipe > 31) { | ||
837 | printk("DBRI: setup_pipe called with illegal pipe number\n"); | ||
838 | return; | ||
839 | } | ||
840 | |||
841 | if ((sdp & 0xf800) != sdp) { | ||
842 | printk("DBRI: setup_pipe called with strange SDP value\n"); | ||
843 | /* sdp &= 0xf800; */ | ||
844 | } | ||
845 | |||
846 | /* If this is a fixed receive pipe, arrange for an interrupt | ||
847 | * every time its data changes | ||
848 | */ | ||
849 | if (D_SDP_MODE(sdp) == D_SDP_FIXED && !(sdp & D_SDP_TO_SER)) | ||
850 | sdp |= D_SDP_CHANGE; | ||
851 | |||
852 | sdp |= D_PIPE(pipe); | ||
853 | dbri->pipes[pipe].sdp = sdp; | ||
854 | dbri->pipes[pipe].desc = -1; | ||
855 | dbri->pipes[pipe].first_desc = -1; | ||
856 | if (sdp & D_SDP_TO_SER) | ||
857 | dbri->pipes[pipe].direction = PIPEoutput; | ||
858 | else | ||
859 | dbri->pipes[pipe].direction = PIPEinput; | ||
860 | |||
861 | reset_pipe(dbri, pipe); | ||
862 | } | ||
863 | |||
864 | /* FIXME: direction not needed */ | ||
865 | static void link_time_slot(snd_dbri_t * dbri, int pipe, | ||
866 | enum in_or_out direction, int basepipe, | ||
867 | int length, int cycle) | ||
868 | { | ||
869 | volatile s32 *cmd; | ||
870 | int val; | ||
871 | int prevpipe; | ||
872 | int nextpipe; | ||
873 | |||
874 | if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) { | ||
875 | printk | ||
876 | ("DBRI: link_time_slot called with illegal pipe number\n"); | ||
877 | return; | ||
878 | } | ||
879 | |||
880 | if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) { | ||
881 | printk("DBRI: link_time_slot called on uninitialized pipe\n"); | ||
882 | return; | ||
883 | } | ||
884 | |||
885 | /* Deal with CHI special case: | ||
886 | * "If transmission on edges 0 or 1 is desired, then cycle n | ||
887 | * (where n = # of bit times per frame...) must be used." | ||
888 | * - DBRI data sheet, page 11 | ||
889 | */ | ||
890 | if (basepipe == 16 && direction == PIPEoutput && cycle == 0) | ||
891 | cycle = dbri->chi_bpf; | ||
892 | |||
893 | if (basepipe == pipe) { | ||
894 | prevpipe = pipe; | ||
895 | nextpipe = pipe; | ||
896 | } else { | ||
897 | /* We're not initializing a new linked list (basepipe != pipe), | ||
898 | * so run through the linked list and find where this pipe | ||
899 | * should be sloted in, based on its cycle. CHI confuses | ||
900 | * things a bit, since it has a single anchor for both its | ||
901 | * transmit and receive lists. | ||
902 | */ | ||
903 | if (basepipe == 16) { | ||
904 | if (direction == PIPEinput) { | ||
905 | prevpipe = dbri->chi_in_pipe; | ||
906 | } else { | ||
907 | prevpipe = dbri->chi_out_pipe; | ||
908 | } | ||
909 | } else { | ||
910 | prevpipe = basepipe; | ||
911 | } | ||
912 | |||
913 | nextpipe = dbri->pipes[prevpipe].nextpipe; | ||
914 | |||
915 | while (dbri->pipes[nextpipe].cycle < cycle | ||
916 | && dbri->pipes[nextpipe].nextpipe != basepipe) { | ||
917 | prevpipe = nextpipe; | ||
918 | nextpipe = dbri->pipes[nextpipe].nextpipe; | ||
919 | } | ||
920 | } | ||
921 | |||
922 | if (prevpipe == 16) { | ||
923 | if (direction == PIPEinput) { | ||
924 | dbri->chi_in_pipe = pipe; | ||
925 | } else { | ||
926 | dbri->chi_out_pipe = pipe; | ||
927 | } | ||
928 | } else { | ||
929 | dbri->pipes[prevpipe].nextpipe = pipe; | ||
930 | } | ||
931 | |||
932 | dbri->pipes[pipe].nextpipe = nextpipe; | ||
933 | dbri->pipes[pipe].cycle = cycle; | ||
934 | dbri->pipes[pipe].length = length; | ||
935 | |||
936 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
937 | |||
938 | if (direction == PIPEinput) { | ||
939 | val = D_DTS_VI | D_DTS_INS | D_DTS_PRVIN(prevpipe) | pipe; | ||
940 | *(cmd++) = DBRI_CMD(D_DTS, 0, val); | ||
941 | *(cmd++) = | ||
942 | D_TS_LEN(length) | D_TS_CYCLE(cycle) | D_TS_NEXT(nextpipe); | ||
943 | *(cmd++) = 0; | ||
944 | } else { | ||
945 | val = D_DTS_VO | D_DTS_INS | D_DTS_PRVOUT(prevpipe) | pipe; | ||
946 | *(cmd++) = DBRI_CMD(D_DTS, 0, val); | ||
947 | *(cmd++) = 0; | ||
948 | *(cmd++) = | ||
949 | D_TS_LEN(length) | D_TS_CYCLE(cycle) | D_TS_NEXT(nextpipe); | ||
950 | } | ||
951 | |||
952 | dbri_cmdsend(dbri, cmd); | ||
953 | } | ||
954 | |||
955 | static void unlink_time_slot(snd_dbri_t * dbri, int pipe, | ||
956 | enum in_or_out direction, int prevpipe, | ||
957 | int nextpipe) | ||
958 | { | ||
959 | volatile s32 *cmd; | ||
960 | int val; | ||
961 | |||
962 | if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) { | ||
963 | printk | ||
964 | ("DBRI: unlink_time_slot called with illegal pipe number\n"); | ||
965 | return; | ||
966 | } | ||
967 | |||
968 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
969 | |||
970 | if (direction == PIPEinput) { | ||
971 | val = D_DTS_VI | D_DTS_DEL | D_DTS_PRVIN(prevpipe) | pipe; | ||
972 | *(cmd++) = DBRI_CMD(D_DTS, 0, val); | ||
973 | *(cmd++) = D_TS_NEXT(nextpipe); | ||
974 | *(cmd++) = 0; | ||
975 | } else { | ||
976 | val = D_DTS_VO | D_DTS_DEL | D_DTS_PRVOUT(prevpipe) | pipe; | ||
977 | *(cmd++) = DBRI_CMD(D_DTS, 0, val); | ||
978 | *(cmd++) = 0; | ||
979 | *(cmd++) = D_TS_NEXT(nextpipe); | ||
980 | } | ||
981 | |||
982 | dbri_cmdsend(dbri, cmd); | ||
983 | } | ||
984 | |||
985 | /* xmit_fixed() / recv_fixed() | ||
986 | * | ||
987 | * Transmit/receive data on a "fixed" pipe - i.e, one whose contents are not | ||
988 | * expected to change much, and which we don't need to buffer. | ||
989 | * The DBRI only interrupts us when the data changes (receive pipes), | ||
990 | * or only changes the data when this function is called (transmit pipes). | ||
991 | * Only short pipes (numbers 16-31) can be used in fixed data mode. | ||
992 | * | ||
993 | * These function operate on a 32-bit field, no matter how large | ||
994 | * the actual time slot is. The interrupt handler takes care of bit | ||
995 | * ordering and alignment. An 8-bit time slot will always end up | ||
996 | * in the low-order 8 bits, filled either MSB-first or LSB-first, | ||
997 | * depending on the settings passed to setup_pipe() | ||
998 | */ | ||
999 | static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data) | ||
1000 | { | ||
1001 | volatile s32 *cmd; | ||
1002 | |||
1003 | if (pipe < 16 || pipe > 31) { | ||
1004 | printk("DBRI: xmit_fixed: Illegal pipe number\n"); | ||
1005 | return; | ||
1006 | } | ||
1007 | |||
1008 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) { | ||
1009 | printk("DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe); | ||
1010 | return; | ||
1011 | } | ||
1012 | |||
1013 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { | ||
1014 | printk("DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe); | ||
1015 | return; | ||
1016 | } | ||
1017 | |||
1018 | if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) { | ||
1019 | printk("DBRI: xmit_fixed: Called on receive pipe %d\n", pipe); | ||
1020 | return; | ||
1021 | } | ||
1022 | |||
1023 | /* DBRI short pipes always transmit LSB first */ | ||
1024 | |||
1025 | if (dbri->pipes[pipe].sdp & D_SDP_MSB) | ||
1026 | data = reverse_bytes(data, dbri->pipes[pipe].length); | ||
1027 | |||
1028 | cmd = dbri_cmdlock(dbri, GetLock); | ||
1029 | |||
1030 | *(cmd++) = DBRI_CMD(D_SSP, 0, pipe); | ||
1031 | *(cmd++) = data; | ||
1032 | |||
1033 | dbri_cmdsend(dbri, cmd); | ||
1034 | } | ||
1035 | |||
1036 | static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr) | ||
1037 | { | ||
1038 | if (pipe < 16 || pipe > 31) { | ||
1039 | printk("DBRI: recv_fixed called with illegal pipe number\n"); | ||
1040 | return; | ||
1041 | } | ||
1042 | |||
1043 | if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { | ||
1044 | printk("DBRI: recv_fixed called on non-fixed pipe %d\n", pipe); | ||
1045 | return; | ||
1046 | } | ||
1047 | |||
1048 | if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) { | ||
1049 | printk("DBRI: recv_fixed called on transmit pipe %d\n", pipe); | ||
1050 | return; | ||
1051 | } | ||
1052 | |||
1053 | dbri->pipes[pipe].recv_fixed_ptr = ptr; | ||
1054 | } | ||
1055 | |||
1056 | /* setup_descs() | ||
1057 | * | ||
1058 | * Setup transmit/receive data on a "long" pipe - i.e, one associated | ||
1059 | * with a DMA buffer. | ||
1060 | * | ||
1061 | * Only pipe numbers 0-15 can be used in this mode. | ||
1062 | * | ||
1063 | * This function takes a stream number pointing to a data buffer, | ||
1064 | * and work by building chains of descriptors which identify the | ||
1065 | * data buffers. Buffers too large for a single descriptor will | ||
1066 | * be spread across multiple descriptors. | ||
1067 | */ | ||
1068 | static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period) | ||
1069 | { | ||
1070 | dbri_streaminfo_t *info = &dbri->stream_info[streamno]; | ||
1071 | __u32 dvma_buffer; | ||
1072 | int desc = 0; | ||
1073 | int len; | ||
1074 | int first_desc = -1; | ||
1075 | int last_desc = -1; | ||
1076 | |||
1077 | if (info->pipe < 0 || info->pipe > 15) { | ||
1078 | printk("DBRI: setup_descs: Illegal pipe number\n"); | ||
1079 | return -2; | ||
1080 | } | ||
1081 | |||
1082 | if (dbri->pipes[info->pipe].sdp == 0) { | ||
1083 | printk("DBRI: setup_descs: Uninitialized pipe %d\n", | ||
1084 | info->pipe); | ||
1085 | return -2; | ||
1086 | } | ||
1087 | |||
1088 | dvma_buffer = info->dvma_buffer; | ||
1089 | len = info->size; | ||
1090 | |||
1091 | if (streamno == DBRI_PLAY) { | ||
1092 | if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) { | ||
1093 | printk("DBRI: setup_descs: Called on receive pipe %d\n", | ||
1094 | info->pipe); | ||
1095 | return -2; | ||
1096 | } | ||
1097 | } else { | ||
1098 | if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) { | ||
1099 | printk | ||
1100 | ("DBRI: setup_descs: Called on transmit pipe %d\n", | ||
1101 | info->pipe); | ||
1102 | return -2; | ||
1103 | } | ||
1104 | /* Should be able to queue multiple buffers to receive on a pipe */ | ||
1105 | if (pipe_active(dbri, info->pipe)) { | ||
1106 | printk("DBRI: recv_on_pipe: Called on active pipe %d\n", | ||
1107 | info->pipe); | ||
1108 | return -2; | ||
1109 | } | ||
1110 | |||
1111 | /* Make sure buffer size is multiple of four */ | ||
1112 | len &= ~3; | ||
1113 | } | ||
1114 | |||
1115 | while (len > 0) { | ||
1116 | int mylen; | ||
1117 | |||
1118 | for (; desc < DBRI_NO_DESCS; desc++) { | ||
1119 | if (!dbri->descs[desc].inuse) | ||
1120 | break; | ||
1121 | } | ||
1122 | if (desc == DBRI_NO_DESCS) { | ||
1123 | printk("DBRI: setup_descs: No descriptors\n"); | ||
1124 | return -1; | ||
1125 | } | ||
1126 | |||
1127 | if (len > DBRI_TD_MAXCNT) { | ||
1128 | mylen = DBRI_TD_MAXCNT; /* 8KB - 1 */ | ||
1129 | } else { | ||
1130 | mylen = len; | ||
1131 | } | ||
1132 | if (mylen > period) { | ||
1133 | mylen = period; | ||
1134 | } | ||
1135 | |||
1136 | dbri->descs[desc].inuse = 1; | ||
1137 | dbri->descs[desc].next = -1; | ||
1138 | dbri->dma->desc[desc].ba = dvma_buffer; | ||
1139 | dbri->dma->desc[desc].nda = 0; | ||
1140 | |||
1141 | if (streamno == DBRI_PLAY) { | ||
1142 | dbri->descs[desc].len = mylen; | ||
1143 | dbri->dma->desc[desc].word1 = DBRI_TD_CNT(mylen); | ||
1144 | dbri->dma->desc[desc].word4 = 0; | ||
1145 | if (first_desc != -1) | ||
1146 | dbri->dma->desc[desc].word1 |= DBRI_TD_M; | ||
1147 | } else { | ||
1148 | dbri->descs[desc].len = 0; | ||
1149 | dbri->dma->desc[desc].word1 = 0; | ||
1150 | dbri->dma->desc[desc].word4 = | ||
1151 | DBRI_RD_B | DBRI_RD_BCNT(mylen); | ||
1152 | } | ||
1153 | |||
1154 | if (first_desc == -1) { | ||
1155 | first_desc = desc; | ||
1156 | } else { | ||
1157 | dbri->descs[last_desc].next = desc; | ||
1158 | dbri->dma->desc[last_desc].nda = | ||
1159 | dbri->dma_dvma + dbri_dma_off(desc, desc); | ||
1160 | } | ||
1161 | |||
1162 | last_desc = desc; | ||
1163 | dvma_buffer += mylen; | ||
1164 | len -= mylen; | ||
1165 | } | ||
1166 | |||
1167 | if (first_desc == -1 || last_desc == -1) { | ||
1168 | printk("DBRI: setup_descs: Not enough descriptors available\n"); | ||
1169 | return -1; | ||
1170 | } | ||
1171 | |||
1172 | dbri->dma->desc[last_desc].word1 &= ~DBRI_TD_M; | ||
1173 | if (streamno == DBRI_PLAY) { | ||
1174 | dbri->dma->desc[last_desc].word1 |= | ||
1175 | DBRI_TD_I | DBRI_TD_F | DBRI_TD_B; | ||
1176 | } | ||
1177 | dbri->pipes[info->pipe].first_desc = first_desc; | ||
1178 | dbri->pipes[info->pipe].desc = first_desc; | ||
1179 | |||
1180 | for (desc = first_desc; desc != -1; desc = dbri->descs[desc].next) { | ||
1181 | dprintk(D_DESC, "DESC %d: %08x %08x %08x %08x\n", | ||
1182 | desc, | ||
1183 | dbri->dma->desc[desc].word1, | ||
1184 | dbri->dma->desc[desc].ba, | ||
1185 | dbri->dma->desc[desc].nda, dbri->dma->desc[desc].word4); | ||
1186 | } | ||
1187 | return 0; | ||
1188 | } | ||
1189 | |||
1190 | /* | ||
1191 | **************************************************************************** | ||
1192 | ************************** DBRI - CHI interface **************************** | ||
1193 | **************************************************************************** | ||
1194 | |||
1195 | The CHI is a four-wire (clock, frame sync, data in, data out) time-division | ||
1196 | multiplexed serial interface which the DBRI can operate in either master | ||
1197 | (give clock/frame sync) or slave (take clock/frame sync) mode. | ||
1198 | |||
1199 | */ | ||
1200 | |||
1201 | enum master_or_slave { CHImaster, CHIslave }; | ||
1202 | |||
1203 | static void reset_chi(snd_dbri_t * dbri, enum master_or_slave master_or_slave, | ||
1204 | int bits_per_frame) | ||
1205 | { | ||
1206 | volatile s32 *cmd; | ||
1207 | int val; | ||
1208 | static int chi_initialized = 0; /* FIXME: mutex? */ | ||
1209 | |||
1210 | if (!chi_initialized) { | ||
1211 | |||
1212 | cmd = dbri_cmdlock(dbri, GetLock); | ||
1213 | |||
1214 | /* Set CHI Anchor: Pipe 16 */ | ||
1215 | |||
1216 | val = D_DTS_VI | D_DTS_INS | D_DTS_PRVIN(16) | D_PIPE(16); | ||
1217 | *(cmd++) = DBRI_CMD(D_DTS, 0, val); | ||
1218 | *(cmd++) = D_TS_ANCHOR | D_TS_NEXT(16); | ||
1219 | *(cmd++) = 0; | ||
1220 | |||
1221 | val = D_DTS_VO | D_DTS_INS | D_DTS_PRVOUT(16) | D_PIPE(16); | ||
1222 | *(cmd++) = DBRI_CMD(D_DTS, 0, val); | ||
1223 | *(cmd++) = 0; | ||
1224 | *(cmd++) = D_TS_ANCHOR | D_TS_NEXT(16); | ||
1225 | |||
1226 | dbri->pipes[16].sdp = 1; | ||
1227 | dbri->pipes[16].nextpipe = 16; | ||
1228 | dbri->chi_in_pipe = 16; | ||
1229 | dbri->chi_out_pipe = 16; | ||
1230 | |||
1231 | #if 0 | ||
1232 | chi_initialized++; | ||
1233 | #endif | ||
1234 | } else { | ||
1235 | int pipe; | ||
1236 | |||
1237 | for (pipe = dbri->chi_in_pipe; | ||
1238 | pipe != 16; pipe = dbri->pipes[pipe].nextpipe) { | ||
1239 | unlink_time_slot(dbri, pipe, PIPEinput, | ||
1240 | 16, dbri->pipes[pipe].nextpipe); | ||
1241 | } | ||
1242 | for (pipe = dbri->chi_out_pipe; | ||
1243 | pipe != 16; pipe = dbri->pipes[pipe].nextpipe) { | ||
1244 | unlink_time_slot(dbri, pipe, PIPEoutput, | ||
1245 | 16, dbri->pipes[pipe].nextpipe); | ||
1246 | } | ||
1247 | |||
1248 | dbri->chi_in_pipe = 16; | ||
1249 | dbri->chi_out_pipe = 16; | ||
1250 | |||
1251 | cmd = dbri_cmdlock(dbri, GetLock); | ||
1252 | } | ||
1253 | |||
1254 | if (master_or_slave == CHIslave) { | ||
1255 | /* Setup DBRI for CHI Slave - receive clock, frame sync (FS) | ||
1256 | * | ||
1257 | * CHICM = 0 (slave mode, 8 kHz frame rate) | ||
1258 | * IR = give immediate CHI status interrupt | ||
1259 | * EN = give CHI status interrupt upon change | ||
1260 | */ | ||
1261 | *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(0)); | ||
1262 | } else { | ||
1263 | /* Setup DBRI for CHI Master - generate clock, FS | ||
1264 | * | ||
1265 | * BPF = bits per 8 kHz frame | ||
1266 | * 12.288 MHz / CHICM_divisor = clock rate | ||
1267 | * FD = 1 - drive CHIFS on rising edge of CHICK | ||
1268 | */ | ||
1269 | int clockrate = bits_per_frame * 8; | ||
1270 | int divisor = 12288 / clockrate; | ||
1271 | |||
1272 | if (divisor > 255 || divisor * clockrate != 12288) | ||
1273 | printk("DBRI: illegal bits_per_frame in setup_chi\n"); | ||
1274 | |||
1275 | *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD | ||
1276 | | D_CHI_BPF(bits_per_frame)); | ||
1277 | } | ||
1278 | |||
1279 | dbri->chi_bpf = bits_per_frame; | ||
1280 | |||
1281 | /* CHI Data Mode | ||
1282 | * | ||
1283 | * RCE = 0 - receive on falling edge of CHICK | ||
1284 | * XCE = 1 - transmit on rising edge of CHICK | ||
1285 | * XEN = 1 - enable transmitter | ||
1286 | * REN = 1 - enable receiver | ||
1287 | */ | ||
1288 | |||
1289 | *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0); | ||
1290 | *(cmd++) = DBRI_CMD(D_CDM, 0, D_CDM_XCE | D_CDM_XEN | D_CDM_REN); | ||
1291 | |||
1292 | dbri_cmdsend(dbri, cmd); | ||
1293 | } | ||
1294 | |||
1295 | /* | ||
1296 | **************************************************************************** | ||
1297 | *********************** CS4215 audio codec management ********************** | ||
1298 | **************************************************************************** | ||
1299 | |||
1300 | In the standard SPARC audio configuration, the CS4215 codec is attached | ||
1301 | to the DBRI via the CHI interface and few of the DBRI's PIO pins. | ||
1302 | |||
1303 | */ | ||
1304 | static void cs4215_setup_pipes(snd_dbri_t * dbri) | ||
1305 | { | ||
1306 | /* | ||
1307 | * Data mode: | ||
1308 | * Pipe 4: Send timeslots 1-4 (audio data) | ||
1309 | * Pipe 20: Send timeslots 5-8 (part of ctrl data) | ||
1310 | * Pipe 6: Receive timeslots 1-4 (audio data) | ||
1311 | * Pipe 21: Receive timeslots 6-7. We can only receive 20 bits via | ||
1312 | * interrupt, and the rest of the data (slot 5 and 8) is | ||
1313 | * not relevant for us (only for doublechecking). | ||
1314 | * | ||
1315 | * Control mode: | ||
1316 | * Pipe 17: Send timeslots 1-4 (slots 5-8 are readonly) | ||
1317 | * Pipe 18: Receive timeslot 1 (clb). | ||
1318 | * Pipe 19: Receive timeslot 7 (version). | ||
1319 | */ | ||
1320 | |||
1321 | setup_pipe(dbri, 4, D_SDP_MEM | D_SDP_TO_SER | D_SDP_MSB); | ||
1322 | setup_pipe(dbri, 20, D_SDP_FIXED | D_SDP_TO_SER | D_SDP_MSB); | ||
1323 | setup_pipe(dbri, 6, D_SDP_MEM | D_SDP_FROM_SER | D_SDP_MSB); | ||
1324 | setup_pipe(dbri, 21, D_SDP_FIXED | D_SDP_FROM_SER | D_SDP_MSB); | ||
1325 | |||
1326 | setup_pipe(dbri, 17, D_SDP_FIXED | D_SDP_TO_SER | D_SDP_MSB); | ||
1327 | setup_pipe(dbri, 18, D_SDP_FIXED | D_SDP_FROM_SER | D_SDP_MSB); | ||
1328 | setup_pipe(dbri, 19, D_SDP_FIXED | D_SDP_FROM_SER | D_SDP_MSB); | ||
1329 | } | ||
1330 | |||
1331 | static int cs4215_init_data(struct cs4215 *mm) | ||
1332 | { | ||
1333 | /* | ||
1334 | * No action, memory resetting only. | ||
1335 | * | ||
1336 | * Data Time Slot 5-8 | ||
1337 | * Speaker,Line and Headphone enable. Gain set to the half. | ||
1338 | * Input is mike. | ||
1339 | */ | ||
1340 | mm->data[0] = CS4215_LO(0x20) | CS4215_HE | CS4215_LE; | ||
1341 | mm->data[1] = CS4215_RO(0x20) | CS4215_SE; | ||
1342 | mm->data[2] = CS4215_LG(0x8) | CS4215_IS | CS4215_PIO0 | CS4215_PIO1; | ||
1343 | mm->data[3] = CS4215_RG(0x8) | CS4215_MA(0xf); | ||
1344 | |||
1345 | /* | ||
1346 | * Control Time Slot 1-4 | ||
1347 | * 0: Default I/O voltage scale | ||
1348 | * 1: 8 bit ulaw, 8kHz, mono, high pass filter disabled | ||
1349 | * 2: Serial enable, CHI master, 128 bits per frame, clock 1 | ||
1350 | * 3: Tests disabled | ||
1351 | */ | ||
1352 | mm->ctrl[0] = CS4215_RSRVD_1 | CS4215_MLB; | ||
1353 | mm->ctrl[1] = CS4215_DFR_ULAW | CS4215_FREQ[0].csval; | ||
1354 | mm->ctrl[2] = CS4215_XCLK | CS4215_BSEL_128 | CS4215_FREQ[0].xtal; | ||
1355 | mm->ctrl[3] = 0; | ||
1356 | |||
1357 | mm->status = 0; | ||
1358 | mm->version = 0xff; | ||
1359 | mm->precision = 8; /* For ULAW */ | ||
1360 | mm->channels = 2; | ||
1361 | |||
1362 | return 0; | ||
1363 | } | ||
1364 | |||
1365 | static void cs4215_setdata(snd_dbri_t * dbri, int muted) | ||
1366 | { | ||
1367 | if (muted) { | ||
1368 | dbri->mm.data[0] |= 63; | ||
1369 | dbri->mm.data[1] |= 63; | ||
1370 | dbri->mm.data[2] &= ~15; | ||
1371 | dbri->mm.data[3] &= ~15; | ||
1372 | } else { | ||
1373 | /* Start by setting the playback attenuation. */ | ||
1374 | dbri_streaminfo_t *info = &dbri->stream_info[DBRI_PLAY]; | ||
1375 | int left_gain = info->left_gain % 64; | ||
1376 | int right_gain = info->right_gain % 64; | ||
1377 | |||
1378 | if (info->balance < DBRI_MID_BALANCE) { | ||
1379 | right_gain *= info->balance; | ||
1380 | right_gain /= DBRI_MID_BALANCE; | ||
1381 | } else { | ||
1382 | left_gain *= DBRI_RIGHT_BALANCE - info->balance; | ||
1383 | left_gain /= DBRI_MID_BALANCE; | ||
1384 | } | ||
1385 | |||
1386 | dbri->mm.data[0] &= ~0x3f; /* Reset the volume bits */ | ||
1387 | dbri->mm.data[1] &= ~0x3f; | ||
1388 | dbri->mm.data[0] |= (DBRI_MAX_VOLUME - left_gain); | ||
1389 | dbri->mm.data[1] |= (DBRI_MAX_VOLUME - right_gain); | ||
1390 | |||
1391 | /* Now set the recording gain. */ | ||
1392 | info = &dbri->stream_info[DBRI_REC]; | ||
1393 | left_gain = info->left_gain % 16; | ||
1394 | right_gain = info->right_gain % 16; | ||
1395 | dbri->mm.data[2] |= CS4215_LG(left_gain); | ||
1396 | dbri->mm.data[3] |= CS4215_RG(right_gain); | ||
1397 | } | ||
1398 | |||
1399 | xmit_fixed(dbri, 20, *(int *)dbri->mm.data); | ||
1400 | } | ||
1401 | |||
1402 | /* | ||
1403 | * Set the CS4215 to data mode. | ||
1404 | */ | ||
1405 | static void cs4215_open(snd_dbri_t * dbri) | ||
1406 | { | ||
1407 | int data_width; | ||
1408 | u32 tmp; | ||
1409 | |||
1410 | dprintk(D_MM, "cs4215_open: %d channels, %d bits\n", | ||
1411 | dbri->mm.channels, dbri->mm.precision); | ||
1412 | |||
1413 | /* Temporarily mute outputs, and wait 1/8000 sec (125 us) | ||
1414 | * to make sure this takes. This avoids clicking noises. | ||
1415 | */ | ||
1416 | |||
1417 | cs4215_setdata(dbri, 1); | ||
1418 | udelay(125); | ||
1419 | |||
1420 | /* | ||
1421 | * Data mode: | ||
1422 | * Pipe 4: Send timeslots 1-4 (audio data) | ||
1423 | * Pipe 20: Send timeslots 5-8 (part of ctrl data) | ||
1424 | * Pipe 6: Receive timeslots 1-4 (audio data) | ||
1425 | * Pipe 21: Receive timeslots 6-7. We can only receive 20 bits via | ||
1426 | * interrupt, and the rest of the data (slot 5 and 8) is | ||
1427 | * not relevant for us (only for doublechecking). | ||
1428 | * | ||
1429 | * Just like in control mode, the time slots are all offset by eight | ||
1430 | * bits. The CS4215, it seems, observes TSIN (the delayed signal) | ||
1431 | * even if it's the CHI master. Don't ask me... | ||
1432 | */ | ||
1433 | tmp = sbus_readl(dbri->regs + REG0); | ||
1434 | tmp &= ~(D_C); /* Disable CHI */ | ||
1435 | sbus_writel(tmp, dbri->regs + REG0); | ||
1436 | |||
1437 | /* Switch CS4215 to data mode - set PIO3 to 1 */ | ||
1438 | sbus_writel(D_ENPIO | D_PIO1 | D_PIO3 | | ||
1439 | (dbri->mm.onboard ? D_PIO0 : D_PIO2), dbri->regs + REG2); | ||
1440 | |||
1441 | reset_chi(dbri, CHIslave, 128); | ||
1442 | |||
1443 | /* Note: this next doesn't work for 8-bit stereo, because the two | ||
1444 | * channels would be on timeslots 1 and 3, with 2 and 4 idle. | ||
1445 | * (See CS4215 datasheet Fig 15) | ||
1446 | * | ||
1447 | * DBRI non-contiguous mode would be required to make this work. | ||
1448 | */ | ||
1449 | data_width = dbri->mm.channels * dbri->mm.precision; | ||
1450 | |||
1451 | link_time_slot(dbri, 20, PIPEoutput, 16, 32, dbri->mm.offset + 32); | ||
1452 | link_time_slot(dbri, 4, PIPEoutput, 16, data_width, dbri->mm.offset); | ||
1453 | link_time_slot(dbri, 6, PIPEinput, 16, data_width, dbri->mm.offset); | ||
1454 | link_time_slot(dbri, 21, PIPEinput, 16, 16, dbri->mm.offset + 40); | ||
1455 | |||
1456 | /* FIXME: enable CHI after _setdata? */ | ||
1457 | tmp = sbus_readl(dbri->regs + REG0); | ||
1458 | tmp |= D_C; /* Enable CHI */ | ||
1459 | sbus_writel(tmp, dbri->regs + REG0); | ||
1460 | |||
1461 | cs4215_setdata(dbri, 0); | ||
1462 | } | ||
1463 | |||
1464 | /* | ||
1465 | * Send the control information (i.e. audio format) | ||
1466 | */ | ||
1467 | static int cs4215_setctrl(snd_dbri_t * dbri) | ||
1468 | { | ||
1469 | int i, val; | ||
1470 | u32 tmp; | ||
1471 | |||
1472 | /* FIXME - let the CPU do something useful during these delays */ | ||
1473 | |||
1474 | /* Temporarily mute outputs, and wait 1/8000 sec (125 us) | ||
1475 | * to make sure this takes. This avoids clicking noises. | ||
1476 | */ | ||
1477 | |||
1478 | cs4215_setdata(dbri, 1); | ||
1479 | udelay(125); | ||
1480 | |||
1481 | /* | ||
1482 | * Enable Control mode: Set DBRI's PIO3 (4215's D/~C) to 0, then wait | ||
1483 | * 12 cycles <= 12/(5512.5*64) sec = 34.01 usec | ||
1484 | */ | ||
1485 | val = D_ENPIO | D_PIO1 | (dbri->mm.onboard ? D_PIO0 : D_PIO2); | ||
1486 | sbus_writel(val, dbri->regs + REG2); | ||
1487 | dprintk(D_MM, "cs4215_setctrl: reg2=0x%x\n", val); | ||
1488 | udelay(34); | ||
1489 | |||
1490 | /* In Control mode, the CS4215 is a slave device, so the DBRI must | ||
1491 | * operate as CHI master, supplying clocking and frame synchronization. | ||
1492 | * | ||
1493 | * In Data mode, however, the CS4215 must be CHI master to insure | ||
1494 | * that its data stream is synchronous with its codec. | ||
1495 | * | ||
1496 | * The upshot of all this? We start by putting the DBRI into master | ||
1497 | * mode, program the CS4215 in Control mode, then switch the CS4215 | ||
1498 | * into Data mode and put the DBRI into slave mode. Various timing | ||
1499 | * requirements must be observed along the way. | ||
1500 | * | ||
1501 | * Oh, and one more thing, on a SPARCStation 20 (and maybe | ||
1502 | * others?), the addressing of the CS4215's time slots is | ||
1503 | * offset by eight bits, so we add eight to all the "cycle" | ||
1504 | * values in the Define Time Slot (DTS) commands. This is | ||
1505 | * done in hardware by a TI 248 that delays the DBRI->4215 | ||
1506 | * frame sync signal by eight clock cycles. Anybody know why? | ||
1507 | */ | ||
1508 | tmp = sbus_readl(dbri->regs + REG0); | ||
1509 | tmp &= ~D_C; /* Disable CHI */ | ||
1510 | sbus_writel(tmp, dbri->regs + REG0); | ||
1511 | |||
1512 | reset_chi(dbri, CHImaster, 128); | ||
1513 | |||
1514 | /* | ||
1515 | * Control mode: | ||
1516 | * Pipe 17: Send timeslots 1-4 (slots 5-8 are readonly) | ||
1517 | * Pipe 18: Receive timeslot 1 (clb). | ||
1518 | * Pipe 19: Receive timeslot 7 (version). | ||
1519 | */ | ||
1520 | |||
1521 | link_time_slot(dbri, 17, PIPEoutput, 16, 32, dbri->mm.offset); | ||
1522 | link_time_slot(dbri, 18, PIPEinput, 16, 8, dbri->mm.offset); | ||
1523 | link_time_slot(dbri, 19, PIPEinput, 16, 8, dbri->mm.offset + 48); | ||
1524 | |||
1525 | /* Wait for the chip to echo back CLB (Control Latch Bit) as zero */ | ||
1526 | dbri->mm.ctrl[0] &= ~CS4215_CLB; | ||
1527 | xmit_fixed(dbri, 17, *(int *)dbri->mm.ctrl); | ||
1528 | |||
1529 | tmp = sbus_readl(dbri->regs + REG0); | ||
1530 | tmp |= D_C; /* Enable CHI */ | ||
1531 | sbus_writel(tmp, dbri->regs + REG0); | ||
1532 | |||
1533 | for (i = 64; ((dbri->mm.status & 0xe4) != 0x20); --i) { | ||
1534 | udelay(125); | ||
1535 | } | ||
1536 | if (i == 0) { | ||
1537 | dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n", | ||
1538 | dbri->mm.status); | ||
1539 | return -1; | ||
1540 | } | ||
1541 | |||
1542 | /* Disable changes to our copy of the version number, as we are about | ||
1543 | * to leave control mode. | ||
1544 | */ | ||
1545 | recv_fixed(dbri, 19, NULL); | ||
1546 | |||
1547 | /* Terminate CS4215 control mode - data sheet says | ||
1548 | * "Set CLB=1 and send two more frames of valid control info" | ||
1549 | */ | ||
1550 | dbri->mm.ctrl[0] |= CS4215_CLB; | ||
1551 | xmit_fixed(dbri, 17, *(int *)dbri->mm.ctrl); | ||
1552 | |||
1553 | /* Two frames of control info @ 8kHz frame rate = 250 us delay */ | ||
1554 | udelay(250); | ||
1555 | |||
1556 | cs4215_setdata(dbri, 0); | ||
1557 | |||
1558 | return 0; | ||
1559 | } | ||
1560 | |||
1561 | /* | ||
1562 | * Setup the codec with the sampling rate, audio format and number of | ||
1563 | * channels. | ||
1564 | * As part of the process we resend the settings for the data | ||
1565 | * timeslots as well. | ||
1566 | */ | ||
1567 | static int cs4215_prepare(snd_dbri_t * dbri, unsigned int rate, | ||
1568 | snd_pcm_format_t format, unsigned int channels) | ||
1569 | { | ||
1570 | int freq_idx; | ||
1571 | int ret = 0; | ||
1572 | |||
1573 | /* Lookup index for this rate */ | ||
1574 | for (freq_idx = 0; CS4215_FREQ[freq_idx].freq != 0; freq_idx++) { | ||
1575 | if (CS4215_FREQ[freq_idx].freq == rate) | ||
1576 | break; | ||
1577 | } | ||
1578 | if (CS4215_FREQ[freq_idx].freq != rate) { | ||
1579 | printk(KERN_WARNING "DBRI: Unsupported rate %d Hz\n", rate); | ||
1580 | return -1; | ||
1581 | } | ||
1582 | |||
1583 | switch (format) { | ||
1584 | case SNDRV_PCM_FORMAT_MU_LAW: | ||
1585 | dbri->mm.ctrl[1] = CS4215_DFR_ULAW; | ||
1586 | dbri->mm.precision = 8; | ||
1587 | break; | ||
1588 | case SNDRV_PCM_FORMAT_A_LAW: | ||
1589 | dbri->mm.ctrl[1] = CS4215_DFR_ALAW; | ||
1590 | dbri->mm.precision = 8; | ||
1591 | break; | ||
1592 | case SNDRV_PCM_FORMAT_U8: | ||
1593 | dbri->mm.ctrl[1] = CS4215_DFR_LINEAR8; | ||
1594 | dbri->mm.precision = 8; | ||
1595 | break; | ||
1596 | case SNDRV_PCM_FORMAT_S16_BE: | ||
1597 | dbri->mm.ctrl[1] = CS4215_DFR_LINEAR16; | ||
1598 | dbri->mm.precision = 16; | ||
1599 | break; | ||
1600 | default: | ||
1601 | printk(KERN_WARNING "DBRI: Unsupported format %d\n", format); | ||
1602 | return -1; | ||
1603 | } | ||
1604 | |||
1605 | /* Add rate parameters */ | ||
1606 | dbri->mm.ctrl[1] |= CS4215_FREQ[freq_idx].csval; | ||
1607 | dbri->mm.ctrl[2] = CS4215_XCLK | | ||
1608 | CS4215_BSEL_128 | CS4215_FREQ[freq_idx].xtal; | ||
1609 | |||
1610 | dbri->mm.channels = channels; | ||
1611 | /* Stereo bit: 8 bit stereo not working yet. */ | ||
1612 | if ((channels > 1) && (dbri->mm.precision == 16)) | ||
1613 | dbri->mm.ctrl[1] |= CS4215_DFR_STEREO; | ||
1614 | |||
1615 | ret = cs4215_setctrl(dbri); | ||
1616 | if (ret == 0) | ||
1617 | cs4215_open(dbri); /* set codec to data mode */ | ||
1618 | |||
1619 | return ret; | ||
1620 | } | ||
1621 | |||
1622 | /* | ||
1623 | * | ||
1624 | */ | ||
1625 | static int cs4215_init(snd_dbri_t * dbri) | ||
1626 | { | ||
1627 | u32 reg2 = sbus_readl(dbri->regs + REG2); | ||
1628 | dprintk(D_MM, "cs4215_init: reg2=0x%x\n", reg2); | ||
1629 | |||
1630 | /* Look for the cs4215 chips */ | ||
1631 | if (reg2 & D_PIO2) { | ||
1632 | dprintk(D_MM, "Onboard CS4215 detected\n"); | ||
1633 | dbri->mm.onboard = 1; | ||
1634 | } | ||
1635 | if (reg2 & D_PIO0) { | ||
1636 | dprintk(D_MM, "Speakerbox detected\n"); | ||
1637 | dbri->mm.onboard = 0; | ||
1638 | |||
1639 | if (reg2 & D_PIO2) { | ||
1640 | printk(KERN_INFO "DBRI: Using speakerbox / " | ||
1641 | "ignoring onboard mmcodec.\n"); | ||
1642 | sbus_writel(D_ENPIO2, dbri->regs + REG2); | ||
1643 | } | ||
1644 | } | ||
1645 | |||
1646 | if (!(reg2 & (D_PIO0 | D_PIO2))) { | ||
1647 | printk(KERN_ERR "DBRI: no mmcodec found.\n"); | ||
1648 | return -EIO; | ||
1649 | } | ||
1650 | |||
1651 | cs4215_setup_pipes(dbri); | ||
1652 | |||
1653 | cs4215_init_data(&dbri->mm); | ||
1654 | |||
1655 | /* Enable capture of the status & version timeslots. */ | ||
1656 | recv_fixed(dbri, 18, &dbri->mm.status); | ||
1657 | recv_fixed(dbri, 19, &dbri->mm.version); | ||
1658 | |||
1659 | dbri->mm.offset = dbri->mm.onboard ? 0 : 8; | ||
1660 | if (cs4215_setctrl(dbri) == -1 || dbri->mm.version == 0xff) { | ||
1661 | dprintk(D_MM, "CS4215 failed probe at offset %d\n", | ||
1662 | dbri->mm.offset); | ||
1663 | return -EIO; | ||
1664 | } | ||
1665 | dprintk(D_MM, "Found CS4215 at offset %d\n", dbri->mm.offset); | ||
1666 | |||
1667 | return 0; | ||
1668 | } | ||
1669 | |||
1670 | /* | ||
1671 | **************************************************************************** | ||
1672 | *************************** DBRI interrupt handler ************************* | ||
1673 | **************************************************************************** | ||
1674 | |||
1675 | The DBRI communicates with the CPU mainly via a circular interrupt | ||
1676 | buffer. When an interrupt is signaled, the CPU walks through the | ||
1677 | buffer and calls dbri_process_one_interrupt() for each interrupt word. | ||
1678 | Complicated interrupts are handled by dedicated functions (which | ||
1679 | appear first in this file). Any pending interrupts can be serviced by | ||
1680 | calling dbri_process_interrupt_buffer(), which works even if the CPU's | ||
1681 | interrupts are disabled. This function is used by dbri_cmdsend() | ||
1682 | to make sure we're synced up with the chip after each command sequence, | ||
1683 | even if we're running cli'ed. | ||
1684 | |||
1685 | */ | ||
1686 | |||
1687 | /* xmit_descs() | ||
1688 | * | ||
1689 | * Transmit the current TD's for recording/playing, if needed. | ||
1690 | * For playback, ALSA has filled the DMA memory with new data (we hope). | ||
1691 | */ | ||
1692 | static void xmit_descs(unsigned long data) | ||
1693 | { | ||
1694 | snd_dbri_t *dbri = (snd_dbri_t *) data; | ||
1695 | dbri_streaminfo_t *info; | ||
1696 | volatile s32 *cmd; | ||
1697 | unsigned long flags; | ||
1698 | int first_td; | ||
1699 | |||
1700 | if (dbri == NULL) | ||
1701 | return; /* Disabled */ | ||
1702 | |||
1703 | /* First check the recording stream for buffer overflow */ | ||
1704 | info = &dbri->stream_info[DBRI_REC]; | ||
1705 | spin_lock_irqsave(&dbri->lock, flags); | ||
1706 | |||
1707 | if ((info->left >= info->size) && (info->pipe >= 0)) { | ||
1708 | first_td = dbri->pipes[info->pipe].first_desc; | ||
1709 | |||
1710 | dprintk(D_DESC, "xmit_descs rec @ TD %d\n", first_td); | ||
1711 | |||
1712 | /* Stream could be closed by the time we run. */ | ||
1713 | if (first_td < 0) { | ||
1714 | goto play; | ||
1715 | } | ||
1716 | |||
1717 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
1718 | *(cmd++) = DBRI_CMD(D_SDP, 0, | ||
1719 | dbri->pipes[info->pipe].sdp | ||
1720 | | D_SDP_P | D_SDP_EVERY | D_SDP_C); | ||
1721 | *(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td); | ||
1722 | dbri_cmdsend(dbri, cmd); | ||
1723 | |||
1724 | /* Reset our admin of the pipe & bytes read. */ | ||
1725 | dbri->pipes[info->pipe].desc = first_td; | ||
1726 | info->left = 0; | ||
1727 | } | ||
1728 | |||
1729 | play: | ||
1730 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
1731 | |||
1732 | /* Now check the playback stream for buffer underflow */ | ||
1733 | info = &dbri->stream_info[DBRI_PLAY]; | ||
1734 | spin_lock_irqsave(&dbri->lock, flags); | ||
1735 | |||
1736 | if ((info->left <= 0) && (info->pipe >= 0)) { | ||
1737 | first_td = dbri->pipes[info->pipe].first_desc; | ||
1738 | |||
1739 | dprintk(D_DESC, "xmit_descs play @ TD %d\n", first_td); | ||
1740 | |||
1741 | /* Stream could be closed by the time we run. */ | ||
1742 | if (first_td < 0) { | ||
1743 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
1744 | return; | ||
1745 | } | ||
1746 | |||
1747 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
1748 | *(cmd++) = DBRI_CMD(D_SDP, 0, | ||
1749 | dbri->pipes[info->pipe].sdp | ||
1750 | | D_SDP_P | D_SDP_EVERY | D_SDP_C); | ||
1751 | *(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td); | ||
1752 | dbri_cmdsend(dbri, cmd); | ||
1753 | |||
1754 | /* Reset our admin of the pipe & bytes written. */ | ||
1755 | dbri->pipes[info->pipe].desc = first_td; | ||
1756 | info->left = info->size; | ||
1757 | } | ||
1758 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
1759 | } | ||
1760 | |||
1761 | DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0); | ||
1762 | |||
1763 | /* transmission_complete_intr() | ||
1764 | * | ||
1765 | * Called by main interrupt handler when DBRI signals transmission complete | ||
1766 | * on a pipe (interrupt triggered by the B bit in a transmit descriptor). | ||
1767 | * | ||
1768 | * Walks through the pipe's list of transmit buffer descriptors, releasing | ||
1769 | * each one's DMA buffer (if present), flagging the descriptor available, | ||
1770 | * and signaling its callback routine (if present), before proceeding | ||
1771 | * to the next one. Stops when the first descriptor is found without | ||
1772 | * TBC (Transmit Buffer Complete) set, or we've run through them all. | ||
1773 | */ | ||
1774 | |||
1775 | static void transmission_complete_intr(snd_dbri_t * dbri, int pipe) | ||
1776 | { | ||
1777 | dbri_streaminfo_t *info; | ||
1778 | int td; | ||
1779 | int status; | ||
1780 | |||
1781 | info = &dbri->stream_info[DBRI_PLAY]; | ||
1782 | |||
1783 | td = dbri->pipes[pipe].desc; | ||
1784 | while (td >= 0) { | ||
1785 | if (td >= DBRI_NO_DESCS) { | ||
1786 | printk(KERN_ERR "DBRI: invalid td on pipe %d\n", pipe); | ||
1787 | return; | ||
1788 | } | ||
1789 | |||
1790 | status = DBRI_TD_STATUS(dbri->dma->desc[td].word4); | ||
1791 | if (!(status & DBRI_TD_TBC)) { | ||
1792 | break; | ||
1793 | } | ||
1794 | |||
1795 | dprintk(D_INT, "TD %d, status 0x%02x\n", td, status); | ||
1796 | |||
1797 | dbri->dma->desc[td].word4 = 0; /* Reset it for next time. */ | ||
1798 | info->offset += dbri->descs[td].len; | ||
1799 | info->left -= dbri->descs[td].len; | ||
1800 | |||
1801 | /* On the last TD, transmit them all again. */ | ||
1802 | if (dbri->descs[td].next == -1) { | ||
1803 | if (info->left > 0) { | ||
1804 | printk(KERN_WARNING | ||
1805 | "%d bytes left after last transfer.\n", | ||
1806 | info->left); | ||
1807 | info->left = 0; | ||
1808 | } | ||
1809 | tasklet_schedule(&xmit_descs_task); | ||
1810 | } | ||
1811 | |||
1812 | td = dbri->descs[td].next; | ||
1813 | dbri->pipes[pipe].desc = td; | ||
1814 | } | ||
1815 | |||
1816 | /* Notify ALSA */ | ||
1817 | if (spin_is_locked(&dbri->lock)) { | ||
1818 | spin_unlock(&dbri->lock); | ||
1819 | snd_pcm_period_elapsed(info->substream); | ||
1820 | spin_lock(&dbri->lock); | ||
1821 | } else | ||
1822 | snd_pcm_period_elapsed(info->substream); | ||
1823 | } | ||
1824 | |||
1825 | static void reception_complete_intr(snd_dbri_t * dbri, int pipe) | ||
1826 | { | ||
1827 | dbri_streaminfo_t *info; | ||
1828 | int rd = dbri->pipes[pipe].desc; | ||
1829 | s32 status; | ||
1830 | |||
1831 | if (rd < 0 || rd >= DBRI_NO_DESCS) { | ||
1832 | printk(KERN_ERR "DBRI: invalid rd on pipe %d\n", pipe); | ||
1833 | return; | ||
1834 | } | ||
1835 | |||
1836 | dbri->descs[rd].inuse = 0; | ||
1837 | dbri->pipes[pipe].desc = dbri->descs[rd].next; | ||
1838 | status = dbri->dma->desc[rd].word1; | ||
1839 | dbri->dma->desc[rd].word1 = 0; /* Reset it for next time. */ | ||
1840 | |||
1841 | info = &dbri->stream_info[DBRI_REC]; | ||
1842 | info->offset += DBRI_RD_CNT(status); | ||
1843 | info->left += DBRI_RD_CNT(status); | ||
1844 | |||
1845 | /* FIXME: Check status */ | ||
1846 | |||
1847 | dprintk(D_INT, "Recv RD %d, status 0x%02x, len %d\n", | ||
1848 | rd, DBRI_RD_STATUS(status), DBRI_RD_CNT(status)); | ||
1849 | |||
1850 | /* On the last TD, transmit them all again. */ | ||
1851 | if (dbri->descs[rd].next == -1) { | ||
1852 | if (info->left > info->size) { | ||
1853 | printk(KERN_WARNING | ||
1854 | "%d bytes recorded in %d size buffer.\n", | ||
1855 | info->left, info->size); | ||
1856 | } | ||
1857 | tasklet_schedule(&xmit_descs_task); | ||
1858 | } | ||
1859 | |||
1860 | /* Notify ALSA */ | ||
1861 | if (spin_is_locked(&dbri->lock)) { | ||
1862 | spin_unlock(&dbri->lock); | ||
1863 | snd_pcm_period_elapsed(info->substream); | ||
1864 | spin_lock(&dbri->lock); | ||
1865 | } else | ||
1866 | snd_pcm_period_elapsed(info->substream); | ||
1867 | } | ||
1868 | |||
1869 | static void dbri_process_one_interrupt(snd_dbri_t * dbri, int x) | ||
1870 | { | ||
1871 | int val = D_INTR_GETVAL(x); | ||
1872 | int channel = D_INTR_GETCHAN(x); | ||
1873 | int command = D_INTR_GETCMD(x); | ||
1874 | int code = D_INTR_GETCODE(x); | ||
1875 | #ifdef DBRI_DEBUG | ||
1876 | int rval = D_INTR_GETRVAL(x); | ||
1877 | #endif | ||
1878 | |||
1879 | if (channel == D_INTR_CMD) { | ||
1880 | dprintk(D_CMD, "INTR: Command: %-5s Value:%d\n", | ||
1881 | cmds[command], val); | ||
1882 | } else { | ||
1883 | dprintk(D_INT, "INTR: Chan:%d Code:%d Val:%#x\n", | ||
1884 | channel, code, rval); | ||
1885 | } | ||
1886 | |||
1887 | if (channel == D_INTR_CMD && command == D_WAIT) { | ||
1888 | dbri->wait_seen++; | ||
1889 | return; | ||
1890 | } | ||
1891 | |||
1892 | switch (code) { | ||
1893 | case D_INTR_BRDY: | ||
1894 | reception_complete_intr(dbri, channel); | ||
1895 | break; | ||
1896 | case D_INTR_XCMP: | ||
1897 | case D_INTR_MINT: | ||
1898 | transmission_complete_intr(dbri, channel); | ||
1899 | break; | ||
1900 | case D_INTR_UNDR: | ||
1901 | /* UNDR - Transmission underrun | ||
1902 | * resend SDP command with clear pipe bit (C) set | ||
1903 | */ | ||
1904 | { | ||
1905 | volatile s32 *cmd; | ||
1906 | |||
1907 | int pipe = channel; | ||
1908 | int td = dbri->pipes[pipe].desc; | ||
1909 | |||
1910 | dbri->dma->desc[td].word4 = 0; | ||
1911 | cmd = dbri_cmdlock(dbri, NoGetLock); | ||
1912 | *(cmd++) = DBRI_CMD(D_SDP, 0, | ||
1913 | dbri->pipes[pipe].sdp | ||
1914 | | D_SDP_P | D_SDP_C | D_SDP_2SAME); | ||
1915 | *(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, td); | ||
1916 | dbri_cmdsend(dbri, cmd); | ||
1917 | } | ||
1918 | break; | ||
1919 | case D_INTR_FXDT: | ||
1920 | /* FXDT - Fixed data change */ | ||
1921 | if (dbri->pipes[channel].sdp & D_SDP_MSB) | ||
1922 | val = reverse_bytes(val, dbri->pipes[channel].length); | ||
1923 | |||
1924 | if (dbri->pipes[channel].recv_fixed_ptr) | ||
1925 | *(dbri->pipes[channel].recv_fixed_ptr) = val; | ||
1926 | break; | ||
1927 | default: | ||
1928 | if (channel != D_INTR_CMD) | ||
1929 | printk(KERN_WARNING | ||
1930 | "DBRI: Ignored Interrupt: %d (0x%x)\n", code, x); | ||
1931 | } | ||
1932 | } | ||
1933 | |||
1934 | /* dbri_process_interrupt_buffer advances through the DBRI's interrupt | ||
1935 | * buffer until it finds a zero word (indicating nothing more to do | ||
1936 | * right now). Non-zero words require processing and are handed off | ||
1937 | * to dbri_process_one_interrupt AFTER advancing the pointer. This | ||
1938 | * order is important since we might recurse back into this function | ||
1939 | * and need to make sure the pointer has been advanced first. | ||
1940 | */ | ||
1941 | static void dbri_process_interrupt_buffer(snd_dbri_t * dbri) | ||
1942 | { | ||
1943 | s32 x; | ||
1944 | |||
1945 | while ((x = dbri->dma->intr[dbri->dbri_irqp]) != 0) { | ||
1946 | dbri->dma->intr[dbri->dbri_irqp] = 0; | ||
1947 | dbri->dbri_irqp++; | ||
1948 | if (dbri->dbri_irqp == (DBRI_NO_INTS * DBRI_INT_BLK)) | ||
1949 | dbri->dbri_irqp = 1; | ||
1950 | else if ((dbri->dbri_irqp & (DBRI_INT_BLK - 1)) == 0) | ||
1951 | dbri->dbri_irqp++; | ||
1952 | |||
1953 | dbri_process_one_interrupt(dbri, x); | ||
1954 | } | ||
1955 | } | ||
1956 | |||
1957 | static irqreturn_t snd_dbri_interrupt(int irq, void *dev_id, | ||
1958 | struct pt_regs *regs) | ||
1959 | { | ||
1960 | snd_dbri_t *dbri = dev_id; | ||
1961 | static int errcnt = 0; | ||
1962 | int x; | ||
1963 | |||
1964 | if (dbri == NULL) | ||
1965 | return IRQ_NONE; | ||
1966 | spin_lock(&dbri->lock); | ||
1967 | |||
1968 | /* | ||
1969 | * Read it, so the interrupt goes away. | ||
1970 | */ | ||
1971 | x = sbus_readl(dbri->regs + REG1); | ||
1972 | |||
1973 | if (x & (D_MRR | D_MLE | D_LBG | D_MBE)) { | ||
1974 | u32 tmp; | ||
1975 | |||
1976 | if (x & D_MRR) | ||
1977 | printk(KERN_ERR | ||
1978 | "DBRI: Multiple Error Ack on SBus reg1=0x%x\n", | ||
1979 | x); | ||
1980 | if (x & D_MLE) | ||
1981 | printk(KERN_ERR | ||
1982 | "DBRI: Multiple Late Error on SBus reg1=0x%x\n", | ||
1983 | x); | ||
1984 | if (x & D_LBG) | ||
1985 | printk(KERN_ERR | ||
1986 | "DBRI: Lost Bus Grant on SBus reg1=0x%x\n", x); | ||
1987 | if (x & D_MBE) | ||
1988 | printk(KERN_ERR | ||
1989 | "DBRI: Burst Error on SBus reg1=0x%x\n", x); | ||
1990 | |||
1991 | /* Some of these SBus errors cause the chip's SBus circuitry | ||
1992 | * to be disabled, so just re-enable and try to keep going. | ||
1993 | * | ||
1994 | * The only one I've seen is MRR, which will be triggered | ||
1995 | * if you let a transmit pipe underrun, then try to CDP it. | ||
1996 | * | ||
1997 | * If these things persist, we should probably reset | ||
1998 | * and re-init the chip. | ||
1999 | */ | ||
2000 | if ((++errcnt) % 10 == 0) { | ||
2001 | dprintk(D_INT, "Interrupt errors exceeded.\n"); | ||
2002 | dbri_reset(dbri); | ||
2003 | } else { | ||
2004 | tmp = sbus_readl(dbri->regs + REG0); | ||
2005 | tmp &= ~(D_D); | ||
2006 | sbus_writel(tmp, dbri->regs + REG0); | ||
2007 | } | ||
2008 | } | ||
2009 | |||
2010 | dbri_process_interrupt_buffer(dbri); | ||
2011 | |||
2012 | /* FIXME: Write 0 into regs to ACK interrupt */ | ||
2013 | |||
2014 | spin_unlock(&dbri->lock); | ||
2015 | |||
2016 | return IRQ_HANDLED; | ||
2017 | } | ||
2018 | |||
2019 | /**************************************************************************** | ||
2020 | PCM Interface | ||
2021 | ****************************************************************************/ | ||
2022 | static snd_pcm_hardware_t snd_dbri_pcm_hw = { | ||
2023 | .info = (SNDRV_PCM_INFO_MMAP | | ||
2024 | SNDRV_PCM_INFO_INTERLEAVED | | ||
2025 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
2026 | SNDRV_PCM_INFO_MMAP_VALID), | ||
2027 | .formats = SNDRV_PCM_FMTBIT_MU_LAW | | ||
2028 | SNDRV_PCM_FMTBIT_A_LAW | | ||
2029 | SNDRV_PCM_FMTBIT_U8 | | ||
2030 | SNDRV_PCM_FMTBIT_S16_BE, | ||
2031 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
2032 | .rate_min = 8000, | ||
2033 | .rate_max = 48000, | ||
2034 | .channels_min = 1, | ||
2035 | .channels_max = 2, | ||
2036 | .buffer_bytes_max = (64 * 1024), | ||
2037 | .period_bytes_min = 1, | ||
2038 | .period_bytes_max = DBRI_TD_MAXCNT, | ||
2039 | .periods_min = 1, | ||
2040 | .periods_max = 1024, | ||
2041 | }; | ||
2042 | |||
2043 | static int snd_dbri_open(snd_pcm_substream_t * substream) | ||
2044 | { | ||
2045 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2046 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
2047 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2048 | unsigned long flags; | ||
2049 | |||
2050 | dprintk(D_USR, "open audio output.\n"); | ||
2051 | runtime->hw = snd_dbri_pcm_hw; | ||
2052 | |||
2053 | spin_lock_irqsave(&dbri->lock, flags); | ||
2054 | info->substream = substream; | ||
2055 | info->left = 0; | ||
2056 | info->offset = 0; | ||
2057 | info->dvma_buffer = 0; | ||
2058 | info->pipe = -1; | ||
2059 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
2060 | |||
2061 | cs4215_open(dbri); | ||
2062 | |||
2063 | return 0; | ||
2064 | } | ||
2065 | |||
2066 | static int snd_dbri_close(snd_pcm_substream_t * substream) | ||
2067 | { | ||
2068 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2069 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2070 | |||
2071 | dprintk(D_USR, "close audio output.\n"); | ||
2072 | info->substream = NULL; | ||
2073 | info->left = 0; | ||
2074 | info->offset = 0; | ||
2075 | |||
2076 | return 0; | ||
2077 | } | ||
2078 | |||
2079 | static int snd_dbri_hw_params(snd_pcm_substream_t * substream, | ||
2080 | snd_pcm_hw_params_t * hw_params) | ||
2081 | { | ||
2082 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
2083 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2084 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2085 | int direction; | ||
2086 | int ret; | ||
2087 | |||
2088 | /* set sampling rate, audio format and number of channels */ | ||
2089 | ret = cs4215_prepare(dbri, params_rate(hw_params), | ||
2090 | params_format(hw_params), | ||
2091 | params_channels(hw_params)); | ||
2092 | if (ret != 0) | ||
2093 | return ret; | ||
2094 | |||
2095 | if ((ret = snd_pcm_lib_malloc_pages(substream, | ||
2096 | params_buffer_bytes(hw_params))) < 0) { | ||
2097 | snd_printk(KERN_ERR "malloc_pages failed with %d\n", ret); | ||
2098 | return ret; | ||
2099 | } | ||
2100 | |||
2101 | /* hw_params can get called multiple times. Only map the DMA once. | ||
2102 | */ | ||
2103 | if (info->dvma_buffer == 0) { | ||
2104 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | ||
2105 | direction = SBUS_DMA_TODEVICE; | ||
2106 | else | ||
2107 | direction = SBUS_DMA_FROMDEVICE; | ||
2108 | |||
2109 | info->dvma_buffer = sbus_map_single(dbri->sdev, | ||
2110 | runtime->dma_area, | ||
2111 | params_buffer_bytes(hw_params), | ||
2112 | direction); | ||
2113 | } | ||
2114 | |||
2115 | direction = params_buffer_bytes(hw_params); | ||
2116 | dprintk(D_USR, "hw_params: %d bytes, dvma=%x\n", | ||
2117 | direction, info->dvma_buffer); | ||
2118 | return 0; | ||
2119 | } | ||
2120 | |||
2121 | static int snd_dbri_hw_free(snd_pcm_substream_t * substream) | ||
2122 | { | ||
2123 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2124 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2125 | int direction; | ||
2126 | dprintk(D_USR, "hw_free.\n"); | ||
2127 | |||
2128 | /* hw_free can get called multiple times. Only unmap the DMA once. | ||
2129 | */ | ||
2130 | if (info->dvma_buffer) { | ||
2131 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | ||
2132 | direction = SBUS_DMA_TODEVICE; | ||
2133 | else | ||
2134 | direction = SBUS_DMA_FROMDEVICE; | ||
2135 | |||
2136 | sbus_unmap_single(dbri->sdev, info->dvma_buffer, | ||
2137 | substream->runtime->buffer_size, direction); | ||
2138 | info->dvma_buffer = 0; | ||
2139 | } | ||
2140 | info->pipe = -1; | ||
2141 | |||
2142 | return snd_pcm_lib_free_pages(substream); | ||
2143 | } | ||
2144 | |||
2145 | static int snd_dbri_prepare(snd_pcm_substream_t * substream) | ||
2146 | { | ||
2147 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2148 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2149 | snd_pcm_runtime_t *runtime = substream->runtime; | ||
2150 | int ret; | ||
2151 | |||
2152 | info->size = snd_pcm_lib_buffer_bytes(substream); | ||
2153 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | ||
2154 | info->pipe = 4; /* Send pipe */ | ||
2155 | else { | ||
2156 | info->pipe = 6; /* Receive pipe */ | ||
2157 | info->left = info->size; /* To trigger submittal */ | ||
2158 | } | ||
2159 | |||
2160 | spin_lock_irq(&dbri->lock); | ||
2161 | |||
2162 | /* Setup the all the transmit/receive desciptors to cover the | ||
2163 | * whole DMA buffer. | ||
2164 | */ | ||
2165 | ret = setup_descs(dbri, DBRI_STREAMNO(substream), | ||
2166 | snd_pcm_lib_period_bytes(substream)); | ||
2167 | |||
2168 | runtime->stop_threshold = DBRI_TD_MAXCNT / runtime->channels; | ||
2169 | |||
2170 | spin_unlock_irq(&dbri->lock); | ||
2171 | |||
2172 | dprintk(D_USR, "prepare audio output. %d bytes\n", info->size); | ||
2173 | return ret; | ||
2174 | } | ||
2175 | |||
2176 | static int snd_dbri_trigger(snd_pcm_substream_t * substream, int cmd) | ||
2177 | { | ||
2178 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2179 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2180 | int ret = 0; | ||
2181 | |||
2182 | switch (cmd) { | ||
2183 | case SNDRV_PCM_TRIGGER_START: | ||
2184 | dprintk(D_USR, "start audio, period is %d bytes\n", | ||
2185 | (int)snd_pcm_lib_period_bytes(substream)); | ||
2186 | /* Enable & schedule the tasklet that re-submits the TDs. */ | ||
2187 | xmit_descs_task.data = (unsigned long)dbri; | ||
2188 | tasklet_schedule(&xmit_descs_task); | ||
2189 | break; | ||
2190 | case SNDRV_PCM_TRIGGER_STOP: | ||
2191 | dprintk(D_USR, "stop audio.\n"); | ||
2192 | /* Make the tasklet bail out immediately. */ | ||
2193 | xmit_descs_task.data = 0; | ||
2194 | reset_pipe(dbri, info->pipe); | ||
2195 | break; | ||
2196 | default: | ||
2197 | ret = -EINVAL; | ||
2198 | } | ||
2199 | |||
2200 | return ret; | ||
2201 | } | ||
2202 | |||
2203 | static snd_pcm_uframes_t snd_dbri_pointer(snd_pcm_substream_t * substream) | ||
2204 | { | ||
2205 | snd_dbri_t *dbri = snd_pcm_substream_chip(substream); | ||
2206 | dbri_streaminfo_t *info = DBRI_STREAM(dbri, substream); | ||
2207 | snd_pcm_uframes_t ret; | ||
2208 | |||
2209 | ret = bytes_to_frames(substream->runtime, info->offset) | ||
2210 | % substream->runtime->buffer_size; | ||
2211 | dprintk(D_USR, "I/O pointer: %ld frames, %d bytes left.\n", | ||
2212 | ret, info->left); | ||
2213 | return ret; | ||
2214 | } | ||
2215 | |||
2216 | static snd_pcm_ops_t snd_dbri_ops = { | ||
2217 | .open = snd_dbri_open, | ||
2218 | .close = snd_dbri_close, | ||
2219 | .ioctl = snd_pcm_lib_ioctl, | ||
2220 | .hw_params = snd_dbri_hw_params, | ||
2221 | .hw_free = snd_dbri_hw_free, | ||
2222 | .prepare = snd_dbri_prepare, | ||
2223 | .trigger = snd_dbri_trigger, | ||
2224 | .pointer = snd_dbri_pointer, | ||
2225 | }; | ||
2226 | |||
2227 | static int __devinit snd_dbri_pcm(snd_dbri_t * dbri) | ||
2228 | { | ||
2229 | snd_pcm_t *pcm; | ||
2230 | int err; | ||
2231 | |||
2232 | if ((err = snd_pcm_new(dbri->card, | ||
2233 | /* ID */ "sun_dbri", | ||
2234 | /* device */ 0, | ||
2235 | /* playback count */ 1, | ||
2236 | /* capture count */ 1, &pcm)) < 0) | ||
2237 | return err; | ||
2238 | snd_assert(pcm != NULL, return -EINVAL); | ||
2239 | |||
2240 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_dbri_ops); | ||
2241 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_dbri_ops); | ||
2242 | |||
2243 | pcm->private_data = dbri; | ||
2244 | pcm->info_flags = 0; | ||
2245 | strcpy(pcm->name, dbri->card->shortname); | ||
2246 | dbri->pcm = pcm; | ||
2247 | |||
2248 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, | ||
2249 | SNDRV_DMA_TYPE_CONTINUOUS, | ||
2250 | snd_dma_continuous_data(GFP_KERNEL), | ||
2251 | 64 * 1024, 64 * 1024)) < 0) { | ||
2252 | return err; | ||
2253 | } | ||
2254 | |||
2255 | return 0; | ||
2256 | } | ||
2257 | |||
2258 | /***************************************************************************** | ||
2259 | Mixer interface | ||
2260 | *****************************************************************************/ | ||
2261 | |||
2262 | static int snd_cs4215_info_volume(snd_kcontrol_t * kcontrol, | ||
2263 | snd_ctl_elem_info_t * uinfo) | ||
2264 | { | ||
2265 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
2266 | uinfo->count = 2; | ||
2267 | uinfo->value.integer.min = 0; | ||
2268 | if (kcontrol->private_value == DBRI_PLAY) { | ||
2269 | uinfo->value.integer.max = DBRI_MAX_VOLUME; | ||
2270 | } else { | ||
2271 | uinfo->value.integer.max = DBRI_MAX_GAIN; | ||
2272 | } | ||
2273 | return 0; | ||
2274 | } | ||
2275 | |||
2276 | static int snd_cs4215_get_volume(snd_kcontrol_t * kcontrol, | ||
2277 | snd_ctl_elem_value_t * ucontrol) | ||
2278 | { | ||
2279 | snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol); | ||
2280 | dbri_streaminfo_t *info; | ||
2281 | snd_assert(dbri != NULL, return -EINVAL); | ||
2282 | info = &dbri->stream_info[kcontrol->private_value]; | ||
2283 | snd_assert(info != NULL, return -EINVAL); | ||
2284 | |||
2285 | ucontrol->value.integer.value[0] = info->left_gain; | ||
2286 | ucontrol->value.integer.value[1] = info->right_gain; | ||
2287 | return 0; | ||
2288 | } | ||
2289 | |||
2290 | static int snd_cs4215_put_volume(snd_kcontrol_t * kcontrol, | ||
2291 | snd_ctl_elem_value_t * ucontrol) | ||
2292 | { | ||
2293 | snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol); | ||
2294 | dbri_streaminfo_t *info = &dbri->stream_info[kcontrol->private_value]; | ||
2295 | unsigned long flags; | ||
2296 | int changed = 0; | ||
2297 | |||
2298 | if (info->left_gain != ucontrol->value.integer.value[0]) { | ||
2299 | info->left_gain = ucontrol->value.integer.value[0]; | ||
2300 | changed = 1; | ||
2301 | } | ||
2302 | if (info->right_gain != ucontrol->value.integer.value[1]) { | ||
2303 | info->right_gain = ucontrol->value.integer.value[1]; | ||
2304 | changed = 1; | ||
2305 | } | ||
2306 | if (changed == 1) { | ||
2307 | /* First mute outputs, and wait 1/8000 sec (125 us) | ||
2308 | * to make sure this takes. This avoids clicking noises. | ||
2309 | */ | ||
2310 | spin_lock_irqsave(&dbri->lock, flags); | ||
2311 | |||
2312 | cs4215_setdata(dbri, 1); | ||
2313 | udelay(125); | ||
2314 | cs4215_setdata(dbri, 0); | ||
2315 | |||
2316 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
2317 | } | ||
2318 | return changed; | ||
2319 | } | ||
2320 | |||
2321 | static int snd_cs4215_info_single(snd_kcontrol_t * kcontrol, | ||
2322 | snd_ctl_elem_info_t * uinfo) | ||
2323 | { | ||
2324 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
2325 | |||
2326 | uinfo->type = (mask == 1) ? | ||
2327 | SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
2328 | uinfo->count = 1; | ||
2329 | uinfo->value.integer.min = 0; | ||
2330 | uinfo->value.integer.max = mask; | ||
2331 | return 0; | ||
2332 | } | ||
2333 | |||
2334 | static int snd_cs4215_get_single(snd_kcontrol_t * kcontrol, | ||
2335 | snd_ctl_elem_value_t * ucontrol) | ||
2336 | { | ||
2337 | snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol); | ||
2338 | int elem = kcontrol->private_value & 0xff; | ||
2339 | int shift = (kcontrol->private_value >> 8) & 0xff; | ||
2340 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
2341 | int invert = (kcontrol->private_value >> 24) & 1; | ||
2342 | snd_assert(dbri != NULL, return -EINVAL); | ||
2343 | |||
2344 | if (elem < 4) { | ||
2345 | ucontrol->value.integer.value[0] = | ||
2346 | (dbri->mm.data[elem] >> shift) & mask; | ||
2347 | } else { | ||
2348 | ucontrol->value.integer.value[0] = | ||
2349 | (dbri->mm.ctrl[elem - 4] >> shift) & mask; | ||
2350 | } | ||
2351 | |||
2352 | if (invert == 1) { | ||
2353 | ucontrol->value.integer.value[0] = | ||
2354 | mask - ucontrol->value.integer.value[0]; | ||
2355 | } | ||
2356 | return 0; | ||
2357 | } | ||
2358 | |||
2359 | static int snd_cs4215_put_single(snd_kcontrol_t * kcontrol, | ||
2360 | snd_ctl_elem_value_t * ucontrol) | ||
2361 | { | ||
2362 | snd_dbri_t *dbri = snd_kcontrol_chip(kcontrol); | ||
2363 | unsigned long flags; | ||
2364 | int elem = kcontrol->private_value & 0xff; | ||
2365 | int shift = (kcontrol->private_value >> 8) & 0xff; | ||
2366 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
2367 | int invert = (kcontrol->private_value >> 24) & 1; | ||
2368 | int changed = 0; | ||
2369 | unsigned short val; | ||
2370 | snd_assert(dbri != NULL, return -EINVAL); | ||
2371 | |||
2372 | val = (ucontrol->value.integer.value[0] & mask); | ||
2373 | if (invert == 1) | ||
2374 | val = mask - val; | ||
2375 | val <<= shift; | ||
2376 | |||
2377 | if (elem < 4) { | ||
2378 | dbri->mm.data[elem] = (dbri->mm.data[elem] & | ||
2379 | ~(mask << shift)) | val; | ||
2380 | changed = (val != dbri->mm.data[elem]); | ||
2381 | } else { | ||
2382 | dbri->mm.ctrl[elem - 4] = (dbri->mm.ctrl[elem - 4] & | ||
2383 | ~(mask << shift)) | val; | ||
2384 | changed = (val != dbri->mm.ctrl[elem - 4]); | ||
2385 | } | ||
2386 | |||
2387 | dprintk(D_GEN, "put_single: mask=0x%x, changed=%d, " | ||
2388 | "mixer-value=%ld, mm-value=0x%x\n", | ||
2389 | mask, changed, ucontrol->value.integer.value[0], | ||
2390 | dbri->mm.data[elem & 3]); | ||
2391 | |||
2392 | if (changed) { | ||
2393 | /* First mute outputs, and wait 1/8000 sec (125 us) | ||
2394 | * to make sure this takes. This avoids clicking noises. | ||
2395 | */ | ||
2396 | spin_lock_irqsave(&dbri->lock, flags); | ||
2397 | |||
2398 | cs4215_setdata(dbri, 1); | ||
2399 | udelay(125); | ||
2400 | cs4215_setdata(dbri, 0); | ||
2401 | |||
2402 | spin_unlock_irqrestore(&dbri->lock, flags); | ||
2403 | } | ||
2404 | return changed; | ||
2405 | } | ||
2406 | |||
2407 | /* Entries 0-3 map to the 4 data timeslots, entries 4-7 map to the 4 control | ||
2408 | timeslots. Shift is the bit offset in the timeslot, mask defines the | ||
2409 | number of bits. invert is a boolean for use with attenuation. | ||
2410 | */ | ||
2411 | #define CS4215_SINGLE(xname, entry, shift, mask, invert) \ | ||
2412 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
2413 | .info = snd_cs4215_info_single, \ | ||
2414 | .get = snd_cs4215_get_single, .put = snd_cs4215_put_single, \ | ||
2415 | .private_value = entry | (shift << 8) | (mask << 16) | (invert << 24) }, | ||
2416 | |||
2417 | static snd_kcontrol_new_t dbri_controls[] __devinitdata = { | ||
2418 | { | ||
2419 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2420 | .name = "Playback Volume", | ||
2421 | .info = snd_cs4215_info_volume, | ||
2422 | .get = snd_cs4215_get_volume, | ||
2423 | .put = snd_cs4215_put_volume, | ||
2424 | .private_value = DBRI_PLAY, | ||
2425 | }, | ||
2426 | CS4215_SINGLE("Headphone switch", 0, 7, 1, 0) | ||
2427 | CS4215_SINGLE("Line out switch", 0, 6, 1, 0) | ||
2428 | CS4215_SINGLE("Speaker switch", 1, 6, 1, 0) | ||
2429 | { | ||
2430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2431 | .name = "Capture Volume", | ||
2432 | .info = snd_cs4215_info_volume, | ||
2433 | .get = snd_cs4215_get_volume, | ||
2434 | .put = snd_cs4215_put_volume, | ||
2435 | .private_value = DBRI_REC, | ||
2436 | }, | ||
2437 | /* FIXME: mic/line switch */ | ||
2438 | CS4215_SINGLE("Line in switch", 2, 4, 1, 0) | ||
2439 | CS4215_SINGLE("High Pass Filter switch", 5, 7, 1, 0) | ||
2440 | CS4215_SINGLE("Monitor Volume", 3, 4, 0xf, 1) | ||
2441 | CS4215_SINGLE("Mic boost", 4, 4, 1, 1) | ||
2442 | }; | ||
2443 | |||
2444 | #define NUM_CS4215_CONTROLS (sizeof(dbri_controls)/sizeof(snd_kcontrol_new_t)) | ||
2445 | |||
2446 | static int __init snd_dbri_mixer(snd_dbri_t * dbri) | ||
2447 | { | ||
2448 | snd_card_t *card; | ||
2449 | int idx, err; | ||
2450 | |||
2451 | snd_assert(dbri != NULL && dbri->card != NULL, return -EINVAL); | ||
2452 | |||
2453 | card = dbri->card; | ||
2454 | strcpy(card->mixername, card->shortname); | ||
2455 | |||
2456 | for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) { | ||
2457 | if ((err = snd_ctl_add(card, | ||
2458 | snd_ctl_new1(&dbri_controls[idx], | ||
2459 | dbri))) < 0) | ||
2460 | return err; | ||
2461 | } | ||
2462 | |||
2463 | for (idx = DBRI_REC; idx < DBRI_NO_STREAMS; idx++) { | ||
2464 | dbri->stream_info[idx].left_gain = 0; | ||
2465 | dbri->stream_info[idx].right_gain = 0; | ||
2466 | dbri->stream_info[idx].balance = DBRI_MID_BALANCE; | ||
2467 | } | ||
2468 | |||
2469 | return 0; | ||
2470 | } | ||
2471 | |||
2472 | /**************************************************************************** | ||
2473 | /proc interface | ||
2474 | ****************************************************************************/ | ||
2475 | static void dbri_regs_read(snd_info_entry_t * entry, snd_info_buffer_t * buffer) | ||
2476 | { | ||
2477 | snd_dbri_t *dbri = entry->private_data; | ||
2478 | |||
2479 | snd_iprintf(buffer, "REG0: 0x%x\n", sbus_readl(dbri->regs + REG0)); | ||
2480 | snd_iprintf(buffer, "REG2: 0x%x\n", sbus_readl(dbri->regs + REG2)); | ||
2481 | snd_iprintf(buffer, "REG8: 0x%x\n", sbus_readl(dbri->regs + REG8)); | ||
2482 | snd_iprintf(buffer, "REG9: 0x%x\n", sbus_readl(dbri->regs + REG9)); | ||
2483 | } | ||
2484 | |||
2485 | #ifdef DBRI_DEBUG | ||
2486 | static void dbri_debug_read(snd_info_entry_t * entry, | ||
2487 | snd_info_buffer_t * buffer) | ||
2488 | { | ||
2489 | snd_dbri_t *dbri = entry->private_data; | ||
2490 | int pipe; | ||
2491 | snd_iprintf(buffer, "debug=%d\n", dbri_debug); | ||
2492 | |||
2493 | snd_iprintf(buffer, "CHI pipe in=%d, out=%d\n", | ||
2494 | dbri->chi_in_pipe, dbri->chi_out_pipe); | ||
2495 | for (pipe = 0; pipe < 32; pipe++) { | ||
2496 | if (pipe_active(dbri, pipe)) { | ||
2497 | struct dbri_pipe *pptr = &dbri->pipes[pipe]; | ||
2498 | snd_iprintf(buffer, | ||
2499 | "Pipe %d: %s SDP=0x%x desc=%d, " | ||
2500 | "len=%d @ %d prev: %d next %d\n", | ||
2501 | pipe, | ||
2502 | (pptr->direction == | ||
2503 | PIPEinput ? "input" : "output"), pptr->sdp, | ||
2504 | pptr->desc, pptr->length, pptr->cycle, | ||
2505 | pptr->prevpipe, pptr->nextpipe); | ||
2506 | } | ||
2507 | } | ||
2508 | } | ||
2509 | |||
2510 | static void dbri_debug_write(snd_info_entry_t * entry, | ||
2511 | snd_info_buffer_t * buffer) | ||
2512 | { | ||
2513 | char line[80]; | ||
2514 | int i; | ||
2515 | |||
2516 | if (snd_info_get_line(buffer, line, 80) == 0) { | ||
2517 | sscanf(line, "%d\n", &i); | ||
2518 | dbri_debug = i & 0x3f; | ||
2519 | } | ||
2520 | } | ||
2521 | #endif | ||
2522 | |||
2523 | void snd_dbri_proc(snd_dbri_t * dbri) | ||
2524 | { | ||
2525 | snd_info_entry_t *entry; | ||
2526 | int err; | ||
2527 | |||
2528 | err = snd_card_proc_new(dbri->card, "regs", &entry); | ||
2529 | snd_info_set_text_ops(entry, dbri, 1024, dbri_regs_read); | ||
2530 | |||
2531 | #ifdef DBRI_DEBUG | ||
2532 | err = snd_card_proc_new(dbri->card, "debug", &entry); | ||
2533 | snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read); | ||
2534 | entry->mode = S_IFREG | S_IRUGO | S_IWUSR; /* Writable for root */ | ||
2535 | entry->c.text.write_size = 256; | ||
2536 | entry->c.text.write = dbri_debug_write; | ||
2537 | #endif | ||
2538 | } | ||
2539 | |||
2540 | /* | ||
2541 | **************************************************************************** | ||
2542 | **************************** Initialization ******************************** | ||
2543 | **************************************************************************** | ||
2544 | */ | ||
2545 | static void snd_dbri_free(snd_dbri_t * dbri); | ||
2546 | |||
2547 | static int __init snd_dbri_create(snd_card_t * card, | ||
2548 | struct sbus_dev *sdev, | ||
2549 | struct linux_prom_irqs *irq, int dev) | ||
2550 | { | ||
2551 | snd_dbri_t *dbri = card->private_data; | ||
2552 | int err; | ||
2553 | |||
2554 | spin_lock_init(&dbri->lock); | ||
2555 | dbri->card = card; | ||
2556 | dbri->sdev = sdev; | ||
2557 | dbri->irq = irq->pri; | ||
2558 | dbri->dbri_version = sdev->prom_name[9]; | ||
2559 | |||
2560 | dbri->dma = sbus_alloc_consistent(sdev, sizeof(struct dbri_dma), | ||
2561 | &dbri->dma_dvma); | ||
2562 | memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); | ||
2563 | |||
2564 | dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", | ||
2565 | dbri->dma, dbri->dma_dvma); | ||
2566 | |||
2567 | /* Map the registers into memory. */ | ||
2568 | dbri->regs_size = sdev->reg_addrs[0].reg_size; | ||
2569 | dbri->regs = sbus_ioremap(&sdev->resource[0], 0, | ||
2570 | dbri->regs_size, "DBRI Registers"); | ||
2571 | if (!dbri->regs) { | ||
2572 | printk(KERN_ERR "DBRI: could not allocate registers\n"); | ||
2573 | sbus_free_consistent(sdev, sizeof(struct dbri_dma), | ||
2574 | (void *)dbri->dma, dbri->dma_dvma); | ||
2575 | return -EIO; | ||
2576 | } | ||
2577 | |||
2578 | err = request_irq(dbri->irq, snd_dbri_interrupt, SA_SHIRQ, | ||
2579 | "DBRI audio", dbri); | ||
2580 | if (err) { | ||
2581 | printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); | ||
2582 | sbus_iounmap(dbri->regs, dbri->regs_size); | ||
2583 | sbus_free_consistent(sdev, sizeof(struct dbri_dma), | ||
2584 | (void *)dbri->dma, dbri->dma_dvma); | ||
2585 | return err; | ||
2586 | } | ||
2587 | |||
2588 | /* Do low level initialization of the DBRI and CS4215 chips */ | ||
2589 | dbri_initialize(dbri); | ||
2590 | err = cs4215_init(dbri); | ||
2591 | if (err) { | ||
2592 | snd_dbri_free(dbri); | ||
2593 | return err; | ||
2594 | } | ||
2595 | |||
2596 | dbri->next = dbri_list; | ||
2597 | dbri_list = dbri; | ||
2598 | |||
2599 | return 0; | ||
2600 | } | ||
2601 | |||
2602 | static void snd_dbri_free(snd_dbri_t * dbri) | ||
2603 | { | ||
2604 | dprintk(D_GEN, "snd_dbri_free\n"); | ||
2605 | dbri_reset(dbri); | ||
2606 | |||
2607 | if (dbri->irq) | ||
2608 | free_irq(dbri->irq, dbri); | ||
2609 | |||
2610 | if (dbri->regs) | ||
2611 | sbus_iounmap(dbri->regs, dbri->regs_size); | ||
2612 | |||
2613 | if (dbri->dma) | ||
2614 | sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma), | ||
2615 | (void *)dbri->dma, dbri->dma_dvma); | ||
2616 | } | ||
2617 | |||
2618 | static int __init dbri_attach(int prom_node, struct sbus_dev *sdev) | ||
2619 | { | ||
2620 | snd_dbri_t *dbri; | ||
2621 | struct linux_prom_irqs irq; | ||
2622 | struct resource *rp; | ||
2623 | snd_card_t *card; | ||
2624 | static int dev = 0; | ||
2625 | int err; | ||
2626 | |||
2627 | if (sdev->prom_name[9] < 'e') { | ||
2628 | printk(KERN_ERR "DBRI: unsupported chip version %c found.\n", | ||
2629 | sdev->prom_name[9]); | ||
2630 | return -EIO; | ||
2631 | } | ||
2632 | |||
2633 | if (dev >= SNDRV_CARDS) | ||
2634 | return -ENODEV; | ||
2635 | if (!enable[dev]) { | ||
2636 | dev++; | ||
2637 | return -ENOENT; | ||
2638 | } | ||
2639 | |||
2640 | prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq)); | ||
2641 | |||
2642 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | ||
2643 | sizeof(snd_dbri_t)); | ||
2644 | if (card == NULL) | ||
2645 | return -ENOMEM; | ||
2646 | |||
2647 | strcpy(card->driver, "DBRI"); | ||
2648 | strcpy(card->shortname, "Sun DBRI"); | ||
2649 | rp = &sdev->resource[0]; | ||
2650 | sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s", | ||
2651 | card->shortname, | ||
2652 | rp->flags & 0xffL, rp->start, __irq_itoa(irq.pri)); | ||
2653 | |||
2654 | if ((err = snd_dbri_create(card, sdev, &irq, dev)) < 0) { | ||
2655 | snd_card_free(card); | ||
2656 | return err; | ||
2657 | } | ||
2658 | |||
2659 | dbri = (snd_dbri_t *) card->private_data; | ||
2660 | if ((err = snd_dbri_pcm(dbri)) < 0) { | ||
2661 | snd_dbri_free(dbri); | ||
2662 | snd_card_free(card); | ||
2663 | return err; | ||
2664 | } | ||
2665 | |||
2666 | if ((err = snd_dbri_mixer(dbri)) < 0) { | ||
2667 | snd_dbri_free(dbri); | ||
2668 | snd_card_free(card); | ||
2669 | return err; | ||
2670 | } | ||
2671 | |||
2672 | /* /proc file handling */ | ||
2673 | snd_dbri_proc(dbri); | ||
2674 | |||
2675 | if ((err = snd_card_register(card)) < 0) { | ||
2676 | snd_dbri_free(dbri); | ||
2677 | snd_card_free(card); | ||
2678 | return err; | ||
2679 | } | ||
2680 | |||
2681 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", | ||
2682 | dev, dbri->regs, | ||
2683 | dbri->irq, dbri->dbri_version, dbri->mm.version); | ||
2684 | dev++; | ||
2685 | |||
2686 | return 0; | ||
2687 | } | ||
2688 | |||
2689 | /* Probe for the dbri chip and then attach the driver. */ | ||
2690 | static int __init dbri_init(void) | ||
2691 | { | ||
2692 | struct sbus_bus *sbus; | ||
2693 | struct sbus_dev *sdev; | ||
2694 | int found = 0; | ||
2695 | |||
2696 | /* Probe each SBUS for the DBRI chip(s). */ | ||
2697 | for_all_sbusdev(sdev, sbus) { | ||
2698 | /* | ||
2699 | * The version is coded in the last character | ||
2700 | */ | ||
2701 | if (!strncmp(sdev->prom_name, "SUNW,DBRI", 9)) { | ||
2702 | dprintk(D_GEN, "DBRI: Found %s in SBUS slot %d\n", | ||
2703 | sdev->prom_name, sdev->slot); | ||
2704 | |||
2705 | if (dbri_attach(sdev->prom_node, sdev) == 0) | ||
2706 | found++; | ||
2707 | } | ||
2708 | } | ||
2709 | |||
2710 | return (found > 0) ? 0 : -EIO; | ||
2711 | } | ||
2712 | |||
2713 | static void __exit dbri_exit(void) | ||
2714 | { | ||
2715 | snd_dbri_t *this = dbri_list; | ||
2716 | |||
2717 | while (this != NULL) { | ||
2718 | snd_dbri_t *next = this->next; | ||
2719 | snd_card_t *card = this->card; | ||
2720 | |||
2721 | snd_dbri_free(this); | ||
2722 | snd_card_free(card); | ||
2723 | this = next; | ||
2724 | } | ||
2725 | dbri_list = NULL; | ||
2726 | } | ||
2727 | |||
2728 | module_init(dbri_init); | ||
2729 | module_exit(dbri_exit); | ||
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index b5e734d975e0..8298c462c291 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -153,6 +153,7 @@ struct snd_usb_substream { | |||
153 | unsigned int format; /* USB data format */ | 153 | unsigned int format; /* USB data format */ |
154 | unsigned int datapipe; /* the data i/o pipe */ | 154 | unsigned int datapipe; /* the data i/o pipe */ |
155 | unsigned int syncpipe; /* 1 - async out or adaptive in */ | 155 | unsigned int syncpipe; /* 1 - async out or adaptive in */ |
156 | unsigned int datainterval; /* log_2 of data packet interval */ | ||
156 | unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */ | 157 | unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */ |
157 | unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ | 158 | unsigned int freqn; /* nominal sampling rate in fs/fps in Q16.16 format */ |
158 | unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ | 159 | unsigned int freqm; /* momentary sampling rate in fs/fps in Q16.16 format */ |
@@ -518,7 +519,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, | |||
518 | if (subs->fill_max) | 519 | if (subs->fill_max) |
519 | counts = subs->maxframesize; /* fixed */ | 520 | counts = subs->maxframesize; /* fixed */ |
520 | else { | 521 | else { |
521 | subs->phase = (subs->phase & 0xffff) + subs->freqm; | 522 | subs->phase = (subs->phase & 0xffff) |
523 | + (subs->freqm << subs->datainterval); | ||
522 | counts = subs->phase >> 16; | 524 | counts = subs->phase >> 16; |
523 | if (counts > subs->maxframesize) | 525 | if (counts > subs->maxframesize) |
524 | counts = subs->maxframesize; | 526 | counts = subs->maxframesize; |
@@ -790,7 +792,7 @@ static int start_urbs(snd_usb_substream_t *subs, snd_pcm_runtime_t *runtime) | |||
790 | */ | 792 | */ |
791 | static int wait_clear_urbs(snd_usb_substream_t *subs) | 793 | static int wait_clear_urbs(snd_usb_substream_t *subs) |
792 | { | 794 | { |
793 | int timeout = HZ; | 795 | unsigned long end_time = jiffies + msecs_to_jiffies(1000); |
794 | unsigned int i; | 796 | unsigned int i; |
795 | int alive; | 797 | int alive; |
796 | 798 | ||
@@ -810,7 +812,7 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) | |||
810 | break; | 812 | break; |
811 | set_current_state(TASK_UNINTERRUPTIBLE); | 813 | set_current_state(TASK_UNINTERRUPTIBLE); |
812 | schedule_timeout(1); | 814 | schedule_timeout(1); |
813 | } while (--timeout > 0); | 815 | } while (time_before(jiffies, end_time)); |
814 | if (alive) | 816 | if (alive) |
815 | snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); | 817 | snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); |
816 | return 0; | 818 | return 0; |
@@ -899,16 +901,19 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
899 | else | 901 | else |
900 | subs->freqn = get_usb_high_speed_rate(rate); | 902 | subs->freqn = get_usb_high_speed_rate(rate); |
901 | subs->freqm = subs->freqn; | 903 | subs->freqm = subs->freqn; |
902 | subs->freqmax = subs->freqn + (subs->freqn >> 2); /* max. allowed frequency */ | 904 | /* calculate max. frequency */ |
903 | subs->phase = 0; | 905 | if (subs->maxpacksize) { |
904 | 906 | /* whatever fits into a max. size packet */ | |
905 | /* calculate the max. size of packet */ | ||
906 | maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) >> 16; | ||
907 | if (subs->maxpacksize && maxsize > subs->maxpacksize) { | ||
908 | //snd_printd(KERN_DEBUG "maxsize %d is greater than defined size %d\n", | ||
909 | // maxsize, subs->maxpacksize); | ||
910 | maxsize = subs->maxpacksize; | 907 | maxsize = subs->maxpacksize; |
908 | subs->freqmax = (maxsize / (frame_bits >> 3)) | ||
909 | << (16 - subs->datainterval); | ||
910 | } else { | ||
911 | /* no max. packet size: just take 25% higher than nominal */ | ||
912 | subs->freqmax = subs->freqn + (subs->freqn >> 2); | ||
913 | maxsize = ((subs->freqmax + 0xffff) * (frame_bits >> 3)) | ||
914 | >> (16 - subs->datainterval); | ||
911 | } | 915 | } |
916 | subs->phase = 0; | ||
912 | 917 | ||
913 | if (subs->fill_max) | 918 | if (subs->fill_max) |
914 | subs->curpacksize = subs->maxpacksize; | 919 | subs->curpacksize = subs->maxpacksize; |
@@ -918,7 +923,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
918 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) | 923 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) |
919 | urb_packs = nrpacks; | 924 | urb_packs = nrpacks; |
920 | else | 925 | else |
921 | urb_packs = nrpacks * 8; | 926 | urb_packs = (nrpacks * 8) >> subs->datainterval; |
922 | 927 | ||
923 | /* allocate a temporary buffer for playback */ | 928 | /* allocate a temporary buffer for playback */ |
924 | if (is_playback) { | 929 | if (is_playback) { |
@@ -991,7 +996,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
991 | u->urb->pipe = subs->datapipe; | 996 | u->urb->pipe = subs->datapipe; |
992 | u->urb->transfer_flags = URB_ISO_ASAP; | 997 | u->urb->transfer_flags = URB_ISO_ASAP; |
993 | u->urb->number_of_packets = u->packets; | 998 | u->urb->number_of_packets = u->packets; |
994 | u->urb->interval = 1; | 999 | u->urb->interval = 1 << subs->datainterval; |
995 | u->urb->context = u; | 1000 | u->urb->context = u; |
996 | u->urb->complete = snd_usb_complete_callback(snd_complete_urb); | 1001 | u->urb->complete = snd_usb_complete_callback(snd_complete_urb); |
997 | } | 1002 | } |
@@ -1195,6 +1200,12 @@ static int set_format(snd_usb_substream_t *subs, struct audioformat *fmt) | |||
1195 | subs->datapipe = usb_sndisocpipe(dev, ep); | 1200 | subs->datapipe = usb_sndisocpipe(dev, ep); |
1196 | else | 1201 | else |
1197 | subs->datapipe = usb_rcvisocpipe(dev, ep); | 1202 | subs->datapipe = usb_rcvisocpipe(dev, ep); |
1203 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH && | ||
1204 | get_endpoint(alts, 0)->bInterval >= 1 && | ||
1205 | get_endpoint(alts, 0)->bInterval <= 4) | ||
1206 | subs->datainterval = get_endpoint(alts, 0)->bInterval - 1; | ||
1207 | else | ||
1208 | subs->datainterval = 0; | ||
1198 | subs->syncpipe = subs->syncinterval = 0; | 1209 | subs->syncpipe = subs->syncinterval = 0; |
1199 | subs->maxpacksize = fmt->maxpacksize; | 1210 | subs->maxpacksize = fmt->maxpacksize; |
1200 | subs->fill_max = 0; | 1211 | subs->fill_max = 0; |
@@ -2397,10 +2408,9 @@ static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp, | |||
2397 | if (chip->usb_id == USB_ID(0x041e, 0x3000) || | 2408 | if (chip->usb_id == USB_ID(0x041e, 0x3000) || |
2398 | chip->usb_id == USB_ID(0x041e, 0x3020)) { | 2409 | chip->usb_id == USB_ID(0x041e, 0x3020)) { |
2399 | if (fmt[3] == USB_FORMAT_TYPE_I && | 2410 | if (fmt[3] == USB_FORMAT_TYPE_I && |
2400 | stream == SNDRV_PCM_STREAM_PLAYBACK && | ||
2401 | fp->rates != SNDRV_PCM_RATE_48000 && | 2411 | fp->rates != SNDRV_PCM_RATE_48000 && |
2402 | fp->rates != SNDRV_PCM_RATE_96000) | 2412 | fp->rates != SNDRV_PCM_RATE_96000) |
2403 | return -1; /* use 48k only */ | 2413 | return -1; |
2404 | } | 2414 | } |
2405 | #endif | 2415 | #endif |
2406 | return 0; | 2416 | return 0; |
@@ -2492,8 +2502,10 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no) | |||
2492 | fp->altset_idx = i; | 2502 | fp->altset_idx = i; |
2493 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; | 2503 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; |
2494 | fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; | 2504 | fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; |
2495 | /* FIXME: decode wMaxPacketSize of high bandwith endpoints */ | ||
2496 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | 2505 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); |
2506 | if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) | ||
2507 | fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) | ||
2508 | * (fp->maxpacksize & 0x7ff); | ||
2497 | fp->attributes = csep[3]; | 2509 | fp->attributes = csep[3]; |
2498 | 2510 | ||
2499 | /* some quirks for attributes here */ | 2511 | /* some quirks for attributes here */ |
@@ -2723,7 +2735,8 @@ static int create_standard_interface_quirk(snd_usb_audio_t *chip, | |||
2723 | * to detect the sample rate is by looking at wMaxPacketSize. | 2735 | * to detect the sample rate is by looking at wMaxPacketSize. |
2724 | */ | 2736 | */ |
2725 | static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, | 2737 | static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, |
2726 | struct usb_interface *iface) | 2738 | struct usb_interface *iface, |
2739 | const snd_usb_audio_quirk_t *quirk) | ||
2727 | { | 2740 | { |
2728 | static const struct audioformat ua_format = { | 2741 | static const struct audioformat ua_format = { |
2729 | .format = SNDRV_PCM_FORMAT_S24_3LE, | 2742 | .format = SNDRV_PCM_FORMAT_S24_3LE, |
@@ -2814,7 +2827,9 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, | |||
2814 | /* | 2827 | /* |
2815 | * Create a stream for an Edirol UA-1000 interface. | 2828 | * Create a stream for an Edirol UA-1000 interface. |
2816 | */ | 2829 | */ |
2817 | static int create_ua1000_quirk(snd_usb_audio_t *chip, struct usb_interface *iface) | 2830 | static int create_ua1000_quirk(snd_usb_audio_t *chip, |
2831 | struct usb_interface *iface, | ||
2832 | const snd_usb_audio_quirk_t *quirk) | ||
2818 | { | 2833 | { |
2819 | static const struct audioformat ua1000_format = { | 2834 | static const struct audioformat ua1000_format = { |
2820 | .format = SNDRV_PCM_FORMAT_S32_LE, | 2835 | .format = SNDRV_PCM_FORMAT_S32_LE, |
@@ -2891,6 +2906,13 @@ static int create_composite_quirk(snd_usb_audio_t *chip, | |||
2891 | return 0; | 2906 | return 0; |
2892 | } | 2907 | } |
2893 | 2908 | ||
2909 | static int ignore_interface_quirk(snd_usb_audio_t *chip, | ||
2910 | struct usb_interface *iface, | ||
2911 | const snd_usb_audio_quirk_t *quirk) | ||
2912 | { | ||
2913 | return 0; | ||
2914 | } | ||
2915 | |||
2894 | 2916 | ||
2895 | /* | 2917 | /* |
2896 | * boot quirks | 2918 | * boot quirks |
@@ -2926,8 +2948,6 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac | |||
2926 | 2948 | ||
2927 | static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) | 2949 | static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) |
2928 | { | 2950 | { |
2929 | #if 0 | ||
2930 | /* TODO: enable this when high speed synchronization actually works */ | ||
2931 | u8 buf = 1; | 2951 | u8 buf = 1; |
2932 | 2952 | ||
2933 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a, | 2953 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a, |
@@ -2939,7 +2959,6 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) | |||
2939 | 1, 2000, NULL, 0, 1000); | 2959 | 1, 2000, NULL, 0, 1000); |
2940 | return -ENODEV; | 2960 | return -ENODEV; |
2941 | } | 2961 | } |
2942 | #endif | ||
2943 | return 0; | 2962 | return 0; |
2944 | } | 2963 | } |
2945 | 2964 | ||
@@ -2956,28 +2975,28 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip, | |||
2956 | struct usb_interface *iface, | 2975 | struct usb_interface *iface, |
2957 | const snd_usb_audio_quirk_t *quirk) | 2976 | const snd_usb_audio_quirk_t *quirk) |
2958 | { | 2977 | { |
2959 | switch (quirk->type) { | 2978 | typedef int (*quirk_func_t)(snd_usb_audio_t *, struct usb_interface *, |
2960 | case QUIRK_MIDI_FIXED_ENDPOINT: | 2979 | const snd_usb_audio_quirk_t *); |
2961 | case QUIRK_MIDI_YAMAHA: | 2980 | static const quirk_func_t quirk_funcs[] = { |
2962 | case QUIRK_MIDI_MIDIMAN: | 2981 | [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, |
2963 | case QUIRK_MIDI_NOVATION: | 2982 | [QUIRK_COMPOSITE] = create_composite_quirk, |
2964 | case QUIRK_MIDI_MOTU: | 2983 | [QUIRK_MIDI_STANDARD_INTERFACE] = snd_usb_create_midi_interface, |
2965 | case QUIRK_MIDI_EMAGIC: | 2984 | [QUIRK_MIDI_FIXED_ENDPOINT] = snd_usb_create_midi_interface, |
2966 | return snd_usb_create_midi_interface(chip, iface, quirk); | 2985 | [QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface, |
2967 | case QUIRK_COMPOSITE: | 2986 | [QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface, |
2968 | return create_composite_quirk(chip, iface, quirk); | 2987 | [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, |
2969 | case QUIRK_AUDIO_FIXED_ENDPOINT: | 2988 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, |
2970 | return create_fixed_stream_quirk(chip, iface, quirk); | 2989 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, |
2971 | case QUIRK_AUDIO_STANDARD_INTERFACE: | 2990 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, |
2972 | case QUIRK_MIDI_STANDARD_INTERFACE: | 2991 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_interface_quirk, |
2973 | return create_standard_interface_quirk(chip, iface, quirk); | 2992 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
2974 | case QUIRK_AUDIO_EDIROL_UA700_UA25: | 2993 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, |
2975 | return create_ua700_ua25_quirk(chip, iface); | 2994 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, |
2976 | case QUIRK_AUDIO_EDIROL_UA1000: | 2995 | }; |
2977 | return create_ua1000_quirk(chip, iface); | 2996 | |
2978 | case QUIRK_IGNORE_INTERFACE: | 2997 | if (quirk->type < QUIRK_TYPE_COUNT) { |
2979 | return 0; | 2998 | return quirk_funcs[quirk->type](chip, iface, quirk); |
2980 | default: | 2999 | } else { |
2981 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | 3000 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); |
2982 | return -ENXIO; | 3001 | return -ENXIO; |
2983 | } | 3002 | } |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index aedb42aaa749..ad9eab211d8f 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -153,20 +153,24 @@ struct snd_usb_audio { | |||
153 | #define QUIRK_NO_INTERFACE -2 | 153 | #define QUIRK_NO_INTERFACE -2 |
154 | #define QUIRK_ANY_INTERFACE -1 | 154 | #define QUIRK_ANY_INTERFACE -1 |
155 | 155 | ||
156 | /* quirk type */ | 156 | enum quirk_type { |
157 | #define QUIRK_MIDI_FIXED_ENDPOINT 0 | 157 | QUIRK_IGNORE_INTERFACE, |
158 | #define QUIRK_MIDI_YAMAHA 1 | 158 | QUIRK_COMPOSITE, |
159 | #define QUIRK_MIDI_MIDIMAN 2 | 159 | QUIRK_MIDI_STANDARD_INTERFACE, |
160 | #define QUIRK_COMPOSITE 3 | 160 | QUIRK_MIDI_FIXED_ENDPOINT, |
161 | #define QUIRK_AUDIO_FIXED_ENDPOINT 4 | 161 | QUIRK_MIDI_YAMAHA, |
162 | #define QUIRK_AUDIO_STANDARD_INTERFACE 5 | 162 | QUIRK_MIDI_MIDIMAN, |
163 | #define QUIRK_MIDI_STANDARD_INTERFACE 6 | 163 | QUIRK_MIDI_NOVATION, |
164 | #define QUIRK_AUDIO_EDIROL_UA700_UA25 7 | 164 | QUIRK_MIDI_RAW, |
165 | #define QUIRK_AUDIO_EDIROL_UA1000 8 | 165 | QUIRK_MIDI_EMAGIC, |
166 | #define QUIRK_IGNORE_INTERFACE 9 | 166 | QUIRK_MIDI_MIDITECH, |
167 | #define QUIRK_MIDI_NOVATION 10 | 167 | QUIRK_AUDIO_STANDARD_INTERFACE, |
168 | #define QUIRK_MIDI_MOTU 11 | 168 | QUIRK_AUDIO_FIXED_ENDPOINT, |
169 | #define QUIRK_MIDI_EMAGIC 12 | 169 | QUIRK_AUDIO_EDIROL_UA700_UA25, |
170 | QUIRK_AUDIO_EDIROL_UA1000, | ||
171 | |||
172 | QUIRK_TYPE_COUNT | ||
173 | }; | ||
170 | 174 | ||
171 | typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t; | 175 | typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t; |
172 | typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t; | 176 | typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t; |
@@ -175,7 +179,7 @@ struct snd_usb_audio_quirk { | |||
175 | const char *vendor_name; | 179 | const char *vendor_name; |
176 | const char *product_name; | 180 | const char *product_name; |
177 | int16_t ifnum; | 181 | int16_t ifnum; |
178 | int16_t type; | 182 | uint16_t type; |
179 | const void *data; | 183 | const void *data; |
180 | }; | 184 | }; |
181 | 185 | ||
@@ -205,11 +209,13 @@ struct snd_usb_midi_endpoint_info { | |||
205 | 209 | ||
206 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ | 210 | /* for QUIRK_IGNORE_INTERFACE, data is NULL */ |
207 | 211 | ||
208 | /* for QUIRK_MIDI_NOVATION and _MOTU, data is NULL */ | 212 | /* for QUIRK_MIDI_NOVATION and _RAW, data is NULL */ |
209 | 213 | ||
210 | /* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info | 214 | /* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info |
211 | * structure (out_cables and in_cables only) */ | 215 | * structure (out_cables and in_cables only) */ |
212 | 216 | ||
217 | /* for QUIRK_MIDI_MIDITECH, data is NULL */ | ||
218 | |||
213 | /* | 219 | /* |
214 | */ | 220 | */ |
215 | 221 | ||
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index bee70068dce0..5778a9b725ec 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -524,16 +524,16 @@ static struct usb_protocol_ops snd_usbmidi_novation_ops = { | |||
524 | }; | 524 | }; |
525 | 525 | ||
526 | /* | 526 | /* |
527 | * Mark of the Unicorn USB MIDI protocol: raw MIDI. | 527 | * "raw" protocol: used by the MOTU FastLane. |
528 | */ | 528 | */ |
529 | 529 | ||
530 | static void snd_usbmidi_motu_input(snd_usb_midi_in_endpoint_t* ep, | 530 | static void snd_usbmidi_raw_input(snd_usb_midi_in_endpoint_t* ep, |
531 | uint8_t* buffer, int buffer_length) | 531 | uint8_t* buffer, int buffer_length) |
532 | { | 532 | { |
533 | snd_usbmidi_input_data(ep, 0, buffer, buffer_length); | 533 | snd_usbmidi_input_data(ep, 0, buffer, buffer_length); |
534 | } | 534 | } |
535 | 535 | ||
536 | static void snd_usbmidi_motu_output(snd_usb_midi_out_endpoint_t* ep) | 536 | static void snd_usbmidi_raw_output(snd_usb_midi_out_endpoint_t* ep) |
537 | { | 537 | { |
538 | int count; | 538 | int count; |
539 | 539 | ||
@@ -549,9 +549,9 @@ static void snd_usbmidi_motu_output(snd_usb_midi_out_endpoint_t* ep) | |||
549 | ep->urb->transfer_buffer_length = count; | 549 | ep->urb->transfer_buffer_length = count; |
550 | } | 550 | } |
551 | 551 | ||
552 | static struct usb_protocol_ops snd_usbmidi_motu_ops = { | 552 | static struct usb_protocol_ops snd_usbmidi_raw_ops = { |
553 | .input = snd_usbmidi_motu_input, | 553 | .input = snd_usbmidi_raw_input, |
554 | .output = snd_usbmidi_motu_output, | 554 | .output = snd_usbmidi_raw_output, |
555 | }; | 555 | }; |
556 | 556 | ||
557 | /* | 557 | /* |
@@ -1505,8 +1505,8 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, | |||
1505 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; | 1505 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; |
1506 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1506 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1507 | break; | 1507 | break; |
1508 | case QUIRK_MIDI_MOTU: | 1508 | case QUIRK_MIDI_RAW: |
1509 | umidi->usb_protocol_ops = &snd_usbmidi_motu_ops; | 1509 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; |
1510 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1510 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1511 | break; | 1511 | break; |
1512 | case QUIRK_MIDI_EMAGIC: | 1512 | case QUIRK_MIDI_EMAGIC: |
@@ -1515,6 +1515,9 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, | |||
1515 | sizeof(snd_usb_midi_endpoint_info_t)); | 1515 | sizeof(snd_usb_midi_endpoint_info_t)); |
1516 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); | 1516 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); |
1517 | break; | 1517 | break; |
1518 | case QUIRK_MIDI_MIDITECH: | ||
1519 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | ||
1520 | break; | ||
1518 | default: | 1521 | default: |
1519 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | 1522 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); |
1520 | err = -ENXIO; | 1523 | err = -ENXIO; |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index f5135641b3e2..f74e652a1e51 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -116,6 +116,7 @@ YAMAHA_DEVICE(0x1039, NULL), | |||
116 | YAMAHA_DEVICE(0x103a, NULL), | 116 | YAMAHA_DEVICE(0x103a, NULL), |
117 | YAMAHA_DEVICE(0x103b, NULL), | 117 | YAMAHA_DEVICE(0x103b, NULL), |
118 | YAMAHA_DEVICE(0x103c, NULL), | 118 | YAMAHA_DEVICE(0x103c, NULL), |
119 | YAMAHA_DEVICE(0x103d, NULL), | ||
119 | YAMAHA_DEVICE(0x2000, "DGP-7"), | 120 | YAMAHA_DEVICE(0x2000, "DGP-7"), |
120 | YAMAHA_DEVICE(0x2001, "DGP-5"), | 121 | YAMAHA_DEVICE(0x2001, "DGP-5"), |
121 | YAMAHA_DEVICE(0x2002, NULL), | 122 | YAMAHA_DEVICE(0x2002, NULL), |
@@ -1259,7 +1260,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1259 | /* Mark of the Unicorn devices */ | 1260 | /* Mark of the Unicorn devices */ |
1260 | { | 1261 | { |
1261 | /* thanks to Robert A. Lerche <ral 'at' msbit.com> */ | 1262 | /* thanks to Robert A. Lerche <ral 'at' msbit.com> */ |
1262 | USB_DEVICE(0x07fd, 0x0001), | 1263 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | |
1264 | USB_DEVICE_ID_MATCH_PRODUCT | | ||
1265 | USB_DEVICE_ID_MATCH_DEV_SUBCLASS, | ||
1266 | .idVendor = 0x07fd, | ||
1267 | .idProduct = 0x0001, | ||
1268 | .bDeviceSubClass = 2, | ||
1263 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 1269 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
1264 | .vendor_name = "MOTU", | 1270 | .vendor_name = "MOTU", |
1265 | .product_name = "Fastlane", | 1271 | .product_name = "Fastlane", |
@@ -1268,7 +1274,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1268 | .data = & (const snd_usb_audio_quirk_t[]) { | 1274 | .data = & (const snd_usb_audio_quirk_t[]) { |
1269 | { | 1275 | { |
1270 | .ifnum = 0, | 1276 | .ifnum = 0, |
1271 | .type = QUIRK_MIDI_MOTU | 1277 | .type = QUIRK_MIDI_RAW |
1272 | }, | 1278 | }, |
1273 | { | 1279 | { |
1274 | .ifnum = 1, | 1280 | .ifnum = 1, |
@@ -1373,6 +1379,25 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1373 | }, | 1379 | }, |
1374 | 1380 | ||
1375 | { | 1381 | { |
1382 | USB_DEVICE(0x4752, 0x0011), | ||
1383 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | ||
1384 | .vendor_name = "Miditech", | ||
1385 | .product_name = "Midistart-2", | ||
1386 | .ifnum = 0, | ||
1387 | .type = QUIRK_MIDI_MIDITECH | ||
1388 | } | ||
1389 | }, | ||
1390 | { | ||
1391 | USB_DEVICE(0x7104, 0x2202), | ||
1392 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | ||
1393 | .vendor_name = "Miditech", | ||
1394 | .product_name = "MidiStudio-2", | ||
1395 | .ifnum = 0, | ||
1396 | .type = QUIRK_MIDI_MIDITECH | ||
1397 | } | ||
1398 | }, | ||
1399 | |||
1400 | { | ||
1376 | /* | 1401 | /* |
1377 | * Some USB MIDI devices don't have an audio control interface, | 1402 | * Some USB MIDI devices don't have an audio control interface, |
1378 | * so we have to grab MIDI streaming interfaces here. | 1403 | * so we have to grab MIDI streaming interfaces here. |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index bef9b0c142c4..0281a362857a 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -232,8 +232,7 @@ static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) | |||
232 | if (err) | 232 | if (err) |
233 | return err; | 233 | return err; |
234 | if (dsp->index == 1) { | 234 | if (dsp->index == 1) { |
235 | set_current_state(TASK_UNINTERRUPTIBLE); | 235 | msleep(250); // give the device some time |
236 | schedule_timeout(HZ/4); // give the device some time | ||
237 | err = usX2Y_AsyncSeq04_init(priv); | 236 | err = usX2Y_AsyncSeq04_init(priv); |
238 | if (err) { | 237 | if (err) { |
239 | snd_printk("usX2Y_AsyncSeq04_init error \n"); | 238 | snd_printk("usX2Y_AsyncSeq04_init error \n"); |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index bb2c8e9000c6..ef28061287f2 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -50,6 +50,7 @@ | |||
50 | Currently rawusb dma pcm buffer transport (this file) is only available to snd-usb-usx2y. | 50 | Currently rawusb dma pcm buffer transport (this file) is only available to snd-usb-usx2y. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/delay.h> | ||
53 | #include "usbusx2yaudio.c" | 54 | #include "usbusx2yaudio.c" |
54 | 55 | ||
55 | #if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) | 56 | #if defined(USX2Y_NRPACKS_VARIABLE) || (!defined(USX2Y_NRPACKS_VARIABLE) && USX2Y_NRPACKS == 1) |
@@ -520,11 +521,8 @@ static int snd_usX2Y_usbpcm_prepare(snd_pcm_substream_t *substream) | |||
520 | usX2Y->hwdep_pcm_shm->playback_iso_start = -1; | 521 | usX2Y->hwdep_pcm_shm->playback_iso_start = -1; |
521 | if (atomic_read(&subs->state) < state_PREPARED) { | 522 | if (atomic_read(&subs->state) < state_PREPARED) { |
522 | while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { | 523 | while (usX2Y_iso_frames_per_buffer(runtime, usX2Y) > usX2Y->hwdep_pcm_shm->captured_iso_frames) { |
523 | signed long timeout; | ||
524 | snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); | 524 | snd_printd("Wait: iso_frames_per_buffer=%i,captured_iso_frames=%i\n", usX2Y_iso_frames_per_buffer(runtime, usX2Y), usX2Y->hwdep_pcm_shm->captured_iso_frames); |
525 | set_current_state(TASK_INTERRUPTIBLE); | 525 | if (msleep_interruptible(10)) { |
526 | timeout = schedule_timeout(HZ/100 + 1); | ||
527 | if (signal_pending(current)) { | ||
528 | err = -ERESTARTSYS; | 526 | err = -ERESTARTSYS; |
529 | goto up_prepare_mutex; | 527 | goto up_prepare_mutex; |
530 | } | 528 | } |