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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
/*
 *
 * This file is part of Open Sound System.
 *
 * Copyright (C) 4Front Technologies 1996-2008.
 *
 * This this source file is released under GPL v2 license (no other versions).
 * See the COPYING file included in the main directory of this source
 * distribution for the license terms and conditions.
 *
 */
/* Codec index is 0 */
/* Codec vendor 11d4:1988 */
/* HD codec revision 1.0 (4.0) (0x00100400) */
/* Subsystem ID 104381e1 */
/* Default amplifier caps: in=80000000, out=00052727 */
#include "oss_hdaudio_cfg.h"
#include "hdaudio.h"
#include "hdaudio_codec.h"
#include "hdaudio_dedicated.h"

int
hdaudio_Asus_P4B_E_mixer_init (int dev, hdaudio_mixer_t * mixer, int cad,
			       int top_group)
{
  int ctl = 0;

  DDB (cmn_err (CE_CONT, "hdaudio_Asus_P4B_E_mixer_init got called.\n"));

  HDA_OUTAMP_F (0x04, top_group, "front", 100, MIXF_PCMVOL);
  HDA_COLOR (ctl, OSS_RGB_GREEN);
  HDA_OUTAMP_F (0x0a, top_group, "side", 100, MIXF_PCMVOL);
  HDA_COLOR (ctl, OSS_RGB_GRAY);
  HDA_OUTAMP_F (0x05, top_group, "center/LFE", 100, MIXF_PCMVOL);
  HDA_COLOR (ctl, OSS_RGB_ORANGE);
  HDA_OUTAMP_F (0x06, top_group, "rear", 100, MIXF_PCMVOL);
  HDA_COLOR (ctl, OSS_RGB_BLACK);
  HDA_OUTAMP_F (0x03, top_group, "headphone", 100, MIXF_PCMVOL);
  HDA_OUTAMP_F (0x21, top_group, "input-mix", 100, MIXF_PCMVOL);
  HDA_OUTAMP_F (0x10, top_group, "pcbeep", 100, MIXF_PCMVOL);

  /* Handle misc widgets */
  {
    int n, group;

    n = 0;

    HDA_GROUP (group, top_group, "input-mix");

    //if (HDA_MISC_GROUP(0x20, group, misc_group, "input-mix", n, "misc", 4))       /* Misc widget 0x20 */
    {
      /* Src 0x39=fppink-micboost */
      /* Src 0x33=blue-insel */
      /* Src 0x38=fpgreen-micboost */
      /* Src 0x3d=green-micboost */
      /* Src 0x34=pink-insel */
      /* Src 0x3b=black-micboost */
      /* Src 0x18=cd */
      /* Src 0x1a=beep */
      HDA_INAMP (0x20, 0, group, "fp-pink", 100);	/* From widget 0x39 */
      HDA_COLOR (ctl, OSS_RGB_PINK);

      HDA_INAMP (0x20, 1, group, "blue", 100);	/* From widget 0x33 */
      HDA_COLOR (ctl, OSS_RGB_BLUE);

      HDA_INAMP (0x20, 2, group, "fp-green", 100);	/* From widget 0x38 */
      HDA_COLOR (ctl, OSS_RGB_GREEN);

      HDA_INAMP (0x20, 3, group, "green", 100);	/* From widget 0x3d */
      HDA_COLOR (ctl, OSS_RGB_GREEN);

      HDA_INAMP (0x20, 4, group, "pink", 100);	/* From widget 0x34 */
      HDA_COLOR (ctl, OSS_RGB_PINK);

      HDA_INAMP (0x20, 5, group, "black", 100);	/* From widget 0x3b */
      HDA_COLOR (ctl, OSS_RGB_BLACK);

      HDA_INAMP (0x20, 6, group, "cd", 100);	/* From widget 0x18 */
      HDA_COLOR (ctl, 0);

      HDA_INAMP (0x20, 7, group, "pcbeep", 100);	/* From widget 0x1a */
      HDA_COLOR (ctl, 0);

#if 0
      // This seems to be unnecessary selector
      /* Widget 0x33 (blue-insel) */
      /* Src 0x3a=blue-micboost */
      /* Src 0x25=grey */
      /* Src 0x24=orange */
      if (HDA_SELECT (0x33, "src", ctl, group, -1))
	{
	  HDA_CHOICES (ctl, "blue grey orange");
	}
#endif

#if 0
      // This seems to be unnecessary selector
      /* Widget 0x34 (pink-insel) */
      /* Src 0x3c=pink-micboost */
      /* Src 0x25=grey */
      /* Src 0x24=orange */
      if (HDA_SELECT (0x34, "src", ctl, group, -1))
	{
	  HDA_CHOICES (ctl, "pink grey orange");
	}
#endif
    }
  }
  /* Handle ADC widgets */
  {
    int n, group, rec_group;

    n = 0;

    HDA_GROUP (rec_group, top_group, "record");

#if 0
    if (HDA_ADC_GROUP (0x07, group, rec_group, "spdin", n, "record", 4))	/* ADC widget 0x07 */
      {
	/* Src 0x1c=spdif-in */
      }
#endif

    if (HDA_ADC_GROUP (0x08, group, rec_group, "rec1", n, "record", 4))	/* ADC widget 0x08 */
      {
	/* Src 0xc=rec1-src */

	/* Widget 0x0c (rec1-src) */
	/* Src 0x38=fpgreen-micboost */
	/* Src 0xbc= (0x3c=porte-boost?) */
	/* Src 0x18=int-black */
	/* Src 0x24=orange */
	/* Src 0x25=grey */
	/* Src 0x3d=green-micboost */
	/* Src 0x20=input-mix */
	if (HDA_SELECT (0x0c, "src", ctl, group, -1))
	  {
	    HDA_CHOICES (ctl, "fp-green pink cd orange grey green input-mix");
	  }
	HDA_OUTAMP_F (0x0c, group, "-", 100, MIXF_RECVOL);
      }

    if (HDA_ADC_GROUP (0x09, group, rec_group, "rec2", n, "record", 4))	/* ADC widget 0x09 */
      {
	/* Src 0xd=rec2-src */

	/* Widget 0x0d (rec2-src) */
	/* Src 0x38=fpgreen-micboost */
	/* Src 0xbc= (0x3c=porte-boost?) */
	/* Src 0x18=int-black */
	/* Src 0x24=orange */
	/* Src 0x25=grey */
	/* Src 0x3d=green-micboost */
	/* Src 0x20=input-mix */
	if (HDA_SELECT (0x0d, "src", ctl, group, -1))
	  {
	    HDA_CHOICES (ctl, "fp-green pink cd orange grey green input-mix");
	  }
	HDA_OUTAMP_F (0x0d, group, "-", 100, MIXF_RECVOL);
      }

    if (HDA_ADC_GROUP (0x0f, group, rec_group, "rec3", n, "record", 4))	/* ADC widget 0x0f */
      {
	/* Src 0xe=rec3-src */

	/* Widget 0x0e (rec3-src) */
	/* Src 0x38=fpgreen-micboost */
	/* Src 0xbc= (0x3c=porte-boost?) */
	/* Src 0x18=int-black */
	/* Src 0x24=orange */
	/* Src 0x25=grey */
	/* Src 0x3d=green-micboost */
	/* Src 0x20=input-mix */
	if (HDA_SELECT (0x0e, "src", ctl, group, -1))
	  {
	    HDA_CHOICES (ctl, "fp-green pink cd orange grey green input-mix");
	  }
	HDA_OUTAMP_F (0x0e, group, "-", 100, MIXF_RECVOL);
      }
  }

  /* Handle PIN widgets */
  {
    int n, group, pin_group;

    n = 0;

    HDA_GROUP (pin_group, top_group, "jack");

    if (HDA_PIN_GROUP (0x11, group, pin_group, "fp-green", n, "jack", 4))	/* Pin widget 0x11 */
      {
	/* Src 0x22=headphon-mix */
	if (HDA_PINSELECT (0x11, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "headphone-out input");
	HDA_OUTMUTE (0x11, group, "inmute", UNMUTE);

	/* Widget 0x22 (headphon-mix) */
	/* Src 0x37=fpgreen-outsel */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x22, 0, amp_group, "headphone", UNMUTE, MIXF_MAINVOL);	/* From widget 0x37 */
	  HDA_INMUTE_F (0x22, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
	/* Widget 0x38 (fpgreen-micboost) */
	/* Src 0x11=fp-green */
	HDA_OUTAMP (0x38, group, "micboost", 100);
      }

    if (HDA_PIN_GROUP (0x14, group, pin_group, "fp-pink", n, "jack", 4))	/* Pin widget 0x14 */
      {
	/* Src 0x2b=fp-mic-mix */
	if (HDA_PINSELECT (0x14, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "headphone-out input");
	HDA_OUTMUTE (0x14, group, "inmute", UNMUTE);

	/* Widget 0x2b (fp-mic-mix) */
	/* Src 0x30=fppink-outsel */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x2b, 0, amp_group, "headphone", UNMUTE, MIXF_MAINVOL);	/* From widget 0x30 */
	  HDA_INMUTE_F (0x2b, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
	/* Widget 0x39 (fppink-micboost) */
	/* Src 0x14=fp-pink */
	HDA_OUTAMP (0x39, group, "micboost", 100);
      }

    if (HDA_PIN_GROUP (0x12, group, pin_group, "green", n, "jack", 0))	/* Pin widget 0x12 */
      {
	/* Src 0x29=front-mix */
	if (HDA_PINSELECT (0x12, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "front-out input");
	HDA_OUTMUTE (0x12, group, "inmute", UNMUTE);

	/* Widget 0x29 (front-mix) */
	/* Src 0x4=front */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x29, 0, amp_group, "front", UNMUTE, MIXF_MAINVOL);	/* From widget 0x04 */
	  HDA_INMUTE_F (0x29, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
	/* Widget 0x3d (green-micboost) */
	/* Src 0x12=green */
	HDA_OUTAMP (0x3d, group, "micboost", 100);
      }

    if (HDA_PIN_GROUP (0x13, group, pin_group, "int-black", n, "jack", 4))	/* Pin widget 0x13 */
      {
	/* Src 0x2d=mono-mixdown */
	if (HDA_PINSELECT (0x13, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "mono-out input");
	HDA_OUTAMP (0x13, group, "invol", 100);

	/* Widget 0x2d (mono-mixdown) */
	/* Src 0x1e=mono-mix */

	/* Widget 0x1e (mono-mix) */
	/* Src 0x36=mono-sel */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x1e, 0, amp_group, "mono", UNMUTE, MIXF_MAINVOL);	/* From widget 0x36 */
	  HDA_INMUTE_F (0x1e, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
      }

    if (HDA_PIN_GROUP (0x15, group, pin_group, "blue", n, "jack", 4))	/* Pin widget 0x15 */
      {
	/* Src 0x2c=linein-mix */
	if (HDA_PINSELECT (0x15, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "front-out input");
	HDA_OUTMUTE (0x15, group, "inmute", UNMUTE);

	/* Widget 0x2c (linein-mix) */
	/* Src 0x31=blue-outsel */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x2c, 0, amp_group, "front", UNMUTE, MIXF_MAINVOL);	/* From widget 0x31 */
	  HDA_INMUTE_F (0x2c, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
	/* Src 0x15=linein */
	HDA_OUTAMP (0x3a, group, "micboost", 100);
      }

    if (HDA_PIN_GROUP (0x16, group, pin_group, "black", n, "jack", 4))	/* Pin widget 0x16 */
      {
	/* Src 0x2a=rear-mix */
	if (HDA_PINSELECT (0x16, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "rear-out input");
	HDA_OUTMUTE (0x16, group, "inmute", UNMUTE);

	/* Widget 0x2a (rear-mix) */
	/* Src 0x6=rear */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x2a, 0, amp_group, "rear", UNMUTE, MIXF_MAINVOL);	/* From widget 0x06 */
	  HDA_INMUTE_F (0x2a, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
	/* Widget 0x3b (black-micboost) */
	/* Src 0x16=black */
	HDA_OUTAMP (0x3b, group, "micboost", 100);
      }

    if (HDA_PIN_GROUP (0x17, group, pin_group, "pink", n, "jack", 0))	/* Pin widget 0x17 */
      {
	/* Src 0x26=mic-mix */
	if (HDA_PINSELECT (0x17, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "center/LFE-out input");
	HDA_OUTMUTE (0x17, group, "inmute", UNMUTE);

	/* Widget 0x26 (mic-mix) */
	/* Src 0x32=pink-outsel */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x26, 0, amp_group, "center/LFE", UNMUTE, MIXF_MAINVOL);	/* From widget 0x32 */
	  HDA_INMUTE_F (0x26, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
	/* Src 0x17=mic */
	HDA_OUTAMP (0x3c, group, "micboost", 100);
      }

#if 0
    if (HDA_PIN_GROUP (0x18, group, pin_group, "int-black", n, "jack", 4))	/* Pin widget 0x18 */
      {
	if (HDA_PINSELECT (0x18, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "input");
      }

    if (HDA_PIN_GROUP (0x1a, group, pin_group, "int-black", n, "jack", 4))	/* Pin widget 0x1a */
      {
	if (HDA_PINSELECT (0x1a, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "input");
      }
#endif

    if (HDA_PIN_GROUP (0x24, group, pin_group, "orange", n, "jack", 4))	/* Pin widget 0x24 */
      {
	/* Src 0x27=center/LFE-mix */
	if (HDA_PINSELECT (0x24, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "center/LFE-out input");
	HDA_OUTMUTE (0x24, group, "inmute", UNMUTE);

	/* Widget 0x27 (center/LFE-mix) */
	/* Src 0x5=center/LFE */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x27, 0, amp_group, "center/LFE", UNMUTE, MIXF_MAINVOL);	/* From widget 0x05 */
	  HDA_INMUTE_F (0x27, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
      }

    if (HDA_PIN_GROUP (0x25, group, pin_group, "grey", n, "jack", 4))	/* Pin widget 0x25 */
      {
	/* Src 0x28=side-mix */
	if (HDA_PINSELECT (0x25, ctl, group, "mode", -1))
	  HDA_CHOICES (ctl, "side-out input");
	HDA_OUTMUTE (0x25, group, "inmute", UNMUTE);

	/* Widget 0x28 (side-mix) */
	/* Src 0xa=side */
	/* Src 0x21=input-mix */
	{
	  int amp_group;

	  HDA_GROUP (amp_group, group, "mute");
	  HDA_INMUTE_F (0x28, 0, amp_group, "side", UNMUTE, MIXF_MAINVOL);	/* From widget 0x0a */
	  HDA_INMUTE_F (0x28, 1, amp_group, "input-mix", UNMUTE, MIXF_MAINVOL);	/* From widget 0x21 */
	}
      }
  }
  return 0;
}