Commit Graph

16701 Commits

Author SHA1 Message Date
Takashi Iwai
9cd5ab9c3c ALSA: lola: Fix uninitialized variable access in error message
The FUNCTION_TYPE parameter isn't associated with any NID, thus
showing the uninitialized nid in the error message is simply
nonsense.

Spotted by coverity CID 145068.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 16:51:36 +01:00
Takashi Iwai
4c88b7f287 ALSA: ice1724: Fix uninitialized variable access
Spotted by coverity CIDs 751505 and 751506.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 16:46:36 +01:00
Takashi Iwai
e12483e0f3 ALSA: ak4114: Fix wrong register array size
The size of the register cache array is actually 6 instead of 7,
as it caches up to AK4114_REG_INT1_MASK.  This resulted in unexpected
access out of array range, although most of them aren't so serious
(just reading one more byte on the stack at snd_ak4114_create()).

Also, the check of cache size was wrongly done by checking with
sizeof() instead of ARRAY_SIZE().  Fixed this together.

(And yes, hardcoded numbers are bad, but I keep the coding style as is
 for making it clear what this patch actually does.)

Spotted by coverity among several CIDs, e.g. 711621.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 16:42:36 +01:00
Takashi Iwai
2026d24ef2 ALSA: rme96: Return error code in PCM copy ops
Just pass the error code returned from copy_from_user_toio() and
copy_to_user_fromio() helpers.

Spotted by coverity CID 114119.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 16:04:37 +01:00
Takashi Iwai
329bbd9ba7 ALSA: ali5451: Drop unused variable
The variable runtime is never used, and this might be even a source of
NULL-dereference.  Nothing better than killing it.

Spotted by coverity CID 100862.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 15:42:29 +01:00
Takashi Iwai
9bd0f5c042 ALSA: ad1889: Fix right attenuation proc output
The right attenuation bits aren't needed to be shifted.

Spotted by coverity CID 11427.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 15:39:37 +01:00
Takashi Iwai
57a4451d26 ALSA: Use strlcpy() instead of strncpy()
We tend to make stupid mistakes with strncpy().  Let's take a safer
one, strlcpy().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 15:26:12 +01:00
Takashi Iwai
97f44f56ca ALSA: Limit the fallback card id string size
When no proper id string is given, the driver tries to fall back to
copy the proc_root name string via strcpy(), but this might overflow
the fixed string size.  Let's use strlcpy().

Spotted by coverity CID 139008.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 15:20:06 +01:00
Takashi Iwai
75415df8ff ALSA: pcsp: Fix initialization with nopcm=1
When nopcm=1 is set, some initializations based on hrtimer resolution
might be bogus because the driver checks the resolution only when
nopcm=0.  Simply get the resolution always at first for fixing the
bug.

Spotted by coverity CID 139740.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 15:15:20 +01:00
Takashi Iwai
a8d09e3a6d ALSA: opl3: Fix possible negative array index access
Spotted by coverity CID 115196.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 15:07:19 +01:00
Takashi Iwai
a40a393722 ALSA: memalloc: NULL-initialize in snd_malloc_dev_iram()
dmab->area and addr fields should be cleared at the head of
snd_malloc_dev_iram() as especially dmab->area is used to indicate the
allocation failure / fallback.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:59:31 +01:00
Takashi Iwai
9f694bc793 ALSA: memalloc: Make snd_{malloc|free}_dev_iram() static
These are used only locally.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:56:21 +01:00
Takashi Iwai
60f6fef877 ALSA: Optimize module name check
module->name is a fixed array, so we can check the empty contents
straightforwardly in module_slot_match().

Spotted by coverity CID 1056786.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:37:42 +01:00
Takashi Iwai
1f96153bc6 ALSA: pcm: Add fallthru comments
Just to improve readability.
Spotted by coverity CID 115002 and 115003.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:37:35 +01:00
Takashi Iwai
ca16ec02e1 ALSA: hda - Remove locally dead codes
Reported by coverity.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:37:30 +01:00
Takashi Iwai
57d8ff617f ALSA: hda - Add a fallthru comment
... to improve the readability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:37:23 +01:00
Takashi Iwai
728deecdd4 ALSA: hda - Fix possible NULL dereference in snd_hda_get_pin_label()
Fix a possible NULL access of indexp in fill_audio_out_name() called
from snd_hda_get_pin_label().

Spotted by coverity CID 402035.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:37:19 +01:00
Takashi Iwai
9b389a8a02 ALSA: 6fire: Fix probe of multiple cards
The probe code of snd-usb-6fire driver overrides the devices[] pointer
wrongly without checking whether it's already occupied or not.  This
would screw up the device disconnection later.

Spotted by coverity CID 141423.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-29 11:37:11 +01:00
Takashi Iwai
63437313da ALSA: memalloc: Yet another ifdef CONFIG_GENERIC_ALLOCATOR protection
I obviously forgot to merge the right version...

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-28 16:08:27 +01:00
Takashi Iwai
a655f75c75 ALSA: pcm_dmaengine: Remove hardcoded PCM formats
Use the standard PCM helper function to figure out the sample bytes
instead of hardcodec PCM format checks in
snd_hwparams_to_dma_slave_config().

The patch also extends the format check for 8 bytes formats although
no one should match so far.

Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-28 10:18:09 +01:00
Takashi Iwai
afb5a77931 ALSA: hda - Sync EAPD with vmaster on AD1984A Thinkpads
As EAPD on NID 0x12 (speaker pin) is used as the master amp on
Thinkpads with AD1984A codec, we can hook this to vmaster for saving a
bit more power at master mute state.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-26 00:33:58 +02:00
Takashi Iwai
d601b66616 Merge branch 'for-linus' into for-next 2013-10-26 00:33:02 +02:00
Takashi Iwai
1ac3293095 ALSA: hda - Fix silent headphone on Thinkpads with AD1984A codec
AD1984A codec has a couple of pins with EAPD controls, and the generic
codec driver tries to turn each of them on/off depending on the pin
active state.  However, Thinkpads seem to use EAPD of the speaker pin
as a master EAPD for controlling the mute of all outputs, including
the headphone.  This results in the dead headphone output via the
headphone plugging because it mutes the speaker and turns off EAPD.

The fix is to simply add spec->gen.keep_on_eapd flag.

[This is a regression fix on 3.12 where we moved the AD codec parser
 to the generic parser.  3.11 and earlier didn't show this problem
 because still static quirks have been used.]

Reported-and-tested-by: Vito Caputo <vcaputo@gnugeneration.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-26 00:30:32 +02:00
Takashi Iwai
b63eae0a6c ALSA: hda - Add missing initial vmaster hook at build_controls callback
The generic parser has a support of vmaster hook, but this is
initialized only in the init callback with the check of the presence
of the corresponding kctl.  However, since kctl is NULL at the very
first init callback that is called before build_controls callback, the
vmaster hook sync is skipped there.  Eventually this leads to the
uninitialized state depending on the hook implementation.

This patch adds a simple workaround, just calling the sync function
explicitly at build_controls callback.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-25 23:43:10 +02:00
Takashi Iwai
6913a9dbf1 ASoC: Updates for v3.13
- Further work on the dmaengine helpers, including support for
    configuring the parameters for DMA by reading the capabilities of the
    DMA controller which removes some guesswork and magic numbers fromm
    drivers.
  - A refresh of the documentation.
  - Conversions of many drivers to direct regmap API usage in order to
    allow the ASoC level register I/O code to be removed, this will
    hopefully be completed by v3.14.
  - Support for using async register I/O in DAPM, reducing the time taken
    to implement power transitions on systems that support it.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJSajLdAAoJELSic+t+oim9MVEQAJ3t7df5K9R/OynjhKiEFxpP
 cBWo306CegZ5oO17UqG+SReJkOWgUI8zIUkNC818suTjtgyhv4WUBx1QgXG8akO5
 arHZEQGyReLxgWbnO5ScP7BJt5ZYldfQWN+NPnNlzwvVA8R4xChvAwuHL+kUSSYW
 DrOb0ag/Gtn2jQo3o9GbZb5c3UhZqoMg/pQSoVtnvG/O8N/xR0yoeXGsdJv1su6g
 OKhCJTRWU8v3FONatR2wWXnSrCBOeJ2Ec7YUJil1FQQdENYZfV3AOsFHxmqsyG2O
 Xj2P7CioY0JY7dtFcKjrXgsnjvgZmVdVsdegTJPWS9RjunjyupvSyhMhZYkoA60j
 V7RxyIbHAx7hILQqCYYhlOczYHom4MSwAGGt7y7T3oKt0432RvIjE2fP7sTGaqD8
 wzuVYuVl4km03xX9g9abF6xjyDE6e+4wun+d8kSvOosvd/nF47gkXUXEvPZh0Ley
 013e5fHNDaNF4uaSVXE169JyVxVnHP6nXJDRWZakXsryGXGUpn0quIzobf6fb6XE
 fY5Q3QoyP5rHdSMIvGN5Gi76KsHF5CWILWqcWLEVPLnaf9gJmrp3IypmF1c8i7VE
 CrcTim5mhNePEX56skRaHhpYHmsxYApSAzxNAA/t3cJ2rtwb87jMM4jOcjHi/war
 emSVe5lXkcwv/lU/Pa0N
 =rVsK
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v3.13

 - Further work on the dmaengine helpers, including support for
   configuring the parameters for DMA by reading the capabilities of the
   DMA controller which removes some guesswork and magic numbers fromm
   drivers.
 - A refresh of the documentation.
 - Conversions of many drivers to direct regmap API usage in order to
   allow the ASoC level register I/O code to be removed, this will
   hopefully be completed by v3.14.
 - Support for using async register I/O in DAPM, reducing the time taken
   to implement power transitions on systems that support it.
2013-10-25 11:43:47 +02:00
Anssi Hannula
7342017f4a ALSA: hda - hdmi: Re-setup pin and infoframe on plug-in on all codecs
hdmi_setup_audio_infoframe() does not set up pin and infoframe if there
is no connected sink. If a sink is connected while audio playback is
already in progress, the pin and infoframe will not be properly set up,
causing no audio or wrongly mapped audio.

On Intel Haswell codecs the hdmi_setup_audio_infoframe() is already
called again from hdmi_present_sense() when an ELD appears because
transcoder:port mapping may have changed.

Make the call non-Haswell-specific so that audio will be properly set up
if the playback was started before a sink was connected.

Tested on non-Haswell Intel HDMI codec by plugging sink in during
playback.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-25 01:03:20 +02:00
Anssi Hannula
84d69e790f ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs
Recent AMD HDMI codecs (revision ID 3 and later, 0x100300 as reported by
procfs codec#0) have a configurable ramp-up/down functionality.

The documentation ( http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf )
specifies that 180 ("180/256 =~ 0.7") is recommended for PCM and 0 for
non-PCM.

Apply the recommended values according to provided S/PDIF AES0 settings
since ramp-up/down does not make sense for non-PCM.

v2: adapted to hdmi_ops infrastructure

* More note from Anssi:
actually, re-reading mails reveals that Olivier didn't find the
expected difference with this setting, except for "maybe slightly
slower startup with AES0=6" (i.e. value 0, which is unexpected).

So maybe
a) it makes too unnoticiable a difference, or
b) only affects certain hardware (card and/or sink), or
c) ramp-up/down is only triggered with the MUTE bit of
   ATI_VERB_SET_MULTICHANNEL_xx which is also rev3+ specific,
   but is not presently used by the driver,
or something else.

So there's a significant chance setting ramp rate is useless for us ATM,
but probably does not do actual harm either.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Olivier Langlois <olivier@trillion01.com> # v1
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 22:57:32 +02:00
Anssi Hannula
461cf6b39d ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs
ATI/AMD HDMI codecs do not include standard HDA HDMI HBR support (which
is required for bitstreaming DTS-HD and Dolby TrueHD), instead they have
custom verbs for checking and enabling it.

Add support for the ATI/AMD HDMI HBR verbs.

The specification is available at:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

v2: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v1
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 22:54:56 +02:00
Anssi Hannula
89250f8464 ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs
ATI/AMD HDMI/DP codecs do not include standard HDA ELD (EDID-like data)
support.

In place of providing access to an ELD buffer, various vendor-specific
verbs are provided to provide the relevant information. Revision ID 3
and later (0x100300 as reported by procfs codec#X) have support for
providing more information than the previous revisions (but only if
supported by the display driver).

Generate ELD from the information provided by the vendor-specific verbs
on ATI/AMD codecs.

The specification is available at:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

v2: moved code to hda_eld.c and cleaned it up
v3: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v2
Tested-by: Olivier Langlois <olivier@trillion01.com> # v2
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 22:54:13 +02:00
Anssi Hannula
5a61358433 ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support
ATI/AMD codecs do not support all the standard HDA HDMI/DP functions,
instead various vendor-specific verbs are provided.

This commit addresses these missing functions:
- standard channel mapping support
- standard infoframe configuration support

ATI/AMD provides their own verbs that allow the following:
- setting CA for infoframe
- setting down-mix information for infoframe
- channel pair remapping
- individual channel remapping (revision ID 3+, 0x100300+)

The documentation for the verbs has now been released by AMD:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

Add support for the ATI/AMD specific verbs and use them instead of the
generic methods on ATI/AMD codecs. This allows multi-channel PCM audio
to work.

Channel remapping is restricted to pairwise mapping on codecs with
revision ID 2 (0x100200 as reported by procfs codec#X) or lower. This
means cards up to Radeon HD7670 as far as I know. This will not affect
standard multi-channel modes since these codecs support automatic
FC-LFE swapping for HDMI.

ATI/AMD codecs do not advertise all of their supported rates, formats
and channel counts, therefore that information is forced accordingly so
that all HDMI 1.x PCM parameters are marked as supported.

Support for multiple ports is also added to patch_atihdmi so that
0x1002aa01 codecs with multiple ports will work properly when switched
back to that patch.

v2: splitted ELD emulation to a separate patch, tlv fixes
v3: adapted to the new hdmi_ops infrastructure, fixed rev3+ vendor id

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v2
Tested-by: Olivier Langlois <olivier@trillion01.com> # v2+rev3fix
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 22:53:43 +02:00
Anssi Hannula
307229d2ac ALSA: hda - hdmi: Allow HDA patches to customize more operations
Upcoming AMD multichannel support requires many customized operations
(channel mapping, ELD, HBR) but can otherwise share most of its code
with the generic patch.

Add a local struct hdmi_ops containing customizable HDMI-specific
callbacks and move the current code to those callbacks. Functionality is
unaltered.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 22:52:53 +02:00
Kailang Yang
88011c0911 ALSA: hda/realtek - Raise the delay for alc283_shutup
Some machine with 85ms delay might be happen pop noise when codec
enter to D3.  Raise up to 100ms delay will be match for more machine.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 15:45:24 +02:00
Vinod Koul
917f4b5cba ALSA: compress: fix drain calls blocking other compress functions
The drain and drain_notify callback were blocked by low level driver untill the
draining was complete. Due to this being invoked with big fat mutex held, others
ops like reading timestamp, calling pause, drop were blocked.

So to fix this we add a new snd_compr_drain_notify() API. This would be required
to be invoked by low level driver when drain or partial drain has been completed
by the DSP. Thus we make the drain and partial_drain callback as non blocking
and driver returns immediately after notifying DSP.
The waiting is done while relasing the lock so that other ops can go ahead.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
CC: stable@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 14:50:37 +02:00
Takashi Iwai
a5606f8561 ALSA: Add ifdef CONFIG_GENERIC_ALLOCATOR for SNDRV_DMA_TYPE_IRAM code
It turned out that we can't use gen_pool_*() functions on archs
without CONFIG_GENERIC_ALLOCATOR (resulting in missing symbols), since
linux/genalloc.h doesn't provide dummy functions for all.  We'd be
able to fix linux/genalloc.h size, but I take an easier path for
now...

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-24 14:36:40 +02:00
Mark Brown
9645083ca5 Merge remote-tracking branch 'asoc/topic/wm8962' into asoc-next 2013-10-24 11:24:18 +01:00
Mark Brown
cd77607f57 Merge remote-tracking branch 'asoc/topic/wm8400' into asoc-next 2013-10-24 11:24:18 +01:00
Mark Brown
d12649452d Merge remote-tracking branch 'asoc/topic/twl6040' into asoc-next 2013-10-24 11:24:17 +01:00
Mark Brown
e3a4bd276d Merge remote-tracking branch 'asoc/topic/twl4030' into asoc-next 2013-10-24 11:24:17 +01:00
Mark Brown
856de81583 Merge remote-tracking branch 'asoc/topic/tpa6130a2' into asoc-next 2013-10-24 11:24:17 +01:00
Mark Brown
3caa28274e Merge remote-tracking branch 'asoc/topic/tlv320aic3x' into asoc-next 2013-10-24 11:24:16 +01:00
Mark Brown
24a6703abb Merge remote-tracking branch 'asoc/topic/tlv320aic32x4' into asoc-next 2013-10-24 11:24:16 +01:00
Mark Brown
3cabd442d7 Merge remote-tracking branch 'asoc/topic/tlv320aic26' into asoc-next 2013-10-24 11:24:15 +01:00
Mark Brown
2b48f86b5b Merge remote-tracking branch 'asoc/topic/tlv320aic23' into asoc-next 2013-10-24 11:24:15 +01:00
Mark Brown
a5f0ac4a0b Merge remote-tracking branch 'asoc/topic/tegra' into asoc-next 2013-10-24 11:24:14 +01:00
Mark Brown
7524be376d Merge remote-tracking branch 'asoc/topic/tas5086' into asoc-next 2013-10-24 11:24:14 +01:00
Mark Brown
abdd182e93 Merge remote-tracking branch 'asoc/topic/spear' into asoc-next 2013-10-24 11:24:13 +01:00
Mark Brown
c5833ddc4a Merge remote-tracking branch 'asoc/topic/sn95031' into asoc-next 2013-10-24 11:24:13 +01:00
Mark Brown
ccc6d1922e Merge remote-tracking branch 'asoc/topic/simple' into asoc-next 2013-10-24 11:24:12 +01:00
Mark Brown
f6b967ab1b Merge remote-tracking branch 'asoc/topic/si476x' into asoc-next 2013-10-24 11:24:12 +01:00
Mark Brown
1f7f8e0462 Merge remote-tracking branch 'asoc/topic/samsung' into asoc-next 2013-10-24 11:24:12 +01:00