diff options
Diffstat (limited to 'sound/pci/ice1712')
-rw-r--r-- | sound/pci/ice1712/ak4xxx.c | 3 | ||||
-rw-r--r-- | sound/pci/ice1712/aureon.c | 699 | ||||
-rw-r--r-- | sound/pci/ice1712/delta.c | 2 | ||||
-rw-r--r-- | sound/pci/ice1712/delta.h | 1 | ||||
-rw-r--r-- | sound/pci/ice1712/ews.c | 9 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 240 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.h | 52 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 188 | ||||
-rw-r--r-- | sound/pci/ice1712/juli.c | 47 | ||||
-rw-r--r-- | sound/pci/ice1712/phase.c | 277 | ||||
-rw-r--r-- | sound/pci/ice1712/phase.h | 8 | ||||
-rw-r--r-- | sound/pci/ice1712/pontis.c | 5 | ||||
-rw-r--r-- | sound/pci/ice1712/revo.c | 25 | ||||
-rw-r--r-- | sound/pci/ice1712/wtm.c | 104 | ||||
-rw-r--r-- | sound/pci/ice1712/wtm.h | 4 |
15 files changed, 913 insertions, 751 deletions
diff --git a/sound/pci/ice1712/ak4xxx.c b/sound/pci/ice1712/ak4xxx.c index dab31b2756a6..03391da8c8c7 100644 --- a/sound/pci/ice1712/ak4xxx.c +++ b/sound/pci/ice1712/ak4xxx.c | |||
@@ -59,7 +59,8 @@ static void snd_ice1712_akm4xxx_write(struct snd_akm4xxx *ak, int chip, | |||
59 | struct snd_ak4xxx_private *priv = (void *)ak->private_value[0]; | 59 | struct snd_ak4xxx_private *priv = (void *)ak->private_value[0]; |
60 | struct snd_ice1712 *ice = ak->private_data[0]; | 60 | struct snd_ice1712 *ice = ak->private_data[0]; |
61 | 61 | ||
62 | snd_assert(chip >= 0 && chip < 4, return); | 62 | if (snd_BUG_ON(chip < 0 || chip >= 4)) |
63 | return; | ||
63 | 64 | ||
64 | tmp = snd_ice1712_gpio_read(ice); | 65 | tmp = snd_ice1712_gpio_read(ice); |
65 | tmp |= priv->add_flags; | 66 | tmp |= priv->add_flags; |
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 868ae291b960..110d16e52733 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -44,10 +44,9 @@ | |||
44 | * not working: prety much everything else, at least i could verify that | 44 | * not working: prety much everything else, at least i could verify that |
45 | * we have no digital output, no capture, pretty bad clicks and poops | 45 | * we have no digital output, no capture, pretty bad clicks and poops |
46 | * on mixer switch and other coll stuff. | 46 | * on mixer switch and other coll stuff. |
47 | * | 47 | */ |
48 | */ | ||
49 | 48 | ||
50 | #include <asm/io.h> | 49 | #include <linux/io.h> |
51 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
52 | #include <linux/interrupt.h> | 51 | #include <linux/interrupt.h> |
53 | #include <linux/init.h> | 52 | #include <linux/init.h> |
@@ -131,7 +130,7 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg, | |||
131 | snd_ice1712_gpio_write(ice, tmp); | 130 | snd_ice1712_gpio_write(ice, tmp); |
132 | udelay(50); | 131 | udelay(50); |
133 | 132 | ||
134 | /* | 133 | /* |
135 | * send i2c stop condition and start condition | 134 | * send i2c stop condition and start condition |
136 | * to obtain sane state | 135 | * to obtain sane state |
137 | */ | 136 | */ |
@@ -152,10 +151,16 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg, | |||
152 | * skipping ack cycles inbetween | 151 | * skipping ack cycles inbetween |
153 | */ | 152 | */ |
154 | for (j = 0; j < 3; j++) { | 153 | for (j = 0; j < 3; j++) { |
155 | switch(j) { | 154 | switch (j) { |
156 | case 0: val = dev; break; | 155 | case 0: |
157 | case 1: val = reg; break; | 156 | val = dev; |
158 | case 2: val = data; break; | 157 | break; |
158 | case 1: | ||
159 | val = reg; | ||
160 | break; | ||
161 | case 2: | ||
162 | val = data; | ||
163 | break; | ||
159 | } | 164 | } |
160 | for (i = 7; i >= 0; i--) { | 165 | for (i = 7; i >= 0; i--) { |
161 | tmp &= ~AUREON_SPI_CLK; | 166 | tmp &= ~AUREON_SPI_CLK; |
@@ -171,7 +176,7 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg, | |||
171 | snd_ice1712_gpio_write(ice, tmp); | 176 | snd_ice1712_gpio_write(ice, tmp); |
172 | udelay(40); | 177 | udelay(40); |
173 | } | 178 | } |
174 | tmp &= ~AUREON_SPI_CLK; | 179 | tmp &= ~AUREON_SPI_CLK; |
175 | snd_ice1712_gpio_write(ice, tmp); | 180 | snd_ice1712_gpio_write(ice, tmp); |
176 | udelay(40); | 181 | udelay(40); |
177 | tmp |= AUREON_SPI_CLK; | 182 | tmp |= AUREON_SPI_CLK; |
@@ -203,7 +208,7 @@ static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol, | |||
203 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 208 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
204 | uinfo->count = 1; | 209 | uinfo->count = 1; |
205 | uinfo->value.enumerated.items = 3; | 210 | uinfo->value.enumerated.items = 3; |
206 | if(uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 211 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
207 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 212 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
208 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 213 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
209 | return 0; | 214 | return 0; |
@@ -231,12 +236,12 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol, | |||
231 | return -EINVAL; | 236 | return -EINVAL; |
232 | snd_ice1712_save_gpio_status(ice); | 237 | snd_ice1712_save_gpio_status(ice); |
233 | oval = spec->pca9554_out; | 238 | oval = spec->pca9554_out; |
234 | if ((change = (oval != nval))) { | 239 | change = (oval != nval); |
240 | if (change) { | ||
235 | aureon_pca9554_write(ice, PCA9554_OUT, nval); | 241 | aureon_pca9554_write(ice, PCA9554_OUT, nval); |
236 | spec->pca9554_out = nval; | 242 | spec->pca9554_out = nval; |
237 | } | 243 | } |
238 | snd_ice1712_restore_gpio_status(ice); | 244 | snd_ice1712_restore_gpio_status(ice); |
239 | |||
240 | return change; | 245 | return change; |
241 | } | 246 | } |
242 | 247 | ||
@@ -256,7 +261,7 @@ static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, | |||
256 | udelay(10); | 261 | udelay(10); |
257 | tmp &= ~AUREON_AC97_ADDR; | 262 | tmp &= ~AUREON_AC97_ADDR; |
258 | snd_ice1712_gpio_write(ice, tmp); | 263 | snd_ice1712_gpio_write(ice, tmp); |
259 | udelay(10); | 264 | udelay(10); |
260 | 265 | ||
261 | /* Send low-order byte to XILINX chip */ | 266 | /* Send low-order byte to XILINX chip */ |
262 | tmp &= ~AUREON_AC97_DATA_MASK; | 267 | tmp &= ~AUREON_AC97_DATA_MASK; |
@@ -269,7 +274,7 @@ static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, | |||
269 | tmp &= ~AUREON_AC97_DATA_LOW; | 274 | tmp &= ~AUREON_AC97_DATA_LOW; |
270 | snd_ice1712_gpio_write(ice, tmp); | 275 | snd_ice1712_gpio_write(ice, tmp); |
271 | udelay(10); | 276 | udelay(10); |
272 | 277 | ||
273 | /* Send high-order byte to XILINX chip */ | 278 | /* Send high-order byte to XILINX chip */ |
274 | tmp &= ~AUREON_AC97_DATA_MASK; | 279 | tmp &= ~AUREON_AC97_DATA_MASK; |
275 | tmp |= (val >> 8) & AUREON_AC97_DATA_MASK; | 280 | tmp |= (val >> 8) & AUREON_AC97_DATA_MASK; |
@@ -282,7 +287,7 @@ static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, | |||
282 | tmp &= ~AUREON_AC97_DATA_HIGH; | 287 | tmp &= ~AUREON_AC97_DATA_HIGH; |
283 | snd_ice1712_gpio_write(ice, tmp); | 288 | snd_ice1712_gpio_write(ice, tmp); |
284 | udelay(10); | 289 | udelay(10); |
285 | 290 | ||
286 | /* Instruct XILINX chip to parse the data to the STAC9744 chip */ | 291 | /* Instruct XILINX chip to parse the data to the STAC9744 chip */ |
287 | tmp |= AUREON_AC97_COMMIT; | 292 | tmp |= AUREON_AC97_COMMIT; |
288 | snd_ice1712_gpio_write(ice, tmp); | 293 | snd_ice1712_gpio_write(ice, tmp); |
@@ -290,7 +295,7 @@ static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, | |||
290 | tmp &= ~AUREON_AC97_COMMIT; | 295 | tmp &= ~AUREON_AC97_COMMIT; |
291 | snd_ice1712_gpio_write(ice, tmp); | 296 | snd_ice1712_gpio_write(ice, tmp); |
292 | udelay(10); | 297 | udelay(10); |
293 | 298 | ||
294 | /* Store the data in out private buffer */ | 299 | /* Store the data in out private buffer */ |
295 | spec->stac9744[(reg & 0x7F) >> 1] = val; | 300 | spec->stac9744[(reg & 0x7F) >> 1] = val; |
296 | } | 301 | } |
@@ -304,7 +309,7 @@ static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short r | |||
304 | /* | 309 | /* |
305 | * Initialize STAC9744 chip | 310 | * Initialize STAC9744 chip |
306 | */ | 311 | */ |
307 | static int aureon_ac97_init (struct snd_ice1712 *ice) | 312 | static int aureon_ac97_init(struct snd_ice1712 *ice) |
308 | { | 313 | { |
309 | struct aureon_spec *spec = ice->spec; | 314 | struct aureon_spec *spec = ice->spec; |
310 | int i; | 315 | int i; |
@@ -335,20 +340,21 @@ static int aureon_ac97_init (struct snd_ice1712 *ice) | |||
335 | tmp = (snd_ice1712_gpio_read(ice) | AUREON_AC97_RESET) & ~AUREON_AC97_DATA_MASK; | 340 | tmp = (snd_ice1712_gpio_read(ice) | AUREON_AC97_RESET) & ~AUREON_AC97_DATA_MASK; |
336 | snd_ice1712_gpio_write(ice, tmp); | 341 | snd_ice1712_gpio_write(ice, tmp); |
337 | udelay(3); | 342 | udelay(3); |
338 | 343 | ||
339 | tmp &= ~AUREON_AC97_RESET; | 344 | tmp &= ~AUREON_AC97_RESET; |
340 | snd_ice1712_gpio_write(ice, tmp); | 345 | snd_ice1712_gpio_write(ice, tmp); |
341 | udelay(3); | 346 | udelay(3); |
342 | 347 | ||
343 | tmp |= AUREON_AC97_RESET; | 348 | tmp |= AUREON_AC97_RESET; |
344 | snd_ice1712_gpio_write(ice, tmp); | 349 | snd_ice1712_gpio_write(ice, tmp); |
345 | udelay(3); | 350 | udelay(3); |
346 | 351 | ||
347 | memset(&spec->stac9744, 0, sizeof(spec->stac9744)); | 352 | memset(&spec->stac9744, 0, sizeof(spec->stac9744)); |
348 | for (i=0; ac97_defaults[i] != (unsigned short)-1; i+=2) | 353 | for (i = 0; ac97_defaults[i] != (unsigned short)-1; i += 2) |
349 | spec->stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1]; | 354 | spec->stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1]; |
350 | 355 | ||
351 | aureon_ac97_write(ice, AC97_MASTER, 0x0000); // Unmute AC'97 master volume permanently - muting is done by WM8770 | 356 | /* Unmute AC'97 master volume permanently - muting is done by WM8770 */ |
357 | aureon_ac97_write(ice, AC97_MASTER, 0x0000); | ||
352 | 358 | ||
353 | return 0; | 359 | return 0; |
354 | } | 360 | } |
@@ -388,7 +394,7 @@ static int aureon_ac97_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
388 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 394 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
389 | unsigned short ovol, nvol; | 395 | unsigned short ovol, nvol; |
390 | int change; | 396 | int change; |
391 | 397 | ||
392 | snd_ice1712_save_gpio_status(ice); | 398 | snd_ice1712_save_gpio_status(ice); |
393 | 399 | ||
394 | ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); | 400 | ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); |
@@ -396,13 +402,14 @@ static int aureon_ac97_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
396 | if (kcontrol->private_value & AUREON_AC97_STEREO) | 402 | if (kcontrol->private_value & AUREON_AC97_STEREO) |
397 | nvol |= ((0x1F - ucontrol->value.integer.value[1]) << 8) & 0x1F00; | 403 | nvol |= ((0x1F - ucontrol->value.integer.value[1]) << 8) & 0x1F00; |
398 | nvol |= ovol & ~0x1F1F; | 404 | nvol |= ovol & ~0x1F1F; |
399 | 405 | ||
400 | if ((change = (ovol != nvol))) | 406 | change = (ovol != nvol); |
407 | if (change) | ||
401 | aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol); | 408 | aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol); |
402 | 409 | ||
403 | snd_ice1712_restore_gpio_status(ice); | 410 | snd_ice1712_restore_gpio_status(ice); |
404 | 411 | ||
405 | return change; | 412 | return change; |
406 | } | 413 | } |
407 | 414 | ||
408 | /* | 415 | /* |
@@ -416,7 +423,8 @@ static int aureon_ac97_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
416 | 423 | ||
417 | mutex_lock(&ice->gpio_mutex); | 424 | mutex_lock(&ice->gpio_mutex); |
418 | 425 | ||
419 | ucontrol->value.integer.value[0] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; | 426 | ucontrol->value.integer.value[0] = aureon_ac97_read(ice, |
427 | kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; | ||
420 | 428 | ||
421 | mutex_unlock(&ice->gpio_mutex); | 429 | mutex_unlock(&ice->gpio_mutex); |
422 | return 0; | 430 | return 0; |
@@ -429,13 +437,14 @@ static int aureon_ac97_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
429 | int change; | 437 | int change; |
430 | 438 | ||
431 | snd_ice1712_save_gpio_status(ice); | 439 | snd_ice1712_save_gpio_status(ice); |
432 | 440 | ||
433 | ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); | 441 | ovol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); |
434 | nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x8000) | (ovol & ~ 0x8000); | 442 | nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x8000) | (ovol & ~0x8000); |
435 | 443 | ||
436 | if ((change = (ovol != nvol))) | 444 | change = (ovol != nvol); |
445 | if (change) | ||
437 | aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol); | 446 | aureon_ac97_write(ice, kcontrol->private_value & 0x7F, nvol); |
438 | 447 | ||
439 | snd_ice1712_restore_gpio_status(ice); | 448 | snd_ice1712_restore_gpio_status(ice); |
440 | 449 | ||
441 | return change; | 450 | return change; |
@@ -465,13 +474,14 @@ static int aureon_ac97_micboost_put(struct snd_kcontrol *kcontrol, struct snd_ct | |||
465 | int change; | 474 | int change; |
466 | 475 | ||
467 | snd_ice1712_save_gpio_status(ice); | 476 | snd_ice1712_save_gpio_status(ice); |
468 | 477 | ||
469 | ovol = aureon_ac97_read(ice, AC97_MIC); | 478 | ovol = aureon_ac97_read(ice, AC97_MIC); |
470 | nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x0020) | (ovol & ~0x0020); | 479 | nvol = (ucontrol->value.integer.value[0] ? 0x0000 : 0x0020) | (ovol & ~0x0020); |
471 | 480 | ||
472 | if ((change = (ovol != nvol))) | 481 | change = (ovol != nvol); |
482 | if (change) | ||
473 | aureon_ac97_write(ice, AC97_MIC, nvol); | 483 | aureon_ac97_write(ice, AC97_MIC, nvol); |
474 | 484 | ||
475 | snd_ice1712_restore_gpio_status(ice); | 485 | snd_ice1712_restore_gpio_status(ice); |
476 | 486 | ||
477 | return change; | 487 | return change; |
@@ -493,16 +503,15 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned | |||
493 | snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS)); | 503 | snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_SPI_MOSI|PRODIGY_SPI_CLK|PRODIGY_WM_CS)); |
494 | mosi = PRODIGY_SPI_MOSI; | 504 | mosi = PRODIGY_SPI_MOSI; |
495 | clk = PRODIGY_SPI_CLK; | 505 | clk = PRODIGY_SPI_CLK; |
496 | } | 506 | } else { |
497 | else { | ||
498 | snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK| | 507 | snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_SPI_MOSI|AUREON_SPI_CLK| |
499 | AUREON_WM_CS|AUREON_CS8415_CS)); | 508 | AUREON_WM_CS|AUREON_CS8415_CS)); |
500 | mosi = AUREON_SPI_MOSI; | 509 | mosi = AUREON_SPI_MOSI; |
501 | clk = AUREON_SPI_CLK; | 510 | clk = AUREON_SPI_CLK; |
502 | 511 | ||
503 | tmp |= AUREON_WM_RW; | 512 | tmp |= AUREON_WM_RW; |
504 | } | 513 | } |
505 | 514 | ||
506 | tmp &= ~cs; | 515 | tmp &= ~cs; |
507 | snd_ice1712_gpio_write(ice, tmp); | 516 | snd_ice1712_gpio_write(ice, tmp); |
508 | udelay(1); | 517 | udelay(1); |
@@ -534,7 +543,9 @@ static void aureon_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned | |||
534 | /* | 543 | /* |
535 | * Read data in SPI mode | 544 | * Read data in SPI mode |
536 | */ | 545 | */ |
537 | static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits, unsigned char *buffer, int size) { | 546 | static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, |
547 | unsigned int data, int bits, unsigned char *buffer, int size) | ||
548 | { | ||
538 | int i, j; | 549 | int i, j; |
539 | unsigned int tmp; | 550 | unsigned int tmp; |
540 | 551 | ||
@@ -544,7 +555,7 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i | |||
544 | snd_ice1712_gpio_write(ice, tmp); | 555 | snd_ice1712_gpio_write(ice, tmp); |
545 | udelay(1); | 556 | udelay(1); |
546 | 557 | ||
547 | for (i=bits-1; i>=0; i--) { | 558 | for (i = bits-1; i >= 0; i--) { |
548 | if (data & (1 << i)) | 559 | if (data & (1 << i)) |
549 | tmp |= AUREON_SPI_MOSI; | 560 | tmp |= AUREON_SPI_MOSI; |
550 | else | 561 | else |
@@ -561,9 +572,9 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i | |||
561 | udelay(1); | 572 | udelay(1); |
562 | } | 573 | } |
563 | 574 | ||
564 | for (j=0; j<size; j++) { | 575 | for (j = 0; j < size; j++) { |
565 | unsigned char outdata = 0; | 576 | unsigned char outdata = 0; |
566 | for (i=7; i>=0; i--) { | 577 | for (i = 7; i >= 0; i--) { |
567 | tmp = snd_ice1712_gpio_read(ice); | 578 | tmp = snd_ice1712_gpio_read(ice); |
568 | outdata <<= 1; | 579 | outdata <<= 1; |
569 | outdata |= (tmp & AUREON_SPI_MISO) ? 1 : 0; | 580 | outdata |= (tmp & AUREON_SPI_MISO) ? 1 : 0; |
@@ -584,19 +595,24 @@ static void aureon_spi_read(struct snd_ice1712 *ice, unsigned int cs, unsigned i | |||
584 | snd_ice1712_gpio_write(ice, tmp); | 595 | snd_ice1712_gpio_write(ice, tmp); |
585 | } | 596 | } |
586 | 597 | ||
587 | static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg) { | 598 | static unsigned char aureon_cs8415_get(struct snd_ice1712 *ice, int reg) |
599 | { | ||
588 | unsigned char val; | 600 | unsigned char val; |
589 | aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); | 601 | aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); |
590 | aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1); | 602 | aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, &val, 1); |
591 | return val; | 603 | return val; |
592 | } | 604 | } |
593 | 605 | ||
594 | static void aureon_cs8415_read(struct snd_ice1712 *ice, int reg, unsigned char *buffer, int size) { | 606 | static void aureon_cs8415_read(struct snd_ice1712 *ice, int reg, |
607 | unsigned char *buffer, int size) | ||
608 | { | ||
595 | aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); | 609 | aureon_spi_write(ice, AUREON_CS8415_CS, 0x2000 | reg, 16); |
596 | aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size); | 610 | aureon_spi_read(ice, AUREON_CS8415_CS, 0x21, 8, buffer, size); |
597 | } | 611 | } |
598 | 612 | ||
599 | static void aureon_cs8415_put(struct snd_ice1712 *ice, int reg, unsigned char val) { | 613 | static void aureon_cs8415_put(struct snd_ice1712 *ice, int reg, |
614 | unsigned char val) | ||
615 | { | ||
600 | aureon_spi_write(ice, AUREON_CS8415_CS, 0x200000 | (reg << 8) | val, 24); | 616 | aureon_spi_write(ice, AUREON_CS8415_CS, 0x200000 | (reg << 8) | val, 24); |
601 | } | 617 | } |
602 | 618 | ||
@@ -654,18 +670,20 @@ static int aureon_ac97_mmute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
654 | return 0; | 670 | return 0; |
655 | } | 671 | } |
656 | 672 | ||
657 | static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { | 673 | static int aureon_ac97_mmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
674 | { | ||
658 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 675 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
659 | unsigned short ovol, nvol; | 676 | unsigned short ovol, nvol; |
660 | int change; | 677 | int change; |
661 | 678 | ||
662 | snd_ice1712_save_gpio_status(ice); | 679 | snd_ice1712_save_gpio_status(ice); |
663 | 680 | ||
664 | ovol = wm_get(ice, WM_OUT_MUX1); | 681 | ovol = wm_get(ice, WM_OUT_MUX1); |
665 | nvol = (ovol & ~0x02) | (ucontrol->value.integer.value[0] ? 0x02 : 0x00); | 682 | nvol = (ovol & ~0x02) | (ucontrol->value.integer.value[0] ? 0x02 : 0x00); |
666 | if ((change = (ovol != nvol))) | 683 | change = (ovol != nvol); |
684 | if (change) | ||
667 | wm_put(ice, WM_OUT_MUX1, nvol); | 685 | wm_put(ice, WM_OUT_MUX1, nvol); |
668 | 686 | ||
669 | snd_ice1712_restore_gpio_status(ice); | 687 | snd_ice1712_restore_gpio_status(ice); |
670 | 688 | ||
671 | return change; | 689 | return change; |
@@ -702,12 +720,12 @@ static const unsigned char wm_vol[256] = { | |||
702 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) | 720 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) |
703 | { | 721 | { |
704 | unsigned char nvol; | 722 | unsigned char nvol; |
705 | 723 | ||
706 | if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) | 724 | if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) |
707 | nvol = 0; | 725 | nvol = 0; |
708 | else | 726 | else |
709 | nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX]; | 727 | nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX]; |
710 | 728 | ||
711 | wm_put(ice, index, nvol); | 729 | wm_put(ice, index, nvol); |
712 | wm_put_nocache(ice, index, 0x180 | nvol); | 730 | wm_put_nocache(ice, index, 0x180 | nvol); |
713 | } | 731 | } |
@@ -736,7 +754,8 @@ static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va | |||
736 | snd_ice1712_save_gpio_status(ice); | 754 | snd_ice1712_save_gpio_status(ice); |
737 | oval = wm_get(ice, WM_MUTE); | 755 | oval = wm_get(ice, WM_MUTE); |
738 | nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10); | 756 | nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10); |
739 | if ((change = (nval != oval))) | 757 | change = (oval != nval); |
758 | if (change) | ||
740 | wm_put(ice, WM_MUTE, nval); | 759 | wm_put(ice, WM_MUTE, nval); |
741 | snd_ice1712_restore_gpio_status(ice); | 760 | snd_ice1712_restore_gpio_status(ice); |
742 | 761 | ||
@@ -760,7 +779,7 @@ static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
760 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 779 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
761 | struct aureon_spec *spec = ice->spec; | 780 | struct aureon_spec *spec = ice->spec; |
762 | int i; | 781 | int i; |
763 | for (i=0; i<2; i++) | 782 | for (i = 0; i < 2; i++) |
764 | ucontrol->value.integer.value[i] = | 783 | ucontrol->value.integer.value[i] = |
765 | spec->master[i] & ~WM_VOL_MUTE; | 784 | spec->master[i] & ~WM_VOL_MUTE; |
766 | return 0; | 785 | return 0; |
@@ -849,7 +868,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * | |||
849 | /* | 868 | /* |
850 | * WM8770 mute control | 869 | * WM8770 mute control |
851 | */ | 870 | */ |
852 | static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { | 871 | static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
872 | { | ||
853 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 873 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
854 | uinfo->count = kcontrol->private_value >> 8; | 874 | uinfo->count = kcontrol->private_value >> 8; |
855 | uinfo->value.integer.min = 0; | 875 | uinfo->value.integer.min = 0; |
@@ -862,7 +882,7 @@ static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
862 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 882 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
863 | struct aureon_spec *spec = ice->spec; | 883 | struct aureon_spec *spec = ice->spec; |
864 | int voices, ofs, i; | 884 | int voices, ofs, i; |
865 | 885 | ||
866 | voices = kcontrol->private_value >> 8; | 886 | voices = kcontrol->private_value >> 8; |
867 | ofs = kcontrol->private_value & 0xFF; | 887 | ofs = kcontrol->private_value & 0xFF; |
868 | 888 | ||
@@ -907,7 +927,7 @@ static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
907 | { | 927 | { |
908 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 928 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
909 | struct aureon_spec *spec = ice->spec; | 929 | struct aureon_spec *spec = ice->spec; |
910 | 930 | ||
911 | ucontrol->value.integer.value[0] = | 931 | ucontrol->value.integer.value[0] = |
912 | (spec->master[0] & WM_VOL_MUTE) ? 0 : 1; | 932 | (spec->master[0] & WM_VOL_MUTE) ? 0 : 1; |
913 | ucontrol->value.integer.value[1] = | 933 | ucontrol->value.integer.value[1] = |
@@ -1083,21 +1103,21 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1083 | static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1103 | static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1084 | { | 1104 | { |
1085 | static const char * const texts[] = { | 1105 | static const char * const texts[] = { |
1086 | "CD", //AIN1 | 1106 | "CD", /* AIN1 */ |
1087 | "Aux", //AIN2 | 1107 | "Aux", /* AIN2 */ |
1088 | "Line", //AIN3 | 1108 | "Line", /* AIN3 */ |
1089 | "Mic", //AIN4 | 1109 | "Mic", /* AIN4 */ |
1090 | "AC97" //AIN5 | 1110 | "AC97" /* AIN5 */ |
1091 | }; | 1111 | }; |
1092 | static const char * const universe_texts[] = { | 1112 | static const char * const universe_texts[] = { |
1093 | "Aux1", //AIN1 | 1113 | "Aux1", /* AIN1 */ |
1094 | "CD", //AIN2 | 1114 | "CD", /* AIN2 */ |
1095 | "Phono", //AIN3 | 1115 | "Phono", /* AIN3 */ |
1096 | "Line", //AIN4 | 1116 | "Line", /* AIN4 */ |
1097 | "Aux2", //AIN5 | 1117 | "Aux2", /* AIN5 */ |
1098 | "Mic", //AIN6 | 1118 | "Mic", /* AIN6 */ |
1099 | "Aux3", //AIN7 | 1119 | "Aux3", /* AIN7 */ |
1100 | "AC97" //AIN8 | 1120 | "AC97" /* AIN8 */ |
1101 | }; | 1121 | }; |
1102 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1122 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1103 | 1123 | ||
@@ -1108,8 +1128,7 @@ static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
1108 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 1128 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
1109 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 1129 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
1110 | strcpy(uinfo->value.enumerated.name, universe_texts[uinfo->value.enumerated.item]); | 1130 | strcpy(uinfo->value.enumerated.name, universe_texts[uinfo->value.enumerated.item]); |
1111 | } | 1131 | } else { |
1112 | else { | ||
1113 | uinfo->value.enumerated.items = 5; | 1132 | uinfo->value.enumerated.items = 5; |
1114 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 1133 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
1115 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 1134 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
@@ -1156,8 +1175,8 @@ static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
1156 | { | 1175 | { |
1157 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1176 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1158 | static const char * const aureon_texts[] = { | 1177 | static const char * const aureon_texts[] = { |
1159 | "CD", //RXP0 | 1178 | "CD", /* RXP0 */ |
1160 | "Optical" //RXP1 | 1179 | "Optical" /* RXP1 */ |
1161 | }; | 1180 | }; |
1162 | static const char * const prodigy_texts[] = { | 1181 | static const char * const prodigy_texts[] = { |
1163 | "CD", | 1182 | "CD", |
@@ -1180,10 +1199,10 @@ static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1180 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1199 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1181 | struct aureon_spec *spec = ice->spec; | 1200 | struct aureon_spec *spec = ice->spec; |
1182 | 1201 | ||
1183 | //snd_ice1712_save_gpio_status(ice); | 1202 | /* snd_ice1712_save_gpio_status(ice); */ |
1184 | //val = aureon_cs8415_get(ice, CS8415_CTRL2); | 1203 | /* val = aureon_cs8415_get(ice, CS8415_CTRL2); */ |
1185 | ucontrol->value.enumerated.item[0] = spec->cs8415_mux; | 1204 | ucontrol->value.enumerated.item[0] = spec->cs8415_mux; |
1186 | //snd_ice1712_restore_gpio_status(ice); | 1205 | /* snd_ice1712_restore_gpio_status(ice); */ |
1187 | return 0; | 1206 | return 0; |
1188 | } | 1207 | } |
1189 | 1208 | ||
@@ -1206,7 +1225,7 @@ static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1206 | return change; | 1225 | return change; |
1207 | } | 1226 | } |
1208 | 1227 | ||
1209 | static int aureon_cs8415_rate_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1228 | static int aureon_cs8415_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1210 | { | 1229 | { |
1211 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 1230 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
1212 | uinfo->count = 1; | 1231 | uinfo->count = 1; |
@@ -1215,7 +1234,7 @@ static int aureon_cs8415_rate_info (struct snd_kcontrol *kcontrol, struct snd_ct | |||
1215 | return 0; | 1234 | return 0; |
1216 | } | 1235 | } |
1217 | 1236 | ||
1218 | static int aureon_cs8415_rate_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1237 | static int aureon_cs8415_rate_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1219 | { | 1238 | { |
1220 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1239 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1221 | unsigned char ratio; | 1240 | unsigned char ratio; |
@@ -1229,7 +1248,7 @@ static int aureon_cs8415_rate_get (struct snd_kcontrol *kcontrol, struct snd_ctl | |||
1229 | */ | 1248 | */ |
1230 | #define aureon_cs8415_mute_info snd_ctl_boolean_mono_info | 1249 | #define aureon_cs8415_mute_info snd_ctl_boolean_mono_info |
1231 | 1250 | ||
1232 | static int aureon_cs8415_mute_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1251 | static int aureon_cs8415_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1233 | { | 1252 | { |
1234 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1253 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1235 | snd_ice1712_save_gpio_status(ice); | 1254 | snd_ice1712_save_gpio_status(ice); |
@@ -1238,7 +1257,7 @@ static int aureon_cs8415_mute_get (struct snd_kcontrol *kcontrol, struct snd_ctl | |||
1238 | return 0; | 1257 | return 0; |
1239 | } | 1258 | } |
1240 | 1259 | ||
1241 | static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1260 | static int aureon_cs8415_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1242 | { | 1261 | { |
1243 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1262 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1244 | unsigned char oval, nval; | 1263 | unsigned char oval, nval; |
@@ -1249,7 +1268,8 @@ static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl | |||
1249 | nval = oval & ~0x20; | 1268 | nval = oval & ~0x20; |
1250 | else | 1269 | else |
1251 | nval = oval | 0x20; | 1270 | nval = oval | 0x20; |
1252 | if ((change = (oval != nval))) | 1271 | change = (oval != nval); |
1272 | if (change) | ||
1253 | aureon_cs8415_put(ice, CS8415_CTRL1, nval); | 1273 | aureon_cs8415_put(ice, CS8415_CTRL1, nval); |
1254 | snd_ice1712_restore_gpio_status(ice); | 1274 | snd_ice1712_restore_gpio_status(ice); |
1255 | return change; | 1275 | return change; |
@@ -1258,15 +1278,17 @@ static int aureon_cs8415_mute_put (struct snd_kcontrol *kcontrol, struct snd_ctl | |||
1258 | /* | 1278 | /* |
1259 | * CS8415A Q-Sub info | 1279 | * CS8415A Q-Sub info |
1260 | */ | 1280 | */ |
1261 | static int aureon_cs8415_qsub_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { | 1281 | static int aureon_cs8415_qsub_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1282 | { | ||
1262 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; | 1283 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; |
1263 | uinfo->count = 10; | 1284 | uinfo->count = 10; |
1264 | return 0; | 1285 | return 0; |
1265 | } | 1286 | } |
1266 | 1287 | ||
1267 | static int aureon_cs8415_qsub_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { | 1288 | static int aureon_cs8415_qsub_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1289 | { | ||
1268 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1290 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1269 | 1291 | ||
1270 | snd_ice1712_save_gpio_status(ice); | 1292 | snd_ice1712_save_gpio_status(ice); |
1271 | aureon_cs8415_read(ice, CS8415_QSUB, ucontrol->value.bytes.data, 10); | 1293 | aureon_cs8415_read(ice, CS8415_QSUB, ucontrol->value.bytes.data, 10); |
1272 | snd_ice1712_restore_gpio_status(ice); | 1294 | snd_ice1712_restore_gpio_status(ice); |
@@ -1274,18 +1296,21 @@ static int aureon_cs8415_qsub_get (struct snd_kcontrol *kcontrol, struct snd_ctl | |||
1274 | return 0; | 1296 | return 0; |
1275 | } | 1297 | } |
1276 | 1298 | ||
1277 | static int aureon_cs8415_spdif_info (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { | 1299 | static int aureon_cs8415_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1300 | { | ||
1278 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 1301 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
1279 | uinfo->count = 1; | 1302 | uinfo->count = 1; |
1280 | return 0; | 1303 | return 0; |
1281 | } | 1304 | } |
1282 | 1305 | ||
1283 | static int aureon_cs8415_mask_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { | 1306 | static int aureon_cs8415_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1307 | { | ||
1284 | memset(ucontrol->value.iec958.status, 0xFF, 24); | 1308 | memset(ucontrol->value.iec958.status, 0xFF, 24); |
1285 | return 0; | 1309 | return 0; |
1286 | } | 1310 | } |
1287 | 1311 | ||
1288 | static int aureon_cs8415_spdif_get (struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { | 1312 | static int aureon_cs8415_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1313 | { | ||
1289 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1314 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1290 | 1315 | ||
1291 | snd_ice1712_save_gpio_status(ice); | 1316 | snd_ice1712_save_gpio_status(ice); |
@@ -1311,9 +1336,9 @@ static int aureon_set_headphone_amp(struct snd_ice1712 *ice, int enable) | |||
1311 | else | 1336 | else |
1312 | if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT && | 1337 | if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT && |
1313 | ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) | 1338 | ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) |
1314 | tmp &= ~ AUREON_HP_SEL; | 1339 | tmp &= ~AUREON_HP_SEL; |
1315 | else | 1340 | else |
1316 | tmp &= ~ PRODIGY_HP_SEL; | 1341 | tmp &= ~PRODIGY_HP_SEL; |
1317 | if (tmp != tmp2) { | 1342 | if (tmp != tmp2) { |
1318 | snd_ice1712_gpio_write(ice, tmp); | 1343 | snd_ice1712_gpio_write(ice, tmp); |
1319 | return 1; | 1344 | return 1; |
@@ -1325,7 +1350,7 @@ static int aureon_get_headphone_amp(struct snd_ice1712 *ice) | |||
1325 | { | 1350 | { |
1326 | unsigned int tmp = snd_ice1712_gpio_read(ice); | 1351 | unsigned int tmp = snd_ice1712_gpio_read(ice); |
1327 | 1352 | ||
1328 | return ( tmp & AUREON_HP_SEL )!= 0; | 1353 | return (tmp & AUREON_HP_SEL) != 0; |
1329 | } | 1354 | } |
1330 | 1355 | ||
1331 | #define aureon_hpamp_info snd_ctl_boolean_mono_info | 1356 | #define aureon_hpamp_info snd_ctl_boolean_mono_info |
@@ -1343,7 +1368,7 @@ static int aureon_hpamp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
1343 | { | 1368 | { |
1344 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1369 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1345 | 1370 | ||
1346 | return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]); | 1371 | return aureon_set_headphone_amp(ice, ucontrol->value.integer.value[0]); |
1347 | } | 1372 | } |
1348 | 1373 | ||
1349 | /* | 1374 | /* |
@@ -1390,7 +1415,7 @@ static int aureon_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_ | |||
1390 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 1415 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
1391 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 1416 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
1392 | 1417 | ||
1393 | return 0; | 1418 | return 0; |
1394 | } | 1419 | } |
1395 | 1420 | ||
1396 | static int aureon_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1421 | static int aureon_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -1434,7 +1459,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1434 | { | 1459 | { |
1435 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1460 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1436 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1461 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1437 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1462 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1438 | .name = "Master Playback Volume", | 1463 | .name = "Master Playback Volume", |
1439 | .info = wm_master_vol_info, | 1464 | .info = wm_master_vol_info, |
1440 | .get = wm_master_vol_get, | 1465 | .get = wm_master_vol_get, |
@@ -1452,7 +1477,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1452 | { | 1477 | { |
1453 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1478 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1454 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1479 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1455 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1480 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1456 | .name = "Front Playback Volume", | 1481 | .name = "Front Playback Volume", |
1457 | .info = wm_vol_info, | 1482 | .info = wm_vol_info, |
1458 | .get = wm_vol_get, | 1483 | .get = wm_vol_get, |
@@ -1471,7 +1496,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1471 | { | 1496 | { |
1472 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1497 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1473 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1498 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1474 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1499 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1475 | .name = "Rear Playback Volume", | 1500 | .name = "Rear Playback Volume", |
1476 | .info = wm_vol_info, | 1501 | .info = wm_vol_info, |
1477 | .get = wm_vol_get, | 1502 | .get = wm_vol_get, |
@@ -1490,7 +1515,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1490 | { | 1515 | { |
1491 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1516 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1492 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1517 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1493 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1518 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1494 | .name = "Center Playback Volume", | 1519 | .name = "Center Playback Volume", |
1495 | .info = wm_vol_info, | 1520 | .info = wm_vol_info, |
1496 | .get = wm_vol_get, | 1521 | .get = wm_vol_get, |
@@ -1509,7 +1534,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1509 | { | 1534 | { |
1510 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1535 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1511 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1536 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1512 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1537 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1513 | .name = "LFE Playback Volume", | 1538 | .name = "LFE Playback Volume", |
1514 | .info = wm_vol_info, | 1539 | .info = wm_vol_info, |
1515 | .get = wm_vol_get, | 1540 | .get = wm_vol_get, |
@@ -1528,7 +1553,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1528 | { | 1553 | { |
1529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1554 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1530 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1555 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1531 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1556 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1532 | .name = "Side Playback Volume", | 1557 | .name = "Side Playback Volume", |
1533 | .info = wm_vol_info, | 1558 | .info = wm_vol_info, |
1534 | .get = wm_vol_get, | 1559 | .get = wm_vol_get, |
@@ -1539,23 +1564,23 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { | |||
1539 | }; | 1564 | }; |
1540 | 1565 | ||
1541 | static struct snd_kcontrol_new wm_controls[] __devinitdata = { | 1566 | static struct snd_kcontrol_new wm_controls[] __devinitdata = { |
1542 | { | 1567 | { |
1543 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1568 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1544 | .name = "PCM Playback Switch", | 1569 | .name = "PCM Playback Switch", |
1545 | .info = wm_pcm_mute_info, | 1570 | .info = wm_pcm_mute_info, |
1546 | .get = wm_pcm_mute_get, | 1571 | .get = wm_pcm_mute_get, |
1547 | .put = wm_pcm_mute_put | 1572 | .put = wm_pcm_mute_put |
1548 | }, | 1573 | }, |
1549 | { | 1574 | { |
1550 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1575 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1551 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1576 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1552 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1577 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1553 | .name = "PCM Playback Volume", | 1578 | .name = "PCM Playback Volume", |
1554 | .info = wm_pcm_vol_info, | 1579 | .info = wm_pcm_vol_info, |
1555 | .get = wm_pcm_vol_get, | 1580 | .get = wm_pcm_vol_get, |
1556 | .put = wm_pcm_vol_put, | 1581 | .put = wm_pcm_vol_put, |
1557 | .tlv = { .p = db_scale_wm_pcm } | 1582 | .tlv = { .p = db_scale_wm_pcm } |
1558 | }, | 1583 | }, |
1559 | { | 1584 | { |
1560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1585 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1561 | .name = "Capture Switch", | 1586 | .name = "Capture Switch", |
@@ -1566,7 +1591,7 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = { | |||
1566 | { | 1591 | { |
1567 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1592 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1568 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1593 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1569 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1594 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1570 | .name = "Capture Volume", | 1595 | .name = "Capture Volume", |
1571 | .info = wm_adc_vol_info, | 1596 | .info = wm_adc_vol_info, |
1572 | .get = wm_adc_vol_get, | 1597 | .get = wm_adc_vol_get, |
@@ -1605,232 +1630,232 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = { | |||
1605 | }; | 1630 | }; |
1606 | 1631 | ||
1607 | static struct snd_kcontrol_new ac97_controls[] __devinitdata = { | 1632 | static struct snd_kcontrol_new ac97_controls[] __devinitdata = { |
1608 | { | 1633 | { |
1609 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1634 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1610 | .name = "AC97 Playback Switch", | 1635 | .name = "AC97 Playback Switch", |
1611 | .info = aureon_ac97_mmute_info, | 1636 | .info = aureon_ac97_mmute_info, |
1612 | .get = aureon_ac97_mmute_get, | 1637 | .get = aureon_ac97_mmute_get, |
1613 | .put = aureon_ac97_mmute_put, | 1638 | .put = aureon_ac97_mmute_put, |
1614 | .private_value = AC97_MASTER | 1639 | .private_value = AC97_MASTER |
1615 | }, | 1640 | }, |
1616 | { | 1641 | { |
1617 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1642 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1618 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1643 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1619 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1644 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1620 | .name = "AC97 Playback Volume", | 1645 | .name = "AC97 Playback Volume", |
1621 | .info = aureon_ac97_vol_info, | 1646 | .info = aureon_ac97_vol_info, |
1622 | .get = aureon_ac97_vol_get, | 1647 | .get = aureon_ac97_vol_get, |
1623 | .put = aureon_ac97_vol_put, | 1648 | .put = aureon_ac97_vol_put, |
1624 | .private_value = AC97_MASTER|AUREON_AC97_STEREO, | 1649 | .private_value = AC97_MASTER|AUREON_AC97_STEREO, |
1625 | .tlv = { .p = db_scale_ac97_master } | 1650 | .tlv = { .p = db_scale_ac97_master } |
1626 | }, | 1651 | }, |
1627 | { | 1652 | { |
1628 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1653 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1629 | .name = "CD Playback Switch", | 1654 | .name = "CD Playback Switch", |
1630 | .info = aureon_ac97_mute_info, | 1655 | .info = aureon_ac97_mute_info, |
1631 | .get = aureon_ac97_mute_get, | 1656 | .get = aureon_ac97_mute_get, |
1632 | .put = aureon_ac97_mute_put, | 1657 | .put = aureon_ac97_mute_put, |
1633 | .private_value = AC97_CD | 1658 | .private_value = AC97_CD |
1634 | }, | 1659 | }, |
1635 | { | 1660 | { |
1636 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1637 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1662 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1638 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1663 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1639 | .name = "CD Playback Volume", | 1664 | .name = "CD Playback Volume", |
1640 | .info = aureon_ac97_vol_info, | 1665 | .info = aureon_ac97_vol_info, |
1641 | .get = aureon_ac97_vol_get, | 1666 | .get = aureon_ac97_vol_get, |
1642 | .put = aureon_ac97_vol_put, | 1667 | .put = aureon_ac97_vol_put, |
1643 | .private_value = AC97_CD|AUREON_AC97_STEREO, | 1668 | .private_value = AC97_CD|AUREON_AC97_STEREO, |
1644 | .tlv = { .p = db_scale_ac97_gain } | 1669 | .tlv = { .p = db_scale_ac97_gain } |
1645 | }, | 1670 | }, |
1646 | { | 1671 | { |
1647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1672 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1648 | .name = "Aux Playback Switch", | 1673 | .name = "Aux Playback Switch", |
1649 | .info = aureon_ac97_mute_info, | 1674 | .info = aureon_ac97_mute_info, |
1650 | .get = aureon_ac97_mute_get, | 1675 | .get = aureon_ac97_mute_get, |
1651 | .put = aureon_ac97_mute_put, | 1676 | .put = aureon_ac97_mute_put, |
1652 | .private_value = AC97_AUX, | 1677 | .private_value = AC97_AUX, |
1653 | }, | 1678 | }, |
1654 | { | 1679 | { |
1655 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1680 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1656 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1681 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1657 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1682 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1658 | .name = "Aux Playback Volume", | 1683 | .name = "Aux Playback Volume", |
1659 | .info = aureon_ac97_vol_info, | 1684 | .info = aureon_ac97_vol_info, |
1660 | .get = aureon_ac97_vol_get, | 1685 | .get = aureon_ac97_vol_get, |
1661 | .put = aureon_ac97_vol_put, | 1686 | .put = aureon_ac97_vol_put, |
1662 | .private_value = AC97_AUX|AUREON_AC97_STEREO, | 1687 | .private_value = AC97_AUX|AUREON_AC97_STEREO, |
1663 | .tlv = { .p = db_scale_ac97_gain } | 1688 | .tlv = { .p = db_scale_ac97_gain } |
1664 | }, | 1689 | }, |
1665 | { | 1690 | { |
1666 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1667 | .name = "Line Playback Switch", | 1692 | .name = "Line Playback Switch", |
1668 | .info = aureon_ac97_mute_info, | 1693 | .info = aureon_ac97_mute_info, |
1669 | .get = aureon_ac97_mute_get, | 1694 | .get = aureon_ac97_mute_get, |
1670 | .put = aureon_ac97_mute_put, | 1695 | .put = aureon_ac97_mute_put, |
1671 | .private_value = AC97_LINE | 1696 | .private_value = AC97_LINE |
1672 | }, | 1697 | }, |
1673 | { | 1698 | { |
1674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1699 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1675 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1700 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1676 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1701 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1677 | .name = "Line Playback Volume", | 1702 | .name = "Line Playback Volume", |
1678 | .info = aureon_ac97_vol_info, | 1703 | .info = aureon_ac97_vol_info, |
1679 | .get = aureon_ac97_vol_get, | 1704 | .get = aureon_ac97_vol_get, |
1680 | .put = aureon_ac97_vol_put, | 1705 | .put = aureon_ac97_vol_put, |
1681 | .private_value = AC97_LINE|AUREON_AC97_STEREO, | 1706 | .private_value = AC97_LINE|AUREON_AC97_STEREO, |
1682 | .tlv = { .p = db_scale_ac97_gain } | 1707 | .tlv = { .p = db_scale_ac97_gain } |
1683 | }, | 1708 | }, |
1684 | { | 1709 | { |
1685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1710 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1686 | .name = "Mic Playback Switch", | 1711 | .name = "Mic Playback Switch", |
1687 | .info = aureon_ac97_mute_info, | 1712 | .info = aureon_ac97_mute_info, |
1688 | .get = aureon_ac97_mute_get, | 1713 | .get = aureon_ac97_mute_get, |
1689 | .put = aureon_ac97_mute_put, | 1714 | .put = aureon_ac97_mute_put, |
1690 | .private_value = AC97_MIC | 1715 | .private_value = AC97_MIC |
1691 | }, | 1716 | }, |
1692 | { | 1717 | { |
1693 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1718 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1694 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1719 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1695 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1720 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1696 | .name = "Mic Playback Volume", | 1721 | .name = "Mic Playback Volume", |
1697 | .info = aureon_ac97_vol_info, | 1722 | .info = aureon_ac97_vol_info, |
1698 | .get = aureon_ac97_vol_get, | 1723 | .get = aureon_ac97_vol_get, |
1699 | .put = aureon_ac97_vol_put, | 1724 | .put = aureon_ac97_vol_put, |
1700 | .private_value = AC97_MIC, | 1725 | .private_value = AC97_MIC, |
1701 | .tlv = { .p = db_scale_ac97_gain } | 1726 | .tlv = { .p = db_scale_ac97_gain } |
1702 | }, | 1727 | }, |
1703 | { | 1728 | { |
1704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1729 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1705 | .name = "Mic Boost (+20dB)", | 1730 | .name = "Mic Boost (+20dB)", |
1706 | .info = aureon_ac97_micboost_info, | 1731 | .info = aureon_ac97_micboost_info, |
1707 | .get = aureon_ac97_micboost_get, | 1732 | .get = aureon_ac97_micboost_get, |
1708 | .put = aureon_ac97_micboost_put | 1733 | .put = aureon_ac97_micboost_put |
1709 | } | 1734 | } |
1710 | }; | 1735 | }; |
1711 | 1736 | ||
1712 | static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { | 1737 | static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { |
1713 | { | 1738 | { |
1714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1739 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1715 | .name = "AC97 Playback Switch", | 1740 | .name = "AC97 Playback Switch", |
1716 | .info = aureon_ac97_mmute_info, | 1741 | .info = aureon_ac97_mmute_info, |
1717 | .get = aureon_ac97_mmute_get, | 1742 | .get = aureon_ac97_mmute_get, |
1718 | .put = aureon_ac97_mmute_put, | 1743 | .put = aureon_ac97_mmute_put, |
1719 | .private_value = AC97_MASTER | 1744 | .private_value = AC97_MASTER |
1720 | }, | 1745 | }, |
1721 | { | 1746 | { |
1722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1747 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1723 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1748 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1724 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1749 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1725 | .name = "AC97 Playback Volume", | 1750 | .name = "AC97 Playback Volume", |
1726 | .info = aureon_ac97_vol_info, | 1751 | .info = aureon_ac97_vol_info, |
1727 | .get = aureon_ac97_vol_get, | 1752 | .get = aureon_ac97_vol_get, |
1728 | .put = aureon_ac97_vol_put, | 1753 | .put = aureon_ac97_vol_put, |
1729 | .private_value = AC97_MASTER|AUREON_AC97_STEREO, | 1754 | .private_value = AC97_MASTER|AUREON_AC97_STEREO, |
1730 | .tlv = { .p = db_scale_ac97_master } | 1755 | .tlv = { .p = db_scale_ac97_master } |
1731 | }, | 1756 | }, |
1732 | { | 1757 | { |
1733 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1758 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1734 | .name = "CD Playback Switch", | 1759 | .name = "CD Playback Switch", |
1735 | .info = aureon_ac97_mute_info, | 1760 | .info = aureon_ac97_mute_info, |
1736 | .get = aureon_ac97_mute_get, | 1761 | .get = aureon_ac97_mute_get, |
1737 | .put = aureon_ac97_mute_put, | 1762 | .put = aureon_ac97_mute_put, |
1738 | .private_value = AC97_AUX | 1763 | .private_value = AC97_AUX |
1739 | }, | 1764 | }, |
1740 | { | 1765 | { |
1741 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1742 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1767 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1743 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1768 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1744 | .name = "CD Playback Volume", | 1769 | .name = "CD Playback Volume", |
1745 | .info = aureon_ac97_vol_info, | 1770 | .info = aureon_ac97_vol_info, |
1746 | .get = aureon_ac97_vol_get, | 1771 | .get = aureon_ac97_vol_get, |
1747 | .put = aureon_ac97_vol_put, | 1772 | .put = aureon_ac97_vol_put, |
1748 | .private_value = AC97_AUX|AUREON_AC97_STEREO, | 1773 | .private_value = AC97_AUX|AUREON_AC97_STEREO, |
1749 | .tlv = { .p = db_scale_ac97_gain } | 1774 | .tlv = { .p = db_scale_ac97_gain } |
1750 | }, | 1775 | }, |
1751 | { | 1776 | { |
1752 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1777 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1753 | .name = "Phono Playback Switch", | 1778 | .name = "Phono Playback Switch", |
1754 | .info = aureon_ac97_mute_info, | 1779 | .info = aureon_ac97_mute_info, |
1755 | .get = aureon_ac97_mute_get, | 1780 | .get = aureon_ac97_mute_get, |
1756 | .put = aureon_ac97_mute_put, | 1781 | .put = aureon_ac97_mute_put, |
1757 | .private_value = AC97_CD | 1782 | .private_value = AC97_CD |
1758 | }, | 1783 | }, |
1759 | { | 1784 | { |
1760 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1785 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1761 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1786 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1762 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1787 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1763 | .name = "Phono Playback Volume", | 1788 | .name = "Phono Playback Volume", |
1764 | .info = aureon_ac97_vol_info, | 1789 | .info = aureon_ac97_vol_info, |
1765 | .get = aureon_ac97_vol_get, | 1790 | .get = aureon_ac97_vol_get, |
1766 | .put = aureon_ac97_vol_put, | 1791 | .put = aureon_ac97_vol_put, |
1767 | .private_value = AC97_CD|AUREON_AC97_STEREO, | 1792 | .private_value = AC97_CD|AUREON_AC97_STEREO, |
1768 | .tlv = { .p = db_scale_ac97_gain } | 1793 | .tlv = { .p = db_scale_ac97_gain } |
1769 | }, | 1794 | }, |
1770 | { | 1795 | { |
1771 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1796 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1772 | .name = "Line Playback Switch", | 1797 | .name = "Line Playback Switch", |
1773 | .info = aureon_ac97_mute_info, | 1798 | .info = aureon_ac97_mute_info, |
1774 | .get = aureon_ac97_mute_get, | 1799 | .get = aureon_ac97_mute_get, |
1775 | .put = aureon_ac97_mute_put, | 1800 | .put = aureon_ac97_mute_put, |
1776 | .private_value = AC97_LINE | 1801 | .private_value = AC97_LINE |
1777 | }, | 1802 | }, |
1778 | { | 1803 | { |
1779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1804 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1780 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1805 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1781 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1806 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1782 | .name = "Line Playback Volume", | 1807 | .name = "Line Playback Volume", |
1783 | .info = aureon_ac97_vol_info, | 1808 | .info = aureon_ac97_vol_info, |
1784 | .get = aureon_ac97_vol_get, | 1809 | .get = aureon_ac97_vol_get, |
1785 | .put = aureon_ac97_vol_put, | 1810 | .put = aureon_ac97_vol_put, |
1786 | .private_value = AC97_LINE|AUREON_AC97_STEREO, | 1811 | .private_value = AC97_LINE|AUREON_AC97_STEREO, |
1787 | .tlv = { .p = db_scale_ac97_gain } | 1812 | .tlv = { .p = db_scale_ac97_gain } |
1788 | }, | 1813 | }, |
1789 | { | 1814 | { |
1790 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1815 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1791 | .name = "Mic Playback Switch", | 1816 | .name = "Mic Playback Switch", |
1792 | .info = aureon_ac97_mute_info, | 1817 | .info = aureon_ac97_mute_info, |
1793 | .get = aureon_ac97_mute_get, | 1818 | .get = aureon_ac97_mute_get, |
1794 | .put = aureon_ac97_mute_put, | 1819 | .put = aureon_ac97_mute_put, |
1795 | .private_value = AC97_MIC | 1820 | .private_value = AC97_MIC |
1796 | }, | 1821 | }, |
1797 | { | 1822 | { |
1798 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1823 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1799 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1824 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1800 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1825 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1801 | .name = "Mic Playback Volume", | 1826 | .name = "Mic Playback Volume", |
1802 | .info = aureon_ac97_vol_info, | 1827 | .info = aureon_ac97_vol_info, |
1803 | .get = aureon_ac97_vol_get, | 1828 | .get = aureon_ac97_vol_get, |
1804 | .put = aureon_ac97_vol_put, | 1829 | .put = aureon_ac97_vol_put, |
1805 | .private_value = AC97_MIC, | 1830 | .private_value = AC97_MIC, |
1806 | .tlv = { .p = db_scale_ac97_gain } | 1831 | .tlv = { .p = db_scale_ac97_gain } |
1807 | }, | 1832 | }, |
1808 | { | 1833 | { |
1809 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1810 | .name = "Mic Boost (+20dB)", | 1835 | .name = "Mic Boost (+20dB)", |
1811 | .info = aureon_ac97_micboost_info, | 1836 | .info = aureon_ac97_micboost_info, |
1812 | .get = aureon_ac97_micboost_get, | 1837 | .get = aureon_ac97_micboost_get, |
1813 | .put = aureon_ac97_micboost_put | 1838 | .put = aureon_ac97_micboost_put |
1814 | }, | 1839 | }, |
1815 | { | 1840 | { |
1816 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1841 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1817 | .name = "Aux Playback Switch", | 1842 | .name = "Aux Playback Switch", |
1818 | .info = aureon_ac97_mute_info, | 1843 | .info = aureon_ac97_mute_info, |
1819 | .get = aureon_ac97_mute_get, | 1844 | .get = aureon_ac97_mute_get, |
1820 | .put = aureon_ac97_mute_put, | 1845 | .put = aureon_ac97_mute_put, |
1821 | .private_value = AC97_VIDEO, | 1846 | .private_value = AC97_VIDEO, |
1822 | }, | 1847 | }, |
1823 | { | 1848 | { |
1824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1849 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1825 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1850 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1826 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), | 1851 | SNDRV_CTL_ELEM_ACCESS_TLV_READ), |
1827 | .name = "Aux Playback Volume", | 1852 | .name = "Aux Playback Volume", |
1828 | .info = aureon_ac97_vol_info, | 1853 | .info = aureon_ac97_vol_info, |
1829 | .get = aureon_ac97_vol_get, | 1854 | .get = aureon_ac97_vol_get, |
1830 | .put = aureon_ac97_vol_put, | 1855 | .put = aureon_ac97_vol_put, |
1831 | .private_value = AC97_VIDEO|AUREON_AC97_STEREO, | 1856 | .private_value = AC97_VIDEO|AUREON_AC97_STEREO, |
1832 | .tlv = { .p = db_scale_ac97_gain } | 1857 | .tlv = { .p = db_scale_ac97_gain } |
1833 | }, | 1858 | }, |
1834 | { | 1859 | { |
1835 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1836 | .name = "Aux Source", | 1861 | .name = "Aux Source", |
@@ -1844,43 +1869,43 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { | |||
1844 | static struct snd_kcontrol_new cs8415_controls[] __devinitdata = { | 1869 | static struct snd_kcontrol_new cs8415_controls[] __devinitdata = { |
1845 | { | 1870 | { |
1846 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1847 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), | 1872 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH), |
1848 | .info = aureon_cs8415_mute_info, | 1873 | .info = aureon_cs8415_mute_info, |
1849 | .get = aureon_cs8415_mute_get, | 1874 | .get = aureon_cs8415_mute_get, |
1850 | .put = aureon_cs8415_mute_put | 1875 | .put = aureon_cs8415_mute_put |
1851 | }, | 1876 | }, |
1852 | { | 1877 | { |
1853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1854 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Source", | 1879 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, NONE) "Source", |
1855 | .info = aureon_cs8415_mux_info, | 1880 | .info = aureon_cs8415_mux_info, |
1856 | .get = aureon_cs8415_mux_get, | 1881 | .get = aureon_cs8415_mux_get, |
1857 | .put = aureon_cs8415_mux_put, | 1882 | .put = aureon_cs8415_mux_put, |
1858 | }, | 1883 | }, |
1859 | { | 1884 | { |
1860 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1885 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1861 | .name = SNDRV_CTL_NAME_IEC958("Q-subcode ",CAPTURE,DEFAULT), | 1886 | .name = SNDRV_CTL_NAME_IEC958("Q-subcode ", CAPTURE, DEFAULT), |
1862 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, | 1887 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
1863 | .info = aureon_cs8415_qsub_info, | 1888 | .info = aureon_cs8415_qsub_info, |
1864 | .get = aureon_cs8415_qsub_get, | 1889 | .get = aureon_cs8415_qsub_get, |
1865 | }, | 1890 | }, |
1866 | { | 1891 | { |
1867 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1892 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1868 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,MASK), | 1893 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, MASK), |
1869 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1894 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1870 | .info = aureon_cs8415_spdif_info, | 1895 | .info = aureon_cs8415_spdif_info, |
1871 | .get = aureon_cs8415_mask_get | 1896 | .get = aureon_cs8415_mask_get |
1872 | }, | 1897 | }, |
1873 | { | 1898 | { |
1874 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1899 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1875 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), | 1900 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT), |
1876 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, | 1901 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
1877 | .info = aureon_cs8415_spdif_info, | 1902 | .info = aureon_cs8415_spdif_info, |
1878 | .get = aureon_cs8415_spdif_get | 1903 | .get = aureon_cs8415_spdif_get |
1879 | }, | 1904 | }, |
1880 | { | 1905 | { |
1881 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1906 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1882 | .name = SNDRV_CTL_NAME_IEC958("",CAPTURE,NONE) "Rate", | 1907 | .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, NONE) "Rate", |
1883 | .access =SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, | 1908 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, |
1884 | .info = aureon_cs8415_rate_info, | 1909 | .info = aureon_cs8415_rate_info, |
1885 | .get = aureon_cs8415_rate_get | 1910 | .get = aureon_cs8415_rate_get |
1886 | } | 1911 | } |
@@ -1905,15 +1930,14 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice) | |||
1905 | if (err < 0) | 1930 | if (err < 0) |
1906 | return err; | 1931 | return err; |
1907 | } | 1932 | } |
1908 | 1933 | ||
1909 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE) { | 1934 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON71_UNIVERSE) { |
1910 | for (i = 0; i < ARRAY_SIZE(universe_ac97_controls); i++) { | 1935 | for (i = 0; i < ARRAY_SIZE(universe_ac97_controls); i++) { |
1911 | err = snd_ctl_add(ice->card, snd_ctl_new1(&universe_ac97_controls[i], ice)); | 1936 | err = snd_ctl_add(ice->card, snd_ctl_new1(&universe_ac97_controls[i], ice)); |
1912 | if (err < 0) | 1937 | if (err < 0) |
1913 | return err; | 1938 | return err; |
1914 | } | 1939 | } |
1915 | } | 1940 | } else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT && |
1916 | else if (ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71LT && | ||
1917 | ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) { | 1941 | ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) { |
1918 | for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) { | 1942 | for (i = 0; i < ARRAY_SIZE(ac97_controls); i++) { |
1919 | err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice)); | 1943 | err = snd_ctl_add(ice->card, snd_ctl_new1(&ac97_controls[i], ice)); |
@@ -1932,7 +1956,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice) | |||
1932 | else if ((id & 0x0F) != 0x01) | 1956 | else if ((id & 0x0F) != 0x01) |
1933 | snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); | 1957 | snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); |
1934 | else { | 1958 | else { |
1935 | for (i = 0; i< ARRAY_SIZE(cs8415_controls); i++) { | 1959 | for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) { |
1936 | struct snd_kcontrol *kctl; | 1960 | struct snd_kcontrol *kctl; |
1937 | err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice))); | 1961 | err = snd_ctl_add(ice->card, (kctl = snd_ctl_new1(&cs8415_controls[i], ice))); |
1938 | if (err < 0) | 1962 | if (err < 0) |
@@ -1943,7 +1967,7 @@ static int __devinit aureon_add_controls(struct snd_ice1712 *ice) | |||
1943 | } | 1967 | } |
1944 | snd_ice1712_restore_gpio_status(ice); | 1968 | snd_ice1712_restore_gpio_status(ice); |
1945 | } | 1969 | } |
1946 | 1970 | ||
1947 | return 0; | 1971 | return 0; |
1948 | } | 1972 | } |
1949 | 1973 | ||
@@ -2059,11 +2083,12 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2059 | 2083 | ||
2060 | /* to remeber the register values of CS8415 */ | 2084 | /* to remeber the register values of CS8415 */ |
2061 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 2085 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
2062 | if (! ice->akm) | 2086 | if (!ice->akm) |
2063 | return -ENOMEM; | 2087 | return -ENOMEM; |
2064 | ice->akm_codecs = 1; | 2088 | ice->akm_codecs = 1; |
2065 | 2089 | ||
2066 | if ((err = aureon_ac97_init(ice)) != 0) | 2090 | err = aureon_ac97_init(ice); |
2091 | if (err != 0) | ||
2067 | return err; | 2092 | return err; |
2068 | 2093 | ||
2069 | snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */ | 2094 | snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */ |
@@ -2086,7 +2111,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2086 | /* initialize WM8770 codec */ | 2111 | /* initialize WM8770 codec */ |
2087 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71 || | 2112 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71 || |
2088 | ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT || | 2113 | ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71LT || |
2089 | ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) | 2114 | ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71XT) |
2090 | p = wm_inits_prodigy; | 2115 | p = wm_inits_prodigy; |
2091 | else | 2116 | else |
2092 | p = wm_inits_aureon; | 2117 | p = wm_inits_aureon; |
@@ -2105,10 +2130,10 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2105 | 2130 | ||
2106 | snd_ice1712_restore_gpio_status(ice); | 2131 | snd_ice1712_restore_gpio_status(ice); |
2107 | 2132 | ||
2108 | /* initialize PCA9554 pin directions & set default input*/ | 2133 | /* initialize PCA9554 pin directions & set default input */ |
2109 | aureon_pca9554_write(ice, PCA9554_DIR, 0x00); | 2134 | aureon_pca9554_write(ice, PCA9554_DIR, 0x00); |
2110 | aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */ | 2135 | aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */ |
2111 | 2136 | ||
2112 | spec->master[0] = WM_VOL_MUTE; | 2137 | spec->master[0] = WM_VOL_MUTE; |
2113 | spec->master[1] = WM_VOL_MUTE; | 2138 | spec->master[1] = WM_VOL_MUTE; |
2114 | for (i = 0; i < ice->num_total_dacs; i++) { | 2139 | for (i = 0; i < ice->num_total_dacs; i++) { |
@@ -2158,6 +2183,24 @@ static unsigned char aureon71_eeprom[] __devinitdata = { | |||
2158 | }; | 2183 | }; |
2159 | #define prodigy71_eeprom aureon71_eeprom | 2184 | #define prodigy71_eeprom aureon71_eeprom |
2160 | 2185 | ||
2186 | static unsigned char aureon71_universe_eeprom[] __devinitdata = { | ||
2187 | [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, spdif-in/ADC, | ||
2188 | * 4DACs | ||
2189 | */ | ||
2190 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ | ||
2191 | [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ | ||
2192 | [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */ | ||
2193 | [ICE_EEP2_GPIO_DIR] = 0xff, | ||
2194 | [ICE_EEP2_GPIO_DIR1] = 0xff, | ||
2195 | [ICE_EEP2_GPIO_DIR2] = 0x5f, | ||
2196 | [ICE_EEP2_GPIO_MASK] = 0x00, | ||
2197 | [ICE_EEP2_GPIO_MASK1] = 0x00, | ||
2198 | [ICE_EEP2_GPIO_MASK2] = 0x00, | ||
2199 | [ICE_EEP2_GPIO_STATE] = 0x00, | ||
2200 | [ICE_EEP2_GPIO_STATE1] = 0x00, | ||
2201 | [ICE_EEP2_GPIO_STATE2] = 0x00, | ||
2202 | }; | ||
2203 | |||
2161 | static unsigned char prodigy71lt_eeprom[] __devinitdata = { | 2204 | static unsigned char prodigy71lt_eeprom[] __devinitdata = { |
2162 | [ICE_EEP2_SYSCONF] = 0x4b, /* clock 384, spdif-in/ADC, 4DACs */ | 2205 | [ICE_EEP2_SYSCONF] = 0x4b, /* clock 384, spdif-in/ADC, 4DACs */ |
2163 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ | 2206 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ |
@@ -2197,14 +2240,14 @@ struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { | |||
2197 | .eeprom_data = aureon71_eeprom, | 2240 | .eeprom_data = aureon71_eeprom, |
2198 | .driver = "Aureon71", | 2241 | .driver = "Aureon71", |
2199 | }, | 2242 | }, |
2200 | { | 2243 | { |
2201 | .subvendor = VT1724_SUBDEVICE_AUREON71_UNIVERSE, | 2244 | .subvendor = VT1724_SUBDEVICE_AUREON71_UNIVERSE, |
2202 | .name = "Terratec Aureon 7.1-Universe", | 2245 | .name = "Terratec Aureon 7.1-Universe", |
2203 | .model = "universe", | 2246 | .model = "universe", |
2204 | .chip_init = aureon_init, | 2247 | .chip_init = aureon_init, |
2205 | .build_controls = aureon_add_controls, | 2248 | .build_controls = aureon_add_controls, |
2206 | .eeprom_size = sizeof(aureon71_eeprom), | 2249 | .eeprom_size = sizeof(aureon71_universe_eeprom), |
2207 | .eeprom_data = aureon71_eeprom, | 2250 | .eeprom_data = aureon71_universe_eeprom, |
2208 | .driver = "Aureon71Univ", /* keep in 15 letters */ | 2251 | .driver = "Aureon71Univ", /* keep in 15 letters */ |
2209 | }, | 2252 | }, |
2210 | { | 2253 | { |
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index 0ed96c178059..d216362626d0 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c | |||
@@ -400,7 +400,7 @@ static void delta_setup_spdif(struct snd_ice1712 *ice, int rate) | |||
400 | static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kcontrol, | 400 | static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kcontrol, |
401 | struct snd_ctl_elem_value *ucontrol) | 401 | struct snd_ctl_elem_value *ucontrol) |
402 | { | 402 | { |
403 | char reg = 0x10; // cs8427 receiver error register | 403 | char reg = 0x10; /* CS8427 receiver error register */ |
404 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 404 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
405 | 405 | ||
406 | if (snd_i2c_sendbytes(ice->cs8427, ®, 1) != 1) | 406 | if (snd_i2c_sendbytes(ice->cs8427, ®, 1) != 1) |
diff --git a/sound/pci/ice1712/delta.h b/sound/pci/ice1712/delta.h index ea7116c304c0..f7f14df81f26 100644 --- a/sound/pci/ice1712/delta.h +++ b/sound/pci/ice1712/delta.h | |||
@@ -31,6 +31,7 @@ | |||
31 | "{MidiMan M Audio,Delta DiO 2496},"\ | 31 | "{MidiMan M Audio,Delta DiO 2496},"\ |
32 | "{MidiMan M Audio,Delta 66},"\ | 32 | "{MidiMan M Audio,Delta 66},"\ |
33 | "{MidiMan M Audio,Delta 44},"\ | 33 | "{MidiMan M Audio,Delta 44},"\ |
34 | "{MidiMan M Audio,Delta 410},"\ | ||
34 | "{MidiMan M Audio,Audiophile 24/96},"\ | 35 | "{MidiMan M Audio,Audiophile 24/96},"\ |
35 | "{Digigram,VX442},"\ | 36 | "{Digigram,VX442},"\ |
36 | "{Lionstracs,Mediastation}," | 37 | "{Lionstracs,Mediastation}," |
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index 013fc4f04822..6fe35b812040 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c | |||
@@ -149,7 +149,8 @@ static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mas | |||
149 | struct ews_spec *spec = ice->spec; | 149 | struct ews_spec *spec = ice->spec; |
150 | unsigned char data, ndata; | 150 | unsigned char data, ndata; |
151 | 151 | ||
152 | snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL); | 152 | if (snd_BUG_ON(chip_mask < 0 || chip_mask > 0x0f)) |
153 | return -EINVAL; | ||
153 | snd_i2c_lock(ice->i2c); | 154 | snd_i2c_lock(ice->i2c); |
154 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) | 155 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) |
155 | goto __error; | 156 | goto __error; |
@@ -685,7 +686,8 @@ static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, st | |||
685 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 686 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
686 | unsigned char data; | 687 | unsigned char data; |
687 | 688 | ||
688 | snd_assert(channel >= 0 && channel <= 7, return 0); | 689 | if (snd_BUG_ON(channel < 0 || channel > 7)) |
690 | return 0; | ||
689 | snd_i2c_lock(ice->i2c); | 691 | snd_i2c_lock(ice->i2c); |
690 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { | 692 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { |
691 | snd_i2c_unlock(ice->i2c); | 693 | snd_i2c_unlock(ice->i2c); |
@@ -705,7 +707,8 @@ static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, st | |||
705 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 707 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
706 | unsigned char data, ndata; | 708 | unsigned char data, ndata; |
707 | 709 | ||
708 | snd_assert(channel >= 0 && channel <= 7, return 0); | 710 | if (snd_BUG_ON(channel < 0 || channel > 7)) |
711 | return 0; | ||
709 | snd_i2c_lock(ice->i2c); | 712 | snd_i2c_lock(ice->i2c); |
710 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { | 713 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { |
711 | snd_i2c_unlock(ice->i2c); | 714 | snd_i2c_unlock(ice->i2c); |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 29d449d73c98..5b442383fcda 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | NOTES: | 23 | NOTES: |
@@ -35,7 +35,7 @@ | |||
35 | * | 35 | * |
36 | * 2002.11.26 James Stafford <jstafford@ampltd.com> | 36 | * 2002.11.26 James Stafford <jstafford@ampltd.com> |
37 | * Added support for VT1724 (Envy24HT) | 37 | * Added support for VT1724 (Envy24HT) |
38 | * I have left out support for 176.4 and 192 KHz for the moment. | 38 | * I have left out support for 176.4 and 192 KHz for the moment. |
39 | * I also haven't done anything with the internal S/PDIF transmitter or the MPU-401 | 39 | * I also haven't done anything with the internal S/PDIF transmitter or the MPU-401 |
40 | * | 40 | * |
41 | * 2003.02.20 Taksahi Iwai <tiwai@suse.de> | 41 | * 2003.02.20 Taksahi Iwai <tiwai@suse.de> |
@@ -47,7 +47,7 @@ | |||
47 | */ | 47 | */ |
48 | 48 | ||
49 | 49 | ||
50 | #include <asm/io.h> | 50 | #include <linux/io.h> |
51 | #include <linux/delay.h> | 51 | #include <linux/delay.h> |
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
@@ -123,7 +123,7 @@ static unsigned int PRO_RATE_DEFAULT = 44100; | |||
123 | /* | 123 | /* |
124 | * Basic I/O | 124 | * Basic I/O |
125 | */ | 125 | */ |
126 | 126 | ||
127 | /* check whether the clock mode is spdif-in */ | 127 | /* check whether the clock mode is spdif-in */ |
128 | static inline int is_spdif_master(struct snd_ice1712 *ice) | 128 | static inline int is_spdif_master(struct snd_ice1712 *ice) |
129 | { | 129 | { |
@@ -135,13 +135,13 @@ static inline int is_pro_rate_locked(struct snd_ice1712 *ice) | |||
135 | return is_spdif_master(ice) || PRO_RATE_LOCKED; | 135 | return is_spdif_master(ice) || PRO_RATE_LOCKED; |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline void snd_ice1712_ds_write(struct snd_ice1712 * ice, u8 channel, u8 addr, u32 data) | 138 | static inline void snd_ice1712_ds_write(struct snd_ice1712 *ice, u8 channel, u8 addr, u32 data) |
139 | { | 139 | { |
140 | outb((channel << 4) | addr, ICEDS(ice, INDEX)); | 140 | outb((channel << 4) | addr, ICEDS(ice, INDEX)); |
141 | outl(data, ICEDS(ice, DATA)); | 141 | outl(data, ICEDS(ice, DATA)); |
142 | } | 142 | } |
143 | 143 | ||
144 | static inline u32 snd_ice1712_ds_read(struct snd_ice1712 * ice, u8 channel, u8 addr) | 144 | static inline u32 snd_ice1712_ds_read(struct snd_ice1712 *ice, u8 channel, u8 addr) |
145 | { | 145 | { |
146 | outb((channel << 4) | addr, ICEDS(ice, INDEX)); | 146 | outb((channel << 4) | addr, ICEDS(ice, INDEX)); |
147 | return inl(ICEDS(ice, DATA)); | 147 | return inl(ICEDS(ice, DATA)); |
@@ -260,7 +260,7 @@ static unsigned short snd_ice1712_pro_ac97_read(struct snd_ac97 *ac97, | |||
260 | static int snd_ice1712_digmix_route_ac97_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 260 | static int snd_ice1712_digmix_route_ac97_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
261 | { | 261 | { |
262 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 262 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
263 | 263 | ||
264 | ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; | 264 | ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_ROUTECTRL)) & ICE1712_ROUTE_AC97 ? 1 : 0; |
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
@@ -269,11 +269,12 @@ static int snd_ice1712_digmix_route_ac97_put(struct snd_kcontrol *kcontrol, stru | |||
269 | { | 269 | { |
270 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 270 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
271 | unsigned char val, nval; | 271 | unsigned char val, nval; |
272 | 272 | ||
273 | spin_lock_irq(&ice->reg_lock); | 273 | spin_lock_irq(&ice->reg_lock); |
274 | val = inb(ICEMT(ice, MONITOR_ROUTECTRL)); | 274 | val = inb(ICEMT(ice, MONITOR_ROUTECTRL)); |
275 | nval = val & ~ICE1712_ROUTE_AC97; | 275 | nval = val & ~ICE1712_ROUTE_AC97; |
276 | if (ucontrol->value.integer.value[0]) nval |= ICE1712_ROUTE_AC97; | 276 | if (ucontrol->value.integer.value[0]) |
277 | nval |= ICE1712_ROUTE_AC97; | ||
277 | outb(nval, ICEMT(ice, MONITOR_ROUTECTRL)); | 278 | outb(nval, ICEMT(ice, MONITOR_ROUTECTRL)); |
278 | spin_unlock_irq(&ice->reg_lock); | 279 | spin_unlock_irq(&ice->reg_lock); |
279 | return val != nval; | 280 | return val != nval; |
@@ -329,7 +330,7 @@ static int snd_ice1712_cs8427_set_input_clock(struct snd_ice1712 *ice, int spdif | |||
329 | unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */ | 330 | unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */ |
330 | unsigned char val, nval; | 331 | unsigned char val, nval; |
331 | int res = 0; | 332 | int res = 0; |
332 | 333 | ||
333 | snd_i2c_lock(ice->i2c); | 334 | snd_i2c_lock(ice->i2c); |
334 | if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { | 335 | if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { |
335 | snd_i2c_unlock(ice->i2c); | 336 | snd_i2c_unlock(ice->i2c); |
@@ -381,9 +382,9 @@ int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) | |||
381 | { | 382 | { |
382 | int err; | 383 | int err; |
383 | 384 | ||
384 | if ((err = snd_cs8427_create(ice->i2c, addr, | 385 | err = snd_cs8427_create(ice->i2c, addr, |
385 | (ice->cs8427_timeout * HZ) / 1000, | 386 | (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427); |
386 | &ice->cs8427)) < 0) { | 387 | if (err < 0) { |
387 | snd_printk(KERN_ERR "CS8427 initialization failed\n"); | 388 | snd_printk(KERN_ERR "CS8427 initialization failed\n"); |
388 | return err; | 389 | return err; |
389 | } | 390 | } |
@@ -395,9 +396,9 @@ int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) | |||
395 | 396 | ||
396 | static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) | 397 | static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) |
397 | { | 398 | { |
398 | /* change CS8427 clock source too */ | 399 | /* change CS8427 clock source too */ |
399 | if (ice->cs8427) | 400 | if (ice->cs8427) |
400 | snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); | 401 | snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); |
401 | /* notify ak4524 chip as well */ | 402 | /* notify ak4524 chip as well */ |
402 | if (spdif_is_master) { | 403 | if (spdif_is_master) { |
403 | unsigned int i; | 404 | unsigned int i; |
@@ -457,11 +458,12 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) | |||
457 | u16 pbkstatus; | 458 | u16 pbkstatus; |
458 | struct snd_pcm_substream *substream; | 459 | struct snd_pcm_substream *substream; |
459 | pbkstatus = inw(ICEDS(ice, INTSTAT)); | 460 | pbkstatus = inw(ICEDS(ice, INTSTAT)); |
460 | //printk("pbkstatus = 0x%x\n", pbkstatus); | 461 | /* printk("pbkstatus = 0x%x\n", pbkstatus); */ |
461 | for (idx = 0; idx < 6; idx++) { | 462 | for (idx = 0; idx < 6; idx++) { |
462 | if ((pbkstatus & (3 << (idx * 2))) == 0) | 463 | if ((pbkstatus & (3 << (idx * 2))) == 0) |
463 | continue; | 464 | continue; |
464 | if ((substream = ice->playback_con_substream_ds[idx]) != NULL) | 465 | substream = ice->playback_con_substream_ds[idx]; |
466 | if (substream != NULL) | ||
465 | snd_pcm_period_elapsed(substream); | 467 | snd_pcm_period_elapsed(substream); |
466 | outw(3 << (idx * 2), ICEDS(ice, INTSTAT)); | 468 | outw(3 << (idx * 2), ICEDS(ice, INTSTAT)); |
467 | } | 469 | } |
@@ -507,7 +509,7 @@ static int snd_ice1712_playback_trigger(struct snd_pcm_substream *substream, | |||
507 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 509 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
508 | int result = 0; | 510 | int result = 0; |
509 | u32 tmp; | 511 | u32 tmp; |
510 | 512 | ||
511 | spin_lock(&ice->reg_lock); | 513 | spin_lock(&ice->reg_lock); |
512 | tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL); | 514 | tmp = snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL); |
513 | if (cmd == SNDRV_PCM_TRIGGER_START) { | 515 | if (cmd == SNDRV_PCM_TRIGGER_START) { |
@@ -532,7 +534,7 @@ static int snd_ice1712_playback_ds_trigger(struct snd_pcm_substream *substream, | |||
532 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 534 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
533 | int result = 0; | 535 | int result = 0; |
534 | u32 tmp; | 536 | u32 tmp; |
535 | 537 | ||
536 | spin_lock(&ice->reg_lock); | 538 | spin_lock(&ice->reg_lock); |
537 | tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL); | 539 | tmp = snd_ice1712_ds_read(ice, substream->number * 2, ICE1712_DSC_CONTROL); |
538 | if (cmd == SNDRV_PCM_TRIGGER_START) { | 540 | if (cmd == SNDRV_PCM_TRIGGER_START) { |
@@ -557,7 +559,7 @@ static int snd_ice1712_capture_trigger(struct snd_pcm_substream *substream, | |||
557 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 559 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
558 | int result = 0; | 560 | int result = 0; |
559 | u8 tmp; | 561 | u8 tmp; |
560 | 562 | ||
561 | spin_lock(&ice->reg_lock); | 563 | spin_lock(&ice->reg_lock); |
562 | tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL); | 564 | tmp = snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL); |
563 | if (cmd == SNDRV_PCM_TRIGGER_START) { | 565 | if (cmd == SNDRV_PCM_TRIGGER_START) { |
@@ -711,8 +713,7 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s | |||
711 | return bytes_to_frames(substream->runtime, ptr); | 713 | return bytes_to_frames(substream->runtime, ptr); |
712 | } | 714 | } |
713 | 715 | ||
714 | static const struct snd_pcm_hardware snd_ice1712_playback = | 716 | static const struct snd_pcm_hardware snd_ice1712_playback = { |
715 | { | ||
716 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 717 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
717 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 718 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
718 | SNDRV_PCM_INFO_MMAP_VALID | | 719 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -731,8 +732,7 @@ static const struct snd_pcm_hardware snd_ice1712_playback = | |||
731 | .fifo_size = 0, | 732 | .fifo_size = 0, |
732 | }; | 733 | }; |
733 | 734 | ||
734 | static const struct snd_pcm_hardware snd_ice1712_playback_ds = | 735 | static const struct snd_pcm_hardware snd_ice1712_playback_ds = { |
735 | { | ||
736 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 736 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
737 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 737 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
738 | SNDRV_PCM_INFO_MMAP_VALID | | 738 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -751,8 +751,7 @@ static const struct snd_pcm_hardware snd_ice1712_playback_ds = | |||
751 | .fifo_size = 0, | 751 | .fifo_size = 0, |
752 | }; | 752 | }; |
753 | 753 | ||
754 | static const struct snd_pcm_hardware snd_ice1712_capture = | 754 | static const struct snd_pcm_hardware snd_ice1712_capture = { |
755 | { | ||
756 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 755 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
757 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 756 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
758 | SNDRV_PCM_INFO_MMAP_VALID), | 757 | SNDRV_PCM_INFO_MMAP_VALID), |
@@ -788,7 +787,7 @@ static int snd_ice1712_playback_ds_open(struct snd_pcm_substream *substream) | |||
788 | 787 | ||
789 | ice->playback_con_substream_ds[substream->number] = substream; | 788 | ice->playback_con_substream_ds[substream->number] = substream; |
790 | runtime->hw = snd_ice1712_playback_ds; | 789 | runtime->hw = snd_ice1712_playback_ds; |
791 | spin_lock_irq(&ice->reg_lock); | 790 | spin_lock_irq(&ice->reg_lock); |
792 | tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2)); | 791 | tmp = inw(ICEDS(ice, INTMASK)) & ~(1 << (substream->number * 2)); |
793 | outw(tmp, ICEDS(ice, INTMASK)); | 792 | outw(tmp, ICEDS(ice, INTMASK)); |
794 | spin_unlock_irq(&ice->reg_lock); | 793 | spin_unlock_irq(&ice->reg_lock); |
@@ -821,7 +820,7 @@ static int snd_ice1712_playback_ds_close(struct snd_pcm_substream *substream) | |||
821 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 820 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
822 | u32 tmp; | 821 | u32 tmp; |
823 | 822 | ||
824 | spin_lock_irq(&ice->reg_lock); | 823 | spin_lock_irq(&ice->reg_lock); |
825 | tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2)); | 824 | tmp = inw(ICEDS(ice, INTMASK)) | (3 << (substream->number * 2)); |
826 | outw(tmp, ICEDS(ice, INTMASK)); | 825 | outw(tmp, ICEDS(ice, INTMASK)); |
827 | spin_unlock_irq(&ice->reg_lock); | 826 | spin_unlock_irq(&ice->reg_lock); |
@@ -870,7 +869,7 @@ static struct snd_pcm_ops snd_ice1712_capture_ops = { | |||
870 | .pointer = snd_ice1712_capture_pointer, | 869 | .pointer = snd_ice1712_capture_pointer, |
871 | }; | 870 | }; |
872 | 871 | ||
873 | static int __devinit snd_ice1712_pcm(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) | 872 | static int __devinit snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) |
874 | { | 873 | { |
875 | struct snd_pcm *pcm; | 874 | struct snd_pcm *pcm; |
876 | int err; | 875 | int err; |
@@ -900,7 +899,7 @@ static int __devinit snd_ice1712_pcm(struct snd_ice1712 * ice, int device, struc | |||
900 | return 0; | 899 | return 0; |
901 | } | 900 | } |
902 | 901 | ||
903 | static int __devinit snd_ice1712_pcm_ds(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) | 902 | static int __devinit snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) |
904 | { | 903 | { |
905 | struct snd_pcm *pcm; | 904 | struct snd_pcm *pcm; |
906 | int err; | 905 | int err; |
@@ -1029,14 +1028,14 @@ static void snd_ice1712_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, | |||
1029 | if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| | 1028 | if (inb(ICEMT(ice, PLAYBACK_CONTROL)) & (ICE1712_CAPTURE_START_SHADOW| |
1030 | ICE1712_PLAYBACK_PAUSE| | 1029 | ICE1712_PLAYBACK_PAUSE| |
1031 | ICE1712_PLAYBACK_START)) { | 1030 | ICE1712_PLAYBACK_START)) { |
1032 | __out: | 1031 | __out: |
1033 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 1032 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
1034 | return; | 1033 | return; |
1035 | } | 1034 | } |
1036 | if (!force && is_pro_rate_locked(ice)) | 1035 | if (!force && is_pro_rate_locked(ice)) |
1037 | goto __out; | 1036 | goto __out; |
1038 | 1037 | ||
1039 | old = inb(ICEMT(ice, RATE)); | 1038 | old = inb(ICEMT(ice, RATE)); |
1040 | if (!force && old == val) | 1039 | if (!force && old == val) |
1041 | goto __out; | 1040 | goto __out; |
1042 | outb(val, ICEMT(ice, RATE)); | 1041 | outb(val, ICEMT(ice, RATE)); |
@@ -1123,8 +1122,7 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea | |||
1123 | return bytes_to_frames(substream->runtime, ptr); | 1122 | return bytes_to_frames(substream->runtime, ptr); |
1124 | } | 1123 | } |
1125 | 1124 | ||
1126 | static const struct snd_pcm_hardware snd_ice1712_playback_pro = | 1125 | static const struct snd_pcm_hardware snd_ice1712_playback_pro = { |
1127 | { | ||
1128 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1126 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1129 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1127 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1130 | SNDRV_PCM_INFO_MMAP_VALID | | 1128 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1143,8 +1141,7 @@ static const struct snd_pcm_hardware snd_ice1712_playback_pro = | |||
1143 | .fifo_size = 0, | 1141 | .fifo_size = 0, |
1144 | }; | 1142 | }; |
1145 | 1143 | ||
1146 | static const struct snd_pcm_hardware snd_ice1712_capture_pro = | 1144 | static const struct snd_pcm_hardware snd_ice1712_capture_pro = { |
1147 | { | ||
1148 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1145 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1149 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1146 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
1150 | SNDRV_PCM_INFO_MMAP_VALID | | 1147 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1238,7 +1235,7 @@ static struct snd_pcm_ops snd_ice1712_capture_pro_ops = { | |||
1238 | .pointer = snd_ice1712_capture_pro_pointer, | 1235 | .pointer = snd_ice1712_capture_pro_pointer, |
1239 | }; | 1236 | }; |
1240 | 1237 | ||
1241 | static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device, struct snd_pcm ** rpcm) | 1238 | static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) |
1242 | { | 1239 | { |
1243 | struct snd_pcm *pcm; | 1240 | struct snd_pcm *pcm; |
1244 | int err; | 1241 | int err; |
@@ -1262,7 +1259,7 @@ static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device, | |||
1262 | ice->pcm_pro = pcm; | 1259 | ice->pcm_pro = pcm; |
1263 | if (rpcm) | 1260 | if (rpcm) |
1264 | *rpcm = pcm; | 1261 | *rpcm = pcm; |
1265 | 1262 | ||
1266 | if (ice->cs8427) { | 1263 | if (ice->cs8427) { |
1267 | /* assign channels to iec958 */ | 1264 | /* assign channels to iec958 */ |
1268 | err = snd_cs8427_iec958_build(ice->cs8427, | 1265 | err = snd_cs8427_iec958_build(ice->cs8427, |
@@ -1272,7 +1269,8 @@ static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 * ice, int device, | |||
1272 | return err; | 1269 | return err; |
1273 | } | 1270 | } |
1274 | 1271 | ||
1275 | if ((err = snd_ice1712_build_pro_mixer(ice)) < 0) | 1272 | err = snd_ice1712_build_pro_mixer(ice); |
1273 | if (err < 0) | ||
1276 | return err; | 1274 | return err; |
1277 | return 0; | 1275 | return 0; |
1278 | } | 1276 | } |
@@ -1299,7 +1297,7 @@ static int snd_ice1712_pro_mixer_switch_get(struct snd_kcontrol *kcontrol, struc | |||
1299 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1297 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1300 | int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + | 1298 | int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + |
1301 | kcontrol->private_value; | 1299 | kcontrol->private_value; |
1302 | 1300 | ||
1303 | spin_lock_irq(&ice->reg_lock); | 1301 | spin_lock_irq(&ice->reg_lock); |
1304 | ucontrol->value.integer.value[0] = | 1302 | ucontrol->value.integer.value[0] = |
1305 | !((ice->pro_volumes[priv_idx] >> 15) & 1); | 1303 | !((ice->pro_volumes[priv_idx] >> 15) & 1); |
@@ -1341,7 +1339,7 @@ static int snd_ice1712_pro_mixer_volume_get(struct snd_kcontrol *kcontrol, struc | |||
1341 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1339 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1342 | int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + | 1340 | int priv_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + |
1343 | kcontrol->private_value; | 1341 | kcontrol->private_value; |
1344 | 1342 | ||
1345 | spin_lock_irq(&ice->reg_lock); | 1343 | spin_lock_irq(&ice->reg_lock); |
1346 | ucontrol->value.integer.value[0] = | 1344 | ucontrol->value.integer.value[0] = |
1347 | (ice->pro_volumes[priv_idx] >> 0) & 127; | 1345 | (ice->pro_volumes[priv_idx] >> 0) & 127; |
@@ -1406,7 +1404,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch __devinit | |||
1406 | 1404 | ||
1407 | static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitdata = { | 1405 | static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitdata = { |
1408 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1406 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1409 | .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,SWITCH), | 1407 | .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, SWITCH), |
1410 | .info = snd_ice1712_pro_mixer_switch_info, | 1408 | .info = snd_ice1712_pro_mixer_switch_info, |
1411 | .get = snd_ice1712_pro_mixer_switch_get, | 1409 | .get = snd_ice1712_pro_mixer_switch_get, |
1412 | .put = snd_ice1712_pro_mixer_switch_put, | 1410 | .put = snd_ice1712_pro_mixer_switch_put, |
@@ -1428,7 +1426,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume __devinit | |||
1428 | 1426 | ||
1429 | static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitdata = { | 1427 | static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitdata = { |
1430 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1428 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1431 | .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,VOLUME), | 1429 | .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, VOLUME), |
1432 | .info = snd_ice1712_pro_mixer_volume_info, | 1430 | .info = snd_ice1712_pro_mixer_volume_info, |
1433 | .get = snd_ice1712_pro_mixer_volume_get, | 1431 | .get = snd_ice1712_pro_mixer_volume_get, |
1434 | .put = snd_ice1712_pro_mixer_volume_put, | 1432 | .put = snd_ice1712_pro_mixer_volume_put, |
@@ -1448,7 +1446,7 @@ static int __devinit snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice) | |||
1448 | if (err < 0) | 1446 | if (err < 0) |
1449 | return err; | 1447 | return err; |
1450 | } | 1448 | } |
1451 | 1449 | ||
1452 | if (ice->num_total_adcs > 0) { | 1450 | if (ice->num_total_adcs > 0) { |
1453 | struct snd_kcontrol_new tmp = snd_ice1712_multi_capture_analog_switch; | 1451 | struct snd_kcontrol_new tmp = snd_ice1712_multi_capture_analog_switch; |
1454 | tmp.count = ice->num_total_adcs; | 1452 | tmp.count = ice->num_total_adcs; |
@@ -1495,7 +1493,7 @@ static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97) | |||
1495 | ice->ac97 = NULL; | 1493 | ice->ac97 = NULL; |
1496 | } | 1494 | } |
1497 | 1495 | ||
1498 | static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice) | 1496 | static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 *ice) |
1499 | { | 1497 | { |
1500 | int err, bus_num = 0; | 1498 | int err, bus_num = 0; |
1501 | struct snd_ac97_template ac97; | 1499 | struct snd_ac97_template ac97; |
@@ -1510,27 +1508,32 @@ static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice) | |||
1510 | }; | 1508 | }; |
1511 | 1509 | ||
1512 | if (ice_has_con_ac97(ice)) { | 1510 | if (ice_has_con_ac97(ice)) { |
1513 | if ((err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus)) < 0) | 1511 | err = snd_ac97_bus(ice->card, bus_num++, &con_ops, NULL, &pbus); |
1512 | if (err < 0) | ||
1514 | return err; | 1513 | return err; |
1515 | memset(&ac97, 0, sizeof(ac97)); | 1514 | memset(&ac97, 0, sizeof(ac97)); |
1516 | ac97.private_data = ice; | 1515 | ac97.private_data = ice; |
1517 | ac97.private_free = snd_ice1712_mixer_free_ac97; | 1516 | ac97.private_free = snd_ice1712_mixer_free_ac97; |
1518 | if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0) | 1517 | err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); |
1518 | if (err < 0) | ||
1519 | printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); | 1519 | printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); |
1520 | else { | 1520 | else { |
1521 | if ((err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice))) < 0) | 1521 | err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice)); |
1522 | if (err < 0) | ||
1522 | return err; | 1523 | return err; |
1523 | return 0; | 1524 | return 0; |
1524 | } | 1525 | } |
1525 | } | 1526 | } |
1526 | 1527 | ||
1527 | if (! (ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) { | 1528 | if (!(ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) { |
1528 | if ((err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus)) < 0) | 1529 | err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus); |
1530 | if (err < 0) | ||
1529 | return err; | 1531 | return err; |
1530 | memset(&ac97, 0, sizeof(ac97)); | 1532 | memset(&ac97, 0, sizeof(ac97)); |
1531 | ac97.private_data = ice; | 1533 | ac97.private_data = ice; |
1532 | ac97.private_free = snd_ice1712_mixer_free_ac97; | 1534 | ac97.private_free = snd_ice1712_mixer_free_ac97; |
1533 | if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0) | 1535 | err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); |
1536 | if (err < 0) | ||
1534 | printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); | 1537 | printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); |
1535 | else | 1538 | else |
1536 | return 0; | 1539 | return 0; |
@@ -1549,7 +1552,7 @@ static inline unsigned int eeprom_double(struct snd_ice1712 *ice, int idx) | |||
1549 | return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); | 1552 | return (unsigned int)ice->eeprom.data[idx] | ((unsigned int)ice->eeprom.data[idx + 1] << 8); |
1550 | } | 1553 | } |
1551 | 1554 | ||
1552 | static void snd_ice1712_proc_read(struct snd_info_entry *entry, | 1555 | static void snd_ice1712_proc_read(struct snd_info_entry *entry, |
1553 | struct snd_info_buffer *buffer) | 1556 | struct snd_info_buffer *buffer) |
1554 | { | 1557 | { |
1555 | struct snd_ice1712 *ice = entry->private_data; | 1558 | struct snd_ice1712 *ice = entry->private_data; |
@@ -1585,15 +1588,15 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry, | |||
1585 | snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); | 1588 | snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); |
1586 | snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); | 1589 | snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); |
1587 | snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); | 1590 | snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); |
1588 | snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK)); | 1591 | snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK)); |
1589 | snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION)); | 1592 | snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION)); |
1590 | } | 1593 | } |
1591 | 1594 | ||
1592 | static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice) | 1595 | static void __devinit snd_ice1712_proc_init(struct snd_ice1712 *ice) |
1593 | { | 1596 | { |
1594 | struct snd_info_entry *entry; | 1597 | struct snd_info_entry *entry; |
1595 | 1598 | ||
1596 | if (! snd_card_proc_new(ice->card, "ice1712", &entry)) | 1599 | if (!snd_card_proc_new(ice->card, "ice1712", &entry)) |
1597 | snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); | 1600 | snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); |
1598 | } | 1601 | } |
1599 | 1602 | ||
@@ -1613,7 +1616,7 @@ static int snd_ice1712_eeprom_get(struct snd_kcontrol *kcontrol, | |||
1613 | struct snd_ctl_elem_value *ucontrol) | 1616 | struct snd_ctl_elem_value *ucontrol) |
1614 | { | 1617 | { |
1615 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1618 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1616 | 1619 | ||
1617 | memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); | 1620 | memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); |
1618 | return 0; | 1621 | return 0; |
1619 | } | 1622 | } |
@@ -1641,7 +1644,7 @@ static int snd_ice1712_spdif_default_get(struct snd_kcontrol *kcontrol, | |||
1641 | { | 1644 | { |
1642 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1645 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1643 | if (ice->spdif.ops.default_get) | 1646 | if (ice->spdif.ops.default_get) |
1644 | ice->spdif.ops.default_get(ice, ucontrol); | 1647 | ice->spdif.ops.default_get(ice, ucontrol); |
1645 | return 0; | 1648 | return 0; |
1646 | } | 1649 | } |
1647 | 1650 | ||
@@ -1657,7 +1660,7 @@ static int snd_ice1712_spdif_default_put(struct snd_kcontrol *kcontrol, | |||
1657 | static struct snd_kcontrol_new snd_ice1712_spdif_default __devinitdata = | 1660 | static struct snd_kcontrol_new snd_ice1712_spdif_default __devinitdata = |
1658 | { | 1661 | { |
1659 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1662 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1660 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 1663 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), |
1661 | .info = snd_ice1712_spdif_info, | 1664 | .info = snd_ice1712_spdif_info, |
1662 | .get = snd_ice1712_spdif_default_get, | 1665 | .get = snd_ice1712_spdif_default_get, |
1663 | .put = snd_ice1712_spdif_default_put | 1666 | .put = snd_ice1712_spdif_default_put |
@@ -1709,7 +1712,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_maskc __devinitdata = | |||
1709 | { | 1712 | { |
1710 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1713 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1711 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1714 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1712 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1715 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
1713 | .info = snd_ice1712_spdif_info, | 1716 | .info = snd_ice1712_spdif_info, |
1714 | .get = snd_ice1712_spdif_maskc_get, | 1717 | .get = snd_ice1712_spdif_maskc_get, |
1715 | }; | 1718 | }; |
@@ -1718,7 +1721,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_maskp __devinitdata = | |||
1718 | { | 1721 | { |
1719 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1722 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1720 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1723 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1721 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 1724 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
1722 | .info = snd_ice1712_spdif_info, | 1725 | .info = snd_ice1712_spdif_info, |
1723 | .get = snd_ice1712_spdif_maskp_get, | 1726 | .get = snd_ice1712_spdif_maskp_get, |
1724 | }; | 1727 | }; |
@@ -1746,7 +1749,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_stream __devinitdata = | |||
1746 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1749 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | |
1747 | SNDRV_CTL_ELEM_ACCESS_INACTIVE), | 1750 | SNDRV_CTL_ELEM_ACCESS_INACTIVE), |
1748 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1751 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1749 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PCM_STREAM), | 1752 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM), |
1750 | .info = snd_ice1712_spdif_info, | 1753 | .info = snd_ice1712_spdif_info, |
1751 | .get = snd_ice1712_spdif_stream_get, | 1754 | .get = snd_ice1712_spdif_stream_get, |
1752 | .put = snd_ice1712_spdif_stream_put | 1755 | .put = snd_ice1712_spdif_stream_put |
@@ -1758,7 +1761,7 @@ int snd_ice1712_gpio_get(struct snd_kcontrol *kcontrol, | |||
1758 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1761 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1759 | unsigned char mask = kcontrol->private_value & 0xff; | 1762 | unsigned char mask = kcontrol->private_value & 0xff; |
1760 | int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; | 1763 | int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; |
1761 | 1764 | ||
1762 | snd_ice1712_save_gpio_status(ice); | 1765 | snd_ice1712_save_gpio_status(ice); |
1763 | ucontrol->value.integer.value[0] = | 1766 | ucontrol->value.integer.value[0] = |
1764 | (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; | 1767 | (snd_ice1712_gpio_read(ice) & mask ? 1 : 0) ^ invert; |
@@ -1825,7 +1828,7 @@ static int snd_ice1712_pro_internal_clock_get(struct snd_kcontrol *kcontrol, | |||
1825 | 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 255, 255, 255, 10 | 1828 | 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 255, 255, 255, 10 |
1826 | }; | 1829 | }; |
1827 | unsigned char val; | 1830 | unsigned char val; |
1828 | 1831 | ||
1829 | spin_lock_irq(&ice->reg_lock); | 1832 | spin_lock_irq(&ice->reg_lock); |
1830 | if (is_spdif_master(ice)) { | 1833 | if (is_spdif_master(ice)) { |
1831 | ucontrol->value.enumerated.item[0] = 13; | 1834 | ucontrol->value.enumerated.item[0] = 13; |
@@ -1867,7 +1870,7 @@ static int snd_ice1712_pro_internal_clock_put(struct snd_kcontrol *kcontrol, | |||
1867 | 1870 | ||
1868 | if ((oval & ICE1712_SPDIF_MASTER) != | 1871 | if ((oval & ICE1712_SPDIF_MASTER) != |
1869 | (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) | 1872 | (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) |
1870 | snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); | 1873 | snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); |
1871 | 1874 | ||
1872 | return change; | 1875 | return change; |
1873 | } | 1876 | } |
@@ -1897,7 +1900,7 @@ static int snd_ice1712_pro_internal_clock_default_info(struct snd_kcontrol *kcon | |||
1897 | "64000", /* 10: 15 */ | 1900 | "64000", /* 10: 15 */ |
1898 | "88200", /* 11: 11 */ | 1901 | "88200", /* 11: 11 */ |
1899 | "96000", /* 12: 7 */ | 1902 | "96000", /* 12: 7 */ |
1900 | // "IEC958 Input", /* 13: -- */ | 1903 | /* "IEC958 Input", 13: -- */ |
1901 | }; | 1904 | }; |
1902 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1905 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1903 | uinfo->count = 1; | 1906 | uinfo->count = 1; |
@@ -2026,7 +2029,7 @@ static int snd_ice1712_pro_route_info(struct snd_kcontrol *kcontrol, | |||
2026 | "IEC958 In L", "IEC958 In R", /* 9-10 */ | 2029 | "IEC958 In L", "IEC958 In R", /* 9-10 */ |
2027 | "Digital Mixer", /* 11 - optional */ | 2030 | "Digital Mixer", /* 11 - optional */ |
2028 | }; | 2031 | }; |
2029 | 2032 | ||
2030 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2033 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2031 | uinfo->count = 1; | 2034 | uinfo->count = 1; |
2032 | uinfo->value.enumerated.items = | 2035 | uinfo->value.enumerated.items = |
@@ -2070,7 +2073,7 @@ static int snd_ice1712_pro_route_analog_put(struct snd_kcontrol *kcontrol, | |||
2070 | int change, shift; | 2073 | int change, shift; |
2071 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 2074 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
2072 | unsigned int val, old_val, nval; | 2075 | unsigned int val, old_val, nval; |
2073 | 2076 | ||
2074 | /* update PSDOUT */ | 2077 | /* update PSDOUT */ |
2075 | if (ucontrol->value.enumerated.item[0] >= 11) | 2078 | if (ucontrol->value.enumerated.item[0] >= 11) |
2076 | nval = idx < 2 ? 1 : 0; /* dig mixer (or pcm) */ | 2079 | nval = idx < 2 ? 1 : 0; /* dig mixer (or pcm) */ |
@@ -2140,7 +2143,7 @@ static int snd_ice1712_pro_route_spdif_put(struct snd_kcontrol *kcontrol, | |||
2140 | int change, shift; | 2143 | int change, shift; |
2141 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 2144 | int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
2142 | unsigned int val, old_val, nval; | 2145 | unsigned int val, old_val, nval; |
2143 | 2146 | ||
2144 | /* update SPDOUT */ | 2147 | /* update SPDOUT */ |
2145 | spin_lock_irq(&ice->reg_lock); | 2148 | spin_lock_irq(&ice->reg_lock); |
2146 | val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT)); | 2149 | val = old_val = inw(ICEMT(ice, ROUTE_SPDOUT)); |
@@ -2182,7 +2185,7 @@ static struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route __devinitdata | |||
2182 | 2185 | ||
2183 | static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route __devinitdata = { | 2186 | static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route __devinitdata = { |
2184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2187 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2185 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", | 2188 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route", |
2186 | .info = snd_ice1712_pro_route_info, | 2189 | .info = snd_ice1712_pro_route_info, |
2187 | .get = snd_ice1712_pro_route_spdif_get, | 2190 | .get = snd_ice1712_pro_route_spdif_get, |
2188 | .put = snd_ice1712_pro_route_spdif_put, | 2191 | .put = snd_ice1712_pro_route_spdif_put, |
@@ -2204,7 +2207,7 @@ static int snd_ice1712_pro_volume_rate_get(struct snd_kcontrol *kcontrol, | |||
2204 | struct snd_ctl_elem_value *ucontrol) | 2207 | struct snd_ctl_elem_value *ucontrol) |
2205 | { | 2208 | { |
2206 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 2209 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
2207 | 2210 | ||
2208 | ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); | 2211 | ucontrol->value.integer.value[0] = inb(ICEMT(ice, MONITOR_RATE)); |
2209 | return 0; | 2212 | return 0; |
2210 | } | 2213 | } |
@@ -2245,7 +2248,7 @@ static int snd_ice1712_pro_peak_get(struct snd_kcontrol *kcontrol, | |||
2245 | { | 2248 | { |
2246 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 2249 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
2247 | int idx; | 2250 | int idx; |
2248 | 2251 | ||
2249 | spin_lock_irq(&ice->reg_lock); | 2252 | spin_lock_irq(&ice->reg_lock); |
2250 | for (idx = 0; idx < 22; idx++) { | 2253 | for (idx = 0; idx < 22; idx++) { |
2251 | outb(idx, ICEMT(ice, MONITOR_PEAKINDEX)); | 2254 | outb(idx, ICEMT(ice, MONITOR_PEAKINDEX)); |
@@ -2296,12 +2299,12 @@ static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice, | |||
2296 | unsigned int i, size; | 2299 | unsigned int i, size; |
2297 | struct snd_ice1712_card_info * const *tbl, *c; | 2300 | struct snd_ice1712_card_info * const *tbl, *c; |
2298 | 2301 | ||
2299 | if (! modelname || ! *modelname) { | 2302 | if (!modelname || !*modelname) { |
2300 | ice->eeprom.subvendor = 0; | 2303 | ice->eeprom.subvendor = 0; |
2301 | if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0) | 2304 | if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) != 0) |
2302 | ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | | 2305 | ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) | |
2303 | (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | | 2306 | (snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | |
2304 | (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | | 2307 | (snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | |
2305 | (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); | 2308 | (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); |
2306 | if (ice->eeprom.subvendor == 0 || | 2309 | if (ice->eeprom.subvendor == 0 || |
2307 | ice->eeprom.subvendor == (unsigned int)-1) { | 2310 | ice->eeprom.subvendor == (unsigned int)-1) { |
@@ -2318,12 +2321,12 @@ static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice, | |||
2318 | } | 2321 | } |
2319 | for (tbl = card_tables; *tbl; tbl++) { | 2322 | for (tbl = card_tables; *tbl; tbl++) { |
2320 | for (c = *tbl; c->subvendor; c++) { | 2323 | for (c = *tbl; c->subvendor; c++) { |
2321 | if (modelname && c->model && ! strcmp(modelname, c->model)) { | 2324 | if (modelname && c->model && !strcmp(modelname, c->model)) { |
2322 | printk(KERN_INFO "ice1712: Using board model %s\n", c->name); | 2325 | printk(KERN_INFO "ice1712: Using board model %s\n", c->name); |
2323 | ice->eeprom.subvendor = c->subvendor; | 2326 | ice->eeprom.subvendor = c->subvendor; |
2324 | } else if (c->subvendor != ice->eeprom.subvendor) | 2327 | } else if (c->subvendor != ice->eeprom.subvendor) |
2325 | continue; | 2328 | continue; |
2326 | if (! c->eeprom_size || ! c->eeprom_data) | 2329 | if (!c->eeprom_size || !c->eeprom_data) |
2327 | goto found; | 2330 | goto found; |
2328 | /* if the EEPROM is given by the driver, use it */ | 2331 | /* if the EEPROM is given by the driver, use it */ |
2329 | snd_printdd("using the defined eeprom..\n"); | 2332 | snd_printdd("using the defined eeprom..\n"); |
@@ -2416,7 +2419,8 @@ int __devinit snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice) | |||
2416 | int err; | 2419 | int err; |
2417 | struct snd_kcontrol *kctl; | 2420 | struct snd_kcontrol *kctl; |
2418 | 2421 | ||
2419 | snd_assert(ice->pcm_pro != NULL, return -EIO); | 2422 | if (snd_BUG_ON(!ice->pcm_pro)) |
2423 | return -EIO; | ||
2420 | err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice)); | 2424 | err = snd_ctl_add(ice->card, kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice)); |
2421 | if (err < 0) | 2425 | if (err < 0) |
2422 | return err; | 2426 | return err; |
@@ -2483,13 +2487,13 @@ static int __devinit snd_ice1712_build_controls(struct snd_ice1712 *ice) | |||
2483 | 2487 | ||
2484 | static int snd_ice1712_free(struct snd_ice1712 *ice) | 2488 | static int snd_ice1712_free(struct snd_ice1712 *ice) |
2485 | { | 2489 | { |
2486 | if (! ice->port) | 2490 | if (!ice->port) |
2487 | goto __hw_end; | 2491 | goto __hw_end; |
2488 | /* mask all interrupts */ | 2492 | /* mask all interrupts */ |
2489 | outb(0xc0, ICEMT(ice, IRQ)); | 2493 | outb(0xc0, ICEMT(ice, IRQ)); |
2490 | outb(0xff, ICEREG(ice, IRQMASK)); | 2494 | outb(0xff, ICEREG(ice, IRQMASK)); |
2491 | /* --- */ | 2495 | /* --- */ |
2492 | __hw_end: | 2496 | __hw_end: |
2493 | if (ice->irq >= 0) | 2497 | if (ice->irq >= 0) |
2494 | free_irq(ice->irq, ice); | 2498 | free_irq(ice->irq, ice); |
2495 | 2499 | ||
@@ -2514,7 +2518,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2514 | int omni, | 2518 | int omni, |
2515 | int cs8427_timeout, | 2519 | int cs8427_timeout, |
2516 | int dxr_enable, | 2520 | int dxr_enable, |
2517 | struct snd_ice1712 ** r_ice1712) | 2521 | struct snd_ice1712 **r_ice1712) |
2518 | { | 2522 | { |
2519 | struct snd_ice1712 *ice; | 2523 | struct snd_ice1712 *ice; |
2520 | int err; | 2524 | int err; |
@@ -2524,8 +2528,9 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2524 | 2528 | ||
2525 | *r_ice1712 = NULL; | 2529 | *r_ice1712 = NULL; |
2526 | 2530 | ||
2527 | /* enable PCI device */ | 2531 | /* enable PCI device */ |
2528 | if ((err = pci_enable_device(pci)) < 0) | 2532 | err = pci_enable_device(pci); |
2533 | if (err < 0) | ||
2529 | return err; | 2534 | return err; |
2530 | /* check, if we can restrict PCI DMA transfers to 28 bits */ | 2535 | /* check, if we can restrict PCI DMA transfers to 28 bits */ |
2531 | if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || | 2536 | if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || |
@@ -2569,7 +2574,8 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2569 | snd_ice1712_proc_init(ice); | 2574 | snd_ice1712_proc_init(ice); |
2570 | synchronize_irq(pci->irq); | 2575 | synchronize_irq(pci->irq); |
2571 | 2576 | ||
2572 | if ((err = pci_request_regions(pci, "ICE1712")) < 0) { | 2577 | err = pci_request_regions(pci, "ICE1712"); |
2578 | if (err < 0) { | ||
2573 | kfree(ice); | 2579 | kfree(ice); |
2574 | pci_disable_device(pci); | 2580 | pci_disable_device(pci); |
2575 | return err; | 2581 | return err; |
@@ -2585,7 +2591,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2585 | snd_ice1712_free(ice); | 2591 | snd_ice1712_free(ice); |
2586 | return -EIO; | 2592 | return -EIO; |
2587 | } | 2593 | } |
2588 | 2594 | ||
2589 | ice->irq = pci->irq; | 2595 | ice->irq = pci->irq; |
2590 | 2596 | ||
2591 | if (snd_ice1712_read_eeprom(ice, modelname) < 0) { | 2597 | if (snd_ice1712_read_eeprom(ice, modelname) < 0) { |
@@ -2605,9 +2611,10 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2605 | ICEREG(ice, IRQMASK)); | 2611 | ICEREG(ice, IRQMASK)); |
2606 | outb(0x00, ICEMT(ice, IRQ)); | 2612 | outb(0x00, ICEMT(ice, IRQ)); |
2607 | 2613 | ||
2608 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops)) < 0) { | 2614 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); |
2615 | if (err < 0) { | ||
2609 | snd_ice1712_free(ice); | 2616 | snd_ice1712_free(ice); |
2610 | return err; | 2617 | return err; |
2611 | } | 2618 | } |
2612 | 2619 | ||
2613 | snd_card_set_dev(card, &pci->dev); | 2620 | snd_card_set_dev(card, &pci->dev); |
@@ -2647,10 +2654,10 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2647 | 2654 | ||
2648 | strcpy(card->driver, "ICE1712"); | 2655 | strcpy(card->driver, "ICE1712"); |
2649 | strcpy(card->shortname, "ICEnsemble ICE1712"); | 2656 | strcpy(card->shortname, "ICEnsemble ICE1712"); |
2650 | 2657 | ||
2651 | if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], | 2658 | err = snd_ice1712_create(card, pci, model[dev], omni[dev], |
2652 | cs8427_timeout[dev], dxr_enable[dev], | 2659 | cs8427_timeout[dev], dxr_enable[dev], &ice); |
2653 | &ice)) < 0) { | 2660 | if (err < 0) { |
2654 | snd_card_free(card); | 2661 | snd_card_free(card); |
2655 | return err; | 2662 | return err; |
2656 | } | 2663 | } |
@@ -2662,7 +2669,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2662 | if (c->driver) /* specific driver? */ | 2669 | if (c->driver) /* specific driver? */ |
2663 | strcpy(card->driver, c->driver); | 2670 | strcpy(card->driver, c->driver); |
2664 | if (c->chip_init) { | 2671 | if (c->chip_init) { |
2665 | if ((err = c->chip_init(ice)) < 0) { | 2672 | err = c->chip_init(ice); |
2673 | if (err < 0) { | ||
2666 | snd_card_free(card); | 2674 | snd_card_free(card); |
2667 | return err; | 2675 | return err; |
2668 | } | 2676 | } |
@@ -2674,47 +2682,52 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2674 | c = &no_matched; | 2682 | c = &no_matched; |
2675 | __found: | 2683 | __found: |
2676 | 2684 | ||
2677 | if ((err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL)) < 0) { | 2685 | err = snd_ice1712_pcm_profi(ice, pcm_dev++, NULL); |
2686 | if (err < 0) { | ||
2678 | snd_card_free(card); | 2687 | snd_card_free(card); |
2679 | return err; | 2688 | return err; |
2680 | } | 2689 | } |
2681 | 2690 | ||
2682 | if (ice_has_con_ac97(ice)) | 2691 | if (ice_has_con_ac97(ice)) |
2683 | if ((err = snd_ice1712_pcm(ice, pcm_dev++, NULL)) < 0) { | 2692 | err = snd_ice1712_pcm(ice, pcm_dev++, NULL); |
2693 | if (err < 0) { | ||
2684 | snd_card_free(card); | 2694 | snd_card_free(card); |
2685 | return err; | 2695 | return err; |
2686 | } | 2696 | } |
2687 | 2697 | ||
2688 | if ((err = snd_ice1712_ac97_mixer(ice)) < 0) { | 2698 | err = snd_ice1712_ac97_mixer(ice); |
2699 | if (err < 0) { | ||
2689 | snd_card_free(card); | 2700 | snd_card_free(card); |
2690 | return err; | 2701 | return err; |
2691 | } | 2702 | } |
2692 | 2703 | ||
2693 | if ((err = snd_ice1712_build_controls(ice)) < 0) { | 2704 | err = snd_ice1712_build_controls(ice); |
2705 | if (err < 0) { | ||
2694 | snd_card_free(card); | 2706 | snd_card_free(card); |
2695 | return err; | 2707 | return err; |
2696 | } | 2708 | } |
2697 | 2709 | ||
2698 | if (c->build_controls) { | 2710 | if (c->build_controls) { |
2699 | if ((err = c->build_controls(ice)) < 0) { | 2711 | err = c->build_controls(ice); |
2712 | if (err < 0) { | ||
2700 | snd_card_free(card); | 2713 | snd_card_free(card); |
2701 | return err; | 2714 | return err; |
2702 | } | 2715 | } |
2703 | } | 2716 | } |
2704 | 2717 | ||
2705 | if (ice_has_con_ac97(ice)) | 2718 | if (ice_has_con_ac97(ice)) |
2706 | if ((err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL)) < 0) { | 2719 | err = snd_ice1712_pcm_ds(ice, pcm_dev++, NULL); |
2720 | if (err < 0) { | ||
2707 | snd_card_free(card); | 2721 | snd_card_free(card); |
2708 | return err; | 2722 | return err; |
2709 | } | 2723 | } |
2710 | 2724 | ||
2711 | if (! c->no_mpu401) { | 2725 | if (!c->no_mpu401) { |
2712 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, | 2726 | err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, |
2713 | ICEREG(ice, MPU1_CTRL), | 2727 | ICEREG(ice, MPU1_CTRL), |
2714 | (c->mpu401_1_info_flags | | 2728 | (c->mpu401_1_info_flags | MPU401_INFO_INTEGRATED), |
2715 | MPU401_INFO_INTEGRATED), | 2729 | ice->irq, 0, &ice->rmidi[0]); |
2716 | ice->irq, 0, | 2730 | if (err < 0) { |
2717 | &ice->rmidi[0])) < 0) { | ||
2718 | snd_card_free(card); | 2731 | snd_card_free(card); |
2719 | return err; | 2732 | return err; |
2720 | } | 2733 | } |
@@ -2726,12 +2739,12 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2726 | 2739 | ||
2727 | if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { | 2740 | if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { |
2728 | /* 2nd port used */ | 2741 | /* 2nd port used */ |
2729 | if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712, | 2742 | err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712, |
2730 | ICEREG(ice, MPU2_CTRL), | 2743 | ICEREG(ice, MPU2_CTRL), |
2731 | (c->mpu401_2_info_flags | | 2744 | (c->mpu401_2_info_flags | MPU401_INFO_INTEGRATED), |
2732 | MPU401_INFO_INTEGRATED), | 2745 | ice->irq, 0, &ice->rmidi[1]); |
2733 | ice->irq, 0, | 2746 | |
2734 | &ice->rmidi[1])) < 0) { | 2747 | if (err < 0) { |
2735 | snd_card_free(card); | 2748 | snd_card_free(card); |
2736 | return err; | 2749 | return err; |
2737 | } | 2750 | } |
@@ -2749,7 +2762,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2749 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 2762 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
2750 | card->shortname, ice->port, ice->irq); | 2763 | card->shortname, ice->port, ice->irq); |
2751 | 2764 | ||
2752 | if ((err = snd_card_register(card)) < 0) { | 2765 | err = snd_card_register(card); |
2766 | if (err < 0) { | ||
2753 | snd_card_free(card); | 2767 | snd_card_free(card); |
2754 | return err; | 2768 | return err; |
2755 | } | 2769 | } |
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 762fbd7a7507..fdae6deba16b 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h | |||
@@ -20,7 +20,7 @@ | |||
20 | * along with this program; if not, write to the Free Software | 20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <sound/control.h> | 25 | #include <sound/control.h> |
26 | #include <sound/ac97_codec.h> | 26 | #include <sound/ac97_codec.h> |
@@ -112,7 +112,7 @@ | |||
112 | */ | 112 | */ |
113 | 113 | ||
114 | #define ICEDS(ice, x) ((ice)->dmapath_port + ICE1712_DS_##x) | 114 | #define ICEDS(ice, x) ((ice)->dmapath_port + ICE1712_DS_##x) |
115 | 115 | ||
116 | #define ICE1712_DS_INTMASK 0x00 /* word - interrupt mask */ | 116 | #define ICE1712_DS_INTMASK 0x00 /* word - interrupt mask */ |
117 | #define ICE1712_DS_INTSTAT 0x02 /* word - interrupt status */ | 117 | #define ICE1712_DS_INTSTAT 0x02 /* word - interrupt status */ |
118 | #define ICE1712_DS_DATA 0x04 /* dword - channel data */ | 118 | #define ICE1712_DS_DATA 0x04 /* dword - channel data */ |
@@ -121,7 +121,7 @@ | |||
121 | /* | 121 | /* |
122 | * Consumer section channel registers | 122 | * Consumer section channel registers |
123 | */ | 123 | */ |
124 | 124 | ||
125 | #define ICE1712_DSC_ADDR0 0x00 /* dword - base address 0 */ | 125 | #define ICE1712_DSC_ADDR0 0x00 /* dword - base address 0 */ |
126 | #define ICE1712_DSC_COUNT0 0x01 /* word - count 0 */ | 126 | #define ICE1712_DSC_COUNT0 0x01 /* word - count 0 */ |
127 | #define ICE1712_DSC_ADDR1 0x02 /* dword - base address 1 */ | 127 | #define ICE1712_DSC_ADDR1 0x02 /* dword - base address 1 */ |
@@ -138,7 +138,7 @@ | |||
138 | #define ICE1712_DSC_RATE 0x05 /* dword - rate */ | 138 | #define ICE1712_DSC_RATE 0x05 /* dword - rate */ |
139 | #define ICE1712_DSC_VOLUME 0x06 /* word - volume control */ | 139 | #define ICE1712_DSC_VOLUME 0x06 /* word - volume control */ |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * Professional multi-track direct control registers | 142 | * Professional multi-track direct control registers |
143 | */ | 143 | */ |
144 | 144 | ||
@@ -214,7 +214,7 @@ | |||
214 | 214 | ||
215 | 215 | ||
216 | /* | 216 | /* |
217 | * | 217 | * |
218 | */ | 218 | */ |
219 | 219 | ||
220 | struct snd_ice1712; | 220 | struct snd_ice1712; |
@@ -253,12 +253,12 @@ enum { | |||
253 | ICE_EEP1_ADC_ID2, | 253 | ICE_EEP1_ADC_ID2, |
254 | ICE_EEP1_ADC_ID3 | 254 | ICE_EEP1_ADC_ID3 |
255 | }; | 255 | }; |
256 | 256 | ||
257 | #define ice_has_con_ac97(ice) (!((ice)->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) | 257 | #define ice_has_con_ac97(ice) (!((ice)->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97)) |
258 | 258 | ||
259 | 259 | ||
260 | struct snd_ak4xxx_private { | 260 | struct snd_ak4xxx_private { |
261 | unsigned int cif: 1; /* CIF mode */ | 261 | unsigned int cif:1; /* CIF mode */ |
262 | unsigned char caddr; /* C0 and C1 bits */ | 262 | unsigned char caddr; /* C0 and C1 bits */ |
263 | unsigned int data_mask; /* DATA gpio bit */ | 263 | unsigned int data_mask; /* DATA gpio bit */ |
264 | unsigned int clk_mask; /* CLK gpio bit */ | 264 | unsigned int clk_mask; /* CLK gpio bit */ |
@@ -306,11 +306,11 @@ struct snd_ice1712 { | |||
306 | struct snd_pcm *pcm; | 306 | struct snd_pcm *pcm; |
307 | struct snd_pcm *pcm_ds; | 307 | struct snd_pcm *pcm_ds; |
308 | struct snd_pcm *pcm_pro; | 308 | struct snd_pcm *pcm_pro; |
309 | struct snd_pcm_substream *playback_con_substream; | 309 | struct snd_pcm_substream *playback_con_substream; |
310 | struct snd_pcm_substream *playback_con_substream_ds[6]; | 310 | struct snd_pcm_substream *playback_con_substream_ds[6]; |
311 | struct snd_pcm_substream *capture_con_substream; | 311 | struct snd_pcm_substream *capture_con_substream; |
312 | struct snd_pcm_substream *playback_pro_substream; | 312 | struct snd_pcm_substream *playback_pro_substream; |
313 | struct snd_pcm_substream *capture_pro_substream; | 313 | struct snd_pcm_substream *capture_pro_substream; |
314 | unsigned int playback_pro_size; | 314 | unsigned int playback_pro_size; |
315 | unsigned int capture_pro_size; | 315 | unsigned int capture_pro_size; |
316 | unsigned int playback_con_virt_addr[6]; | 316 | unsigned int playback_con_virt_addr[6]; |
@@ -326,15 +326,15 @@ struct snd_ice1712 { | |||
326 | struct snd_ice1712_eeprom eeprom; | 326 | struct snd_ice1712_eeprom eeprom; |
327 | 327 | ||
328 | unsigned int pro_volumes[20]; | 328 | unsigned int pro_volumes[20]; |
329 | unsigned int omni: 1; /* Delta Omni I/O */ | 329 | unsigned int omni:1; /* Delta Omni I/O */ |
330 | unsigned int dxr_enable: 1; /* Terratec DXR enable for DMX6FIRE */ | 330 | unsigned int dxr_enable:1; /* Terratec DXR enable for DMX6FIRE */ |
331 | unsigned int vt1724: 1; | 331 | unsigned int vt1724:1; |
332 | unsigned int vt1720: 1; | 332 | unsigned int vt1720:1; |
333 | unsigned int has_spdif: 1; /* VT1720/4 - has SPDIF I/O */ | 333 | unsigned int has_spdif:1; /* VT1720/4 - has SPDIF I/O */ |
334 | unsigned int force_pdma4: 1; /* VT1720/4 - PDMA4 as non-spdif */ | 334 | unsigned int force_pdma4:1; /* VT1720/4 - PDMA4 as non-spdif */ |
335 | unsigned int force_rdma1: 1; /* VT1720/4 - RDMA1 as non-spdif */ | 335 | unsigned int force_rdma1:1; /* VT1720/4 - RDMA1 as non-spdif */ |
336 | unsigned int midi_output: 1; /* VT1720/4: MIDI output triggered */ | 336 | unsigned int midi_output:1; /* VT1720/4: MIDI output triggered */ |
337 | unsigned int midi_input: 1; /* VT1720/4: MIDI input triggered */ | 337 | unsigned int midi_input:1; /* VT1720/4: MIDI input triggered */ |
338 | unsigned int num_total_dacs; /* total DACs */ | 338 | unsigned int num_total_dacs; /* total DACs */ |
339 | unsigned int num_total_adcs; /* total ADCs */ | 339 | unsigned int num_total_adcs; /* total ADCs */ |
340 | unsigned int cur_rate; /* current rate */ | 340 | unsigned int cur_rate; /* current rate */ |
@@ -351,7 +351,7 @@ struct snd_ice1712 { | |||
351 | struct snd_i2c_bus *i2c; /* I2C bus */ | 351 | struct snd_i2c_bus *i2c; /* I2C bus */ |
352 | struct snd_i2c_device *cs8427; /* CS8427 I2C device */ | 352 | struct snd_i2c_device *cs8427; /* CS8427 I2C device */ |
353 | unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */ | 353 | unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */ |
354 | 354 | ||
355 | struct ice1712_gpio { | 355 | struct ice1712_gpio { |
356 | unsigned int direction; /* current direction bits */ | 356 | unsigned int direction; /* current direction bits */ |
357 | unsigned int write_mask; /* current mask bits */ | 357 | unsigned int write_mask; /* current mask bits */ |
@@ -455,7 +455,7 @@ static inline int snd_ice1712_gpio_read_bits(struct snd_ice1712 *ice, | |||
455 | { | 455 | { |
456 | ice->gpio.direction &= ~mask; | 456 | ice->gpio.direction &= ~mask; |
457 | snd_ice1712_gpio_set_dir(ice, ice->gpio.direction); | 457 | snd_ice1712_gpio_set_dir(ice, ice->gpio.direction); |
458 | return (snd_ice1712_gpio_read(ice) & mask); | 458 | return snd_ice1712_gpio_read(ice) & mask; |
459 | } | 459 | } |
460 | 460 | ||
461 | int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice); | 461 | int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice); |
@@ -467,13 +467,13 @@ int snd_ice1712_akm4xxx_build_controls(struct snd_ice1712 *ice); | |||
467 | 467 | ||
468 | int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr); | 468 | int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr); |
469 | 469 | ||
470 | static inline void snd_ice1712_write(struct snd_ice1712 * ice, u8 addr, u8 data) | 470 | static inline void snd_ice1712_write(struct snd_ice1712 *ice, u8 addr, u8 data) |
471 | { | 471 | { |
472 | outb(addr, ICEREG(ice, INDEX)); | 472 | outb(addr, ICEREG(ice, INDEX)); |
473 | outb(data, ICEREG(ice, DATA)); | 473 | outb(data, ICEREG(ice, DATA)); |
474 | } | 474 | } |
475 | 475 | ||
476 | static inline u8 snd_ice1712_read(struct snd_ice1712 * ice, u8 addr) | 476 | static inline u8 snd_ice1712_read(struct snd_ice1712 *ice, u8 addr) |
477 | { | 477 | { |
478 | outb(addr, ICEREG(ice, INDEX)); | 478 | outb(addr, ICEREG(ice, INDEX)); |
479 | return inb(ICEREG(ice, DATA)); | 479 | return inb(ICEREG(ice, DATA)); |
@@ -491,7 +491,7 @@ struct snd_ice1712_card_info { | |||
491 | char *driver; | 491 | char *driver; |
492 | int (*chip_init)(struct snd_ice1712 *); | 492 | int (*chip_init)(struct snd_ice1712 *); |
493 | int (*build_controls)(struct snd_ice1712 *); | 493 | int (*build_controls)(struct snd_ice1712 *); |
494 | unsigned int no_mpu401: 1; | 494 | unsigned int no_mpu401:1; |
495 | unsigned int mpu401_1_info_flags; | 495 | unsigned int mpu401_1_info_flags; |
496 | unsigned int mpu401_2_info_flags; | 496 | unsigned int mpu401_2_info_flags; |
497 | const char *mpu401_1_name; | 497 | const char *mpu401_1_name; |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index e596d777d9dd..1b3f11702713 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -20,9 +20,9 @@ | |||
20 | * along with this program; if not, write to the Free Software | 20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <asm/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
@@ -105,7 +105,7 @@ static unsigned int PRO_RATE_DEFAULT = 44100; | |||
105 | /* | 105 | /* |
106 | * Basic I/O | 106 | * Basic I/O |
107 | */ | 107 | */ |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * default rates, default clock routines | 110 | * default rates, default clock routines |
111 | */ | 111 | */ |
@@ -198,7 +198,7 @@ static void snd_vt1724_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data) | |||
198 | static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | 198 | static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) |
199 | { | 199 | { |
200 | outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); | 200 | outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); |
201 | if (! ice->vt1720) /* VT1720 supports only 16 GPIO bits */ | 201 | if (!ice->vt1720) /* VT1720 supports only 16 GPIO bits */ |
202 | outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22)); | 202 | outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22)); |
203 | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ | 203 | inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ |
204 | } | 204 | } |
@@ -206,7 +206,7 @@ static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data) | |||
206 | static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) | 206 | static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) |
207 | { | 207 | { |
208 | outw(data, ICEREG1724(ice, GPIO_DATA)); | 208 | outw(data, ICEREG1724(ice, GPIO_DATA)); |
209 | if (! ice->vt1720) | 209 | if (!ice->vt1720) |
210 | outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22)); | 210 | outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22)); |
211 | inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ | 211 | inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ |
212 | } | 212 | } |
@@ -214,7 +214,7 @@ static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data) | |||
214 | static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice) | 214 | static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice) |
215 | { | 215 | { |
216 | unsigned int data; | 216 | unsigned int data; |
217 | if (! ice->vt1720) | 217 | if (!ice->vt1720) |
218 | data = (unsigned int)inb(ICEREG1724(ice, GPIO_DATA_22)); | 218 | data = (unsigned int)inb(ICEREG1724(ice, GPIO_DATA_22)); |
219 | else | 219 | else |
220 | data = 0; | 220 | data = 0; |
@@ -399,7 +399,7 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
399 | break; | 399 | break; |
400 | } | 400 | } |
401 | #endif | 401 | #endif |
402 | handled = 1; | 402 | handled = 1; |
403 | if (status & VT1724_IRQ_MPU_TX) { | 403 | if (status & VT1724_IRQ_MPU_TX) { |
404 | spin_lock(&ice->reg_lock); | 404 | spin_lock(&ice->reg_lock); |
405 | if (ice->midi_output) | 405 | if (ice->midi_output) |
@@ -468,8 +468,8 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
468 | /* ought to really handle this properly */ | 468 | /* ought to really handle this properly */ |
469 | if (mtstat & VT1724_MULTI_FIFO_ERR) { | 469 | if (mtstat & VT1724_MULTI_FIFO_ERR) { |
470 | unsigned char fstat = inb(ICEMT1724(ice, DMA_FIFO_ERR)); | 470 | unsigned char fstat = inb(ICEMT1724(ice, DMA_FIFO_ERR)); |
471 | outb(fstat, ICEMT1724(ice, DMA_FIFO_ERR)); | 471 | outb(fstat, ICEMT1724(ice, DMA_FIFO_ERR)); |
472 | outb(VT1724_MULTI_FIFO_ERR | inb(ICEMT1724(ice, DMA_INT_MASK)), ICEMT1724(ice, DMA_INT_MASK)); | 472 | outb(VT1724_MULTI_FIFO_ERR | inb(ICEMT1724(ice, DMA_INT_MASK)), ICEMT1724(ice, DMA_INT_MASK)); |
473 | /* If I don't do this, I get machine lockup due to continual interrupts */ | 473 | /* If I don't do this, I get machine lockup due to continual interrupts */ |
474 | } | 474 | } |
475 | 475 | ||
@@ -733,17 +733,17 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) | |||
733 | outl(substream->runtime->dma_addr, ICEMT1724(ice, PLAYBACK_ADDR)); | 733 | outl(substream->runtime->dma_addr, ICEMT1724(ice, PLAYBACK_ADDR)); |
734 | 734 | ||
735 | size = (snd_pcm_lib_buffer_bytes(substream) >> 2) - 1; | 735 | size = (snd_pcm_lib_buffer_bytes(substream) >> 2) - 1; |
736 | // outl(size, ICEMT1724(ice, PLAYBACK_SIZE)); | 736 | /* outl(size, ICEMT1724(ice, PLAYBACK_SIZE)); */ |
737 | outw(size, ICEMT1724(ice, PLAYBACK_SIZE)); | 737 | outw(size, ICEMT1724(ice, PLAYBACK_SIZE)); |
738 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_SIZE) + 2); | 738 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_SIZE) + 2); |
739 | size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; | 739 | size = (snd_pcm_lib_period_bytes(substream) >> 2) - 1; |
740 | // outl(size, ICEMT1724(ice, PLAYBACK_COUNT)); | 740 | /* outl(size, ICEMT1724(ice, PLAYBACK_COUNT)); */ |
741 | outw(size, ICEMT1724(ice, PLAYBACK_COUNT)); | 741 | outw(size, ICEMT1724(ice, PLAYBACK_COUNT)); |
742 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_COUNT) + 2); | 742 | outb(size >> 16, ICEMT1724(ice, PLAYBACK_COUNT) + 2); |
743 | 743 | ||
744 | spin_unlock_irq(&ice->reg_lock); | 744 | spin_unlock_irq(&ice->reg_lock); |
745 | 745 | ||
746 | // printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); | 746 | /* printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); */ |
747 | return 0; | 747 | return 0; |
748 | } | 748 | } |
749 | 749 | ||
@@ -771,7 +771,7 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea | |||
771 | ptr = inl(ICEMT1724(ice, PLAYBACK_SIZE)) & 0xffffff; | 771 | ptr = inl(ICEMT1724(ice, PLAYBACK_SIZE)) & 0xffffff; |
772 | ptr = (ptr + 1) << 2; | 772 | ptr = (ptr + 1) << 2; |
773 | ptr = bytes_to_frames(substream->runtime, ptr); | 773 | ptr = bytes_to_frames(substream->runtime, ptr); |
774 | if (! ptr) | 774 | if (!ptr) |
775 | ; | 775 | ; |
776 | else if (ptr <= substream->runtime->buffer_size) | 776 | else if (ptr <= substream->runtime->buffer_size) |
777 | ptr = substream->runtime->buffer_size - ptr; | 777 | ptr = substream->runtime->buffer_size - ptr; |
@@ -815,7 +815,7 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substr | |||
815 | ptr = inw(ice->profi_port + reg->size); | 815 | ptr = inw(ice->profi_port + reg->size); |
816 | ptr = (ptr + 1) << 2; | 816 | ptr = (ptr + 1) << 2; |
817 | ptr = bytes_to_frames(substream->runtime, ptr); | 817 | ptr = bytes_to_frames(substream->runtime, ptr); |
818 | if (! ptr) | 818 | if (!ptr) |
819 | ; | 819 | ; |
820 | else if (ptr <= substream->runtime->buffer_size) | 820 | else if (ptr <= substream->runtime->buffer_size) |
821 | ptr = substream->runtime->buffer_size - ptr; | 821 | ptr = substream->runtime->buffer_size - ptr; |
@@ -842,8 +842,7 @@ static const struct vt1724_pcm_reg vt1724_capture_pro_reg = { | |||
842 | .start = VT1724_RDMA0_START, | 842 | .start = VT1724_RDMA0_START, |
843 | }; | 843 | }; |
844 | 844 | ||
845 | static const struct snd_pcm_hardware snd_vt1724_playback_pro = | 845 | static const struct snd_pcm_hardware snd_vt1724_playback_pro = { |
846 | { | ||
847 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 846 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
848 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 847 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
849 | SNDRV_PCM_INFO_MMAP_VALID | | 848 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -861,8 +860,7 @@ static const struct snd_pcm_hardware snd_vt1724_playback_pro = | |||
861 | .periods_max = 1024, | 860 | .periods_max = 1024, |
862 | }; | 861 | }; |
863 | 862 | ||
864 | static const struct snd_pcm_hardware snd_vt1724_spdif = | 863 | static const struct snd_pcm_hardware snd_vt1724_spdif = { |
865 | { | ||
866 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 864 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
867 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 865 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
868 | SNDRV_PCM_INFO_MMAP_VALID | | 866 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -883,8 +881,7 @@ static const struct snd_pcm_hardware snd_vt1724_spdif = | |||
883 | .periods_max = 1024, | 881 | .periods_max = 1024, |
884 | }; | 882 | }; |
885 | 883 | ||
886 | static const struct snd_pcm_hardware snd_vt1724_2ch_stereo = | 884 | static const struct snd_pcm_hardware snd_vt1724_2ch_stereo = { |
887 | { | ||
888 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 885 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
889 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 886 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
890 | SNDRV_PCM_INFO_MMAP_VALID | | 887 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -942,7 +939,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream) | |||
942 | { | 939 | { |
943 | struct snd_pcm_runtime *runtime = substream->runtime; | 940 | struct snd_pcm_runtime *runtime = substream->runtime; |
944 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 941 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
945 | int chs; | 942 | int chs, num_indeps; |
946 | 943 | ||
947 | runtime->private_data = (void *)&vt1724_playback_pro_reg; | 944 | runtime->private_data = (void *)&vt1724_playback_pro_reg; |
948 | ice->playback_pro_substream = substream; | 945 | ice->playback_pro_substream = substream; |
@@ -952,7 +949,8 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream) | |||
952 | set_rate_constraints(ice, substream); | 949 | set_rate_constraints(ice, substream); |
953 | mutex_lock(&ice->open_mutex); | 950 | mutex_lock(&ice->open_mutex); |
954 | /* calculate the currently available channels */ | 951 | /* calculate the currently available channels */ |
955 | for (chs = 0; chs < 3; chs++) { | 952 | num_indeps = ice->num_total_dacs / 2 - 1; |
953 | for (chs = 0; chs < num_indeps; chs++) { | ||
956 | if (ice->pcm_reserved[chs]) | 954 | if (ice->pcm_reserved[chs]) |
957 | break; | 955 | break; |
958 | } | 956 | } |
@@ -1029,7 +1027,7 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = { | |||
1029 | .pointer = snd_vt1724_pcm_pointer, | 1027 | .pointer = snd_vt1724_pcm_pointer, |
1030 | }; | 1028 | }; |
1031 | 1029 | ||
1032 | static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 * ice, int device) | 1030 | static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) |
1033 | { | 1031 | { |
1034 | struct snd_pcm *pcm; | 1032 | struct snd_pcm *pcm; |
1035 | int err; | 1033 | int err; |
@@ -1114,7 +1112,7 @@ static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate) | |||
1114 | static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream) | 1112 | static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream) |
1115 | { | 1113 | { |
1116 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); | 1114 | struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); |
1117 | if (! ice->force_pdma4) | 1115 | if (!ice->force_pdma4) |
1118 | update_spdif_rate(ice, substream->runtime->rate); | 1116 | update_spdif_rate(ice, substream->runtime->rate); |
1119 | return snd_vt1724_pcm_prepare(substream); | 1117 | return snd_vt1724_pcm_prepare(substream); |
1120 | } | 1118 | } |
@@ -1214,7 +1212,7 @@ static struct snd_pcm_ops snd_vt1724_capture_spdif_ops = { | |||
1214 | }; | 1212 | }; |
1215 | 1213 | ||
1216 | 1214 | ||
1217 | static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 * ice, int device) | 1215 | static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) |
1218 | { | 1216 | { |
1219 | char *name; | 1217 | char *name; |
1220 | struct snd_pcm *pcm; | 1218 | struct snd_pcm *pcm; |
@@ -1233,7 +1231,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 * ice, int device) | |||
1233 | ice->has_spdif = 1; | 1231 | ice->has_spdif = 1; |
1234 | } else | 1232 | } else |
1235 | capt = 0; | 1233 | capt = 0; |
1236 | if (! play && ! capt) | 1234 | if (!play && !capt) |
1237 | return 0; /* no spdif device */ | 1235 | return 0; /* no spdif device */ |
1238 | 1236 | ||
1239 | if (ice->force_pdma4 || ice->force_rdma1) | 1237 | if (ice->force_pdma4 || ice->force_rdma1) |
@@ -1348,7 +1346,7 @@ static struct snd_pcm_ops snd_vt1724_playback_indep_ops = { | |||
1348 | }; | 1346 | }; |
1349 | 1347 | ||
1350 | 1348 | ||
1351 | static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 * ice, int device) | 1349 | static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) |
1352 | { | 1350 | { |
1353 | struct snd_pcm *pcm; | 1351 | struct snd_pcm *pcm; |
1354 | int play; | 1352 | int play; |
@@ -1383,11 +1381,11 @@ static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 * ice, int device) | |||
1383 | * Mixer section | 1381 | * Mixer section |
1384 | */ | 1382 | */ |
1385 | 1383 | ||
1386 | static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 * ice) | 1384 | static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 *ice) |
1387 | { | 1385 | { |
1388 | int err; | 1386 | int err; |
1389 | 1387 | ||
1390 | if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { | 1388 | if (!(ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { |
1391 | struct snd_ac97_bus *pbus; | 1389 | struct snd_ac97_bus *pbus; |
1392 | struct snd_ac97_template ac97; | 1390 | struct snd_ac97_template ac97; |
1393 | static struct snd_ac97_bus_ops ops = { | 1391 | static struct snd_ac97_bus_ops ops = { |
@@ -1400,11 +1398,13 @@ static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 * ice) | |||
1400 | mdelay(5); /* FIXME */ | 1398 | mdelay(5); /* FIXME */ |
1401 | outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); | 1399 | outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); |
1402 | 1400 | ||
1403 | if ((err = snd_ac97_bus(ice->card, 0, &ops, NULL, &pbus)) < 0) | 1401 | err = snd_ac97_bus(ice->card, 0, &ops, NULL, &pbus); |
1402 | if (err < 0) | ||
1404 | return err; | 1403 | return err; |
1405 | memset(&ac97, 0, sizeof(ac97)); | 1404 | memset(&ac97, 0, sizeof(ac97)); |
1406 | ac97.private_data = ice; | 1405 | ac97.private_data = ice; |
1407 | if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0) | 1406 | err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); |
1407 | if (err < 0) | ||
1408 | printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); | 1408 | printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); |
1409 | else | 1409 | else |
1410 | return 0; | 1410 | return 0; |
@@ -1425,7 +1425,7 @@ static inline unsigned int eeprom_triple(struct snd_ice1712 *ice, int idx) | |||
1425 | ((unsigned int)ice->eeprom.data[idx + 2] << 16); | 1425 | ((unsigned int)ice->eeprom.data[idx + 2] << 16); |
1426 | } | 1426 | } |
1427 | 1427 | ||
1428 | static void snd_vt1724_proc_read(struct snd_info_entry *entry, | 1428 | static void snd_vt1724_proc_read(struct snd_info_entry *entry, |
1429 | struct snd_info_buffer *buffer) | 1429 | struct snd_info_buffer *buffer) |
1430 | { | 1430 | { |
1431 | struct snd_ice1712 *ice = entry->private_data; | 1431 | struct snd_ice1712 *ice = entry->private_data; |
@@ -1467,11 +1467,11 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry, | |||
1467 | idx, inb(ice->profi_port+idx)); | 1467 | idx, inb(ice->profi_port+idx)); |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | static void __devinit snd_vt1724_proc_init(struct snd_ice1712 * ice) | 1470 | static void __devinit snd_vt1724_proc_init(struct snd_ice1712 *ice) |
1471 | { | 1471 | { |
1472 | struct snd_info_entry *entry; | 1472 | struct snd_info_entry *entry; |
1473 | 1473 | ||
1474 | if (! snd_card_proc_new(ice->card, "ice1724", &entry)) | 1474 | if (!snd_card_proc_new(ice->card, "ice1724", &entry)) |
1475 | snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read); | 1475 | snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read); |
1476 | } | 1476 | } |
1477 | 1477 | ||
@@ -1491,7 +1491,7 @@ static int snd_vt1724_eeprom_get(struct snd_kcontrol *kcontrol, | |||
1491 | struct snd_ctl_elem_value *ucontrol) | 1491 | struct snd_ctl_elem_value *ucontrol) |
1492 | { | 1492 | { |
1493 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1493 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1494 | 1494 | ||
1495 | memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); | 1495 | memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); |
1496 | return 0; | 1496 | return 0; |
1497 | } | 1497 | } |
@@ -1606,13 +1606,13 @@ static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol, | |||
1606 | if (val != old) | 1606 | if (val != old) |
1607 | update_spdif_bits(ice, val); | 1607 | update_spdif_bits(ice, val); |
1608 | spin_unlock_irq(&ice->reg_lock); | 1608 | spin_unlock_irq(&ice->reg_lock); |
1609 | return (val != old); | 1609 | return val != old; |
1610 | } | 1610 | } |
1611 | 1611 | ||
1612 | static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata = | 1612 | static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata = |
1613 | { | 1613 | { |
1614 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1614 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1615 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 1615 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), |
1616 | .info = snd_vt1724_spdif_info, | 1616 | .info = snd_vt1724_spdif_info, |
1617 | .get = snd_vt1724_spdif_default_get, | 1617 | .get = snd_vt1724_spdif_default_get, |
1618 | .put = snd_vt1724_spdif_default_put | 1618 | .put = snd_vt1724_spdif_default_put |
@@ -1645,7 +1645,7 @@ static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata = | |||
1645 | { | 1645 | { |
1646 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1646 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1647 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1647 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1648 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | 1648 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), |
1649 | .info = snd_vt1724_spdif_info, | 1649 | .info = snd_vt1724_spdif_info, |
1650 | .get = snd_vt1724_spdif_maskc_get, | 1650 | .get = snd_vt1724_spdif_maskc_get, |
1651 | }; | 1651 | }; |
@@ -1654,7 +1654,7 @@ static struct snd_kcontrol_new snd_vt1724_spdif_maskp __devinitdata = | |||
1654 | { | 1654 | { |
1655 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 1655 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1656 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1656 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
1657 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | 1657 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), |
1658 | .info = snd_vt1724_spdif_info, | 1658 | .info = snd_vt1724_spdif_info, |
1659 | .get = snd_vt1724_spdif_maskp_get, | 1659 | .get = snd_vt1724_spdif_maskp_get, |
1660 | }; | 1660 | }; |
@@ -1691,8 +1691,8 @@ static struct snd_kcontrol_new snd_vt1724_spdif_switch __devinitdata = | |||
1691 | { | 1691 | { |
1692 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1692 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1693 | /* FIXME: the following conflict with IEC958 Playback Route */ | 1693 | /* FIXME: the following conflict with IEC958 Playback Route */ |
1694 | // .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), | 1694 | /* .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), */ |
1695 | .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), | 1695 | .name = SNDRV_CTL_NAME_IEC958("Output ", NONE, SWITCH), |
1696 | .info = snd_vt1724_spdif_sw_info, | 1696 | .info = snd_vt1724_spdif_sw_info, |
1697 | .get = snd_vt1724_spdif_sw_get, | 1697 | .get = snd_vt1724_spdif_sw_get, |
1698 | .put = snd_vt1724_spdif_sw_put | 1698 | .put = snd_vt1724_spdif_sw_put |
@@ -1712,7 +1712,7 @@ int snd_vt1724_gpio_get(struct snd_kcontrol *kcontrol, | |||
1712 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1712 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1713 | int shift = kcontrol->private_value & 0xff; | 1713 | int shift = kcontrol->private_value & 0xff; |
1714 | int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; | 1714 | int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; |
1715 | 1715 | ||
1716 | snd_ice1712_save_gpio_status(ice); | 1716 | snd_ice1712_save_gpio_status(ice); |
1717 | ucontrol->value.integer.value[0] = | 1717 | ucontrol->value.integer.value[0] = |
1718 | (snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert; | 1718 | (snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert; |
@@ -1767,7 +1767,7 @@ static int snd_vt1724_pro_internal_clock_get(struct snd_kcontrol *kcontrol, | |||
1767 | { | 1767 | { |
1768 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1768 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1769 | unsigned int i, rate; | 1769 | unsigned int i, rate; |
1770 | 1770 | ||
1771 | spin_lock_irq(&ice->reg_lock); | 1771 | spin_lock_irq(&ice->reg_lock); |
1772 | if (ice->is_spdif_master(ice)) { | 1772 | if (ice->is_spdif_master(ice)) { |
1773 | ucontrol->value.enumerated.item[0] = ice->hw_rates->count; | 1773 | ucontrol->value.enumerated.item[0] = ice->hw_rates->count; |
@@ -1923,7 +1923,7 @@ static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol, | |||
1923 | "H/W In 0", "H/W In 1", /* 1-2 */ | 1923 | "H/W In 0", "H/W In 1", /* 1-2 */ |
1924 | "IEC958 In L", "IEC958 In R", /* 3-4 */ | 1924 | "IEC958 In L", "IEC958 In R", /* 3-4 */ |
1925 | }; | 1925 | }; |
1926 | 1926 | ||
1927 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1927 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1928 | uinfo->count = 1; | 1928 | uinfo->count = 1; |
1929 | uinfo->value.enumerated.items = 5; | 1929 | uinfo->value.enumerated.items = 5; |
@@ -1953,7 +1953,7 @@ static int get_route_val(struct snd_ice1712 *ice, int shift) | |||
1953 | 1953 | ||
1954 | val = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); | 1954 | val = inl(ICEMT1724(ice, ROUTE_PLAYBACK)); |
1955 | val >>= shift; | 1955 | val >>= shift; |
1956 | val &= 7; //we now have 3 bits per output | 1956 | val &= 7; /* we now have 3 bits per output */ |
1957 | eitem = xlate[val]; | 1957 | eitem = xlate[val]; |
1958 | if (eitem == 255) { | 1958 | if (eitem == 255) { |
1959 | snd_BUG(); | 1959 | snd_BUG(); |
@@ -2032,7 +2032,7 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = | |||
2032 | 2032 | ||
2033 | static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = { | 2033 | static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = { |
2034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2035 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", | 2035 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route", |
2036 | .info = snd_vt1724_pro_route_info, | 2036 | .info = snd_vt1724_pro_route_info, |
2037 | .get = snd_vt1724_pro_route_spdif_get, | 2037 | .get = snd_vt1724_pro_route_spdif_get, |
2038 | .put = snd_vt1724_pro_route_spdif_put, | 2038 | .put = snd_vt1724_pro_route_spdif_put, |
@@ -2055,7 +2055,7 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol, | |||
2055 | { | 2055 | { |
2056 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 2056 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
2057 | int idx; | 2057 | int idx; |
2058 | 2058 | ||
2059 | spin_lock_irq(&ice->reg_lock); | 2059 | spin_lock_irq(&ice->reg_lock); |
2060 | for (idx = 0; idx < 22; idx++) { | 2060 | for (idx = 0; idx < 22; idx++) { |
2061 | outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX)); | 2061 | outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX)); |
@@ -2082,7 +2082,7 @@ static struct snd_ice1712_card_info no_matched __devinitdata; | |||
2082 | 2082 | ||
2083 | static struct snd_ice1712_card_info *card_tables[] __devinitdata = { | 2083 | static struct snd_ice1712_card_info *card_tables[] __devinitdata = { |
2084 | snd_vt1724_revo_cards, | 2084 | snd_vt1724_revo_cards, |
2085 | snd_vt1724_amp_cards, | 2085 | snd_vt1724_amp_cards, |
2086 | snd_vt1724_aureon_cards, | 2086 | snd_vt1724_aureon_cards, |
2087 | snd_vt1720_mobo_cards, | 2087 | snd_vt1720_mobo_cards, |
2088 | snd_vt1720_pontis_cards, | 2088 | snd_vt1720_pontis_cards, |
@@ -2120,7 +2120,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, | |||
2120 | wait_i2c_busy(ice); | 2120 | wait_i2c_busy(ice); |
2121 | val = inb(ICEREG1724(ice, I2C_DATA)); | 2121 | val = inb(ICEREG1724(ice, I2C_DATA)); |
2122 | mutex_unlock(&ice->i2c_mutex); | 2122 | mutex_unlock(&ice->i2c_mutex); |
2123 | //printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); | 2123 | /* printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); */ |
2124 | return val; | 2124 | return val; |
2125 | } | 2125 | } |
2126 | 2126 | ||
@@ -2129,7 +2129,7 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice, | |||
2129 | { | 2129 | { |
2130 | mutex_lock(&ice->i2c_mutex); | 2130 | mutex_lock(&ice->i2c_mutex); |
2131 | wait_i2c_busy(ice); | 2131 | wait_i2c_busy(ice); |
2132 | //printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); | 2132 | /* printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); */ |
2133 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); | 2133 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); |
2134 | outb(data, ICEREG1724(ice, I2C_DATA)); | 2134 | outb(data, ICEREG1724(ice, I2C_DATA)); |
2135 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); | 2135 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); |
@@ -2144,13 +2144,13 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, | |||
2144 | unsigned int i, size; | 2144 | unsigned int i, size; |
2145 | struct snd_ice1712_card_info * const *tbl, *c; | 2145 | struct snd_ice1712_card_info * const *tbl, *c; |
2146 | 2146 | ||
2147 | if (! modelname || ! *modelname) { | 2147 | if (!modelname || !*modelname) { |
2148 | ice->eeprom.subvendor = 0; | 2148 | ice->eeprom.subvendor = 0; |
2149 | if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) != 0) | 2149 | if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) != 0) |
2150 | ice->eeprom.subvendor = | 2150 | ice->eeprom.subvendor = |
2151 | (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) | | 2151 | (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) | |
2152 | (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | | 2152 | (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | |
2153 | (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | | 2153 | (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | |
2154 | (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); | 2154 | (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); |
2155 | if (ice->eeprom.subvendor == 0 || | 2155 | if (ice->eeprom.subvendor == 0 || |
2156 | ice->eeprom.subvendor == (unsigned int)-1) { | 2156 | ice->eeprom.subvendor == (unsigned int)-1) { |
@@ -2173,13 +2173,13 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, | |||
2173 | for (tbl = card_tables; *tbl; tbl++) { | 2173 | for (tbl = card_tables; *tbl; tbl++) { |
2174 | for (c = *tbl; c->subvendor; c++) { | 2174 | for (c = *tbl; c->subvendor; c++) { |
2175 | if (modelname && c->model && | 2175 | if (modelname && c->model && |
2176 | ! strcmp(modelname, c->model)) { | 2176 | !strcmp(modelname, c->model)) { |
2177 | printk(KERN_INFO "ice1724: Using board model %s\n", | 2177 | printk(KERN_INFO "ice1724: Using board model %s\n", |
2178 | c->name); | 2178 | c->name); |
2179 | ice->eeprom.subvendor = c->subvendor; | 2179 | ice->eeprom.subvendor = c->subvendor; |
2180 | } else if (c->subvendor != ice->eeprom.subvendor) | 2180 | } else if (c->subvendor != ice->eeprom.subvendor) |
2181 | continue; | 2181 | continue; |
2182 | if (! c->eeprom_size || ! c->eeprom_data) | 2182 | if (!c->eeprom_size || !c->eeprom_data) |
2183 | goto found; | 2183 | goto found; |
2184 | /* if the EEPROM is given by the driver, use it */ | 2184 | /* if the EEPROM is given by the driver, use it */ |
2185 | snd_printdd("using the defined eeprom..\n"); | 2185 | snd_printdd("using the defined eeprom..\n"); |
@@ -2250,7 +2250,8 @@ static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice) | |||
2250 | int err; | 2250 | int err; |
2251 | struct snd_kcontrol *kctl; | 2251 | struct snd_kcontrol *kctl; |
2252 | 2252 | ||
2253 | snd_assert(ice->pcm != NULL, return -EIO); | 2253 | if (snd_BUG_ON(!ice->pcm)) |
2254 | return -EIO; | ||
2254 | 2255 | ||
2255 | err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_mixer_pro_spdif_route, ice)); | 2256 | err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_mixer_pro_spdif_route, ice)); |
2256 | if (err < 0) | 2257 | if (err < 0) |
@@ -2320,13 +2321,13 @@ static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice) | |||
2320 | 2321 | ||
2321 | static int snd_vt1724_free(struct snd_ice1712 *ice) | 2322 | static int snd_vt1724_free(struct snd_ice1712 *ice) |
2322 | { | 2323 | { |
2323 | if (! ice->port) | 2324 | if (!ice->port) |
2324 | goto __hw_end; | 2325 | goto __hw_end; |
2325 | /* mask all interrupts */ | 2326 | /* mask all interrupts */ |
2326 | outb(0xff, ICEMT1724(ice, DMA_INT_MASK)); | 2327 | outb(0xff, ICEMT1724(ice, DMA_INT_MASK)); |
2327 | outb(0xff, ICEREG1724(ice, IRQMASK)); | 2328 | outb(0xff, ICEREG1724(ice, IRQMASK)); |
2328 | /* --- */ | 2329 | /* --- */ |
2329 | __hw_end: | 2330 | __hw_end: |
2330 | if (ice->irq >= 0) | 2331 | if (ice->irq >= 0) |
2331 | free_irq(ice->irq, ice); | 2332 | free_irq(ice->irq, ice); |
2332 | pci_release_regions(ice->pci); | 2333 | pci_release_regions(ice->pci); |
@@ -2346,7 +2347,7 @@ static int snd_vt1724_dev_free(struct snd_device *device) | |||
2346 | static int __devinit snd_vt1724_create(struct snd_card *card, | 2347 | static int __devinit snd_vt1724_create(struct snd_card *card, |
2347 | struct pci_dev *pci, | 2348 | struct pci_dev *pci, |
2348 | const char *modelname, | 2349 | const char *modelname, |
2349 | struct snd_ice1712 ** r_ice1712) | 2350 | struct snd_ice1712 **r_ice1712) |
2350 | { | 2351 | { |
2351 | struct snd_ice1712 *ice; | 2352 | struct snd_ice1712 *ice; |
2352 | int err; | 2353 | int err; |
@@ -2357,8 +2358,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2357 | 2358 | ||
2358 | *r_ice1712 = NULL; | 2359 | *r_ice1712 = NULL; |
2359 | 2360 | ||
2360 | /* enable PCI device */ | 2361 | /* enable PCI device */ |
2361 | if ((err = pci_enable_device(pci)) < 0) | 2362 | err = pci_enable_device(pci); |
2363 | if (err < 0) | ||
2362 | return err; | 2364 | return err; |
2363 | 2365 | ||
2364 | ice = kzalloc(sizeof(*ice), GFP_KERNEL); | 2366 | ice = kzalloc(sizeof(*ice), GFP_KERNEL); |
@@ -2382,7 +2384,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2382 | snd_vt1724_proc_init(ice); | 2384 | snd_vt1724_proc_init(ice); |
2383 | synchronize_irq(pci->irq); | 2385 | synchronize_irq(pci->irq); |
2384 | 2386 | ||
2385 | if ((err = pci_request_regions(pci, "ICE1724")) < 0) { | 2387 | err = pci_request_regions(pci, "ICE1724"); |
2388 | if (err < 0) { | ||
2386 | kfree(ice); | 2389 | kfree(ice); |
2387 | pci_disable_device(pci); | 2390 | pci_disable_device(pci); |
2388 | return err; | 2391 | return err; |
@@ -2417,9 +2420,10 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2417 | */ | 2420 | */ |
2418 | outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); | 2421 | outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); |
2419 | 2422 | ||
2420 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops)) < 0) { | 2423 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); |
2424 | if (err < 0) { | ||
2421 | snd_vt1724_free(ice); | 2425 | snd_vt1724_free(ice); |
2422 | return err; | 2426 | return err; |
2423 | } | 2427 | } |
2424 | 2428 | ||
2425 | snd_card_set_dev(card, &pci->dev); | 2429 | snd_card_set_dev(card, &pci->dev); |
@@ -2457,8 +2461,9 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2457 | 2461 | ||
2458 | strcpy(card->driver, "ICE1724"); | 2462 | strcpy(card->driver, "ICE1724"); |
2459 | strcpy(card->shortname, "ICEnsemble ICE1724"); | 2463 | strcpy(card->shortname, "ICEnsemble ICE1724"); |
2460 | 2464 | ||
2461 | if ((err = snd_vt1724_create(card, pci, model[dev], &ice)) < 0) { | 2465 | err = snd_vt1724_create(card, pci, model[dev], &ice); |
2466 | if (err < 0) { | ||
2462 | snd_card_free(card); | 2467 | snd_card_free(card); |
2463 | return err; | 2468 | return err; |
2464 | } | 2469 | } |
@@ -2470,7 +2475,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2470 | if (c->driver) /* specific driver? */ | 2475 | if (c->driver) /* specific driver? */ |
2471 | strcpy(card->driver, c->driver); | 2476 | strcpy(card->driver, c->driver); |
2472 | if (c->chip_init) { | 2477 | if (c->chip_init) { |
2473 | if ((err = c->chip_init(ice)) < 0) { | 2478 | err = c->chip_init(ice); |
2479 | if (err < 0) { | ||
2474 | snd_card_free(card); | 2480 | snd_card_free(card); |
2475 | return err; | 2481 | return err; |
2476 | } | 2482 | } |
@@ -2480,15 +2486,15 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2480 | } | 2486 | } |
2481 | } | 2487 | } |
2482 | c = &no_matched; | 2488 | c = &no_matched; |
2483 | __found: | 2489 | __found: |
2484 | /* | 2490 | /* |
2485 | * VT1724 has separate DMAs for the analog and the SPDIF streams while | 2491 | * VT1724 has separate DMAs for the analog and the SPDIF streams while |
2486 | * ICE1712 has only one for both (mixed up). | 2492 | * ICE1712 has only one for both (mixed up). |
2487 | * | 2493 | * |
2488 | * Confusingly the analog PCM is named "professional" here because it | 2494 | * Confusingly the analog PCM is named "professional" here because it |
2489 | * was called so in ice1712 driver, and vt1724 driver is derived from | 2495 | * was called so in ice1712 driver, and vt1724 driver is derived from |
2490 | * ice1712 driver. | 2496 | * ice1712 driver. |
2491 | */ | 2497 | */ |
2492 | ice->pro_rate_default = PRO_RATE_DEFAULT; | 2498 | ice->pro_rate_default = PRO_RATE_DEFAULT; |
2493 | if (!ice->is_spdif_master) | 2499 | if (!ice->is_spdif_master) |
2494 | ice->is_spdif_master = stdclock_is_spdif_master; | 2500 | ice->is_spdif_master = stdclock_is_spdif_master; |
@@ -2503,46 +2509,53 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2503 | if (!ice->hw_rates) | 2509 | if (!ice->hw_rates) |
2504 | set_std_hw_rates(ice); | 2510 | set_std_hw_rates(ice); |
2505 | 2511 | ||
2506 | if ((err = snd_vt1724_pcm_profi(ice, pcm_dev++)) < 0) { | 2512 | err = snd_vt1724_pcm_profi(ice, pcm_dev++); |
2513 | if (err < 0) { | ||
2507 | snd_card_free(card); | 2514 | snd_card_free(card); |
2508 | return err; | 2515 | return err; |
2509 | } | 2516 | } |
2510 | 2517 | ||
2511 | if ((err = snd_vt1724_pcm_spdif(ice, pcm_dev++)) < 0) { | 2518 | err = snd_vt1724_pcm_spdif(ice, pcm_dev++); |
2519 | if (err < 0) { | ||
2512 | snd_card_free(card); | 2520 | snd_card_free(card); |
2513 | return err; | 2521 | return err; |
2514 | } | 2522 | } |
2515 | 2523 | ||
2516 | if ((err = snd_vt1724_pcm_indep(ice, pcm_dev++)) < 0) { | 2524 | err = snd_vt1724_pcm_indep(ice, pcm_dev++); |
2525 | if (err < 0) { | ||
2517 | snd_card_free(card); | 2526 | snd_card_free(card); |
2518 | return err; | 2527 | return err; |
2519 | } | 2528 | } |
2520 | 2529 | ||
2521 | if ((err = snd_vt1724_ac97_mixer(ice)) < 0) { | 2530 | err = snd_vt1724_ac97_mixer(ice); |
2531 | if (err < 0) { | ||
2522 | snd_card_free(card); | 2532 | snd_card_free(card); |
2523 | return err; | 2533 | return err; |
2524 | } | 2534 | } |
2525 | 2535 | ||
2526 | if ((err = snd_vt1724_build_controls(ice)) < 0) { | 2536 | err = snd_vt1724_build_controls(ice); |
2537 | if (err < 0) { | ||
2527 | snd_card_free(card); | 2538 | snd_card_free(card); |
2528 | return err; | 2539 | return err; |
2529 | } | 2540 | } |
2530 | 2541 | ||
2531 | if (ice->pcm && ice->has_spdif) { /* has SPDIF I/O */ | 2542 | if (ice->pcm && ice->has_spdif) { /* has SPDIF I/O */ |
2532 | if ((err = snd_vt1724_spdif_build_controls(ice)) < 0) { | 2543 | err = snd_vt1724_spdif_build_controls(ice); |
2544 | if (err < 0) { | ||
2533 | snd_card_free(card); | 2545 | snd_card_free(card); |
2534 | return err; | 2546 | return err; |
2535 | } | 2547 | } |
2536 | } | 2548 | } |
2537 | 2549 | ||
2538 | if (c->build_controls) { | 2550 | if (c->build_controls) { |
2539 | if ((err = c->build_controls(ice)) < 0) { | 2551 | err = c->build_controls(ice); |
2552 | if (err < 0) { | ||
2540 | snd_card_free(card); | 2553 | snd_card_free(card); |
2541 | return err; | 2554 | return err; |
2542 | } | 2555 | } |
2543 | } | 2556 | } |
2544 | 2557 | ||
2545 | if (! c->no_mpu401) { | 2558 | if (!c->no_mpu401) { |
2546 | if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { | 2559 | if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { |
2547 | struct snd_rawmidi *rmidi; | 2560 | struct snd_rawmidi *rmidi; |
2548 | 2561 | ||
@@ -2574,7 +2587,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2574 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 2587 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
2575 | card->shortname, ice->port, ice->irq); | 2588 | card->shortname, ice->port, ice->irq); |
2576 | 2589 | ||
2577 | if ((err = snd_card_register(card)) < 0) { | 2590 | err = snd_card_register(card); |
2591 | if (err < 0) { | ||
2578 | snd_card_free(card); | 2592 | snd_card_free(card); |
2579 | return err; | 2593 | return err; |
2580 | } | 2594 | } |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index b4e0c16852a6..c51659b9caf6 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -21,7 +21,7 @@ | |||
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 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
@@ -34,9 +34,10 @@ | |||
34 | #include "ice1712.h" | 34 | #include "ice1712.h" |
35 | #include "envy24ht.h" | 35 | #include "envy24ht.h" |
36 | #include "juli.h" | 36 | #include "juli.h" |
37 | |||
37 | struct juli_spec { | 38 | struct juli_spec { |
38 | struct ak4114 *ak4114; | 39 | struct ak4114 *ak4114; |
39 | unsigned int analog: 1; | 40 | unsigned int analog:1; |
40 | }; | 41 | }; |
41 | 42 | ||
42 | /* | 43 | /* |
@@ -160,14 +161,17 @@ static int get_gpio_val(int rate) | |||
160 | return 0; | 161 | return 0; |
161 | } | 162 | } |
162 | 163 | ||
163 | static void juli_ak4114_write(void *private_data, unsigned char reg, unsigned char val) | 164 | static void juli_ak4114_write(void *private_data, unsigned char reg, |
165 | unsigned char val) | ||
164 | { | 166 | { |
165 | snd_vt1724_write_i2c((struct snd_ice1712 *)private_data, AK4114_ADDR, reg, val); | 167 | snd_vt1724_write_i2c((struct snd_ice1712 *)private_data, AK4114_ADDR, |
168 | reg, val); | ||
166 | } | 169 | } |
167 | 170 | ||
168 | static unsigned char juli_ak4114_read(void *private_data, unsigned char reg) | 171 | static unsigned char juli_ak4114_read(void *private_data, unsigned char reg) |
169 | { | 172 | { |
170 | return snd_vt1724_read_i2c((struct snd_ice1712 *)private_data, AK4114_ADDR, reg); | 173 | return snd_vt1724_read_i2c((struct snd_ice1712 *)private_data, |
174 | AK4114_ADDR, reg); | ||
171 | } | 175 | } |
172 | 176 | ||
173 | /* | 177 | /* |
@@ -175,7 +179,7 @@ static unsigned char juli_ak4114_read(void *private_data, unsigned char reg) | |||
175 | * to the external rate | 179 | * to the external rate |
176 | */ | 180 | */ |
177 | static void juli_spdif_in_open(struct snd_ice1712 *ice, | 181 | static void juli_spdif_in_open(struct snd_ice1712 *ice, |
178 | struct snd_pcm_substream *substream) | 182 | struct snd_pcm_substream *substream) |
179 | { | 183 | { |
180 | struct juli_spec *spec = ice->spec; | 184 | struct juli_spec *spec = ice->spec; |
181 | struct snd_pcm_runtime *runtime = substream->runtime; | 185 | struct snd_pcm_runtime *runtime = substream->runtime; |
@@ -208,7 +212,8 @@ static void juli_akm_write(struct snd_akm4xxx *ak, int chip, | |||
208 | { | 212 | { |
209 | struct snd_ice1712 *ice = ak->private_data[0]; | 213 | struct snd_ice1712 *ice = ak->private_data[0]; |
210 | 214 | ||
211 | snd_assert(chip == 0, return); | 215 | if (snd_BUG_ON(chip)) |
216 | return; | ||
212 | snd_vt1724_write_i2c(ice, AK4358_ADDR, addr, data); | 217 | snd_vt1724_write_i2c(ice, AK4358_ADDR, addr, data); |
213 | } | 218 | } |
214 | 219 | ||
@@ -571,10 +576,12 @@ static void juli_ak4114_change(struct ak4114 *ak4114, unsigned char c0, | |||
571 | static int __devinit juli_init(struct snd_ice1712 *ice) | 576 | static int __devinit juli_init(struct snd_ice1712 *ice) |
572 | { | 577 | { |
573 | static const unsigned char ak4114_init_vals[] = { | 578 | static const unsigned char ak4114_init_vals[] = { |
574 | /* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN | AK4114_OCKS0 | AK4114_OCKS1, | 579 | /* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN | |
580 | AK4114_OCKS0 | AK4114_OCKS1, | ||
575 | /* AK4114_REQ_FORMAT */ AK4114_DIF_I24I2S, | 581 | /* AK4114_REQ_FORMAT */ AK4114_DIF_I24I2S, |
576 | /* AK4114_REG_IO0 */ AK4114_TX1E, | 582 | /* AK4114_REG_IO0 */ AK4114_TX1E, |
577 | /* AK4114_REG_IO1 */ AK4114_EFH_1024 | AK4114_DIT | AK4114_IPS(1), | 583 | /* AK4114_REG_IO1 */ AK4114_EFH_1024 | AK4114_DIT | |
584 | AK4114_IPS(1), | ||
578 | /* AK4114_REG_INT0_MASK */ 0, | 585 | /* AK4114_REG_INT0_MASK */ 0, |
579 | /* AK4114_REG_INT1_MASK */ 0 | 586 | /* AK4114_REG_INT1_MASK */ 0 |
580 | }; | 587 | }; |
@@ -604,12 +611,14 @@ static int __devinit juli_init(struct snd_ice1712 *ice) | |||
604 | spec->ak4114->check_flags = 0; | 611 | spec->ak4114->check_flags = 0; |
605 | 612 | ||
606 | #if 0 | 613 | #if 0 |
607 | /* it seems that the analog doughter board detection does not work | 614 | /* |
608 | reliably, so force the analog flag; it should be very rare | 615 | * it seems that the analog doughter board detection does not work reliably, so |
609 | to use Juli@ without the analog doughter board */ | 616 | * force the analog flag; it should be very rare (if ever) to come at Juli@ |
617 | * used without the analog daughter board | ||
618 | */ | ||
610 | spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; | 619 | spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; |
611 | #else | 620 | #else |
612 | spec->analog = 1; | 621 | spec->analog = 1; |
613 | #endif | 622 | #endif |
614 | 623 | ||
615 | if (spec->analog) { | 624 | if (spec->analog) { |
@@ -617,14 +626,16 @@ static int __devinit juli_init(struct snd_ice1712 *ice) | |||
617 | ice->num_total_dacs = 2; | 626 | ice->num_total_dacs = 2; |
618 | ice->num_total_adcs = 2; | 627 | ice->num_total_adcs = 2; |
619 | 628 | ||
620 | ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 629 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
621 | if (! ak) | 630 | ak = ice->akm; |
631 | if (!ak) | ||
622 | return -ENOMEM; | 632 | return -ENOMEM; |
623 | ice->akm_codecs = 1; | 633 | ice->akm_codecs = 1; |
624 | if ((err = snd_ice1712_akm4xxx_init(ak, &akm_juli_dac, NULL, ice)) < 0) | 634 | err = snd_ice1712_akm4xxx_init(ak, &akm_juli_dac, NULL, ice); |
635 | if (err < 0) | ||
625 | return err; | 636 | return err; |
626 | } | 637 | } |
627 | 638 | ||
628 | /* juli is clocked by Xilinx array */ | 639 | /* juli is clocked by Xilinx array */ |
629 | ice->hw_rates = &juli_rates_info; | 640 | ice->hw_rates = &juli_rates_info; |
630 | ice->is_spdif_master = juli_is_spdif_master; | 641 | ice->is_spdif_master = juli_is_spdif_master; |
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index 5a158b73dcaa..de29be8c9657 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c | |||
@@ -22,15 +22,24 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* PHASE 22 overview: | 24 | /* PHASE 22 overview: |
25 | * Audio controller: VIA Envy24HT-S (slightly trimmed down version of Envy24HT) | 25 | * Audio controller: VIA Envy24HT-S (slightly trimmed down Envy24HT, 4in/4out) |
26 | * Analog chip: AK4524 (partially via Philip's 74HCT125) | 26 | * Analog chip: AK4524 (partially via Philip's 74HCT125) |
27 | * Digital receiver: CS8414-CS (not supported in this release) | 27 | * Digital receiver: CS8414-CS (supported in this release) |
28 | * PHASE 22 revision 2.0 and Terrasoniq/Musonik TS22PCI have CS8416 | ||
29 | * (support status unknown, please test and report) | ||
28 | * | 30 | * |
29 | * Envy connects to AK4524 | 31 | * Envy connects to AK4524 |
30 | * - CS directly from GPIO 10 | 32 | * - CS directly from GPIO 10 |
31 | * - CCLK via 74HCT125's gate #4 from GPIO 4 | 33 | * - CCLK via 74HCT125's gate #4 from GPIO 4 |
32 | * - CDTI via 74HCT125's gate #2 from GPIO 5 | 34 | * - CDTI via 74HCT125's gate #2 from GPIO 5 |
33 | * CDTI may be completely blocked by 74HCT125's gate #1 controlled by GPIO 3 | 35 | * CDTI may be completely blocked by 74HCT125's gate #1 |
36 | * controlled by GPIO 3 | ||
37 | */ | ||
38 | |||
39 | /* PHASE 28 overview: | ||
40 | * Audio controller: VIA Envy24HT (full untrimmed version, 4in/8out) | ||
41 | * Analog chip: WM8770 (8 channel 192k DAC, 2 channel 96k ADC) | ||
42 | * Digital receiver: CS8414-CS (supported in this release) | ||
34 | */ | 43 | */ |
35 | 44 | ||
36 | #include <asm/io.h> | 45 | #include <asm/io.h> |
@@ -77,18 +86,18 @@ struct phase28_spec { | |||
77 | * Computed as 20 * Log10(255 / x) | 86 | * Computed as 20 * Log10(255 / x) |
78 | */ | 87 | */ |
79 | static const unsigned char wm_vol[256] = { | 88 | static const unsigned char wm_vol[256] = { |
80 | 127, 48, 42, 39, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23, | 89 | 127, 48, 42, 39, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, |
81 | 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17, | 90 | 24, 23, 23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, |
82 | 17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13, | 91 | 17, 17, 17, 17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, |
83 | 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, | 92 | 14, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, |
84 | 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, | 93 | 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, |
85 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, | 94 | 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, |
86 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | 95 | 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, |
87 | 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, | 96 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
88 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 97 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
89 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 98 | 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
90 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 99 | 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
91 | 0, 0 | 100 | 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
92 | }; | 101 | }; |
93 | 102 | ||
94 | #define WM_VOL_MAX (sizeof(wm_vol) - 1) | 103 | #define WM_VOL_MAX (sizeof(wm_vol) - 1) |
@@ -117,26 +126,31 @@ static int __devinit phase22_init(struct snd_ice1712 *ice) | |||
117 | struct snd_akm4xxx *ak; | 126 | struct snd_akm4xxx *ak; |
118 | int err; | 127 | int err; |
119 | 128 | ||
120 | // Configure DAC/ADC description for generic part of ice1724 | 129 | /* Configure DAC/ADC description for generic part of ice1724 */ |
121 | switch (ice->eeprom.subvendor) { | 130 | switch (ice->eeprom.subvendor) { |
122 | case VT1724_SUBDEVICE_PHASE22: | 131 | case VT1724_SUBDEVICE_PHASE22: |
132 | case VT1724_SUBDEVICE_TS22: | ||
123 | ice->num_total_dacs = 2; | 133 | ice->num_total_dacs = 2; |
124 | ice->num_total_adcs = 2; | 134 | ice->num_total_adcs = 2; |
125 | ice->vt1720 = 1; // Envy24HT-S have 16 bit wide GPIO | 135 | ice->vt1720 = 1; /* Envy24HT-S have 16 bit wide GPIO */ |
126 | break; | 136 | break; |
127 | default: | 137 | default: |
128 | snd_BUG(); | 138 | snd_BUG(); |
129 | return -EINVAL; | 139 | return -EINVAL; |
130 | } | 140 | } |
131 | 141 | ||
132 | // Initialize analog chips | 142 | /* Initialize analog chips */ |
133 | ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 143 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
134 | if (! ak) | 144 | ak = ice->akm; |
145 | if (!ak) | ||
135 | return -ENOMEM; | 146 | return -ENOMEM; |
136 | ice->akm_codecs = 1; | 147 | ice->akm_codecs = 1; |
137 | switch (ice->eeprom.subvendor) { | 148 | switch (ice->eeprom.subvendor) { |
138 | case VT1724_SUBDEVICE_PHASE22: | 149 | case VT1724_SUBDEVICE_PHASE22: |
139 | if ((err = snd_ice1712_akm4xxx_init(ak, &akm_phase22, &akm_phase22_priv, ice)) < 0) | 150 | case VT1724_SUBDEVICE_TS22: |
151 | err = snd_ice1712_akm4xxx_init(ak, &akm_phase22, | ||
152 | &akm_phase22_priv, ice); | ||
153 | if (err < 0) | ||
140 | return err; | 154 | return err; |
141 | break; | 155 | break; |
142 | } | 156 | } |
@@ -150,6 +164,7 @@ static int __devinit phase22_add_controls(struct snd_ice1712 *ice) | |||
150 | 164 | ||
151 | switch (ice->eeprom.subvendor) { | 165 | switch (ice->eeprom.subvendor) { |
152 | case VT1724_SUBDEVICE_PHASE22: | 166 | case VT1724_SUBDEVICE_PHASE22: |
167 | case VT1724_SUBDEVICE_TS22: | ||
153 | err = snd_ice1712_akm4xxx_build_controls(ice); | 168 | err = snd_ice1712_akm4xxx_build_controls(ice); |
154 | if (err < 0) | 169 | if (err < 0) |
155 | return err; | 170 | return err; |
@@ -158,9 +173,10 @@ static int __devinit phase22_add_controls(struct snd_ice1712 *ice) | |||
158 | } | 173 | } |
159 | 174 | ||
160 | static unsigned char phase22_eeprom[] __devinitdata = { | 175 | static unsigned char phase22_eeprom[] __devinitdata = { |
161 | [ICE_EEP2_SYSCONF] = 0x00, /* 1xADC, 1xDACs */ | 176 | [ICE_EEP2_SYSCONF] = 0x28, /* clock 512, mpu 401, |
177 | spdif-in/1xADC, 1xDACs */ | ||
162 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ | 178 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ |
163 | [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit */ | 179 | [ICE_EEP2_I2S] = 0xf0, /* vol, 96k, 24bit */ |
164 | [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */ | 180 | [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */ |
165 | [ICE_EEP2_GPIO_DIR] = 0xff, | 181 | [ICE_EEP2_GPIO_DIR] = 0xff, |
166 | [ICE_EEP2_GPIO_DIR1] = 0xff, | 182 | [ICE_EEP2_GPIO_DIR1] = 0xff, |
@@ -174,7 +190,8 @@ static unsigned char phase22_eeprom[] __devinitdata = { | |||
174 | }; | 190 | }; |
175 | 191 | ||
176 | static unsigned char phase28_eeprom[] __devinitdata = { | 192 | static unsigned char phase28_eeprom[] __devinitdata = { |
177 | [ICE_EEP2_SYSCONF] = 0x0b, /* clock 512, spdif-in/ADC, 4DACs */ | 193 | [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, |
194 | spdif-in/1xADC, 4xDACs */ | ||
178 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ | 195 | [ICE_EEP2_ACLINK] = 0x80, /* I2S */ |
179 | [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ | 196 | [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ |
180 | [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */ | 197 | [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */ |
@@ -192,15 +209,16 @@ static unsigned char phase28_eeprom[] __devinitdata = { | |||
192 | /* | 209 | /* |
193 | * write data in the SPI mode | 210 | * write data in the SPI mode |
194 | */ | 211 | */ |
195 | static void phase28_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits) | 212 | static void phase28_spi_write(struct snd_ice1712 *ice, unsigned int cs, |
213 | unsigned int data, int bits) | ||
196 | { | 214 | { |
197 | unsigned int tmp; | 215 | unsigned int tmp; |
198 | int i; | 216 | int i; |
199 | 217 | ||
200 | tmp = snd_ice1712_gpio_read(ice); | 218 | tmp = snd_ice1712_gpio_read(ice); |
201 | 219 | ||
202 | snd_ice1712_gpio_set_mask(ice, ~(PHASE28_WM_RW|PHASE28_SPI_MOSI|PHASE28_SPI_CLK| | 220 | snd_ice1712_gpio_set_mask(ice, ~(PHASE28_WM_RW|PHASE28_SPI_MOSI| |
203 | PHASE28_WM_CS)); | 221 | PHASE28_SPI_CLK|PHASE28_WM_CS)); |
204 | tmp |= PHASE28_WM_RW; | 222 | tmp |= PHASE28_WM_RW; |
205 | tmp &= ~cs; | 223 | tmp &= ~cs; |
206 | snd_ice1712_gpio_write(ice, tmp); | 224 | snd_ice1712_gpio_write(ice, tmp); |
@@ -259,14 +277,16 @@ static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val) | |||
259 | ice->akm[0].images[reg + 1] = val; | 277 | ice->akm[0].images[reg + 1] = val; |
260 | } | 278 | } |
261 | 279 | ||
262 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) | 280 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, |
281 | unsigned short vol, unsigned short master) | ||
263 | { | 282 | { |
264 | unsigned char nvol; | 283 | unsigned char nvol; |
265 | 284 | ||
266 | if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) | 285 | if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE)) |
267 | nvol = 0; | 286 | nvol = 0; |
268 | else | 287 | else |
269 | nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX]; | 288 | nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * |
289 | (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX]; | ||
270 | 290 | ||
271 | wm_put(ice, index, nvol); | 291 | wm_put(ice, index, nvol); |
272 | wm_put_nocache(ice, index, 0x180 | nvol); | 292 | wm_put_nocache(ice, index, 0x180 | nvol); |
@@ -277,17 +297,20 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho | |||
277 | */ | 297 | */ |
278 | #define wm_pcm_mute_info snd_ctl_boolean_mono_info | 298 | #define wm_pcm_mute_info snd_ctl_boolean_mono_info |
279 | 299 | ||
280 | static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 300 | static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, |
301 | struct snd_ctl_elem_value *ucontrol) | ||
281 | { | 302 | { |
282 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 303 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
283 | 304 | ||
284 | mutex_lock(&ice->gpio_mutex); | 305 | mutex_lock(&ice->gpio_mutex); |
285 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1; | 306 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? |
307 | 0 : 1; | ||
286 | mutex_unlock(&ice->gpio_mutex); | 308 | mutex_unlock(&ice->gpio_mutex); |
287 | return 0; | 309 | return 0; |
288 | } | 310 | } |
289 | 311 | ||
290 | static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 312 | static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, |
313 | struct snd_ctl_elem_value *ucontrol) | ||
291 | { | 314 | { |
292 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 315 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
293 | unsigned short nval, oval; | 316 | unsigned short nval, oval; |
@@ -296,7 +319,8 @@ static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va | |||
296 | snd_ice1712_save_gpio_status(ice); | 319 | snd_ice1712_save_gpio_status(ice); |
297 | oval = wm_get(ice, WM_MUTE); | 320 | oval = wm_get(ice, WM_MUTE); |
298 | nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10); | 321 | nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10); |
299 | if ((change = (nval != oval))) | 322 | change = (nval != oval); |
323 | if (change) | ||
300 | wm_put(ice, WM_MUTE, nval); | 324 | wm_put(ice, WM_MUTE, nval); |
301 | snd_ice1712_restore_gpio_status(ice); | 325 | snd_ice1712_restore_gpio_status(ice); |
302 | 326 | ||
@@ -306,7 +330,8 @@ static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va | |||
306 | /* | 330 | /* |
307 | * Master volume attenuation mixer control | 331 | * Master volume attenuation mixer control |
308 | */ | 332 | */ |
309 | static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 333 | static int wm_master_vol_info(struct snd_kcontrol *kcontrol, |
334 | struct snd_ctl_elem_info *uinfo) | ||
310 | { | 335 | { |
311 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 336 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
312 | uinfo->count = 2; | 337 | uinfo->count = 2; |
@@ -315,17 +340,20 @@ static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
315 | return 0; | 340 | return 0; |
316 | } | 341 | } |
317 | 342 | ||
318 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 343 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, |
344 | struct snd_ctl_elem_value *ucontrol) | ||
319 | { | 345 | { |
320 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 346 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
321 | struct phase28_spec *spec = ice->spec; | 347 | struct phase28_spec *spec = ice->spec; |
322 | int i; | 348 | int i; |
323 | for (i=0; i<2; i++) | 349 | for (i = 0; i < 2; i++) |
324 | ucontrol->value.integer.value[i] = spec->master[i] & ~WM_VOL_MUTE; | 350 | ucontrol->value.integer.value[i] = spec->master[i] & |
351 | ~WM_VOL_MUTE; | ||
325 | return 0; | 352 | return 0; |
326 | } | 353 | } |
327 | 354 | ||
328 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 355 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, |
356 | struct snd_ctl_elem_value *ucontrol) | ||
329 | { | 357 | { |
330 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 358 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
331 | struct phase28_spec *spec = ice->spec; | 359 | struct phase28_spec *spec = ice->spec; |
@@ -355,38 +383,38 @@ static int __devinit phase28_init(struct snd_ice1712 *ice) | |||
355 | { | 383 | { |
356 | static const unsigned short wm_inits_phase28[] = { | 384 | static const unsigned short wm_inits_phase28[] = { |
357 | /* These come first to reduce init pop noise */ | 385 | /* These come first to reduce init pop noise */ |
358 | 0x1b, 0x044, /* ADC Mux (AC'97 source) */ | 386 | 0x1b, 0x044, /* ADC Mux (AC'97 source) */ |
359 | 0x1c, 0x00B, /* Out Mux1 (VOUT1 = DAC+AUX, VOUT2 = DAC) */ | 387 | 0x1c, 0x00B, /* Out Mux1 (VOUT1 = DAC+AUX, VOUT2 = DAC) */ |
360 | 0x1d, 0x009, /* Out Mux2 (VOUT2 = DAC, VOUT3 = DAC) */ | 388 | 0x1d, 0x009, /* Out Mux2 (VOUT2 = DAC, VOUT3 = DAC) */ |
361 | 389 | ||
362 | 0x18, 0x000, /* All power-up */ | 390 | 0x18, 0x000, /* All power-up */ |
363 | 391 | ||
364 | 0x16, 0x122, /* I2S, normal polarity, 24bit */ | 392 | 0x16, 0x122, /* I2S, normal polarity, 24bit */ |
365 | 0x17, 0x022, /* 256fs, slave mode */ | 393 | 0x17, 0x022, /* 256fs, slave mode */ |
366 | 0x00, 0, /* DAC1 analog mute */ | 394 | 0x00, 0, /* DAC1 analog mute */ |
367 | 0x01, 0, /* DAC2 analog mute */ | 395 | 0x01, 0, /* DAC2 analog mute */ |
368 | 0x02, 0, /* DAC3 analog mute */ | 396 | 0x02, 0, /* DAC3 analog mute */ |
369 | 0x03, 0, /* DAC4 analog mute */ | 397 | 0x03, 0, /* DAC4 analog mute */ |
370 | 0x04, 0, /* DAC5 analog mute */ | 398 | 0x04, 0, /* DAC5 analog mute */ |
371 | 0x05, 0, /* DAC6 analog mute */ | 399 | 0x05, 0, /* DAC6 analog mute */ |
372 | 0x06, 0, /* DAC7 analog mute */ | 400 | 0x06, 0, /* DAC7 analog mute */ |
373 | 0x07, 0, /* DAC8 analog mute */ | 401 | 0x07, 0, /* DAC8 analog mute */ |
374 | 0x08, 0x100, /* master analog mute */ | 402 | 0x08, 0x100, /* master analog mute */ |
375 | 0x09, 0xff, /* DAC1 digital full */ | 403 | 0x09, 0xff, /* DAC1 digital full */ |
376 | 0x0a, 0xff, /* DAC2 digital full */ | 404 | 0x0a, 0xff, /* DAC2 digital full */ |
377 | 0x0b, 0xff, /* DAC3 digital full */ | 405 | 0x0b, 0xff, /* DAC3 digital full */ |
378 | 0x0c, 0xff, /* DAC4 digital full */ | 406 | 0x0c, 0xff, /* DAC4 digital full */ |
379 | 0x0d, 0xff, /* DAC5 digital full */ | 407 | 0x0d, 0xff, /* DAC5 digital full */ |
380 | 0x0e, 0xff, /* DAC6 digital full */ | 408 | 0x0e, 0xff, /* DAC6 digital full */ |
381 | 0x0f, 0xff, /* DAC7 digital full */ | 409 | 0x0f, 0xff, /* DAC7 digital full */ |
382 | 0x10, 0xff, /* DAC8 digital full */ | 410 | 0x10, 0xff, /* DAC8 digital full */ |
383 | 0x11, 0x1ff, /* master digital full */ | 411 | 0x11, 0x1ff, /* master digital full */ |
384 | 0x12, 0x000, /* phase normal */ | 412 | 0x12, 0x000, /* phase normal */ |
385 | 0x13, 0x090, /* unmute DAC L/R */ | 413 | 0x13, 0x090, /* unmute DAC L/R */ |
386 | 0x14, 0x000, /* all unmute */ | 414 | 0x14, 0x000, /* all unmute */ |
387 | 0x15, 0x000, /* no deemphasis, no ZFLG */ | 415 | 0x15, 0x000, /* no deemphasis, no ZFLG */ |
388 | 0x19, 0x000, /* -12dB ADC/L */ | 416 | 0x19, 0x000, /* -12dB ADC/L */ |
389 | 0x1a, 0x000, /* -12dB ADC/R */ | 417 | 0x1a, 0x000, /* -12dB ADC/R */ |
390 | (unsigned short)-1 | 418 | (unsigned short)-1 |
391 | }; | 419 | }; |
392 | 420 | ||
@@ -404,17 +432,19 @@ static int __devinit phase28_init(struct snd_ice1712 *ice) | |||
404 | return -ENOMEM; | 432 | return -ENOMEM; |
405 | ice->spec = spec; | 433 | ice->spec = spec; |
406 | 434 | ||
407 | // Initialize analog chips | 435 | /* Initialize analog chips */ |
408 | ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 436 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
437 | ak = ice->akm; | ||
409 | if (!ak) | 438 | if (!ak) |
410 | return -ENOMEM; | 439 | return -ENOMEM; |
411 | ice->akm_codecs = 1; | 440 | ice->akm_codecs = 1; |
412 | 441 | ||
413 | snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */ | 442 | snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for time being */ |
414 | 443 | ||
415 | /* reset the wm codec as the SPI mode */ | 444 | /* reset the wm codec as the SPI mode */ |
416 | snd_ice1712_save_gpio_status(ice); | 445 | snd_ice1712_save_gpio_status(ice); |
417 | snd_ice1712_gpio_set_mask(ice, ~(PHASE28_WM_RESET|PHASE28_WM_CS|PHASE28_HP_SEL)); | 446 | snd_ice1712_gpio_set_mask(ice, ~(PHASE28_WM_RESET|PHASE28_WM_CS| |
447 | PHASE28_HP_SEL)); | ||
418 | 448 | ||
419 | tmp = snd_ice1712_gpio_read(ice); | 449 | tmp = snd_ice1712_gpio_read(ice); |
420 | tmp &= ~PHASE28_WM_RESET; | 450 | tmp &= ~PHASE28_WM_RESET; |
@@ -446,7 +476,8 @@ static int __devinit phase28_init(struct snd_ice1712 *ice) | |||
446 | /* | 476 | /* |
447 | * DAC volume attenuation mixer control | 477 | * DAC volume attenuation mixer control |
448 | */ | 478 | */ |
449 | static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 479 | static int wm_vol_info(struct snd_kcontrol *kcontrol, |
480 | struct snd_ctl_elem_info *uinfo) | ||
450 | { | 481 | { |
451 | int voices = kcontrol->private_value >> 8; | 482 | int voices = kcontrol->private_value >> 8; |
452 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 483 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
@@ -456,7 +487,8 @@ static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info * | |||
456 | return 0; | 487 | return 0; |
457 | } | 488 | } |
458 | 489 | ||
459 | static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 490 | static int wm_vol_get(struct snd_kcontrol *kcontrol, |
491 | struct snd_ctl_elem_value *ucontrol) | ||
460 | { | 492 | { |
461 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 493 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
462 | struct phase28_spec *spec = ice->spec; | 494 | struct phase28_spec *spec = ice->spec; |
@@ -470,7 +502,8 @@ static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * | |||
470 | return 0; | 502 | return 0; |
471 | } | 503 | } |
472 | 504 | ||
473 | static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 505 | static int wm_vol_put(struct snd_kcontrol *kcontrol, |
506 | struct snd_ctl_elem_value *ucontrol) | ||
474 | { | 507 | { |
475 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 508 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
476 | struct phase28_spec *spec = ice->spec; | 509 | struct phase28_spec *spec = ice->spec; |
@@ -501,7 +534,8 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * | |||
501 | /* | 534 | /* |
502 | * WM8770 mute control | 535 | * WM8770 mute control |
503 | */ | 536 | */ |
504 | static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { | 537 | static int wm_mute_info(struct snd_kcontrol *kcontrol, |
538 | struct snd_ctl_elem_info *uinfo) { | ||
505 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 539 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
506 | uinfo->count = kcontrol->private_value >> 8; | 540 | uinfo->count = kcontrol->private_value >> 8; |
507 | uinfo->value.integer.min = 0; | 541 | uinfo->value.integer.min = 0; |
@@ -509,7 +543,8 @@ static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info | |||
509 | return 0; | 543 | return 0; |
510 | } | 544 | } |
511 | 545 | ||
512 | static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 546 | static int wm_mute_get(struct snd_kcontrol *kcontrol, |
547 | struct snd_ctl_elem_value *ucontrol) | ||
513 | { | 548 | { |
514 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 549 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
515 | struct phase28_spec *spec = ice->spec; | 550 | struct phase28_spec *spec = ice->spec; |
@@ -524,7 +559,8 @@ static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
524 | return 0; | 559 | return 0; |
525 | } | 560 | } |
526 | 561 | ||
527 | static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 562 | static int wm_mute_put(struct snd_kcontrol *kcontrol, |
563 | struct snd_ctl_elem_value *ucontrol) | ||
528 | { | 564 | { |
529 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 565 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
530 | struct phase28_spec *spec = ice->spec; | 566 | struct phase28_spec *spec = ice->spec; |
@@ -539,9 +575,10 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
539 | if (ucontrol->value.integer.value[i] != val) { | 575 | if (ucontrol->value.integer.value[i] != val) { |
540 | spec->vol[ofs + i] &= ~WM_VOL_MUTE; | 576 | spec->vol[ofs + i] &= ~WM_VOL_MUTE; |
541 | spec->vol[ofs + i] |= | 577 | spec->vol[ofs + i] |= |
542 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; | 578 | ucontrol->value.integer.value[i] ? 0 : |
579 | WM_VOL_MUTE; | ||
543 | wm_set_vol(ice, ofs + i, spec->vol[ofs + i], | 580 | wm_set_vol(ice, ofs + i, spec->vol[ofs + i], |
544 | spec->master[i]); | 581 | spec->master[i]); |
545 | change = 1; | 582 | change = 1; |
546 | } | 583 | } |
547 | } | 584 | } |
@@ -555,7 +592,8 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
555 | */ | 592 | */ |
556 | #define wm_master_mute_info snd_ctl_boolean_stereo_info | 593 | #define wm_master_mute_info snd_ctl_boolean_stereo_info |
557 | 594 | ||
558 | static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 595 | static int wm_master_mute_get(struct snd_kcontrol *kcontrol, |
596 | struct snd_ctl_elem_value *ucontrol) | ||
559 | { | 597 | { |
560 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 598 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
561 | struct phase28_spec *spec = ice->spec; | 599 | struct phase28_spec *spec = ice->spec; |
@@ -567,7 +605,8 @@ static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
567 | return 0; | 605 | return 0; |
568 | } | 606 | } |
569 | 607 | ||
570 | static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 608 | static int wm_master_mute_put(struct snd_kcontrol *kcontrol, |
609 | struct snd_ctl_elem_value *ucontrol) | ||
571 | { | 610 | { |
572 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 611 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
573 | struct phase28_spec *spec = ice->spec; | 612 | struct phase28_spec *spec = ice->spec; |
@@ -580,11 +619,12 @@ static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
580 | int dac; | 619 | int dac; |
581 | spec->master[i] &= ~WM_VOL_MUTE; | 620 | spec->master[i] &= ~WM_VOL_MUTE; |
582 | spec->master[i] |= | 621 | spec->master[i] |= |
583 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; | 622 | ucontrol->value.integer.value[i] ? 0 : |
623 | WM_VOL_MUTE; | ||
584 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) | 624 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) |
585 | wm_set_vol(ice, WM_DAC_ATTEN + dac + i, | 625 | wm_set_vol(ice, WM_DAC_ATTEN + dac + i, |
586 | spec->vol[dac + i], | 626 | spec->vol[dac + i], |
587 | spec->master[i]); | 627 | spec->master[i]); |
588 | change = 1; | 628 | change = 1; |
589 | } | 629 | } |
590 | } | 630 | } |
@@ -597,7 +637,8 @@ static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
597 | #define PCM_0dB 0xff | 637 | #define PCM_0dB 0xff |
598 | #define PCM_RES 128 /* -64dB */ | 638 | #define PCM_RES 128 /* -64dB */ |
599 | #define PCM_MIN (PCM_0dB - PCM_RES) | 639 | #define PCM_MIN (PCM_0dB - PCM_RES) |
600 | static int wm_pcm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 640 | static int wm_pcm_vol_info(struct snd_kcontrol *kcontrol, |
641 | struct snd_ctl_elem_info *uinfo) | ||
601 | { | 642 | { |
602 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 643 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
603 | uinfo->count = 1; | 644 | uinfo->count = 1; |
@@ -606,7 +647,8 @@ static int wm_pcm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
606 | return 0; | 647 | return 0; |
607 | } | 648 | } |
608 | 649 | ||
609 | static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 650 | static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, |
651 | struct snd_ctl_elem_value *ucontrol) | ||
610 | { | 652 | { |
611 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 653 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
612 | unsigned short val; | 654 | unsigned short val; |
@@ -619,7 +661,8 @@ static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
619 | return 0; | 661 | return 0; |
620 | } | 662 | } |
621 | 663 | ||
622 | static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 664 | static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, |
665 | struct snd_ctl_elem_value *ucontrol) | ||
623 | { | 666 | { |
624 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 667 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
625 | unsigned short ovol, nvol; | 668 | unsigned short ovol, nvol; |
@@ -633,7 +676,8 @@ static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
633 | ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff; | 676 | ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff; |
634 | if (ovol != nvol) { | 677 | if (ovol != nvol) { |
635 | wm_put(ice, WM_DAC_DIG_MASTER_ATTEN, nvol); /* prelatch */ | 678 | wm_put(ice, WM_DAC_DIG_MASTER_ATTEN, nvol); /* prelatch */ |
636 | wm_put_nocache(ice, WM_DAC_DIG_MASTER_ATTEN, nvol | 0x100); /* update */ | 679 | /* update */ |
680 | wm_put_nocache(ice, WM_DAC_DIG_MASTER_ATTEN, nvol | 0x100); | ||
637 | change = 1; | 681 | change = 1; |
638 | } | 682 | } |
639 | snd_ice1712_restore_gpio_status(ice); | 683 | snd_ice1712_restore_gpio_status(ice); |
@@ -645,18 +689,22 @@ static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
645 | */ | 689 | */ |
646 | #define phase28_deemp_info snd_ctl_boolean_mono_info | 690 | #define phase28_deemp_info snd_ctl_boolean_mono_info |
647 | 691 | ||
648 | static int phase28_deemp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 692 | static int phase28_deemp_get(struct snd_kcontrol *kcontrol, |
693 | struct snd_ctl_elem_value *ucontrol) | ||
649 | { | 694 | { |
650 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 695 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
651 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf; | 696 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == |
697 | 0xf; | ||
652 | return 0; | 698 | return 0; |
653 | } | 699 | } |
654 | 700 | ||
655 | static int phase28_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 701 | static int phase28_deemp_put(struct snd_kcontrol *kcontrol, |
702 | struct snd_ctl_elem_value *ucontrol) | ||
656 | { | 703 | { |
657 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 704 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
658 | int temp, temp2; | 705 | int temp, temp2; |
659 | temp2 = temp = wm_get(ice, WM_DAC_CTRL2); | 706 | temp = wm_get(ice, WM_DAC_CTRL2); |
707 | temp2 = temp; | ||
660 | if (ucontrol->value.integer.value[0]) | 708 | if (ucontrol->value.integer.value[0]) |
661 | temp |= 0xf; | 709 | temp |= 0xf; |
662 | else | 710 | else |
@@ -671,7 +719,8 @@ static int phase28_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
671 | /* | 719 | /* |
672 | * ADC Oversampling | 720 | * ADC Oversampling |
673 | */ | 721 | */ |
674 | static int phase28_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo) | 722 | static int phase28_oversampling_info(struct snd_kcontrol *k, |
723 | struct snd_ctl_elem_info *uinfo) | ||
675 | { | 724 | { |
676 | static char *texts[2] = { "128x", "64x" }; | 725 | static char *texts[2] = { "128x", "64x" }; |
677 | 726 | ||
@@ -680,25 +729,31 @@ static int phase28_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem | |||
680 | uinfo->value.enumerated.items = 2; | 729 | uinfo->value.enumerated.items = 2; |
681 | 730 | ||
682 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 731 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
683 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 732 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - |
684 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 733 | 1; |
734 | strcpy(uinfo->value.enumerated.name, | ||
735 | texts[uinfo->value.enumerated.item]); | ||
685 | 736 | ||
686 | return 0; | 737 | return 0; |
687 | } | 738 | } |
688 | 739 | ||
689 | static int phase28_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 740 | static int phase28_oversampling_get(struct snd_kcontrol *kcontrol, |
741 | struct snd_ctl_elem_value *ucontrol) | ||
690 | { | 742 | { |
691 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 743 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
692 | ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8; | 744 | ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == |
745 | 0x8; | ||
693 | return 0; | 746 | return 0; |
694 | } | 747 | } |
695 | 748 | ||
696 | static int phase28_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 749 | static int phase28_oversampling_put(struct snd_kcontrol *kcontrol, |
750 | struct snd_ctl_elem_value *ucontrol) | ||
697 | { | 751 | { |
698 | int temp, temp2; | 752 | int temp, temp2; |
699 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 753 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
700 | 754 | ||
701 | temp2 = temp = wm_get(ice, WM_MASTER); | 755 | temp = wm_get(ice, WM_MASTER); |
756 | temp2 = temp; | ||
702 | 757 | ||
703 | if (ucontrol->value.enumerated.item[0]) | 758 | if (ucontrol->value.enumerated.item[0]) |
704 | temp |= 0x8; | 759 | temp |= 0x8; |
@@ -871,13 +926,16 @@ static int __devinit phase28_add_controls(struct snd_ice1712 *ice) | |||
871 | 926 | ||
872 | counts = ARRAY_SIZE(phase28_dac_controls); | 927 | counts = ARRAY_SIZE(phase28_dac_controls); |
873 | for (i = 0; i < counts; i++) { | 928 | for (i = 0; i < counts; i++) { |
874 | err = snd_ctl_add(ice->card, snd_ctl_new1(&phase28_dac_controls[i], ice)); | 929 | err = snd_ctl_add(ice->card, |
930 | snd_ctl_new1(&phase28_dac_controls[i], | ||
931 | ice)); | ||
875 | if (err < 0) | 932 | if (err < 0) |
876 | return err; | 933 | return err; |
877 | } | 934 | } |
878 | 935 | ||
879 | for (i = 0; i < ARRAY_SIZE(wm_controls); i++) { | 936 | for (i = 0; i < ARRAY_SIZE(wm_controls); i++) { |
880 | err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice)); | 937 | err = snd_ctl_add(ice->card, |
938 | snd_ctl_new1(&wm_controls[i], ice)); | ||
881 | if (err < 0) | 939 | if (err < 0) |
882 | return err; | 940 | return err; |
883 | } | 941 | } |
@@ -904,5 +962,14 @@ struct snd_ice1712_card_info snd_vt1724_phase_cards[] __devinitdata = { | |||
904 | .eeprom_size = sizeof(phase28_eeprom), | 962 | .eeprom_size = sizeof(phase28_eeprom), |
905 | .eeprom_data = phase28_eeprom, | 963 | .eeprom_data = phase28_eeprom, |
906 | }, | 964 | }, |
965 | { | ||
966 | .subvendor = VT1724_SUBDEVICE_TS22, | ||
967 | .name = "Terrasoniq TS22 PCI", | ||
968 | .model = "TS22", | ||
969 | .chip_init = phase22_init, | ||
970 | .build_controls = phase22_add_controls, | ||
971 | .eeprom_size = sizeof(phase22_eeprom), | ||
972 | .eeprom_data = phase22_eeprom, | ||
973 | }, | ||
907 | { } /* terminator */ | 974 | { } /* terminator */ |
908 | }; | 975 | }; |
diff --git a/sound/pci/ice1712/phase.h b/sound/pci/ice1712/phase.h index 13e841b55488..7fc22d9d442f 100644 --- a/sound/pci/ice1712/phase.h +++ b/sound/pci/ice1712/phase.h | |||
@@ -22,13 +22,15 @@ | |||
22 | * along with this program; if not, write to the Free Software | 22 | * along with this program; if not, write to the Free Software |
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define PHASE_DEVICE_DESC "{Terratec,Phase 22},"\ | 27 | #define PHASE_DEVICE_DESC "{Terratec,Phase 22},"\ |
28 | "{Terratec,Phase 28}," | 28 | "{Terratec,Phase 28},"\ |
29 | "{Terrasoniq,TS22}," | ||
29 | 30 | ||
30 | #define VT1724_SUBDEVICE_PHASE22 0x3b155011 | 31 | #define VT1724_SUBDEVICE_PHASE22 0x3b155011 |
31 | #define VT1724_SUBDEVICE_PHASE28 0x3b154911 | 32 | #define VT1724_SUBDEVICE_PHASE28 0x3b154911 |
33 | #define VT1724_SUBDEVICE_TS22 0x3b157b11 | ||
32 | 34 | ||
33 | /* entry point */ | 35 | /* entry point */ |
34 | extern struct snd_ice1712_card_info snd_vt1724_phase_cards[]; | 36 | extern struct snd_ice1712_card_info snd_vt1724_phase_cards[]; |
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index 203cdc1bf8da..6bc3f91b7281 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c | |||
@@ -43,7 +43,8 @@ | |||
43 | /* WM8776 registers */ | 43 | /* WM8776 registers */ |
44 | #define WM_HP_ATTEN_L 0x00 /* headphone left attenuation */ | 44 | #define WM_HP_ATTEN_L 0x00 /* headphone left attenuation */ |
45 | #define WM_HP_ATTEN_R 0x01 /* headphone left attenuation */ | 45 | #define WM_HP_ATTEN_R 0x01 /* headphone left attenuation */ |
46 | #define WM_HP_MASTER 0x02 /* headphone master (both channels), override LLR */ | 46 | #define WM_HP_MASTER 0x02 /* headphone master (both channels) */ |
47 | /* override LLR */ | ||
47 | #define WM_DAC_ATTEN_L 0x03 /* digital left attenuation */ | 48 | #define WM_DAC_ATTEN_L 0x03 /* digital left attenuation */ |
48 | #define WM_DAC_ATTEN_R 0x04 | 49 | #define WM_DAC_ATTEN_R 0x04 |
49 | #define WM_DAC_MASTER 0x05 | 50 | #define WM_DAC_MASTER 0x05 |
@@ -740,7 +741,7 @@ static int __devinit pontis_init(struct snd_ice1712 *ice) | |||
740 | WM_DAC_ATTEN_L, 0x0100, /* DAC 0dB */ | 741 | WM_DAC_ATTEN_L, 0x0100, /* DAC 0dB */ |
741 | WM_DAC_ATTEN_R, 0x0000, /* DAC 0dB */ | 742 | WM_DAC_ATTEN_R, 0x0000, /* DAC 0dB */ |
742 | WM_DAC_ATTEN_R, 0x0100, /* DAC 0dB */ | 743 | WM_DAC_ATTEN_R, 0x0100, /* DAC 0dB */ |
743 | // WM_DAC_MASTER, 0x0100, /* DAC master muted */ | 744 | /* WM_DAC_MASTER, 0x0100, */ /* DAC master muted */ |
744 | WM_PHASE_SWAP, 0x0000, /* phase normal */ | 745 | WM_PHASE_SWAP, 0x0000, /* phase normal */ |
745 | WM_DAC_CTRL2, 0x0000, /* no deemphasis, no ZFLG */ | 746 | WM_DAC_CTRL2, 0x0000, /* no deemphasis, no ZFLG */ |
746 | WM_ADC_ATTEN_L, 0x0000, /* ADC muted */ | 747 | WM_ADC_ATTEN_L, 0x0000, /* ADC muted */ |
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 4d2631434dc8..b508bb360b97 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ALSA driver for ICEnsemble ICE1712 (Envy24) | 2 | * ALSA driver for ICEnsemble ICE1712 (Envy24) |
3 | * | 3 | * |
4 | * Lowlevel functions for M-Audio Revolution 7.1 | 4 | * Lowlevel functions for M-Audio Audiophile 192, Revolution 7.1 and 5.1 |
5 | * | 5 | * |
6 | * Copyright (c) 2003 Takashi Iwai <tiwai@suse.de> | 6 | * Copyright (c) 2003 Takashi Iwai <tiwai@suse.de> |
7 | * | 7 | * |
@@ -48,7 +48,7 @@ static void revo_i2s_mclk_changed(struct snd_ice1712 *ice) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * change the rate of envy24HT, AK4355 and AK4381 | 51 | * change the rate of Envy24HT, AK4355 and AK4381 |
52 | */ | 52 | */ |
53 | static void revo_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | 53 | static void revo_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) |
54 | { | 54 | { |
@@ -83,8 +83,8 @@ static void revo_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | |||
83 | tmp = snd_akm4xxx_get(ak, 0, reg); | 83 | tmp = snd_akm4xxx_get(ak, 0, reg); |
84 | tmp &= ~(0x03 << shift); | 84 | tmp &= ~(0x03 << shift); |
85 | tmp |= dfs << shift; | 85 | tmp |= dfs << shift; |
86 | // snd_akm4xxx_write(ak, 0, reg, tmp); | 86 | /* snd_akm4xxx_write(ak, 0, reg, tmp); */ |
87 | snd_akm4xxx_set(ak, 0, reg, tmp); /* the value is written in reset(0) */ | 87 | snd_akm4xxx_set(ak, 0, reg, tmp); /* value is written in reset(0) */ |
88 | snd_akm4xxx_reset(ak, 0); | 88 | snd_akm4xxx_reset(ak, 0); |
89 | } | 89 | } |
90 | 90 | ||
@@ -216,6 +216,7 @@ static const struct snd_akm4xxx_dac_channel revo51_dac[] = { | |||
216 | AK_DAC("PCM Center Playback Volume", 1), | 216 | AK_DAC("PCM Center Playback Volume", 1), |
217 | AK_DAC("PCM LFE Playback Volume", 1), | 217 | AK_DAC("PCM LFE Playback Volume", 1), |
218 | AK_DAC("PCM Rear Playback Volume", 2), | 218 | AK_DAC("PCM Rear Playback Volume", 2), |
219 | AK_DAC("PCM Headphone Volume", 2), | ||
219 | }; | 220 | }; |
220 | 221 | ||
221 | static const char *revo51_adc_input_names[] = { | 222 | static const char *revo51_adc_input_names[] = { |
@@ -279,7 +280,7 @@ static struct snd_ak4xxx_private akm_revo_surround_priv __devinitdata = { | |||
279 | 280 | ||
280 | static struct snd_akm4xxx akm_revo51 __devinitdata = { | 281 | static struct snd_akm4xxx akm_revo51 __devinitdata = { |
281 | .type = SND_AK4358, | 282 | .type = SND_AK4358, |
282 | .num_dacs = 6, | 283 | .num_dacs = 8, |
283 | .ops = { | 284 | .ops = { |
284 | .set_rate_val = revo_set_rate_val | 285 | .set_rate_val = revo_set_rate_val |
285 | }, | 286 | }, |
@@ -508,7 +509,7 @@ static int __devinit revo_init(struct snd_ice1712 *ice) | |||
508 | ice->gpio.i2s_mclk_changed = revo_i2s_mclk_changed; | 509 | ice->gpio.i2s_mclk_changed = revo_i2s_mclk_changed; |
509 | break; | 510 | break; |
510 | case VT1724_SUBDEVICE_REVOLUTION51: | 511 | case VT1724_SUBDEVICE_REVOLUTION51: |
511 | ice->num_total_dacs = 6; | 512 | ice->num_total_dacs = 8; |
512 | ice->num_total_adcs = 2; | 513 | ice->num_total_adcs = 2; |
513 | break; | 514 | break; |
514 | case VT1724_SUBDEVICE_AUDIOPHILE192: | 515 | case VT1724_SUBDEVICE_AUDIOPHILE192: |
@@ -524,16 +525,20 @@ static int __devinit revo_init(struct snd_ice1712 *ice) | |||
524 | ak = ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL); | 525 | ak = ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL); |
525 | if (! ak) | 526 | if (! ak) |
526 | return -ENOMEM; | 527 | return -ENOMEM; |
527 | ice->akm_codecs = 2; | ||
528 | switch (ice->eeprom.subvendor) { | 528 | switch (ice->eeprom.subvendor) { |
529 | case VT1724_SUBDEVICE_REVOLUTION71: | 529 | case VT1724_SUBDEVICE_REVOLUTION71: |
530 | ice->akm_codecs = 2; | 530 | ice->akm_codecs = 2; |
531 | if ((err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice)) < 0) | 531 | err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, |
532 | &akm_revo_front_priv, ice); | ||
533 | if (err < 0) | ||
532 | return err; | 534 | return err; |
533 | if ((err = snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice)) < 0) | 535 | err = snd_ice1712_akm4xxx_init(ak+1, &akm_revo_surround, |
536 | &akm_revo_surround_priv, ice); | ||
537 | if (err < 0) | ||
534 | return err; | 538 | return err; |
535 | /* unmute all codecs */ | 539 | /* unmute all codecs */ |
536 | snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, VT1724_REVO_MUTE); | 540 | snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, |
541 | VT1724_REVO_MUTE); | ||
537 | break; | 542 | break; |
538 | case VT1724_SUBDEVICE_REVOLUTION51: | 543 | case VT1724_SUBDEVICE_REVOLUTION51: |
539 | ice->akm_codecs = 2; | 544 | ice->akm_codecs = 2; |
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 | */ |
44 | static inline void stac9460_put(struct snd_ice1712 *ice, int reg, | 44 | static 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 | ||
75 | static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol, | 75 | static 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 | ||
97 | static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, | 97 | static 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 | */ |
138 | static int stac9460_dac_vol_info(struct snd_kcontrol *kcontrol, | 138 | static 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 | ||
148 | static int stac9460_dac_vol_get(struct snd_kcontrol *kcontrol, | 148 | static 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 | ||
170 | static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, | 170 | static 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 | ||
215 | static int stac9460_adc_mute_get(struct snd_kcontrol *kcontrol, | 215 | static 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 | ||
237 | static int stac9460_adc_mute_put(struct snd_kcontrol *kcontrol, | 237 | static 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 | */ |
273 | static int stac9460_adc_vol_info(struct snd_kcontrol *kcontrol, | 273 | static 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 | ||
283 | static int stac9460_adc_vol_get(struct snd_kcontrol *kcontrol, | 283 | static 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 | ||
307 | static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, | 307 | static 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 | ||
346 | static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol, | 346 | static 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 | ||
362 | static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol, | 362 | static 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; |
diff --git a/sound/pci/ice1712/wtm.h b/sound/pci/ice1712/wtm.h index 03a394e442f1..423c1a204c0b 100644 --- a/sound/pci/ice1712/wtm.h +++ b/sound/pci/ice1712/wtm.h | |||
@@ -10,8 +10,8 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define AK4114_ADDR 0x20 /*S/PDIF receiver*/ | 12 | #define AK4114_ADDR 0x20 /*S/PDIF receiver*/ |
13 | #define STAC9460_I2C_ADDR 0x54 /* ADC*2 | DAC*6 */ | 13 | #define STAC9460_I2C_ADDR 0x54 /* ADC*2 | DAC*6 */ |
14 | #define STAC9460_2_I2C_ADDR 0x56 /* ADC|DAC *2 */ | 14 | #define STAC9460_2_I2C_ADDR 0x56 /* ADC|DAC *2 */ |
15 | 15 | ||
16 | 16 | ||
17 | extern struct snd_ice1712_card_info snd_vt1724_wtm_cards[]; | 17 | extern struct snd_ice1712_card_info snd_vt1724_wtm_cards[]; |