~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to kernel/drv/oss_hdaudio/hdaudio_asus_P4B_E.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 * This file is part of Open Sound System.
 
4
 *
 
5
 * Copyright (C) 4Front Technologies 1996-2008.
 
6
 *
 
7
 * This this source file is released under GPL v2 license (no other versions).
 
8
 * See the COPYING file included in the main directory of this source
 
9
 * distribution for the license terms and conditions.
 
10
 *
 
11
 */
 
12
/* Codec index is 0 */
 
13
/* Codec vendor 11d4:1988 */
 
14
/* HD codec revision 1.0 (4.0) (0x00100400) */
 
15
/* Subsystem ID 104381e1 */
 
16
/* Default amplifier caps: in=80000000, out=00052727 */
 
17
#include "oss_hdaudio_cfg.h"
 
18
#include "hdaudio.h"
 
19
#include "hdaudio_codec.h"
 
20
#include "hdaudio_dedicated.h"
 
21
 
 
22
int
 
23
hdaudio_Asus_P4B_E_mixer_init (int dev, hdaudio_mixer_t * mixer, int cad,
 
24
                               int top_group)
 
25
{
 
26
  int ctl = 0;
 
27
 
 
28
  DDB (cmn_err (CE_CONT, "hdaudio_Asus_P4B_E_mixer_init got called.\n"));
 
29
 
 
30
  HDA_OUTAMP_F (0x04, top_group, "front", 100, MIXF_PCMVOL);
 
31
  HDA_COLOR (ctl, OSS_RGB_GREEN);
 
32
  HDA_OUTAMP_F (0x0a, top_group, "side", 100, MIXF_PCMVOL);
 
33
  HDA_COLOR (ctl, OSS_RGB_GRAY);
 
34
  HDA_OUTAMP_F (0x05, top_group, "center/LFE", 100, MIXF_PCMVOL);
 
35
  HDA_COLOR (ctl, OSS_RGB_ORANGE);
 
36
  HDA_OUTAMP_F (0x06, top_group, "rear", 100, MIXF_PCMVOL);
 
37
  HDA_COLOR (ctl, OSS_RGB_BLACK);
 
38
  HDA_OUTAMP_F (0x03, top_group, "headphone", 100, MIXF_PCMVOL);
 
39
  HDA_OUTAMP_F (0x21, top_group, "input-mix", 100, MIXF_PCMVOL);
 
40
  HDA_OUTAMP_F (0x10, top_group, "pcbeep", 100, MIXF_PCMVOL);
 
41
 
 
42
  /* Handle misc widgets */
 
43
  {
 
44
    int n, group;
 
45
 
 
46
    n = 0;
 
47
 
 
48
    HDA_GROUP (group, top_group, "input-mix");
 
49
 
 
50
    //if (HDA_MISC_GROUP(0x20, group, misc_group, "input-mix", n, "misc", 4))       /* Misc widget 0x20 */
 
51
    {
 
52
      /* Src 0x39=fppink-micboost */
 
53
      /* Src 0x33=blue-insel */
 
54
      /* Src 0x38=fpgreen-micboost */
 
55
      /* Src 0x3d=green-micboost */
 
56
      /* Src 0x34=pink-insel */
 
57
      /* Src 0x3b=black-micboost */
 
58
      /* Src 0x18=cd */
 
59
      /* Src 0x1a=beep */
 
60
      HDA_INAMP (0x20, 0, group, "fp-pink", 100);       /* From widget 0x39 */
 
61
      HDA_COLOR (ctl, OSS_RGB_PINK);
 
62
 
 
63
      HDA_INAMP (0x20, 1, group, "blue", 100);  /* From widget 0x33 */
 
64
      HDA_COLOR (ctl, OSS_RGB_BLUE);
 
65
 
 
66
      HDA_INAMP (0x20, 2, group, "fp-green", 100);      /* From widget 0x38 */
 
67
      HDA_COLOR (ctl, OSS_RGB_GREEN);
 
68
 
 
69
      HDA_INAMP (0x20, 3, group, "green", 100); /* From widget 0x3d */
 
70
      HDA_COLOR (ctl, OSS_RGB_GREEN);
 
71
 
 
72
      HDA_INAMP (0x20, 4, group, "pink", 100);  /* From widget 0x34 */
 
73
      HDA_COLOR (ctl, OSS_RGB_PINK);
 
74
 
 
75
      HDA_INAMP (0x20, 5, group, "black", 100); /* From widget 0x3b */
 
76
      HDA_COLOR (ctl, OSS_RGB_BLACK);
 
77
 
 
78
      HDA_INAMP (0x20, 6, group, "cd", 100);    /* From widget 0x18 */
 
79
      HDA_COLOR (ctl, 0);
 
80
 
 
81
      HDA_INAMP (0x20, 7, group, "pcbeep", 100);        /* From widget 0x1a */
 
82
      HDA_COLOR (ctl, 0);
 
83
 
 
84
#if 0
 
85
      // This seems to be unnecessary selector
 
86
      /* Widget 0x33 (blue-insel) */
 
87
      /* Src 0x3a=blue-micboost */
 
88
      /* Src 0x25=grey */
 
89
      /* Src 0x24=orange */
 
90
      if (HDA_SELECT (0x33, "src", ctl, group, -1))
 
91
        {
 
92
          HDA_CHOICES (ctl, "blue grey orange");
 
93
        }
 
94
#endif
 
95
 
 
96
#if 0
 
97
      // This seems to be unnecessary selector
 
98
      /* Widget 0x34 (pink-insel) */
 
99
      /* Src 0x3c=pink-micboost */
 
100
      /* Src 0x25=grey */
 
101
      /* Src 0x24=orange */
 
102
      if (HDA_SELECT (0x34, "src", ctl, group, -1))
 
103
        {
 
104
          HDA_CHOICES (ctl, "pink grey orange");
 
105
        }
 
106
#endif
 
107
    }
 
108
  }
 
109
  /* Handle ADC widgets */
 
110
  {
 
111
    int n, group, rec_group;
 
112
 
 
113
    n = 0;
 
114
 
 
115
    HDA_GROUP (rec_group, top_group, "record");
 
116
 
 
117
#if 0
 
118
    if (HDA_ADC_GROUP (0x07, group, rec_group, "spdin", n, "record", 4))        /* ADC widget 0x07 */
 
119
      {
 
120
        /* Src 0x1c=spdif-in */
 
121
      }
 
122
#endif
 
123
 
 
124
    if (HDA_ADC_GROUP (0x08, group, rec_group, "rec1", n, "record", 4)) /* ADC widget 0x08 */
 
125
      {
 
126
        /* Src 0xc=rec1-src */
 
127
 
 
128
        /* Widget 0x0c (rec1-src) */
 
129
        /* Src 0x38=fpgreen-micboost */
 
130
        /* Src 0xbc= (0x3c=porte-boost?) */
 
131
        /* Src 0x18=int-black */
 
132
        /* Src 0x24=orange */
 
133
        /* Src 0x25=grey */
 
134
        /* Src 0x3d=green-micboost */
 
135
        /* Src 0x20=input-mix */
 
136
        if (HDA_SELECT (0x0c, "src", ctl, group, -1))
 
137
          {
 
138
            HDA_CHOICES (ctl, "fp-green pink cd orange grey green input-mix");
 
139
          }
 
140
        HDA_OUTAMP_F (0x0c, group, "-", 100, MIXF_RECVOL);
 
141
      }
 
142
 
 
143
    if (HDA_ADC_GROUP (0x09, group, rec_group, "rec2", n, "record", 4)) /* ADC widget 0x09 */
 
144
      {
 
145
        /* Src 0xd=rec2-src */
 
146
 
 
147
        /* Widget 0x0d (rec2-src) */
 
148
        /* Src 0x38=fpgreen-micboost */
 
149
        /* Src 0xbc= (0x3c=porte-boost?) */
 
150
        /* Src 0x18=int-black */
 
151
        /* Src 0x24=orange */
 
152
        /* Src 0x25=grey */
 
153
        /* Src 0x3d=green-micboost */
 
154
        /* Src 0x20=input-mix */
 
155
        if (HDA_SELECT (0x0d, "src", ctl, group, -1))
 
156
          {
 
157
            HDA_CHOICES (ctl, "fp-green pink cd orange grey green input-mix");
 
158
          }
 
159
        HDA_OUTAMP_F (0x0d, group, "-", 100, MIXF_RECVOL);
 
160
      }
 
161
 
 
162
    if (HDA_ADC_GROUP (0x0f, group, rec_group, "rec3", n, "record", 4)) /* ADC widget 0x0f */
 
163
      {
 
164
        /* Src 0xe=rec3-src */
 
165
 
 
166
        /* Widget 0x0e (rec3-src) */
 
167
        /* Src 0x38=fpgreen-micboost */
 
168
        /* Src 0xbc= (0x3c=porte-boost?) */
 
169
        /* Src 0x18=int-black */
 
170
        /* Src 0x24=orange */
 
171
        /* Src 0x25=grey */
 
172
        /* Src 0x3d=green-micboost */
 
173
        /* Src 0x20=input-mix */
 
174
        if (HDA_SELECT (0x0e, "src", ctl, group, -1))
 
175
          {
 
176
            HDA_CHOICES (ctl, "fp-green pink cd orange grey green input-mix");
 
177
          }
 
178
        HDA_OUTAMP_F (0x0e, group, "-", 100, MIXF_RECVOL);
 
179
      }
 
180
  }
 
181
 
 
182
  /* Handle PIN widgets */
 
183
  {
 
184
    int n, group, pin_group;
 
185
 
 
186
    n = 0;
 
187
 
 
188
    HDA_GROUP (pin_group, top_group, "jack");
 
189
 
 
190
    if (HDA_PIN_GROUP (0x11, group, pin_group, "fp-green", n, "jack", 4))       /* Pin widget 0x11 */
 
191
      {
 
192
        /* Src 0x22=headphon-mix */
 
193
        if (HDA_PINSELECT (0x11, ctl, group, "mode", -1))
 
194
          HDA_CHOICES (ctl, "headphone-out input");
 
195
        HDA_OUTMUTE (0x11, group, "inmute", UNMUTE);
 
196
 
 
197
        /* Widget 0x22 (headphon-mix) */
 
198
        /* Src 0x37=fpgreen-outsel */
 
199
        /* Src 0x21=input-mix */
 
200
        {
 
201
          int amp_group;
 
202
 
 
203
          HDA_GROUP (amp_group, group, "mute");
 
204
          HDA_INMUTE_F (0x22, 0, amp_group, "headphone", UNMUTE, MIXF_MAINVOL); /* From widget 0x37 */
 
205
          HDA_INMUTE_F (0x22, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
206
        }
 
207
        /* Widget 0x38 (fpgreen-micboost) */
 
208
        /* Src 0x11=fp-green */
 
209
        HDA_OUTAMP (0x38, group, "micboost", 100);
 
210
      }
 
211
 
 
212
    if (HDA_PIN_GROUP (0x14, group, pin_group, "fp-pink", n, "jack", 4))        /* Pin widget 0x14 */
 
213
      {
 
214
        /* Src 0x2b=fp-mic-mix */
 
215
        if (HDA_PINSELECT (0x14, ctl, group, "mode", -1))
 
216
          HDA_CHOICES (ctl, "headphone-out input");
 
217
        HDA_OUTMUTE (0x14, group, "inmute", UNMUTE);
 
218
 
 
219
        /* Widget 0x2b (fp-mic-mix) */
 
220
        /* Src 0x30=fppink-outsel */
 
221
        /* Src 0x21=input-mix */
 
222
        {
 
223
          int amp_group;
 
224
 
 
225
          HDA_GROUP (amp_group, group, "mute");
 
226
          HDA_INMUTE_F (0x2b, 0, amp_group, "headphone", UNMUTE, MIXF_MAINVOL); /* From widget 0x30 */
 
227
          HDA_INMUTE_F (0x2b, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
228
        }
 
229
        /* Widget 0x39 (fppink-micboost) */
 
230
        /* Src 0x14=fp-pink */
 
231
        HDA_OUTAMP (0x39, group, "micboost", 100);
 
232
      }
 
233
 
 
234
    if (HDA_PIN_GROUP (0x12, group, pin_group, "green", n, "jack", 0))  /* Pin widget 0x12 */
 
235
      {
 
236
        /* Src 0x29=front-mix */
 
237
        if (HDA_PINSELECT (0x12, ctl, group, "mode", -1))
 
238
          HDA_CHOICES (ctl, "front-out input");
 
239
        HDA_OUTMUTE (0x12, group, "inmute", UNMUTE);
 
240
 
 
241
        /* Widget 0x29 (front-mix) */
 
242
        /* Src 0x4=front */
 
243
        /* Src 0x21=input-mix */
 
244
        {
 
245
          int amp_group;
 
246
 
 
247
          HDA_GROUP (amp_group, group, "mute");
 
248
          HDA_INMUTE_F (0x29, 0, amp_group, "front", UNMUTE, MIXF_MAINVOL);     /* From widget 0x04 */
 
249
          HDA_INMUTE_F (0x29, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
250
        }
 
251
        /* Widget 0x3d (green-micboost) */
 
252
        /* Src 0x12=green */
 
253
        HDA_OUTAMP (0x3d, group, "micboost", 100);
 
254
      }
 
255
 
 
256
    if (HDA_PIN_GROUP (0x13, group, pin_group, "int-black", n, "jack", 4))      /* Pin widget 0x13 */
 
257
      {
 
258
        /* Src 0x2d=mono-mixdown */
 
259
        if (HDA_PINSELECT (0x13, ctl, group, "mode", -1))
 
260
          HDA_CHOICES (ctl, "mono-out input");
 
261
        HDA_OUTAMP (0x13, group, "invol", 100);
 
262
 
 
263
        /* Widget 0x2d (mono-mixdown) */
 
264
        /* Src 0x1e=mono-mix */
 
265
 
 
266
        /* Widget 0x1e (mono-mix) */
 
267
        /* Src 0x36=mono-sel */
 
268
        /* Src 0x21=input-mix */
 
269
        {
 
270
          int amp_group;
 
271
 
 
272
          HDA_GROUP (amp_group, group, "mute");
 
273
          HDA_INMUTE_F (0x1e, 0, amp_group, "mono", UNMUTE, MIXF_MAINVOL);      /* From widget 0x36 */
 
274
          HDA_INMUTE_F (0x1e, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
275
        }
 
276
      }
 
277
 
 
278
    if (HDA_PIN_GROUP (0x15, group, pin_group, "blue", n, "jack", 4))   /* Pin widget 0x15 */
 
279
      {
 
280
        /* Src 0x2c=linein-mix */
 
281
        if (HDA_PINSELECT (0x15, ctl, group, "mode", -1))
 
282
          HDA_CHOICES (ctl, "front-out input");
 
283
        HDA_OUTMUTE (0x15, group, "inmute", UNMUTE);
 
284
 
 
285
        /* Widget 0x2c (linein-mix) */
 
286
        /* Src 0x31=blue-outsel */
 
287
        /* Src 0x21=input-mix */
 
288
        {
 
289
          int amp_group;
 
290
 
 
291
          HDA_GROUP (amp_group, group, "mute");
 
292
          HDA_INMUTE_F (0x2c, 0, amp_group, "front", UNMUTE, MIXF_MAINVOL);     /* From widget 0x31 */
 
293
          HDA_INMUTE_F (0x2c, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
294
        }
 
295
        /* Src 0x15=linein */
 
296
        HDA_OUTAMP (0x3a, group, "micboost", 100);
 
297
      }
 
298
 
 
299
    if (HDA_PIN_GROUP (0x16, group, pin_group, "black", n, "jack", 4))  /* Pin widget 0x16 */
 
300
      {
 
301
        /* Src 0x2a=rear-mix */
 
302
        if (HDA_PINSELECT (0x16, ctl, group, "mode", -1))
 
303
          HDA_CHOICES (ctl, "rear-out input");
 
304
        HDA_OUTMUTE (0x16, group, "inmute", UNMUTE);
 
305
 
 
306
        /* Widget 0x2a (rear-mix) */
 
307
        /* Src 0x6=rear */
 
308
        /* Src 0x21=input-mix */
 
309
        {
 
310
          int amp_group;
 
311
 
 
312
          HDA_GROUP (amp_group, group, "mute");
 
313
          HDA_INMUTE_F (0x2a, 0, amp_group, "rear", UNMUTE, MIXF_MAINVOL);      /* From widget 0x06 */
 
314
          HDA_INMUTE_F (0x2a, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
315
        }
 
316
        /* Widget 0x3b (black-micboost) */
 
317
        /* Src 0x16=black */
 
318
        HDA_OUTAMP (0x3b, group, "micboost", 100);
 
319
      }
 
320
 
 
321
    if (HDA_PIN_GROUP (0x17, group, pin_group, "pink", n, "jack", 0))   /* Pin widget 0x17 */
 
322
      {
 
323
        /* Src 0x26=mic-mix */
 
324
        if (HDA_PINSELECT (0x17, ctl, group, "mode", -1))
 
325
          HDA_CHOICES (ctl, "center/LFE-out input");
 
326
        HDA_OUTMUTE (0x17, group, "inmute", UNMUTE);
 
327
 
 
328
        /* Widget 0x26 (mic-mix) */
 
329
        /* Src 0x32=pink-outsel */
 
330
        /* Src 0x21=input-mix */
 
331
        {
 
332
          int amp_group;
 
333
 
 
334
          HDA_GROUP (amp_group, group, "mute");
 
335
          HDA_INMUTE_F (0x26, 0, amp_group, "center/LFE", UNMUTE, MIXF_MAINVOL);        /* From widget 0x32 */
 
336
          HDA_INMUTE_F (0x26, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
337
        }
 
338
        /* Src 0x17=mic */
 
339
        HDA_OUTAMP (0x3c, group, "micboost", 100);
 
340
      }
 
341
 
 
342
#if 0
 
343
    if (HDA_PIN_GROUP (0x18, group, pin_group, "int-black", n, "jack", 4))      /* Pin widget 0x18 */
 
344
      {
 
345
        if (HDA_PINSELECT (0x18, ctl, group, "mode", -1))
 
346
          HDA_CHOICES (ctl, "input");
 
347
      }
 
348
 
 
349
    if (HDA_PIN_GROUP (0x1a, group, pin_group, "int-black", n, "jack", 4))      /* Pin widget 0x1a */
 
350
      {
 
351
        if (HDA_PINSELECT (0x1a, ctl, group, "mode", -1))
 
352
          HDA_CHOICES (ctl, "input");
 
353
      }
 
354
#endif
 
355
 
 
356
    if (HDA_PIN_GROUP (0x24, group, pin_group, "orange", n, "jack", 4)) /* Pin widget 0x24 */
 
357
      {
 
358
        /* Src 0x27=center/LFE-mix */
 
359
        if (HDA_PINSELECT (0x24, ctl, group, "mode", -1))
 
360
          HDA_CHOICES (ctl, "center/LFE-out input");
 
361
        HDA_OUTMUTE (0x24, group, "inmute", UNMUTE);
 
362
 
 
363
        /* Widget 0x27 (center/LFE-mix) */
 
364
        /* Src 0x5=center/LFE */
 
365
        /* Src 0x21=input-mix */
 
366
        {
 
367
          int amp_group;
 
368
 
 
369
          HDA_GROUP (amp_group, group, "mute");
 
370
          HDA_INMUTE_F (0x27, 0, amp_group, "center/LFE", UNMUTE, MIXF_MAINVOL);        /* From widget 0x05 */
 
371
          HDA_INMUTE_F (0x27, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
372
        }
 
373
      }
 
374
 
 
375
    if (HDA_PIN_GROUP (0x25, group, pin_group, "grey", n, "jack", 4))   /* Pin widget 0x25 */
 
376
      {
 
377
        /* Src 0x28=side-mix */
 
378
        if (HDA_PINSELECT (0x25, ctl, group, "mode", -1))
 
379
          HDA_CHOICES (ctl, "side-out input");
 
380
        HDA_OUTMUTE (0x25, group, "inmute", UNMUTE);
 
381
 
 
382
        /* Widget 0x28 (side-mix) */
 
383
        /* Src 0xa=side */
 
384
        /* Src 0x21=input-mix */
 
385
        {
 
386
          int amp_group;
 
387
 
 
388
          HDA_GROUP (amp_group, group, "mute");
 
389
          HDA_INMUTE_F (0x28, 0, amp_group, "side", UNMUTE, MIXF_MAINVOL);      /* From widget 0x0a */
 
390
          HDA_INMUTE_F (0x28, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL); /* From widget 0x21 */
 
391
        }
 
392
      }
 
393
  }
 
394
  return 0;
 
395
}