aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-07-31 05:35:35 -0400
committerTakashi Iwai <tiwai@suse.de>2012-09-06 12:01:18 -0400
commit9c9a5175e65b2667001e6a3b6dedddebeee82aa2 (patch)
tree245f9651869624fe47c1c7e4549e30d56b277c98 /sound
parentbe84bbcccc757b86449daaf924e72f95c95dc00e (diff)
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c36
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/patch_realtek.c2
3 files changed, 39 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ff97cf3e8bad..c4c62edca556 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)
3688} 3688}
3689EXPORT_SYMBOL_HDA(snd_hda_build_controls); 3689EXPORT_SYMBOL_HDA(snd_hda_build_controls);
3690 3690
3691/*
3692 * add standard channel maps if not specified
3693 */
3694static int add_std_chmaps(struct hda_codec *codec)
3695{
3696 int i, str, err;
3697
3698 for (i = 0; i < codec->num_pcms; i++) {
3699 for (str = 0; str < 2; str++) {
3700 struct snd_pcm *pcm = codec->pcm_info[i].pcm;
3701 struct hda_pcm_stream *hinfo =
3702 &codec->pcm_info[i].stream[str];
3703 struct snd_pcm_chmap *chmap;
3704
3705 if (codec->pcm_info[i].own_chmap)
3706 continue;
3707 if (!pcm || !hinfo->substreams)
3708 continue;
3709 err = snd_pcm_add_chmap_ctls(pcm, str,
3710 snd_pcm_std_chmaps,
3711 hinfo->channels_max,
3712 0, &chmap);
3713 if (err < 0)
3714 return err;
3715 chmap->channel_mask = SND_PCM_CHMAP_MASK_2468;
3716 }
3717 }
3718 return 0;
3719}
3720
3691int snd_hda_codec_build_controls(struct hda_codec *codec) 3721int snd_hda_codec_build_controls(struct hda_codec *codec)
3692{ 3722{
3693 int err = 0; 3723 int err = 0;
@@ -3699,6 +3729,12 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
3699 err = codec->patch_ops.build_controls(codec); 3729 err = codec->patch_ops.build_controls(codec);
3700 if (err < 0) 3730 if (err < 0)
3701 return err; 3731 return err;
3732
3733 /* we create chmaps here instead of build_pcms */
3734 err = add_std_chmaps(codec);
3735 if (err < 0)
3736 return err;
3737
3702 snd_hda_jack_report_sync(codec); /* call at the last init point */ 3738 snd_hda_jack_report_sync(codec); /* call at the last init point */
3703 return 0; 3739 return 0;
3704} 3740}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 8fd9f636cfe1..ed3de8d151c8 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -776,6 +776,7 @@ struct hda_pcm {
776 unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */ 776 unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */
777 int device; /* device number to assign */ 777 int device; /* device number to assign */
778 struct snd_pcm *pcm; /* assigned PCM instance */ 778 struct snd_pcm *pcm; /* assigned PCM instance */
779 bool own_chmap; /* codec driver provides own channel maps */
779}; 780};
780 781
781/* codec information */ 782/* codec information */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 613499932b2b..1907ddad3840 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2287,6 +2287,8 @@ static int alc_build_pcms(struct hda_codec *codec)
2287 p = &alc_pcm_analog_playback; 2287 p = &alc_pcm_analog_playback;
2288 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p; 2288 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *p;
2289 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 2289 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2290 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
2291 spec->multiout.max_channels;
2290 } 2292 }
2291 if (spec->adc_nids) { 2293 if (spec->adc_nids) {
2292 p = spec->stream_analog_capture; 2294 p = spec->stream_analog_capture;