All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA - HDA - Add period time constraint to hda-intel
@ 2011-05-24  4:15 Raymond Yau
  2011-05-24  6:09 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Raymond Yau @ 2011-05-24  4:15 UTC (permalink / raw)
  To: ALSA Development Mailing List, Takashi Iwai

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

As there is a 10 seconds schedule_timeout in alsa-kernel

The following error occur when aplay/arecord using a period time
longer than 10 seconds for for those hda codec which support rate
lower than 32000 when prealloc = 4096

ALSA hda_intel.c:1680: azx_pcm_prepare: bufsize=0x1aeb00, format=0x4111
...
ALSA pcm_native.c:1531: playback drain error (DMA or IRQ trouble?)


aplay -v -Dhw:1 --period-time=10001000 22050.wav
Playing WAVE '22050.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Hardware PCM card 1 'HDA Intel' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 22050
  exact rate   : 22050 (22050/1)
  msbits       : 16
  buffer_size  : 441024
  period_size  : 220512
  period_time  : 10000544
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 220512
  period_event : 0
  start_threshold  : 441024
  stop_threshold   : 441024
  silence_threshold: 0
  silence_size : 0
  boundary     : 1806434304
  appl_ptr     : 0
  hw_ptr       : 0


ALSA hda_intel.c:1680: azx_pcm_prepare: bufsize=0x9c500, format=0x511
ALSA hda_codec.c:1295: hda_codec_setup_stream: NID=0x8, stream=0x1,
channel=0, format=0x511
ALSA pcm_lib.c:1789: capture write error (DMA or IRQ trouble?)

arecord -Dhw:1  -v --period-time=10005000 -r 8000 -c2 -f S16_LE /dev/null
Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
Hardware PCM card 1 'HDA Intel' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 160064
  period_size  : 80032
  period_time  : 10004000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 80032
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 160064
  silence_threshold: 0
  silence_size : 0
  boundary     : 1311244288
  appl_ptr     : 0
  hw_ptr       : 0
arecord: pcm_read:1773: read error: Input/output error

[-- Attachment #2: 0001-Add-period-time-constraint-to-hda-intel.patch --]
[-- Type: application/octet-stream, Size: 2921 bytes --]

From 7db88ab08c9690f92a2fe03a1e3c97767e74f17a Mon Sep 17 00:00:00 2001
From: Raymond Yau <superquad.vortex2@gmail.com>
Date: Tue, 24 May 2011 10:20:17 +0800
Subject: [PATCH ALSA - HDA - Add period time constraint to hda-intel

As there is a 10 seconds schedule_timeout in alsa-kernel

ALSA hda_intel.c:1680: azx_pcm_prepare: bufsize=0x1aeb00, format=0x4111
...
ALSA pcm_native.c:1531: playback drain error (DMA or IRQ trouble?)

occur when application using a period time longer than 10 seconds for for those hda codec which support rate lower than 32000 when prealloc = 4096

aplay -v -Dhw:1 --period-time=10001000 22050.wav
Playing WAVE '22050.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Hardware PCM card 1 'HDA Intel' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 22050
  exact rate   : 22050 (22050/1)
  msbits       : 16
  buffer_size  : 441024
  period_size  : 220512
  period_time  : 10000544
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 220512
  period_event : 0
  start_threshold  : 441024
  stop_threshold   : 441024
  silence_threshold: 0
  silence_size : 0
  boundary     : 1806434304
  appl_ptr     : 0
  hw_ptr       : 0


ALSA hda_intel.c:1680: azx_pcm_prepare: bufsize=0x9c500, format=0x511
ALSA hda_codec.c:1295: hda_codec_setup_stream: NID=0x8, stream=0x1, channel=0, format=0x511
ALSA pcm_lib.c:1789: capture write error (DMA or IRQ trouble?)

arecord -Dhw:1  -v --period-time=10005000 -r 8000 -c2 -f S16_LE /dev/null
Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
Hardware PCM card 1 'HDA Intel' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 16
  buffer_size  : 160064
  period_size  : 80032
  period_time  : 10004000
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 80032
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 160064
  silence_threshold: 0
  silence_size : 0
  boundary     : 1311244288
  appl_ptr     : 0
  hw_ptr       : 0
arecord: pcm_read:1773: read error: Input/output error



Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 43a0367..7682bc0 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1587,6 +1587,8 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
 				   128);
 	snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
 				   128);
+	snd_pcm_hw_constraint_minmax
+		(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 166, 10000000);
 	snd_hda_power_up(apcm->codec);
 	err = hinfo->ops.open(hinfo, apcm->codec, substream);
 	if (err < 0) {
-- 
1.6.0.6


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-23  1:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-24  4:15 [PATCH] ALSA - HDA - Add period time constraint to hda-intel Raymond Yau
2011-05-24  6:09 ` Takashi Iwai
2011-05-26  2:01   ` Raymond Yau
2011-05-26  6:15     ` Takashi Iwai
2011-06-23  1:14       ` Raymond Yau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.