[ALSA] dbri: driver cleanup
This patch fixes white spaces, spelling and formatting to conform closer to the coding standard of the kernel. It contains few fixes pointed out by the checkpatch.pl script. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
committed by
Jaroslav Kysela
parent
189609ae1e
commit
098ccbc558
@@ -9,17 +9,17 @@
|
|||||||
* Copyright (C) 1998, 1999 Brent Baccala (baccala@freesoft.org)
|
* Copyright (C) 1998, 1999 Brent Baccala (baccala@freesoft.org)
|
||||||
*
|
*
|
||||||
* This is the low level driver for the DBRI & MMCODEC duo used for ISDN & AUDIO
|
* This is the low level driver for the DBRI & MMCODEC duo used for ISDN & AUDIO
|
||||||
* on Sun SPARCstation 10, 20, LX and Voyager models.
|
* on Sun SPARCStation 10, 20, LX and Voyager models.
|
||||||
*
|
*
|
||||||
* - DBRI: AT&T T5900FX Dual Basic Rates ISDN Interface. It is a 32 channel
|
* - DBRI: AT&T T5900FX Dual Basic Rates ISDN Interface. It is a 32 channel
|
||||||
* data time multiplexer with ISDN support (aka T7259)
|
* data time multiplexer with ISDN support (aka T7259)
|
||||||
* Interfaces: SBus,ISDN NT & TE, CHI, 4 bits parallel.
|
* Interfaces: SBus,ISDN NT & TE, CHI, 4 bits parallel.
|
||||||
* CHI: (spelled ki) Concentration Highway Interface (AT&T or Intel bus ?).
|
* CHI: (spelled ki) Concentration Highway Interface (AT&T or Intel bus ?).
|
||||||
* Documentation:
|
* Documentation:
|
||||||
* - "STP 4000SBus Dual Basic Rate ISDN (DBRI) Tranceiver" from
|
* - "STP 4000SBus Dual Basic Rate ISDN (DBRI) Transceiver" from
|
||||||
* Sparc Technology Business (courtesy of Sun Support)
|
* Sparc Technology Business (courtesy of Sun Support)
|
||||||
* - Data sheet of the T7903, a newer but very similar ISA bus equivalent
|
* - Data sheet of the T7903, a newer but very similar ISA bus equivalent
|
||||||
* available from the Lucent (formarly AT&T microelectronics) home
|
* available from the Lucent (formerly AT&T microelectronics) home
|
||||||
* page.
|
* page.
|
||||||
* - http://www.freesoft.org/Linux/DBRI/
|
* - http://www.freesoft.org/Linux/DBRI/
|
||||||
* - MMCODEC: Crystal Semiconductor CS4215 16 bit Multimedia Audio Codec
|
* - MMCODEC: Crystal Semiconductor CS4215 16 bit Multimedia Audio Codec
|
||||||
@@ -27,10 +27,10 @@
|
|||||||
* Documentation: from the Crystal Semiconductor home page.
|
* Documentation: from the Crystal Semiconductor home page.
|
||||||
*
|
*
|
||||||
* The DBRI is a 32 pipe machine, each pipe can transfer some bits between
|
* The DBRI is a 32 pipe machine, each pipe can transfer some bits between
|
||||||
* memory and a serial device (long pipes, nr 0-15) or between two serial
|
* memory and a serial device (long pipes, no. 0-15) or between two serial
|
||||||
* devices (short pipes, nr 16-31), or simply send a fixed data to a serial
|
* devices (short pipes, no. 16-31), or simply send a fixed data to a serial
|
||||||
* device (short pipes).
|
* device (short pipes).
|
||||||
* A timeslot defines the bit-offset and nr of bits read from a serial device.
|
* A timeslot defines the bit-offset and no. of bits read from a serial device.
|
||||||
* The timeslots are linked to 6 circular lists, one for each direction for
|
* The timeslots are linked to 6 circular lists, one for each direction for
|
||||||
* each serial device (NT,TE,CHI). A timeslot is associated to 1 or 2 pipes
|
* each serial device (NT,TE,CHI). A timeslot is associated to 1 or 2 pipes
|
||||||
* (the second one is a monitor/tee pipe, valid only for serial input).
|
* (the second one is a monitor/tee pipe, valid only for serial input).
|
||||||
@@ -40,8 +40,8 @@
|
|||||||
* chunks. It also has a control mode, which serves for audio format setting.
|
* chunks. It also has a control mode, which serves for audio format setting.
|
||||||
*
|
*
|
||||||
* Looking at the CS4215 data sheet it is easy to set up 2 or 4 codecs on
|
* Looking at the CS4215 data sheet it is easy to set up 2 or 4 codecs on
|
||||||
* the same CHI bus, so I thought perhaps it is possible to use the onboard
|
* the same CHI bus, so I thought perhaps it is possible to use the on-board
|
||||||
* & the speakerbox codec simultanously, giving 2 (not very independent :-)
|
* & the speakerbox codec simultaneously, giving 2 (not very independent :-)
|
||||||
* audio devices. But the SUN HW group decided against it, at least on my
|
* audio devices. But the SUN HW group decided against it, at least on my
|
||||||
* LX the speakerbox connector has at least 1 pin missing and 1 wrongly
|
* LX the speakerbox connector has at least 1 pin missing and 1 wrongly
|
||||||
* connected.
|
* connected.
|
||||||
@@ -56,6 +56,8 @@
|
|||||||
#include <sound/driver.h>
|
#include <sound/driver.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/irq.h>
|
||||||
|
#include <linux/io.h>
|
||||||
|
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
@@ -64,8 +66,6 @@
|
|||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
#include <sound/initval.h>
|
#include <sound/initval.h>
|
||||||
|
|
||||||
#include <asm/irq.h>
|
|
||||||
#include <asm/io.h>
|
|
||||||
#include <asm/sbus.h>
|
#include <asm/sbus.h>
|
||||||
#include <asm/atomic.h>
|
#include <asm/atomic.h>
|
||||||
|
|
||||||
@@ -76,7 +76,8 @@ MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}");
|
|||||||
|
|
||||||
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
||||||
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
||||||
static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
|
/* Enable this card */
|
||||||
|
static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
|
||||||
|
|
||||||
module_param_array(index, int, NULL, 0444);
|
module_param_array(index, int, NULL, 0444);
|
||||||
MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard.");
|
MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard.");
|
||||||
@@ -285,7 +286,7 @@ struct dbri_pipe {
|
|||||||
/* Per stream (playback or record) information */
|
/* Per stream (playback or record) information */
|
||||||
struct dbri_streaminfo {
|
struct dbri_streaminfo {
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
u32 dvma_buffer; /* Device view of Alsa DMA buffer */
|
u32 dvma_buffer; /* Device view of ALSA DMA buffer */
|
||||||
int size; /* Size of DMA buffer */
|
int size; /* Size of DMA buffer */
|
||||||
size_t offset; /* offset in user buffer */
|
size_t offset; /* offset in user buffer */
|
||||||
int pipe; /* Data pipe used */
|
int pipe; /* Data pipe used */
|
||||||
@@ -376,11 +377,11 @@ struct snd_dbri {
|
|||||||
#define D_CDM 0xe /* CHI Data mode command */
|
#define D_CDM 0xe /* CHI Data mode command */
|
||||||
|
|
||||||
/* Special bits for some commands */
|
/* Special bits for some commands */
|
||||||
#define D_PIPE(v) ((v)<<0) /* Pipe Nr: 0-15 long, 16-21 short */
|
#define D_PIPE(v) ((v)<<0) /* Pipe No.: 0-15 long, 16-21 short */
|
||||||
|
|
||||||
/* Setup Data Pipe */
|
/* Setup Data Pipe */
|
||||||
/* IRM */
|
/* IRM */
|
||||||
#define D_SDP_2SAME (1<<18) /* Report 2nd time in a row value rcvd */
|
#define D_SDP_2SAME (1<<18) /* Report 2nd time in a row value received */
|
||||||
#define D_SDP_CHANGE (2<<18) /* Report any changes */
|
#define D_SDP_CHANGE (2<<18) /* Report any changes */
|
||||||
#define D_SDP_EVERY (3<<18) /* Report any changes */
|
#define D_SDP_EVERY (3<<18) /* Report any changes */
|
||||||
#define D_SDP_EOL (1<<17) /* EOL interrupt enable */
|
#define D_SDP_EOL (1<<17) /* EOL interrupt enable */
|
||||||
@@ -419,7 +420,7 @@ struct snd_dbri {
|
|||||||
#define D_TS_NONCONTIG (3<<10) /* Non contiguous mode */
|
#define D_TS_NONCONTIG (3<<10) /* Non contiguous mode */
|
||||||
#define D_TS_ANCHOR (7<<10) /* Starting short pipes */
|
#define D_TS_ANCHOR (7<<10) /* Starting short pipes */
|
||||||
#define D_TS_MON(v) ((v)<<5) /* Monitor Pipe */
|
#define D_TS_MON(v) ((v)<<5) /* Monitor Pipe */
|
||||||
#define D_TS_NEXT(v) ((v)<<0) /* Pipe Nr: 0-15 long, 16-21 short */
|
#define D_TS_NEXT(v) ((v)<<0) /* Pipe no.: 0-15 long, 16-21 short */
|
||||||
|
|
||||||
/* Concentration Highway Interface Modes */
|
/* Concentration Highway Interface Modes */
|
||||||
#define D_CHI_CHICM(v) ((v)<<16) /* Clock mode */
|
#define D_CHI_CHICM(v) ((v)<<16) /* Clock mode */
|
||||||
@@ -435,7 +436,7 @@ struct snd_dbri {
|
|||||||
#define D_NT_NBF (1<<16) /* Number of bad frames to loose framing */
|
#define D_NT_NBF (1<<16) /* Number of bad frames to loose framing */
|
||||||
#define D_NT_IRM_IMM (1<<15) /* Interrupt Report & Mask: Immediate */
|
#define D_NT_IRM_IMM (1<<15) /* Interrupt Report & Mask: Immediate */
|
||||||
#define D_NT_IRM_EN (1<<14) /* Interrupt Report & Mask: Enable */
|
#define D_NT_IRM_EN (1<<14) /* Interrupt Report & Mask: Enable */
|
||||||
#define D_NT_ISNT (1<<13) /* Configfure interface as NT */
|
#define D_NT_ISNT (1<<13) /* Configure interface as NT */
|
||||||
#define D_NT_FT (1<<12) /* Fixed Timing */
|
#define D_NT_FT (1<<12) /* Fixed Timing */
|
||||||
#define D_NT_EZ (1<<11) /* Echo Channel is Zeros */
|
#define D_NT_EZ (1<<11) /* Echo Channel is Zeros */
|
||||||
#define D_NT_IFA (1<<10) /* Inhibit Final Activation */
|
#define D_NT_IFA (1<<10) /* Inhibit Final Activation */
|
||||||
@@ -455,7 +456,7 @@ struct snd_dbri {
|
|||||||
#define D_TEST_RAM(v) ((v)<<16) /* RAM Pointer */
|
#define D_TEST_RAM(v) ((v)<<16) /* RAM Pointer */
|
||||||
#define D_TEST_SIZE(v) ((v)<<11) /* */
|
#define D_TEST_SIZE(v) ((v)<<11) /* */
|
||||||
#define D_TEST_ROMONOFF 0x5 /* Toggle ROM opcode monitor on/off */
|
#define D_TEST_ROMONOFF 0x5 /* Toggle ROM opcode monitor on/off */
|
||||||
#define D_TEST_PROC 0x6 /* MicroProcessor test */
|
#define D_TEST_PROC 0x6 /* Microprocessor test */
|
||||||
#define D_TEST_SER 0x7 /* Serial-Controller test */
|
#define D_TEST_SER 0x7 /* Serial-Controller test */
|
||||||
#define D_TEST_RAMREAD 0x8 /* Copy from Ram to system memory */
|
#define D_TEST_RAMREAD 0x8 /* Copy from Ram to system memory */
|
||||||
#define D_TEST_RAMWRITE 0x9 /* Copy into Ram from system memory */
|
#define D_TEST_RAMWRITE 0x9 /* Copy into Ram from system memory */
|
||||||
@@ -544,7 +545,7 @@ struct snd_dbri {
|
|||||||
#define DBRI_TD_ABT (1 << 2) /* Abort: frame aborted */
|
#define DBRI_TD_ABT (1 << 2) /* Abort: frame aborted */
|
||||||
#define DBRI_TD_TBC (1 << 0) /* Transmit buffer Complete */
|
#define DBRI_TD_TBC (1 << 0) /* Transmit buffer Complete */
|
||||||
#define DBRI_TD_STATUS(v) ((v) & 0xff) /* Transmit status */
|
#define DBRI_TD_STATUS(v) ((v) & 0xff) /* Transmit status */
|
||||||
/* Maximum buffer size per TD: almost 8Kb */
|
/* Maximum buffer size per TD: almost 8KB */
|
||||||
#define DBRI_TD_MAXCNT ((1 << 13) - 4)
|
#define DBRI_TD_MAXCNT ((1 << 13) - 4)
|
||||||
|
|
||||||
/* Receive descriptor defines */
|
/* Receive descriptor defines */
|
||||||
@@ -567,7 +568,8 @@ struct snd_dbri {
|
|||||||
SNDRV_PCM_STREAM_PLAYBACK? DBRI_PLAY: DBRI_REC)
|
SNDRV_PCM_STREAM_PLAYBACK? DBRI_PLAY: DBRI_REC)
|
||||||
|
|
||||||
/* Return a pointer to dbri_streaminfo */
|
/* Return a pointer to dbri_streaminfo */
|
||||||
#define DBRI_STREAM(dbri, substream) &dbri->stream_info[DBRI_STREAMNO(substream)]
|
#define DBRI_STREAM(dbri, substream) \
|
||||||
|
&dbri->stream_info[DBRI_STREAMNO(substream)]
|
||||||
|
|
||||||
static struct snd_dbri *dbri_list; /* All DBRI devices */
|
static struct snd_dbri *dbri_list; /* All DBRI devices */
|
||||||
|
|
||||||
@@ -700,16 +702,17 @@ static void dbri_cmdsend(struct snd_dbri * dbri, s32 * cmd,int len)
|
|||||||
s32 *ptr;
|
s32 *ptr;
|
||||||
|
|
||||||
for (ptr = dbri->cmdptr; ptr < cmd+2; ptr++)
|
for (ptr = dbri->cmdptr; ptr < cmd+2; ptr++)
|
||||||
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
|
dprintk(D_CMD, "cmd: %lx:%08x\n",
|
||||||
|
(unsigned long)ptr, *ptr);
|
||||||
} else {
|
} else {
|
||||||
s32 *ptr = dbri->cmdptr;
|
s32 *ptr = dbri->cmdptr;
|
||||||
|
|
||||||
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
|
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
|
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
|
||||||
for (ptr = dbri->dma->cmd; ptr < cmd+2; ptr++) {
|
for (ptr = dbri->dma->cmd; ptr < cmd+2; ptr++)
|
||||||
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
|
dprintk(D_CMD, "cmd: %lx:%08x\n",
|
||||||
}
|
(unsigned long)ptr, *ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -818,13 +821,15 @@ static void reset_pipe(struct snd_dbri * dbri, int pipe)
|
|||||||
s32 *cmd;
|
s32 *cmd;
|
||||||
|
|
||||||
if (pipe < 0 || pipe > DBRI_MAX_PIPE) {
|
if (pipe < 0 || pipe > DBRI_MAX_PIPE) {
|
||||||
printk(KERN_ERR "DBRI: reset_pipe called with illegal pipe number\n");
|
printk(KERN_ERR "DBRI: reset_pipe called with "
|
||||||
|
"illegal pipe number\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdp = dbri->pipes[pipe].sdp;
|
sdp = dbri->pipes[pipe].sdp;
|
||||||
if (sdp == 0) {
|
if (sdp == 0) {
|
||||||
printk(KERN_ERR "DBRI: reset_pipe called on uninitialized pipe\n");
|
printk(KERN_ERR "DBRI: reset_pipe called "
|
||||||
|
"on uninitialized pipe\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -837,7 +842,8 @@ static void reset_pipe(struct snd_dbri * dbri, int pipe)
|
|||||||
desc = dbri->pipes[pipe].first_desc;
|
desc = dbri->pipes[pipe].first_desc;
|
||||||
if (desc >= 0)
|
if (desc >= 0)
|
||||||
do {
|
do {
|
||||||
dbri->dma->desc[desc].nda = dbri->dma->desc[desc].ba = 0;
|
dbri->dma->desc[desc].ba = 0;
|
||||||
|
dbri->dma->desc[desc].nda = 0;
|
||||||
desc = dbri->next_desc[desc];
|
desc = dbri->next_desc[desc];
|
||||||
} while (desc != -1 && desc != dbri->pipes[pipe].first_desc);
|
} while (desc != -1 && desc != dbri->pipes[pipe].first_desc);
|
||||||
|
|
||||||
@@ -851,12 +857,14 @@ static void reset_pipe(struct snd_dbri * dbri, int pipe)
|
|||||||
static void setup_pipe(struct snd_dbri *dbri, int pipe, int sdp)
|
static void setup_pipe(struct snd_dbri *dbri, int pipe, int sdp)
|
||||||
{
|
{
|
||||||
if (pipe < 0 || pipe > DBRI_MAX_PIPE) {
|
if (pipe < 0 || pipe > DBRI_MAX_PIPE) {
|
||||||
printk(KERN_ERR "DBRI: setup_pipe called with illegal pipe number\n");
|
printk(KERN_ERR "DBRI: setup_pipe called "
|
||||||
|
"with illegal pipe number\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sdp & 0xf800) != sdp) {
|
if ((sdp & 0xf800) != sdp) {
|
||||||
printk(KERN_ERR "DBRI: setup_pipe called with strange SDP value\n");
|
printk(KERN_ERR "DBRI: setup_pipe called "
|
||||||
|
"with strange SDP value\n");
|
||||||
/* sdp &= 0xf800; */
|
/* sdp &= 0xf800; */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,7 +903,8 @@ static void link_time_slot(struct snd_dbri * dbri, int pipe,
|
|||||||
if (dbri->pipes[pipe].sdp == 0
|
if (dbri->pipes[pipe].sdp == 0
|
||||||
|| dbri->pipes[prevpipe].sdp == 0
|
|| dbri->pipes[prevpipe].sdp == 0
|
||||||
|| dbri->pipes[nextpipe].sdp == 0) {
|
|| dbri->pipes[nextpipe].sdp == 0) {
|
||||||
printk(KERN_ERR "DBRI: link_time_slot called on uninitialized pipe\n");
|
printk(KERN_ERR "DBRI: link_time_slot called "
|
||||||
|
"on uninitialized pipe\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -996,7 +1005,8 @@ static void xmit_fixed(struct snd_dbri * dbri, int pipe, unsigned int data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) {
|
if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) {
|
||||||
printk(KERN_ERR "DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe);
|
printk(KERN_ERR "DBRI: xmit_fixed: "
|
||||||
|
"Uninitialized pipe %d\n", pipe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,7 +1016,8 @@ static void xmit_fixed(struct snd_dbri * dbri, int pipe, unsigned int data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) {
|
if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) {
|
||||||
printk(KERN_ERR "DBRI: xmit_fixed: Called on receive pipe %d\n", pipe);
|
printk(KERN_ERR "DBRI: xmit_fixed: Called on receive pipe %d\n",
|
||||||
|
pipe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1031,17 +1042,20 @@ static void xmit_fixed(struct snd_dbri * dbri, int pipe, unsigned int data)
|
|||||||
static void recv_fixed(struct snd_dbri *dbri, int pipe, volatile __u32 *ptr)
|
static void recv_fixed(struct snd_dbri *dbri, int pipe, volatile __u32 *ptr)
|
||||||
{
|
{
|
||||||
if (pipe < 16 || pipe > DBRI_MAX_PIPE) {
|
if (pipe < 16 || pipe > DBRI_MAX_PIPE) {
|
||||||
printk(KERN_ERR "DBRI: recv_fixed called with illegal pipe number\n");
|
printk(KERN_ERR "DBRI: recv_fixed called with "
|
||||||
|
"illegal pipe number\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
|
if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
|
||||||
printk(KERN_ERR "DBRI: recv_fixed called on non-fixed pipe %d\n", pipe);
|
printk(KERN_ERR "DBRI: recv_fixed called on "
|
||||||
|
"non-fixed pipe %d\n", pipe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) {
|
if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) {
|
||||||
printk(KERN_ERR "DBRI: recv_fixed called on transmit pipe %d\n", pipe);
|
printk(KERN_ERR "DBRI: recv_fixed called on "
|
||||||
|
"transmit pipe %d\n", pipe);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,8 +1103,8 @@ static int setup_descs(struct snd_dbri * dbri, int streamno, unsigned int period
|
|||||||
|
|
||||||
if (streamno == DBRI_PLAY) {
|
if (streamno == DBRI_PLAY) {
|
||||||
if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) {
|
if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) {
|
||||||
printk(KERN_ERR "DBRI: setup_descs: Called on receive pipe %d\n",
|
printk(KERN_ERR "DBRI: setup_descs: "
|
||||||
info->pipe);
|
"Called on receive pipe %d\n", info->pipe);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1100,10 +1114,12 @@ static int setup_descs(struct snd_dbri * dbri, int streamno, unsigned int period
|
|||||||
info->pipe);
|
info->pipe);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
/* Should be able to queue multiple buffers to receive on a pipe */
|
/* Should be able to queue multiple buffers
|
||||||
|
* to receive on a pipe
|
||||||
|
*/
|
||||||
if (pipe_active(dbri, info->pipe)) {
|
if (pipe_active(dbri, info->pipe)) {
|
||||||
printk(KERN_ERR "DBRI: recv_on_pipe: Called on active pipe %d\n",
|
printk(KERN_ERR "DBRI: recv_on_pipe: "
|
||||||
info->pipe);
|
"Called on active pipe %d\n", info->pipe);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1115,9 +1131,11 @@ static int setup_descs(struct snd_dbri * dbri, int streamno, unsigned int period
|
|||||||
desc = dbri->pipes[info->pipe].first_desc;
|
desc = dbri->pipes[info->pipe].first_desc;
|
||||||
if (desc >= 0)
|
if (desc >= 0)
|
||||||
do {
|
do {
|
||||||
dbri->dma->desc[desc].nda = dbri->dma->desc[desc].ba = 0;
|
dbri->dma->desc[desc].ba = 0;
|
||||||
|
dbri->dma->desc[desc].nda = 0;
|
||||||
desc = dbri->next_desc[desc];
|
desc = dbri->next_desc[desc];
|
||||||
} while (desc != -1 && desc != dbri->pipes[info->pipe].first_desc);
|
} while (desc != -1 &&
|
||||||
|
desc != dbri->pipes[info->pipe].first_desc);
|
||||||
|
|
||||||
dbri->pipes[info->pipe].desc = -1;
|
dbri->pipes[info->pipe].desc = -1;
|
||||||
dbri->pipes[info->pipe].first_desc = -1;
|
dbri->pipes[info->pipe].first_desc = -1;
|
||||||
@@ -1150,8 +1168,7 @@ static int setup_descs(struct snd_dbri * dbri, int streamno, unsigned int period
|
|||||||
if (streamno == DBRI_PLAY) {
|
if (streamno == DBRI_PLAY) {
|
||||||
dbri->dma->desc[desc].word1 = DBRI_TD_CNT(mylen);
|
dbri->dma->desc[desc].word1 = DBRI_TD_CNT(mylen);
|
||||||
dbri->dma->desc[desc].word4 = 0;
|
dbri->dma->desc[desc].word4 = 0;
|
||||||
dbri->dma->desc[desc].word1 |=
|
dbri->dma->desc[desc].word1 |= DBRI_TD_F | DBRI_TD_B;
|
||||||
DBRI_TD_F | DBRI_TD_B;
|
|
||||||
} else {
|
} else {
|
||||||
dbri->dma->desc[desc].word1 = 0;
|
dbri->dma->desc[desc].word1 = 0;
|
||||||
dbri->dma->desc[desc].word4 =
|
dbri->dma->desc[desc].word4 =
|
||||||
@@ -1172,7 +1189,8 @@ static int setup_descs(struct snd_dbri * dbri, int streamno, unsigned int period
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (first_desc == -1 || last_desc == -1) {
|
if (first_desc == -1 || last_desc == -1) {
|
||||||
printk(KERN_ERR "DBRI: setup_descs: Not enough descriptors available\n");
|
printk(KERN_ERR "DBRI: setup_descs: "
|
||||||
|
" Not enough descriptors available\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1213,7 +1231,8 @@ enum master_or_slave { CHImaster, CHIslave };
|
|||||||
/*
|
/*
|
||||||
* Lock must not be held before calling it.
|
* Lock must not be held before calling it.
|
||||||
*/
|
*/
|
||||||
static void reset_chi(struct snd_dbri * dbri, enum master_or_slave master_or_slave,
|
static void reset_chi(struct snd_dbri *dbri,
|
||||||
|
enum master_or_slave master_or_slave,
|
||||||
int bits_per_frame)
|
int bits_per_frame)
|
||||||
{
|
{
|
||||||
s32 *cmd;
|
s32 *cmd;
|
||||||
@@ -1254,7 +1273,8 @@ static void reset_chi(struct snd_dbri * dbri, enum master_or_slave master_or_sla
|
|||||||
int divisor = 12288 / clockrate;
|
int divisor = 12288 / clockrate;
|
||||||
|
|
||||||
if (divisor > 255 || divisor * clockrate != 12288)
|
if (divisor > 255 || divisor * clockrate != 12288)
|
||||||
printk(KERN_ERR "DBRI: illegal bits_per_frame in setup_chi\n");
|
printk(KERN_ERR "DBRI: illegal bits_per_frame "
|
||||||
|
"in setup_chi\n");
|
||||||
|
|
||||||
*(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD
|
*(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD
|
||||||
| D_CHI_BPF(bits_per_frame));
|
| D_CHI_BPF(bits_per_frame));
|
||||||
@@ -1522,9 +1542,9 @@ static int cs4215_setctrl(struct snd_dbri * dbri)
|
|||||||
sbus_writel(tmp, dbri->regs + REG0);
|
sbus_writel(tmp, dbri->regs + REG0);
|
||||||
spin_unlock_irqrestore(&dbri->lock, flags);
|
spin_unlock_irqrestore(&dbri->lock, flags);
|
||||||
|
|
||||||
for (i = 10; ((dbri->mm.status & 0xe4) != 0x20); --i) {
|
for (i = 10; ((dbri->mm.status & 0xe4) != 0x20); --i)
|
||||||
msleep_interruptible(1);
|
msleep_interruptible(1);
|
||||||
}
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n",
|
dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n",
|
||||||
dbri->mm.status);
|
dbri->mm.status);
|
||||||
@@ -1674,7 +1694,7 @@ interrupts are disabled.
|
|||||||
|
|
||||||
/* xmit_descs()
|
/* xmit_descs()
|
||||||
*
|
*
|
||||||
* Starts transmiting the current TD's for recording/playing.
|
* Starts transmitting the current TD's for recording/playing.
|
||||||
* For playback, ALSA has filled the DMA memory with new data (we hope).
|
* For playback, ALSA has filled the DMA memory with new data (we hope).
|
||||||
*/
|
*/
|
||||||
static void xmit_descs(struct snd_dbri *dbri)
|
static void xmit_descs(struct snd_dbri *dbri)
|
||||||
@@ -1701,7 +1721,8 @@ static void xmit_descs(struct snd_dbri *dbri)
|
|||||||
*(cmd++) = DBRI_CMD(D_SDP, 0,
|
*(cmd++) = DBRI_CMD(D_SDP, 0,
|
||||||
dbri->pipes[info->pipe].sdp
|
dbri->pipes[info->pipe].sdp
|
||||||
| D_SDP_P | D_SDP_EVERY | D_SDP_C);
|
| D_SDP_P | D_SDP_EVERY | D_SDP_C);
|
||||||
*(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
|
*(cmd++) = dbri->dma_dvma +
|
||||||
|
dbri_dma_off(desc, first_td);
|
||||||
dbri_cmdsend(dbri, cmd, 2);
|
dbri_cmdsend(dbri, cmd, 2);
|
||||||
|
|
||||||
/* Reset our admin of the pipe. */
|
/* Reset our admin of the pipe. */
|
||||||
@@ -1722,7 +1743,8 @@ static void xmit_descs(struct snd_dbri *dbri)
|
|||||||
*(cmd++) = DBRI_CMD(D_SDP, 0,
|
*(cmd++) = DBRI_CMD(D_SDP, 0,
|
||||||
dbri->pipes[info->pipe].sdp
|
dbri->pipes[info->pipe].sdp
|
||||||
| D_SDP_P | D_SDP_EVERY | D_SDP_C);
|
| D_SDP_P | D_SDP_EVERY | D_SDP_C);
|
||||||
*(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
|
*(cmd++) = dbri->dma_dvma +
|
||||||
|
dbri_dma_off(desc, first_td);
|
||||||
dbri_cmdsend(dbri, cmd, 2);
|
dbri_cmdsend(dbri, cmd, 2);
|
||||||
|
|
||||||
/* Reset our admin of the pipe. */
|
/* Reset our admin of the pipe. */
|
||||||
@@ -1763,9 +1785,8 @@ static void transmission_complete_intr(struct snd_dbri * dbri, int pipe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = DBRI_TD_STATUS(dbri->dma->desc[td].word4);
|
status = DBRI_TD_STATUS(dbri->dma->desc[td].word4);
|
||||||
if (!(status & DBRI_TD_TBC)) {
|
if (!(status & DBRI_TD_TBC))
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
dprintk(D_INT, "TD %d, status 0x%02x\n", td, status);
|
dprintk(D_INT, "TD %d, status 0x%02x\n", td, status);
|
||||||
|
|
||||||
@@ -2011,7 +2032,8 @@ static int snd_hw_rule_channels(struct snd_pcm_hw_params *params,
|
|||||||
|
|
||||||
snd_interval_any(&ch);
|
snd_interval_any(&ch);
|
||||||
if (!(f->bits[0] & SNDRV_PCM_FMTBIT_S16_BE)) {
|
if (!(f->bits[0] & SNDRV_PCM_FMTBIT_S16_BE)) {
|
||||||
ch.min = ch.max = 1;
|
ch.min = 1;
|
||||||
|
ch.max = 1;
|
||||||
ch.integer = 1;
|
ch.integer = 1;
|
||||||
return snd_interval_refine(c, &ch);
|
return snd_interval_refine(c, &ch);
|
||||||
}
|
}
|
||||||
@@ -2145,7 +2167,7 @@ static int snd_dbri_prepare(struct snd_pcm_substream *substream)
|
|||||||
spin_lock_irq(&dbri->lock);
|
spin_lock_irq(&dbri->lock);
|
||||||
info->offset = 0;
|
info->offset = 0;
|
||||||
|
|
||||||
/* Setup the all the transmit/receive desciptors to cover the
|
/* Setup the all the transmit/receive descriptors to cover the
|
||||||
* whole DMA buffer.
|
* whole DMA buffer.
|
||||||
*/
|
*/
|
||||||
ret = setup_descs(dbri, DBRI_STREAMNO(substream),
|
ret = setup_descs(dbri, DBRI_STREAMNO(substream),
|
||||||
@@ -2228,9 +2250,8 @@ static int __devinit snd_dbri_pcm(struct snd_dbri * dbri)
|
|||||||
if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm,
|
if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm,
|
||||||
SNDRV_DMA_TYPE_CONTINUOUS,
|
SNDRV_DMA_TYPE_CONTINUOUS,
|
||||||
snd_dma_continuous_data(GFP_KERNEL),
|
snd_dma_continuous_data(GFP_KERNEL),
|
||||||
64 * 1024, 64 * 1024)) < 0) {
|
64 * 1024, 64 * 1024)) < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2271,7 +2292,8 @@ static int snd_cs4215_put_volume(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_dbri *dbri = snd_kcontrol_chip(kcontrol);
|
struct snd_dbri *dbri = snd_kcontrol_chip(kcontrol);
|
||||||
struct dbri_streaminfo *info = &dbri->stream_info[kcontrol->private_value];
|
struct dbri_streaminfo *info =
|
||||||
|
&dbri->stream_info[kcontrol->private_value];
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|
||||||
if (info->left_gain != ucontrol->value.integer.value[0]) {
|
if (info->left_gain != ucontrol->value.integer.value[0]) {
|
||||||
@@ -2316,18 +2338,16 @@ static int snd_cs4215_get_single(struct snd_kcontrol *kcontrol,
|
|||||||
int invert = (kcontrol->private_value >> 24) & 1;
|
int invert = (kcontrol->private_value >> 24) & 1;
|
||||||
snd_assert(dbri != NULL, return -EINVAL);
|
snd_assert(dbri != NULL, return -EINVAL);
|
||||||
|
|
||||||
if (elem < 4) {
|
if (elem < 4)
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(dbri->mm.data[elem] >> shift) & mask;
|
(dbri->mm.data[elem] >> shift) & mask;
|
||||||
} else {
|
else
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
(dbri->mm.ctrl[elem - 4] >> shift) & mask;
|
(dbri->mm.ctrl[elem - 4] >> shift) & mask;
|
||||||
}
|
|
||||||
|
|
||||||
if (invert == 1) {
|
if (invert == 1)
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
mask - ucontrol->value.integer.value[0];
|
mask - ucontrol->value.integer.value[0];
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2379,10 +2399,11 @@ static int snd_cs4215_put_single(struct snd_kcontrol *kcontrol,
|
|||||||
number of bits. invert is a boolean for use with attenuation.
|
number of bits. invert is a boolean for use with attenuation.
|
||||||
*/
|
*/
|
||||||
#define CS4215_SINGLE(xname, entry, shift, mask, invert) \
|
#define CS4215_SINGLE(xname, entry, shift, mask, invert) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
||||||
.info = snd_cs4215_info_single, \
|
.info = snd_cs4215_info_single, \
|
||||||
.get = snd_cs4215_get_single, .put = snd_cs4215_put_single, \
|
.get = snd_cs4215_get_single, .put = snd_cs4215_put_single, \
|
||||||
.private_value = entry | (shift << 8) | (mask << 16) | (invert << 24) },
|
.private_value = (entry) | ((shift) << 8) | ((mask) << 16) | \
|
||||||
|
((invert) << 24) },
|
||||||
|
|
||||||
static struct snd_kcontrol_new dbri_controls[] __devinitdata = {
|
static struct snd_kcontrol_new dbri_controls[] __devinitdata = {
|
||||||
{
|
{
|
||||||
@@ -2438,7 +2459,8 @@ static int __init snd_dbri_mixer(struct snd_dbri * dbri)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
/proc interface
|
/proc interface
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void dbri_regs_read(struct snd_info_entry * entry, struct snd_info_buffer *buffer)
|
static void dbri_regs_read(struct snd_info_entry *entry,
|
||||||
|
struct snd_info_buffer *buffer)
|
||||||
{
|
{
|
||||||
struct snd_dbri *dbri = entry->private_data;
|
struct snd_dbri *dbri = entry->private_data;
|
||||||
|
|
||||||
@@ -2463,7 +2485,8 @@ static void dbri_debug_read(struct snd_info_entry * entry,
|
|||||||
"Pipe %d: %s SDP=0x%x desc=%d, "
|
"Pipe %d: %s SDP=0x%x desc=%d, "
|
||||||
"len=%d next %d\n",
|
"len=%d next %d\n",
|
||||||
pipe,
|
pipe,
|
||||||
((pptr->sdp & D_SDP_TO_SER) ? "output" : "input"),
|
((pptr->sdp & D_SDP_TO_SER) ? "output" :
|
||||||
|
"input"),
|
||||||
pptr->sdp, pptr->desc,
|
pptr->sdp, pptr->desc,
|
||||||
pptr->length, pptr->nextpipe);
|
pptr->length, pptr->nextpipe);
|
||||||
}
|
}
|
||||||
@@ -2587,7 +2610,8 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
|
|||||||
|
|
||||||
err = prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq));
|
err = prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq));
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
printk(KERN_ERR "DBRI-%d: Firmware node lacks IRQ property.\n", dev);
|
printk(KERN_ERR "DBRI-%d: Firmware node lacks IRQ property.\n",
|
||||||
|
dev);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2612,13 +2636,15 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
|
|||||||
if ((err = snd_dbri_pcm(dbri)) < 0)
|
if ((err = snd_dbri_pcm(dbri)) < 0)
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
||||||
|
if ((err = snd_dbri_mixer(dbri)) < 0)
|
||||||
if ((err = snd_dbri_mixer(dbri)) < 0)
|
if ((err = snd_dbri_mixer(dbri)) < 0)
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
||||||
/* /proc file handling */
|
/* /proc file handling */
|
||||||
snd_dbri_proc(dbri);
|
snd_dbri_proc(dbri);
|
||||||
|
|
||||||
if ((err = snd_card_register(card)) < 0)
|
err = snd_card_register(card);
|
||||||
|
if (err < 0)
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
||||||
printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
|
printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user