Commit 35a8dc1f authored by Eliot Blennerhassett's avatar Eliot Blennerhassett Committed by Takashi Iwai

ALSA: asihpi: Logging format improvements

Signed-off-by: default avatarEliot Blennerhassett <eliot@blennerhassett.gen.nz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3872f19d
...@@ -288,21 +288,17 @@ static void print_hwparams(struct snd_pcm_substream *substream, ...@@ -288,21 +288,17 @@ static void print_hwparams(struct snd_pcm_substream *substream,
{ {
char name[16]; char name[16];
snd_pcm_debug_name(substream, name, sizeof(name)); snd_pcm_debug_name(substream, name, sizeof(name));
snd_printd("%s HWPARAMS\n", name); snd_printdd("%s HWPARAMS\n", name);
snd_printd(" samplerate %d Hz\n", params_rate(p)); snd_printdd(" samplerate=%dHz channels=%d format=%d subformat=%d\n",
snd_printd(" channels %d\n", params_channels(p)); params_rate(p), params_channels(p),
snd_printd(" format %d\n", params_format(p)); params_format(p), params_subformat(p));
snd_printd(" subformat %d\n", params_subformat(p)); snd_printdd(" buffer=%dB period=%dB period_size=%dB periods=%d\n",
snd_printd(" buffer %d B\n", params_buffer_bytes(p)); params_buffer_bytes(p), params_period_bytes(p),
snd_printd(" period %d B\n", params_period_bytes(p)); params_period_size(p), params_periods(p));
snd_printd(" access %d\n", params_access(p)); snd_printdd(" buffer_size=%d access=%d data_rate=%dB/s\n",
snd_printd(" period_size %d\n", params_period_size(p)); params_buffer_size(p), params_access(p),
snd_printd(" periods %d\n", params_periods(p)); params_rate(p) * params_channels(p) *
snd_printd(" buffer_size %d\n", params_buffer_size(p));
snd_printd(" %d B/s\n", params_rate(p) *
params_channels(p) *
snd_pcm_format_width(params_format(p)) / 8); snd_pcm_format_width(params_format(p)) / 8);
} }
static snd_pcm_format_t hpi_to_alsa_formats[] = { static snd_pcm_format_t hpi_to_alsa_formats[] = {
...@@ -480,7 +476,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -480,7 +476,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
params_buffer_bytes(params), runtime->dma_addr); params_buffer_bytes(params), runtime->dma_addr);
if (err == 0) { if (err == 0) {
snd_printdd( snd_printdd(
"stream_host_buffer_attach succeeded %u %lu\n", "stream_host_buffer_attach success %u %lu\n",
params_buffer_bytes(params), params_buffer_bytes(params),
(unsigned long)runtime->dma_addr); (unsigned long)runtime->dma_addr);
} else { } else {
...@@ -490,12 +486,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -490,12 +486,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
} }
err = hpi_stream_get_info_ex(dpcm->h_stream, NULL, err = hpi_stream_get_info_ex(dpcm->h_stream, NULL,
&dpcm->hpi_buffer_attached, &dpcm->hpi_buffer_attached, NULL, NULL, NULL);
NULL, NULL, NULL);
snd_printdd("stream_host_buffer_attach status 0x%x\n",
dpcm->hpi_buffer_attached);
} }
bytes_per_sec = params_rate(params) * params_channels(params); bytes_per_sec = params_rate(params) * params_channels(params);
width = snd_pcm_format_width(params_format(params)); width = snd_pcm_format_width(params_format(params));
...@@ -563,10 +554,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -563,10 +554,10 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
char name[16]; char name[16];
snd_pcm_debug_name(substream, name, sizeof(name)); snd_pcm_debug_name(substream, name, sizeof(name));
snd_printdd("%s trigger\n", name);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
snd_printdd("%s trigger start\n", name);
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
struct snd_pcm_runtime *runtime = s->runtime; struct snd_pcm_runtime *runtime = s->runtime;
struct snd_card_asihpi_pcm *ds = runtime->private_data; struct snd_card_asihpi_pcm *ds = runtime->private_data;
...@@ -587,7 +578,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -587,7 +578,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
* data?? * data??
*/ */
unsigned int preload = ds->period_bytes * 1; unsigned int preload = ds->period_bytes * 1;
snd_printddd("%d preload x%x\n", s->number, preload); snd_printddd("%d preload %d\n", s->number, preload);
hpi_handle_error(hpi_outstream_write_buf( hpi_handle_error(hpi_outstream_write_buf(
ds->h_stream, ds->h_stream,
&runtime->dma_area[0], &runtime->dma_area[0],
...@@ -610,7 +601,6 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -610,7 +601,6 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
} else } else
break; break;
} }
snd_printdd("start\n");
/* start the master stream */ /* start the master stream */
snd_card_asihpi_pcm_timer_start(substream); snd_card_asihpi_pcm_timer_start(substream);
if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) || if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) ||
...@@ -619,6 +609,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -619,6 +609,7 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
snd_printdd("%s trigger stop\n", name);
snd_card_asihpi_pcm_timer_stop(substream); snd_card_asihpi_pcm_timer_stop(substream);
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
if (snd_pcm_substream_chip(s) != card) if (snd_pcm_substream_chip(s) != card)
...@@ -637,7 +628,6 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -637,7 +628,6 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
} else } else
break; break;
} }
snd_printdd("stop\n");
/* _prepare and _hwparams reset the stream */ /* _prepare and _hwparams reset the stream */
hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); hpi_handle_error(hpi_stream_stop(dpcm->h_stream));
...@@ -650,12 +640,12 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, ...@@ -650,12 +640,12 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream,
break; break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
snd_printdd("pause release\n"); snd_printdd("%s trigger pause release\n", name);
hpi_handle_error(hpi_stream_start(dpcm->h_stream)); hpi_handle_error(hpi_stream_start(dpcm->h_stream));
snd_card_asihpi_pcm_timer_start(substream); snd_card_asihpi_pcm_timer_start(substream);
break; break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
snd_printdd("pause\n"); snd_printdd("%s trigger pause push\n", name);
snd_card_asihpi_pcm_timer_stop(substream); snd_card_asihpi_pcm_timer_stop(substream);
hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); hpi_handle_error(hpi_stream_stop(dpcm->h_stream));
break; break;
...@@ -730,7 +720,6 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -730,7 +720,6 @@ static void snd_card_asihpi_timer_function(unsigned long data)
snd_pcm_debug_name(substream, name, sizeof(name)); snd_pcm_debug_name(substream, name, sizeof(name));
snd_printdd("%s snd_card_asihpi_timer_function\n", name);
/* find minimum newdata and buffer pos in group */ /* find minimum newdata and buffer pos in group */
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
...@@ -790,19 +779,20 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -790,19 +779,20 @@ static void snd_card_asihpi_timer_function(unsigned long data)
newdata); newdata);
} }
snd_printdd("hw_ptr 0x%04lX, appl_ptr 0x%04lX\n", snd_printddd("timer1, %s, %d, S=%d, elap=%d, rw=%d, dsp=%d, left=%d, aux=%d, space=%d, hw_ptr=%ld, appl_ptr=%ld\n",
name, s->number, state,
ds->pcm_buf_elapsed_dma_ofs,
ds->pcm_buf_host_rw_ofs,
pcm_buf_dma_ofs,
(int)bytes_avail,
(int)on_card_bytes,
buffer_size-bytes_avail,
(unsigned long)frames_to_bytes(runtime, (unsigned long)frames_to_bytes(runtime,
runtime->status->hw_ptr), runtime->status->hw_ptr),
(unsigned long)frames_to_bytes(runtime, (unsigned long)frames_to_bytes(runtime,
runtime->control->appl_ptr)); runtime->control->appl_ptr)
);
snd_printdd("%d S=%d, "
"rw=0x%04X, dma=0x%04X, left=0x%04X, "
"aux=0x%04X space=0x%04X\n",
s->number, state,
ds->pcm_buf_host_rw_ofs, pcm_buf_dma_ofs,
(int)bytes_avail,
(int)on_card_bytes, buffer_size-bytes_avail);
loops++; loops++;
} }
pcm_buf_dma_ofs = min_buf_pos; pcm_buf_dma_ofs = min_buf_pos;
...@@ -820,7 +810,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -820,7 +810,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
next_jiffies = max(next_jiffies, 1U); next_jiffies = max(next_jiffies, 1U);
dpcm->timer.expires = jiffies + next_jiffies; dpcm->timer.expires = jiffies + next_jiffies;
snd_printdd("jif %d buf pos 0x%04X newdata 0x%04X xfer 0x%04X\n", snd_printddd("timer2, jif=%d, buf_pos=%d, newdata=%d, xfer=%d\n",
next_jiffies, pcm_buf_dma_ofs, newdata, xfercount); next_jiffies, pcm_buf_dma_ofs, newdata, xfercount);
snd_pcm_group_for_each_entry(s, substream) { snd_pcm_group_for_each_entry(s, substream) {
...@@ -852,7 +842,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -852,7 +842,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
} }
if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
snd_printddd("P%d write1 0x%04X 0x%04X\n", snd_printddd("write1, P=%d, xfer=%d, buf_ofs=%d\n",
s->number, xfer1, buf_ofs); s->number, xfer1, buf_ofs);
hpi_handle_error( hpi_handle_error(
hpi_outstream_write_buf( hpi_outstream_write_buf(
...@@ -862,7 +852,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -862,7 +852,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
if (xfer2) { if (xfer2) {
pd = s->runtime->dma_area; pd = s->runtime->dma_area;
snd_printddd("P%d write2 0x%04X 0x%04X\n", snd_printddd("write2, P=%d, xfer=%d, buf_ofs=%d\n",
s->number, s->number,
xfercount - xfer1, buf_ofs); xfercount - xfer1, buf_ofs);
hpi_handle_error( hpi_handle_error(
...@@ -872,7 +862,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -872,7 +862,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
&ds->format)); &ds->format));
} }
} else { } else {
snd_printddd("C%d read1 0x%04x\n", snd_printddd("read1, C=%d, xfer=%d\n",
s->number, xfer1); s->number, xfer1);
hpi_handle_error( hpi_handle_error(
hpi_instream_read_buf( hpi_instream_read_buf(
...@@ -880,7 +870,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) ...@@ -880,7 +870,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
pd, xfer1)); pd, xfer1));
if (xfer2) { if (xfer2) {
pd = s->runtime->dma_area; pd = s->runtime->dma_area;
snd_printddd("C%d read2 0x%04x\n", snd_printddd("read2, C=%d, xfer=%d\n",
s->number, xfer2); s->number, xfer2);
hpi_handle_error( hpi_handle_error(
hpi_instream_read_buf( hpi_instream_read_buf(
...@@ -933,7 +923,7 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream) ...@@ -933,7 +923,7 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream)
snd_pcm_debug_name(substream, name, sizeof(name)); snd_pcm_debug_name(substream, name, sizeof(name));
ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes);
snd_printddd("%s pointer = 0x%04lx\n", name, (unsigned long)ptr); snd_printddd("%s, pointer=%ld\n", name, (unsigned long)ptr);
return ptr; return ptr;
} }
...@@ -1081,9 +1071,10 @@ snd_card_asihpi_capture_pointer(struct snd_pcm_substream *substream) ...@@ -1081,9 +1071,10 @@ snd_card_asihpi_capture_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data; struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
char name[16];
snd_pcm_debug_name(substream, name, sizeof(name));
snd_printddd("capture pointer %d=%d\n", snd_printddd("%s, pointer=%d\n", name, dpcm->pcm_buf_dma_ofs);
substream->number, dpcm->pcm_buf_dma_ofs);
/* NOTE Unlike playback can't use actual samples_played /* NOTE Unlike playback can't use actual samples_played
for the capture position, because those samples aren't yet in for the capture position, because those samples aren't yet in
the local buffer available for reading. the local buffer available for reading.
...@@ -2867,6 +2858,8 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev, ...@@ -2867,6 +2858,8 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev,
asihpi->in_min_chans = 1; asihpi->in_min_chans = 1;
} }
snd_printk(KERN_INFO "update_interval_frames: %d",
asihpi->update_interval_frames);
snd_printk(KERN_INFO "Has dma:%d, grouping:%d, mrx:%d\n", snd_printk(KERN_INFO "Has dma:%d, grouping:%d, mrx:%d\n",
asihpi->can_dma, asihpi->can_dma,
asihpi->support_grouping, asihpi->support_grouping,
......
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