platform/kernel/linux-rpi.git
11 years agoALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs
Anssi Hannula [Thu, 24 Oct 2013 18:10:36 +0000 (21:10 +0300)]
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>
11 years agoALSA: hda - hdmi: Add ATI/AMD multi-channel audio support
Anssi Hannula [Thu, 24 Oct 2013 18:10:35 +0000 (21:10 +0300)]
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>
11 years agoALSA: hda - hdmi: Allow HDA patches to customize more operations
Anssi Hannula [Thu, 24 Oct 2013 18:10:34 +0000 (21:10 +0300)]
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>
11 years agoALSA: hda/realtek - Raise the delay for alc283_shutup
Kailang Yang [Thu, 24 Oct 2013 13:45:24 +0000 (15:45 +0200)]
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>
11 years agoALSA: compress: fix drain calls blocking other compress functions
Vinod Koul [Thu, 24 Oct 2013 11:07:31 +0000 (16:37 +0530)]
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>
11 years agoALSA: Add ifdef CONFIG_GENERIC_ALLOCATOR for SNDRV_DMA_TYPE_IRAM code
Takashi Iwai [Thu, 24 Oct 2013 12:25:32 +0000 (14:25 +0200)]
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>
11 years agoALSA: hda - Fix mute LED on HP laptops in runtime suspend
Takashi Iwai [Wed, 23 Oct 2013 23:24:15 +0000 (01:24 +0200)]
ALSA: hda - Fix mute LED on HP laptops in runtime suspend

When HP laptops with mute and mic-record LEDs go to runtime suspend,
these LEDs are turned on forcibly no matter whether GPIO pis are on or
off.  This strange behavior seems triggered by resetting the HD-audio
bus link at azx_rutime_suspend().  So, just add a new hda_bus flag to
avoid the link reset at runtime suspend and set it for these HP
machines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add support of ALC285 / ALC293 codecs
Kailang Yang [Thu, 24 Oct 2013 09:36:33 +0000 (11:36 +0200)]
ALSA: hda - Add support of ALC285 / ALC293 codecs

Yet another variants of ALC269.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add support of ALC255 codecs
Kailang Yang [Thu, 24 Oct 2013 09:35:18 +0000 (11:35 +0200)]
ALSA: hda - Add support of ALC255 codecs

It's just another variant of ALC269 & co.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Remove OOM message after input_allocate_device
Joe Perches [Wed, 23 Oct 2013 19:14:54 +0000 (12:14 -0700)]
ALSA: hda - Remove OOM message after input_allocate_device

Emitting an OOM message isn't necessary after input_allocate_device
as there's a generic OOM and a dump_stack already done.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Add SoC on-chip internal ram support for DMA buffer allocation
Nicolin Chen [Wed, 23 Oct 2013 03:47:43 +0000 (11:47 +0800)]
ALSA: Add SoC on-chip internal ram support for DMA buffer allocation

Now it's quite common that an SoC contains its on-chip internal RAM.
By using this RAM space for DMA buffer during audio playback/record,
we can shutdown the voltage for external RAM to save power.

So add new DEV type with iram malloc()/free() and accordingly modify
current default mmap() for the iram circumstance.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'dice-driver-playback-only' of git://git.alsa-project.org/alsa-kprivate...
Takashi Iwai [Tue, 22 Oct 2013 08:02:57 +0000 (10:02 +0200)]
Merge branch 'dice-driver-playback-only' of git://git.alsa-project.org/alsa-kprivate into for-next

11 years agoALSA: hda - Fix typos in patch_hdmi.c
Takashi Iwai [Mon, 21 Oct 2013 14:31:45 +0000 (16:31 +0200)]
ALSA: hda - Fix typos in patch_hdmi.c

... which was introduced by the previous commit a4e9a38b, causing
build errors without CONFIG_PROC_FS.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - add codec ID for Valleyview2 display codec
Mengdong Lin [Mon, 21 Oct 2013 03:03:31 +0000 (23:03 -0400)]
ALSA: hda - add codec ID for Valleyview2 display codec

This patch adds codec ID (0x80862882) and module alias for
Valleyview2 display codec.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: dice: restrict the driver to playback-only devices
Clemens Ladisch [Tue, 15 Oct 2013 18:26:05 +0000 (20:26 +0200)]
ALSA: dice: restrict the driver to playback-only devices

At the moment, this driver supports only playback, while FFADO supports
(only) full-duplex devices.  So, prevent conflicts by not claiming
devices that would be better handled by FFADO.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: fix detection of Weiss devices
Clemens Ladisch [Mon, 13 Feb 2012 20:55:13 +0000 (21:55 +0100)]
ALSA: dice: fix detection of Weiss devices

While most DICE devices keep TCAT's default category ID of 0x04, Weiss
devices identify themselves with 0x00.

Reported-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: dice_proc_read: remove wrong typecast
Clemens Ladisch [Sun, 22 Jan 2012 15:46:23 +0000 (16:46 +0100)]
ALSA: dice: dice_proc_read: remove wrong typecast

Remove a wrong typecast that resulted from a copy-and-paste error.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: document quadlet alignment
Clemens Ladisch [Sun, 8 Jan 2012 21:18:00 +0000 (22:18 +0100)]
ALSA: dice: document quadlet alignment

Doing accesses without quadlet alignment is a bad idea because the
firmware's byte-swapping would garble the data; clarify this in the
documentation.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: add a proc file to show device information
Clemens Ladisch [Thu, 5 Jan 2012 21:36:08 +0000 (22:36 +0100)]
ALSA: dice: add a proc file to show device information

For easier debugging, add a proc file to show the device's capabilities
and current status.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: check clock change timeout
Clemens Ladisch [Thu, 5 Jan 2012 21:16:24 +0000 (22:16 +0100)]
ALSA: dice: check clock change timeout

Output a warning if the wait for the clock change notification times
out.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: dynamic sample rate selection
Clemens Ladisch [Sun, 4 Dec 2011 21:07:01 +0000 (22:07 +0100)]
ALSA: dice: dynamic sample rate selection

Instead of relying of some control panel application to configure some
fixed sample rate, allow applications to set it automatically.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: get rate-dependent parameters
Clemens Ladisch [Sun, 4 Dec 2011 21:23:59 +0000 (22:23 +0100)]
ALSA: dice: get rate-dependent parameters

In preparation for sample rate selection support, read the stream
parameters that might change when running at different sample rates.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: allow notifications during initialization
Clemens Ladisch [Mon, 5 Dec 2011 21:09:42 +0000 (22:09 +0100)]
ALSA: dice: allow notifications during initialization

Reorganize the initialization order so that the driver can receive
notifications earlier.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: get clock capabilities
Clemens Ladisch [Sun, 4 Dec 2011 20:47:00 +0000 (21:47 +0100)]
ALSA: dice: get clock capabilities

In preparation for sample rate selection support, ensure that the driver
knows about the device's clock capabilities.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: make amdtp_rates[] const
Clemens Ladisch [Sun, 16 Oct 2011 19:39:00 +0000 (21:39 +0200)]
ALSA: dice: make amdtp_rates[] const

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: fix locking
Stefan Richter [Sat, 27 Aug 2011 18:05:15 +0000 (20:05 +0200)]
ALSA: dice: fix locking

Avoid a lock inversion between dice->mutex and pcm->open_mutex.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: remove superfluous field
Clemens Ladisch [Tue, 11 Oct 2011 15:51:16 +0000 (17:51 +0200)]
ALSA: dice: remove superfluous field

The pcm field was not actually used.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: remove 10s period length limit
Clemens Ladisch [Sun, 4 Sep 2011 20:17:51 +0000 (22:17 +0200)]
ALSA: dice: remove 10s period length limit

Since commit f2b3614cefb6 (Don't check DMA time-out too shortly), we
need no longer to restrict the period length to less than 10 s.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: avoid superflous write at bus reset
Clemens Ladisch [Sun, 4 Sep 2011 20:17:45 +0000 (22:17 +0200)]
ALSA: dice: avoid superflous write at bus reset

When a bus reset happens, the enable register is automatically cleared,
so we do not need to clear it manually when stopping the stream.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: firewire: extend snd_fw_transaction()
Clemens Ladisch [Sun, 4 Sep 2011 20:17:38 +0000 (22:17 +0200)]
ALSA: firewire: extend snd_fw_transaction()

Add a flag to snd_fw_transaction() to allow it to abort when a bus reset
happens.  This removes most of the duplicated error handling loops that
were required around calls to the low-level fw_run_transaction().

Also add a flag to suppress error messages; errors are expected when we
attempt to clean up after the device was unplugged.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: optimize reading of consecutive registers
Clemens Ladisch [Sun, 4 Sep 2011 20:17:31 +0000 (22:17 +0200)]
ALSA: dice: optimize reading of consecutive registers

Instead of reading two consecutive register with two quadlet requests,
use one block read request.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: support dual-wire stream format at 192 kHz
Clemens Ladisch [Sun, 4 Sep 2011 20:16:10 +0000 (22:16 +0200)]
ALSA: dice: support dual-wire stream format at 192 kHz

Change the AMDTP streaming code to handle the non-standard stream format
that DICE devices use at sample rates greater than 96 kHz.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: fix device detection for other vendors
Clemens Ladisch [Sun, 4 Sep 2011 20:16:02 +0000 (22:16 +0200)]
ALSA: dice: fix device detection for other vendors

DICE devices do not have a unique specifier ID in their unit directory
(it's always the same as the device vendor's ID), so rely on just the
version ID for driver loading, and use a heuristic in the probe callback
to detect actual DICE devices.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: reorganize interface definitions
Clemens Ladisch [Sun, 4 Sep 2011 20:15:54 +0000 (22:15 +0200)]
ALSA: dice: reorganize interface definitions

Move the DICE interface symbols into a separate header file, and add
more documentation.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: firewire: introduce amdtp_out_stream_running()
Clemens Ladisch [Sun, 4 Sep 2011 20:15:44 +0000 (22:15 +0200)]
ALSA: firewire: introduce amdtp_out_stream_running()

Introduce the helper function amdtp_out_stream_running().  This makes
many checks in amdtp.c clearer and frees the device drivers from having
to track this with a separate variable.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: clear device lock when closing hwdep device
Clemens Ladisch [Sun, 4 Sep 2011 20:14:54 +0000 (22:14 +0200)]
ALSA: dice: clear device lock when closing hwdep device

Ensure that misbehaving or aborted userspace programs do not
accidentally keep the lock.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: implement hwdep device
Clemens Ladisch [Sun, 4 Sep 2011 20:14:15 +0000 (22:14 +0200)]
ALSA: dice: implement hwdep device

Implement the hwdep locking and notification mechanisms.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: fix hang when unplugging a running device
Clemens Ladisch [Sun, 4 Sep 2011 20:13:09 +0000 (22:13 +0200)]
ALSA: dice: fix hang when unplugging a running device

When aborting a PCM stream, the xrun is signaled only if the stream is
running.  When disconnecting a PCM stream, calling snd_card_disconnect()
too early would change the stream into a non-running state and thus
prevent the xrun from being noticed by user space.

To prevent this, move the snd_card_disconnect() call after the xrun.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice, firewire-lib: add blocking mode
Clemens Ladisch [Sun, 4 Sep 2011 20:12:48 +0000 (22:12 +0200)]
ALSA: dice, firewire-lib: add blocking mode

Allow AMDTP output streams to use blocking mode.

Use it for DICE devices, because the old DICE-II chip will in some cases
not be able to lock to non-blocking streams (erratum E7).

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: reduce noisy logging
Clemens Ladisch [Sun, 4 Sep 2011 20:12:20 +0000 (22:12 +0200)]
ALSA: dice: reduce noisy logging

The notification bits are not of general interest; log them only when
debugging.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: allow all sample rates
Clemens Ladisch [Sun, 4 Sep 2011 20:12:06 +0000 (22:12 +0200)]
ALSA: dice: allow all sample rates

Instead of forcing a constant 44.1 kHz, read the current sample rate
from the device when opening the PCM device.

Actually changing the sample rate requires some separate controller
application.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: dice: optimize bus reset handling
Clemens Ladisch [Sun, 4 Sep 2011 20:11:14 +0000 (22:11 +0200)]
ALSA: dice: optimize bus reset handling

After a bus reset, do not stop the stream completely to avoid having to
reconfigure the device when restarting the stream.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: emu10k1: code refactoring
Geyslan G. Bem [Thu, 17 Oct 2013 22:57:12 +0000 (19:57 -0300)]
ALSA: emu10k1: code refactoring

Partially restructures _snd_emu10k1_audigy_init_efx() and
_snd_emu10k1_init_efx() functions.

Be noted that the cast is demanded to use '__user'. So, in these cases,
avoid patches based on the coccinelle 'drop_kmalloc_cast' semantic patch.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: add DICE driver
Clemens Ladisch [Sun, 4 Sep 2011 20:04:49 +0000 (22:04 +0200)]
ALSA: add DICE driver

As a start point for further development, this is an incomplete driver
for DICE devices:
- only playback (so no clock source except the bus clock)
- only 44.1 kHz
- no MIDI
- recovery after bus reset is slow
- hwdep device is created, but not actually implemented

Contains compilation fixes by Stefan Richter.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
11 years agoALSA: hda - Move mutex from hda_eld to per_pin in HDMI codec driver
Takashi Iwai [Thu, 17 Oct 2013 16:21:12 +0000 (18:21 +0200)]
ALSA: hda - Move mutex from hda_eld to per_pin in HDMI codec driver

Since the lock is used primarily in patch_hdmi.c, it's better to move
it in the local struct instead of exporting in hda_eld.  The only
functions requiring the lock in hda_eld.c are proc accessors.  So in
this patch, the proc entry and its creation/deletion/accessors are
moved into patch_hdmi.c, together with the mutex lock to pin_spec
struct.

The former proc info functions are exported so that they can be called
from patch_hdmi.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix possible races in HDMI driver
Takashi Iwai [Thu, 17 Oct 2013 16:03:24 +0000 (18:03 +0200)]
ALSA: hda - Fix possible races in HDMI driver

Some per_pin fields and ELD contents might be changed dynamically in
multiple ways where the concurrent accesses are still opened in the
current code.  This patch fixes such possible races by using eld->lock
in appropriate places.

Reported-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Treat zero connection as non-error
Takashi Iwai [Thu, 17 Oct 2013 15:56:25 +0000 (17:56 +0200)]
ALSA: hda - Treat zero connection as non-error

The zero-length connection list happens so often on Haswell HDMI, and
it results in warning messages like
    ALSA: hda_codec: invalid CONNECT_LIST verb 5[1]:0
at each time the codec resumes from the power-save, which is fairly
annoying.

Since this is no real error, make it shown only in the verbose debug
mode.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - add connection to thinkpad_acpi to control mute/micmute LEDs
David Henningsson [Wed, 16 Oct 2013 21:10:33 +0000 (23:10 +0200)]
ALSA: hda - add connection to thinkpad_acpi to control mute/micmute LEDs

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - add HDA_FIXUP_ACT_FREE action
David Henningsson [Wed, 16 Oct 2013 21:10:32 +0000 (23:10 +0200)]
ALSA: hda - add HDA_FIXUP_ACT_FREE action

A fixup which should be called before codec being freed will come
to use in the next patch.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agothinkpad-acpi: Add mute and mic-mute LED functionality
David Henningsson [Wed, 16 Oct 2013 21:10:31 +0000 (23:10 +0200)]
thinkpad-acpi: Add mute and mic-mute LED functionality

The LEDs are currently not visible to userspace, for security
reasons. They are exported through thinkpad_acpi.h for use by the
snd-hda-intel driver.

Thanks to Alex Hung <alex.hung@canonical.com> and Takashi Iwai
<tiwai@suse.de> for writing parts of this patch.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agosound: Remove unnecessary semicolons
Joe Perches [Tue, 8 Oct 2013 22:55:45 +0000 (15:55 -0700)]
sound: Remove unnecessary semicolons

These aren't necessary after switch and if blocks.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Enable surround speakers (when line out is also present)
David Henningsson [Thu, 10 Oct 2013 07:01:25 +0000 (09:01 +0200)]
ALSA: hda - Enable surround speakers (when line out is also present)

In the case where we have both line out and more than stereo speakers,
the speaker DACs will end up in extra_out_nid.
In fact, AFAIU, speakers are the only ones that can end up in extra_out_nid,
and if we have several of those, they should be surround outputs
rather than copy front.

BugLink: https://bugs.launchpad.net/bugs/1236965
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: Use module_usb_driver
Sachin Kamat [Wed, 9 Oct 2013 11:52:32 +0000 (17:22 +0530)]
ALSA: usb-audio: Use module_usb_driver

module_usb_driver makes code simpler by removing the boilerplate.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Tue, 8 Oct 2013 07:30:04 +0000 (09:30 +0200)]
Merge branch 'for-linus' into for-next

For updating the HDMI chmap fix.

Conflicts:
sound/pci/hda/patch_hdmi.c

11 years agoALSA: hda - hdmi: Fix channel map switch not taking effect
Anssi Hannula [Mon, 7 Oct 2013 16:24:52 +0000 (19:24 +0300)]
ALSA: hda - hdmi: Fix channel map switch not taking effect

Currently hdmi_setup_audio_infoframe() reprograms the HDA channel
mapping only when the infoframe is not up-to-date or the non-PCM flag
has changed.

However, when just the channel map has been changed, the infoframe may
still be up-to-date and non-PCM flag may not have changed, so the new
channel map is not actually programmed into the HDA codec.

Notably, this failing case is also always triggered when the device is
already in a prepared state and a new channel map is configured while
changing only the channel positions (for example, plain
"speaker-test -c2 -m FR,FL").

Fix that by always programming the channel map in
hdmi_setup_audio_infoframe(). Tested on Intel HDMI.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: support wireless devices in snd_usb_parse_datainterval
Thomas Pugliese [Tue, 1 Oct 2013 19:32:57 +0000 (14:32 -0500)]
ALSA: usb-audio: support wireless devices in snd_usb_parse_datainterval

This patch adds support for dev speed USB_SPEED_WIRELESS in
snd_usb_parse_datainterval which allows the usb sound core to create
ISO urbs with the correct number and size of buffers.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: add support for wireless USB devices
Thomas Pugliese [Tue, 1 Oct 2013 19:32:15 +0000 (14:32 -0500)]
ALSA: usb-audio: add support for wireless USB devices

This patch updates snd_usb_audio_create also support devices whose
speed == USB_SPEED_WIRELESS.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Tweak debug messages to be more useful
Anssi Hannula [Fri, 4 Oct 2013 23:25:44 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Tweak debug messages to be more useful

Allow channel map debugging for both automatic and manual channel maps,
and print CA always when updating infoframe.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Fix available channel maps missing from TLV
Anssi Hannula [Fri, 4 Oct 2013 23:25:43 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Fix available channel maps missing from TLV

Currently the available channel maps TLV only contains channel maps that
are limited to the traditional 7.1 speakers.

Since the other HDMI channel mapping functions have been fixed to
properly handle all CEA-861-E specified speakers, allow them to be
listed.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Fix channel maps with less common speakers
Anssi Hannula [Fri, 4 Oct 2013 23:25:42 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Fix channel maps with less common speakers

For some speakers and slots the CEA slot <-> speaker assignment depends
on the used CEA Channel Allocation value.

Therefore the from_cea_slot() and to_cea_slot() helpers currently only
work correctly for the regular 7.1 speakers.

Fix them to work with all speakers, taking the re-ordered CA index as
input and adapting use sites accordingly.

This change allows manual channel mapping to actually work for all CEA
allocated speakers. Additionally, this fixes incorrect channel map
reporting in automatic channel mapping mode when an affected speaker
position is used (e.g. 6.1 map which contains an RC speaker).

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Fix unused slots being enabled in manual and non-PCM mappings
Anssi Hannula [Fri, 4 Oct 2013 23:25:41 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Fix unused slots being enabled in manual and non-PCM mappings

hdmi_manual_setup_channel_mapping() and hdmi_std_setup_channel_mapping
try to assign ALSA channels to HDMI channel slots and disable (i.e.
silence) other slots.

However, they try to disable a slot by using AC_VERB_SET_CHAN_SLOT with
parameter ((alsa_ch << 8) | 0xf), while the correct parameter is
((0xf << 8) | hdmi_slot), i.e. the slot should be unassigned, not the
ALSA channel.

Fix that by actually disabling the unused slots.

Note that this bug did not cause any (reported) issues because slots
incorrectly having audio are normally ignored by a receiver if the CEA
channel allocation used does not map that slot to any speaker.
Additionally, the converter channel count configuration limits the
number of actually active channels in any case.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Fix programmed active channel count
Anssi Hannula [Fri, 4 Oct 2013 23:25:40 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Fix programmed active channel count

Currently the converter channel count is set to the number of actual
input channels. The audio infoframe channel count field is set
similarly.

However, sometimes the used channel map does not map all input channels
to outputs. Notably, 3 channel modes (e.g. 2.1) require a dummy input
channel so there are 4 input channels. According to the HDA
specification, converter channel count should be programmed according to
the number of _active_ channels.

On Intel HDMI codecs (but not on NVIDIA), setting the converter channel
to a higher value than there are actually mapped channels to HDMI slots
will cause no audio to be output at all.

Note that the effects of this issue are currently partially masked by
other bugs that prevent the driver from actually unmapping channels in
certain cases. For example, if a 4 channel stream is first created and
prepared, it gets a FL,FR,RL,RR mapping (ALSA->HDMI slot mapping 0->0,
1->1, 2->4, 3->5). If one thereafter assigns a FR,FL,FC mapping to it,
the driver will remap 2->3 but fail to unmap 2->4 and 3->5, so there are
still 4 active channels and the issue will not trigger in this case.
These bugs will be fixed separately.

Fix the channel counts in the converter channel count field and in the
audio infoframe channel count field to match the actual number of active
channels.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Fix incorrect default channel mapping for unusual CAs
Anssi Hannula [Fri, 4 Oct 2013 23:25:39 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Fix incorrect default channel mapping for unusual CAs

hdmi_std_setup_channel_mapping() selects a Channel Allocation according
to the sink reported speaker mask, preferring the ALSA standard layouts.

If the channel allocation is not one of the ALSA standard layouts, the
ALSA channels are mapped directly to HDMI channels in order. However,
the function does not take into account that there a holes in the HDMI
channel map.

Additionally, the function tries to disable a slot by using
AC_VERB_SET_CHAN_SLOT with parameter ((alsa_ch << 8) | 0xf), while the
correct parameter is ((0xf << 8) | hdmi_slot), i.e. the slot should be
unassigned, not the ALSA channel.

Fix both of the issues for non-ALSA-default layouts.

Tested on Intel HDMI with a speaker mask of FL | FR | FC | RC, which
causes CA 0x06 to be selected for 4-channel audio, which causes
incorrect output (sound destined to RC goes to FC and FC goes nowhere)
without the patch.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - hdmi: Fix reported channel map on common default layouts
Anssi Hannula [Fri, 4 Oct 2013 23:25:38 +0000 (02:25 +0300)]
ALSA: hda - hdmi: Fix reported channel map on common default layouts

hdmi_setup_fake_chmap() is supposed to set the reported channel map when
the channel map is not specified by the user.

However, the function indexes channel_allocations[] with a wrong value
and extracts the wrong nibble from hdmi_channel_mapping[], causing wrong
channel maps to be shown.

Fix those issues.

Tested on Intel HDMI to correctly generate various channel maps, for
example 3,4,14,15,7,8,5,6 (instead of incorrect 3,4,8,7,5,6,14,0) for
standard 7.1 channel audio. (Note that the side and rear channels are
reported as RL/RR and RLC/RRC, respectively, as per the CEA-861
standard, instead of the more traditional SL/SR and RL/RR.)

Note that this only fixes the layouts that only contain traditional 7.1
speakers (2.0, 2.1, 4.0, 5.1, 7.1, etc.). E.g. the rear center of 6.1
is still being shown wrongly due to an issue with from_cea_slot()
which will be fixed in a later patch.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: remove unused endpoint flag EP_FLAG_ACTIVATED
Eldad Zack [Sun, 6 Oct 2013 20:31:17 +0000 (22:31 +0200)]
ALSA: usb-audio: remove unused endpoint flag EP_FLAG_ACTIVATED

EP_FLAG_ACTIVATED is never tested for, remove it.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: rename alt_idx to altsetting
Eldad Zack [Sun, 6 Oct 2013 20:31:13 +0000 (22:31 +0200)]
ALSA: usb-audio: rename alt_idx to altsetting

As Clemens Ladisch kindly explained:
 "Please note that there are two methods to identify alternate settings:
  the number, which is the value in bAlternateSetting, and the index,
  which is the index in the descriptor array.  There might be some wording
  in the USB spec that these two values must be the same, but in reality,
  [insert standard rant about firmware writers], bAlternateSetting
  must be treated as a random ID value."

This patch changes the name to express the correct usage semantics.
No functional change.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: clear SUBSTREAM_FLAG_SYNC_EP_STARTED on error
Eldad Zack [Sun, 6 Oct 2013 20:31:11 +0000 (22:31 +0200)]
ALSA: usb-audio: clear SUBSTREAM_FLAG_SYNC_EP_STARTED on error

If setting the interface fails, the SUBSTREAM_FLAG_SYNC_EP_STARTED
should be cleared.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: void return type of snd_usb_endpoint_deactivate()
Eldad Zack [Sun, 6 Oct 2013 20:31:10 +0000 (22:31 +0200)]
ALSA: usb-audio: void return type of snd_usb_endpoint_deactivate()

The return value of snd_usb_endpoint_deactivate() is not used,
make the function have no return value.
Update the documentation to reflect what the function is actually
doing.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: don't deactivate URBs on in-use EP
Eldad Zack [Sun, 6 Oct 2013 20:31:09 +0000 (22:31 +0200)]
ALSA: usb-audio: don't deactivate URBs on in-use EP

If an endpoint in use, its associated URBs should not be
deactivated.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: remove deactivate_endpoints()
Eldad Zack [Sun, 6 Oct 2013 20:31:07 +0000 (22:31 +0200)]
ALSA: usb-audio: remove deactivate_endpoints()

The only call site for deactivate_endpoints() at snd_usb_hw_free().
The return value is not checked there, as it is irrelevant if it
fails on hw_free.
This patch moves the deactivation of the endpoints directly into
snd_usb_hw_free().

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: usb-audio: remove unused parameter from sync_ep_set_params
Eldad Zack [Sun, 6 Oct 2013 20:31:06 +0000 (22:31 +0200)]
ALSA: usb-audio: remove unused parameter from sync_ep_set_params

Since the format is not actually used in sync_ep_set_params(),
there is no need to pass it down.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix mono speakers and headset mic on Dell Vostro 5470
David Henningsson [Mon, 7 Oct 2013 08:39:59 +0000 (10:39 +0200)]
ALSA: hda - Fix mono speakers and headset mic on Dell Vostro 5470

On this machine, DAC on node 0x03 seems to give mono output.

Also, it needs additional patches for headset mic support.
It supports CTIA style headsets only.

Alsa-info available at the bug link below.

Cc: stable@kernel.org (v3.10+)
BugLink: https://bugs.launchpad.net/bugs/1236228
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: snd-usb-usx2y: remove bogus frame checks
Daniel Mack [Wed, 2 Oct 2013 15:49:50 +0000 (17:49 +0200)]
ALSA: snd-usb-usx2y: remove bogus frame checks

The frame check in i_usX2Y_urb_complete() and
i_usX2Y_usbpcm_urb_complete() is bogus and produces false positives as
described in this LAU thread:

  http://linuxaudio.org/mailarchive/lau/2013/5/20/200177

This patch removes the check code entirely.

Cc: fzu@wemgehoertderstaat.de
Reported-by: Dr Nicholas J Bailey <nicholas.bailey@glasgow.ac.uk>
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix GPIO for Acer Aspire 3830TG
Takashi Iwai [Mon, 30 Sep 2013 10:13:44 +0000 (12:13 +0200)]
ALSA: hda - Fix GPIO for Acer Aspire 3830TG

Acer Aspire 3830TG seems requiring GPIO bit 0 as the primary mute
control.  When a machine is booted after Windows 8, the GPIO pin is
turned off and it results in the silent output.

This patch adds the manual fixup of GPIO bit 0 for this model.

Reported-by: Christopher <DIDI2002@web.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: snd-usb-caiaq: LED support for Maschine Controller
Hannes Gräuler [Sat, 28 Sep 2013 19:51:08 +0000 (21:51 +0200)]
ALSA: snd-usb-caiaq: LED support for Maschine Controller

This patch adds LED support for the Native Instruments Maschine
Controller. It adds ALSA controls for dimming the LEDs of all
buttons and the backlight of the two displays.

Signed-off-by: Hannes Gräuler <hgraeule@uos.de>
Acked-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: ac97: Add ID for TI TLV320AIC27 codec
Ondrej Zary [Fri, 27 Sep 2013 18:27:58 +0000 (20:27 +0200)]
ALSA: ac97: Add ID for TI TLV320AIC27 codec

Add 0x54584e03 ID for TI TLV320AIC27 AC'97 codec according to datasheet:
http://www.ti.com/lit/ds/slas253a/slas253a.pdf

The weird thing is that the chip is physically marked 320AD91.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge tag 'asoc-v3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Mon, 30 Sep 2013 08:49:45 +0000 (10:49 +0200)]
Merge tag 'asoc-v3.12-rc2' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v3.12

Nothing too exciting here, all driver specific except for the fix from
Liam for DPCM systems which have both front and back end DAIs which is
not yet used by anything in mainline.

11 years agoMerge remote-tracking branch 'asoc/fix/max98095' into asoc-linus
Mark Brown [Fri, 27 Sep 2013 13:56:24 +0000 (14:56 +0100)]
Merge remote-tracking branch 'asoc/fix/max98095' into asoc-linus

11 years agoMerge remote-tracking branch 'asoc/fix/fsl' into asoc-linus
Mark Brown [Fri, 27 Sep 2013 13:56:23 +0000 (14:56 +0100)]
Merge remote-tracking branch 'asoc/fix/fsl' into asoc-linus

11 years agoMerge remote-tracking branch 'asoc/fix/core' into asoc-linus
Mark Brown [Fri, 27 Sep 2013 13:56:22 +0000 (14:56 +0100)]
Merge remote-tracking branch 'asoc/fix/core' into asoc-linus

11 years agoMerge remote-tracking branch 'asoc/fix/bfin' into asoc-linus
Mark Brown [Fri, 27 Sep 2013 13:56:21 +0000 (14:56 +0100)]
Merge remote-tracking branch 'asoc/fix/bfin' into asoc-linus

11 years agoMerge remote-tracking branch 'asoc/fix/ab8500' into asoc-linus
Mark Brown [Fri, 27 Sep 2013 13:56:20 +0000 (14:56 +0100)]
Merge remote-tracking branch 'asoc/fix/ab8500' into asoc-linus

11 years agoMerge remote-tracking branch 'asoc/fix/88pm860x' into asoc-linus
Mark Brown [Fri, 27 Sep 2013 13:56:19 +0000 (14:56 +0100)]
Merge remote-tracking branch 'asoc/fix/88pm860x' into asoc-linus

11 years agoALSA: hda - Enable internal mic on a Thinkpad machine with ALC283
Kailang Yang [Fri, 27 Sep 2013 11:10:25 +0000 (13:10 +0200)]
ALSA: hda - Enable internal mic on a Thinkpad machine with ALC283

More thorough testing showed that these verbs were necessary to
improve quality of the internal mic. Patch originally from Realtek.

BugLink: https://bugs.launchpad.net/bugs/1231931
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Fix Internal Mic boost can't control with ALC283
Kailang Yang [Fri, 27 Sep 2013 12:02:28 +0000 (14:02 +0200)]
ALSA: hda - Fix Internal Mic boost can't control with ALC283

ALC283 pin control for Line1 default control by hidden register.
Use line1 as internal Mic will not get sound when boost value up.
Set control by verb for hidden register will solve this issue.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add documentation for CS4208 fixups
Takashi Iwai [Fri, 27 Sep 2013 08:19:31 +0000 (10:19 +0200)]
ALSA: hda - Add documentation for CS4208 fixups

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda - Add fixup for MacBook Air 6,1 and 6,2 with CS4208 codec
Ben Whitten [Fri, 27 Sep 2013 08:13:51 +0000 (10:13 +0200)]
ALSA: hda - Add fixup for MacBook Air 6,1 and 6,2 with CS4208 codec

This patch adds the default pin configuration and some init verbs for
setting COEFs, in addition to the correction of input pin AMP caps
for MacBook Air 6,1 and 6,2.  With these changes, the headphone jack
detection starts working properly.

[trivial space fixes by tiwai]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=60811
Signed-off-by: Ben Whitten <benwhitten@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoASoC: imx-sgtl5000: Fix uninitialized pointer use in error path
Philipp Zabel [Wed, 25 Sep 2013 13:22:01 +0000 (15:22 +0200)]
ASoC: imx-sgtl5000: Fix uninitialized pointer use in error path

This patch avoids to dereference the uninitialized data pointer if the
error path is entered before devm_kzalloc is called (or if the allocation
fails). It fixes the following warning:

    sound/soc/fsl/imx-sgtl5000.c: In function 'imx_sgtl5000_probe':
    sound/soc/fsl/imx-sgtl5000.c:175:18: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
11 years agoASoC: imx-sgtl5000: do not use devres on a foreign device
Philipp Zabel [Wed, 25 Sep 2013 13:21:08 +0000 (15:21 +0200)]
ASoC: imx-sgtl5000: do not use devres on a foreign device

Calling devm_clk_get with any device pointer other than our own confuses
devres. Use clk_get instead. This avoids hitting the following warning in
the imx-sgtl5000 error path:

imx-sgtl5000 sound.12: snd_soc_register_card failed (-517)
platform sound.12: Driver imx-sgtl5000 requests probe deferral
------------[ cut here ]------------
WARNING: CPU: 0 PID: 75 at drivers/base/dd.c:272 driver_probe_device+0x194/0x218()
Modules linked in: snd_soc_sgtl5000(+) snd_soc_imx_sgtl5000 coda snd_soc_imx_audmux imx_sdma snd_soc_fsl_spdif snd_soc_fsl_ssi
CPU: 0 PID: 75 Comm: udevd Not tainted 3.11.0-rc6+ #4682
Backtrace:
[<80010bc4>] (dump_backtrace+0x0/0x10c) from [<80010d60>] (show_stack+0x18/0x1c)
 r6:00000110 r5:00000009 r4:00000000 r3:00000000
[<80010d48>] (show_stack+0x0/0x1c) from [<804f0764>] (dump_stack+0x20/0x28)
[<804f0744>] (dump_stack+0x0/0x28) from [<8001a4a4>] (warn_slowpath_common+0x6c/0x8c)
[<8001a438>] (warn_slowpath_common+0x0/0x8c) from [<8001a4e8>] (warn_slowpath_null+0x24/0x2c)
 r8:7f032000 r7:7f02f93c r6:cf8eaa54 r5:cf8eaa20 r4:80728a0c
[<8001a4c4>] (warn_slowpath_null+0x0/0x2c) from [<80286bdc>] (driver_probe_device+0x194/0x218)
[<80286a48>] (driver_probe_device+0x0/0x218) from [<80286cf4>] (__driver_attach+0x94/0x98)
 r7:00000000 r6:cf8eaa54 r5:7f02f93c r4:cf8eaa20
[<80286c60>] (__driver_attach+0x0/0x98) from [<802851c8>] (bus_for_each_dev+0x5c/0x90)
 r6:80286c60 r5:7f02f93c r4:00000000 r3:cf8ef03c
[<8028516c>] (bus_for_each_dev+0x0/0x90) from [<80286654>] (driver_attach+0x24/0x28)
 r6:806d0424 r5:cf16a580 r4:7f02f93c
[<80286630>] (driver_attach+0x0/0x28) from [<802861e4>] (bus_add_driver+0xdc/0x234)
[<80286108>] (bus_add_driver+0x0/0x234) from [<802871d4>] (driver_register+0x80/0x154)
 r8:7f032000 r7:00000001 r6:7f02fa68 r5:7f02fa74 r4:7f02f93c
[<80287154>] (driver_register+0x0/0x154) from [<8033c278>] (i2c_register_driver+0x34/0xbc)
[<8033c244>] (i2c_register_driver+0x0/0xbc) from [<7f032018>] (sgtl5000_i2c_driver_init+0x18/0x24 [snd_soc_sgtl5000])
 r5:7f02fa74 r4:cfb7ff48
[<7f032000>] (sgtl5000_i2c_driver_init+0x0/0x24 [snd_soc_sgtl5000]) from [<80008738>] (do_one_initcall+0xf4/0x150)
[<80008644>] (do_one_initcall+0x0/0x150) from [<80053f64>] (load_module+0x174c/0x1db4)
[<80052818>] (load_module+0x0/0x1db4) from [<800546ac>] (SyS_init_module+0xe0/0xf4)
[<800545cc>] (SyS_init_module+0x0/0xf4) from [<8000e540>] (ret_fast_syscall+0x0/0x30)
 r6:00005b22 r5:00afed68 r4:00000000
---[ end trace b24c5c3bb145dbdd ]---

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
11 years agoALSA: firewire-lib: use inlune function to calculate frame bytes
Takashi Sakamoto [Fri, 13 Sep 2013 15:35:47 +0000 (00:35 +0900)]
ALSA: firewire-lib: use inlune function to calculate frame bytes

Calculating frame bytes can be replaced with inline function in
include/sound/pcm.h.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: improve buffer size computations for USB PCM audio
Alan Stern [Tue, 24 Sep 2013 19:51:58 +0000 (15:51 -0400)]
ALSA: improve buffer size computations for USB PCM audio

This patch changes the way URBs are allocated and their sizes are
determined for PCM playback in the snd-usb-audio driver.  Currently
the driver allocates too few URBs for endpoints that don't use
implicit sync, making underruns more likely to occur.  This may be a
holdover from before I/O delays could be measured accurately; in any
case, it is no longer necessary.

The patch allocates as many URBs as possible, subject to four
limitations:

The total number of URBs for the endpoint is not allowed to
exceed MAX_URBS (which the patch increases from 8 to 12).

The total number of packets per URB is not allowed to exceed
MAX_PACKS (or MAX_PACKS_HS for high-speed devices), which is
decreased from 20 to 6.

The total duration of queued data is not allowed to exceed
MAX_QUEUE, which is decreased from 24 ms to 18 ms.

The total number of ALSA frames in the output queue is not
allowed to exceed the ALSA buffer size.

The last requirement is the hardest to implement.  Currently the
number of URBs needed to fill a buffer cannot be determined in
advance, because a buffer contains a fixed number of frames whereas
the number of frames in an URB varies to match shifts in the device's
clock rate.  To solve this problem, the patch changes the logic for
deciding how many packets an URB should contain.  Rather than using as
many as possible without exceeding an ALSA period boundary, now the
driver uses only as many packets as needed to transfer a predetermined
number of frames.  As a result, unless the device's clock has an
exceedingly variable rate, the number of URBs making up each period
(and hence each buffer) will remain constant.

The overall effect of the patch is that playback works better in
low-latency settings.  The user can still specify values for
frames/period and periods/buffer that exceed the capabilities of the
hardware, of course.  But for values that are within those
capabilities, the performance will be improved.  For example, testing
shows that a high-speed device can handle 32 frames/period and 3
periods/buffer at 48 KHz, whereas the current driver starts to get
glitchy at 64 frames/period and 2 periods/buffer.

A side effect of these changes is that the "nrpacks" module parameter
is no longer used.  The patch removes it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Daniel Mack <zonque@gmail.com>
Tested-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Thu, 26 Sep 2013 08:23:31 +0000 (10:23 +0200)]
Merge branch 'for-linus' into for-next

* for-linus:
  ALSA : hda - not use assigned converters for all unused pins
  ALSA: compress: Make sure we trigger STOP before closing the stream.

11 years agoALSA : hda - not use assigned converters for all unused pins
Mengdong Lin [Sun, 22 Sep 2013 00:34:45 +0000 (20:34 -0400)]
ALSA : hda - not use assigned converters for all unused pins

BIOS can mark a pin as "no physical connection" if the port is used by an
integrated display which is not audio capable. And audio driver will overlook
such pins.

On Haswell, such a disconneted pin will keep muted and connected to the 1st
converter by default. But if the 1st convertor is assigned to a connected pin
for audio streaming. The muted disconnected pin can make the connected pin
no sound output.

So this patch avoids using assigned converters for all unused pins for Haswell,
including the disconected pins.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Reviewed-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: Fix assignment of 0/1 to bool variables
Peter Senna Tschudin [Sun, 22 Sep 2013 18:44:12 +0000 (20:44 +0200)]
ALSA: Fix assignment of 0/1 to bool variables

Convert 0 to false and 1 to true when assigning values to bool
variables. Inspired by commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2.

The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):

@@
bool b;
@@
(
-b = 0
+b = false
|
-b = 1
+b = true
)

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: compress: Make sure we trigger STOP before closing the stream.
Liam Girdwood [Fri, 13 Sep 2013 16:43:16 +0000 (17:43 +0100)]
ALSA: compress: Make sure we trigger STOP before closing the stream.

Currently we assume that userspace will shut down the compressed stream
correctly. However, if userspcae dies (e.g. cplay & ctrl-C) we dont
stop the stream before freeing it.

This now checks that the stream is stopped before freeing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoLinux 3.12-rc2
Linus Torvalds [Mon, 23 Sep 2013 22:41:09 +0000 (15:41 -0700)]
Linux 3.12-rc2

11 years agoMerge tag 'staging-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Mon, 23 Sep 2013 19:53:07 +0000 (12:53 -0700)]
Merge tag 'staging-3.12-rc2' of git://git./linux/kernel/git/gregkh/staging

Pull staging fixes from Greg KH:
 "Here are a number of small staging tree and iio driver fixes.  Nothing
  major, just lots of little things"

* tag 'staging-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (34 commits)
  iio:buffer_cb: Add missing iio_buffer_init()
  iio: Prevent race between IIO chardev opening and IIO device free
  iio: fix: Keep a reference to the IIO device for open file descriptors
  iio: Stop sampling when the device is removed
  iio: Fix crash when scan_bytes is computed with active_scan_mask == NULL
  iio: Fix mcp4725 dev-to-indio_dev conversion in suspend/resume
  iio: Fix bma180 dev-to-indio_dev conversion in suspend/resume
  iio: Fix tmp006 dev-to-indio_dev conversion in suspend/resume
  iio: iio_device_add_event_sysfs() bugfix
  staging: iio: ade7854-spi: Fix return value
  staging:iio:hmc5843: Fix measurement conversion
  iio: isl29018: Fix uninitialized value
  staging:iio:dummy fix kfifo_buf kconfig dependency issue if kfifo modular and buffer enabled for built in dummy driver.
  iio: at91: fix adc_clk overflow
  staging: line6: add bounds check in snd_toneport_source_put()
  Staging: comedi: Fix dependencies for drivers misclassified as PCI
  staging: r8188eu: Adjust RX gain
  staging: r8188eu: Fix smatch warning in core/rtw_ieee80211.
  staging: r8188eu: Fix smatch error in core/rtw_mlme_ext.c
  staging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c
  ...

11 years agoMerge tag 'usb-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Mon, 23 Sep 2013 19:52:35 +0000 (12:52 -0700)]
Merge tag 'usb-3.12-rc2' of git://git./linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are a number of small USB fixes for 3.12-rc2.

  One is a revert of a EHCI change that isn't quite ready for 3.12.
  Others are minor things, gadget fixes, Kconfig fixes, and some quirks
  and documentation updates.

  All have been in linux-next for a bit"

* tag 'usb-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: pl2303: distinguish between original and cloned HX chips
  USB: Faraday fotg210: fix email addresses
  USB: fix typo in usb serial simple driver Kconfig
  Revert "USB: EHCI: support running URB giveback in tasklet context"
  usb: s3c-hsotg: do not disconnect gadget when receiving ErlySusp intr
  usb: s3c-hsotg: fix unregistration function
  usb: gadget: f_mass_storage: reset endpoint driver data when disabled
  usb: host: fsl-mph-dr-of: Staticize local symbols
  usb: gadget: f_eem: Staticize eem_alloc
  usb: gadget: f_ecm: Staticize ecm_alloc
  usb: phy: omap-usb3: Fix return value
  usb: dwc3: gadget: avoid memory leak when failing to allocate all eps
  usb: dwc3: remove extcon dependency
  usb: gadget: add '__ref' for rndis_config_register() and cdc_config_register()
  usb: dwc3: pci: add support for BayTrail
  usb: gadget: cdc2: fix conversion to new interface of f_ecm
  usb: gadget: fix a bug and a WARN_ON in dummy-hcd
  usb: gadget: mv_u3d_core: fix violation of locking discipline in mv_u3d_ep_disable()

11 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Mon, 23 Sep 2013 02:51:49 +0000 (19:51 -0700)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 - some small fixes for msm and exynos
 - a regression revert affecting nouveau users with old userspace
 - intel pageflip deadlock and gpu hang fixes, hsw modesetting hangs

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (22 commits)
  Revert "drm: mark context support as a legacy subsystem"
  drm/i915: Don't enable the cursor on a disable pipe
  drm/i915: do not update cursor in crtc mode set
  drm/exynos: fix return value check in lowlevel_buffer_allocate()
  drm/exynos: Fix address space warnings in exynos_drm_fbdev.c
  drm/exynos: Fix address space warning in exynos_drm_buf.c
  drm/exynos: Remove redundant OF dependency
  drm/msm: drop unnecessary set_need_resched()
  drm/i915: kill set_need_resched
  drm/msm: fix potential NULL pointer dereference
  drm/i915/dvo: set crtc timings again for panel fixed modes
  drm/i915/sdvo: Robustify the dtd<->drm_mode conversions
  drm/msm: workaround for missing irq
  drm/msm: return -EBUSY if bo still active
  drm/msm: fix return value check in ERR_PTR()
  drm/msm: fix cmdstream size check
  drm/msm: hangcheck harder
  drm/msm: handle read vs write fences
  drm/i915/sdvo: Fully translate sync flags in the dtd->mode conversion
  drm/i915: Use proper print format for debug prints
  ...

11 years agoMerge branch 'for-3.12/core' of git://git.kernel.dk/linux-block
Linus Torvalds [Sun, 22 Sep 2013 22:00:11 +0000 (15:00 -0700)]
Merge branch 'for-3.12/core' of git://git.kernel.dk/linux-block

Pull block IO fixes from Jens Axboe:
 "After merge window, no new stuff this time only a collection of neatly
  confined and simple fixes"

* 'for-3.12/core' of git://git.kernel.dk/linux-block:
  cfq: explicitly use 64bit divide operation for 64bit arguments
  block: Add nr_bios to block_rq_remap tracepoint
  If the queue is dying then we only call the rq->end_io callout. This leaves bios setup on the request, because the caller assumes when the blk_execute_rq_nowait/blk_execute_rq call has completed that the rq->bios have been cleaned up.
  bio-integrity: Fix use of bs->bio_integrity_pool after free
  blkcg: relocate root_blkg setting and clearing
  block: Convert kmalloc_node(...GFP_ZERO...) to kzalloc_node(...)
  block: trace all devices plug operation