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

« back to all changes in this revision

Viewing changes to kernel/drv/oss_hdaudio/hdaudio_scaleoP.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 0804:7d10 */
 
14
/* HD codec revision 1.0 (0.1) (0x00100001) */
 
15
/* Subsystem ID 1043e601 */
 
16
/* Default amplifier caps: in=00000000, out=00000000 */
 
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_scaleoP_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_scaleoP_mixer_init got called.\n"));
 
29
 
 
30
  HDA_OUTAMP_F (0x0c, top_group, "front", 90, MIXF_PCMVOL);
 
31
  HDA_OUTAMP_F (0x0d, top_group, "rear", 90, MIXF_PCMVOL);
 
32
  HDA_OUTAMP_F (0x0e, top_group, "center/LFE", 90, MIXF_PCMVOL);
 
33
  HDA_OUTAMP_F (0x0f, top_group, "side", 90, MIXF_PCMVOL);
 
34
  HDA_OUTAMP_F (0x26, top_group, "pcm4", 90, MIXF_PCMVOL);
 
35
 
 
36
  /*
 
37
   * Unmute all inputs for the above sliders.
 
38
   */
 
39
  HDA_SET_INMUTE (0x0c, 0, UNMUTE);     /* From widget 0x02 */
 
40
  HDA_SET_INMUTE (0x0c, 1, UNMUTE);     /* From widget 0x0b */
 
41
  HDA_SET_INMUTE (0x0d, 0, UNMUTE);     /* From widget 0x03 */
 
42
  HDA_SET_INMUTE (0x0d, 1, UNMUTE);     /* From widget 0x0b */
 
43
  HDA_SET_INMUTE (0x0e, 0, UNMUTE);     /* From widget 0x04 */
 
44
  HDA_SET_INMUTE (0x0e, 1, UNMUTE);     /* From widget 0x0b */
 
45
  HDA_SET_INMUTE (0x0f, 0, UNMUTE);     /* From widget 0x05 */
 
46
  HDA_SET_INMUTE (0x0f, 1, UNMUTE);     /* From widget 0x0b */
 
47
  HDA_SET_INMUTE (0x26, 0, UNMUTE);     /* From widget 0x25 */
 
48
  HDA_SET_INMUTE (0x26, 1, UNMUTE);     /* From widget 0x0b */
 
49
 
 
50
  /* Handle ADC widgets */
 
51
  {
 
52
    int n, group, rec_group;
 
53
 
 
54
    n = 0;
 
55
 
 
56
    HDA_GROUP (rec_group, top_group, "record");
 
57
 
 
58
    if (HDA_ADC_GROUP (0x08, group, rec_group, "rec1", n, "record", 2)) /* ADC widget 0x08 */
 
59
      {
 
60
        /* Src 0x23=mix */
 
61
        HDA_INAMP (0x08, 0, group, "-", 90);    /* From widget 0x23 */
 
62
 
 
63
        /* Widget 0x23 (mix) */
 
64
        /* Src 0x18=pink */
 
65
        /* Src 0x19=fp-pink */
 
66
        /* Src 0x1a=blue */
 
67
        /* Src 0x1b=fp-green */
 
68
        /* Src 0x1c=int-aux */
 
69
        /* Src 0x1d=black */
 
70
        /* Src 0x14=green */
 
71
        /* Src 0x15=black */
 
72
        /* Src 0x16=orange */
 
73
        /* Src 0x17=grey */
 
74
        /* Src 0x0b=input-mix */
 
75
        if (HDA_INSRC_SELECT (0x23, group, ctl, "recsrc", 10))
 
76
          HDA_CHOICES (ctl,
 
77
                       "pink fp-pink blue fp-green int-aux black green black orange grey input-mix");
 
78
      }
 
79
 
 
80
    if (HDA_ADC_GROUP (0x09, group, rec_group, "rec2", n, "record", 2)) /* ADC widget 0x09 */
 
81
      {
 
82
        /* Src 0x22=mix */
 
83
        HDA_INAMP (0x09, 0, group, "-", 90);    /* From widget 0x22 */
 
84
 
 
85
        /* Widget 0x22 (mix) */
 
86
        /* Src 0x18=pink */
 
87
        /* Src 0x19=fp-pink */
 
88
        /* Src 0x1a=blue */
 
89
        /* Src 0x1b=fp-green */
 
90
        /* Src 0x1c=int-aux */
 
91
        /* Src 0x1d=black */
 
92
        /* Src 0x14=green */
 
93
        /* Src 0x15=black */
 
94
        /* Src 0x16=orange */
 
95
        /* Src 0x17=grey */
 
96
        /* Src 0xb=input-mix */
 
97
        if (HDA_INSRC_SELECT (0x23, group, ctl, "recsrc", 10))
 
98
          HDA_CHOICES (ctl,
 
99
                       "pink fp-pink blue fp-green int-aux black green black orange grey input-mix");
 
100
      }
 
101
 
 
102
#if 0
 
103
    if (HDA_ADC_GROUP (0x0a, group, rec_group, "spdif-in", n, "record", 4))     /* ADC widget 0x0a */
 
104
      {
 
105
        /* Src 0x1f=speaker */
 
106
      }
 
107
#endif
 
108
  }
 
109
  /* Handle misc widgets */
 
110
  {
 
111
    int n, group;
 
112
 
 
113
    n = 0;
 
114
 
 
115
    HDA_GROUP (group, top_group, "input-mix");
 
116
 
 
117
    /* Src 0x18=mic */
 
118
    /* Src 0x19=fp-mic */
 
119
    /* Src 0x1a=linein */
 
120
    /* Src 0x1b=fp-headphone */
 
121
    /* Src 0x1c=int-aux */
 
122
    /* Src 0x1d=speaker */
 
123
    /* Src 0x14=lineout */
 
124
    /* Src 0x15=lineout */
 
125
    /* Src 0x16=lineout */
 
126
    /* Src 0x17=lineout */
 
127
    HDA_INAMP (0x0b, 0, group, "pink", 30);     /* From widget 0x18 */
 
128
    HDA_INAMP (0x0b, 2, group, "blue", 90);     /* From widget 0x1a */
 
129
    HDA_INAMP (0x0b, 4, group, "int-aux", 90);  /* From widget 0x1c */
 
130
    HDA_INAMP (0x0b, 5, group, "black", 90);    /* From widget 0x1d */
 
131
    HDA_INAMP (0x0b, 6, group, "green", 90);    /* From widget 0x14 */
 
132
    HDA_INAMP (0x0b, 7, group, "black", 90);    /* From widget 0x15 */
 
133
    HDA_INAMP (0x0b, 8, group, "orange", 90);   /* From widget 0x16 */
 
134
    HDA_INAMP (0x0b, 9, group, "grey", 90);     /* From widget 0x17 */
 
135
    HDA_INAMP (0x0b, 3, group, "fp-green", 90); /* From widget 0x1b */
 
136
    HDA_INAMP (0x0b, 1, group, "fp-pink", 30);  /* From widget 0x19 */
 
137
  }
 
138
  /* Handle PIN widgets */
 
139
  {
 
140
    int n, group, pin_group;
 
141
 
 
142
    n = 0;
 
143
 
 
144
    HDA_GROUP (pin_group, top_group, "jack");
 
145
 
 
146
    if (HDA_PIN_GROUP (0x14, group, pin_group, "green", n, "jack", 4))  /* Pin widget 0x14 */
 
147
      {
 
148
        /* Src 0xc=front */
 
149
        /* Src 0xd=rear */
 
150
        /* Src 0xe=center/LFE */
 
151
        /* Src 0xf=side */
 
152
        /* Src 0x26=pcm4 */
 
153
        if (HDA_PINSELECT (0x14, ctl, group, "mode", -1))
 
154
          HDA_CHOICES (ctl,
 
155
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
156
        HDA_OUTMUTE (0x14, group, "inmute", UNMUTE);
 
157
        HDA_INAMP (0x14, 0, group, "in", 90);   /* From widget 0x0c */
 
158
      }
 
159
 
 
160
    if (HDA_PIN_GROUP (0x15, group, pin_group, "black", n, "jack", 4))  /* Pin widget 0x15 */
 
161
      {
 
162
        /* Src 0xc=front */
 
163
        /* Src 0xd=rear */
 
164
        /* Src 0xe=center/LFE */
 
165
        /* Src 0xf=side */
 
166
        /* Src 0x26=pcm4 */
 
167
        if (HDA_PINSELECT (0x15, ctl, group, "mode", -1))
 
168
          HDA_CHOICES (ctl,
 
169
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
170
        HDA_OUTMUTE (0x15, group, "inmute", UNMUTE);
 
171
        HDA_INAMP (0x15, 0, group, "in", 90);   /* From widget 0x0c */
 
172
      }
 
173
 
 
174
    if (HDA_PIN_GROUP (0x16, group, pin_group, "orange", n, "jack", 4)) /* Pin widget 0x16 */
 
175
      {
 
176
        /* Src 0xc=front */
 
177
        /* Src 0xd=rear */
 
178
        /* Src 0xe=center/LFE */
 
179
        /* Src 0xf=side */
 
180
        /* Src 0x26=pcm4 */
 
181
        if (HDA_PINSELECT (0x16, ctl, group, "mode", -1))
 
182
          HDA_CHOICES (ctl,
 
183
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
184
        HDA_OUTMUTE (0x16, group, "inmute", UNMUTE);
 
185
        HDA_INAMP (0x16, 0, group, "in", 90);   /* From widget 0x0c */
 
186
      }
 
187
 
 
188
    if (HDA_PIN_GROUP (0x17, group, pin_group, "grey", n, "jack", 4))   /* Pin widget 0x17 */
 
189
      {
 
190
        /* Src 0xc=front */
 
191
        /* Src 0xd=rear */
 
192
        /* Src 0xe=center/LFE */
 
193
        /* Src 0xf=side */
 
194
        /* Src 0x26=pcm4 */
 
195
        if (HDA_PINSELECT (0x17, ctl, group, "mode", -1))
 
196
          HDA_CHOICES (ctl,
 
197
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
198
        HDA_OUTMUTE (0x17, group, "inmute", UNMUTE);
 
199
        HDA_INAMP (0x17, 0, group, "in", 90);   /* From widget 0x0c */
 
200
      }
 
201
 
 
202
    if (HDA_PIN_GROUP (0x18, group, pin_group, "pink", n, "jack", 4))   /* Pin widget 0x18 */
 
203
      {
 
204
        /* Src 0xc=front */
 
205
        /* Src 0xd=rear */
 
206
        /* Src 0xe=center/LFE */
 
207
        /* Src 0xf=side */
 
208
        /* Src 0x26=pcm4 */
 
209
        if (HDA_PINSELECT (0x18, ctl, group, "mode", -1))
 
210
          HDA_CHOICES (ctl,
 
211
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
212
        HDA_OUTMUTE (0x18, group, "inmute", UNMUTE);
 
213
        HDA_INAMP (0x18, 0, group, "in", 90);   /* From widget 0x0c */
 
214
      }
 
215
 
 
216
    if (HDA_PIN_GROUP (0x1a, group, pin_group, "blue", n, "jack", 4))   /* Pin widget 0x1a */
 
217
      {
 
218
        /* Src 0xc=front */
 
219
        /* Src 0xd=rear */
 
220
        /* Src 0xe=center/LFE */
 
221
        /* Src 0xf=side */
 
222
        /* Src 0x26=pcm4 */
 
223
        if (HDA_PINSELECT (0x1a, ctl, group, "mode", -1))
 
224
          HDA_CHOICES (ctl,
 
225
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
226
        HDA_OUTMUTE (0x1a, group, "inmute", UNMUTE);
 
227
        HDA_INAMP (0x1a, 0, group, "in", 90);   /* From widget 0x0c */
 
228
      }
 
229
 
 
230
    if (HDA_PIN_GROUP (0x1b, group, pin_group, "fp-green", n, "jack", 4))       /* Pin widget 0x1b */
 
231
      {
 
232
        /* Src 0xc=front */
 
233
        /* Src 0xd=rear */
 
234
        /* Src 0xe=center/LFE */
 
235
        /* Src 0xf=side */
 
236
        /* Src 0x26=pcm4 */
 
237
        if (HDA_PINSELECT (0x1b, ctl, group, "mode", -1))
 
238
          HDA_CHOICES (ctl,
 
239
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
240
        HDA_OUTMUTE (0x1b, group, "inmute", UNMUTE);
 
241
        HDA_INAMP (0x1b, 0, group, "in", 90);   /* From widget 0x0c */
 
242
      }
 
243
 
 
244
    if (HDA_PIN_GROUP (0x19, group, pin_group, "fp-pink", n, "jack", 4))        /* Pin widget 0x19 */
 
245
      {
 
246
        /* Src 0xc=front */
 
247
        /* Src 0xd=rear */
 
248
        /* Src 0xe=center/LFE */
 
249
        /* Src 0xf=side */
 
250
        /* Src 0x26=pcm4 */
 
251
        if (HDA_PINSELECT (0x19, ctl, group, "mode", -1))
 
252
          HDA_CHOICES (ctl,
 
253
                       "front-out rear-out center/LFE-out side-out pcm4-out input");
 
254
        HDA_OUTMUTE (0x19, group, "inmute", UNMUTE);
 
255
        HDA_INAMP (0x19, 0, group, "in", 90);   /* From widget 0x0c */
 
256
      }
 
257
 
 
258
#if 0
 
259
    /*
 
260
     * Non-used pins
 
261
     */
 
262
    if (HDA_PIN_GROUP (0x1c, group, pin_group, "int-aux", n, "jack", 4))        /* Pin widget 0x1c */
 
263
      {
 
264
        if (HDA_PINSELECT (0x1c, ctl, group, "mode", -1))
 
265
          HDA_CHOICES (ctl, "input");
 
266
      }
 
267
 
 
268
    if (HDA_PIN_GROUP (0x1d, group, pin_group, "black", n, "jack", 4))  /* Pin widget 0x1d */
 
269
      {
 
270
        if (HDA_PINSELECT (0x1d, ctl, group, "mode", -1))
 
271
          HDA_CHOICES (ctl, "input");
 
272
      }
 
273
#endif
 
274
  }
 
275
 
 
276
  return 0;
 
277
}