aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 09:01:29 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:19:18 -0500
commit10754f53450a2c2aababe69f20edd7d2077e588d (patch)
treecf21ec72bfe5a068492bda56c318054426b77486
parent67b48b880062ba1775f424c2dd2c68bc30ec180f (diff)
[ALSA] Remove xxx_t typedefs: PCI NM256
Modules: NM256 driver Remove xxx_t typedefs from the PCI NM256 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/nm256/nm256.c250
1 files changed, 127 insertions, 123 deletions
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index a01b3e577966..99ec1c17049b 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -183,17 +183,10 @@ module_param(enable, bool, 0444);
183#define NM_PBUFFER_WMARK (NM_PLAYBACK_REG_OFFSET + 0xc) 183#define NM_PBUFFER_WMARK (NM_PLAYBACK_REG_OFFSET + 0xc)
184#define NM_PBUFFER_CURRP (NM_PLAYBACK_REG_OFFSET + 0x8) 184#define NM_PBUFFER_CURRP (NM_PLAYBACK_REG_OFFSET + 0x8)
185 185
186/* 186struct nm256_stream {
187 * type definitions
188 */
189
190typedef struct snd_nm256 nm256_t;
191typedef struct snd_nm256_stream nm256_stream_t;
192
193struct snd_nm256_stream {
194 187
195 nm256_t *chip; 188 struct nm256 *chip;
196 snd_pcm_substream_t *substream; 189 struct snd_pcm_substream *substream;
197 int running; 190 int running;
198 int suspended; 191 int suspended;
199 192
@@ -210,9 +203,9 @@ struct snd_nm256_stream {
210 203
211}; 204};
212 205
213struct snd_nm256 { 206struct nm256 {
214 207
215 snd_card_t *card; 208 struct snd_card *card;
216 209
217 void __iomem *cport; /* control port */ 210 void __iomem *cport; /* control port */
218 struct resource *res_cport; /* its resource */ 211 struct resource *res_cport; /* its resource */
@@ -244,11 +237,11 @@ struct snd_nm256 {
244 int badintrcount; /* counter to check bogus interrupts */ 237 int badintrcount; /* counter to check bogus interrupts */
245 struct semaphore irq_mutex; 238 struct semaphore irq_mutex;
246 239
247 nm256_stream_t streams[2]; 240 struct nm256_stream streams[2];
248 241
249 ac97_t *ac97; 242 struct snd_ac97 *ac97;
250 243
251 snd_pcm_t *pcm; 244 struct snd_pcm *pcm;
252 245
253 struct pci_dev *pci; 246 struct pci_dev *pci;
254 247
@@ -281,48 +274,49 @@ MODULE_DEVICE_TABLE(pci, snd_nm256_ids);
281 */ 274 */
282 275
283static inline u8 276static inline u8
284snd_nm256_readb(nm256_t *chip, int offset) 277snd_nm256_readb(struct nm256 *chip, int offset)
285{ 278{
286 return readb(chip->cport + offset); 279 return readb(chip->cport + offset);
287} 280}
288 281
289static inline u16 282static inline u16
290snd_nm256_readw(nm256_t *chip, int offset) 283snd_nm256_readw(struct nm256 *chip, int offset)
291{ 284{
292 return readw(chip->cport + offset); 285 return readw(chip->cport + offset);
293} 286}
294 287
295static inline u32 288static inline u32
296snd_nm256_readl(nm256_t *chip, int offset) 289snd_nm256_readl(struct nm256 *chip, int offset)
297{ 290{
298 return readl(chip->cport + offset); 291 return readl(chip->cport + offset);
299} 292}
300 293
301static inline void 294static inline void
302snd_nm256_writeb(nm256_t *chip, int offset, u8 val) 295snd_nm256_writeb(struct nm256 *chip, int offset, u8 val)
303{ 296{
304 writeb(val, chip->cport + offset); 297 writeb(val, chip->cport + offset);
305} 298}
306 299
307static inline void 300static inline void
308snd_nm256_writew(nm256_t *chip, int offset, u16 val) 301snd_nm256_writew(struct nm256 *chip, int offset, u16 val)
309{ 302{
310 writew(val, chip->cport + offset); 303 writew(val, chip->cport + offset);
311} 304}
312 305
313static inline void 306static inline void
314snd_nm256_writel(nm256_t *chip, int offset, u32 val) 307snd_nm256_writel(struct nm256 *chip, int offset, u32 val)
315{ 308{
316 writel(val, chip->cport + offset); 309 writel(val, chip->cport + offset);
317} 310}
318 311
319static inline void 312static inline void
320snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size) 313snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size)
321{ 314{
322 offset -= chip->buffer_start; 315 offset -= chip->buffer_start;
323#ifdef CONFIG_SND_DEBUG 316#ifdef CONFIG_SND_DEBUG
324 if (offset < 0 || offset >= chip->buffer_size) { 317 if (offset < 0 || offset >= chip->buffer_size) {
325 snd_printk(KERN_ERR "write_buffer invalid offset = %d size = %d\n", offset, size); 318 snd_printk(KERN_ERR "write_buffer invalid offset = %d size = %d\n",
319 offset, size);
326 return; 320 return;
327 } 321 }
328#endif 322#endif
@@ -343,7 +337,7 @@ snd_nm256_get_start_offset(int which)
343} 337}
344 338
345static void 339static void
346snd_nm256_load_one_coefficient(nm256_t *chip, int stream, u32 port, int which) 340snd_nm256_load_one_coefficient(struct nm256 *chip, int stream, u32 port, int which)
347{ 341{
348 u32 coeff_buf = chip->coeff_buf[stream]; 342 u32 coeff_buf = chip->coeff_buf[stream];
349 u16 offset = snd_nm256_get_start_offset(which); 343 u16 offset = snd_nm256_get_start_offset(which);
@@ -358,13 +352,15 @@ snd_nm256_load_one_coefficient(nm256_t *chip, int stream, u32 port, int which)
358} 352}
359 353
360static void 354static void
361snd_nm256_load_coefficient(nm256_t *chip, int stream, int number) 355snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
362{ 356{
363 /* The enable register for the specified engine. */ 357 /* The enable register for the specified engine. */
364 u32 poffset = (stream == SNDRV_PCM_STREAM_CAPTURE ? NM_RECORD_ENABLE_REG : NM_PLAYBACK_ENABLE_REG); 358 u32 poffset = (stream == SNDRV_PCM_STREAM_CAPTURE ?
359 NM_RECORD_ENABLE_REG : NM_PLAYBACK_ENABLE_REG);
365 u32 addr = NM_COEFF_START_OFFSET; 360 u32 addr = NM_COEFF_START_OFFSET;
366 361
367 addr += (stream == SNDRV_PCM_STREAM_CAPTURE ? NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET); 362 addr += (stream == SNDRV_PCM_STREAM_CAPTURE ?
363 NM_RECORD_REG_OFFSET : NM_PLAYBACK_REG_OFFSET);
368 364
369 if (snd_nm256_readb(chip, poffset) & 1) { 365 if (snd_nm256_readb(chip, poffset) & 1) {
370 snd_printd("NM256: Engine was enabled while loading coefficients!\n"); 366 snd_printd("NM256: Engine was enabled while loading coefficients!\n");
@@ -400,7 +396,7 @@ snd_nm256_load_coefficient(nm256_t *chip, int stream, int number)
400static unsigned int samplerates[8] = { 396static unsigned int samplerates[8] = {
401 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 397 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000,
402}; 398};
403static snd_pcm_hw_constraint_list_t constraints_rates = { 399static struct snd_pcm_hw_constraint_list constraints_rates = {
404 .count = ARRAY_SIZE(samplerates), 400 .count = ARRAY_SIZE(samplerates),
405 .list = samplerates, 401 .list = samplerates,
406 .mask = 0, 402 .mask = 0,
@@ -425,9 +421,10 @@ snd_nm256_fixed_rate(unsigned int rate)
425 * set sample rate and format 421 * set sample rate and format
426 */ 422 */
427static void 423static void
428snd_nm256_set_format(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *substream) 424snd_nm256_set_format(struct nm256 *chip, struct nm256_stream *s,
425 struct snd_pcm_substream *substream)
429{ 426{
430 snd_pcm_runtime_t *runtime = substream->runtime; 427 struct snd_pcm_runtime *runtime = substream->runtime;
431 int rate_index = snd_nm256_fixed_rate(runtime->rate); 428 int rate_index = snd_nm256_fixed_rate(runtime->rate);
432 unsigned char ratebits = (rate_index << 4) & NM_RATE_MASK; 429 unsigned char ratebits = (rate_index << 4) & NM_RATE_MASK;
433 430
@@ -460,12 +457,12 @@ snd_nm256_set_format(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *subs
460} 457}
461 458
462/* acquire interrupt */ 459/* acquire interrupt */
463static int snd_nm256_acquire_irq(nm256_t *chip) 460static int snd_nm256_acquire_irq(struct nm256 *chip)
464{ 461{
465 down(&chip->irq_mutex); 462 down(&chip->irq_mutex);
466 if (chip->irq < 0) { 463 if (chip->irq < 0) {
467 if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, 464 if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ,
468 chip->card->driver, (void*)chip)) { 465 chip->card->driver, chip)) {
469 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); 466 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq);
470 up(&chip->irq_mutex); 467 up(&chip->irq_mutex);
471 return -EBUSY; 468 return -EBUSY;
@@ -478,13 +475,13 @@ static int snd_nm256_acquire_irq(nm256_t *chip)
478} 475}
479 476
480/* release interrupt */ 477/* release interrupt */
481static void snd_nm256_release_irq(nm256_t *chip) 478static void snd_nm256_release_irq(struct nm256 *chip)
482{ 479{
483 down(&chip->irq_mutex); 480 down(&chip->irq_mutex);
484 if (chip->irq_acks > 0) 481 if (chip->irq_acks > 0)
485 chip->irq_acks--; 482 chip->irq_acks--;
486 if (chip->irq_acks == 0 && chip->irq >= 0) { 483 if (chip->irq_acks == 0 && chip->irq >= 0) {
487 free_irq(chip->irq, (void*)chip); 484 free_irq(chip->irq, chip);
488 chip->irq = -1; 485 chip->irq = -1;
489 } 486 }
490 up(&chip->irq_mutex); 487 up(&chip->irq_mutex);
@@ -495,7 +492,7 @@ static void snd_nm256_release_irq(nm256_t *chip)
495 */ 492 */
496 493
497/* update the watermark (current period) */ 494/* update the watermark (current period) */
498static void snd_nm256_pcm_mark(nm256_t *chip, nm256_stream_t *s, int reg) 495static void snd_nm256_pcm_mark(struct nm256 *chip, struct nm256_stream *s, int reg)
499{ 496{
500 s->cur_period++; 497 s->cur_period++;
501 s->cur_period %= s->periods; 498 s->cur_period %= s->periods;
@@ -506,7 +503,8 @@ static void snd_nm256_pcm_mark(nm256_t *chip, nm256_stream_t *s, int reg)
506#define snd_nm256_capture_mark(chip, s) snd_nm256_pcm_mark(chip, s, NM_RBUFFER_WMARK) 503#define snd_nm256_capture_mark(chip, s) snd_nm256_pcm_mark(chip, s, NM_RBUFFER_WMARK)
507 504
508static void 505static void
509snd_nm256_playback_start(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *substream) 506snd_nm256_playback_start(struct nm256 *chip, struct nm256_stream *s,
507 struct snd_pcm_substream *substream)
510{ 508{
511 /* program buffer pointers */ 509 /* program buffer pointers */
512 snd_nm256_writel(chip, NM_PBUFFER_START, s->buf); 510 snd_nm256_writel(chip, NM_PBUFFER_START, s->buf);
@@ -522,7 +520,8 @@ snd_nm256_playback_start(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *
522} 520}
523 521
524static void 522static void
525snd_nm256_capture_start(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *substream) 523snd_nm256_capture_start(struct nm256 *chip, struct nm256_stream *s,
524 struct snd_pcm_substream *substream)
526{ 525{
527 /* program buffer pointers */ 526 /* program buffer pointers */
528 snd_nm256_writel(chip, NM_RBUFFER_START, s->buf); 527 snd_nm256_writel(chip, NM_RBUFFER_START, s->buf);
@@ -537,7 +536,7 @@ snd_nm256_capture_start(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *s
537 536
538/* Stop the play engine. */ 537/* Stop the play engine. */
539static void 538static void
540snd_nm256_playback_stop(nm256_t *chip) 539snd_nm256_playback_stop(struct nm256 *chip)
541{ 540{
542 /* Shut off sound from both channels. */ 541 /* Shut off sound from both channels. */
543 snd_nm256_writew(chip, NM_AUDIO_MUTE_REG, 542 snd_nm256_writew(chip, NM_AUDIO_MUTE_REG,
@@ -547,17 +546,17 @@ snd_nm256_playback_stop(nm256_t *chip)
547} 546}
548 547
549static void 548static void
550snd_nm256_capture_stop(nm256_t *chip) 549snd_nm256_capture_stop(struct nm256 *chip)
551{ 550{
552 /* Disable recording engine. */ 551 /* Disable recording engine. */
553 snd_nm256_writeb(chip, NM_RECORD_ENABLE_REG, 0); 552 snd_nm256_writeb(chip, NM_RECORD_ENABLE_REG, 0);
554} 553}
555 554
556static int 555static int
557snd_nm256_playback_trigger(snd_pcm_substream_t *substream, int cmd) 556snd_nm256_playback_trigger(struct snd_pcm_substream *substream, int cmd)
558{ 557{
559 nm256_t *chip = snd_pcm_substream_chip(substream); 558 struct nm256 *chip = snd_pcm_substream_chip(substream);
560 nm256_stream_t *s = (nm256_stream_t*)substream->runtime->private_data; 559 struct nm256_stream *s = substream->runtime->private_data;
561 int err = 0; 560 int err = 0;
562 561
563 snd_assert(s != NULL, return -ENXIO); 562 snd_assert(s != NULL, return -ENXIO);
@@ -591,10 +590,10 @@ snd_nm256_playback_trigger(snd_pcm_substream_t *substream, int cmd)
591} 590}
592 591
593static int 592static int
594snd_nm256_capture_trigger(snd_pcm_substream_t *substream, int cmd) 593snd_nm256_capture_trigger(struct snd_pcm_substream *substream, int cmd)
595{ 594{
596 nm256_t *chip = snd_pcm_substream_chip(substream); 595 struct nm256 *chip = snd_pcm_substream_chip(substream);
597 nm256_stream_t *s = (nm256_stream_t*)substream->runtime->private_data; 596 struct nm256_stream *s = substream->runtime->private_data;
598 int err = 0; 597 int err = 0;
599 598
600 snd_assert(s != NULL, return -ENXIO); 599 snd_assert(s != NULL, return -ENXIO);
@@ -627,11 +626,11 @@ snd_nm256_capture_trigger(snd_pcm_substream_t *substream, int cmd)
627/* 626/*
628 * prepare playback/capture channel 627 * prepare playback/capture channel
629 */ 628 */
630static int snd_nm256_pcm_prepare(snd_pcm_substream_t *substream) 629static int snd_nm256_pcm_prepare(struct snd_pcm_substream *substream)
631{ 630{
632 nm256_t *chip = snd_pcm_substream_chip(substream); 631 struct nm256 *chip = snd_pcm_substream_chip(substream);
633 snd_pcm_runtime_t *runtime = substream->runtime; 632 struct snd_pcm_runtime *runtime = substream->runtime;
634 nm256_stream_t *s = (nm256_stream_t*)runtime->private_data; 633 struct nm256_stream *s = runtime->private_data;
635 634
636 snd_assert(s, return -ENXIO); 635 snd_assert(s, return -ENXIO);
637 s->dma_size = frames_to_bytes(runtime, substream->runtime->buffer_size); 636 s->dma_size = frames_to_bytes(runtime, substream->runtime->buffer_size);
@@ -652,10 +651,10 @@ static int snd_nm256_pcm_prepare(snd_pcm_substream_t *substream)
652 * get the current pointer 651 * get the current pointer
653 */ 652 */
654static snd_pcm_uframes_t 653static snd_pcm_uframes_t
655snd_nm256_playback_pointer(snd_pcm_substream_t * substream) 654snd_nm256_playback_pointer(struct snd_pcm_substream *substream)
656{ 655{
657 nm256_t *chip = snd_pcm_substream_chip(substream); 656 struct nm256 *chip = snd_pcm_substream_chip(substream);
658 nm256_stream_t *s = (nm256_stream_t*)substream->runtime->private_data; 657 struct nm256_stream *s = substream->runtime->private_data;
659 unsigned long curp; 658 unsigned long curp;
660 659
661 snd_assert(s, return 0); 660 snd_assert(s, return 0);
@@ -665,10 +664,10 @@ snd_nm256_playback_pointer(snd_pcm_substream_t * substream)
665} 664}
666 665
667static snd_pcm_uframes_t 666static snd_pcm_uframes_t
668snd_nm256_capture_pointer(snd_pcm_substream_t * substream) 667snd_nm256_capture_pointer(struct snd_pcm_substream *substream)
669{ 668{
670 nm256_t *chip = snd_pcm_substream_chip(substream); 669 struct nm256 *chip = snd_pcm_substream_chip(substream);
671 nm256_stream_t *s = (nm256_stream_t*)substream->runtime->private_data; 670 struct nm256_stream *s = substream->runtime->private_data;
672 unsigned long curp; 671 unsigned long curp;
673 672
674 snd_assert(s != NULL, return 0); 673 snd_assert(s != NULL, return 0);
@@ -684,13 +683,13 @@ snd_nm256_capture_pointer(snd_pcm_substream_t * substream)
684 * silence / copy for playback 683 * silence / copy for playback
685 */ 684 */
686static int 685static int
687snd_nm256_playback_silence(snd_pcm_substream_t *substream, 686snd_nm256_playback_silence(struct snd_pcm_substream *substream,
688 int channel, /* not used (interleaved data) */ 687 int channel, /* not used (interleaved data) */
689 snd_pcm_uframes_t pos, 688 snd_pcm_uframes_t pos,
690 snd_pcm_uframes_t count) 689 snd_pcm_uframes_t count)
691{ 690{
692 snd_pcm_runtime_t *runtime = substream->runtime; 691 struct snd_pcm_runtime *runtime = substream->runtime;
693 nm256_stream_t *s = (nm256_stream_t*)runtime->private_data; 692 struct nm256_stream *s = runtime->private_data;
694 count = frames_to_bytes(runtime, count); 693 count = frames_to_bytes(runtime, count);
695 pos = frames_to_bytes(runtime, pos); 694 pos = frames_to_bytes(runtime, pos);
696 memset_io(s->bufptr + pos, 0, count); 695 memset_io(s->bufptr + pos, 0, count);
@@ -698,14 +697,14 @@ snd_nm256_playback_silence(snd_pcm_substream_t *substream,
698} 697}
699 698
700static int 699static int
701snd_nm256_playback_copy(snd_pcm_substream_t *substream, 700snd_nm256_playback_copy(struct snd_pcm_substream *substream,
702 int channel, /* not used (interleaved data) */ 701 int channel, /* not used (interleaved data) */
703 snd_pcm_uframes_t pos, 702 snd_pcm_uframes_t pos,
704 void __user *src, 703 void __user *src,
705 snd_pcm_uframes_t count) 704 snd_pcm_uframes_t count)
706{ 705{
707 snd_pcm_runtime_t *runtime = substream->runtime; 706 struct snd_pcm_runtime *runtime = substream->runtime;
708 nm256_stream_t *s = (nm256_stream_t*)runtime->private_data; 707 struct nm256_stream *s = runtime->private_data;
709 count = frames_to_bytes(runtime, count); 708 count = frames_to_bytes(runtime, count);
710 pos = frames_to_bytes(runtime, pos); 709 pos = frames_to_bytes(runtime, pos);
711 if (copy_from_user_toio(s->bufptr + pos, src, count)) 710 if (copy_from_user_toio(s->bufptr + pos, src, count))
@@ -717,14 +716,14 @@ snd_nm256_playback_copy(snd_pcm_substream_t *substream,
717 * copy to user 716 * copy to user
718 */ 717 */
719static int 718static int
720snd_nm256_capture_copy(snd_pcm_substream_t *substream, 719snd_nm256_capture_copy(struct snd_pcm_substream *substream,
721 int channel, /* not used (interleaved data) */ 720 int channel, /* not used (interleaved data) */
722 snd_pcm_uframes_t pos, 721 snd_pcm_uframes_t pos,
723 void __user *dst, 722 void __user *dst,
724 snd_pcm_uframes_t count) 723 snd_pcm_uframes_t count)
725{ 724{
726 snd_pcm_runtime_t *runtime = substream->runtime; 725 struct snd_pcm_runtime *runtime = substream->runtime;
727 nm256_stream_t *s = (nm256_stream_t*)runtime->private_data; 726 struct nm256_stream *s = runtime->private_data;
728 count = frames_to_bytes(runtime, count); 727 count = frames_to_bytes(runtime, count);
729 pos = frames_to_bytes(runtime, pos); 728 pos = frames_to_bytes(runtime, pos);
730 if (copy_to_user_fromio(dst, s->bufptr + pos, count)) 729 if (copy_to_user_fromio(dst, s->bufptr + pos, count))
@@ -741,9 +740,9 @@ snd_nm256_capture_copy(snd_pcm_substream_t *substream,
741 740
742/* spinlock held! */ 741/* spinlock held! */
743static void 742static void
744snd_nm256_playback_update(nm256_t *chip) 743snd_nm256_playback_update(struct nm256 *chip)
745{ 744{
746 nm256_stream_t *s; 745 struct nm256_stream *s;
747 746
748 s = &chip->streams[SNDRV_PCM_STREAM_PLAYBACK]; 747 s = &chip->streams[SNDRV_PCM_STREAM_PLAYBACK];
749 if (s->running && s->substream) { 748 if (s->running && s->substream) {
@@ -756,9 +755,9 @@ snd_nm256_playback_update(nm256_t *chip)
756 755
757/* spinlock held! */ 756/* spinlock held! */
758static void 757static void
759snd_nm256_capture_update(nm256_t *chip) 758snd_nm256_capture_update(struct nm256 *chip)
760{ 759{
761 nm256_stream_t *s; 760 struct nm256_stream *s;
762 761
763 s = &chip->streams[SNDRV_PCM_STREAM_CAPTURE]; 762 s = &chip->streams[SNDRV_PCM_STREAM_CAPTURE];
764 if (s->running && s->substream) { 763 if (s->running && s->substream) {
@@ -772,7 +771,7 @@ snd_nm256_capture_update(nm256_t *chip)
772/* 771/*
773 * hardware info 772 * hardware info
774 */ 773 */
775static snd_pcm_hardware_t snd_nm256_playback = 774static struct snd_pcm_hardware snd_nm256_playback =
776{ 775{
777 .info = SNDRV_PCM_INFO_MMAP_IOMEM |SNDRV_PCM_INFO_MMAP_VALID | 776 .info = SNDRV_PCM_INFO_MMAP_IOMEM |SNDRV_PCM_INFO_MMAP_VALID |
778 SNDRV_PCM_INFO_INTERLEAVED | 777 SNDRV_PCM_INFO_INTERLEAVED |
@@ -791,7 +790,7 @@ static snd_pcm_hardware_t snd_nm256_playback =
791 .period_bytes_max = 128 * 1024, 790 .period_bytes_max = 128 * 1024,
792}; 791};
793 792
794static snd_pcm_hardware_t snd_nm256_capture = 793static struct snd_pcm_hardware snd_nm256_capture =
795{ 794{
796 .info = SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID | 795 .info = SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID |
797 SNDRV_PCM_INFO_INTERLEAVED | 796 SNDRV_PCM_INFO_INTERLEAVED |
@@ -812,7 +811,8 @@ static snd_pcm_hardware_t snd_nm256_capture =
812 811
813 812
814/* set dma transfer size */ 813/* set dma transfer size */
815static int snd_nm256_pcm_hw_params(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *hw_params) 814static int snd_nm256_pcm_hw_params(struct snd_pcm_substream *substream,
815 struct snd_pcm_hw_params *hw_params)
816{ 816{
817 /* area and addr are already set and unchanged */ 817 /* area and addr are already set and unchanged */
818 substream->runtime->dma_bytes = params_buffer_bytes(hw_params); 818 substream->runtime->dma_bytes = params_buffer_bytes(hw_params);
@@ -822,11 +822,11 @@ static int snd_nm256_pcm_hw_params(snd_pcm_substream_t *substream, snd_pcm_hw_pa
822/* 822/*
823 * open 823 * open
824 */ 824 */
825static void snd_nm256_setup_stream(nm256_t *chip, nm256_stream_t *s, 825static void snd_nm256_setup_stream(struct nm256 *chip, struct nm256_stream *s,
826 snd_pcm_substream_t *substream, 826 struct snd_pcm_substream *substream,
827 snd_pcm_hardware_t *hw_ptr) 827 struct snd_pcm_hardware *hw_ptr)
828{ 828{
829 snd_pcm_runtime_t *runtime = substream->runtime; 829 struct snd_pcm_runtime *runtime = substream->runtime;
830 830
831 s->running = 0; 831 s->running = 0;
832 runtime->hw = *hw_ptr; 832 runtime->hw = *hw_ptr;
@@ -844,9 +844,9 @@ static void snd_nm256_setup_stream(nm256_t *chip, nm256_stream_t *s,
844} 844}
845 845
846static int 846static int
847snd_nm256_playback_open(snd_pcm_substream_t *substream) 847snd_nm256_playback_open(struct snd_pcm_substream *substream)
848{ 848{
849 nm256_t *chip = snd_pcm_substream_chip(substream); 849 struct nm256 *chip = snd_pcm_substream_chip(substream);
850 850
851 if (snd_nm256_acquire_irq(chip) < 0) 851 if (snd_nm256_acquire_irq(chip) < 0)
852 return -EBUSY; 852 return -EBUSY;
@@ -856,9 +856,9 @@ snd_nm256_playback_open(snd_pcm_substream_t *substream)
856} 856}
857 857
858static int 858static int
859snd_nm256_capture_open(snd_pcm_substream_t *substream) 859snd_nm256_capture_open(struct snd_pcm_substream *substream)
860{ 860{
861 nm256_t *chip = snd_pcm_substream_chip(substream); 861 struct nm256 *chip = snd_pcm_substream_chip(substream);
862 862
863 if (snd_nm256_acquire_irq(chip) < 0) 863 if (snd_nm256_acquire_irq(chip) < 0)
864 return -EBUSY; 864 return -EBUSY;
@@ -871,9 +871,9 @@ snd_nm256_capture_open(snd_pcm_substream_t *substream)
871 * close - we don't have to do special.. 871 * close - we don't have to do special..
872 */ 872 */
873static int 873static int
874snd_nm256_playback_close(snd_pcm_substream_t *substream) 874snd_nm256_playback_close(struct snd_pcm_substream *substream)
875{ 875{
876 nm256_t *chip = snd_pcm_substream_chip(substream); 876 struct nm256 *chip = snd_pcm_substream_chip(substream);
877 877
878 snd_nm256_release_irq(chip); 878 snd_nm256_release_irq(chip);
879 return 0; 879 return 0;
@@ -881,9 +881,9 @@ snd_nm256_playback_close(snd_pcm_substream_t *substream)
881 881
882 882
883static int 883static int
884snd_nm256_capture_close(snd_pcm_substream_t *substream) 884snd_nm256_capture_close(struct snd_pcm_substream *substream)
885{ 885{
886 nm256_t *chip = snd_pcm_substream_chip(substream); 886 struct nm256 *chip = snd_pcm_substream_chip(substream);
887 887
888 snd_nm256_release_irq(chip); 888 snd_nm256_release_irq(chip);
889 return 0; 889 return 0;
@@ -892,7 +892,7 @@ snd_nm256_capture_close(snd_pcm_substream_t *substream)
892/* 892/*
893 * create a pcm instance 893 * create a pcm instance
894 */ 894 */
895static snd_pcm_ops_t snd_nm256_playback_ops = { 895static struct snd_pcm_ops snd_nm256_playback_ops = {
896 .open = snd_nm256_playback_open, 896 .open = snd_nm256_playback_open,
897 .close = snd_nm256_playback_close, 897 .close = snd_nm256_playback_close,
898 .ioctl = snd_pcm_lib_ioctl, 898 .ioctl = snd_pcm_lib_ioctl,
@@ -907,7 +907,7 @@ static snd_pcm_ops_t snd_nm256_playback_ops = {
907 .mmap = snd_pcm_lib_mmap_iomem, 907 .mmap = snd_pcm_lib_mmap_iomem,
908}; 908};
909 909
910static snd_pcm_ops_t snd_nm256_capture_ops = { 910static struct snd_pcm_ops snd_nm256_capture_ops = {
911 .open = snd_nm256_capture_open, 911 .open = snd_nm256_capture_open,
912 .close = snd_nm256_capture_close, 912 .close = snd_nm256_capture_close,
913 .ioctl = snd_pcm_lib_ioctl, 913 .ioctl = snd_pcm_lib_ioctl,
@@ -922,13 +922,13 @@ static snd_pcm_ops_t snd_nm256_capture_ops = {
922}; 922};
923 923
924static int __devinit 924static int __devinit
925snd_nm256_pcm(nm256_t *chip, int device) 925snd_nm256_pcm(struct nm256 *chip, int device)
926{ 926{
927 snd_pcm_t *pcm; 927 struct snd_pcm *pcm;
928 int i, err; 928 int i, err;
929 929
930 for (i = 0; i < 2; i++) { 930 for (i = 0; i < 2; i++) {
931 nm256_stream_t *s = &chip->streams[i]; 931 struct nm256_stream *s = &chip->streams[i];
932 s->bufptr = chip->buffer + (s->buf - chip->buffer_start); 932 s->bufptr = chip->buffer + (s->buf - chip->buffer_start);
933 s->bufptr_addr = chip->buffer_addr + (s->buf - chip->buffer_start); 933 s->bufptr_addr = chip->buffer_addr + (s->buf - chip->buffer_start);
934 } 934 }
@@ -953,7 +953,7 @@ snd_nm256_pcm(nm256_t *chip, int device)
953 * Initialize the hardware. 953 * Initialize the hardware.
954 */ 954 */
955static void 955static void
956snd_nm256_init_chip(nm256_t *chip) 956snd_nm256_init_chip(struct nm256 *chip)
957{ 957{
958 /* Reset everything. */ 958 /* Reset everything. */
959 snd_nm256_writeb(chip, 0x0, 0x11); 959 snd_nm256_writeb(chip, 0x0, 0x11);
@@ -965,7 +965,7 @@ snd_nm256_init_chip(nm256_t *chip)
965 965
966 966
967static irqreturn_t 967static irqreturn_t
968snd_nm256_intr_check(nm256_t *chip) 968snd_nm256_intr_check(struct nm256 *chip)
969{ 969{
970 if (chip->badintrcount++ > 1000) { 970 if (chip->badintrcount++ > 1000) {
971 /* 971 /*
@@ -1002,7 +1002,7 @@ snd_nm256_intr_check(nm256_t *chip)
1002static irqreturn_t 1002static irqreturn_t
1003snd_nm256_interrupt(int irq, void *dev_id, struct pt_regs *dummy) 1003snd_nm256_interrupt(int irq, void *dev_id, struct pt_regs *dummy)
1004{ 1004{
1005 nm256_t *chip = dev_id; 1005 struct nm256 *chip = dev_id;
1006 u16 status; 1006 u16 status;
1007 u8 cbyte; 1007 u8 cbyte;
1008 1008
@@ -1067,7 +1067,7 @@ snd_nm256_interrupt(int irq, void *dev_id, struct pt_regs *dummy)
1067static irqreturn_t 1067static irqreturn_t
1068snd_nm256_interrupt_zx(int irq, void *dev_id, struct pt_regs *dummy) 1068snd_nm256_interrupt_zx(int irq, void *dev_id, struct pt_regs *dummy)
1069{ 1069{
1070 nm256_t *chip = dev_id; 1070 struct nm256 *chip = dev_id;
1071 u32 status; 1071 u32 status;
1072 u8 cbyte; 1072 u8 cbyte;
1073 1073
@@ -1131,7 +1131,7 @@ snd_nm256_interrupt_zx(int irq, void *dev_id, struct pt_regs *dummy)
1131 * if it timed out. 1131 * if it timed out.
1132 */ 1132 */
1133static int 1133static int
1134snd_nm256_ac97_ready(nm256_t *chip) 1134snd_nm256_ac97_ready(struct nm256 *chip)
1135{ 1135{
1136 int timeout = 10; 1136 int timeout = 10;
1137 u32 testaddr; 1137 u32 testaddr;
@@ -1154,9 +1154,9 @@ snd_nm256_ac97_ready(nm256_t *chip)
1154/* 1154/*
1155 */ 1155 */
1156static unsigned short 1156static unsigned short
1157snd_nm256_ac97_read(ac97_t *ac97, unsigned short reg) 1157snd_nm256_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
1158{ 1158{
1159 nm256_t *chip = ac97->private_data; 1159 struct nm256 *chip = ac97->private_data;
1160 int res; 1160 int res;
1161 1161
1162 if (reg >= 128) 1162 if (reg >= 128)
@@ -1173,10 +1173,10 @@ snd_nm256_ac97_read(ac97_t *ac97, unsigned short reg)
1173/* 1173/*
1174 */ 1174 */
1175static void 1175static void
1176snd_nm256_ac97_write(ac97_t *ac97, 1176snd_nm256_ac97_write(struct snd_ac97 *ac97,
1177 unsigned short reg, unsigned short val) 1177 unsigned short reg, unsigned short val)
1178{ 1178{
1179 nm256_t *chip = ac97->private_data; 1179 struct nm256 *chip = ac97->private_data;
1180 int tries = 2; 1180 int tries = 2;
1181 u32 base; 1181 u32 base;
1182 1182
@@ -1196,9 +1196,9 @@ snd_nm256_ac97_write(ac97_t *ac97,
1196 1196
1197/* initialize the ac97 into a known state */ 1197/* initialize the ac97 into a known state */
1198static void 1198static void
1199snd_nm256_ac97_reset(ac97_t *ac97) 1199snd_nm256_ac97_reset(struct snd_ac97 *ac97)
1200{ 1200{
1201 nm256_t *chip = ac97->private_data; 1201 struct nm256 *chip = ac97->private_data;
1202 1202
1203 /* Reset the mixer. 'Tis magic! */ 1203 /* Reset the mixer. 'Tis magic! */
1204 snd_nm256_writeb(chip, 0x6c0, 1); 1204 snd_nm256_writeb(chip, 0x6c0, 1);
@@ -1215,12 +1215,12 @@ snd_nm256_ac97_reset(ac97_t *ac97)
1215 1215
1216/* create an ac97 mixer interface */ 1216/* create an ac97 mixer interface */
1217static int __devinit 1217static int __devinit
1218snd_nm256_mixer(nm256_t *chip) 1218snd_nm256_mixer(struct nm256 *chip)
1219{ 1219{
1220 ac97_bus_t *pbus; 1220 struct snd_ac97_bus *pbus;
1221 ac97_template_t ac97; 1221 struct snd_ac97_template ac97;
1222 int i, err; 1222 int i, err;
1223 static ac97_bus_ops_t ops = { 1223 static struct snd_ac97_bus_ops ops = {
1224 .reset = snd_nm256_ac97_reset, 1224 .reset = snd_nm256_ac97_reset,
1225 .write = snd_nm256_ac97_write, 1225 .write = snd_nm256_ac97_write,
1226 .read = snd_nm256_ac97_read, 1226 .read = snd_nm256_ac97_read,
@@ -1263,7 +1263,7 @@ snd_nm256_mixer(nm256_t *chip)
1263 */ 1263 */
1264 1264
1265static int __devinit 1265static int __devinit
1266snd_nm256_peek_for_sig(nm256_t *chip) 1266snd_nm256_peek_for_sig(struct nm256 *chip)
1267{ 1267{
1268 /* The signature is located 1K below the end of video RAM. */ 1268 /* The signature is located 1K below the end of video RAM. */
1269 void __iomem *temp; 1269 void __iomem *temp;
@@ -1292,7 +1292,8 @@ snd_nm256_peek_for_sig(nm256_t *chip)
1292 return -ENODEV; 1292 return -ENODEV;
1293 } else { 1293 } else {
1294 pointer_found = pointer; 1294 pointer_found = pointer;
1295 printk(KERN_INFO "nm256: found card signature in video RAM: 0x%x\n", pointer); 1295 printk(KERN_INFO "nm256: found card signature in video RAM: 0x%x\n",
1296 pointer);
1296 } 1297 }
1297 } 1298 }
1298 1299
@@ -1307,9 +1308,9 @@ snd_nm256_peek_for_sig(nm256_t *chip)
1307 * APM event handler, so the card is properly reinitialized after a power 1308 * APM event handler, so the card is properly reinitialized after a power
1308 * event. 1309 * event.
1309 */ 1310 */
1310static int nm256_suspend(snd_card_t *card, pm_message_t state) 1311static int nm256_suspend(struct snd_card *card, pm_message_t state)
1311{ 1312{
1312 nm256_t *chip = card->pm_private_data; 1313 struct nm256 *chip = card->pm_private_data;
1313 1314
1314 snd_pcm_suspend_all(chip->pcm); 1315 snd_pcm_suspend_all(chip->pcm);
1315 snd_ac97_suspend(chip->ac97); 1316 snd_ac97_suspend(chip->ac97);
@@ -1318,9 +1319,9 @@ static int nm256_suspend(snd_card_t *card, pm_message_t state)
1318 return 0; 1319 return 0;
1319} 1320}
1320 1321
1321static int nm256_resume(snd_card_t *card) 1322static int nm256_resume(struct snd_card *card)
1322{ 1323{
1323 nm256_t *chip = card->pm_private_data; 1324 struct nm256 *chip = card->pm_private_data;
1324 int i; 1325 int i;
1325 1326
1326 /* Perform a full reset on the hardware */ 1327 /* Perform a full reset on the hardware */
@@ -1331,7 +1332,7 @@ static int nm256_resume(snd_card_t *card)
1331 snd_ac97_resume(chip->ac97); 1332 snd_ac97_resume(chip->ac97);
1332 1333
1333 for (i = 0; i < 2; i++) { 1334 for (i = 0; i < 2; i++) {
1334 nm256_stream_t *s = &chip->streams[i]; 1335 struct nm256_stream *s = &chip->streams[i];
1335 if (s->substream && s->suspended) { 1336 if (s->substream && s->suspended) {
1336 spin_lock_irq(&chip->reg_lock); 1337 spin_lock_irq(&chip->reg_lock);
1337 snd_nm256_set_format(chip, s, s->substream); 1338 snd_nm256_set_format(chip, s, s->substream);
@@ -1343,7 +1344,7 @@ static int nm256_resume(snd_card_t *card)
1343} 1344}
1344#endif /* CONFIG_PM */ 1345#endif /* CONFIG_PM */
1345 1346
1346static int snd_nm256_free(nm256_t *chip) 1347static int snd_nm256_free(struct nm256 *chip)
1347{ 1348{
1348 if (chip->streams[SNDRV_PCM_STREAM_PLAYBACK].running) 1349 if (chip->streams[SNDRV_PCM_STREAM_PLAYBACK].running)
1349 snd_nm256_playback_stop(chip); 1350 snd_nm256_playback_stop(chip);
@@ -1360,26 +1361,26 @@ static int snd_nm256_free(nm256_t *chip)
1360 release_and_free_resource(chip->res_cport); 1361 release_and_free_resource(chip->res_cport);
1361 release_and_free_resource(chip->res_buffer); 1362 release_and_free_resource(chip->res_buffer);
1362 if (chip->irq >= 0) 1363 if (chip->irq >= 0)
1363 free_irq(chip->irq, (void*)chip); 1364 free_irq(chip->irq, chip);
1364 1365
1365 pci_disable_device(chip->pci); 1366 pci_disable_device(chip->pci);
1366 kfree(chip); 1367 kfree(chip);
1367 return 0; 1368 return 0;
1368} 1369}
1369 1370
1370static int snd_nm256_dev_free(snd_device_t *device) 1371static int snd_nm256_dev_free(struct snd_device *device)
1371{ 1372{
1372 nm256_t *chip = device->device_data; 1373 struct nm256 *chip = device->device_data;
1373 return snd_nm256_free(chip); 1374 return snd_nm256_free(chip);
1374} 1375}
1375 1376
1376static int __devinit 1377static int __devinit
1377snd_nm256_create(snd_card_t *card, struct pci_dev *pci, 1378snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1378 nm256_t **chip_ret) 1379 struct nm256 **chip_ret)
1379{ 1380{
1380 nm256_t *chip; 1381 struct nm256 *chip;
1381 int err, pval; 1382 int err, pval;
1382 static snd_device_ops_t ops = { 1383 static struct snd_device_ops ops = {
1383 .dev_free = snd_nm256_dev_free, 1384 .dev_free = snd_nm256_dev_free,
1384 }; 1385 };
1385 u32 addr; 1386 u32 addr;
@@ -1439,7 +1440,8 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1439 if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { 1440 if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) {
1440 if (! force_ac97) { 1441 if (! force_ac97) {
1441 printk(KERN_ERR "nm256: no ac97 is found!\n"); 1442 printk(KERN_ERR "nm256: no ac97 is found!\n");
1442 printk(KERN_ERR " force the driver to load by passing in the module parameter\n"); 1443 printk(KERN_ERR " force the driver to load by "
1444 "passing in the module parameter\n");
1443 printk(KERN_ERR " force_ac97=1\n"); 1445 printk(KERN_ERR " force_ac97=1\n");
1444 printk(KERN_ERR " or try sb16 or cs423x drivers instead.\n"); 1446 printk(KERN_ERR " or try sb16 or cs423x drivers instead.\n");
1445 err = -ENXIO; 1447 err = -ENXIO;
@@ -1462,7 +1464,8 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1462 chip->mixer_status_mask = NM2_MIXER_READY_MASK; 1464 chip->mixer_status_mask = NM2_MIXER_READY_MASK;
1463 } 1465 }
1464 1466
1465 chip->buffer_size = chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize + chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize; 1467 chip->buffer_size = chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize +
1468 chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize;
1466 if (chip->use_cache) 1469 if (chip->use_cache)
1467 chip->buffer_size += NM_TOTAL_COEFF_COUNT * 4; 1470 chip->buffer_size += NM_TOTAL_COEFF_COUNT * 4;
1468 else 1471 else
@@ -1561,8 +1564,8 @@ static struct nm256_quirk nm256_quirks[] __devinitdata = {
1561static int __devinit snd_nm256_probe(struct pci_dev *pci, 1564static int __devinit snd_nm256_probe(struct pci_dev *pci,
1562 const struct pci_device_id *pci_id) 1565 const struct pci_device_id *pci_id)
1563{ 1566{
1564 snd_card_t *card; 1567 struct snd_card *card;
1565 nm256_t *chip; 1568 struct nm256 *chip;
1566 int err; 1569 int err;
1567 struct nm256_quirk *q; 1570 struct nm256_quirk *q;
1568 u16 subsystem_vendor, subsystem_device; 1571 u16 subsystem_vendor, subsystem_device;
@@ -1574,7 +1577,8 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1574 if (q->vendor == subsystem_vendor && q->device == subsystem_device) { 1577 if (q->vendor == subsystem_vendor && q->device == subsystem_device) {
1575 switch (q->type) { 1578 switch (q->type) {
1576 case NM_BLACKLISTED: 1579 case NM_BLACKLISTED:
1577 printk(KERN_INFO "nm256: The device is blacklisted. Loading stopped\n"); 1580 printk(KERN_INFO "nm256: The device is blacklisted. "
1581 "Loading stopped\n");
1578 return -ENODEV; 1582 return -ENODEV;
1579 case NM_RESET_WORKAROUND_2: 1583 case NM_RESET_WORKAROUND_2:
1580 reset_workaround_2 = 1; 1584 reset_workaround_2 = 1;