diff options
| author | Len Brown <len.brown@intel.com> | 2005-07-30 01:55:32 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2005-07-30 01:55:32 -0400 |
| commit | adbedd34244e2b054557002817f979a9b004a405 (patch) | |
| tree | 78e4a524e84f8b3e23ae8b49ac689048584e4668 | |
| parent | d6ac1a7910d22626bc77e73db091e00b810715f4 (diff) | |
| parent | b0825488a642cadcf39709961dde61440cb0731c (diff) | |
merge 2.6.13-rc4 with ACPI's to-linus tree
250 files changed, 8013 insertions, 2902 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/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt index 3cea13875277..f39c9d714db3 100644 --- a/Documentation/stable_api_nonsense.txt +++ b/Documentation/stable_api_nonsense.txt | |||
| @@ -132,7 +132,7 @@ to extra work for the USB developers. Since all Linux USB developers do | |||
| 132 | their work on their own time, asking programmers to do extra work for no | 132 | their work on their own time, asking programmers to do extra work for no |
| 133 | gain, for free, is not a possibility. | 133 | gain, for free, is not a possibility. |
| 134 | 134 | ||
| 135 | Security issues are also a very important for Linux. When a | 135 | Security issues are also very important for Linux. When a |
| 136 | security issue is found, it is fixed in a very short amount of time. A | 136 | security issue is found, it is fixed in a very short amount of time. A |
| 137 | number of times this has caused internal kernel interfaces to be | 137 | number of times this has caused internal kernel interfaces to be |
| 138 | reworked to prevent the security problem from occurring. When this | 138 | reworked to prevent the security problem from occurring. When this |
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt new file mode 100644 index 000000000000..2c81305090df --- /dev/null +++ b/Documentation/stable_kernel_rules.txt | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | Everything you ever wanted to know about Linux 2.6 -stable releases. | ||
| 2 | |||
| 3 | Rules on what kind of patches are accepted, and what ones are not, into | ||
| 4 | the "-stable" tree: | ||
| 5 | |||
| 6 | - It must be obviously correct and tested. | ||
| 7 | - It can not bigger than 100 lines, with context. | ||
| 8 | - It must fix only one thing. | ||
| 9 | - It must fix a real bug that bothers people (not a, "This could be a | ||
| 10 | problem..." type thing.) | ||
| 11 | - It must fix a problem that causes a build error (but not for things | ||
| 12 | marked CONFIG_BROKEN), an oops, a hang, data corruption, a real | ||
| 13 | security issue, or some "oh, that's not good" issue. In short, | ||
| 14 | something critical. | ||
| 15 | - No "theoretical race condition" issues, unless an explanation of how | ||
| 16 | the race can be exploited. | ||
| 17 | - It can not contain any "trivial" fixes in it (spelling changes, | ||
| 18 | whitespace cleanups, etc.) | ||
| 19 | - It must be accepted by the relevant subsystem maintainer. | ||
| 20 | - It must follow Documentation/SubmittingPatches rules. | ||
| 21 | |||
| 22 | |||
| 23 | Procedure for submitting patches to the -stable tree: | ||
| 24 | |||
| 25 | - Send the patch, after verifying that it follows the above rules, to | ||
| 26 | stable@kernel.org. | ||
| 27 | - The sender will receive an ack when the patch has been accepted into | ||
| 28 | the queue, or a nak if the patch is rejected. This response might | ||
| 29 | take a few days, according to the developer's schedules. | ||
| 30 | - If accepted, the patch will be added to the -stable queue, for review | ||
| 31 | by other developers. | ||
| 32 | - Security patches should not be sent to this alias, but instead to the | ||
| 33 | documented security@kernel.org. | ||
| 34 | |||
| 35 | |||
| 36 | Review cycle: | ||
| 37 | |||
| 38 | - When the -stable maintainers decide for a review cycle, the patches | ||
| 39 | will be sent to the review committee, and the maintainer of the | ||
| 40 | affected area of the patch (unless the submitter is the maintainer of | ||
| 41 | the area) and CC: to the linux-kernel mailing list. | ||
| 42 | - The review committee has 48 hours in which to ack or nak the patch. | ||
| 43 | - If the patch is rejected by a member of the committee, or linux-kernel | ||
| 44 | members object to the patch, bringing up issues that the maintainers | ||
| 45 | and members did not realize, the patch will be dropped from the | ||
| 46 | queue. | ||
| 47 | - At the end of the review cycle, the acked patches will be added to | ||
| 48 | the latest -stable release, and a new -stable release will happen. | ||
| 49 | - Security patches will be accepted into the -stable tree directly from | ||
| 50 | the security kernel team, and not go through the normal review cycle. | ||
| 51 | Contact the kernel security team for more details on this procedure. | ||
| 52 | |||
| 53 | |||
| 54 | Review committe: | ||
| 55 | |||
| 56 | - This will be made up of a number of kernel developers who have | ||
| 57 | volunteered for this task, and a few that haven't. | ||
| 58 | |||
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/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 295e0a8379cf..b2085735a2ba 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -176,6 +176,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | |||
| 176 | cpu_set(cpu, mm->cpu_vm_mask); | 176 | cpu_set(cpu, mm->cpu_vm_mask); |
| 177 | cpu_switch_mm(mm->pgd, mm); | 177 | cpu_switch_mm(mm->pgd, mm); |
| 178 | enter_lazy_tlb(mm, current); | 178 | enter_lazy_tlb(mm, current); |
| 179 | local_flush_tlb_all(); | ||
| 179 | 180 | ||
| 180 | cpu_init(); | 181 | cpu_init(); |
| 181 | 182 | ||
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h index 5382a3023602..2036ff15bda9 100644 --- a/arch/arm/lib/bitops.h +++ b/arch/arm/lib/bitops.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 1: ldrexb r2, [r1] | 7 | 1: ldrexb r2, [r1] |
| 8 | \instr r2, r2, r3 | 8 | \instr r2, r2, r3 |
| 9 | strexb r0, r2, [r1] | 9 | strexb r0, r2, [r1] |
| 10 | cmpne r0, #0 | 10 | cmp r0, #0 |
| 11 | bne 1b | 11 | bne 1b |
| 12 | mov pc, lr | 12 | mov pc, lr |
| 13 | .endm | 13 | .endm |
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c index aecf47ba033a..ea10bd8c972c 100644 --- a/arch/arm/mach-integrator/platsmp.c +++ b/arch/arm/mach-integrator/platsmp.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
| 16 | 16 | ||
| 17 | #include <asm/atomic.h> | 17 | #include <asm/atomic.h> |
| 18 | #include <asm/cacheflush.h> | ||
| 18 | #include <asm/delay.h> | 19 | #include <asm/delay.h> |
| 19 | #include <asm/mmu_context.h> | 20 | #include <asm/mmu_context.h> |
| 20 | #include <asm/procinfo.h> | 21 | #include <asm/procinfo.h> |
| @@ -80,6 +81,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
| 80 | * "cpu" is Linux's internal ID. | 81 | * "cpu" is Linux's internal ID. |
| 81 | */ | 82 | */ |
| 82 | pen_release = cpu; | 83 | pen_release = cpu; |
| 84 | flush_cache_all(); | ||
| 83 | 85 | ||
| 84 | /* | 86 | /* |
| 85 | * XXX | 87 | * XXX |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 31f65c8a4c24..ab6e0611303d 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * (c) 2003, 2004 Advanced Micro Devices, Inc. | 2 | * (c) 2003, 2004, 2005 Advanced Micro Devices, Inc. |
| 3 | * Your use of this code is subject to the terms and conditions of the | 3 | * Your use of this code is subject to the terms and conditions of the |
| 4 | * GNU general public license version 2. See "COPYING" or | 4 | * GNU general public license version 2. See "COPYING" or |
| 5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
| @@ -44,7 +44,7 @@ | |||
| 44 | 44 | ||
| 45 | #define PFX "powernow-k8: " | 45 | #define PFX "powernow-k8: " |
| 46 | #define BFX PFX "BIOS error: " | 46 | #define BFX PFX "BIOS error: " |
| 47 | #define VERSION "version 1.40.2" | 47 | #define VERSION "version 1.50.3" |
| 48 | #include "powernow-k8.h" | 48 | #include "powernow-k8.h" |
| 49 | 49 | ||
| 50 | /* serialize freq changes */ | 50 | /* serialize freq changes */ |
| @@ -231,7 +231,7 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid) | |||
| 231 | /* | 231 | /* |
| 232 | * Reduce the vid by the max of step or reqvid. | 232 | * Reduce the vid by the max of step or reqvid. |
| 233 | * Decreasing vid codes represent increasing voltages: | 233 | * Decreasing vid codes represent increasing voltages: |
| 234 | * vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of 0x1f is off. | 234 | * vid of 0 is 1.550V, vid of 0x1e is 0.800V, vid of VID_OFF is off. |
| 235 | */ | 235 | */ |
| 236 | static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, u32 step) | 236 | static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, u32 step) |
| 237 | { | 237 | { |
| @@ -466,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
| 466 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); | 466 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); |
| 467 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || | 467 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || |
| 468 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || | 468 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || |
| 469 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_E)) { | 469 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { |
| 470 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); | 470 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); |
| 471 | goto out; | 471 | goto out; |
| 472 | } | 472 | } |
| @@ -695,6 +695,7 @@ static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned | |||
| 695 | 695 | ||
| 696 | data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; | 696 | data->irt = (data->acpi_data.states[index].control >> IRT_SHIFT) & IRT_MASK; |
| 697 | data->rvo = (data->acpi_data.states[index].control >> RVO_SHIFT) & RVO_MASK; | 697 | data->rvo = (data->acpi_data.states[index].control >> RVO_SHIFT) & RVO_MASK; |
| 698 | data->exttype = (data->acpi_data.states[index].control >> EXT_TYPE_SHIFT) & EXT_TYPE_MASK; | ||
| 698 | data->plllock = (data->acpi_data.states[index].control >> PLL_L_SHIFT) & PLL_L_MASK; | 699 | data->plllock = (data->acpi_data.states[index].control >> PLL_L_SHIFT) & PLL_L_MASK; |
| 699 | data->vidmvs = 1 << ((data->acpi_data.states[index].control >> MVS_SHIFT) & MVS_MASK); | 700 | data->vidmvs = 1 << ((data->acpi_data.states[index].control >> MVS_SHIFT) & MVS_MASK); |
| 700 | data->vstable = (data->acpi_data.states[index].control >> VST_SHIFT) & VST_MASK; | 701 | data->vstable = (data->acpi_data.states[index].control >> VST_SHIFT) & VST_MASK; |
| @@ -734,8 +735,16 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) | |||
| 734 | } | 735 | } |
| 735 | 736 | ||
| 736 | for (i = 0; i < data->acpi_data.state_count; i++) { | 737 | for (i = 0; i < data->acpi_data.state_count; i++) { |
| 737 | u32 fid = data->acpi_data.states[i].control & FID_MASK; | 738 | u32 fid; |
| 738 | u32 vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK; | 739 | u32 vid; |
| 740 | |||
| 741 | if (data->exttype) { | ||
| 742 | fid = data->acpi_data.states[i].status & FID_MASK; | ||
| 743 | vid = (data->acpi_data.states[i].status >> VID_SHIFT) & VID_MASK; | ||
| 744 | } else { | ||
| 745 | fid = data->acpi_data.states[i].control & FID_MASK; | ||
| 746 | vid = (data->acpi_data.states[i].control >> VID_SHIFT) & VID_MASK; | ||
| 747 | } | ||
| 739 | 748 | ||
| 740 | dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid); | 749 | dprintk(" %d : fid 0x%x, vid 0x%x\n", i, fid, vid); |
| 741 | 750 | ||
| @@ -752,7 +761,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) | |||
| 752 | } | 761 | } |
| 753 | 762 | ||
| 754 | /* verify voltage is OK - BIOSs are using "off" to indicate invalid */ | 763 | /* verify voltage is OK - BIOSs are using "off" to indicate invalid */ |
| 755 | if (vid == 0x1f) { | 764 | if (vid == VID_OFF) { |
| 756 | dprintk("invalid vid %u, ignoring\n", vid); | 765 | dprintk("invalid vid %u, ignoring\n", vid); |
| 757 | powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; | 766 | powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; |
| 758 | continue; | 767 | continue; |
| @@ -929,15 +938,6 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 929 | 938 | ||
| 930 | down(&fidvid_sem); | 939 | down(&fidvid_sem); |
| 931 | 940 | ||
| 932 | for_each_cpu_mask(i, cpu_core_map[pol->cpu]) { | ||
| 933 | /* make sure the sibling is initialized */ | ||
| 934 | if (!powernow_data[i]) { | ||
| 935 | ret = 0; | ||
| 936 | up(&fidvid_sem); | ||
| 937 | goto err_out; | ||
| 938 | } | ||
| 939 | } | ||
| 940 | |||
| 941 | powernow_k8_acpi_pst_values(data, newstate); | 941 | powernow_k8_acpi_pst_values(data, newstate); |
| 942 | 942 | ||
| 943 | if (transition_frequency(data, newstate)) { | 943 | if (transition_frequency(data, newstate)) { |
| @@ -977,7 +977,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 977 | { | 977 | { |
| 978 | struct powernow_k8_data *data; | 978 | struct powernow_k8_data *data; |
| 979 | cpumask_t oldmask = CPU_MASK_ALL; | 979 | cpumask_t oldmask = CPU_MASK_ALL; |
| 980 | int rc; | 980 | int rc, i; |
| 981 | 981 | ||
| 982 | if (!check_supported_cpu(pol->cpu)) | 982 | if (!check_supported_cpu(pol->cpu)) |
| 983 | return -ENODEV; | 983 | return -ENODEV; |
| @@ -1063,7 +1063,9 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1063 | printk("cpu_init done, current fid 0x%x, vid 0x%x\n", | 1063 | printk("cpu_init done, current fid 0x%x, vid 0x%x\n", |
| 1064 | data->currfid, data->currvid); | 1064 | data->currfid, data->currvid); |
| 1065 | 1065 | ||
| 1066 | powernow_data[pol->cpu] = data; | 1066 | for_each_cpu_mask(i, cpu_core_map[pol->cpu]) { |
| 1067 | powernow_data[i] = data; | ||
| 1068 | } | ||
| 1067 | 1069 | ||
| 1068 | return 0; | 1070 | return 0; |
| 1069 | 1071 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index 9ed5bf221cb7..b1e85bb36396 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * (c) 2003, 2004 Advanced Micro Devices, Inc. | 2 | * (c) 2003, 2004, 2005 Advanced Micro Devices, Inc. |
| 3 | * Your use of this code is subject to the terms and conditions of the | 3 | * Your use of this code is subject to the terms and conditions of the |
| 4 | * GNU general public license version 2. See "COPYING" or | 4 | * GNU general public license version 2. See "COPYING" or |
| 5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
| @@ -19,6 +19,7 @@ struct powernow_k8_data { | |||
| 19 | u32 vidmvs; /* usable value calculated from mvs */ | 19 | u32 vidmvs; /* usable value calculated from mvs */ |
| 20 | u32 vstable; /* voltage stabilization time, units 20 us */ | 20 | u32 vstable; /* voltage stabilization time, units 20 us */ |
| 21 | u32 plllock; /* pll lock time, units 1 us */ | 21 | u32 plllock; /* pll lock time, units 1 us */ |
| 22 | u32 exttype; /* extended interface = 1 */ | ||
| 22 | 23 | ||
| 23 | /* keep track of the current fid / vid */ | 24 | /* keep track of the current fid / vid */ |
| 24 | u32 currvid, currfid; | 25 | u32 currvid, currfid; |
| @@ -41,7 +42,7 @@ struct powernow_k8_data { | |||
| 41 | #define CPUID_XFAM 0x0ff00000 /* extended family */ | 42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ |
| 42 | #define CPUID_XFAM_K8 0 | 43 | #define CPUID_XFAM_K8 0 |
| 43 | #define CPUID_XMOD 0x000f0000 /* extended model */ | 44 | #define CPUID_XMOD 0x000f0000 /* extended model */ |
| 44 | #define CPUID_XMOD_REV_E 0x00020000 | 45 | #define CPUID_XMOD_REV_F 0x00040000 |
| 45 | #define CPUID_USE_XFAM_XMOD 0x00000f00 | 46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 |
| 46 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 | 47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 |
| 47 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 | 48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 |
| @@ -57,25 +58,26 @@ struct powernow_k8_data { | |||
| 57 | 58 | ||
| 58 | /* Field definitions within the FID VID Low Control MSR : */ | 59 | /* Field definitions within the FID VID Low Control MSR : */ |
| 59 | #define MSR_C_LO_INIT_FID_VID 0x00010000 | 60 | #define MSR_C_LO_INIT_FID_VID 0x00010000 |
| 60 | #define MSR_C_LO_NEW_VID 0x00001f00 | 61 | #define MSR_C_LO_NEW_VID 0x00003f00 |
| 61 | #define MSR_C_LO_NEW_FID 0x0000002f | 62 | #define MSR_C_LO_NEW_FID 0x0000003f |
| 62 | #define MSR_C_LO_VID_SHIFT 8 | 63 | #define MSR_C_LO_VID_SHIFT 8 |
| 63 | 64 | ||
| 64 | /* Field definitions within the FID VID High Control MSR : */ | 65 | /* Field definitions within the FID VID High Control MSR : */ |
| 65 | #define MSR_C_HI_STP_GNT_TO 0x000fffff | 66 | #define MSR_C_HI_STP_GNT_TO 0x000fffff |
| 66 | 67 | ||
| 67 | /* Field definitions within the FID VID Low Status MSR : */ | 68 | /* Field definitions within the FID VID Low Status MSR : */ |
| 68 | #define MSR_S_LO_CHANGE_PENDING 0x80000000 /* cleared when completed */ | 69 | #define MSR_S_LO_CHANGE_PENDING 0x80000000 /* cleared when completed */ |
| 69 | #define MSR_S_LO_MAX_RAMP_VID 0x1f000000 | 70 | #define MSR_S_LO_MAX_RAMP_VID 0x3f000000 |
| 70 | #define MSR_S_LO_MAX_FID 0x003f0000 | 71 | #define MSR_S_LO_MAX_FID 0x003f0000 |
| 71 | #define MSR_S_LO_START_FID 0x00003f00 | 72 | #define MSR_S_LO_START_FID 0x00003f00 |
| 72 | #define MSR_S_LO_CURRENT_FID 0x0000003f | 73 | #define MSR_S_LO_CURRENT_FID 0x0000003f |
| 73 | 74 | ||
| 74 | /* Field definitions within the FID VID High Status MSR : */ | 75 | /* Field definitions within the FID VID High Status MSR : */ |
| 75 | #define MSR_S_HI_MAX_WORKING_VID 0x001f0000 | 76 | #define MSR_S_HI_MIN_WORKING_VID 0x3f000000 |
| 76 | #define MSR_S_HI_START_VID 0x00001f00 | 77 | #define MSR_S_HI_MAX_WORKING_VID 0x003f0000 |
| 77 | #define MSR_S_HI_CURRENT_VID 0x0000001f | 78 | #define MSR_S_HI_START_VID 0x00003f00 |
| 78 | #define MSR_C_HI_STP_GNT_BENIGN 0x00000001 | 79 | #define MSR_S_HI_CURRENT_VID 0x0000003f |
| 80 | #define MSR_C_HI_STP_GNT_BENIGN 0x00000001 | ||
| 79 | 81 | ||
| 80 | /* | 82 | /* |
| 81 | * There are restrictions frequencies have to follow: | 83 | * There are restrictions frequencies have to follow: |
| @@ -99,13 +101,15 @@ struct powernow_k8_data { | |||
| 99 | #define MIN_FREQ_RESOLUTION 200 /* fids jump by 2 matching freq jumps by 200 */ | 101 | #define MIN_FREQ_RESOLUTION 200 /* fids jump by 2 matching freq jumps by 200 */ |
| 100 | 102 | ||
| 101 | #define MAX_FID 0x2a /* Spec only gives FID values as far as 5 GHz */ | 103 | #define MAX_FID 0x2a /* Spec only gives FID values as far as 5 GHz */ |
| 102 | #define LEAST_VID 0x1e /* Lowest (numerically highest) useful vid value */ | 104 | #define LEAST_VID 0x3e /* Lowest (numerically highest) useful vid value */ |
| 103 | 105 | ||
| 104 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ | 106 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ |
| 105 | #define MAX_FREQ 5000 | 107 | #define MAX_FREQ 5000 |
| 106 | 108 | ||
| 107 | #define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ | 109 | #define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ |
| 108 | #define INVALID_VID_MASK 0xffffffe0 /* not a valid vid if these bits are set */ | 110 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ |
| 111 | |||
| 112 | #define VID_OFF 0x3f | ||
| 109 | 113 | ||
| 110 | #define STOP_GRANT_5NS 1 /* min poss memory access latency for voltage change */ | 114 | #define STOP_GRANT_5NS 1 /* min poss memory access latency for voltage change */ |
| 111 | 115 | ||
| @@ -121,12 +125,14 @@ struct powernow_k8_data { | |||
| 121 | 125 | ||
| 122 | #define IRT_SHIFT 30 | 126 | #define IRT_SHIFT 30 |
| 123 | #define RVO_SHIFT 28 | 127 | #define RVO_SHIFT 28 |
| 128 | #define EXT_TYPE_SHIFT 27 | ||
| 124 | #define PLL_L_SHIFT 20 | 129 | #define PLL_L_SHIFT 20 |
| 125 | #define MVS_SHIFT 18 | 130 | #define MVS_SHIFT 18 |
| 126 | #define VST_SHIFT 11 | 131 | #define VST_SHIFT 11 |
| 127 | #define VID_SHIFT 6 | 132 | #define VID_SHIFT 6 |
| 128 | #define IRT_MASK 3 | 133 | #define IRT_MASK 3 |
| 129 | #define RVO_MASK 3 | 134 | #define RVO_MASK 3 |
| 135 | #define EXT_TYPE_MASK 1 | ||
| 130 | #define PLL_L_MASK 0x7f | 136 | #define PLL_L_MASK 0x7f |
| 131 | #define MVS_MASK 3 | 137 | #define MVS_MASK 3 |
| 132 | #define VST_MASK 0x7f | 138 | #define VST_MASK 0x7f |
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/machine_kexec.c b/arch/i386/kernel/machine_kexec.c index 52ed18d8b511..cb699a2aa1f8 100644 --- a/arch/i386/kernel/machine_kexec.c +++ b/arch/i386/kernel/machine_kexec.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <asm/io.h> | 16 | #include <asm/io.h> |
| 17 | #include <asm/apic.h> | 17 | #include <asm/apic.h> |
| 18 | #include <asm/cpufeature.h> | 18 | #include <asm/cpufeature.h> |
| 19 | #include <asm/desc.h> | ||
| 19 | 20 | ||
| 20 | static inline unsigned long read_cr3(void) | 21 | static inline unsigned long read_cr3(void) |
| 21 | { | 22 | { |
| @@ -90,33 +91,32 @@ static void identity_map_page(unsigned long address) | |||
| 90 | } | 91 | } |
| 91 | #endif | 92 | #endif |
| 92 | 93 | ||
| 93 | |||
| 94 | static void set_idt(void *newidt, __u16 limit) | 94 | static void set_idt(void *newidt, __u16 limit) |
| 95 | { | 95 | { |
| 96 | unsigned char curidt[6]; | 96 | struct Xgt_desc_struct curidt; |
| 97 | 97 | ||
| 98 | /* ia32 supports unaliged loads & stores */ | 98 | /* ia32 supports unaliged loads & stores */ |
| 99 | (*(__u16 *)(curidt)) = limit; | 99 | curidt.size = limit; |
| 100 | (*(__u32 *)(curidt +2)) = (unsigned long)(newidt); | 100 | curidt.address = (unsigned long)newidt; |
| 101 | 101 | ||
| 102 | __asm__ __volatile__ ( | 102 | __asm__ __volatile__ ( |
| 103 | "lidt %0\n" | 103 | "lidtl %0\n" |
| 104 | : "=m" (curidt) | 104 | : : "m" (curidt) |
| 105 | ); | 105 | ); |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | static void set_gdt(void *newgdt, __u16 limit) | 109 | static void set_gdt(void *newgdt, __u16 limit) |
| 110 | { | 110 | { |
| 111 | unsigned char curgdt[6]; | 111 | struct Xgt_desc_struct curgdt; |
| 112 | 112 | ||
| 113 | /* ia32 supports unaligned loads & stores */ | 113 | /* ia32 supports unaligned loads & stores */ |
| 114 | (*(__u16 *)(curgdt)) = limit; | 114 | curgdt.size = limit; |
| 115 | (*(__u32 *)(curgdt +2)) = (unsigned long)(newgdt); | 115 | curgdt.address = (unsigned long)newgdt; |
| 116 | 116 | ||
| 117 | __asm__ __volatile__ ( | 117 | __asm__ __volatile__ ( |
| 118 | "lgdt %0\n" | 118 | "lgdtl %0\n" |
| 119 | : "=m" (curgdt) | 119 | : : "m" (curgdt) |
| 120 | ); | 120 | ); |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index af917f609c7d..ce838abb27d8 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c | |||
| @@ -1116,7 +1116,15 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | |||
| 1116 | */ | 1116 | */ |
| 1117 | int irq = gsi; | 1117 | int irq = gsi; |
| 1118 | if (gsi < MAX_GSI_NUM) { | 1118 | if (gsi < MAX_GSI_NUM) { |
| 1119 | gsi = pci_irq++; | 1119 | if (gsi > 15) |
| 1120 | gsi = pci_irq++; | ||
| 1121 | #ifdef CONFIG_ACPI_BUS | ||
| 1122 | /* | ||
| 1123 | * Don't assign IRQ used by ACPI SCI | ||
| 1124 | */ | ||
| 1125 | if (gsi == acpi_fadt.sci_int) | ||
| 1126 | gsi = pci_irq++; | ||
| 1127 | #endif | ||
| 1120 | gsi_to_irq[irq] = gsi; | 1128 | gsi_to_irq[irq] = gsi; |
| 1121 | } else { | 1129 | } else { |
| 1122 | printk(KERN_ERR "GSI %u is too high\n", gsi); | 1130 | printk(KERN_ERR "GSI %u is too high\n", gsi); |
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/mm/discontig.c b/arch/i386/mm/discontig.c index b358f0702a44..c369a8bf7cbe 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c | |||
| @@ -243,6 +243,14 @@ static unsigned long calculate_numa_remap_pages(void) | |||
| 243 | /* now the roundup is correct, convert to PAGE_SIZE pages */ | 243 | /* now the roundup is correct, convert to PAGE_SIZE pages */ |
| 244 | size = size * PTRS_PER_PTE; | 244 | size = size * PTRS_PER_PTE; |
| 245 | 245 | ||
| 246 | if (node_end_pfn[nid] & (PTRS_PER_PTE-1)) { | ||
| 247 | /* | ||
| 248 | * Adjust size if node_end_pfn is not on a proper | ||
| 249 | * pmd boundary. remap_numa_kva will barf otherwise. | ||
| 250 | */ | ||
| 251 | size += node_end_pfn[nid] & (PTRS_PER_PTE-1); | ||
| 252 | } | ||
| 253 | |||
| 246 | /* | 254 | /* |
| 247 | * Validate the region we are allocating only contains valid | 255 | * Validate the region we are allocating only contains valid |
| 248 | * pages. | 256 | * pages. |
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c index 187350ccf864..86348b68fda1 100644 --- a/arch/i386/pci/irq.c +++ b/arch/i386/pci/irq.c | |||
| @@ -551,6 +551,13 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route | |||
| 551 | static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) | 551 | static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) |
| 552 | { | 552 | { |
| 553 | /* FIXME: We should move some of the quirk fixup stuff here */ | 553 | /* FIXME: We should move some of the quirk fixup stuff here */ |
| 554 | |||
| 555 | if (router->device == PCI_DEVICE_ID_VIA_82C686 && | ||
| 556 | device == PCI_DEVICE_ID_VIA_82C586_0) { | ||
| 557 | /* Asus k7m bios wrongly reports 82C686A as 586-compatible */ | ||
| 558 | device = PCI_DEVICE_ID_VIA_82C686; | ||
| 559 | } | ||
| 560 | |||
| 554 | switch(device) | 561 | switch(device) |
| 555 | { | 562 | { |
| 556 | case PCI_DEVICE_ID_VIA_82C586_0: | 563 | case PCI_DEVICE_ID_VIA_82C586_0: |
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index c067435bae45..c9f2f60cfa58 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c | |||
| @@ -232,7 +232,11 @@ static int appldata_diag(char record_nr, u16 function, unsigned long buffer, | |||
| 232 | ry = -1; | 232 | ry = -1; |
| 233 | asm volatile( | 233 | asm volatile( |
| 234 | "diag %1,%0,0xDC\n\t" | 234 | "diag %1,%0,0xDC\n\t" |
| 235 | : "=d" (ry) : "d" (&(appldata_parameter_list)) : "cc"); | 235 | : "=d" (ry) |
| 236 | : "d" (&appldata_parameter_list), | ||
| 237 | "m" (appldata_parameter_list), | ||
| 238 | "m" (appldata_product_id) | ||
| 239 | : "cc"); | ||
| 236 | return (int) ry; | 240 | return (int) ry; |
| 237 | } | 241 | } |
| 238 | /************************ timer, work, DIAG <END> ****************************/ | 242 | /************************ timer, work, DIAG <END> ****************************/ |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 89850b2c27ea..0865251a3f44 100644 --- a/arch/s390/defconfig +++ b/arch/s390/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-rc3 | 3 | # Linux kernel version: 2.6.13-rc4 |
| 4 | # Fri Apr 22 15:30:58 2005 | 4 | # Fri Jul 29 14:49:30 2005 |
| 5 | # | 5 | # |
| 6 | CONFIG_MMU=y | 6 | CONFIG_MMU=y |
| 7 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y | 7 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y |
| @@ -23,10 +23,11 @@ CONFIG_INIT_ENV_ARG_LIMIT=32 | |||
| 23 | CONFIG_LOCALVERSION="" | 23 | CONFIG_LOCALVERSION="" |
| 24 | CONFIG_SWAP=y | 24 | CONFIG_SWAP=y |
| 25 | CONFIG_SYSVIPC=y | 25 | CONFIG_SYSVIPC=y |
| 26 | # CONFIG_POSIX_MQUEUE is not set | 26 | CONFIG_POSIX_MQUEUE=y |
| 27 | # CONFIG_BSD_PROCESS_ACCT is not set | 27 | # CONFIG_BSD_PROCESS_ACCT is not set |
| 28 | CONFIG_SYSCTL=y | 28 | CONFIG_SYSCTL=y |
| 29 | # CONFIG_AUDIT is not set | 29 | CONFIG_AUDIT=y |
| 30 | # CONFIG_AUDITSYSCALL is not set | ||
| 30 | CONFIG_HOTPLUG=y | 31 | CONFIG_HOTPLUG=y |
| 31 | CONFIG_KOBJECT_UEVENT=y | 32 | CONFIG_KOBJECT_UEVENT=y |
| 32 | CONFIG_IKCONFIG=y | 33 | CONFIG_IKCONFIG=y |
| @@ -36,6 +37,8 @@ CONFIG_IKCONFIG_PROC=y | |||
| 36 | CONFIG_KALLSYMS=y | 37 | CONFIG_KALLSYMS=y |
| 37 | # CONFIG_KALLSYMS_ALL is not set | 38 | # CONFIG_KALLSYMS_ALL is not set |
| 38 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 39 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
| 40 | CONFIG_PRINTK=y | ||
| 41 | CONFIG_BUG=y | ||
| 39 | CONFIG_BASE_FULL=y | 42 | CONFIG_BASE_FULL=y |
| 40 | CONFIG_FUTEX=y | 43 | CONFIG_FUTEX=y |
| 41 | CONFIG_EPOLL=y | 44 | CONFIG_EPOLL=y |
| @@ -51,9 +54,10 @@ CONFIG_BASE_SMALL=0 | |||
| 51 | # Loadable module support | 54 | # Loadable module support |
| 52 | # | 55 | # |
| 53 | CONFIG_MODULES=y | 56 | CONFIG_MODULES=y |
| 54 | # CONFIG_MODULE_UNLOAD is not set | 57 | CONFIG_MODULE_UNLOAD=y |
| 58 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
| 55 | CONFIG_OBSOLETE_MODPARM=y | 59 | CONFIG_OBSOLETE_MODPARM=y |
| 56 | # CONFIG_MODVERSIONS is not set | 60 | CONFIG_MODVERSIONS=y |
| 57 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 61 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
| 58 | CONFIG_KMOD=y | 62 | CONFIG_KMOD=y |
| 59 | CONFIG_STOP_MACHINE=y | 63 | CONFIG_STOP_MACHINE=y |
| @@ -81,8 +85,15 @@ CONFIG_MARCH_G5=y | |||
| 81 | # CONFIG_MARCH_Z990 is not set | 85 | # CONFIG_MARCH_Z990 is not set |
| 82 | CONFIG_PACK_STACK=y | 86 | CONFIG_PACK_STACK=y |
| 83 | # CONFIG_SMALL_STACK is not set | 87 | # CONFIG_SMALL_STACK is not set |
| 84 | # CONFIG_CHECK_STACK is not set | 88 | CONFIG_CHECK_STACK=y |
| 89 | CONFIG_STACK_GUARD=256 | ||
| 85 | # CONFIG_WARN_STACK is not set | 90 | # CONFIG_WARN_STACK is not set |
| 91 | CONFIG_SELECT_MEMORY_MODEL=y | ||
| 92 | CONFIG_FLATMEM_MANUAL=y | ||
| 93 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
| 94 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
| 95 | CONFIG_FLATMEM=y | ||
| 96 | CONFIG_FLAT_NODE_MEM_MAP=y | ||
| 86 | 97 | ||
| 87 | # | 98 | # |
| 88 | # I/O subsystem configuration | 99 | # I/O subsystem configuration |
| @@ -95,7 +106,7 @@ CONFIG_QDIO=y | |||
| 95 | # | 106 | # |
| 96 | # Misc | 107 | # Misc |
| 97 | # | 108 | # |
| 98 | # CONFIG_PREEMPT is not set | 109 | CONFIG_PREEMPT=y |
| 99 | CONFIG_IPL=y | 110 | CONFIG_IPL=y |
| 100 | # CONFIG_IPL_TAPE is not set | 111 | # CONFIG_IPL_TAPE is not set |
| 101 | CONFIG_IPL_VM=y | 112 | CONFIG_IPL_VM=y |
| @@ -105,9 +116,110 @@ CONFIG_BINFMT_MISC=m | |||
| 105 | CONFIG_PFAULT=y | 116 | CONFIG_PFAULT=y |
| 106 | # CONFIG_SHARED_KERNEL is not set | 117 | # CONFIG_SHARED_KERNEL is not set |
| 107 | # CONFIG_CMM is not set | 118 | # CONFIG_CMM is not set |
| 108 | # CONFIG_VIRT_TIMER is not set | 119 | CONFIG_VIRT_TIMER=y |
| 120 | CONFIG_VIRT_CPU_ACCOUNTING=y | ||
| 121 | # CONFIG_APPLDATA_BASE is not set | ||
| 109 | CONFIG_NO_IDLE_HZ=y | 122 | CONFIG_NO_IDLE_HZ=y |
| 110 | CONFIG_NO_IDLE_HZ_INIT=y | 123 | CONFIG_NO_IDLE_HZ_INIT=y |
| 124 | # CONFIG_KEXEC is not set | ||
| 125 | |||
| 126 | # | ||
| 127 | # Networking | ||
| 128 | # | ||
| 129 | CONFIG_NET=y | ||
| 130 | |||
| 131 | # | ||
| 132 | # Networking options | ||
| 133 | # | ||
| 134 | CONFIG_PACKET=y | ||
| 135 | # CONFIG_PACKET_MMAP is not set | ||
| 136 | CONFIG_UNIX=y | ||
| 137 | CONFIG_XFRM=y | ||
| 138 | # CONFIG_XFRM_USER is not set | ||
| 139 | CONFIG_NET_KEY=y | ||
| 140 | CONFIG_INET=y | ||
| 141 | CONFIG_IP_MULTICAST=y | ||
| 142 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
| 143 | CONFIG_IP_FIB_HASH=y | ||
| 144 | # CONFIG_IP_PNP is not set | ||
| 145 | # CONFIG_NET_IPIP is not set | ||
| 146 | # CONFIG_NET_IPGRE is not set | ||
| 147 | # CONFIG_IP_MROUTE is not set | ||
| 148 | # CONFIG_ARPD is not set | ||
| 149 | # CONFIG_SYN_COOKIES is not set | ||
| 150 | # CONFIG_INET_AH is not set | ||
| 151 | # CONFIG_INET_ESP is not set | ||
| 152 | # CONFIG_INET_IPCOMP is not set | ||
| 153 | # CONFIG_INET_TUNNEL is not set | ||
| 154 | CONFIG_IP_TCPDIAG=y | ||
| 155 | CONFIG_IP_TCPDIAG_IPV6=y | ||
| 156 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
| 157 | CONFIG_TCP_CONG_BIC=y | ||
| 158 | CONFIG_IPV6=y | ||
| 159 | # CONFIG_IPV6_PRIVACY is not set | ||
| 160 | # CONFIG_INET6_AH is not set | ||
| 161 | # CONFIG_INET6_ESP is not set | ||
| 162 | # CONFIG_INET6_IPCOMP is not set | ||
| 163 | # CONFIG_INET6_TUNNEL is not set | ||
| 164 | # CONFIG_IPV6_TUNNEL is not set | ||
| 165 | # CONFIG_NETFILTER is not set | ||
| 166 | |||
| 167 | # | ||
| 168 | # SCTP Configuration (EXPERIMENTAL) | ||
| 169 | # | ||
| 170 | # CONFIG_IP_SCTP is not set | ||
| 171 | # CONFIG_ATM is not set | ||
| 172 | # CONFIG_BRIDGE is not set | ||
| 173 | # CONFIG_VLAN_8021Q is not set | ||
| 174 | # CONFIG_DECNET is not set | ||
| 175 | # CONFIG_LLC2 is not set | ||
| 176 | # CONFIG_IPX is not set | ||
| 177 | # CONFIG_ATALK is not set | ||
| 178 | # CONFIG_X25 is not set | ||
| 179 | # CONFIG_LAPB is not set | ||
| 180 | # CONFIG_NET_DIVERT is not set | ||
| 181 | # CONFIG_ECONET is not set | ||
| 182 | # CONFIG_WAN_ROUTER is not set | ||
| 183 | CONFIG_NET_SCHED=y | ||
| 184 | CONFIG_NET_SCH_CLK_JIFFIES=y | ||
| 185 | # CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set | ||
| 186 | # CONFIG_NET_SCH_CLK_CPU is not set | ||
| 187 | CONFIG_NET_SCH_CBQ=m | ||
| 188 | # CONFIG_NET_SCH_HTB is not set | ||
| 189 | # CONFIG_NET_SCH_HFSC is not set | ||
| 190 | CONFIG_NET_SCH_PRIO=m | ||
| 191 | CONFIG_NET_SCH_RED=m | ||
| 192 | CONFIG_NET_SCH_SFQ=m | ||
| 193 | CONFIG_NET_SCH_TEQL=m | ||
| 194 | CONFIG_NET_SCH_TBF=m | ||
| 195 | CONFIG_NET_SCH_GRED=m | ||
| 196 | CONFIG_NET_SCH_DSMARK=m | ||
| 197 | # CONFIG_NET_SCH_NETEM is not set | ||
| 198 | # CONFIG_NET_SCH_INGRESS is not set | ||
| 199 | CONFIG_NET_QOS=y | ||
| 200 | CONFIG_NET_ESTIMATOR=y | ||
| 201 | CONFIG_NET_CLS=y | ||
| 202 | # CONFIG_NET_CLS_BASIC is not set | ||
| 203 | CONFIG_NET_CLS_TCINDEX=m | ||
| 204 | CONFIG_NET_CLS_ROUTE4=m | ||
| 205 | CONFIG_NET_CLS_ROUTE=y | ||
| 206 | CONFIG_NET_CLS_FW=m | ||
| 207 | CONFIG_NET_CLS_U32=m | ||
| 208 | # CONFIG_CLS_U32_PERF is not set | ||
| 209 | # CONFIG_NET_CLS_IND is not set | ||
| 210 | CONFIG_NET_CLS_RSVP=m | ||
| 211 | CONFIG_NET_CLS_RSVP6=m | ||
| 212 | # CONFIG_NET_EMATCH is not set | ||
| 213 | # CONFIG_NET_CLS_ACT is not set | ||
| 214 | CONFIG_NET_CLS_POLICE=y | ||
| 215 | |||
| 216 | # | ||
| 217 | # Network testing | ||
| 218 | # | ||
| 219 | # CONFIG_NET_PKTGEN is not set | ||
| 220 | # CONFIG_HAMRADIO is not set | ||
| 221 | # CONFIG_IRDA is not set | ||
| 222 | # CONFIG_BT is not set | ||
| 111 | # CONFIG_PCMCIA is not set | 223 | # CONFIG_PCMCIA is not set |
| 112 | 224 | ||
| 113 | # | 225 | # |
| @@ -133,6 +245,7 @@ CONFIG_CHR_DEV_ST=y | |||
| 133 | CONFIG_BLK_DEV_SR=y | 245 | CONFIG_BLK_DEV_SR=y |
| 134 | CONFIG_BLK_DEV_SR_VENDOR=y | 246 | CONFIG_BLK_DEV_SR_VENDOR=y |
| 135 | CONFIG_CHR_DEV_SG=y | 247 | CONFIG_CHR_DEV_SG=y |
| 248 | # CONFIG_CHR_DEV_SCH is not set | ||
| 136 | 249 | ||
| 137 | # | 250 | # |
| 138 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | 251 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs |
| @@ -205,7 +318,13 @@ CONFIG_MD_RAID5=m | |||
| 205 | # CONFIG_MD_RAID6 is not set | 318 | # CONFIG_MD_RAID6 is not set |
| 206 | CONFIG_MD_MULTIPATH=m | 319 | CONFIG_MD_MULTIPATH=m |
| 207 | # CONFIG_MD_FAULTY is not set | 320 | # CONFIG_MD_FAULTY is not set |
| 208 | # CONFIG_BLK_DEV_DM is not set | 321 | CONFIG_BLK_DEV_DM=y |
| 322 | CONFIG_DM_CRYPT=y | ||
| 323 | CONFIG_DM_SNAPSHOT=y | ||
| 324 | CONFIG_DM_MIRROR=y | ||
| 325 | CONFIG_DM_ZERO=y | ||
| 326 | CONFIG_DM_MULTIPATH=y | ||
| 327 | # CONFIG_DM_MULTIPATH_EMC is not set | ||
| 209 | 328 | ||
| 210 | # | 329 | # |
| 211 | # Character device drivers | 330 | # Character device drivers |
| @@ -231,7 +350,8 @@ CONFIG_CCW_CONSOLE=y | |||
| 231 | CONFIG_SCLP=y | 350 | CONFIG_SCLP=y |
| 232 | CONFIG_SCLP_TTY=y | 351 | CONFIG_SCLP_TTY=y |
| 233 | CONFIG_SCLP_CONSOLE=y | 352 | CONFIG_SCLP_CONSOLE=y |
| 234 | # CONFIG_SCLP_VT220_TTY is not set | 353 | CONFIG_SCLP_VT220_TTY=y |
| 354 | CONFIG_SCLP_VT220_CONSOLE=y | ||
| 235 | CONFIG_SCLP_CPI=m | 355 | CONFIG_SCLP_CPI=m |
| 236 | CONFIG_S390_TAPE=m | 356 | CONFIG_S390_TAPE=m |
| 237 | 357 | ||
| @@ -255,105 +375,8 @@ CONFIG_S390_TAPE_34XX=m | |||
| 255 | CONFIG_Z90CRYPT=m | 375 | CONFIG_Z90CRYPT=m |
| 256 | 376 | ||
| 257 | # | 377 | # |
| 258 | # Networking support | 378 | # Network device support |
| 259 | # | ||
| 260 | CONFIG_NET=y | ||
| 261 | |||
| 262 | # | ||
| 263 | # Networking options | ||
| 264 | # | ||
| 265 | CONFIG_PACKET=y | ||
| 266 | # CONFIG_PACKET_MMAP is not set | ||
| 267 | CONFIG_UNIX=y | ||
| 268 | CONFIG_NET_KEY=y | ||
| 269 | CONFIG_INET=y | ||
| 270 | CONFIG_IP_MULTICAST=y | ||
| 271 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
| 272 | # CONFIG_IP_PNP is not set | ||
| 273 | # CONFIG_NET_IPIP is not set | ||
| 274 | # CONFIG_NET_IPGRE is not set | ||
| 275 | # CONFIG_IP_MROUTE is not set | ||
| 276 | # CONFIG_ARPD is not set | ||
| 277 | # CONFIG_SYN_COOKIES is not set | ||
| 278 | # CONFIG_INET_AH is not set | ||
| 279 | # CONFIG_INET_ESP is not set | ||
| 280 | # CONFIG_INET_IPCOMP is not set | ||
| 281 | # CONFIG_INET_TUNNEL is not set | ||
| 282 | CONFIG_IP_TCPDIAG=y | ||
| 283 | CONFIG_IP_TCPDIAG_IPV6=y | ||
| 284 | CONFIG_IPV6=y | ||
| 285 | # CONFIG_IPV6_PRIVACY is not set | ||
| 286 | # CONFIG_INET6_AH is not set | ||
| 287 | # CONFIG_INET6_ESP is not set | ||
| 288 | # CONFIG_INET6_IPCOMP is not set | ||
| 289 | # CONFIG_INET6_TUNNEL is not set | ||
| 290 | # CONFIG_IPV6_TUNNEL is not set | ||
| 291 | # CONFIG_NETFILTER is not set | ||
| 292 | CONFIG_XFRM=y | ||
| 293 | # CONFIG_XFRM_USER is not set | ||
| 294 | |||
| 295 | # | ||
| 296 | # SCTP Configuration (EXPERIMENTAL) | ||
| 297 | # | ||
| 298 | # CONFIG_IP_SCTP is not set | ||
| 299 | # CONFIG_ATM is not set | ||
| 300 | # CONFIG_BRIDGE is not set | ||
| 301 | # CONFIG_VLAN_8021Q is not set | ||
| 302 | # CONFIG_DECNET is not set | ||
| 303 | # CONFIG_LLC2 is not set | ||
| 304 | # CONFIG_IPX is not set | ||
| 305 | # CONFIG_ATALK is not set | ||
| 306 | # CONFIG_X25 is not set | ||
| 307 | # CONFIG_LAPB is not set | ||
| 308 | # CONFIG_NET_DIVERT is not set | ||
| 309 | # CONFIG_ECONET is not set | ||
| 310 | # CONFIG_WAN_ROUTER is not set | ||
| 311 | |||
| 312 | # | ||
| 313 | # QoS and/or fair queueing | ||
| 314 | # | ||
| 315 | CONFIG_NET_SCHED=y | ||
| 316 | CONFIG_NET_SCH_CLK_JIFFIES=y | ||
| 317 | # CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set | ||
| 318 | # CONFIG_NET_SCH_CLK_CPU is not set | ||
| 319 | CONFIG_NET_SCH_CBQ=m | ||
| 320 | # CONFIG_NET_SCH_HTB is not set | ||
| 321 | # CONFIG_NET_SCH_HFSC is not set | ||
| 322 | CONFIG_NET_SCH_PRIO=m | ||
| 323 | CONFIG_NET_SCH_RED=m | ||
| 324 | CONFIG_NET_SCH_SFQ=m | ||
| 325 | CONFIG_NET_SCH_TEQL=m | ||
| 326 | CONFIG_NET_SCH_TBF=m | ||
| 327 | CONFIG_NET_SCH_GRED=m | ||
| 328 | CONFIG_NET_SCH_DSMARK=m | ||
| 329 | # CONFIG_NET_SCH_NETEM is not set | ||
| 330 | # CONFIG_NET_SCH_INGRESS is not set | ||
| 331 | CONFIG_NET_QOS=y | ||
| 332 | CONFIG_NET_ESTIMATOR=y | ||
| 333 | CONFIG_NET_CLS=y | ||
| 334 | # CONFIG_NET_CLS_BASIC is not set | ||
| 335 | CONFIG_NET_CLS_TCINDEX=m | ||
| 336 | CONFIG_NET_CLS_ROUTE4=m | ||
| 337 | CONFIG_NET_CLS_ROUTE=y | ||
| 338 | CONFIG_NET_CLS_FW=m | ||
| 339 | CONFIG_NET_CLS_U32=m | ||
| 340 | # CONFIG_CLS_U32_PERF is not set | ||
| 341 | # CONFIG_NET_CLS_IND is not set | ||
| 342 | CONFIG_NET_CLS_RSVP=m | ||
| 343 | CONFIG_NET_CLS_RSVP6=m | ||
| 344 | # CONFIG_NET_EMATCH is not set | ||
| 345 | # CONFIG_NET_CLS_ACT is not set | ||
| 346 | CONFIG_NET_CLS_POLICE=y | ||
| 347 | |||
| 348 | # | ||
| 349 | # Network testing | ||
| 350 | # | 379 | # |
| 351 | # CONFIG_NET_PKTGEN is not set | ||
| 352 | # CONFIG_NETPOLL is not set | ||
| 353 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
| 354 | # CONFIG_HAMRADIO is not set | ||
| 355 | # CONFIG_IRDA is not set | ||
| 356 | # CONFIG_BT is not set | ||
| 357 | CONFIG_NETDEVICES=y | 380 | CONFIG_NETDEVICES=y |
| 358 | CONFIG_DUMMY=m | 381 | CONFIG_DUMMY=m |
| 359 | CONFIG_BONDING=m | 382 | CONFIG_BONDING=m |
| @@ -411,12 +434,15 @@ CONFIG_CCWGROUP=y | |||
| 411 | # CONFIG_SLIP is not set | 434 | # CONFIG_SLIP is not set |
| 412 | # CONFIG_SHAPER is not set | 435 | # CONFIG_SHAPER is not set |
| 413 | # CONFIG_NETCONSOLE is not set | 436 | # CONFIG_NETCONSOLE is not set |
| 437 | # CONFIG_NETPOLL is not set | ||
| 438 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
| 414 | 439 | ||
| 415 | # | 440 | # |
| 416 | # File systems | 441 | # File systems |
| 417 | # | 442 | # |
| 418 | CONFIG_EXT2_FS=y | 443 | CONFIG_EXT2_FS=y |
| 419 | # CONFIG_EXT2_FS_XATTR is not set | 444 | # CONFIG_EXT2_FS_XATTR is not set |
| 445 | # CONFIG_EXT2_FS_XIP is not set | ||
| 420 | CONFIG_EXT3_FS=y | 446 | CONFIG_EXT3_FS=y |
| 421 | CONFIG_EXT3_FS_XATTR=y | 447 | CONFIG_EXT3_FS_XATTR=y |
| 422 | # CONFIG_EXT3_FS_POSIX_ACL is not set | 448 | # CONFIG_EXT3_FS_POSIX_ACL is not set |
| @@ -426,6 +452,7 @@ CONFIG_JBD=y | |||
| 426 | CONFIG_FS_MBCACHE=y | 452 | CONFIG_FS_MBCACHE=y |
| 427 | # CONFIG_REISERFS_FS is not set | 453 | # CONFIG_REISERFS_FS is not set |
| 428 | # CONFIG_JFS_FS is not set | 454 | # CONFIG_JFS_FS is not set |
| 455 | # CONFIG_FS_POSIX_ACL is not set | ||
| 429 | 456 | ||
| 430 | # | 457 | # |
| 431 | # XFS support | 458 | # XFS support |
| @@ -433,6 +460,7 @@ CONFIG_FS_MBCACHE=y | |||
| 433 | # CONFIG_XFS_FS is not set | 460 | # CONFIG_XFS_FS is not set |
| 434 | # CONFIG_MINIX_FS is not set | 461 | # CONFIG_MINIX_FS is not set |
| 435 | # CONFIG_ROMFS_FS is not set | 462 | # CONFIG_ROMFS_FS is not set |
| 463 | CONFIG_INOTIFY=y | ||
| 436 | # CONFIG_QUOTA is not set | 464 | # CONFIG_QUOTA is not set |
| 437 | CONFIG_DNOTIFY=y | 465 | CONFIG_DNOTIFY=y |
| 438 | # CONFIG_AUTOFS_FS is not set | 466 | # CONFIG_AUTOFS_FS is not set |
| @@ -457,7 +485,6 @@ CONFIG_DNOTIFY=y | |||
| 457 | CONFIG_PROC_FS=y | 485 | CONFIG_PROC_FS=y |
| 458 | CONFIG_PROC_KCORE=y | 486 | CONFIG_PROC_KCORE=y |
| 459 | CONFIG_SYSFS=y | 487 | CONFIG_SYSFS=y |
| 460 | # CONFIG_DEVFS_FS is not set | ||
| 461 | # CONFIG_DEVPTS_FS_XATTR is not set | 488 | # CONFIG_DEVPTS_FS_XATTR is not set |
| 462 | CONFIG_TMPFS=y | 489 | CONFIG_TMPFS=y |
| 463 | # CONFIG_TMPFS_XATTR is not set | 490 | # CONFIG_TMPFS_XATTR is not set |
| @@ -486,15 +513,18 @@ CONFIG_RAMFS=y | |||
| 486 | # | 513 | # |
| 487 | CONFIG_NFS_FS=y | 514 | CONFIG_NFS_FS=y |
| 488 | CONFIG_NFS_V3=y | 515 | CONFIG_NFS_V3=y |
| 516 | # CONFIG_NFS_V3_ACL is not set | ||
| 489 | # CONFIG_NFS_V4 is not set | 517 | # CONFIG_NFS_V4 is not set |
| 490 | # CONFIG_NFS_DIRECTIO is not set | 518 | # CONFIG_NFS_DIRECTIO is not set |
| 491 | CONFIG_NFSD=y | 519 | CONFIG_NFSD=y |
| 492 | CONFIG_NFSD_V3=y | 520 | CONFIG_NFSD_V3=y |
| 521 | # CONFIG_NFSD_V3_ACL is not set | ||
| 493 | # CONFIG_NFSD_V4 is not set | 522 | # CONFIG_NFSD_V4 is not set |
| 494 | CONFIG_NFSD_TCP=y | 523 | CONFIG_NFSD_TCP=y |
| 495 | CONFIG_LOCKD=y | 524 | CONFIG_LOCKD=y |
| 496 | CONFIG_LOCKD_V4=y | 525 | CONFIG_LOCKD_V4=y |
| 497 | CONFIG_EXPORTFS=y | 526 | CONFIG_EXPORTFS=y |
| 527 | CONFIG_NFS_COMMON=y | ||
| 498 | CONFIG_SUNRPC=y | 528 | CONFIG_SUNRPC=y |
| 499 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 529 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
| 500 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 530 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
| @@ -544,11 +574,12 @@ CONFIG_MAGIC_SYSRQ=y | |||
| 544 | CONFIG_LOG_BUF_SHIFT=17 | 574 | CONFIG_LOG_BUF_SHIFT=17 |
| 545 | # CONFIG_SCHEDSTATS is not set | 575 | # CONFIG_SCHEDSTATS is not set |
| 546 | # CONFIG_DEBUG_SLAB is not set | 576 | # CONFIG_DEBUG_SLAB is not set |
| 577 | CONFIG_DEBUG_PREEMPT=y | ||
| 547 | # CONFIG_DEBUG_SPINLOCK is not set | 578 | # CONFIG_DEBUG_SPINLOCK is not set |
| 548 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 579 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
| 549 | # CONFIG_DEBUG_KOBJECT is not set | 580 | # CONFIG_DEBUG_KOBJECT is not set |
| 550 | # CONFIG_DEBUG_INFO is not set | 581 | # CONFIG_DEBUG_INFO is not set |
| 551 | # CONFIG_DEBUG_FS is not set | 582 | CONFIG_DEBUG_FS=y |
| 552 | 583 | ||
| 553 | # | 584 | # |
| 554 | # Security options | 585 | # Security options |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index d12cff11b4bc..2710e66fefba 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
| @@ -346,6 +346,13 @@ iplstart: | |||
| 346 | la %r2,.Lreset | 346 | la %r2,.Lreset |
| 347 | lhi %r3,26 | 347 | lhi %r3,26 |
| 348 | diag %r2,%r3,8 | 348 | diag %r2,%r3,8 |
| 349 | la %r5,.Lirb | ||
| 350 | stsch 0(%r5) # check if irq is pending | ||
| 351 | tm 30(%r5),0x0f # by verifying if any of the | ||
| 352 | bnz .Lwaitforirq # activity or status control | ||
| 353 | tm 31(%r5),0xff # bits is set in the schib | ||
| 354 | bz .Lnoreset | ||
| 355 | .Lwaitforirq: | ||
| 349 | mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw | 356 | mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw |
| 350 | .Lwaitrdrirq: | 357 | .Lwaitrdrirq: |
| 351 | lpsw .Lrdrwaitpsw | 358 | lpsw .Lrdrwaitpsw |
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S index 10bc592c3637..9a8263a153cb 100644 --- a/arch/s390/kernel/head64.S +++ b/arch/s390/kernel/head64.S | |||
| @@ -345,6 +345,13 @@ iplstart: | |||
| 345 | la %r2,.Lreset | 345 | la %r2,.Lreset |
| 346 | lhi %r3,26 | 346 | lhi %r3,26 |
| 347 | diag %r2,%r3,8 | 347 | diag %r2,%r3,8 |
| 348 | la %r5,.Lirb | ||
| 349 | stsch 0(%r5) # check if irq is pending | ||
| 350 | tm 30(%r5),0x0f # by verifying if any of the | ||
| 351 | bnz .Lwaitforirq # activity or status control | ||
| 352 | tm 31(%r5),0xff # bits is set in the schib | ||
| 353 | bz .Lnoreset | ||
| 354 | .Lwaitforirq: | ||
| 348 | mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw | 355 | mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw |
| 349 | .Lwaitrdrirq: | 356 | .Lwaitrdrirq: |
| 350 | lpsw .Lrdrwaitpsw | 357 | lpsw .Lrdrwaitpsw |
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/elf_aux.c b/arch/um/os-Linux/elf_aux.c index 5423b1ca17c4..9416e1c29926 100644 --- a/arch/um/os-Linux/elf_aux.c +++ b/arch/um/os-Linux/elf_aux.c | |||
| @@ -9,9 +9,10 @@ | |||
| 9 | */ | 9 | */ |
| 10 | #include <elf.h> | 10 | #include <elf.h> |
| 11 | #include <stddef.h> | 11 | #include <stddef.h> |
| 12 | #include <asm/elf.h> | ||
| 12 | #include "init.h" | 13 | #include "init.h" |
| 13 | #include "elf_user.h" | 14 | #include "elf_user.h" |
| 14 | #include <asm/elf.h> | 15 | #include "mem_user.h" |
| 15 | 16 | ||
| 16 | #if ELF_CLASS == ELFCLASS32 | 17 | #if ELF_CLASS == ELFCLASS32 |
| 17 | typedef Elf32_auxv_t elf_auxv_t; | 18 | typedef Elf32_auxv_t elf_auxv_t; |
| @@ -41,6 +42,9 @@ __init void scan_elf_aux( char **envp) | |||
| 41 | break; | 42 | break; |
| 42 | case AT_SYSINFO_EHDR: | 43 | case AT_SYSINFO_EHDR: |
| 43 | vsyscall_ehdr = auxv->a_un.a_val; | 44 | vsyscall_ehdr = auxv->a_un.a_val; |
| 45 | /* See if the page is under TASK_SIZE */ | ||
| 46 | if (vsyscall_ehdr < (unsigned long) envp) | ||
| 47 | vsyscall_ehdr = 0; | ||
| 44 | break; | 48 | break; |
| 45 | case AT_HWCAP: | 49 | case AT_HWCAP: |
| 46 | elf_aux_hwcap = auxv->a_un.a_val; | 50 | elf_aux_hwcap = auxv->a_un.a_val; |
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/machine_kexec.c b/arch/x86_64/kernel/machine_kexec.c index 60d1eff41567..89fab51e20f4 100644 --- a/arch/x86_64/kernel/machine_kexec.c +++ b/arch/x86_64/kernel/machine_kexec.c | |||
| @@ -8,43 +8,26 @@ | |||
| 8 | 8 | ||
| 9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
| 10 | #include <linux/kexec.h> | 10 | #include <linux/kexec.h> |
| 11 | #include <linux/delay.h> | ||
| 12 | #include <linux/string.h> | 11 | #include <linux/string.h> |
| 13 | #include <linux/reboot.h> | 12 | #include <linux/reboot.h> |
| 14 | #include <asm/pda.h> | ||
| 15 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
| 16 | #include <asm/pgalloc.h> | ||
| 17 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
| 18 | #include <asm/mmu_context.h> | 15 | #include <asm/mmu_context.h> |
| 19 | #include <asm/io.h> | 16 | #include <asm/io.h> |
| 20 | #include <asm/apic.h> | 17 | |
| 21 | #include <asm/cpufeature.h> | 18 | static void init_level2_page(pmd_t *level2p, unsigned long addr) |
| 22 | #include <asm/hw_irq.h> | ||
| 23 | |||
| 24 | #define LEVEL0_SIZE (1UL << 12UL) | ||
| 25 | #define LEVEL1_SIZE (1UL << 21UL) | ||
| 26 | #define LEVEL2_SIZE (1UL << 30UL) | ||
| 27 | #define LEVEL3_SIZE (1UL << 39UL) | ||
| 28 | #define LEVEL4_SIZE (1UL << 48UL) | ||
| 29 | |||
| 30 | #define L0_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
| 31 | #define L1_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE) | ||
| 32 | #define L2_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
| 33 | #define L3_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
| 34 | |||
| 35 | static void init_level2_page(u64 *level2p, unsigned long addr) | ||
| 36 | { | 19 | { |
| 37 | unsigned long end_addr; | 20 | unsigned long end_addr; |
| 38 | 21 | ||
| 39 | addr &= PAGE_MASK; | 22 | addr &= PAGE_MASK; |
| 40 | end_addr = addr + LEVEL2_SIZE; | 23 | end_addr = addr + PUD_SIZE; |
| 41 | while (addr < end_addr) { | 24 | while (addr < end_addr) { |
| 42 | *(level2p++) = addr | L1_ATTR; | 25 | set_pmd(level2p++, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC)); |
| 43 | addr += LEVEL1_SIZE; | 26 | addr += PMD_SIZE; |
| 44 | } | 27 | } |
| 45 | } | 28 | } |
| 46 | 29 | ||
| 47 | static int init_level3_page(struct kimage *image, u64 *level3p, | 30 | static int init_level3_page(struct kimage *image, pud_t *level3p, |
| 48 | unsigned long addr, unsigned long last_addr) | 31 | unsigned long addr, unsigned long last_addr) |
| 49 | { | 32 | { |
| 50 | unsigned long end_addr; | 33 | unsigned long end_addr; |
| @@ -52,32 +35,32 @@ static int init_level3_page(struct kimage *image, u64 *level3p, | |||
| 52 | 35 | ||
| 53 | result = 0; | 36 | result = 0; |
| 54 | addr &= PAGE_MASK; | 37 | addr &= PAGE_MASK; |
| 55 | end_addr = addr + LEVEL3_SIZE; | 38 | end_addr = addr + PGDIR_SIZE; |
| 56 | while ((addr < last_addr) && (addr < end_addr)) { | 39 | while ((addr < last_addr) && (addr < end_addr)) { |
| 57 | struct page *page; | 40 | struct page *page; |
| 58 | u64 *level2p; | 41 | pmd_t *level2p; |
| 59 | 42 | ||
| 60 | page = kimage_alloc_control_pages(image, 0); | 43 | page = kimage_alloc_control_pages(image, 0); |
| 61 | if (!page) { | 44 | if (!page) { |
| 62 | result = -ENOMEM; | 45 | result = -ENOMEM; |
| 63 | goto out; | 46 | goto out; |
| 64 | } | 47 | } |
| 65 | level2p = (u64 *)page_address(page); | 48 | level2p = (pmd_t *)page_address(page); |
| 66 | init_level2_page(level2p, addr); | 49 | init_level2_page(level2p, addr); |
| 67 | *(level3p++) = __pa(level2p) | L2_ATTR; | 50 | set_pud(level3p++, __pud(__pa(level2p) | _KERNPG_TABLE)); |
| 68 | addr += LEVEL2_SIZE; | 51 | addr += PUD_SIZE; |
| 69 | } | 52 | } |
| 70 | /* clear the unused entries */ | 53 | /* clear the unused entries */ |
| 71 | while (addr < end_addr) { | 54 | while (addr < end_addr) { |
| 72 | *(level3p++) = 0; | 55 | pud_clear(level3p++); |
| 73 | addr += LEVEL2_SIZE; | 56 | addr += PUD_SIZE; |
| 74 | } | 57 | } |
| 75 | out: | 58 | out: |
| 76 | return result; | 59 | return result; |
| 77 | } | 60 | } |
| 78 | 61 | ||
| 79 | 62 | ||
| 80 | static int init_level4_page(struct kimage *image, u64 *level4p, | 63 | static int init_level4_page(struct kimage *image, pgd_t *level4p, |
| 81 | unsigned long addr, unsigned long last_addr) | 64 | unsigned long addr, unsigned long last_addr) |
| 82 | { | 65 | { |
| 83 | unsigned long end_addr; | 66 | unsigned long end_addr; |
| @@ -85,28 +68,28 @@ static int init_level4_page(struct kimage *image, u64 *level4p, | |||
| 85 | 68 | ||
| 86 | result = 0; | 69 | result = 0; |
| 87 | addr &= PAGE_MASK; | 70 | addr &= PAGE_MASK; |
| 88 | end_addr = addr + LEVEL4_SIZE; | 71 | end_addr = addr + (PTRS_PER_PGD * PGDIR_SIZE); |
| 89 | while ((addr < last_addr) && (addr < end_addr)) { | 72 | while ((addr < last_addr) && (addr < end_addr)) { |
| 90 | struct page *page; | 73 | struct page *page; |
| 91 | u64 *level3p; | 74 | pud_t *level3p; |
| 92 | 75 | ||
| 93 | page = kimage_alloc_control_pages(image, 0); | 76 | page = kimage_alloc_control_pages(image, 0); |
| 94 | if (!page) { | 77 | if (!page) { |
| 95 | result = -ENOMEM; | 78 | result = -ENOMEM; |
| 96 | goto out; | 79 | goto out; |
| 97 | } | 80 | } |
| 98 | level3p = (u64 *)page_address(page); | 81 | level3p = (pud_t *)page_address(page); |
| 99 | result = init_level3_page(image, level3p, addr, last_addr); | 82 | result = init_level3_page(image, level3p, addr, last_addr); |
| 100 | if (result) { | 83 | if (result) { |
| 101 | goto out; | 84 | goto out; |
| 102 | } | 85 | } |
| 103 | *(level4p++) = __pa(level3p) | L3_ATTR; | 86 | set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE)); |
| 104 | addr += LEVEL3_SIZE; | 87 | addr += PGDIR_SIZE; |
| 105 | } | 88 | } |
| 106 | /* clear the unused entries */ | 89 | /* clear the unused entries */ |
| 107 | while (addr < end_addr) { | 90 | while (addr < end_addr) { |
| 108 | *(level4p++) = 0; | 91 | pgd_clear(level4p++); |
| 109 | addr += LEVEL3_SIZE; | 92 | addr += PGDIR_SIZE; |
| 110 | } | 93 | } |
| 111 | out: | 94 | out: |
| 112 | return result; | 95 | return result; |
| @@ -115,52 +98,50 @@ out: | |||
| 115 | 98 | ||
| 116 | static int init_pgtable(struct kimage *image, unsigned long start_pgtable) | 99 | static int init_pgtable(struct kimage *image, unsigned long start_pgtable) |
| 117 | { | 100 | { |
| 118 | u64 *level4p; | 101 | pgd_t *level4p; |
| 119 | level4p = (u64 *)__va(start_pgtable); | 102 | level4p = (pgd_t *)__va(start_pgtable); |
| 120 | return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); | 103 | return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); |
| 121 | } | 104 | } |
| 122 | 105 | ||
| 123 | static void set_idt(void *newidt, u16 limit) | 106 | static void set_idt(void *newidt, u16 limit) |
| 124 | { | 107 | { |
| 125 | unsigned char curidt[10]; | 108 | struct desc_ptr curidt; |
| 126 | 109 | ||
| 127 | /* x86-64 supports unaliged loads & stores */ | 110 | /* x86-64 supports unaliged loads & stores */ |
| 128 | (*(u16 *)(curidt)) = limit; | 111 | curidt.size = limit; |
| 129 | (*(u64 *)(curidt +2)) = (unsigned long)(newidt); | 112 | curidt.address = (unsigned long)newidt; |
| 130 | 113 | ||
| 131 | __asm__ __volatile__ ( | 114 | __asm__ __volatile__ ( |
| 132 | "lidt %0\n" | 115 | "lidtq %0\n" |
| 133 | : "=m" (curidt) | 116 | : : "m" (curidt) |
| 134 | ); | 117 | ); |
| 135 | }; | 118 | }; |
| 136 | 119 | ||
| 137 | 120 | ||
| 138 | static void set_gdt(void *newgdt, u16 limit) | 121 | static void set_gdt(void *newgdt, u16 limit) |
| 139 | { | 122 | { |
| 140 | unsigned char curgdt[10]; | 123 | struct desc_ptr curgdt; |
| 141 | 124 | ||
| 142 | /* x86-64 supports unaligned loads & stores */ | 125 | /* x86-64 supports unaligned loads & stores */ |
| 143 | (*(u16 *)(curgdt)) = limit; | 126 | curgdt.size = limit; |
| 144 | (*(u64 *)(curgdt +2)) = (unsigned long)(newgdt); | 127 | curgdt.address = (unsigned long)newgdt; |
| 145 | 128 | ||
| 146 | __asm__ __volatile__ ( | 129 | __asm__ __volatile__ ( |
| 147 | "lgdt %0\n" | 130 | "lgdtq %0\n" |
| 148 | : "=m" (curgdt) | 131 | : : "m" (curgdt) |
| 149 | ); | 132 | ); |
| 150 | }; | 133 | }; |
| 151 | 134 | ||
| 152 | static void load_segments(void) | 135 | static void load_segments(void) |
| 153 | { | 136 | { |
| 154 | __asm__ __volatile__ ( | 137 | __asm__ __volatile__ ( |
| 155 | "\tmovl $"STR(__KERNEL_DS)",%eax\n" | 138 | "\tmovl %0,%%ds\n" |
| 156 | "\tmovl %eax,%ds\n" | 139 | "\tmovl %0,%%es\n" |
| 157 | "\tmovl %eax,%es\n" | 140 | "\tmovl %0,%%ss\n" |
| 158 | "\tmovl %eax,%ss\n" | 141 | "\tmovl %0,%%fs\n" |
| 159 | "\tmovl %eax,%fs\n" | 142 | "\tmovl %0,%%gs\n" |
| 160 | "\tmovl %eax,%gs\n" | 143 | : : "a" (__KERNEL_DS) |
| 161 | ); | 144 | ); |
| 162 | #undef STR | ||
| 163 | #undef __STR | ||
| 164 | } | 145 | } |
| 165 | 146 | ||
| 166 | typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page, | 147 | typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page, |
| @@ -178,7 +159,7 @@ int machine_kexec_prepare(struct kimage *image) | |||
| 178 | 159 | ||
| 179 | /* Calculate the offsets */ | 160 | /* Calculate the offsets */ |
| 180 | start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; | 161 | start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; |
| 181 | control_code_buffer = start_pgtable + 4096UL; | 162 | control_code_buffer = start_pgtable + PAGE_SIZE; |
| 182 | 163 | ||
| 183 | /* Setup the identity mapped 64bit page table */ | 164 | /* Setup the identity mapped 64bit page table */ |
| 184 | result = init_pgtable(image, start_pgtable); | 165 | result = init_pgtable(image, start_pgtable); |
| @@ -214,7 +195,7 @@ NORET_TYPE void machine_kexec(struct kimage *image) | |||
| 214 | /* Calculate the offsets */ | 195 | /* Calculate the offsets */ |
| 215 | page_list = image->head; | 196 | page_list = image->head; |
| 216 | start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; | 197 | start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; |
| 217 | control_code_buffer = start_pgtable + 4096UL; | 198 | control_code_buffer = start_pgtable + PAGE_SIZE; |
| 218 | 199 | ||
| 219 | /* Set the low half of the page table to my identity mapped | 200 | /* Set the low half of the page table to my identity mapped |
| 220 | * page table for kexec. Leave the high half pointing at the | 201 | * page table for kexec. Leave the high half pointing at the |
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..e5958220d6b8 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 | ||
| @@ -294,6 +293,69 @@ void unlock_ipi_call_lock(void) | |||
| 294 | } | 293 | } |
| 295 | 294 | ||
| 296 | /* | 295 | /* |
| 296 | * this function sends a 'generic call function' IPI to one other CPU | ||
| 297 | * in the system. | ||
| 298 | */ | ||
| 299 | static void __smp_call_function_single (int cpu, void (*func) (void *info), void *info, | ||
| 300 | int nonatomic, int wait) | ||
| 301 | { | ||
| 302 | struct call_data_struct data; | ||
| 303 | int cpus = 1; | ||
| 304 | |||
| 305 | data.func = func; | ||
| 306 | data.info = info; | ||
| 307 | atomic_set(&data.started, 0); | ||
| 308 | data.wait = wait; | ||
| 309 | if (wait) | ||
| 310 | atomic_set(&data.finished, 0); | ||
| 311 | |||
| 312 | call_data = &data; | ||
| 313 | wmb(); | ||
| 314 | /* Send a message to all other CPUs and wait for them to respond */ | ||
| 315 | send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); | ||
| 316 | |||
| 317 | /* Wait for response */ | ||
| 318 | while (atomic_read(&data.started) != cpus) | ||
| 319 | cpu_relax(); | ||
| 320 | |||
| 321 | if (!wait) | ||
| 322 | return; | ||
| 323 | |||
| 324 | while (atomic_read(&data.finished) != cpus) | ||
| 325 | cpu_relax(); | ||
| 326 | } | ||
| 327 | |||
| 328 | /* | ||
| 329 | * smp_call_function_single - Run a function on another CPU | ||
| 330 | * @func: The function to run. This must be fast and non-blocking. | ||
| 331 | * @info: An arbitrary pointer to pass to the function. | ||
| 332 | * @nonatomic: Currently unused. | ||
| 333 | * @wait: If true, wait until function has completed on other CPUs. | ||
| 334 | * | ||
| 335 | * Retrurns 0 on success, else a negative status code. | ||
| 336 | * | ||
| 337 | * Does not return until the remote CPU is nearly ready to execute <func> | ||
| 338 | * or is or has executed. | ||
| 339 | */ | ||
| 340 | |||
| 341 | int smp_call_function_single (int cpu, void (*func) (void *info), void *info, | ||
| 342 | int nonatomic, int wait) | ||
| 343 | { | ||
| 344 | /* prevent preemption and reschedule on another processor */ | ||
| 345 | int me = get_cpu(); | ||
| 346 | if (cpu == me) { | ||
| 347 | WARN_ON(1); | ||
| 348 | put_cpu(); | ||
| 349 | return -EBUSY; | ||
| 350 | } | ||
| 351 | spin_lock_bh(&call_lock); | ||
| 352 | __smp_call_function_single(cpu, func, info, nonatomic, wait); | ||
| 353 | spin_unlock_bh(&call_lock); | ||
| 354 | put_cpu(); | ||
| 355 | return 0; | ||
| 356 | } | ||
| 357 | |||
| 358 | /* | ||
| 297 | * this function sends a 'generic call function' IPI to all other CPUs | 359 | * this function sends a 'generic call function' IPI to all other CPUs |
| 298 | * in the system. | 360 | * in the system. |
| 299 | */ | 361 | */ |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index e773a794ec45..6e4807d64d46 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. |
| @@ -229,9 +211,6 @@ static __cpuinit void sync_master(void *arg) | |||
| 229 | { | 211 | { |
| 230 | unsigned long flags, i; | 212 | unsigned long flags, i; |
| 231 | 213 | ||
| 232 | if (smp_processor_id() != 0) | ||
| 233 | return; | ||
| 234 | |||
| 235 | go[MASTER] = 0; | 214 | go[MASTER] = 0; |
| 236 | 215 | ||
| 237 | local_irq_save(flags); | 216 | local_irq_save(flags); |
| @@ -280,7 +259,7 @@ get_delta(long *rt, long *master) | |||
| 280 | return tcenter - best_tm; | 259 | return tcenter - best_tm; |
| 281 | } | 260 | } |
| 282 | 261 | ||
| 283 | static __cpuinit void sync_tsc(void) | 262 | static __cpuinit void sync_tsc(unsigned int master) |
| 284 | { | 263 | { |
| 285 | int i, done = 0; | 264 | int i, done = 0; |
| 286 | long delta, adj, adjust_latency = 0; | 265 | long delta, adj, adjust_latency = 0; |
| @@ -294,9 +273,17 @@ static __cpuinit void sync_tsc(void) | |||
| 294 | } t[NUM_ROUNDS] __cpuinitdata; | 273 | } t[NUM_ROUNDS] __cpuinitdata; |
| 295 | #endif | 274 | #endif |
| 296 | 275 | ||
| 276 | printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n", | ||
| 277 | smp_processor_id(), master); | ||
| 278 | |||
| 297 | go[MASTER] = 1; | 279 | go[MASTER] = 1; |
| 298 | 280 | ||
| 299 | smp_call_function(sync_master, NULL, 1, 0); | 281 | /* It is dangerous to broadcast IPI as cpus are coming up, |
| 282 | * as they may not be ready to accept them. So since | ||
| 283 | * we only need to send the ipi to the boot cpu direct | ||
| 284 | * the message, and avoid the race. | ||
| 285 | */ | ||
| 286 | smp_call_function_single(master, sync_master, NULL, 1, 0); | ||
| 300 | 287 | ||
| 301 | while (go[MASTER]) /* wait for master to be ready */ | 288 | while (go[MASTER]) /* wait for master to be ready */ |
| 302 | no_cpu_relax(); | 289 | no_cpu_relax(); |
| @@ -340,16 +327,14 @@ static __cpuinit void sync_tsc(void) | |||
| 340 | printk(KERN_INFO | 327 | printk(KERN_INFO |
| 341 | "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, " | 328 | "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, " |
| 342 | "maxerr %lu cycles)\n", | 329 | "maxerr %lu cycles)\n", |
| 343 | smp_processor_id(), boot_cpu_id, delta, rt); | 330 | smp_processor_id(), master, delta, rt); |
| 344 | } | 331 | } |
| 345 | 332 | ||
| 346 | static void __cpuinit tsc_sync_wait(void) | 333 | static void __cpuinit tsc_sync_wait(void) |
| 347 | { | 334 | { |
| 348 | if (notscsync || !cpu_has_tsc) | 335 | if (notscsync || !cpu_has_tsc) |
| 349 | return; | 336 | return; |
| 350 | printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n", smp_processor_id(), | 337 | sync_tsc(boot_cpu_id); |
| 351 | boot_cpu_id); | ||
| 352 | sync_tsc(); | ||
| 353 | } | 338 | } |
| 354 | 339 | ||
| 355 | static __init int notscsync_setup(char *s) | 340 | static __init int notscsync_setup(char *s) |
| @@ -773,8 +758,9 @@ do_rest: | |||
| 773 | initial_code = start_secondary; | 758 | initial_code = start_secondary; |
| 774 | clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); | 759 | clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); |
| 775 | 760 | ||
| 776 | printk(KERN_INFO "Booting processor %d/%d rip %lx rsp %lx\n", cpu, apicid, | 761 | printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu, |
| 777 | start_rip, init_rsp); | 762 | cpus_weight(cpu_present_map), |
| 763 | apicid); | ||
| 778 | 764 | ||
| 779 | /* | 765 | /* |
| 780 | * This grunge runs the startup process for | 766 | * This grunge runs the startup process for |
| @@ -924,6 +910,27 @@ static __init void enforce_max_cpus(unsigned max_cpus) | |||
| 924 | } | 910 | } |
| 925 | } | 911 | } |
| 926 | 912 | ||
| 913 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 914 | /* | ||
| 915 | * cpu_possible_map should be static, it cannot change as cpu's | ||
| 916 | * are onlined, or offlined. The reason is per-cpu data-structures | ||
| 917 | * are allocated by some modules at init time, and dont expect to | ||
| 918 | * do this dynamically on cpu arrival/departure. | ||
| 919 | * cpu_present_map on the other hand can change dynamically. | ||
| 920 | * In case when cpu_hotplug is not compiled, then we resort to current | ||
| 921 | * behaviour, which is cpu_possible == cpu_present. | ||
| 922 | * If cpu-hotplug is supported, then we need to preallocate for all | ||
| 923 | * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range. | ||
| 924 | * - Ashok Raj | ||
| 925 | */ | ||
| 926 | static void prefill_possible_map(void) | ||
| 927 | { | ||
| 928 | int i; | ||
| 929 | for (i = 0; i < NR_CPUS; i++) | ||
| 930 | cpu_set(i, cpu_possible_map); | ||
| 931 | } | ||
| 932 | #endif | ||
| 933 | |||
| 927 | /* | 934 | /* |
| 928 | * Various sanity checks. | 935 | * Various sanity checks. |
| 929 | */ | 936 | */ |
| @@ -987,25 +994,15 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
| 987 | */ | 994 | */ |
| 988 | void __init smp_prepare_cpus(unsigned int max_cpus) | 995 | void __init smp_prepare_cpus(unsigned int max_cpus) |
| 989 | { | 996 | { |
| 990 | int i; | ||
| 991 | |||
| 992 | nmi_watchdog_default(); | 997 | nmi_watchdog_default(); |
| 993 | current_cpu_data = boot_cpu_data; | 998 | current_cpu_data = boot_cpu_data; |
| 994 | current_thread_info()->cpu = 0; /* needed? */ | 999 | current_thread_info()->cpu = 0; /* needed? */ |
| 995 | 1000 | ||
| 996 | enforce_max_cpus(max_cpus); | 1001 | enforce_max_cpus(max_cpus); |
| 997 | 1002 | ||
| 998 | /* | 1003 | #ifdef CONFIG_HOTPLUG_CPU |
| 999 | * Fill in cpu_present_mask | 1004 | prefill_possible_map(); |
| 1000 | */ | 1005 | #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 | 1006 | ||
| 1010 | if (smp_sanity_check(max_cpus) < 0) { | 1007 | if (smp_sanity_check(max_cpus) < 0) { |
| 1011 | printk(KERN_INFO "SMP disabled\n"); | 1008 | printk(KERN_INFO "SMP disabled\n"); |
| @@ -1189,8 +1186,7 @@ void __cpu_die(unsigned int cpu) | |||
| 1189 | printk ("CPU %d is now offline\n", cpu); | 1186 | printk ("CPU %d is now offline\n", cpu); |
| 1190 | return; | 1187 | return; |
| 1191 | } | 1188 | } |
| 1192 | current->state = TASK_UNINTERRUPTIBLE; | 1189 | msleep(100); |
| 1193 | schedule_timeout(HZ/10); | ||
| 1194 | } | 1190 | } |
| 1195 | printk(KERN_ERR "CPU %u didn't die...\n", cpu); | 1191 | printk(KERN_ERR "CPU %u didn't die...\n", cpu); |
| 1196 | } | 1192 | } |
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/char/agp/agp.h b/drivers/char/agp/agp.h index c1fe013c64f3..b4af87c6f9c8 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
| @@ -143,6 +143,7 @@ struct agp_bridge_data { | |||
| 143 | char major_version; | 143 | char major_version; |
| 144 | char minor_version; | 144 | char minor_version; |
| 145 | struct list_head list; | 145 | struct list_head list; |
| 146 | u32 apbase_config; | ||
| 146 | }; | 147 | }; |
| 147 | 148 | ||
| 148 | #define KB(x) ((x) * 1024) | 149 | #define KB(x) ((x) * 1024) |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 51266d6b4d78..1f7d415f432c 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
| @@ -1047,9 +1047,15 @@ static int intel_845_configure(void) | |||
| 1047 | /* aperture size */ | 1047 | /* aperture size */ |
| 1048 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); | 1048 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
| 1049 | 1049 | ||
| 1050 | /* address to map to */ | 1050 | if (agp_bridge->apbase_config != 0) { |
| 1051 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); | 1051 | pci_write_config_dword(agp_bridge->dev, AGP_APBASE, |
| 1052 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 1052 | agp_bridge->apbase_config); |
| 1053 | } else { | ||
| 1054 | /* address to map to */ | ||
| 1055 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); | ||
| 1056 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | ||
| 1057 | agp_bridge->apbase_config = temp; | ||
| 1058 | } | ||
| 1053 | 1059 | ||
| 1054 | /* attbase - aperture base */ | 1060 | /* attbase - aperture base */ |
| 1055 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); | 1061 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 7b19e02f112f..523fd3c8bbaa 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
| @@ -198,10 +198,10 @@ int setkeycode(unsigned int scancode, unsigned int keycode) | |||
| 198 | 198 | ||
| 199 | if (scancode >= dev->keycodemax) | 199 | if (scancode >= dev->keycodemax) |
| 200 | return -EINVAL; | 200 | return -EINVAL; |
| 201 | if (keycode > KEY_MAX) | ||
| 202 | return -EINVAL; | ||
| 203 | if (keycode < 0 || keycode > KEY_MAX) | 201 | if (keycode < 0 || keycode > KEY_MAX) |
| 204 | return -EINVAL; | 202 | return -EINVAL; |
| 203 | if (keycode >> (dev->keycodesize * 8)) | ||
| 204 | return -EINVAL; | ||
| 205 | 205 | ||
| 206 | oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); | 206 | oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); |
| 207 | 207 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index fd042060809a..cefbe985e55c 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
| @@ -439,6 +439,11 @@ static struct { | |||
| 439 | { 0, 0 }, | 439 | { 0, 0 }, |
| 440 | }; | 440 | }; |
| 441 | 441 | ||
| 442 | struct sonypi_keypress { | ||
| 443 | struct input_dev *dev; | ||
| 444 | int key; | ||
| 445 | }; | ||
| 446 | |||
| 442 | static struct sonypi_device { | 447 | static struct sonypi_device { |
| 443 | struct pci_dev *dev; | 448 | struct pci_dev *dev; |
| 444 | struct platform_device *pdev; | 449 | struct platform_device *pdev; |
| @@ -710,22 +715,61 @@ static void sonypi_setbluetoothpower(u8 state) | |||
| 710 | 715 | ||
| 711 | static void input_keyrelease(void *data) | 716 | static void input_keyrelease(void *data) |
| 712 | { | 717 | { |
| 713 | struct input_dev *input_dev; | 718 | struct sonypi_keypress kp; |
| 714 | int key; | ||
| 715 | |||
| 716 | while (1) { | ||
| 717 | if (kfifo_get(sonypi_device.input_fifo, | ||
| 718 | (unsigned char *)&input_dev, | ||
| 719 | sizeof(input_dev)) != sizeof(input_dev)) | ||
| 720 | return; | ||
| 721 | if (kfifo_get(sonypi_device.input_fifo, | ||
| 722 | (unsigned char *)&key, | ||
| 723 | sizeof(key)) != sizeof(key)) | ||
| 724 | return; | ||
| 725 | 719 | ||
| 720 | while (kfifo_get(sonypi_device.input_fifo, (unsigned char *)&kp, | ||
| 721 | sizeof(kp)) == sizeof(kp)) { | ||
| 726 | msleep(10); | 722 | msleep(10); |
| 727 | input_report_key(input_dev, key, 0); | 723 | input_report_key(kp.dev, kp.key, 0); |
| 728 | input_sync(input_dev); | 724 | input_sync(kp.dev); |
| 725 | } | ||
| 726 | } | ||
| 727 | |||
| 728 | static void sonypi_report_input_event(u8 event) | ||
| 729 | { | ||
| 730 | struct input_dev *jog_dev = &sonypi_device.input_jog_dev; | ||
| 731 | struct input_dev *key_dev = &sonypi_device.input_key_dev; | ||
| 732 | struct sonypi_keypress kp = { NULL }; | ||
| 733 | int i; | ||
| 734 | |||
| 735 | switch (event) { | ||
| 736 | case SONYPI_EVENT_JOGDIAL_UP: | ||
| 737 | case SONYPI_EVENT_JOGDIAL_UP_PRESSED: | ||
| 738 | input_report_rel(jog_dev, REL_WHEEL, 1); | ||
| 739 | input_sync(jog_dev); | ||
| 740 | break; | ||
| 741 | |||
| 742 | case SONYPI_EVENT_JOGDIAL_DOWN: | ||
| 743 | case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED: | ||
| 744 | input_report_rel(jog_dev, REL_WHEEL, -1); | ||
| 745 | input_sync(jog_dev); | ||
| 746 | break; | ||
| 747 | |||
| 748 | case SONYPI_EVENT_JOGDIAL_PRESSED: | ||
| 749 | kp.key = BTN_MIDDLE; | ||
| 750 | kp.dev = jog_dev; | ||
| 751 | break; | ||
| 752 | |||
| 753 | case SONYPI_EVENT_FNKEY_RELEASED: | ||
| 754 | /* Nothing, not all VAIOs generate this event */ | ||
| 755 | break; | ||
| 756 | |||
| 757 | default: | ||
| 758 | for (i = 0; sonypi_inputkeys[i].sonypiev; i++) | ||
| 759 | if (event == sonypi_inputkeys[i].sonypiev) { | ||
| 760 | kp.dev = key_dev; | ||
| 761 | kp.key = sonypi_inputkeys[i].inputev; | ||
| 762 | break; | ||
| 763 | } | ||
| 764 | break; | ||
| 765 | } | ||
| 766 | |||
| 767 | if (kp.dev) { | ||
| 768 | input_report_key(kp.dev, kp.key, 1); | ||
| 769 | input_sync(kp.dev); | ||
| 770 | kfifo_put(sonypi_device.input_fifo, | ||
| 771 | (unsigned char *)&kp, sizeof(kp)); | ||
| 772 | schedule_work(&sonypi_device.input_work); | ||
| 729 | } | 773 | } |
| 730 | } | 774 | } |
| 731 | 775 | ||
| @@ -768,51 +812,8 @@ found: | |||
| 768 | printk(KERN_INFO | 812 | printk(KERN_INFO |
| 769 | "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2); | 813 | "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2); |
| 770 | 814 | ||
| 771 | if (useinput) { | 815 | if (useinput) |
| 772 | struct input_dev *input_jog_dev = &sonypi_device.input_jog_dev; | 816 | sonypi_report_input_event(event); |
| 773 | struct input_dev *input_key_dev = &sonypi_device.input_key_dev; | ||
| 774 | switch (event) { | ||
| 775 | case SONYPI_EVENT_JOGDIAL_UP: | ||
| 776 | case SONYPI_EVENT_JOGDIAL_UP_PRESSED: | ||
| 777 | input_report_rel(input_jog_dev, REL_WHEEL, 1); | ||
| 778 | break; | ||
| 779 | case SONYPI_EVENT_JOGDIAL_DOWN: | ||
| 780 | case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED: | ||
| 781 | input_report_rel(input_jog_dev, REL_WHEEL, -1); | ||
| 782 | break; | ||
| 783 | case SONYPI_EVENT_JOGDIAL_PRESSED: { | ||
| 784 | int key = BTN_MIDDLE; | ||
| 785 | input_report_key(input_jog_dev, key, 1); | ||
| 786 | kfifo_put(sonypi_device.input_fifo, | ||
| 787 | (unsigned char *)&input_jog_dev, | ||
| 788 | sizeof(input_jog_dev)); | ||
| 789 | kfifo_put(sonypi_device.input_fifo, | ||
| 790 | (unsigned char *)&key, sizeof(key)); | ||
| 791 | break; | ||
| 792 | } | ||
| 793 | case SONYPI_EVENT_FNKEY_RELEASED: | ||
| 794 | /* Nothing, not all VAIOs generate this event */ | ||
| 795 | break; | ||
| 796 | } | ||
| 797 | input_sync(input_jog_dev); | ||
| 798 | |||
| 799 | for (i = 0; sonypi_inputkeys[i].sonypiev; i++) { | ||
| 800 | int key; | ||
| 801 | |||
| 802 | if (event != sonypi_inputkeys[i].sonypiev) | ||
| 803 | continue; | ||
| 804 | |||
| 805 | key = sonypi_inputkeys[i].inputev; | ||
| 806 | input_report_key(input_key_dev, key, 1); | ||
| 807 | kfifo_put(sonypi_device.input_fifo, | ||
| 808 | (unsigned char *)&input_key_dev, | ||
| 809 | sizeof(input_key_dev)); | ||
| 810 | kfifo_put(sonypi_device.input_fifo, | ||
| 811 | (unsigned char *)&key, sizeof(key)); | ||
| 812 | } | ||
| 813 | input_sync(input_key_dev); | ||
| 814 | schedule_work(&sonypi_device.input_work); | ||
| 815 | } | ||
| 816 | 817 | ||
| 817 | kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); | 818 | kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); |
| 818 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); | 819 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); |
| @@ -1227,14 +1228,7 @@ static int __devinit sonypi_probe(void) | |||
| 1227 | sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = | 1228 | sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = |
| 1228 | BIT(BTN_MIDDLE); | 1229 | BIT(BTN_MIDDLE); |
| 1229 | sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); | 1230 | sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); |
| 1230 | sonypi_device.input_jog_dev.name = | 1231 | sonypi_device.input_jog_dev.name = SONYPI_JOG_INPUTNAME; |
| 1231 | kmalloc(sizeof(SONYPI_JOG_INPUTNAME), GFP_KERNEL); | ||
| 1232 | if (!sonypi_device.input_jog_dev.name) { | ||
| 1233 | printk(KERN_ERR "sonypi: kmalloc failed\n"); | ||
| 1234 | ret = -ENOMEM; | ||
| 1235 | goto out_inkmallocinput1; | ||
| 1236 | } | ||
| 1237 | sprintf(sonypi_device.input_jog_dev.name, SONYPI_JOG_INPUTNAME); | ||
| 1238 | sonypi_device.input_jog_dev.id.bustype = BUS_ISA; | 1232 | sonypi_device.input_jog_dev.id.bustype = BUS_ISA; |
| 1239 | sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; | 1233 | sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; |
| 1240 | 1234 | ||
| @@ -1248,14 +1242,7 @@ static int __devinit sonypi_probe(void) | |||
| 1248 | if (sonypi_inputkeys[i].inputev) | 1242 | if (sonypi_inputkeys[i].inputev) |
| 1249 | set_bit(sonypi_inputkeys[i].inputev, | 1243 | set_bit(sonypi_inputkeys[i].inputev, |
| 1250 | sonypi_device.input_key_dev.keybit); | 1244 | sonypi_device.input_key_dev.keybit); |
| 1251 | sonypi_device.input_key_dev.name = | 1245 | sonypi_device.input_key_dev.name = SONYPI_KEY_INPUTNAME; |
| 1252 | kmalloc(sizeof(SONYPI_KEY_INPUTNAME), GFP_KERNEL); | ||
| 1253 | if (!sonypi_device.input_key_dev.name) { | ||
| 1254 | printk(KERN_ERR "sonypi: kmalloc failed\n"); | ||
| 1255 | ret = -ENOMEM; | ||
| 1256 | goto out_inkmallocinput2; | ||
| 1257 | } | ||
| 1258 | sprintf(sonypi_device.input_key_dev.name, SONYPI_KEY_INPUTNAME); | ||
| 1259 | sonypi_device.input_key_dev.id.bustype = BUS_ISA; | 1246 | sonypi_device.input_key_dev.id.bustype = BUS_ISA; |
| 1260 | sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; | 1247 | sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; |
| 1261 | 1248 | ||
| @@ -1313,11 +1300,7 @@ out_platformdev: | |||
| 1313 | kfifo_free(sonypi_device.input_fifo); | 1300 | kfifo_free(sonypi_device.input_fifo); |
| 1314 | out_infifo: | 1301 | out_infifo: |
| 1315 | input_unregister_device(&sonypi_device.input_key_dev); | 1302 | input_unregister_device(&sonypi_device.input_key_dev); |
| 1316 | kfree(sonypi_device.input_key_dev.name); | ||
| 1317 | out_inkmallocinput2: | ||
| 1318 | input_unregister_device(&sonypi_device.input_jog_dev); | 1303 | input_unregister_device(&sonypi_device.input_jog_dev); |
| 1319 | kfree(sonypi_device.input_jog_dev.name); | ||
| 1320 | out_inkmallocinput1: | ||
| 1321 | free_irq(sonypi_device.irq, sonypi_irq); | 1304 | free_irq(sonypi_device.irq, sonypi_irq); |
| 1322 | out_reqirq: | 1305 | out_reqirq: |
| 1323 | release_region(sonypi_device.ioport1, sonypi_device.region_size); | 1306 | release_region(sonypi_device.ioport1, sonypi_device.region_size); |
| @@ -1337,13 +1320,14 @@ static void __devexit sonypi_remove(void) | |||
| 1337 | { | 1320 | { |
| 1338 | sonypi_disable(); | 1321 | sonypi_disable(); |
| 1339 | 1322 | ||
| 1323 | synchronize_sched(); /* Allow sonypi interrupt to complete. */ | ||
| 1324 | flush_scheduled_work(); | ||
| 1325 | |||
| 1340 | platform_device_unregister(sonypi_device.pdev); | 1326 | platform_device_unregister(sonypi_device.pdev); |
| 1341 | 1327 | ||
| 1342 | if (useinput) { | 1328 | if (useinput) { |
| 1343 | input_unregister_device(&sonypi_device.input_key_dev); | 1329 | input_unregister_device(&sonypi_device.input_key_dev); |
| 1344 | kfree(sonypi_device.input_key_dev.name); | ||
| 1345 | input_unregister_device(&sonypi_device.input_jog_dev); | 1330 | input_unregister_device(&sonypi_device.input_jog_dev); |
| 1346 | kfree(sonypi_device.input_jog_dev.name); | ||
| 1347 | kfifo_free(sonypi_device.input_fifo); | 1331 | kfifo_free(sonypi_device.input_fifo); |
| 1348 | } | 1332 | } |
| 1349 | 1333 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7a7859dd0d98..10b014982381 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -1130,7 +1130,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
| 1130 | unsigned int target_freq, | 1130 | unsigned int target_freq, |
| 1131 | unsigned int relation) | 1131 | unsigned int relation) |
| 1132 | { | 1132 | { |
| 1133 | unsigned int ret; | 1133 | int ret; |
| 1134 | 1134 | ||
| 1135 | policy = cpufreq_cpu_get(policy->cpu); | 1135 | policy = cpufreq_cpu_get(policy->cpu); |
| 1136 | if (!policy) | 1136 | if (!policy) |
| @@ -1151,7 +1151,7 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target); | |||
| 1151 | 1151 | ||
| 1152 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | 1152 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) |
| 1153 | { | 1153 | { |
| 1154 | int ret = -EINVAL; | 1154 | int ret; |
| 1155 | 1155 | ||
| 1156 | if (!try_module_get(policy->governor->owner)) | 1156 | if (!try_module_get(policy->governor->owner)) |
| 1157 | return -EINVAL; | 1157 | return -EINVAL; |
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/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 3c85fe150cd7..4fa17c76eea2 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
| @@ -393,7 +393,7 @@ void adm1026_init_client(struct i2c_client *client) | |||
| 393 | 393 | ||
| 394 | value = data->config3; | 394 | value = data->config3; |
| 395 | if (data->config3 & CFG3_GPIO16_ENABLE) { | 395 | if (data->config3 & CFG3_GPIO16_ENABLE) { |
| 396 | dev_dbg(&client->dev, "GPIO16 enabled. THERM" | 396 | dev_dbg(&client->dev, "GPIO16 enabled. THERM " |
| 397 | "pin disabled.\n"); | 397 | "pin disabled.\n"); |
| 398 | } else { | 398 | } else { |
| 399 | dev_dbg(&client->dev, "THERM pin enabled. " | 399 | dev_dbg(&client->dev, "THERM pin enabled. " |
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 0bcf82b4c07b..fca3fc1cef72 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
| 23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 24 | #include <linux/jiffies.h> | ||
| 24 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
| 25 | #include <linux/i2c-sensor.h> | 26 | #include <linux/i2c-sensor.h> |
| 26 | #include <linux/i2c-vid.h> | 27 | #include <linux/i2c-vid.h> |
| @@ -80,9 +81,7 @@ static struct atxp1_data * atxp1_update_device(struct device *dev) | |||
| 80 | 81 | ||
| 81 | down(&data->update_lock); | 82 | down(&data->update_lock); |
| 82 | 83 | ||
| 83 | if ((jiffies - data->last_updated > HZ) || | 84 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { |
| 84 | (jiffies < data->last_updated) || | ||
| 85 | !data->valid) { | ||
| 86 | 85 | ||
| 87 | /* Update local register data */ | 86 | /* Update local register data */ |
| 88 | data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); | 87 | data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); |
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 3beaa6191ef4..270015b626ad 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| 34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| 35 | #include <linux/jiffies.h> | ||
| 35 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
| 36 | #include <linux/i2c-sensor.h> | 37 | #include <linux/i2c-sensor.h> |
| 37 | #include <linux/init.h> | 38 | #include <linux/init.h> |
| @@ -572,8 +573,7 @@ static struct fscpos_data *fscpos_update_device(struct device *dev) | |||
| 572 | 573 | ||
| 573 | down(&data->update_lock); | 574 | down(&data->update_lock); |
| 574 | 575 | ||
| 575 | if ((jiffies - data->last_updated > 2 * HZ) || | 576 | if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { |
| 576 | (jiffies < data->last_updated) || !data->valid) { | ||
| 577 | int i; | 577 | int i; |
| 578 | 578 | ||
| 579 | dev_dbg(&client->dev, "Starting fscpos update\n"); | 579 | dev_dbg(&client->dev, "Starting fscpos update\n"); |
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index a13a504f5bfa..80ae8d30c2af 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/jiffies.h> | ||
| 27 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
| 28 | #include <linux/i2c-sensor.h> | 29 | #include <linux/i2c-sensor.h> |
| 29 | #include <linux/i2c-vid.h> | 30 | #include <linux/i2c-vid.h> |
| @@ -678,8 +679,7 @@ static struct gl520_data *gl520_update_device(struct device *dev) | |||
| 678 | 679 | ||
| 679 | down(&data->update_lock); | 680 | down(&data->update_lock); |
| 680 | 681 | ||
| 681 | if ((jiffies - data->last_updated > 2 * HZ) || | 682 | if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { |
| 682 | (jiffies < data->last_updated) || !data->valid) { | ||
| 683 | 683 | ||
| 684 | dev_dbg(&client->dev, "Starting gl520sm update\n"); | 684 | dev_dbg(&client->dev, "Starting gl520sm update\n"); |
| 685 | 685 | ||
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index bf553dcd97d6..3c159f1d49ee 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
| @@ -363,7 +363,7 @@ static void __exit sensors_max1619_exit(void) | |||
| 363 | i2c_del_driver(&max1619_driver); | 363 | i2c_del_driver(&max1619_driver); |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and" | 366 | MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and " |
| 367 | "Jean Delvare <khali@linux-fr.org>"); | 367 | "Jean Delvare <khali@linux-fr.org>"); |
| 368 | MODULE_DESCRIPTION("MAX1619 sensor driver"); | 368 | MODULE_DESCRIPTION("MAX1619 sensor driver"); |
| 369 | MODULE_LICENSE("GPL"); | 369 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 876c68f3af31..fa4032d53b79 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
| @@ -1043,7 +1043,7 @@ static void pc87360_init_client(struct i2c_client *client, int use_thermistors) | |||
| 1043 | if (init >= 2 && data->innr) { | 1043 | if (init >= 2 && data->innr) { |
| 1044 | reg = pc87360_read_value(data, LD_IN, NO_BANK, | 1044 | reg = pc87360_read_value(data, LD_IN, NO_BANK, |
| 1045 | PC87365_REG_IN_CONVRATE); | 1045 | PC87365_REG_IN_CONVRATE); |
| 1046 | dev_info(&client->dev, "VLM conversion set to" | 1046 | dev_info(&client->dev, "VLM conversion set to " |
| 1047 | "1s period, 160us delay\n"); | 1047 | "1s period, 160us delay\n"); |
| 1048 | pc87360_write_value(data, LD_IN, NO_BANK, | 1048 | pc87360_write_value(data, LD_IN, NO_BANK, |
| 1049 | PC87365_REG_IN_CONVRATE, | 1049 | PC87365_REG_IN_CONVRATE, |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 0ab7e37f5b00..1ab41313ce51 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
| @@ -137,7 +137,7 @@ static int i801_setup(struct pci_dev *dev) | |||
| 137 | pci_read_config_word(I801_dev, SMBBA, &i801_smba); | 137 | pci_read_config_word(I801_dev, SMBBA, &i801_smba); |
| 138 | i801_smba &= 0xfff0; | 138 | i801_smba &= 0xfff0; |
| 139 | if(i801_smba == 0) { | 139 | if(i801_smba == 0) { |
| 140 | dev_err(&dev->dev, "SMB base address uninitialized" | 140 | dev_err(&dev->dev, "SMB base address uninitialized " |
| 141 | "- upgrade BIOS or use force_addr=0xaddr\n"); | 141 | "- upgrade BIOS or use force_addr=0xaddr\n"); |
| 142 | return -ENODEV; | 142 | return -ENODEV; |
| 143 | } | 143 | } |
| @@ -186,7 +186,7 @@ static int i801_transaction(void) | |||
| 186 | int result = 0; | 186 | int result = 0; |
| 187 | int timeout = 0; | 187 | int timeout = 0; |
| 188 | 188 | ||
| 189 | dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x," | 189 | dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x, " |
| 190 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 190 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), |
| 191 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | 191 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), |
| 192 | inb_p(SMBHSTDAT1)); | 192 | inb_p(SMBHSTDAT1)); |
| @@ -240,7 +240,7 @@ static int i801_transaction(void) | |||
| 240 | outb_p(inb(SMBHSTSTS), SMBHSTSTS); | 240 | outb_p(inb(SMBHSTSTS), SMBHSTSTS); |
| 241 | 241 | ||
| 242 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { | 242 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { |
| 243 | dev_dbg(&I801_dev->dev, "Failed reset at end of transaction" | 243 | dev_dbg(&I801_dev->dev, "Failed reset at end of transaction " |
| 244 | "(%02x)\n", temp); | 244 | "(%02x)\n", temp); |
| 245 | } | 245 | } |
| 246 | dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, " | 246 | dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, " |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 9ad3e9262e8a..04adde62a003 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
| @@ -382,6 +382,100 @@ static void __exit fsl_i2c_exit(void) | |||
| 382 | module_init(fsl_i2c_init); | 382 | module_init(fsl_i2c_init); |
| 383 | module_exit(fsl_i2c_exit); | 383 | module_exit(fsl_i2c_exit); |
| 384 | 384 | ||
| 385 | static int fsl_i2c_probe(struct device *device) | ||
| 386 | { | ||
| 387 | int result = 0; | ||
| 388 | struct mpc_i2c *i2c; | ||
| 389 | struct platform_device *pdev = to_platform_device(device); | ||
| 390 | struct fsl_i2c_platform_data *pdata; | ||
| 391 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 392 | |||
| 393 | pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data; | ||
| 394 | |||
| 395 | if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) { | ||
| 396 | return -ENOMEM; | ||
| 397 | } | ||
| 398 | memset(i2c, 0, sizeof(*i2c)); | ||
| 399 | |||
| 400 | i2c->irq = platform_get_irq(pdev, 0); | ||
| 401 | i2c->flags = pdata->device_flags; | ||
| 402 | init_waitqueue_head(&i2c->queue); | ||
| 403 | |||
| 404 | i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION); | ||
| 405 | |||
| 406 | if (!i2c->base) { | ||
| 407 | printk(KERN_ERR "i2c-mpc - failed to map controller\n"); | ||
| 408 | result = -ENOMEM; | ||
| 409 | goto fail_map; | ||
| 410 | } | ||
| 411 | |||
| 412 | if (i2c->irq != 0) | ||
| 413 | if ((result = request_irq(i2c->irq, mpc_i2c_isr, | ||
| 414 | SA_SHIRQ, "i2c-mpc", i2c)) < 0) { | ||
| 415 | printk(KERN_ERR | ||
| 416 | "i2c-mpc - failed to attach interrupt\n"); | ||
| 417 | goto fail_irq; | ||
| 418 | } | ||
| 419 | |||
| 420 | mpc_i2c_setclock(i2c); | ||
| 421 | dev_set_drvdata(device, i2c); | ||
| 422 | |||
| 423 | i2c->adap = mpc_ops; | ||
| 424 | i2c_set_adapdata(&i2c->adap, i2c); | ||
| 425 | i2c->adap.dev.parent = &pdev->dev; | ||
| 426 | if ((result = i2c_add_adapter(&i2c->adap)) < 0) { | ||
| 427 | printk(KERN_ERR "i2c-mpc - failed to add adapter\n"); | ||
| 428 | goto fail_add; | ||
| 429 | } | ||
| 430 | |||
| 431 | return result; | ||
| 432 | |||
| 433 | fail_add: | ||
| 434 | if (i2c->irq != 0) | ||
| 435 | free_irq(i2c->irq, NULL); | ||
| 436 | fail_irq: | ||
| 437 | iounmap(i2c->base); | ||
| 438 | fail_map: | ||
| 439 | kfree(i2c); | ||
| 440 | return result; | ||
| 441 | }; | ||
| 442 | |||
| 443 | static int fsl_i2c_remove(struct device *device) | ||
| 444 | { | ||
| 445 | struct mpc_i2c *i2c = dev_get_drvdata(device); | ||
| 446 | |||
| 447 | i2c_del_adapter(&i2c->adap); | ||
| 448 | dev_set_drvdata(device, NULL); | ||
| 449 | |||
| 450 | if (i2c->irq != 0) | ||
| 451 | free_irq(i2c->irq, i2c); | ||
| 452 | |||
| 453 | iounmap(i2c->base); | ||
| 454 | kfree(i2c); | ||
| 455 | return 0; | ||
| 456 | }; | ||
| 457 | |||
| 458 | /* Structure for a device driver */ | ||
| 459 | static struct device_driver fsl_i2c_driver = { | ||
| 460 | .name = "fsl-i2c", | ||
| 461 | .bus = &platform_bus_type, | ||
| 462 | .probe = fsl_i2c_probe, | ||
| 463 | .remove = fsl_i2c_remove, | ||
| 464 | }; | ||
| 465 | |||
| 466 | static int __init fsl_i2c_init(void) | ||
| 467 | { | ||
| 468 | return driver_register(&fsl_i2c_driver); | ||
| 469 | } | ||
| 470 | |||
| 471 | static void __exit fsl_i2c_exit(void) | ||
| 472 | { | ||
| 473 | driver_unregister(&fsl_i2c_driver); | ||
| 474 | } | ||
| 475 | |||
| 476 | module_init(fsl_i2c_init); | ||
| 477 | module_exit(fsl_i2c_exit); | ||
| 478 | |||
| 385 | MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); | 479 | MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); |
| 386 | MODULE_DESCRIPTION | 480 | MODULE_DESCRIPTION |
| 387 | ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors"); | 481 | ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors"); |
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 74ece8ac1c23..82cf959989fd 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c | |||
| @@ -165,7 +165,7 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt) | |||
| 165 | buf[0] = 0; /* reg offset */ | 165 | buf[0] = 0; /* reg offset */ |
| 166 | buf[1] = BIN2BCD(dt->tm_sec); | 166 | buf[1] = BIN2BCD(dt->tm_sec); |
| 167 | buf[2] = BIN2BCD(dt->tm_min); | 167 | buf[2] = BIN2BCD(dt->tm_min); |
| 168 | buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6); | 168 | buf[3] = BIN2BCD(dt->tm_hour); |
| 169 | buf[4] = BIN2BCD(dt->tm_wday) + 1; | 169 | buf[4] = BIN2BCD(dt->tm_wday) + 1; |
| 170 | buf[5] = BIN2BCD(dt->tm_mday); | 170 | buf[5] = BIN2BCD(dt->tm_mday); |
| 171 | buf[6] = BIN2BCD(dt->tm_mon) + 1; | 171 | buf[6] = BIN2BCD(dt->tm_mon) + 1; |
| @@ -344,9 +344,9 @@ static void ds1337_init_client(struct i2c_client *client) | |||
| 344 | 344 | ||
| 345 | /* Ensure that device is set in 24-hour mode */ | 345 | /* Ensure that device is set in 24-hour mode */ |
| 346 | val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); | 346 | val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); |
| 347 | if ((val >= 0) && (val & (1 << 6)) == 0) | 347 | if ((val >= 0) && (val & (1 << 6))) |
| 348 | i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, | 348 | i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, |
| 349 | val | (1 << 6)); | 349 | val & 0x3f); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | static int ds1337_detach_client(struct i2c_client *client) | 352 | static int ds1337_detach_client(struct i2c_client *client) |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 6ea413f6d5e5..a2da31b0dd7b 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
| @@ -163,6 +163,11 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 163 | struct eeprom_data *data; | 163 | struct eeprom_data *data; |
| 164 | int err = 0; | 164 | int err = 0; |
| 165 | 165 | ||
| 166 | /* prevent 24RF08 corruption */ | ||
| 167 | if (kind < 0) | ||
| 168 | i2c_smbus_xfer(adapter, address, 0, 0, 0, | ||
| 169 | I2C_SMBUS_QUICK, NULL); | ||
| 170 | |||
| 166 | /* There are three ways we can read the EEPROM data: | 171 | /* There are three ways we can read the EEPROM data: |
| 167 | (1) I2C block reads (faster, but unsupported by most adapters) | 172 | (1) I2C block reads (faster, but unsupported by most adapters) |
| 168 | (2) Consecutive byte reads (100% overhead) | 173 | (2) Consecutive byte reads (100% overhead) |
| @@ -187,9 +192,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 187 | new_client->driver = &eeprom_driver; | 192 | new_client->driver = &eeprom_driver; |
| 188 | new_client->flags = 0; | 193 | new_client->flags = 0; |
| 189 | 194 | ||
| 190 | /* prevent 24RF08 corruption */ | ||
| 191 | i2c_smbus_write_quick(new_client, 0); | ||
| 192 | |||
| 193 | /* Fill in the remaining client fields */ | 195 | /* Fill in the remaining client fields */ |
| 194 | strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); | 196 | strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); |
| 195 | data->valid = 0; | 197 | data->valid = 0; |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index c4f14d9623c4..0230375f72e5 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
| @@ -343,6 +343,11 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 343 | struct max6875_data *data; | 343 | struct max6875_data *data; |
| 344 | int err = 0; | 344 | int err = 0; |
| 345 | 345 | ||
| 346 | /* Prevent 24RF08 corruption (in case of user error) */ | ||
| 347 | if (kind < 0) | ||
| 348 | i2c_smbus_xfer(adapter, address, 0, 0, 0, | ||
| 349 | I2C_SMBUS_QUICK, NULL); | ||
| 350 | |||
| 346 | /* There are three ways we can read the EEPROM data: | 351 | /* There are three ways we can read the EEPROM data: |
| 347 | (1) I2C block reads (faster, but unsupported by most adapters) | 352 | (1) I2C block reads (faster, but unsupported by most adapters) |
| 348 | (2) Consecutive byte reads (100% overhead) | 353 | (2) Consecutive byte reads (100% overhead) |
| @@ -370,9 +375,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
| 370 | new_client->driver = &max6875_driver; | 375 | new_client->driver = &max6875_driver; |
| 371 | new_client->flags = 0; | 376 | new_client->flags = 0; |
| 372 | 377 | ||
| 373 | /* Prevent 24RF08 corruption */ | ||
| 374 | i2c_smbus_write_quick(new_client, 0); | ||
| 375 | |||
| 376 | /* Setup the user section */ | 378 | /* Setup the user section */ |
| 377 | data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; | 379 | data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; |
| 378 | data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; | 380 | data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 4fd4f52c8e9b..4a9ead277596 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -231,8 +231,8 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
| 231 | if (driver->detach_adapter) | 231 | if (driver->detach_adapter) |
| 232 | if ((res = driver->detach_adapter(adap))) { | 232 | if ((res = driver->detach_adapter(adap))) { |
| 233 | dev_warn(&adap->dev, "can't detach adapter " | 233 | dev_warn(&adap->dev, "can't detach adapter " |
| 234 | "while detaching driver %s: driver not " | 234 | "while detaching driver %s: driver " |
| 235 | "detached!", driver->name); | 235 | "not detached!\n", driver->name); |
| 236 | goto out_unlock; | 236 | goto out_unlock; |
| 237 | } | 237 | } |
| 238 | } | 238 | } |
| @@ -456,8 +456,8 @@ int i2c_detach_client(struct i2c_client *client) | |||
| 456 | res = adapter->client_unregister(client); | 456 | res = adapter->client_unregister(client); |
| 457 | if (res) { | 457 | if (res) { |
| 458 | dev_err(&client->dev, | 458 | dev_err(&client->dev, |
| 459 | "client_unregister [%s] failed, " | 459 | "client_unregister [%s] failed, " |
| 460 | "client not detached", client->name); | 460 | "client not detached\n", client->name); |
| 461 | goto out; | 461 | goto out; |
| 462 | } | 462 | } |
| 463 | } | 463 | } |
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/input/evdev.c b/drivers/input/evdev.c index 374f404e81da..20e3a165989f 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
| @@ -320,6 +320,7 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 320 | if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; | 320 | if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; |
| 321 | if (get_user(v, ip + 1)) return -EFAULT; | 321 | if (get_user(v, ip + 1)) return -EFAULT; |
| 322 | if (v < 0 || v > KEY_MAX) return -EINVAL; | 322 | if (v < 0 || v > KEY_MAX) return -EINVAL; |
| 323 | if (v >> (dev->keycodesize * 8)) return -EINVAL; | ||
| 323 | u = SET_INPUT_KEYCODE(dev, t, v); | 324 | u = SET_INPUT_KEYCODE(dev, t, v); |
| 324 | clear_bit(u, dev->keybit); | 325 | clear_bit(u, dev->keybit); |
| 325 | set_bit(v, dev->keybit); | 326 | set_bit(v, dev->keybit); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7c4b4d37b3e6..a275211c8e1e 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -48,12 +48,6 @@ static LIST_HEAD(input_handler_list); | |||
| 48 | 48 | ||
| 49 | static struct input_handler *input_table[8]; | 49 | static struct input_handler *input_table[8]; |
| 50 | 50 | ||
| 51 | #ifdef CONFIG_PROC_FS | ||
| 52 | static struct proc_dir_entry *proc_bus_input_dir; | ||
| 53 | static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait); | ||
| 54 | static int input_devices_state; | ||
| 55 | #endif | ||
| 56 | |||
| 57 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 51 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
| 58 | { | 52 | { |
| 59 | struct input_handle *handle; | 53 | struct input_handle *handle; |
| @@ -312,6 +306,7 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st | |||
| 312 | return NULL; | 306 | return NULL; |
| 313 | } | 307 | } |
| 314 | 308 | ||
| 309 | |||
| 315 | /* | 310 | /* |
| 316 | * Input hotplugging interface - loading event handlers based on | 311 | * Input hotplugging interface - loading event handlers based on |
| 317 | * device bitfields. | 312 | * device bitfields. |
| @@ -428,6 +423,177 @@ static void input_call_hotplug(char *verb, struct input_dev *dev) | |||
| 428 | 423 | ||
| 429 | #endif | 424 | #endif |
| 430 | 425 | ||
| 426 | #ifdef CONFIG_PROC_FS | ||
| 427 | |||
| 428 | static struct proc_dir_entry *proc_bus_input_dir; | ||
| 429 | static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait); | ||
| 430 | static int input_devices_state; | ||
| 431 | |||
| 432 | static inline void input_wakeup_procfs_readers(void) | ||
| 433 | { | ||
| 434 | input_devices_state++; | ||
| 435 | wake_up(&input_devices_poll_wait); | ||
| 436 | } | ||
| 437 | |||
| 438 | static unsigned int input_devices_poll(struct file *file, poll_table *wait) | ||
| 439 | { | ||
| 440 | int state = input_devices_state; | ||
| 441 | poll_wait(file, &input_devices_poll_wait, wait); | ||
| 442 | if (state != input_devices_state) | ||
| 443 | return POLLIN | POLLRDNORM; | ||
| 444 | return 0; | ||
| 445 | } | ||
| 446 | |||
| 447 | #define SPRINTF_BIT_B(bit, name, max) \ | ||
| 448 | do { \ | ||
| 449 | len += sprintf(buf + len, "B: %s", name); \ | ||
| 450 | for (i = NBITS(max) - 1; i >= 0; i--) \ | ||
| 451 | if (dev->bit[i]) break; \ | ||
| 452 | for (; i >= 0; i--) \ | ||
| 453 | len += sprintf(buf + len, "%lx ", dev->bit[i]); \ | ||
| 454 | len += sprintf(buf + len, "\n"); \ | ||
| 455 | } while (0) | ||
| 456 | |||
| 457 | #define SPRINTF_BIT_B2(bit, name, max, ev) \ | ||
| 458 | do { \ | ||
| 459 | if (test_bit(ev, dev->evbit)) \ | ||
| 460 | SPRINTF_BIT_B(bit, name, max); \ | ||
| 461 | } while (0) | ||
| 462 | |||
| 463 | static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | ||
| 464 | { | ||
| 465 | struct input_dev *dev; | ||
| 466 | struct input_handle *handle; | ||
| 467 | |||
| 468 | off_t at = 0; | ||
| 469 | int i, len, cnt = 0; | ||
| 470 | |||
| 471 | list_for_each_entry(dev, &input_dev_list, node) { | ||
| 472 | |||
| 473 | len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", | ||
| 474 | dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); | ||
| 475 | |||
| 476 | len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : ""); | ||
| 477 | len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : ""); | ||
| 478 | len += sprintf(buf + len, "H: Handlers="); | ||
| 479 | |||
| 480 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
| 481 | len += sprintf(buf + len, "%s ", handle->name); | ||
| 482 | |||
| 483 | len += sprintf(buf + len, "\n"); | ||
| 484 | |||
| 485 | SPRINTF_BIT_B(evbit, "EV=", EV_MAX); | ||
| 486 | SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY); | ||
| 487 | SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL); | ||
| 488 | SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS); | ||
| 489 | SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC); | ||
| 490 | SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED); | ||
| 491 | SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND); | ||
| 492 | SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF); | ||
| 493 | |||
| 494 | len += sprintf(buf + len, "\n"); | ||
| 495 | |||
| 496 | at += len; | ||
| 497 | |||
| 498 | if (at >= pos) { | ||
| 499 | if (!*start) { | ||
| 500 | *start = buf + (pos - (at - len)); | ||
| 501 | cnt = at - pos; | ||
| 502 | } else cnt += len; | ||
| 503 | buf += len; | ||
| 504 | if (cnt >= count) | ||
| 505 | break; | ||
| 506 | } | ||
| 507 | } | ||
| 508 | |||
| 509 | if (&dev->node == &input_dev_list) | ||
| 510 | *eof = 1; | ||
| 511 | |||
| 512 | return (count > cnt) ? cnt : count; | ||
| 513 | } | ||
| 514 | |||
| 515 | static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | ||
| 516 | { | ||
| 517 | struct input_handler *handler; | ||
| 518 | |||
| 519 | off_t at = 0; | ||
| 520 | int len = 0, cnt = 0; | ||
| 521 | int i = 0; | ||
| 522 | |||
| 523 | list_for_each_entry(handler, &input_handler_list, node) { | ||
| 524 | |||
| 525 | if (handler->fops) | ||
| 526 | len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n", | ||
| 527 | i++, handler->name, handler->minor); | ||
| 528 | else | ||
| 529 | len = sprintf(buf, "N: Number=%d Name=%s\n", | ||
| 530 | i++, handler->name); | ||
| 531 | |||
| 532 | at += len; | ||
| 533 | |||
| 534 | if (at >= pos) { | ||
| 535 | if (!*start) { | ||
| 536 | *start = buf + (pos - (at - len)); | ||
| 537 | cnt = at - pos; | ||
| 538 | } else cnt += len; | ||
| 539 | buf += len; | ||
| 540 | if (cnt >= count) | ||
| 541 | break; | ||
| 542 | } | ||
| 543 | } | ||
| 544 | if (&handler->node == &input_handler_list) | ||
| 545 | *eof = 1; | ||
| 546 | |||
| 547 | return (count > cnt) ? cnt : count; | ||
| 548 | } | ||
| 549 | |||
| 550 | static struct file_operations input_fileops; | ||
| 551 | |||
| 552 | static int __init input_proc_init(void) | ||
| 553 | { | ||
| 554 | struct proc_dir_entry *entry; | ||
| 555 | |||
| 556 | proc_bus_input_dir = proc_mkdir("input", proc_bus); | ||
| 557 | if (!proc_bus_input_dir) | ||
| 558 | return -ENOMEM; | ||
| 559 | |||
| 560 | proc_bus_input_dir->owner = THIS_MODULE; | ||
| 561 | |||
| 562 | entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL); | ||
| 563 | if (!entry) | ||
| 564 | goto fail1; | ||
| 565 | |||
| 566 | entry->owner = THIS_MODULE; | ||
| 567 | input_fileops = *entry->proc_fops; | ||
| 568 | entry->proc_fops = &input_fileops; | ||
| 569 | entry->proc_fops->poll = input_devices_poll; | ||
| 570 | |||
| 571 | entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL); | ||
| 572 | if (!entry) | ||
| 573 | goto fail2; | ||
| 574 | |||
| 575 | entry->owner = THIS_MODULE; | ||
| 576 | |||
| 577 | return 0; | ||
| 578 | |||
| 579 | fail2: remove_proc_entry("devices", proc_bus_input_dir); | ||
| 580 | fail1: remove_proc_entry("input", proc_bus); | ||
| 581 | return -ENOMEM; | ||
| 582 | } | ||
| 583 | |||
| 584 | static void input_proc_exit(void) | ||
| 585 | { | ||
| 586 | remove_proc_entry("devices", proc_bus_input_dir); | ||
| 587 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
| 588 | remove_proc_entry("input", proc_bus); | ||
| 589 | } | ||
| 590 | |||
| 591 | #else /* !CONFIG_PROC_FS */ | ||
| 592 | static inline void input_wakeup_procfs_readers(void) { } | ||
| 593 | static inline int input_proc_init(void) { return 0; } | ||
| 594 | static inline void input_proc_exit(void) { } | ||
| 595 | #endif | ||
| 596 | |||
| 431 | void input_register_device(struct input_dev *dev) | 597 | void input_register_device(struct input_dev *dev) |
| 432 | { | 598 | { |
| 433 | struct input_handle *handle; | 599 | struct input_handle *handle; |
| @@ -464,10 +630,7 @@ void input_register_device(struct input_dev *dev) | |||
| 464 | input_call_hotplug("add", dev); | 630 | input_call_hotplug("add", dev); |
| 465 | #endif | 631 | #endif |
| 466 | 632 | ||
| 467 | #ifdef CONFIG_PROC_FS | 633 | input_wakeup_procfs_readers(); |
| 468 | input_devices_state++; | ||
| 469 | wake_up(&input_devices_poll_wait); | ||
| 470 | #endif | ||
| 471 | } | 634 | } |
| 472 | 635 | ||
| 473 | void input_unregister_device(struct input_dev *dev) | 636 | void input_unregister_device(struct input_dev *dev) |
| @@ -491,10 +654,7 @@ void input_unregister_device(struct input_dev *dev) | |||
| 491 | 654 | ||
| 492 | list_del_init(&dev->node); | 655 | list_del_init(&dev->node); |
| 493 | 656 | ||
| 494 | #ifdef CONFIG_PROC_FS | 657 | input_wakeup_procfs_readers(); |
| 495 | input_devices_state++; | ||
| 496 | wake_up(&input_devices_poll_wait); | ||
| 497 | #endif | ||
| 498 | } | 658 | } |
| 499 | 659 | ||
| 500 | void input_register_handler(struct input_handler *handler) | 660 | void input_register_handler(struct input_handler *handler) |
| @@ -518,10 +678,7 @@ void input_register_handler(struct input_handler *handler) | |||
| 518 | if ((handle = handler->connect(handler, dev, id))) | 678 | if ((handle = handler->connect(handler, dev, id))) |
| 519 | input_link_handle(handle); | 679 | input_link_handle(handle); |
| 520 | 680 | ||
| 521 | #ifdef CONFIG_PROC_FS | 681 | input_wakeup_procfs_readers(); |
| 522 | input_devices_state++; | ||
| 523 | wake_up(&input_devices_poll_wait); | ||
| 524 | #endif | ||
| 525 | } | 682 | } |
| 526 | 683 | ||
| 527 | void input_unregister_handler(struct input_handler *handler) | 684 | void input_unregister_handler(struct input_handler *handler) |
| @@ -540,10 +697,7 @@ void input_unregister_handler(struct input_handler *handler) | |||
| 540 | if (handler->fops != NULL) | 697 | if (handler->fops != NULL) |
| 541 | input_table[handler->minor >> 5] = NULL; | 698 | input_table[handler->minor >> 5] = NULL; |
| 542 | 699 | ||
| 543 | #ifdef CONFIG_PROC_FS | 700 | input_wakeup_procfs_readers(); |
| 544 | input_devices_state++; | ||
| 545 | wake_up(&input_devices_poll_wait); | ||
| 546 | #endif | ||
| 547 | } | 701 | } |
| 548 | 702 | ||
| 549 | static int input_open_file(struct inode *inode, struct file *file) | 703 | static int input_open_file(struct inode *inode, struct file *file) |
| @@ -582,190 +736,43 @@ static struct file_operations input_fops = { | |||
| 582 | .open = input_open_file, | 736 | .open = input_open_file, |
| 583 | }; | 737 | }; |
| 584 | 738 | ||
| 585 | #ifdef CONFIG_PROC_FS | 739 | struct class *input_class; |
| 586 | |||
| 587 | #define SPRINTF_BIT_B(bit, name, max) \ | ||
| 588 | do { \ | ||
| 589 | len += sprintf(buf + len, "B: %s", name); \ | ||
| 590 | for (i = NBITS(max) - 1; i >= 0; i--) \ | ||
| 591 | if (dev->bit[i]) break; \ | ||
| 592 | for (; i >= 0; i--) \ | ||
| 593 | len += sprintf(buf + len, "%lx ", dev->bit[i]); \ | ||
| 594 | len += sprintf(buf + len, "\n"); \ | ||
| 595 | } while (0) | ||
| 596 | |||
| 597 | #define SPRINTF_BIT_B2(bit, name, max, ev) \ | ||
| 598 | do { \ | ||
| 599 | if (test_bit(ev, dev->evbit)) \ | ||
| 600 | SPRINTF_BIT_B(bit, name, max); \ | ||
| 601 | } while (0) | ||
| 602 | |||
| 603 | |||
| 604 | static unsigned int input_devices_poll(struct file *file, poll_table *wait) | ||
| 605 | { | ||
| 606 | int state = input_devices_state; | ||
| 607 | poll_wait(file, &input_devices_poll_wait, wait); | ||
| 608 | if (state != input_devices_state) | ||
| 609 | return POLLIN | POLLRDNORM; | ||
| 610 | return 0; | ||
| 611 | } | ||
| 612 | 740 | ||
| 613 | static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | 741 | static int __init input_init(void) |
| 614 | { | 742 | { |
| 615 | struct input_dev *dev; | 743 | int err; |
| 616 | struct input_handle *handle; | ||
| 617 | |||
| 618 | off_t at = 0; | ||
| 619 | int i, len, cnt = 0; | ||
| 620 | |||
| 621 | list_for_each_entry(dev, &input_dev_list, node) { | ||
| 622 | |||
| 623 | len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", | ||
| 624 | dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); | ||
| 625 | |||
| 626 | len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : ""); | ||
| 627 | len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : ""); | ||
| 628 | len += sprintf(buf + len, "H: Handlers="); | ||
| 629 | |||
| 630 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
| 631 | len += sprintf(buf + len, "%s ", handle->name); | ||
| 632 | |||
| 633 | len += sprintf(buf + len, "\n"); | ||
| 634 | |||
| 635 | SPRINTF_BIT_B(evbit, "EV=", EV_MAX); | ||
| 636 | SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY); | ||
| 637 | SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL); | ||
| 638 | SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS); | ||
| 639 | SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC); | ||
| 640 | SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED); | ||
| 641 | SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND); | ||
| 642 | SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF); | ||
| 643 | |||
| 644 | len += sprintf(buf + len, "\n"); | ||
| 645 | |||
| 646 | at += len; | ||
| 647 | 744 | ||
| 648 | if (at >= pos) { | 745 | input_class = class_create(THIS_MODULE, "input"); |
| 649 | if (!*start) { | 746 | if (IS_ERR(input_class)) { |
| 650 | *start = buf + (pos - (at - len)); | 747 | printk(KERN_ERR "input: unable to register input class\n"); |
| 651 | cnt = at - pos; | 748 | return PTR_ERR(input_class); |
| 652 | } else cnt += len; | ||
| 653 | buf += len; | ||
| 654 | if (cnt >= count) | ||
| 655 | break; | ||
| 656 | } | ||
| 657 | } | 749 | } |
| 658 | 750 | ||
| 659 | if (&dev->node == &input_dev_list) | 751 | err = input_proc_init(); |
| 660 | *eof = 1; | 752 | if (err) |
| 661 | 753 | goto fail1; | |
| 662 | return (count > cnt) ? cnt : count; | ||
| 663 | } | ||
| 664 | |||
| 665 | static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | ||
| 666 | { | ||
| 667 | struct input_handler *handler; | ||
| 668 | |||
| 669 | off_t at = 0; | ||
| 670 | int len = 0, cnt = 0; | ||
| 671 | int i = 0; | ||
| 672 | |||
| 673 | list_for_each_entry(handler, &input_handler_list, node) { | ||
| 674 | |||
| 675 | if (handler->fops) | ||
| 676 | len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n", | ||
| 677 | i++, handler->name, handler->minor); | ||
| 678 | else | ||
| 679 | len = sprintf(buf, "N: Number=%d Name=%s\n", | ||
| 680 | i++, handler->name); | ||
| 681 | |||
| 682 | at += len; | ||
| 683 | 754 | ||
| 684 | if (at >= pos) { | 755 | err = register_chrdev(INPUT_MAJOR, "input", &input_fops); |
| 685 | if (!*start) { | 756 | if (err) { |
| 686 | *start = buf + (pos - (at - len)); | 757 | printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR); |
| 687 | cnt = at - pos; | 758 | goto fail2; |
| 688 | } else cnt += len; | ||
| 689 | buf += len; | ||
| 690 | if (cnt >= count) | ||
| 691 | break; | ||
| 692 | } | ||
| 693 | } | 759 | } |
| 694 | if (&handler->node == &input_handler_list) | ||
| 695 | *eof = 1; | ||
| 696 | |||
| 697 | return (count > cnt) ? cnt : count; | ||
| 698 | } | ||
| 699 | |||
| 700 | static struct file_operations input_fileops; | ||
| 701 | 760 | ||
| 702 | static int __init input_proc_init(void) | 761 | err = devfs_mk_dir("input"); |
| 703 | { | 762 | if (err) |
| 704 | struct proc_dir_entry *entry; | 763 | goto fail3; |
| 705 | 764 | ||
| 706 | proc_bus_input_dir = proc_mkdir("input", proc_bus); | ||
| 707 | if (proc_bus_input_dir == NULL) | ||
| 708 | return -ENOMEM; | ||
| 709 | proc_bus_input_dir->owner = THIS_MODULE; | ||
| 710 | entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL); | ||
| 711 | if (entry == NULL) { | ||
| 712 | remove_proc_entry("input", proc_bus); | ||
| 713 | return -ENOMEM; | ||
| 714 | } | ||
| 715 | entry->owner = THIS_MODULE; | ||
| 716 | input_fileops = *entry->proc_fops; | ||
| 717 | entry->proc_fops = &input_fileops; | ||
| 718 | entry->proc_fops->poll = input_devices_poll; | ||
| 719 | entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL); | ||
| 720 | if (entry == NULL) { | ||
| 721 | remove_proc_entry("devices", proc_bus_input_dir); | ||
| 722 | remove_proc_entry("input", proc_bus); | ||
| 723 | return -ENOMEM; | ||
| 724 | } | ||
| 725 | entry->owner = THIS_MODULE; | ||
| 726 | return 0; | 765 | return 0; |
| 727 | } | ||
| 728 | #else /* !CONFIG_PROC_FS */ | ||
| 729 | static inline int input_proc_init(void) { return 0; } | ||
| 730 | #endif | ||
| 731 | 766 | ||
| 732 | struct class *input_class; | 767 | fail3: unregister_chrdev(INPUT_MAJOR, "input"); |
| 733 | 768 | fail2: input_proc_exit(); | |
| 734 | static int __init input_init(void) | 769 | fail1: class_destroy(input_class); |
| 735 | { | 770 | return err; |
| 736 | int retval = -ENOMEM; | ||
| 737 | |||
| 738 | input_class = class_create(THIS_MODULE, "input"); | ||
| 739 | if (IS_ERR(input_class)) | ||
| 740 | return PTR_ERR(input_class); | ||
| 741 | input_proc_init(); | ||
| 742 | retval = register_chrdev(INPUT_MAJOR, "input", &input_fops); | ||
| 743 | if (retval) { | ||
| 744 | printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR); | ||
| 745 | remove_proc_entry("devices", proc_bus_input_dir); | ||
| 746 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
| 747 | remove_proc_entry("input", proc_bus); | ||
| 748 | class_destroy(input_class); | ||
| 749 | return retval; | ||
| 750 | } | ||
| 751 | |||
| 752 | retval = devfs_mk_dir("input"); | ||
| 753 | if (retval) { | ||
| 754 | remove_proc_entry("devices", proc_bus_input_dir); | ||
| 755 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
| 756 | remove_proc_entry("input", proc_bus); | ||
| 757 | unregister_chrdev(INPUT_MAJOR, "input"); | ||
| 758 | class_destroy(input_class); | ||
| 759 | } | ||
| 760 | return retval; | ||
| 761 | } | 771 | } |
| 762 | 772 | ||
| 763 | static void __exit input_exit(void) | 773 | static void __exit input_exit(void) |
| 764 | { | 774 | { |
| 765 | remove_proc_entry("devices", proc_bus_input_dir); | 775 | input_proc_exit(); |
| 766 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
| 767 | remove_proc_entry("input", proc_bus); | ||
| 768 | |||
| 769 | devfs_remove("input"); | 776 | devfs_remove("input"); |
| 770 | unregister_chrdev(INPUT_MAJOR, "input"); | 777 | unregister_chrdev(INPUT_MAJOR, "input"); |
| 771 | class_destroy(input_class); | 778 | class_destroy(input_class); |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index ff8e1bbd0e13..e0938d1d3ad7 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
| @@ -37,8 +37,6 @@ MODULE_LICENSE("GPL"); | |||
| 37 | #define JOYDEV_MINORS 16 | 37 | #define JOYDEV_MINORS 16 |
| 38 | #define JOYDEV_BUFFER_SIZE 64 | 38 | #define JOYDEV_BUFFER_SIZE 64 |
| 39 | 39 | ||
| 40 | #define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) | ||
| 41 | |||
| 42 | struct joydev { | 40 | struct joydev { |
| 43 | int exist; | 41 | int exist; |
| 44 | int open; | 42 | int open; |
| @@ -117,7 +115,7 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne | |||
| 117 | return; | 115 | return; |
| 118 | } | 116 | } |
| 119 | 117 | ||
| 120 | event.time = MSECS(jiffies); | 118 | event.time = jiffies_to_msecs(jiffies); |
| 121 | 119 | ||
| 122 | list_for_each_entry(list, &joydev->list, node) { | 120 | list_for_each_entry(list, &joydev->list, node) { |
| 123 | 121 | ||
| @@ -245,7 +243,7 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo | |||
| 245 | 243 | ||
| 246 | struct js_event event; | 244 | struct js_event event; |
| 247 | 245 | ||
| 248 | event.time = MSECS(jiffies); | 246 | event.time = jiffies_to_msecs(jiffies); |
| 249 | 247 | ||
| 250 | if (list->startup < joydev->nkey) { | 248 | if (list->startup < joydev->nkey) { |
| 251 | event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; | 249 | event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 98710997aaaa..d5c5b32045af 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
| @@ -36,16 +36,6 @@ | |||
| 36 | #include <linux/miscdevice.h> | 36 | #include <linux/miscdevice.h> |
| 37 | #include <linux/uinput.h> | 37 | #include <linux/uinput.h> |
| 38 | 38 | ||
| 39 | static int uinput_dev_open(struct input_dev *dev) | ||
| 40 | { | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | static void uinput_dev_close(struct input_dev *dev) | ||
| 45 | { | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
| 49 | static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 39 | static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
| 50 | { | 40 | { |
| 51 | struct uinput_device *udev; | 41 | struct uinput_device *udev; |
| @@ -63,22 +53,24 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i | |||
| 63 | return 0; | 53 | return 0; |
| 64 | } | 54 | } |
| 65 | 55 | ||
| 66 | static int uinput_request_alloc_id(struct input_dev *dev, struct uinput_request *request) | 56 | static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_request *request) |
| 67 | { | 57 | { |
| 68 | /* Atomically allocate an ID for the given request. Returns 0 on success. */ | 58 | /* Atomically allocate an ID for the given request. Returns 0 on success. */ |
| 69 | struct uinput_device *udev = dev->private; | ||
| 70 | int id; | 59 | int id; |
| 60 | int err = -1; | ||
| 61 | |||
| 62 | spin_lock(&udev->requests_lock); | ||
| 71 | 63 | ||
| 72 | down(&udev->requests_sem); | 64 | for (id = 0; id < UINPUT_NUM_REQUESTS; id++) |
| 73 | for (id=0; id<UINPUT_NUM_REQUESTS; id++) | ||
| 74 | if (!udev->requests[id]) { | 65 | if (!udev->requests[id]) { |
| 75 | udev->requests[id] = request; | ||
| 76 | request->id = id; | 66 | request->id = id; |
| 77 | up(&udev->requests_sem); | 67 | udev->requests[id] = request; |
| 78 | return 0; | 68 | err = 0; |
| 69 | break; | ||
| 79 | } | 70 | } |
| 80 | up(&udev->requests_sem); | 71 | |
| 81 | return -1; | 72 | spin_unlock(&udev->requests_lock); |
| 73 | return err; | ||
| 82 | } | 74 | } |
| 83 | 75 | ||
| 84 | static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) | 76 | static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) |
| @@ -86,70 +78,78 @@ static struct uinput_request* uinput_request_find(struct uinput_device *udev, in | |||
| 86 | /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ | 78 | /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ |
| 87 | if (id >= UINPUT_NUM_REQUESTS || id < 0) | 79 | if (id >= UINPUT_NUM_REQUESTS || id < 0) |
| 88 | return NULL; | 80 | return NULL; |
| 89 | if (udev->requests[id]->completed) | ||
| 90 | return NULL; | ||
| 91 | return udev->requests[id]; | 81 | return udev->requests[id]; |
| 92 | } | 82 | } |
| 93 | 83 | ||
| 94 | static void uinput_request_init(struct input_dev *dev, struct uinput_request *request, int code) | 84 | static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct uinput_request *request) |
| 95 | { | 85 | { |
| 96 | struct uinput_device *udev = dev->private; | 86 | /* Allocate slot. If none are available right away, wait. */ |
| 87 | return wait_event_interruptible(udev->requests_waitq, | ||
| 88 | !uinput_request_alloc_id(udev, request)); | ||
| 89 | } | ||
| 97 | 90 | ||
| 98 | memset(request, 0, sizeof(struct uinput_request)); | 91 | static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) |
| 99 | request->code = code; | 92 | { |
| 100 | init_waitqueue_head(&request->waitq); | 93 | complete(&request->done); |
| 101 | 94 | ||
| 102 | /* Allocate an ID. If none are available right away, wait. */ | 95 | /* Mark slot as available */ |
| 103 | request->retval = wait_event_interruptible(udev->requests_waitq, | 96 | udev->requests[request->id] = NULL; |
| 104 | !uinput_request_alloc_id(dev, request)); | 97 | wake_up_interruptible(&udev->requests_waitq); |
| 105 | } | 98 | } |
| 106 | 99 | ||
| 107 | static void uinput_request_submit(struct input_dev *dev, struct uinput_request *request) | 100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) |
| 108 | { | 101 | { |
| 109 | struct uinput_device *udev = dev->private; | ||
| 110 | int retval; | 102 | int retval; |
| 111 | 103 | ||
| 112 | /* Tell our userspace app about this new request by queueing an input event */ | 104 | /* Tell our userspace app about this new request by queueing an input event */ |
| 113 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); | 105 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); |
| 114 | 106 | ||
| 115 | /* Wait for the request to complete */ | 107 | /* Wait for the request to complete */ |
| 116 | retval = wait_event_interruptible(request->waitq, request->completed); | 108 | retval = wait_for_completion_interruptible(&request->done); |
| 117 | if (retval) | 109 | if (!retval) |
| 118 | request->retval = retval; | 110 | retval = request->retval; |
| 119 | 111 | ||
| 120 | /* Release this request's ID, let others know it's available */ | 112 | return retval; |
| 121 | udev->requests[request->id] = NULL; | ||
| 122 | wake_up_interruptible(&udev->requests_waitq); | ||
| 123 | } | 113 | } |
| 124 | 114 | ||
| 125 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) | 115 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) |
| 126 | { | 116 | { |
| 127 | struct uinput_request request; | 117 | struct uinput_request request; |
| 118 | int retval; | ||
| 128 | 119 | ||
| 129 | if (!test_bit(EV_FF, dev->evbit)) | 120 | if (!test_bit(EV_FF, dev->evbit)) |
| 130 | return -ENOSYS; | 121 | return -ENOSYS; |
| 131 | 122 | ||
| 132 | uinput_request_init(dev, &request, UI_FF_UPLOAD); | 123 | request.id = -1; |
| 133 | if (request.retval) | 124 | init_completion(&request.done); |
| 134 | return request.retval; | 125 | request.code = UI_FF_UPLOAD; |
| 135 | request.u.effect = effect; | 126 | request.u.effect = effect; |
| 136 | uinput_request_submit(dev, &request); | 127 | |
| 137 | return request.retval; | 128 | retval = uinput_request_reserve_slot(dev->private, &request); |
| 129 | if (!retval) | ||
| 130 | retval = uinput_request_submit(dev, &request); | ||
| 131 | |||
| 132 | return retval; | ||
| 138 | } | 133 | } |
| 139 | 134 | ||
| 140 | static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) | 135 | static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) |
| 141 | { | 136 | { |
| 142 | struct uinput_request request; | 137 | struct uinput_request request; |
| 138 | int retval; | ||
| 143 | 139 | ||
| 144 | if (!test_bit(EV_FF, dev->evbit)) | 140 | if (!test_bit(EV_FF, dev->evbit)) |
| 145 | return -ENOSYS; | 141 | return -ENOSYS; |
| 146 | 142 | ||
| 147 | uinput_request_init(dev, &request, UI_FF_ERASE); | 143 | request.id = -1; |
| 148 | if (request.retval) | 144 | init_completion(&request.done); |
| 149 | return request.retval; | 145 | request.code = UI_FF_ERASE; |
| 150 | request.u.effect_id = effect_id; | 146 | request.u.effect_id = effect_id; |
| 151 | uinput_request_submit(dev, &request); | 147 | |
| 152 | return request.retval; | 148 | retval = uinput_request_reserve_slot(dev->private, &request); |
| 149 | if (!retval) | ||
| 150 | retval = uinput_request_submit(dev, &request); | ||
| 151 | |||
| 152 | return retval; | ||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static int uinput_create_device(struct uinput_device *udev) | 155 | static int uinput_create_device(struct uinput_device *udev) |
| @@ -159,32 +159,30 @@ static int uinput_create_device(struct uinput_device *udev) | |||
| 159 | return -EINVAL; | 159 | return -EINVAL; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | udev->dev->open = uinput_dev_open; | ||
| 163 | udev->dev->close = uinput_dev_close; | ||
| 164 | udev->dev->event = uinput_dev_event; | 162 | udev->dev->event = uinput_dev_event; |
| 165 | udev->dev->upload_effect = uinput_dev_upload_effect; | 163 | udev->dev->upload_effect = uinput_dev_upload_effect; |
| 166 | udev->dev->erase_effect = uinput_dev_erase_effect; | 164 | udev->dev->erase_effect = uinput_dev_erase_effect; |
| 167 | udev->dev->private = udev; | 165 | udev->dev->private = udev; |
| 168 | 166 | ||
| 169 | init_waitqueue_head(&(udev->waitq)); | 167 | init_waitqueue_head(&udev->waitq); |
| 170 | 168 | ||
| 171 | input_register_device(udev->dev); | 169 | input_register_device(udev->dev); |
| 172 | 170 | ||
| 173 | set_bit(UIST_CREATED, &(udev->state)); | 171 | set_bit(UIST_CREATED, &udev->state); |
| 174 | 172 | ||
| 175 | return 0; | 173 | return 0; |
| 176 | } | 174 | } |
| 177 | 175 | ||
| 178 | static int uinput_destroy_device(struct uinput_device *udev) | 176 | static int uinput_destroy_device(struct uinput_device *udev) |
| 179 | { | 177 | { |
| 180 | if (!test_bit(UIST_CREATED, &(udev->state))) { | 178 | if (!test_bit(UIST_CREATED, &udev->state)) { |
| 181 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); | 179 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); |
| 182 | return -EINVAL; | 180 | return -EINVAL; |
| 183 | } | 181 | } |
| 184 | 182 | ||
| 185 | input_unregister_device(udev->dev); | 183 | input_unregister_device(udev->dev); |
| 186 | 184 | ||
| 187 | clear_bit(UIST_CREATED, &(udev->state)); | 185 | clear_bit(UIST_CREATED, &udev->state); |
| 188 | 186 | ||
| 189 | return 0; | 187 | return 0; |
| 190 | } | 188 | } |
| @@ -198,7 +196,7 @@ static int uinput_open(struct inode *inode, struct file *file) | |||
| 198 | if (!newdev) | 196 | if (!newdev) |
| 199 | goto error; | 197 | goto error; |
| 200 | memset(newdev, 0, sizeof(struct uinput_device)); | 198 | memset(newdev, 0, sizeof(struct uinput_device)); |
| 201 | init_MUTEX(&newdev->requests_sem); | 199 | spin_lock_init(&newdev->requests_lock); |
| 202 | init_waitqueue_head(&newdev->requests_waitq); | 200 | init_waitqueue_head(&newdev->requests_waitq); |
| 203 | 201 | ||
| 204 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); | 202 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); |
| @@ -253,15 +251,16 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
| 253 | struct uinput_user_dev *user_dev; | 251 | struct uinput_user_dev *user_dev; |
| 254 | struct input_dev *dev; | 252 | struct input_dev *dev; |
| 255 | struct uinput_device *udev; | 253 | struct uinput_device *udev; |
| 256 | int size, | 254 | char *name; |
| 257 | retval; | 255 | int size; |
| 256 | int retval; | ||
| 258 | 257 | ||
| 259 | retval = count; | 258 | retval = count; |
| 260 | 259 | ||
| 261 | udev = file->private_data; | 260 | udev = file->private_data; |
| 262 | dev = udev->dev; | 261 | dev = udev->dev; |
| 263 | 262 | ||
| 264 | user_dev = kmalloc(sizeof(*user_dev), GFP_KERNEL); | 263 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); |
| 265 | if (!user_dev) { | 264 | if (!user_dev) { |
| 266 | retval = -ENOMEM; | 265 | retval = -ENOMEM; |
| 267 | goto exit; | 266 | goto exit; |
| @@ -272,17 +271,17 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
| 272 | goto exit; | 271 | goto exit; |
| 273 | } | 272 | } |
| 274 | 273 | ||
| 275 | if (NULL != dev->name) | 274 | if (dev->name) |
| 276 | kfree(dev->name); | 275 | kfree(dev->name); |
| 277 | 276 | ||
| 278 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; | 277 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; |
| 279 | dev->name = kmalloc(size, GFP_KERNEL); | 278 | dev->name = name = kmalloc(size, GFP_KERNEL); |
| 280 | if (!dev->name) { | 279 | if (!name) { |
| 281 | retval = -ENOMEM; | 280 | retval = -ENOMEM; |
| 282 | goto exit; | 281 | goto exit; |
| 283 | } | 282 | } |
| 283 | strlcpy(name, user_dev->name, size); | ||
| 284 | 284 | ||
| 285 | strlcpy(dev->name, user_dev->name, size); | ||
| 286 | dev->id.bustype = user_dev->id.bustype; | 285 | dev->id.bustype = user_dev->id.bustype; |
| 287 | dev->id.vendor = user_dev->id.vendor; | 286 | dev->id.vendor = user_dev->id.vendor; |
| 288 | dev->id.product = user_dev->id.product; | 287 | dev->id.product = user_dev->id.product; |
| @@ -314,14 +313,13 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t | |||
| 314 | { | 313 | { |
| 315 | struct uinput_device *udev = file->private_data; | 314 | struct uinput_device *udev = file->private_data; |
| 316 | 315 | ||
| 317 | if (test_bit(UIST_CREATED, &(udev->state))) { | 316 | if (test_bit(UIST_CREATED, &udev->state)) { |
| 318 | struct input_event ev; | 317 | struct input_event ev; |
| 319 | 318 | ||
| 320 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | 319 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) |
| 321 | return -EFAULT; | 320 | return -EFAULT; |
| 322 | input_event(udev->dev, ev.type, ev.code, ev.value); | 321 | input_event(udev->dev, ev.type, ev.code, ev.value); |
| 323 | } | 322 | } else |
| 324 | else | ||
| 325 | count = uinput_alloc_device(file, buffer, count); | 323 | count = uinput_alloc_device(file, buffer, count); |
| 326 | 324 | ||
| 327 | return count; | 325 | return count; |
| @@ -332,26 +330,24 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
| 332 | struct uinput_device *udev = file->private_data; | 330 | struct uinput_device *udev = file->private_data; |
| 333 | int retval = 0; | 331 | int retval = 0; |
| 334 | 332 | ||
| 335 | if (!test_bit(UIST_CREATED, &(udev->state))) | 333 | if (!test_bit(UIST_CREATED, &udev->state)) |
| 336 | return -ENODEV; | 334 | return -ENODEV; |
| 337 | 335 | ||
| 338 | if ((udev->head == udev->tail) && (file->f_flags & O_NONBLOCK)) | 336 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) |
| 339 | return -EAGAIN; | 337 | return -EAGAIN; |
| 340 | 338 | ||
| 341 | retval = wait_event_interruptible(udev->waitq, | 339 | retval = wait_event_interruptible(udev->waitq, |
| 342 | (udev->head != udev->tail) || | 340 | udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); |
| 343 | !test_bit(UIST_CREATED, &(udev->state))); | ||
| 344 | |||
| 345 | if (retval) | 341 | if (retval) |
| 346 | return retval; | 342 | return retval; |
| 347 | 343 | ||
| 348 | if (!test_bit(UIST_CREATED, &(udev->state))) | 344 | if (!test_bit(UIST_CREATED, &udev->state)) |
| 349 | return -ENODEV; | 345 | return -ENODEV; |
| 350 | 346 | ||
| 351 | while ((udev->head != udev->tail) && | 347 | while ((udev->head != udev->tail) && |
| 352 | (retval + sizeof(struct input_event) <= count)) { | 348 | (retval + sizeof(struct input_event) <= count)) { |
| 353 | if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), | 349 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) |
| 354 | sizeof(struct input_event))) return -EFAULT; | 350 | return -EFAULT; |
| 355 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | 351 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; |
| 356 | retval += sizeof(struct input_event); | 352 | retval += sizeof(struct input_event); |
| 357 | } | 353 | } |
| @@ -373,12 +369,12 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) | |||
| 373 | 369 | ||
| 374 | static int uinput_burn_device(struct uinput_device *udev) | 370 | static int uinput_burn_device(struct uinput_device *udev) |
| 375 | { | 371 | { |
| 376 | if (test_bit(UIST_CREATED, &(udev->state))) | 372 | if (test_bit(UIST_CREATED, &udev->state)) |
| 377 | uinput_destroy_device(udev); | 373 | uinput_destroy_device(udev); |
| 378 | 374 | ||
| 379 | if (NULL != udev->dev->name) | 375 | if (udev->dev->name) |
| 380 | kfree(udev->dev->name); | 376 | kfree(udev->dev->name); |
| 381 | if (NULL != udev->dev->phys) | 377 | if (udev->dev->phys) |
| 382 | kfree(udev->dev->phys); | 378 | kfree(udev->dev->phys); |
| 383 | 379 | ||
| 384 | kfree(udev->dev); | 380 | kfree(udev->dev); |
| @@ -389,7 +385,8 @@ static int uinput_burn_device(struct uinput_device *udev) | |||
| 389 | 385 | ||
| 390 | static int uinput_close(struct inode *inode, struct file *file) | 386 | static int uinput_close(struct inode *inode, struct file *file) |
| 391 | { | 387 | { |
| 392 | return uinput_burn_device(file->private_data); | 388 | uinput_burn_device(file->private_data); |
| 389 | return 0; | ||
| 393 | } | 390 | } |
| 394 | 391 | ||
| 395 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 392 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
| @@ -401,6 +398,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 401 | struct uinput_ff_erase ff_erase; | 398 | struct uinput_ff_erase ff_erase; |
| 402 | struct uinput_request *req; | 399 | struct uinput_request *req; |
| 403 | int length; | 400 | int length; |
| 401 | char *phys; | ||
| 404 | 402 | ||
| 405 | udev = file->private_data; | 403 | udev = file->private_data; |
| 406 | 404 | ||
| @@ -415,7 +413,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 415 | case UI_SET_SNDBIT: | 413 | case UI_SET_SNDBIT: |
| 416 | case UI_SET_FFBIT: | 414 | case UI_SET_FFBIT: |
| 417 | case UI_SET_PHYS: | 415 | case UI_SET_PHYS: |
| 418 | if (test_bit(UIST_CREATED, &(udev->state))) | 416 | if (test_bit(UIST_CREATED, &udev->state)) |
| 419 | return -EINVAL; | 417 | return -EINVAL; |
| 420 | } | 418 | } |
| 421 | 419 | ||
| @@ -498,20 +496,19 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 498 | retval = -EFAULT; | 496 | retval = -EFAULT; |
| 499 | break; | 497 | break; |
| 500 | } | 498 | } |
| 501 | if (NULL != udev->dev->phys) | 499 | kfree(udev->dev->phys); |
| 502 | kfree(udev->dev->phys); | 500 | udev->dev->phys = phys = kmalloc(length, GFP_KERNEL); |
| 503 | udev->dev->phys = kmalloc(length, GFP_KERNEL); | 501 | if (!phys) { |
| 504 | if (!udev->dev->phys) { | ||
| 505 | retval = -ENOMEM; | 502 | retval = -ENOMEM; |
| 506 | break; | 503 | break; |
| 507 | } | 504 | } |
| 508 | if (copy_from_user(udev->dev->phys, p, length)) { | 505 | if (copy_from_user(phys, p, length)) { |
| 509 | retval = -EFAULT; | ||
| 510 | kfree(udev->dev->phys); | ||
| 511 | udev->dev->phys = NULL; | 506 | udev->dev->phys = NULL; |
| 507 | kfree(phys); | ||
| 508 | retval = -EFAULT; | ||
| 512 | break; | 509 | break; |
| 513 | } | 510 | } |
| 514 | udev->dev->phys[length-1] = '\0'; | 511 | phys[length - 1] = '\0'; |
| 515 | break; | 512 | break; |
| 516 | 513 | ||
| 517 | case UI_BEGIN_FF_UPLOAD: | 514 | case UI_BEGIN_FF_UPLOAD: |
| @@ -520,7 +517,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 520 | break; | 517 | break; |
| 521 | } | 518 | } |
| 522 | req = uinput_request_find(udev, ff_up.request_id); | 519 | req = uinput_request_find(udev, ff_up.request_id); |
| 523 | if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { | 520 | if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) { |
| 524 | retval = -EINVAL; | 521 | retval = -EINVAL; |
| 525 | break; | 522 | break; |
| 526 | } | 523 | } |
| @@ -538,7 +535,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 538 | break; | 535 | break; |
| 539 | } | 536 | } |
| 540 | req = uinput_request_find(udev, ff_erase.request_id); | 537 | req = uinput_request_find(udev, ff_erase.request_id); |
| 541 | if (!(req && req->code==UI_FF_ERASE)) { | 538 | if (!(req && req->code == UI_FF_ERASE)) { |
| 542 | retval = -EINVAL; | 539 | retval = -EINVAL; |
| 543 | break; | 540 | break; |
| 544 | } | 541 | } |
| @@ -556,14 +553,13 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 556 | break; | 553 | break; |
| 557 | } | 554 | } |
| 558 | req = uinput_request_find(udev, ff_up.request_id); | 555 | req = uinput_request_find(udev, ff_up.request_id); |
| 559 | if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { | 556 | if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) { |
| 560 | retval = -EINVAL; | 557 | retval = -EINVAL; |
| 561 | break; | 558 | break; |
| 562 | } | 559 | } |
| 563 | req->retval = ff_up.retval; | 560 | req->retval = ff_up.retval; |
| 564 | memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect)); | 561 | memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect)); |
| 565 | req->completed = 1; | 562 | uinput_request_done(udev, req); |
| 566 | wake_up_interruptible(&req->waitq); | ||
| 567 | break; | 563 | break; |
| 568 | 564 | ||
| 569 | case UI_END_FF_ERASE: | 565 | case UI_END_FF_ERASE: |
| @@ -572,13 +568,12 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
| 572 | break; | 568 | break; |
| 573 | } | 569 | } |
| 574 | req = uinput_request_find(udev, ff_erase.request_id); | 570 | req = uinput_request_find(udev, ff_erase.request_id); |
| 575 | if (!(req && req->code==UI_FF_ERASE)) { | 571 | if (!(req && req->code == UI_FF_ERASE)) { |
| 576 | retval = -EINVAL; | 572 | retval = -EINVAL; |
| 577 | break; | 573 | break; |
| 578 | } | 574 | } |
| 579 | req->retval = ff_erase.retval; | 575 | req->retval = ff_erase.retval; |
| 580 | req->completed = 1; | 576 | uinput_request_done(udev, req); |
| 581 | wake_up_interruptible(&req->waitq); | ||
| 582 | break; | 577 | break; |
| 583 | 578 | ||
| 584 | default: | 579 | default: |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index a12e98158a75..0d68e5e0182a 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * ALPS touchpad PS/2 mouse driver | 2 | * ALPS touchpad PS/2 mouse driver |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au> | 4 | * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au> |
| 5 | * Copyright (c) 2003 Peter Osterlund <petero2@telia.com> | 5 | * Copyright (c) 2003-2005 Peter Osterlund <petero2@telia.com> |
| 6 | * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> | 6 | * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> |
| 7 | * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> | 7 | * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> |
| 8 | * | 8 | * |
| @@ -350,7 +350,6 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable) | |||
| 350 | static int alps_reconnect(struct psmouse *psmouse) | 350 | static int alps_reconnect(struct psmouse *psmouse) |
| 351 | { | 351 | { |
| 352 | struct alps_data *priv = psmouse->private; | 352 | struct alps_data *priv = psmouse->private; |
| 353 | unsigned char param[4]; | ||
| 354 | int version; | 353 | int version; |
| 355 | 354 | ||
| 356 | psmouse_reset(psmouse); | 355 | psmouse_reset(psmouse); |
| @@ -358,21 +357,20 @@ static int alps_reconnect(struct psmouse *psmouse) | |||
| 358 | if (!(priv->i = alps_get_model(psmouse, &version))) | 357 | if (!(priv->i = alps_get_model(psmouse, &version))) |
| 359 | return -1; | 358 | return -1; |
| 360 | 359 | ||
| 361 | if (priv->i->flags & ALPS_PASS && alps_passthrough_mode(psmouse, 1)) | 360 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) |
| 362 | return -1; | 361 | return -1; |
| 363 | 362 | ||
| 364 | if (alps_get_status(psmouse, param)) | 363 | if (alps_tap_mode(psmouse, 1)) { |
| 364 | printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n"); | ||
| 365 | return -1; | 365 | return -1; |
| 366 | 366 | } | |
| 367 | if (!(param[0] & 0x04)) | ||
| 368 | alps_tap_mode(psmouse, 1); | ||
| 369 | 367 | ||
| 370 | if (alps_absolute_mode(psmouse)) { | 368 | if (alps_absolute_mode(psmouse)) { |
| 371 | printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); | 369 | printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n"); |
| 372 | return -1; | 370 | return -1; |
| 373 | } | 371 | } |
| 374 | 372 | ||
| 375 | if (priv->i->flags == ALPS_PASS && alps_passthrough_mode(psmouse, 0)) | 373 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0)) |
| 376 | return -1; | 374 | return -1; |
| 377 | 375 | ||
| 378 | return 0; | 376 | return 0; |
| @@ -389,7 +387,6 @@ static void alps_disconnect(struct psmouse *psmouse) | |||
| 389 | int alps_init(struct psmouse *psmouse) | 387 | int alps_init(struct psmouse *psmouse) |
| 390 | { | 388 | { |
| 391 | struct alps_data *priv; | 389 | struct alps_data *priv; |
| 392 | unsigned char param[4]; | ||
| 393 | int version; | 390 | int version; |
| 394 | 391 | ||
| 395 | psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); | 392 | psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); |
| @@ -403,16 +400,8 @@ int alps_init(struct psmouse *psmouse) | |||
| 403 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) | 400 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) |
| 404 | goto init_fail; | 401 | goto init_fail; |
| 405 | 402 | ||
| 406 | if (alps_get_status(psmouse, param)) { | 403 | if (alps_tap_mode(psmouse, 1)) |
| 407 | printk(KERN_ERR "alps.c: touchpad status report request failed\n"); | 404 | printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); |
| 408 | goto init_fail; | ||
| 409 | } | ||
| 410 | |||
| 411 | if (param[0] & 0x04) { | ||
| 412 | printk(KERN_INFO "alps.c: Enabling hardware tapping\n"); | ||
| 413 | if (alps_tap_mode(psmouse, 1)) | ||
| 414 | printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); | ||
| 415 | } | ||
| 416 | 405 | ||
| 417 | if (alps_absolute_mode(psmouse)) { | 406 | if (alps_absolute_mode(psmouse)) { |
| 418 | printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); | 407 | printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 5ab1bd7d529d..48d2b20d2642 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
| @@ -385,8 +385,6 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties) | |||
| 385 | 385 | ||
| 386 | if (buttons < 3) | 386 | if (buttons < 3) |
| 387 | clear_bit(BTN_MIDDLE, psmouse->dev.keybit); | 387 | clear_bit(BTN_MIDDLE, psmouse->dev.keybit); |
| 388 | if (buttons < 2) | ||
| 389 | clear_bit(BTN_RIGHT, psmouse->dev.keybit); | ||
| 390 | 388 | ||
| 391 | if (model_info) | 389 | if (model_info) |
| 392 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); | 390 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 19785a6c5abd..2bb2fe78bdca 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
| @@ -344,6 +344,7 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties) | |||
| 344 | return -1; | 344 | return -1; |
| 345 | 345 | ||
| 346 | if (set_properties) { | 346 | if (set_properties) { |
| 347 | set_bit(BTN_MIDDLE, psmouse->dev.keybit); | ||
| 347 | set_bit(REL_WHEEL, psmouse->dev.relbit); | 348 | set_bit(REL_WHEEL, psmouse->dev.relbit); |
| 348 | 349 | ||
| 349 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 350 | if (!psmouse->vendor) psmouse->vendor = "Generic"; |
| @@ -376,6 +377,7 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties) | |||
| 376 | return -1; | 377 | return -1; |
| 377 | 378 | ||
| 378 | if (set_properties) { | 379 | if (set_properties) { |
| 380 | set_bit(BTN_MIDDLE, psmouse->dev.keybit); | ||
| 379 | set_bit(REL_WHEEL, psmouse->dev.relbit); | 381 | set_bit(REL_WHEEL, psmouse->dev.relbit); |
| 380 | set_bit(BTN_SIDE, psmouse->dev.keybit); | 382 | set_bit(BTN_SIDE, psmouse->dev.keybit); |
| 381 | set_bit(BTN_EXTRA, psmouse->dev.keybit); | 383 | set_bit(BTN_EXTRA, psmouse->dev.keybit); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 36c721227b68..029309422409 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -219,7 +219,7 @@ static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet | |||
| 219 | serio_interrupt(ptport, packet[1], 0, NULL); | 219 | serio_interrupt(ptport, packet[1], 0, NULL); |
| 220 | serio_interrupt(ptport, packet[4], 0, NULL); | 220 | serio_interrupt(ptport, packet[4], 0, NULL); |
| 221 | serio_interrupt(ptport, packet[5], 0, NULL); | 221 | serio_interrupt(ptport, packet[5], 0, NULL); |
| 222 | if (child->type >= PSMOUSE_GENPS) | 222 | if (child->pktsize == 4) |
| 223 | serio_interrupt(ptport, packet[2], 0, NULL); | 223 | serio_interrupt(ptport, packet[2], 0, NULL); |
| 224 | } else | 224 | } else |
| 225 | serio_interrupt(ptport, packet[1], 0, NULL); | 225 | serio_interrupt(ptport, packet[1], 0, NULL); |
| @@ -233,7 +233,7 @@ static void synaptics_pt_activate(struct psmouse *psmouse) | |||
| 233 | 233 | ||
| 234 | /* adjust the touchpad to child's choice of protocol */ | 234 | /* adjust the touchpad to child's choice of protocol */ |
| 235 | if (child) { | 235 | if (child) { |
| 236 | if (child->type >= PSMOUSE_GENPS) | 236 | if (child->pktsize == 4) |
| 237 | priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; | 237 | priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; |
| 238 | else | 238 | else |
| 239 | priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; | 239 | priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; |
| @@ -608,6 +608,13 @@ static struct dmi_system_id toshiba_dmi_table[] = { | |||
| 608 | DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"), | 608 | DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"), |
| 609 | }, | 609 | }, |
| 610 | }, | 610 | }, |
| 611 | { | ||
| 612 | .ident = "Toshiba Dynabook", | ||
| 613 | .matches = { | ||
| 614 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
| 615 | DMI_MATCH(DMI_PRODUCT_NAME , "dynabook"), | ||
| 616 | }, | ||
| 617 | }, | ||
| 611 | { } | 618 | { } |
| 612 | }; | 619 | }; |
| 613 | #endif | 620 | #endif |
| @@ -656,7 +663,8 @@ int synaptics_init(struct psmouse *psmouse) | |||
| 656 | * thye same as rate of standard PS/2 mouse. | 663 | * thye same as rate of standard PS/2 mouse. |
| 657 | */ | 664 | */ |
| 658 | if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { | 665 | if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { |
| 659 | printk(KERN_INFO "synaptics: Toshiba Satellite detected, limiting rate to 40pps.\n"); | 666 | printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", |
| 667 | dmi_get_system_info(DMI_PRODUCT_NAME)); | ||
| 660 | psmouse->rate = 40; | 668 | psmouse->rate = 40; |
| 661 | } | 669 | } |
| 662 | #endif | 670 | #endif |
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index b3710733b36b..98acf170252c 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
| @@ -175,7 +175,7 @@ config SERIO_RAW | |||
| 175 | allocating minor 1 (that historically corresponds to /dev/psaux) | 175 | allocating minor 1 (that historically corresponds to /dev/psaux) |
| 176 | first. To bind this driver to a serio port use sysfs interface: | 176 | first. To bind this driver to a serio port use sysfs interface: |
| 177 | 177 | ||
| 178 | echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver | 178 | echo -n "serio_raw" > /sys/bus/serio/devices/serioX/drvctl |
| 179 | 179 | ||
| 180 | To compile this driver as a module, choose M here: the | 180 | To compile this driver as a module, choose M here: the |
| 181 | module will be called serio_raw. | 181 | module will be called serio_raw. |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 0487ecbb8a49..03877c84e6ff 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
| @@ -131,12 +131,26 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |||
| 131 | }, | 131 | }, |
| 132 | }, | 132 | }, |
| 133 | { | 133 | { |
| 134 | .ident = "Fujitsu-Siemens Lifebook T3010", | ||
| 135 | .matches = { | ||
| 136 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
| 137 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"), | ||
| 138 | }, | ||
| 139 | }, | ||
| 140 | { | ||
| 134 | .ident = "Toshiba P10", | 141 | .ident = "Toshiba P10", |
| 135 | .matches = { | 142 | .matches = { |
| 136 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 143 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
| 137 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), | 144 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), |
| 138 | }, | 145 | }, |
| 139 | }, | 146 | }, |
| 147 | { | ||
| 148 | .ident = "Alienware Sentia", | ||
| 149 | .matches = { | ||
| 150 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), | ||
| 151 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), | ||
| 152 | }, | ||
| 153 | }, | ||
| 140 | { } | 154 | { } |
| 141 | }; | 155 | }; |
| 142 | 156 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index a9bf549c8dc5..708a1d3beab9 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
| @@ -100,7 +100,7 @@ struct i8042_port { | |||
| 100 | static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { | 100 | static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { |
| 101 | { | 101 | { |
| 102 | .disable = I8042_CTR_KBDDIS, | 102 | .disable = I8042_CTR_KBDDIS, |
| 103 | .irqen = I8042_CTR_KBDINT, | 103 | .irqen = I8042_CTR_KBDINT, |
| 104 | .mux = -1, | 104 | .mux = -1, |
| 105 | .name = "KBD", | 105 | .name = "KBD", |
| 106 | }, | 106 | }, |
| @@ -191,41 +191,45 @@ static int i8042_flush(void) | |||
| 191 | static int i8042_command(unsigned char *param, int command) | 191 | static int i8042_command(unsigned char *param, int command) |
| 192 | { | 192 | { |
| 193 | unsigned long flags; | 193 | unsigned long flags; |
| 194 | int retval = 0, i = 0; | 194 | int i, retval, auxerr = 0; |
| 195 | 195 | ||
| 196 | if (i8042_noloop && command == I8042_CMD_AUX_LOOP) | 196 | if (i8042_noloop && command == I8042_CMD_AUX_LOOP) |
| 197 | return -1; | 197 | return -1; |
| 198 | 198 | ||
| 199 | spin_lock_irqsave(&i8042_lock, flags); | 199 | spin_lock_irqsave(&i8042_lock, flags); |
| 200 | 200 | ||
| 201 | retval = i8042_wait_write(); | 201 | if ((retval = i8042_wait_write())) |
| 202 | if (!retval) { | 202 | goto out; |
| 203 | dbg("%02x -> i8042 (command)", command & 0xff); | 203 | |
| 204 | i8042_write_command(command & 0xff); | 204 | dbg("%02x -> i8042 (command)", command & 0xff); |
| 205 | i8042_write_command(command & 0xff); | ||
| 206 | |||
| 207 | for (i = 0; i < ((command >> 12) & 0xf); i++) { | ||
| 208 | if ((retval = i8042_wait_write())) | ||
| 209 | goto out; | ||
| 210 | dbg("%02x -> i8042 (parameter)", param[i]); | ||
| 211 | i8042_write_data(param[i]); | ||
| 205 | } | 212 | } |
| 206 | 213 | ||
| 207 | if (!retval) | 214 | for (i = 0; i < ((command >> 8) & 0xf); i++) { |
| 208 | for (i = 0; i < ((command >> 12) & 0xf); i++) { | 215 | if ((retval = i8042_wait_read())) |
| 209 | if ((retval = i8042_wait_write())) break; | 216 | goto out; |
| 210 | dbg("%02x -> i8042 (parameter)", param[i]); | ||
| 211 | i8042_write_data(param[i]); | ||
| 212 | } | ||
| 213 | 217 | ||
| 214 | if (!retval) | 218 | if (command == I8042_CMD_AUX_LOOP && |
| 215 | for (i = 0; i < ((command >> 8) & 0xf); i++) { | 219 | !(i8042_read_status() & I8042_STR_AUXDATA)) { |
| 216 | if ((retval = i8042_wait_read())) break; | 220 | retval = auxerr = -1; |
| 217 | if (i8042_read_status() & I8042_STR_AUXDATA) | 221 | goto out; |
| 218 | param[i] = ~i8042_read_data(); | ||
| 219 | else | ||
| 220 | param[i] = i8042_read_data(); | ||
| 221 | dbg("%02x <- i8042 (return)", param[i]); | ||
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | spin_unlock_irqrestore(&i8042_lock, flags); | 224 | param[i] = i8042_read_data(); |
| 225 | dbg("%02x <- i8042 (return)", param[i]); | ||
| 226 | } | ||
| 225 | 227 | ||
| 226 | if (retval) | 228 | if (retval) |
| 227 | dbg(" -- i8042 (timeout)"); | 229 | dbg(" -- i8042 (%s)", auxerr ? "auxerr" : "timeout"); |
| 228 | 230 | ||
| 231 | out: | ||
| 232 | spin_unlock_irqrestore(&i8042_lock, flags); | ||
| 229 | return retval; | 233 | return retval; |
| 230 | } | 234 | } |
| 231 | 235 | ||
| @@ -507,17 +511,17 @@ static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version) | |||
| 507 | */ | 511 | */ |
| 508 | 512 | ||
| 509 | param = 0xf0; | 513 | param = 0xf0; |
| 510 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0x0f) | 514 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xf0) |
| 511 | return -1; | 515 | return -1; |
| 512 | param = mode ? 0x56 : 0xf6; | 516 | param = mode ? 0x56 : 0xf6; |
| 513 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != (mode ? 0xa9 : 0x09)) | 517 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6)) |
| 514 | return -1; | 518 | return -1; |
| 515 | param = mode ? 0xa4 : 0xa5; | 519 | param = mode ? 0xa4 : 0xa5; |
| 516 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == (mode ? 0x5b : 0x5a)) | 520 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5)) |
| 517 | return -1; | 521 | return -1; |
| 518 | 522 | ||
| 519 | if (mux_version) | 523 | if (mux_version) |
| 520 | *mux_version = ~param; | 524 | *mux_version = param; |
| 521 | 525 | ||
| 522 | return 0; | 526 | return 0; |
| 523 | } | 527 | } |
| @@ -619,7 +623,7 @@ static int __init i8042_check_aux(void) | |||
| 619 | */ | 623 | */ |
| 620 | 624 | ||
| 621 | param = 0x5a; | 625 | param = 0x5a; |
| 622 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xa5) { | 626 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0x5a) { |
| 623 | 627 | ||
| 624 | /* | 628 | /* |
| 625 | * External connection test - filters out AT-soldered PS/2 i8042's | 629 | * External connection test - filters out AT-soldered PS/2 i8042's |
| @@ -630,7 +634,7 @@ static int __init i8042_check_aux(void) | |||
| 630 | */ | 634 | */ |
| 631 | 635 | ||
| 632 | if (i8042_command(¶m, I8042_CMD_AUX_TEST) | 636 | if (i8042_command(¶m, I8042_CMD_AUX_TEST) |
| 633 | || (param && param != 0xfa && param != 0xff)) | 637 | || (param && param != 0xfa && param != 0xff)) |
| 634 | return -1; | 638 | return -1; |
| 635 | } | 639 | } |
| 636 | 640 | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index f367695e69b5..edd15db17715 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
| @@ -389,6 +389,14 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut | |||
| 389 | return sprintf(buf, "%s\n", serio->name); | 389 | return sprintf(buf, "%s\n", serio->name); |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) | ||
| 393 | { | ||
| 394 | struct serio *serio = to_serio_port(dev); | ||
| 395 | |||
| 396 | return sprintf(buf, "serio:ty%02Xpr%02Xid%02Xex%02X\n", | ||
| 397 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); | ||
| 398 | } | ||
| 399 | |||
| 392 | static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) | 400 | static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) |
| 393 | { | 401 | { |
| 394 | struct serio *serio = to_serio_port(dev); | 402 | struct serio *serio = to_serio_port(dev); |
| @@ -487,6 +495,7 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute * | |||
| 487 | 495 | ||
| 488 | static struct device_attribute serio_device_attrs[] = { | 496 | static struct device_attribute serio_device_attrs[] = { |
| 489 | __ATTR(description, S_IRUGO, serio_show_description, NULL), | 497 | __ATTR(description, S_IRUGO, serio_show_description, NULL), |
| 498 | __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL), | ||
| 490 | __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), | 499 | __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), |
| 491 | __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), | 500 | __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), |
| 492 | __ATTR_NULL | 501 | __ATTR_NULL |
| @@ -785,36 +794,37 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv) | |||
| 785 | 794 | ||
| 786 | #ifdef CONFIG_HOTPLUG | 795 | #ifdef CONFIG_HOTPLUG |
| 787 | 796 | ||
| 788 | #define PUT_ENVP(fmt, val) \ | 797 | #define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \ |
| 789 | do { \ | 798 | do { \ |
| 790 | envp[i++] = buffer; \ | 799 | int err = add_hotplug_env_var(envp, num_envp, &i, \ |
| 791 | length += snprintf(buffer, buffer_size - length, fmt, val); \ | 800 | buffer, buffer_size, &len, \ |
| 792 | if (buffer_size - length <= 0 || i >= num_envp) \ | 801 | fmt, val); \ |
| 793 | return -ENOMEM; \ | 802 | if (err) \ |
| 794 | length++; \ | 803 | return err; \ |
| 795 | buffer += length; \ | 804 | } while (0) |
| 796 | } while (0) | 805 | |
| 797 | static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) | 806 | static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) |
| 798 | { | 807 | { |
| 799 | struct serio *serio; | 808 | struct serio *serio; |
| 800 | int i = 0; | 809 | int i = 0; |
| 801 | int length = 0; | 810 | int len = 0; |
| 802 | 811 | ||
| 803 | if (!dev) | 812 | if (!dev) |
| 804 | return -ENODEV; | 813 | return -ENODEV; |
| 805 | 814 | ||
| 806 | serio = to_serio_port(dev); | 815 | serio = to_serio_port(dev); |
| 807 | 816 | ||
| 808 | PUT_ENVP("SERIO_TYPE=%02x", serio->id.type); | 817 | SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type); |
| 809 | PUT_ENVP("SERIO_PROTO=%02x", serio->id.proto); | 818 | SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto); |
| 810 | PUT_ENVP("SERIO_ID=%02x", serio->id.id); | 819 | SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id); |
| 811 | PUT_ENVP("SERIO_EXTRA=%02x", serio->id.extra); | 820 | SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra); |
| 812 | 821 | SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", | |
| 822 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); | ||
| 813 | envp[i] = NULL; | 823 | envp[i] = NULL; |
| 814 | 824 | ||
| 815 | return 0; | 825 | return 0; |
| 816 | } | 826 | } |
| 817 | #undef PUT_ENVP | 827 | #undef SERIO_ADD_HOTPLUG_VAR |
| 818 | 828 | ||
| 819 | #else | 829 | #else |
| 820 | 830 | ||
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index d914e7e93db4..47e08de18d07 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
| @@ -299,6 +299,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) | |||
| 299 | 299 | ||
| 300 | serio_raw->dev.minor = PSMOUSE_MINOR; | 300 | serio_raw->dev.minor = PSMOUSE_MINOR; |
| 301 | serio_raw->dev.name = serio_raw->name; | 301 | serio_raw->dev.name = serio_raw->name; |
| 302 | serio_raw->dev.dev = &serio->dev; | ||
| 302 | serio_raw->dev.fops = &serio_raw_fops; | 303 | serio_raw->dev.fops = &serio_raw_fops; |
| 303 | 304 | ||
| 304 | err = misc_register(&serio_raw->dev); | 305 | err = misc_register(&serio_raw->dev); |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 7e991274ea40..0489af5a80c9 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -58,7 +58,7 @@ config TOUCHSCREEN_ELO | |||
| 58 | If unsure, say N. | 58 | If unsure, say N. |
| 59 | 59 | ||
| 60 | To compile this driver as a module, choose M here: the | 60 | To compile this driver as a module, choose M here: the |
| 61 | module will be called gunze. | 61 | module will be called elo. |
| 62 | 62 | ||
| 63 | config TOUCHSCREEN_MTOUCH | 63 | config TOUCHSCREEN_MTOUCH |
| 64 | tristate "MicroTouch serial touchscreens" | 64 | tristate "MicroTouch serial touchscreens" |
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/pci/probe.c b/drivers/pci/probe.c index df3bdae2040f..93e8a878ea95 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -507,7 +507,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
| 507 | pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); | 507 | pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); |
| 508 | 508 | ||
| 509 | if (!is_cardbus) { | 509 | if (!is_cardbus) { |
| 510 | child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA; | 510 | child->bridge_ctl = bctl | PCI_BRIDGE_CTL_NO_ISA; |
| 511 | /* | 511 | /* |
| 512 | * Adjust subordinate busnr in parent buses. | 512 | * Adjust subordinate busnr in parent buses. |
| 513 | * We do this before scanning for children because | 513 | * We do this before scanning for children because |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 1521fd5d95cc..8d0968bd527e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -820,6 +820,11 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 820 | case 0x0001: /* Toshiba Satellite A40 */ | 820 | case 0x0001: /* Toshiba Satellite A40 */ |
| 821 | asus_hides_smbus = 1; | 821 | asus_hides_smbus = 1; |
| 822 | } | 822 | } |
| 823 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | ||
| 824 | switch(dev->subsystem_device) { | ||
| 825 | case 0x0001: /* Toshiba Tecra M2 */ | ||
| 826 | asus_hides_smbus = 1; | ||
| 827 | } | ||
| 823 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { | 828 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { |
| 824 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 829 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
| 825 | switch(dev->subsystem_device) { | 830 | switch(dev->subsystem_device) { |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 838575e3fac6..713c78f3a65d 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
| @@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
| 125 | image += readw(pds + 16) * 512; | 125 | image += readw(pds + 16) * 512; |
| 126 | } while (!last_image); | 126 | } while (!last_image); |
| 127 | 127 | ||
| 128 | *size = image - rom; | 128 | /* never return a size larger than the PCI resource window */ |
| 129 | /* there are known ROMs that get the size wrong */ | ||
| 130 | *size = min((size_t)(image - rom), *size); | ||
| 129 | 131 | ||
| 130 | return rom; | 132 | return rom; |
| 131 | } | 133 | } |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 9fe48f712be9..a2eebc6eaacc 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -51,8 +51,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus) | |||
| 51 | struct resource_list head, *list, *tmp; | 51 | struct resource_list head, *list, *tmp; |
| 52 | int idx; | 52 | int idx; |
| 53 | 53 | ||
| 54 | bus->bridge_ctl &= ~PCI_BRIDGE_CTL_VGA; | ||
| 55 | |||
| 56 | head.next = NULL; | 54 | head.next = NULL; |
| 57 | list_for_each_entry(dev, &bus->devices, bus_list) { | 55 | list_for_each_entry(dev, &bus->devices, bus_list) { |
| 58 | u16 class = dev->class >> 8; | 56 | u16 class = dev->class >> 8; |
| @@ -62,10 +60,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus) | |||
| 62 | class == PCI_CLASS_BRIDGE_HOST) | 60 | class == PCI_CLASS_BRIDGE_HOST) |
| 63 | continue; | 61 | continue; |
| 64 | 62 | ||
| 65 | if (class == PCI_CLASS_DISPLAY_VGA || | ||
| 66 | class == PCI_CLASS_NOT_DEFINED_VGA) | ||
| 67 | bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA; | ||
| 68 | |||
| 69 | pdev_sort_resources(dev, &head); | 63 | pdev_sort_resources(dev, &head); |
| 70 | } | 64 | } |
| 71 | 65 | ||
| @@ -509,12 +503,6 @@ pci_bus_assign_resources(struct pci_bus *bus) | |||
| 509 | 503 | ||
| 510 | pbus_assign_resources_sorted(bus); | 504 | pbus_assign_resources_sorted(bus); |
| 511 | 505 | ||
| 512 | if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) { | ||
| 513 | /* Propagate presence of the VGA to upstream bridges */ | ||
| 514 | for (b = bus; b->parent; b = b->parent) { | ||
| 515 | b->bridge_ctl |= PCI_BRIDGE_CTL_VGA; | ||
| 516 | } | ||
| 517 | } | ||
| 518 | list_for_each_entry(dev, &bus->devices, bus_list) { | 506 | list_for_each_entry(dev, &bus->devices, bus_list) { |
| 519 | b = dev->subordinate; | 507 | b = dev->subordinate; |
| 520 | if (!b) | 508 | if (!b) |
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/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 9b7f6f548b1d..ee7a05e0c3ba 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
| @@ -235,6 +235,9 @@ ccw_device_recog_done(struct ccw_device *cdev, int state) | |||
| 235 | sch->schib.pmcw.pam & | 235 | sch->schib.pmcw.pam & |
| 236 | sch->schib.pmcw.pom & | 236 | sch->schib.pmcw.pom & |
| 237 | sch->opm; | 237 | sch->opm; |
| 238 | /* Check since device may again have become not operational. */ | ||
| 239 | if (!sch->schib.pmcw.dnv) | ||
| 240 | state = DEV_STATE_NOT_OPER; | ||
| 238 | if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) | 241 | if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) |
| 239 | /* Force reprobe on all chpids. */ | 242 | /* Force reprobe on all chpids. */ |
| 240 | old_lpm = 0; | 243 | old_lpm = 0; |
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/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 18c58fb73899..6b321e82cafb 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
| @@ -394,7 +394,7 @@ static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags) | |||
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | static int __devinit | 396 | static int __devinit |
| 397 | serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) | 397 | serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) |
| 398 | { | 398 | { |
| 399 | struct uart_port port; | 399 | struct uart_port port; |
| 400 | int ret, line, flags = dev_id->driver_data; | 400 | int ret, line, flags = dev_id->driver_data; |
| @@ -406,15 +406,23 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) | |||
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | memset(&port, 0, sizeof(struct uart_port)); | 408 | memset(&port, 0, sizeof(struct uart_port)); |
| 409 | port.irq = pnp_irq(dev,0); | 409 | port.irq = pnp_irq(dev, 0); |
| 410 | port.iobase = pnp_port_start(dev, 0); | 410 | if (pnp_port_valid(dev, 0)) { |
| 411 | port.iobase = pnp_port_start(dev, 0); | ||
| 412 | port.iotype = UPIO_PORT; | ||
| 413 | } else if (pnp_mem_valid(dev, 0)) { | ||
| 414 | port.mapbase = pnp_mem_start(dev, 0); | ||
| 415 | port.iotype = UPIO_MEM; | ||
| 416 | port.flags = UPF_IOREMAP; | ||
| 417 | } else | ||
| 418 | return -ENODEV; | ||
| 411 | 419 | ||
| 412 | #ifdef SERIAL_DEBUG_PNP | 420 | #ifdef SERIAL_DEBUG_PNP |
| 413 | printk("Setup PNP port: port %x, irq %d, type %d\n", | 421 | printk("Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n", |
| 414 | port.iobase, port.irq, port.iotype); | 422 | port.iobase, port.mapbase, port.irq, port.iotype); |
| 415 | #endif | 423 | #endif |
| 416 | 424 | ||
| 417 | port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; | 425 | port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; |
| 418 | port.uartclk = 1843200; | 426 | port.uartclk = 1843200; |
| 419 | port.dev = &dev->dev; | 427 | port.dev = &dev->dev; |
| 420 | 428 | ||
| @@ -426,7 +434,7 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) | |||
| 426 | 434 | ||
| 427 | } | 435 | } |
| 428 | 436 | ||
| 429 | static void __devexit serial_pnp_remove(struct pnp_dev * dev) | 437 | static void __devexit serial_pnp_remove(struct pnp_dev *dev) |
| 430 | { | 438 | { |
| 431 | long line = (long)pnp_get_drvdata(dev); | 439 | long line = (long)pnp_get_drvdata(dev); |
| 432 | if (line) | 440 | if (line) |
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/usb/Kconfig b/drivers/usb/Kconfig index cd329dd7fb86..85dacc92545a 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
| @@ -20,6 +20,7 @@ config USB_ARCH_HAS_OHCI | |||
| 20 | default y if SA1111 | 20 | default y if SA1111 |
| 21 | default y if ARCH_OMAP | 21 | default y if ARCH_OMAP |
| 22 | default y if ARCH_LH7A404 | 22 | default y if ARCH_LH7A404 |
| 23 | default y if ARCH_S3C2410 | ||
| 23 | default y if PXA27x | 24 | default y if PXA27x |
| 24 | # PPC: | 25 | # PPC: |
| 25 | default y if STB03xxx | 26 | default y if STB03xxx |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index adff5a77e31f..16ecad30e29c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -980,6 +980,9 @@ static struct usb_device_id acm_ids[] = { | |||
| 980 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ | 980 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ |
| 981 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 981 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
| 982 | }, | 982 | }, |
| 983 | { USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */ | ||
| 984 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | ||
| 985 | }, | ||
| 983 | /* control interfaces with various AT-command sets */ | 986 | /* control interfaces with various AT-command sets */ |
| 984 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 987 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
| 985 | USB_CDC_ACM_PROTO_AT_V25TER) }, | 988 | USB_CDC_ACM_PROTO_AT_V25TER) }, |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 787c27a63c51..f86bf1454e21 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
| @@ -569,8 +569,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
| 569 | free_page((unsigned long)tbuf); | 569 | free_page((unsigned long)tbuf); |
| 570 | return -EINVAL; | 570 | return -EINVAL; |
| 571 | } | 571 | } |
| 572 | snoop(&dev->dev, "control read: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", | 572 | snoop(&dev->dev, "control read: bRequest=%02x " |
| 573 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); | 573 | "bRrequestType=%02x wValue=%04x " |
| 574 | "wIndex=%04x wLength=%04x\n", | ||
| 575 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, | ||
| 576 | ctrl.wIndex, ctrl.wLength); | ||
| 574 | 577 | ||
| 575 | usb_unlock_device(dev); | 578 | usb_unlock_device(dev); |
| 576 | i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, | 579 | i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, |
| @@ -579,11 +582,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
| 579 | if ((i > 0) && ctrl.wLength) { | 582 | if ((i > 0) && ctrl.wLength) { |
| 580 | if (usbfs_snoop) { | 583 | if (usbfs_snoop) { |
| 581 | dev_info(&dev->dev, "control read: data "); | 584 | dev_info(&dev->dev, "control read: data "); |
| 582 | for (j = 0; j < ctrl.wLength; ++j) | 585 | for (j = 0; j < i; ++j) |
| 583 | printk ("%02x ", (unsigned char)(tbuf)[j]); | 586 | printk ("%02x ", (unsigned char)(tbuf)[j]); |
| 584 | printk("\n"); | 587 | printk("\n"); |
| 585 | } | 588 | } |
| 586 | if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { | 589 | if (copy_to_user(ctrl.data, tbuf, i)) { |
| 587 | free_page((unsigned long)tbuf); | 590 | free_page((unsigned long)tbuf); |
| 588 | return -EFAULT; | 591 | return -EFAULT; |
| 589 | } | 592 | } |
| @@ -595,8 +598,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
| 595 | return -EFAULT; | 598 | return -EFAULT; |
| 596 | } | 599 | } |
| 597 | } | 600 | } |
| 598 | snoop(&dev->dev, "control write: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", | 601 | snoop(&dev->dev, "control write: bRequest=%02x " |
| 599 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); | 602 | "bRrequestType=%02x wValue=%04x " |
| 603 | "wIndex=%04x wLength=%04x\n", | ||
| 604 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, | ||
| 605 | ctrl.wIndex, ctrl.wLength); | ||
| 600 | if (usbfs_snoop) { | 606 | if (usbfs_snoop) { |
| 601 | dev_info(&dev->dev, "control write: data: "); | 607 | dev_info(&dev->dev, "control write: data: "); |
| 602 | for (j = 0; j < ctrl.wLength; ++j) | 608 | for (j = 0; j < ctrl.wLength; ++j) |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8616356f55e8..79422a3b07bc 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -939,9 +939,9 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount) | |||
| 939 | case USB_SPEED_HIGH: /* ISOC or INTR */ | 939 | case USB_SPEED_HIGH: /* ISOC or INTR */ |
| 940 | // FIXME adjust for input vs output | 940 | // FIXME adjust for input vs output |
| 941 | if (isoc) | 941 | if (isoc) |
| 942 | tmp = HS_USECS (bytecount); | 942 | tmp = HS_NSECS_ISO (bytecount); |
| 943 | else | 943 | else |
| 944 | tmp = HS_USECS_ISO (bytecount); | 944 | tmp = HS_NSECS (bytecount); |
| 945 | return tmp; | 945 | return tmp; |
| 946 | default: | 946 | default: |
| 947 | pr_debug ("%s: bogus device speed!\n", usbcore_name); | 947 | pr_debug ("%s: bogus device speed!\n", usbcore_name); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 67db4a999b93..28055f95645b 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
| @@ -334,17 +334,19 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, | |||
| 334 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); | 334 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); |
| 335 | 335 | ||
| 336 | /* | 336 | /* |
| 337 | * Ceiling microseconds (typical) for that many bytes at high speed | 337 | * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed |
| 338 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed | 338 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed |
| 339 | * to preallocate bandwidth) | 339 | * to preallocate bandwidth) |
| 340 | */ | 340 | */ |
| 341 | #define USB2_HOST_DELAY 5 /* nsec, guess */ | 341 | #define USB2_HOST_DELAY 5 /* nsec, guess */ |
| 342 | #define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \ | 342 | #define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \ |
| 343 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ | 343 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ |
| 344 | + USB2_HOST_DELAY) | 344 | + USB2_HOST_DELAY) |
| 345 | #define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \ | 345 | #define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \ |
| 346 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ | 346 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ |
| 347 | + USB2_HOST_DELAY) | 347 | + USB2_HOST_DELAY) |
| 348 | #define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes)) | ||
| 349 | #define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes)) | ||
| 348 | 350 | ||
| 349 | extern long usb_calc_bus_time (int speed, int is_input, | 351 | extern long usb_calc_bus_time (int speed, int is_input, |
| 350 | int isoc, int bytecount); | 352 | int isoc, int bytecount); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a428ef479bd7..88d1b376f67c 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
| 985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { | 985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { |
| 986 | struct usb_interface *interface; | 986 | struct usb_interface *interface; |
| 987 | 987 | ||
| 988 | /* remove this interface */ | 988 | /* remove this interface if it has been registered */ |
| 989 | interface = dev->actconfig->interface[i]; | 989 | interface = dev->actconfig->interface[i]; |
| 990 | if (!klist_node_attached(&interface->dev.knode_bus)) | ||
| 991 | continue; | ||
| 990 | dev_dbg (&dev->dev, "unregistering interface %s\n", | 992 | dev_dbg (&dev->dev, "unregistering interface %s\n", |
| 991 | interface->dev.bus_id); | 993 | interface->dev.bus_id); |
| 992 | usb_remove_sysfs_intf_files(interface); | 994 | usb_remove_sysfs_intf_files(interface); |
| @@ -1439,7 +1441,7 @@ free_interfaces: | |||
| 1439 | } | 1441 | } |
| 1440 | } | 1442 | } |
| 1441 | 1443 | ||
| 1442 | return ret; | 1444 | return 0; |
| 1443 | } | 1445 | } |
| 1444 | 1446 | ||
| 1445 | // synchronous request completion model | 1447 | // synchronous request completion model |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index d74b2d68a50e..4f97a4ad1ed3 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -657,8 +657,8 @@ qh_make ( | |||
| 657 | * For control/bulk requests, the HC or TT handles these. | 657 | * For control/bulk requests, the HC or TT handles these. |
| 658 | */ | 658 | */ |
| 659 | if (type == PIPE_INTERRUPT) { | 659 | if (type == PIPE_INTERRUPT) { |
| 660 | qh->usecs = usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, | 660 | qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, |
| 661 | hb_mult (maxp) * max_packet (maxp)); | 661 | hb_mult (maxp) * max_packet (maxp))); |
| 662 | qh->start = NO_FRAME; | 662 | qh->start = NO_FRAME; |
| 663 | 663 | ||
| 664 | if (urb->dev->speed == USB_SPEED_HIGH) { | 664 | if (urb->dev->speed == USB_SPEED_HIGH) { |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 68decab280dd..56b43f2a0e52 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
| @@ -887,6 +887,10 @@ MODULE_LICENSE ("GPL"); | |||
| 887 | #include "ohci-sa1111.c" | 887 | #include "ohci-sa1111.c" |
| 888 | #endif | 888 | #endif |
| 889 | 889 | ||
| 890 | #ifdef CONFIG_ARCH_S3C2410 | ||
| 891 | #include "ohci-s3c2410.c" | ||
| 892 | #endif | ||
| 893 | |||
| 890 | #ifdef CONFIG_ARCH_OMAP | 894 | #ifdef CONFIG_ARCH_OMAP |
| 891 | #include "ohci-omap.c" | 895 | #include "ohci-omap.c" |
| 892 | #endif | 896 | #endif |
| @@ -909,6 +913,7 @@ MODULE_LICENSE ("GPL"); | |||
| 909 | 913 | ||
| 910 | #if !(defined(CONFIG_PCI) \ | 914 | #if !(defined(CONFIG_PCI) \ |
| 911 | || defined(CONFIG_SA1111) \ | 915 | || defined(CONFIG_SA1111) \ |
| 916 | || defined(CONFIG_ARCH_S3C2410) \ | ||
| 912 | || defined(CONFIG_ARCH_OMAP) \ | 917 | || defined(CONFIG_ARCH_OMAP) \ |
| 913 | || defined (CONFIG_ARCH_LH7A404) \ | 918 | || defined (CONFIG_ARCH_LH7A404) \ |
| 914 | || defined (CONFIG_PXA27x) \ | 919 | || defined (CONFIG_PXA27x) \ |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c new file mode 100644 index 000000000000..e9401662503c --- /dev/null +++ b/drivers/usb/host/ohci-s3c2410.c | |||
| @@ -0,0 +1,496 @@ | |||
| 1 | /* | ||
| 2 | * OHCI HCD (Host Controller Driver) for USB. | ||
| 3 | * | ||
| 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | ||
| 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | ||
| 6 | * (C) Copyright 2002 Hewlett-Packard Company | ||
| 7 | * | ||
| 8 | * USB Bus Glue for Samsung S3C2410 | ||
| 9 | * | ||
| 10 | * Written by Christopher Hoover <ch@hpl.hp.com> | ||
| 11 | * Based on fragments of previous driver by Rusell King et al. | ||
| 12 | * | ||
| 13 | * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c | ||
| 14 | * by Ben Dooks, <ben@simtec.co.uk> | ||
| 15 | * Copyright (C) 2004 Simtec Electronics | ||
| 16 | * | ||
| 17 | * Thanks to basprog@mail.ru for updates to newer kernels | ||
| 18 | * | ||
| 19 | * This file is licenced under the GPL. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <asm/hardware.h> | ||
| 23 | #include <asm/mach-types.h> | ||
| 24 | #include <asm/hardware/clock.h> | ||
| 25 | #include <asm/arch/usb-control.h> | ||
| 26 | |||
| 27 | #define valid_port(idx) ((idx) == 1 || (idx) == 2) | ||
| 28 | |||
| 29 | /* clock device associated with the hcd */ | ||
| 30 | |||
| 31 | static struct clk *clk; | ||
| 32 | |||
| 33 | /* forward definitions */ | ||
| 34 | |||
| 35 | static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); | ||
| 36 | |||
| 37 | /* conversion functions */ | ||
| 38 | |||
| 39 | struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) | ||
| 40 | { | ||
| 41 | return hcd->self.controller->platform_data; | ||
| 42 | } | ||
| 43 | |||
| 44 | static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd) | ||
| 45 | { | ||
| 46 | struct s3c2410_hcd_info *info = dev->dev.platform_data; | ||
| 47 | |||
| 48 | dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); | ||
| 49 | clk_enable(clk); | ||
| 50 | |||
| 51 | if (info != NULL) { | ||
| 52 | info->hcd = hcd; | ||
| 53 | info->report_oc = s3c2410_hcd_oc; | ||
| 54 | |||
| 55 | if (info->enable_oc != NULL) { | ||
| 56 | (info->enable_oc)(info, 1); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | static void s3c2410_stop_hc(struct platform_device *dev) | ||
| 62 | { | ||
| 63 | struct s3c2410_hcd_info *info = dev->dev.platform_data; | ||
| 64 | |||
| 65 | dev_dbg(&dev->dev, "s3c2410_stop_hc:\n"); | ||
| 66 | |||
| 67 | if (info != NULL) { | ||
| 68 | info->report_oc = NULL; | ||
| 69 | info->hcd = NULL; | ||
| 70 | |||
| 71 | if (info->enable_oc != NULL) { | ||
| 72 | (info->enable_oc)(info, 0); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | |||
| 76 | clk_disable(clk); | ||
| 77 | } | ||
| 78 | |||
| 79 | /* ohci_s3c2410_hub_status_data | ||
| 80 | * | ||
| 81 | * update the status data from the hub with anything that | ||
| 82 | * has been detected by our system | ||
| 83 | */ | ||
| 84 | |||
| 85 | static int | ||
| 86 | ohci_s3c2410_hub_status_data (struct usb_hcd *hcd, char *buf) | ||
| 87 | { | ||
| 88 | struct s3c2410_hcd_info *info = to_s3c2410_info(hcd); | ||
| 89 | struct s3c2410_hcd_port *port; | ||
| 90 | int orig; | ||
| 91 | int portno; | ||
| 92 | |||
| 93 | orig = ohci_hub_status_data (hcd, buf); | ||
| 94 | |||
| 95 | if (info == NULL) | ||
| 96 | return orig; | ||
| 97 | |||
| 98 | port = &info->port[0]; | ||
| 99 | |||
| 100 | /* mark any changed port as changed */ | ||
| 101 | |||
| 102 | for (portno = 0; portno < 2; port++, portno++) { | ||
| 103 | if (port->oc_changed == 1 && | ||
| 104 | port->flags & S3C_HCDFLG_USED) { | ||
| 105 | dev_dbg(hcd->self.controller, | ||
| 106 | "oc change on port %d\n", portno); | ||
| 107 | |||
| 108 | if (orig < 1) | ||
| 109 | orig = 1; | ||
| 110 | |||
| 111 | buf[0] |= 1<<(portno+1); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | return orig; | ||
| 116 | } | ||
| 117 | |||
| 118 | /* s3c2410_usb_set_power | ||
| 119 | * | ||
| 120 | * configure the power on a port, by calling the platform device | ||
| 121 | * routine registered with the platform device | ||
| 122 | */ | ||
| 123 | |||
| 124 | static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info, | ||
| 125 | int port, int to) | ||
| 126 | { | ||
| 127 | if (info == NULL) | ||
| 128 | return; | ||
| 129 | |||
| 130 | if (info->power_control != NULL) { | ||
| 131 | info->port[port-1].power = to; | ||
| 132 | (info->power_control)(port, to); | ||
| 133 | } | ||
| 134 | } | ||
| 135 | |||
| 136 | /* ohci_s3c2410_hub_control | ||
| 137 | * | ||
| 138 | * look at control requests to the hub, and see if we need | ||
| 139 | * to take any action or over-ride the results from the | ||
| 140 | * request. | ||
| 141 | */ | ||
| 142 | |||
| 143 | static int ohci_s3c2410_hub_control ( | ||
| 144 | struct usb_hcd *hcd, | ||
| 145 | u16 typeReq, | ||
| 146 | u16 wValue, | ||
| 147 | u16 wIndex, | ||
| 148 | char *buf, | ||
| 149 | u16 wLength) | ||
| 150 | { | ||
| 151 | struct s3c2410_hcd_info *info = to_s3c2410_info(hcd); | ||
| 152 | struct usb_hub_descriptor *desc; | ||
| 153 | int ret = -EINVAL; | ||
| 154 | u32 *data = (u32 *)buf; | ||
| 155 | |||
| 156 | dev_dbg(hcd->self.controller, | ||
| 157 | "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", | ||
| 158 | hcd, typeReq, wValue, wIndex, buf, wLength); | ||
| 159 | |||
| 160 | /* if we are only an humble host without any special capabilites | ||
| 161 | * process the request straight away and exit */ | ||
| 162 | |||
| 163 | if (info == NULL) { | ||
| 164 | ret = ohci_hub_control(hcd, typeReq, wValue, | ||
| 165 | wIndex, buf, wLength); | ||
| 166 | goto out; | ||
| 167 | } | ||
| 168 | |||
| 169 | /* check the request to see if it needs handling */ | ||
| 170 | |||
| 171 | switch (typeReq) { | ||
| 172 | case SetPortFeature: | ||
| 173 | if (wValue == USB_PORT_FEAT_POWER) { | ||
| 174 | dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); | ||
| 175 | s3c2410_usb_set_power(info, wIndex, 1); | ||
| 176 | goto out; | ||
| 177 | } | ||
| 178 | break; | ||
| 179 | |||
| 180 | case ClearPortFeature: | ||
| 181 | switch (wValue) { | ||
| 182 | case USB_PORT_FEAT_C_OVER_CURRENT: | ||
| 183 | dev_dbg(hcd->self.controller, | ||
| 184 | "ClearPortFeature: C_OVER_CURRENT\n"); | ||
| 185 | |||
| 186 | if (valid_port(wIndex)) { | ||
| 187 | info->port[wIndex-1].oc_changed = 0; | ||
| 188 | info->port[wIndex-1].oc_status = 0; | ||
| 189 | } | ||
| 190 | |||
| 191 | goto out; | ||
| 192 | |||
| 193 | case USB_PORT_FEAT_OVER_CURRENT: | ||
| 194 | dev_dbg(hcd->self.controller, | ||
| 195 | "ClearPortFeature: OVER_CURRENT\n"); | ||
| 196 | |||
| 197 | if (valid_port(wIndex)) { | ||
| 198 | info->port[wIndex-1].oc_status = 0; | ||
| 199 | } | ||
| 200 | |||
| 201 | goto out; | ||
| 202 | |||
| 203 | case USB_PORT_FEAT_POWER: | ||
| 204 | dev_dbg(hcd->self.controller, | ||
| 205 | "ClearPortFeature: POWER\n"); | ||
| 206 | |||
| 207 | if (valid_port(wIndex)) { | ||
| 208 | s3c2410_usb_set_power(info, wIndex, 0); | ||
| 209 | return 0; | ||
| 210 | } | ||
| 211 | } | ||
| 212 | break; | ||
| 213 | } | ||
| 214 | |||
| 215 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | ||
| 216 | if (ret) | ||
| 217 | goto out; | ||
| 218 | |||
| 219 | switch (typeReq) { | ||
| 220 | case GetHubDescriptor: | ||
| 221 | |||
| 222 | /* update the hub's descriptor */ | ||
| 223 | |||
| 224 | desc = (struct usb_hub_descriptor *)buf; | ||
| 225 | |||
| 226 | if (info->power_control == NULL) | ||
| 227 | return ret; | ||
| 228 | |||
| 229 | dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n", | ||
| 230 | desc->wHubCharacteristics); | ||
| 231 | |||
| 232 | /* remove the old configurations for power-switching, and | ||
| 233 | * over-current protection, and insert our new configuration | ||
| 234 | */ | ||
| 235 | |||
| 236 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); | ||
| 237 | desc->wHubCharacteristics |= cpu_to_le16(0x0001); | ||
| 238 | |||
| 239 | if (info->enable_oc) { | ||
| 240 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM); | ||
| 241 | desc->wHubCharacteristics |= cpu_to_le16(0x0008|0x0001); | ||
| 242 | } | ||
| 243 | |||
| 244 | dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", | ||
| 245 | desc->wHubCharacteristics); | ||
| 246 | |||
| 247 | return ret; | ||
| 248 | |||
| 249 | case GetPortStatus: | ||
| 250 | /* check port status */ | ||
| 251 | |||
| 252 | dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); | ||
| 253 | |||
| 254 | if (valid_port(wIndex)) { | ||
| 255 | if (info->port[wIndex-1].oc_changed) { | ||
| 256 | *data |= cpu_to_le32(RH_PS_OCIC); | ||
| 257 | } | ||
| 258 | |||
| 259 | if (info->port[wIndex-1].oc_status) { | ||
| 260 | *data |= cpu_to_le32(RH_PS_POCI); | ||
| 261 | } | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | out: | ||
| 266 | return ret; | ||
| 267 | } | ||
| 268 | |||
| 269 | /* s3c2410_hcd_oc | ||
| 270 | * | ||
| 271 | * handle an over-current report | ||
| 272 | */ | ||
| 273 | |||
| 274 | static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc) | ||
| 275 | { | ||
| 276 | struct s3c2410_hcd_port *port; | ||
| 277 | struct usb_hcd *hcd; | ||
| 278 | unsigned long flags; | ||
| 279 | int portno; | ||
| 280 | |||
| 281 | if (info == NULL) | ||
| 282 | return; | ||
| 283 | |||
| 284 | port = &info->port[0]; | ||
| 285 | hcd = info->hcd; | ||
| 286 | |||
| 287 | local_irq_save(flags); | ||
| 288 | |||
| 289 | for (portno = 0; portno < 2; port++, portno++) { | ||
| 290 | if (port_oc & (1<<portno) && | ||
| 291 | port->flags & S3C_HCDFLG_USED) { | ||
| 292 | port->oc_status = 1; | ||
| 293 | port->oc_changed = 1; | ||
| 294 | |||
| 295 | /* ok, once over-current is detected, | ||
| 296 | the port needs to be powered down */ | ||
| 297 | s3c2410_usb_set_power(info, portno+1, 0); | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | local_irq_restore(flags); | ||
| 302 | } | ||
| 303 | |||
| 304 | /* may be called without controller electrically present */ | ||
| 305 | /* may be called with controller, bus, and devices active */ | ||
| 306 | |||
| 307 | /* | ||
| 308 | * usb_hcd_s3c2410_remove - shutdown processing for HCD | ||
| 309 | * @dev: USB Host Controller being removed | ||
| 310 | * Context: !in_interrupt() | ||
| 311 | * | ||
| 312 | * Reverses the effect of usb_hcd_3c2410_probe(), first invoking | ||
| 313 | * the HCD's stop() method. It is always called from a thread | ||
| 314 | * context, normally "rmmod", "apmd", or something similar. | ||
| 315 | * | ||
| 316 | */ | ||
| 317 | |||
| 318 | void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | ||
| 319 | { | ||
| 320 | usb_remove_hcd(hcd); | ||
| 321 | s3c2410_stop_hc(dev); | ||
| 322 | iounmap(hcd->regs); | ||
| 323 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
| 324 | usb_put_hcd(hcd); | ||
| 325 | } | ||
| 326 | |||
| 327 | /** | ||
| 328 | * usb_hcd_s3c2410_probe - initialize S3C2410-based HCDs | ||
| 329 | * Context: !in_interrupt() | ||
| 330 | * | ||
| 331 | * Allocates basic resources for this USB host controller, and | ||
| 332 | * then invokes the start() method for the HCD associated with it | ||
| 333 | * through the hotplug entry's driver_data. | ||
| 334 | * | ||
| 335 | */ | ||
| 336 | int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | ||
| 337 | struct platform_device *dev) | ||
| 338 | { | ||
| 339 | struct usb_hcd *hcd = NULL; | ||
| 340 | int retval; | ||
| 341 | |||
| 342 | s3c2410_usb_set_power(dev->dev.platform_data, 0, 1); | ||
| 343 | s3c2410_usb_set_power(dev->dev.platform_data, 1, 1); | ||
| 344 | |||
| 345 | hcd = usb_create_hcd(driver, &dev->dev, "s3c24xx"); | ||
| 346 | if (hcd == NULL) | ||
| 347 | return -ENOMEM; | ||
| 348 | |||
| 349 | hcd->rsrc_start = dev->resource[0].start; | ||
| 350 | hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; | ||
| 351 | |||
| 352 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
| 353 | dev_err(&dev->dev, "request_mem_region failed"); | ||
| 354 | retval = -EBUSY; | ||
| 355 | goto err0; | ||
| 356 | } | ||
| 357 | |||
| 358 | clk = clk_get(NULL, "usb-host"); | ||
| 359 | if (IS_ERR(clk)) { | ||
| 360 | dev_err(&dev->dev, "cannot get usb-host clock\n"); | ||
| 361 | retval = -ENOENT; | ||
| 362 | goto err1; | ||
| 363 | } | ||
| 364 | |||
| 365 | clk_use(clk); | ||
| 366 | s3c2410_start_hc(dev, hcd); | ||
| 367 | |||
| 368 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
| 369 | if (!hcd->regs) { | ||
| 370 | dev_err(&dev->dev, "ioremap failed\n"); | ||
| 371 | retval = -ENOMEM; | ||
| 372 | goto err2; | ||
| 373 | } | ||
| 374 | |||
| 375 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
| 376 | |||
| 377 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); | ||
| 378 | if (retval != 0) | ||
| 379 | goto err2; | ||
| 380 | |||
| 381 | return 0; | ||
| 382 | |||
| 383 | err2: | ||
| 384 | s3c2410_stop_hc(dev); | ||
| 385 | iounmap(hcd->regs); | ||
| 386 | clk_unuse(clk); | ||
| 387 | clk_put(clk); | ||
| 388 | |||
| 389 | err1: | ||
| 390 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
| 391 | |||
| 392 | err0: | ||
| 393 | usb_put_hcd(hcd); | ||
| 394 | return retval; | ||
| 395 | } | ||
| 396 | |||
| 397 | /*-------------------------------------------------------------------------*/ | ||
| 398 | |||
| 399 | static int | ||
| 400 | ohci_s3c2410_start (struct usb_hcd *hcd) | ||
| 401 | { | ||
| 402 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
| 403 | int ret; | ||
| 404 | |||
| 405 | if ((ret = ohci_init(ohci)) < 0) | ||
| 406 | return ret; | ||
| 407 | |||
| 408 | if ((ret = ohci_run (ohci)) < 0) { | ||
| 409 | err ("can't start %s", hcd->self.bus_name); | ||
| 410 | ohci_stop (hcd); | ||
| 411 | return ret; | ||
| 412 | } | ||
| 413 | |||
| 414 | return 0; | ||
| 415 | } | ||
| 416 | |||
| 417 | |||
| 418 | static const struct hc_driver ohci_s3c2410_hc_driver = { | ||
| 419 | .description = hcd_name, | ||
| 420 | .product_desc = "S3C24XX OHCI", | ||
| 421 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
| 422 | |||
| 423 | /* | ||
| 424 | * generic hardware linkage | ||
| 425 | */ | ||
| 426 | .irq = ohci_irq, | ||
| 427 | .flags = HCD_USB11 | HCD_MEMORY, | ||
| 428 | |||
| 429 | /* | ||
| 430 | * basic lifecycle operations | ||
| 431 | */ | ||
| 432 | .start = ohci_s3c2410_start, | ||
| 433 | .stop = ohci_stop, | ||
| 434 | |||
| 435 | /* | ||
| 436 | * managing i/o requests and associated device resources | ||
| 437 | */ | ||
| 438 | .urb_enqueue = ohci_urb_enqueue, | ||
| 439 | .urb_dequeue = ohci_urb_dequeue, | ||
| 440 | .endpoint_disable = ohci_endpoint_disable, | ||
| 441 | |||
| 442 | /* | ||
| 443 | * scheduling support | ||
| 444 | */ | ||
| 445 | .get_frame_number = ohci_get_frame, | ||
| 446 | |||
| 447 | /* | ||
| 448 | * root hub support | ||
| 449 | */ | ||
| 450 | .hub_status_data = ohci_s3c2410_hub_status_data, | ||
| 451 | .hub_control = ohci_s3c2410_hub_control, | ||
| 452 | |||
| 453 | #if defined(CONFIG_USB_SUSPEND) && 0 | ||
| 454 | .hub_suspend = ohci_hub_suspend, | ||
| 455 | .hub_resume = ohci_hub_resume, | ||
| 456 | #endif | ||
| 457 | }; | ||
| 458 | |||
| 459 | /* device driver */ | ||
| 460 | |||
| 461 | static int ohci_hcd_s3c2410_drv_probe(struct device *dev) | ||
| 462 | { | ||
| 463 | struct platform_device *pdev = to_platform_device(dev); | ||
| 464 | return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); | ||
| 465 | } | ||
| 466 | |||
| 467 | static int ohci_hcd_s3c2410_drv_remove(struct device *dev) | ||
| 468 | { | ||
| 469 | struct platform_device *pdev = to_platform_device(dev); | ||
| 470 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
| 471 | |||
| 472 | usb_hcd_s3c2410_remove(hcd, pdev); | ||
| 473 | return 0; | ||
| 474 | } | ||
| 475 | |||
| 476 | static struct device_driver ohci_hcd_s3c2410_driver = { | ||
| 477 | .name = "s3c2410-ohci", | ||
| 478 | .bus = &platform_bus_type, | ||
| 479 | .probe = ohci_hcd_s3c2410_drv_probe, | ||
| 480 | .remove = ohci_hcd_s3c2410_drv_remove, | ||
| 481 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ | ||
| 482 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ | ||
| 483 | }; | ||
| 484 | |||
| 485 | static int __init ohci_hcd_s3c2410_init (void) | ||
| 486 | { | ||
| 487 | return driver_register(&ohci_hcd_s3c2410_driver); | ||
| 488 | } | ||
| 489 | |||
| 490 | static void __exit ohci_hcd_s3c2410_cleanup (void) | ||
| 491 | { | ||
| 492 | driver_unregister(&ohci_hcd_s3c2410_driver); | ||
| 493 | } | ||
| 494 | |||
| 495 | module_init (ohci_hcd_s3c2410_init); | ||
| 496 | module_exit (ohci_hcd_s3c2410_cleanup); | ||
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c index ebcf7c955800..13532f3e3efc 100644 --- a/drivers/usb/input/acecad.c +++ b/drivers/usb/input/acecad.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
| 32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
| 34 | #include <linux/usb_input.h> | ||
| 34 | 35 | ||
| 35 | /* | 36 | /* |
| 36 | * Version Information | 37 | * Version Information |
| @@ -87,8 +88,8 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs) | |||
| 87 | if (prox) { | 88 | if (prox) { |
| 88 | int x = data[1] | (data[2] << 8); | 89 | int x = data[1] | (data[2] << 8); |
| 89 | int y = data[3] | (data[4] << 8); | 90 | int y = data[3] | (data[4] << 8); |
| 90 | /*Pressure should compute the same way for flair and 302*/ | 91 | /* Pressure should compute the same way for flair and 302 */ |
| 91 | int pressure = data[5] | ((int)data[6] << 8); | 92 | int pressure = data[5] | (data[6] << 8); |
| 92 | int touch = data[0] & 0x01; | 93 | int touch = data[0] & 0x01; |
| 93 | int stylus = (data[0] & 0x10) >> 4; | 94 | int stylus = (data[0] & 0x10) >> 4; |
| 94 | int stylus2 = (data[0] & 0x20) >> 5; | 95 | int stylus2 = (data[0] & 0x20) >> 5; |
| @@ -104,9 +105,9 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs) | |||
| 104 | input_sync(dev); | 105 | input_sync(dev); |
| 105 | 106 | ||
| 106 | resubmit: | 107 | resubmit: |
| 107 | status = usb_submit_urb (urb, GFP_ATOMIC); | 108 | status = usb_submit_urb(urb, GFP_ATOMIC); |
| 108 | if (status) | 109 | if (status) |
| 109 | err ("can't resubmit intr, %s-%s/input0, status %d", | 110 | err("can't resubmit intr, %s-%s/input0, status %d", |
| 110 | acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); | 111 | acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); |
| 111 | } | 112 | } |
| 112 | 113 | ||
| @@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
| 212 | 213 | ||
| 213 | acecad->dev.name = acecad->name; | 214 | acecad->dev.name = acecad->name; |
| 214 | acecad->dev.phys = acecad->phys; | 215 | acecad->dev.phys = acecad->phys; |
| 215 | acecad->dev.id.bustype = BUS_USB; | 216 | usb_to_input_id(dev, &acecad->dev.id); |
| 216 | acecad->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 217 | acecad->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 218 | acecad->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 219 | acecad->dev.dev = &intf->dev; | 217 | acecad->dev.dev = &intf->dev; |
| 220 | 218 | ||
| 221 | usb_fill_int_urb(acecad->irq, dev, pipe, | 219 | usb_fill_int_urb(acecad->irq, dev, pipe, |
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index 6bb0f25e8e93..cd0cbfe20723 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
| @@ -77,6 +77,7 @@ | |||
| 77 | #include <linux/module.h> | 77 | #include <linux/module.h> |
| 78 | #include <linux/init.h> | 78 | #include <linux/init.h> |
| 79 | #include <linux/usb.h> | 79 | #include <linux/usb.h> |
| 80 | #include <linux/usb_input.h> | ||
| 80 | #include <linux/sched.h> | 81 | #include <linux/sched.h> |
| 81 | #include <asm/uaccess.h> | 82 | #include <asm/uaccess.h> |
| 82 | #include <asm/unaligned.h> | 83 | #include <asm/unaligned.h> |
| @@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 2125 | aiptek->inputdev.absflat[ABS_WHEEL] = 0; | 2126 | aiptek->inputdev.absflat[ABS_WHEEL] = 0; |
| 2126 | aiptek->inputdev.name = "Aiptek"; | 2127 | aiptek->inputdev.name = "Aiptek"; |
| 2127 | aiptek->inputdev.phys = aiptek->features.usbPath; | 2128 | aiptek->inputdev.phys = aiptek->features.usbPath; |
| 2128 | aiptek->inputdev.id.bustype = BUS_USB; | 2129 | usb_to_input_id(usbdev, &aiptek->inputdev.id); |
| 2129 | aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor); | ||
| 2130 | aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct); | ||
| 2131 | aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice); | ||
| 2132 | aiptek->inputdev.dev = &intf->dev; | 2130 | aiptek->inputdev.dev = &intf->dev; |
| 2133 | 2131 | ||
| 2134 | aiptek->usbdev = usbdev; | 2132 | aiptek->usbdev = usbdev; |
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index 654ac454744d..fd99681ee483 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
| @@ -94,6 +94,7 @@ | |||
| 94 | #include <linux/moduleparam.h> | 94 | #include <linux/moduleparam.h> |
| 95 | #include <linux/input.h> | 95 | #include <linux/input.h> |
| 96 | #include <linux/usb.h> | 96 | #include <linux/usb.h> |
| 97 | #include <linux/usb_input.h> | ||
| 97 | #include <linux/wait.h> | 98 | #include <linux/wait.h> |
| 98 | 99 | ||
| 99 | /* | 100 | /* |
| @@ -635,11 +636,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote) | |||
| 635 | idev->name = ati_remote->name; | 636 | idev->name = ati_remote->name; |
| 636 | idev->phys = ati_remote->phys; | 637 | idev->phys = ati_remote->phys; |
| 637 | 638 | ||
| 638 | idev->id.bustype = BUS_USB; | 639 | usb_to_input_id(ati_remote->udev, &idev->id); |
| 639 | idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); | 640 | idev->dev = &ati_remote->udev->dev; |
| 640 | idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct); | ||
| 641 | idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice); | ||
| 642 | idev->dev = &(ati_remote->udev->dev); | ||
| 643 | } | 641 | } |
| 644 | 642 | ||
| 645 | static int ati_remote_initialize(struct ati_remote *ati_remote) | 643 | static int ati_remote_initialize(struct ati_remote *ati_remote) |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 2350e7a5ad70..b2cb2b35892e 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
| @@ -789,12 +789,12 @@ static __inline__ int search(__s32 *array, __s32 value, unsigned n) | |||
| 789 | return -1; | 789 | return -1; |
| 790 | } | 790 | } |
| 791 | 791 | ||
| 792 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) | 792 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs) |
| 793 | { | 793 | { |
| 794 | hid_dump_input(usage, value); | 794 | hid_dump_input(usage, value); |
| 795 | if (hid->claimed & HID_CLAIMED_INPUT) | 795 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 796 | hidinput_hid_event(hid, field, usage, value, regs); | 796 | hidinput_hid_event(hid, field, usage, value, regs); |
| 797 | if (hid->claimed & HID_CLAIMED_HIDDEV) | 797 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt) |
| 798 | hiddev_hid_event(hid, field, usage, value, regs); | 798 | hiddev_hid_event(hid, field, usage, value, regs); |
| 799 | } | 799 | } |
| 800 | 800 | ||
| @@ -804,7 +804,7 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s | |||
| 804 | * reporting to the layer). | 804 | * reporting to the layer). |
| 805 | */ | 805 | */ |
| 806 | 806 | ||
| 807 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, struct pt_regs *regs) | 807 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt, struct pt_regs *regs) |
| 808 | { | 808 | { |
| 809 | unsigned n; | 809 | unsigned n; |
| 810 | unsigned count = field->report_count; | 810 | unsigned count = field->report_count; |
| @@ -831,19 +831,19 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u | |||
| 831 | for (n = 0; n < count; n++) { | 831 | for (n = 0; n < count; n++) { |
| 832 | 832 | ||
| 833 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { | 833 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { |
| 834 | hid_process_event(hid, field, &field->usage[n], value[n], regs); | 834 | hid_process_event(hid, field, &field->usage[n], value[n], interrupt, regs); |
| 835 | continue; | 835 | continue; |
| 836 | } | 836 | } |
| 837 | 837 | ||
| 838 | if (field->value[n] >= min && field->value[n] <= max | 838 | if (field->value[n] >= min && field->value[n] <= max |
| 839 | && field->usage[field->value[n] - min].hid | 839 | && field->usage[field->value[n] - min].hid |
| 840 | && search(value, field->value[n], count)) | 840 | && search(value, field->value[n], count)) |
| 841 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, regs); | 841 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt, regs); |
| 842 | 842 | ||
| 843 | if (value[n] >= min && value[n] <= max | 843 | if (value[n] >= min && value[n] <= max |
| 844 | && field->usage[value[n] - min].hid | 844 | && field->usage[value[n] - min].hid |
| 845 | && search(field->value, value[n], count)) | 845 | && search(field->value, value[n], count)) |
| 846 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, regs); | 846 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt, regs); |
| 847 | } | 847 | } |
| 848 | 848 | ||
| 849 | memcpy(field->value, value, count * sizeof(__s32)); | 849 | memcpy(field->value, value, count * sizeof(__s32)); |
| @@ -851,7 +851,7 @@ exit: | |||
| 851 | kfree(value); | 851 | kfree(value); |
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) | 854 | static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_regs *regs) |
| 855 | { | 855 | { |
| 856 | struct hid_device *hid = urb->context; | 856 | struct hid_device *hid = urb->context; |
| 857 | struct hid_report_enum *report_enum = hid->report_enum + type; | 857 | struct hid_report_enum *report_enum = hid->report_enum + type; |
| @@ -899,7 +899,7 @@ static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) | |||
| 899 | hiddev_report_event(hid, report); | 899 | hiddev_report_event(hid, report); |
| 900 | 900 | ||
| 901 | for (n = 0; n < report->maxfield; n++) | 901 | for (n = 0; n < report->maxfield; n++) |
| 902 | hid_input_field(hid, report->field[n], data, regs); | 902 | hid_input_field(hid, report->field[n], data, interrupt, regs); |
| 903 | 903 | ||
| 904 | if (hid->claimed & HID_CLAIMED_INPUT) | 904 | if (hid->claimed & HID_CLAIMED_INPUT) |
| 905 | hidinput_report_event(hid, report); | 905 | hidinput_report_event(hid, report); |
| @@ -918,7 +918,7 @@ static void hid_irq_in(struct urb *urb, struct pt_regs *regs) | |||
| 918 | 918 | ||
| 919 | switch (urb->status) { | 919 | switch (urb->status) { |
| 920 | case 0: /* success */ | 920 | case 0: /* success */ |
| 921 | hid_input_report(HID_INPUT_REPORT, urb, regs); | 921 | hid_input_report(HID_INPUT_REPORT, urb, 1, regs); |
| 922 | break; | 922 | break; |
| 923 | case -ECONNRESET: /* unlink */ | 923 | case -ECONNRESET: /* unlink */ |
| 924 | case -ENOENT: | 924 | case -ENOENT: |
| @@ -1142,7 +1142,7 @@ static void hid_ctrl(struct urb *urb, struct pt_regs *regs) | |||
| 1142 | switch (urb->status) { | 1142 | switch (urb->status) { |
| 1143 | case 0: /* success */ | 1143 | case 0: /* success */ |
| 1144 | if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) | 1144 | if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) |
| 1145 | hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); | 1145 | hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs); |
| 1146 | case -ESHUTDOWN: /* unplug */ | 1146 | case -ESHUTDOWN: /* unplug */ |
| 1147 | case -EILSEQ: /* unplug timectrl on uhci */ | 1147 | case -EILSEQ: /* unplug timectrl on uhci */ |
| 1148 | unplug = 1; | 1148 | unplug = 1; |
| @@ -1372,6 +1372,9 @@ void hid_init_reports(struct hid_device *hid) | |||
| 1372 | #define USB_VENDOR_ID_A4TECH 0x09da | 1372 | #define USB_VENDOR_ID_A4TECH 0x09da |
| 1373 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 | 1373 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 |
| 1374 | 1374 | ||
| 1375 | #define USB_VENDOR_ID_AASHIMA 0x06D6 | ||
| 1376 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 | ||
| 1377 | |||
| 1375 | #define USB_VENDOR_ID_CYPRESS 0x04b4 | 1378 | #define USB_VENDOR_ID_CYPRESS 0x04b4 |
| 1376 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 | 1379 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 |
| 1377 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 | 1380 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 |
| @@ -1548,6 +1551,7 @@ static struct hid_blacklist { | |||
| 1548 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, | 1551 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, |
| 1549 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, | 1552 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, |
| 1550 | 1553 | ||
| 1554 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, | ||
| 1551 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, | 1555 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
| 1552 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, | 1556 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
| 1553 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 1557 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 9ac1e9095334..63a4db721f7e 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
| 32 | #include <linux/input.h> | 32 | #include <linux/input.h> |
| 33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
| 34 | #include <linux/usb_input.h> | ||
| 34 | 35 | ||
| 35 | #undef DEBUG | 36 | #undef DEBUG |
| 36 | 37 | ||
| @@ -397,11 +398,12 @@ ignore: | |||
| 397 | 398 | ||
| 398 | void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) | 399 | void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) |
| 399 | { | 400 | { |
| 400 | struct input_dev *input = &field->hidinput->input; | 401 | struct input_dev *input; |
| 401 | int *quirks = &hid->quirks; | 402 | int *quirks = &hid->quirks; |
| 402 | 403 | ||
| 403 | if (!input) | 404 | if (!field->hidinput) |
| 404 | return; | 405 | return; |
| 406 | input = &field->hidinput->input; | ||
| 405 | 407 | ||
| 406 | input_regs(input, regs); | 408 | input_regs(input, regs); |
| 407 | 409 | ||
| @@ -581,10 +583,7 @@ int hidinput_connect(struct hid_device *hid) | |||
| 581 | hidinput->input.name = hid->name; | 583 | hidinput->input.name = hid->name; |
| 582 | hidinput->input.phys = hid->phys; | 584 | hidinput->input.phys = hid->phys; |
| 583 | hidinput->input.uniq = hid->uniq; | 585 | hidinput->input.uniq = hid->uniq; |
| 584 | hidinput->input.id.bustype = BUS_USB; | 586 | usb_to_input_id(dev, &hidinput->input.id); |
| 585 | hidinput->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 586 | hidinput->input.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 587 | hidinput->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 588 | hidinput->input.dev = &hid->intf->dev; | 587 | hidinput->input.dev = &hid->intf->dev; |
| 589 | } | 588 | } |
| 590 | 589 | ||
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c index 47dec6a1b344..0dc439f10823 100644 --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
| 54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
| 55 | #include <linux/usb.h> | 55 | #include <linux/usb.h> |
| 56 | #include <linux/usb_input.h> | ||
| 56 | 57 | ||
| 57 | /* only an 8 byte buffer necessary for a single packet */ | 58 | /* only an 8 byte buffer necessary for a single packet */ |
| 58 | #define ITM_BUFSIZE 8 | 59 | #define ITM_BUFSIZE 8 |
| @@ -184,10 +185,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id | |||
| 184 | 185 | ||
| 185 | itmtouch->inputdev.name = itmtouch->name; | 186 | itmtouch->inputdev.name = itmtouch->name; |
| 186 | itmtouch->inputdev.phys = itmtouch->phys; | 187 | itmtouch->inputdev.phys = itmtouch->phys; |
| 187 | itmtouch->inputdev.id.bustype = BUS_USB; | 188 | usb_to_input_id(udev, &itmtouch->inputdev.id); |
| 188 | itmtouch->inputdev.id.vendor = udev->descriptor.idVendor; | ||
| 189 | itmtouch->inputdev.id.product = udev->descriptor.idProduct; | ||
| 190 | itmtouch->inputdev.id.version = udev->descriptor.bcdDevice; | ||
| 191 | itmtouch->inputdev.dev = &intf->dev; | 189 | itmtouch->inputdev.dev = &intf->dev; |
| 192 | 190 | ||
| 193 | if (!strlen(itmtouch->name)) | 191 | if (!strlen(itmtouch->name)) |
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c index d2f0f90a9bcd..b6f6ac8d9c2f 100644 --- a/drivers/usb/input/kbtab.c +++ b/drivers/usb/input/kbtab.c | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
| 5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
| 6 | #include <linux/usb.h> | 6 | #include <linux/usb.h> |
| 7 | #include <linux/usb_input.h> | ||
| 7 | #include <asm/unaligned.h> | 8 | #include <asm/unaligned.h> |
| 8 | #include <asm/byteorder.h> | 9 | #include <asm/byteorder.h> |
| 9 | 10 | ||
| @@ -167,10 +168,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 167 | 168 | ||
| 168 | kbtab->dev.name = "KB Gear Tablet"; | 169 | kbtab->dev.name = "KB Gear Tablet"; |
| 169 | kbtab->dev.phys = kbtab->phys; | 170 | kbtab->dev.phys = kbtab->phys; |
| 170 | kbtab->dev.id.bustype = BUS_USB; | 171 | usb_to_input_id(dev, &kbtab->dev.id); |
| 171 | kbtab->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 172 | kbtab->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 173 | kbtab->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 174 | kbtab->dev.dev = &intf->dev; | 172 | kbtab->dev.dev = &intf->dev; |
| 175 | kbtab->usbdev = dev; | 173 | kbtab->usbdev = dev; |
| 176 | 174 | ||
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 09b5cc7c66de..ff9275057a18 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
| 54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
| 55 | #include <linux/usb.h> | 55 | #include <linux/usb.h> |
| 56 | #include <linux/usb_input.h> | ||
| 56 | 57 | ||
| 57 | #define MTOUCHUSB_MIN_XC 0x0 | 58 | #define MTOUCHUSB_MIN_XC 0x0 |
| 58 | #define MTOUCHUSB_MAX_RAW_XC 0x4000 | 59 | #define MTOUCHUSB_MAX_RAW_XC 0x4000 |
| @@ -232,10 +233,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i | |||
| 232 | 233 | ||
| 233 | mtouch->input.name = mtouch->name; | 234 | mtouch->input.name = mtouch->name; |
| 234 | mtouch->input.phys = mtouch->phys; | 235 | mtouch->input.phys = mtouch->phys; |
| 235 | mtouch->input.id.bustype = BUS_USB; | 236 | usb_to_input_id(udev, &mtouch->input.id); |
| 236 | mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
| 237 | mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
| 238 | mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
| 239 | mtouch->input.dev = &intf->dev; | 237 | mtouch->input.dev = &intf->dev; |
| 240 | 238 | ||
| 241 | mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 239 | mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c index 3975b309d55f..ad4afe7e5897 100644 --- a/drivers/usb/input/powermate.c +++ b/drivers/usb/input/powermate.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
| 36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
| 37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
| 38 | #include <linux/usb_input.h> | ||
| 38 | 39 | ||
| 39 | #define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ | 40 | #define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ |
| 40 | #define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ | 41 | #define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ |
| @@ -389,10 +390,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i | |||
| 389 | pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); | 390 | pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); |
| 390 | pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); | 391 | pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); |
| 391 | pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); | 392 | pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); |
| 392 | pm->input.id.bustype = BUS_USB; | 393 | usb_to_input_id(udev, &pm->input.id); |
| 393 | pm->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
| 394 | pm->input.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
| 395 | pm->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
| 396 | pm->input.event = powermate_input_event; | 394 | pm->input.event = powermate_input_event; |
| 397 | pm->input.dev = &intf->dev; | 395 | pm->input.dev = &intf->dev; |
| 398 | pm->input.phys = pm->phys; | 396 | pm->input.phys = pm->phys; |
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 386595ee21c0..4276c24a5080 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #define DEBUG | 35 | #define DEBUG |
| 36 | #endif | 36 | #endif |
| 37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
| 38 | 38 | #include <linux/usb_input.h> | |
| 39 | 39 | ||
| 40 | #define TOUCHKIT_MIN_XC 0x0 | 40 | #define TOUCHKIT_MIN_XC 0x0 |
| 41 | #define TOUCHKIT_MAX_XC 0x07ff | 41 | #define TOUCHKIT_MAX_XC 0x07ff |
| @@ -202,10 +202,7 @@ static int touchkit_probe(struct usb_interface *intf, | |||
| 202 | 202 | ||
| 203 | touchkit->input.name = touchkit->name; | 203 | touchkit->input.name = touchkit->name; |
| 204 | touchkit->input.phys = touchkit->phys; | 204 | touchkit->input.phys = touchkit->phys; |
| 205 | touchkit->input.id.bustype = BUS_USB; | 205 | usb_to_input_id(udev, &touchkit->input.id); |
| 206 | touchkit->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
| 207 | touchkit->input.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
| 208 | touchkit->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
| 209 | touchkit->input.dev = &intf->dev; | 206 | touchkit->input.dev = &intf->dev; |
| 210 | 207 | ||
| 211 | touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 208 | touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c index f35db1974c42..28987f15eeee 100644 --- a/drivers/usb/input/usbkbd.c +++ b/drivers/usb/input/usbkbd.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/input.h> | 32 | #include <linux/input.h> |
| 33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
| 34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
| 35 | #include <linux/usb_input.h> | ||
| 35 | 36 | ||
| 36 | /* | 37 | /* |
| 37 | * Version Information | 38 | * Version Information |
| @@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_interface *iface, | |||
| 288 | 289 | ||
| 289 | kbd->dev.name = kbd->name; | 290 | kbd->dev.name = kbd->name; |
| 290 | kbd->dev.phys = kbd->phys; | 291 | kbd->dev.phys = kbd->phys; |
| 291 | kbd->dev.id.bustype = BUS_USB; | 292 | usb_to_input_id(dev, &kbd->dev.id); |
| 292 | kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 293 | kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 294 | kbd->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 295 | kbd->dev.dev = &iface->dev; | 293 | kbd->dev.dev = &iface->dev; |
| 296 | 294 | ||
| 297 | if (dev->manufacturer) | 295 | if (dev->manufacturer) |
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c index 1ec41b5effe6..4104dec847fb 100644 --- a/drivers/usb/input/usbmouse.c +++ b/drivers/usb/input/usbmouse.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
| 33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
| 34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
| 35 | #include <linux/usb_input.h> | ||
| 35 | 36 | ||
| 36 | /* | 37 | /* |
| 37 | * Version Information | 38 | * Version Information |
| @@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_ | |||
| 171 | 172 | ||
| 172 | mouse->dev.name = mouse->name; | 173 | mouse->dev.name = mouse->name; |
| 173 | mouse->dev.phys = mouse->phys; | 174 | mouse->dev.phys = mouse->phys; |
| 174 | mouse->dev.id.bustype = BUS_USB; | 175 | usb_to_input_id(dev, &mouse->dev.id); |
| 175 | mouse->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 176 | mouse->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 177 | mouse->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 178 | mouse->dev.dev = &intf->dev; | 176 | mouse->dev.dev = &intf->dev; |
| 179 | 177 | ||
| 180 | if (dev->manufacturer) | 178 | if (dev->manufacturer) |
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index f6b34af66b3d..02412e31a46b 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c | |||
| @@ -69,6 +69,7 @@ | |||
| 69 | #include <linux/module.h> | 69 | #include <linux/module.h> |
| 70 | #include <linux/init.h> | 70 | #include <linux/init.h> |
| 71 | #include <linux/usb.h> | 71 | #include <linux/usb.h> |
| 72 | #include <linux/usb_input.h> | ||
| 72 | #include <asm/unaligned.h> | 73 | #include <asm/unaligned.h> |
| 73 | #include <asm/byteorder.h> | 74 | #include <asm/byteorder.h> |
| 74 | 75 | ||
| @@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 823 | 824 | ||
| 824 | wacom->dev.name = wacom->features->name; | 825 | wacom->dev.name = wacom->features->name; |
| 825 | wacom->dev.phys = wacom->phys; | 826 | wacom->dev.phys = wacom->phys; |
| 826 | wacom->dev.id.bustype = BUS_USB; | 827 | usb_to_input_id(dev, &wacom->dev.id); |
| 827 | wacom->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 828 | wacom->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 829 | wacom->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 830 | wacom->dev.dev = &intf->dev; | 828 | wacom->dev.dev = &intf->dev; |
| 831 | wacom->usbdev = dev; | 829 | wacom->usbdev = dev; |
| 832 | 830 | ||
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index a7fa1b17dcfe..18125e0bffa2 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | #include <linux/module.h> | 62 | #include <linux/module.h> |
| 63 | #include <linux/smp_lock.h> | 63 | #include <linux/smp_lock.h> |
| 64 | #include <linux/usb.h> | 64 | #include <linux/usb.h> |
| 65 | #include <linux/usb_input.h> | ||
| 65 | 66 | ||
| 66 | #define DRIVER_VERSION "v0.0.5" | 67 | #define DRIVER_VERSION "v0.0.5" |
| 67 | #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" | 68 | #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" |
| @@ -256,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 256 | 257 | ||
| 257 | xpad->udev = udev; | 258 | xpad->udev = udev; |
| 258 | 259 | ||
| 259 | xpad->dev.id.bustype = BUS_USB; | 260 | usb_to_input_id(udev, &xpad->dev.id); |
| 260 | xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
| 261 | xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
| 262 | xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
| 263 | xpad->dev.dev = &intf->dev; | 261 | xpad->dev.dev = &intf->dev; |
| 264 | xpad->dev.private = xpad; | 262 | xpad->dev.private = xpad; |
| 265 | xpad->dev.name = xpad_device[i].name; | 263 | xpad->dev.name = xpad_device[i].name; |
diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c index 08521a2b4f3d..20ac9e1069d4 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/usb/media/konicawc.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
| 19 | #include <linux/usb_input.h> | ||
| 19 | 20 | ||
| 20 | #include "usbvideo.h" | 21 | #include "usbvideo.h" |
| 21 | 22 | ||
| @@ -845,10 +846,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id | |||
| 845 | cam->input.private = cam; | 846 | cam->input.private = cam; |
| 846 | cam->input.evbit[0] = BIT(EV_KEY); | 847 | cam->input.evbit[0] = BIT(EV_KEY); |
| 847 | cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); | 848 | cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); |
| 848 | cam->input.id.bustype = BUS_USB; | 849 | usb_to_input_id(dev, &cam->input.id); |
| 849 | cam->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 850 | cam->input.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 851 | cam->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 852 | input_register_device(&cam->input); | 850 | input_register_device(&cam->input); |
| 853 | 851 | ||
| 854 | usb_make_path(dev, cam->input_physname, 56); | 852 | usb_make_path(dev, cam->input_physname, 56); |
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 66ec88354b93..ad17892aac9e 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | * | 23 | * |
| 24 | * V0.1 (mh) Initial version | 24 | * V0.1 (mh) Initial version |
| 25 | * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) | 25 | * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) |
| 26 | * V0.12 (mh) Added kmalloc check for string buffer | ||
| 26 | */ | 27 | */ |
| 27 | 28 | ||
| 28 | #include <linux/config.h> | 29 | #include <linux/config.h> |
| @@ -84,7 +85,7 @@ static struct usb_device_id ld_usb_table [] = { | |||
| 84 | { } /* Terminating entry */ | 85 | { } /* Terminating entry */ |
| 85 | }; | 86 | }; |
| 86 | MODULE_DEVICE_TABLE(usb, ld_usb_table); | 87 | MODULE_DEVICE_TABLE(usb, ld_usb_table); |
| 87 | MODULE_VERSION("V0.11"); | 88 | MODULE_VERSION("V0.12"); |
| 88 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); | 89 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); |
| 89 | MODULE_DESCRIPTION("LD USB Driver"); | 90 | MODULE_DESCRIPTION("LD USB Driver"); |
| 90 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
| @@ -635,6 +636,10 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id * | |||
| 635 | (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && | 636 | (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && |
| 636 | (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { | 637 | (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { |
| 637 | buffer = kmalloc(256, GFP_KERNEL); | 638 | buffer = kmalloc(256, GFP_KERNEL); |
| 639 | if (buffer == NULL) { | ||
| 640 | dev_err(&intf->dev, "Couldn't allocate string buffer\n"); | ||
| 641 | goto error; | ||
| 642 | } | ||
| 638 | /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ | 643 | /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ |
| 639 | usb_string(udev, 255, buffer, 256); | 644 | usb_string(udev, 255, buffer, 256); |
| 640 | kfree(buffer); | 645 | kfree(buffer); |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 5f4496d8dbac..fcd6d3ccef44 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
| @@ -59,7 +59,6 @@ static const char driver_name[] = "pegasus"; | |||
| 59 | 59 | ||
| 60 | static int loopback = 0; | 60 | static int loopback = 0; |
| 61 | static int mii_mode = 0; | 61 | static int mii_mode = 0; |
| 62 | static int multicast_filter_limit = 32; | ||
| 63 | 62 | ||
| 64 | static struct usb_eth_dev usb_dev_id[] = { | 63 | static struct usb_eth_dev usb_dev_id[] = { |
| 65 | #define PEGASUS_DEV(pn, vid, pid, flags) \ | 64 | #define PEGASUS_DEV(pn, vid, pid, flags) \ |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 626b016addff..59ab40ebb394 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
| @@ -167,8 +167,6 @@ struct rtl8150 { | |||
| 167 | 167 | ||
| 168 | typedef struct rtl8150 rtl8150_t; | 168 | typedef struct rtl8150 rtl8150_t; |
| 169 | 169 | ||
| 170 | static unsigned long multicast_filter_limit = 32; | ||
| 171 | |||
| 172 | static void fill_skb_pool(rtl8150_t *); | 170 | static void fill_skb_pool(rtl8150_t *); |
| 173 | static void free_skb_pool(rtl8150_t *); | 171 | static void free_skb_pool(rtl8150_t *); |
| 174 | static inline struct sk_buff *pull_skb(rtl8150_t *); | 172 | static inline struct sk_buff *pull_skb(rtl8150_t *); |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index 3b387b005739..29cd801eb958 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
| @@ -29,6 +29,7 @@ static struct usb_device_id zd1201_table[] = { | |||
| 29 | {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ | 29 | {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ |
| 30 | {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ | 30 | {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ |
| 31 | {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ | 31 | {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ |
| 32 | {USB_DEVICE(0x1044, 0x8005)}, /* GIGABYTE GN-WLBZ201 usb adapter */ | ||
| 32 | {} | 33 | {} |
| 33 | }; | 34 | }; |
| 34 | 35 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0b03ddab53d9..d1964a0c4168 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -429,6 +429,9 @@ static struct usb_device_id id_table_combined [] = { | |||
| 429 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, | 429 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, |
| 430 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 430 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
| 431 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, | 431 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, |
| 432 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, | ||
| 433 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, | ||
| 434 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | ||
| 432 | { } /* Terminating entry */ | 435 | { } /* Terminating entry */ |
| 433 | }; | 436 | }; |
| 434 | 437 | ||
| @@ -545,6 +548,7 @@ static struct usb_serial_device_type ftdi_sio_device = { | |||
| 545 | 548 | ||
| 546 | 549 | ||
| 547 | #define WDR_TIMEOUT 5000 /* default urb timeout */ | 550 | #define WDR_TIMEOUT 5000 /* default urb timeout */ |
| 551 | #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ | ||
| 548 | 552 | ||
| 549 | /* High and low are for DTR, RTS etc etc */ | 553 | /* High and low are for DTR, RTS etc etc */ |
| 550 | #define HIGH 1 | 554 | #define HIGH 1 |
| @@ -593,62 +597,59 @@ static __u32 ftdi_232bm_baud_to_divisor(int baud) | |||
| 593 | return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); | 597 | return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); |
| 594 | } | 598 | } |
| 595 | 599 | ||
| 596 | static int set_rts(struct usb_serial_port *port, int high_or_low) | 600 | #define set_mctrl(port, set) update_mctrl((port), (set), 0) |
| 601 | #define clear_mctrl(port, clear) update_mctrl((port), 0, (clear)) | ||
| 602 | |||
| 603 | static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned int clear) | ||
| 597 | { | 604 | { |
| 598 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 605 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
| 599 | char *buf; | 606 | char *buf; |
| 600 | unsigned ftdi_high_or_low; | 607 | unsigned urb_value; |
| 601 | int rv; | 608 | int rv; |
| 602 | |||
| 603 | buf = kmalloc(1, GFP_NOIO); | ||
| 604 | if (!buf) | ||
| 605 | return -ENOMEM; | ||
| 606 | |||
| 607 | if (high_or_low) { | ||
| 608 | ftdi_high_or_low = FTDI_SIO_SET_RTS_HIGH; | ||
| 609 | priv->last_dtr_rts |= TIOCM_RTS; | ||
| 610 | } else { | ||
| 611 | ftdi_high_or_low = FTDI_SIO_SET_RTS_LOW; | ||
| 612 | priv->last_dtr_rts &= ~TIOCM_RTS; | ||
| 613 | } | ||
| 614 | rv = usb_control_msg(port->serial->dev, | ||
| 615 | usb_sndctrlpipe(port->serial->dev, 0), | ||
| 616 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, | ||
| 617 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, | ||
| 618 | ftdi_high_or_low, priv->interface, | ||
| 619 | buf, 0, WDR_TIMEOUT); | ||
| 620 | |||
| 621 | kfree(buf); | ||
| 622 | return rv; | ||
| 623 | } | ||
| 624 | 609 | ||
| 610 | if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) { | ||
| 611 | dbg("%s - DTR|RTS not being set|cleared", __FUNCTION__); | ||
| 612 | return 0; /* no change */ | ||
| 613 | } | ||
| 625 | 614 | ||
| 626 | static int set_dtr(struct usb_serial_port *port, int high_or_low) | ||
| 627 | { | ||
| 628 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
| 629 | char *buf; | ||
| 630 | unsigned ftdi_high_or_low; | ||
| 631 | int rv; | ||
| 632 | |||
| 633 | buf = kmalloc(1, GFP_NOIO); | 615 | buf = kmalloc(1, GFP_NOIO); |
| 634 | if (!buf) | 616 | if (!buf) { |
| 635 | return -ENOMEM; | 617 | return -ENOMEM; |
| 636 | |||
| 637 | if (high_or_low) { | ||
| 638 | ftdi_high_or_low = FTDI_SIO_SET_DTR_HIGH; | ||
| 639 | priv->last_dtr_rts |= TIOCM_DTR; | ||
| 640 | } else { | ||
| 641 | ftdi_high_or_low = FTDI_SIO_SET_DTR_LOW; | ||
| 642 | priv->last_dtr_rts &= ~TIOCM_DTR; | ||
| 643 | } | 618 | } |
| 619 | |||
| 620 | clear &= ~set; /* 'set' takes precedence over 'clear' */ | ||
| 621 | urb_value = 0; | ||
| 622 | if (clear & TIOCM_DTR) | ||
| 623 | urb_value |= FTDI_SIO_SET_DTR_LOW; | ||
| 624 | if (clear & TIOCM_RTS) | ||
| 625 | urb_value |= FTDI_SIO_SET_RTS_LOW; | ||
| 626 | if (set & TIOCM_DTR) | ||
| 627 | urb_value |= FTDI_SIO_SET_DTR_HIGH; | ||
| 628 | if (set & TIOCM_RTS) | ||
| 629 | urb_value |= FTDI_SIO_SET_RTS_HIGH; | ||
| 644 | rv = usb_control_msg(port->serial->dev, | 630 | rv = usb_control_msg(port->serial->dev, |
| 645 | usb_sndctrlpipe(port->serial->dev, 0), | 631 | usb_sndctrlpipe(port->serial->dev, 0), |
| 646 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, | 632 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, |
| 647 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, | 633 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, |
| 648 | ftdi_high_or_low, priv->interface, | 634 | urb_value, priv->interface, |
| 649 | buf, 0, WDR_TIMEOUT); | 635 | buf, 0, WDR_TIMEOUT); |
| 650 | 636 | ||
| 651 | kfree(buf); | 637 | kfree(buf); |
| 638 | if (rv < 0) { | ||
| 639 | err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s", | ||
| 640 | __FUNCTION__, | ||
| 641 | (set & TIOCM_DTR) ? "HIGH" : | ||
| 642 | (clear & TIOCM_DTR) ? "LOW" : "unchanged", | ||
| 643 | (set & TIOCM_RTS) ? "HIGH" : | ||
| 644 | (clear & TIOCM_RTS) ? "LOW" : "unchanged"); | ||
| 645 | } else { | ||
| 646 | dbg("%s - DTR %s, RTS %s", __FUNCTION__, | ||
| 647 | (set & TIOCM_DTR) ? "HIGH" : | ||
| 648 | (clear & TIOCM_DTR) ? "LOW" : "unchanged", | ||
| 649 | (set & TIOCM_RTS) ? "HIGH" : | ||
| 650 | (clear & TIOCM_RTS) ? "LOW" : "unchanged"); | ||
| 651 | priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set; | ||
| 652 | } | ||
| 652 | return rv; | 653 | return rv; |
| 653 | } | 654 | } |
| 654 | 655 | ||
| @@ -681,7 +682,7 @@ static int change_speed(struct usb_serial_port *port) | |||
| 681 | FTDI_SIO_SET_BAUDRATE_REQUEST, | 682 | FTDI_SIO_SET_BAUDRATE_REQUEST, |
| 682 | FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, | 683 | FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, |
| 683 | urb_value, urb_index, | 684 | urb_value, urb_index, |
| 684 | buf, 0, 100); | 685 | buf, 0, WDR_SHORT_TIMEOUT); |
| 685 | 686 | ||
| 686 | kfree(buf); | 687 | kfree(buf); |
| 687 | return rv; | 688 | return rv; |
| @@ -1219,12 +1220,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
| 1219 | /* FIXME: Flow control might be enabled, so it should be checked - | 1220 | /* FIXME: Flow control might be enabled, so it should be checked - |
| 1220 | we have no control of defaults! */ | 1221 | we have no control of defaults! */ |
| 1221 | /* Turn on RTS and DTR since we are not flow controlling by default */ | 1222 | /* Turn on RTS and DTR since we are not flow controlling by default */ |
| 1222 | if (set_dtr(port, HIGH) < 0) { | 1223 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
| 1223 | err("%s Error from DTR HIGH urb", __FUNCTION__); | ||
| 1224 | } | ||
| 1225 | if (set_rts(port, HIGH) < 0){ | ||
| 1226 | err("%s Error from RTS HIGH urb", __FUNCTION__); | ||
| 1227 | } | ||
| 1228 | 1224 | ||
| 1229 | /* Not throttled */ | 1225 | /* Not throttled */ |
| 1230 | spin_lock_irqsave(&priv->rx_lock, flags); | 1226 | spin_lock_irqsave(&priv->rx_lock, flags); |
| @@ -1274,14 +1270,8 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp) | |||
| 1274 | err("error from flowcontrol urb"); | 1270 | err("error from flowcontrol urb"); |
| 1275 | } | 1271 | } |
| 1276 | 1272 | ||
| 1277 | /* drop DTR */ | 1273 | /* drop RTS and DTR */ |
| 1278 | if (set_dtr(port, LOW) < 0){ | 1274 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
| 1279 | err("Error from DTR LOW urb"); | ||
| 1280 | } | ||
| 1281 | /* drop RTS */ | ||
| 1282 | if (set_rts(port, LOW) < 0) { | ||
| 1283 | err("Error from RTS LOW urb"); | ||
| 1284 | } | ||
| 1285 | } /* Note change no line if hupcl is off */ | 1275 | } /* Note change no line if hupcl is off */ |
| 1286 | 1276 | ||
| 1287 | /* cancel any scheduled reading */ | 1277 | /* cancel any scheduled reading */ |
| @@ -1797,7 +1787,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
| 1797 | FTDI_SIO_SET_DATA_REQUEST, | 1787 | FTDI_SIO_SET_DATA_REQUEST, |
| 1798 | FTDI_SIO_SET_DATA_REQUEST_TYPE, | 1788 | FTDI_SIO_SET_DATA_REQUEST_TYPE, |
| 1799 | urb_value , priv->interface, | 1789 | urb_value , priv->interface, |
| 1800 | buf, 0, 100) < 0) { | 1790 | buf, 0, WDR_SHORT_TIMEOUT) < 0) { |
| 1801 | err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); | 1791 | err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); |
| 1802 | } | 1792 | } |
| 1803 | 1793 | ||
| @@ -1812,25 +1802,14 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
| 1812 | err("%s error from disable flowcontrol urb", __FUNCTION__); | 1802 | err("%s error from disable flowcontrol urb", __FUNCTION__); |
| 1813 | } | 1803 | } |
| 1814 | /* Drop RTS and DTR */ | 1804 | /* Drop RTS and DTR */ |
| 1815 | if (set_dtr(port, LOW) < 0){ | 1805 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
| 1816 | err("%s Error from DTR LOW urb", __FUNCTION__); | ||
| 1817 | } | ||
| 1818 | if (set_rts(port, LOW) < 0){ | ||
| 1819 | err("%s Error from RTS LOW urb", __FUNCTION__); | ||
| 1820 | } | ||
| 1821 | |||
| 1822 | } else { | 1806 | } else { |
| 1823 | /* set the baudrate determined before */ | 1807 | /* set the baudrate determined before */ |
| 1824 | if (change_speed(port)) { | 1808 | if (change_speed(port)) { |
| 1825 | err("%s urb failed to set baurdrate", __FUNCTION__); | 1809 | err("%s urb failed to set baurdrate", __FUNCTION__); |
| 1826 | } | 1810 | } |
| 1827 | /* Ensure RTS and DTR are raised */ | 1811 | /* Ensure RTS and DTR are raised */ |
| 1828 | else if (set_dtr(port, HIGH) < 0){ | 1812 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
| 1829 | err("%s Error from DTR HIGH urb", __FUNCTION__); | ||
| 1830 | } | ||
| 1831 | else if (set_rts(port, HIGH) < 0){ | ||
| 1832 | err("%s Error from RTS HIGH urb", __FUNCTION__); | ||
| 1833 | } | ||
| 1834 | } | 1813 | } |
| 1835 | 1814 | ||
| 1836 | /* Set flow control */ | 1815 | /* Set flow control */ |
| @@ -1942,35 +1921,8 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) | |||
| 1942 | 1921 | ||
| 1943 | static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) | 1922 | static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) |
| 1944 | { | 1923 | { |
| 1945 | int ret; | ||
| 1946 | |||
| 1947 | dbg("%s TIOCMSET", __FUNCTION__); | 1924 | dbg("%s TIOCMSET", __FUNCTION__); |
| 1948 | if (set & TIOCM_DTR){ | 1925 | return update_mctrl(port, set, clear); |
| 1949 | if ((ret = set_dtr(port, HIGH)) < 0) { | ||
| 1950 | err("Urb to set DTR failed"); | ||
| 1951 | return(ret); | ||
| 1952 | } | ||
| 1953 | } | ||
| 1954 | if (set & TIOCM_RTS) { | ||
| 1955 | if ((ret = set_rts(port, HIGH)) < 0){ | ||
| 1956 | err("Urb to set RTS failed"); | ||
| 1957 | return(ret); | ||
| 1958 | } | ||
| 1959 | } | ||
| 1960 | |||
| 1961 | if (clear & TIOCM_DTR){ | ||
| 1962 | if ((ret = set_dtr(port, LOW)) < 0){ | ||
| 1963 | err("Urb to unset DTR failed"); | ||
| 1964 | return(ret); | ||
| 1965 | } | ||
| 1966 | } | ||
| 1967 | if (clear & TIOCM_RTS) { | ||
| 1968 | if ((ret = set_rts(port, LOW)) < 0){ | ||
| 1969 | err("Urb to unset RTS failed"); | ||
| 1970 | return(ret); | ||
| 1971 | } | ||
| 1972 | } | ||
| 1973 | return(0); | ||
| 1974 | } | 1926 | } |
| 1975 | 1927 | ||
| 1976 | 1928 | ||
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 8866376823a5..9f4342093e8b 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
| @@ -265,10 +265,24 @@ | |||
| 265 | #define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ | 265 | #define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ |
| 266 | 266 | ||
| 267 | /* | 267 | /* |
| 268 | * microHAM product IDs (http://www.microham.com). | ||
| 269 | * Submitted by Justin Burket (KL1RL) <zorton@jtan.com>. | ||
| 270 | */ | ||
| 271 | #define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */ | ||
| 272 | #define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */ | ||
| 273 | |||
| 274 | /* | ||
| 268 | * Active Robots product ids. | 275 | * Active Robots product ids. |
| 269 | */ | 276 | */ |
| 270 | #define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ | 277 | #define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ |
| 271 | 278 | ||
| 279 | /* | ||
| 280 | * Evolution Robotics products (http://www.evolution.com/). | ||
| 281 | * Submitted by Shawn M. Lavelle. | ||
| 282 | */ | ||
| 283 | #define EVOLUTION_VID 0xDEEE /* Vendor ID */ | ||
| 284 | #define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */ | ||
| 285 | |||
| 272 | /* Commands */ | 286 | /* Commands */ |
| 273 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 287 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
| 274 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 288 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 6051a646fe69..353f24d45bc1 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c | |||
| @@ -257,7 +257,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i | |||
| 257 | endpoint = &iface_desc->endpoint[i].desc; | 257 | endpoint = &iface_desc->endpoint[i].desc; |
| 258 | 258 | ||
| 259 | if (!dev->bulk_in_endpointAddr && | 259 | if (!dev->bulk_in_endpointAddr && |
| 260 | (endpoint->bEndpointAddress & USB_DIR_IN) && | 260 | ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
| 261 | == USB_DIR_IN) && | ||
| 261 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 262 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
| 262 | == USB_ENDPOINT_XFER_BULK)) { | 263 | == USB_ENDPOINT_XFER_BULK)) { |
| 263 | /* we found a bulk in endpoint */ | 264 | /* we found a bulk in endpoint */ |
| @@ -272,7 +273,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i | |||
| 272 | } | 273 | } |
| 273 | 274 | ||
| 274 | if (!dev->bulk_out_endpointAddr && | 275 | if (!dev->bulk_out_endpointAddr && |
| 275 | !(endpoint->bEndpointAddress & USB_DIR_OUT) && | 276 | ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
| 277 | == USB_DIR_OUT) && | ||
| 276 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 278 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
| 277 | == USB_ENDPOINT_XFER_BULK)) { | 279 | == USB_ENDPOINT_XFER_BULK)) { |
| 278 | /* we found a bulk out endpoint */ | 280 | /* we found a bulk out endpoint */ |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 40784a944d05..d2e19f6dd72c 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
| @@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth); | |||
| 80 | */ | 80 | */ |
| 81 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) | 81 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) |
| 82 | { | 82 | { |
| 83 | int i; | 83 | int i, j; |
| 84 | 84 | ||
| 85 | for (i = height; i--; ) { | 85 | for (i = height; i--; ) { |
| 86 | memcpy(dst, src, s_pitch); | 86 | /* s_pitch is a few bytes at the most, memcpy is suboptimal */ |
| 87 | for (j = 0; j < s_pitch; j++) | ||
| 88 | dst[j] = src[j]; | ||
| 87 | src += s_pitch; | 89 | src += s_pitch; |
| 88 | dst += d_pitch; | 90 | dst += d_pitch; |
| 89 | } | 91 | } |
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, |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 9ed1a931dd31..a272592b0373 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
| @@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { | |||
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | static int inverse = 0; | 47 | static int inverse = 0; |
| 48 | static int mtrr = 1; | 48 | static int mtrr = 3; /* default to write-combining */ |
| 49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ | 49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ |
| 50 | static int vram_total __initdata = 0; /* Set total amount of memory */ | 50 | static int vram_total __initdata = 0; /* Set total amount of memory */ |
| 51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ | 51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ |
| @@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options) | |||
| 204 | pmi_setpal=0; | 204 | pmi_setpal=0; |
| 205 | else if (! strcmp(this_opt, "pmipal")) | 205 | else if (! strcmp(this_opt, "pmipal")) |
| 206 | pmi_setpal=1; | 206 | pmi_setpal=1; |
| 207 | else if (! strcmp(this_opt, "mtrr")) | 207 | else if (! strncmp(this_opt, "mtrr:", 5)) |
| 208 | mtrr=1; | 208 | mtrr = simple_strtoul(this_opt+5, NULL, 0); |
| 209 | else if (! strcmp(this_opt, "nomtrr")) | 209 | else if (! strcmp(this_opt, "nomtrr")) |
| 210 | mtrr=0; | 210 | mtrr=0; |
| 211 | else if (! strncmp(this_opt, "vtotal:", 7)) | 211 | else if (! strncmp(this_opt, "vtotal:", 7)) |
| @@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device) | |||
| 387 | 387 | ||
| 388 | if (mtrr) { | 388 | if (mtrr) { |
| 389 | unsigned int temp_size = size_total; | 389 | unsigned int temp_size = size_total; |
| 390 | /* Find the largest power-of-two */ | 390 | unsigned int type = 0; |
| 391 | while (temp_size & (temp_size - 1)) | 391 | |
| 392 | temp_size &= (temp_size - 1); | 392 | switch (mtrr) { |
| 393 | 393 | case 1: | |
| 394 | /* Try and find a power of two to add */ | 394 | type = MTRR_TYPE_UNCACHABLE; |
| 395 | while (temp_size > PAGE_SIZE && | 395 | break; |
| 396 | mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { | 396 | case 2: |
| 397 | temp_size >>= 1; | 397 | type = MTRR_TYPE_WRBACK; |
| 398 | break; | ||
| 399 | case 3: | ||
| 400 | type = MTRR_TYPE_WRCOMB; | ||
| 401 | break; | ||
| 402 | case 4: | ||
| 403 | type = MTRR_TYPE_WRTHROUGH; | ||
| 404 | break; | ||
| 405 | default: | ||
| 406 | type = 0; | ||
| 407 | break; | ||
| 408 | } | ||
| 409 | |||
| 410 | if (type) { | ||
| 411 | int rc; | ||
| 412 | |||
| 413 | /* Find the largest power-of-two */ | ||
| 414 | while (temp_size & (temp_size - 1)) | ||
| 415 | temp_size &= (temp_size - 1); | ||
| 416 | |||
| 417 | /* Try and find a power of two to add */ | ||
| 418 | do { | ||
| 419 | rc = mtrr_add(vesafb_fix.smem_start, temp_size, | ||
| 420 | type, 1); | ||
| 421 | temp_size >>= 1; | ||
| 422 | } while (temp_size >= PAGE_SIZE && rc == -EINVAL); | ||
| 398 | } | 423 | } |
| 399 | } | 424 | } |
| 400 | 425 | ||
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig index 4f120796273e..711b90903e7b 100644 --- a/drivers/w1/Kconfig +++ b/drivers/w1/Kconfig | |||
| @@ -30,7 +30,7 @@ config W1_DS9490 | |||
| 30 | This support is also available as a module. If so, the module | 30 | This support is also available as a module. If so, the module |
| 31 | will be called ds9490r.ko. | 31 | will be called ds9490r.ko. |
| 32 | 32 | ||
| 33 | config W1_DS9490R_BRIDGE | 33 | config W1_DS9490_BRIDGE |
| 34 | tristate "DS9490R USB <-> W1 transport layer for 1-wire" | 34 | tristate "DS9490R USB <-> W1 transport layer for 1-wire" |
| 35 | depends on W1_DS9490 | 35 | depends on W1_DS9490 |
| 36 | help | 36 | help |
| @@ -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/fs/sysfs/file.c b/fs/sysfs/file.c index 335288b9be0f..4013d7905e84 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -437,8 +437,8 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
| 437 | { | 437 | { |
| 438 | struct dentry *dir = kobj->dentry; | 438 | struct dentry *dir = kobj->dentry; |
| 439 | struct dentry *victim; | 439 | struct dentry *victim; |
| 440 | struct sysfs_dirent *sd; | 440 | struct inode * inode; |
| 441 | umode_t umode = (mode & S_IALLUGO) | S_IFREG; | 441 | struct iattr newattrs; |
| 442 | int res = -ENOENT; | 442 | int res = -ENOENT; |
| 443 | 443 | ||
| 444 | down(&dir->d_inode->i_sem); | 444 | down(&dir->d_inode->i_sem); |
| @@ -446,13 +446,15 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
| 446 | if (!IS_ERR(victim)) { | 446 | if (!IS_ERR(victim)) { |
| 447 | if (victim->d_inode && | 447 | if (victim->d_inode && |
| 448 | (victim->d_parent->d_inode == dir->d_inode)) { | 448 | (victim->d_parent->d_inode == dir->d_inode)) { |
| 449 | sd = victim->d_fsdata; | 449 | inode = victim->d_inode; |
| 450 | attr->mode = mode; | 450 | down(&inode->i_sem); |
| 451 | sd->s_mode = umode; | 451 | newattrs.ia_mode = (mode & S_IALLUGO) | |
| 452 | victim->d_inode->i_mode = umode; | 452 | (inode->i_mode & ~S_IALLUGO); |
| 453 | dput(victim); | 453 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
| 454 | res = 0; | 454 | res = notify_change(victim, &newattrs); |
| 455 | up(&inode->i_sem); | ||
| 455 | } | 456 | } |
| 457 | dput(victim); | ||
| 456 | } | 458 | } |
| 457 | up(&dir->d_inode->i_sem); | 459 | up(&dir->d_inode->i_sem); |
| 458 | 460 | ||
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 8de13bafaa76..d727dc960634 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
| @@ -85,7 +85,7 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) | |||
| 85 | 85 | ||
| 86 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) | 86 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) |
| 87 | mode &= ~S_ISGID; | 87 | mode &= ~S_ISGID; |
| 88 | sd_iattr->ia_mode = mode; | 88 | sd_iattr->ia_mode = sd->s_mode = mode; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | return error; | 91 | return error; |
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h index c1adc6b3e86d..aad7aad026b3 100644 --- a/include/asm-arm/bitops.h +++ b/include/asm-arm/bitops.h | |||
| @@ -229,6 +229,7 @@ extern int _find_next_zero_bit_be(const void * p, int size, int offset); | |||
| 229 | extern int _find_first_bit_be(const unsigned long *p, unsigned size); | 229 | extern int _find_first_bit_be(const unsigned long *p, unsigned size); |
| 230 | extern int _find_next_bit_be(const unsigned long *p, int size, int offset); | 230 | extern int _find_next_bit_be(const unsigned long *p, int size, int offset); |
| 231 | 231 | ||
| 232 | #ifndef CONFIG_SMP | ||
| 232 | /* | 233 | /* |
| 233 | * The __* form of bitops are non-atomic and may be reordered. | 234 | * The __* form of bitops are non-atomic and may be reordered. |
| 234 | */ | 235 | */ |
| @@ -241,6 +242,10 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset); | |||
| 241 | (__builtin_constant_p(nr) ? \ | 242 | (__builtin_constant_p(nr) ? \ |
| 242 | ____atomic_##name(nr, p) : \ | 243 | ____atomic_##name(nr, p) : \ |
| 243 | _##name##_be(nr,p)) | 244 | _##name##_be(nr,p)) |
| 245 | #else | ||
| 246 | #define ATOMIC_BITOP_LE(name,nr,p) _##name##_le(nr,p) | ||
| 247 | #define ATOMIC_BITOP_BE(name,nr,p) _##name##_be(nr,p) | ||
| 248 | #endif | ||
| 244 | 249 | ||
| 245 | #define NONATOMIC_BITOP(name,nr,p) \ | 250 | #define NONATOMIC_BITOP(name,nr,p) \ |
| 246 | (____nonatomic_##name(nr, p)) | 251 | (____nonatomic_##name(nr, p)) |
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..ddf1739dc7fd 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,15 @@ 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 | |
| 325 | 339 | while (x < size) { | |
| 326 | /* This looks at memory. Mark it volatile to tell gcc not to move it around */ | 340 | unsigned long val = *addr++; |
| 327 | __asm__ __volatile__( | 341 | if (val) |
| 328 | "xorl %%eax,%%eax\n\t" | 342 | return __ffs(val) + x; |
| 329 | "repe; scasl\n\t" | 343 | x += (sizeof(*addr)<<3); |
| 330 | "jz 1f\n\t" | 344 | } |
| 331 | "leal -4(%%edi),%%edi\n\t" | 345 | return x; |
| 332 | "bsfl (%%edi),%%eax\n" | ||
| 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 | } | 346 | } |
| 340 | 347 | ||
| 341 | /** | 348 | /** |
| @@ -360,20 +367,6 @@ static inline unsigned long ffz(unsigned long word) | |||
| 360 | return word; | 367 | return word; |
| 361 | } | 368 | } |
| 362 | 369 | ||
| 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 | /* | 370 | /* |
| 378 | * fls: find last bit set. | 371 | * fls: find last bit set. |
| 379 | */ | 372 | */ |
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/pgtable.h b/include/asm-x86_64/pgtable.h index 4eec176c3c39..4e167b5ea8f3 100644 --- a/include/asm-x86_64/pgtable.h +++ b/include/asm-x86_64/pgtable.h | |||
| @@ -176,6 +176,8 @@ extern inline void pgd_clear (pgd_t * pgd) | |||
| 176 | (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD) | 176 | (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD) |
| 177 | #define __PAGE_KERNEL_LARGE \ | 177 | #define __PAGE_KERNEL_LARGE \ |
| 178 | (__PAGE_KERNEL | _PAGE_PSE) | 178 | (__PAGE_KERNEL | _PAGE_PSE) |
| 179 | #define __PAGE_KERNEL_LARGE_EXEC \ | ||
| 180 | (__PAGE_KERNEL_EXEC | _PAGE_PSE) | ||
| 179 | 181 | ||
| 180 | #define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL) | 182 | #define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL) |
| 181 | 183 | ||
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h index aeb1b73e21e1..de8b57b2b62b 100644 --- a/include/asm-x86_64/smp.h +++ b/include/asm-x86_64/smp.h | |||
| @@ -46,12 +46,12 @@ 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); |
| 52 | extern int smp_call_function_single(int cpuid, void (*func) (void *info), | ||
| 53 | void *info, int retry, int wait); | ||
| 54 | |||
| 55 | extern cpumask_t cpu_sibling_map[NR_CPUS]; | 55 | extern cpumask_t cpu_sibling_map[NR_CPUS]; |
| 56 | extern cpumask_t cpu_core_map[NR_CPUS]; | 56 | extern cpumask_t cpu_core_map[NR_CPUS]; |
| 57 | extern u8 phys_proc_id[NR_CPUS]; | 57 | extern u8 phys_proc_id[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/linux/input.h b/include/linux/input.h index b9cc0ac71f44..bdc53c6cc962 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -811,9 +811,9 @@ struct input_dev { | |||
| 811 | 811 | ||
| 812 | void *private; | 812 | void *private; |
| 813 | 813 | ||
| 814 | char *name; | 814 | const char *name; |
| 815 | char *phys; | 815 | const char *phys; |
| 816 | char *uniq; | 816 | const char *uniq; |
| 817 | struct input_id id; | 817 | struct input_id id; |
| 818 | 818 | ||
| 819 | unsigned long evbit[NBITS(EV_MAX)]; | 819 | unsigned long evbit[NBITS(EV_MAX)]; |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7ac14961ba22..8621cf42b46f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -971,6 +971,8 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int en | |||
| 971 | 971 | ||
| 972 | #define isa_bridge ((struct pci_dev *)NULL) | 972 | #define isa_bridge ((struct pci_dev *)NULL) |
| 973 | 973 | ||
| 974 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | ||
| 975 | |||
| 974 | #else | 976 | #else |
| 975 | 977 | ||
| 976 | /* | 978 | /* |
| @@ -985,9 +987,6 @@ static inline int pci_proc_domain(struct pci_bus *bus) | |||
| 985 | return 0; | 987 | return 0; |
| 986 | } | 988 | } |
| 987 | #endif | 989 | #endif |
| 988 | |||
| 989 | #define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) | ||
| 990 | |||
| 991 | #endif /* !CONFIG_PCI */ | 990 | #endif /* !CONFIG_PCI */ |
| 992 | 991 | ||
| 993 | /* these helpers provide future and backwards compatibility | 992 | /* these helpers provide future and backwards compatibility |
diff --git a/include/linux/uinput.h b/include/linux/uinput.h index 4c2c82336d10..84876077027f 100644 --- a/include/linux/uinput.h +++ b/include/linux/uinput.h | |||
| @@ -42,8 +42,7 @@ struct uinput_request { | |||
| 42 | int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ | 42 | int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ |
| 43 | 43 | ||
| 44 | int retval; | 44 | int retval; |
| 45 | wait_queue_head_t waitq; | 45 | struct completion done; |
| 46 | int completed; | ||
| 47 | 46 | ||
| 48 | union { | 47 | union { |
| 49 | int effect_id; | 48 | int effect_id; |
| @@ -62,7 +61,7 @@ struct uinput_device { | |||
| 62 | 61 | ||
| 63 | struct uinput_request *requests[UINPUT_NUM_REQUESTS]; | 62 | struct uinput_request *requests[UINPUT_NUM_REQUESTS]; |
| 64 | wait_queue_head_t requests_waitq; | 63 | wait_queue_head_t requests_waitq; |
| 65 | struct semaphore requests_sem; | 64 | spinlock_t requests_lock; |
| 66 | }; | 65 | }; |
| 67 | #endif /* __KERNEL__ */ | 66 | #endif /* __KERNEL__ */ |
| 68 | 67 | ||
diff --git a/include/linux/usb_input.h b/include/linux/usb_input.h new file mode 100644 index 000000000000..716e0cc16043 --- /dev/null +++ b/include/linux/usb_input.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #ifndef __USB_INPUT_H | ||
| 2 | #define __USB_INPUT_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Copyright (C) 2005 Dmitry Torokhov | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/usb.h> | ||
| 13 | #include <linux/input.h> | ||
| 14 | #include <asm/byteorder.h> | ||
| 15 | |||
| 16 | static inline void | ||
| 17 | usb_to_input_id(const struct usb_device *dev, struct input_id *id) | ||
| 18 | { | ||
| 19 | id->bustype = BUS_USB; | ||
| 20 | id->vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
| 21 | id->product = le16_to_cpu(dev->descriptor.idProduct); | ||
| 22 | id->version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
| 23 | } | ||
| 24 | |||
| 25 | #endif | ||
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/kernel/sys.c b/kernel/sys.c index 8f255259ef9e..000e81ad2c1d 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -392,7 +392,6 @@ void kernel_kexec(void) | |||
| 392 | } | 392 | } |
| 393 | notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL); | 393 | notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL); |
| 394 | system_state = SYSTEM_RESTART; | 394 | system_state = SYSTEM_RESTART; |
| 395 | device_suspend(PMSG_FREEZE); | ||
| 396 | device_shutdown(); | 395 | device_shutdown(); |
| 397 | printk(KERN_EMERG "Starting new kernel\n"); | 396 | printk(KERN_EMERG "Starting new kernel\n"); |
| 398 | machine_shutdown(); | 397 | machine_shutdown(); |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 0c421295e613..299f7f3b5b08 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -141,7 +141,7 @@ config DEBUG_IOREMAP | |||
| 141 | 141 | ||
| 142 | config DEBUG_FS | 142 | config DEBUG_FS |
| 143 | bool "Debug Filesystem" | 143 | bool "Debug Filesystem" |
| 144 | depends on DEBUG_KERNEL | 144 | depends on DEBUG_KERNEL && SYSFS |
| 145 | help | 145 | help |
| 146 | debugfs is a virtual file system that kernel developers use to put | 146 | debugfs is a virtual file system that kernel developers use to put |
| 147 | debugging files into. Enable this option to be able to read and | 147 | debugging files into. Enable this option to be able to read and |
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 28ac005c21b5..d7af3e474432 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,9 @@ 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)); | ||
| 2379 | |||
| 2376 | if (chip->irq >= 0) | 2380 | if (chip->irq >= 0) |
| 2377 | free_irq(chip->irq, (void *)chip); | 2381 | free_irq(chip->irq, (void *)chip); |
| 2378 | pci_disable_device(chip->pci); | 2382 | pci_disable_device(chip->pci); |
| @@ -2390,6 +2394,16 @@ static int intel8x0_resume(snd_card_t *card) | |||
| 2390 | synchronize_irq(chip->irq); | 2394 | synchronize_irq(chip->irq); |
| 2391 | snd_intel8x0_chip_init(chip, 1); | 2395 | snd_intel8x0_chip_init(chip, 1); |
| 2392 | 2396 | ||
| 2397 | /* re-initialize mixer stuff */ | ||
| 2398 | if (chip->device_type == DEVICE_INTEL_ICH4) { | ||
| 2399 | /* enable separate SDINs for ICH4 */ | ||
| 2400 | iputbyte(chip, ICHREG(SDM), chip->sdm_saved); | ||
| 2401 | /* use slot 10/11 for SPDIF */ | ||
| 2402 | iputdword(chip, ICHREG(GLOB_CNT), | ||
| 2403 | (igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_PCM_SPDIF_MASK) | | ||
| 2404 | ICH_PCM_SPDIF_1011); | ||
| 2405 | } | ||
| 2406 | |||
| 2393 | /* refill nocache */ | 2407 | /* refill nocache */ |
| 2394 | if (chip->fix_nocache) | 2408 | if (chip->fix_nocache) |
| 2395 | fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1); | 2409 | fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1); |
| @@ -2455,8 +2469,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip) | |||
| 2455 | } | 2469 | } |
| 2456 | do_gettimeofday(&start_time); | 2470 | do_gettimeofday(&start_time); |
| 2457 | spin_unlock_irq(&chip->reg_lock); | 2471 | spin_unlock_irq(&chip->reg_lock); |
| 2458 | set_current_state(TASK_UNINTERRUPTIBLE); | 2472 | msleep(50); |
| 2459 | schedule_timeout(HZ / 20); | ||
| 2460 | spin_lock_irq(&chip->reg_lock); | 2473 | spin_lock_irq(&chip->reg_lock); |
| 2461 | /* check the position */ | 2474 | /* check the position */ |
| 2462 | pos = ichdev->fragsize1; | 2475 | 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 | } |
