mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
ALSA: riptide: Use standard print API
Use the standard print API with dev_*() instead of the old house-baked one. It gives better information and allows dynamically control of debug prints. The device pointer is stored in struct cmdif for calling dev_*() functions. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20240807133452.9424-38-tiwai@suse.de
This commit is contained in:
parent
661c43fcdf
commit
8aee49444f
|
|
@ -380,6 +380,7 @@ struct riptideport {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmdif {
|
struct cmdif {
|
||||||
|
struct device *dev;
|
||||||
struct riptideport *hwport;
|
struct riptideport *hwport;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
unsigned int cmdcnt; /* cmd statistics */
|
unsigned int cmdcnt; /* cmd statistics */
|
||||||
|
|
@ -727,7 +728,7 @@ static int loadfirmware(struct cmdif *cif, const unsigned char *img,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snd_printdd("load firmware return %d\n", err);
|
dev_dbg(cif->dev, "load firmware return %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -740,7 +741,7 @@ alloclbuspath(struct cmdif *cif, unsigned char source,
|
||||||
|
|
||||||
sink = *path & (~SPLIT_PATH);
|
sink = *path & (~SPLIT_PATH);
|
||||||
if (sink != E2SINK_MAX) {
|
if (sink != E2SINK_MAX) {
|
||||||
snd_printdd("alloc path 0x%x->0x%x\n", source, sink);
|
dev_dbg(cif->dev, "alloc path 0x%x->0x%x\n", source, sink);
|
||||||
SEND_PSEL(cif, source, sink);
|
SEND_PSEL(cif, source, sink);
|
||||||
source = lbusin2out[sink][0];
|
source = lbusin2out[sink][0];
|
||||||
type = lbusin2out[sink][1];
|
type = lbusin2out[sink][1];
|
||||||
|
|
@ -778,7 +779,7 @@ freelbuspath(struct cmdif *cif, unsigned char source, const unsigned char *path)
|
||||||
|
|
||||||
sink = *path & (~SPLIT_PATH);
|
sink = *path & (~SPLIT_PATH);
|
||||||
if (sink != E2SINK_MAX) {
|
if (sink != E2SINK_MAX) {
|
||||||
snd_printdd("free path 0x%x->0x%x\n", source, sink);
|
dev_dbg(cif->dev, "free path 0x%x->0x%x\n", source, sink);
|
||||||
SEND_PCLR(cif, source, sink);
|
SEND_PCLR(cif, source, sink);
|
||||||
source = lbusin2out[sink][0];
|
source = lbusin2out[sink][0];
|
||||||
}
|
}
|
||||||
|
|
@ -811,8 +812,8 @@ static int writearm(struct cmdif *cif, u32 addr, u32 data, u32 mask)
|
||||||
} else
|
} else
|
||||||
rptr.retlongs[0] &= ~mask;
|
rptr.retlongs[0] &= ~mask;
|
||||||
}
|
}
|
||||||
snd_printdd("send arm 0x%x 0x%x 0x%x return %d\n", addr, data, mask,
|
dev_dbg(cif->dev, "send arm 0x%x 0x%x 0x%x return %d\n", addr, data, mask,
|
||||||
flag);
|
flag);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -832,14 +833,14 @@ static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
|
||||||
hwport = cif->hwport;
|
hwport = cif->hwport;
|
||||||
if (cif->errcnt > MAX_ERROR_COUNT) {
|
if (cif->errcnt > MAX_ERROR_COUNT) {
|
||||||
if (cif->is_reset) {
|
if (cif->is_reset) {
|
||||||
snd_printk(KERN_ERR
|
dev_err(cif->dev,
|
||||||
"Riptide: Too many failed cmds, reinitializing\n");
|
"Riptide: Too many failed cmds, reinitializing\n");
|
||||||
if (riptide_reset(cif, NULL) == 0) {
|
if (riptide_reset(cif, NULL) == 0) {
|
||||||
cif->errcnt = 0;
|
cif->errcnt = 0;
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snd_printk(KERN_ERR "Riptide: Initialization failed.\n");
|
dev_err(cif->dev, "Riptide: Initialization failed.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
@ -899,21 +900,21 @@ static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
|
||||||
if (time < cif->cmdtimemin)
|
if (time < cif->cmdtimemin)
|
||||||
cif->cmdtimemin = time;
|
cif->cmdtimemin = time;
|
||||||
if ((cif->cmdcnt) % 1000 == 0)
|
if ((cif->cmdcnt) % 1000 == 0)
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("send cmd %d time: %d mintime: %d maxtime %d err: %d\n",
|
"send cmd %d time: %d mintime: %d maxtime %d err: %d\n",
|
||||||
cif->cmdcnt, cif->cmdtime, cif->cmdtimemin,
|
cif->cmdcnt, cif->cmdtime, cif->cmdtimemin,
|
||||||
cif->cmdtimemax, cif->errcnt);
|
cif->cmdtimemax, cif->errcnt);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
cif->errcnt++;
|
cif->errcnt++;
|
||||||
spin_unlock_irqrestore(&cif->lock, irqflags);
|
spin_unlock_irqrestore(&cif->lock, irqflags);
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("send cmd %d hw: 0x%x flag: 0x%x cmd: 0x%x parm: 0x%x ret: 0x%x 0x%x CMDE: %d DATF: %d failed %d\n",
|
"send cmd %d hw: 0x%x flag: 0x%x cmd: 0x%x parm: 0x%x ret: 0x%x 0x%x CMDE: %d DATF: %d failed %d\n",
|
||||||
cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport),
|
cif->cmdcnt, (int)((void *)&(cmdport->stat) - (void *)hwport),
|
||||||
flags, cmd, parm, ret ? ret->retlongs[0] : 0,
|
flags, cmd, parm, ret ? ret->retlongs[0] : 0,
|
||||||
ret ? ret->retlongs[1] : 0, IS_CMDE(cmdport), IS_DATF(cmdport),
|
ret ? ret->retlongs[1] : 0, IS_CMDE(cmdport), IS_DATF(cmdport),
|
||||||
err);
|
err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -923,14 +924,14 @@ setmixer(struct cmdif *cif, short num, unsigned short rval, unsigned short lval)
|
||||||
union cmdret rptr = CMDRET_ZERO;
|
union cmdret rptr = CMDRET_ZERO;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
snd_printdd("sent mixer %d: 0x%x 0x%x\n", num, rval, lval);
|
dev_dbg(cif->dev, "sent mixer %d: 0x%x 0x%x\n", num, rval, lval);
|
||||||
do {
|
do {
|
||||||
SEND_SDGV(cif, num, num, rval, lval);
|
SEND_SDGV(cif, num, num, rval, lval);
|
||||||
SEND_RDGV(cif, num, num, &rptr);
|
SEND_RDGV(cif, num, num, &rptr);
|
||||||
if (rptr.retwords[0] == lval && rptr.retwords[1] == rval)
|
if (rptr.retwords[0] == lval && rptr.retwords[1] == rval)
|
||||||
return 0;
|
return 0;
|
||||||
} while (i++ < MAX_WRITE_RETRY);
|
} while (i++ < MAX_WRITE_RETRY);
|
||||||
snd_printdd("sent mixer failed\n");
|
dev_dbg(cif->dev, "sent mixer failed\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -961,7 +962,7 @@ getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
*a = rptr.retbytes[0];
|
*a = rptr.retbytes[0];
|
||||||
*b = rptr.retbytes[1];
|
*b = rptr.retbytes[1];
|
||||||
snd_printdd("getsourcesink 0x%x 0x%x\n", *a, *b);
|
dev_dbg(cif->dev, "%s 0x%x 0x%x\n", __func__, *a, *b);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -988,11 +989,11 @@ getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate)
|
||||||
}
|
}
|
||||||
if (p[0]) {
|
if (p[0]) {
|
||||||
if (p[1] != p[0])
|
if (p[1] != p[0])
|
||||||
snd_printdd("rates differ %d %d\n", p[0], p[1]);
|
dev_dbg(cif->dev, "rates differ %d %d\n", p[0], p[1]);
|
||||||
*rate = (unsigned int)p[0];
|
*rate = (unsigned int)p[0];
|
||||||
} else
|
} else
|
||||||
*rate = (unsigned int)p[1];
|
*rate = (unsigned int)p[1];
|
||||||
snd_printdd("getsampleformat %d %d %d\n", intdec[0], intdec[1], *rate);
|
dev_dbg(cif->dev, "getsampleformat %d %d %d\n", intdec[0], intdec[1], *rate);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1003,9 +1004,9 @@ setsampleformat(struct cmdif *cif,
|
||||||
{
|
{
|
||||||
unsigned char w, ch, sig, order;
|
unsigned char w, ch, sig, order;
|
||||||
|
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("setsampleformat mixer: %d id: %d channels: %d format: %d\n",
|
"%s mixer: %d id: %d channels: %d format: %d\n",
|
||||||
mixer, id, channels, format);
|
__func__, mixer, id, channels, format);
|
||||||
ch = channels == 1;
|
ch = channels == 1;
|
||||||
w = snd_pcm_format_width(format) == 8;
|
w = snd_pcm_format_width(format) == 8;
|
||||||
sig = snd_pcm_format_unsigned(format) != 0;
|
sig = snd_pcm_format_unsigned(format) != 0;
|
||||||
|
|
@ -1013,7 +1014,7 @@ setsampleformat(struct cmdif *cif,
|
||||||
|
|
||||||
if (SEND_SETF(cif, mixer, w, ch, order, sig, id) &&
|
if (SEND_SETF(cif, mixer, w, ch, order, sig, id) &&
|
||||||
SEND_SETF(cif, mixer, w, ch, order, sig, id)) {
|
SEND_SETF(cif, mixer, w, ch, order, sig, id)) {
|
||||||
snd_printdd("setsampleformat failed\n");
|
dev_dbg(cif->dev, "%s failed\n", __func__);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1026,8 +1027,8 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
|
||||||
union cmdret rptr = CMDRET_ZERO;
|
union cmdret rptr = CMDRET_ZERO;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
snd_printdd("setsamplerate intdec: %d,%d rate: %d\n", intdec[0],
|
dev_dbg(cif->dev, "%s intdec: %d,%d rate: %d\n", __func__,
|
||||||
intdec[1], rate);
|
intdec[0], intdec[1], rate);
|
||||||
D = 48000;
|
D = 48000;
|
||||||
M = ((rate == 48000) ? 47999 : rate) * 65536;
|
M = ((rate == 48000) ? 47999 : rate) * 65536;
|
||||||
N = M % D;
|
N = M % D;
|
||||||
|
|
@ -1042,8 +1043,8 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
|
||||||
rptr.retwords[3] != N &&
|
rptr.retwords[3] != N &&
|
||||||
i++ < MAX_WRITE_RETRY);
|
i++ < MAX_WRITE_RETRY);
|
||||||
if (i > MAX_WRITE_RETRY) {
|
if (i > MAX_WRITE_RETRY) {
|
||||||
snd_printdd("sent samplerate %d: %d failed\n",
|
dev_dbg(cif->dev, "sent samplerate %d: %d failed\n",
|
||||||
*intdec, rate);
|
*intdec, rate);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1062,7 +1063,7 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
*rval = rptr.retwords[0];
|
*rval = rptr.retwords[0];
|
||||||
*lval = rptr.retwords[1];
|
*lval = rptr.retwords[1];
|
||||||
snd_printdd("got mixer %d: 0x%x 0x%x\n", num, *rval, *lval);
|
dev_dbg(cif->dev, "got mixer %d: 0x%x 0x%x\n", num, *rval, *lval);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1105,8 +1106,8 @@ static irqreturn_t riptide_handleirq(int irq, void *dev_id)
|
||||||
if ((flag & EOS_STATUS)
|
if ((flag & EOS_STATUS)
|
||||||
&& (data->state == ST_PLAY)) {
|
&& (data->state == ST_PLAY)) {
|
||||||
data->state = ST_STOP;
|
data->state = ST_STOP;
|
||||||
snd_printk(KERN_ERR
|
dev_err(cif->dev,
|
||||||
"Riptide: DMA stopped unexpectedly\n");
|
"Riptide: DMA stopped unexpectedly\n");
|
||||||
}
|
}
|
||||||
c->dwStat_Ctl =
|
c->dwStat_Ctl =
|
||||||
cpu_to_le32(flag &
|
cpu_to_le32(flag &
|
||||||
|
|
@ -1119,11 +1120,11 @@ static irqreturn_t riptide_handleirq(int irq, void *dev_id)
|
||||||
period_bytes =
|
period_bytes =
|
||||||
frames_to_bytes(runtime,
|
frames_to_bytes(runtime,
|
||||||
runtime->period_size);
|
runtime->period_size);
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("interrupt 0x%x after 0x%lx of 0x%lx frames in period\n",
|
"interrupt 0x%x after 0x%lx of 0x%lx frames in period\n",
|
||||||
READ_AUDIO_STATUS(cif->hwport),
|
READ_AUDIO_STATUS(cif->hwport),
|
||||||
bytes_to_frames(runtime, pos),
|
bytes_to_frames(runtime, pos),
|
||||||
runtime->period_size);
|
runtime->period_size);
|
||||||
j = 0;
|
j = 0;
|
||||||
if (pos >= period_bytes) {
|
if (pos >= period_bytes) {
|
||||||
j++;
|
j++;
|
||||||
|
|
@ -1184,23 +1185,23 @@ static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
snd_printk(KERN_ERR
|
dev_err(cif->dev,
|
||||||
"Riptide: device not ready, audio status: 0x%x "
|
"Riptide: device not ready, audio status: 0x%x ready: %d gerr: %d\n",
|
||||||
"ready: %d gerr: %d\n",
|
READ_AUDIO_STATUS(cif->hwport),
|
||||||
READ_AUDIO_STATUS(cif->hwport),
|
IS_READY(cif->hwport), IS_GERR(cif->hwport));
|
||||||
IS_READY(cif->hwport), IS_GERR(cif->hwport));
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} else {
|
} else {
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("Riptide: audio status: 0x%x ready: %d gerr: %d\n",
|
"Riptide: audio status: 0x%x ready: %d gerr: %d\n",
|
||||||
READ_AUDIO_STATUS(cif->hwport),
|
READ_AUDIO_STATUS(cif->hwport),
|
||||||
IS_READY(cif->hwport), IS_GERR(cif->hwport));
|
IS_READY(cif->hwport), IS_GERR(cif->hwport));
|
||||||
}
|
}
|
||||||
|
|
||||||
SEND_GETV(cif, &firmware.ret);
|
SEND_GETV(cif, &firmware.ret);
|
||||||
snd_printdd("Firmware version: ASIC: %d CODEC %d AUXDSP %d PROG %d\n",
|
dev_dbg(cif->dev,
|
||||||
firmware.firmware.ASIC, firmware.firmware.CODEC,
|
"Firmware version: ASIC: %d CODEC %d AUXDSP %d PROG %d\n",
|
||||||
firmware.firmware.AUXDSP, firmware.firmware.PROG);
|
firmware.firmware.ASIC, firmware.firmware.CODEC,
|
||||||
|
firmware.firmware.AUXDSP, firmware.firmware.PROG);
|
||||||
|
|
||||||
if (!chip)
|
if (!chip)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -1211,20 +1212,20 @@ static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_printdd("Writing Firmware\n");
|
dev_dbg(cif->dev, "Writing Firmware\n");
|
||||||
if (!chip->fw_entry) {
|
if (!chip->fw_entry) {
|
||||||
err = request_firmware(&chip->fw_entry, "riptide.hex",
|
err = request_firmware(&chip->fw_entry, "riptide.hex",
|
||||||
&chip->pci->dev);
|
&chip->pci->dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
snd_printk(KERN_ERR
|
dev_err(cif->dev,
|
||||||
"Riptide: Firmware not available %d\n", err);
|
"Riptide: Firmware not available %d\n", err);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size);
|
err = loadfirmware(cif, chip->fw_entry->data, chip->fw_entry->size);
|
||||||
if (err) {
|
if (err) {
|
||||||
snd_printk(KERN_ERR
|
dev_err(cif->dev,
|
||||||
"Riptide: Could not load firmware %d\n", err);
|
"Riptide: Could not load firmware %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1257,7 +1258,7 @@ static int riptide_reset(struct cmdif *cif, struct snd_riptide *chip)
|
||||||
|
|
||||||
SEND_SACR(cif, 0, AC97_RESET);
|
SEND_SACR(cif, 0, AC97_RESET);
|
||||||
SEND_RACR(cif, AC97_RESET, &rptr);
|
SEND_RACR(cif, AC97_RESET, &rptr);
|
||||||
snd_printdd("AC97: 0x%x 0x%x\n", rptr.retlongs[0], rptr.retlongs[1]);
|
dev_dbg(cif->dev, "AC97: 0x%x 0x%x\n", rptr.retlongs[0], rptr.retlongs[1]);
|
||||||
|
|
||||||
SEND_PLST(cif, 0);
|
SEND_PLST(cif, 0);
|
||||||
SEND_SLST(cif, 0);
|
SEND_SLST(cif, 0);
|
||||||
|
|
@ -1350,11 +1351,11 @@ static snd_pcm_uframes_t snd_riptide_pointer(struct snd_pcm_substream
|
||||||
|
|
||||||
SEND_GPOS(cif, 0, data->id, &rptr);
|
SEND_GPOS(cif, 0, data->id, &rptr);
|
||||||
if (data->size && runtime->period_size) {
|
if (data->size && runtime->period_size) {
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("pointer stream %d position 0x%x(0x%x in buffer) bytes 0x%lx(0x%lx in period) frames\n",
|
"pointer stream %d position 0x%x(0x%x in buffer) bytes 0x%lx(0x%lx in period) frames\n",
|
||||||
data->id, rptr.retlongs[1], rptr.retlongs[1] % data->size,
|
data->id, rptr.retlongs[1], rptr.retlongs[1] % data->size,
|
||||||
bytes_to_frames(runtime, rptr.retlongs[1]),
|
bytes_to_frames(runtime, rptr.retlongs[1]),
|
||||||
bytes_to_frames(runtime,
|
bytes_to_frames(runtime,
|
||||||
rptr.retlongs[1]) % runtime->period_size);
|
rptr.retlongs[1]) % runtime->period_size);
|
||||||
if (rptr.retlongs[1] > data->pointer)
|
if (rptr.retlongs[1] > data->pointer)
|
||||||
ret =
|
ret =
|
||||||
|
|
@ -1365,8 +1366,9 @@ static snd_pcm_uframes_t snd_riptide_pointer(struct snd_pcm_substream
|
||||||
bytes_to_frames(runtime,
|
bytes_to_frames(runtime,
|
||||||
data->pointer % data->size);
|
data->pointer % data->size);
|
||||||
} else {
|
} else {
|
||||||
snd_printdd("stream not started or strange parms (%d %ld)\n",
|
dev_dbg(cif->dev,
|
||||||
data->size, runtime->period_size);
|
"stream not started or strange parms (%d %ld)\n",
|
||||||
|
data->size, runtime->period_size);
|
||||||
ret = bytes_to_frames(runtime, 0);
|
ret = bytes_to_frames(runtime, 0);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -1410,7 +1412,7 @@ static int snd_riptide_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||||
udelay(1);
|
udelay(1);
|
||||||
} while (i != rptr.retlongs[1] && j++ < MAX_WRITE_RETRY);
|
} while (i != rptr.retlongs[1] && j++ < MAX_WRITE_RETRY);
|
||||||
if (j > MAX_WRITE_RETRY)
|
if (j > MAX_WRITE_RETRY)
|
||||||
snd_printk(KERN_ERR "Riptide: Could not stop stream!");
|
dev_err(cif->dev, "Riptide: Could not stop stream!");
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
if (!(data->state & ST_PAUSE)) {
|
if (!(data->state & ST_PAUSE)) {
|
||||||
|
|
@ -1448,8 +1450,8 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
|
||||||
if (snd_BUG_ON(!cif || !data))
|
if (snd_BUG_ON(!cif || !data))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
snd_printdd("prepare id %d ch: %d f:0x%x r:%d\n", data->id,
|
dev_dbg(cif->dev, "prepare id %d ch: %d f:0x%x r:%d\n", data->id,
|
||||||
runtime->channels, runtime->format, runtime->rate);
|
runtime->channels, runtime->format, runtime->rate);
|
||||||
|
|
||||||
spin_lock_irq(&chip->lock);
|
spin_lock_irq(&chip->lock);
|
||||||
channels = runtime->channels;
|
channels = runtime->channels;
|
||||||
|
|
@ -1469,8 +1471,7 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
|
||||||
lbuspath = data->paths.stereo;
|
lbuspath = data->paths.stereo;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
snd_printdd("use sgdlist at 0x%p\n",
|
dev_dbg(cif->dev, "use sgdlist at 0x%p\n", data->sgdlist.area);
|
||||||
data->sgdlist.area);
|
|
||||||
if (data->sgdlist.area) {
|
if (data->sgdlist.area) {
|
||||||
unsigned int i, j, size, pages, f, pt, period;
|
unsigned int i, j, size, pages, f, pt, period;
|
||||||
struct sgd *c, *p = NULL;
|
struct sgd *c, *p = NULL;
|
||||||
|
|
@ -1483,9 +1484,9 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
|
||||||
pages = DIV_ROUND_UP(size, f);
|
pages = DIV_ROUND_UP(size, f);
|
||||||
data->size = size;
|
data->size = size;
|
||||||
data->pages = pages;
|
data->pages = pages;
|
||||||
snd_printdd
|
dev_dbg(cif->dev,
|
||||||
("create sgd size: 0x%x pages %d of size 0x%x for period 0x%x\n",
|
"create sgd size: 0x%x pages %d of size 0x%x for period 0x%x\n",
|
||||||
size, pages, f, period);
|
size, pages, f, period);
|
||||||
pt = 0;
|
pt = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < pages; i++) {
|
for (i = 0; i < pages; i++) {
|
||||||
|
|
@ -1543,17 +1544,18 @@ snd_riptide_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_dma_buffer *sgdlist = &data->sgdlist;
|
struct snd_dma_buffer *sgdlist = &data->sgdlist;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
snd_printdd("hw params id %d (sgdlist: 0x%p 0x%lx %d)\n", data->id,
|
dev_dbg(chip->card->dev, "hw params id %d (sgdlist: 0x%p 0x%lx %d)\n",
|
||||||
sgdlist->area, (unsigned long)sgdlist->addr,
|
data->id, sgdlist->area, (unsigned long)sgdlist->addr,
|
||||||
(int)sgdlist->bytes);
|
(int)sgdlist->bytes);
|
||||||
if (sgdlist->area)
|
if (sgdlist->area)
|
||||||
snd_dma_free_pages(sgdlist);
|
snd_dma_free_pages(sgdlist);
|
||||||
err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
|
err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
|
||||||
sizeof(struct sgd) * (DESC_MAX_MASK + 1),
|
sizeof(struct sgd) * (DESC_MAX_MASK + 1),
|
||||||
sgdlist);
|
sgdlist);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_printk(KERN_ERR "Riptide: failed to alloc %d dma bytes\n",
|
dev_err(chip->card->dev,
|
||||||
(int)sizeof(struct sgd) * (DESC_MAX_MASK + 1));
|
"Riptide: failed to alloc %d dma bytes\n",
|
||||||
|
(int)sizeof(struct sgd) * (DESC_MAX_MASK + 1));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
data->sgdbuf = (struct sgd *)sgdlist->area;
|
data->sgdbuf = (struct sgd *)sgdlist->area;
|
||||||
|
|
@ -1729,13 +1731,13 @@ snd_riptide_codec_write(struct snd_ac97 *ac97, unsigned short reg,
|
||||||
if (snd_BUG_ON(!cif))
|
if (snd_BUG_ON(!cif))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
snd_printdd("Write AC97 reg 0x%x 0x%x\n", reg, val);
|
dev_dbg(cif->dev, "Write AC97 reg 0x%x 0x%x\n", reg, val);
|
||||||
do {
|
do {
|
||||||
SEND_SACR(cif, val, reg);
|
SEND_SACR(cif, val, reg);
|
||||||
SEND_RACR(cif, reg, &rptr);
|
SEND_RACR(cif, reg, &rptr);
|
||||||
} while (rptr.retwords[1] != val && i++ < MAX_WRITE_RETRY);
|
} while (rptr.retwords[1] != val && i++ < MAX_WRITE_RETRY);
|
||||||
if (i > MAX_WRITE_RETRY)
|
if (i > MAX_WRITE_RETRY)
|
||||||
snd_printdd("Write AC97 reg failed\n");
|
dev_dbg(cif->dev, "Write AC97 reg failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned short snd_riptide_codec_read(struct snd_ac97 *ac97,
|
static unsigned short snd_riptide_codec_read(struct snd_ac97 *ac97,
|
||||||
|
|
@ -1750,7 +1752,7 @@ static unsigned short snd_riptide_codec_read(struct snd_ac97 *ac97,
|
||||||
|
|
||||||
if (SEND_RACR(cif, reg, &rptr) != 0)
|
if (SEND_RACR(cif, reg, &rptr) != 0)
|
||||||
SEND_RACR(cif, reg, &rptr);
|
SEND_RACR(cif, reg, &rptr);
|
||||||
snd_printdd("Read AC97 reg 0x%x got 0x%x\n", reg, rptr.retwords[1]);
|
dev_dbg(cif->dev, "Read AC97 reg 0x%x got 0x%x\n", reg, rptr.retwords[1]);
|
||||||
return rptr.retwords[1];
|
return rptr.retwords[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1768,6 +1770,7 @@ static int snd_riptide_initialize(struct snd_riptide *chip)
|
||||||
cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL);
|
cif = kzalloc(sizeof(struct cmdif), GFP_KERNEL);
|
||||||
if (!cif)
|
if (!cif)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
cif->dev = chip->card->dev;
|
||||||
cif->hwport = (struct riptideport *)chip->port;
|
cif->hwport = (struct riptideport *)chip->port;
|
||||||
spin_lock_init(&cif->lock);
|
spin_lock_init(&cif->lock);
|
||||||
chip->cif = cif;
|
chip->cif = cif;
|
||||||
|
|
@ -1781,11 +1784,11 @@ static int snd_riptide_initialize(struct snd_riptide *chip)
|
||||||
case 0x4310:
|
case 0x4310:
|
||||||
case 0x4320:
|
case 0x4320:
|
||||||
case 0x4330:
|
case 0x4330:
|
||||||
snd_printdd("Modem enable?\n");
|
dev_dbg(cif->dev, "Modem enable?\n");
|
||||||
SEND_SETDPLL(cif);
|
SEND_SETDPLL(cif);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
snd_printdd("Enabling MPU IRQs\n");
|
dev_dbg(cif->dev, "Enabling MPU IRQs\n");
|
||||||
if (chip->rmidi)
|
if (chip->rmidi)
|
||||||
SET_EMPUIRQ(cif->hwport);
|
SET_EMPUIRQ(cif->hwport);
|
||||||
return err;
|
return err;
|
||||||
|
|
@ -1838,8 +1841,8 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci)
|
||||||
snd_riptide_interrupt,
|
snd_riptide_interrupt,
|
||||||
riptide_handleirq, IRQF_SHARED,
|
riptide_handleirq, IRQF_SHARED,
|
||||||
KBUILD_MODNAME, chip)) {
|
KBUILD_MODNAME, chip)) {
|
||||||
snd_printk(KERN_ERR "Riptide: unable to grab IRQ %d\n",
|
dev_err(&pci->dev, "Riptide: unable to grab IRQ %d\n",
|
||||||
pci->irq);
|
pci->irq);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
chip->irq = pci->irq;
|
chip->irq = pci->irq;
|
||||||
|
|
@ -1987,9 +1990,9 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id)
|
||||||
goto inc_dev;
|
goto inc_dev;
|
||||||
}
|
}
|
||||||
if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {
|
if (!request_region(joystick_port[dev], 8, "Riptide gameport")) {
|
||||||
snd_printk(KERN_WARNING
|
dev_err(&pci->dev,
|
||||||
"Riptide: cannot grab gameport 0x%x\n",
|
"Riptide: cannot grab gameport 0x%x\n",
|
||||||
joystick_port[dev]);
|
joystick_port[dev]);
|
||||||
gameport_free_port(gameport);
|
gameport_free_port(gameport);
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
goto inc_dev;
|
goto inc_dev;
|
||||||
|
|
@ -2064,9 +2067,9 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
|
||||||
val, MPU401_INFO_IRQ_HOOK, -1,
|
val, MPU401_INFO_IRQ_HOOK, -1,
|
||||||
&chip->rmidi);
|
&chip->rmidi);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_printk(KERN_WARNING
|
dev_warn(&pci->dev,
|
||||||
"Riptide: Can't Allocate MPU at 0x%x\n",
|
"Riptide: Can't Allocate MPU at 0x%x\n",
|
||||||
val);
|
val);
|
||||||
else
|
else
|
||||||
chip->mpuaddr = val;
|
chip->mpuaddr = val;
|
||||||
}
|
}
|
||||||
|
|
@ -2076,15 +2079,15 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
|
||||||
err = snd_opl3_create(card, val, val + 2,
|
err = snd_opl3_create(card, val, val + 2,
|
||||||
OPL3_HW_RIPTIDE, 0, &chip->opl3);
|
OPL3_HW_RIPTIDE, 0, &chip->opl3);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_printk(KERN_WARNING
|
dev_warn(&pci->dev,
|
||||||
"Riptide: Can't Allocate OPL3 at 0x%x\n",
|
"Riptide: Can't Allocate OPL3 at 0x%x\n",
|
||||||
val);
|
val);
|
||||||
else {
|
else {
|
||||||
chip->opladdr = val;
|
chip->opladdr = val;
|
||||||
err = snd_opl3_hwdep_new(chip->opl3, 0, 1, NULL);
|
err = snd_opl3_hwdep_new(chip->opl3, 0, 1, NULL);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
snd_printk(KERN_WARNING
|
dev_warn(&pci->dev,
|
||||||
"Riptide: Can't Allocate OPL3-HWDEP\n");
|
"Riptide: Can't Allocate OPL3-HWDEP\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef SUPPORT_JOYSTICK
|
#ifdef SUPPORT_JOYSTICK
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user