Commit graph

253 commits

Author SHA1 Message Date
Joe Perches 9fe856e47e sound: Remove unnecessary casts of private_data
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-09-07 08:05:59 +02:00
Jaroslav Kysela 56385a12d9 ALSA: emu10k1 - delay the PCM interrupts (add pcm_irq_delay parameter)
With some hardware combinations, the PCM interrupts are acknowledged
before the period boundary from the emu10k1 chip. The midlevel PCM code
gets confused and the playback stream is interrupted.

It seems that the interrupt processing shift by 2 samples is enough
to fix this issue. This default value does not harm other,
non-affected hardware.

More information: Kernel bugzilla bug#16300

[A copmile warning fixed by tiwai]

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-08-18 15:10:59 +02:00
Clemens Ladisch 4daf7a0c0b ALSA: emu10k1: allow high-resolution mixer controls
Add a module option to allow the GPR mixer controls to have the full
resolution of the hardware, i.e., 0...2^31-1 instead of 0...100.

Because of bugs in userspace tools like alsactl and alsamixer, this is
not yet enabled by default.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-05-25 20:23:54 +02:00
Linus Torvalds 7f06a8b26a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (250 commits)
  ALSA: hda: Storage class should be before const qualifier
  ASoC: tpa6130a2: Remove CPVSS and HPVdd supplies
  ASoC: tpa6130a2: Define output pins with SND_SOC_DAPM_OUTPUT
  ASoC: sdp4430 - add sdp4430 pcm ops to DAI.
  ASoC: TWL6040: Enable earphone path in codec
  ASoC: SDP4430: Add support for Earphone speaker
  ASoC: SDP4430: Add sdp4430 machine driver
  ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF
  ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function
  ALSA: sound/pci/asihpi: Use kzalloc
  ALSA: hdmi - dont fail on extra nodes
  ALSA: intelhdmi - add id for the CougarPoint chipset
  ALSA: intelhdmi - user friendly codec name
  ALSA: intelhdmi - add dependency on SND_DYNAMIC_MINORS
  ALSA: asihpi: incorrect range check
  ALSA: asihpi: testing the wrong variable
  ALSA: es1688: add pedantic range checks
  ARM: McBSP: Add support for omap4 in McBSP driver
  ARM: McBSP: Fix request for irq in OMAP4
  OMAP: McBSP: Add 32-bit mode support
  ...
2010-05-20 09:41:44 -07:00
Jiri Kosina 6c9468e9eb Merge branch 'master' into for-next 2010-04-23 02:08:44 +02:00
Takashi Iwai d97e1b7823 ALSA: info - Check file position validity in common layer
Check the validity of the file position in the common info layer before
calling read or write callbacks in assumption that entry->size is set up
properly to indicate the max file size.

Removed the redundant checks from the callbacks as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-04-13 12:01:14 +02:00
Takashi Iwai 24e4a1211f ALSA: info - Use standard types for info callbacks
Use loff_t, size_t and ssize_t for arguments of info callbacks
to follow the standard procfs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-04-13 11:57:14 +02:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Thomas Weber 8839316121 Fix typos in comments
[Ss]ytem => [Ss]ystem
udpate => update
paramters => parameters
orginal => original

Signed-off-by: Thomas Weber <swirl@gmx.li>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-03-16 11:47:56 +01:00
Alexey Dobriyan cebe41d4b8 sound: use DEFINE_PCI_DEVICE_TABLE
Use DEFINE_PCI_DEVICE_TABLE() to make PCI device ids go to
.devinit.rodata section, so they can be discarded in some cases,
and make them const.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-02-09 11:08:33 +01:00
Linus Torvalds 4ef58d4e2a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (42 commits)
  tree-wide: fix misspelling of "definition" in comments
  reiserfs: fix misspelling of "journaled"
  doc: Fix a typo in slub.txt.
  inotify: remove superfluous return code check
  hdlc: spelling fix in find_pvc() comment
  doc: fix regulator docs cut-and-pasteism
  mtd: Fix comment in Kconfig
  doc: Fix IRQ chip docs
  tree-wide: fix assorted typos all over the place
  drivers/ata/libata-sff.c: comment spelling fixes
  fix typos/grammos in Documentation/edac.txt
  sysctl: add missing comments
  fs/debugfs/inode.c: fix comment typos
  sgivwfb: Make use of ARRAY_SIZE.
  sky2: fix sky2_link_down copy/paste comment error
  tree-wide: fix typos "couter" -> "counter"
  tree-wide: fix typos "offest" -> "offset"
  fix kerneldoc for set_irq_msi()
  spidev: fix double "of of" in comment
  comment typo fix: sybsystem -> subsystem
  ...
2009-12-09 19:43:33 -08:00
André Goddard Rosa af901ca181 tree-wide: fix assorted typos all over the place
That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-04 15:39:55 +01:00
Jaroslav Kysela d355c82a01 ALSA: rename "PC Speaker" and "PC Beep" controls to "Beep"
To avoid confusion in control names for the standard analog PC Beep generator
using a small Internal PC Speaker, rename all related "PC Speaker" and "PC
Beep" controls to "Beep" only. This name is more universal and can be also
used on more platforms without confusion.

Introduce also "Internal Speaker" in ControlNames.txt for systems with
full-featured build-in internal speaker.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-11-05 09:00:18 +01:00
Roel Kluin 84ed1a1942 ALSA: Cleanup redundant tests on unsigned
The variables are unsigned so the test `>= 0' is always true,
the `< 0' test always fails. In these cases the other part of
the test catches wrapped values.

In dac_audio_write() there does not occur a test for wrapped
values, but the test appears redundant.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-10-30 12:25:07 +01:00
Joe Perches ad361c9884 Remove multiple KERN_ prefixes from printk formats
Commit 5fd29d6ccb ("printk: clean up
handling of log-levels and newlines") changed printk semantics.  printk
lines with multiple KERN_<level> prefixes are no longer emitted as
before the patch.

<level> is now included in the output on each additional use.

Remove all uses of multiple KERN_<level>s in formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-08 10:30:03 -07:00
Joe Perches 0d7392e544 sound: Use PCI_VDEVICE for CREATIVE and ECTIVA
Here's a patch on top of the others to use CREATIVE and ECTIVA

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-25 08:53:57 +02:00
Takashi Iwai 4ef279205a Merge branch 'topic/seq-kconfig-cleanup' into for-linus
* topic/seq-kconfig-cleanup:
  ALSA: clean up the logic for building sequencer modules
2009-06-10 07:26:48 +02:00
Takashi Iwai 4ad75433c2 Merge branch 'topic/pcm-subclass-fix' into for-linus
* topic/pcm-subclass-fix:
  ALSA: Remove invalid GENERIC_MIX PCM sublass
2009-06-10 07:26:43 +02:00
Takashi Iwai 806d31d738 ALSA: emu10k1 - Fix minimum periods for efx playback
EFX playback stream should have periods_min = 2 to avoid the buffer
position overflow (due to restrictions of the pcm-indirect helper).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-08 15:50:42 +02:00
Takashi Iwai 9a83b7453c ALSA: Remove invalid GENERIC_MIX PCM sublass
SNDRV_PCM_SUBCLASS_GENERIC_MIX is mostly for h/w multi-stream playback
devices, but ca0106 and emu10k1x don't support it (unlike emu10k1).
We shouldn't set that flag to avoid confusion.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-02 14:23:05 +02:00
Michal Marek 0528c7494e ALSA: clean up the logic for building sequencer modules
Instead of mangling the CONFIG_* variables in the makefiles over and
over, set a few helper variables in Kconfig.

Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-29 11:49:42 +02:00
Takashi Iwai d6aa764ee8 Merge branch 'fix/misc' into for-linus
* fix/misc:
  ALSA: MAINTAINERS - Update SOUND
  ALSA: emu10k1 - off by 1 in snd_emu10k1_wait()
2009-04-19 11:40:02 +02:00
Roel Kluin 5a47fa3d30 ALSA: emu10k1 - off by 1 in snd_emu10k1_wait()
With `while (count++ < 16384)' count reaches 16385.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-17 12:53:05 +02:00
Li Zefan 336500f030 ALSA: sound/pci: use memdup_user()
Remove open-coded memdup_user().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-14 12:39:46 +02:00
Yang Hongyang ce0b620160 dma-mapping: replace all DMA_28BIT_MASK macro with DMA_BIT_MASK(28)
Replace all DMA_28BIT_MASK macro with DMA_BIT_MASK(28)

Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-07 08:31:12 -07:00
Takashi Iwai fe506d6bc5 Merge branch 'topic/emu10k1' into for-linus 2009-03-24 00:36:08 +01:00
Takashi Iwai dec14f8c0e Merge branch 'topic/snd_card_new-err' into for-linus 2009-03-24 00:35:35 +01:00
Hannes Eder 730d45f913 ALSA: sound/pci/emu10k1: fix sparse warning: different signedness
Fix this sparse warnings:
  sound/pci/emu10k1/emu10k1_main.c:723:66: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:724:68: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:748:74: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:751:66: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:759:73: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:760:73: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:837:50: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:845:50: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:881:50: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:889:57: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:890:57: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:895:60: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:897:60: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:899:60: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:910:56: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:914:57: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:918:56: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:922:57: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:924:58: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:936:60: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:1073:60: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:1088:60: warning: incorrect type in argument 3 (different signedness)
  sound/pci/emu10k1/emu10k1_main.c:1093:58: warning: incorrect type in argument 3 (different signedness)

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-26 09:57:53 +01:00
Takashi Iwai 1f9da55440 ALSA: emu10k1 - Fix digital/analog switch on audigy2 ZS
Fix the inverted logic of shared spdif switch.

Reference: Novell bnc#478496
	https://bugzilla.novell.com/show_bug.cgi?id=478496

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-24 15:31:02 +01:00
Takashi Iwai 28a97c194c ALSA: emu10k1 - Add missing KERN_* prefix to printk
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-05 16:08:14 +01:00
Takashi Iwai e58de7baf7 ALSA: Convert to snd_card_create() in sound/pci/*
Convert from snd_card_new() to the new snd_card_create() function
in sound/pci/*.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-12 15:20:55 +01:00
Takashi Iwai 86b3aa390b Merge branch 'topic/ca0106' into to-push 2008-12-25 11:40:26 +01:00
Takashi Iwai 16950e09cf ALSA: emu10k1 - Add capture boost mixer switch for Audigy
Due to the conversion (drop) from 24bit in the DSP to 16bit in AC97,
the maximum capture level on Audigy seems lower than it could be.

This patch adds a workaround to enable the artificial capture boost
switch.  When this switch is on, the whole analog capature level is
boost up.  However, this results in the lower capture resolution.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-02 09:31:16 +01:00
Takashi Iwai 63cf123bf5 Merge branch 'topic/fix/misc' into topic/misc 2008-11-07 09:06:05 +01:00
Takashi Iwai 55e03a68d2 ALSA: emu10k1 - Add more invert_shared_spdif flag to Audigy models
Reported in Novell bnc#440862:
    https://bugzilla.novell.com/show_bug.cgi?id=440862

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-03 10:21:36 +01:00
Vedran Miletic 67679b1fd1 ALSA: emu10k1: fix coding style for emu10k1_main.c
I fixed all of coding style errors and some warnings, now it is down to:
checkpatch.pl-0.24 --no-tree --file --strict --terse emu10k1_main.c
total: 0 errors, 62 warnings, 7 checks, 2075 lines checked

Signed-off-by: Vedran Miletic <rivanvx@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-23 18:52:24 +02:00
Vedran Miletic 718a2594b6 ALSA: emu10k1: fix faulty commit 18c71092
Commit 18c7109289 had #endif leftoff from
compilation. This patch fixes it.
Also, I replaced a misplaced comment by a useful one, that explains why are
here #ifdef and #endif added in compilation.

Signed-off-by: Vedran Miletic <rivanvx@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-21 21:31:27 +02:00
Vedran Miletic 18c7109289 ALSA: emu10k1: fix device names for Live!/Audigy1/2/4/E-mu
* added missing SBxxxx, CTxxxx, PCxxx and MAEMxxxx where they were missing,
and fixed some of them which were wrong (according to kx.inf, which is pretty
accurate compared to anything out there)
* fixed device names to make them more consistent across various cards
* fixed order of devices where appropriate

Signed-off-by: Vedran Miletic <rivanvx@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-10-21 17:44:02 +02:00
Takashi Iwai 77a23f2695 ALSA: Clean up SG-buffer helper functions and macros
Clean up SG-buffer helper functions and macros.  Helpers take substream
as arguments now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-25 09:57:18 +02:00
Takashi Iwai da3cec35dd ALSA: Kill snd_assert() in sound/pci/*
Kill snd_assert() in sound/pci/*, either removed or replaced with
if () with snd_BUG_ON().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-08-13 11:46:38 +02:00
Takashi Iwai 284373059f ALSA: emu10k1 - simplify the last fix
Clean up the previous commit for fixing memory leaks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-17 16:30:27 +02:00
Jaroslav Kysela 9f515b6898 ALSA: emu10k1 - fix possible memory leak in memory allocation routines
The leak was introduced in "[ALSA] emu10k1 - simplify page allocation
for synth" commit.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-06-17 16:20:13 +02:00
Takashi Iwai 781711a93e ALSA: emu10k1 - Fix page allocation with GFP_DMA
Added the missing GFP_ATOMIC to page_alloc when called with GFP_DMA.
GFP_KERNEL often results in stalls for ZONE_DMA, so GFP_ATOMIC is more
prgmatic.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-06-13 16:29:38 +02:00
Takashi Iwai d2cd74b158 [ALSA] emu10k1 - Fix inverted Analog/Digital mixer switch on Audigy2
On Audigy2 Platinum, the Analog/Digital mixer switch is inverted.
	https://bugzilla.novell.com/show_bug.cgi?id=396204

The patch adds a simple workaround.

There might be another device requiring a similar fix, too (or fix for
audigy2 generically), but right now I fix only the known broken one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-02 11:45:53 +02:00
Takashi Iwai a5003fc041 [ALSA] emu10k1 - simplify page allocation for synth
Simplify the page allocation of emu10k1 driver for emux synth support.
Since these pages aren't be necessarily coherent, we can avoid
expensive DMA-coherent routines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-05-30 11:37:41 +02:00
Jaroslav Franek 868e15dbd2 sound: emu10k1 - fix system hang with Audigy2 ZS Notebook PCMCIA card
When the Linux kernel is compiled with CONFIG_DEBUG_SHIRQ=y,
the Soundblaster Audigy2 ZS Notebook PCMCIA card causes the
system hang during boot (udev stage) or when the card is hot-plug.
The CONFIG_DEBUG_SHIRQ flag is by default 'y' with all Fedora
kernels since 2.6.23. The problem was reported as
https://bugzilla.redhat.com/show_bug.cgi?id=326411

The issue was hunted down to the snd_emu10k1_create() routine:

/* pseudo-code */
snd_emu10k1_create(...) {
	...
	request_irq(... IRQF_SHARED ...) {
		register the irq handler
		#ifdef CONFIG_DEBUG_SHIRQ
		call the irq handler: snd_emu10k1_interrupt() {
			poll I/O port   // <---- !! system hangs
			...
		}
		#endif
	}
	...
	snd_emu10k1_cardbus_init(...) {
		initialize I/O ports
	}
	...
}

The early access to I/O port in the interrupt handler causes
the freeze. Obviously it is necessary to init the I/O ports
before accessing them. This patch moves the registration of
the irq handler after the initialization of the I/O ports.

Signed-off-by: Jaroslav Franek <jarin.franek@post.cz>
Acked-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-06-06 11:16:06 +02:00
Takashi Iwai ebf029da38 [ALSA] Fix possible races at free_irq in PCI drivers
The irq handler of PCI drivers must be released before releasing other
resources since the handler for a shared irq can be still called and
may access the freed resource again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:41 +02:00
Harvey Harrison f2948fc2f0 [ALSA] sound: emu10k1x.c fix shadowed variable warnings
enable in these contexts refers specifically to intr enable, as
per the two functions it is found in.  Use intr_enable instead.
sound/pci/emu10k1/emu10k1x.c:330:15: warning: symbol 'enable' shadows an earlier one
sound/pci/emu10k1/emu10k1x.c:53:12: originally declared here
sound/pci/emu10k1/emu10k1x.c:341:15: warning: symbol 'enable' shadows an earlier one
sound/pci/emu10k1/emu10k1x.c:53:12: originally declared here

instead of shadowing, use cap_voice as we test for the capture
voice in this statement.
sound/pci/emu10k1/emu10k1x.c:798:25: warning: symbol 'pvoice' shadows an earlier one
sound/pci/emu10k1/emu10k1x.c:787:24: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:18 +02:00
Harvey Harrison 4677df07e5 [ALSA] sound: emuproc.c fix signedness warning
Reading regs from the fpga into an int instead of a u32, trivial
fix.
sound/pci/emu10k1/emuproc.c:422:34: warning: incorrect type in argument 3 (different signedness)
sound/pci/emu10k1/emuproc.c:422:34:    expected unsigned int [usertype] *value
sound/pci/emu10k1/emuproc.c:422:34:    got int *<noident>

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-04-24 12:00:18 +02:00
Veli-Matti Valtonen 493b4acb9e [ALSA] emu10k1 - Another EMU0404 Board ID
This is based on pseudo-random playing around with the capabilities.
With ca0102 this card gives no output atall, ca0108 appears to work
fine, so it rather looks similar to the EMU1010b/EMU1010 changes.
Some other people seem to have succeeded in using this aswell:
    https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3496
From: Veli-Matti Valtonen <maligor@gmail.com>

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:25 +01:00
Takashi Iwai bd3d1c2096 [ALSA] emu10k1 - Fix kthread handling at resume
Don't create emu1010 kthread again at resume if it's already created.
Also make the thread function static.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:25 +01:00
James Courtier-Dutton c94fa4c916 [ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:24 +01:00
Takashi Iwai 3839e4f136 [ALSA] emu10k1 - Use enum for emu_model types
Use enum instead of digits for emu_model types.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:24 +01:00
Takashi Iwai 88aa139057 [ALSA] emu10k1 - Don't create emu1010 controls for non-emu boards
The last change for emu1616 introduced a bug that the driver creates
emu1010-related controls even on non-emu boards.  Fixed now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:24 +01:00
Ctirad Fertr 1c02e36681 [ALSA] emu10k1 - 1616(M) cardbus improvements
This patch improves E-Mu 1616(M) cardbus support. It adds definitions of the
new Microdock and 1010 cardbus registers (thanks again for descriptions
James) and improves mixer for this card. Now you can use S/PDIF and ADAT on
Mirodock and also use headpohone output on host cardbus card as another
independent output.

Signed-off-by: Ctirad Fertr <c.fertr@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:24 +01:00
James Courtier-Dutton 190d2c46e5 [ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:24 +01:00
Takashi Iwai 6735e5723b [ALSA] emu10k1 - Fix over-sized kmalloc for TLV
Reported by Al Viro:
In copy_tlv(), the size of kmalloc is wrongly calculated.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:30:05 +01:00
Takashi Iwai 9004acc70e [ALSA] Remove sound/driver.h
This header file exists only for some hacks to adapt alsa-driver
tree.  It's useless for building in the kernel.  Let's move a few
lines in it to sound/core.h and remove it.
With this patch, sound/driver.h isn't removed but has just a single
compile warning to include it.  This should be really killed in
future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:48 +01:00
Takashi Iwai 682fc0a5fe [ALSA] emu10k1x - Add missing snd_card_set_dev call
Added the missing snd_card_set_dev() call.  This will fix the incomplete
sysfs entry for this card.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:29 +01:00
Takashi Iwai 7e39e2273a [ALSA] emu10k1 - Check value ranges in ctl callbacks
Check value ranges in ctl callbacks properly.  This fixes the unexpected
crash due to wrong value assignment.
Also, remove invalid comments in the last patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:24 +01:00
James Courtier-Dutton 83a28a09c8 [ALSA] emu10k1: Add mixer controls parameter checking.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-01-31 17:29:22 +01:00
Takashi Iwai aa299d01f1 [ALSA] emu10k1 - Check value ranges in ctl callbacks
Check value ranges in ctl callbacks properly.  This fixes the unexpected
crash due to wrong value assignment.
Also, remove invalid comments in the last patch.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-11-20 20:03:39 +01:00
James Courtier-Dutton 74415a3676 [ALSA] emu10k1: Add mixer controls parameter checking.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-11-20 20:03:32 +01:00
Jaroslav Kysela c1017a4cdb [ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2007-10-16 16:51:18 +02:00
Matthias Kaehlcke c2d7051ed1 [ALSA] Routines for effect processor FX8010: Use list_for_each_entry
Routines for effect processor FX8010: Use list_for_each_entry instead
of list_for_each

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 16:50:44 +02:00
Jesper Juhl 36726d9df7 [ALSA] emu10k1: There's no need to cast vmalloc() return value in snd_emu10k1_create()
vmalloc() returns void *. no need to cast.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:31 +02:00
Takashi Iwai 7583cb51a1 [ALSA] emu10k1 - Fix memory corruption
The number of mixer elements for SPDIF control don't match with the
actual array size (3).  This may result in a memory corruption that
overwrites the i2c_capture_source field (ALSA bug#3095).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:59:13 +02:00
Clemens Ladisch b83f346bc4 [ALSA] remove incorrect usage of SNDRV_PCM_INFO_SYNC_START and snd_pcm_set_sync()
Set the SNDRV_PCM_INFO_SYNC_START flag and the substream's sync ID
(only) if the substream actually can be linked to another one.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:52 +02:00
Mariusz Kozlowski 51882453a7 [ALSA] This patch removes memset() from snd_emu10k1_fx8010_info() which apparently
isn't needed there.  Upatched code uses:
memset(info, 0, sizeof(info));
where 'info' is a pointer and therefore only first 4 bytes of 'info' gets
cleared on a 32bit machine.  Anyway looking at the code zeoring this memory
region isn't needed at all because the snd_emu10k1_fx8010_info() function
initializes all the 'info' fields on its own.  So that's why this code works
at all in its original form.
This patch removes this redundant code.  Also snd_emu10k1_fx8010_info() can't
fail so lets save some bytes and change its return type to void.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:48 +02:00
Clemens Ladisch 29998d24ab [ALSA] check for linked substreams of different cards
It is possible to have linked substreams that belong to different cards
and/or different drivers.  This patch changes some drivers to make sure
that they do not incorrectly try to handle substreams of a different
card.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:13 +02:00
James Courtier-Dutton c93d1c25be [ALSA] snd-emu10k1:Unmute the Audio/Micro Dock after firmware load.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:04 +02:00
James Courtier-Dutton f93abe51e8 [ALSA] snd-emu10k1:Implement SPDIF/ADAT status.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:58:03 +02:00
James Courtier-Dutton edec7bbb22 [ALSA] snd-emu10k1:Support for ADAT and S/PDIF.
Patch submitted by Ctirad Fertr
<c.fertr@volny.cz>

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:57:53 +02:00
James Courtier-Dutton 42f5322695 [ALSA] snd-emu10k1:Improves firmware loading for E-Mu cards.
Details:
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=8176

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:57:51 +02:00
Takashi Iwai a5ce88909d [ALSA] Clean up with common snd_ctl_boolean_*_info callbacks
Clean up codes using the new common snd_ctl_boolean_*_info() callbacks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:57:45 +02:00
James Courtier-Dutton 90fd5ce5f6 [ALSA] snd-emu10k1: Add support for E-Mu 1616 PCI, 1616M PCI, 0404 PCI, E-Mu
Notebook.
Description: The .device=0x0008 chips have new, but different EMU32 in/out
channels. Driver updated to make use of these EMU32 channels.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-10-16 15:57:43 +02:00
James Courtier-Dutton d9e8a552d4 [ALSA] snd-emu10k1:Enable E-Mu 1616m notebook firmware loading.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-07-20 11:11:59 +02:00
James Courtier-Dutton 3663d845e5 [ALSA] snd-emu10k1: Initial support for E-Mu 1616 and 1616m.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-07-20 11:11:58 +02:00
Pavel Hofman 13d457094b [ALSA] emu10k1 - EMU 1212 with 16 capture channels
* adding 8 more 32-bit capture channels (total of 16) for emu1010 cards
* adding some code comments and card details description

Signed-off-by: Pavel Hofman <dustin@seznam.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-07-20 11:11:27 +02:00
Auke Kok 44c10138fd PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision
ID, they can now use the pci_device->revision member.

This exposes some issues where drivers where reading a word or a dword
for the revision number, and adding useless error-handling around the
read. Some drivers even just read it for no purpose of all.

In devices where the revision ID is being copied over and used in what
appears to be the equivalent of hotpath, I have left the copy code
and the cached copy as not to influence the driver's performance.

Compile tested with make all{yes,mod}config on x86_64 and i386.

Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11 16:02:10 -07:00
Clemens Ladisch 7e0af29d6f [ALSA] add MODULE_FIRMWARE entries
Add MODULE_FIRMWARE() entries, where appropriate.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-11 16:56:14 +02:00
James Courtier-Dutton 82c8c74107 [ALSA] snd-emu10k1: Prevent E-Mu 1010 Notebook card from hanging PC.
E-Mu 1010 is not currently supported yet. Needs development work.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-11 16:56:13 +02:00
Takashi Iwai ef991b95aa [ALSA] Add snd_pcm_group_for_each_entry() for code cleanup
Added a new macro snd_pcm_group_for_each_entry() just for code cleanup.
Old macros, snd_pcm_group_for_each() and snd_pcm_group_substream_entry(),
are removed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-05-11 16:55:42 +02:00
Rolf Stefan Wilke 2594d96079 [ALSA] emu10k1 - Fix STAC9758 front channel
For some time now, some users of STAC9758 (emu10k1) would have no sound on
their front channels. This can be fixed (at least for me) by unmuting  head
phone volume and setting it to 0dB before removing the 'Front Playback'
control. For details, cf.
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2308
Find the appropriate patch attached.
Credits to: Raymond

Signed-off-by: Rolf Stefan Wilke <stefan.wilke@uni-ulm.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:03:57 +01:00
Takashi Iwai 0cb29ea0d4 [ALSA] Add even more 'const' to everything related to TLV
Mark TLV data as 'const'
Signed-of-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:03:19 +01:00
Takashi Iwai f7ba7fc617 [ALSA] emu10k1 - Fix ABI for older ld10k1
Fix ABI for older ld10k1.  When no EMU10K1_PVERSION ioctl is issued,
the driver accepts ioctls with the old struct size without TLV information.
Also, changed the struct field to make the conversion easier from the
old to the new structs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:03:06 +01:00
James Courtier-Dutton eb41dab6e1 [ALSA] emu10k1: Rename the digital optical capture control for the Audigy 2 ZS
Notebook.
Digital playback and capture now works, but it is not bit accurate because it
passes through a resampler.
Bit accurate playback and capture will be implemented later via the p17v.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:02:18 +01:00
James Courtier-Dutton 184c1e2c4c [ALSA] emu10k1: Add Audio capture support for Audigy 2 ZS Notebook.
Implement functionallity in order to fixe ALSA bug#2058.

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:02:17 +01:00
James Courtier-Dutton 4c07c81832 [ALSA] snd-emu10k1: Update Enum naming.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:01:24 +01:00
James Courtier-Dutton e40a0b2e9d [ALSA] snd-emu10k1: emu1010: replace long udelay with msleep.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:00:41 +01:00
James Courtier-Dutton b0dbdaea55 [ALSA] snd-emu10k1: Add emu1010 internal clock rate control for 44100 or 48000.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:00:40 +01:00
James Courtier-Dutton 9148cc5027 [ALSA] snd_emu10k1: Added support for 14dB Attenuation PADS on DACs and ADCs.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:00:38 +01:00
Takashi Iwai bbb53551e3 [ALSA] emu10k1 - Fix compile warning
Fixed a compile warning regarding print format for size_t.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 09:00:11 +01:00
James Courtier-Dutton 9f4bd5dde8 [ALSA] snd-emu10k1: Added support for emu1010, including E-Mu 1212m and E-Mu 1820m
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2007-02-09 08:59:59 +01:00
Takashi Iwai 437a5a4606 [ALSA] Remove IRQF_DISABLED for shared PCI irqs
Fix IRQ flags for PCI devices.
The shared IRQs for PCI devices shouldn't be allocated with
IRQF_DISABLED.  Also, when MSI is enabled, IRQF_SHARED shouldn't
be used.
The patch removes unnecessary cast in request_irq and free_irq,
too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-12-20 08:55:57 +01:00
Takashi Iwai 01f681da49 [ALSA] Fix invalid assignment of PCI revision
Fix the type of PCI revision to char from int and avoid invalid
assignment with pointer cast.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-12-20 08:55:55 +01:00
James Courtier-Dutton 3271b7b2da [ALSA] snd-emu10k1: Fix capture for one variant.
Fixes ALSA bug#324

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-11-28 13:46:39 +01:00
Takashi Iwai 30b35399ce [ALSA] Various fixes for suspend/resume of ALSA PCI drivers
- Check the return value of pci_enable_device() and request_irq()
  in the suspend.  If any error occurs there, disable the device
  using snd_card_disconnect().
- Call pci_set_power_state() properly with pci_choose_state().
- Fix the order to call pci_set_power_state().
- Removed obsolete house-made PM codes in some drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-10-22 10:51:10 +02:00
Arnaud Patard 4130d59b1a [ALSA] emu10k1: Fix outl() in snd_emu10k1_resume_regs()
The emu10k1 driver saves the A_IOCFG and HCFG register on suspend and restores
it on resumes. Unfortunately, this doesn't work as the arguments to outl() are
reversed.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-10-06 20:23:03 +02:00
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00