Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]

Diff markup

Differences between /linux/sound/pci/hda/patch_intelhdmi.c (Version 2.6.31.13) and /linux/sound/pci/hda/patch_intelhdmi.c (Version 2.6.25)


  1 /*                                                  1 
  2  *                                                
  3  *  patch_intelhdmi.c - Patch for Intel HDMI c    
  4  *                                                
  5  *  Copyright(c) 2008 Intel Corporation. All r    
  6  *                                                
  7  *  Authors:                                      
  8  *                      Jiang Zhe <zhe.jiang@i    
  9  *                      Wu Fengguang <wfg@linu    
 10  *                                                
 11  *  Maintained by:                                
 12  *                      Wu Fengguang <wfg@linu    
 13  *                                                
 14  *  This program is free software; you can red    
 15  *  under the terms of the GNU General Public     
 16  *  Software Foundation; either version 2 of t    
 17  *  any later version.                            
 18  *                                                
 19  *  This program is distributed in the hope th    
 20  *  WITHOUT ANY WARRANTY; without even the imp    
 21  *  or FITNESS FOR A PARTICULAR PURPOSE.  See     
 22  *  for more details.                             
 23  *                                                
 24  *  You should have received a copy of the GNU    
 25  *  along with this program; if not, write to     
 26  *  Inc., 59 Temple Place - Suite 330, Boston,    
 27  */                                               
 28                                                   
 29 #include <linux/init.h>                           
 30 #include <linux/delay.h>                          
 31 #include <linux/slab.h>                           
 32 #include <sound/core.h>                           
 33 #include "hda_codec.h"                            
 34 #include "hda_local.h"                            
 35                                                   
 36 #define CVT_NID         0x02    /* audio conve    
 37 #define PIN_NID         0x03    /* HDMI output    
 38                                                   
 39 #define INTEL_HDMI_EVENT_TAG            0x08      
 40                                                   
 41 struct intel_hdmi_spec {                          
 42         struct hda_multi_out multiout;            
 43         struct hda_pcm pcm_rec;                   
 44         struct hdmi_eld sink_eld;                 
 45 };                                                
 46                                                   
 47 static struct hda_verb pinout_enable_verb[] =     
 48         {PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTR    
 49         {} /* terminator */                       
 50 };                                                
 51                                                   
 52 static struct hda_verb unsolicited_response_ve    
 53         {PIN_NID, AC_VERB_SET_UNSOLICITED_ENAB    
 54                                                   
 55         {}                                        
 56 };                                                
 57                                                   
 58 static struct hda_verb def_chan_map[] = {         
 59         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 60         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 61         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 62         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 63         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 64         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 65         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 66         {CVT_NID, AC_VERB_SET_HDMI_CHAN_SLOT,     
 67         {}                                        
 68 };                                                
 69                                                   
 70                                                   
 71 struct hdmi_audio_infoframe {                     
 72         u8 type; /* 0x84 */                       
 73         u8 ver;  /* 0x01 */                       
 74         u8 len;  /* 0x0a */                       
 75                                                   
 76         u8 checksum;    /* PB0 */                 
 77         u8 CC02_CT47;   /* CC in bits 0:2, CT     
 78         u8 SS01_SF24;                             
 79         u8 CXT04;                                 
 80         u8 CA;                                    
 81         u8 LFEPBL01_LSV36_DM_INH7;                
 82         u8 reserved[5]; /* PB6 - PB10 */          
 83 };                                                
 84                                                   
 85 /*                                                
 86  * CEA speaker placement:                         
 87  *                                                
 88  *        FLH       FCH        FRH                
 89  *  FLW    FL  FLC   FC   FRC   FR   FRW          
 90  *                                                
 91  *                                  LFE           
 92  *                     TC                         
 93  *                                                
 94  *          RL  RLC   RC   RRC   RR               
 95  *                                                
 96  * The Left/Right Surround channel _notions_ L    
 97  * CEA RL/RR; The SMPTE channel _assignment_ C    
 98  */                                               
 99 enum cea_speaker_placement {                      
100         FL  = (1 <<  0),        /* Front Left     
101         FC  = (1 <<  1),        /* Front Cente    
102         FR  = (1 <<  2),        /* Front Right    
103         FLC = (1 <<  3),        /* Front Left     
104         FRC = (1 <<  4),        /* Front Right    
105         RL  = (1 <<  5),        /* Rear Left      
106         RC  = (1 <<  6),        /* Rear Center    
107         RR  = (1 <<  7),        /* Rear Right     
108         RLC = (1 <<  8),        /* Rear Left C    
109         RRC = (1 <<  9),        /* Rear Right     
110         LFE = (1 << 10),        /* Low Frequen    
111         FLW = (1 << 11),        /* Front Left     
112         FRW = (1 << 12),        /* Front Right    
113         FLH = (1 << 13),        /* Front Left     
114         FCH = (1 << 14),        /* Front Cente    
115         FRH = (1 << 15),        /* Front Right    
116         TC  = (1 << 16),        /* Top Center     
117 };                                                
118                                                   
119 /*                                                
120  * ELD SA bits in the CEA Speaker Allocation d    
121  */                                               
122 static int eld_speaker_allocation_bits[] = {      
123         [0] = FL | FR,                            
124         [1] = LFE,                                
125         [2] = FC,                                 
126         [3] = RL | RR,                            
127         [4] = RC,                                 
128         [5] = FLC | FRC,                          
129         [6] = RLC | RRC,                          
130         /* the following are not defined in EL    
131         [7] = FLW | FRW,                          
132         [8] = FLH | FRH,                          
133         [9] = TC,                                 
134         [10] = FCH,                               
135 };                                                
136                                                   
137 struct cea_channel_speaker_allocation {           
138         int ca_index;                             
139         int speakers[8];                          
140                                                   
141         /* derived values, just for convenienc    
142         int channels;                             
143         int spk_mask;                             
144 };                                                
145                                                   
146 /*                                                
147  * This is an ordered list!                       
148  *                                                
149  * The preceding ones have better chances to b    
150  * hdmi_setup_channel_allocation().               
151  */                                               
152 static struct cea_channel_speaker_allocation c    
153 /*                        channel:   8     7      
154 { .ca_index = 0x00,  .speakers = {   0,    0,     
155                                  /* 2.1 */        
156 { .ca_index = 0x01,  .speakers = {   0,    0,     
157                                  /* Dolby Surr    
158 { .ca_index = 0x02,  .speakers = {   0,    0,     
159 { .ca_index = 0x03,  .speakers = {   0,    0,     
160 { .ca_index = 0x04,  .speakers = {   0,    0,     
161 { .ca_index = 0x05,  .speakers = {   0,    0,     
162 { .ca_index = 0x06,  .speakers = {   0,    0,     
163 { .ca_index = 0x07,  .speakers = {   0,    0,     
164 { .ca_index = 0x08,  .speakers = {   0,    0,     
165 { .ca_index = 0x09,  .speakers = {   0,    0,     
166 { .ca_index = 0x0a,  .speakers = {   0,    0,     
167                                  /* 5.1 */        
168 { .ca_index = 0x0b,  .speakers = {   0,    0,     
169 { .ca_index = 0x0c,  .speakers = {   0,   RC,     
170 { .ca_index = 0x0d,  .speakers = {   0,   RC,     
171 { .ca_index = 0x0e,  .speakers = {   0,   RC,     
172                                  /* 6.1 */        
173 { .ca_index = 0x0f,  .speakers = {   0,   RC,     
174 { .ca_index = 0x10,  .speakers = { RRC,  RLC,     
175 { .ca_index = 0x11,  .speakers = { RRC,  RLC,     
176 { .ca_index = 0x12,  .speakers = { RRC,  RLC,     
177                                  /* 7.1 */        
178 { .ca_index = 0x13,  .speakers = { RRC,  RLC,     
179 { .ca_index = 0x14,  .speakers = { FRC,  FLC,     
180 { .ca_index = 0x15,  .speakers = { FRC,  FLC,     
181 { .ca_index = 0x16,  .speakers = { FRC,  FLC,     
182 { .ca_index = 0x17,  .speakers = { FRC,  FLC,     
183 { .ca_index = 0x18,  .speakers = { FRC,  FLC,     
184 { .ca_index = 0x19,  .speakers = { FRC,  FLC,     
185 { .ca_index = 0x1a,  .speakers = { FRC,  FLC,     
186 { .ca_index = 0x1b,  .speakers = { FRC,  FLC,     
187 { .ca_index = 0x1c,  .speakers = { FRC,  FLC,     
188 { .ca_index = 0x1d,  .speakers = { FRC,  FLC,     
189 { .ca_index = 0x1e,  .speakers = { FRC,  FLC,     
190 { .ca_index = 0x1f,  .speakers = { FRC,  FLC,     
191 { .ca_index = 0x20,  .speakers = {   0,  FCH,     
192 { .ca_index = 0x21,  .speakers = {   0,  FCH,     
193 { .ca_index = 0x22,  .speakers = {  TC,    0,     
194 { .ca_index = 0x23,  .speakers = {  TC,    0,     
195 { .ca_index = 0x24,  .speakers = { FRH,  FLH,     
196 { .ca_index = 0x25,  .speakers = { FRH,  FLH,     
197 { .ca_index = 0x26,  .speakers = { FRW,  FLW,     
198 { .ca_index = 0x27,  .speakers = { FRW,  FLW,     
199 { .ca_index = 0x28,  .speakers = {  TC,   RC,     
200 { .ca_index = 0x29,  .speakers = {  TC,   RC,     
201 { .ca_index = 0x2a,  .speakers = { FCH,   RC,     
202 { .ca_index = 0x2b,  .speakers = { FCH,   RC,     
203 { .ca_index = 0x2c,  .speakers = {  TC,  FCH,     
204 { .ca_index = 0x2d,  .speakers = {  TC,  FCH,     
205 { .ca_index = 0x2e,  .speakers = { FRH,  FLH,     
206 { .ca_index = 0x2f,  .speakers = { FRH,  FLH,     
207 { .ca_index = 0x30,  .speakers = { FRW,  FLW,     
208 { .ca_index = 0x31,  .speakers = { FRW,  FLW,     
209 };                                                
210                                                   
211 /*                                                
212  * HDMI routines                                  
213  */                                               
214                                                   
215 #ifdef BE_PARANOID                                
216 static void hdmi_get_dip_index(struct hda_code    
217                                 int *packet_in    
218 {                                                 
219         int val;                                  
220                                                   
221         val = snd_hda_codec_read(codec, nid, 0    
222                                                   
223         *packet_index = val >> 5;                 
224         *byte_index = val & 0x1f;                 
225 }                                                 
226 #endif                                            
227                                                   
228 static void hdmi_set_dip_index(struct hda_code    
229                                 int packet_ind    
230 {                                                 
231         int val;                                  
232                                                   
233         val = (packet_index << 5) | (byte_inde    
234                                                   
235         snd_hda_codec_write(codec, nid, 0, AC_    
236 }                                                 
237                                                   
238 static void hdmi_write_dip_byte(struct hda_cod    
239                                 unsigned char     
240 {                                                 
241         snd_hda_codec_write(codec, nid, 0, AC_    
242 }                                                 
243                                                   
244 static void hdmi_enable_output(struct hda_code    
245 {                                                 
246         /* Unmute */                              
247         if (get_wcaps(codec, PIN_NID) & AC_WCA    
248                 snd_hda_codec_write(codec, PIN    
249                                 AC_VERB_SET_AM    
250         /* Enable pin out */                      
251         snd_hda_sequence_write(codec, pinout_e    
252 }                                                 
253                                                   
254 /*                                                
255  * Enable Audio InfoFrame Transmission            
256  */                                               
257 static void hdmi_start_infoframe_trans(struct     
258 {                                                 
259         hdmi_set_dip_index(codec, PIN_NID, 0x0    
260         snd_hda_codec_write(codec, PIN_NID, 0,    
261                                                   
262 }                                                 
263                                                   
264 /*                                                
265  * Disable Audio InfoFrame Transmission           
266  */                                               
267 static void hdmi_stop_infoframe_trans(struct h    
268 {                                                 
269         hdmi_set_dip_index(codec, PIN_NID, 0x0    
270         snd_hda_codec_write(codec, PIN_NID, 0,    
271                                                   
272 }                                                 
273                                                   
274 static int hdmi_get_channel_count(struct hda_c    
275 {                                                 
276         return 1 + snd_hda_codec_read(codec, C    
277                                         AC_VER    
278 }                                                 
279                                                   
280 static void hdmi_set_channel_count(struct hda_    
281 {                                                 
282         snd_hda_codec_write(codec, CVT_NID, 0,    
283                                         AC_VER    
284                                                   
285         if (chs != hdmi_get_channel_count(code    
286                 snd_printd(KERN_INFO "HDMI cha    
287                                         chs, h    
288 }                                                 
289                                                   
290 static void hdmi_debug_channel_mapping(struct     
291 {                                                 
292 #ifdef CONFIG_SND_DEBUG_VERBOSE                   
293         int i;                                    
294         int slot;                                 
295                                                   
296         for (i = 0; i < 8; i++) {                 
297                 slot = snd_hda_codec_read(code    
298                                                   
299                 printk(KERN_DEBUG "HDMI: ASP c    
300                                                   
301         }                                         
302 #endif                                            
303 }                                                 
304                                                   
305 static void hdmi_parse_eld(struct hda_codec *c    
306 {                                                 
307         struct intel_hdmi_spec *spec = codec->    
308         struct hdmi_eld *eld = &spec->sink_eld    
309                                                   
310         if (!snd_hdmi_get_eld(eld, codec, PIN_    
311                 snd_hdmi_show_eld(eld);           
312 }                                                 
313                                                   
314                                                   
315 /*                                                
316  * Audio InfoFrame routines                       
317  */                                               
318                                                   
319 static void hdmi_debug_dip_size(struct hda_cod    
320 {                                                 
321 #ifdef CONFIG_SND_DEBUG_VERBOSE                   
322         int i;                                    
323         int size;                                 
324                                                   
325         size = snd_hdmi_get_eld_size(codec, PI    
326         printk(KERN_DEBUG "HDMI: ELD buf size     
327                                                   
328         for (i = 0; i < 8; i++) {                 
329                 size = snd_hda_codec_read(code    
330                                                   
331                 printk(KERN_DEBUG "HDMI: DIP G    
332         }                                         
333 #endif                                            
334 }                                                 
335                                                   
336 static void hdmi_clear_dip_buffers(struct hda_    
337 {                                                 
338 #ifdef BE_PARANOID                                
339         int i, j;                                 
340         int size;                                 
341         int pi, bi;                               
342         for (i = 0; i < 8; i++) {                 
343                 size = snd_hda_codec_read(code    
344                                                   
345                 if (size == 0)                    
346                         continue;                 
347                                                   
348                 hdmi_set_dip_index(codec, PIN_    
349                 for (j = 1; j < 1000; j++) {      
350                         hdmi_write_dip_byte(co    
351                         hdmi_get_dip_index(cod    
352                         if (pi != i)              
353                                 snd_printd(KER    
354                                                   
355                         if (bi == 0) /* byte i    
356                                 break;            
357                 }                                 
358                 snd_printd(KERN_INFO              
359                         "HDMI: DIP GP[%d] buf     
360                         i, size, j);              
361         }                                         
362 #endif                                            
363 }                                                 
364                                                   
365 static void hdmi_fill_audio_infoframe(struct h    
366                                         struct    
367 {                                                 
368         u8 *params = (u8 *)ai;                    
369         u8 sum = 0;                               
370         int i;                                    
371                                                   
372         hdmi_debug_dip_size(codec);               
373         hdmi_clear_dip_buffers(codec); /* be p    
374                                                   
375         for (i = 0; i < sizeof(ai); i++)          
376                 sum += params[i];                 
377         ai->checksum = - sum;                     
378                                                   
379         hdmi_set_dip_index(codec, PIN_NID, 0x0    
380         for (i = 0; i < sizeof(ai); i++)          
381                 hdmi_write_dip_byte(codec, PIN    
382 }                                                 
383                                                   
384 /*                                                
385  * Compute derived values in channel_allocatio    
386  */                                               
387 static void init_channel_allocations(void)        
388 {                                                 
389         int i, j;                                 
390         struct cea_channel_speaker_allocation     
391                                                   
392         for (i = 0; i < ARRAY_SIZE(channel_all    
393                 p = channel_allocations + i;      
394                 p->channels = 0;                  
395                 p->spk_mask = 0;                  
396                 for (j = 0; j < ARRAY_SIZE(p->    
397                         if (p->speakers[j]) {     
398                                 p->channels++;    
399                                 p->spk_mask |=    
400                         }                         
401         }                                         
402 }                                                 
403                                                   
404 /*                                                
405  * The transformation takes two steps:            
406  *                                                
407  *      eld->spk_alloc => (eld_speaker_allocat    
408  *            spk_mask => (channel_allocations    
409  *                                                
410  * TODO: it could select the wrong CA from mul    
411 */                                                
412 static int hdmi_setup_channel_allocation(struc    
413                                          struc    
414 {                                                 
415         struct intel_hdmi_spec *spec = codec->    
416         struct hdmi_eld *eld = &spec->sink_eld    
417         int i;                                    
418         int spk_mask = 0;                         
419         int channels = 1 + (ai->CC02_CT47 & 0x    
420         char buf[SND_PRINT_CHANNEL_ALLOCATION_    
421                                                   
422         /*                                        
423          * CA defaults to 0 for basic stereo a    
424          */                                       
425         if (channels <= 2)                        
426                 return 0;                         
427                                                   
428         /*                                        
429          * HDMI sink's ELD info cannot always     
430          * in console or for audio devices. As    
431          * configuration, to _not_ prohibit mu    
432          */                                       
433         if (!eld->spk_alloc)                      
434                 eld->spk_alloc = 0xffff;          
435                                                   
436         /*                                        
437          * expand ELD's speaker allocation mas    
438          *                                        
439          * ELD tells the speaker mask in a com    
440          * expand ELD's notions to match the o    
441          */                                       
442         for (i = 0; i < ARRAY_SIZE(eld_speaker    
443                 if (eld->spk_alloc & (1 << i))    
444                         spk_mask |= eld_speake    
445         }                                         
446                                                   
447         /* search for the first working match     
448         for (i = 0; i < ARRAY_SIZE(channel_all    
449                 if (channels == channel_alloca    
450                     (spk_mask & channel_alloca    
451                                 channel_alloca    
452                         ai->CA = channel_alloc    
453                         break;                    
454                 }                                 
455         }                                         
456                                                   
457         snd_print_channel_allocation(eld->spk_    
458         snd_printdd(KERN_INFO                     
459                         "HDMI: select CA 0x%x     
460                         ai->CA, channels, buf)    
461                                                   
462         return ai->CA;                            
463 }                                                 
464                                                   
465 static void hdmi_setup_channel_mapping(struct     
466                                         struct    
467 {                                                 
468         if (!ai->CA)                              
469                 return;                           
470                                                   
471         /*                                        
472          * TODO: adjust channel mapping if nec    
473          * ALSA sequence is front/surr/clfe/si    
474          */                                       
475                                                   
476         snd_hda_sequence_write(codec, def_chan    
477         hdmi_debug_channel_mapping(codec);        
478 }                                                 
479                                                   
480                                                   
481 static void hdmi_setup_audio_infoframe(struct     
482                                         struct    
483 {                                                 
484         struct hdmi_audio_infoframe ai = {        
485                 .type           = 0x84,           
486                 .ver            = 0x01,           
487                 .len            = 0x0a,           
488                 .CC02_CT47      = substream->r    
489         };                                        
490                                                   
491         hdmi_setup_channel_allocation(codec, &    
492         hdmi_setup_channel_mapping(codec, &ai)    
493                                                   
494         hdmi_fill_audio_infoframe(codec, &ai);    
495         hdmi_start_infoframe_trans(codec);        
496 }                                                 
497                                                   
498                                                   
499 /*                                                
500  * Unsolicited events                             
501  */                                               
502                                                   
503 static void hdmi_intrinsic_event(struct hda_co    
504 {                                                 
505         int pind = !!(res & AC_UNSOL_RES_PD);     
506         int eldv = !!(res & AC_UNSOL_RES_ELDV)    
507                                                   
508         printk(KERN_INFO                          
509                 "HDMI hot plug event: Presence    
510                 pind, eldv);                      
511                                                   
512         if (pind && eldv) {                       
513                 hdmi_parse_eld(codec);            
514                 /* TODO: do real things about     
515         }                                         
516 }                                                 
517                                                   
518 static void hdmi_non_intrinsic_event(struct hd    
519 {                                                 
520         int subtag = (res & AC_UNSOL_RES_SUBTA    
521         int cp_state = !!(res & AC_UNSOL_RES_C    
522         int cp_ready = !!(res & AC_UNSOL_RES_C    
523                                                   
524         printk(KERN_INFO                          
525                 "HDMI content protection event    
526                 subtag,                           
527                 cp_state,                         
528                 cp_ready);                        
529                                                   
530         /* TODO */                                
531         if (cp_state)                             
532                 ;                                 
533         if (cp_ready)                             
534                 ;                                 
535 }                                                 
536                                                   
537                                                   
538 static void intel_hdmi_unsol_event(struct hda_    
539 {                                                 
540         int tag = res >> AC_UNSOL_RES_TAG_SHIF    
541         int subtag = (res & AC_UNSOL_RES_SUBTA    
542                                                   
543         if (tag != INTEL_HDMI_EVENT_TAG) {        
544                 snd_printd(KERN_INFO "Unexpect    
545                 return;                           
546         }                                         
547                                                   
548         if (subtag == 0)                          
549                 hdmi_intrinsic_event(codec, re    
550         else                                      
551                 hdmi_non_intrinsic_event(codec    
552 }                                                 
553                                                   
554 /*                                                
555  * Callbacks                                      
556  */                                               
557                                                   
558 static int intel_hdmi_playback_pcm_open(struct    
559                                         struct    
560                                         struct    
561 {                                                 
562         struct intel_hdmi_spec *spec = codec->    
563                                                   
564         return snd_hda_multi_out_dig_open(code    
565 }                                                 
566                                                   
567 static int intel_hdmi_playback_pcm_close(struc    
568                                          struc    
569                                          struc    
570 {                                                 
571         struct intel_hdmi_spec *spec = codec->    
572                                                   
573         hdmi_stop_infoframe_trans(codec);         
574                                                   
575         return snd_hda_multi_out_dig_close(cod    
576 }                                                 
577                                                   
578 static int intel_hdmi_playback_pcm_prepare(str    
579                                            str    
580                                            uns    
581                                            uns    
582                                            str    
583 {                                                 
584         struct intel_hdmi_spec *spec = codec->    
585                                                   
586         snd_hda_multi_out_dig_prepare(codec, &    
587                                              f    
588                                                   
589         hdmi_set_channel_count(codec, substrea    
590                                                   
591         hdmi_setup_audio_infoframe(codec, subs    
592                                                   
593         return 0;                                 
594 }                                                 
595                                                   
596 static struct hda_pcm_stream intel_hdmi_pcm_pl    
597         .substreams = 1,                          
598         .channels_min = 2,                        
599         .channels_max = 8,                        
600         .nid = CVT_NID, /* NID to query format    
601         .ops = {                                  
602                 .open    = intel_hdmi_playback    
603                 .close   = intel_hdmi_playback    
604                 .prepare = intel_hdmi_playback    
605         },                                        
606 };                                                
607                                                   
608 static int intel_hdmi_build_pcms(struct hda_co    
609 {                                                 
610         struct intel_hdmi_spec *spec = codec->    
611         struct hda_pcm *info = &spec->pcm_rec;    
612                                                   
613         codec->num_pcms = 1;                      
614         codec->pcm_info = info;                   
615                                                   
616         info->name = "INTEL HDMI";                
617         info->pcm_type = HDA_PCM_TYPE_HDMI;       
618         info->stream[SNDRV_PCM_STREAM_PLAYBACK    
619                                                   
620         return 0;                                 
621 }                                                 
622                                                   
623 static int intel_hdmi_build_controls(struct hd    
624 {                                                 
625         struct intel_hdmi_spec *spec = codec->    
626         int err;                                  
627                                                   
628         err = snd_hda_create_spdif_out_ctls(co    
629         if (err < 0)                              
630                 return err;                       
631                                                   
632         return 0;                                 
633 }                                                 
634                                                   
635 static int intel_hdmi_init(struct hda_codec *c    
636 {                                                 
637         hdmi_enable_output(codec);                
638                                                   
639         snd_hda_sequence_write(codec, unsolici    
640                                                   
641         return 0;                                 
642 }                                                 
643                                                   
644 static void intel_hdmi_free(struct hda_codec *    
645 {                                                 
646         struct intel_hdmi_spec *spec = codec->    
647                                                   
648         snd_hda_eld_proc_free(codec, &spec->si    
649         kfree(spec);                              
650 }                                                 
651                                                   
652 static struct hda_codec_ops intel_hdmi_patch_o    
653         .init                   = intel_hdmi_i    
654         .free                   = intel_hdmi_f    
655         .build_pcms             = intel_hdmi_b    
656         .build_controls         = intel_hdmi_b    
657         .unsol_event            = intel_hdmi_u    
658 };                                                
659                                                   
660 static int patch_intel_hdmi(struct hda_codec *    
661 {                                                 
662         struct intel_hdmi_spec *spec;             
663                                                   
664         spec = kzalloc(sizeof(*spec), GFP_KERN    
665         if (spec == NULL)                         
666                 return -ENOMEM;                   
667                                                   
668         spec->multiout.num_dacs = 0;      /* n    
669         spec->multiout.max_channels = 8;          
670         spec->multiout.dig_out_nid = CVT_NID;     
671                                                   
672         codec->spec = spec;                       
673         codec->patch_ops = intel_hdmi_patch_op    
674                                                   
675         snd_hda_eld_proc_new(codec, &spec->sin    
676                                                   
677         init_channel_allocations();               
678                                                   
679         return 0;                                 
680 }                                                 
681                                                   
682 static struct hda_codec_preset snd_hda_preset_    
683         { .id = 0x808629fb, .name = "G45 DEVCL    
684         { .id = 0x80862801, .name = "G45 DEVBL    
685         { .id = 0x80862802, .name = "G45 DEVCT    
686         { .id = 0x80862803, .name = "G45 DEVEL    
687         { .id = 0x80862804, .name = "G45 DEVIB    
688         { .id = 0x10951392, .name = "SiI1392 H    
689         {} /* terminator */                       
690 };                                                
691                                                   
692 MODULE_ALIAS("snd-hda-codec-id:808629fb");        
693 MODULE_ALIAS("snd-hda-codec-id:80862801");        
694 MODULE_ALIAS("snd-hda-codec-id:80862802");        
695 MODULE_ALIAS("snd-hda-codec-id:80862803");        
696 MODULE_ALIAS("snd-hda-codec-id:80862804");        
697 MODULE_ALIAS("snd-hda-codec-id:10951392");        
698                                                   
699 MODULE_LICENSE("GPL");                            
700 MODULE_DESCRIPTION("Intel HDMI HD-audio codec"    
701                                                   
702 static struct hda_codec_preset_list intel_list    
703         .preset = snd_hda_preset_intelhdmi,       
704         .owner = THIS_MODULE,                     
705 };                                                
706                                                   
707 static int __init patch_intelhdmi_init(void)      
708 {                                                 
709         return snd_hda_add_codec_preset(&intel    
710 }                                                 
711                                                   
712 static void __exit patch_intelhdmi_exit(void)     
713 {                                                 
714         snd_hda_delete_codec_preset(&intel_lis    
715 }                                                 
716                                                   
717 module_init(patch_intelhdmi_init)                 
718 module_exit(patch_intelhdmi_exit)                 
719                                                   
  This page was automatically generated by the LXR engine.