In hda_codec.c, it has define
"[HDA_PCM_TYPE_HDMI] = { 3, 7, 8, 9, -1 },",
it support up to device 9 for HDMI.
But in hda_intel.c, it only define AZX_MAX_PCMS as 8.
So if it have 4 hdmi codecs, when run azx_attach_pcm_stream(),
it will show error "Invalid PCM device number 8", and "... number 9",
and return "-EINVAL".
We should change the AZX_MAX_PCMS to 10.
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Sid Boyce reported that his machine locks up without enable_msi=0 option.
This looks like another ASUS mobo with Nvidia combo.
Reported-by: Sid Boyce <sboyce@blueyonder.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In azx_stream_start() and azx_stream_stop(),
it use azx_readb/azx_writeb to read/write SIE,
it just enable/disable 8 streams.
But according to the HDA spec, it support 30 streams,
and the new HDA controller will support more then 8
streams. So we should use azx_readl/azx_writel to
read/write SIE.
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds the Intel Cougar Point (PCH) HD Audio Controller DeviceIDs.
Signed-off-by: Seth Heasley <seth.heasley@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When we run the following commands in turn (with
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0),
speaker-test -Dhw:0,3 -c2 -twav # HDMI
speaker-test -Dhw:0,0 -c2 -twav # Analog
The second command will produce sound in the analog lineout _as well as_
HDMI sink. The root cause is, device 0 "reuses" the same stream tag that
was used by device 3, and the "intelhdmi - sticky stream id" patch leaves
the HDMI codec in a functional state. So the HDMI codec happily accepts
the audio samples which reuse its stream tag.
The proposed solution is to remember the last device each azx_dev was
assigned to, and prefer to
1) reuse the azx_dev (and hence the stream tag) the HDMI codec last used
2) or assign a never-used azx_dev for HDMI
With this patch and the above two speaker-test commands,
HDMI codec will use stream tag 8 and Analog codec will use 5.
The stream tag used by HDMI codec won't be reused by others, as long
as we don't run out of the 4 playback azx_dev's. The legacy Analog
codec will continue to use stream tag 5 because its device id is 0
(this is a bit tricky).
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
A machine with AMD CPU with Nvidia board doesn't work with MSI.
Reported-by: Robert J. King <peritus@gurunetwork.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Instead of listing all individual PCI IDs, check the matching with
the PCI class together with the vendor id for Nvidia.
This simplifies the pci id entries.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
For codecs without EPSS support (G45/IbexPeak), the hotplug event will
be lost if the HDA is powered off during the time. After that the pin
presence detection verb returns inaccurate info.
So always power-on HDA link for !EPSS codecs.
KarL offers the fact and Takashi recommends to flag hda_bus. Thanks!
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Confirmed from vendor and tests in RedHat bugzilla #536782 .
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The beep_mode parameter for snd-hda-intel module allows to choose among
different digital beep device registation to the input layer.
0 = do not register to the input layer
1 = register to the input layer all time
2 = use "Beep Switch" control exported to user space mixer applications
Also, introduce CONFIG_SND_HDA_INPUT_BEEP_MODE for default value.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add reboot notifier to each codec so that it can do some workarounds
needed for reboot.
So far, patch_sigmatel.c calls its shutup routine for avoiding noises
at reboot on some HP machines.
References: Novell bnc#544779
http://bugzilla.novell.com/show_bug.cgi?id=544779
Signed-off-by: Takashi Iwai <tiwai@suse.de>
So far, CORB/RIRB still remains even if the driver is switched to the
single_cmd mode. The specification says that this should be disabled,
but I hoped this isn't the case; indeed most devices worked together with
CORB/RIRB.
However, Poulsbo (US15W) seems problematic with this setup, and it
requires to disable CORB/RIRB when single_cmd is used.
Now this patch disables CORB/RIRB initialization when the single_cmd
mode is used. Also the unsolicited event is disabled because it can't
work without RIRB.
Reported-and-tested-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When any codec communication error happens, try to switch to the polling
mode first before turning off MSI. MSI gets more stable nowadays, thus
we should keep it on as much as possible.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Since the recent kernel can handle MSI properly on non-Intel platforms,
let's enable MSI as default.
If any borken device is found, we can add the quirk entry to the list,
which is currently empty.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Created a white-list to enable MSI since some devices require MSI
explicitly due to BIOS/ACPI problems. Simply using a quirk list.
As the first case, take HP Compaq CQ40.
Reference: Novell bnc#529971
https://bugzilla.novell.com/show_bug.cgi?id=529971
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
Add support for new AMD HD audio devices. Use generic driver to detect HD audio
devices with Vendor ID AMD.
Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
Added the patch module option to apply a "patch" as a firmware to
modify pin configurations or give additional hints to the driver
before actually initializing and configuring the codec.
This can be used as a workaround when the BIOS doesn't give sufficient
information or give wrong information that doesn't match with the real
hardware setup, until it's fixed statically in the driver via a quirk.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The codec setup call via snd_hda_codec_configure() isn't necessarily
called in snd_hda_codec_new(). For the later added feature, it's better
to change the code flow like:
- create all codec instances
- configure each codec
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* '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
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>
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>
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>
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>
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>
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>
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 #12735http://bugzilla.kernel.org/show_bug.cgi?id=12735
Tested-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Move power_save option into hda_intel.c, and make a field in hda_bus,
instead of keeping module parameters in separate files.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Minor clean ups: move snd_hda_codecs_inuse() into hda_intel.c and
make static. Also, make snd_hda_query_supported_pcm() static
as it's used only in hda_codec.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Medion MD96630 has ALC268 codec on slot#2 although it's not used
for any purpose. This codec conflicts with the primiary codec ALC888
on slot#0, and gives mixer errors.
This patch adds a corresponding entry to probe_mask blacklist.
Reference: Novell bnc#412528
https://bugzilla.novell.com/show_bug.cgi?id=412528
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Replace 5 free-and-return-err blocks with goto-out-free ones.
This makes the main logic more outstanding.
Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The patch uses HD Audio PCI class code to detect AMD HD Audio cards.
Signed-off-by: Libin Yang <libin.yang@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
BIOS on Dell Studio Desktop tells wrong codec probe masks.
This patch gives the preset mask value to avoid invalid access.
Reference: Novell bug#440907
https://bugzilla.novell.com/show_bug.cgi?id=440907
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When an error occurs during the codec probing, typically accessing to an
non-existing codec slot, the controller chip gets often screwed up and
can no longer communicate with the codecs.
This patch adds a preparation phase just to probe codec addresses before
actually creating codec instances. If any error occurs during this
probing phase, the driver resets the controller to recover.
This will (hopefully) fix the famous "single_cmd" errors.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The hda_bus ops callback take struct hda_bus pointer.
Also, the command callback takes the composed command word, instead of
each small bits in arguments.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The current snd-hda-intel driver seems blocking the power-off on some
devices like eeepc. Although this is likely a BIOS problem, we can add
a workaround by disabling IRQ lines before power-off operation.
This patch adds the reboot notifier to achieve it.
The detailed problem description is found in bug#11889:
http://bugme.linux-foundation.org/show_bug.cgi?id=11889
Tested-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Cc: stable@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Removed the old workaround to avoid the non-existing codec slot.
The current code should work without that workaround. If any,
we can add a quirk table.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use the newly introduced pci_ioremap_bar() function in sound/.
pci_ioremap_bar() just takes a pci device and a bar number, with the goal
of making it really hard to get wrong, while also having a central place
to stick sanity checks.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When read RIRB buffer immediately after RIRB interrupt received,
sometimes the data will be "0x0". If we wait for some time, the data
in buffer will be correct. This issue only occurred with AMD Phenom cpu.
So we set this "needs_damn_long_delay" flag.
Signed-off-by: Wei Ni <wni@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Allow probing of 4 codecs on known good situations.
On some known bad situations, it should be avoided.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>