aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c18
-rw-r--r--sound/pci/hda/hda_codec.h3
-rw-r--r--sound/pci/hda/patch_cirrus.c3
-rw-r--r--sound/pci/hda/patch_conexant.c5
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c5
-rw-r--r--sound/pci/hda/patch_via.c4
7 files changed, 40 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 569bc05aad6c..a8e7b00fe90d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3747,13 +3747,14 @@ static int add_std_chmaps(struct hda_codec *codec)
3747 struct hda_pcm_stream *hinfo = 3747 struct hda_pcm_stream *hinfo =
3748 &codec->pcm_info[i].stream[str]; 3748 &codec->pcm_info[i].stream[str];
3749 struct snd_pcm_chmap *chmap; 3749 struct snd_pcm_chmap *chmap;
3750 const struct snd_pcm_chmap_elem *elem;
3750 3751
3751 if (codec->pcm_info[i].own_chmap) 3752 if (codec->pcm_info[i].own_chmap)
3752 continue; 3753 continue;
3753 if (!pcm || !hinfo->substreams) 3754 if (!pcm || !hinfo->substreams)
3754 continue; 3755 continue;
3755 err = snd_pcm_add_chmap_ctls(pcm, str, 3756 elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
3756 snd_pcm_std_chmaps, 3757 err = snd_pcm_add_chmap_ctls(pcm, str, elem,
3757 hinfo->channels_max, 3758 hinfo->channels_max,
3758 0, &chmap); 3759 0, &chmap);
3759 if (err < 0) 3760 if (err < 0)
@@ -3764,6 +3765,19 @@ static int add_std_chmaps(struct hda_codec *codec)
3764 return 0; 3765 return 0;
3765} 3766}
3766 3767
3768/* default channel maps for 2.1 speakers;
3769 * since HD-audio supports only stereo, odd number channels are omitted
3770 */
3771const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[] = {
3772 { .channels = 2,
3773 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
3774 { .channels = 4,
3775 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
3776 SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
3777 { }
3778};
3779EXPORT_SYMBOL_GPL(snd_pcm_2_1_chmaps);
3780
3767int snd_hda_codec_build_controls(struct hda_codec *codec) 3781int snd_hda_codec_build_controls(struct hda_codec *codec)
3768{ 3782{
3769 int err = 0; 3783 int err = 0;
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 62d4229c7b95..baad7bf6133b 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -757,6 +757,7 @@ struct hda_pcm_stream {
757 u32 rates; /* supported rates */ 757 u32 rates; /* supported rates */
758 u64 formats; /* supported formats (SNDRV_PCM_FMTBIT_) */ 758 u64 formats; /* supported formats (SNDRV_PCM_FMTBIT_) */
759 unsigned int maxbps; /* supported max. bit per sample */ 759 unsigned int maxbps; /* supported max. bit per sample */
760 const struct snd_pcm_chmap_elem *chmap; /* chmap to override */
760 struct hda_pcm_ops ops; 761 struct hda_pcm_ops ops;
761}; 762};
762 763
@@ -1026,6 +1027,8 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
1026int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, 1027int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,
1027 unsigned int format); 1028 unsigned int format);
1028 1029
1030extern const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[];
1031
1029/* 1032/*
1030 * Misc 1033 * Misc
1031 */ 1034 */
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 794b0da11212..f99cbf942b8d 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -344,6 +344,9 @@ static int cs_build_pcms(struct hda_codec *codec)
344 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dac_nid[0]; 344 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dac_nid[0];
345 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 345 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
346 spec->multiout.max_channels; 346 spec->multiout.max_channels;
347 if (spec->speaker_2_1)
348 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
349 snd_pcm_2_1_chmaps;
347 info->stream[SNDRV_PCM_STREAM_CAPTURE] = cs_pcm_analog_capture; 350 info->stream[SNDRV_PCM_STREAM_CAPTURE] = cs_pcm_analog_capture;
348 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 351 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
349 spec->adc_nid[spec->cur_input]; 352 spec->adc_nid[spec->cur_input];
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index f8e9ff493dc7..3401a087de80 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -337,6 +337,8 @@ static const struct hda_pcm_stream cx5051_pcm_analog_capture = {
337 }, 337 },
338}; 338};
339 339
340static bool is_2_1_speaker(struct conexant_spec *spec);
341
340static int conexant_build_pcms(struct hda_codec *codec) 342static int conexant_build_pcms(struct hda_codec *codec)
341{ 343{
342 struct conexant_spec *spec = codec->spec; 344 struct conexant_spec *spec = codec->spec;
@@ -351,6 +353,9 @@ static int conexant_build_pcms(struct hda_codec *codec)
351 spec->multiout.max_channels; 353 spec->multiout.max_channels;
352 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 354 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
353 spec->multiout.dac_nids[0]; 355 spec->multiout.dac_nids[0];
356 if (is_2_1_speaker(spec))
357 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
358 snd_pcm_2_1_chmaps;
354 if (spec->capture_stream) 359 if (spec->capture_stream)
355 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->capture_stream; 360 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->capture_stream;
356 else { 361 else {
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index bc71be32232e..89737ae49152 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2260,6 +2260,10 @@ static int alc_build_pcms(struct hda_codec *codec)
2260 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 2260 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2261 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 2261 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
2262 spec->multiout.max_channels; 2262 spec->multiout.max_channels;
2263 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2264 spec->autocfg.line_outs == 2)
2265 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
2266 snd_pcm_2_1_chmaps;
2263 } 2267 }
2264 if (spec->adc_nids) { 2268 if (spec->adc_nids) {
2265 p = spec->stream_analog_capture; 2269 p = spec->stream_analog_capture;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f799406f4404..a6aeb6260719 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2516,6 +2516,11 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2518 spec->multiout.dac_nids[0]; 2518 spec->multiout.dac_nids[0];
2519 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2520 spec->autocfg.line_outs == 2)
2521 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
2522 snd_pcm_2_1_chmaps;
2523
2519 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 2524 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2520 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2525 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2521 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; 2526 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 0e9b0747adc6..9ae8cfcecf1d 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -1555,6 +1555,10 @@ static int via_build_pcms(struct hda_codec *codec)
1555 spec->multiout.dac_nids[0]; 1555 spec->multiout.dac_nids[0];
1556 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 1556 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
1557 spec->multiout.max_channels; 1557 spec->multiout.max_channels;
1558 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT
1559 && spec->autocfg.line_outs == 2)
1560 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
1561 snd_pcm_2_1_chmaps;
1558 } 1562 }
1559 1563
1560 if (!spec->stream_analog_capture) { 1564 if (!spec->stream_analog_capture) {