Commit 9fd9156c authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] korg1212 - Clean up debug prints

Modules: KORG1212 driver

Clean up debug prints in korg1212 driver.
Also, clean up spaces/indents in some places.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e017fa57
...@@ -41,8 +41,16 @@ ...@@ -41,8 +41,16 @@
// Debug Stuff // Debug Stuff
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#define K1212_DEBUG_LEVEL 0 #define K1212_DEBUG_LEVEL 0
#define K1212_DEBUG_PRINTK printk #if K1212_DEBUG_LEVEL > 0
//#define K1212_DEBUG_PRINTK(x...) printk("<0>" x) #define K1212_DEBUG_PRINTK(fmt,args...) printk(KERN_DEBUG fmt,##args)
#else
#define K1212_DEBUG_PRINTK(fmt,...)
#endif
#if K1212_DEBUG_LEVEL > 1
#define K1212_DEBUG_PRINTK_VERBOSE(fmt,args...) printk(KERN_DEBUG fmt,##args)
#else
#define K1212_DEBUG_PRINTK_VERBOSE(fmt,...)
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Record/Play Buffer Allocation Method. If K1212_LARGEALLOC is defined all // Record/Play Buffer Allocation Method. If K1212_LARGEALLOC is defined all
...@@ -432,54 +440,54 @@ static struct pci_device_id snd_korg1212_ids[] = { ...@@ -432,54 +440,54 @@ static struct pci_device_id snd_korg1212_ids[] = {
{ 0, }, { 0, },
}; };
static char* stateName[] = { static char *stateName[] = {
"Non-existent", "Non-existent",
"Uninitialized", "Uninitialized",
"DSP download in process", "DSP download in process",
"DSP download complete", "DSP download complete",
"Ready", "Ready",
"Open", "Open",
"Setup for play", "Setup for play",
"Playing", "Playing",
"Monitor mode on", "Monitor mode on",
"Calibrating", "Calibrating",
"Invalid" "Invalid"
}; };
static char* clockSourceTypeName[] = { "ADAT", "S/PDIF", "local" }; static char *clockSourceTypeName[] = { "ADAT", "S/PDIF", "local" };
static char* clockSourceName[] = { static char *clockSourceName[] = {
"ADAT at 44.1 kHz", "ADAT at 44.1 kHz",
"ADAT at 48 kHz", "ADAT at 48 kHz",
"S/PDIF at 44.1 kHz", "S/PDIF at 44.1 kHz",
"S/PDIF at 48 kHz", "S/PDIF at 48 kHz",
"local clock at 44.1 kHz", "local clock at 44.1 kHz",
"local clock at 48 kHz" "local clock at 48 kHz"
}; };
static char* channelName[] = { static char *channelName[] = {
"ADAT-1", "ADAT-1",
"ADAT-2", "ADAT-2",
"ADAT-3", "ADAT-3",
"ADAT-4", "ADAT-4",
"ADAT-5", "ADAT-5",
"ADAT-6", "ADAT-6",
"ADAT-7", "ADAT-7",
"ADAT-8", "ADAT-8",
"Analog-L", "Analog-L",
"Analog-R", "Analog-R",
"SPDIF-L", "SPDIF-L",
"SPDIF-R", "SPDIF-R",
}; };
static u16 ClockSourceSelector[] = static u16 ClockSourceSelector[] = {
{0x8000, // selects source as ADAT at 44.1 kHz 0x8000, // selects source as ADAT at 44.1 kHz
0x0000, // selects source as ADAT at 48 kHz 0x0000, // selects source as ADAT at 48 kHz
0x8001, // selects source as S/PDIF at 44.1 kHz 0x8001, // selects source as S/PDIF at 44.1 kHz
0x0001, // selects source as S/PDIF at 48 kHz 0x0001, // selects source as S/PDIF at 48 kHz
0x8002, // selects source as local clock at 44.1 kHz 0x8002, // selects source as local clock at 44.1 kHz
0x0002 // selects source as local clock at 48 kHz 0x0002 // selects source as local clock at 48 kHz
}; };
static snd_korg1212rc rc; static snd_korg1212rc rc;
...@@ -521,23 +529,6 @@ static u32 LowerWordSwap(u32 swappee) ...@@ -521,23 +529,6 @@ static u32 LowerWordSwap(u32 swappee)
return retVal.i; return retVal.i;
} }
#if 0 /* not used */
static u32 EndianSwap(u32 swappee)
{
swap_u32 retVal, swapper;
swapper.i = swappee;
retVal.c[0] = swapper.c[3];
retVal.c[1] = swapper.c[2];
retVal.c[2] = swapper.c[1];
retVal.c[3] = swapper.c[0];
return retVal.i;
}
#endif /* not used */
#define SetBitInWord(theWord,bitPosition) (*theWord) |= (0x0001 << bitPosition) #define SetBitInWord(theWord,bitPosition) (*theWord) |= (0x0001 << bitPosition)
#define SetBitInDWord(theWord,bitPosition) (*theWord) |= (0x00000001 << bitPosition) #define SetBitInDWord(theWord,bitPosition) (*theWord) |= (0x00000001 << bitPosition)
#define ClearBitInWord(theWord,bitPosition) (*theWord) &= ~(0x0001 << bitPosition) #define ClearBitInWord(theWord,bitPosition) (*theWord) &= ~(0x0001 << bitPosition)
...@@ -551,15 +542,12 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121 ...@@ -551,15 +542,12 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121
snd_korg1212rc rc = K1212_CMDRET_Success; snd_korg1212rc rc = K1212_CMDRET_Success;
if (!korg1212->outDoorbellPtr) { if (!korg1212->outDoorbellPtr) {
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: CardUninitialized\n");
K1212_DEBUG_PRINTK("K1212_DEBUG: CardUninitialized\n");
#endif
return K1212_CMDRET_CardUninitialized; return K1212_CMDRET_CardUninitialized;
} }
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: Card <- 0x%08x 0x%08x [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: Card <- 0x%08x 0x%08x [%s]\n", doorbellVal, mailBox0Val, stateName[korg1212->cardState]); doorbellVal, mailBox0Val, stateName[korg1212->cardState]);
#endif
for (retryCount = 0; retryCount < MAX_COMMAND_RETRIES; retryCount++) { for (retryCount = 0; retryCount < MAX_COMMAND_RETRIES; retryCount++) {
writel(mailBox3Val, korg1212->mailbox3Ptr); writel(mailBox3Val, korg1212->mailbox3Ptr);
writel(mailBox2Val, korg1212->mailbox2Ptr); writel(mailBox2Val, korg1212->mailbox2Ptr);
...@@ -586,9 +574,7 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121 ...@@ -586,9 +574,7 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121
mailBox3Lo = readl(korg1212->mailbox3Ptr); mailBox3Lo = readl(korg1212->mailbox3Ptr);
if (mailBox3Lo & COMMAND_ACK_MASK) { if (mailBox3Lo & COMMAND_ACK_MASK) {
if ((mailBox3Lo & DOORBELL_VAL_MASK) == (doorbellVal & DOORBELL_VAL_MASK)) { if ((mailBox3Lo & DOORBELL_VAL_MASK) == (doorbellVal & DOORBELL_VAL_MASK)) {
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: Card <- Success\n");
K1212_DEBUG_PRINTK("K1212_DEBUG: Card <- Success\n");
#endif
rc = K1212_CMDRET_Success; rc = K1212_CMDRET_Success;
break; break;
} }
...@@ -597,9 +583,7 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121 ...@@ -597,9 +583,7 @@ static snd_korg1212rc snd_korg1212_Send1212Command(korg1212_t *korg1212, korg121
korg1212->cmdRetryCount += retryCount; korg1212->cmdRetryCount += retryCount;
if (retryCount >= MAX_COMMAND_RETRIES) { if (retryCount >= MAX_COMMAND_RETRIES) {
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: Card <- NoAckFromCard\n");
K1212_DEBUG_PRINTK("K1212_DEBUG: Card <- NoAckFromCard\n");
#endif
rc = K1212_CMDRET_NoAckFromCard; rc = K1212_CMDRET_NoAckFromCard;
} }
...@@ -639,9 +623,8 @@ static void snd_korg1212_timer_func(unsigned long data) ...@@ -639,9 +623,8 @@ static void snd_korg1212_timer_func(unsigned long data)
korg1212->stop_pending_cnt = 0; korg1212->stop_pending_cnt = 0;
korg1212->dsp_stop_is_processed = 1; korg1212->dsp_stop_is_processed = 1;
wake_up(&korg1212->wait); wake_up(&korg1212->wait);
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: Stop ack'ed [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: Stop ack'ed [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
} else { } else {
if (--korg1212->stop_pending_cnt > 0) { if (--korg1212->stop_pending_cnt > 0) {
/* reprogram timer */ /* reprogram timer */
...@@ -652,17 +635,17 @@ static void snd_korg1212_timer_func(unsigned long data) ...@@ -652,17 +635,17 @@ static void snd_korg1212_timer_func(unsigned long data)
korg1212->sharedBufferPtr->cardCommand = 0; korg1212->sharedBufferPtr->cardCommand = 0;
korg1212->dsp_stop_is_processed = 1; korg1212->dsp_stop_is_processed = 1;
wake_up(&korg1212->wait); wake_up(&korg1212->wait);
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: Stop timeout [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: Stop timeout [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
} }
} }
spin_unlock(&korg1212->lock); spin_unlock(&korg1212->lock);
} }
static void snd_korg1212_TurnOnIdleMonitor(korg1212_t *korg1212) static int snd_korg1212_TurnOnIdleMonitor(korg1212_t *korg1212)
{ {
unsigned long flags; unsigned long flags;
int rc;
udelay(INTERCOMMAND_DELAY); udelay(INTERCOMMAND_DELAY);
spin_lock_irqsave(&korg1212->lock, flags); spin_lock_irqsave(&korg1212->lock, flags);
...@@ -670,6 +653,7 @@ static void snd_korg1212_TurnOnIdleMonitor(korg1212_t *korg1212) ...@@ -670,6 +653,7 @@ static void snd_korg1212_TurnOnIdleMonitor(korg1212_t *korg1212)
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode, rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode,
K1212_MODE_MonitorOn, 0, 0, 0); K1212_MODE_MonitorOn, 0, 0, 0);
spin_unlock_irqrestore(&korg1212->lock, flags); spin_unlock_irqrestore(&korg1212->lock, flags);
return rc;
} }
static void snd_korg1212_TurnOffIdleMonitor(korg1212_t *korg1212) static void snd_korg1212_TurnOffIdleMonitor(korg1212_t *korg1212)
...@@ -687,9 +671,8 @@ static inline void snd_korg1212_setCardState(korg1212_t * korg1212, CardState cs ...@@ -687,9 +671,8 @@ static inline void snd_korg1212_setCardState(korg1212_t * korg1212, CardState cs
static int snd_korg1212_OpenCard(korg1212_t * korg1212) static int snd_korg1212_OpenCard(korg1212_t * korg1212)
{ {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n", stateName[korg1212->cardState], korg1212->opencnt); stateName[korg1212->cardState], korg1212->opencnt);
#endif
down(&korg1212->open_mutex); down(&korg1212->open_mutex);
if (korg1212->opencnt++ == 0) { if (korg1212->opencnt++ == 0) {
snd_korg1212_TurnOffIdleMonitor(korg1212); snd_korg1212_TurnOffIdleMonitor(korg1212);
...@@ -702,9 +685,8 @@ static int snd_korg1212_OpenCard(korg1212_t * korg1212) ...@@ -702,9 +685,8 @@ static int snd_korg1212_OpenCard(korg1212_t * korg1212)
static int snd_korg1212_CloseCard(korg1212_t * korg1212) static int snd_korg1212_CloseCard(korg1212_t * korg1212)
{ {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n", stateName[korg1212->cardState], korg1212->opencnt); stateName[korg1212->cardState], korg1212->opencnt);
#endif
down(&korg1212->open_mutex); down(&korg1212->open_mutex);
if (--(korg1212->opencnt)) { if (--(korg1212->opencnt)) {
...@@ -713,12 +695,11 @@ static int snd_korg1212_CloseCard(korg1212_t * korg1212) ...@@ -713,12 +695,11 @@ static int snd_korg1212_CloseCard(korg1212_t * korg1212)
} }
if (korg1212->cardState == K1212_STATE_SETUP) { if (korg1212->cardState == K1212_STATE_SETUP) {
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode, int rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode,
K1212_MODE_StopPlay, 0, 0, 0); K1212_MODE_StopPlay, 0, 0, 0);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
if (rc != K1212_CMDRET_Success) { if (rc != K1212_CMDRET_Success) {
up(&korg1212->open_mutex); up(&korg1212->open_mutex);
return 0; return 0;
...@@ -739,9 +720,10 @@ static int snd_korg1212_CloseCard(korg1212_t * korg1212) ...@@ -739,9 +720,10 @@ static int snd_korg1212_CloseCard(korg1212_t * korg1212)
/* spinlock already held */ /* spinlock already held */
static int snd_korg1212_SetupForPlay(korg1212_t * korg1212) static int snd_korg1212_SetupForPlay(korg1212_t * korg1212)
{ {
#if K1212_DEBUG_LEVEL > 0 int rc;
K1212_DEBUG_PRINTK("K1212_DEBUG: SetupForPlay [%s] %d\n", stateName[korg1212->cardState], korg1212->setcnt);
#endif K1212_DEBUG_PRINTK("K1212_DEBUG: SetupForPlay [%s] %d\n",
stateName[korg1212->cardState], korg1212->setcnt);
if (korg1212->setcnt++) if (korg1212->setcnt++)
return 0; return 0;
...@@ -749,10 +731,9 @@ static int snd_korg1212_SetupForPlay(korg1212_t * korg1212) ...@@ -749,10 +731,9 @@ static int snd_korg1212_SetupForPlay(korg1212_t * korg1212)
snd_korg1212_setCardState(korg1212, K1212_STATE_SETUP); snd_korg1212_setCardState(korg1212, K1212_STATE_SETUP);
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode, rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode,
K1212_MODE_SetupPlay, 0, 0, 0); K1212_MODE_SetupPlay, 0, 0, 0);
if (rc)
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: SetupForPlay - RC = %d [%s]\n",
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: SetupForPlay - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); rc, stateName[korg1212->cardState]);
#endif
if (rc != K1212_CMDRET_Success) { if (rc != K1212_CMDRET_Success) {
return 1; return 1;
} }
...@@ -762,20 +743,19 @@ static int snd_korg1212_SetupForPlay(korg1212_t * korg1212) ...@@ -762,20 +743,19 @@ static int snd_korg1212_SetupForPlay(korg1212_t * korg1212)
/* spinlock already held */ /* spinlock already held */
static int snd_korg1212_TriggerPlay(korg1212_t * korg1212) static int snd_korg1212_TriggerPlay(korg1212_t * korg1212)
{ {
#if K1212_DEBUG_LEVEL > 0 int rc;
K1212_DEBUG_PRINTK("K1212_DEBUG: TriggerPlay [%s] %d\n", stateName[korg1212->cardState], korg1212->playcnt);
#endif K1212_DEBUG_PRINTK("K1212_DEBUG: TriggerPlay [%s] %d\n",
stateName[korg1212->cardState], korg1212->playcnt);
if (korg1212->playcnt++) if (korg1212->playcnt++)
return 0; return 0;
snd_korg1212_setCardState(korg1212, K1212_STATE_PLAYING); snd_korg1212_setCardState(korg1212, K1212_STATE_PLAYING);
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_TriggerPlay, 0, 0, 0, 0); rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_TriggerPlay, 0, 0, 0, 0);
if (rc)
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: TriggerPlay - RC = %d [%s]\n",
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: TriggerPlay - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); rc, stateName[korg1212->cardState]);
#endif
if (rc != K1212_CMDRET_Success) { if (rc != K1212_CMDRET_Success) {
return 1; return 1;
} }
...@@ -785,9 +765,8 @@ static int snd_korg1212_TriggerPlay(korg1212_t * korg1212) ...@@ -785,9 +765,8 @@ static int snd_korg1212_TriggerPlay(korg1212_t * korg1212)
/* spinlock already held */ /* spinlock already held */
static int snd_korg1212_StopPlay(korg1212_t * korg1212) static int snd_korg1212_StopPlay(korg1212_t * korg1212)
{ {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: StopPlay [%s] %d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: StopPlay [%s] %d\n", stateName[korg1212->cardState], korg1212->playcnt); stateName[korg1212->cardState], korg1212->playcnt);
#endif
if (--(korg1212->playcnt)) if (--(korg1212->playcnt))
return 0; return 0;
...@@ -815,35 +794,34 @@ static void snd_korg1212_EnableCardInterrupts(korg1212_t * korg1212) ...@@ -815,35 +794,34 @@ static void snd_korg1212_EnableCardInterrupts(korg1212_t * korg1212)
static int snd_korg1212_SetMonitorMode(korg1212_t *korg1212, MonitorModeSelector mode) static int snd_korg1212_SetMonitorMode(korg1212_t *korg1212, MonitorModeSelector mode)
{ {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: SetMonitorMode [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: SetMonitorMode [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
switch (mode) { switch (mode) {
case K1212_MONMODE_Off: case K1212_MONMODE_Off:
if (korg1212->cardState != K1212_STATE_MONITOR) { if (korg1212->cardState != K1212_STATE_MONITOR)
return 0; return 0;
} else { else {
snd_korg1212_SendStopAndWait(korg1212); snd_korg1212_SendStopAndWait(korg1212);
snd_korg1212_setCardState(korg1212, K1212_STATE_OPEN); snd_korg1212_setCardState(korg1212, K1212_STATE_OPEN);
} }
break; break;
case K1212_MONMODE_On: case K1212_MONMODE_On:
if (korg1212->cardState != K1212_STATE_OPEN) { if (korg1212->cardState != K1212_STATE_OPEN)
return 0; return 0;
} else { else {
snd_korg1212_setCardState(korg1212, K1212_STATE_MONITOR); int rc;
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode, snd_korg1212_setCardState(korg1212, K1212_STATE_MONITOR);
K1212_MODE_MonitorOn, 0, 0, 0); rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode,
if (rc != K1212_CMDRET_Success) { K1212_MODE_MonitorOn, 0, 0, 0);
return 0; if (rc != K1212_CMDRET_Success)
} return 0;
} }
break; break;
default: default:
return 0; return 0;
} }
return 1; return 1;
...@@ -853,42 +831,42 @@ static int snd_korg1212_SetMonitorMode(korg1212_t *korg1212, MonitorModeSelector ...@@ -853,42 +831,42 @@ static int snd_korg1212_SetMonitorMode(korg1212_t *korg1212, MonitorModeSelector
static inline int snd_korg1212_use_is_exclusive(korg1212_t *korg1212) static inline int snd_korg1212_use_is_exclusive(korg1212_t *korg1212)
{ {
int ret = 1; if (korg1212->playback_pid != korg1212->capture_pid &&
korg1212->playback_pid >= 0 && korg1212->capture_pid >= 0)
return 0;
if ((korg1212->playback_pid != korg1212->capture_pid) && return 1;
(korg1212->playback_pid >= 0) && (korg1212->capture_pid >= 0)) {
ret = 0;
}
return ret;
} }
static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate) static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate)
{ {
static ClockSourceIndex s44[] = { K1212_CLKIDX_AdatAt44_1K, static ClockSourceIndex s44[] = {
K1212_CLKIDX_WordAt44_1K, K1212_CLKIDX_AdatAt44_1K,
K1212_CLKIDX_LocalAt44_1K }; K1212_CLKIDX_WordAt44_1K,
K1212_CLKIDX_LocalAt44_1K
};
static ClockSourceIndex s48[] = { static ClockSourceIndex s48[] = {
K1212_CLKIDX_AdatAt48K, K1212_CLKIDX_AdatAt48K,
K1212_CLKIDX_WordAt48K, K1212_CLKIDX_WordAt48K,
K1212_CLKIDX_LocalAt48K }; K1212_CLKIDX_LocalAt48K
int parm; };
int parm, rc;
if (!snd_korg1212_use_is_exclusive (korg1212)) { if (!snd_korg1212_use_is_exclusive (korg1212))
return -EBUSY; return -EBUSY;
}
switch(rate) { switch(rate) {
case 44100: case 44100:
parm = s44[korg1212->clkSource]; parm = s44[korg1212->clkSource];
break; break;
case 48000: case 48000:
parm = s48[korg1212->clkSource]; parm = s48[korg1212->clkSource];
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
korg1212->clkSrcRate = parm; korg1212->clkSrcRate = parm;
korg1212->clkRate = rate; korg1212->clkRate = rate;
...@@ -898,9 +876,9 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate) ...@@ -898,9 +876,9 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate)
ClockSourceSelector[korg1212->clkSrcRate], ClockSourceSelector[korg1212->clkSrcRate],
0, 0, 0); 0, 0, 0);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Set Clock Source Selector - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Set Clock Source Selector - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
return 0; return 0;
} }
...@@ -908,8 +886,8 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate) ...@@ -908,8 +886,8 @@ static int snd_korg1212_SetRate(korg1212_t *korg1212, int rate)
static int snd_korg1212_SetClockSource(korg1212_t *korg1212, int source) static int snd_korg1212_SetClockSource(korg1212_t *korg1212, int source)
{ {
if (source<0 || source >2) if (source < 0 || source > 2)
return -EINVAL; return -EINVAL;
korg1212->clkSource = source; korg1212->clkSource = source;
...@@ -935,9 +913,8 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212) ...@@ -935,9 +913,8 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212)
u16 count; u16 count;
unsigned long flags; unsigned long flags;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: WriteADCSensivity [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: WriteADCSensivity [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// initialize things. The local init bit is always set when writing to the // initialize things. The local init bit is always set when writing to the
...@@ -1006,19 +983,17 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212) ...@@ -1006,19 +983,17 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212)
udelay(LOADSHIFT_DELAY); udelay(LOADSHIFT_DELAY);
for (bitPosition = 15; bitPosition >= 0; bitPosition--) { // for all the bits for (bitPosition = 15; bitPosition >= 0; bitPosition--) { // for all the bits
if (channel == 0) { if (channel == 0) {
if (sensVals.l.leftSensBits & (0x0001 << bitPosition)) { if (sensVals.l.leftSensBits & (0x0001 << bitPosition))
SetBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set high SetBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set high
} else { else
ClearBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set low ClearBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set low
} } else {
} else { if (sensVals.r.rightSensBits & (0x0001 << bitPosition))
if (sensVals.r.rightSensBits & (0x0001 << bitPosition)) { SetBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set high
SetBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set high else
} else { ClearBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set low
ClearBitInWord(&controlValue, SET_SENS_DATA_BITPOS); // data bit set low }
}
}
ClearBitInWord(&controlValue, SET_SENS_CLOCK_BITPOS); ClearBitInWord(&controlValue, SET_SENS_CLOCK_BITPOS);
writew(controlValue, korg1212->sensRegPtr); // clock goes low writew(controlValue, korg1212->sensRegPtr); // clock goes low
...@@ -1061,10 +1036,9 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212) ...@@ -1061,10 +1036,9 @@ static int snd_korg1212_WriteADCSensitivity(korg1212_t *korg1212)
if (monModeSet) { if (monModeSet) {
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode, rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SelectPlayMode,
K1212_MODE_MonitorOn, 0, 0, 0); K1212_MODE_MonitorOn, 0, 0, 0);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: WriteADCSensivity - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: WriteADCSensivity - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
} }
spin_unlock_irqrestore(&korg1212->lock, flags); spin_unlock_irqrestore(&korg1212->lock, flags);
...@@ -1076,19 +1050,18 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212) ...@@ -1076,19 +1050,18 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212)
{ {
int channel; int channel;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is complete. [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is complete. [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
// ---------------------------------------------------- // ----------------------------------------------------
// tell the card to boot // tell the card to boot
// ---------------------------------------------------- // ----------------------------------------------------
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_BootFromDSPPage4, 0, 0, 0, 0); rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_BootFromDSPPage4, 0, 0, 0, 0);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Boot from Page 4 - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Boot from Page 4 - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
mdelay(DSP_BOOT_DELAY_IN_MS); msleep(DSP_BOOT_DELAY_IN_MS);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// Let the card know where all the buffers are. // Let the card know where all the buffers are.
...@@ -1102,9 +1075,9 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212) ...@@ -1102,9 +1075,9 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212)
0 0
); );
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Configure Buffer Memory - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Configure Buffer Memory - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
udelay(INTERCOMMAND_DELAY); udelay(INTERCOMMAND_DELAY);
...@@ -1116,10 +1089,9 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212) ...@@ -1116,10 +1089,9 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212)
0 0
); );
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Configure Misc Memory - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Configure Misc Memory - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
// Initialize the routing and volume tables, then update the card's state. // Initialize the routing and volume tables, then update the card's state.
...@@ -1138,16 +1110,16 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212) ...@@ -1138,16 +1110,16 @@ static void snd_korg1212_OnDSPDownloadComplete(korg1212_t *korg1212)
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SetClockSourceRate, rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_SetClockSourceRate,
ClockSourceSelector[korg1212->clkSrcRate], ClockSourceSelector[korg1212->clkSrcRate],
0, 0, 0); 0, 0, 0);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Set Clock Source Selector - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Set Clock Source Selector - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
snd_korg1212_TurnOnIdleMonitor(korg1212); rc = snd_korg1212_TurnOnIdleMonitor(korg1212);
snd_korg1212_setCardState(korg1212, K1212_STATE_READY); snd_korg1212_setCardState(korg1212, K1212_STATE_READY);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Set Monitor On - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Set Monitor On - RC = %d [%s]\n",
#endif rc, stateName[korg1212->cardState]);
snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_COMPLETE); snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_COMPLETE);
} }
...@@ -1176,9 +1148,9 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs ...@@ -1176,9 +1148,9 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
switch (doorbellValue) { switch (doorbellValue) {
case K1212_DB_DSPDownloadDone: case K1212_DB_DSPDownloadDone:
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ DNLD count - %ld, %x, [%s].\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ DNLD count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]); korg1212->irqcount, doorbellValue,
#endif stateName[korg1212->cardState]);
if (korg1212->cardState == K1212_STATE_DSP_IN_PROCESS) { if (korg1212->cardState == K1212_STATE_DSP_IN_PROCESS) {
korg1212->dsp_is_loaded = 1; korg1212->dsp_is_loaded = 1;
wake_up(&korg1212->wait); wake_up(&korg1212->wait);
...@@ -1189,10 +1161,10 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs ...@@ -1189,10 +1161,10 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
// an error occurred - stop the card // an error occurred - stop the card
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case K1212_DB_DMAERROR: case K1212_DB_DMAERROR:
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: IRQ DMAE count - %ld, %x, [%s].\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ DMAE count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]); korg1212->irqcount, doorbellValue,
#endif stateName[korg1212->cardState]);
snd_printk(KERN_ERR "korg1212: DMA Error\n"); snd_printk(KERN_ERR "korg1212: DMA Error\n");
korg1212->errorcnt++; korg1212->errorcnt++;
korg1212->totalerrorcnt++; korg1212->totalerrorcnt++;
korg1212->sharedBufferPtr->cardCommand = 0; korg1212->sharedBufferPtr->cardCommand = 0;
...@@ -1204,17 +1176,17 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs ...@@ -1204,17 +1176,17 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
// the semaphore in case someone is waiting for this. // the semaphore in case someone is waiting for this.
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case K1212_DB_CARDSTOPPED: case K1212_DB_CARDSTOPPED:
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VEROBSE("K1212_DEBUG: IRQ CSTP count - %ld, %x, [%s].\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ CSTP count - %ld, %x, [%s].\n", korg1212->irqcount, doorbellValue, stateName[korg1212->cardState]); korg1212->irqcount, doorbellValue,
#endif stateName[korg1212->cardState]);
korg1212->sharedBufferPtr->cardCommand = 0; korg1212->sharedBufferPtr->cardCommand = 0;
break; break;
default: default:
#if K1212_DEBUG_LEVEL > 3 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: IRQ DFLT count - %ld, %x, cpos=%d [%s].\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: IRQ DFLT count - %ld, %x, cpos=%d [%s].\n", korg1212->irqcount, doorbellValue, korg1212->irqcount, doorbellValue,
korg1212->currentBuffer, stateName[korg1212->cardState]); korg1212->currentBuffer,
#endif stateName[korg1212->cardState]);
if ((korg1212->cardState > K1212_STATE_SETUP) || korg1212->idleMonitorOn) { if ((korg1212->cardState > K1212_STATE_SETUP) || korg1212->idleMonitorOn) {
korg1212->currentBuffer++; korg1212->currentBuffer++;
...@@ -1249,16 +1221,14 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs ...@@ -1249,16 +1221,14 @@ static irqreturn_t snd_korg1212_interrupt(int irq, void *dev_id, struct pt_regs
static int snd_korg1212_downloadDSPCode(korg1212_t *korg1212) static int snd_korg1212_downloadDSPCode(korg1212_t *korg1212)
{ {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is starting... [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: DSP download is starting... [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
// --------------------------------------------------------------- // ---------------------------------------------------------------
// verify the state of the card before proceeding. // verify the state of the card before proceeding.
// --------------------------------------------------------------- // ---------------------------------------------------------------
if (korg1212->cardState >= K1212_STATE_DSP_IN_PROCESS) { if (korg1212->cardState >= K1212_STATE_DSP_IN_PROCESS)
return 1; return 1;
}
snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_IN_PROCESS); snd_korg1212_setCardState(korg1212, K1212_STATE_DSP_IN_PROCESS);
...@@ -1267,10 +1237,9 @@ static int snd_korg1212_downloadDSPCode(korg1212_t *korg1212) ...@@ -1267,10 +1237,9 @@ static int snd_korg1212_downloadDSPCode(korg1212_t *korg1212)
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_StartDSPDownload, rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_StartDSPDownload,
UpperWordSwap(korg1212->dma_dsp.addr), UpperWordSwap(korg1212->dma_dsp.addr),
0, 0, 0); 0, 0, 0);
if (rc)
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: Start DSP Download RC = %d [%s]\n",
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Start DSP Download RC = %d [%s]\n", rc, stateName[korg1212->cardState]); rc, stateName[korg1212->cardState]);
#endif
korg1212->dsp_is_loaded = 0; korg1212->dsp_is_loaded = 0;
wait_event_timeout(korg1212->wait, korg1212->dsp_is_loaded, HZ * CARD_BOOT_TIMEOUT); wait_event_timeout(korg1212->wait, korg1212->dsp_is_loaded, HZ * CARD_BOOT_TIMEOUT);
...@@ -1327,16 +1296,16 @@ static int snd_korg1212_silence(korg1212_t *korg1212, int pos, int count, int of ...@@ -1327,16 +1296,16 @@ static int snd_korg1212_silence(korg1212_t *korg1212, int pos, int count, int of
KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos; KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos;
int i; int i;
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_silence pos=%d offset=%d size=%d count=%d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_silence pos=%d offset=%d size=%d count=%d\n", pos, offset, size, count); pos, offset, size, count);
#endif
snd_assert(pos + count <= K1212_MAX_SAMPLES, return -EINVAL); snd_assert(pos + count <= K1212_MAX_SAMPLES, return -EINVAL);
for (i=0; i < count; i++) { for (i=0; i < count; i++) {
#if K1212_DEBUG_LEVEL > 0 #if K1212_DEBUG_LEVEL > 0
if ( (void *) dst < (void *) korg1212->playDataBufsPtr || if ( (void *) dst < (void *) korg1212->playDataBufsPtr ||
(void *) dst > (void *) korg1212->playDataBufsPtr[8].bufferData ) { (void *) dst > (void *) korg1212->playDataBufsPtr[8].bufferData ) {
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_silence KERNEL EFAULT dst=%p iter=%d\n", dst, i); printk(KERN_DEBUG "K1212_DEBUG: snd_korg1212_silence KERNEL EFAULT dst=%p iter=%d\n",
dst, i);
return -EFAULT; return -EFAULT;
} }
#endif #endif
...@@ -1352,24 +1321,21 @@ static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos, ...@@ -1352,24 +1321,21 @@ static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos,
KorgAudioFrame * src = korg1212->recordDataBufsPtr[0].bufferData + pos; KorgAudioFrame * src = korg1212->recordDataBufsPtr[0].bufferData + pos;
int i, rc; int i, rc;
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_copy_to pos=%d offset=%d size=%d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to pos=%d offset=%d size=%d\n", pos, offset, size); pos, offset, size);
#endif
snd_assert(pos + count <= K1212_MAX_SAMPLES, return -EINVAL); snd_assert(pos + count <= K1212_MAX_SAMPLES, return -EINVAL);
for (i=0; i < count; i++) { for (i=0; i < count; i++) {
#if K1212_DEBUG_LEVEL > 0 #if K1212_DEBUG_LEVEL > 0
if ( (void *) src < (void *) korg1212->recordDataBufsPtr || if ( (void *) src < (void *) korg1212->recordDataBufsPtr ||
(void *) src > (void *) korg1212->recordDataBufsPtr[8].bufferData ) { (void *) src > (void *) korg1212->recordDataBufsPtr[8].bufferData ) {
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to KERNEL EFAULT, src=%p dst=%p iter=%d\n", src, dst, i); printk(KERN_DEBUG "K1212_DEBUG: snd_korg1212_copy_to KERNEL EFAULT, src=%p dst=%p iter=%d\n", src, dst, i);
return -EFAULT; return -EFAULT;
} }
#endif #endif
rc = copy_to_user(dst + offset, src, size); rc = copy_to_user(dst + offset, src, size);
if (rc) { if (rc) {
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i); K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i);
#endif
return -EFAULT; return -EFAULT;
} }
src++; src++;
...@@ -1384,9 +1350,8 @@ static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int po ...@@ -1384,9 +1350,8 @@ static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int po
KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos; KorgAudioFrame * dst = korg1212->playDataBufsPtr[0].bufferData + pos;
int i, rc; int i, rc;
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_copy_from pos=%d offset=%d size=%d count=%d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_from pos=%d offset=%d size=%d count=%d\n", pos, offset, size, count); pos, offset, size, count);
#endif
snd_assert(pos + count <= K1212_MAX_SAMPLES, return -EINVAL); snd_assert(pos + count <= K1212_MAX_SAMPLES, return -EINVAL);
...@@ -1394,15 +1359,15 @@ static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int po ...@@ -1394,15 +1359,15 @@ static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int po
#if K1212_DEBUG_LEVEL > 0 #if K1212_DEBUG_LEVEL > 0
if ( (void *) dst < (void *) korg1212->playDataBufsPtr || if ( (void *) dst < (void *) korg1212->playDataBufsPtr ||
(void *) dst > (void *) korg1212->playDataBufsPtr[8].bufferData ) { (void *) dst > (void *) korg1212->playDataBufsPtr[8].bufferData ) {
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_from KERNEL EFAULT, src=%p dst=%p iter=%d\n", src, dst, i); printk(KERN_DEBUG "K1212_DEBUG: snd_korg1212_copy_from KERNEL EFAULT, src=%p dst=%p iter=%d\n",
src, dst, i);
return -EFAULT; return -EFAULT;
} }
#endif #endif
rc = copy_from_user((void*) dst + offset, src, size); rc = copy_from_user((void*) dst + offset, src, size);
if (rc) { if (rc) {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_from USER EFAULT src=%p dst=%p iter=%d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_from USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i); src, dst, i);
#endif
return -EFAULT; return -EFAULT;
} }
dst++; dst++;
...@@ -1416,9 +1381,8 @@ static void snd_korg1212_free_pcm(snd_pcm_t *pcm) ...@@ -1416,9 +1381,8 @@ static void snd_korg1212_free_pcm(snd_pcm_t *pcm)
{ {
korg1212_t *korg1212 = (korg1212_t *) pcm->private_data; korg1212_t *korg1212 = (korg1212_t *) pcm->private_data;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_free_pcm [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_free_pcm [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
korg1212->pcm = NULL; korg1212->pcm = NULL;
} }
...@@ -1429,9 +1393,8 @@ static int snd_korg1212_playback_open(snd_pcm_substream_t *substream) ...@@ -1429,9 +1393,8 @@ static int snd_korg1212_playback_open(snd_pcm_substream_t *substream)
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_runtime_t *runtime = substream->runtime;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_open [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_open [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
snd_pcm_set_sync(substream); // ??? snd_pcm_set_sync(substream); // ???
...@@ -1461,9 +1424,8 @@ static int snd_korg1212_capture_open(snd_pcm_substream_t *substream) ...@@ -1461,9 +1424,8 @@ static int snd_korg1212_capture_open(snd_pcm_substream_t *substream)
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
snd_pcm_runtime_t *runtime = substream->runtime; snd_pcm_runtime_t *runtime = substream->runtime;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_open [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_open [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
snd_pcm_set_sync(substream); snd_pcm_set_sync(substream);
...@@ -1490,9 +1452,8 @@ static int snd_korg1212_playback_close(snd_pcm_substream_t *substream) ...@@ -1490,9 +1452,8 @@ static int snd_korg1212_playback_close(snd_pcm_substream_t *substream)
unsigned long flags; unsigned long flags;
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_close [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_close [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
snd_korg1212_silence(korg1212, 0, K1212_MAX_SAMPLES, 0, korg1212->channels * 2); snd_korg1212_silence(korg1212, 0, K1212_MAX_SAMPLES, 0, korg1212->channels * 2);
...@@ -1513,9 +1474,8 @@ static int snd_korg1212_capture_close(snd_pcm_substream_t *substream) ...@@ -1513,9 +1474,8 @@ static int snd_korg1212_capture_close(snd_pcm_substream_t *substream)
unsigned long flags; unsigned long flags;
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_close [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_close [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
spin_lock_irqsave(&korg1212->lock, flags); spin_lock_irqsave(&korg1212->lock, flags);
...@@ -1532,18 +1492,14 @@ static int snd_korg1212_capture_close(snd_pcm_substream_t *substream) ...@@ -1532,18 +1492,14 @@ static int snd_korg1212_capture_close(snd_pcm_substream_t *substream)
static int snd_korg1212_ioctl(snd_pcm_substream_t *substream, static int snd_korg1212_ioctl(snd_pcm_substream_t *substream,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_ioctl: cmd=%d\n", cmd);
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_ioctl: cmd=%d\n", cmd);
#endif
if (cmd == SNDRV_PCM_IOCTL1_CHANNEL_INFO ) { if (cmd == SNDRV_PCM_IOCTL1_CHANNEL_INFO ) {
snd_pcm_channel_info_t *info = arg; snd_pcm_channel_info_t *info = arg;
info->offset = 0; info->offset = 0;
info->first = info->channel * 16; info->first = info->channel * 16;
info->step = 256; info->step = 256;
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: channel_info %d:, offset=%ld, first=%d, step=%d\n", info->channel, info->offset, info->first, info->step); K1212_DEBUG_PRINTK("K1212_DEBUG: channel_info %d:, offset=%ld, first=%d, step=%d\n", info->channel, info->offset, info->first, info->step);
#endif
return 0; return 0;
} }
...@@ -1559,9 +1515,8 @@ static int snd_korg1212_hw_params(snd_pcm_substream_t *substream, ...@@ -1559,9 +1515,8 @@ static int snd_korg1212_hw_params(snd_pcm_substream_t *substream,
pid_t this_pid; pid_t this_pid;
pid_t other_pid; pid_t other_pid;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_hw_params [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_hw_params [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
spin_lock_irqsave(&korg1212->lock, flags); spin_lock_irqsave(&korg1212->lock, flags);
...@@ -1608,17 +1563,15 @@ static int snd_korg1212_prepare(snd_pcm_substream_t *substream) ...@@ -1608,17 +1563,15 @@ static int snd_korg1212_prepare(snd_pcm_substream_t *substream)
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
int rc; int rc;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_prepare [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_prepare [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
spin_lock_irq(&korg1212->lock); spin_lock_irq(&korg1212->lock);
/* FIXME: we should wait for ack! */ /* FIXME: we should wait for ack! */
if (korg1212->stop_pending_cnt > 0) { if (korg1212->stop_pending_cnt > 0) {
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_prepare - Stop is pending... [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_prepare - Stop is pending... [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
spin_unlock_irq(&korg1212->lock); spin_unlock_irq(&korg1212->lock);
return -EAGAIN; return -EAGAIN;
/* /*
...@@ -1643,18 +1596,15 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream, ...@@ -1643,18 +1596,15 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream,
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
int rc; int rc;
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_trigger [%s] cmd=%d\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_trigger [%s] cmd=%d\n", stateName[korg1212->cardState], cmd); stateName[korg1212->cardState], cmd);
#endif
spin_lock(&korg1212->lock); spin_lock(&korg1212->lock);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
/* /*
if (korg1212->running) { if (korg1212->running) {
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_trigger: Already running?\n");
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_trigger: Already running?\n");
#endif
break; break;
} }
*/ */
...@@ -1665,9 +1615,7 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream, ...@@ -1665,9 +1615,7 @@ static int snd_korg1212_trigger(snd_pcm_substream_t *substream,
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
/* /*
if (!korg1212->running) { if (!korg1212->running) {
#if K1212_DEBUG_LEVEL > 1 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_trigger: Already stopped?\n");
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_trigger: Already stopped?\n");
#endif
break; break;
} }
*/ */
...@@ -1690,10 +1638,8 @@ static snd_pcm_uframes_t snd_korg1212_playback_pointer(snd_pcm_substream_t *subs ...@@ -1690,10 +1638,8 @@ static snd_pcm_uframes_t snd_korg1212_playback_pointer(snd_pcm_substream_t *subs
pos = korg1212->currentBuffer * kPlayBufferFrames; pos = korg1212->currentBuffer * kPlayBufferFrames;
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_pointer [%s] %ld\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_pointer [%s] %ld\n", stateName[korg1212->cardState], pos);
stateName[korg1212->cardState], pos);
#endif
return pos; return pos;
} }
...@@ -1705,10 +1651,8 @@ static snd_pcm_uframes_t snd_korg1212_capture_pointer(snd_pcm_substream_t *subst ...@@ -1705,10 +1651,8 @@ static snd_pcm_uframes_t snd_korg1212_capture_pointer(snd_pcm_substream_t *subst
pos = korg1212->currentBuffer * kPlayBufferFrames; pos = korg1212->currentBuffer * kPlayBufferFrames;
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_capture_pointer [%s] %ld\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_pointer [%s] %ld\n", stateName[korg1212->cardState], pos);
stateName[korg1212->cardState], pos);
#endif
return pos; return pos;
} }
...@@ -1721,9 +1665,8 @@ static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream, ...@@ -1721,9 +1665,8 @@ static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream,
{ {
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_copy [%s] %ld %ld\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_copy [%s] %ld %ld\n", stateName[korg1212->cardState], pos, count); stateName[korg1212->cardState], pos, count);
#endif
return snd_korg1212_copy_from(korg1212, src, pos, count, 0, korg1212->channels * 2); return snd_korg1212_copy_from(korg1212, src, pos, count, 0, korg1212->channels * 2);
...@@ -1736,9 +1679,8 @@ static int snd_korg1212_playback_silence(snd_pcm_substream_t *substream, ...@@ -1736,9 +1679,8 @@ static int snd_korg1212_playback_silence(snd_pcm_substream_t *substream,
{ {
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
#if K1212_DEBUG_LEVEL > 0 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_playback_silence [%s]\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_playback_silence [%s]\n", stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
return snd_korg1212_silence(korg1212, pos, count, 0, korg1212->channels * 2); return snd_korg1212_silence(korg1212, pos, count, 0, korg1212->channels * 2);
} }
...@@ -1751,9 +1693,8 @@ static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream, ...@@ -1751,9 +1693,8 @@ static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream,
{ {
korg1212_t *korg1212 = snd_pcm_substream_chip(substream); korg1212_t *korg1212 = snd_pcm_substream_chip(substream);
#if K1212_DEBUG_LEVEL > 2 K1212_DEBUG_PRINTK_VERBOSE("K1212_DEBUG: snd_korg1212_capture_copy [%s] %ld %ld\n",
K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_capture_copy [%s] %ld %ld\n", stateName[korg1212->cardState], pos, count); stateName[korg1212->cardState], pos, count);
#endif
return snd_korg1212_copy_to(korg1212, dst, pos, count, 0, korg1212->channels * 2); return snd_korg1212_copy_to(korg1212, dst, pos, count, 0, korg1212->channels * 2);
} }
...@@ -2145,7 +2086,7 @@ snd_korg1212_free(korg1212_t *korg1212) ...@@ -2145,7 +2086,7 @@ snd_korg1212_free(korg1212_t *korg1212)
if (korg1212->irq >= 0) { if (korg1212->irq >= 0) {
synchronize_irq(korg1212->irq); synchronize_irq(korg1212->irq);
snd_korg1212_DisableCardInterrupts(korg1212); snd_korg1212_DisableCardInterrupts(korg1212);
free_irq(korg1212->irq, (void *)korg1212); free_irq(korg1212->irq, korg1212);
korg1212->irq = -1; korg1212->irq = -1;
} }
...@@ -2197,9 +2138,7 @@ snd_korg1212_free(korg1212_t *korg1212) ...@@ -2197,9 +2138,7 @@ snd_korg1212_free(korg1212_t *korg1212)
static int snd_korg1212_dev_free(snd_device_t *device) static int snd_korg1212_dev_free(snd_device_t *device)
{ {
korg1212_t *korg1212 = device->device_data; korg1212_t *korg1212 = device->device_data;
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: Freeing device\n"); K1212_DEBUG_PRINTK("K1212_DEBUG: Freeing device\n");
#endif
return snd_korg1212_free(korg1212); return snd_korg1212_free(korg1212);
} }
...@@ -2207,7 +2146,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2207,7 +2146,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212_t ** rchip) korg1212_t ** rchip)
{ {
int err; int err, rc;
unsigned int i; unsigned int i;
unsigned ioport_size, iomem_size, iomem2_size; unsigned ioport_size, iomem_size, iomem2_size;
korg1212_t * korg1212; korg1212_t * korg1212;
...@@ -2270,7 +2209,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2270,7 +2209,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
ioport_size = pci_resource_len(korg1212->pci, 1); ioport_size = pci_resource_len(korg1212->pci, 1);
iomem2_size = pci_resource_len(korg1212->pci, 2); iomem2_size = pci_resource_len(korg1212->pci, 2);
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: resources:\n" K1212_DEBUG_PRINTK("K1212_DEBUG: resources:\n"
" iomem = 0x%lx (%d)\n" " iomem = 0x%lx (%d)\n"
" ioport = 0x%lx (%d)\n" " ioport = 0x%lx (%d)\n"
...@@ -2280,7 +2218,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2280,7 +2218,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->ioport, ioport_size, korg1212->ioport, ioport_size,
korg1212->iomem2, iomem2_size, korg1212->iomem2, iomem2_size,
stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
if ((korg1212->iobase = ioremap(korg1212->iomem, iomem_size)) == NULL) { if ((korg1212->iobase = ioremap(korg1212->iomem, iomem_size)) == NULL) {
snd_printk(KERN_ERR "korg1212: unable to remap memory region 0x%lx-0x%lx\n", korg1212->iomem, snd_printk(KERN_ERR "korg1212: unable to remap memory region 0x%lx-0x%lx\n", korg1212->iomem,
...@@ -2291,7 +2228,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2291,7 +2228,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
err = request_irq(pci->irq, snd_korg1212_interrupt, err = request_irq(pci->irq, snd_korg1212_interrupt,
SA_INTERRUPT|SA_SHIRQ, SA_INTERRUPT|SA_SHIRQ,
"korg1212", (void *) korg1212); "korg1212", korg1212);
if (err) { if (err) {
snd_printk(KERN_ERR "korg1212: unable to grab IRQ %d\n", pci->irq); snd_printk(KERN_ERR "korg1212: unable to grab IRQ %d\n", pci->irq);
...@@ -2314,7 +2251,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2314,7 +2251,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->sensRegPtr = (u16 __iomem *) (korg1212->iobase + SENS_CONTROL_OFFSET); korg1212->sensRegPtr = (u16 __iomem *) (korg1212->iobase + SENS_CONTROL_OFFSET);
korg1212->idRegPtr = (u32 __iomem *) (korg1212->iobase + DEV_VEND_ID_OFFSET); korg1212->idRegPtr = (u32 __iomem *) (korg1212->iobase + DEV_VEND_ID_OFFSET);
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: card registers:\n" K1212_DEBUG_PRINTK("K1212_DEBUG: card registers:\n"
" Status register = 0x%p\n" " Status register = 0x%p\n"
" OutDoorbell = 0x%p\n" " OutDoorbell = 0x%p\n"
...@@ -2338,7 +2274,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2338,7 +2274,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->sensRegPtr, korg1212->sensRegPtr,
korg1212->idRegPtr, korg1212->idRegPtr,
stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
sizeof(KorgSharedBuffer), &korg1212->dma_shared) < 0) { sizeof(KorgSharedBuffer), &korg1212->dma_shared) < 0) {
...@@ -2349,9 +2284,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2349,9 +2284,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->sharedBufferPtr = (KorgSharedBuffer *)korg1212->dma_shared.area; korg1212->sharedBufferPtr = (KorgSharedBuffer *)korg1212->dma_shared.area;
korg1212->sharedBufferPhy = korg1212->dma_shared.addr; korg1212->sharedBufferPhy = korg1212->dma_shared.addr;
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: Shared Buffer Area = 0x%p (0x%08lx), %d bytes\n", korg1212->sharedBufferPtr, korg1212->sharedBufferPhy, sizeof(KorgSharedBuffer)); K1212_DEBUG_PRINTK("K1212_DEBUG: Shared Buffer Area = 0x%p (0x%08lx), %d bytes\n", korg1212->sharedBufferPtr, korg1212->sharedBufferPhy, sizeof(KorgSharedBuffer));
#endif
#ifndef K1212_LARGEALLOC #ifndef K1212_LARGEALLOC
...@@ -2366,10 +2299,8 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2366,10 +2299,8 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->playDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_play.area; korg1212->playDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_play.area;
korg1212->PlayDataPhy = korg1212->dma_play.addr; korg1212->PlayDataPhy = korg1212->dma_play.addr;
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: Play Data Area = 0x%p (0x%08x), %d bytes\n", K1212_DEBUG_PRINTK("K1212_DEBUG: Play Data Area = 0x%p (0x%08x), %d bytes\n",
korg1212->playDataBufsPtr, korg1212->PlayDataPhy, korg1212->DataBufsSize); korg1212->playDataBufsPtr, korg1212->PlayDataPhy, korg1212->DataBufsSize);
#endif
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
korg1212->DataBufsSize, &korg1212->dma_rec) < 0) { korg1212->DataBufsSize, &korg1212->dma_rec) < 0) {
...@@ -2380,10 +2311,8 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2380,10 +2311,8 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->recordDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_rec.area; korg1212->recordDataBufsPtr = (KorgAudioBuffer *)korg1212->dma_rec.area;
korg1212->RecDataPhy = korg1212->dma_rec.addr; korg1212->RecDataPhy = korg1212->dma_rec.addr;
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: Record Data Area = 0x%p (0x%08x), %d bytes\n", K1212_DEBUG_PRINTK("K1212_DEBUG: Record Data Area = 0x%p (0x%08x), %d bytes\n",
korg1212->recordDataBufsPtr, korg1212->RecDataPhy, korg1212->DataBufsSize); korg1212->recordDataBufsPtr, korg1212->RecDataPhy, korg1212->DataBufsSize);
#endif
#else // K1212_LARGEALLOC #else // K1212_LARGEALLOC
...@@ -2410,17 +2339,14 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2410,17 +2339,14 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
return -ENOMEM; return -ENOMEM;
} }
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n", K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n",
korg1212->dma_dsp.area, korg1212->dma_dsp.addr, korg1212->dspCodeSize, korg1212->dma_dsp.area, korg1212->dma_dsp.addr, korg1212->dspCodeSize,
stateName[korg1212->cardState]); stateName[korg1212->cardState]);
#endif
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_RebootCard, 0, 0, 0, 0); rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_RebootCard, 0, 0, 0, 0);
#if K1212_DEBUG_LEVEL > 0 if (rc)
if (rc) K1212_DEBUG_PRINTK("K1212_DEBUG: Reboot Card - RC = %d [%s]\n", rc, stateName[korg1212->cardState]); K1212_DEBUG_PRINTK("K1212_DEBUG: Reboot Card - RC = %d [%s]\n", rc, stateName[korg1212->cardState]);
#endif
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, korg1212, &ops)) < 0) { if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, korg1212, &ops)) < 0) {
snd_korg1212_free(korg1212); snd_korg1212_free(korg1212);
...@@ -2434,8 +2360,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2434,8 +2360,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
if (snd_korg1212_downloadDSPCode(korg1212)) if (snd_korg1212_downloadDSPCode(korg1212))
return -EBUSY; return -EBUSY;
snd_printk(KERN_ERR K1212_DEBUG_PRINTK("korg1212: dspMemPhy = %08x U[%08x], "
"korg1212: dspMemPhy = %08x U[%08x], "
"PlayDataPhy = %08x L[%08x]\n" "PlayDataPhy = %08x L[%08x]\n"
"korg1212: RecDataPhy = %08x L[%08x], " "korg1212: RecDataPhy = %08x L[%08x], "
"VolumeTablePhy = %08x L[%08x]\n" "VolumeTablePhy = %08x L[%08x]\n"
...@@ -2461,9 +2386,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci, ...@@ -2461,9 +2386,6 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
korg1212->pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; korg1212->pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
//snd_pcm_lib_preallocate_pages_for_all(korg1212->pcm,
// K1212_MAX_BUF_SIZE, K1212_MAX_BUF_SIZE, GFP_KERNEL);
for (i = 0; i < ARRAY_SIZE(snd_korg1212_controls); i++) { for (i = 0; i < ARRAY_SIZE(snd_korg1212_controls); i++) {
err = snd_ctl_add(korg1212->card, snd_ctl_new1(&snd_korg1212_controls[i], korg1212)); err = snd_ctl_add(korg1212->card, snd_ctl_new1(&snd_korg1212_controls[i], korg1212));
if (err < 0) if (err < 0)
...@@ -2513,9 +2435,7 @@ snd_korg1212_probe(struct pci_dev *pci, ...@@ -2513,9 +2435,7 @@ snd_korg1212_probe(struct pci_dev *pci,
sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname, sprintf(card->longname, "%s at 0x%lx, irq %d", card->shortname,
korg1212->iomem, korg1212->irq); korg1212->iomem, korg1212->irq);
#if K1212_DEBUG_LEVEL > 0
K1212_DEBUG_PRINTK("K1212_DEBUG: %s\n", card->longname); K1212_DEBUG_PRINTK("K1212_DEBUG: %s\n", card->longname);
#endif
if ((err = snd_card_register(card)) < 0) { if ((err = snd_card_register(card)) < 0) {
snd_card_free(card); snd_card_free(card);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment