Commit Graph

199 Commits

Author SHA1 Message Date
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
Andiry Brienza dc4c2e6bde ALSA: hda - Disable AMD SB600 64bit address support only
HDA driver disabled HD audio 64bit address support for all AMD
SB600/SB700/SB800 platforms with commit
09240cf429 due to one SB600 issue
reported by community, but we do not see the similar issue on
SB700/SB800 platforms.
This patch is to refine the workaround for SB600 only.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-08 08:01:47 +02:00
Takashi Iwai aba6653617 ALSA: hda - Fix error path in the sanity check in azx_pcm_open()
Release resources cleanly after errors in the sanity check in
azx_pcm_open().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-05 11:44:46 +02:00
Takashi Iwai c470331e69 ALSA: hda - Add sanity check in PCM open callback
Add some sanity checks of struct snd_pcm_hardware fields in the PCM
open callback of hda driver.  This makes a bit easier to debug any PCM
setup errors in the codec side.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-03 23:10:23 +02:00
Takashi Iwai 70d321e638 ALSA: hda - Call snd_pcm_lib_hw_rates() again after codec open callback
The PCM rates bit field may have been changed by the codec open callback.
In that case, we need to reset rate_min and rate_max.  So, simply call
snd_pcm_lib_hw_rates() again after the codec open callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-03 23:06:45 +02:00
Alexander Beregalov 65f7598311 ALSA: hda_intel: fix build error when !PM
Fix this build error when CONFIG_PM is not set:
ound/pci/hda/hda_intel.c: In function 'azx_bus_reset':
sound/pci/hda/hda_intel.c:1270: error: implicit declaration of function 'snd_pcm_suspend_all'
sound/pci/hda/hda_intel.c:1271: error: implicit declaration of function 'snd_hda_suspend'
sound/pci/hda/hda_intel.c:1272: error: implicit declaration of function 'snd_hda_resume'

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-04 14:21:11 +02:00
Takashi Iwai b20f3b8346 ALSA: hda - Limit codec-verb retry to limited hardwares
The reset of a BUS controller during operations is somehow risky and
shouldn't be done inevitably for devices that have apparently no such
codec-communication problems.

This patch adds the check of the hardware and limits the bus-reset
capability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-02 01:21:30 +02:00
Takashi Iwai 8dd783304e ALSA: hda - Add codec bus reset and verb-retry at critical errors
Some machines machine cause a severe CORB/RIRB stall in certain
weird conditions, such as PA access at the start up together with
fglrx driver.  This seems unable to be recovered without the controller
reset.

This patch allows the bus controller reset at critical errors so
that the communication gets recovered again.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-06-02 01:21:23 +02:00
Takashi Iwai 8a933ece41 ALSA: hda - Fix a typo in the previous patch
ICH6_GCTL_RESET was wrongly set to another bit by the commit
b21fadb9c1.  This caused a problem when
the codec needs really a reset (e.g. recovering from the communication
error at probe).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-31 09:28:12 +02:00
Takashi Iwai b21fadb9c1 ALSA: hda - Add more register bits definitions
Added some missing register bits definitions to reduce magic numbers.
Also renamed some to follow the names on the datasheet.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-28 12:26:15 +02:00
Takashi Iwai b05a7d4fed ALSA: hda - Always sync writes in single_cmd mode
In the single_cmd mode, the hardware cannot store the multiple replies
like on RIRB, thus each verb has to sync and wait for the response no
matter whether the return value is needed or not.  Otherwise it may
result in a wrong return value from the previous verb.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-28 12:01:24 +02:00
Takashi Iwai 8174086167 ALSA: hda - Allow concurrent RIRB access in single_cmd mode
In the single_cmd mode, the current driver code doesn't do any update
for RIRB just for any safety reason.  But, actually the RIRB and
single_cmd mode don't conflict.  Unsolicited events can be delivered
even while using the single_cmd mode.

This patch allows the handling of unsolicited events with single_cmd
mode, just always checking RIRB independent from single_cmd flag.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-26 15:22:00 +02:00
Takashi Iwai 20e91c5750 Merge branch 'fix/hda' into topic/hda 2009-05-26 15:19:56 +02:00
Takashi Iwai 4fcd39207f ALSA: hda - Reset CORB/RIRB at retrying the verb communication
When a codec communication error occurs, the CORB/RIRB counters should
be reset first before re-issuing the verb.  Simply call azx_free_cmd_io()
and azx_init_cmd_io() to achieve that.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-25 18:34:52 +02:00
Ozan Çağlayan 93574844bc ALSA: hda - Add forced codec-slots for ASUS W5Fm
ASUS W5Fm needs the fixed codec-slots to probe to override the BIOS
problem like W5F.

Tested-by: Alp Kılıç <kilic.alp@gmail.com>
Signed-off-by: Ozan Çağlayan <ozan@pardus.org.tr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-24 18:45:28 +02:00
Takashi Iwai 4abc1cc2f9 ALSA: hda - Add prefix to kernel messages
Add proper prefix to each kernel message in hda_intel.c.
Also, avoid the unneeded prefix when CONFIG_SND_VERBOSE_PRINTK is used
together with snd_print*().

Reference: bko#13207
	http://bugzilla.kernel.org/show_bug.cgi?id=13207

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-19 12:16:46 +02:00
Takashi Iwai 313f6e2d40 ALSA: hda - Avoid conflicts with snd-ctxfi driver
The PCI entries of Creative with HD-audio class can be the devices
with emu20k1/emu20k2 chips.  These are supported better by snd-ctxfi
driver.  With that driver, the device will mutate from HD-audio to
its native class.

This patch adds a simple ifdef to avoid the conflict of device probe
between snd-hda-intel and snd-ctxfi drivers.  1102:0009 seems still
OK to be added as it has no emu20kx chip, and is a pure HD-audio
device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-05-18 12:40:52 +02:00
Takashi Iwai b97bedcded Merge branch 'topic/hda-cache' into topic/hda 2009-04-21 11:11:54 +02:00
Takashi Iwai b613291fb2 ALSA: hda - Retry codec-verbs at errors
The current error-recovery scheme for the codec communication errors
doesn't work always well.  Especially falling back to the
single-command mode causes the fatal problem on many systems.

In this patch, the problematic verb is re-issued again after the error
(even with polling mode) instead of the single-cmd mode.  The
single-cmd mode will be used only when specified via the command
option explicitly, mainly just for testing.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-21 11:10:44 +02:00
Takashi Iwai 18cb7109d3 ALSA: hda - Check strcpy length
Check the length to copy via strlen() beforehand to avoid the stack
corruption, or use strlcpy() to be safe in HD-audio codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-16 10:22:24 +02:00
Takashi Iwai 4e01f54bfd ALSA: hda - Add Creative CA0110-IBG support
Added the support for Creative SB X-Fi boards with UAA (HD-audio) mode.
In the HD-audio mode, no multiple streams are supported by just it
behaves like a normal HD-audio device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-16 08:54:53 +02:00
Joe Perches d523b0c808 ALSA: hda_intel.c - Consolidate bitfields
Commit fa00e046b4
added a new bitfield not adjacent to other
bitfields in the same struct.  Moved the new one.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-04-16 08:24:02 +02:00
Takashi Iwai 45c27fc8c8 Merge branch 'master' of git://git.alsa-project.org/alsa-kernel into for-linus
* 'master' of git://git.alsa-project.org/alsa-kernel:
  [ALSA] intel8x0: add one retry to the ac97_clock measurement routine
  [ALSA] intel8x0: fix wrong conditions in ac97_clock measure routine
  [ALSA] intel8x0: do not use zero value from PICB register
  [ALSA] intel8x0: an attempt to make ac97_clock measurement more reliable
  [ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffies
  [ALSA] hda_intel: fix unexpected ring buffer positions
2009-04-15 11:21:13 +02:00
Yang Hongyang e930438c42 Replace all DMA_nBIT_MASK macro with DMA_BIT_MASK(n)
This is the second go through of the old DMA_nBIT_MASK macro,and there're not
so many of them left,so I put them into one patch.I hope this is the last round.
After this the definition of the old DMA_nBIT_MASK macro could be removed.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Tony Lindgren <tony@atomide.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Greg KH <greg@kroah.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-13 15:04:33 -07:00
Jaroslav Kysela fa00e046b4 [ALSA] hda_intel: fix unexpected ring buffer positions
I found two issues with ICH7-M (it should be related to other HDA chipsets
as well):

- the ring buffer position is not reset when stream restarts (after xrun) -
  solved by moving azx_stream_reset() call from open() to prepare() callback
  and reset posbuf to zero (it might be filled with hw later than position()
  callback is called)
- irq_ignore flag should be set also when ring buffer memory area is not
  changed in prepare() callback - this patch replaces irq_ignore with
  more universal check based on jiffies clock

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2009-04-10 12:20:45 +02:00
Takashi Iwai e7bfbb0215 Merge branch 'topic/hda' into for-linus 2009-03-24 00:36:09 +01:00
Takashi Iwai dec14f8c0e Merge branch 'topic/snd_card_new-err' into for-linus 2009-03-24 00:35:35 +01:00
Takashi Iwai 1dddab400b ALSA: hda - Don't reset stream at each prepare callback
Don't reset the stream at each prepare callback but do it only once
after the open.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-19 12:54:23 +01:00
Takashi Iwai 97b71c94d6 ALSA: hda - Don't reset BDL unnecessarily
So far, the prepare callback is called multiple times, BDL entries
are reset and re-programmed at each time.

This patch adds the check to avoid the reset of BDL entries when the
same parameters are used.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-19 12:53:58 +01:00
Takashi Iwai 4a10079345 Merge branch 'fix/hda' into topic/hda 2009-03-18 07:50:56 +01:00
Takashi Iwai c673ba1c23 ALSA: hda - Workaround for buggy DMA position on ATI controllers
The position-buffer on ATI controllers are unreliable as well as
on VIA chips, thus the same workaround for DMA position reading as
VIA is useful for ATI.

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-18 07:46:21 +01:00
Takashi Iwai 09240cf429 ALSA: hda - Fix DMA mask for ATI controllers
ATI controllers (at least some SB0600 models) appear buggy to handle
64bit DMA.  As a workaround, reset GCAP bit0 and let the driver to
use only 32bit DMA on these controllers.

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-18 07:45:41 +01:00
Takashi Iwai 4c4531d64d ALSA: hda - Remove Toshiba probe_mask quirk
Revert the Toshiba probe_mask quirk for 2.6.29 kernel
(commit 38f1df27e3).
In the current tree, the digital-only codec is handled properly so
no codec conflict should occur.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-02 08:06:11 +01:00
Takashi Iwai b31b43e9fb Merge branch 'fix/hda' into topic/hda
Conflicts:
	sound/pci/hda/hda_intel.c
2009-03-02 08:04:10 +01:00
Takashi Iwai 38f1df27e3 ALSA: hda - Add probe_mask default for Toshiba laptop with ALC268
Some Toshiba laptops have another ALC268 codec on slot#3 that conflicts
with the primary codec.  The codec#3 is for the digital I/O, and should
be fixed by the driver, but it'd need a bunch of changes.

So, let's fix the probe problem temporarily by setting the default
probe_mask value.

Reference: kernel bugzilla #12735
	http://bugzilla.kernel.org/show_bug.cgi?id=12735

Tested-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-03-02 07:55:52 +01:00
peerchen bedfcebb4f ALSA: hda - Add the Device IDs for MCP89 and remove IDs of MCP7B
Added the Device IDs for MCP89 HD audio controller.
Removed the IDs of MCP7B cause this chipset had been cancelled.

Signed-off-by: Peer Chen <peerchen@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-27 10:22:55 +01:00
Takashi Iwai e23573d7e3 Merge branch 'fix/hda' into topic/hda 2009-02-16 10:23:35 +01:00
Takashi Iwai d14a7e0bfc Revert "Sound: hda - Restore PCI configuration space with interrupts off"
This reverts commit 32e176c14d.

That commit caused a regression with suspend on Thinkpad SL300.

Reference: kernel bug#12711
	http://bugzilla.kernel.org/show_bug.cgi?id=12711

Tested-by:  Alexandre Rostovtsev <tetromino@gmail.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-16 10:16:27 +01:00
Takashi Iwai 20db7cb0ac ALSA: hda - Add forced codec-slots for ASUS W5F
ASUS W5F needs the fixed codec-slots to probe to override the BIOS
problem.

Tested-by: Giovanni Moser Frainer <giovanni@redix.com.br>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-13 08:19:30 +01:00
Takashi Iwai f1eaaeec11 ALSA: hda - Allow fixed codec-probe mask
Some devices have broken BIOS and they don't set the codec probe-bit
properly after cleared by the driver.  This makes the driver skipping
the necessary codec slots.

Since BIOS update isn't always easy, now the semantics of probe_mask
option is changed a bit.  When it contains the bit 8 (0x100), the
lower bits are used to probe that slots regardless of codec-probe bits
returned by the hardware.

For example, probe_mask=0x103 will force to probe the codec slot #0
and #1.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-02-13 08:16:55 +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 6acaed38a3 ALSA: hda - Use own workqueue
snd-hda-intel driver used schedule_work() fot the delayed DMA pointer
updates, but this has several potential problems:
- it may block other eventsd works longer
- it may deadlock when probing fails and flush_scheduled_work() is
  called during probe callback (as probe callback itself could be
  invoked from eventd)

This patch adds an own workq for each driver instance to solve these
problems.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-01-12 10:33:56 +01:00
Takashi Iwai 8326e32c1e Merge branch 'topic/hda-resume-fix' into topic/hda 2008-12-20 23:41:18 +01:00
Takashi Iwai d4d9cd0338 ALSA: hda - Add probe_only option
Added probe_only module option to hd-audio driver.
This option specifies whether the driver creates and initializes the
codec-parser after probing.  When this option is set, the driver skips
the codec parsing and initialization but gives you proc and other
accesses.  It's useful to see the initial codec state for debugging.

The default of this value is off, so the default behavior is as same
as before.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-19 15:19:11 +01:00
Takashi Iwai 0ff555192a Merge branch 'fix/hda' into topic/hda 2008-12-19 08:22:57 +01:00
Takashi Iwai 5c0b9bec46 ALSA: hda - Fix a compile warning when CONFIG_PM=n
Fixed the compile warning regarding the unused function when built
with CONFIG_PM=n:
  sound/pci/hda/hda_intel.c:1905: warning: ‘snd_hda_codecs_inuse’ defined but not used

snd_hda_codecs_inuse() is used only in the resume callback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-11 11:48:33 +01:00
Rafael J. Wysocki 32e176c14d Sound: hda - Restore PCI configuration space with interrupts off
Move the restoration of the standard PCI configuration registers
in the snd_hda_intel driver to a ->resume_early() callback executed
with interrupts disabled, since doing that with interrupts enabled
may lead to problems in some cases.

This patch addresses the regression from 2.6.26 tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=12121 .

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-12-07 10:45:32 +01:00
Takashi Iwai 11cd41b893 ALSA: hda - Fix build error with CONFIG_SND_HDA_POWER_SAVE
Moved power_save field initialization inside a proper ifdef
to fix a build error without CONFIG_SND_HDA_POWER_SAVE.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-11-28 07:22:18 +01:00