aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:02:23 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:22 -0500
commit74ee4ff1e62d9798361763f152c6f07d491be819 (patch)
tree4790b9498602f38400bc8a371a604ae4fdd4e95c
parent17c39d9a59cbf4b3a51a2694134754fc1d3668e7 (diff)
[ALSA] Remove xxx_t typedefs: PCI ATIIXP
Modules: ATIIXP driver,ATIIXP-modem driver Remove xxx_t typedefs from the PCI ATIIXP and modem drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/atiixp.c295
-rw-r--r--sound/pci/atiixp_modem.c259
2 files changed, 295 insertions, 259 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 36395d0f3d87..5ead66610ed7 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -197,24 +197,18 @@ module_param(enable, bool, 0444);
197#define ATI_MAX_DESCRIPTORS 256 /* max number of descriptor packets */ 197#define ATI_MAX_DESCRIPTORS 256 /* max number of descriptor packets */
198 198
199 199
200/* 200struct atiixp;
201 */
202
203typedef struct snd_atiixp atiixp_t;
204typedef struct snd_atiixp_dma atiixp_dma_t;
205typedef struct snd_atiixp_dma_ops atiixp_dma_ops_t;
206
207 201
208/* 202/*
209 * DMA packate descriptor 203 * DMA packate descriptor
210 */ 204 */
211 205
212typedef struct atiixp_dma_desc { 206struct atiixp_dma_desc {
213 u32 addr; /* DMA buffer address */ 207 u32 addr; /* DMA buffer address */
214 u16 status; /* status bits */ 208 u16 status; /* status bits */
215 u16 size; /* size of the packet in dwords */ 209 u16 size; /* size of the packet in dwords */
216 u32 next; /* address of the next packet descriptor */ 210 u32 next; /* address of the next packet descriptor */
217} atiixp_dma_desc_t; 211};
218 212
219/* 213/*
220 * stream enum 214 * stream enum
@@ -229,22 +223,25 @@ enum { ATI_PCMDEV_ANALOG, ATI_PCMDEV_DIGITAL, NUM_ATI_PCMDEVS }; /* pcm devices
229/* 223/*
230 * constants and callbacks for each DMA type 224 * constants and callbacks for each DMA type
231 */ 225 */
232struct snd_atiixp_dma_ops { 226struct atiixp_dma_ops {
233 int type; /* ATI_DMA_XXX */ 227 int type; /* ATI_DMA_XXX */
234 unsigned int llp_offset; /* LINKPTR offset */ 228 unsigned int llp_offset; /* LINKPTR offset */
235 unsigned int dt_cur; /* DT_CUR offset */ 229 unsigned int dt_cur; /* DT_CUR offset */
236 void (*enable_dma)(atiixp_t *chip, int on); /* called from open callback */ 230 /* called from open callback */
237 void (*enable_transfer)(atiixp_t *chip, int on); /* called from trigger (START/STOP) */ 231 void (*enable_dma)(struct atiixp *chip, int on);
238 void (*flush_dma)(atiixp_t *chip); /* called from trigger (STOP only) */ 232 /* called from trigger (START/STOP) */
233 void (*enable_transfer)(struct atiixp *chip, int on);
234 /* called from trigger (STOP only) */
235 void (*flush_dma)(struct atiixp *chip);
239}; 236};
240 237
241/* 238/*
242 * DMA stream 239 * DMA stream
243 */ 240 */
244struct snd_atiixp_dma { 241struct atiixp_dma {
245 const atiixp_dma_ops_t *ops; 242 const struct atiixp_dma_ops *ops;
246 struct snd_dma_buffer desc_buf; 243 struct snd_dma_buffer desc_buf;
247 snd_pcm_substream_t *substream; /* assigned PCM substream */ 244 struct snd_pcm_substream *substream; /* assigned PCM substream */
248 unsigned int buf_addr, buf_bytes; /* DMA buffer address, bytes */ 245 unsigned int buf_addr, buf_bytes; /* DMA buffer address, bytes */
249 unsigned int period_bytes, periods; 246 unsigned int period_bytes, periods;
250 int opened; 247 int opened;
@@ -258,22 +255,22 @@ struct snd_atiixp_dma {
258/* 255/*
259 * ATI IXP chip 256 * ATI IXP chip
260 */ 257 */
261struct snd_atiixp { 258struct atiixp {
262 snd_card_t *card; 259 struct snd_card *card;
263 struct pci_dev *pci; 260 struct pci_dev *pci;
264 261
265 unsigned long addr; 262 unsigned long addr;
266 void __iomem *remap_addr; 263 void __iomem *remap_addr;
267 int irq; 264 int irq;
268 265
269 ac97_bus_t *ac97_bus; 266 struct snd_ac97_bus *ac97_bus;
270 ac97_t *ac97[NUM_ATI_CODECS]; 267 struct snd_ac97 *ac97[NUM_ATI_CODECS];
271 268
272 spinlock_t reg_lock; 269 spinlock_t reg_lock;
273 270
274 atiixp_dma_t dmas[NUM_ATI_DMAS]; 271 struct atiixp_dma dmas[NUM_ATI_DMAS];
275 struct ac97_pcm *pcms[NUM_ATI_PCMS]; 272 struct ac97_pcm *pcms[NUM_ATI_PCMS];
276 snd_pcm_t *pcmdevs[NUM_ATI_PCMDEVS]; 273 struct snd_pcm *pcmdevs[NUM_ATI_PCMDEVS];
277 274
278 int max_channels; /* max. channels for PCM out */ 275 int max_channels; /* max. channels for PCM out */
279 276
@@ -304,7 +301,7 @@ MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
304 * update the bits of the given register. 301 * update the bits of the given register.
305 * return 1 if the bits changed. 302 * return 1 if the bits changed.
306 */ 303 */
307static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, 304static int snd_atiixp_update_bits(struct atiixp *chip, unsigned int reg,
308 unsigned int mask, unsigned int value) 305 unsigned int mask, unsigned int value)
309{ 306{
310 void __iomem *addr = chip->remap_addr + reg; 307 void __iomem *addr = chip->remap_addr + reg;
@@ -336,7 +333,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
336 */ 333 */
337 334
338#define ATI_DESC_LIST_SIZE \ 335#define ATI_DESC_LIST_SIZE \
339 PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(atiixp_dma_desc_t)) 336 PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(struct atiixp_dma_desc))
340 337
341/* 338/*
342 * build packets ring for the given buffer size. 339 * build packets ring for the given buffer size.
@@ -347,10 +344,10 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
347 * 344 *
348 * the ring is built in this function, and is set up to the hardware. 345 * the ring is built in this function, and is set up to the hardware.
349 */ 346 */
350static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, 347static int atiixp_build_dma_packets(struct atiixp *chip, struct atiixp_dma *dma,
351 snd_pcm_substream_t *substream, 348 struct snd_pcm_substream *substream,
352 unsigned int periods, 349 unsigned int periods,
353 unsigned int period_bytes) 350 unsigned int period_bytes)
354{ 351{
355 unsigned int i; 352 unsigned int i;
356 u32 addr, desc_addr; 353 u32 addr, desc_addr;
@@ -360,8 +357,10 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
360 return -ENOMEM; 357 return -ENOMEM;
361 358
362 if (dma->desc_buf.area == NULL) { 359 if (dma->desc_buf.area == NULL) {
363 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 360 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
364 ATI_DESC_LIST_SIZE, &dma->desc_buf) < 0) 361 snd_dma_pci_data(chip->pci),
362 ATI_DESC_LIST_SIZE,
363 &dma->desc_buf) < 0)
365 return -ENOMEM; 364 return -ENOMEM;
366 dma->period_bytes = dma->periods = 0; /* clear */ 365 dma->period_bytes = dma->periods = 0; /* clear */
367 } 366 }
@@ -380,11 +379,12 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
380 addr = (u32)substream->runtime->dma_addr; 379 addr = (u32)substream->runtime->dma_addr;
381 desc_addr = (u32)dma->desc_buf.addr; 380 desc_addr = (u32)dma->desc_buf.addr;
382 for (i = 0; i < periods; i++) { 381 for (i = 0; i < periods; i++) {
383 atiixp_dma_desc_t *desc = &((atiixp_dma_desc_t *)dma->desc_buf.area)[i]; 382 struct atiixp_dma_desc *desc;
383 desc = &((struct atiixp_dma_desc *)dma->desc_buf.area)[i];
384 desc->addr = cpu_to_le32(addr); 384 desc->addr = cpu_to_le32(addr);
385 desc->status = 0; 385 desc->status = 0;
386 desc->size = period_bytes >> 2; /* in dwords */ 386 desc->size = period_bytes >> 2; /* in dwords */
387 desc_addr += sizeof(atiixp_dma_desc_t); 387 desc_addr += sizeof(struct atiixp_dma_desc);
388 if (i == periods - 1) 388 if (i == periods - 1)
389 desc->next = cpu_to_le32((u32)dma->desc_buf.addr); 389 desc->next = cpu_to_le32((u32)dma->desc_buf.addr);
390 else 390 else
@@ -404,7 +404,8 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
404/* 404/*
405 * remove the ring buffer and release it if assigned 405 * remove the ring buffer and release it if assigned
406 */ 406 */
407static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_substream_t *substream) 407static void atiixp_clear_dma_packets(struct atiixp *chip, struct atiixp_dma *dma,
408 struct snd_pcm_substream *substream)
408{ 409{
409 if (dma->desc_buf.area) { 410 if (dma->desc_buf.area) {
410 writel(0, chip->remap_addr + dma->ops->llp_offset); 411 writel(0, chip->remap_addr + dma->ops->llp_offset);
@@ -416,7 +417,7 @@ static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_
416/* 417/*
417 * AC97 interface 418 * AC97 interface
418 */ 419 */
419static int snd_atiixp_acquire_codec(atiixp_t *chip) 420static int snd_atiixp_acquire_codec(struct atiixp *chip)
420{ 421{
421 int timeout = 1000; 422 int timeout = 1000;
422 423
@@ -430,7 +431,7 @@ static int snd_atiixp_acquire_codec(atiixp_t *chip)
430 return 0; 431 return 0;
431} 432}
432 433
433static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec, unsigned short reg) 434static unsigned short snd_atiixp_codec_read(struct atiixp *chip, unsigned short codec, unsigned short reg)
434{ 435{
435 unsigned int data; 436 unsigned int data;
436 int timeout; 437 int timeout;
@@ -458,7 +459,8 @@ static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec
458} 459}
459 460
460 461
461static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigned short reg, unsigned short val) 462static void snd_atiixp_codec_write(struct atiixp *chip, unsigned short codec,
463 unsigned short reg, unsigned short val)
462{ 464{
463 unsigned int data; 465 unsigned int data;
464 466
@@ -471,23 +473,25 @@ static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigne
471} 473}
472 474
473 475
474static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg) 476static unsigned short snd_atiixp_ac97_read(struct snd_ac97 *ac97,
477 unsigned short reg)
475{ 478{
476 atiixp_t *chip = ac97->private_data; 479 struct atiixp *chip = ac97->private_data;
477 return snd_atiixp_codec_read(chip, ac97->num, reg); 480 return snd_atiixp_codec_read(chip, ac97->num, reg);
478 481
479} 482}
480 483
481static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) 484static void snd_atiixp_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
485 unsigned short val)
482{ 486{
483 atiixp_t *chip = ac97->private_data; 487 struct atiixp *chip = ac97->private_data;
484 snd_atiixp_codec_write(chip, ac97->num, reg, val); 488 snd_atiixp_codec_write(chip, ac97->num, reg, val);
485} 489}
486 490
487/* 491/*
488 * reset AC link 492 * reset AC link
489 */ 493 */
490static int snd_atiixp_aclink_reset(atiixp_t *chip) 494static int snd_atiixp_aclink_reset(struct atiixp *chip)
491{ 495{
492 int timeout; 496 int timeout;
493 497
@@ -507,7 +511,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip)
507 atiixp_update(chip, CMD, ATI_REG_CMD_AC_SYNC|ATI_REG_CMD_AC_RESET, 511 atiixp_update(chip, CMD, ATI_REG_CMD_AC_SYNC|ATI_REG_CMD_AC_RESET,
508 ATI_REG_CMD_AC_SYNC); 512 ATI_REG_CMD_AC_SYNC);
509 atiixp_read(chip, CMD); 513 atiixp_read(chip, CMD);
510 msleep(1); 514 mdelay(1);
511 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET); 515 atiixp_update(chip, CMD, ATI_REG_CMD_AC_RESET, ATI_REG_CMD_AC_RESET);
512 if (--timeout) { 516 if (--timeout) {
513 snd_printk(KERN_ERR "atiixp: codec reset timeout\n"); 517 snd_printk(KERN_ERR "atiixp: codec reset timeout\n");
@@ -523,7 +527,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip)
523} 527}
524 528
525#ifdef CONFIG_PM 529#ifdef CONFIG_PM
526static int snd_atiixp_aclink_down(atiixp_t *chip) 530static int snd_atiixp_aclink_down(struct atiixp *chip)
527{ 531{
528 // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ 532 // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */
529 // return -EBUSY; 533 // return -EBUSY;
@@ -548,7 +552,7 @@ static int snd_atiixp_aclink_down(atiixp_t *chip)
548 ATI_REG_ISR_CODEC2_NOT_READY) 552 ATI_REG_ISR_CODEC2_NOT_READY)
549#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME) 553#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME)
550 554
551static int snd_atiixp_codec_detect(atiixp_t *chip) 555static int snd_atiixp_codec_detect(struct atiixp *chip)
552{ 556{
553 int timeout; 557 int timeout;
554 558
@@ -557,7 +561,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip)
557 /* wait for the interrupts */ 561 /* wait for the interrupts */
558 timeout = 50; 562 timeout = 50;
559 while (timeout-- > 0) { 563 while (timeout-- > 0) {
560 msleep(1); 564 mdelay(1);
561 if (chip->codec_not_ready_bits) 565 if (chip->codec_not_ready_bits)
562 break; 566 break;
563 } 567 }
@@ -574,7 +578,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip)
574/* 578/*
575 * enable DMA and irqs 579 * enable DMA and irqs
576 */ 580 */
577static int snd_atiixp_chip_start(atiixp_t *chip) 581static int snd_atiixp_chip_start(struct atiixp *chip)
578{ 582{
579 unsigned int reg; 583 unsigned int reg;
580 584
@@ -604,7 +608,7 @@ static int snd_atiixp_chip_start(atiixp_t *chip)
604/* 608/*
605 * disable DMA and IRQs 609 * disable DMA and IRQs
606 */ 610 */
607static int snd_atiixp_chip_stop(atiixp_t *chip) 611static int snd_atiixp_chip_stop(struct atiixp *chip)
608{ 612{
609 /* clear interrupt source */ 613 /* clear interrupt source */
610 atiixp_write(chip, ISR, atiixp_read(chip, ISR)); 614 atiixp_write(chip, ISR, atiixp_read(chip, ISR));
@@ -623,11 +627,11 @@ static int snd_atiixp_chip_stop(atiixp_t *chip)
623 * position. when SG-buffer is implemented, the offset must be calculated 627 * position. when SG-buffer is implemented, the offset must be calculated
624 * correctly... 628 * correctly...
625 */ 629 */
626static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream) 630static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream)
627{ 631{
628 atiixp_t *chip = snd_pcm_substream_chip(substream); 632 struct atiixp *chip = snd_pcm_substream_chip(substream);
629 snd_pcm_runtime_t *runtime = substream->runtime; 633 struct snd_pcm_runtime *runtime = substream->runtime;
630 atiixp_dma_t *dma = (atiixp_dma_t *)runtime->private_data; 634 struct atiixp_dma *dma = runtime->private_data;
631 unsigned int curptr; 635 unsigned int curptr;
632 int timeout = 1000; 636 int timeout = 1000;
633 637
@@ -648,7 +652,7 @@ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream)
648/* 652/*
649 * XRUN detected, and stop the PCM substream 653 * XRUN detected, and stop the PCM substream
650 */ 654 */
651static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma) 655static void snd_atiixp_xrun_dma(struct atiixp *chip, struct atiixp_dma *dma)
652{ 656{
653 if (! dma->substream || ! dma->running) 657 if (! dma->substream || ! dma->running)
654 return; 658 return;
@@ -659,7 +663,7 @@ static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
659/* 663/*
660 * the period ack. update the substream. 664 * the period ack. update the substream.
661 */ 665 */
662static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma) 666static void snd_atiixp_update_dma(struct atiixp *chip, struct atiixp_dma *dma)
663{ 667{
664 if (! dma->substream || ! dma->running) 668 if (! dma->substream || ! dma->running)
665 return; 669 return;
@@ -668,7 +672,7 @@ static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma)
668 672
669/* set BUS_BUSY interrupt bit if any DMA is running */ 673/* set BUS_BUSY interrupt bit if any DMA is running */
670/* call with spinlock held */ 674/* call with spinlock held */
671static void snd_atiixp_check_bus_busy(atiixp_t *chip) 675static void snd_atiixp_check_bus_busy(struct atiixp *chip)
672{ 676{
673 unsigned int bus_busy; 677 unsigned int bus_busy;
674 if (atiixp_read(chip, CMD) & (ATI_REG_CMD_SEND_EN | 678 if (atiixp_read(chip, CMD) & (ATI_REG_CMD_SEND_EN |
@@ -683,10 +687,10 @@ static void snd_atiixp_check_bus_busy(atiixp_t *chip)
683/* common trigger callback 687/* common trigger callback
684 * calling the lowlevel callbacks in it 688 * calling the lowlevel callbacks in it
685 */ 689 */
686static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 690static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
687{ 691{
688 atiixp_t *chip = snd_pcm_substream_chip(substream); 692 struct atiixp *chip = snd_pcm_substream_chip(substream);
689 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 693 struct atiixp_dma *dma = substream->runtime->private_data;
690 int err = 0; 694 int err = 0;
691 695
692 snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL); 696 snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
@@ -730,13 +734,13 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
730 */ 734 */
731 735
732/* flush FIFO of analog OUT DMA */ 736/* flush FIFO of analog OUT DMA */
733static void atiixp_out_flush_dma(atiixp_t *chip) 737static void atiixp_out_flush_dma(struct atiixp *chip)
734{ 738{
735 atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_OUT_FLUSH); 739 atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_OUT_FLUSH);
736} 740}
737 741
738/* enable/disable analog OUT DMA */ 742/* enable/disable analog OUT DMA */
739static void atiixp_out_enable_dma(atiixp_t *chip, int on) 743static void atiixp_out_enable_dma(struct atiixp *chip, int on)
740{ 744{
741 unsigned int data; 745 unsigned int data;
742 data = atiixp_read(chip, CMD); 746 data = atiixp_read(chip, CMD);
@@ -751,21 +755,21 @@ static void atiixp_out_enable_dma(atiixp_t *chip, int on)
751} 755}
752 756
753/* start/stop transfer over OUT DMA */ 757/* start/stop transfer over OUT DMA */
754static void atiixp_out_enable_transfer(atiixp_t *chip, int on) 758static void atiixp_out_enable_transfer(struct atiixp *chip, int on)
755{ 759{
756 atiixp_update(chip, CMD, ATI_REG_CMD_SEND_EN, 760 atiixp_update(chip, CMD, ATI_REG_CMD_SEND_EN,
757 on ? ATI_REG_CMD_SEND_EN : 0); 761 on ? ATI_REG_CMD_SEND_EN : 0);
758} 762}
759 763
760/* enable/disable analog IN DMA */ 764/* enable/disable analog IN DMA */
761static void atiixp_in_enable_dma(atiixp_t *chip, int on) 765static void atiixp_in_enable_dma(struct atiixp *chip, int on)
762{ 766{
763 atiixp_update(chip, CMD, ATI_REG_CMD_IN_DMA_EN, 767 atiixp_update(chip, CMD, ATI_REG_CMD_IN_DMA_EN,
764 on ? ATI_REG_CMD_IN_DMA_EN : 0); 768 on ? ATI_REG_CMD_IN_DMA_EN : 0);
765} 769}
766 770
767/* start/stop analog IN DMA */ 771/* start/stop analog IN DMA */
768static void atiixp_in_enable_transfer(atiixp_t *chip, int on) 772static void atiixp_in_enable_transfer(struct atiixp *chip, int on)
769{ 773{
770 if (on) { 774 if (on) {
771 unsigned int data = atiixp_read(chip, CMD); 775 unsigned int data = atiixp_read(chip, CMD);
@@ -784,20 +788,20 @@ static void atiixp_in_enable_transfer(atiixp_t *chip, int on)
784} 788}
785 789
786/* flush FIFO of analog IN DMA */ 790/* flush FIFO of analog IN DMA */
787static void atiixp_in_flush_dma(atiixp_t *chip) 791static void atiixp_in_flush_dma(struct atiixp *chip)
788{ 792{
789 atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_IN_FLUSH); 793 atiixp_write(chip, FIFO_FLUSH, ATI_REG_FIFO_IN_FLUSH);
790} 794}
791 795
792/* enable/disable SPDIF OUT DMA */ 796/* enable/disable SPDIF OUT DMA */
793static void atiixp_spdif_enable_dma(atiixp_t *chip, int on) 797static void atiixp_spdif_enable_dma(struct atiixp *chip, int on)
794{ 798{
795 atiixp_update(chip, CMD, ATI_REG_CMD_SPDF_DMA_EN, 799 atiixp_update(chip, CMD, ATI_REG_CMD_SPDF_DMA_EN,
796 on ? ATI_REG_CMD_SPDF_DMA_EN : 0); 800 on ? ATI_REG_CMD_SPDF_DMA_EN : 0);
797} 801}
798 802
799/* start/stop SPDIF OUT DMA */ 803/* start/stop SPDIF OUT DMA */
800static void atiixp_spdif_enable_transfer(atiixp_t *chip, int on) 804static void atiixp_spdif_enable_transfer(struct atiixp *chip, int on)
801{ 805{
802 unsigned int data; 806 unsigned int data;
803 data = atiixp_read(chip, CMD); 807 data = atiixp_read(chip, CMD);
@@ -809,7 +813,7 @@ static void atiixp_spdif_enable_transfer(atiixp_t *chip, int on)
809} 813}
810 814
811/* flush FIFO of SPDIF OUT DMA */ 815/* flush FIFO of SPDIF OUT DMA */
812static void atiixp_spdif_flush_dma(atiixp_t *chip) 816static void atiixp_spdif_flush_dma(struct atiixp *chip)
813{ 817{
814 int timeout; 818 int timeout;
815 819
@@ -828,9 +832,9 @@ static void atiixp_spdif_flush_dma(atiixp_t *chip)
828} 832}
829 833
830/* set up slots and formats for SPDIF OUT */ 834/* set up slots and formats for SPDIF OUT */
831static int snd_atiixp_spdif_prepare(snd_pcm_substream_t *substream) 835static int snd_atiixp_spdif_prepare(struct snd_pcm_substream *substream)
832{ 836{
833 atiixp_t *chip = snd_pcm_substream_chip(substream); 837 struct atiixp *chip = snd_pcm_substream_chip(substream);
834 838
835 spin_lock_irq(&chip->reg_lock); 839 spin_lock_irq(&chip->reg_lock);
836 if (chip->spdif_over_aclink) { 840 if (chip->spdif_over_aclink) {
@@ -855,9 +859,9 @@ static int snd_atiixp_spdif_prepare(snd_pcm_substream_t *substream)
855} 859}
856 860
857/* set up slots and formats for analog OUT */ 861/* set up slots and formats for analog OUT */
858static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream) 862static int snd_atiixp_playback_prepare(struct snd_pcm_substream *substream)
859{ 863{
860 atiixp_t *chip = snd_pcm_substream_chip(substream); 864 struct atiixp *chip = snd_pcm_substream_chip(substream);
861 unsigned int data; 865 unsigned int data;
862 866
863 spin_lock_irq(&chip->reg_lock); 867 spin_lock_irq(&chip->reg_lock);
@@ -900,9 +904,9 @@ static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream)
900} 904}
901 905
902/* set up slots and formats for analog IN */ 906/* set up slots and formats for analog IN */
903static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream) 907static int snd_atiixp_capture_prepare(struct snd_pcm_substream *substream)
904{ 908{
905 atiixp_t *chip = snd_pcm_substream_chip(substream); 909 struct atiixp *chip = snd_pcm_substream_chip(substream);
906 910
907 spin_lock_irq(&chip->reg_lock); 911 spin_lock_irq(&chip->reg_lock);
908 atiixp_update(chip, CMD, ATI_REG_CMD_INTERLEAVE_IN, 912 atiixp_update(chip, CMD, ATI_REG_CMD_INTERLEAVE_IN,
@@ -915,11 +919,11 @@ static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream)
915/* 919/*
916 * hw_params - allocate the buffer and set up buffer descriptors 920 * hw_params - allocate the buffer and set up buffer descriptors
917 */ 921 */
918static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream, 922static int snd_atiixp_pcm_hw_params(struct snd_pcm_substream *substream,
919 snd_pcm_hw_params_t *hw_params) 923 struct snd_pcm_hw_params *hw_params)
920{ 924{
921 atiixp_t *chip = snd_pcm_substream_chip(substream); 925 struct atiixp *chip = snd_pcm_substream_chip(substream);
922 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 926 struct atiixp_dma *dma = substream->runtime->private_data;
923 int err; 927 int err;
924 928
925 err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 929 err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
@@ -953,10 +957,10 @@ static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
953 return err; 957 return err;
954} 958}
955 959
956static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream) 960static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream)
957{ 961{
958 atiixp_t *chip = snd_pcm_substream_chip(substream); 962 struct atiixp *chip = snd_pcm_substream_chip(substream);
959 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 963 struct atiixp_dma *dma = substream->runtime->private_data;
960 964
961 if (dma->pcm_open_flag) { 965 if (dma->pcm_open_flag) {
962 struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type]; 966 struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type];
@@ -972,7 +976,7 @@ static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream)
972/* 976/*
973 * pcm hardware definition, identical for all DMA types 977 * pcm hardware definition, identical for all DMA types
974 */ 978 */
975static snd_pcm_hardware_t snd_atiixp_pcm_hw = 979static struct snd_pcm_hardware snd_atiixp_pcm_hw =
976{ 980{
977 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 981 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
978 SNDRV_PCM_INFO_BLOCK_TRANSFER | 982 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -992,10 +996,11 @@ static snd_pcm_hardware_t snd_atiixp_pcm_hw =
992 .periods_max = ATI_MAX_DESCRIPTORS, 996 .periods_max = ATI_MAX_DESCRIPTORS,
993}; 997};
994 998
995static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma, int pcm_type) 999static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
1000 struct atiixp_dma *dma, int pcm_type)
996{ 1001{
997 atiixp_t *chip = snd_pcm_substream_chip(substream); 1002 struct atiixp *chip = snd_pcm_substream_chip(substream);
998 snd_pcm_runtime_t *runtime = substream->runtime; 1003 struct snd_pcm_runtime *runtime = substream->runtime;
999 int err; 1004 int err;
1000 1005
1001 snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL); 1006 snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
@@ -1025,9 +1030,10 @@ static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma
1025 return 0; 1030 return 0;
1026} 1031}
1027 1032
1028static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dma) 1033static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
1034 struct atiixp_dma *dma)
1029{ 1035{
1030 atiixp_t *chip = snd_pcm_substream_chip(substream); 1036 struct atiixp *chip = snd_pcm_substream_chip(substream);
1031 /* disable DMA bits */ 1037 /* disable DMA bits */
1032 snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL); 1038 snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
1033 spin_lock_irq(&chip->reg_lock); 1039 spin_lock_irq(&chip->reg_lock);
@@ -1040,9 +1046,9 @@ static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dm
1040 1046
1041/* 1047/*
1042 */ 1048 */
1043static int snd_atiixp_playback_open(snd_pcm_substream_t *substream) 1049static int snd_atiixp_playback_open(struct snd_pcm_substream *substream)
1044{ 1050{
1045 atiixp_t *chip = snd_pcm_substream_chip(substream); 1051 struct atiixp *chip = snd_pcm_substream_chip(substream);
1046 int err; 1052 int err;
1047 1053
1048 down(&chip->open_mutex); 1054 down(&chip->open_mutex);
@@ -1058,9 +1064,9 @@ static int snd_atiixp_playback_open(snd_pcm_substream_t *substream)
1058 return 0; 1064 return 0;
1059} 1065}
1060 1066
1061static int snd_atiixp_playback_close(snd_pcm_substream_t *substream) 1067static int snd_atiixp_playback_close(struct snd_pcm_substream *substream)
1062{ 1068{
1063 atiixp_t *chip = snd_pcm_substream_chip(substream); 1069 struct atiixp *chip = snd_pcm_substream_chip(substream);
1064 int err; 1070 int err;
1065 down(&chip->open_mutex); 1071 down(&chip->open_mutex);
1066 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); 1072 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
@@ -1068,21 +1074,21 @@ static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
1068 return err; 1074 return err;
1069} 1075}
1070 1076
1071static int snd_atiixp_capture_open(snd_pcm_substream_t *substream) 1077static int snd_atiixp_capture_open(struct snd_pcm_substream *substream)
1072{ 1078{
1073 atiixp_t *chip = snd_pcm_substream_chip(substream); 1079 struct atiixp *chip = snd_pcm_substream_chip(substream);
1074 return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1); 1080 return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1);
1075} 1081}
1076 1082
1077static int snd_atiixp_capture_close(snd_pcm_substream_t *substream) 1083static int snd_atiixp_capture_close(struct snd_pcm_substream *substream)
1078{ 1084{
1079 atiixp_t *chip = snd_pcm_substream_chip(substream); 1085 struct atiixp *chip = snd_pcm_substream_chip(substream);
1080 return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]); 1086 return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]);
1081} 1087}
1082 1088
1083static int snd_atiixp_spdif_open(snd_pcm_substream_t *substream) 1089static int snd_atiixp_spdif_open(struct snd_pcm_substream *substream)
1084{ 1090{
1085 atiixp_t *chip = snd_pcm_substream_chip(substream); 1091 struct atiixp *chip = snd_pcm_substream_chip(substream);
1086 int err; 1092 int err;
1087 down(&chip->open_mutex); 1093 down(&chip->open_mutex);
1088 if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */ 1094 if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */
@@ -1093,9 +1099,9 @@ static int snd_atiixp_spdif_open(snd_pcm_substream_t *substream)
1093 return err; 1099 return err;
1094} 1100}
1095 1101
1096static int snd_atiixp_spdif_close(snd_pcm_substream_t *substream) 1102static int snd_atiixp_spdif_close(struct snd_pcm_substream *substream)
1097{ 1103{
1098 atiixp_t *chip = snd_pcm_substream_chip(substream); 1104 struct atiixp *chip = snd_pcm_substream_chip(substream);
1099 int err; 1105 int err;
1100 down(&chip->open_mutex); 1106 down(&chip->open_mutex);
1101 if (chip->spdif_over_aclink) 1107 if (chip->spdif_over_aclink)
@@ -1107,7 +1113,7 @@ static int snd_atiixp_spdif_close(snd_pcm_substream_t *substream)
1107} 1113}
1108 1114
1109/* AC97 playback */ 1115/* AC97 playback */
1110static snd_pcm_ops_t snd_atiixp_playback_ops = { 1116static struct snd_pcm_ops snd_atiixp_playback_ops = {
1111 .open = snd_atiixp_playback_open, 1117 .open = snd_atiixp_playback_open,
1112 .close = snd_atiixp_playback_close, 1118 .close = snd_atiixp_playback_close,
1113 .ioctl = snd_pcm_lib_ioctl, 1119 .ioctl = snd_pcm_lib_ioctl,
@@ -1119,7 +1125,7 @@ static snd_pcm_ops_t snd_atiixp_playback_ops = {
1119}; 1125};
1120 1126
1121/* AC97 capture */ 1127/* AC97 capture */
1122static snd_pcm_ops_t snd_atiixp_capture_ops = { 1128static struct snd_pcm_ops snd_atiixp_capture_ops = {
1123 .open = snd_atiixp_capture_open, 1129 .open = snd_atiixp_capture_open,
1124 .close = snd_atiixp_capture_close, 1130 .close = snd_atiixp_capture_close,
1125 .ioctl = snd_pcm_lib_ioctl, 1131 .ioctl = snd_pcm_lib_ioctl,
@@ -1131,7 +1137,7 @@ static snd_pcm_ops_t snd_atiixp_capture_ops = {
1131}; 1137};
1132 1138
1133/* SPDIF playback */ 1139/* SPDIF playback */
1134static snd_pcm_ops_t snd_atiixp_spdif_ops = { 1140static struct snd_pcm_ops snd_atiixp_spdif_ops = {
1135 .open = snd_atiixp_spdif_open, 1141 .open = snd_atiixp_spdif_open,
1136 .close = snd_atiixp_spdif_close, 1142 .close = snd_atiixp_spdif_close,
1137 .ioctl = snd_pcm_lib_ioctl, 1143 .ioctl = snd_pcm_lib_ioctl,
@@ -1178,7 +1184,7 @@ static struct ac97_pcm atiixp_pcm_defs[] __devinitdata = {
1178 }, 1184 },
1179}; 1185};
1180 1186
1181static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = { 1187static struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {
1182 .type = ATI_DMA_PLAYBACK, 1188 .type = ATI_DMA_PLAYBACK,
1183 .llp_offset = ATI_REG_OUT_DMA_LINKPTR, 1189 .llp_offset = ATI_REG_OUT_DMA_LINKPTR,
1184 .dt_cur = ATI_REG_OUT_DMA_DT_CUR, 1190 .dt_cur = ATI_REG_OUT_DMA_DT_CUR,
@@ -1187,7 +1193,7 @@ static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
1187 .flush_dma = atiixp_out_flush_dma, 1193 .flush_dma = atiixp_out_flush_dma,
1188}; 1194};
1189 1195
1190static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = { 1196static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
1191 .type = ATI_DMA_CAPTURE, 1197 .type = ATI_DMA_CAPTURE,
1192 .llp_offset = ATI_REG_IN_DMA_LINKPTR, 1198 .llp_offset = ATI_REG_IN_DMA_LINKPTR,
1193 .dt_cur = ATI_REG_IN_DMA_DT_CUR, 1199 .dt_cur = ATI_REG_IN_DMA_DT_CUR,
@@ -1196,7 +1202,7 @@ static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
1196 .flush_dma = atiixp_in_flush_dma, 1202 .flush_dma = atiixp_in_flush_dma,
1197}; 1203};
1198 1204
1199static atiixp_dma_ops_t snd_atiixp_spdif_dma_ops = { 1205static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {
1200 .type = ATI_DMA_SPDIF, 1206 .type = ATI_DMA_SPDIF,
1201 .llp_offset = ATI_REG_SPDF_DMA_LINKPTR, 1207 .llp_offset = ATI_REG_SPDF_DMA_LINKPTR,
1202 .dt_cur = ATI_REG_SPDF_DMA_DT_CUR, 1208 .dt_cur = ATI_REG_SPDF_DMA_DT_CUR,
@@ -1206,10 +1212,10 @@ static atiixp_dma_ops_t snd_atiixp_spdif_dma_ops = {
1206}; 1212};
1207 1213
1208 1214
1209static int __devinit snd_atiixp_pcm_new(atiixp_t *chip) 1215static int __devinit snd_atiixp_pcm_new(struct atiixp *chip)
1210{ 1216{
1211 snd_pcm_t *pcm; 1217 struct snd_pcm *pcm;
1212 ac97_bus_t *pbus = chip->ac97_bus; 1218 struct snd_ac97_bus *pbus = chip->ac97_bus;
1213 int err, i, num_pcms; 1219 int err, i, num_pcms;
1214 1220
1215 /* initialize constants */ 1221 /* initialize constants */
@@ -1238,7 +1244,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
1238 } 1244 }
1239 1245
1240 /* PCM #0: analog I/O */ 1246 /* PCM #0: analog I/O */
1241 err = snd_pcm_new(chip->card, "ATI IXP AC97", ATI_PCMDEV_ANALOG, 1, 1, &pcm); 1247 err = snd_pcm_new(chip->card, "ATI IXP AC97",
1248 ATI_PCMDEV_ANALOG, 1, 1, &pcm);
1242 if (err < 0) 1249 if (err < 0)
1243 return err; 1250 return err;
1244 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops); 1251 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops);
@@ -1248,7 +1255,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
1248 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; 1255 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
1249 1256
1250 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1257 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1251 snd_dma_pci_data(chip->pci), 64*1024, 128*1024); 1258 snd_dma_pci_data(chip->pci),
1259 64*1024, 128*1024);
1252 1260
1253 /* no SPDIF support on codec? */ 1261 /* no SPDIF support on codec? */
1254 if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates) 1262 if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates)
@@ -1259,7 +1267,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
1259 chip->pcms[ATI_PCM_SPDIF]->rates = SNDRV_PCM_RATE_48000; 1267 chip->pcms[ATI_PCM_SPDIF]->rates = SNDRV_PCM_RATE_48000;
1260 1268
1261 /* PCM #1: spdif playback */ 1269 /* PCM #1: spdif playback */
1262 err = snd_pcm_new(chip->card, "ATI IXP IEC958", ATI_PCMDEV_DIGITAL, 1, 0, &pcm); 1270 err = snd_pcm_new(chip->card, "ATI IXP IEC958",
1271 ATI_PCMDEV_DIGITAL, 1, 0, &pcm);
1263 if (err < 0) 1272 if (err < 0)
1264 return err; 1273 return err;
1265 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_spdif_ops); 1274 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_spdif_ops);
@@ -1271,12 +1280,15 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
1271 chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm; 1280 chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm;
1272 1281
1273 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1282 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1274 snd_dma_pci_data(chip->pci), 64*1024, 128*1024); 1283 snd_dma_pci_data(chip->pci),
1284 64*1024, 128*1024);
1275 1285
1276 /* pre-select AC97 SPDIF slots 10/11 */ 1286 /* pre-select AC97 SPDIF slots 10/11 */
1277 for (i = 0; i < NUM_ATI_CODECS; i++) { 1287 for (i = 0; i < NUM_ATI_CODECS; i++) {
1278 if (chip->ac97[i]) 1288 if (chip->ac97[i])
1279 snd_ac97_update_bits(chip->ac97[i], AC97_EXTENDED_STATUS, 0x03 << 4, 0x03 << 4); 1289 snd_ac97_update_bits(chip->ac97[i],
1290 AC97_EXTENDED_STATUS,
1291 0x03 << 4, 0x03 << 4);
1280 } 1292 }
1281 1293
1282 return 0; 1294 return 0;
@@ -1289,7 +1301,7 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
1289 */ 1301 */
1290static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1302static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1291{ 1303{
1292 atiixp_t *chip = dev_id; 1304 struct atiixp *chip = dev_id;
1293 unsigned int status; 1305 unsigned int status;
1294 1306
1295 status = atiixp_read(chip, ISR); 1307 status = atiixp_read(chip, ISR);
@@ -1344,13 +1356,14 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1344 { } /* terminator */ 1356 { } /* terminator */
1345}; 1357};
1346 1358
1347static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char *quirk_override) 1359static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock,
1360 const char *quirk_override)
1348{ 1361{
1349 ac97_bus_t *pbus; 1362 struct snd_ac97_bus *pbus;
1350 ac97_template_t ac97; 1363 struct snd_ac97_template ac97;
1351 int i, err; 1364 int i, err;
1352 int codec_count; 1365 int codec_count;
1353 static ac97_bus_ops_t ops = { 1366 static struct snd_ac97_bus_ops ops = {
1354 .write = snd_atiixp_ac97_write, 1367 .write = snd_atiixp_ac97_write,
1355 .read = snd_atiixp_ac97_read, 1368 .read = snd_atiixp_ac97_read,
1356 }; 1369 };
@@ -1402,16 +1415,17 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char
1402/* 1415/*
1403 * power management 1416 * power management
1404 */ 1417 */
1405static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state) 1418static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state)
1406{ 1419{
1407 atiixp_t *chip = card->pm_private_data; 1420 struct atiixp *chip = card->pm_private_data;
1408 int i; 1421 int i;
1409 1422
1410 for (i = 0; i < NUM_ATI_PCMDEVS; i++) 1423 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1411 if (chip->pcmdevs[i]) { 1424 if (chip->pcmdevs[i]) {
1412 atiixp_dma_t *dma = &chip->dmas[i]; 1425 struct atiixp_dma *dma = &chip->dmas[i];
1413 if (dma->substream && dma->running) 1426 if (dma->substream && dma->running)
1414 dma->saved_curptr = readl(chip->remap_addr + dma->ops->dt_cur); 1427 dma->saved_curptr = readl(chip->remap_addr +
1428 dma->ops->dt_cur);
1415 snd_pcm_suspend_all(chip->pcmdevs[i]); 1429 snd_pcm_suspend_all(chip->pcmdevs[i]);
1416 } 1430 }
1417 for (i = 0; i < NUM_ATI_CODECS; i++) 1431 for (i = 0; i < NUM_ATI_CODECS; i++)
@@ -1425,9 +1439,9 @@ static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state)
1425 return 0; 1439 return 0;
1426} 1440}
1427 1441
1428static int snd_atiixp_resume(snd_card_t *card) 1442static int snd_atiixp_resume(struct snd_card *card)
1429{ 1443{
1430 atiixp_t *chip = card->pm_private_data; 1444 struct atiixp *chip = card->pm_private_data;
1431 int i; 1445 int i;
1432 1446
1433 pci_enable_device(chip->pci); 1447 pci_enable_device(chip->pci);
@@ -1443,13 +1457,14 @@ static int snd_atiixp_resume(snd_card_t *card)
1443 1457
1444 for (i = 0; i < NUM_ATI_PCMDEVS; i++) 1458 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1445 if (chip->pcmdevs[i]) { 1459 if (chip->pcmdevs[i]) {
1446 atiixp_dma_t *dma = &chip->dmas[i]; 1460 struct atiixp_dma *dma = &chip->dmas[i];
1447 if (dma->substream && dma->suspended) { 1461 if (dma->substream && dma->suspended) {
1448 dma->ops->enable_dma(chip, 1); 1462 dma->ops->enable_dma(chip, 1);
1449 dma->substream->ops->prepare(dma->substream); 1463 dma->substream->ops->prepare(dma->substream);
1450 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, 1464 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
1451 chip->remap_addr + dma->ops->llp_offset); 1465 chip->remap_addr + dma->ops->llp_offset);
1452 writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur); 1466 writel(dma->saved_curptr, chip->remap_addr +
1467 dma->ops->dt_cur);
1453 } 1468 }
1454 } 1469 }
1455 1470
@@ -1462,18 +1477,19 @@ static int snd_atiixp_resume(snd_card_t *card)
1462 * proc interface for register dump 1477 * proc interface for register dump
1463 */ 1478 */
1464 1479
1465static void snd_atiixp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 1480static void snd_atiixp_proc_read(struct snd_info_entry *entry,
1481 struct snd_info_buffer *buffer)
1466{ 1482{
1467 atiixp_t *chip = entry->private_data; 1483 struct atiixp *chip = entry->private_data;
1468 int i; 1484 int i;
1469 1485
1470 for (i = 0; i < 256; i += 4) 1486 for (i = 0; i < 256; i += 4)
1471 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i)); 1487 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i));
1472} 1488}
1473 1489
1474static void __devinit snd_atiixp_proc_init(atiixp_t *chip) 1490static void __devinit snd_atiixp_proc_init(struct atiixp *chip)
1475{ 1491{
1476 snd_info_entry_t *entry; 1492 struct snd_info_entry *entry;
1477 1493
1478 if (! snd_card_proc_new(chip->card, "atiixp", &entry)) 1494 if (! snd_card_proc_new(chip->card, "atiixp", &entry))
1479 snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); 1495 snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
@@ -1485,7 +1501,7 @@ static void __devinit snd_atiixp_proc_init(atiixp_t *chip)
1485 * destructor 1501 * destructor
1486 */ 1502 */
1487 1503
1488static int snd_atiixp_free(atiixp_t *chip) 1504static int snd_atiixp_free(struct atiixp *chip)
1489{ 1505{
1490 if (chip->irq < 0) 1506 if (chip->irq < 0)
1491 goto __hw_end; 1507 goto __hw_end;
@@ -1493,7 +1509,7 @@ static int snd_atiixp_free(atiixp_t *chip)
1493 synchronize_irq(chip->irq); 1509 synchronize_irq(chip->irq);
1494 __hw_end: 1510 __hw_end:
1495 if (chip->irq >= 0) 1511 if (chip->irq >= 0)
1496 free_irq(chip->irq, (void *)chip); 1512 free_irq(chip->irq, chip);
1497 if (chip->remap_addr) 1513 if (chip->remap_addr)
1498 iounmap(chip->remap_addr); 1514 iounmap(chip->remap_addr);
1499 pci_release_regions(chip->pci); 1515 pci_release_regions(chip->pci);
@@ -1502,23 +1518,23 @@ static int snd_atiixp_free(atiixp_t *chip)
1502 return 0; 1518 return 0;
1503} 1519}
1504 1520
1505static int snd_atiixp_dev_free(snd_device_t *device) 1521static int snd_atiixp_dev_free(struct snd_device *device)
1506{ 1522{
1507 atiixp_t *chip = device->device_data; 1523 struct atiixp *chip = device->device_data;
1508 return snd_atiixp_free(chip); 1524 return snd_atiixp_free(chip);
1509} 1525}
1510 1526
1511/* 1527/*
1512 * constructor for chip instance 1528 * constructor for chip instance
1513 */ 1529 */
1514static int __devinit snd_atiixp_create(snd_card_t *card, 1530static int __devinit snd_atiixp_create(struct snd_card *card,
1515 struct pci_dev *pci, 1531 struct pci_dev *pci,
1516 atiixp_t **r_chip) 1532 struct atiixp **r_chip)
1517{ 1533{
1518 static snd_device_ops_t ops = { 1534 static struct snd_device_ops ops = {
1519 .dev_free = snd_atiixp_dev_free, 1535 .dev_free = snd_atiixp_dev_free,
1520 }; 1536 };
1521 atiixp_t *chip; 1537 struct atiixp *chip;
1522 int err; 1538 int err;
1523 1539
1524 if ((err = pci_enable_device(pci)) < 0) 1540 if ((err = pci_enable_device(pci)) < 0)
@@ -1548,7 +1564,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1548 return -EIO; 1564 return -EIO;
1549 } 1565 }
1550 1566
1551 if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { 1567 if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ,
1568 card->shortname, chip)) {
1552 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1569 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1553 snd_atiixp_free(chip); 1570 snd_atiixp_free(chip);
1554 return -EBUSY; 1571 return -EBUSY;
@@ -1572,8 +1589,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1572static int __devinit snd_atiixp_probe(struct pci_dev *pci, 1589static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1573 const struct pci_device_id *pci_id) 1590 const struct pci_device_id *pci_id)
1574{ 1591{
1575 snd_card_t *card; 1592 struct snd_card *card;
1576 atiixp_t *chip; 1593 struct atiixp *chip;
1577 unsigned char revision; 1594 unsigned char revision;
1578 int err; 1595 int err;
1579 1596
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 649a999214e2..15be161b0a93 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -176,24 +176,18 @@ module_param(enable, bool, 0444);
176#define ATI_MAX_DESCRIPTORS 256 /* max number of descriptor packets */ 176#define ATI_MAX_DESCRIPTORS 256 /* max number of descriptor packets */
177 177
178 178
179/* 179struct atiixp_modem;
180 */
181
182typedef struct snd_atiixp atiixp_t;
183typedef struct snd_atiixp_dma atiixp_dma_t;
184typedef struct snd_atiixp_dma_ops atiixp_dma_ops_t;
185
186 180
187/* 181/*
188 * DMA packate descriptor 182 * DMA packate descriptor
189 */ 183 */
190 184
191typedef struct atiixp_dma_desc { 185struct atiixp_dma_desc {
192 u32 addr; /* DMA buffer address */ 186 u32 addr; /* DMA buffer address */
193 u16 status; /* status bits */ 187 u16 status; /* status bits */
194 u16 size; /* size of the packet in dwords */ 188 u16 size; /* size of the packet in dwords */
195 u32 next; /* address of the next packet descriptor */ 189 u32 next; /* address of the next packet descriptor */
196} atiixp_dma_desc_t; 190};
197 191
198/* 192/*
199 * stream enum 193 * stream enum
@@ -208,22 +202,25 @@ enum { ATI_PCMDEV_ANALOG, NUM_ATI_PCMDEVS }; /* pcm devices */
208/* 202/*
209 * constants and callbacks for each DMA type 203 * constants and callbacks for each DMA type
210 */ 204 */
211struct snd_atiixp_dma_ops { 205struct atiixp_dma_ops {
212 int type; /* ATI_DMA_XXX */ 206 int type; /* ATI_DMA_XXX */
213 unsigned int llp_offset; /* LINKPTR offset */ 207 unsigned int llp_offset; /* LINKPTR offset */
214 unsigned int dt_cur; /* DT_CUR offset */ 208 unsigned int dt_cur; /* DT_CUR offset */
215 void (*enable_dma)(atiixp_t *chip, int on); /* called from open callback */ 209 /* called from open callback */
216 void (*enable_transfer)(atiixp_t *chip, int on); /* called from trigger (START/STOP) */ 210 void (*enable_dma)(struct atiixp_modem *chip, int on);
217 void (*flush_dma)(atiixp_t *chip); /* called from trigger (STOP only) */ 211 /* called from trigger (START/STOP) */
212 void (*enable_transfer)(struct atiixp_modem *chip, int on);
213 /* called from trigger (STOP only) */
214 void (*flush_dma)(struct atiixp_modem *chip);
218}; 215};
219 216
220/* 217/*
221 * DMA stream 218 * DMA stream
222 */ 219 */
223struct snd_atiixp_dma { 220struct atiixp_dma {
224 const atiixp_dma_ops_t *ops; 221 const struct atiixp_dma_ops *ops;
225 struct snd_dma_buffer desc_buf; 222 struct snd_dma_buffer desc_buf;
226 snd_pcm_substream_t *substream; /* assigned PCM substream */ 223 struct snd_pcm_substream *substream; /* assigned PCM substream */
227 unsigned int buf_addr, buf_bytes; /* DMA buffer address, bytes */ 224 unsigned int buf_addr, buf_bytes; /* DMA buffer address, bytes */
228 unsigned int period_bytes, periods; 225 unsigned int period_bytes, periods;
229 int opened; 226 int opened;
@@ -235,8 +232,8 @@ struct snd_atiixp_dma {
235/* 232/*
236 * ATI IXP chip 233 * ATI IXP chip
237 */ 234 */
238struct snd_atiixp { 235struct atiixp_modem {
239 snd_card_t *card; 236 struct snd_card *card;
240 struct pci_dev *pci; 237 struct pci_dev *pci;
241 238
242 struct resource *res; /* memory i/o */ 239 struct resource *res; /* memory i/o */
@@ -244,14 +241,14 @@ struct snd_atiixp {
244 void __iomem *remap_addr; 241 void __iomem *remap_addr;
245 int irq; 242 int irq;
246 243
247 ac97_bus_t *ac97_bus; 244 struct snd_ac97_bus *ac97_bus;
248 ac97_t *ac97[NUM_ATI_CODECS]; 245 struct snd_ac97 *ac97[NUM_ATI_CODECS];
249 246
250 spinlock_t reg_lock; 247 spinlock_t reg_lock;
251 248
252 atiixp_dma_t dmas[NUM_ATI_DMAS]; 249 struct atiixp_dma dmas[NUM_ATI_DMAS];
253 struct ac97_pcm *pcms[NUM_ATI_PCMS]; 250 struct ac97_pcm *pcms[NUM_ATI_PCMS];
254 snd_pcm_t *pcmdevs[NUM_ATI_PCMDEVS]; 251 struct snd_pcm *pcmdevs[NUM_ATI_PCMDEVS];
255 252
256 int max_channels; /* max. channels for PCM out */ 253 int max_channels; /* max. channels for PCM out */
257 254
@@ -281,8 +278,8 @@ MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
281 * update the bits of the given register. 278 * update the bits of the given register.
282 * return 1 if the bits changed. 279 * return 1 if the bits changed.
283 */ 280 */
284static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, 281static int snd_atiixp_update_bits(struct atiixp_modem *chip, unsigned int reg,
285 unsigned int mask, unsigned int value) 282 unsigned int mask, unsigned int value)
286{ 283{
287 void __iomem *addr = chip->remap_addr + reg; 284 void __iomem *addr = chip->remap_addr + reg;
288 unsigned int data, old_data; 285 unsigned int data, old_data;
@@ -313,7 +310,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
313 */ 310 */
314 311
315#define ATI_DESC_LIST_SIZE \ 312#define ATI_DESC_LIST_SIZE \
316 PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(atiixp_dma_desc_t)) 313 PAGE_ALIGN(ATI_MAX_DESCRIPTORS * sizeof(struct atiixp_dma_desc))
317 314
318/* 315/*
319 * build packets ring for the given buffer size. 316 * build packets ring for the given buffer size.
@@ -324,10 +321,11 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg,
324 * 321 *
325 * the ring is built in this function, and is set up to the hardware. 322 * the ring is built in this function, and is set up to the hardware.
326 */ 323 */
327static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, 324static int atiixp_build_dma_packets(struct atiixp_modem *chip,
328 snd_pcm_substream_t *substream, 325 struct atiixp_dma *dma,
329 unsigned int periods, 326 struct snd_pcm_substream *substream,
330 unsigned int period_bytes) 327 unsigned int periods,
328 unsigned int period_bytes)
331{ 329{
332 unsigned int i; 330 unsigned int i;
333 u32 addr, desc_addr; 331 u32 addr, desc_addr;
@@ -357,11 +355,12 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
357 addr = (u32)substream->runtime->dma_addr; 355 addr = (u32)substream->runtime->dma_addr;
358 desc_addr = (u32)dma->desc_buf.addr; 356 desc_addr = (u32)dma->desc_buf.addr;
359 for (i = 0; i < periods; i++) { 357 for (i = 0; i < periods; i++) {
360 atiixp_dma_desc_t *desc = &((atiixp_dma_desc_t *)dma->desc_buf.area)[i]; 358 struct atiixp_dma_desc *desc;
359 desc = &((struct atiixp_dma_desc *)dma->desc_buf.area)[i];
361 desc->addr = cpu_to_le32(addr); 360 desc->addr = cpu_to_le32(addr);
362 desc->status = 0; 361 desc->status = 0;
363 desc->size = period_bytes >> 2; /* in dwords */ 362 desc->size = period_bytes >> 2; /* in dwords */
364 desc_addr += sizeof(atiixp_dma_desc_t); 363 desc_addr += sizeof(struct atiixp_dma_desc);
365 if (i == periods - 1) 364 if (i == periods - 1)
366 desc->next = cpu_to_le32((u32)dma->desc_buf.addr); 365 desc->next = cpu_to_le32((u32)dma->desc_buf.addr);
367 else 366 else
@@ -381,7 +380,9 @@ static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma,
381/* 380/*
382 * remove the ring buffer and release it if assigned 381 * remove the ring buffer and release it if assigned
383 */ 382 */
384static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_substream_t *substream) 383static void atiixp_clear_dma_packets(struct atiixp_modem *chip,
384 struct atiixp_dma *dma,
385 struct snd_pcm_substream *substream)
385{ 386{
386 if (dma->desc_buf.area) { 387 if (dma->desc_buf.area) {
387 writel(0, chip->remap_addr + dma->ops->llp_offset); 388 writel(0, chip->remap_addr + dma->ops->llp_offset);
@@ -393,7 +394,7 @@ static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_
393/* 394/*
394 * AC97 interface 395 * AC97 interface
395 */ 396 */
396static int snd_atiixp_acquire_codec(atiixp_t *chip) 397static int snd_atiixp_acquire_codec(struct atiixp_modem *chip)
397{ 398{
398 int timeout = 1000; 399 int timeout = 1000;
399 400
@@ -407,7 +408,9 @@ static int snd_atiixp_acquire_codec(atiixp_t *chip)
407 return 0; 408 return 0;
408} 409}
409 410
410static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec, unsigned short reg) 411static unsigned short snd_atiixp_codec_read(struct atiixp_modem *chip,
412 unsigned short codec,
413 unsigned short reg)
411{ 414{
412 unsigned int data; 415 unsigned int data;
413 int timeout; 416 int timeout;
@@ -435,7 +438,9 @@ static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec
435} 438}
436 439
437 440
438static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigned short reg, unsigned short val) 441static void snd_atiixp_codec_write(struct atiixp_modem *chip,
442 unsigned short codec,
443 unsigned short reg, unsigned short val)
439{ 444{
440 unsigned int data; 445 unsigned int data;
441 446
@@ -448,16 +453,18 @@ static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigne
448} 453}
449 454
450 455
451static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg) 456static unsigned short snd_atiixp_ac97_read(struct snd_ac97 *ac97,
457 unsigned short reg)
452{ 458{
453 atiixp_t *chip = ac97->private_data; 459 struct atiixp_modem *chip = ac97->private_data;
454 return snd_atiixp_codec_read(chip, ac97->num, reg); 460 return snd_atiixp_codec_read(chip, ac97->num, reg);
455 461
456} 462}
457 463
458static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) 464static void snd_atiixp_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
465 unsigned short val)
459{ 466{
460 atiixp_t *chip = ac97->private_data; 467 struct atiixp_modem *chip = ac97->private_data;
461 if (reg == AC97_GPIO_STATUS) { 468 if (reg == AC97_GPIO_STATUS) {
462 atiixp_write(chip, MODEM_OUT_GPIO, 469 atiixp_write(chip, MODEM_OUT_GPIO,
463 (val << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN); 470 (val << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN);
@@ -469,7 +476,7 @@ static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned sho
469/* 476/*
470 * reset AC link 477 * reset AC link
471 */ 478 */
472static int snd_atiixp_aclink_reset(atiixp_t *chip) 479static int snd_atiixp_aclink_reset(struct atiixp_modem *chip)
473{ 480{
474 int timeout; 481 int timeout;
475 482
@@ -505,7 +512,7 @@ static int snd_atiixp_aclink_reset(atiixp_t *chip)
505} 512}
506 513
507#ifdef CONFIG_PM 514#ifdef CONFIG_PM
508static int snd_atiixp_aclink_down(atiixp_t *chip) 515static int snd_atiixp_aclink_down(struct atiixp_modem *chip)
509{ 516{
510 // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */ 517 // if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */
511 // return -EBUSY; 518 // return -EBUSY;
@@ -530,7 +537,7 @@ static int snd_atiixp_aclink_down(atiixp_t *chip)
530 ATI_REG_ISR_CODEC2_NOT_READY) 537 ATI_REG_ISR_CODEC2_NOT_READY)
531#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME) 538#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME)
532 539
533static int snd_atiixp_codec_detect(atiixp_t *chip) 540static int snd_atiixp_codec_detect(struct atiixp_modem *chip)
534{ 541{
535 int timeout; 542 int timeout;
536 543
@@ -556,7 +563,7 @@ static int snd_atiixp_codec_detect(atiixp_t *chip)
556/* 563/*
557 * enable DMA and irqs 564 * enable DMA and irqs
558 */ 565 */
559static int snd_atiixp_chip_start(atiixp_t *chip) 566static int snd_atiixp_chip_start(struct atiixp_modem *chip)
560{ 567{
561 unsigned int reg; 568 unsigned int reg;
562 569
@@ -581,7 +588,7 @@ static int snd_atiixp_chip_start(atiixp_t *chip)
581/* 588/*
582 * disable DMA and IRQs 589 * disable DMA and IRQs
583 */ 590 */
584static int snd_atiixp_chip_stop(atiixp_t *chip) 591static int snd_atiixp_chip_stop(struct atiixp_modem *chip)
585{ 592{
586 /* clear interrupt source */ 593 /* clear interrupt source */
587 atiixp_write(chip, ISR, atiixp_read(chip, ISR)); 594 atiixp_write(chip, ISR, atiixp_read(chip, ISR));
@@ -600,11 +607,11 @@ static int snd_atiixp_chip_stop(atiixp_t *chip)
600 * position. when SG-buffer is implemented, the offset must be calculated 607 * position. when SG-buffer is implemented, the offset must be calculated
601 * correctly... 608 * correctly...
602 */ 609 */
603static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream) 610static snd_pcm_uframes_t snd_atiixp_pcm_pointer(struct snd_pcm_substream *substream)
604{ 611{
605 atiixp_t *chip = snd_pcm_substream_chip(substream); 612 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
606 snd_pcm_runtime_t *runtime = substream->runtime; 613 struct snd_pcm_runtime *runtime = substream->runtime;
607 atiixp_dma_t *dma = (atiixp_dma_t *)runtime->private_data; 614 struct atiixp_dma *dma = runtime->private_data;
608 unsigned int curptr; 615 unsigned int curptr;
609 int timeout = 1000; 616 int timeout = 1000;
610 617
@@ -625,7 +632,8 @@ static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream)
625/* 632/*
626 * XRUN detected, and stop the PCM substream 633 * XRUN detected, and stop the PCM substream
627 */ 634 */
628static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma) 635static void snd_atiixp_xrun_dma(struct atiixp_modem *chip,
636 struct atiixp_dma *dma)
629{ 637{
630 if (! dma->substream || ! dma->running) 638 if (! dma->substream || ! dma->running)
631 return; 639 return;
@@ -636,7 +644,8 @@ static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
636/* 644/*
637 * the period ack. update the substream. 645 * the period ack. update the substream.
638 */ 646 */
639static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma) 647static void snd_atiixp_update_dma(struct atiixp_modem *chip,
648 struct atiixp_dma *dma)
640{ 649{
641 if (! dma->substream || ! dma->running) 650 if (! dma->substream || ! dma->running)
642 return; 651 return;
@@ -645,7 +654,7 @@ static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma)
645 654
646/* set BUS_BUSY interrupt bit if any DMA is running */ 655/* set BUS_BUSY interrupt bit if any DMA is running */
647/* call with spinlock held */ 656/* call with spinlock held */
648static void snd_atiixp_check_bus_busy(atiixp_t *chip) 657static void snd_atiixp_check_bus_busy(struct atiixp_modem *chip)
649{ 658{
650 unsigned int bus_busy; 659 unsigned int bus_busy;
651 if (atiixp_read(chip, CMD) & (ATI_REG_CMD_MODEM_SEND1_EN | 660 if (atiixp_read(chip, CMD) & (ATI_REG_CMD_MODEM_SEND1_EN |
@@ -659,10 +668,10 @@ static void snd_atiixp_check_bus_busy(atiixp_t *chip)
659/* common trigger callback 668/* common trigger callback
660 * calling the lowlevel callbacks in it 669 * calling the lowlevel callbacks in it
661 */ 670 */
662static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 671static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
663{ 672{
664 atiixp_t *chip = snd_pcm_substream_chip(substream); 673 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
665 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 674 struct atiixp_dma *dma = substream->runtime->private_data;
666 int err = 0; 675 int err = 0;
667 676
668 snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL); 677 snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
@@ -700,13 +709,13 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
700 */ 709 */
701 710
702/* flush FIFO of analog OUT DMA */ 711/* flush FIFO of analog OUT DMA */
703static void atiixp_out_flush_dma(atiixp_t *chip) 712static void atiixp_out_flush_dma(struct atiixp_modem *chip)
704{ 713{
705 atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_OUT1_FLUSH); 714 atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_OUT1_FLUSH);
706} 715}
707 716
708/* enable/disable analog OUT DMA */ 717/* enable/disable analog OUT DMA */
709static void atiixp_out_enable_dma(atiixp_t *chip, int on) 718static void atiixp_out_enable_dma(struct atiixp_modem *chip, int on)
710{ 719{
711 unsigned int data; 720 unsigned int data;
712 data = atiixp_read(chip, CMD); 721 data = atiixp_read(chip, CMD);
@@ -721,21 +730,21 @@ static void atiixp_out_enable_dma(atiixp_t *chip, int on)
721} 730}
722 731
723/* start/stop transfer over OUT DMA */ 732/* start/stop transfer over OUT DMA */
724static void atiixp_out_enable_transfer(atiixp_t *chip, int on) 733static void atiixp_out_enable_transfer(struct atiixp_modem *chip, int on)
725{ 734{
726 atiixp_update(chip, CMD, ATI_REG_CMD_MODEM_SEND1_EN, 735 atiixp_update(chip, CMD, ATI_REG_CMD_MODEM_SEND1_EN,
727 on ? ATI_REG_CMD_MODEM_SEND1_EN : 0); 736 on ? ATI_REG_CMD_MODEM_SEND1_EN : 0);
728} 737}
729 738
730/* enable/disable analog IN DMA */ 739/* enable/disable analog IN DMA */
731static void atiixp_in_enable_dma(atiixp_t *chip, int on) 740static void atiixp_in_enable_dma(struct atiixp_modem *chip, int on)
732{ 741{
733 atiixp_update(chip, CMD, ATI_REG_CMD_MODEM_IN_DMA_EN, 742 atiixp_update(chip, CMD, ATI_REG_CMD_MODEM_IN_DMA_EN,
734 on ? ATI_REG_CMD_MODEM_IN_DMA_EN : 0); 743 on ? ATI_REG_CMD_MODEM_IN_DMA_EN : 0);
735} 744}
736 745
737/* start/stop analog IN DMA */ 746/* start/stop analog IN DMA */
738static void atiixp_in_enable_transfer(atiixp_t *chip, int on) 747static void atiixp_in_enable_transfer(struct atiixp_modem *chip, int on)
739{ 748{
740 if (on) { 749 if (on) {
741 unsigned int data = atiixp_read(chip, CMD); 750 unsigned int data = atiixp_read(chip, CMD);
@@ -748,15 +757,15 @@ static void atiixp_in_enable_transfer(atiixp_t *chip, int on)
748} 757}
749 758
750/* flush FIFO of analog IN DMA */ 759/* flush FIFO of analog IN DMA */
751static void atiixp_in_flush_dma(atiixp_t *chip) 760static void atiixp_in_flush_dma(struct atiixp_modem *chip)
752{ 761{
753 atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_IN_FLUSH); 762 atiixp_write(chip, MODEM_FIFO_FLUSH, ATI_REG_MODEM_FIFO_IN_FLUSH);
754} 763}
755 764
756/* set up slots and formats for analog OUT */ 765/* set up slots and formats for analog OUT */
757static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream) 766static int snd_atiixp_playback_prepare(struct snd_pcm_substream *substream)
758{ 767{
759 atiixp_t *chip = snd_pcm_substream_chip(substream); 768 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
760 unsigned int data; 769 unsigned int data;
761 770
762 spin_lock_irq(&chip->reg_lock); 771 spin_lock_irq(&chip->reg_lock);
@@ -770,7 +779,7 @@ static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream)
770} 779}
771 780
772/* set up slots and formats for analog IN */ 781/* set up slots and formats for analog IN */
773static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream) 782static int snd_atiixp_capture_prepare(struct snd_pcm_substream *substream)
774{ 783{
775 return 0; 784 return 0;
776} 785}
@@ -778,11 +787,11 @@ static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream)
778/* 787/*
779 * hw_params - allocate the buffer and set up buffer descriptors 788 * hw_params - allocate the buffer and set up buffer descriptors
780 */ 789 */
781static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream, 790static int snd_atiixp_pcm_hw_params(struct snd_pcm_substream *substream,
782 snd_pcm_hw_params_t *hw_params) 791 struct snd_pcm_hw_params *hw_params)
783{ 792{
784 atiixp_t *chip = snd_pcm_substream_chip(substream); 793 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
785 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 794 struct atiixp_dma *dma = substream->runtime->private_data;
786 int err; 795 int err;
787 int i; 796 int i;
788 797
@@ -809,10 +818,10 @@ static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
809 return err; 818 return err;
810} 819}
811 820
812static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream) 821static int snd_atiixp_pcm_hw_free(struct snd_pcm_substream *substream)
813{ 822{
814 atiixp_t *chip = snd_pcm_substream_chip(substream); 823 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
815 atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data; 824 struct atiixp_dma *dma = substream->runtime->private_data;
816 825
817 atiixp_clear_dma_packets(chip, dma, substream); 826 atiixp_clear_dma_packets(chip, dma, substream);
818 snd_pcm_lib_free_pages(substream); 827 snd_pcm_lib_free_pages(substream);
@@ -823,13 +832,15 @@ static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream)
823/* 832/*
824 * pcm hardware definition, identical for all DMA types 833 * pcm hardware definition, identical for all DMA types
825 */ 834 */
826static snd_pcm_hardware_t snd_atiixp_pcm_hw = 835static struct snd_pcm_hardware snd_atiixp_pcm_hw =
827{ 836{
828 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 837 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
829 SNDRV_PCM_INFO_BLOCK_TRANSFER | 838 SNDRV_PCM_INFO_BLOCK_TRANSFER |
830 SNDRV_PCM_INFO_MMAP_VALID), 839 SNDRV_PCM_INFO_MMAP_VALID),
831 .formats = SNDRV_PCM_FMTBIT_S16_LE, 840 .formats = SNDRV_PCM_FMTBIT_S16_LE,
832 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_KNOT, 841 .rates = (SNDRV_PCM_RATE_8000 |
842 SNDRV_PCM_RATE_16000 |
843 SNDRV_PCM_RATE_KNOT),
833 .rate_min = 8000, 844 .rate_min = 8000,
834 .rate_max = 16000, 845 .rate_max = 16000,
835 .channels_min = 2, 846 .channels_min = 2,
@@ -841,13 +852,14 @@ static snd_pcm_hardware_t snd_atiixp_pcm_hw =
841 .periods_max = ATI_MAX_DESCRIPTORS, 852 .periods_max = ATI_MAX_DESCRIPTORS,
842}; 853};
843 854
844static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma, int pcm_type) 855static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
856 struct atiixp_dma *dma, int pcm_type)
845{ 857{
846 atiixp_t *chip = snd_pcm_substream_chip(substream); 858 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
847 snd_pcm_runtime_t *runtime = substream->runtime; 859 struct snd_pcm_runtime *runtime = substream->runtime;
848 int err; 860 int err;
849 static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; 861 static unsigned int rates[] = { 8000, 9600, 12000, 16000 };
850 static snd_pcm_hw_constraint_list_t hw_constraints_rates = { 862 static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
851 .count = ARRAY_SIZE(rates), 863 .count = ARRAY_SIZE(rates),
852 .list = rates, 864 .list = rates,
853 .mask = 0, 865 .mask = 0,
@@ -860,9 +872,12 @@ static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma
860 dma->substream = substream; 872 dma->substream = substream;
861 runtime->hw = snd_atiixp_pcm_hw; 873 runtime->hw = snd_atiixp_pcm_hw;
862 dma->ac97_pcm_type = pcm_type; 874 dma->ac97_pcm_type = pcm_type;
863 if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0) 875 if ((err = snd_pcm_hw_constraint_list(runtime, 0,
876 SNDRV_PCM_HW_PARAM_RATE,
877 &hw_constraints_rates)) < 0)
864 return err; 878 return err;
865 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 879 if ((err = snd_pcm_hw_constraint_integer(runtime,
880 SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
866 return err; 881 return err;
867 runtime->private_data = dma; 882 runtime->private_data = dma;
868 883
@@ -875,9 +890,10 @@ static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma
875 return 0; 890 return 0;
876} 891}
877 892
878static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dma) 893static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
894 struct atiixp_dma *dma)
879{ 895{
880 atiixp_t *chip = snd_pcm_substream_chip(substream); 896 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
881 /* disable DMA bits */ 897 /* disable DMA bits */
882 snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL); 898 snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
883 spin_lock_irq(&chip->reg_lock); 899 spin_lock_irq(&chip->reg_lock);
@@ -890,9 +906,9 @@ static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dm
890 906
891/* 907/*
892 */ 908 */
893static int snd_atiixp_playback_open(snd_pcm_substream_t *substream) 909static int snd_atiixp_playback_open(struct snd_pcm_substream *substream)
894{ 910{
895 atiixp_t *chip = snd_pcm_substream_chip(substream); 911 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
896 int err; 912 int err;
897 913
898 down(&chip->open_mutex); 914 down(&chip->open_mutex);
@@ -903,9 +919,9 @@ static int snd_atiixp_playback_open(snd_pcm_substream_t *substream)
903 return 0; 919 return 0;
904} 920}
905 921
906static int snd_atiixp_playback_close(snd_pcm_substream_t *substream) 922static int snd_atiixp_playback_close(struct snd_pcm_substream *substream)
907{ 923{
908 atiixp_t *chip = snd_pcm_substream_chip(substream); 924 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
909 int err; 925 int err;
910 down(&chip->open_mutex); 926 down(&chip->open_mutex);
911 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); 927 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
@@ -913,21 +929,21 @@ static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
913 return err; 929 return err;
914} 930}
915 931
916static int snd_atiixp_capture_open(snd_pcm_substream_t *substream) 932static int snd_atiixp_capture_open(struct snd_pcm_substream *substream)
917{ 933{
918 atiixp_t *chip = snd_pcm_substream_chip(substream); 934 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
919 return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1); 935 return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1);
920} 936}
921 937
922static int snd_atiixp_capture_close(snd_pcm_substream_t *substream) 938static int snd_atiixp_capture_close(struct snd_pcm_substream *substream)
923{ 939{
924 atiixp_t *chip = snd_pcm_substream_chip(substream); 940 struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
925 return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]); 941 return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]);
926} 942}
927 943
928 944
929/* AC97 playback */ 945/* AC97 playback */
930static snd_pcm_ops_t snd_atiixp_playback_ops = { 946static struct snd_pcm_ops snd_atiixp_playback_ops = {
931 .open = snd_atiixp_playback_open, 947 .open = snd_atiixp_playback_open,
932 .close = snd_atiixp_playback_close, 948 .close = snd_atiixp_playback_close,
933 .ioctl = snd_pcm_lib_ioctl, 949 .ioctl = snd_pcm_lib_ioctl,
@@ -939,7 +955,7 @@ static snd_pcm_ops_t snd_atiixp_playback_ops = {
939}; 955};
940 956
941/* AC97 capture */ 957/* AC97 capture */
942static snd_pcm_ops_t snd_atiixp_capture_ops = { 958static struct snd_pcm_ops snd_atiixp_capture_ops = {
943 .open = snd_atiixp_capture_open, 959 .open = snd_atiixp_capture_open,
944 .close = snd_atiixp_capture_close, 960 .close = snd_atiixp_capture_close,
945 .ioctl = snd_pcm_lib_ioctl, 961 .ioctl = snd_pcm_lib_ioctl,
@@ -950,7 +966,7 @@ static snd_pcm_ops_t snd_atiixp_capture_ops = {
950 .pointer = snd_atiixp_pcm_pointer, 966 .pointer = snd_atiixp_pcm_pointer,
951}; 967};
952 968
953static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = { 969static struct atiixp_dma_ops snd_atiixp_playback_dma_ops = {
954 .type = ATI_DMA_PLAYBACK, 970 .type = ATI_DMA_PLAYBACK,
955 .llp_offset = ATI_REG_MODEM_OUT_DMA1_LINKPTR, 971 .llp_offset = ATI_REG_MODEM_OUT_DMA1_LINKPTR,
956 .dt_cur = ATI_REG_MODEM_OUT_DMA1_DT_CUR, 972 .dt_cur = ATI_REG_MODEM_OUT_DMA1_DT_CUR,
@@ -959,7 +975,7 @@ static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
959 .flush_dma = atiixp_out_flush_dma, 975 .flush_dma = atiixp_out_flush_dma,
960}; 976};
961 977
962static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = { 978static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
963 .type = ATI_DMA_CAPTURE, 979 .type = ATI_DMA_CAPTURE,
964 .llp_offset = ATI_REG_MODEM_IN_DMA_LINKPTR, 980 .llp_offset = ATI_REG_MODEM_IN_DMA_LINKPTR,
965 .dt_cur = ATI_REG_MODEM_IN_DMA_DT_CUR, 981 .dt_cur = ATI_REG_MODEM_IN_DMA_DT_CUR,
@@ -968,9 +984,9 @@ static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
968 .flush_dma = atiixp_in_flush_dma, 984 .flush_dma = atiixp_in_flush_dma,
969}; 985};
970 986
971static int __devinit snd_atiixp_pcm_new(atiixp_t *chip) 987static int __devinit snd_atiixp_pcm_new(struct atiixp_modem *chip)
972{ 988{
973 snd_pcm_t *pcm; 989 struct snd_pcm *pcm;
974 int err; 990 int err;
975 991
976 /* initialize constants */ 992 /* initialize constants */
@@ -989,7 +1005,8 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
989 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; 1005 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
990 1006
991 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1007 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
992 snd_dma_pci_data(chip->pci), 64*1024, 128*1024); 1008 snd_dma_pci_data(chip->pci),
1009 64*1024, 128*1024);
993 1010
994 return 0; 1011 return 0;
995} 1012}
@@ -1001,7 +1018,7 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip)
1001 */ 1018 */
1002static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1019static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1003{ 1020{
1004 atiixp_t *chip = dev_id; 1021 struct atiixp_modem *chip = dev_id;
1005 unsigned int status; 1022 unsigned int status;
1006 1023
1007 status = atiixp_read(chip, ISR); 1024 status = atiixp_read(chip, ISR);
@@ -1040,13 +1057,13 @@ static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *r
1040 * ac97 mixer section 1057 * ac97 mixer section
1041 */ 1058 */
1042 1059
1043static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock) 1060static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
1044{ 1061{
1045 ac97_bus_t *pbus; 1062 struct snd_ac97_bus *pbus;
1046 ac97_template_t ac97; 1063 struct snd_ac97_template ac97;
1047 int i, err; 1064 int i, err;
1048 int codec_count; 1065 int codec_count;
1049 static ac97_bus_ops_t ops = { 1066 static struct snd_ac97_bus_ops ops = {
1050 .write = snd_atiixp_ac97_write, 1067 .write = snd_atiixp_ac97_write,
1051 .read = snd_atiixp_ac97_read, 1068 .read = snd_atiixp_ac97_read,
1052 }; 1069 };
@@ -1096,9 +1113,9 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock)
1096/* 1113/*
1097 * power management 1114 * power management
1098 */ 1115 */
1099static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state) 1116static int snd_atiixp_suspend(struct snd_card *card, pm_message_t state)
1100{ 1117{
1101 atiixp_t *chip = card->pm_private_data; 1118 struct atiixp_modem *chip = card->pm_private_data;
1102 int i; 1119 int i;
1103 1120
1104 for (i = 0; i < NUM_ATI_PCMDEVS; i++) 1121 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
@@ -1115,9 +1132,9 @@ static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state)
1115 return 0; 1132 return 0;
1116} 1133}
1117 1134
1118static int snd_atiixp_resume(snd_card_t *card) 1135static int snd_atiixp_resume(struct snd_card *card)
1119{ 1136{
1120 atiixp_t *chip = card->pm_private_data; 1137 struct atiixp_modem *chip = card->pm_private_data;
1121 int i; 1138 int i;
1122 1139
1123 pci_enable_device(chip->pci); 1140 pci_enable_device(chip->pci);
@@ -1140,18 +1157,19 @@ static int snd_atiixp_resume(snd_card_t *card)
1140 * proc interface for register dump 1157 * proc interface for register dump
1141 */ 1158 */
1142 1159
1143static void snd_atiixp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 1160static void snd_atiixp_proc_read(struct snd_info_entry *entry,
1161 struct snd_info_buffer *buffer)
1144{ 1162{
1145 atiixp_t *chip = entry->private_data; 1163 struct atiixp_modem *chip = entry->private_data;
1146 int i; 1164 int i;
1147 1165
1148 for (i = 0; i < 256; i += 4) 1166 for (i = 0; i < 256; i += 4)
1149 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i)); 1167 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i));
1150} 1168}
1151 1169
1152static void __devinit snd_atiixp_proc_init(atiixp_t *chip) 1170static void __devinit snd_atiixp_proc_init(struct atiixp_modem *chip)
1153{ 1171{
1154 snd_info_entry_t *entry; 1172 struct snd_info_entry *entry;
1155 1173
1156 if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) 1174 if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry))
1157 snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read); 1175 snd_info_set_text_ops(entry, chip, 1024, snd_atiixp_proc_read);
@@ -1163,7 +1181,7 @@ static void __devinit snd_atiixp_proc_init(atiixp_t *chip)
1163 * destructor 1181 * destructor
1164 */ 1182 */
1165 1183
1166static int snd_atiixp_free(atiixp_t *chip) 1184static int snd_atiixp_free(struct atiixp_modem *chip)
1167{ 1185{
1168 if (chip->irq < 0) 1186 if (chip->irq < 0)
1169 goto __hw_end; 1187 goto __hw_end;
@@ -1171,7 +1189,7 @@ static int snd_atiixp_free(atiixp_t *chip)
1171 synchronize_irq(chip->irq); 1189 synchronize_irq(chip->irq);
1172 __hw_end: 1190 __hw_end:
1173 if (chip->irq >= 0) 1191 if (chip->irq >= 0)
1174 free_irq(chip->irq, (void *)chip); 1192 free_irq(chip->irq, chip);
1175 if (chip->remap_addr) 1193 if (chip->remap_addr)
1176 iounmap(chip->remap_addr); 1194 iounmap(chip->remap_addr);
1177 pci_release_regions(chip->pci); 1195 pci_release_regions(chip->pci);
@@ -1180,23 +1198,23 @@ static int snd_atiixp_free(atiixp_t *chip)
1180 return 0; 1198 return 0;
1181} 1199}
1182 1200
1183static int snd_atiixp_dev_free(snd_device_t *device) 1201static int snd_atiixp_dev_free(struct snd_device *device)
1184{ 1202{
1185 atiixp_t *chip = device->device_data; 1203 struct atiixp_modem *chip = device->device_data;
1186 return snd_atiixp_free(chip); 1204 return snd_atiixp_free(chip);
1187} 1205}
1188 1206
1189/* 1207/*
1190 * constructor for chip instance 1208 * constructor for chip instance
1191 */ 1209 */
1192static int __devinit snd_atiixp_create(snd_card_t *card, 1210static int __devinit snd_atiixp_create(struct snd_card *card,
1193 struct pci_dev *pci, 1211 struct pci_dev *pci,
1194 atiixp_t **r_chip) 1212 struct atiixp_modem **r_chip)
1195{ 1213{
1196 static snd_device_ops_t ops = { 1214 static struct snd_device_ops ops = {
1197 .dev_free = snd_atiixp_dev_free, 1215 .dev_free = snd_atiixp_dev_free,
1198 }; 1216 };
1199 atiixp_t *chip; 1217 struct atiixp_modem *chip;
1200 int err; 1218 int err;
1201 1219
1202 if ((err = pci_enable_device(pci)) < 0) 1220 if ((err = pci_enable_device(pci)) < 0)
@@ -1226,7 +1244,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1226 return -EIO; 1244 return -EIO;
1227 } 1245 }
1228 1246
1229 if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { 1247 if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ,
1248 card->shortname, chip)) {
1230 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1249 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1231 snd_atiixp_free(chip); 1250 snd_atiixp_free(chip);
1232 return -EBUSY; 1251 return -EBUSY;
@@ -1250,8 +1269,8 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1250static int __devinit snd_atiixp_probe(struct pci_dev *pci, 1269static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1251 const struct pci_device_id *pci_id) 1270 const struct pci_device_id *pci_id)
1252{ 1271{
1253 snd_card_t *card; 1272 struct snd_card *card;
1254 atiixp_t *chip; 1273 struct atiixp_modem *chip;
1255 unsigned char revision; 1274 unsigned char revision;
1256 int err; 1275 int err;
1257 1276