diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-06-17 10:24:21 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-06-20 10:23:58 -0400 |
commit | 82673bc8950b869f01f9fd517f1c2286e0e49f44 (patch) | |
tree | daf633090562edd025b011d5bef59deefb99a639 | |
parent | 291c9e33bf3f8ac201b24b8f9e481756d43d7df7 (diff) |
ALSA: hda - Generate PCM names dynamically in patch_via.c
This reduces lots of static strings.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_via.c | 64 |
1 files changed, 7 insertions, 57 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 41398b07ba8b..c66ff69eccf2 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -115,11 +115,11 @@ struct via_spec { | |||
115 | const struct hda_verb *init_verbs[5]; | 115 | const struct hda_verb *init_verbs[5]; |
116 | unsigned int num_iverbs; | 116 | unsigned int num_iverbs; |
117 | 117 | ||
118 | char *stream_name_analog; | 118 | char stream_name_analog[32]; |
119 | const struct hda_pcm_stream *stream_analog_playback; | 119 | const struct hda_pcm_stream *stream_analog_playback; |
120 | const struct hda_pcm_stream *stream_analog_capture; | 120 | const struct hda_pcm_stream *stream_analog_capture; |
121 | 121 | ||
122 | char *stream_name_digital; | 122 | char stream_name_digital[32]; |
123 | const struct hda_pcm_stream *stream_digital_playback; | 123 | const struct hda_pcm_stream *stream_digital_playback; |
124 | const struct hda_pcm_stream *stream_digital_capture; | 124 | const struct hda_pcm_stream *stream_digital_capture; |
125 | 125 | ||
@@ -1556,6 +1556,8 @@ static int via_build_pcms(struct hda_codec *codec) | |||
1556 | codec->num_pcms = 1; | 1556 | codec->num_pcms = 1; |
1557 | codec->pcm_info = info; | 1557 | codec->pcm_info = info; |
1558 | 1558 | ||
1559 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | ||
1560 | "%s Analog", codec->chip_name); | ||
1559 | info->name = spec->stream_name_analog; | 1561 | info->name = spec->stream_name_analog; |
1560 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | 1562 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
1561 | *(spec->stream_analog_playback); | 1563 | *(spec->stream_analog_playback); |
@@ -1570,6 +1572,9 @@ static int via_build_pcms(struct hda_codec *codec) | |||
1570 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | 1572 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
1571 | codec->num_pcms++; | 1573 | codec->num_pcms++; |
1572 | info++; | 1574 | info++; |
1575 | snprintf(spec->stream_name_digital, | ||
1576 | sizeof(spec->stream_name_digital), | ||
1577 | "%s Digital", codec->chip_name); | ||
1573 | info->name = spec->stream_name_digital; | 1578 | info->name = spec->stream_name_digital; |
1574 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | 1579 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
1575 | if (spec->multiout.dig_out_nid) { | 1580 | if (spec->multiout.dig_out_nid) { |
@@ -2313,14 +2318,12 @@ static int patch_vt1708(struct hda_codec *codec) | |||
2313 | } | 2318 | } |
2314 | 2319 | ||
2315 | 2320 | ||
2316 | spec->stream_name_analog = "VT1708 Analog"; | ||
2317 | spec->stream_analog_playback = &vt1708_pcm_analog_playback; | 2321 | spec->stream_analog_playback = &vt1708_pcm_analog_playback; |
2318 | /* disable 32bit format on VT1708 */ | 2322 | /* disable 32bit format on VT1708 */ |
2319 | if (codec->vendor_id == 0x11061708) | 2323 | if (codec->vendor_id == 0x11061708) |
2320 | spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback; | 2324 | spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback; |
2321 | spec->stream_analog_capture = &vt1708_pcm_analog_capture; | 2325 | spec->stream_analog_capture = &vt1708_pcm_analog_capture; |
2322 | 2326 | ||
2323 | spec->stream_name_digital = "VT1708 Digital"; | ||
2324 | spec->stream_digital_playback = &vt1708_pcm_digital_playback; | 2327 | spec->stream_digital_playback = &vt1708_pcm_digital_playback; |
2325 | spec->stream_digital_capture = &vt1708_pcm_digital_capture; | 2328 | spec->stream_digital_capture = &vt1708_pcm_digital_capture; |
2326 | 2329 | ||
@@ -2748,11 +2751,9 @@ static int patch_vt1709_10ch(struct hda_codec *codec) | |||
2748 | spec->init_verbs[spec->num_iverbs++] = vt1709_10ch_volume_init_verbs; | 2751 | spec->init_verbs[spec->num_iverbs++] = vt1709_10ch_volume_init_verbs; |
2749 | spec->init_verbs[spec->num_iverbs++] = vt1709_uniwill_init_verbs; | 2752 | spec->init_verbs[spec->num_iverbs++] = vt1709_uniwill_init_verbs; |
2750 | 2753 | ||
2751 | spec->stream_name_analog = "VT1709 Analog"; | ||
2752 | spec->stream_analog_playback = &vt1709_10ch_pcm_analog_playback; | 2754 | spec->stream_analog_playback = &vt1709_10ch_pcm_analog_playback; |
2753 | spec->stream_analog_capture = &vt1709_pcm_analog_capture; | 2755 | spec->stream_analog_capture = &vt1709_pcm_analog_capture; |
2754 | 2756 | ||
2755 | spec->stream_name_digital = "VT1709 Digital"; | ||
2756 | spec->stream_digital_playback = &vt1709_pcm_digital_playback; | 2757 | spec->stream_digital_playback = &vt1709_pcm_digital_playback; |
2757 | spec->stream_digital_capture = &vt1709_pcm_digital_capture; | 2758 | spec->stream_digital_capture = &vt1709_pcm_digital_capture; |
2758 | 2759 | ||
@@ -2836,11 +2837,9 @@ static int patch_vt1709_6ch(struct hda_codec *codec) | |||
2836 | spec->init_verbs[spec->num_iverbs++] = vt1709_6ch_volume_init_verbs; | 2837 | spec->init_verbs[spec->num_iverbs++] = vt1709_6ch_volume_init_verbs; |
2837 | spec->init_verbs[spec->num_iverbs++] = vt1709_uniwill_init_verbs; | 2838 | spec->init_verbs[spec->num_iverbs++] = vt1709_uniwill_init_verbs; |
2838 | 2839 | ||
2839 | spec->stream_name_analog = "VT1709 Analog"; | ||
2840 | spec->stream_analog_playback = &vt1709_6ch_pcm_analog_playback; | 2840 | spec->stream_analog_playback = &vt1709_6ch_pcm_analog_playback; |
2841 | spec->stream_analog_capture = &vt1709_pcm_analog_capture; | 2841 | spec->stream_analog_capture = &vt1709_pcm_analog_capture; |
2842 | 2842 | ||
2843 | spec->stream_name_digital = "VT1709 Digital"; | ||
2844 | spec->stream_digital_playback = &vt1709_pcm_digital_playback; | 2843 | spec->stream_digital_playback = &vt1709_pcm_digital_playback; |
2845 | spec->stream_digital_capture = &vt1709_pcm_digital_capture; | 2844 | spec->stream_digital_capture = &vt1709_pcm_digital_capture; |
2846 | 2845 | ||
@@ -3354,11 +3353,9 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) | |||
3354 | spec->init_verbs[spec->num_iverbs++] = vt1708B_8ch_volume_init_verbs; | 3353 | spec->init_verbs[spec->num_iverbs++] = vt1708B_8ch_volume_init_verbs; |
3355 | spec->init_verbs[spec->num_iverbs++] = vt1708B_uniwill_init_verbs; | 3354 | spec->init_verbs[spec->num_iverbs++] = vt1708B_uniwill_init_verbs; |
3356 | 3355 | ||
3357 | spec->stream_name_analog = "VT1708B Analog"; | ||
3358 | spec->stream_analog_playback = &vt1708B_8ch_pcm_analog_playback; | 3356 | spec->stream_analog_playback = &vt1708B_8ch_pcm_analog_playback; |
3359 | spec->stream_analog_capture = &vt1708B_pcm_analog_capture; | 3357 | spec->stream_analog_capture = &vt1708B_pcm_analog_capture; |
3360 | 3358 | ||
3361 | spec->stream_name_digital = "VT1708B Digital"; | ||
3362 | spec->stream_digital_playback = &vt1708B_pcm_digital_playback; | 3359 | spec->stream_digital_playback = &vt1708B_pcm_digital_playback; |
3363 | spec->stream_digital_capture = &vt1708B_pcm_digital_capture; | 3360 | spec->stream_digital_capture = &vt1708B_pcm_digital_capture; |
3364 | 3361 | ||
@@ -3403,11 +3400,9 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
3403 | spec->init_verbs[spec->num_iverbs++] = vt1708B_4ch_volume_init_verbs; | 3400 | spec->init_verbs[spec->num_iverbs++] = vt1708B_4ch_volume_init_verbs; |
3404 | spec->init_verbs[spec->num_iverbs++] = vt1708B_uniwill_init_verbs; | 3401 | spec->init_verbs[spec->num_iverbs++] = vt1708B_uniwill_init_verbs; |
3405 | 3402 | ||
3406 | spec->stream_name_analog = "VT1708B Analog"; | ||
3407 | spec->stream_analog_playback = &vt1708B_4ch_pcm_analog_playback; | 3403 | spec->stream_analog_playback = &vt1708B_4ch_pcm_analog_playback; |
3408 | spec->stream_analog_capture = &vt1708B_pcm_analog_capture; | 3404 | spec->stream_analog_capture = &vt1708B_pcm_analog_capture; |
3409 | 3405 | ||
3410 | spec->stream_name_digital = "VT1708B Digital"; | ||
3411 | spec->stream_digital_playback = &vt1708B_pcm_digital_playback; | 3406 | spec->stream_digital_playback = &vt1708B_pcm_digital_playback; |
3412 | spec->stream_digital_capture = &vt1708B_pcm_digital_capture; | 3407 | spec->stream_digital_capture = &vt1708B_pcm_digital_capture; |
3413 | 3408 | ||
@@ -3863,24 +3858,12 @@ static int patch_vt1708S(struct hda_codec *codec) | |||
3863 | spec->init_verbs[spec->num_iverbs++] = | 3858 | spec->init_verbs[spec->num_iverbs++] = |
3864 | vt1708S_uniwill_init_verbs; | 3859 | vt1708S_uniwill_init_verbs; |
3865 | 3860 | ||
3866 | if (codec->vendor_id == 0x11060440) | ||
3867 | spec->stream_name_analog = "VT1818S Analog"; | ||
3868 | else if (codec->vendor_id == 0x11064397) | ||
3869 | spec->stream_name_analog = "VT1705 Analog"; | ||
3870 | else | ||
3871 | spec->stream_name_analog = "VT1708S Analog"; | ||
3872 | if (codec->vendor_id == 0x11064397) | 3861 | if (codec->vendor_id == 0x11064397) |
3873 | spec->stream_analog_playback = &vt1705_pcm_analog_playback; | 3862 | spec->stream_analog_playback = &vt1705_pcm_analog_playback; |
3874 | else | 3863 | else |
3875 | spec->stream_analog_playback = &vt1708S_pcm_analog_playback; | 3864 | spec->stream_analog_playback = &vt1708S_pcm_analog_playback; |
3876 | spec->stream_analog_capture = &vt1708S_pcm_analog_capture; | 3865 | spec->stream_analog_capture = &vt1708S_pcm_analog_capture; |
3877 | 3866 | ||
3878 | if (codec->vendor_id == 0x11060440) | ||
3879 | spec->stream_name_digital = "VT1818S Digital"; | ||
3880 | else if (codec->vendor_id == 0x11064397) | ||
3881 | spec->stream_name_digital = "VT1705 Digital"; | ||
3882 | else | ||
3883 | spec->stream_name_digital = "VT1708S Digital"; | ||
3884 | spec->stream_digital_playback = &vt1708S_pcm_digital_playback; | 3867 | spec->stream_digital_playback = &vt1708S_pcm_digital_playback; |
3885 | 3868 | ||
3886 | if (spec->adc_nids && spec->input_mux) { | 3869 | if (spec->adc_nids && spec->input_mux) { |
@@ -3905,13 +3888,6 @@ static int patch_vt1708S(struct hda_codec *codec) | |||
3905 | snprintf(codec->bus->card->mixername, | 3888 | snprintf(codec->bus->card->mixername, |
3906 | sizeof(codec->bus->card->mixername), | 3889 | sizeof(codec->bus->card->mixername), |
3907 | "%s %s", codec->vendor_name, codec->chip_name); | 3890 | "%s %s", codec->vendor_name, codec->chip_name); |
3908 | spec->stream_name_analog = "VT1708BCE Analog"; | ||
3909 | spec->stream_name_digital = "VT1708BCE Digital"; | ||
3910 | } | ||
3911 | /* correct names for VT1818S */ | ||
3912 | if (codec->vendor_id == 0x11060440) { | ||
3913 | spec->stream_name_analog = "VT1818S Analog"; | ||
3914 | spec->stream_name_digital = "VT1818S Digital"; | ||
3915 | } | 3891 | } |
3916 | /* correct names for VT1705 */ | 3892 | /* correct names for VT1705 */ |
3917 | if (codec->vendor_id == 0x11064397) { | 3893 | if (codec->vendor_id == 0x11064397) { |
@@ -4231,11 +4207,9 @@ static int patch_vt1702(struct hda_codec *codec) | |||
4231 | spec->init_verbs[spec->num_iverbs++] = vt1702_volume_init_verbs; | 4207 | spec->init_verbs[spec->num_iverbs++] = vt1702_volume_init_verbs; |
4232 | spec->init_verbs[spec->num_iverbs++] = vt1702_uniwill_init_verbs; | 4208 | spec->init_verbs[spec->num_iverbs++] = vt1702_uniwill_init_verbs; |
4233 | 4209 | ||
4234 | spec->stream_name_analog = "VT1702 Analog"; | ||
4235 | spec->stream_analog_playback = &vt1702_pcm_analog_playback; | 4210 | spec->stream_analog_playback = &vt1702_pcm_analog_playback; |
4236 | spec->stream_analog_capture = &vt1702_pcm_analog_capture; | 4211 | spec->stream_analog_capture = &vt1702_pcm_analog_capture; |
4237 | 4212 | ||
4238 | spec->stream_name_digital = "VT1702 Digital"; | ||
4239 | spec->stream_digital_playback = &vt1702_pcm_digital_playback; | 4213 | spec->stream_digital_playback = &vt1702_pcm_digital_playback; |
4240 | 4214 | ||
4241 | if (spec->adc_nids && spec->input_mux) { | 4215 | if (spec->adc_nids && spec->input_mux) { |
@@ -4681,21 +4655,9 @@ static int patch_vt1718S(struct hda_codec *codec) | |||
4681 | spec->init_verbs[spec->num_iverbs++] = vt1718S_volume_init_verbs; | 4655 | spec->init_verbs[spec->num_iverbs++] = vt1718S_volume_init_verbs; |
4682 | spec->init_verbs[spec->num_iverbs++] = vt1718S_uniwill_init_verbs; | 4656 | spec->init_verbs[spec->num_iverbs++] = vt1718S_uniwill_init_verbs; |
4683 | 4657 | ||
4684 | if (codec->vendor_id == 0x11060441) | ||
4685 | spec->stream_name_analog = "VT2020 Analog"; | ||
4686 | else if (codec->vendor_id == 0x11064441) | ||
4687 | spec->stream_name_analog = "VT1828S Analog"; | ||
4688 | else | ||
4689 | spec->stream_name_analog = "VT1718S Analog"; | ||
4690 | spec->stream_analog_playback = &vt1718S_pcm_analog_playback; | 4658 | spec->stream_analog_playback = &vt1718S_pcm_analog_playback; |
4691 | spec->stream_analog_capture = &vt1718S_pcm_analog_capture; | 4659 | spec->stream_analog_capture = &vt1718S_pcm_analog_capture; |
4692 | 4660 | ||
4693 | if (codec->vendor_id == 0x11060441) | ||
4694 | spec->stream_name_digital = "VT2020 Digital"; | ||
4695 | else if (codec->vendor_id == 0x11064441) | ||
4696 | spec->stream_name_digital = "VT1828S Digital"; | ||
4697 | else | ||
4698 | spec->stream_name_digital = "VT1718S Digital"; | ||
4699 | spec->stream_digital_playback = &vt1718S_pcm_digital_playback; | 4661 | spec->stream_digital_playback = &vt1718S_pcm_digital_playback; |
4700 | if (codec->vendor_id == 0x11060428 || codec->vendor_id == 0x11060441) | 4662 | if (codec->vendor_id == 0x11060428 || codec->vendor_id == 0x11060441) |
4701 | spec->stream_digital_capture = &vt1718S_pcm_digital_capture; | 4663 | spec->stream_digital_capture = &vt1718S_pcm_digital_capture; |
@@ -5230,11 +5192,9 @@ static int patch_vt1716S(struct hda_codec *codec) | |||
5230 | spec->init_verbs[spec->num_iverbs++] = vt1716S_volume_init_verbs; | 5192 | spec->init_verbs[spec->num_iverbs++] = vt1716S_volume_init_verbs; |
5231 | spec->init_verbs[spec->num_iverbs++] = vt1716S_uniwill_init_verbs; | 5193 | spec->init_verbs[spec->num_iverbs++] = vt1716S_uniwill_init_verbs; |
5232 | 5194 | ||
5233 | spec->stream_name_analog = "VT1716S Analog"; | ||
5234 | spec->stream_analog_playback = &vt1716S_pcm_analog_playback; | 5195 | spec->stream_analog_playback = &vt1716S_pcm_analog_playback; |
5235 | spec->stream_analog_capture = &vt1716S_pcm_analog_capture; | 5196 | spec->stream_analog_capture = &vt1716S_pcm_analog_capture; |
5236 | 5197 | ||
5237 | spec->stream_name_digital = "VT1716S Digital"; | ||
5238 | spec->stream_digital_playback = &vt1716S_pcm_digital_playback; | 5198 | spec->stream_digital_playback = &vt1716S_pcm_digital_playback; |
5239 | 5199 | ||
5240 | if (spec->adc_nids && spec->input_mux) { | 5200 | if (spec->adc_nids && spec->input_mux) { |
@@ -5728,17 +5688,9 @@ static int patch_vt2002P(struct hda_codec *codec) | |||
5728 | spec->init_verbs[spec->num_iverbs++] = | 5688 | spec->init_verbs[spec->num_iverbs++] = |
5729 | vt2002P_uniwill_init_verbs; | 5689 | vt2002P_uniwill_init_verbs; |
5730 | 5690 | ||
5731 | if (spec->codec_type == VT1802) | ||
5732 | spec->stream_name_analog = "VT1802 Analog"; | ||
5733 | else | ||
5734 | spec->stream_name_analog = "VT2002P Analog"; | ||
5735 | spec->stream_analog_playback = &vt2002P_pcm_analog_playback; | 5691 | spec->stream_analog_playback = &vt2002P_pcm_analog_playback; |
5736 | spec->stream_analog_capture = &vt2002P_pcm_analog_capture; | 5692 | spec->stream_analog_capture = &vt2002P_pcm_analog_capture; |
5737 | 5693 | ||
5738 | if (spec->codec_type == VT1802) | ||
5739 | spec->stream_name_digital = "VT1802 Digital"; | ||
5740 | else | ||
5741 | spec->stream_name_digital = "VT2002P Digital"; | ||
5742 | spec->stream_digital_playback = &vt2002P_pcm_digital_playback; | 5694 | spec->stream_digital_playback = &vt2002P_pcm_digital_playback; |
5743 | 5695 | ||
5744 | if (spec->adc_nids && spec->input_mux) { | 5696 | if (spec->adc_nids && spec->input_mux) { |
@@ -6128,11 +6080,9 @@ static int patch_vt1812(struct hda_codec *codec) | |||
6128 | spec->init_verbs[spec->num_iverbs++] = vt1812_volume_init_verbs; | 6080 | spec->init_verbs[spec->num_iverbs++] = vt1812_volume_init_verbs; |
6129 | spec->init_verbs[spec->num_iverbs++] = vt1812_uniwill_init_verbs; | 6081 | spec->init_verbs[spec->num_iverbs++] = vt1812_uniwill_init_verbs; |
6130 | 6082 | ||
6131 | spec->stream_name_analog = "VT1812 Analog"; | ||
6132 | spec->stream_analog_playback = &vt1812_pcm_analog_playback; | 6083 | spec->stream_analog_playback = &vt1812_pcm_analog_playback; |
6133 | spec->stream_analog_capture = &vt1812_pcm_analog_capture; | 6084 | spec->stream_analog_capture = &vt1812_pcm_analog_capture; |
6134 | 6085 | ||
6135 | spec->stream_name_digital = "VT1812 Digital"; | ||
6136 | spec->stream_digital_playback = &vt1812_pcm_digital_playback; | 6086 | spec->stream_digital_playback = &vt1812_pcm_digital_playback; |
6137 | 6087 | ||
6138 | if (spec->adc_nids && spec->input_mux) { | 6088 | if (spec->adc_nids && spec->input_mux) { |