aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/wtm.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-14 20:31:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-14 20:31:54 -0400
commit6dc6472581f693b5fc95aebedf67b4960fb85cf0 (patch)
tree06a5a9a08519950575505273eabced331ed51405 /sound/pci/ice1712/wtm.c
parentee673eaa72d8d185012b1027a05e25aba18c267f (diff)
parent8acd3a60bcca17c6d89c73cee3ad6057eb83ba1e (diff)
Merge commit 'origin'
Manual fixup of conflicts on: arch/powerpc/include/asm/dcr-regs.h drivers/net/ibm_newemac/core.h
Diffstat (limited to 'sound/pci/ice1712/wtm.c')
-rw-r--r--sound/pci/ice1712/wtm.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
index a08d17c7e651..5af9e84456d1 100644
--- a/sound/pci/ice1712/wtm.c
+++ b/sound/pci/ice1712/wtm.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * ALSA driver for ICEnsemble VT1724 (Envy24HT) 2 * ALSA driver for ICEnsemble VT1724 (Envy24HT)
3 * 3 *
4 * Lowlevel functions for Ego Sys Waveterminal 192M 4 * Lowlevel functions for Ego Sys Waveterminal 192M
5 * 5 *
6 * Copyright (c) 2006 Guedez Clement <klem.dev@gmail.com> 6 * Copyright (c) 2006 Guedez Clement <klem.dev@gmail.com>
7 * Some functions are taken from the Prodigy192 driver 7 * Some functions are taken from the Prodigy192 driver
8 * source 8 * source
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
@@ -20,12 +20,12 @@
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * 23 *
24 */ 24 */
25 25
26 26
27 27
28#include <asm/io.h> 28#include <linux/io.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/init.h> 31#include <linux/init.h>
@@ -39,9 +39,9 @@
39 39
40 40
41/* 41/*
42 * 2*ADC 6*DAC no1 ringbuffer r/w on i2c bus 42 * 2*ADC 6*DAC no1 ringbuffer r/w on i2c bus
43 */ 43 */
44static inline void stac9460_put(struct snd_ice1712 *ice, int reg, 44static inline void stac9460_put(struct snd_ice1712 *ice, int reg,
45 unsigned char val) 45 unsigned char val)
46{ 46{
47 snd_vt1724_write_i2c(ice, STAC9460_I2C_ADDR, reg, val); 47 snd_vt1724_write_i2c(ice, STAC9460_I2C_ADDR, reg, val);
@@ -73,7 +73,7 @@ static inline unsigned char stac9460_2_get(struct snd_ice1712 *ice, int reg)
73#define stac9460_dac_mute_info snd_ctl_boolean_mono_info 73#define stac9460_dac_mute_info snd_ctl_boolean_mono_info
74 74
75static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol, 75static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol,
76 struct snd_ctl_elem_value *ucontrol) 76 struct snd_ctl_elem_value *ucontrol)
77{ 77{
78 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 78 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
79 unsigned char val; 79 unsigned char val;
@@ -88,14 +88,14 @@ static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol,
88 } 88 }
89 if (id < 6) 89 if (id < 6)
90 val = stac9460_get(ice, idx); 90 val = stac9460_get(ice, idx);
91 else 91 else
92 val = stac9460_2_get(ice,idx - 6); 92 val = stac9460_2_get(ice, idx - 6);
93 ucontrol->value.integer.value[0] = (~val >> 7) & 0x1; 93 ucontrol->value.integer.value[0] = (~val >> 7) & 0x1;
94 return 0; 94 return 0;
95} 95}
96 96
97static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, 97static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol,
98 struct snd_ctl_elem_value *ucontrol) 98 struct snd_ctl_elem_value *ucontrol)
99{ 99{
100 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 100 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
101 unsigned char new, old; 101 unsigned char new, old;
@@ -105,8 +105,8 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol,
105 if (kcontrol->private_value) { 105 if (kcontrol->private_value) {
106 idx = STAC946X_MASTER_VOLUME; 106 idx = STAC946X_MASTER_VOLUME;
107 old = stac9460_get(ice, idx); 107 old = stac9460_get(ice, idx);
108 new = (~ucontrol->value.integer.value[0]<< 7 & 0x80) | 108 new = (~ucontrol->value.integer.value[0] << 7 & 0x80) |
109 (old & ~0x80); 109 (old & ~0x80);
110 change = (new != old); 110 change = (new != old);
111 if (change) { 111 if (change) {
112 stac9460_put(ice, idx, new); 112 stac9460_put(ice, idx, new);
@@ -117,16 +117,16 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol,
117 idx = id + STAC946X_LF_VOLUME; 117 idx = id + STAC946X_LF_VOLUME;
118 if (id < 6) 118 if (id < 6)
119 old = stac9460_get(ice, idx); 119 old = stac9460_get(ice, idx);
120 else 120 else
121 old = stac9460_2_get(ice, idx - 6); 121 old = stac9460_2_get(ice, idx - 6);
122 new = (~ucontrol->value.integer.value[0]<< 7 & 0x80) | 122 new = (~ucontrol->value.integer.value[0] << 7 & 0x80) |
123 (old & ~0x80); 123 (old & ~0x80);
124 change = (new != old); 124 change = (new != old);
125 if (change) { 125 if (change) {
126 if (id < 6) 126 if (id < 6)
127 stac9460_put(ice, idx, new); 127 stac9460_put(ice, idx, new);
128 else 128 else
129 stac9460_2_put(ice, idx - 6, new); 129 stac9460_2_put(ice, idx - 6, new);
130 } 130 }
131 } 131 }
132 return change; 132 return change;
@@ -136,7 +136,7 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol,
136 * DAC volume attenuation mixer control 136 * DAC volume attenuation mixer control
137 */ 137 */
138static int stac9460_dac_vol_info(struct snd_kcontrol *kcontrol, 138static int stac9460_dac_vol_info(struct snd_kcontrol *kcontrol,
139 struct snd_ctl_elem_info *uinfo) 139 struct snd_ctl_elem_info *uinfo)
140{ 140{
141 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 141 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
142 uinfo->count = 1; 142 uinfo->count = 1;
@@ -146,7 +146,7 @@ static int stac9460_dac_vol_info(struct snd_kcontrol *kcontrol,
146} 146}
147 147
148static int stac9460_dac_vol_get(struct snd_kcontrol *kcontrol, 148static int stac9460_dac_vol_get(struct snd_kcontrol *kcontrol,
149 struct snd_ctl_elem_value *ucontrol) 149 struct snd_ctl_elem_value *ucontrol)
150{ 150{
151 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 151 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
152 int idx, id; 152 int idx, id;
@@ -161,14 +161,14 @@ static int stac9460_dac_vol_get(struct snd_kcontrol *kcontrol,
161 } 161 }
162 if (id < 6) 162 if (id < 6)
163 vol = stac9460_get(ice, idx) & 0x7f; 163 vol = stac9460_get(ice, idx) & 0x7f;
164 else 164 else
165 vol = stac9460_2_get(ice, idx - 6) & 0x7f; 165 vol = stac9460_2_get(ice, idx - 6) & 0x7f;
166 ucontrol->value.integer.value[0] = 0x7f - vol; 166 ucontrol->value.integer.value[0] = 0x7f - vol;
167 return 0; 167 return 0;
168} 168}
169 169
170static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, 170static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol,
171 struct snd_ctl_elem_value *ucontrol) 171 struct snd_ctl_elem_value *ucontrol)
172{ 172{
173 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 173 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
174 int idx, id; 174 int idx, id;
@@ -182,8 +182,8 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol,
182 ovol = 0x7f - (tmp & 0x7f); 182 ovol = 0x7f - (tmp & 0x7f);
183 change = (ovol != nvol); 183 change = (ovol != nvol);
184 if (change) { 184 if (change) {
185 stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); 185 stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80));
186 stac9460_2_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); 186 stac9460_2_put(ice, idx, (0x7f - nvol) | (tmp & 0x80));
187 } 187 }
188 } else { 188 } else {
189 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 189 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
@@ -191,17 +191,17 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol,
191 nvol = ucontrol->value.integer.value[0] & 0x7f; 191 nvol = ucontrol->value.integer.value[0] & 0x7f;
192 if (id < 6) 192 if (id < 6)
193 tmp = stac9460_get(ice, idx); 193 tmp = stac9460_get(ice, idx);
194 else 194 else
195 tmp = stac9460_2_get(ice, idx - 6); 195 tmp = stac9460_2_get(ice, idx - 6);
196 ovol = 0x7f - (tmp & 0x7f); 196 ovol = 0x7f - (tmp & 0x7f);
197 change = (ovol != nvol); 197 change = (ovol != nvol);
198 if (change) { 198 if (change) {
199 if (id < 6) 199 if (id < 6)
200 stac9460_put(ice, idx, (0x7f - nvol) | 200 stac9460_put(ice, idx, (0x7f - nvol) |
201 (tmp & 0x80)); 201 (tmp & 0x80));
202 else 202 else
203 stac9460_2_put(ice, idx-6, (0x7f - nvol) | 203 stac9460_2_put(ice, idx-6, (0x7f - nvol) |
204 (tmp & 0x80)); 204 (tmp & 0x80));
205 } 205 }
206 } 206 }
207 return change; 207 return change;
@@ -213,12 +213,12 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol,
213#define stac9460_adc_mute_info snd_ctl_boolean_stereo_info 213#define stac9460_adc_mute_info snd_ctl_boolean_stereo_info
214 214
215static int stac9460_adc_mute_get(struct snd_kcontrol *kcontrol, 215static int stac9460_adc_mute_get(struct snd_kcontrol *kcontrol,
216 struct snd_ctl_elem_value *ucontrol) 216 struct snd_ctl_elem_value *ucontrol)
217{ 217{
218 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 218 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
219 unsigned char val; 219 unsigned char val;
220 int i, id; 220 int i, id;
221 221
222 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 222 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
223 if (id == 0) { 223 if (id == 0) {
224 for (i = 0; i < 2; ++i) { 224 for (i = 0; i < 2; ++i) {
@@ -235,20 +235,20 @@ static int stac9460_adc_mute_get(struct snd_kcontrol *kcontrol,
235} 235}
236 236
237static int stac9460_adc_mute_put(struct snd_kcontrol *kcontrol, 237static int stac9460_adc_mute_put(struct snd_kcontrol *kcontrol,
238 struct snd_ctl_elem_value *ucontrol) 238 struct snd_ctl_elem_value *ucontrol)
239{ 239{
240 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 240 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
241 unsigned char new, old; 241 unsigned char new, old;
242 int i, reg, id; 242 int i, reg, id;
243 int change; 243 int change;
244 244
245 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 245 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
246 if (id == 0) { 246 if (id == 0) {
247 for (i = 0; i < 2; ++i) { 247 for (i = 0; i < 2; ++i) {
248 reg = STAC946X_MIC_L_VOLUME + i; 248 reg = STAC946X_MIC_L_VOLUME + i;
249 old = stac9460_get(ice, reg); 249 old = stac9460_get(ice, reg);
250 new = (~ucontrol->value.integer.value[i]<<7&0x80) | 250 new = (~ucontrol->value.integer.value[i]<<7&0x80) |
251 (old&~0x80); 251 (old&~0x80);
252 change = (new != old); 252 change = (new != old);
253 if (change) 253 if (change)
254 stac9460_put(ice, reg, new); 254 stac9460_put(ice, reg, new);
@@ -258,7 +258,7 @@ static int stac9460_adc_mute_put(struct snd_kcontrol *kcontrol,
258 reg = STAC946X_MIC_L_VOLUME + i; 258 reg = STAC946X_MIC_L_VOLUME + i;
259 old = stac9460_2_get(ice, reg); 259 old = stac9460_2_get(ice, reg);
260 new = (~ucontrol->value.integer.value[i]<<7&0x80) | 260 new = (~ucontrol->value.integer.value[i]<<7&0x80) |
261 (old&~0x80); 261 (old&~0x80);
262 change = (new != old); 262 change = (new != old);
263 if (change) 263 if (change)
264 stac9460_2_put(ice, reg, new); 264 stac9460_2_put(ice, reg, new);
@@ -271,7 +271,7 @@ static int stac9460_adc_mute_put(struct snd_kcontrol *kcontrol,
271 *ADC gain mixer control 271 *ADC gain mixer control
272 */ 272 */
273static int stac9460_adc_vol_info(struct snd_kcontrol *kcontrol, 273static int stac9460_adc_vol_info(struct snd_kcontrol *kcontrol,
274 struct snd_ctl_elem_info *uinfo) 274 struct snd_ctl_elem_info *uinfo)
275{ 275{
276 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 276 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
277 uinfo->count = 2; 277 uinfo->count = 2;
@@ -281,12 +281,12 @@ static int stac9460_adc_vol_info(struct snd_kcontrol *kcontrol,
281} 281}
282 282
283static int stac9460_adc_vol_get(struct snd_kcontrol *kcontrol, 283static int stac9460_adc_vol_get(struct snd_kcontrol *kcontrol,
284 struct snd_ctl_elem_value *ucontrol) 284 struct snd_ctl_elem_value *ucontrol)
285{ 285{
286 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 286 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
287 int i, reg, id; 287 int i, reg, id;
288 unsigned char vol; 288 unsigned char vol;
289 289
290 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 290 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
291 if (id == 0) { 291 if (id == 0) {
292 for (i = 0; i < 2; ++i) { 292 for (i = 0; i < 2; ++i) {
@@ -305,13 +305,13 @@ static int stac9460_adc_vol_get(struct snd_kcontrol *kcontrol,
305} 305}
306 306
307static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, 307static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol,
308 struct snd_ctl_elem_value *ucontrol) 308 struct snd_ctl_elem_value *ucontrol)
309{ 309{
310 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 310 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
311 int i, reg, id; 311 int i, reg, id;
312 unsigned char ovol, nvol; 312 unsigned char ovol, nvol;
313 int change; 313 int change;
314 314
315 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 315 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
316 if (id == 0) { 316 if (id == 0) {
317 for (i = 0; i < 2; ++i) { 317 for (i = 0; i < 2; ++i) {
@@ -321,7 +321,7 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol,
321 change = ((ovol & 0x0f) != nvol); 321 change = ((ovol & 0x0f) != nvol);
322 if (change) 322 if (change)
323 stac9460_put(ice, reg, (0x0f - nvol) | 323 stac9460_put(ice, reg, (0x0f - nvol) |
324 (ovol & ~0x0f)); 324 (ovol & ~0x0f));
325 } 325 }
326 } else { 326 } else {
327 for (i = 0; i < 2; ++i) { 327 for (i = 0; i < 2; ++i) {
@@ -331,7 +331,7 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol,
331 change = ((ovol & 0x0f) != nvol); 331 change = ((ovol & 0x0f) != nvol);
332 if (change) 332 if (change)
333 stac9460_2_put(ice, reg, (0x0f - nvol) | 333 stac9460_2_put(ice, reg, (0x0f - nvol) |
334 (ovol & ~0x0f)); 334 (ovol & ~0x0f));
335 } 335 }
336 } 336 }
337 return change; 337 return change;
@@ -344,23 +344,23 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol,
344#define stac9460_mic_sw_info snd_ctl_boolean_mono_info 344#define stac9460_mic_sw_info snd_ctl_boolean_mono_info
345 345
346static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol, 346static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol,
347 struct snd_ctl_elem_value *ucontrol) 347 struct snd_ctl_elem_value *ucontrol)
348{ 348{
349 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 349 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
350 unsigned char val; 350 unsigned char val;
351 int id; 351 int id;
352 352
353 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 353 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
354 if (id == 0) 354 if (id == 0)
355 val = stac9460_get(ice, STAC946X_GENERAL_PURPOSE); 355 val = stac9460_get(ice, STAC946X_GENERAL_PURPOSE);
356 else 356 else
357 val = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE); 357 val = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE);
358 ucontrol->value.integer.value[0] = ~val>>7 & 0x1; 358 ucontrol->value.integer.value[0] = ~val>>7 & 0x1;
359 return 0; 359 return 0;
360} 360}
361 361
362static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol, 362static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
363 struct snd_ctl_elem_value *ucontrol) 363 struct snd_ctl_elem_value *ucontrol)
364{ 364{
365 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 365 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
366 unsigned char new, old; 366 unsigned char new, old;
@@ -368,16 +368,16 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
368 368
369 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 369 id = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
370 if (id == 0) 370 if (id == 0)
371 old = stac9460_get(ice, STAC946X_GENERAL_PURPOSE); 371 old = stac9460_get(ice, STAC946X_GENERAL_PURPOSE);
372 else 372 else
373 old = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE); 373 old = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE);
374 new = (~ucontrol->value.integer.value[0]<< 7 & 0x80) | (old & ~0x80); 374 new = (~ucontrol->value.integer.value[0] << 7 & 0x80) | (old & ~0x80);
375 change = (new != old); 375 change = (new != old);
376 if (change) { 376 if (change) {
377 if (id == 0) 377 if (id == 0)
378 stac9460_put(ice, STAC946X_GENERAL_PURPOSE, new); 378 stac9460_put(ice, STAC946X_GENERAL_PURPOSE, new);
379 else 379 else
380 stac9460_2_put(ice, STAC946X_GENERAL_PURPOSE, new); 380 stac9460_2_put(ice, STAC946X_GENERAL_PURPOSE, new);
381 } 381 }
382 return change; 382 return change;
383} 383}
@@ -443,7 +443,7 @@ static struct snd_kcontrol_new stac9640_controls[] __devinitdata = {
443 .get = stac9460_adc_vol_get, 443 .get = stac9460_adc_vol_get,
444 .put = stac9460_adc_vol_put, 444 .put = stac9460_adc_vol_put,
445 445
446 } 446 }
447}; 447};
448 448
449 449
@@ -470,7 +470,7 @@ static int __devinit wtm_init(struct snd_ice1712 *ice)
470 (unsigned short)-1 470 (unsigned short)-1
471 }; 471 };
472 unsigned short *p; 472 unsigned short *p;
473 473
474 /*WTM 192M*/ 474 /*WTM 192M*/
475 ice->num_total_dacs = 8; 475 ice->num_total_dacs = 8;
476 ice->num_total_adcs = 4; 476 ice->num_total_adcs = 4;