aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-01-03 07:42:38 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 07:43:12 -0500
commitbe9b7e8c02a5f864e29b17f6d86abcde258ef2fa (patch)
treecb0a777be924ffa8f6078ea5189b6cc753e417bc /sound
parent68094e3251a664ee1389fcf179497237cbf78331 (diff)
[ALSA] Remove xxx_t typedefs: SPARC CS4231
Remove xxx_t typedefs from the SPARC CS4231 driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/sparc/cs4231.c342
1 files changed, 168 insertions, 174 deletions
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 14b1277bc83..e9086e95a31 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -62,49 +62,47 @@ MODULE_LICENSE("GPL");
62MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}"); 62MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}");
63 63
64#ifdef SBUS_SUPPORT 64#ifdef SBUS_SUPPORT
65typedef struct sbus_dma_info { 65struct sbus_dma_info {
66 spinlock_t lock; 66 spinlock_t lock;
67 int dir; 67 int dir;
68 void __iomem *regs; 68 void __iomem *regs;
69} sbus_dma_info_t; 69};
70#endif 70#endif
71 71
72typedef struct snd_cs4231 cs4231_t; 72struct cs4231_dma_control {
73
74typedef struct cs4231_dma_control {
75 void (*prepare)(struct cs4231_dma_control *dma_cont, int dir); 73 void (*prepare)(struct cs4231_dma_control *dma_cont, int dir);
76 void (*enable)(struct cs4231_dma_control *dma_cont, int on); 74 void (*enable)(struct cs4231_dma_control *dma_cont, int on);
77 int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len); 75 int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len);
78 unsigned int (*address)(struct cs4231_dma_control *dma_cont); 76 unsigned int (*address)(struct cs4231_dma_control *dma_cont);
79 void (*reset)(cs4231_t *chip); 77 void (*reset)(struct snd_cs4231 *chip);
80 void (*preallocate)(cs4231_t *chip, snd_pcm_t *pcm); 78 void (*preallocate)(struct snd_cs4231 *chip, struct snd_snd_pcm *pcm);
81#ifdef EBUS_SUPPORT 79#ifdef EBUS_SUPPORT
82 struct ebus_dma_info ebus_info; 80 struct ebus_dma_info ebus_info;
83#endif 81#endif
84#ifdef SBUS_SUPPORT 82#ifdef SBUS_SUPPORT
85 struct sbus_dma_info sbus_info; 83 struct sbus_dma_info sbus_info;
86#endif 84#endif
87} cs4231_dma_control_t; 85};
88 86
89struct snd_cs4231 { 87struct snd_cs4231 {
90 spinlock_t lock; 88 spinlock_t lock;
91 void __iomem *port; 89 void __iomem *port;
92 90
93 cs4231_dma_control_t p_dma; 91 struct cs4231_dma_control p_dma;
94 cs4231_dma_control_t c_dma; 92 struct cs4231_dma_control c_dma;
95 93
96 u32 flags; 94 u32 flags;
97#define CS4231_FLAG_EBUS 0x00000001 95#define CS4231_FLAG_EBUS 0x00000001
98#define CS4231_FLAG_PLAYBACK 0x00000002 96#define CS4231_FLAG_PLAYBACK 0x00000002
99#define CS4231_FLAG_CAPTURE 0x00000004 97#define CS4231_FLAG_CAPTURE 0x00000004
100 98
101 snd_card_t *card; 99 struct snd_card *card;
102 snd_pcm_t *pcm; 100 struct snd_pcm *pcm;
103 snd_pcm_substream_t *playback_substream; 101 struct snd_pcm_substream *playback_substream;
104 unsigned int p_periods_sent; 102 unsigned int p_periods_sent;
105 snd_pcm_substream_t *capture_substream; 103 struct snd_pcm_substream *capture_substream;
106 unsigned int c_periods_sent; 104 unsigned int c_periods_sent;
107 snd_timer_t *timer; 105 struct snd_timer *timer;
108 106
109 unsigned short mode; 107 unsigned short mode;
110#define CS4231_MODE_NONE 0x0000 108#define CS4231_MODE_NONE 0x0000
@@ -132,7 +130,7 @@ struct snd_cs4231 {
132 struct snd_cs4231 *next; 130 struct snd_cs4231 *next;
133}; 131};
134 132
135static cs4231_t *cs4231_list; 133static struct snd_cs4231 *cs4231_list;
136 134
137/* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for 135/* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for
138 * now.... -DaveM 136 * now.... -DaveM
@@ -341,12 +339,12 @@ static unsigned int rates[14] = {
341 27042, 32000, 33075, 37800, 44100, 48000 339 27042, 32000, 33075, 37800, 44100, 48000
342}; 340};
343 341
344static snd_pcm_hw_constraint_list_t hw_constraints_rates = { 342static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
345 .count = 14, 343 .count = 14,
346 .list = rates, 344 .list = rates,
347}; 345};
348 346
349static int snd_cs4231_xrate(snd_pcm_runtime_t *runtime) 347static int snd_cs4231_xrate(struct snd_pcm_runtime *runtime)
350{ 348{
351 return snd_pcm_hw_constraint_list(runtime, 0, 349 return snd_pcm_hw_constraint_list(runtime, 0,
352 SNDRV_PCM_HW_PARAM_RATE, 350 SNDRV_PCM_HW_PARAM_RATE,
@@ -389,7 +387,7 @@ static unsigned char snd_cs4231_original_image[32] =
389 0x00, /* 1f/31 - cbrl */ 387 0x00, /* 1f/31 - cbrl */
390}; 388};
391 389
392static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr) 390static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr)
393{ 391{
394#ifdef EBUS_SUPPORT 392#ifdef EBUS_SUPPORT
395 if (cp->flags & CS4231_FLAG_EBUS) { 393 if (cp->flags & CS4231_FLAG_EBUS) {
@@ -404,7 +402,7 @@ static u8 __cs4231_readb(cs4231_t *cp, void __iomem *reg_addr)
404#endif 402#endif
405} 403}
406 404
407static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr) 405static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, void __iomem *reg_addr)
408{ 406{
409#ifdef EBUS_SUPPORT 407#ifdef EBUS_SUPPORT
410 if (cp->flags & CS4231_FLAG_EBUS) { 408 if (cp->flags & CS4231_FLAG_EBUS) {
@@ -423,7 +421,7 @@ static void __cs4231_writeb(cs4231_t *cp, u8 val, void __iomem *reg_addr)
423 * Basic I/O functions 421 * Basic I/O functions
424 */ 422 */
425 423
426static void snd_cs4231_outm(cs4231_t *chip, unsigned char reg, 424static void snd_cs4231_outm(struct snd_cs4231 *chip, unsigned char reg,
427 unsigned char mask, unsigned char value) 425 unsigned char mask, unsigned char value)
428{ 426{
429 int timeout; 427 int timeout;
@@ -450,7 +448,7 @@ static void snd_cs4231_outm(cs4231_t *chip, unsigned char reg,
450 } 448 }
451} 449}
452 450
453static void snd_cs4231_dout(cs4231_t *chip, unsigned char reg, unsigned char value) 451static void snd_cs4231_dout(struct snd_cs4231 *chip, unsigned char reg, unsigned char value)
454{ 452{
455 int timeout; 453 int timeout;
456 454
@@ -467,7 +465,7 @@ static void snd_cs4231_dout(cs4231_t *chip, unsigned char reg, unsigned char val
467 mb(); 465 mb();
468} 466}
469 467
470static void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char value) 468static void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char value)
471{ 469{
472 int timeout; 470 int timeout;
473 471
@@ -485,7 +483,7 @@ static void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char valu
485 mb(); 483 mb();
486} 484}
487 485
488static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg) 486static unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg)
489{ 487{
490 int timeout; 488 int timeout;
491 unsigned char ret; 489 unsigned char ret;
@@ -508,7 +506,7 @@ static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg)
508 * CS4231 detection / MCE routines 506 * CS4231 detection / MCE routines
509 */ 507 */
510 508
511static void snd_cs4231_busy_wait(cs4231_t *chip) 509static void snd_cs4231_busy_wait(struct snd_cs4231 *chip)
512{ 510{
513 int timeout; 511 int timeout;
514 512
@@ -523,7 +521,7 @@ static void snd_cs4231_busy_wait(cs4231_t *chip)
523 udelay(1000); 521 udelay(1000);
524} 522}
525 523
526static void snd_cs4231_mce_up(cs4231_t *chip) 524static void snd_cs4231_mce_up(struct snd_cs4231 *chip)
527{ 525{
528 unsigned long flags; 526 unsigned long flags;
529 int timeout; 527 int timeout;
@@ -544,7 +542,7 @@ static void snd_cs4231_mce_up(cs4231_t *chip)
544 spin_unlock_irqrestore(&chip->lock, flags); 542 spin_unlock_irqrestore(&chip->lock, flags);
545} 543}
546 544
547static void snd_cs4231_mce_down(cs4231_t *chip) 545static void snd_cs4231_mce_down(struct snd_cs4231 *chip)
548{ 546{
549 unsigned long flags; 547 unsigned long flags;
550 int timeout; 548 int timeout;
@@ -602,9 +600,11 @@ static void snd_cs4231_mce_down(cs4231_t *chip)
602 spin_unlock_irqrestore(&chip->lock, flags); 600 spin_unlock_irqrestore(&chip->lock, flags);
603} 601}
604 602
605static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, snd_pcm_substream_t *substream, unsigned int *periods_sent) 603static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont,
604 struct snd_pcm_substream *substream,
605 unsigned int *periods_sent)
606{ 606{
607 snd_pcm_runtime_t *runtime = substream->runtime; 607 struct snd_pcm_runtime *runtime = substream->runtime;
608 608
609 while (1) { 609 while (1) {
610 unsigned int period_size = snd_pcm_lib_period_bytes(substream); 610 unsigned int period_size = snd_pcm_lib_period_bytes(substream);
@@ -619,10 +619,11 @@ static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, snd_pcm_
619 } 619 }
620} 620}
621 621
622static void cs4231_dma_trigger(snd_pcm_substream_t *substream, unsigned int what, int on) 622static void cs4231_dma_trigger(struct snd_pcm_substream *substream,
623 unsigned int what, int on)
623{ 624{
624 cs4231_t *chip = snd_pcm_substream_chip(substream); 625 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
625 cs4231_dma_control_t *dma_cont; 626 struct cs4231_dma_control *dma_cont;
626 627
627 if (what & CS4231_PLAYBACK_ENABLE) { 628 if (what & CS4231_PLAYBACK_ENABLE) {
628 dma_cont = &chip->p_dma; 629 dma_cont = &chip->p_dma;
@@ -650,9 +651,9 @@ static void cs4231_dma_trigger(snd_pcm_substream_t *substream, unsigned int what
650 } 651 }
651} 652}
652 653
653static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd) 654static int snd_cs4231_trigger(struct snd_pcm_substream *substream, int cmd)
654{ 655{
655 cs4231_t *chip = snd_pcm_substream_chip(substream); 656 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
656 int result = 0; 657 int result = 0;
657 658
658 switch (cmd) { 659 switch (cmd) {
@@ -660,7 +661,7 @@ static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd)
660 case SNDRV_PCM_TRIGGER_STOP: 661 case SNDRV_PCM_TRIGGER_STOP:
661 { 662 {
662 unsigned int what = 0; 663 unsigned int what = 0;
663 snd_pcm_substream_t *s; 664 struct snd_pcm_substream *s;
664 struct list_head *pos; 665 struct list_head *pos;
665 unsigned long flags; 666 unsigned long flags;
666 667
@@ -711,7 +712,7 @@ static unsigned char snd_cs4231_get_rate(unsigned int rate)
711 return freq_bits[13]; 712 return freq_bits[13];
712} 713}
713 714
714static unsigned char snd_cs4231_get_format(cs4231_t *chip, int format, int channels) 715static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, int format, int channels)
715{ 716{
716 unsigned char rformat; 717 unsigned char rformat;
717 718
@@ -728,7 +729,7 @@ static unsigned char snd_cs4231_get_format(cs4231_t *chip, int format, int chann
728 return rformat; 729 return rformat;
729} 730}
730 731
731static void snd_cs4231_calibrate_mute(cs4231_t *chip, int mute) 732static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute)
732{ 733{
733 unsigned long flags; 734 unsigned long flags;
734 735
@@ -768,7 +769,7 @@ static void snd_cs4231_calibrate_mute(cs4231_t *chip, int mute)
768 spin_unlock_irqrestore(&chip->lock, flags); 769 spin_unlock_irqrestore(&chip->lock, flags);
769} 770}
770 771
771static void snd_cs4231_playback_format(cs4231_t *chip, snd_pcm_hw_params_t *params, 772static void snd_cs4231_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params,
772 unsigned char pdfr) 773 unsigned char pdfr)
773{ 774{
774 unsigned long flags; 775 unsigned long flags;
@@ -791,7 +792,7 @@ static void snd_cs4231_playback_format(cs4231_t *chip, snd_pcm_hw_params_t *para
791 up(&chip->mce_mutex); 792 up(&chip->mce_mutex);
792} 793}
793 794
794static void snd_cs4231_capture_format(cs4231_t *chip, snd_pcm_hw_params_t *params, 795static void snd_cs4231_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params,
795 unsigned char cdfr) 796 unsigned char cdfr)
796{ 797{
797 unsigned long flags; 798 unsigned long flags;
@@ -824,18 +825,18 @@ static void snd_cs4231_capture_format(cs4231_t *chip, snd_pcm_hw_params_t *param
824 * Timer interface 825 * Timer interface
825 */ 826 */
826 827
827static unsigned long snd_cs4231_timer_resolution(snd_timer_t *timer) 828static unsigned long snd_cs4231_timer_resolution(struct snd_timer *timer)
828{ 829{
829 cs4231_t *chip = snd_timer_chip(timer); 830 struct snd_cs4231 *chip = snd_timer_chip(timer);
830 831
831 return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920; 832 return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920;
832} 833}
833 834
834static int snd_cs4231_timer_start(snd_timer_t *timer) 835static int snd_cs4231_timer_start(struct snd_timer *timer)
835{ 836{
836 unsigned long flags; 837 unsigned long flags;
837 unsigned int ticks; 838 unsigned int ticks;
838 cs4231_t *chip = snd_timer_chip(timer); 839 struct snd_cs4231 *chip = snd_timer_chip(timer);
839 840
840 spin_lock_irqsave(&chip->lock, flags); 841 spin_lock_irqsave(&chip->lock, flags);
841 ticks = timer->sticks; 842 ticks = timer->sticks;
@@ -856,10 +857,10 @@ static int snd_cs4231_timer_start(snd_timer_t *timer)
856 return 0; 857 return 0;
857} 858}
858 859
859static int snd_cs4231_timer_stop(snd_timer_t *timer) 860static int snd_cs4231_timer_stop(struct snd_timer *timer)
860{ 861{
861 unsigned long flags; 862 unsigned long flags;
862 cs4231_t *chip = snd_timer_chip(timer); 863 struct snd_cs4231 *chip = snd_timer_chip(timer);
863 864
864 spin_lock_irqsave(&chip->lock, flags); 865 spin_lock_irqsave(&chip->lock, flags);
865 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, 866 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1,
@@ -869,7 +870,7 @@ static int snd_cs4231_timer_stop(snd_timer_t *timer)
869 return 0; 870 return 0;
870} 871}
871 872
872static void snd_cs4231_init(cs4231_t *chip) 873static void __init snd_cs4231_init(struct snd_cs4231 *chip)
873{ 874{
874 unsigned long flags; 875 unsigned long flags;
875 876
@@ -927,7 +928,7 @@ static void snd_cs4231_init(cs4231_t *chip)
927#endif 928#endif
928} 929}
929 930
930static int snd_cs4231_open(cs4231_t *chip, unsigned int mode) 931static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
931{ 932{
932 unsigned long flags; 933 unsigned long flags;
933 934
@@ -962,7 +963,7 @@ static int snd_cs4231_open(cs4231_t *chip, unsigned int mode)
962 return 0; 963 return 0;
963} 964}
964 965
965static void snd_cs4231_close(cs4231_t *chip, unsigned int mode) 966static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
966{ 967{
967 unsigned long flags; 968 unsigned long flags;
968 969
@@ -1013,21 +1014,21 @@ static void snd_cs4231_close(cs4231_t *chip, unsigned int mode)
1013 * timer open/close 1014 * timer open/close
1014 */ 1015 */
1015 1016
1016static int snd_cs4231_timer_open(snd_timer_t *timer) 1017static int snd_cs4231_timer_open(struct snd_timer *timer)
1017{ 1018{
1018 cs4231_t *chip = snd_timer_chip(timer); 1019 struct snd_cs4231 *chip = snd_timer_chip(timer);
1019 snd_cs4231_open(chip, CS4231_MODE_TIMER); 1020 snd_cs4231_open(chip, CS4231_MODE_TIMER);
1020 return 0; 1021 return 0;
1021} 1022}
1022 1023
1023static int snd_cs4231_timer_close(snd_timer_t * timer) 1024static int snd_cs4231_timer_close(struct snd_timer * timer)
1024{ 1025{
1025 cs4231_t *chip = snd_timer_chip(timer); 1026 struct snd_cs4231 *chip = snd_timer_chip(timer);
1026 snd_cs4231_close(chip, CS4231_MODE_TIMER); 1027 snd_cs4231_close(chip, CS4231_MODE_TIMER);
1027 return 0; 1028 return 0;
1028} 1029}
1029 1030
1030static struct _snd_timer_hardware snd_cs4231_timer_table = 1031static struct snd_timer_hardware snd_cs4231_timer_table =
1031{ 1032{
1032 .flags = SNDRV_TIMER_HW_AUTO, 1033 .flags = SNDRV_TIMER_HW_AUTO,
1033 .resolution = 9945, 1034 .resolution = 9945,
@@ -1043,10 +1044,10 @@ static struct _snd_timer_hardware snd_cs4231_timer_table =
1043 * ok.. exported functions.. 1044 * ok.. exported functions..
1044 */ 1045 */
1045 1046
1046static int snd_cs4231_playback_hw_params(snd_pcm_substream_t *substream, 1047static int snd_cs4231_playback_hw_params(struct snd_pcm_substream *substream,
1047 snd_pcm_hw_params_t *hw_params) 1048 struct snd_pcm_hw_params *hw_params)
1048{ 1049{
1049 cs4231_t *chip = snd_pcm_substream_chip(substream); 1050 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1050 unsigned char new_pdfr; 1051 unsigned char new_pdfr;
1051 int err; 1052 int err;
1052 1053
@@ -1061,15 +1062,15 @@ static int snd_cs4231_playback_hw_params(snd_pcm_substream_t *substream,
1061 return 0; 1062 return 0;
1062} 1063}
1063 1064
1064static int snd_cs4231_playback_hw_free(snd_pcm_substream_t *substream) 1065static int snd_cs4231_playback_hw_free(struct snd_pcm_substream *substream)
1065{ 1066{
1066 return snd_pcm_lib_free_pages(substream); 1067 return snd_pcm_lib_free_pages(substream);
1067} 1068}
1068 1069
1069static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream) 1070static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream)
1070{ 1071{
1071 cs4231_t *chip = snd_pcm_substream_chip(substream); 1072 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1072 snd_pcm_runtime_t *runtime = substream->runtime; 1073 struct snd_pcm_runtime *runtime = substream->runtime;
1073 unsigned long flags; 1074 unsigned long flags;
1074 1075
1075 spin_lock_irqsave(&chip->lock, flags); 1076 spin_lock_irqsave(&chip->lock, flags);
@@ -1086,10 +1087,10 @@ static int snd_cs4231_playback_prepare(snd_pcm_substream_t *substream)
1086 return 0; 1087 return 0;
1087} 1088}
1088 1089
1089static int snd_cs4231_capture_hw_params(snd_pcm_substream_t *substream, 1090static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream,
1090 snd_pcm_hw_params_t *hw_params) 1091 struct snd_pcm_hw_params *hw_params)
1091{ 1092{
1092 cs4231_t *chip = snd_pcm_substream_chip(substream); 1093 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1093 unsigned char new_cdfr; 1094 unsigned char new_cdfr;
1094 int err; 1095 int err;
1095 1096
@@ -1104,14 +1105,14 @@ static int snd_cs4231_capture_hw_params(snd_pcm_substream_t *substream,
1104 return 0; 1105 return 0;
1105} 1106}
1106 1107
1107static int snd_cs4231_capture_hw_free(snd_pcm_substream_t *substream) 1108static int snd_cs4231_capture_hw_free(struct snd_pcm_substream *substream)
1108{ 1109{
1109 return snd_pcm_lib_free_pages(substream); 1110 return snd_pcm_lib_free_pages(substream);
1110} 1111}
1111 1112
1112static int snd_cs4231_capture_prepare(snd_pcm_substream_t *substream) 1113static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream)
1113{ 1114{
1114 cs4231_t *chip = snd_pcm_substream_chip(substream); 1115 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1115 unsigned long flags; 1116 unsigned long flags;
1116 1117
1117 spin_lock_irqsave(&chip->lock, flags); 1118 spin_lock_irqsave(&chip->lock, flags);
@@ -1125,7 +1126,7 @@ static int snd_cs4231_capture_prepare(snd_pcm_substream_t *substream)
1125 return 0; 1126 return 0;
1126} 1127}
1127 1128
1128static void snd_cs4231_overrange(cs4231_t *chip) 1129static void snd_cs4231_overrange(struct snd_cs4231 *chip)
1129{ 1130{
1130 unsigned long flags; 1131 unsigned long flags;
1131 unsigned char res; 1132 unsigned char res;
@@ -1138,10 +1139,8 @@ static void snd_cs4231_overrange(cs4231_t *chip)
1138 chip->capture_substream->runtime->overrange++; 1139 chip->capture_substream->runtime->overrange++;
1139} 1140}
1140 1141
1141static void snd_cs4231_play_callback(cs4231_t *cookie) 1142static void snd_cs4231_play_callback(struct snd_cs4231 *chip)
1142{ 1143{
1143 cs4231_t *chip = cookie;
1144
1145 if (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) { 1144 if (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) {
1146 snd_pcm_period_elapsed(chip->playback_substream); 1145 snd_pcm_period_elapsed(chip->playback_substream);
1147 snd_cs4231_advance_dma(&chip->p_dma, chip->playback_substream, 1146 snd_cs4231_advance_dma(&chip->p_dma, chip->playback_substream,
@@ -1149,10 +1148,8 @@ static void snd_cs4231_play_callback(cs4231_t *cookie)
1149 } 1148 }
1150} 1149}
1151 1150
1152static void snd_cs4231_capture_callback(cs4231_t *cookie) 1151static void snd_cs4231_capture_callback(struct snd_cs4231 *chip)
1153{ 1152{
1154 cs4231_t *chip = cookie;
1155
1156 if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) { 1153 if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) {
1157 snd_pcm_period_elapsed(chip->capture_substream); 1154 snd_pcm_period_elapsed(chip->capture_substream);
1158 snd_cs4231_advance_dma(&chip->c_dma, chip->capture_substream, 1155 snd_cs4231_advance_dma(&chip->c_dma, chip->capture_substream,
@@ -1160,10 +1157,10 @@ static void snd_cs4231_capture_callback(cs4231_t *cookie)
1160 } 1157 }
1161} 1158}
1162 1159
1163static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t *substream) 1160static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *substream)
1164{ 1161{
1165 cs4231_t *chip = snd_pcm_substream_chip(substream); 1162 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1166 cs4231_dma_control_t *dma_cont = &chip->p_dma; 1163 struct cs4231_dma_control *dma_cont = &chip->p_dma;
1167 size_t ptr; 1164 size_t ptr;
1168 1165
1169 if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) 1166 if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE))
@@ -1175,10 +1172,10 @@ static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t *substr
1175 return bytes_to_frames(substream->runtime, ptr); 1172 return bytes_to_frames(substream->runtime, ptr);
1176} 1173}
1177 1174
1178static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substream) 1175static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *substream)
1179{ 1176{
1180 cs4231_t *chip = snd_pcm_substream_chip(substream); 1177 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1181 cs4231_dma_control_t *dma_cont = &chip->c_dma; 1178 struct cs4231_dma_control *dma_cont = &chip->c_dma;
1182 size_t ptr; 1179 size_t ptr;
1183 1180
1184 if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) 1181 if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE))
@@ -1194,7 +1191,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substr
1194 1191
1195 */ 1192 */
1196 1193
1197static int snd_cs4231_probe(cs4231_t *chip) 1194static int __init snd_cs4231_probe(struct snd_cs4231 *chip)
1198{ 1195{
1199 unsigned long flags; 1196 unsigned long flags;
1200 int i, id, vers; 1197 int i, id, vers;
@@ -1259,7 +1256,7 @@ static int snd_cs4231_probe(cs4231_t *chip)
1259 return 0; /* all things are ok.. */ 1256 return 0; /* all things are ok.. */
1260} 1257}
1261 1258
1262static snd_pcm_hardware_t snd_cs4231_playback = 1259static struct snd_pcm_hardware snd_cs4231_playback =
1263{ 1260{
1264 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1261 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1265 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START), 1262 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START),
@@ -1279,7 +1276,7 @@ static snd_pcm_hardware_t snd_cs4231_playback =
1279 .periods_max = 1024, 1276 .periods_max = 1024,
1280}; 1277};
1281 1278
1282static snd_pcm_hardware_t snd_cs4231_capture = 1279static struct snd_pcm_hardware snd_cs4231_capture =
1283{ 1280{
1284 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1281 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1285 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START), 1282 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START),
@@ -1299,10 +1296,10 @@ static snd_pcm_hardware_t snd_cs4231_capture =
1299 .periods_max = 1024, 1296 .periods_max = 1024,
1300}; 1297};
1301 1298
1302static int snd_cs4231_playback_open(snd_pcm_substream_t *substream) 1299static int snd_cs4231_playback_open(struct snd_pcm_substream *substream)
1303{ 1300{
1304 cs4231_t *chip = snd_pcm_substream_chip(substream); 1301 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1305 snd_pcm_runtime_t *runtime = substream->runtime; 1302 struct snd_pcm_runtime *runtime = substream->runtime;
1306 int err; 1303 int err;
1307 1304
1308 runtime->hw = snd_cs4231_playback; 1305 runtime->hw = snd_cs4231_playback;
@@ -1319,10 +1316,10 @@ static int snd_cs4231_playback_open(snd_pcm_substream_t *substream)
1319 return 0; 1316 return 0;
1320} 1317}
1321 1318
1322static int snd_cs4231_capture_open(snd_pcm_substream_t *substream) 1319static int snd_cs4231_capture_open(struct snd_pcm_substream *substream)
1323{ 1320{
1324 cs4231_t *chip = snd_pcm_substream_chip(substream); 1321 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1325 snd_pcm_runtime_t *runtime = substream->runtime; 1322 struct snd_pcm_runtime *runtime = substream->runtime;
1326 int err; 1323 int err;
1327 1324
1328 runtime->hw = snd_cs4231_capture; 1325 runtime->hw = snd_cs4231_capture;
@@ -1339,9 +1336,9 @@ static int snd_cs4231_capture_open(snd_pcm_substream_t *substream)
1339 return 0; 1336 return 0;
1340} 1337}
1341 1338
1342static int snd_cs4231_playback_close(snd_pcm_substream_t *substream) 1339static int snd_cs4231_playback_close(struct snd_pcm_substream *substream)
1343{ 1340{
1344 cs4231_t *chip = snd_pcm_substream_chip(substream); 1341 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1345 1342
1346 snd_cs4231_close(chip, CS4231_MODE_PLAY); 1343 snd_cs4231_close(chip, CS4231_MODE_PLAY);
1347 chip->playback_substream = NULL; 1344 chip->playback_substream = NULL;
@@ -1349,9 +1346,9 @@ static int snd_cs4231_playback_close(snd_pcm_substream_t *substream)
1349 return 0; 1346 return 0;
1350} 1347}
1351 1348
1352static int snd_cs4231_capture_close(snd_pcm_substream_t *substream) 1349static int snd_cs4231_capture_close(struct snd_pcm_substream *substream)
1353{ 1350{
1354 cs4231_t *chip = snd_pcm_substream_chip(substream); 1351 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream);
1355 1352
1356 snd_cs4231_close(chip, CS4231_MODE_RECORD); 1353 snd_cs4231_close(chip, CS4231_MODE_RECORD);
1357 chip->capture_substream = NULL; 1354 chip->capture_substream = NULL;
@@ -1363,7 +1360,7 @@ static int snd_cs4231_capture_close(snd_pcm_substream_t *substream)
1363 * XXX the audio AUXIO register... 1360 * XXX the audio AUXIO register...
1364 */ 1361 */
1365 1362
1366static snd_pcm_ops_t snd_cs4231_playback_ops = { 1363static struct snd_pcm_ops snd_cs4231_playback_ops = {
1367 .open = snd_cs4231_playback_open, 1364 .open = snd_cs4231_playback_open,
1368 .close = snd_cs4231_playback_close, 1365 .close = snd_cs4231_playback_close,
1369 .ioctl = snd_pcm_lib_ioctl, 1366 .ioctl = snd_pcm_lib_ioctl,
@@ -1374,7 +1371,7 @@ static snd_pcm_ops_t snd_cs4231_playback_ops = {
1374 .pointer = snd_cs4231_playback_pointer, 1371 .pointer = snd_cs4231_playback_pointer,
1375}; 1372};
1376 1373
1377static snd_pcm_ops_t snd_cs4231_capture_ops = { 1374static struct snd_pcm_ops snd_cs4231_capture_ops = {
1378 .open = snd_cs4231_capture_open, 1375 .open = snd_cs4231_capture_open,
1379 .close = snd_cs4231_capture_close, 1376 .close = snd_cs4231_capture_close,
1380 .ioctl = snd_pcm_lib_ioctl, 1377 .ioctl = snd_pcm_lib_ioctl,
@@ -1385,9 +1382,9 @@ static snd_pcm_ops_t snd_cs4231_capture_ops = {
1385 .pointer = snd_cs4231_capture_pointer, 1382 .pointer = snd_cs4231_capture_pointer,
1386}; 1383};
1387 1384
1388int snd_cs4231_pcm(cs4231_t *chip) 1385static int __init snd_cs4231_pcm(struct snd_cs4231 *chip)
1389{ 1386{
1390 snd_pcm_t *pcm; 1387 struct snd_pcm *pcm;
1391 int err; 1388 int err;
1392 1389
1393 if ((err = snd_pcm_new(chip->card, "CS4231", 0, 1, 1, &pcm)) < 0) 1390 if ((err = snd_pcm_new(chip->card, "CS4231", 0, 1, 1, &pcm)) < 0)
@@ -1408,16 +1405,10 @@ int snd_cs4231_pcm(cs4231_t *chip)
1408 return 0; 1405 return 0;
1409} 1406}
1410 1407
1411static void snd_cs4231_timer_free(snd_timer_t *timer) 1408static int __init snd_cs4231_timer(struct snd_cs4231 *chip)
1412{ 1409{
1413 cs4231_t *chip = timer->private_data; 1410 struct snd_timer *timer;
1414 chip->timer = NULL; 1411 struct snd_timer_id tid;
1415}
1416
1417int snd_cs4231_timer(cs4231_t *chip)
1418{
1419 snd_timer_t *timer;
1420 snd_timer_id_t tid;
1421 int err; 1412 int err;
1422 1413
1423 /* Timer initialization */ 1414 /* Timer initialization */
@@ -1430,7 +1421,6 @@ int snd_cs4231_timer(cs4231_t *chip)
1430 return err; 1421 return err;
1431 strcpy(timer->name, "CS4231"); 1422 strcpy(timer->name, "CS4231");
1432 timer->private_data = chip; 1423 timer->private_data = chip;
1433 timer->private_free = snd_cs4231_timer_free;
1434 timer->hw = snd_cs4231_timer_table; 1424 timer->hw = snd_cs4231_timer_table;
1435 chip->timer = timer; 1425 chip->timer = timer;
1436 1426
@@ -1441,12 +1431,13 @@ int snd_cs4231_timer(cs4231_t *chip)
1441 * MIXER part 1431 * MIXER part
1442 */ 1432 */
1443 1433
1444static int snd_cs4231_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1434static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol,
1435 struct snd_ctl_elem_info *uinfo)
1445{ 1436{
1446 static char *texts[4] = { 1437 static char *texts[4] = {
1447 "Line", "CD", "Mic", "Mix" 1438 "Line", "CD", "Mic", "Mix"
1448 }; 1439 };
1449 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1440 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1450 1441
1451 snd_assert(chip->card != NULL, return -EINVAL); 1442 snd_assert(chip->card != NULL, return -EINVAL);
1452 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1443 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -1459,9 +1450,10 @@ static int snd_cs4231_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *ui
1459 return 0; 1450 return 0;
1460} 1451}
1461 1452
1462static int snd_cs4231_get_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1453static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol,
1454 struct snd_ctl_elem_value *ucontrol)
1463{ 1455{
1464 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1456 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1465 unsigned long flags; 1457 unsigned long flags;
1466 1458
1467 spin_lock_irqsave(&chip->lock, flags); 1459 spin_lock_irqsave(&chip->lock, flags);
@@ -1474,9 +1466,10 @@ static int snd_cs4231_get_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
1474 return 0; 1466 return 0;
1475} 1467}
1476 1468
1477static int snd_cs4231_put_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1469static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol,
1470 struct snd_ctl_elem_value *ucontrol)
1478{ 1471{
1479 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1472 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1480 unsigned long flags; 1473 unsigned long flags;
1481 unsigned short left, right; 1474 unsigned short left, right;
1482 int change; 1475 int change;
@@ -1501,7 +1494,8 @@ static int snd_cs4231_put_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
1501 return change; 1494 return change;
1502} 1495}
1503 1496
1504int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1497static int snd_cs4231_info_single(struct snd_kcontrol *kcontrol,
1498 struct snd_ctl_elem_info *uinfo)
1505{ 1499{
1506 int mask = (kcontrol->private_value >> 16) & 0xff; 1500 int mask = (kcontrol->private_value >> 16) & 0xff;
1507 1501
@@ -1514,9 +1508,10 @@ int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
1514 return 0; 1508 return 0;
1515} 1509}
1516 1510
1517int snd_cs4231_get_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1511static int snd_cs4231_get_single(struct snd_kcontrol *kcontrol,
1512 struct snd_ctl_elem_value *ucontrol)
1518{ 1513{
1519 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1514 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1520 unsigned long flags; 1515 unsigned long flags;
1521 int reg = kcontrol->private_value & 0xff; 1516 int reg = kcontrol->private_value & 0xff;
1522 int shift = (kcontrol->private_value >> 8) & 0xff; 1517 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -1536,9 +1531,10 @@ int snd_cs4231_get_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
1536 return 0; 1531 return 0;
1537} 1532}
1538 1533
1539int snd_cs4231_put_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1534static int snd_cs4231_put_single(struct snd_kcontrol *kcontrol,
1535 struct snd_ctl_elem_value *ucontrol)
1540{ 1536{
1541 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1537 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1542 unsigned long flags; 1538 unsigned long flags;
1543 int reg = kcontrol->private_value & 0xff; 1539 int reg = kcontrol->private_value & 0xff;
1544 int shift = (kcontrol->private_value >> 8) & 0xff; 1540 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -1563,7 +1559,8 @@ int snd_cs4231_put_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
1563 return change; 1559 return change;
1564} 1560}
1565 1561
1566int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1562static int snd_cs4231_info_double(struct snd_kcontrol *kcontrol,
1563 struct snd_ctl_elem_info *uinfo)
1567{ 1564{
1568 int mask = (kcontrol->private_value >> 24) & 0xff; 1565 int mask = (kcontrol->private_value >> 24) & 0xff;
1569 1566
@@ -1576,9 +1573,10 @@ int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
1576 return 0; 1573 return 0;
1577} 1574}
1578 1575
1579int snd_cs4231_get_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1576static int snd_cs4231_get_double(struct snd_kcontrol *kcontrol,
1577 struct snd_ctl_elem_value *ucontrol)
1580{ 1578{
1581 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1579 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1582 unsigned long flags; 1580 unsigned long flags;
1583 int left_reg = kcontrol->private_value & 0xff; 1581 int left_reg = kcontrol->private_value & 0xff;
1584 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1582 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -1604,9 +1602,10 @@ int snd_cs4231_get_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
1604 return 0; 1602 return 0;
1605} 1603}
1606 1604
1607int snd_cs4231_put_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1605static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol,
1606 struct snd_ctl_elem_value *ucontrol)
1608{ 1607{
1609 cs4231_t *chip = snd_kcontrol_chip(kcontrol); 1608 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
1610 unsigned long flags; 1609 unsigned long flags;
1611 int left_reg = kcontrol->private_value & 0xff; 1610 int left_reg = kcontrol->private_value & 0xff;
1612 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1611 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -1651,7 +1650,7 @@ int snd_cs4231_put_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
1651 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ 1650 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
1652 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 1651 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
1653 1652
1654static snd_kcontrol_new_t snd_cs4231_controls[] = { 1653static struct snd_kcontrol_new snd_cs4231_controls[] __initdata = {
1655CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 1654CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
1656CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), 1655CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
1657CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 1656CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
@@ -1680,9 +1679,9 @@ CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1),
1680CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1) 1679CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1)
1681}; 1680};
1682 1681
1683int snd_cs4231_mixer(cs4231_t *chip) 1682static int __init snd_cs4231_mixer(struct snd_cs4231 *chip)
1684{ 1683{
1685 snd_card_t *card; 1684 struct snd_card *card;
1686 int err, idx; 1685 int err, idx;
1687 1686
1688 snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL); 1687 snd_assert(chip != NULL && chip->pcm != NULL, return -EINVAL);
@@ -1702,9 +1701,9 @@ int snd_cs4231_mixer(cs4231_t *chip)
1702 1701
1703static int dev; 1702static int dev;
1704 1703
1705static int cs4231_attach_begin(snd_card_t **rcard) 1704static int __init cs4231_attach_begin(struct snd_card **rcard)
1706{ 1705{
1707 snd_card_t *card; 1706 struct snd_card *card;
1708 1707
1709 *rcard = NULL; 1708 *rcard = NULL;
1710 1709
@@ -1727,7 +1726,7 @@ static int cs4231_attach_begin(snd_card_t **rcard)
1727 return 0; 1726 return 0;
1728} 1727}
1729 1728
1730static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip) 1729static int __init cs4231_attach_finish(struct snd_card *card, struct snd_cs4231 *chip)
1731{ 1730{
1732 int err; 1731 int err;
1733 1732
@@ -1761,7 +1760,7 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_re
1761 unsigned long flags; 1760 unsigned long flags;
1762 unsigned char status; 1761 unsigned char status;
1763 u32 csr; 1762 u32 csr;
1764 cs4231_t *chip = dev_id; 1763 struct snd_cs4231 *chip = dev_id;
1765 1764
1766 /*This is IRQ is not raised by the cs4231*/ 1765 /*This is IRQ is not raised by the cs4231*/
1767 if (!(__cs4231_readb(chip, CS4231P(chip, STATUS)) & CS4231_GLOBALIRQ)) 1766 if (!(__cs4231_readb(chip, CS4231P(chip, STATUS)) & CS4231_GLOBALIRQ))
@@ -1806,12 +1805,12 @@ static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_re
1806 * SBUS DMA routines 1805 * SBUS DMA routines
1807 */ 1806 */
1808 1807
1809int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len) 1808static int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
1810{ 1809{
1811 unsigned long flags; 1810 unsigned long flags;
1812 u32 test, csr; 1811 u32 test, csr;
1813 int err; 1812 int err;
1814 sbus_dma_info_t *base = &dma_cont->sbus_info; 1813 struct sbus_dma_info *base = &dma_cont->sbus_info;
1815 1814
1816 if (len >= (1 << 24)) 1815 if (len >= (1 << 24))
1817 return -EINVAL; 1816 return -EINVAL;
@@ -1838,11 +1837,11 @@ out:
1838 return err; 1837 return err;
1839} 1838}
1840 1839
1841void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d) 1840static void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d)
1842{ 1841{
1843 unsigned long flags; 1842 unsigned long flags;
1844 u32 csr, test; 1843 u32 csr, test;
1845 sbus_dma_info_t *base = &dma_cont->sbus_info; 1844 struct sbus_dma_info *base = &dma_cont->sbus_info;
1846 1845
1847 spin_lock_irqsave(&base->lock, flags); 1846 spin_lock_irqsave(&base->lock, flags);
1848 csr = sbus_readl(base->regs + APCCSR); 1847 csr = sbus_readl(base->regs + APCCSR);
@@ -1857,11 +1856,11 @@ void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d)
1857 spin_unlock_irqrestore(&base->lock, flags); 1856 spin_unlock_irqrestore(&base->lock, flags);
1858} 1857}
1859 1858
1860void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on) 1859static void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
1861{ 1860{
1862 unsigned long flags; 1861 unsigned long flags;
1863 u32 csr, shift; 1862 u32 csr, shift;
1864 sbus_dma_info_t *base = &dma_cont->sbus_info; 1863 struct sbus_dma_info *base = &dma_cont->sbus_info;
1865 1864
1866 spin_lock_irqsave(&base->lock, flags); 1865 spin_lock_irqsave(&base->lock, flags);
1867 if (!on) { 1866 if (!on) {
@@ -1894,14 +1893,14 @@ void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
1894 spin_unlock_irqrestore(&base->lock, flags); 1893 spin_unlock_irqrestore(&base->lock, flags);
1895} 1894}
1896 1895
1897unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont) 1896static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
1898{ 1897{
1899 sbus_dma_info_t *base = &dma_cont->sbus_info; 1898 struct sbus_dma_info *base = &dma_cont->sbus_info;
1900 1899
1901 return sbus_readl(base->regs + base->dir + APCVA); 1900 return sbus_readl(base->regs + base->dir + APCVA);
1902} 1901}
1903 1902
1904void sbus_dma_reset(cs4231_t *chip) 1903static void sbus_dma_reset(struct snd_cs4231 *chip)
1905{ 1904{
1906 sbus_writel(APC_CHIP_RESET, chip->port + APCCSR); 1905 sbus_writel(APC_CHIP_RESET, chip->port + APCCSR);
1907 sbus_writel(0x00, chip->port + APCCSR); 1906 sbus_writel(0x00, chip->port + APCCSR);
@@ -1918,7 +1917,7 @@ void sbus_dma_reset(cs4231_t *chip)
1918 chip->port + APCCSR); 1917 chip->port + APCCSR);
1919} 1918}
1920 1919
1921void sbus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm) 1920static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
1922{ 1921{
1923 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, 1922 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
1924 snd_dma_sbus_data(chip->dev_u.sdev), 1923 snd_dma_sbus_data(chip->dev_u.sdev),
@@ -1929,7 +1928,7 @@ void sbus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
1929 * Init and exit routines 1928 * Init and exit routines
1930 */ 1929 */
1931 1930
1932static int snd_cs4231_sbus_free(cs4231_t *chip) 1931static int snd_cs4231_sbus_free(struct snd_cs4231 *chip)
1933{ 1932{
1934 if (chip->irq[0]) 1933 if (chip->irq[0])
1935 free_irq(chip->irq[0], chip); 1934 free_irq(chip->irq[0], chip);
@@ -1937,31 +1936,28 @@ static int snd_cs4231_sbus_free(cs4231_t *chip)
1937 if (chip->port) 1936 if (chip->port)
1938 sbus_iounmap(chip->port, chip->regs_size); 1937 sbus_iounmap(chip->port, chip->regs_size);
1939 1938
1940 if (chip->timer)
1941 snd_device_free(chip->card, chip->timer);
1942
1943 kfree(chip); 1939 kfree(chip);
1944 1940
1945 return 0; 1941 return 0;
1946} 1942}
1947 1943
1948static int snd_cs4231_sbus_dev_free(snd_device_t *device) 1944static int snd_cs4231_sbus_dev_free(struct snd_device *device)
1949{ 1945{
1950 cs4231_t *cp = device->device_data; 1946 struct snd_cs4231 *cp = device->device_data;
1951 1947
1952 return snd_cs4231_sbus_free(cp); 1948 return snd_cs4231_sbus_free(cp);
1953} 1949}
1954 1950
1955static snd_device_ops_t snd_cs4231_sbus_dev_ops = { 1951static struct snd_device_ops snd_cs4231_sbus_dev_ops = {
1956 .dev_free = snd_cs4231_sbus_dev_free, 1952 .dev_free = snd_cs4231_sbus_dev_free,
1957}; 1953};
1958 1954
1959static int __init snd_cs4231_sbus_create(snd_card_t *card, 1955static int __init snd_cs4231_sbus_create(struct snd_card *card,
1960 struct sbus_dev *sdev, 1956 struct sbus_dev *sdev,
1961 int dev, 1957 int dev,
1962 cs4231_t **rchip) 1958 struct snd_cs4231 **rchip)
1963{ 1959{
1964 cs4231_t *chip; 1960 struct snd_cs4231 *chip;
1965 int err; 1961 int err;
1966 1962
1967 *rchip = NULL; 1963 *rchip = NULL;
@@ -2032,11 +2028,11 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
2032 return 0; 2028 return 0;
2033} 2029}
2034 2030
2035static int cs4231_sbus_attach(struct sbus_dev *sdev) 2031static int __init cs4231_sbus_attach(struct sbus_dev *sdev)
2036{ 2032{
2037 struct resource *rp = &sdev->resource[0]; 2033 struct resource *rp = &sdev->resource[0];
2038 cs4231_t *cp; 2034 struct snd_cs4231 *cp;
2039 snd_card_t *card; 2035 struct snd_card *card;
2040 int err; 2036 int err;
2041 2037
2042 err = cs4231_attach_begin(&card); 2038 err = cs4231_attach_begin(&card);
@@ -2062,14 +2058,14 @@ static int cs4231_sbus_attach(struct sbus_dev *sdev)
2062 2058
2063static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie) 2059static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie)
2064{ 2060{
2065 cs4231_t *chip = cookie; 2061 struct snd_cs4231 *chip = cookie;
2066 2062
2067 snd_cs4231_play_callback(chip); 2063 snd_cs4231_play_callback(chip);
2068} 2064}
2069 2065
2070static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie) 2066static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie)
2071{ 2067{
2072 cs4231_t *chip = cookie; 2068 struct snd_cs4231 *chip = cookie;
2073 2069
2074 snd_cs4231_capture_callback(chip); 2070 snd_cs4231_capture_callback(chip);
2075} 2071}
@@ -2078,32 +2074,32 @@ static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event,
2078 * EBUS DMA wrappers 2074 * EBUS DMA wrappers
2079 */ 2075 */
2080 2076
2081int _ebus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len) 2077static int _ebus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
2082{ 2078{
2083 return ebus_dma_request(&dma_cont->ebus_info, bus_addr, len); 2079 return ebus_dma_request(&dma_cont->ebus_info, bus_addr, len);
2084} 2080}
2085 2081
2086void _ebus_dma_enable(struct cs4231_dma_control *dma_cont, int on) 2082static void _ebus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
2087{ 2083{
2088 ebus_dma_enable(&dma_cont->ebus_info, on); 2084 ebus_dma_enable(&dma_cont->ebus_info, on);
2089} 2085}
2090 2086
2091void _ebus_dma_prepare(struct cs4231_dma_control *dma_cont, int dir) 2087static void _ebus_dma_prepare(struct cs4231_dma_control *dma_cont, int dir)
2092{ 2088{
2093 ebus_dma_prepare(&dma_cont->ebus_info, dir); 2089 ebus_dma_prepare(&dma_cont->ebus_info, dir);
2094} 2090}
2095 2091
2096unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont) 2092static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
2097{ 2093{
2098 return ebus_dma_addr(&dma_cont->ebus_info); 2094 return ebus_dma_addr(&dma_cont->ebus_info);
2099} 2095}
2100 2096
2101void _ebus_dma_reset(cs4231_t *chip) 2097static void _ebus_dma_reset(struct snd_cs4231 *chip)
2102{ 2098{
2103 return; 2099 return;
2104} 2100}
2105 2101
2106void _ebus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm) 2102static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
2107{ 2103{
2108 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 2104 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
2109 snd_dma_pci_data(chip->dev_u.pdev), 2105 snd_dma_pci_data(chip->dev_u.pdev),
@@ -2114,7 +2110,7 @@ void _ebus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
2114 * Init and exit routines 2110 * Init and exit routines
2115 */ 2111 */
2116 2112
2117static int snd_cs4231_ebus_free(cs4231_t *chip) 2113static int snd_cs4231_ebus_free(struct snd_cs4231 *chip)
2118{ 2114{
2119 if (chip->c_dma.ebus_info.regs) { 2115 if (chip->c_dma.ebus_info.regs) {
2120 ebus_dma_unregister(&chip->c_dma.ebus_info); 2116 ebus_dma_unregister(&chip->c_dma.ebus_info);
@@ -2127,31 +2123,29 @@ static int snd_cs4231_ebus_free(cs4231_t *chip)
2127 2123
2128 if (chip->port) 2124 if (chip->port)
2129 iounmap(chip->port); 2125 iounmap(chip->port);
2130 if (chip->timer)
2131 snd_device_free(chip->card, chip->timer);
2132 2126
2133 kfree(chip); 2127 kfree(chip);
2134 2128
2135 return 0; 2129 return 0;
2136} 2130}
2137 2131
2138static int snd_cs4231_ebus_dev_free(snd_device_t *device) 2132static int snd_cs4231_ebus_dev_free(struct snd_device *device)
2139{ 2133{
2140 cs4231_t *cp = device->device_data; 2134 struct snd_cs4231 *cp = device->device_data;
2141 2135
2142 return snd_cs4231_ebus_free(cp); 2136 return snd_cs4231_ebus_free(cp);
2143} 2137}
2144 2138
2145static snd_device_ops_t snd_cs4231_ebus_dev_ops = { 2139static struct snd_device_ops snd_cs4231_ebus_dev_ops = {
2146 .dev_free = snd_cs4231_ebus_dev_free, 2140 .dev_free = snd_cs4231_ebus_dev_free,
2147}; 2141};
2148 2142
2149static int __init snd_cs4231_ebus_create(snd_card_t *card, 2143static int __init snd_cs4231_ebus_create(struct snd_card *card,
2150 struct linux_ebus_device *edev, 2144 struct linux_ebus_device *edev,
2151 int dev, 2145 int dev,
2152 cs4231_t **rchip) 2146 struct snd_cs4231 **rchip)
2153{ 2147{
2154 cs4231_t *chip; 2148 struct snd_cs4231 *chip;
2155 int err; 2149 int err;
2156 2150
2157 *rchip = NULL; 2151 *rchip = NULL;
@@ -2241,10 +2235,10 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
2241 return 0; 2235 return 0;
2242} 2236}
2243 2237
2244static int cs4231_ebus_attach(struct linux_ebus_device *edev) 2238static int __init cs4231_ebus_attach(struct linux_ebus_device *edev)
2245{ 2239{
2246 snd_card_t *card; 2240 struct snd_card *card;
2247 cs4231_t *chip; 2241 struct snd_cs4231 *chip;
2248 int err; 2242 int err;
2249 2243
2250 err = cs4231_attach_begin(&card); 2244 err = cs4231_attach_begin(&card);
@@ -2317,10 +2311,10 @@ static int __init cs4231_init(void)
2317 2311
2318static void __exit cs4231_exit(void) 2312static void __exit cs4231_exit(void)
2319{ 2313{
2320 cs4231_t *p = cs4231_list; 2314 struct snd_cs4231 *p = cs4231_list;
2321 2315
2322 while (p != NULL) { 2316 while (p != NULL) {
2323 cs4231_t *next = p->next; 2317 struct snd_cs4231 *next = p->next;
2324 2318
2325 snd_card_free(p->card); 2319 snd_card_free(p->card);
2326 2320