Commit graph

5637 commits

Author SHA1 Message Date
Linus Torvalds
6ce90c430b Merge branch 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: hda - Read buffer overflow
  ALSA: hda: Correct EAPD for Dell Inspiron 1525
  ALSA: hda: warn on spurious response
  ALSA: hda: remember last command for each codec
  ALSA: hda: read CORBWP inside reg_lock
  ALSA: hda: take reg_lock in azx_init_cmd_io/azx_free_cmd_io
  ALSA: hda: take cmd_mutex in probe_codec()
  ALSA: hda: track CIRB/CORB command/response states for each codec
  ALSA: hda - Fix quirk for Toshiba Satellite A135-S4527
2009-08-04 15:39:55 -07:00
Roel Kluin
4b35d2ca23 ALSA: hda - Read buffer overflow
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:34:06 +02:00
Chengu Wang
84d3dc200f ALSA: hda: Correct EAPD for Dell Inspiron 1525
The commit 24918b61b5 statically changes
the model from dell-bios to dell-3stack to solve the sound decreasing
regression (http://lkml.org/lkml/2008/9/12/203), however it leads to another
problem that the 2nd headphone jack doesn't work
(https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3987). So I think
the commit 249**2dc is just a workaround. I would like to give a true solution
here.

The datasheet for STAC9228 says, GPIO2 is the same pin as VOL DOWN, and
the EAPD pin is GPIO0. This is why the sound decreases if we set EAPD as
GPIO2. This patch changes EAPD to GPIO0 to solve the problem.

Signed-off-by: Chengu Wang <wangchengu@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:30:56 +02:00
Wu Fengguang
e310bb0646 ALSA: hda: warn on spurious response
To help disclose hardware bugs.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:27:53 +02:00
Wu Fengguang
feb273404f ALSA: hda: remember last command for each codec
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:27:39 +02:00
Wu Fengguang
c32649feb4 ALSA: hda: read CORBWP inside reg_lock
This converts the last CORBWP access outside of reg_lock.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:26:55 +02:00
Wu Fengguang
cdb1fbf231 ALSA: hda: take reg_lock in azx_init_cmd_io/azx_free_cmd_io
Just for safety.  azx_init_cmd_io() and azx_free_cmd_io() may be
called when switching to single command mode.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:26:42 +02:00
Wu Fengguang
a678cdee25 ALSA: hda: take cmd_mutex in probe_codec()
Now that each codec will have its own module, it is possible
for the user to load one codec while another one is running.

So cmd_mutex would be a safe addition to probe_codec().

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:26:23 +02:00
Wu Fengguang
deadff1665 ALSA: hda: track CIRB/CORB command/response states for each codec
Recently we hit a bug in our dev board, whose HDMI codec#3 may emit
redundant/spurious responses, which were then taken as responses to
command for another onboard Realtek codec#2, and mess up both codecs.

Extend the azx_rb.cmds and azx_rb.res to array and track each codec's
commands/responses separately. This helps keep good codec safe from
broken ones.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:26:13 +02:00
Takashi Iwai
ce577e8cf5 ALSA: hda - Fix quirk for Toshiba Satellite A135-S4527
Use model=lenovo instead of model=dallas for Toshiba Satellite A135-S4527
with ALC861-VD codec.

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-08-03 08:23:52 +02:00
Takashi Iwai
ec86fe5209 Merge branch 'fix/oss' into for-linus
* fix/oss:
  sound: mpu401.c: Buffer overflow
  sound: aedsp16: Buffer overflow
2009-07-31 10:17:45 +02:00
Takashi Iwai
d62e345f14 Merge branch 'fix/misc' into for-linus
* fix/misc:
  ALSA: sound/aoa: Add kmalloc NULL tests
2009-07-31 10:17:44 +02:00
Takashi Iwai
6280b61af5 Merge branch 'fix/hda' into for-linus
* fix/hda:
  ALSA: hda - Increase PCM stream name buf in patch_realtek.c
  ALSA: hda: fix out-of-bound hdmi_eld.sad[] write
  ALSA: hda - Add quirk for Dell Studio 1555
2009-07-31 10:17:42 +02:00
Julia Lawall
f065fabc86 ALSA: sound/aoa: Add kmalloc NULL tests
Check that the result of kzalloc is not NULL before a dereference.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression *x;
identifier f;
constant char *C;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
... when != x == NULL
    when != x != NULL
    when != (x || ...)
(
kfree(x)
|
f(...,C,...,x,...)
|
*f(...,x,...)
|
*x->f
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-31 10:14:58 +02:00
Takashi Iwai
aa563af763 ALSA: hda - Increase PCM stream name buf in patch_realtek.c
The name buf with size 16 is too short for some codec names, e.g.
truncated like "ALC861-VD Analo".  Now the size is doubled.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-31 10:06:34 +02:00
Roel Kluin
a987004fbc sound: mpu401.c: Buffer overflow
mpu_synth_info[m].name is a char[30], and the minimum length of the data
written by sprintf is 31 bytes including terminating null.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-29 14:41:24 +02:00
Roel Kluin
c45ec06c74 sound: aedsp16: Buffer overflow
DSPVersion is declared as char[3], but the sprintf writes at least 4 bytes
including terminating null.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-29 14:37:12 +02:00
Roel Kluin
78735cffc2 ALSA: hda: fix out-of-bound hdmi_eld.sad[] write
e->sad[] is declared with size ELD_MAX_SAD=16, but the guard
allows range 0-31.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-29 14:35:20 +02:00
Takashi Iwai
626f5cefc6 ALSA: hda - Add quirk for Dell Studio 1555
Added a quirk entry for Dell Studio 1555.

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-28 00:54:39 +02:00
Takashi Iwai
57e4a5c4f8 Merge branch 'fix/usb-audio' into for-linus
* fix/usb-audio:
  ALSA: usb-audio - Volume control quirk for QuickCam E 3500
2009-07-26 11:07:08 +02:00
Takashi Iwai
b88158846f Merge branch 'fix/pcm-hwptr' into for-linus
* fix/pcm-hwptr:
  ALSA: pcm - Fix hwptr buffer-size overlap bug
  ALSA: pcm - Fix warnings in debug loggings
  ALSA: pcm - Add logging of hwptr updates and interrupt updates
  ALSA: pcm - Fix regressions with VMware
2009-07-26 11:07:07 +02:00
Takashi Iwai
de5d674c02 Merge branch 'fix/hda' into for-linus
* fix/hda:
  ALSA: hda - Fix mute control with some ALC262 models
  ALSA: hda - Restore GPIO1 properly at resume with AD1984A
  ALSA: hda - Use snprintf() to be safer
2009-07-26 11:07:06 +02:00
Takashi Iwai
f35e2965b2 Merge branch 'fix/ctxfi' into for-linus
* fix/ctxfi:
  ALSA: ctxfi - Fix uninitialized error checks
2009-07-26 11:07:05 +02:00
Takashi Iwai
29769d533b Merge branch 'fix/caiaq' into for-linus
* fix/caiaq:
  ALSA: snd_usb_caiaq: add support for Audio2DJ
2009-07-26 11:07:04 +02:00
Takashi Iwai
7679d5c65b Merge branch 'fix/asoc' into for-linus
* fix/asoc:
  ASoC: tlv320aic3x: Enable PLL when not bypassed
2009-07-26 11:07:03 +02:00
Takashi Iwai
8de56b7deb ALSA: hda - Fix mute control with some ALC262 models
The master mute switch is wrongly implemented as checking the pointer
instead of its value, thus it can be never muted.  This patch fixes
the issue.

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
2009-07-24 16:54:31 +02:00
Daniel Mack
b30c494773 ALSA: snd_usb_caiaq: add support for Audio2DJ
This adds support for Native Instrument's freshly announced Audio2DJ
sound device hardware. Version number bumped to 1.3.19.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-23 16:31:58 +02:00
Takashi Iwai
947ca210f1 ALSA: pcm - Fix hwptr buffer-size overlap bug
The fix 79452f0a28 introduced another
bug due to the missing offset for the overlapped hwptr.
When the hwptr goes back to zero, the delta value has to be corrected
with the buffer size.  Otherwise this causes looping sounds.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-23 16:21:08 +02:00
Takashi Iwai
8935064043 ALSA: pcm - Fix warnings in debug loggings
Add proper cast.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-23 14:28:37 +02:00
Takashi Iwai
cedb8118e8 ALSA: pcm - Add logging of hwptr updates and interrupt updates
Added the logging functionality to xrun_debug to record the hwptr
updates via snd_pcm_update_hw_ptr() and snd_pcm_update_hwptr_interrupt(),
corresponding to 16 and 8, respectively.

For example,
	# echo 9 > /proc/asound/card0/pcm0p/xrun_debug
will record the position and other parameters at each period interrupt
together with the normal XRUN debugging.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-23 11:09:03 +02:00
Chaithrika U S
06c71282a9 ASoC: tlv320aic3x: Enable PLL when not bypassed
PLL was not being enabled when it was not bypassed. This patch
enables the PLL when it is used. Additionally, it disables the PLL
when it is bypassed.

Without this patch, the audio on TI DM646x EVM and DM355 EVM
does not work properly. The bit clocks and the frame sync signals
from the codec are not correct and hence the playback/record are faster
than usual for most sample rates. The reason for this was that the PLL
was not enabled when it was not bypassed.

Tested on DM6467 EVM, playback tested on DM355 EVM.

Signed-off-by: Chaithrika U S <chaithrika@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2009-07-23 08:14:29 +01:00
Takashi Iwai
4012ade933 ALSA: hda - Restore GPIO1 properly at resume with AD1984A
The commit 099db17e66 introduced a
regression at suspend/resume where the GPIO1 bit isn't properly
restored, thus the speaker output gets muted initially after resume.

The fix is simple, use the cached write for storing GPIO data.

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-22 18:15:10 +02:00
Takashi Iwai
68110661e8 ALSA: ctxfi - Fix uninitialized error checks
Fix a few uninitialized error checks that were introduced recently
mistakenlly during the clean-up:
  sound/pci/ctxfi/ctamixer.c: In function ‘get_amixer_rsc’:
  sound/pci/ctxfi/ctamixer.c:261: warning: ‘err’ may be used uninitialized in this function
  sound/pci/ctxfi/ctamixer.c: In function ‘get_sum_rsc’:
  sound/pci/ctxfi/ctamixer.c:415: warning: ‘err’ may be used uninitialized in this function
  sound/pci/ctxfi/ctsrc.c: In function ‘get_srcimp_rsc’:
  sound/pci/ctxfi/ctsrc.c:742: warning: ‘err’ may be used uninitialized in this function

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-22 17:05:15 +02:00
Takashi Iwai
86de741660 ALSA: hda - Use snprintf() to be safer
Use snprint() for creating the jack name string instead of sprintf()
in patch_sigmatel.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-22 16:02:46 +02:00
Alexey Fisher
2cf313ee75 ALSA: usb-audio - Volume control quirk for QuickCam E 3500
- E3500 report cval->max more than it actually can handel, so if you
set 95% capture level it will be silently muted.
- Betwen cval->min and cval-max(real) is 2940 control units,
but real are only 7 with cval->res = 384.
- Alsa can't handel less than 10 controls, so make it more
and set cval->res = 192.

Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-22 15:52:15 +02:00
Takashi Iwai
79452f0a28 ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly
wrong timing.  This screws up the recent PCM core code that tries
to correct the position based on the irq timing.

Now, when a backward irq position is detected, skip the update
instead of rebasing.  (This is almost the old behavior before
2.6.30.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-22 12:55:56 +02:00
Takashi Iwai
44f167d376 Merge branch 'fix/misc' into for-linus
* fix/misc:
  ALSA: ca0106 - Fix the max capture buffer size
  ALSA: OSS sequencer should be initialized after snd_seq_system_client_init
  ALSA: sound/isa: convert nested spin_lock_irqsave to spin_lock
2009-07-21 19:03:22 +02:00
Takashi Iwai
a9d90c81b5 Merge branch 'fix/hda' into for-linus
* fix/hda:
  ALSA: hda - Fix pin-setup for Sony VAIO with STAC9872 codecs
  ALSA: hda - Add quirk for Gateway T6834c laptop
  ALSA: hda_codec: Check for invalid zero connections
2009-07-21 19:03:20 +02:00
Takashi Iwai
36766835ed Merge branch 'fix/ctxfi' into for-linus
* fix/ctxfi:
  ALSA: ctxfi: Swapped SURROUND-SIDE channels on emu20k2
2009-07-21 19:03:19 +02:00
Frank Roth
55fe27f7e2 ALSA: ctxfi: Swapped SURROUND-SIDE channels on emu20k2
On Soundblaster X-FI Titanium with emu20k2 the SIDE and SURROUND
channels were swapped and wrong. 
I double checked it with connector colors and creative soundblaster
windows drivers.

So I swapped them to the true order.
Now "speaker-test -c6" and "speaker-test -c8" are working fine.

Signed-off-by: Frank Roth <frashman@freenet.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-20 17:07:10 +02:00
Takashi Iwai
34fdeb2d07 ALSA: ca0106 - Fix the max capture buffer size
The capture buffer size with 64kB seems broken with CA0106.
At least, either the update timing or the DMA position is wrong,
and this screws up pulseaudio badly.

This patch restricts the max buffer size less than that to make life
a bit easier.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
2009-07-20 15:49:46 +02:00
Takashi Iwai
b04add9566 ALSA: hda - Fix pin-setup for Sony VAIO with STAC9872 codecs
The recent rewrite of the codec parser for STAC9872 caused a regression
for some Sony VAIO models that don't give proper pin default configs
by BIOS.  Even using model=vaio doesn't work because the pin definitions
are set after the pin overrides.

This patch fixes the pin definitions in patch_stac9872() to be put
in the right place before the pin overrides.  Also the patch adds the
new quirk entry for VAIO F/S to have the correct pin default configs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
2009-07-20 15:12:41 +02:00
Hao Song
42b95f0c6b ALSA: hda - Add quirk for Gateway T6834c laptop
Gateway T6834c laptops need EAPD always on while the default behavior
for the STAC9205 reference board is to turn it off upon every HP plug.
By using the special "eapd" model, which is first introduced for Gateway
T1616 laptops for this same reason, this peculiarity can be properly
handled.

Signed-off-by: Hao Song <baritono.tux@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-20 09:05:53 +02:00
Jaswinder Singh Rajput
f96e080821 ALSA: OSS sequencer should be initialized after snd_seq_system_client_init
When build SND_SEQUENCER in kernel then OSS sequencer(alsa_seq_oss_init)
is initialized before System (snd_seq_system_client_init) which leads to
memory leak :

unreferenced object 0xf6b0e680 (size 256):
  comm "swapper", pid 1, jiffies 4294670753
  backtrace:
    [<c108ac5c>] create_object+0x135/0x204
    [<c108adfe>] kmemleak_alloc+0x26/0x4c
    [<c1087de2>] kmem_cache_alloc+0x72/0xff
    [<c126d2ac>] seq_create_client1+0x22/0x160
    [<c126e3b6>] snd_seq_create_kernel_client+0x72/0xef
    [<c1485a05>] snd_seq_oss_create_client+0x86/0x142
    [<c1485920>] alsa_seq_oss_init+0xf6/0x155
    [<c1001059>] do_one_initcall+0x4f/0x111
    [<c14655be>] kernel_init+0x115/0x166
    [<c10032af>] kernel_thread_helper+0x7/0x10
    [<ffffffff>] 0xffffffff
unreferenced object 0xf688a580 (size 64):
  comm "swapper", pid 1, jiffies 4294670753
  backtrace:
    [<c108ac5c>] create_object+0x135/0x204
    [<c108adfe>] kmemleak_alloc+0x26/0x4c
    [<c1087de2>] kmem_cache_alloc+0x72/0xff
    [<c126f964>] snd_seq_pool_new+0x1c/0xb8
    [<c126d311>] seq_create_client1+0x87/0x160
    [<c126e3b6>] snd_seq_create_kernel_client+0x72/0xef
    [<c1485a05>] snd_seq_oss_create_client+0x86/0x142
    [<c1485920>] alsa_seq_oss_init+0xf6/0x155
    [<c1001059>] do_one_initcall+0x4f/0x111
    [<c14655be>] kernel_init+0x115/0x166
    [<c10032af>] kernel_thread_helper+0x7/0x10
    [<ffffffff>] 0xffffffff
unreferenced object 0xf6b0e480 (size 256):
  comm "swapper", pid 1, jiffies 4294670754
  backtrace:
    [<c108ac5c>] create_object+0x135/0x204
    [<c108adfe>] kmemleak_alloc+0x26/0x4c
    [<c1087de2>] kmem_cache_alloc+0x72/0xff
    [<c12725a0>] snd_seq_create_port+0x51/0x21c
    [<c126de50>] snd_seq_ioctl_create_port+0x57/0x13c
    [<c126d07a>] snd_seq_do_ioctl+0x4a/0x69
    [<c126d0de>] snd_seq_kernel_client_ctl+0x33/0x49
    [<c1485a74>] snd_seq_oss_create_client+0xf5/0x142
    [<c1485920>] alsa_seq_oss_init+0xf6/0x155
    [<c1001059>] do_one_initcall+0x4f/0x111
    [<c14655be>] kernel_init+0x115/0x166
    [<c10032af>] kernel_thread_helper+0x7/0x10
    [<ffffffff>] 0xffffffff

The correct order should be :

System (snd_seq_system_client_init) should be initialized before
OSS sequencer(alsa_seq_oss_init) which is equivalent to :

1. insmod sound/core/seq/snd-seq-device.ko
2. insmod sound/core/seq/snd-seq.ko
3. insmod sound/core/seq/snd-seq-midi-event.ko
4. insmod sound/core/seq/oss/snd-seq-oss.ko

Including sound/core/seq/oss/Makefile after other seq modules
fixes the ordering and memory leak.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-19 19:10:01 +02:00
Julia Lawall
fcb2954b96 ALSA: sound/isa: convert nested spin_lock_irqsave to spin_lock
If spin_lock_irqsave is called twice in a row with the same second
argument, the interrupt state at the point of the second call overwrites
the value saved by the first call.  Indeed, the second call does not need
to save the interrupt state, so it is changed to a simple spin_lock.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression lock1,lock2;
expression flags;
@@

*spin_lock_irqsave(lock1,flags)
... when != flags
*spin_lock_irqsave(lock2,flags)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-19 14:02:29 +02:00
Jaroslav Kysela
2e9bf24706 ALSA: hda_codec: Check for invalid zero connections
To prevent "Too many connections" message and the error path for some HDMI
codecs (which makes onboard audio unusable), check for invalid zero
connections for CONNECT_LIST verb.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-19 13:51:45 +02:00
Takashi Iwai
15c2ac051c Merge branch 'fix/usb-audio' into for-linus
* fix/usb-audio:
  sound: usb-audio: add workaround for Blue Microphones devices
2009-07-16 16:35:50 +02:00
Takashi Iwai
9d79b13691 Merge branch 'fix/misc' into for-linus
* fix/misc:
  ALSA: riptide -  proper handling of pci_register_driver for joystick
2009-07-16 16:35:48 +02:00
Takashi Iwai
26887793b6 Merge branch 'fix/hda' into for-linus
* fix/hda:
  ALSA: hda_intel: more strict alc880_parse_auto_config dig_nid checking
2009-07-16 16:35:47 +02:00
Takashi Iwai
9d5b28d530 Merge branch 'fix/asoc' into for-linus
* fix/asoc:
  ASoC: Fix NULL pointer dereference in __pxa2xx_pcm_hw_free
2009-07-16 16:35:46 +02:00