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>
ALSA: Remove VOLATILE flag from chmap ctls

The VOLATILE flag was added to control elements by
snd_pcm_add_chmap_ctls() just because I didn't want to have a
side-effect of "alsactl restore".  But now the set operation doesn't
allow to change the value unless the PCM stream is in PREAPRED state,
there is no reason to keep this flag.  Let's rip it off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Follow channel position definitions to alsa-lib mixer

There is already a set of channel position definitions in alsa-lib
mixer.h, and it'd be more practical to keep the same order for the
PCM channel map, too.  The value is shifted with 1 to keep zero for
UNKNOWN.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Allow 3/5/7 channel map for HDMI/DP

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: pcm - Use UNKNOWN chmap for mono streams

In general, mono streams have no dedicated speaker assignment, thus
they should be rather marked as UNKNOWN position.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ctxfi: Fix mono channel map to UNKNOWN

To follow the previous commit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: ens1370: Reduce ifdefs

... just by defining CHIP_NAME and string concats.

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

Provide channel maps for individual stereo streams of CA0106.

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

Provide channel maps for individual stereo streams of emu10k1x.

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

Provide channel maps for individual stereo streams of ENS1370 and
ENS1371.  Note that the configuration of ENS1370 uses the secondary
PCM as the front unlike ENS1371.

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

Provide channel maps for individual stereo streams of YMFPCI.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Define more channel map positions

For following the standard, define more channel map positions and
shuffle the items a bit:

- As both PulseAudio and gstreamer define MONO channel position
  explicitly, we should follow that, too.  The mono streams point to
  this channel position unless they are explicitly assigned to certain
  channel positions.

- Top-front-* and Top-rear-* positions are added, carried from
  PulseAudio's definitions.

- Move NA and MONO definitions at the top of table right after
  UNKNOWN, since these are more abstract in comparison with other
  practical positions.

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