49 static inline unsigned char stac9460_get(
struct snd_ice1712 *ice,
int reg)
57 static inline void stac9460_2_put(
struct snd_ice1712 *ice,
int reg,
63 static inline unsigned char stac9460_2_get(
struct snd_ice1712 *ice,
int reg)
72 #define stac9460_dac_mute_info snd_ctl_boolean_mono_info
74 static int stac9460_dac_mute_get(
struct snd_kcontrol *kcontrol,
85 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
89 val = stac9460_get(ice, idx);
91 val = stac9460_2_get(ice, idx - 6);
92 ucontrol->
value.integer.value[0] = (~val >> 7) & 0x1;
96 static int stac9460_dac_mute_put(
struct snd_kcontrol *kcontrol,
100 unsigned char new, old;
106 old = stac9460_get(ice, idx);
107 new = (~ucontrol->
value.integer.value[0] << 7 & 0x80) |
109 change = (
new != old);
111 stac9460_put(ice, idx,
new);
112 stac9460_2_put(ice, idx,
new);
115 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
118 old = stac9460_get(ice, idx);
120 old = stac9460_2_get(ice, idx - 6);
121 new = (~ucontrol->
value.integer.value[0] << 7 & 0x80) |
123 change = (
new != old);
126 stac9460_put(ice, idx,
new);
128 stac9460_2_put(ice, idx - 6,
new);
137 static int stac9460_dac_vol_info(
struct snd_kcontrol *kcontrol,
147 static int stac9460_dac_vol_get(
struct snd_kcontrol *kcontrol,
158 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
162 vol = stac9460_get(ice, idx) & 0x7f;
164 vol = stac9460_2_get(ice, idx - 6) & 0x7f;
165 ucontrol->
value.integer.value[0] = 0x7f -
vol;
169 static int stac9460_dac_vol_put(
struct snd_kcontrol *kcontrol,
174 unsigned char tmp, ovol, nvol;
179 nvol = ucontrol->
value.integer.value[0] & 0x7f;
180 tmp = stac9460_get(ice, idx);
181 ovol = 0x7f - (tmp & 0x7f);
182 change = (ovol != nvol);
184 stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80));
185 stac9460_2_put(ice, idx, (0x7f - nvol) | (tmp & 0x80));
188 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
190 nvol = ucontrol->
value.integer.value[0] & 0x7f;
192 tmp = stac9460_get(ice, idx);
194 tmp = stac9460_2_get(ice, idx - 6);
195 ovol = 0x7f - (tmp & 0x7f);
196 change = (ovol != nvol);
199 stac9460_put(ice, idx, (0x7f - nvol) |
202 stac9460_2_put(ice, idx-6, (0x7f - nvol) |
212 #define stac9460_adc_mute_info snd_ctl_boolean_stereo_info
214 static int stac9460_adc_mute_get(
struct snd_kcontrol *kcontrol,
221 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
223 for (i = 0; i < 2; ++
i) {
225 ucontrol->
value.integer.value[
i] = ~val>>7 & 0x1;
228 for (i = 0; i < 2; ++
i) {
230 ucontrol->
value.integer.value[
i] = ~val>>7 & 0x1;
236 static int stac9460_adc_mute_put(
struct snd_kcontrol *kcontrol,
240 unsigned char new, old;
244 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
246 for (i = 0; i < 2; ++
i) {
248 old = stac9460_get(ice, reg);
249 new = (~ucontrol->
value.integer.value[
i]<<7&0x80) |
251 change = (
new != old);
253 stac9460_put(ice, reg,
new);
256 for (i = 0; i < 2; ++
i) {
258 old = stac9460_2_get(ice, reg);
259 new = (~ucontrol->
value.integer.value[
i]<<7&0x80) |
261 change = (
new != old);
263 stac9460_2_put(ice, reg,
new);
272 static int stac9460_adc_vol_info(
struct snd_kcontrol *kcontrol,
282 static int stac9460_adc_vol_get(
struct snd_kcontrol *kcontrol,
289 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
291 for (i = 0; i < 2; ++
i) {
293 vol = stac9460_get(ice, reg) & 0x0f;
294 ucontrol->
value.integer.value[
i] = 0x0f -
vol;
297 for (i = 0; i < 2; ++
i) {
299 vol = stac9460_2_get(ice, reg) & 0x0f;
300 ucontrol->
value.integer.value[
i] = 0x0f -
vol;
306 static int stac9460_adc_vol_put(
struct snd_kcontrol *kcontrol,
311 unsigned char ovol, nvol;
314 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
316 for (i = 0; i < 2; ++
i) {
318 nvol = ucontrol->
value.integer.value[
i] & 0x0f;
319 ovol = 0x0f - stac9460_get(ice, reg);
320 change = ((ovol & 0x0f) != nvol);
322 stac9460_put(ice, reg, (0x0f - nvol) |
326 for (i = 0; i < 2; ++
i) {
328 nvol = ucontrol->
value.integer.value[
i] & 0x0f;
329 ovol = 0x0f - stac9460_2_get(ice, reg);
330 change = ((ovol & 0x0f) != nvol);
332 stac9460_2_put(ice, reg, (0x0f - nvol) |
343 #define stac9460_mic_sw_info snd_ctl_boolean_mono_info
345 static int stac9460_mic_sw_get(
struct snd_kcontrol *kcontrol,
352 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
357 ucontrol->
value.integer.value[0] = ~val>>7 & 0x1;
361 static int stac9460_mic_sw_put(
struct snd_kcontrol *kcontrol,
365 unsigned char new, old;
368 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
373 new = (~ucontrol->
value.integer.value[0] << 7 & 0x80) | (old & ~0x80);
374 change = (
new != old);
390 .name =
"Master Playback Switch",
392 .get = stac9460_dac_mute_get,
393 .put = stac9460_dac_mute_put,
398 .name =
"Master Playback Volume",
399 .info = stac9460_dac_vol_info,
400 .get = stac9460_dac_vol_get,
401 .put = stac9460_dac_vol_put,
406 .name =
"MIC/Line switch",
409 .get = stac9460_mic_sw_get,
410 .put = stac9460_mic_sw_put,
415 .name =
"DAC Switch",
418 .get = stac9460_dac_mute_get,
419 .put = stac9460_dac_mute_put,
423 .name =
"DAC Volume",
425 .info = stac9460_dac_vol_info,
426 .get = stac9460_dac_vol_get,
427 .put = stac9460_dac_vol_put,
431 .name =
"ADC Switch",
434 .get = stac9460_adc_mute_get,
435 .put = stac9460_adc_mute_put,
439 .name =
"ADC Volume",
441 .info = stac9460_adc_vol_info,
442 .get = stac9460_adc_vol_get,
443 .put = stac9460_adc_vol_put,
456 for (i = 0; i <
ARRAY_SIZE(stac9640_controls); i++) {
467 static unsigned short stac_inits_prodigy[] = {
479 p = stac_inits_prodigy;
480 for (; *p != (
unsigned short)-1; p += 2) {
481 stac9460_put(ice, p[0], p[1]);
482 stac9460_2_put(ice, p[0], p[1]);
488 static unsigned char wtm_eeprom[] __devinitdata = {
509 .name =
"ESI Waveterminal 192M",
512 .build_controls = wtm_add_controls,
513 .eeprom_size =
sizeof(wtm_eeprom),