From bbf6ad1399e9516b0a95de3ad58ffbaed670e4cc Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 10 Apr 2009 12:28:58 +0200 Subject: [ALSA] pcm-midlevel: Add more strict buffer position checks based on jiffies Some drivers like Intel8x0 or Intel HDA are broken for some hardware variants. This patch adds more strict buffer position checks based on jiffies when internal hw_ptr is updated. Enable xrun_debug to see mangling of wrong positions. As a side effect, the hw_ptr interrupt update routine might do slightly better job when many interrupts are lost. Signed-off-by: Jaroslav Kysela --- include/sound/pcm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 8904b1900d7f..c17296891617 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -268,7 +268,8 @@ struct snd_pcm_runtime { int overrange; snd_pcm_uframes_t avail_max; snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ - snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/ + snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ + unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ /* -- HW params -- */ snd_pcm_access_t access; /* access mode */ -- cgit v1.2.3 From 9d59065cd6fae841ca56c281189d5b8d0817d35f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 14 Apr 2009 16:13:58 +0200 Subject: ALSA: add private_data to struct snd_jack Added private_data and private_free fields to struct snd_jack so that the caller can assign the data. It'll be helpful for avoiding the double-free of the jack instance. Signed-off-by: Takashi Iwai --- include/sound/jack.h | 2 ++ sound/core/jack.c | 3 +++ 2 files changed, 5 insertions(+) (limited to 'include') diff --git a/include/sound/jack.h b/include/sound/jack.h index 6b013c6f6a04..f236e426a706 100644 --- a/include/sound/jack.h +++ b/include/sound/jack.h @@ -50,6 +50,8 @@ struct snd_jack { int type; const char *id; char name[100]; + void *private_data; + void (*private_free)(struct snd_jack *); }; #ifdef CONFIG_SND_JACK diff --git a/sound/core/jack.c b/sound/core/jack.c index c8254c667c62..d54d1a05fe65 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c @@ -35,6 +35,9 @@ static int snd_jack_dev_free(struct snd_device *device) { struct snd_jack *jack = device->device_data; + if (jack->private_free) + jack->private_free(jack); + /* If the input device is registered with the input subsystem * then we need to use a different deallocator. */ if (jack->registered) -- cgit v1.2.3