aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/ice1724.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:00:18 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:13 -0500
commitab0c7d72c32d703d1a2833ce2a1920cd3b46b131 (patch)
tree6d5ed4991fd9b463fa929899af0ddf0cde158def /sound/pci/ice1712/ice1724.c
parent6ca308d4edd51c4f34ffff94ae0bbf193087d89f (diff)
[ALSA] Remove xxx_t typedefs: PCI ICE1724
Modules: ICE1724 driver,ICE1712 driver Remove xxx_t typedefs from the PCI ICE1724 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ice1712/ice1724.c')
-rw-r--r--sound/pci/ice1712/ice1724.c532
1 files changed, 308 insertions, 224 deletions
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 0b5389ee26d5..71f08c036019 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -102,12 +102,12 @@ static unsigned int PRO_RATE_DEFAULT = 44100;
102 */ 102 */
103 103
104/* check whether the clock mode is spdif-in */ 104/* check whether the clock mode is spdif-in */
105static inline int is_spdif_master(ice1712_t *ice) 105static inline int is_spdif_master(struct snd_ice1712 *ice)
106{ 106{
107 return (inb(ICEMT1724(ice, RATE)) & VT1724_SPDIF_MASTER) ? 1 : 0; 107 return (inb(ICEMT1724(ice, RATE)) & VT1724_SPDIF_MASTER) ? 1 : 0;
108} 108}
109 109
110static inline int is_pro_rate_locked(ice1712_t *ice) 110static inline int is_pro_rate_locked(struct snd_ice1712 *ice)
111{ 111{
112 return is_spdif_master(ice) || PRO_RATE_LOCKED; 112 return is_spdif_master(ice) || PRO_RATE_LOCKED;
113} 113}
@@ -116,7 +116,7 @@ static inline int is_pro_rate_locked(ice1712_t *ice)
116 * ac97 section 116 * ac97 section
117 */ 117 */
118 118
119static unsigned char snd_vt1724_ac97_ready(ice1712_t *ice) 119static unsigned char snd_vt1724_ac97_ready(struct snd_ice1712 *ice)
120{ 120{
121 unsigned char old_cmd; 121 unsigned char old_cmd;
122 int tm; 122 int tm;
@@ -132,7 +132,7 @@ static unsigned char snd_vt1724_ac97_ready(ice1712_t *ice)
132 return old_cmd; 132 return old_cmd;
133} 133}
134 134
135static int snd_vt1724_ac97_wait_bit(ice1712_t *ice, unsigned char bit) 135static int snd_vt1724_ac97_wait_bit(struct snd_ice1712 *ice, unsigned char bit)
136{ 136{
137 int tm; 137 int tm;
138 for (tm = 0; tm < 0x10000; tm++) 138 for (tm = 0; tm < 0x10000; tm++)
@@ -142,11 +142,11 @@ static int snd_vt1724_ac97_wait_bit(ice1712_t *ice, unsigned char bit)
142 return -EIO; 142 return -EIO;
143} 143}
144 144
145static void snd_vt1724_ac97_write(ac97_t *ac97, 145static void snd_vt1724_ac97_write(struct snd_ac97 *ac97,
146 unsigned short reg, 146 unsigned short reg,
147 unsigned short val) 147 unsigned short val)
148{ 148{
149 ice1712_t *ice = (ice1712_t *)ac97->private_data; 149 struct snd_ice1712 *ice = ac97->private_data;
150 unsigned char old_cmd; 150 unsigned char old_cmd;
151 151
152 old_cmd = snd_vt1724_ac97_ready(ice); 152 old_cmd = snd_vt1724_ac97_ready(ice);
@@ -158,9 +158,9 @@ static void snd_vt1724_ac97_write(ac97_t *ac97,
158 snd_vt1724_ac97_wait_bit(ice, VT1724_AC97_WRITE); 158 snd_vt1724_ac97_wait_bit(ice, VT1724_AC97_WRITE);
159} 159}
160 160
161static unsigned short snd_vt1724_ac97_read(ac97_t *ac97, unsigned short reg) 161static unsigned short snd_vt1724_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
162{ 162{
163 ice1712_t *ice = (ice1712_t *)ac97->private_data; 163 struct snd_ice1712 *ice = ac97->private_data;
164 unsigned char old_cmd; 164 unsigned char old_cmd;
165 165
166 old_cmd = snd_vt1724_ac97_ready(ice); 166 old_cmd = snd_vt1724_ac97_ready(ice);
@@ -179,14 +179,14 @@ static unsigned short snd_vt1724_ac97_read(ac97_t *ac97, unsigned short reg)
179 */ 179 */
180 180
181/* set gpio direction 0 = read, 1 = write */ 181/* set gpio direction 0 = read, 1 = write */
182static void snd_vt1724_set_gpio_dir(ice1712_t *ice, unsigned int data) 182static void snd_vt1724_set_gpio_dir(struct snd_ice1712 *ice, unsigned int data)
183{ 183{
184 outl(data, ICEREG1724(ice, GPIO_DIRECTION)); 184 outl(data, ICEREG1724(ice, GPIO_DIRECTION));
185 inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */ 185 inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */
186} 186}
187 187
188/* set the gpio mask (0 = writable) */ 188/* set the gpio mask (0 = writable) */
189static void snd_vt1724_set_gpio_mask(ice1712_t *ice, unsigned int data) 189static void snd_vt1724_set_gpio_mask(struct snd_ice1712 *ice, unsigned int data)
190{ 190{
191 outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); 191 outw(data, ICEREG1724(ice, GPIO_WRITE_MASK));
192 if (! ice->vt1720) /* VT1720 supports only 16 GPIO bits */ 192 if (! ice->vt1720) /* VT1720 supports only 16 GPIO bits */
@@ -194,7 +194,7 @@ static void snd_vt1724_set_gpio_mask(ice1712_t *ice, unsigned int data)
194 inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ 194 inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */
195} 195}
196 196
197static void snd_vt1724_set_gpio_data(ice1712_t *ice, unsigned int data) 197static void snd_vt1724_set_gpio_data(struct snd_ice1712 *ice, unsigned int data)
198{ 198{
199 outw(data, ICEREG1724(ice, GPIO_DATA)); 199 outw(data, ICEREG1724(ice, GPIO_DATA));
200 if (! ice->vt1720) 200 if (! ice->vt1720)
@@ -202,7 +202,7 @@ static void snd_vt1724_set_gpio_data(ice1712_t *ice, unsigned int data)
202 inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ 202 inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */
203} 203}
204 204
205static unsigned int snd_vt1724_get_gpio_data(ice1712_t *ice) 205static unsigned int snd_vt1724_get_gpio_data(struct snd_ice1712 *ice)
206{ 206{
207 unsigned int data; 207 unsigned int data;
208 if (! ice->vt1720) 208 if (! ice->vt1720)
@@ -219,7 +219,7 @@ static unsigned int snd_vt1724_get_gpio_data(ice1712_t *ice)
219 219
220static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id, struct pt_regs *regs) 220static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id, struct pt_regs *regs)
221{ 221{
222 ice1712_t *ice = dev_id; 222 struct snd_ice1712 *ice = dev_id;
223 unsigned char status; 223 unsigned char status;
224 int handled = 0; 224 int handled = 0;
225 225
@@ -229,8 +229,10 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id, struct pt_regs *r
229 break; 229 break;
230 230
231 handled = 1; 231 handled = 1;
232 /* these should probably be separated at some point, 232 /* these should probably be separated at some point,
233 but as we don't currently have MPU support on the board I will leave it */ 233 * but as we don't currently have MPU support on the board
234 * I will leave it
235 */
234 if ((status & VT1724_IRQ_MPU_RX)||(status & VT1724_IRQ_MPU_TX)) { 236 if ((status & VT1724_IRQ_MPU_RX)||(status & VT1724_IRQ_MPU_TX)) {
235 if (ice->rmidi[0]) 237 if (ice->rmidi[0])
236 snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data, regs); 238 snd_mpu401_uart_interrupt(irq, ice->rmidi[0]->private_data, regs);
@@ -303,19 +305,19 @@ static unsigned int rates[] = {
303 176400, 192000, 305 176400, 192000,
304}; 306};
305 307
306static snd_pcm_hw_constraint_list_t hw_constraints_rates_96 = { 308static struct snd_pcm_hw_constraint_list hw_constraints_rates_96 = {
307 .count = ARRAY_SIZE(rates) - 2, /* up to 96000 */ 309 .count = ARRAY_SIZE(rates) - 2, /* up to 96000 */
308 .list = rates, 310 .list = rates,
309 .mask = 0, 311 .mask = 0,
310}; 312};
311 313
312static snd_pcm_hw_constraint_list_t hw_constraints_rates_48 = { 314static struct snd_pcm_hw_constraint_list hw_constraints_rates_48 = {
313 .count = ARRAY_SIZE(rates) - 5, /* up to 48000 */ 315 .count = ARRAY_SIZE(rates) - 5, /* up to 48000 */
314 .list = rates, 316 .list = rates,
315 .mask = 0, 317 .mask = 0,
316}; 318};
317 319
318static snd_pcm_hw_constraint_list_t hw_constraints_rates_192 = { 320static struct snd_pcm_hw_constraint_list hw_constraints_rates_192 = {
319 .count = ARRAY_SIZE(rates), 321 .count = ARRAY_SIZE(rates),
320 .list = rates, 322 .list = rates,
321 .mask = 0, 323 .mask = 0,
@@ -328,13 +330,13 @@ struct vt1724_pcm_reg {
328 unsigned int start; /* start & pause bit */ 330 unsigned int start; /* start & pause bit */
329}; 331};
330 332
331static int snd_vt1724_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 333static int snd_vt1724_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
332{ 334{
333 ice1712_t *ice = snd_pcm_substream_chip(substream); 335 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
334 unsigned char what; 336 unsigned char what;
335 unsigned char old; 337 unsigned char old;
336 struct list_head *pos; 338 struct list_head *pos;
337 snd_pcm_substream_t *s; 339 struct snd_pcm_substream *s;
338 340
339 what = 0; 341 what = 0;
340 snd_pcm_group_for_each(pos, substream) { 342 snd_pcm_group_for_each(pos, substream) {
@@ -384,7 +386,7 @@ static int snd_vt1724_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
384#define DMA_PAUSES (VT1724_RDMA0_PAUSE|VT1724_PDMA0_PAUSE|VT1724_RDMA1_PAUSE|\ 386#define DMA_PAUSES (VT1724_RDMA0_PAUSE|VT1724_PDMA0_PAUSE|VT1724_RDMA1_PAUSE|\
385 VT1724_PDMA1_PAUSE|VT1724_PDMA2_PAUSE|VT1724_PDMA3_PAUSE|VT1724_PDMA4_PAUSE) 387 VT1724_PDMA1_PAUSE|VT1724_PDMA2_PAUSE|VT1724_PDMA3_PAUSE|VT1724_PDMA4_PAUSE)
386 388
387static int get_max_rate(ice1712_t *ice) 389static int get_max_rate(struct snd_ice1712 *ice)
388{ 390{
389 if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) { 391 if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) {
390 if ((ice->eeprom.data[ICE_EEP2_I2S] & 0x08) && !ice->vt1720) 392 if ((ice->eeprom.data[ICE_EEP2_I2S] & 0x08) && !ice->vt1720)
@@ -395,7 +397,8 @@ static int get_max_rate(ice1712_t *ice)
395 return 48000; 397 return 48000;
396} 398}
397 399
398static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force) 400static void snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate,
401 int force)
399{ 402{
400 unsigned long flags; 403 unsigned long flags;
401 unsigned char val, old; 404 unsigned char val, old;
@@ -477,10 +480,10 @@ static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force
477 ice->spdif.ops.setup_rate(ice, rate); 480 ice->spdif.ops.setup_rate(ice, rate);
478} 481}
479 482
480static int snd_vt1724_pcm_hw_params(snd_pcm_substream_t * substream, 483static int snd_vt1724_pcm_hw_params(struct snd_pcm_substream *substream,
481 snd_pcm_hw_params_t * hw_params) 484 struct snd_pcm_hw_params *hw_params)
482{ 485{
483 ice1712_t *ice = snd_pcm_substream_chip(substream); 486 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
484 int i, chs; 487 int i, chs;
485 488
486 chs = params_channels(hw_params); 489 chs = params_channels(hw_params);
@@ -490,7 +493,8 @@ static int snd_vt1724_pcm_hw_params(snd_pcm_substream_t * substream,
490 /* PDMA0 can be multi-channel up to 8 */ 493 /* PDMA0 can be multi-channel up to 8 */
491 chs = chs / 2 - 1; 494 chs = chs / 2 - 1;
492 for (i = 0; i < chs; i++) { 495 for (i = 0; i < chs; i++) {
493 if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) { 496 if (ice->pcm_reserved[i] &&
497 ice->pcm_reserved[i] != substream) {
494 up(&ice->open_mutex); 498 up(&ice->open_mutex);
495 return -EBUSY; 499 return -EBUSY;
496 } 500 }
@@ -504,7 +508,8 @@ static int snd_vt1724_pcm_hw_params(snd_pcm_substream_t * substream,
504 for (i = 0; i < 3; i++) { 508 for (i = 0; i < 3; i++) {
505 /* check individual playback stream */ 509 /* check individual playback stream */
506 if (ice->playback_con_substream_ds[i] == substream) { 510 if (ice->playback_con_substream_ds[i] == substream) {
507 if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) { 511 if (ice->pcm_reserved[i] &&
512 ice->pcm_reserved[i] != substream) {
508 up(&ice->open_mutex); 513 up(&ice->open_mutex);
509 return -EBUSY; 514 return -EBUSY;
510 } 515 }
@@ -518,9 +523,9 @@ static int snd_vt1724_pcm_hw_params(snd_pcm_substream_t * substream,
518 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 523 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
519} 524}
520 525
521static int snd_vt1724_pcm_hw_free(snd_pcm_substream_t * substream) 526static int snd_vt1724_pcm_hw_free(struct snd_pcm_substream *substream)
522{ 527{
523 ice1712_t *ice = snd_pcm_substream_chip(substream); 528 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
524 int i; 529 int i;
525 530
526 down(&ice->open_mutex); 531 down(&ice->open_mutex);
@@ -532,9 +537,9 @@ static int snd_vt1724_pcm_hw_free(snd_pcm_substream_t * substream)
532 return snd_pcm_lib_free_pages(substream); 537 return snd_pcm_lib_free_pages(substream);
533} 538}
534 539
535static int snd_vt1724_playback_pro_prepare(snd_pcm_substream_t * substream) 540static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
536{ 541{
537 ice1712_t *ice = snd_pcm_substream_chip(substream); 542 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
538 unsigned char val; 543 unsigned char val;
539 unsigned int size; 544 unsigned int size;
540 545
@@ -559,9 +564,9 @@ static int snd_vt1724_playback_pro_prepare(snd_pcm_substream_t * substream)
559 return 0; 564 return 0;
560} 565}
561 566
562static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(snd_pcm_substream_t * substream) 567static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substream *substream)
563{ 568{
564 ice1712_t *ice = snd_pcm_substream_chip(substream); 569 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
565 size_t ptr; 570 size_t ptr;
566 571
567 if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & VT1724_PDMA0_START)) 572 if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & VT1724_PDMA0_START))
@@ -575,7 +580,8 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(snd_pcm_substream_t * s
575 ptr -= substream->runtime->dma_addr; 580 ptr -= substream->runtime->dma_addr;
576 ptr = bytes_to_frames(substream->runtime, ptr); 581 ptr = bytes_to_frames(substream->runtime, ptr);
577 if (ptr >= substream->runtime->buffer_size) { 582 if (ptr >= substream->runtime->buffer_size) {
578 snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->period_size); 583 snd_printd("ice1724: invalid ptr %d (size=%d)\n",
584 (int)ptr, (int)substream->runtime->period_size);
579 return 0; 585 return 0;
580 } 586 }
581#else /* read PLAYBACK_SIZE */ 587#else /* read PLAYBACK_SIZE */
@@ -587,29 +593,32 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(snd_pcm_substream_t * s
587 else if (ptr <= substream->runtime->buffer_size) 593 else if (ptr <= substream->runtime->buffer_size)
588 ptr = substream->runtime->buffer_size - ptr; 594 ptr = substream->runtime->buffer_size - ptr;
589 else { 595 else {
590 snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->buffer_size); 596 snd_printd("ice1724: invalid ptr %d (size=%d)\n",
597 (int)ptr, (int)substream->runtime->buffer_size);
591 ptr = 0; 598 ptr = 0;
592 } 599 }
593#endif 600#endif
594 return ptr; 601 return ptr;
595} 602}
596 603
597static int snd_vt1724_pcm_prepare(snd_pcm_substream_t *substream) 604static int snd_vt1724_pcm_prepare(struct snd_pcm_substream *substream)
598{ 605{
599 ice1712_t *ice = snd_pcm_substream_chip(substream); 606 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
600 struct vt1724_pcm_reg *reg = substream->runtime->private_data; 607 struct vt1724_pcm_reg *reg = substream->runtime->private_data;
601 608
602 spin_lock_irq(&ice->reg_lock); 609 spin_lock_irq(&ice->reg_lock);
603 outl(substream->runtime->dma_addr, ice->profi_port + reg->addr); 610 outl(substream->runtime->dma_addr, ice->profi_port + reg->addr);
604 outw((snd_pcm_lib_buffer_bytes(substream) >> 2) - 1, ice->profi_port + reg->size); 611 outw((snd_pcm_lib_buffer_bytes(substream) >> 2) - 1,
605 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1, ice->profi_port + reg->count); 612 ice->profi_port + reg->size);
613 outw((snd_pcm_lib_period_bytes(substream) >> 2) - 1,
614 ice->profi_port + reg->count);
606 spin_unlock_irq(&ice->reg_lock); 615 spin_unlock_irq(&ice->reg_lock);
607 return 0; 616 return 0;
608} 617}
609 618
610static snd_pcm_uframes_t snd_vt1724_pcm_pointer(snd_pcm_substream_t *substream) 619static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substream)
611{ 620{
612 ice1712_t *ice = snd_pcm_substream_chip(substream); 621 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
613 struct vt1724_pcm_reg *reg = substream->runtime->private_data; 622 struct vt1724_pcm_reg *reg = substream->runtime->private_data;
614 size_t ptr; 623 size_t ptr;
615 624
@@ -628,7 +637,8 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(snd_pcm_substream_t *substream)
628 else if (ptr <= substream->runtime->buffer_size) 637 else if (ptr <= substream->runtime->buffer_size)
629 ptr = substream->runtime->buffer_size - ptr; 638 ptr = substream->runtime->buffer_size - ptr;
630 else { 639 else {
631 snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->buffer_size); 640 snd_printd("ice1724: invalid ptr %d (size=%d)\n",
641 (int)ptr, (int)substream->runtime->buffer_size);
632 ptr = 0; 642 ptr = 0;
633 } 643 }
634 return ptr; 644 return ptr;
@@ -649,7 +659,7 @@ static struct vt1724_pcm_reg vt1724_capture_pro_reg = {
649 .start = VT1724_RDMA0_START, 659 .start = VT1724_RDMA0_START,
650}; 660};
651 661
652static snd_pcm_hardware_t snd_vt1724_playback_pro = 662static struct snd_pcm_hardware snd_vt1724_playback_pro =
653{ 663{
654 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 664 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
655 SNDRV_PCM_INFO_BLOCK_TRANSFER | 665 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -668,7 +678,7 @@ static snd_pcm_hardware_t snd_vt1724_playback_pro =
668 .periods_max = 1024, 678 .periods_max = 1024,
669}; 679};
670 680
671static snd_pcm_hardware_t snd_vt1724_spdif = 681static struct snd_pcm_hardware snd_vt1724_spdif =
672{ 682{
673 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 683 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
674 SNDRV_PCM_INFO_BLOCK_TRANSFER | 684 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -690,7 +700,7 @@ static snd_pcm_hardware_t snd_vt1724_spdif =
690 .periods_max = 1024, 700 .periods_max = 1024,
691}; 701};
692 702
693static snd_pcm_hardware_t snd_vt1724_2ch_stereo = 703static struct snd_pcm_hardware snd_vt1724_2ch_stereo =
694{ 704{
695 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 705 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
696 SNDRV_PCM_INFO_BLOCK_TRANSFER | 706 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -712,31 +722,41 @@ static snd_pcm_hardware_t snd_vt1724_2ch_stereo =
712/* 722/*
713 * set rate constraints 723 * set rate constraints
714 */ 724 */
715static int set_rate_constraints(ice1712_t *ice, snd_pcm_substream_t *substream) 725static int set_rate_constraints(struct snd_ice1712 *ice,
726 struct snd_pcm_substream *substream)
716{ 727{
717 snd_pcm_runtime_t *runtime = substream->runtime; 728 struct snd_pcm_runtime *runtime = substream->runtime;
718 if (ice->hw_rates) { 729 if (ice->hw_rates) {
719 /* hardware specific */ 730 /* hardware specific */
720 runtime->hw.rate_min = ice->hw_rates->list[0]; 731 runtime->hw.rate_min = ice->hw_rates->list[0];
721 runtime->hw.rate_max = ice->hw_rates->list[ice->hw_rates->count - 1]; 732 runtime->hw.rate_max = ice->hw_rates->list[ice->hw_rates->count - 1];
722 runtime->hw.rates = SNDRV_PCM_RATE_KNOT; 733 runtime->hw.rates = SNDRV_PCM_RATE_KNOT;
723 return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, ice->hw_rates); 734 return snd_pcm_hw_constraint_list(runtime, 0,
735 SNDRV_PCM_HW_PARAM_RATE,
736 ice->hw_rates);
724 } 737 }
725 if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) { 738 if (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S) {
726 /* I2S */ 739 /* I2S */
727 /* VT1720 doesn't support more than 96kHz */ 740 /* VT1720 doesn't support more than 96kHz */
728 if ((ice->eeprom.data[ICE_EEP2_I2S] & 0x08) && !ice->vt1720) 741 if ((ice->eeprom.data[ICE_EEP2_I2S] & 0x08) && !ice->vt1720)
729 return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192); 742 return snd_pcm_hw_constraint_list(runtime, 0,
743 SNDRV_PCM_HW_PARAM_RATE,
744 &hw_constraints_rates_192);
730 else { 745 else {
731 runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_96000; 746 runtime->hw.rates = SNDRV_PCM_RATE_KNOT |
747 SNDRV_PCM_RATE_8000_96000;
732 runtime->hw.rate_max = 96000; 748 runtime->hw.rate_max = 96000;
733 return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96); 749 return snd_pcm_hw_constraint_list(runtime, 0,
750 SNDRV_PCM_HW_PARAM_RATE,
751 &hw_constraints_rates_96);
734 } 752 }
735 } else if (ice->ac97) { 753 } else if (ice->ac97) {
736 /* ACLINK */ 754 /* ACLINK */
737 runtime->hw.rate_max = 48000; 755 runtime->hw.rate_max = 48000;
738 runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000; 756 runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000;
739 return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_48); 757 return snd_pcm_hw_constraint_list(runtime, 0,
758 SNDRV_PCM_HW_PARAM_RATE,
759 &hw_constraints_rates_48);
740 } 760 }
741 return 0; 761 return 0;
742} 762}
@@ -746,10 +766,10 @@ static int set_rate_constraints(ice1712_t *ice, snd_pcm_substream_t *substream)
746 */ 766 */
747#define VT1724_BUFFER_ALIGN 0x20 767#define VT1724_BUFFER_ALIGN 0x20
748 768
749static int snd_vt1724_playback_pro_open(snd_pcm_substream_t * substream) 769static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
750{ 770{
751 snd_pcm_runtime_t *runtime = substream->runtime; 771 struct snd_pcm_runtime *runtime = substream->runtime;
752 ice1712_t *ice = snd_pcm_substream_chip(substream); 772 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
753 int chs; 773 int chs;
754 774
755 runtime->private_data = &vt1724_playback_pro_reg; 775 runtime->private_data = &vt1724_playback_pro_reg;
@@ -776,10 +796,10 @@ static int snd_vt1724_playback_pro_open(snd_pcm_substream_t * substream)
776 return 0; 796 return 0;
777} 797}
778 798
779static int snd_vt1724_capture_pro_open(snd_pcm_substream_t * substream) 799static int snd_vt1724_capture_pro_open(struct snd_pcm_substream *substream)
780{ 800{
781 ice1712_t *ice = snd_pcm_substream_chip(substream); 801 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
782 snd_pcm_runtime_t *runtime = substream->runtime; 802 struct snd_pcm_runtime *runtime = substream->runtime;
783 803
784 runtime->private_data = &vt1724_capture_pro_reg; 804 runtime->private_data = &vt1724_capture_pro_reg;
785 ice->capture_pro_substream = substream; 805 ice->capture_pro_substream = substream;
@@ -794,9 +814,9 @@ static int snd_vt1724_capture_pro_open(snd_pcm_substream_t * substream)
794 return 0; 814 return 0;
795} 815}
796 816
797static int snd_vt1724_playback_pro_close(snd_pcm_substream_t * substream) 817static int snd_vt1724_playback_pro_close(struct snd_pcm_substream *substream)
798{ 818{
799 ice1712_t *ice = snd_pcm_substream_chip(substream); 819 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
800 820
801 if (PRO_RATE_RESET) 821 if (PRO_RATE_RESET)
802 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); 822 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
@@ -805,9 +825,9 @@ static int snd_vt1724_playback_pro_close(snd_pcm_substream_t * substream)
805 return 0; 825 return 0;
806} 826}
807 827
808static int snd_vt1724_capture_pro_close(snd_pcm_substream_t * substream) 828static int snd_vt1724_capture_pro_close(struct snd_pcm_substream *substream)
809{ 829{
810 ice1712_t *ice = snd_pcm_substream_chip(substream); 830 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
811 831
812 if (PRO_RATE_RESET) 832 if (PRO_RATE_RESET)
813 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); 833 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
@@ -815,7 +835,7 @@ static int snd_vt1724_capture_pro_close(snd_pcm_substream_t * substream)
815 return 0; 835 return 0;
816} 836}
817 837
818static snd_pcm_ops_t snd_vt1724_playback_pro_ops = { 838static struct snd_pcm_ops snd_vt1724_playback_pro_ops = {
819 .open = snd_vt1724_playback_pro_open, 839 .open = snd_vt1724_playback_pro_open,
820 .close = snd_vt1724_playback_pro_close, 840 .close = snd_vt1724_playback_pro_close,
821 .ioctl = snd_pcm_lib_ioctl, 841 .ioctl = snd_pcm_lib_ioctl,
@@ -826,7 +846,7 @@ static snd_pcm_ops_t snd_vt1724_playback_pro_ops = {
826 .pointer = snd_vt1724_playback_pro_pointer, 846 .pointer = snd_vt1724_playback_pro_pointer,
827}; 847};
828 848
829static snd_pcm_ops_t snd_vt1724_capture_pro_ops = { 849static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
830 .open = snd_vt1724_capture_pro_open, 850 .open = snd_vt1724_capture_pro_open,
831 .close = snd_vt1724_capture_pro_close, 851 .close = snd_vt1724_capture_pro_close,
832 .ioctl = snd_pcm_lib_ioctl, 852 .ioctl = snd_pcm_lib_ioctl,
@@ -837,9 +857,9 @@ static snd_pcm_ops_t snd_vt1724_capture_pro_ops = {
837 .pointer = snd_vt1724_pcm_pointer, 857 .pointer = snd_vt1724_pcm_pointer,
838}; 858};
839 859
840static int __devinit snd_vt1724_pcm_profi(ice1712_t * ice, int device) 860static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 * ice, int device)
841{ 861{
842 snd_pcm_t *pcm; 862 struct snd_pcm *pcm;
843 int err; 863 int err;
844 864
845 err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm); 865 err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm);
@@ -854,7 +874,8 @@ static int __devinit snd_vt1724_pcm_profi(ice1712_t * ice, int device)
854 strcpy(pcm->name, "ICE1724"); 874 strcpy(pcm->name, "ICE1724");
855 875
856 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 876 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
857 snd_dma_pci_data(ice->pci), 256*1024, 256*1024); 877 snd_dma_pci_data(ice->pci),
878 256*1024, 256*1024);
858 879
859 ice->pcm_pro = pcm; 880 ice->pcm_pro = pcm;
860 881
@@ -881,7 +902,7 @@ static struct vt1724_pcm_reg vt1724_capture_spdif_reg = {
881}; 902};
882 903
883/* update spdif control bits; call with reg_lock */ 904/* update spdif control bits; call with reg_lock */
884static void update_spdif_bits(ice1712_t *ice, unsigned int val) 905static void update_spdif_bits(struct snd_ice1712 *ice, unsigned int val)
885{ 906{
886 unsigned char cbit, disabled; 907 unsigned char cbit, disabled;
887 908
@@ -896,7 +917,7 @@ static void update_spdif_bits(ice1712_t *ice, unsigned int val)
896} 917}
897 918
898/* update SPDIF control bits according to the given rate */ 919/* update SPDIF control bits according to the given rate */
899static void update_spdif_rate(ice1712_t *ice, unsigned int rate) 920static void update_spdif_rate(struct snd_ice1712 *ice, unsigned int rate)
900{ 921{
901 unsigned int val, nval; 922 unsigned int val, nval;
902 unsigned long flags; 923 unsigned long flags;
@@ -918,18 +939,18 @@ static void update_spdif_rate(ice1712_t *ice, unsigned int rate)
918 spin_unlock_irqrestore(&ice->reg_lock, flags); 939 spin_unlock_irqrestore(&ice->reg_lock, flags);
919} 940}
920 941
921static int snd_vt1724_playback_spdif_prepare(snd_pcm_substream_t * substream) 942static int snd_vt1724_playback_spdif_prepare(struct snd_pcm_substream *substream)
922{ 943{
923 ice1712_t *ice = snd_pcm_substream_chip(substream); 944 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
924 if (! ice->force_pdma4) 945 if (! ice->force_pdma4)
925 update_spdif_rate(ice, substream->runtime->rate); 946 update_spdif_rate(ice, substream->runtime->rate);
926 return snd_vt1724_pcm_prepare(substream); 947 return snd_vt1724_pcm_prepare(substream);
927} 948}
928 949
929static int snd_vt1724_playback_spdif_open(snd_pcm_substream_t *substream) 950static int snd_vt1724_playback_spdif_open(struct snd_pcm_substream *substream)
930{ 951{
931 ice1712_t *ice = snd_pcm_substream_chip(substream); 952 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
932 snd_pcm_runtime_t *runtime = substream->runtime; 953 struct snd_pcm_runtime *runtime = substream->runtime;
933 954
934 runtime->private_data = &vt1724_playback_spdif_reg; 955 runtime->private_data = &vt1724_playback_spdif_reg;
935 ice->playback_con_substream = substream; 956 ice->playback_con_substream = substream;
@@ -947,9 +968,9 @@ static int snd_vt1724_playback_spdif_open(snd_pcm_substream_t *substream)
947 return 0; 968 return 0;
948} 969}
949 970
950static int snd_vt1724_playback_spdif_close(snd_pcm_substream_t * substream) 971static int snd_vt1724_playback_spdif_close(struct snd_pcm_substream *substream)
951{ 972{
952 ice1712_t *ice = snd_pcm_substream_chip(substream); 973 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
953 974
954 if (PRO_RATE_RESET) 975 if (PRO_RATE_RESET)
955 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); 976 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
@@ -958,10 +979,10 @@ static int snd_vt1724_playback_spdif_close(snd_pcm_substream_t * substream)
958 return 0; 979 return 0;
959} 980}
960 981
961static int snd_vt1724_capture_spdif_open(snd_pcm_substream_t *substream) 982static int snd_vt1724_capture_spdif_open(struct snd_pcm_substream *substream)
962{ 983{
963 ice1712_t *ice = snd_pcm_substream_chip(substream); 984 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
964 snd_pcm_runtime_t *runtime = substream->runtime; 985 struct snd_pcm_runtime *runtime = substream->runtime;
965 986
966 runtime->private_data = &vt1724_capture_spdif_reg; 987 runtime->private_data = &vt1724_capture_spdif_reg;
967 ice->capture_con_substream = substream; 988 ice->capture_con_substream = substream;
@@ -979,9 +1000,9 @@ static int snd_vt1724_capture_spdif_open(snd_pcm_substream_t *substream)
979 return 0; 1000 return 0;
980} 1001}
981 1002
982static int snd_vt1724_capture_spdif_close(snd_pcm_substream_t * substream) 1003static int snd_vt1724_capture_spdif_close(struct snd_pcm_substream *substream)
983{ 1004{
984 ice1712_t *ice = snd_pcm_substream_chip(substream); 1005 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
985 1006
986 if (PRO_RATE_RESET) 1007 if (PRO_RATE_RESET)
987 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); 1008 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
@@ -990,7 +1011,7 @@ static int snd_vt1724_capture_spdif_close(snd_pcm_substream_t * substream)
990 return 0; 1011 return 0;
991} 1012}
992 1013
993static snd_pcm_ops_t snd_vt1724_playback_spdif_ops = { 1014static struct snd_pcm_ops snd_vt1724_playback_spdif_ops = {
994 .open = snd_vt1724_playback_spdif_open, 1015 .open = snd_vt1724_playback_spdif_open,
995 .close = snd_vt1724_playback_spdif_close, 1016 .close = snd_vt1724_playback_spdif_close,
996 .ioctl = snd_pcm_lib_ioctl, 1017 .ioctl = snd_pcm_lib_ioctl,
@@ -1001,7 +1022,7 @@ static snd_pcm_ops_t snd_vt1724_playback_spdif_ops = {
1001 .pointer = snd_vt1724_pcm_pointer, 1022 .pointer = snd_vt1724_pcm_pointer,
1002}; 1023};
1003 1024
1004static snd_pcm_ops_t snd_vt1724_capture_spdif_ops = { 1025static struct snd_pcm_ops snd_vt1724_capture_spdif_ops = {
1005 .open = snd_vt1724_capture_spdif_open, 1026 .open = snd_vt1724_capture_spdif_open,
1006 .close = snd_vt1724_capture_spdif_close, 1027 .close = snd_vt1724_capture_spdif_close,
1007 .ioctl = snd_pcm_lib_ioctl, 1028 .ioctl = snd_pcm_lib_ioctl,
@@ -1013,10 +1034,10 @@ static snd_pcm_ops_t snd_vt1724_capture_spdif_ops = {
1013}; 1034};
1014 1035
1015 1036
1016static int __devinit snd_vt1724_pcm_spdif(ice1712_t * ice, int device) 1037static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 * ice, int device)
1017{ 1038{
1018 char *name; 1039 char *name;
1019 snd_pcm_t *pcm; 1040 struct snd_pcm *pcm;
1020 int play, capt; 1041 int play, capt;
1021 int err; 1042 int err;
1022 1043
@@ -1055,7 +1076,8 @@ static int __devinit snd_vt1724_pcm_spdif(ice1712_t * ice, int device)
1055 strcpy(pcm->name, name); 1076 strcpy(pcm->name, name);
1056 1077
1057 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1078 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1058 snd_dma_pci_data(ice->pci), 64*1024, 64*1024); 1079 snd_dma_pci_data(ice->pci),
1080 64*1024, 64*1024);
1059 1081
1060 ice->pcm = pcm; 1082 ice->pcm = pcm;
1061 1083
@@ -1088,9 +1110,9 @@ static struct vt1724_pcm_reg vt1724_playback_dma_regs[3] = {
1088 }, 1110 },
1089}; 1111};
1090 1112
1091static int snd_vt1724_playback_indep_prepare(snd_pcm_substream_t * substream) 1113static int snd_vt1724_playback_indep_prepare(struct snd_pcm_substream *substream)
1092{ 1114{
1093 ice1712_t *ice = snd_pcm_substream_chip(substream); 1115 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
1094 unsigned char val; 1116 unsigned char val;
1095 1117
1096 spin_lock_irq(&ice->reg_lock); 1118 spin_lock_irq(&ice->reg_lock);
@@ -1101,10 +1123,10 @@ static int snd_vt1724_playback_indep_prepare(snd_pcm_substream_t * substream)
1101 return snd_vt1724_pcm_prepare(substream); 1123 return snd_vt1724_pcm_prepare(substream);
1102} 1124}
1103 1125
1104static int snd_vt1724_playback_indep_open(snd_pcm_substream_t *substream) 1126static int snd_vt1724_playback_indep_open(struct snd_pcm_substream *substream)
1105{ 1127{
1106 ice1712_t *ice = snd_pcm_substream_chip(substream); 1128 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
1107 snd_pcm_runtime_t *runtime = substream->runtime; 1129 struct snd_pcm_runtime *runtime = substream->runtime;
1108 1130
1109 down(&ice->open_mutex); 1131 down(&ice->open_mutex);
1110 /* already used by PDMA0? */ 1132 /* already used by PDMA0? */
@@ -1122,9 +1144,9 @@ static int snd_vt1724_playback_indep_open(snd_pcm_substream_t *substream)
1122 return 0; 1144 return 0;
1123} 1145}
1124 1146
1125static int snd_vt1724_playback_indep_close(snd_pcm_substream_t * substream) 1147static int snd_vt1724_playback_indep_close(struct snd_pcm_substream *substream)
1126{ 1148{
1127 ice1712_t *ice = snd_pcm_substream_chip(substream); 1149 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
1128 1150
1129 if (PRO_RATE_RESET) 1151 if (PRO_RATE_RESET)
1130 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); 1152 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0);
@@ -1134,7 +1156,7 @@ static int snd_vt1724_playback_indep_close(snd_pcm_substream_t * substream)
1134 return 0; 1156 return 0;
1135} 1157}
1136 1158
1137static snd_pcm_ops_t snd_vt1724_playback_indep_ops = { 1159static struct snd_pcm_ops snd_vt1724_playback_indep_ops = {
1138 .open = snd_vt1724_playback_indep_open, 1160 .open = snd_vt1724_playback_indep_open,
1139 .close = snd_vt1724_playback_indep_close, 1161 .close = snd_vt1724_playback_indep_close,
1140 .ioctl = snd_pcm_lib_ioctl, 1162 .ioctl = snd_pcm_lib_ioctl,
@@ -1146,9 +1168,9 @@ static snd_pcm_ops_t snd_vt1724_playback_indep_ops = {
1146}; 1168};
1147 1169
1148 1170
1149static int __devinit snd_vt1724_pcm_indep(ice1712_t * ice, int device) 1171static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 * ice, int device)
1150{ 1172{
1151 snd_pcm_t *pcm; 1173 struct snd_pcm *pcm;
1152 int play; 1174 int play;
1153 int err; 1175 int err;
1154 1176
@@ -1168,7 +1190,8 @@ static int __devinit snd_vt1724_pcm_indep(ice1712_t * ice, int device)
1168 strcpy(pcm->name, "ICE1724 Surround PCM"); 1190 strcpy(pcm->name, "ICE1724 Surround PCM");
1169 1191
1170 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1192 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1171 snd_dma_pci_data(ice->pci), 64*1024, 64*1024); 1193 snd_dma_pci_data(ice->pci),
1194 64*1024, 64*1024);
1172 1195
1173 ice->pcm_ds = pcm; 1196 ice->pcm_ds = pcm;
1174 1197
@@ -1180,14 +1203,14 @@ static int __devinit snd_vt1724_pcm_indep(ice1712_t * ice, int device)
1180 * Mixer section 1203 * Mixer section
1181 */ 1204 */
1182 1205
1183static int __devinit snd_vt1724_ac97_mixer(ice1712_t * ice) 1206static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 * ice)
1184{ 1207{
1185 int err; 1208 int err;
1186 1209
1187 if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { 1210 if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) {
1188 ac97_bus_t *pbus; 1211 struct snd_ac97_bus *pbus;
1189 ac97_template_t ac97; 1212 struct snd_ac97_template ac97;
1190 static ac97_bus_ops_t ops = { 1213 static struct snd_ac97_bus_ops ops = {
1191 .write = snd_vt1724_ac97_write, 1214 .write = snd_vt1724_ac97_write,
1192 .read = snd_vt1724_ac97_read, 1215 .read = snd_vt1724_ac97_read,
1193 }; 1216 };
@@ -1215,17 +1238,17 @@ static int __devinit snd_vt1724_ac97_mixer(ice1712_t * ice)
1215 * 1238 *
1216 */ 1239 */
1217 1240
1218static inline unsigned int eeprom_triple(ice1712_t *ice, int idx) 1241static inline unsigned int eeprom_triple(struct snd_ice1712 *ice, int idx)
1219{ 1242{
1220 return (unsigned int)ice->eeprom.data[idx] | \ 1243 return (unsigned int)ice->eeprom.data[idx] | \
1221 ((unsigned int)ice->eeprom.data[idx + 1] << 8) | \ 1244 ((unsigned int)ice->eeprom.data[idx + 1] << 8) | \
1222 ((unsigned int)ice->eeprom.data[idx + 2] << 16); 1245 ((unsigned int)ice->eeprom.data[idx + 2] << 16);
1223} 1246}
1224 1247
1225static void snd_vt1724_proc_read(snd_info_entry_t *entry, 1248static void snd_vt1724_proc_read(struct snd_info_entry *entry,
1226 snd_info_buffer_t * buffer) 1249 struct snd_info_buffer *buffer)
1227{ 1250{
1228 ice1712_t *ice = entry->private_data; 1251 struct snd_ice1712 *ice = entry->private_data;
1229 unsigned int idx; 1252 unsigned int idx;
1230 1253
1231 snd_iprintf(buffer, "%s\n\n", ice->card->longname); 1254 snd_iprintf(buffer, "%s\n\n", ice->card->longname);
@@ -1234,28 +1257,39 @@ static void snd_vt1724_proc_read(snd_info_entry_t *entry,
1234 snd_iprintf(buffer, " Subvendor : 0x%x\n", ice->eeprom.subvendor); 1257 snd_iprintf(buffer, " Subvendor : 0x%x\n", ice->eeprom.subvendor);
1235 snd_iprintf(buffer, " Size : %i bytes\n", ice->eeprom.size); 1258 snd_iprintf(buffer, " Size : %i bytes\n", ice->eeprom.size);
1236 snd_iprintf(buffer, " Version : %i\n", ice->eeprom.version); 1259 snd_iprintf(buffer, " Version : %i\n", ice->eeprom.version);
1237 snd_iprintf(buffer, " System Config : 0x%x\n", ice->eeprom.data[ICE_EEP2_SYSCONF]); 1260 snd_iprintf(buffer, " System Config : 0x%x\n",
1238 snd_iprintf(buffer, " ACLink : 0x%x\n", ice->eeprom.data[ICE_EEP2_ACLINK]); 1261 ice->eeprom.data[ICE_EEP2_SYSCONF]);
1239 snd_iprintf(buffer, " I2S : 0x%x\n", ice->eeprom.data[ICE_EEP2_I2S]); 1262 snd_iprintf(buffer, " ACLink : 0x%x\n",
1240 snd_iprintf(buffer, " S/PDIF : 0x%x\n", ice->eeprom.data[ICE_EEP2_SPDIF]); 1263 ice->eeprom.data[ICE_EEP2_ACLINK]);
1241 snd_iprintf(buffer, " GPIO direction : 0x%x\n", ice->eeprom.gpiodir); 1264 snd_iprintf(buffer, " I2S : 0x%x\n",
1242 snd_iprintf(buffer, " GPIO mask : 0x%x\n", ice->eeprom.gpiomask); 1265 ice->eeprom.data[ICE_EEP2_I2S]);
1243 snd_iprintf(buffer, " GPIO state : 0x%x\n", ice->eeprom.gpiostate); 1266 snd_iprintf(buffer, " S/PDIF : 0x%x\n",
1267 ice->eeprom.data[ICE_EEP2_SPDIF]);
1268 snd_iprintf(buffer, " GPIO direction : 0x%x\n",
1269 ice->eeprom.gpiodir);
1270 snd_iprintf(buffer, " GPIO mask : 0x%x\n",
1271 ice->eeprom.gpiomask);
1272 snd_iprintf(buffer, " GPIO state : 0x%x\n",
1273 ice->eeprom.gpiostate);
1244 for (idx = 0x12; idx < ice->eeprom.size; idx++) 1274 for (idx = 0x12; idx < ice->eeprom.size; idx++)
1245 snd_iprintf(buffer, " Extra #%02i : 0x%x\n", idx, ice->eeprom.data[idx]); 1275 snd_iprintf(buffer, " Extra #%02i : 0x%x\n",
1276 idx, ice->eeprom.data[idx]);
1246 1277
1247 snd_iprintf(buffer, "\nRegisters:\n"); 1278 snd_iprintf(buffer, "\nRegisters:\n");
1248 1279
1249 snd_iprintf(buffer, " PSDOUT03 : 0x%08x\n", (unsigned)inl(ICEMT1724(ice, ROUTE_PLAYBACK))); 1280 snd_iprintf(buffer, " PSDOUT03 : 0x%08x\n",
1281 (unsigned)inl(ICEMT1724(ice, ROUTE_PLAYBACK)));
1250 for (idx = 0x0; idx < 0x20 ; idx++) 1282 for (idx = 0x0; idx < 0x20 ; idx++)
1251 snd_iprintf(buffer, " CCS%02x : 0x%02x\n", idx, inb(ice->port+idx)); 1283 snd_iprintf(buffer, " CCS%02x : 0x%02x\n",
1284 idx, inb(ice->port+idx));
1252 for (idx = 0x0; idx < 0x30 ; idx++) 1285 for (idx = 0x0; idx < 0x30 ; idx++)
1253 snd_iprintf(buffer, " MT%02x : 0x%02x\n", idx, inb(ice->profi_port+idx)); 1286 snd_iprintf(buffer, " MT%02x : 0x%02x\n",
1287 idx, inb(ice->profi_port+idx));
1254} 1288}
1255 1289
1256static void __devinit snd_vt1724_proc_init(ice1712_t * ice) 1290static void __devinit snd_vt1724_proc_init(struct snd_ice1712 * ice)
1257{ 1291{
1258 snd_info_entry_t *entry; 1292 struct snd_info_entry *entry;
1259 1293
1260 if (! snd_card_proc_new(ice->card, "ice1724", &entry)) 1294 if (! snd_card_proc_new(ice->card, "ice1724", &entry))
1261 snd_info_set_text_ops(entry, ice, 1024, snd_vt1724_proc_read); 1295 snd_info_set_text_ops(entry, ice, 1024, snd_vt1724_proc_read);
@@ -1265,22 +1299,24 @@ static void __devinit snd_vt1724_proc_init(ice1712_t * ice)
1265 * 1299 *
1266 */ 1300 */
1267 1301
1268static int snd_vt1724_eeprom_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1302static int snd_vt1724_eeprom_info(struct snd_kcontrol *kcontrol,
1303 struct snd_ctl_elem_info *uinfo)
1269{ 1304{
1270 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; 1305 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
1271 uinfo->count = sizeof(ice1712_eeprom_t); 1306 uinfo->count = sizeof(struct snd_ice1712_eeprom);
1272 return 0; 1307 return 0;
1273} 1308}
1274 1309
1275static int snd_vt1724_eeprom_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1310static int snd_vt1724_eeprom_get(struct snd_kcontrol *kcontrol,
1311 struct snd_ctl_elem_value *ucontrol)
1276{ 1312{
1277 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1313 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1278 1314
1279 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom)); 1315 memcpy(ucontrol->value.bytes.data, &ice->eeprom, sizeof(ice->eeprom));
1280 return 0; 1316 return 0;
1281} 1317}
1282 1318
1283static snd_kcontrol_new_t snd_vt1724_eeprom __devinitdata = { 1319static struct snd_kcontrol_new snd_vt1724_eeprom __devinitdata = {
1284 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1320 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1285 .name = "ICE1724 EEPROM", 1321 .name = "ICE1724 EEPROM",
1286 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1322 .access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -1290,21 +1326,23 @@ static snd_kcontrol_new_t snd_vt1724_eeprom __devinitdata = {
1290 1326
1291/* 1327/*
1292 */ 1328 */
1293static int snd_vt1724_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1329static int snd_vt1724_spdif_info(struct snd_kcontrol *kcontrol,
1330 struct snd_ctl_elem_info *uinfo)
1294{ 1331{
1295 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 1332 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
1296 uinfo->count = 1; 1333 uinfo->count = 1;
1297 return 0; 1334 return 0;
1298} 1335}
1299 1336
1300static unsigned int encode_spdif_bits(snd_aes_iec958_t *diga) 1337static unsigned int encode_spdif_bits(struct snd_aes_iec958 *diga)
1301{ 1338{
1302 unsigned int val, rbits; 1339 unsigned int val, rbits;
1303 1340
1304 val = diga->status[0] & 0x03; /* professional, non-audio */ 1341 val = diga->status[0] & 0x03; /* professional, non-audio */
1305 if (val & 0x01) { 1342 if (val & 0x01) {
1306 /* professional */ 1343 /* professional */
1307 if ((diga->status[0] & IEC958_AES0_PRO_EMPHASIS) == IEC958_AES0_PRO_EMPHASIS_5015) 1344 if ((diga->status[0] & IEC958_AES0_PRO_EMPHASIS) ==
1345 IEC958_AES0_PRO_EMPHASIS_5015)
1308 val |= 1U << 3; 1346 val |= 1U << 3;
1309 rbits = (diga->status[4] >> 3) & 0x0f; 1347 rbits = (diga->status[4] >> 3) & 0x0f;
1310 if (rbits) { 1348 if (rbits) {
@@ -1329,7 +1367,8 @@ static unsigned int encode_spdif_bits(snd_aes_iec958_t *diga)
1329 } else { 1367 } else {
1330 /* consumer */ 1368 /* consumer */
1331 val |= diga->status[1] & 0x04; /* copyright */ 1369 val |= diga->status[1] & 0x04; /* copyright */
1332 if ((diga->status[0] & IEC958_AES0_CON_EMPHASIS)== IEC958_AES0_CON_EMPHASIS_5015) 1370 if ((diga->status[0] & IEC958_AES0_CON_EMPHASIS) ==
1371 IEC958_AES0_CON_EMPHASIS_5015)
1333 val |= 1U << 3; 1372 val |= 1U << 3;
1334 val |= (unsigned int)(diga->status[1] & 0x3f) << 4; /* category */ 1373 val |= (unsigned int)(diga->status[1] & 0x3f) << 4; /* category */
1335 val |= (unsigned int)(diga->status[3] & IEC958_AES3_CON_FS) << 12; /* fs */ 1374 val |= (unsigned int)(diga->status[3] & IEC958_AES3_CON_FS) << 12; /* fs */
@@ -1337,7 +1376,7 @@ static unsigned int encode_spdif_bits(snd_aes_iec958_t *diga)
1337 return val; 1376 return val;
1338} 1377}
1339 1378
1340static void decode_spdif_bits(snd_aes_iec958_t *diga, unsigned int val) 1379static void decode_spdif_bits(struct snd_aes_iec958 *diga, unsigned int val)
1341{ 1380{
1342 memset(diga->status, 0, sizeof(diga->status)); 1381 memset(diga->status, 0, sizeof(diga->status));
1343 diga->status[0] = val & 0x03; /* professional, non-audio */ 1382 diga->status[0] = val & 0x03; /* professional, non-audio */
@@ -1365,20 +1404,20 @@ static void decode_spdif_bits(snd_aes_iec958_t *diga, unsigned int val)
1365 } 1404 }
1366} 1405}
1367 1406
1368static int snd_vt1724_spdif_default_get(snd_kcontrol_t * kcontrol, 1407static int snd_vt1724_spdif_default_get(struct snd_kcontrol *kcontrol,
1369 snd_ctl_elem_value_t * ucontrol) 1408 struct snd_ctl_elem_value *ucontrol)
1370{ 1409{
1371 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1410 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1372 unsigned int val; 1411 unsigned int val;
1373 val = inw(ICEMT1724(ice, SPDIF_CTRL)); 1412 val = inw(ICEMT1724(ice, SPDIF_CTRL));
1374 decode_spdif_bits(&ucontrol->value.iec958, val); 1413 decode_spdif_bits(&ucontrol->value.iec958, val);
1375 return 0; 1414 return 0;
1376} 1415}
1377 1416
1378static int snd_vt1724_spdif_default_put(snd_kcontrol_t * kcontrol, 1417static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol,
1379 snd_ctl_elem_value_t * ucontrol) 1418 struct snd_ctl_elem_value *ucontrol)
1380{ 1419{
1381 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1420 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1382 unsigned int val, old; 1421 unsigned int val, old;
1383 1422
1384 val = encode_spdif_bits(&ucontrol->value.iec958); 1423 val = encode_spdif_bits(&ucontrol->value.iec958);
@@ -1390,7 +1429,7 @@ static int snd_vt1724_spdif_default_put(snd_kcontrol_t * kcontrol,
1390 return (val != old); 1429 return (val != old);
1391} 1430}
1392 1431
1393static snd_kcontrol_new_t snd_vt1724_spdif_default __devinitdata = 1432static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata =
1394{ 1433{
1395 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1434 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1396 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 1435 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -1399,8 +1438,8 @@ static snd_kcontrol_new_t snd_vt1724_spdif_default __devinitdata =
1399 .put = snd_vt1724_spdif_default_put 1438 .put = snd_vt1724_spdif_default_put
1400}; 1439};
1401 1440
1402static int snd_vt1724_spdif_maskc_get(snd_kcontrol_t * kcontrol, 1441static int snd_vt1724_spdif_maskc_get(struct snd_kcontrol *kcontrol,
1403 snd_ctl_elem_value_t * ucontrol) 1442 struct snd_ctl_elem_value *ucontrol)
1404{ 1443{
1405 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | 1444 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO |
1406 IEC958_AES0_PROFESSIONAL | 1445 IEC958_AES0_PROFESSIONAL |
@@ -1412,8 +1451,8 @@ static int snd_vt1724_spdif_maskc_get(snd_kcontrol_t * kcontrol,
1412 return 0; 1451 return 0;
1413} 1452}
1414 1453
1415static int snd_vt1724_spdif_maskp_get(snd_kcontrol_t * kcontrol, 1454static int snd_vt1724_spdif_maskp_get(struct snd_kcontrol *kcontrol,
1416 snd_ctl_elem_value_t * ucontrol) 1455 struct snd_ctl_elem_value *ucontrol)
1417{ 1456{
1418 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO | 1457 ucontrol->value.iec958.status[0] = IEC958_AES0_NONAUDIO |
1419 IEC958_AES0_PROFESSIONAL | 1458 IEC958_AES0_PROFESSIONAL |
@@ -1422,7 +1461,7 @@ static int snd_vt1724_spdif_maskp_get(snd_kcontrol_t * kcontrol,
1422 return 0; 1461 return 0;
1423} 1462}
1424 1463
1425static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata = 1464static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata =
1426{ 1465{
1427 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1466 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1428 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1467 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1431,7 +1470,7 @@ static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata =
1431 .get = snd_vt1724_spdif_maskc_get, 1470 .get = snd_vt1724_spdif_maskc_get,
1432}; 1471};
1433 1472
1434static snd_kcontrol_new_t snd_vt1724_spdif_maskp __devinitdata = 1473static struct snd_kcontrol_new snd_vt1724_spdif_maskp __devinitdata =
1435{ 1474{
1436 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1475 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1437 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1476 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1440,7 +1479,8 @@ static snd_kcontrol_new_t snd_vt1724_spdif_maskp __devinitdata =
1440 .get = snd_vt1724_spdif_maskp_get, 1479 .get = snd_vt1724_spdif_maskp_get,
1441}; 1480};
1442 1481
1443static int snd_vt1724_spdif_sw_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1482static int snd_vt1724_spdif_sw_info(struct snd_kcontrol *kcontrol,
1483 struct snd_ctl_elem_info *uinfo)
1444{ 1484{
1445 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1485 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1446 uinfo->count = 1; 1486 uinfo->count = 1;
@@ -1449,16 +1489,19 @@ static int snd_vt1724_spdif_sw_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_
1449 return 0; 1489 return 0;
1450} 1490}
1451 1491
1452static int snd_vt1724_spdif_sw_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1492static int snd_vt1724_spdif_sw_get(struct snd_kcontrol *kcontrol,
1493 struct snd_ctl_elem_value *ucontrol)
1453{ 1494{
1454 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1495 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1455 ucontrol->value.integer.value[0] = inb(ICEREG1724(ice, SPDIF_CFG)) & VT1724_CFG_SPDIF_OUT_EN ? 1 : 0; 1496 ucontrol->value.integer.value[0] = inb(ICEREG1724(ice, SPDIF_CFG)) &
1497 VT1724_CFG_SPDIF_OUT_EN ? 1 : 0;
1456 return 0; 1498 return 0;
1457} 1499}
1458 1500
1459static int snd_vt1724_spdif_sw_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1501static int snd_vt1724_spdif_sw_put(struct snd_kcontrol *kcontrol,
1502 struct snd_ctl_elem_value *ucontrol)
1460{ 1503{
1461 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1504 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1462 unsigned char old, val; 1505 unsigned char old, val;
1463 1506
1464 spin_lock_irq(&ice->reg_lock); 1507 spin_lock_irq(&ice->reg_lock);
@@ -1472,7 +1515,7 @@ static int snd_vt1724_spdif_sw_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
1472 return old != val; 1515 return old != val;
1473} 1516}
1474 1517
1475static snd_kcontrol_new_t snd_vt1724_spdif_switch __devinitdata = 1518static struct snd_kcontrol_new snd_vt1724_spdif_switch __devinitdata =
1476{ 1519{
1477 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1478 /* FIXME: the following conflict with IEC958 Playback Route */ 1521 /* FIXME: the following conflict with IEC958 Playback Route */
@@ -1489,7 +1532,8 @@ static snd_kcontrol_new_t snd_vt1724_spdif_switch __devinitdata =
1489 * GPIO access from extern 1532 * GPIO access from extern
1490 */ 1533 */
1491 1534
1492int snd_vt1724_gpio_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1535int snd_vt1724_gpio_info(struct snd_kcontrol *kcontrol,
1536 struct snd_ctl_elem_info *uinfo)
1493{ 1537{
1494 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1538 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1495 uinfo->count = 1; 1539 uinfo->count = 1;
@@ -1498,21 +1542,24 @@ int snd_vt1724_gpio_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
1498 return 0; 1542 return 0;
1499} 1543}
1500 1544
1501int snd_vt1724_gpio_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1545int snd_vt1724_gpio_get(struct snd_kcontrol *kcontrol,
1546 struct snd_ctl_elem_value *ucontrol)
1502{ 1547{
1503 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1548 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1504 int shift = kcontrol->private_value & 0xff; 1549 int shift = kcontrol->private_value & 0xff;
1505 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; 1550 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0;
1506 1551
1507 snd_ice1712_save_gpio_status(ice); 1552 snd_ice1712_save_gpio_status(ice);
1508 ucontrol->value.integer.value[0] = (snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert; 1553 ucontrol->value.integer.value[0] =
1554 (snd_ice1712_gpio_read(ice) & (1 << shift) ? 1 : 0) ^ invert;
1509 snd_ice1712_restore_gpio_status(ice); 1555 snd_ice1712_restore_gpio_status(ice);
1510 return 0; 1556 return 0;
1511} 1557}
1512 1558
1513int snd_ice1712_gpio_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1559int snd_ice1712_gpio_put(struct snd_kcontrol *kcontrol,
1560 struct snd_ctl_elem_value *ucontrol)
1514{ 1561{
1515 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1562 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1516 int shift = kcontrol->private_value & 0xff; 1563 int shift = kcontrol->private_value & 0xff;
1517 int invert = (kcontrol->private_value & (1<<24)) ? mask : 0; 1564 int invert = (kcontrol->private_value & (1<<24)) ? mask : 0;
1518 unsigned int val, nval; 1565 unsigned int val, nval;
@@ -1533,7 +1580,8 @@ int snd_ice1712_gpio_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucont
1533/* 1580/*
1534 * rate 1581 * rate
1535 */ 1582 */
1536static int snd_vt1724_pro_internal_clock_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1583static int snd_vt1724_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
1584 struct snd_ctl_elem_info *uinfo)
1537{ 1585{
1538 static char *texts_1724[] = { 1586 static char *texts_1724[] = {
1539 "8000", /* 0: 6 */ 1587 "8000", /* 0: 6 */
@@ -1569,7 +1617,7 @@ static int snd_vt1724_pro_internal_clock_info(snd_kcontrol_t *kcontrol, snd_ctl_
1569 "96000", /* 12: 7 */ 1617 "96000", /* 12: 7 */
1570 "IEC958 Input", /* 13: -- */ 1618 "IEC958 Input", /* 13: -- */
1571 }; 1619 };
1572 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1620 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1573 1621
1574 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1622 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1575 uinfo->count = 1; 1623 uinfo->count = 1;
@@ -1582,9 +1630,10 @@ static int snd_vt1724_pro_internal_clock_info(snd_kcontrol_t *kcontrol, snd_ctl_
1582 return 0; 1630 return 0;
1583} 1631}
1584 1632
1585static int snd_vt1724_pro_internal_clock_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1633static int snd_vt1724_pro_internal_clock_get(struct snd_kcontrol *kcontrol,
1634 struct snd_ctl_elem_value *ucontrol)
1586{ 1635{
1587 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1636 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1588 static unsigned char xlate[16] = { 1637 static unsigned char xlate[16] = {
1589 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 13, 255, 14, 10 1638 9, 6, 3, 1, 7, 4, 0, 12, 8, 5, 2, 11, 13, 255, 14, 10
1590 }; 1639 };
@@ -1605,9 +1654,10 @@ static int snd_vt1724_pro_internal_clock_get(snd_kcontrol_t * kcontrol, snd_ctl_
1605 return 0; 1654 return 0;
1606} 1655}
1607 1656
1608static int snd_vt1724_pro_internal_clock_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1657static int snd_vt1724_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
1658 struct snd_ctl_elem_value *ucontrol)
1609{ 1659{
1610 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1660 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1611 unsigned char oval; 1661 unsigned char oval;
1612 int rate; 1662 int rate;
1613 int change = 0; 1663 int change = 0;
@@ -1629,7 +1679,8 @@ static int snd_vt1724_pro_internal_clock_put(snd_kcontrol_t * kcontrol, snd_ctl_
1629 change = inb(ICEMT1724(ice, RATE)) != oval; 1679 change = inb(ICEMT1724(ice, RATE)) != oval;
1630 spin_unlock_irq(&ice->reg_lock); 1680 spin_unlock_irq(&ice->reg_lock);
1631 1681
1632 if ((oval & VT1724_SPDIF_MASTER) != (inb(ICEMT1724(ice, RATE)) & VT1724_SPDIF_MASTER)) { 1682 if ((oval & VT1724_SPDIF_MASTER) !=
1683 (inb(ICEMT1724(ice, RATE)) & VT1724_SPDIF_MASTER)) {
1633 /* notify akm chips as well */ 1684 /* notify akm chips as well */
1634 if (is_spdif_master(ice)) { 1685 if (is_spdif_master(ice)) {
1635 unsigned int i; 1686 unsigned int i;
@@ -1642,7 +1693,7 @@ static int snd_vt1724_pro_internal_clock_put(snd_kcontrol_t * kcontrol, snd_ctl_
1642 return change; 1693 return change;
1643} 1694}
1644 1695
1645static snd_kcontrol_new_t snd_vt1724_pro_internal_clock __devinitdata = { 1696static struct snd_kcontrol_new snd_vt1724_pro_internal_clock __devinitdata = {
1646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1647 .name = "Multi Track Internal Clock", 1698 .name = "Multi Track Internal Clock",
1648 .info = snd_vt1724_pro_internal_clock_info, 1699 .info = snd_vt1724_pro_internal_clock_info,
@@ -1650,7 +1701,8 @@ static snd_kcontrol_new_t snd_vt1724_pro_internal_clock __devinitdata = {
1650 .put = snd_vt1724_pro_internal_clock_put 1701 .put = snd_vt1724_pro_internal_clock_put
1651}; 1702};
1652 1703
1653static int snd_vt1724_pro_rate_locking_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1704static int snd_vt1724_pro_rate_locking_info(struct snd_kcontrol *kcontrol,
1705 struct snd_ctl_elem_info *uinfo)
1654{ 1706{
1655 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1707 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1656 uinfo->count = 1; 1708 uinfo->count = 1;
@@ -1659,15 +1711,17 @@ static int snd_vt1724_pro_rate_locking_info(snd_kcontrol_t *kcontrol, snd_ctl_el
1659 return 0; 1711 return 0;
1660} 1712}
1661 1713
1662static int snd_vt1724_pro_rate_locking_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1714static int snd_vt1724_pro_rate_locking_get(struct snd_kcontrol *kcontrol,
1715 struct snd_ctl_elem_value *ucontrol)
1663{ 1716{
1664 ucontrol->value.integer.value[0] = PRO_RATE_LOCKED; 1717 ucontrol->value.integer.value[0] = PRO_RATE_LOCKED;
1665 return 0; 1718 return 0;
1666} 1719}
1667 1720
1668static int snd_vt1724_pro_rate_locking_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1721static int snd_vt1724_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
1722 struct snd_ctl_elem_value *ucontrol)
1669{ 1723{
1670 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1724 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1671 int change = 0, nval; 1725 int change = 0, nval;
1672 1726
1673 nval = ucontrol->value.integer.value[0] ? 1 : 0; 1727 nval = ucontrol->value.integer.value[0] ? 1 : 0;
@@ -1678,7 +1732,7 @@ static int snd_vt1724_pro_rate_locking_put(snd_kcontrol_t * kcontrol, snd_ctl_el
1678 return change; 1732 return change;
1679} 1733}
1680 1734
1681static snd_kcontrol_new_t snd_vt1724_pro_rate_locking __devinitdata = { 1735static struct snd_kcontrol_new snd_vt1724_pro_rate_locking __devinitdata = {
1682 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1736 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1683 .name = "Multi Track Rate Locking", 1737 .name = "Multi Track Rate Locking",
1684 .info = snd_vt1724_pro_rate_locking_info, 1738 .info = snd_vt1724_pro_rate_locking_info,
@@ -1686,7 +1740,8 @@ static snd_kcontrol_new_t snd_vt1724_pro_rate_locking __devinitdata = {
1686 .put = snd_vt1724_pro_rate_locking_put 1740 .put = snd_vt1724_pro_rate_locking_put
1687}; 1741};
1688 1742
1689static int snd_vt1724_pro_rate_reset_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1743static int snd_vt1724_pro_rate_reset_info(struct snd_kcontrol *kcontrol,
1744 struct snd_ctl_elem_info *uinfo)
1690{ 1745{
1691 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1746 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1692 uinfo->count = 1; 1747 uinfo->count = 1;
@@ -1695,15 +1750,17 @@ static int snd_vt1724_pro_rate_reset_info(snd_kcontrol_t *kcontrol, snd_ctl_elem
1695 return 0; 1750 return 0;
1696} 1751}
1697 1752
1698static int snd_vt1724_pro_rate_reset_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1753static int snd_vt1724_pro_rate_reset_get(struct snd_kcontrol *kcontrol,
1754 struct snd_ctl_elem_value *ucontrol)
1699{ 1755{
1700 ucontrol->value.integer.value[0] = PRO_RATE_RESET ? 1 : 0; 1756 ucontrol->value.integer.value[0] = PRO_RATE_RESET ? 1 : 0;
1701 return 0; 1757 return 0;
1702} 1758}
1703 1759
1704static int snd_vt1724_pro_rate_reset_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1760static int snd_vt1724_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
1761 struct snd_ctl_elem_value *ucontrol)
1705{ 1762{
1706 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1763 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1707 int change = 0, nval; 1764 int change = 0, nval;
1708 1765
1709 nval = ucontrol->value.integer.value[0] ? 1 : 0; 1766 nval = ucontrol->value.integer.value[0] ? 1 : 0;
@@ -1714,7 +1771,7 @@ static int snd_vt1724_pro_rate_reset_put(snd_kcontrol_t * kcontrol, snd_ctl_elem
1714 return change; 1771 return change;
1715} 1772}
1716 1773
1717static snd_kcontrol_new_t snd_vt1724_pro_rate_reset __devinitdata = { 1774static struct snd_kcontrol_new snd_vt1724_pro_rate_reset __devinitdata = {
1718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1719 .name = "Multi Track Rate Reset", 1776 .name = "Multi Track Rate Reset",
1720 .info = snd_vt1724_pro_rate_reset_info, 1777 .info = snd_vt1724_pro_rate_reset_info,
@@ -1726,7 +1783,8 @@ static snd_kcontrol_new_t snd_vt1724_pro_rate_reset __devinitdata = {
1726/* 1783/*
1727 * routing 1784 * routing
1728 */ 1785 */
1729static int snd_vt1724_pro_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1786static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol,
1787 struct snd_ctl_elem_info *uinfo)
1730{ 1788{
1731 static char *texts[] = { 1789 static char *texts[] = {
1732 "PCM Out", /* 0 */ 1790 "PCM Out", /* 0 */
@@ -1753,7 +1811,7 @@ static inline int digital_route_shift(int idx)
1753 return idx * 3; 1811 return idx * 3;
1754} 1812}
1755 1813
1756static int get_route_val(ice1712_t *ice, int shift) 1814static int get_route_val(struct snd_ice1712 *ice, int shift)
1757{ 1815{
1758 unsigned long val; 1816 unsigned long val;
1759 unsigned char eitem; 1817 unsigned char eitem;
@@ -1772,7 +1830,7 @@ static int get_route_val(ice1712_t *ice, int shift)
1772 return eitem; 1830 return eitem;
1773} 1831}
1774 1832
1775static int put_route_val(ice1712_t *ice, unsigned int val, int shift) 1833static int put_route_val(struct snd_ice1712 *ice, unsigned int val, int shift)
1776{ 1834{
1777 unsigned int old_val, nval; 1835 unsigned int old_val, nval;
1778 int change; 1836 int change;
@@ -1794,39 +1852,45 @@ static int put_route_val(ice1712_t *ice, unsigned int val, int shift)
1794 return change; 1852 return change;
1795} 1853}
1796 1854
1797static int snd_vt1724_pro_route_analog_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) 1855static int snd_vt1724_pro_route_analog_get(struct snd_kcontrol *kcontrol,
1856 struct snd_ctl_elem_value *ucontrol)
1798{ 1857{
1799 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1858 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1800 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1859 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1801 ucontrol->value.enumerated.item[0] = get_route_val(ice, analog_route_shift(idx)); 1860 ucontrol->value.enumerated.item[0] =
1861 get_route_val(ice, analog_route_shift(idx));
1802 return 0; 1862 return 0;
1803} 1863}
1804 1864
1805static int snd_vt1724_pro_route_analog_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) 1865static int snd_vt1724_pro_route_analog_put(struct snd_kcontrol *kcontrol,
1866 struct snd_ctl_elem_value *ucontrol)
1806{ 1867{
1807 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1868 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1808 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1869 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1809 return put_route_val(ice, ucontrol->value.enumerated.item[0], 1870 return put_route_val(ice, ucontrol->value.enumerated.item[0],
1810 analog_route_shift(idx)); 1871 analog_route_shift(idx));
1811} 1872}
1812 1873
1813static int snd_vt1724_pro_route_spdif_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) 1874static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol,
1875 struct snd_ctl_elem_value *ucontrol)
1814{ 1876{
1815 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1877 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1816 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1878 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1817 ucontrol->value.enumerated.item[0] = get_route_val(ice, digital_route_shift(idx)); 1879 ucontrol->value.enumerated.item[0] =
1880 get_route_val(ice, digital_route_shift(idx));
1818 return 0; 1881 return 0;
1819} 1882}
1820 1883
1821static int snd_vt1724_pro_route_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) 1884static int snd_vt1724_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
1885 struct snd_ctl_elem_value *ucontrol)
1822{ 1886{
1823 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1887 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1824 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1888 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1825 return put_route_val(ice, ucontrol->value.enumerated.item[0], 1889 return put_route_val(ice, ucontrol->value.enumerated.item[0],
1826 digital_route_shift(idx)); 1890 digital_route_shift(idx));
1827} 1891}
1828 1892
1829static snd_kcontrol_new_t snd_vt1724_mixer_pro_analog_route __devinitdata = { 1893static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = {
1830 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1831 .name = "H/W Playback Route", 1895 .name = "H/W Playback Route",
1832 .info = snd_vt1724_pro_route_info, 1896 .info = snd_vt1724_pro_route_info,
@@ -1834,7 +1898,7 @@ static snd_kcontrol_new_t snd_vt1724_mixer_pro_analog_route __devinitdata = {
1834 .put = snd_vt1724_pro_route_analog_put, 1898 .put = snd_vt1724_pro_route_analog_put,
1835}; 1899};
1836 1900
1837static snd_kcontrol_new_t snd_vt1724_mixer_pro_spdif_route __devinitdata = { 1901static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = {
1838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1839 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route", 1903 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route",
1840 .info = snd_vt1724_pro_route_info, 1904 .info = snd_vt1724_pro_route_info,
@@ -1844,7 +1908,8 @@ static snd_kcontrol_new_t snd_vt1724_mixer_pro_spdif_route __devinitdata = {
1844}; 1908};
1845 1909
1846 1910
1847static int snd_vt1724_pro_peak_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1911static int snd_vt1724_pro_peak_info(struct snd_kcontrol *kcontrol,
1912 struct snd_ctl_elem_info *uinfo)
1848{ 1913{
1849 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1914 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1850 uinfo->count = 22; /* FIXME: for compatibility with ice1712... */ 1915 uinfo->count = 22; /* FIXME: for compatibility with ice1712... */
@@ -1853,21 +1918,23 @@ static int snd_vt1724_pro_peak_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_
1853 return 0; 1918 return 0;
1854} 1919}
1855 1920
1856static int snd_vt1724_pro_peak_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1921static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol,
1922 struct snd_ctl_elem_value *ucontrol)
1857{ 1923{
1858 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1924 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
1859 int idx; 1925 int idx;
1860 1926
1861 spin_lock_irq(&ice->reg_lock); 1927 spin_lock_irq(&ice->reg_lock);
1862 for (idx = 0; idx < 22; idx++) { 1928 for (idx = 0; idx < 22; idx++) {
1863 outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX)); 1929 outb(idx, ICEMT1724(ice, MONITOR_PEAKINDEX));
1864 ucontrol->value.integer.value[idx] = inb(ICEMT1724(ice, MONITOR_PEAKDATA)); 1930 ucontrol->value.integer.value[idx] =
1931 inb(ICEMT1724(ice, MONITOR_PEAKDATA));
1865 } 1932 }
1866 spin_unlock_irq(&ice->reg_lock); 1933 spin_unlock_irq(&ice->reg_lock);
1867 return 0; 1934 return 0;
1868} 1935}
1869 1936
1870static snd_kcontrol_new_t snd_vt1724_mixer_pro_peak __devinitdata = { 1937static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = {
1871 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1872 .name = "Multi Track Peak", 1939 .name = "Multi Track Peak",
1873 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 1940 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -1897,7 +1964,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
1897/* 1964/*
1898 */ 1965 */
1899 1966
1900static void wait_i2c_busy(ice1712_t *ice) 1967static void wait_i2c_busy(struct snd_ice1712 *ice)
1901{ 1968{
1902 int t = 0x10000; 1969 int t = 0x10000;
1903 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--) 1970 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--)
@@ -1906,7 +1973,8 @@ static void wait_i2c_busy(ice1712_t *ice)
1906 printk(KERN_ERR "ice1724: i2c busy timeout\n"); 1973 printk(KERN_ERR "ice1724: i2c busy timeout\n");
1907} 1974}
1908 1975
1909unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr) 1976unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
1977 unsigned char dev, unsigned char addr)
1910{ 1978{
1911 unsigned char val; 1979 unsigned char val;
1912 1980
@@ -1920,7 +1988,8 @@ unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned ch
1920 return val; 1988 return val;
1921} 1989}
1922 1990
1923void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr, unsigned char data) 1991void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
1992 unsigned char dev, unsigned char addr, unsigned char data)
1924{ 1993{
1925 down(&ice->i2c_mutex); 1994 down(&ice->i2c_mutex);
1926 wait_i2c_busy(ice); 1995 wait_i2c_busy(ice);
@@ -1932,7 +2001,8 @@ void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr,
1932 up(&ice->i2c_mutex); 2001 up(&ice->i2c_mutex);
1933} 2002}
1934 2003
1935static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelname) 2004static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2005 const char *modelname)
1936{ 2006{
1937 const int dev = 0xa0; /* EEPROM device address */ 2007 const int dev = 0xa0; /* EEPROM device address */
1938 unsigned int i, size; 2008 unsigned int i, size;
@@ -1946,13 +2016,19 @@ static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelnam
1946 (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | 2016 (snd_vt1724_read_i2c(ice, dev, 0x01) << 8) |
1947 (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | 2017 (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) |
1948 (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); 2018 (snd_vt1724_read_i2c(ice, dev, 0x03) << 24);
1949 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { 2019 if (ice->eeprom.subvendor == 0 ||
1950 /* invalid subvendor from EEPROM, try the PCI subststem ID instead */ 2020 ice->eeprom.subvendor == (unsigned int)-1) {
2021 /* invalid subvendor from EEPROM, try the PCI
2022 * subststem ID instead
2023 */
1951 u16 vendor, device; 2024 u16 vendor, device;
1952 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor); 2025 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID,
2026 &vendor);
1953 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); 2027 pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device);
1954 ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); 2028 ice->eeprom.subvendor =
1955 if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { 2029 ((unsigned int)swab16(vendor) << 16) | swab16(device);
2030 if (ice->eeprom.subvendor == 0 ||
2031 ice->eeprom.subvendor == (unsigned int)-1) {
1956 printk(KERN_ERR "ice1724: No valid ID is found\n"); 2032 printk(KERN_ERR "ice1724: No valid ID is found\n");
1957 return -ENXIO; 2033 return -ENXIO;
1958 } 2034 }
@@ -1960,8 +2036,10 @@ static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelnam
1960 } 2036 }
1961 for (tbl = card_tables; *tbl; tbl++) { 2037 for (tbl = card_tables; *tbl; tbl++) {
1962 for (c = *tbl; c->subvendor; c++) { 2038 for (c = *tbl; c->subvendor; c++) {
1963 if (modelname && c->model && ! strcmp(modelname, c->model)) { 2039 if (modelname && c->model &&
1964 printk(KERN_INFO "ice1724: Using board model %s\n", c->name); 2040 ! strcmp(modelname, c->model)) {
2041 printk(KERN_INFO "ice1724: Using board model %s\n",
2042 c->name);
1965 ice->eeprom.subvendor = c->subvendor; 2043 ice->eeprom.subvendor = c->subvendor;
1966 } else if (c->subvendor != ice->eeprom.subvendor) 2044 } else if (c->subvendor != ice->eeprom.subvendor)
1967 continue; 2045 continue;
@@ -1975,19 +2053,22 @@ static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelnam
1975 goto read_skipped; 2053 goto read_skipped;
1976 } 2054 }
1977 } 2055 }
1978 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", ice->eeprom.subvendor); 2056 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n",
2057 ice->eeprom.subvendor);
1979 2058
1980 found: 2059 found:
1981 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); 2060 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
1982 if (ice->eeprom.size < 6) 2061 if (ice->eeprom.size < 6)
1983 ice->eeprom.size = 32; 2062 ice->eeprom.size = 32;
1984 else if (ice->eeprom.size > 32) { 2063 else if (ice->eeprom.size > 32) {
1985 printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n", ice->eeprom.size); 2064 printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n",
2065 ice->eeprom.size);
1986 return -EIO; 2066 return -EIO;
1987 } 2067 }
1988 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); 2068 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
1989 if (ice->eeprom.version != 2) 2069 if (ice->eeprom.version != 2)
1990 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", ice->eeprom.version); 2070 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n",
2071 ice->eeprom.version);
1991 size = ice->eeprom.size - 6; 2072 size = ice->eeprom.size - 6;
1992 for (i = 0; i < size; i++) 2073 for (i = 0; i < size; i++)
1993 ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6); 2074 ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6);
@@ -2002,7 +2083,7 @@ static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelnam
2002 2083
2003 2084
2004 2085
2005static int __devinit snd_vt1724_chip_init(ice1712_t *ice) 2086static int __devinit snd_vt1724_chip_init(struct snd_ice1712 *ice)
2006{ 2087{
2007 outb(VT1724_RESET , ICEREG1724(ice, CONTROL)); 2088 outb(VT1724_RESET , ICEREG1724(ice, CONTROL));
2008 udelay(200); 2089 udelay(200);
@@ -2024,10 +2105,10 @@ static int __devinit snd_vt1724_chip_init(ice1712_t *ice)
2024 return 0; 2105 return 0;
2025} 2106}
2026 2107
2027static int __devinit snd_vt1724_spdif_build_controls(ice1712_t *ice) 2108static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
2028{ 2109{
2029 int err; 2110 int err;
2030 snd_kcontrol_t *kctl; 2111 struct snd_kcontrol *kctl;
2031 2112
2032 snd_assert(ice->pcm != NULL, return -EIO); 2113 snd_assert(ice->pcm != NULL, return -EIO);
2033 2114
@@ -2062,7 +2143,7 @@ static int __devinit snd_vt1724_spdif_build_controls(ice1712_t *ice)
2062} 2143}
2063 2144
2064 2145
2065static int __devinit snd_vt1724_build_controls(ice1712_t *ice) 2146static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice)
2066{ 2147{
2067 int err; 2148 int err;
2068 2149
@@ -2081,7 +2162,7 @@ static int __devinit snd_vt1724_build_controls(ice1712_t *ice)
2081 return err; 2162 return err;
2082 2163
2083 if (ice->num_total_dacs > 0) { 2164 if (ice->num_total_dacs > 0) {
2084 snd_kcontrol_new_t tmp = snd_vt1724_mixer_pro_analog_route; 2165 struct snd_kcontrol_new tmp = snd_vt1724_mixer_pro_analog_route;
2085 tmp.count = ice->num_total_dacs; 2166 tmp.count = ice->num_total_dacs;
2086 if (ice->vt1720 && tmp.count > 2) 2167 if (ice->vt1720 && tmp.count > 2)
2087 tmp.count = 2; 2168 tmp.count = 2;
@@ -2097,7 +2178,7 @@ static int __devinit snd_vt1724_build_controls(ice1712_t *ice)
2097 return 0; 2178 return 0;
2098} 2179}
2099 2180
2100static int snd_vt1724_free(ice1712_t *ice) 2181static int snd_vt1724_free(struct snd_ice1712 *ice)
2101{ 2182{
2102 if (! ice->port) 2183 if (! ice->port)
2103 goto __hw_end; 2184 goto __hw_end;
@@ -2108,7 +2189,7 @@ static int snd_vt1724_free(ice1712_t *ice)
2108 __hw_end: 2189 __hw_end:
2109 if (ice->irq >= 0) { 2190 if (ice->irq >= 0) {
2110 synchronize_irq(ice->irq); 2191 synchronize_irq(ice->irq);
2111 free_irq(ice->irq, (void *) ice); 2192 free_irq(ice->irq, ice);
2112 } 2193 }
2113 pci_release_regions(ice->pci); 2194 pci_release_regions(ice->pci);
2114 snd_ice1712_akm4xxx_free(ice); 2195 snd_ice1712_akm4xxx_free(ice);
@@ -2117,21 +2198,21 @@ static int snd_vt1724_free(ice1712_t *ice)
2117 return 0; 2198 return 0;
2118} 2199}
2119 2200
2120static int snd_vt1724_dev_free(snd_device_t *device) 2201static int snd_vt1724_dev_free(struct snd_device *device)
2121{ 2202{
2122 ice1712_t *ice = device->device_data; 2203 struct snd_ice1712 *ice = device->device_data;
2123 return snd_vt1724_free(ice); 2204 return snd_vt1724_free(ice);
2124} 2205}
2125 2206
2126static int __devinit snd_vt1724_create(snd_card_t * card, 2207static int __devinit snd_vt1724_create(struct snd_card *card,
2127 struct pci_dev *pci, 2208 struct pci_dev *pci,
2128 const char *modelname, 2209 const char *modelname,
2129 ice1712_t ** r_ice1712) 2210 struct snd_ice1712 ** r_ice1712)
2130{ 2211{
2131 ice1712_t *ice; 2212 struct snd_ice1712 *ice;
2132 int err; 2213 int err;
2133 unsigned char mask; 2214 unsigned char mask;
2134 static snd_device_ops_t ops = { 2215 static struct snd_device_ops ops = {
2135 .dev_free = snd_vt1724_dev_free, 2216 .dev_free = snd_vt1724_dev_free,
2136 }; 2217 };
2137 2218
@@ -2170,7 +2251,8 @@ static int __devinit snd_vt1724_create(snd_card_t * card,
2170 ice->port = pci_resource_start(pci, 0); 2251 ice->port = pci_resource_start(pci, 0);
2171 ice->profi_port = pci_resource_start(pci, 1); 2252 ice->profi_port = pci_resource_start(pci, 1);
2172 2253
2173 if (request_irq(pci->irq, snd_vt1724_interrupt, SA_INTERRUPT|SA_SHIRQ, "ICE1724", (void *) ice)) { 2254 if (request_irq(pci->irq, snd_vt1724_interrupt,
2255 SA_INTERRUPT|SA_SHIRQ, "ICE1724", ice)) {
2174 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2256 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2175 snd_vt1724_free(ice); 2257 snd_vt1724_free(ice);
2176 return -EIO; 2258 return -EIO;
@@ -2193,7 +2275,9 @@ static int __devinit snd_vt1724_create(snd_card_t * card,
2193 else 2275 else
2194 mask = 0; 2276 mask = 0;
2195 outb(mask, ICEREG1724(ice, IRQMASK)); 2277 outb(mask, ICEREG1724(ice, IRQMASK));
2196 /* don't handle FIFO overrun/underruns (just yet), since they cause machine lockups */ 2278 /* don't handle FIFO overrun/underruns (just yet),
2279 * since they cause machine lockups
2280 */
2197 outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK)); 2281 outb(VT1724_MULTI_FIFO_ERR, ICEMT1724(ice, DMA_INT_MASK));
2198 2282
2199 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops)) < 0) { 2283 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops)) < 0) {
@@ -2218,8 +2302,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
2218 const struct pci_device_id *pci_id) 2302 const struct pci_device_id *pci_id)
2219{ 2303{
2220 static int dev; 2304 static int dev;
2221 snd_card_t *card; 2305 struct snd_card *card;
2222 ice1712_t *ice; 2306 struct snd_ice1712 *ice;
2223 int pcm_dev = 0, err; 2307 int pcm_dev = 0, err;
2224 struct snd_ice1712_card_info **tbl, *c; 2308 struct snd_ice1712_card_info **tbl, *c;
2225 2309