diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 09:06:15 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:19:49 -0500 |
commit | e437e3d7c7fb656010f8f767d20215e67b847685 (patch) | |
tree | 807b22db635295cded8ccb5af23f491b22a2a2e6 /sound/pci/via82xx_modem.c | |
parent | 016e401c2e64ce5c440b1f68eae4a53273aa0bc2 (diff) |
[ALSA] Remove xxx_t typedefs: PCI VIA82xx
Modules: VIA82xx driver,VIA82xx-modem driver
Remove xxx_t typedefs from the PCI VIA82xx and modem drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/via82xx_modem.c')
-rw-r--r-- | sound/pci/via82xx_modem.c | 217 |
1 files changed, 116 insertions, 101 deletions
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index b83660bd05b0..55ef69a8d2de 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -206,9 +206,6 @@ DEFINE_VIA_REGSET(MI, 0x50); | |||
206 | VIA_MC97_CTRL_SECONDARY) | 206 | VIA_MC97_CTRL_SECONDARY) |
207 | 207 | ||
208 | 208 | ||
209 | typedef struct _snd_via82xx_modem via82xx_t; | ||
210 | typedef struct via_dev viadev_t; | ||
211 | |||
212 | /* | 209 | /* |
213 | * pcm stream | 210 | * pcm stream |
214 | */ | 211 | */ |
@@ -220,11 +217,11 @@ struct snd_via_sg_table { | |||
220 | 217 | ||
221 | #define VIA_TABLE_SIZE 255 | 218 | #define VIA_TABLE_SIZE 255 |
222 | 219 | ||
223 | struct via_dev { | 220 | struct viadev { |
224 | unsigned int reg_offset; | 221 | unsigned int reg_offset; |
225 | unsigned long port; | 222 | unsigned long port; |
226 | int direction; /* playback = 0, capture = 1 */ | 223 | int direction; /* playback = 0, capture = 1 */ |
227 | snd_pcm_substream_t *substream; | 224 | struct snd_pcm_substream *substream; |
228 | int running; | 225 | int running; |
229 | unsigned int tbl_entries; /* # descriptors */ | 226 | unsigned int tbl_entries; /* # descriptors */ |
230 | struct snd_dma_buffer table; | 227 | struct snd_dma_buffer table; |
@@ -239,7 +236,7 @@ enum { TYPE_CARD_VIA82XX_MODEM = 1 }; | |||
239 | 236 | ||
240 | #define VIA_MAX_MODEM_DEVS 2 | 237 | #define VIA_MAX_MODEM_DEVS 2 |
241 | 238 | ||
242 | struct _snd_via82xx_modem { | 239 | struct via82xx_modem { |
243 | int irq; | 240 | int irq; |
244 | 241 | ||
245 | unsigned long port; | 242 | unsigned long port; |
@@ -247,21 +244,21 @@ struct _snd_via82xx_modem { | |||
247 | unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */ | 244 | unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */ |
248 | 245 | ||
249 | struct pci_dev *pci; | 246 | struct pci_dev *pci; |
250 | snd_card_t *card; | 247 | struct snd_card *card; |
251 | 248 | ||
252 | unsigned int num_devs; | 249 | unsigned int num_devs; |
253 | unsigned int playback_devno, capture_devno; | 250 | unsigned int playback_devno, capture_devno; |
254 | viadev_t devs[VIA_MAX_MODEM_DEVS]; | 251 | struct viadev devs[VIA_MAX_MODEM_DEVS]; |
255 | 252 | ||
256 | snd_pcm_t *pcms[2]; | 253 | struct snd_pcm *pcms[2]; |
257 | 254 | ||
258 | ac97_bus_t *ac97_bus; | 255 | struct snd_ac97_bus *ac97_bus; |
259 | ac97_t *ac97; | 256 | struct snd_ac97 *ac97; |
260 | unsigned int ac97_clock; | 257 | unsigned int ac97_clock; |
261 | unsigned int ac97_secondary; /* secondary AC'97 codec is present */ | 258 | unsigned int ac97_secondary; /* secondary AC'97 codec is present */ |
262 | 259 | ||
263 | spinlock_t reg_lock; | 260 | spinlock_t reg_lock; |
264 | snd_info_entry_t *proc_entry; | 261 | struct snd_info_entry *proc_entry; |
265 | }; | 262 | }; |
266 | 263 | ||
267 | static struct pci_device_id snd_via82xx_modem_ids[] = { | 264 | static struct pci_device_id snd_via82xx_modem_ids[] = { |
@@ -279,12 +276,12 @@ MODULE_DEVICE_TABLE(pci, snd_via82xx_modem_ids); | |||
279 | * periods = number of periods | 276 | * periods = number of periods |
280 | * fragsize = period size in bytes | 277 | * fragsize = period size in bytes |
281 | */ | 278 | */ |
282 | static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream, | 279 | static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream, |
283 | struct pci_dev *pci, | 280 | struct pci_dev *pci, |
284 | unsigned int periods, unsigned int fragsize) | 281 | unsigned int periods, unsigned int fragsize) |
285 | { | 282 | { |
286 | unsigned int i, idx, ofs, rest; | 283 | unsigned int i, idx, ofs, rest; |
287 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 284 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
288 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); | 285 | struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); |
289 | 286 | ||
290 | if (dev->table.area == NULL) { | 287 | if (dev->table.area == NULL) { |
@@ -346,7 +343,7 @@ static int build_via_table(viadev_t *dev, snd_pcm_substream_t *substream, | |||
346 | } | 343 | } |
347 | 344 | ||
348 | 345 | ||
349 | static int clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream, | 346 | static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream, |
350 | struct pci_dev *pci) | 347 | struct pci_dev *pci) |
351 | { | 348 | { |
352 | if (dev->table.area) { | 349 | if (dev->table.area) { |
@@ -362,17 +359,17 @@ static int clean_via_table(viadev_t *dev, snd_pcm_substream_t *substream, | |||
362 | * Basic I/O | 359 | * Basic I/O |
363 | */ | 360 | */ |
364 | 361 | ||
365 | static inline unsigned int snd_via82xx_codec_xread(via82xx_t *chip) | 362 | static inline unsigned int snd_via82xx_codec_xread(struct via82xx_modem *chip) |
366 | { | 363 | { |
367 | return inl(VIAREG(chip, AC97)); | 364 | return inl(VIAREG(chip, AC97)); |
368 | } | 365 | } |
369 | 366 | ||
370 | static inline void snd_via82xx_codec_xwrite(via82xx_t *chip, unsigned int val) | 367 | static inline void snd_via82xx_codec_xwrite(struct via82xx_modem *chip, unsigned int val) |
371 | { | 368 | { |
372 | outl(val, VIAREG(chip, AC97)); | 369 | outl(val, VIAREG(chip, AC97)); |
373 | } | 370 | } |
374 | 371 | ||
375 | static int snd_via82xx_codec_ready(via82xx_t *chip, int secondary) | 372 | static int snd_via82xx_codec_ready(struct via82xx_modem *chip, int secondary) |
376 | { | 373 | { |
377 | unsigned int timeout = 1000; /* 1ms */ | 374 | unsigned int timeout = 1000; /* 1ms */ |
378 | unsigned int val; | 375 | unsigned int val; |
@@ -382,11 +379,12 @@ static int snd_via82xx_codec_ready(via82xx_t *chip, int secondary) | |||
382 | if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) | 379 | if (!((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY)) |
383 | return val & 0xffff; | 380 | return val & 0xffff; |
384 | } | 381 | } |
385 | snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_via82xx_codec_xread(chip)); | 382 | snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", |
383 | secondary, snd_via82xx_codec_xread(chip)); | ||
386 | return -EIO; | 384 | return -EIO; |
387 | } | 385 | } |
388 | 386 | ||
389 | static int snd_via82xx_codec_valid(via82xx_t *chip, int secondary) | 387 | static int snd_via82xx_codec_valid(struct via82xx_modem *chip, int secondary) |
390 | { | 388 | { |
391 | unsigned int timeout = 1000; /* 1ms */ | 389 | unsigned int timeout = 1000; /* 1ms */ |
392 | unsigned int val, val1; | 390 | unsigned int val, val1; |
@@ -403,20 +401,20 @@ static int snd_via82xx_codec_valid(via82xx_t *chip, int secondary) | |||
403 | return -EIO; | 401 | return -EIO; |
404 | } | 402 | } |
405 | 403 | ||
406 | static void snd_via82xx_codec_wait(ac97_t *ac97) | 404 | static void snd_via82xx_codec_wait(struct snd_ac97 *ac97) |
407 | { | 405 | { |
408 | via82xx_t *chip = ac97->private_data; | 406 | struct via82xx_modem *chip = ac97->private_data; |
409 | int err; | 407 | int err; |
410 | err = snd_via82xx_codec_ready(chip, ac97->num); | 408 | err = snd_via82xx_codec_ready(chip, ac97->num); |
411 | /* here we need to wait fairly for long time.. */ | 409 | /* here we need to wait fairly for long time.. */ |
412 | msleep(500); | 410 | msleep(500); |
413 | } | 411 | } |
414 | 412 | ||
415 | static void snd_via82xx_codec_write(ac97_t *ac97, | 413 | static void snd_via82xx_codec_write(struct snd_ac97 *ac97, |
416 | unsigned short reg, | 414 | unsigned short reg, |
417 | unsigned short val) | 415 | unsigned short val) |
418 | { | 416 | { |
419 | via82xx_t *chip = ac97->private_data; | 417 | struct via82xx_modem *chip = ac97->private_data; |
420 | unsigned int xval; | 418 | unsigned int xval; |
421 | if(reg == AC97_GPIO_STATUS) { | 419 | if(reg == AC97_GPIO_STATUS) { |
422 | outl(val, VIAREG(chip, GPI_STATUS)); | 420 | outl(val, VIAREG(chip, GPI_STATUS)); |
@@ -430,9 +428,9 @@ static void snd_via82xx_codec_write(ac97_t *ac97, | |||
430 | snd_via82xx_codec_ready(chip, ac97->num); | 428 | snd_via82xx_codec_ready(chip, ac97->num); |
431 | } | 429 | } |
432 | 430 | ||
433 | static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) | 431 | static unsigned short snd_via82xx_codec_read(struct snd_ac97 *ac97, unsigned short reg) |
434 | { | 432 | { |
435 | via82xx_t *chip = ac97->private_data; | 433 | struct via82xx_modem *chip = ac97->private_data; |
436 | unsigned int xval, val = 0xffff; | 434 | unsigned int xval, val = 0xffff; |
437 | int again = 0; | 435 | int again = 0; |
438 | 436 | ||
@@ -442,7 +440,8 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) | |||
442 | xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; | 440 | xval |= (reg & 0x7f) << VIA_REG_AC97_CMD_SHIFT; |
443 | while (1) { | 441 | while (1) { |
444 | if (again++ > 3) { | 442 | if (again++ > 3) { |
445 | snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", ac97->num, snd_via82xx_codec_xread(chip)); | 443 | snd_printk(KERN_ERR "codec_read: codec %i is not valid [0x%x]\n", |
444 | ac97->num, snd_via82xx_codec_xread(chip)); | ||
446 | return 0xffff; | 445 | return 0xffff; |
447 | } | 446 | } |
448 | snd_via82xx_codec_xwrite(chip, xval); | 447 | snd_via82xx_codec_xwrite(chip, xval); |
@@ -456,7 +455,7 @@ static unsigned short snd_via82xx_codec_read(ac97_t *ac97, unsigned short reg) | |||
456 | return val & 0xffff; | 455 | return val & 0xffff; |
457 | } | 456 | } |
458 | 457 | ||
459 | static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) | 458 | static void snd_via82xx_channel_reset(struct via82xx_modem *chip, struct viadev *viadev) |
460 | { | 459 | { |
461 | outb(VIA_REG_CTRL_PAUSE | VIA_REG_CTRL_TERMINATE | VIA_REG_CTRL_RESET, | 460 | outb(VIA_REG_CTRL_PAUSE | VIA_REG_CTRL_TERMINATE | VIA_REG_CTRL_RESET, |
462 | VIADEV_REG(viadev, OFFSET_CONTROL)); | 461 | VIADEV_REG(viadev, OFFSET_CONTROL)); |
@@ -478,7 +477,7 @@ static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) | |||
478 | 477 | ||
479 | static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 478 | static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
480 | { | 479 | { |
481 | via82xx_t *chip = dev_id; | 480 | struct via82xx_modem *chip = dev_id; |
482 | unsigned int status; | 481 | unsigned int status; |
483 | unsigned int i; | 482 | unsigned int i; |
484 | 483 | ||
@@ -491,7 +490,7 @@ static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs * | |||
491 | /* check status for each stream */ | 490 | /* check status for each stream */ |
492 | spin_lock(&chip->reg_lock); | 491 | spin_lock(&chip->reg_lock); |
493 | for (i = 0; i < chip->num_devs; i++) { | 492 | for (i = 0; i < chip->num_devs; i++) { |
494 | viadev_t *viadev = &chip->devs[i]; | 493 | struct viadev *viadev = &chip->devs[i]; |
495 | unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); | 494 | unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); |
496 | c_status &= (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG|VIA_REG_STAT_STOPPED); | 495 | c_status &= (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG|VIA_REG_STAT_STOPPED); |
497 | if (! c_status) | 496 | if (! c_status) |
@@ -514,10 +513,10 @@ static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs * | |||
514 | /* | 513 | /* |
515 | * trigger callback | 514 | * trigger callback |
516 | */ | 515 | */ |
517 | static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) | 516 | static int snd_via82xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
518 | { | 517 | { |
519 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 518 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
520 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 519 | struct viadev *viadev = substream->runtime->private_data; |
521 | unsigned char val = 0; | 520 | unsigned char val = 0; |
522 | 521 | ||
523 | switch (cmd) { | 522 | switch (cmd) { |
@@ -555,9 +554,11 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd) | |||
555 | */ | 554 | */ |
556 | 555 | ||
557 | #define check_invalid_pos(viadev,pos) \ | 556 | #define check_invalid_pos(viadev,pos) \ |
558 | ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 || viadev->lastpos < viadev->bufsize2)) | 557 | ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\ |
558 | viadev->lastpos < viadev->bufsize2)) | ||
559 | 559 | ||
560 | static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, unsigned int count) | 560 | static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx, |
561 | unsigned int count) | ||
561 | { | 562 | { |
562 | unsigned int size, res; | 563 | unsigned int size, res; |
563 | 564 | ||
@@ -566,24 +567,33 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u | |||
566 | 567 | ||
567 | /* check the validity of the calculated position */ | 568 | /* check the validity of the calculated position */ |
568 | if (size < count) { | 569 | if (size < count) { |
569 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", (int)size, (int)count); | 570 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr (size = %d, count = %d)\n", |
571 | (int)size, (int)count); | ||
570 | res = viadev->lastpos; | 572 | res = viadev->lastpos; |
571 | } else if (check_invalid_pos(viadev, res)) { | 573 | } else if (check_invalid_pos(viadev, res)) { |
572 | #ifdef POINTER_DEBUG | 574 | #ifdef POINTER_DEBUG |
573 | printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count); | 575 | printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, " |
576 | "bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, " | ||
577 | "count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, | ||
578 | viadev->bufsize2, viadev->idx_table[idx].offset, | ||
579 | viadev->idx_table[idx].size, count); | ||
574 | #endif | 580 | #endif |
575 | if (count && size < count) { | 581 | if (count && size < count) { |
576 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr, using last valid pointer\n"); | 582 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr, " |
583 | "using last valid pointer\n"); | ||
577 | res = viadev->lastpos; | 584 | res = viadev->lastpos; |
578 | } else { | 585 | } else { |
579 | if (! count) | 586 | if (! count) |
580 | /* bogus count 0 on the DMA boundary? */ | 587 | /* bogus count 0 on the DMA boundary? */ |
581 | res = viadev->idx_table[idx].offset; | 588 | res = viadev->idx_table[idx].offset; |
582 | else | 589 | else |
583 | /* count register returns full size when end of buffer is reached */ | 590 | /* count register returns full size |
591 | * when end of buffer is reached | ||
592 | */ | ||
584 | res = viadev->idx_table[idx].offset + size; | 593 | res = viadev->idx_table[idx].offset + size; |
585 | if (check_invalid_pos(viadev, res)) { | 594 | if (check_invalid_pos(viadev, res)) { |
586 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), using last valid pointer\n"); | 595 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr (2), " |
596 | "using last valid pointer\n"); | ||
587 | res = viadev->lastpos; | 597 | res = viadev->lastpos; |
588 | } | 598 | } |
589 | } | 599 | } |
@@ -597,10 +607,10 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u | |||
597 | /* | 607 | /* |
598 | * get the current pointer on via686 | 608 | * get the current pointer on via686 |
599 | */ | 609 | */ |
600 | static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) | 610 | static snd_pcm_uframes_t snd_via686_pcm_pointer(struct snd_pcm_substream *substream) |
601 | { | 611 | { |
602 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 612 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
603 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 613 | struct viadev *viadev = substream->runtime->private_data; |
604 | unsigned int idx, ptr, count, res; | 614 | unsigned int idx, ptr, count, res; |
605 | 615 | ||
606 | snd_assert(viadev->tbl_entries, return 0); | 616 | snd_assert(viadev->tbl_entries, return 0); |
@@ -616,7 +626,8 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) | |||
616 | if (ptr <= (unsigned int)viadev->table.addr) | 626 | if (ptr <= (unsigned int)viadev->table.addr) |
617 | idx = 0; | 627 | idx = 0; |
618 | else /* CURR_PTR holds the address + 8 */ | 628 | else /* CURR_PTR holds the address + 8 */ |
619 | idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; | 629 | idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % |
630 | viadev->tbl_entries; | ||
620 | res = calc_linear_pos(viadev, idx, count); | 631 | res = calc_linear_pos(viadev, idx, count); |
621 | spin_unlock(&chip->reg_lock); | 632 | spin_unlock(&chip->reg_lock); |
622 | 633 | ||
@@ -627,11 +638,11 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) | |||
627 | * hw_params callback: | 638 | * hw_params callback: |
628 | * allocate the buffer and build up the buffer description table | 639 | * allocate the buffer and build up the buffer description table |
629 | */ | 640 | */ |
630 | static int snd_via82xx_hw_params(snd_pcm_substream_t * substream, | 641 | static int snd_via82xx_hw_params(struct snd_pcm_substream *substream, |
631 | snd_pcm_hw_params_t * hw_params) | 642 | struct snd_pcm_hw_params *hw_params) |
632 | { | 643 | { |
633 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 644 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
634 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 645 | struct viadev *viadev = substream->runtime->private_data; |
635 | int err; | 646 | int err; |
636 | 647 | ||
637 | err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | 648 | err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
@@ -653,10 +664,10 @@ static int snd_via82xx_hw_params(snd_pcm_substream_t * substream, | |||
653 | * hw_free callback: | 664 | * hw_free callback: |
654 | * clean up the buffer description table and release the buffer | 665 | * clean up the buffer description table and release the buffer |
655 | */ | 666 | */ |
656 | static int snd_via82xx_hw_free(snd_pcm_substream_t * substream) | 667 | static int snd_via82xx_hw_free(struct snd_pcm_substream *substream) |
657 | { | 668 | { |
658 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 669 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
659 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 670 | struct viadev *viadev = substream->runtime->private_data; |
660 | 671 | ||
661 | clean_via_table(viadev, substream, chip->pci); | 672 | clean_via_table(viadev, substream, chip->pci); |
662 | snd_pcm_lib_free_pages(substream); | 673 | snd_pcm_lib_free_pages(substream); |
@@ -667,7 +678,7 @@ static int snd_via82xx_hw_free(snd_pcm_substream_t * substream) | |||
667 | /* | 678 | /* |
668 | * set up the table pointer | 679 | * set up the table pointer |
669 | */ | 680 | */ |
670 | static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev) | 681 | static void snd_via82xx_set_table_ptr(struct via82xx_modem *chip, struct viadev *viadev) |
671 | { | 682 | { |
672 | snd_via82xx_codec_ready(chip, chip->ac97_secondary); | 683 | snd_via82xx_codec_ready(chip, chip->ac97_secondary); |
673 | outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR)); | 684 | outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR)); |
@@ -678,10 +689,10 @@ static void snd_via82xx_set_table_ptr(via82xx_t *chip, viadev_t *viadev) | |||
678 | /* | 689 | /* |
679 | * prepare callback for playback and capture | 690 | * prepare callback for playback and capture |
680 | */ | 691 | */ |
681 | static int snd_via82xx_pcm_prepare(snd_pcm_substream_t *substream) | 692 | static int snd_via82xx_pcm_prepare(struct snd_pcm_substream *substream) |
682 | { | 693 | { |
683 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 694 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
684 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 695 | struct viadev *viadev = substream->runtime->private_data; |
685 | 696 | ||
686 | snd_via82xx_channel_reset(chip, viadev); | 697 | snd_via82xx_channel_reset(chip, viadev); |
687 | /* this must be set after channel_reset */ | 698 | /* this must be set after channel_reset */ |
@@ -694,7 +705,7 @@ static int snd_via82xx_pcm_prepare(snd_pcm_substream_t *substream) | |||
694 | /* | 705 | /* |
695 | * pcm hardware definition, identical for both playback and capture | 706 | * pcm hardware definition, identical for both playback and capture |
696 | */ | 707 | */ |
697 | static snd_pcm_hardware_t snd_via82xx_hw = | 708 | static struct snd_pcm_hardware snd_via82xx_hw = |
698 | { | 709 | { |
699 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 710 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
700 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 711 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -719,12 +730,13 @@ static snd_pcm_hardware_t snd_via82xx_hw = | |||
719 | /* | 730 | /* |
720 | * open callback skeleton | 731 | * open callback skeleton |
721 | */ | 732 | */ |
722 | static int snd_via82xx_modem_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm_substream_t * substream) | 733 | static int snd_via82xx_modem_pcm_open(struct via82xx_modem *chip, struct viadev *viadev, |
734 | struct snd_pcm_substream *substream) | ||
723 | { | 735 | { |
724 | snd_pcm_runtime_t *runtime = substream->runtime; | 736 | struct snd_pcm_runtime *runtime = substream->runtime; |
725 | int err; | 737 | int err; |
726 | static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; | 738 | static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; |
727 | static snd_pcm_hw_constraint_list_t hw_constraints_rates = { | 739 | static struct snd_pcm_hw_constraint_list hw_constraints_rates = { |
728 | .count = ARRAY_SIZE(rates), | 740 | .count = ARRAY_SIZE(rates), |
729 | .list = rates, | 741 | .list = rates, |
730 | .mask = 0, | 742 | .mask = 0, |
@@ -732,7 +744,8 @@ static int snd_via82xx_modem_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm | |||
732 | 744 | ||
733 | runtime->hw = snd_via82xx_hw; | 745 | runtime->hw = snd_via82xx_hw; |
734 | 746 | ||
735 | if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0) | 747 | if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, |
748 | &hw_constraints_rates)) < 0) | ||
736 | return err; | 749 | return err; |
737 | 750 | ||
738 | /* we may remove following constaint when we modify table entries | 751 | /* we may remove following constaint when we modify table entries |
@@ -750,10 +763,10 @@ static int snd_via82xx_modem_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm | |||
750 | /* | 763 | /* |
751 | * open callback for playback | 764 | * open callback for playback |
752 | */ | 765 | */ |
753 | static int snd_via82xx_playback_open(snd_pcm_substream_t * substream) | 766 | static int snd_via82xx_playback_open(struct snd_pcm_substream *substream) |
754 | { | 767 | { |
755 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 768 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
756 | viadev_t *viadev = &chip->devs[chip->playback_devno + substream->number]; | 769 | struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; |
757 | 770 | ||
758 | return snd_via82xx_modem_pcm_open(chip, viadev, substream); | 771 | return snd_via82xx_modem_pcm_open(chip, viadev, substream); |
759 | } | 772 | } |
@@ -761,10 +774,10 @@ static int snd_via82xx_playback_open(snd_pcm_substream_t * substream) | |||
761 | /* | 774 | /* |
762 | * open callback for capture | 775 | * open callback for capture |
763 | */ | 776 | */ |
764 | static int snd_via82xx_capture_open(snd_pcm_substream_t * substream) | 777 | static int snd_via82xx_capture_open(struct snd_pcm_substream *substream) |
765 | { | 778 | { |
766 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 779 | struct via82xx_modem *chip = snd_pcm_substream_chip(substream); |
767 | viadev_t *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; | 780 | struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; |
768 | 781 | ||
769 | return snd_via82xx_modem_pcm_open(chip, viadev, substream); | 782 | return snd_via82xx_modem_pcm_open(chip, viadev, substream); |
770 | } | 783 | } |
@@ -772,9 +785,9 @@ static int snd_via82xx_capture_open(snd_pcm_substream_t * substream) | |||
772 | /* | 785 | /* |
773 | * close callback | 786 | * close callback |
774 | */ | 787 | */ |
775 | static int snd_via82xx_pcm_close(snd_pcm_substream_t * substream) | 788 | static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream) |
776 | { | 789 | { |
777 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 790 | struct viadev *viadev = substream->runtime->private_data; |
778 | 791 | ||
779 | viadev->substream = NULL; | 792 | viadev->substream = NULL; |
780 | return 0; | 793 | return 0; |
@@ -782,7 +795,7 @@ static int snd_via82xx_pcm_close(snd_pcm_substream_t * substream) | |||
782 | 795 | ||
783 | 796 | ||
784 | /* via686 playback callbacks */ | 797 | /* via686 playback callbacks */ |
785 | static snd_pcm_ops_t snd_via686_playback_ops = { | 798 | static struct snd_pcm_ops snd_via686_playback_ops = { |
786 | .open = snd_via82xx_playback_open, | 799 | .open = snd_via82xx_playback_open, |
787 | .close = snd_via82xx_pcm_close, | 800 | .close = snd_via82xx_pcm_close, |
788 | .ioctl = snd_pcm_lib_ioctl, | 801 | .ioctl = snd_pcm_lib_ioctl, |
@@ -795,7 +808,7 @@ static snd_pcm_ops_t snd_via686_playback_ops = { | |||
795 | }; | 808 | }; |
796 | 809 | ||
797 | /* via686 capture callbacks */ | 810 | /* via686 capture callbacks */ |
798 | static snd_pcm_ops_t snd_via686_capture_ops = { | 811 | static struct snd_pcm_ops snd_via686_capture_ops = { |
799 | .open = snd_via82xx_capture_open, | 812 | .open = snd_via82xx_capture_open, |
800 | .close = snd_via82xx_pcm_close, | 813 | .close = snd_via82xx_pcm_close, |
801 | .ioctl = snd_pcm_lib_ioctl, | 814 | .ioctl = snd_pcm_lib_ioctl, |
@@ -808,7 +821,8 @@ static snd_pcm_ops_t snd_via686_capture_ops = { | |||
808 | }; | 821 | }; |
809 | 822 | ||
810 | 823 | ||
811 | static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int direction) | 824 | static void init_viadev(struct via82xx_modem *chip, int idx, unsigned int reg_offset, |
825 | int direction) | ||
812 | { | 826 | { |
813 | chip->devs[idx].reg_offset = reg_offset; | 827 | chip->devs[idx].reg_offset = reg_offset; |
814 | chip->devs[idx].direction = direction; | 828 | chip->devs[idx].direction = direction; |
@@ -818,9 +832,9 @@ static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int d | |||
818 | /* | 832 | /* |
819 | * create a pcm instance for via686a/b | 833 | * create a pcm instance for via686a/b |
820 | */ | 834 | */ |
821 | static int __devinit snd_via686_pcm_new(via82xx_t *chip) | 835 | static int __devinit snd_via686_pcm_new(struct via82xx_modem *chip) |
822 | { | 836 | { |
823 | snd_pcm_t *pcm; | 837 | struct snd_pcm *pcm; |
824 | int err; | 838 | int err; |
825 | 839 | ||
826 | chip->playback_devno = 0; | 840 | chip->playback_devno = 0; |
@@ -841,7 +855,8 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) | |||
841 | init_viadev(chip, 1, VIA_REG_MI_STATUS, 1); | 855 | init_viadev(chip, 1, VIA_REG_MI_STATUS, 1); |
842 | 856 | ||
843 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 857 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
844 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) | 858 | snd_dma_pci_data(chip->pci), |
859 | 64*1024, 128*1024)) < 0) | ||
845 | return err; | 860 | return err; |
846 | 861 | ||
847 | return 0; | 862 | return 0; |
@@ -853,24 +868,24 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) | |||
853 | */ | 868 | */ |
854 | 869 | ||
855 | 870 | ||
856 | static void snd_via82xx_mixer_free_ac97_bus(ac97_bus_t *bus) | 871 | static void snd_via82xx_mixer_free_ac97_bus(struct snd_ac97_bus *bus) |
857 | { | 872 | { |
858 | via82xx_t *chip = bus->private_data; | 873 | struct via82xx_modem *chip = bus->private_data; |
859 | chip->ac97_bus = NULL; | 874 | chip->ac97_bus = NULL; |
860 | } | 875 | } |
861 | 876 | ||
862 | static void snd_via82xx_mixer_free_ac97(ac97_t *ac97) | 877 | static void snd_via82xx_mixer_free_ac97(struct snd_ac97 *ac97) |
863 | { | 878 | { |
864 | via82xx_t *chip = ac97->private_data; | 879 | struct via82xx_modem *chip = ac97->private_data; |
865 | chip->ac97 = NULL; | 880 | chip->ac97 = NULL; |
866 | } | 881 | } |
867 | 882 | ||
868 | 883 | ||
869 | static int __devinit snd_via82xx_mixer_new(via82xx_t *chip) | 884 | static int __devinit snd_via82xx_mixer_new(struct via82xx_modem *chip) |
870 | { | 885 | { |
871 | ac97_template_t ac97; | 886 | struct snd_ac97_template ac97; |
872 | int err; | 887 | int err; |
873 | static ac97_bus_ops_t ops = { | 888 | static struct snd_ac97_bus_ops ops = { |
874 | .write = snd_via82xx_codec_write, | 889 | .write = snd_via82xx_codec_write, |
875 | .read = snd_via82xx_codec_read, | 890 | .read = snd_via82xx_codec_read, |
876 | .wait = snd_via82xx_codec_wait, | 891 | .wait = snd_via82xx_codec_wait, |
@@ -898,9 +913,9 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip) | |||
898 | /* | 913 | /* |
899 | * proc interface | 914 | * proc interface |
900 | */ | 915 | */ |
901 | static void snd_via82xx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | 916 | static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) |
902 | { | 917 | { |
903 | via82xx_t *chip = entry->private_data; | 918 | struct via82xx_modem *chip = entry->private_data; |
904 | int i; | 919 | int i; |
905 | 920 | ||
906 | snd_iprintf(buffer, "%s\n\n", chip->card->longname); | 921 | snd_iprintf(buffer, "%s\n\n", chip->card->longname); |
@@ -909,9 +924,9 @@ static void snd_via82xx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *bu | |||
909 | } | 924 | } |
910 | } | 925 | } |
911 | 926 | ||
912 | static void __devinit snd_via82xx_proc_init(via82xx_t *chip) | 927 | static void __devinit snd_via82xx_proc_init(struct via82xx_modem *chip) |
913 | { | 928 | { |
914 | snd_info_entry_t *entry; | 929 | struct snd_info_entry *entry; |
915 | 930 | ||
916 | if (! snd_card_proc_new(chip->card, "via82xx", &entry)) | 931 | if (! snd_card_proc_new(chip->card, "via82xx", &entry)) |
917 | snd_info_set_text_ops(entry, chip, 1024, snd_via82xx_proc_read); | 932 | snd_info_set_text_ops(entry, chip, 1024, snd_via82xx_proc_read); |
@@ -921,7 +936,7 @@ static void __devinit snd_via82xx_proc_init(via82xx_t *chip) | |||
921 | * | 936 | * |
922 | */ | 937 | */ |
923 | 938 | ||
924 | static int snd_via82xx_chip_init(via82xx_t *chip) | 939 | static int snd_via82xx_chip_init(struct via82xx_modem *chip) |
925 | { | 940 | { |
926 | unsigned int val; | 941 | unsigned int val; |
927 | unsigned long end_time; | 942 | unsigned long end_time; |
@@ -1004,9 +1019,9 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1004 | /* | 1019 | /* |
1005 | * power management | 1020 | * power management |
1006 | */ | 1021 | */ |
1007 | static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state) | 1022 | static int snd_via82xx_suspend(struct snd_card *card, pm_message_t state) |
1008 | { | 1023 | { |
1009 | via82xx_t *chip = card->pm_private_data; | 1024 | struct via82xx_modem *chip = card->pm_private_data; |
1010 | int i; | 1025 | int i; |
1011 | 1026 | ||
1012 | for (i = 0; i < 2; i++) | 1027 | for (i = 0; i < 2; i++) |
@@ -1021,9 +1036,9 @@ static int snd_via82xx_suspend(snd_card_t *card, pm_message_t state) | |||
1021 | return 0; | 1036 | return 0; |
1022 | } | 1037 | } |
1023 | 1038 | ||
1024 | static int snd_via82xx_resume(snd_card_t *card) | 1039 | static int snd_via82xx_resume(struct snd_card *card) |
1025 | { | 1040 | { |
1026 | via82xx_t *chip = card->pm_private_data; | 1041 | struct via82xx_modem *chip = card->pm_private_data; |
1027 | int i; | 1042 | int i; |
1028 | 1043 | ||
1029 | pci_enable_device(chip->pci); | 1044 | pci_enable_device(chip->pci); |
@@ -1041,7 +1056,7 @@ static int snd_via82xx_resume(snd_card_t *card) | |||
1041 | } | 1056 | } |
1042 | #endif /* CONFIG_PM */ | 1057 | #endif /* CONFIG_PM */ |
1043 | 1058 | ||
1044 | static int snd_via82xx_free(via82xx_t *chip) | 1059 | static int snd_via82xx_free(struct via82xx_modem *chip) |
1045 | { | 1060 | { |
1046 | unsigned int i; | 1061 | unsigned int i; |
1047 | 1062 | ||
@@ -1053,29 +1068,29 @@ static int snd_via82xx_free(via82xx_t *chip) | |||
1053 | synchronize_irq(chip->irq); | 1068 | synchronize_irq(chip->irq); |
1054 | __end_hw: | 1069 | __end_hw: |
1055 | if (chip->irq >= 0) | 1070 | if (chip->irq >= 0) |
1056 | free_irq(chip->irq, (void *)chip); | 1071 | free_irq(chip->irq, chip); |
1057 | pci_release_regions(chip->pci); | 1072 | pci_release_regions(chip->pci); |
1058 | pci_disable_device(chip->pci); | 1073 | pci_disable_device(chip->pci); |
1059 | kfree(chip); | 1074 | kfree(chip); |
1060 | return 0; | 1075 | return 0; |
1061 | } | 1076 | } |
1062 | 1077 | ||
1063 | static int snd_via82xx_dev_free(snd_device_t *device) | 1078 | static int snd_via82xx_dev_free(struct snd_device *device) |
1064 | { | 1079 | { |
1065 | via82xx_t *chip = device->device_data; | 1080 | struct via82xx_modem *chip = device->device_data; |
1066 | return snd_via82xx_free(chip); | 1081 | return snd_via82xx_free(chip); |
1067 | } | 1082 | } |
1068 | 1083 | ||
1069 | static int __devinit snd_via82xx_create(snd_card_t * card, | 1084 | static int __devinit snd_via82xx_create(struct snd_card *card, |
1070 | struct pci_dev *pci, | 1085 | struct pci_dev *pci, |
1071 | int chip_type, | 1086 | int chip_type, |
1072 | int revision, | 1087 | int revision, |
1073 | unsigned int ac97_clock, | 1088 | unsigned int ac97_clock, |
1074 | via82xx_t ** r_via) | 1089 | struct via82xx_modem ** r_via) |
1075 | { | 1090 | { |
1076 | via82xx_t *chip; | 1091 | struct via82xx_modem *chip; |
1077 | int err; | 1092 | int err; |
1078 | static snd_device_ops_t ops = { | 1093 | static struct snd_device_ops ops = { |
1079 | .dev_free = snd_via82xx_dev_free, | 1094 | .dev_free = snd_via82xx_dev_free, |
1080 | }; | 1095 | }; |
1081 | 1096 | ||
@@ -1099,7 +1114,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
1099 | } | 1114 | } |
1100 | chip->port = pci_resource_start(pci, 0); | 1115 | chip->port = pci_resource_start(pci, 0); |
1101 | if (request_irq(pci->irq, snd_via82xx_interrupt, SA_INTERRUPT|SA_SHIRQ, | 1116 | if (request_irq(pci->irq, snd_via82xx_interrupt, SA_INTERRUPT|SA_SHIRQ, |
1102 | card->driver, (void *)chip)) { | 1117 | card->driver, chip)) { |
1103 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1118 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1104 | snd_via82xx_free(chip); | 1119 | snd_via82xx_free(chip); |
1105 | return -EBUSY; | 1120 | return -EBUSY; |
@@ -1134,8 +1149,8 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
1134 | static int __devinit snd_via82xx_probe(struct pci_dev *pci, | 1149 | static int __devinit snd_via82xx_probe(struct pci_dev *pci, |
1135 | const struct pci_device_id *pci_id) | 1150 | const struct pci_device_id *pci_id) |
1136 | { | 1151 | { |
1137 | snd_card_t *card; | 1152 | struct snd_card *card; |
1138 | via82xx_t *chip; | 1153 | struct via82xx_modem *chip; |
1139 | unsigned char revision; | 1154 | unsigned char revision; |
1140 | int chip_type = 0, card_type; | 1155 | int chip_type = 0, card_type; |
1141 | unsigned int i; | 1156 | unsigned int i; |