]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Takashi Iwai <tiwai@suse.de> |
2 | Subject: ALSA: hda - update ATI HDMI codec support | |
3 | Patch-mainline: 2.6.28-rc1 | |
4 | References: bnc#363153 | |
5 | ||
6 | Updates for HDMI support; 8-ch LPCM is capable. | |
7 | ||
8 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
9 | ||
10 | --- | |
11 | diff -ruN a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c | |
12 | --- a/sound/pci/hda/patch_atihdmi.c | |
13 | +++ b/sound/pci/hda/patch_atihdmi.c | |
14 | @@ -35,6 +35,9 @@ | |
15 | struct hda_pcm pcm_rec; | |
16 | }; | |
17 | ||
18 | +#define CVT_NID 0x02 /* audio converter */ | |
19 | +#define PIN_NID 0x03 /* HDMI output pin */ | |
20 | + | |
21 | static struct hda_verb atihdmi_basic_init[] = { | |
22 | /* enable digital output on pin widget */ | |
23 | { 0x03, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | |
24 | @@ -60,8 +63,9 @@ | |
25 | { | |
26 | snd_hda_sequence_write(codec, atihdmi_basic_init); | |
27 | /* SI codec requires to unmute the pin */ | |
28 | - if (get_wcaps(codec, 0x03) & AC_WCAP_OUT_AMP) | |
29 | - snd_hda_codec_write(codec, 0x03, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
30 | + if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP) | |
31 | + snd_hda_codec_write(codec, PIN_NID, 0, | |
32 | + AC_VERB_SET_AMP_GAIN_MUTE, | |
33 | AMP_OUT_UNMUTE); | |
34 | return 0; | |
35 | } | |
36 | @@ -92,15 +96,29 @@ | |
37 | struct snd_pcm_substream *substream) | |
38 | { | |
39 | struct atihdmi_spec *spec = codec->spec; | |
40 | - return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | |
41 | - format, substream); | |
42 | + int chans = substream->runtime->channels; | |
43 | + int i, err; | |
44 | + | |
45 | + err = snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | |
46 | + format, substream); | |
47 | + if (err < 0) | |
48 | + return err; | |
49 | + snd_hda_codec_write(codec, CVT_NID, 0, AC_VERB_SET_CVT_CHAN_COUNT, | |
50 | + chans - 1); | |
51 | + /* FIXME: XXX */ | |
52 | + for (i = 0; i < chans; i++) { | |
53 | + snd_hda_codec_write(codec, CVT_NID, 0, | |
54 | + AC_VERB_SET_HDMI_CHAN_SLOT, | |
55 | + (i << 4) | i); | |
56 | + } | |
57 | + return 0; | |
58 | } | |
59 | ||
60 | static struct hda_pcm_stream atihdmi_pcm_digital_playback = { | |
61 | .substreams = 1, | |
62 | .channels_min = 2, | |
63 | .channels_max = 2, | |
64 | - .nid = 0x2, /* NID to query formats and rates and setup streams */ | |
65 | + .nid = CVT_NID, /* NID to query formats and rates and setup streams */ | |
66 | .ops = { | |
67 | .open = atihdmi_dig_playback_pcm_open, | |
68 | .close = atihdmi_dig_playback_pcm_close, | |
69 | @@ -112,6 +130,7 @@ | |
70 | { | |
71 | struct atihdmi_spec *spec = codec->spec; | |
72 | struct hda_pcm *info = &spec->pcm_rec; | |
73 | + unsigned int chans; | |
74 | ||
75 | codec->num_pcms = 1; | |
76 | codec->pcm_info = info; | |
77 | @@ -120,6 +139,13 @@ | |
78 | info->pcm_type = HDA_PCM_TYPE_HDMI; | |
79 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = atihdmi_pcm_digital_playback; | |
80 | ||
81 | + /* FIXME: we must check ELD and change the PCM parameters dynamically | |
82 | + */ | |
83 | + chans = get_wcaps(codec, CVT_NID); | |
84 | + chans = (chans & AC_WCAP_CHAN_CNT_EXT) >> 13; | |
85 | + chans = ((chans << 1) | 1) + 1; | |
86 | + info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = chans; | |
87 | + | |
88 | return 0; | |
89 | } | |
90 | ||
91 | @@ -147,9 +173,11 @@ | |
92 | ||
93 | spec->multiout.num_dacs = 0; /* no analog */ | |
94 | spec->multiout.max_channels = 2; | |
95 | - spec->multiout.dig_out_nid = 0x2; /* NID for copying analog to digital, | |
96 | - * seems to be unused in pure-digital | |
97 | - * case. */ | |
98 | + /* NID for copying analog to digital, | |
99 | + * seems to be unused in pure-digital | |
100 | + * case. | |
101 | + */ | |
102 | + spec->multiout.dig_out_nid = CVT_NID; | |
103 | ||
104 | codec->patch_ops = atihdmi_patch_ops; | |
105 | ||
106 | @@ -164,6 +192,7 @@ | |
107 | { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, | |
108 | { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, | |
109 | { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, | |
110 | + { .id = 0x10951390, .name = "SiI1390 HDMI", .patch = patch_atihdmi }, | |
111 | { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi }, | |
112 | { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, | |
113 | {} /* terminator */ | |
114 | diff -ruN a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt | |
115 | --- a/Documentation/sound/alsa/ALSA-Configuration.txt | |
116 | +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |
117 | @@ -746,8 +746,10 @@ | |
118 | Module snd-hda-intel | |
119 | -------------------- | |
120 | ||
121 | - Module for Intel HD Audio (ICH6, ICH6M, ESB2, ICH7, ICH8), | |
122 | - ATI SB450, SB600, RS600, | |
123 | + Module for Intel HD Audio (ICH6, ICH6M, ESB2, ICH7, ICH8, ICH9, ICH10, | |
124 | + PCH, SCH), | |
125 | + ATI SB450, SB600, R600, RS600, RS690, RS780, RV610, RV620, | |
126 | + RV630, RV635, RV670, RV770, | |
127 | VIA VT8251/VT8237A, | |
128 | SIS966, ULI M5461 | |
129 |