summaryrefslogtreecommitdiff
path: root/sound/usb/usx2y/usbusx2yaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usx2y/usbusx2yaudio.c')
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c94
1 files changed, 39 insertions, 55 deletions
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index ca7888495a9f..acca8bead82e 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -28,33 +28,6 @@
#include "usx2y.h"
#include "usbusx2y.h"
-/* Default value used for nr of packs per urb.
- * 1 to 4 have been tested ok on uhci.
- * To use 3 on ohci, you'd need a patch:
- * look for "0000425-linux-2.6.9-rc4-mm1_ohci-hcd.patch.gz" on
- * "https://bugtrack.alsa-project.org/alsa-bug/bug_view_page.php?bug_id=0000425"
- *
- * 1, 2 and 4 work out of the box on ohci, if I recall correctly.
- * Bigger is safer operation, smaller gives lower latencies.
- */
-#define USX2Y_NRPACKS 4
-
-/* If your system works ok with this module's parameter
- * nrpacks set to 1, you might as well comment
- * this define out, and thereby produce smaller, faster code.
- * You'd also set USX2Y_NRPACKS to 1 then.
- */
-#define USX2Y_NRPACKS_VARIABLE 1
-
-#ifdef USX2Y_NRPACKS_VARIABLE
-static int nrpacks = USX2Y_NRPACKS; /* number of packets per urb */
-#define nr_of_packs() nrpacks
-module_param(nrpacks, int, 0444);
-MODULE_PARM_DESC(nrpacks, "Number of packets per URB.");
-#else
-#define nr_of_packs() USX2Y_NRPACKS
-#endif
-
static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs)
{
struct urb *urb = subs->completed_urb;
@@ -67,14 +40,15 @@ static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs)
for (i = 0; i < nr_of_packs(); i++) {
cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */
- snd_printk(KERN_ERR
- "active frame status %i. Most probably some hardware problem.\n",
- urb->iso_frame_desc[i].status);
+ dev_err(&usx2y->dev->dev,
+ "%s: active frame status %i. Most probably some hardware problem.\n",
+ __func__,
+ urb->iso_frame_desc[i].status);
return urb->iso_frame_desc[i].status;
}
len = urb->iso_frame_desc[i].actual_length / usx2y->stride;
if (!len) {
- snd_printd("0 == len ERROR!\n");
+ dev_dbg(&usx2y->dev->dev, "%s: 0 == len ERROR!\n", __func__);
continue;
}
@@ -128,7 +102,8 @@ static int usx2y_urb_play_prepare(struct snd_usx2y_substream *subs,
counts = cap_urb->iso_frame_desc[pack].actual_length / usx2y->stride;
count += counts;
if (counts < 43 || counts > 50) {
- snd_printk(KERN_ERR "should not be here with counts=%i\n", counts);
+ dev_err(&usx2y->dev->dev, "%s: should not be here with counts=%i\n",
+ __func__, counts);
return -EPIPE;
}
/* set up descriptor */
@@ -196,7 +171,8 @@ static int usx2y_urb_submit(struct snd_usx2y_substream *subs, struct urb *urb, i
urb->dev = subs->usx2y->dev; /* we need to set this at each time */
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err < 0) {
- snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err);
+ dev_err(&urb->dev->dev, "%s: usb_submit_urb() returned %i\n",
+ __func__, err);
return err;
}
return 0;
@@ -264,7 +240,8 @@ static void usx2y_clients_stop(struct usx2ydev *usx2y)
for (s = 0; s < 4; s++) {
subs = usx2y->subs[s];
if (subs) {
- snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state));
+ dev_dbg(&usx2y->dev->dev, "%s: %i %p state=%i\n",
+ __func__, s, subs, atomic_read(&subs->state));
atomic_set(&subs->state, STATE_STOPPED);
}
}
@@ -276,8 +253,9 @@ static void usx2y_clients_stop(struct usx2ydev *usx2y)
for (u = 0; u < NRURBS; u++) {
urb = subs->urb[u];
if (urb)
- snd_printdd("%i status=%i start_frame=%i\n",
- u, urb->status, urb->start_frame);
+ dev_dbg(&usx2y->dev->dev,
+ "%s: %i status=%i start_frame=%i\n",
+ __func__, u, urb->status, urb->start_frame);
}
}
}
@@ -288,7 +266,8 @@ static void usx2y_clients_stop(struct usx2ydev *usx2y)
static void usx2y_error_urb_status(struct usx2ydev *usx2y,
struct snd_usx2y_substream *subs, struct urb *urb)
{
- snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status);
+ dev_err(&usx2y->dev->dev, "%s: ep=%i stalled with status=%i\n",
+ __func__, subs->endpoint, urb->status);
urb->status = 0;
usx2y_clients_stop(usx2y);
}
@@ -300,10 +279,12 @@ static void i_usx2y_urb_complete(struct urb *urb)
struct snd_usx2y_substream *capsubs, *playbacksubs;
if (unlikely(atomic_read(&subs->state) < STATE_PREPARED)) {
- snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
- usb_get_current_frame_number(usx2y->dev),
- subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
- urb->status, urb->start_frame);
+ dev_dbg(&usx2y->dev->dev,
+ "%s: hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
+ __func__,
+ usb_get_current_frame_number(usx2y->dev),
+ subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
+ urb->status, urb->start_frame);
return;
}
if (unlikely(urb->status)) {
@@ -323,7 +304,6 @@ static void i_usx2y_urb_complete(struct urb *urb)
if (!usx2y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) {
usx2y->wait_iso_frame += nr_of_packs();
} else {
- snd_printdd("\n");
usx2y_clients_stop(usx2y);
}
}
@@ -373,8 +353,9 @@ static void i_usx2y_subs_startup(struct urb *urb)
static void usx2y_subs_prepare(struct snd_usx2y_substream *subs)
{
- snd_printdd("usx2y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n",
- subs, subs->endpoint, subs->urb[0], subs->urb[1]);
+ dev_dbg(&subs->usx2y->dev->dev,
+ "%s(%p) ep=%i urb0=%p urb1=%p\n",
+ __func__, subs, subs->endpoint, subs->urb[0], subs->urb[1]);
/* reset the pointer */
subs->hwptr = 0;
subs->hwptr_done = 0;
@@ -399,7 +380,7 @@ static void usx2y_urbs_release(struct snd_usx2y_substream *subs)
{
int i;
- snd_printdd("%s %i\n", __func__, subs->endpoint);
+ dev_dbg(&subs->usx2y->dev->dev, "%s %i\n", __func__, subs->endpoint);
for (i = 0; i < NRURBS; i++)
usx2y_urb_release(subs->urb + i,
subs != subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]);
@@ -505,7 +486,8 @@ static int usx2y_urbs_start(struct snd_usx2y_substream *subs)
urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs();
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err < 0) {
- snd_printk(KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err);
+ dev_err(&urb->dev->dev, "%s: cannot submit datapipe for urb %d, err = %d\n",
+ __func__, i, err);
err = -EPIPE;
goto cleanup;
} else {
@@ -550,17 +532,16 @@ static int snd_usx2y_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- snd_printdd("%s(START)\n", __func__);
+ dev_dbg(&subs->usx2y->dev->dev, "%s(START)\n", __func__);
if (atomic_read(&subs->state) == STATE_PREPARED &&
atomic_read(&subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= STATE_PREPARED) {
atomic_set(&subs->state, STATE_PRERUNNING);
} else {
- snd_printdd("\n");
return -EPIPE;
}
break;
case SNDRV_PCM_TRIGGER_STOP:
- snd_printdd("%s(STOP)\n", __func__);
+ dev_dbg(&subs->usx2y->dev->dev, "%s(STOP)\n", __func__);
if (atomic_read(&subs->state) >= STATE_PRERUNNING)
atomic_set(&subs->state, STATE_PREPARED);
break;
@@ -661,7 +642,8 @@ static void i_usx2y_04int(struct urb *urb)
struct usx2ydev *usx2y = urb->context;
if (urb->status)
- snd_printk(KERN_ERR "snd_usx2y_04int() urb->status=%i\n", urb->status);
+ dev_err(&urb->dev->dev, "%s() urb->status=%i\n",
+ __func__, urb->status);
if (!--usx2y->us04->len)
wake_up(&usx2y->in04_wait_queue);
}
@@ -751,7 +733,8 @@ static int usx2y_format_set(struct usx2ydev *usx2y, snd_pcm_format_t format)
usb_kill_urb(usx2y->in04_urb);
err = usb_set_interface(usx2y->dev, 0, alternate);
if (err) {
- snd_printk(KERN_ERR "usb_set_interface error\n");
+ dev_err(&usx2y->dev->dev, "%s: usb_set_interface error\n",
+ __func__);
return err;
}
usx2y->in04_urb->dev = usx2y->dev;
@@ -778,7 +761,7 @@ static int snd_usx2y_pcm_hw_params(struct snd_pcm_substream *substream,
int i;
mutex_lock(&usx2y(card)->pcm_mutex);
- snd_printdd("snd_usx2y_hw_params(%p, %p)\n", substream, hw_params);
+ dev_dbg(&dev->dev->dev, "%s(%p, %p)\n", __func__, substream, hw_params);
/* all pcm substreams off one usx2y have to operate at the same
* rate & format
*/
@@ -814,7 +797,7 @@ static int snd_usx2y_pcm_hw_free(struct snd_pcm_substream *substream)
struct snd_usx2y_substream *cap_subs, *playback_subs;
mutex_lock(&subs->usx2y->pcm_mutex);
- snd_printdd("snd_usx2y_hw_free(%p)\n", substream);
+ dev_dbg(&subs->usx2y->dev->dev, "%s(%p)\n", __func__, substream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE];
@@ -850,7 +833,7 @@ static int snd_usx2y_pcm_prepare(struct snd_pcm_substream *substream)
struct snd_usx2y_substream *capsubs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE];
int err = 0;
- snd_printdd("%s(%p)\n", __func__, substream);
+ dev_dbg(&usx2y->dev->dev, "%s(%p)\n", __func__, substream);
mutex_lock(&usx2y->pcm_mutex);
usx2y_subs_prepare(subs);
@@ -867,7 +850,8 @@ static int snd_usx2y_pcm_prepare(struct snd_pcm_substream *substream)
if (err < 0)
goto up_prepare_mutex;
}
- snd_printdd("starting capture pipe for %s\n", subs == capsubs ? "self" : "playpipe");
+ dev_dbg(&usx2y->dev->dev, "%s: starting capture pipe for %s\n",
+ __func__, subs == capsubs ? "self" : "playpipe");
err = usx2y_urbs_start(capsubs);
if (err < 0)
goto up_prepare_mutex;