ASoC: imx-sgtl5000: fix error return code

Initialize ret on the second call to imx_audmux_v2_configure_port so that
the subsequent test checks that result and not the previous one.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: ux500_msp_i2s: better use devm functions and fix error return code

Remove unnecessary calls to devm_kfree and replace iounmap by devm_iounmap
(and use resource_size for the third argument).  These changes make it
possible to remove the error-handling code at the end of
ux500_msp_i2s_init_msp, and all of the gotos become direct returns.

In the case of the second call to devm_kzalloc, the return variable ret was
not initialized.  Here it is changed to a direct return of -ENOMEM.

A simplified version of the semantic match that finds the second problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: am3517evm: fix error return code

It was forgotten to initialize ret to the result of calling
snd_soc_dai_set_sysclk, unlike at the other calls in the same function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: dapm: Make sure we update the bias level for CODECs with no op

Commit 412312 (ASoC: dapm: Make sure all dapm contexts are updated)
ensures that we update non-CODEC DAPM contexts but means that if a
CODEC has no set_bias_level() operation it'll not be updated. Fix
that.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: dapm: Don't force card bias level to be updated

Commit 412312 (ASoC: dapm: Make sure all dapm contexts are updated) means
that any DAPM context being updated will have the bias level automatically
set, including the card. We can't safely do this as the card callbacks are
called for each device context and so the management of the card bias is
more complex. Several multi-component cards rely on this behaviour.

Skip updates during the asynchronous run entirely. We should really do them
in the synchronous section but it's not 100% clear which values to pick as
the different DAPM contexts may have different bias levels.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: atmel-ssc: include linux/io.h for raw io

Include linux/io.h for raw io operations in atmel-scc header.

This fixes the following build error:
  CC [M]  sound/soc/atmel/atmel_ssc_dai.o
sound/soc/atmel/atmel_ssc_dai.c: In function 'atmel_ssc_interrupt':
sound/soc/atmel/atmel_ssc_dai.c:171: error: implicit declaration of function '__raw_readl'
sound/soc/atmel/atmel_ssc_dai.c: In function 'atmel_ssc_shutdown':
sound/soc/atmel/atmel_ssc_dai.c:249: error: implicit declaration of function '__raw_writel'

Signed-off-by: Joachim Eastwood <joachim.eastwood@jotron.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound: tegra_alc5632: remove HP detect GPIO inversion

Both the schematics and practical testing show that the HP detect GPIO
is high when the headphones are plugged in. Hence, the snd_soc_jack_gpio
should not specify to invert the signal.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Andrey Danin <danindrey@mail.ru>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: <stable@vger.kernel.org> # v3.4 v3.5
ASoC: spear: correct the check for NULL dma_buffer pointer

The if condition
	if (!buf && !buf->area)

checks if the buf pointer is NULL and then dereferences it again to
check if the buffer area is NULL, resulting in possible NULL
dereference.

Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: arizona: Fix typo in 44.1kHz rates

Signed-off-by: Heather Lomond <hlomond@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: mc13783: Remove mono support

Playing a mono track on a mc13783 codec results in incorrect playback rate.

Remove mono support so that a mono track can be played correctly.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Gaëtan Carlier <gcembed@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: samsung dma - Don't indicate support for pause/resume.

The pause and resume operations indicate that the stream can be
un-paused/resumed from the exact location they were paused/suspended.
This is not true for this driver, the pause and suspend triggers share
the same code path with stop, they flush all pending DMA transfers.
This drops all pending samples.  The pause_release/resume triggers are
the same as start, except that prepare won't be called beforehand,
nothing will be enqueued to the DMA engine and nothing will happen (no
audio).  Removing the pause flag will let apps know that it isn't
supported.  Removing the resume flag will cause user space to call
prepare and start instead of resume, so audio will continue playing when
the system wakes up.

Before removing the pause and resume flags, I tested this on an exynos
5250, using 'aplay -i'. Pause/un-pause leads to silence followed by a
write error.  Suspend/resume testing led to the same result.  Removing
the two flags fixes suspend/resume (since snd_pcm_prepare is called
again). And leads to a proper reporting of pause not supported.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
ALSA: PCM: channel mapping API implementation

This patch implements the basic data types for the standard channel
mapping API handling.

- The definitions of the channel positions and the new TLV types are
  added in sound/asound.h and sound/tlv.h, so that they can be
  referred from user-space.

- Introduced a new helper function snd_pcm_add_chmap_ctls() to create
  control elements representing the channel maps for each PCM
  (sub)stream.

- Some standard pre-defined channel maps are provided for
  convenience.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Add a documentation for channel mapping API

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Add standard channel maps

Although HD-audio allows pair-wise channel configurations, only the
fixed channel positions are used in this version.  In future, this can
be changed and allow user to modify the channel positions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Provide the proper channel mapping for generic HDMI driver

... instead of the standard fixed channel maps.
The generic HDMI is based on the audio infoframe, and its configuration
can be selected via CA bits.  Thus we need a translation between the
CA index and the verbose channel map list.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Fix channel maps for Nvidia 7x 8ch HDMI codecs

Some old Nvidia HDMI codecs with 8ch support only 2/8 or
2/6/8 channels and with the fixed CLFE-first map.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ac97: Implement channel map workaround for ALC650

ALC650 has a channel swap option between surround and CLFE channels,
so we need to tweak the channel maps dynamically depending on the
register bit.

Now struct snd_ac97 can contain chmap pointers for playback and
capture.  The driver may store these and let ac97 driver changing the
channel mapping dynamically.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Implement channel maps for standard onboard AC97 drivers

Just set the channel maps depending on the hardware availability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: cmipci: Implement channel mapping

Simply enable the channel map according to the h/w capability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ctxfi: Implement channel maps

Assign the multi-channel map to front PCM, and other channel map to
each other channel PCM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>