diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 09:02:23 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:19:22 -0500 |
commit | 74ee4ff1e62d9798361763f152c6f07d491be819 (patch) | |
tree | 4790b9498602f38400bc8a371a604ae4fdd4e95c /sound/pci/atiixp.c | |
parent | 17c39d9a59cbf4b3a51a2694134754fc1d3668e7 (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>
Diffstat (limited to 'sound/pci/atiixp.c')
-rw-r--r-- | sound/pci/atiixp.c | 295 |
1 files changed, 156 insertions, 139 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 | /* | 200 | struct atiixp; |
201 | */ | ||
202 | |||
203 | typedef struct snd_atiixp atiixp_t; | ||
204 | typedef struct snd_atiixp_dma atiixp_dma_t; | ||
205 | typedef 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 | ||
212 | typedef struct atiixp_dma_desc { | 206 | struct 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 | */ |
232 | struct snd_atiixp_dma_ops { | 226 | struct 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 | */ |
244 | struct snd_atiixp_dma { | 241 | struct 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 | */ |
261 | struct snd_atiixp { | 258 | struct 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 | */ |
307 | static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, | 304 | static 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 | */ |
350 | static int atiixp_build_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, | 347 | static 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 | */ |
407 | static void atiixp_clear_dma_packets(atiixp_t *chip, atiixp_dma_t *dma, snd_pcm_substream_t *substream) | 407 | static 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 | */ |
419 | static int snd_atiixp_acquire_codec(atiixp_t *chip) | 420 | static 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 | ||
433 | static unsigned short snd_atiixp_codec_read(atiixp_t *chip, unsigned short codec, unsigned short reg) | 434 | static 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 | ||
461 | static void snd_atiixp_codec_write(atiixp_t *chip, unsigned short codec, unsigned short reg, unsigned short val) | 462 | static 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 | ||
474 | static unsigned short snd_atiixp_ac97_read(ac97_t *ac97, unsigned short reg) | 476 | static 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 | ||
481 | static void snd_atiixp_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) | 484 | static 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 | */ |
490 | static int snd_atiixp_aclink_reset(atiixp_t *chip) | 494 | static 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 |
526 | static int snd_atiixp_aclink_down(atiixp_t *chip) | 530 | static 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 | ||
551 | static int snd_atiixp_codec_detect(atiixp_t *chip) | 555 | static 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 | */ |
577 | static int snd_atiixp_chip_start(atiixp_t *chip) | 581 | static 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 | */ |
607 | static int snd_atiixp_chip_stop(atiixp_t *chip) | 611 | static 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 | */ |
626 | static snd_pcm_uframes_t snd_atiixp_pcm_pointer(snd_pcm_substream_t *substream) | 630 | static 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 | */ |
651 | static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma) | 655 | static 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 | */ |
662 | static void snd_atiixp_update_dma(atiixp_t *chip, atiixp_dma_t *dma) | 666 | static 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 */ |
671 | static void snd_atiixp_check_bus_busy(atiixp_t *chip) | 675 | static 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 | */ |
686 | static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | 690 | static 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 */ |
733 | static void atiixp_out_flush_dma(atiixp_t *chip) | 737 | static 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 */ |
739 | static void atiixp_out_enable_dma(atiixp_t *chip, int on) | 743 | static 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 */ |
754 | static void atiixp_out_enable_transfer(atiixp_t *chip, int on) | 758 | static 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 */ |
761 | static void atiixp_in_enable_dma(atiixp_t *chip, int on) | 765 | static 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 */ |
768 | static void atiixp_in_enable_transfer(atiixp_t *chip, int on) | 772 | static 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 */ |
787 | static void atiixp_in_flush_dma(atiixp_t *chip) | 791 | static 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 */ |
793 | static void atiixp_spdif_enable_dma(atiixp_t *chip, int on) | 797 | static 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 */ |
800 | static void atiixp_spdif_enable_transfer(atiixp_t *chip, int on) | 804 | static 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 */ |
812 | static void atiixp_spdif_flush_dma(atiixp_t *chip) | 816 | static 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 */ |
831 | static int snd_atiixp_spdif_prepare(snd_pcm_substream_t *substream) | 835 | static 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 */ |
858 | static int snd_atiixp_playback_prepare(snd_pcm_substream_t *substream) | 862 | static 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 */ |
903 | static int snd_atiixp_capture_prepare(snd_pcm_substream_t *substream) | 907 | static 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 | */ |
918 | static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream, | 922 | static 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 | ||
956 | static int snd_atiixp_pcm_hw_free(snd_pcm_substream_t * substream) | 960 | static 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 | */ |
975 | static snd_pcm_hardware_t snd_atiixp_pcm_hw = | 979 | static 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 | ||
995 | static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma, int pcm_type) | 999 | static 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 | ||
1028 | static int snd_atiixp_pcm_close(snd_pcm_substream_t *substream, atiixp_dma_t *dma) | 1033 | static 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 | */ |
1043 | static int snd_atiixp_playback_open(snd_pcm_substream_t *substream) | 1049 | static 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 | ||
1061 | static int snd_atiixp_playback_close(snd_pcm_substream_t *substream) | 1067 | static 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 | ||
1071 | static int snd_atiixp_capture_open(snd_pcm_substream_t *substream) | 1077 | static 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 | ||
1077 | static int snd_atiixp_capture_close(snd_pcm_substream_t *substream) | 1083 | static 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 | ||
1083 | static int snd_atiixp_spdif_open(snd_pcm_substream_t *substream) | 1089 | static 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 | ||
1096 | static int snd_atiixp_spdif_close(snd_pcm_substream_t *substream) | 1102 | static 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 */ |
1110 | static snd_pcm_ops_t snd_atiixp_playback_ops = { | 1116 | static 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 */ |
1122 | static snd_pcm_ops_t snd_atiixp_capture_ops = { | 1128 | static 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 */ |
1134 | static snd_pcm_ops_t snd_atiixp_spdif_ops = { | 1140 | static 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 | ||
1181 | static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = { | 1187 | static 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 | ||
1190 | static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = { | 1196 | static 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 | ||
1199 | static atiixp_dma_ops_t snd_atiixp_spdif_dma_ops = { | 1205 | static 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 | ||
1209 | static int __devinit snd_atiixp_pcm_new(atiixp_t *chip) | 1215 | static 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 | */ |
1290 | static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 1302 | static 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 | ||
1347 | static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char *quirk_override) | 1359 | static 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 | */ |
1405 | static int snd_atiixp_suspend(snd_card_t *card, pm_message_t state) | 1418 | static 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 | ||
1428 | static int snd_atiixp_resume(snd_card_t *card) | 1442 | static 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 | ||
1465 | static void snd_atiixp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | 1480 | static 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 | ||
1474 | static void __devinit snd_atiixp_proc_init(atiixp_t *chip) | 1490 | static 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 | ||
1488 | static int snd_atiixp_free(atiixp_t *chip) | 1504 | static 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 | ||
1505 | static int snd_atiixp_dev_free(snd_device_t *device) | 1521 | static 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 | */ |
1514 | static int __devinit snd_atiixp_create(snd_card_t *card, | 1530 | static 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, | |||
1572 | static int __devinit snd_atiixp_probe(struct pci_dev *pci, | 1589 | static 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 | ||