summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-09-15 16:32:31 +0200
committerTakashi Iwai <tiwai@suse.de>2012-09-15 16:32:31 +0200
commite5d6db8e6039d7f51a9a648d74db1109c7fdc746 (patch)
tree1f8ec13b6bda70fdf6c607a86d02c3e974e4c469 /sound/pci/hda/hda_codec.c
parent62cbde1868b16e7cf1ed115cdfb9cbe82e230f0a (diff)
parent5efbc2610a7b2aac6c51f8fc943c019106568939 (diff)
downloadop-kernel-dev-e5d6db8e6039d7f51a9a648d74db1109c7fdc746.zip
op-kernel-dev-e5d6db8e6039d7f51a9a648d74db1109c7fdc746.tar.gz
Merge branch 'topic/tlv-chmap' into for-next
This is a merge of a topic branch containing the support for the new channel map API using control elements.
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d71d101..960800b 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3688,6 +3688,36 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus)
}
EXPORT_SYMBOL_HDA(snd_hda_build_controls);
+/*
+ * add standard channel maps if not specified
+ */
+static int add_std_chmaps(struct hda_codec *codec)
+{
+ int i, str, err;
+
+ for (i = 0; i < codec->num_pcms; i++) {
+ for (str = 0; str < 2; str++) {
+ struct snd_pcm *pcm = codec->pcm_info[i].pcm;
+ struct hda_pcm_stream *hinfo =
+ &codec->pcm_info[i].stream[str];
+ struct snd_pcm_chmap *chmap;
+
+ if (codec->pcm_info[i].own_chmap)
+ continue;
+ if (!pcm || !hinfo->substreams)
+ continue;
+ err = snd_pcm_add_chmap_ctls(pcm, str,
+ snd_pcm_std_chmaps,
+ hinfo->channels_max,
+ 0, &chmap);
+ if (err < 0)
+ return err;
+ chmap->channel_mask = SND_PCM_CHMAP_MASK_2468;
+ }
+ }
+ return 0;
+}
+
int snd_hda_codec_build_controls(struct hda_codec *codec)
{
int err = 0;
@@ -3699,6 +3729,12 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
err = codec->patch_ops.build_controls(codec);
if (err < 0)
return err;
+
+ /* we create chmaps here instead of build_pcms */
+ err = add_std_chmaps(codec);
+ if (err < 0)
+ return err;
+
snd_hda_jack_report_sync(codec); /* call at the last init point */
return 0;
}
OpenPOWER on IntegriCloud