ALSA: hda - Add codec->pcm_format_first flag

Introduced a new flag to set up the PCM stream format at first before
the stream_id and channel tag.  Some codecs (e.g. CA0132) seem
preferring this over stream_id -> format order.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Fix superfluous "-in" suffix from CA0132 capture items

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Use the standard PCM ops for CA0132

Now with the workaround using codec->pcm_format_first flag, we can
clean up the home-baked codes in patch_ca0132.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Add missing SPDIF I/O setup for CA0132

CA0132 driver had some codes to handle the S/PDIF I/O, but the actual
setups of pins and converters were missing.  Now the pins are added.

Also, fixed a few points triggering invalid codec verbs and mixer
elements since the digital I/O audio widgets on CA0132 have no amp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound: oss/sb_audio: prevent divide by zero bug

Speed comes from get_user() in audio_ioctl().  We use it to set the "s"
variable before clamping it to valid values so it could lead to a divide
by zero bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: fix pcm.h kernel-doc warning and notation

Fix kernel-doc warning in <sound/pcm.h> and add function name to make
the kernel-doc notation complete.

Warning(include/sound/pcm.h:1081): No description found for parameter 'substream'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: sound/atmel/abdac.c: fix error return code

Initialize retval before returning from a failed call to ioremap.

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: Takashi Iwai <tiwai@suse.de>
ALSA: sound/atmel/ac97c.c: fix error return code

In the first case, the second test of whether retval is negative is
redundant.  It is dropped and the previous and subsequent tests are
combined.

In the second case, add an initialization of retval on failure of ioremap.

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: Takashi Iwai <tiwai@suse.de>
ALSA: sound/pci/ctxfi/ctatc.c: fix error return code

Initialize err before returning on failure, as done elsewhere in the
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: sound/pci/sis7019.c: fix error return code

Initialize rc before returning on failure, as done elsewhere in the
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: sound/pci/rme9652/hdspm.c: fix error return code

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the 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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: sound/ppc/snd_ps3.c: fix error return code

Initialize ret before returning on failure, as done elsewhere in the
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-linus'
ALSA: snd-ad1816a: remove useless struct snd_card_ad1816a

struct snd_card_ad1816a is only set but the values are never used then.
Removing it allows struct snd_card's private_data to be used for
struct snd_ad1816a, simplifying the code.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: snd-ad1816a: Implement suspend/resume

Implement suspend/resume support for AD1816 chips.
Tested with Terratec SoundSystem Base-1.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-next'
ALSA: hda - Add tracepoints at snd_hda_power_up/down entrances.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - don't create dysfunctional mixer controls for ca0132

It's possible that these amps are settable somehow, e g through
secret codec verbs, but for now, don't create the controls (as
they won't be working anyway, and cause errors in amixer).

Cc: stable@kernel.org
BugLink: https://bugs.launchpad.net/bugs/1038651
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'topic/ca0132-fix' into for-linus

This is a series of fixes for CA0132, especially the missing SPDIF I/O
and the mixer build errors.
Merge branch 'for-linus'