aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/atiixp_modem.c
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 /sound/pci/atiixp_modem.c
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>
Diffstat (limited to 'sound/pci/atiixp_modem.c')
-rw-r--r--sound/pci/atiixp_modem.c259
1 files changed, 139 insertions, 120 deletions
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