aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/korg1212/korg1212.c384
1 files changed, 196 insertions, 188 deletions
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index ec716133ec3a..a8a6a5c41a7f 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -61,7 +61,7 @@
61// ---------------------------------------------------------------------------- 61// ----------------------------------------------------------------------------
62// Valid states of the Korg 1212 I/O card. 62// Valid states of the Korg 1212 I/O card.
63// ---------------------------------------------------------------------------- 63// ----------------------------------------------------------------------------
64typedef enum { 64enum CardState {
65 K1212_STATE_NONEXISTENT, // there is no card here 65 K1212_STATE_NONEXISTENT, // there is no card here
66 K1212_STATE_UNINITIALIZED, // the card is awaiting DSP download 66 K1212_STATE_UNINITIALIZED, // the card is awaiting DSP download
67 K1212_STATE_DSP_IN_PROCESS, // the card is currently downloading its DSP code 67 K1212_STATE_DSP_IN_PROCESS, // the card is currently downloading its DSP code
@@ -77,13 +77,13 @@ typedef enum {
77 K1212_STATE_ERRORSTOP, // the card has stopped itself because of an error and we 77 K1212_STATE_ERRORSTOP, // the card has stopped itself because of an error and we
78 // are in the process of cleaning things up. 78 // are in the process of cleaning things up.
79 K1212_STATE_MAX_STATE // state values of this and beyond are invalid 79 K1212_STATE_MAX_STATE // state values of this and beyond are invalid
80} CardState; 80};
81 81
82// ---------------------------------------------------------------------------- 82// ----------------------------------------------------------------------------
83// The following enumeration defines the constants written to the card's 83// The following enumeration defines the constants written to the card's
84// host-to-card doorbell to initiate a command. 84// host-to-card doorbell to initiate a command.
85// ---------------------------------------------------------------------------- 85// ----------------------------------------------------------------------------
86typedef enum { 86enum korg1212_dbcnst {
87 K1212_DB_RequestForData = 0, // sent by the card to request a buffer fill. 87 K1212_DB_RequestForData = 0, // sent by the card to request a buffer fill.
88 K1212_DB_TriggerPlay = 1, // starts playback/record on the card. 88 K1212_DB_TriggerPlay = 1, // starts playback/record on the card.
89 K1212_DB_SelectPlayMode = 2, // select monitor, playback setup, or stop. 89 K1212_DB_SelectPlayMode = 2, // select monitor, playback setup, or stop.
@@ -101,14 +101,14 @@ typedef enum {
101 K1212_DB_DSPDownloadDone = 0xAE, // sent by the card to indicate the download has 101 K1212_DB_DSPDownloadDone = 0xAE, // sent by the card to indicate the download has
102 // completed. 102 // completed.
103 K1212_DB_StartDSPDownload = 0xAF // tells the card to download its DSP firmware. 103 K1212_DB_StartDSPDownload = 0xAF // tells the card to download its DSP firmware.
104} korg1212_dbcnst_t; 104};
105 105
106 106
107// ---------------------------------------------------------------------------- 107// ----------------------------------------------------------------------------
108// The following enumeration defines return codes 108// The following enumeration defines return codes
109// to the Korg 1212 I/O driver. 109// to the Korg 1212 I/O driver.
110// ---------------------------------------------------------------------------- 110// ----------------------------------------------------------------------------
111typedef enum { 111enum snd_korg1212rc {
112 K1212_CMDRET_Success = 0, // command was successfully placed 112 K1212_CMDRET_Success = 0, // command was successfully placed
113 K1212_CMDRET_DIOCFailure, // the DeviceIoControl call failed 113 K1212_CMDRET_DIOCFailure, // the DeviceIoControl call failed
114 K1212_CMDRET_PMFailure, // the protected mode call failed 114 K1212_CMDRET_PMFailure, // the protected mode call failed
@@ -126,27 +126,27 @@ typedef enum {
126 126
127 K1212_CMDRET_BadDevice, // the specified wave device was out of range 127 K1212_CMDRET_BadDevice, // the specified wave device was out of range
128 K1212_CMDRET_BadFormat // the specified wave format is unsupported 128 K1212_CMDRET_BadFormat // the specified wave format is unsupported
129} snd_korg1212rc; 129};
130 130
131// ---------------------------------------------------------------------------- 131// ----------------------------------------------------------------------------
132// The following enumeration defines the constants used to select the play 132// The following enumeration defines the constants used to select the play
133// mode for the card in the SelectPlayMode command. 133// mode for the card in the SelectPlayMode command.
134// ---------------------------------------------------------------------------- 134// ----------------------------------------------------------------------------
135typedef enum { 135enum PlayModeSelector {
136 K1212_MODE_SetupPlay = 0x00000001, // provides card with pre-play information 136 K1212_MODE_SetupPlay = 0x00000001, // provides card with pre-play information
137 K1212_MODE_MonitorOn = 0x00000002, // tells card to turn on monitor mode 137 K1212_MODE_MonitorOn = 0x00000002, // tells card to turn on monitor mode
138 K1212_MODE_MonitorOff = 0x00000004, // tells card to turn off monitor mode 138 K1212_MODE_MonitorOff = 0x00000004, // tells card to turn off monitor mode
139 K1212_MODE_StopPlay = 0x00000008 // stops playback on the card 139 K1212_MODE_StopPlay = 0x00000008 // stops playback on the card
140} PlayModeSelector; 140};
141 141
142// ---------------------------------------------------------------------------- 142// ----------------------------------------------------------------------------
143// The following enumeration defines the constants used to select the monitor 143// The following enumeration defines the constants used to select the monitor
144// mode for the card in the SetMonitorMode command. 144// mode for the card in the SetMonitorMode command.
145// ---------------------------------------------------------------------------- 145// ----------------------------------------------------------------------------
146typedef enum { 146enum MonitorModeSelector {
147 K1212_MONMODE_Off = 0, // tells card to turn off monitor mode 147 K1212_MONMODE_Off = 0, // tells card to turn off monitor mode
148 K1212_MONMODE_On // tells card to turn on monitor mode 148 K1212_MONMODE_On // tells card to turn on monitor mode
149} MonitorModeSelector; 149};
150 150
151#define MAILBOX0_OFFSET 0x40 // location of mailbox 0 relative to base address 151#define MAILBOX0_OFFSET 0x40 // location of mailbox 0 relative to base address
152#define MAILBOX1_OFFSET 0x44 // location of mailbox 1 relative to base address 152#define MAILBOX1_OFFSET 0x44 // location of mailbox 1 relative to base address
@@ -188,7 +188,7 @@ typedef enum {
188#define K1212_CHANNELS (K1212_ADAT_CHANNELS + K1212_ANALOG_CHANNELS) 188#define K1212_CHANNELS (K1212_ADAT_CHANNELS + K1212_ANALOG_CHANNELS)
189#define K1212_MIN_CHANNELS 1 189#define K1212_MIN_CHANNELS 1
190#define K1212_MAX_CHANNELS K1212_CHANNELS 190#define K1212_MAX_CHANNELS K1212_CHANNELS
191#define K1212_FRAME_SIZE (sizeof(KorgAudioFrame)) 191#define K1212_FRAME_SIZE (sizeof(struct KorgAudioFrame))
192#define K1212_MAX_SAMPLES (kPlayBufferFrames*kNumBuffers) 192#define K1212_MAX_SAMPLES (kPlayBufferFrames*kNumBuffers)
193#define K1212_PERIODS (kNumBuffers) 193#define K1212_PERIODS (kNumBuffers)
194#define K1212_PERIOD_BYTES (K1212_FRAME_SIZE*kPlayBufferFrames) 194#define K1212_PERIOD_BYTES (K1212_FRAME_SIZE*kPlayBufferFrames)
@@ -264,14 +264,7 @@ typedef enum {
264 264
265#include "korg1212-firmware.h" 265#include "korg1212-firmware.h"
266 266
267typedef struct _snd_korg1212 korg1212_t; 267enum ClockSourceIndex {
268
269typedef u16 K1212Sample; // channels 0-9 use 16 bit samples
270typedef u32 K1212SpdifSample; // channels 10-11 use 32 bits - only 20 are sent
271 // across S/PDIF.
272typedef u32 K1212TimeCodeSample; // holds the ADAT timecode value
273
274typedef enum {
275 K1212_CLKIDX_AdatAt44_1K = 0, // selects source as ADAT at 44.1 kHz 268 K1212_CLKIDX_AdatAt44_1K = 0, // selects source as ADAT at 44.1 kHz
276 K1212_CLKIDX_AdatAt48K, // selects source as ADAT at 48 kHz 269 K1212_CLKIDX_AdatAt48K, // selects source as ADAT at 48 kHz
277 K1212_CLKIDX_WordAt44_1K, // selects source as S/PDIF at 44.1 kHz 270 K1212_CLKIDX_WordAt44_1K, // selects source as S/PDIF at 44.1 kHz
@@ -279,36 +272,36 @@ typedef enum {
279 K1212_CLKIDX_LocalAt44_1K, // selects source as local clock at 44.1 kHz 272 K1212_CLKIDX_LocalAt44_1K, // selects source as local clock at 44.1 kHz
280 K1212_CLKIDX_LocalAt48K, // selects source as local clock at 48 kHz 273 K1212_CLKIDX_LocalAt48K, // selects source as local clock at 48 kHz
281 K1212_CLKIDX_Invalid // used to check validity of the index 274 K1212_CLKIDX_Invalid // used to check validity of the index
282} ClockSourceIndex; 275};
283 276
284typedef enum { 277enum ClockSourceType {
285 K1212_CLKIDX_Adat = 0, // selects source as ADAT 278 K1212_CLKIDX_Adat = 0, // selects source as ADAT
286 K1212_CLKIDX_Word, // selects source as S/PDIF 279 K1212_CLKIDX_Word, // selects source as S/PDIF
287 K1212_CLKIDX_Local // selects source as local clock 280 K1212_CLKIDX_Local // selects source as local clock
288} ClockSourceType; 281};
289 282
290typedef struct KorgAudioFrame { 283struct KorgAudioFrame {
291 K1212Sample frameData16[k16BitChannels]; 284 u16 frameData16[k16BitChannels]; /* channels 0-9 use 16 bit samples */
292 K1212SpdifSample frameData32[k32BitChannels]; 285 u32 frameData32[k32BitChannels]; /* channels 10-11 use 32 bits - only 20 are sent across S/PDIF */
293 K1212TimeCodeSample timeCodeVal; 286 u32 timeCodeVal; /* holds the ADAT timecode value */
294} KorgAudioFrame; 287};
295 288
296typedef struct KorgAudioBuffer { 289struct KorgAudioBuffer {
297 KorgAudioFrame bufferData[kPlayBufferFrames]; /* buffer definition */ 290 struct KorgAudioFrame bufferData[kPlayBufferFrames]; /* buffer definition */
298} KorgAudioBuffer; 291};
299 292
300typedef struct KorgSharedBuffer { 293struct KorgSharedBuffer {
301#ifdef K1212_LARGEALLOC 294#ifdef K1212_LARGEALLOC
302 KorgAudioBuffer playDataBufs[kNumBuffers]; 295 struct KorgAudioBuffer playDataBufs[kNumBuffers];
303 KorgAudioBuffer recordDataBufs[kNumBuffers]; 296 struct KorgAudioBuffer recordDataBufs[kNumBuffers];
304#endif 297#endif
305 short volumeData[kAudioChannels]; 298 short volumeData[kAudioChannels];
306 u32 cardCommand; 299 u32 cardCommand;
307 u16 routeData [kAudioChannels]; 300 u16 routeData [kAudioChannels];
308 u32 AdatTimeCode; // ADAT timecode value 301 u32 AdatTimeCode; // ADAT timecode value
309} KorgSharedBuffer; 302};
310 303
311typedef struct SensBits { 304struct SensBits {
312 union { 305 union {
313 struct { 306 struct {
314 unsigned int leftChanVal:8; 307 unsigned int leftChanVal:8;
@@ -323,12 +316,12 @@ typedef struct SensBits {
323 } v; 316 } v;
324 u16 rightSensBits; 317 u16 rightSensBits;
325 } r; 318 } r;
326} SensBits; 319};
327 320
328struct _snd_korg1212 { 321struct snd_korg1212 {
329 snd_card_t *card; 322 struct snd_card *card;
330 struct pci_dev *pci; 323 struct pci_dev *pci;
331 snd_pcm_t *pcm; 324 struct snd_pcm *pcm;
332 int irq; 325 int irq;
333 326
334 spinlock_t lock; 327 spinlock_t lock;
@@ -355,10 +348,10 @@ struct _snd_korg1212 {
355 348
356 u32 DataBufsSize; 349 u32 DataBufsSize;
357 350
358 KorgAudioBuffer * playDataBufsPtr; 351 struct KorgAudioBuffer * playDataBufsPtr;
359 KorgAudioBuffer * recordDataBufsPtr; 352 struct KorgAudioBuffer * recordDataBufsPtr;
360 353
361 KorgSharedBuffer * sharedBufferPtr; 354 struct KorgSharedBuffer * sharedBufferPtr;
362 355
363 u32 RecDataPhy; 356 u32 RecDataPhy;
364 u32 PlayDataPhy; 357 u32 PlayDataPhy;
@@ -382,20 +375,20 @@ struct _snd_korg1212 {
382 int channels; 375 int channels;
383 int currentBuffer; 376 int currentBuffer;
384 377
385 snd_pcm_substream_t *playback_substream; 378 struct snd_pcm_substream *playback_substream;
386 snd_pcm_substream_t *capture_substream; 379 struct snd_pcm_substream *capture_substream;
387 380
388 pid_t capture_pid; 381 pid_t capture_pid;
389 pid_t playback_pid; 382 pid_t playback_pid;
390 383
391 CardState cardState; 384 enum CardState cardState;
392 int running; 385 int running;
393 int idleMonitorOn; // indicates whether the card is in idle monitor mode. 386 int idleMonitorOn; // indicates whether the card is in idle monitor mode.
394 u32 cmdRetryCount; // tracks how many times we have retried sending to the card. 387 u32 cmdRetryCount; // tracks how many times we have retried sending to the card.
395 388
396 ClockSourceIndex clkSrcRate; // sample rate and clock source 389 enum ClockSourceIndex clkSrcRate; // sample rate and clock source
397 390
398 ClockSourceType clkSource; // clock source 391 enum ClockSourceType clkSource; // clock source
399 int clkRate; // clock rate 392 int clkRate; // clock rate
400 393
401 int volumePhase[kAudioChannels]; 394 int volumePhase[kAudioChannels];
@@ -440,6 +433,8 @@ static struct pci_device_id snd_korg1212_ids[] = {
440 { 0, }, 433 { 0, },
441}; 434};
442 435
436MODULE_DEVICE_TABLE(pci, snd_korg1212_ids);
437
443static char *stateName[] = { 438static char *stateName[] = {
444 "Non-existent", 439 "Non-existent",
445 "Uninitialized", 440 "Uninitialized",
@@ -489,11 +484,7 @@ static u16 ClockSourceSelector[] = {
489 0x0002 // selects source as local clock at 48 kHz 484 0x0002 // selects source as local clock at 48 kHz
490}; 485};
491 486
492static snd_korg1212rc rc; 487union swap_u32 { unsigned char c[4]; u32 i; };
493
494MODULE_DEVICE_TABLE(pci, snd_korg1212_ids);
495
496typedef union swap_u32 { unsigned char c[4]; u32 i; } swap_u32;
497 488
498#ifdef SNDRV_BIG_ENDIAN 489#ifdef SNDRV_BIG_ENDIAN
499static u32 LowerWordSwap(u32 swappee) 490static u32 LowerWordSwap(u32 swappee)
@@ -501,7 +492,7 @@ static u32 LowerWordSwap(u32 swappee)
501static u32 UpperWordSwap(u32 swappee) 492static u32 UpperWordSwap(u32 swappee)
502#endif 493#endif
503{ 494{
504 swap_u32 retVal, swapper; 495 union swap_u32 retVal, swapper;
505 496
506 swapper.i = swappee; 497 swapper.i = swappee;
507 retVal.c[2] = swapper.c[3]; 498 retVal.c[2] = swapper.c[3];
@@ -518,7 +509,7 @@ static u32 UpperWordSwap(u32 swappee)
518static u32 LowerWordSwap(u32 swappee) 509static u32 LowerWordSwap(u32 swappee)
519#endif 510#endif
520{ 511{
521 swap_u32 retVal, swapper; 512 union swap_u32 retVal, swapper;
522 513
523 swapper.i = swappee; 514 swapper.i = swappee;
524 retVal.c[2] = swapper.c[2]; 515 retVal.c[2] = swapper.c[2];
@@ -534,12 +525,14 @@ static u32 LowerWordSwap(u32 swappee)
534#define ClearBitInWord(theWord,bitPosition) (*theWord) &= ~(0x0001 << bitPosition) 525#define ClearBitInWord(theWord,bitPosition) (*theWord) &= ~(0x0001 << bitPosition)
535#define ClearBitInDWord(theWord,bitPosition) (*theWord) &= ~(0x00000001 << bitPosition) 526#define ClearBitInDWord(theWord,bitPosition) (*theWord) &= ~(0x00000001 << bitPosition)
536 527
537static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg1212_dbcnst_t doorbellVal, 528static int snd_korg1212_Send1212Command(struct snd_korg1212 *korg1212,
538 u32 mailBox0Val, u32 mailBox1Val, u32 mailBox2Val, u32 mailBox3Val) 529 enum korg1212_dbcnst doorbellVal,
530 u32 mailBox0Val, u32 mailBox1Val,
531 u32 mailBox2Val, u32 mailBox3Val)
539{ 532{
540 u32 retryCount; 533 u32 retryCount;
541 u16 mailBox3Lo; 534 u16 mailBox3Lo;
542 snd_korg1212rc rc = K1212_CMDRET_Success; 535 int rc = K1212_CMDRET_Success;
543 536
544 if (!korg1212->outDoorbellPtr) { 537 if (!korg1212->outDoorbellPtr) {
545 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: CardUninitialized\n"); 538 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: CardUninitialized\n");
@@ -591,7 +584,7 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121
591} 584}
592 585
593/* spinlock already held */ 586/* spinlock already held */
594static void snd_korg1212_SendStop(korg1212_t *korg1212) 587static void snd_korg1212_SendStop(struct snd_korg1212 *korg1212)
595{ 588{
596 if (! korg1212->stop_pending_cnt) { 589 if (! korg1212->stop_pending_cnt) {
597 korg1212->sharedBufferPtr->cardCommand = 0xffffffff; 590 korg1212->sharedBufferPtr->cardCommand = 0xffffffff;
@@ -602,7 +595,7 @@ static void snd_korg1212_SendStop(korg1212_t *korg1212)
602 } 595 }
603} 596}
604 597
605static void snd_korg1212_SendStopAndWait(korg1212_t *korg1212) 598static void snd_korg1212_SendStopAndWait(struct snd_korg1212 *korg1212)
606{ 599{
607 unsigned long flags; 600 unsigned long flags;
608 spin_lock_irqsave(&korg1212->lock, flags); 601 spin_lock_irqsave(&korg1212->lock, flags);
@@ -615,7 +608,7 @@ static void snd_korg1212_SendStopAndWait(korg1212_t *korg1212)
615/* timer callback for checking the ack of stop request */ 608/* timer callback for checking the ack of stop request */
616static void snd_korg1212_timer_func(unsigned long data) 609static void snd_korg1212_timer_func(unsigned long data)
617{ 610{
618 korg1212_t *korg1212 = (korg1212_t *) data; 611 struct snd_korg1212 *korg1212 = (struct snd_korg1212 *) data;
619 612
620 spin_lock(&korg1212->lock); 613 spin_lock(&korg1212->lock);
621 if (korg1212->sharedBufferPtr->cardCommand == 0) { 614 if (korg1212->sharedBufferPtr->cardCommand == 0) {
@@ -642,7 +635,7 @@ static void snd_korg1212_timer_func(unsigned long data)
642 spin_unlock(&korg1212->lock); 635 spin_unlock(&korg1212->lock);
643} 636}
644 637
645static int snd_korg1212_TurnOnIdleMonitor(korg1212_t *korg1212) 638static int snd_korg1212_TurnOnIdleMonitor(struct snd_korg1212 *korg1212)
646{ 639{
647 unsigned long flags; 640 unsigned long flags;
648 int rc; 641 int rc;
@@ -656,7 +649,7 @@ static int snd_korg1212_TurnOnIdleMonitor(korg1212_t *korg1212)
656 return rc; 649 return rc;
657} 650}
658 651
659static void snd_korg1212_TurnOffIdleMonitor(korg1212_t *korg1212) 652static void snd_korg1212_TurnOffIdleMonitor(struct snd_korg1212 *korg1212)
660{ 653{
661 if (korg1212->idleMonitorOn) { 654 if (korg1212->idleMonitorOn) {
662 snd_korg1212_SendStopAndWait(korg1212); 655 snd_korg1212_SendStopAndWait(korg1212);
@@ -664,12 +657,12 @@ static void snd_korg1212_TurnOffIdleMonitor(korg1212_t *korg1212)
664 } 657 }
665} 658}
666 659
667static inline void snd_korg1212_setCardState(korg1212_t * korg1212, CardState csState) 660static inline void snd_korg1212_setCardState(struct snd_korg1212 * korg1212, enum CardState csState)
668{ 661{
669 korg1212->cardState = csState; 662 korg1212->cardState = csState;
670} 663}
671 664
672static int snd_korg1212_OpenCard(korg1212_t * korg1212) 665static int snd_korg1212_OpenCard(struct snd_korg1212 * korg1212)
673{ 666{
674 K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n", 667 K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n",
675 stateName[korg1212->cardState], korg1212->opencnt); 668 stateName[korg1212->cardState], korg1212->opencnt);
@@ -683,7 +676,7 @@ static int snd_korg1212_OpenCard(korg1212_t * korg1212)
683 return 1; 676 return 1;
684} 677}
685 678
686static int snd_korg1212_CloseCard(korg1212_t * korg1212) 679static int snd_korg1212_CloseCard(struct snd_korg1212 * korg1212)
687{ 680{
688 K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n", 681 K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n",
689 stateName[korg1212->cardState], korg1212->opencnt); 682 stateName[korg1212->cardState], korg1212->opencnt);
@@ -718,7 +711,7 @@ static int snd_korg1212_CloseCard(korg1212_t * korg1212)
718} 711}
719 712
720/* spinlock already held */ 713/* spinlock already held */
721static int snd_korg1212_SetupForPlay(korg1212_t * korg1212) 714static int snd_korg1212_SetupForPlay(struct snd_korg1212 * korg1212)
722{ 715{
723 int rc; 716 int rc;
724 717
@@ -741,7 +734,7 @@ static int snd_korg1212_SetupForPlay(korg1212_t * korg1212)
741} 734}
742 735
743/* spinlock already held */ 736/* spinlock already held */
744static int snd_korg1212_TriggerPlay(korg1212_t * korg1212) 737static int snd_korg1212_TriggerPlay(struct snd_korg1212 * korg1212)
745{ 738{
746 int rc; 739 int rc;
747 740
@@ -763,7 +756,7 @@ static int snd_korg1212_TriggerPlay(korg1212_t * korg1212)
763} 756}
764 757
765/* spinlock already held */ 758/* spinlock already held */
766static int snd_korg1212_StopPlay(korg1212_t * korg1212) 759static int snd_korg1212_StopPlay(struct snd_korg1212 * korg1212)
767{ 760{
768 K1212_DEBUG_PRINTK("K1212_DEBUG: StopPlay [%s] %d\n", 761 K1212_DEBUG_PRINTK("K1212_DEBUG: StopPlay [%s] %d\n",
769 stateName[korg1212->cardState], korg1212->playcnt); 762 stateName[korg1212->cardState], korg1212->playcnt);
@@ -780,7 +773,7 @@ static int snd_korg1212_StopPlay(korg1212_t * korg1212)
780 return 0; 773 return 0;
781} 774}
782 775
783static void snd_korg1212_EnableCardInterrupts(korg1212_t * korg1212) 776static void snd_korg1212_EnableCardInterrupts(struct snd_korg1212 * korg1212)
784{ 777{
785 writel(PCI_INT_ENABLE_BIT | 778 writel(PCI_INT_ENABLE_BIT |
786 PCI_DOORBELL_INT_ENABLE_BIT | 779 PCI_DOORBELL_INT_ENABLE_BIT |
@@ -792,7 +785,8 @@ static void snd_korg1212_EnableCardInterrupts(korg1212_t * korg1212)
792 785
793#if 0 /* not used */ 786#if 0 /* not used */
794 787
795static int snd_korg1212_SetMonitorMode(korg1212_t *korg1212, MonitorModeSelector mode) 788static int snd_korg1212_SetMonitorMode(struct snd_korg1212 *korg1212,
789 enum MonitorModeSelector mode)
796{ 790{
797 K1212_DEBUG_PRINTK("K1212_DEBUG: SetMonitorMode [%s]\n", 791 K1212_DEBUG_PRINTK("K1212_DEBUG: SetMonitorMode [%s]\n",
798 stateName[korg1212->cardState]); 792 stateName[korg1212->cardState]);
@@ -829,7 +823,7 @@ static int snd_korg1212_SetMonitorMode(korg1212_t *korg1212, MonitorModeSelector
829 823
830#endif /* not used */ 824#endif /* not used */
831 825
832static inline int snd_korg1212_use_is_exclusive(korg1212_t *korg1212) 826static inline int snd_korg1212_use_is_exclusive(struct snd_korg1212 *korg1212)
833{ 827{
834 if (korg1212->playback_pid != korg1212->capture_pid && 828 if (korg1212->playback_pid != korg1212->capture_pid &&
835 korg1212->playback_pid >= 0 && korg1212->capture_pid >= 0) 829 korg1212->playback_pid >= 0 && korg1212->capture_pid >= 0)
@@ -838,14 +832,14 @@ static inline int snd_korg1212_use_is_exclusive(korg1212_t *korg1212)
838 return 1; 832 return 1;
839} 833}
840 834
841static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate) 835static int snd_korg1212_SetRate(struct snd_korg1212 *korg1212, int rate)
842{ 836{
843 static ClockSourceIndex s44[] = { 837 static enum ClockSourceIndex s44[] = {
844 K1212_CLKIDX_AdatAt44_1K, 838 K1212_CLKIDX_AdatAt44_1K,
845 K1212_CLKIDX_WordAt44_1K, 839 K1212_CLKIDX_WordAt44_1K,
846 K1212_CLKIDX_LocalAt44_1K 840 K1212_CLKIDX_LocalAt44_1K
847 }; 841 };
848 static ClockSourceIndex s48[] = { 842 static enum ClockSourceIndex s48[] = {
849 K1212_CLKIDX_AdatAt48K, 843 K1212_CLKIDX_AdatAt48K,
850 K1212_CLKIDX_WordAt48K, 844 K1212_CLKIDX_WordAt48K,
851 K1212_CLKIDX_LocalAt48K 845 K1212_CLKIDX_LocalAt48K
@@ -855,7 +849,7 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate)
855 if (!snd_korg1212_use_is_exclusive (korg1212)) 849 if (!snd_korg1212_use_is_exclusive (korg1212))
856 return -EBUSY; 850 return -EBUSY;
857 851
858 switch(rate) { 852 switch (rate) {
859 case 44100: 853 case 44100:
860 parm = s44[korg1212->clkSource]; 854 parm = s44[korg1212->clkSource];
861 break; 855 break;
@@ -875,7 +869,6 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate)
875 rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SetClockSourceRate, 869 rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SetClockSourceRate,
876 ClockSourceSelector[korg1212->clkSrcRate], 870 ClockSourceSelector[korg1212->clkSrcRate],
877 0, 0, 0); 871 0, 0, 0);
878
879 if (rc) 872 if (rc)
880 K1212_DEBUG_PRINTK("K1212_DEBUG: Set Clock Source Selector - RC = %d [%s]\n", 873 K1212_DEBUG_PRINTK("K1212_DEBUG: Set Clock Source Selector - RC = %d [%s]\n",
881 rc, stateName[korg1212->cardState]); 874 rc, stateName[korg1212->cardState]);
@@ -883,7 +876,7 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate)
883 return 0; 876 return 0;
884} 877}
885 878
886static int snd_korg1212_SetClockSource(korg1212_t *korg1212, int source) 879static int snd_korg1212_SetClockSource(struct snd_korg1212 *korg1212, int source)
887{ 880{
888 881
889 if (source < 0 || source > 2) 882 if (source < 0 || source > 2)
@@ -896,14 +889,14 @@ static int snd_korg1212_SetClockSource(korg1212_t *korg1212, int source)
896 return 0; 889 return 0;
897} 890}
898 891
899static void snd_korg1212_DisableCardInterrupts(korg1212_t *korg1212) 892static void snd_korg1212_DisableCardInterrupts(struct snd_korg1212 *korg1212)
900{ 893{
901 writel(0, korg1212->statusRegPtr); 894 writel(0, korg1212->statusRegPtr);
902} 895}
903 896
904static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212) 897static int snd_korg1212_WriteADCSensitivity(struct snd_korg1212 *korg1212)
905{ 898{
906 SensBits sensVals; 899 struct SensBits sensVals;
907 int bitPosition; 900 int bitPosition;
908 int channel; 901 int channel;
909 int clkIs48K; 902 int clkIs48K;
@@ -985,7 +978,7 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212)
985 for (bitPosition = 15; bitPosition >= 0; bitPosition--) { // for all the bits 978 for (bitPosition = 15; bitPosition >= 0; bitPosition--) { // for all the bits
986 if (channel == 0) { 979 if (channel == 0) {
987 if (sensVals.l.leftSensBits & (0x0001 << bitPosition)) 980 if (sensVals.l.leftSensBits & (0x0001 << bitPosition))
988 SetBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set high 981 SetBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set high
989 else 982 else
990 ClearBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set low 983 ClearBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set low
991 } else { 984 } else {
@@ -1034,7 +1027,7 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212)
1034 udelay(SENSCLKPULSE_WIDTH); 1027 udelay(SENSCLKPULSE_WIDTH);
1035 1028
1036 if (monModeSet) { 1029 if (monModeSet) {
1037 rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode, 1030 int rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode,
1038 K1212_MODE_MonitorOn, 0, 0, 0); 1031 K1212_MODE_MonitorOn, 0, 0, 0);
1039 if (rc) 1032 if (rc)
1040 K1212_DEBUG_PRINTK("K1212_DEBUG: WriteADCSensivity - RC = %d [%s]\n", 1033 K1212_DEBUG_PRINTK("K1212_DEBUG: WriteADCSensivity - RC = %d [%s]\n",
@@ -1046,9 +1039,9 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212)
1046 return 1; 1039 return 1;
1047} 1040}
1048 1041
1049static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212) 1042static void snd_korg1212_OnDSPDownloadComplete(struct snd_korg1212 *korg1212)
1050{ 1043{
1051 int channel; 1044 int channel, rc;
1052 1045
1053 K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is complete. [%s]\n", 1046 K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is complete. [%s]\n",
1054 stateName[korg1212->cardState]); 1047 stateName[korg1212->cardState]);
@@ -1127,7 +1120,7 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212)
1127static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1120static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1128{ 1121{
1129 u32 doorbellValue; 1122 u32 doorbellValue;
1130 korg1212_t *korg1212 = dev_id; 1123 struct snd_korg1212 *korg1212 = dev_id;
1131 1124
1132 if(irq != korg1212->irq) 1125 if(irq != korg1212->irq)
1133 return IRQ_NONE; 1126 return IRQ_NONE;
@@ -1176,7 +1169,7 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
1176 // the semaphore in case someone is waiting for this. 1169 // the semaphore in case someone is waiting for this.
1177 // ------------------------------------------------------------------------ 1170 // ------------------------------------------------------------------------
1178 case K1212_DB_CARDSTOPPED: 1171 case K1212_DB_CARDSTOPPED:
1179 K1212_DEBUG_PRINTK_VEROBSE("K1212_DEBUG: IRQ CSTP count - %ld, %x, [%s].\n", 1172 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: IRQ CSTP count - %ld, %x, [%s].\n",
1180 korg1212->irqcount, doorbellValue, 1173 korg1212->irqcount, doorbellValue,
1181 stateName[korg1212->cardState]); 1174 stateName[korg1212->cardState]);
1182 korg1212->sharedBufferPtr->cardCommand = 0; 1175 korg1212->sharedBufferPtr->cardCommand = 0;
@@ -1184,9 +1177,8 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
1184 1177
1185 default: 1178 default:
1186 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: IRQ DFLT count - %ld, %x, cpos=%d [%s].\n", 1179 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: IRQ DFLT count - %ld, %x, cpos=%d [%s].\n",
1187 korg1212->irqcount, doorbellValue, 1180 korg1212->irqcount, doorbellValue,
1188 korg1212->currentBuffer, 1181 korg1212->currentBuffer, stateName[korg1212->cardState]);
1189 stateName[korg1212->cardState]);
1190 if ((korg1212->cardState > K1212_STATE_SETUP) || korg1212->idleMonitorOn) { 1182 if ((korg1212->cardState > K1212_STATE_SETUP) || korg1212->idleMonitorOn) {
1191 korg1212->currentBuffer++; 1183 korg1212->currentBuffer++;
1192 1184
@@ -1218,8 +1210,9 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
1218 return IRQ_HANDLED; 1210 return IRQ_HANDLED;
1219} 1211}
1220 1212
1221static int snd_korg1212_downloadDSPCode(korg1212_t *korg1212) 1213static int snd_korg1212_downloadDSPCode(struct snd_korg1212 *korg1212)
1222{ 1214{
1215 int rc;
1223 1216
1224 K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is starting... [%s]\n", 1217 K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is starting... [%s]\n",
1225 stateName[korg1212->cardState]); 1218 stateName[korg1212->cardState]);
@@ -1251,7 +1244,7 @@ static int snd_korg1212_downloadDSPCode(korg1212_t *korg1212)
1251 return 0; 1244 return 0;
1252} 1245}
1253 1246
1254static snd_pcm_hardware_t snd_korg1212_playback_info = 1247static struct snd_pcm_hardware snd_korg1212_playback_info =
1255{ 1248{
1256 .info = (SNDRV_PCM_INFO_MMAP | 1249 .info = (SNDRV_PCM_INFO_MMAP |
1257 SNDRV_PCM_INFO_MMAP_VALID | 1250 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1271,7 +1264,7 @@ static snd_pcm_hardware_t snd_korg1212_playback_info =
1271 .fifo_size = 0, 1264 .fifo_size = 0,
1272}; 1265};
1273 1266
1274static snd_pcm_hardware_t snd_korg1212_capture_info = 1267static struct snd_pcm_hardware snd_korg1212_capture_info =
1275{ 1268{
1276 .info = (SNDRV_PCM_INFO_MMAP | 1269 .info = (SNDRV_PCM_INFO_MMAP |
1277 SNDRV_PCM_INFO_MMAP_VALID | 1270 SNDRV_PCM_INFO_MMAP_VALID |
@@ -1291,9 +1284,9 @@ static snd_pcm_hardware_t snd_korg1212_capture_info =
1291 .fifo_size = 0, 1284 .fifo_size = 0,
1292}; 1285};
1293 1286
1294static int snd_korg1212_silence(korg1212_t *korg1212, int pos, int count, int offset, int size) 1287static int snd_korg1212_silence(struct snd_korg1212 *korg1212, int pos, int count, int offset, int size)
1295{ 1288{
1296 KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos; 1289 struct KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos;
1297 int i; 1290 int i;
1298 1291
1299 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_silence pos=%d offset=%d size=%d count=%d\n", 1292 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_silence pos=%d offset=%d size=%d count=%d\n",
@@ -1316,9 +1309,9 @@ static int snd_korg1212_silence(korg1212_t *korg1212, int pos, int count, int of
1316 return 0; 1309 return 0;
1317} 1310}
1318 1311
1319static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos, int count, int offset, int size) 1312static int snd_korg1212_copy_to(struct snd_korg1212 *korg1212, void __user *dst, int pos, int count, int offset, int size)
1320{ 1313{
1321 KorgAudioFrame * src = korg1212->recordDataBufsPtr[0].bufferData + pos; 1314 struct KorgAudioFrame * src = korg1212->recordDataBufsPtr[0].bufferData + pos;
1322 int i, rc; 1315 int i, rc;
1323 1316
1324 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_copy_to pos=%d offset=%d size=%d\n", 1317 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_copy_to pos=%d offset=%d size=%d\n",
@@ -1345,9 +1338,9 @@ static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos,
1345 return 0; 1338 return 0;
1346} 1339}
1347 1340
1348static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int pos, int count, int offset, int size) 1341static int snd_korg1212_copy_from(struct snd_korg1212 *korg1212, void __user *src, int pos, int count, int offset, int size)
1349{ 1342{
1350 KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos; 1343 struct KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos;
1351 int i, rc; 1344 int i, rc;
1352 1345
1353 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_copy_from pos=%d offset=%d size=%d count=%d\n", 1346 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_copy_from pos=%d offset=%d size=%d count=%d\n",
@@ -1359,15 +1352,13 @@ static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int po
1359#if K1212_DEBUG_LEVEL > 0 1352#if K1212_DEBUG_LEVEL > 0
1360 if ( (void *) dst < (void *) korg1212->playDataBufsPtr || 1353 if ( (void *) dst < (void *) korg1212->playDataBufsPtr ||
1361 (void *) dst > (void *) korg1212->playDataBufsPtr[8].bufferData ) { 1354 (void *) dst > (void *) korg1212->playDataBufsPtr[8].bufferData ) {
1362 printk(KERN_DEBUG "K1212_DEBUG: snd_korg1212_copy_from KERNEL EFAULT, src=%p dst=%p iter=%d\n", 1355 printk(KERN_DEBUG "K1212_DEBUG: snd_korg1212_copy_from KERNEL EFAULT, src=%p dst=%p iter=%d\n", src, dst, i);
1363 src, dst, i);
1364 return -EFAULT; 1356 return -EFAULT;
1365 } 1357 }
1366#endif 1358#endif
1367 rc = copy_from_user((void*) dst + offset, src, size); 1359 rc = copy_from_user((void*) dst + offset, src, size);
1368 if (rc) { 1360 if (rc) {
1369 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_from USER EFAULT src=%p dst=%p iter=%d\n", 1361 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_from USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i);
1370 src, dst, i);
1371 return -EFAULT; 1362 return -EFAULT;
1372 } 1363 }
1373 dst++; 1364 dst++;
@@ -1377,9 +1368,9 @@ static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int po
1377 return 0; 1368 return 0;
1378} 1369}
1379 1370
1380static void snd_korg1212_free_pcm(snd_pcm_t *pcm) 1371static void snd_korg1212_free_pcm(struct snd_pcm *pcm)
1381{ 1372{
1382 korg1212_t *korg1212 = (korg1212_t *) pcm->private_data; 1373 struct snd_korg1212 *korg1212 = pcm->private_data;
1383 1374
1384 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_free_pcm [%s]\n", 1375 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_free_pcm [%s]\n",
1385 stateName[korg1212->cardState]); 1376 stateName[korg1212->cardState]);
@@ -1387,11 +1378,11 @@ static void snd_korg1212_free_pcm(snd_pcm_t *pcm)
1387 korg1212->pcm = NULL; 1378 korg1212->pcm = NULL;
1388} 1379}
1389 1380
1390static int snd_korg1212_playback_open(snd_pcm_substream_t *substream) 1381static int snd_korg1212_playback_open(struct snd_pcm_substream *substream)
1391{ 1382{
1392 unsigned long flags; 1383 unsigned long flags;
1393 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1384 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1394 snd_pcm_runtime_t *runtime = substream->runtime; 1385 struct snd_pcm_runtime *runtime = substream->runtime;
1395 1386
1396 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_open [%s]\n", 1387 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_open [%s]\n",
1397 stateName[korg1212->cardState]); 1388 stateName[korg1212->cardState]);
@@ -1418,11 +1409,11 @@ static int snd_korg1212_playback_open(snd_pcm_substream_t *substream)
1418} 1409}
1419 1410
1420 1411
1421static int snd_korg1212_capture_open(snd_pcm_substream_t *substream) 1412static int snd_korg1212_capture_open(struct snd_pcm_substream *substream)
1422{ 1413{
1423 unsigned long flags; 1414 unsigned long flags;
1424 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1415 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1425 snd_pcm_runtime_t *runtime = substream->runtime; 1416 struct snd_pcm_runtime *runtime = substream->runtime;
1426 1417
1427 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_open [%s]\n", 1418 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_open [%s]\n",
1428 stateName[korg1212->cardState]); 1419 stateName[korg1212->cardState]);
@@ -1443,14 +1434,15 @@ static int snd_korg1212_capture_open(snd_pcm_substream_t *substream)
1443 1434
1444 spin_unlock_irqrestore(&korg1212->lock, flags); 1435 spin_unlock_irqrestore(&korg1212->lock, flags);
1445 1436
1446 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, kPlayBufferFrames, kPlayBufferFrames); 1437 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1438 kPlayBufferFrames, kPlayBufferFrames);
1447 return 0; 1439 return 0;
1448} 1440}
1449 1441
1450static int snd_korg1212_playback_close(snd_pcm_substream_t *substream) 1442static int snd_korg1212_playback_close(struct snd_pcm_substream *substream)
1451{ 1443{
1452 unsigned long flags; 1444 unsigned long flags;
1453 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1445 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1454 1446
1455 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_close [%s]\n", 1447 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_close [%s]\n",
1456 stateName[korg1212->cardState]); 1448 stateName[korg1212->cardState]);
@@ -1469,10 +1461,10 @@ static int snd_korg1212_playback_close(snd_pcm_substream_t *substream)
1469 return 0; 1461 return 0;
1470} 1462}
1471 1463
1472static int snd_korg1212_capture_close(snd_pcm_substream_t *substream) 1464static int snd_korg1212_capture_close(struct snd_pcm_substream *substream)
1473{ 1465{
1474 unsigned long flags; 1466 unsigned long flags;
1475 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1467 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1476 1468
1477 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_close [%s]\n", 1469 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_close [%s]\n",
1478 stateName[korg1212->cardState]); 1470 stateName[korg1212->cardState]);
@@ -1489,13 +1481,13 @@ static int snd_korg1212_capture_close(snd_pcm_substream_t *substream)
1489 return 0; 1481 return 0;
1490} 1482}
1491 1483
1492static int snd_korg1212_ioctl(snd_pcm_substream_t *substream, 1484static int snd_korg1212_ioctl(struct snd_pcm_substream *substream,
1493 unsigned int cmd, void *arg) 1485 unsigned int cmd, void *arg)
1494{ 1486{
1495 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_ioctl: cmd=%d\n", cmd); 1487 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_ioctl: cmd=%d\n", cmd);
1496 1488
1497 if (cmd == SNDRV_PCM_IOCTL1_CHANNEL_INFO ) { 1489 if (cmd == SNDRV_PCM_IOCTL1_CHANNEL_INFO ) {
1498 snd_pcm_channel_info_t *info = arg; 1490 struct snd_pcm_channel_info *info = arg;
1499 info->offset = 0; 1491 info->offset = 0;
1500 info->first = info->channel * 16; 1492 info->first = info->channel * 16;
1501 info->step = 256; 1493 info->step = 256;
@@ -1506,11 +1498,11 @@ static int snd_korg1212_ioctl(snd_pcm_substream_t *substream,
1506 return snd_pcm_lib_ioctl(substream, cmd, arg); 1498 return snd_pcm_lib_ioctl(substream, cmd, arg);
1507} 1499}
1508 1500
1509static int snd_korg1212_hw_params(snd_pcm_substream_t *substream, 1501static int snd_korg1212_hw_params(struct snd_pcm_substream *substream,
1510 snd_pcm_hw_params_t *params) 1502 struct snd_pcm_hw_params *params)
1511{ 1503{
1512 unsigned long flags; 1504 unsigned long flags;
1513 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1505 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1514 int err; 1506 int err;
1515 pid_t this_pid; 1507 pid_t this_pid;
1516 pid_t other_pid; 1508 pid_t other_pid;
@@ -1558,9 +1550,9 @@ static int snd_korg1212_hw_params(snd_pcm_substream_t *substream,
1558 return 0; 1550 return 0;
1559} 1551}
1560 1552
1561static int snd_korg1212_prepare(snd_pcm_substream_t *substream) 1553static int snd_korg1212_prepare(struct snd_pcm_substream *substream)
1562{ 1554{
1563 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1555 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1564 int rc; 1556 int rc;
1565 1557
1566 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_prepare [%s]\n", 1558 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_prepare [%s]\n",
@@ -1590,10 +1582,10 @@ static int snd_korg1212_prepare(snd_pcm_substream_t *substream)
1590 return rc ? -EINVAL : 0; 1582 return rc ? -EINVAL : 0;
1591} 1583}
1592 1584
1593static int snd_korg1212_trigger(snd_pcm_substream_t *substream, 1585static int snd_korg1212_trigger(struct snd_pcm_substream *substream,
1594 int cmd) 1586 int cmd)
1595{ 1587{
1596 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1588 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1597 int rc; 1589 int rc;
1598 1590
1599 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_trigger [%s] cmd=%d\n", 1591 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_trigger [%s] cmd=%d\n",
@@ -1631,9 +1623,9 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream,
1631 return rc ? -EINVAL : 0; 1623 return rc ? -EINVAL : 0;
1632} 1624}
1633 1625
1634static snd_pcm_uframes_t snd_korg1212_playback_pointer(snd_pcm_substream_t *substream) 1626static snd_pcm_uframes_t snd_korg1212_playback_pointer(struct snd_pcm_substream *substream)
1635{ 1627{
1636 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1628 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1637 snd_pcm_uframes_t pos; 1629 snd_pcm_uframes_t pos;
1638 1630
1639 pos = korg1212->currentBuffer * kPlayBufferFrames; 1631 pos = korg1212->currentBuffer * kPlayBufferFrames;
@@ -1644,9 +1636,9 @@ static snd_pcm_uframes_t snd_korg1212_playback_pointer(snd_pcm_substream_t *subs
1644 return pos; 1636 return pos;
1645} 1637}
1646 1638
1647static snd_pcm_uframes_t snd_korg1212_capture_pointer(snd_pcm_substream_t *substream) 1639static snd_pcm_uframes_t snd_korg1212_capture_pointer(struct snd_pcm_substream *substream)
1648{ 1640{
1649 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1641 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1650 snd_pcm_uframes_t pos; 1642 snd_pcm_uframes_t pos;
1651 1643
1652 pos = korg1212->currentBuffer * kPlayBufferFrames; 1644 pos = korg1212->currentBuffer * kPlayBufferFrames;
@@ -1657,13 +1649,13 @@ static snd_pcm_uframes_t snd_korg1212_capture_pointer(snd_pcm_substream_t *subst
1657 return pos; 1649 return pos;
1658} 1650}
1659 1651
1660static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream, 1652static int snd_korg1212_playback_copy(struct snd_pcm_substream *substream,
1661 int channel, /* not used (interleaved data) */ 1653 int channel, /* not used (interleaved data) */
1662 snd_pcm_uframes_t pos, 1654 snd_pcm_uframes_t pos,
1663 void __user *src, 1655 void __user *src,
1664 snd_pcm_uframes_t count) 1656 snd_pcm_uframes_t count)
1665{ 1657{
1666 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1658 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1667 1659
1668 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_copy [%s] %ld %ld\n", 1660 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_copy [%s] %ld %ld\n",
1669 stateName[korg1212->cardState], pos, count); 1661 stateName[korg1212->cardState], pos, count);
@@ -1672,12 +1664,12 @@ static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream,
1672 1664
1673} 1665}
1674 1666
1675static int snd_korg1212_playback_silence(snd_pcm_substream_t *substream, 1667static int snd_korg1212_playback_silence(struct snd_pcm_substream *substream,
1676 int channel, /* not used (interleaved data) */ 1668 int channel, /* not used (interleaved data) */
1677 snd_pcm_uframes_t pos, 1669 snd_pcm_uframes_t pos,
1678 snd_pcm_uframes_t count) 1670 snd_pcm_uframes_t count)
1679{ 1671{
1680 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1672 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1681 1673
1682 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_silence [%s]\n", 1674 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_silence [%s]\n",
1683 stateName[korg1212->cardState]); 1675 stateName[korg1212->cardState]);
@@ -1685,13 +1677,13 @@ static int snd_korg1212_playback_silence(snd_pcm_substream_t *substream,
1685 return snd_korg1212_silence(korg1212, pos, count, 0, korg1212->channels * 2); 1677 return snd_korg1212_silence(korg1212, pos, count, 0, korg1212->channels * 2);
1686} 1678}
1687 1679
1688static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream, 1680static int snd_korg1212_capture_copy(struct snd_pcm_substream *substream,
1689 int channel, /* not used (interleaved data) */ 1681 int channel, /* not used (interleaved data) */
1690 snd_pcm_uframes_t pos, 1682 snd_pcm_uframes_t pos,
1691 void __user *dst, 1683 void __user *dst,
1692 snd_pcm_uframes_t count) 1684 snd_pcm_uframes_t count)
1693{ 1685{
1694 korg1212_t *korg1212 = snd_pcm_substream_chip(substream); 1686 struct snd_korg1212 *korg1212 = snd_pcm_substream_chip(substream);
1695 1687
1696 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_capture_copy [%s] %ld %ld\n", 1688 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_capture_copy [%s] %ld %ld\n",
1697 stateName[korg1212->cardState], pos, count); 1689 stateName[korg1212->cardState], pos, count);
@@ -1699,7 +1691,7 @@ static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream,
1699 return snd_korg1212_copy_to(korg1212, dst, pos, count, 0, korg1212->channels * 2); 1691 return snd_korg1212_copy_to(korg1212, dst, pos, count, 0, korg1212->channels * 2);
1700} 1692}
1701 1693
1702static snd_pcm_ops_t snd_korg1212_playback_ops = { 1694static struct snd_pcm_ops snd_korg1212_playback_ops = {
1703 .open = snd_korg1212_playback_open, 1695 .open = snd_korg1212_playback_open,
1704 .close = snd_korg1212_playback_close, 1696 .close = snd_korg1212_playback_close,
1705 .ioctl = snd_korg1212_ioctl, 1697 .ioctl = snd_korg1212_ioctl,
@@ -1711,7 +1703,7 @@ static snd_pcm_ops_t snd_korg1212_playback_ops = {
1711 .silence = snd_korg1212_playback_silence, 1703 .silence = snd_korg1212_playback_silence,
1712}; 1704};
1713 1705
1714static snd_pcm_ops_t snd_korg1212_capture_ops = { 1706static struct snd_pcm_ops snd_korg1212_capture_ops = {
1715 .open = snd_korg1212_capture_open, 1707 .open = snd_korg1212_capture_open,
1716 .close = snd_korg1212_capture_close, 1708 .close = snd_korg1212_capture_close,
1717 .ioctl = snd_korg1212_ioctl, 1709 .ioctl = snd_korg1212_ioctl,
@@ -1726,16 +1718,18 @@ static snd_pcm_ops_t snd_korg1212_capture_ops = {
1726 * Control Interface 1718 * Control Interface
1727 */ 1719 */
1728 1720
1729static int snd_korg1212_control_phase_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1721static int snd_korg1212_control_phase_info(struct snd_kcontrol *kcontrol,
1722 struct snd_ctl_elem_info *uinfo)
1730{ 1723{
1731 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1724 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1732 uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1; 1725 uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
1733 return 0; 1726 return 0;
1734} 1727}
1735 1728
1736static int snd_korg1212_control_phase_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1729static int snd_korg1212_control_phase_get(struct snd_kcontrol *kcontrol,
1730 struct snd_ctl_elem_value *u)
1737{ 1731{
1738 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1732 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1739 int i = kcontrol->private_value; 1733 int i = kcontrol->private_value;
1740 1734
1741 spin_lock_irq(&korg1212->lock); 1735 spin_lock_irq(&korg1212->lock);
@@ -1750,9 +1744,10 @@ static int snd_korg1212_control_phase_get(snd_kcontrol_t *kcontrol, snd_ctl_elem
1750 return 0; 1744 return 0;
1751} 1745}
1752 1746
1753static int snd_korg1212_control_phase_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1747static int snd_korg1212_control_phase_put(struct snd_kcontrol *kcontrol,
1748 struct snd_ctl_elem_value *u)
1754{ 1749{
1755 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1750 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1756 int change = 0; 1751 int change = 0;
1757 int i, val; 1752 int i, val;
1758 1753
@@ -1787,7 +1782,8 @@ static int snd_korg1212_control_phase_put(snd_kcontrol_t *kcontrol, snd_ctl_elem
1787 return change; 1782 return change;
1788} 1783}
1789 1784
1790static int snd_korg1212_control_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1785static int snd_korg1212_control_volume_info(struct snd_kcontrol *kcontrol,
1786 struct snd_ctl_elem_info *uinfo)
1791{ 1787{
1792 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1788 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1793 uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1; 1789 uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
@@ -1796,9 +1792,10 @@ static int snd_korg1212_control_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_el
1796 return 0; 1792 return 0;
1797} 1793}
1798 1794
1799static int snd_korg1212_control_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1795static int snd_korg1212_control_volume_get(struct snd_kcontrol *kcontrol,
1796 struct snd_ctl_elem_value *u)
1800{ 1797{
1801 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1798 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1802 int i; 1799 int i;
1803 1800
1804 spin_lock_irq(&korg1212->lock); 1801 spin_lock_irq(&korg1212->lock);
@@ -1814,9 +1811,10 @@ static int snd_korg1212_control_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_ele
1814 return 0; 1811 return 0;
1815} 1812}
1816 1813
1817static int snd_korg1212_control_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1814static int snd_korg1212_control_volume_put(struct snd_kcontrol *kcontrol,
1815 struct snd_ctl_elem_value *u)
1818{ 1816{
1819 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1817 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1820 int change = 0; 1818 int change = 0;
1821 int i; 1819 int i;
1822 int val; 1820 int val;
@@ -1846,7 +1844,8 @@ static int snd_korg1212_control_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_ele
1846 return change; 1844 return change;
1847} 1845}
1848 1846
1849static int snd_korg1212_control_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1847static int snd_korg1212_control_route_info(struct snd_kcontrol *kcontrol,
1848 struct snd_ctl_elem_info *uinfo)
1850{ 1849{
1851 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1850 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1852 uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1; 1851 uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
@@ -1858,9 +1857,10 @@ static int snd_korg1212_control_route_info(snd_kcontrol_t *kcontrol, snd_ctl_ele
1858 return 0; 1857 return 0;
1859} 1858}
1860 1859
1861static int snd_korg1212_control_route_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1860static int snd_korg1212_control_route_get(struct snd_kcontrol *kcontrol,
1861 struct snd_ctl_elem_value *u)
1862{ 1862{
1863 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1863 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1864 int i; 1864 int i;
1865 1865
1866 spin_lock_irq(&korg1212->lock); 1866 spin_lock_irq(&korg1212->lock);
@@ -1876,9 +1876,10 @@ static int snd_korg1212_control_route_get(snd_kcontrol_t *kcontrol, snd_ctl_elem
1876 return 0; 1876 return 0;
1877} 1877}
1878 1878
1879static int snd_korg1212_control_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1879static int snd_korg1212_control_route_put(struct snd_kcontrol *kcontrol,
1880 struct snd_ctl_elem_value *u)
1880{ 1881{
1881 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1882 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1882 int change = 0, i; 1883 int change = 0, i;
1883 1884
1884 spin_lock_irq(&korg1212->lock); 1885 spin_lock_irq(&korg1212->lock);
@@ -1902,7 +1903,8 @@ static int snd_korg1212_control_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem
1902 return change; 1903 return change;
1903} 1904}
1904 1905
1905static int snd_korg1212_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1906static int snd_korg1212_control_info(struct snd_kcontrol *kcontrol,
1907 struct snd_ctl_elem_info *uinfo)
1906{ 1908{
1907 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1909 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1908 uinfo->count = 2; 1910 uinfo->count = 2;
@@ -1911,9 +1913,10 @@ static int snd_korg1212_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info
1911 return 0; 1913 return 0;
1912} 1914}
1913 1915
1914static int snd_korg1212_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1916static int snd_korg1212_control_get(struct snd_kcontrol *kcontrol,
1917 struct snd_ctl_elem_value *u)
1915{ 1918{
1916 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1919 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1917 1920
1918 spin_lock_irq(&korg1212->lock); 1921 spin_lock_irq(&korg1212->lock);
1919 1922
@@ -1925,9 +1928,10 @@ static int snd_korg1212_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value
1925 return 0; 1928 return 0;
1926} 1929}
1927 1930
1928static int snd_korg1212_control_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u) 1931static int snd_korg1212_control_put(struct snd_kcontrol *kcontrol,
1932 struct snd_ctl_elem_value *u)
1929{ 1933{
1930 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1934 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1931 int change = 0; 1935 int change = 0;
1932 1936
1933 spin_lock_irq(&korg1212->lock); 1937 spin_lock_irq(&korg1212->lock);
@@ -1949,7 +1953,8 @@ static int snd_korg1212_control_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value
1949 return change; 1953 return change;
1950} 1954}
1951 1955
1952static int snd_korg1212_control_sync_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1956static int snd_korg1212_control_sync_info(struct snd_kcontrol *kcontrol,
1957 struct snd_ctl_elem_info *uinfo)
1953{ 1958{
1954 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1959 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1955 uinfo->count = 1; 1960 uinfo->count = 1;
@@ -1961,9 +1966,10 @@ static int snd_korg1212_control_sync_info(snd_kcontrol_t *kcontrol, snd_ctl_elem
1961 return 0; 1966 return 0;
1962} 1967}
1963 1968
1964static int snd_korg1212_control_sync_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1969static int snd_korg1212_control_sync_get(struct snd_kcontrol *kcontrol,
1970 struct snd_ctl_elem_value *ucontrol)
1965{ 1971{
1966 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1972 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1967 1973
1968 spin_lock_irq(&korg1212->lock); 1974 spin_lock_irq(&korg1212->lock);
1969 1975
@@ -1973,9 +1979,10 @@ static int snd_korg1212_control_sync_get(snd_kcontrol_t * kcontrol, snd_ctl_elem
1973 return 0; 1979 return 0;
1974} 1980}
1975 1981
1976static int snd_korg1212_control_sync_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1982static int snd_korg1212_control_sync_put(struct snd_kcontrol *kcontrol,
1983 struct snd_ctl_elem_value *ucontrol)
1977{ 1984{
1978 korg1212_t *korg1212 = snd_kcontrol_chip(kcontrol); 1985 struct snd_korg1212 *korg1212 = snd_kcontrol_chip(kcontrol);
1979 unsigned int val; 1986 unsigned int val;
1980 int change; 1987 int change;
1981 1988
@@ -2016,7 +2023,7 @@ static int snd_korg1212_control_sync_put(snd_kcontrol_t * kcontrol, snd_ctl_elem
2016 .private_value = ord, \ 2023 .private_value = ord, \
2017 } 2024 }
2018 2025
2019static snd_kcontrol_new_t snd_korg1212_controls[] = { 2026static struct snd_kcontrol_new snd_korg1212_controls[] = {
2020 MON_MIXER(8, "Analog"), 2027 MON_MIXER(8, "Analog"),
2021 MON_MIXER(10, "SPDIF"), 2028 MON_MIXER(10, "SPDIF"),
2022 MON_MIXER(0, "ADAT-1"), MON_MIXER(1, "ADAT-2"), MON_MIXER(2, "ADAT-3"), MON_MIXER(3, "ADAT-4"), 2029 MON_MIXER(0, "ADAT-1"), MON_MIXER(1, "ADAT-2"), MON_MIXER(2, "ADAT-3"), MON_MIXER(3, "ADAT-4"),
@@ -2043,10 +2050,11 @@ static snd_kcontrol_new_t snd_korg1212_controls[] = {
2043 * proc interface 2050 * proc interface
2044 */ 2051 */
2045 2052
2046static void snd_korg1212_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) 2053static void snd_korg1212_proc_read(struct snd_info_entry *entry,
2054 struct snd_info_buffer *buffer)
2047{ 2055{
2048 int n; 2056 int n;
2049 korg1212_t *korg1212 = (korg1212_t *)entry->private_data; 2057 struct snd_korg1212 *korg1212 = entry->private_data;
2050 2058
2051 snd_iprintf(buffer, korg1212->card->longname); 2059 snd_iprintf(buffer, korg1212->card->longname);
2052 snd_iprintf(buffer, " (index #%d)\n", korg1212->card->number + 1); 2060 snd_iprintf(buffer, " (index #%d)\n", korg1212->card->number + 1);
@@ -2070,16 +2078,16 @@ static void snd_korg1212_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *b
2070 snd_iprintf(buffer, " Error count: %ld\n", korg1212->totalerrorcnt); 2078 snd_iprintf(buffer, " Error count: %ld\n", korg1212->totalerrorcnt);
2071} 2079}
2072 2080
2073static void __devinit snd_korg1212_proc_init(korg1212_t *korg1212) 2081static void __devinit snd_korg1212_proc_init(struct snd_korg1212 *korg1212)
2074{ 2082{
2075 snd_info_entry_t *entry; 2083 struct snd_info_entry *entry;
2076 2084
2077 if (! snd_card_proc_new(korg1212->card, "korg1212", &entry)) 2085 if (! snd_card_proc_new(korg1212->card, "korg1212", &entry))
2078 snd_info_set_text_ops(entry, korg1212, 1024, snd_korg1212_proc_read); 2086 snd_info_set_text_ops(entry, korg1212, 1024, snd_korg1212_proc_read);
2079} 2087}
2080 2088
2081static int 2089static int
2082snd_korg1212_free(korg1212_t *korg1212) 2090snd_korg1212_free(struct snd_korg1212 *korg1212)
2083{ 2091{
2084 snd_korg1212_TurnOffIdleMonitor(korg1212); 2092 snd_korg1212_TurnOffIdleMonitor(korg1212);
2085 2093
@@ -2135,23 +2143,23 @@ snd_korg1212_free(korg1212_t *korg1212)
2135 return 0; 2143 return 0;
2136} 2144}
2137 2145
2138static int snd_korg1212_dev_free(snd_device_t *device) 2146static int snd_korg1212_dev_free(struct snd_device *device)
2139{ 2147{
2140 korg1212_t *korg1212 = device->device_data; 2148 struct snd_korg1212 *korg1212 = device->device_data;
2141 K1212_DEBUG_PRINTK("K1212_DEBUG: Freeing device\n"); 2149 K1212_DEBUG_PRINTK("K1212_DEBUG: Freeing device\n");
2142 return snd_korg1212_free(korg1212); 2150 return snd_korg1212_free(korg1212);
2143} 2151}
2144 2152
2145static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, 2153static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *pci,
2146 korg1212_t ** rchip) 2154 struct snd_korg1212 ** rchip)
2147 2155
2148{ 2156{
2149 int err, rc; 2157 int err, rc;
2150 unsigned int i; 2158 unsigned int i;
2151 unsigned ioport_size, iomem_size, iomem2_size; 2159 unsigned ioport_size, iomem_size, iomem2_size;
2152 korg1212_t * korg1212; 2160 struct snd_korg1212 * korg1212;
2153 2161
2154 static snd_device_ops_t ops = { 2162 static struct snd_device_ops ops = {
2155 .dev_free = snd_korg1212_dev_free, 2163 .dev_free = snd_korg1212_dev_free,
2156 }; 2164 };
2157 2165
@@ -2276,19 +2284,19 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2276 stateName[korg1212->cardState]); 2284 stateName[korg1212->cardState]);
2277 2285
2278 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 2286 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2279 sizeof(KorgSharedBuffer), &korg1212->dma_shared) < 0) { 2287 sizeof(struct KorgSharedBuffer), &korg1212->dma_shared) < 0) {
2280 snd_printk(KERN_ERR "korg1212: can not allocate shared buffer memory (%Zd bytes)\n", sizeof(KorgSharedBuffer)); 2288 snd_printk(KERN_ERR "korg1212: can not allocate shared buffer memory (%Zd bytes)\n", sizeof(struct KorgSharedBuffer));
2281 snd_korg1212_free(korg1212); 2289 snd_korg1212_free(korg1212);
2282 return -ENOMEM; 2290 return -ENOMEM;
2283 } 2291 }
2284 korg1212->sharedBufferPtr = (KorgSharedBuffer *)korg1212->dma_shared.area; 2292 korg1212->sharedBufferPtr = (struct KorgSharedBuffer *)korg1212->dma_shared.area;
2285 korg1212->sharedBufferPhy = korg1212->dma_shared.addr; 2293 korg1212->sharedBufferPhy = korg1212->dma_shared.addr;
2286 2294
2287 K1212_DEBUG_PRINTK("K1212_DEBUG: Shared Buffer Area = 0x%p (0x%08lx), %d bytes\n", korg1212->sharedBufferPtr, korg1212->sharedBufferPhy, sizeof(KorgSharedBuffer)); 2295 K1212_DEBUG_PRINTK("K1212_DEBUG: Shared Buffer Area = 0x%p (0x%08lx), %d bytes\n", korg1212->sharedBufferPtr, korg1212->sharedBufferPhy, sizeof(struct KorgSharedBuffer));
2288 2296
2289#ifndef K1212_LARGEALLOC 2297#ifndef K1212_LARGEALLOC
2290 2298
2291 korg1212->DataBufsSize = sizeof(KorgAudioBuffer) * kNumBuffers; 2299 korg1212->DataBufsSize = sizeof(struct KorgAudioBuffer) * kNumBuffers;
2292 2300
2293 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 2301 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2294 korg1212->DataBufsSize, &korg1212->dma_play) < 0) { 2302 korg1212->DataBufsSize, &korg1212->dma_play) < 0) {
@@ -2296,7 +2304,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2296 snd_korg1212_free(korg1212); 2304 snd_korg1212_free(korg1212);
2297 return -ENOMEM; 2305 return -ENOMEM;
2298 } 2306 }
2299 korg1212->playDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_play.area; 2307 korg1212->playDataBufsPtr = (struct KorgAudioBuffer *)korg1212->dma_play.area;
2300 korg1212->PlayDataPhy = korg1212->dma_play.addr; 2308 korg1212->PlayDataPhy = korg1212->dma_play.addr;
2301 2309
2302 K1212_DEBUG_PRINTK("K1212_DEBUG: Play Data Area = 0x%p (0x%08x), %d bytes\n", 2310 K1212_DEBUG_PRINTK("K1212_DEBUG: Play Data Area = 0x%p (0x%08x), %d bytes\n",
@@ -2308,7 +2316,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2308 snd_korg1212_free(korg1212); 2316 snd_korg1212_free(korg1212);
2309 return -ENOMEM; 2317 return -ENOMEM;
2310 } 2318 }
2311 korg1212->recordDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_rec.area; 2319 korg1212->recordDataBufsPtr = (struct KorgAudioBuffer *)korg1212->dma_rec.area;
2312 korg1212->RecDataPhy = korg1212->dma_rec.addr; 2320 korg1212->RecDataPhy = korg1212->dma_rec.addr;
2313 2321
2314 K1212_DEBUG_PRINTK("K1212_DEBUG: Record Data Area = 0x%p (0x%08x), %d bytes\n", 2322 K1212_DEBUG_PRINTK("K1212_DEBUG: Record Data Area = 0x%p (0x%08x), %d bytes\n",
@@ -2318,19 +2326,19 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2318 2326
2319 korg1212->recordDataBufsPtr = korg1212->sharedBufferPtr->recordDataBufs; 2327 korg1212->recordDataBufsPtr = korg1212->sharedBufferPtr->recordDataBufs;
2320 korg1212->playDataBufsPtr = korg1212->sharedBufferPtr->playDataBufs; 2328 korg1212->playDataBufsPtr = korg1212->sharedBufferPtr->playDataBufs;
2321 korg1212->PlayDataPhy = (u32) &((KorgSharedBuffer *) korg1212->sharedBufferPhy)->playDataBufs; 2329 korg1212->PlayDataPhy = (u32) &((struct KorgSharedBuffer *) korg1212->sharedBufferPhy)->playDataBufs;
2322 korg1212->RecDataPhy = (u32) &((KorgSharedBuffer *) korg1212->sharedBufferPhy)->recordDataBufs; 2330 korg1212->RecDataPhy = (u32) &((struct KorgSharedBuffer *) korg1212->sharedBufferPhy)->recordDataBufs;
2323 2331
2324#endif // K1212_LARGEALLOC 2332#endif // K1212_LARGEALLOC
2325 2333
2326 korg1212->dspCodeSize = sizeof (dspCode); 2334 korg1212->dspCodeSize = sizeof (dspCode);
2327 2335
2328 korg1212->VolumeTablePhy = korg1212->sharedBufferPhy + 2336 korg1212->VolumeTablePhy = korg1212->sharedBufferPhy +
2329 offsetof(KorgSharedBuffer, volumeData); 2337 offsetof(struct KorgSharedBuffer, volumeData);
2330 korg1212->RoutingTablePhy = korg1212->sharedBufferPhy + 2338 korg1212->RoutingTablePhy = korg1212->sharedBufferPhy +
2331 offsetof(KorgSharedBuffer, routeData); 2339 offsetof(struct KorgSharedBuffer, routeData);
2332 korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy + 2340 korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
2333 offsetof(KorgSharedBuffer, AdatTimeCode); 2341 offsetof(struct KorgSharedBuffer, AdatTimeCode);
2334 2342
2335 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 2343 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2336 korg1212->dspCodeSize, &korg1212->dma_dsp) < 0) { 2344 korg1212->dspCodeSize, &korg1212->dma_dsp) < 0) {
@@ -2360,7 +2368,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2360 if (snd_korg1212_downloadDSPCode(korg1212)) 2368 if (snd_korg1212_downloadDSPCode(korg1212))
2361 return -EBUSY; 2369 return -EBUSY;
2362 2370
2363 K1212_DEBUG_PRINTK("korg1212: dspMemPhy = %08x U[%08x], " 2371 K1212_DEBUG_PRINTK("korg1212: dspMemPhy = %08x U[%08x], "
2364 "PlayDataPhy = %08x L[%08x]\n" 2372 "PlayDataPhy = %08x L[%08x]\n"
2365 "korg1212: RecDataPhy = %08x L[%08x], " 2373 "korg1212: RecDataPhy = %08x L[%08x], "
2366 "VolumeTablePhy = %08x L[%08x]\n" 2374 "VolumeTablePhy = %08x L[%08x]\n"
@@ -2410,8 +2418,8 @@ snd_korg1212_probe(struct pci_dev *pci,
2410 const struct pci_device_id *pci_id) 2418 const struct pci_device_id *pci_id)
2411{ 2419{
2412 static int dev; 2420 static int dev;
2413 korg1212_t *korg1212; 2421 struct snd_korg1212 *korg1212;
2414 snd_card_t *card; 2422 struct snd_card *card;
2415 int err; 2423 int err;
2416 2424
2417 if (dev >= SNDRV_CARDS) { 2425 if (dev >= SNDRV_CARDS) {