mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
pcm: dmix: Add option to allow alignment of slave pointers
These changes are required due to the kernel
commit 07b7acb51d283d8469696c906b91f1882696a4d4
("ASoC: rsnd: update pointer more accurate")
Issue is that snd_pcm_wait() goes back to waiting because the hw_ptr
is not period aligned. Therefore snd_pcm_wait() will block for a longer
time as required.
With these rcar driver changes the exact position of the dma is returned.
During snd_pcm_start they read hw_ptr as reference, and this hw_ptr
is now not period aligned, and is a little ahead over the period while it
is read. Therefore when the avail is calculated during snd_pcm_wait(),
it is missing the avail_min by a few frames.
An additional option hw_ptr_alignment is provided to dmix configuration,
to allow the user to configure the slave application and hw pointer
alignment at startup
[ Slight indentation and parentheses removals by tiwai ]
Signed-off-by: Laxmi Devi <Laxmi.Devi@in.bosch.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
178fe66bc8
commit
6b058fda9d
3 changed files with 76 additions and 8 deletions
|
|
@ -50,6 +50,13 @@ typedef void (mix_areas_u8_t)(unsigned int size,
|
|||
volatile signed int *sum, size_t dst_step,
|
||||
size_t src_step, size_t sum_step);
|
||||
|
||||
typedef enum snd_pcm_direct_hw_ptr_alignment {
|
||||
SND_PCM_HW_PTR_ALIGNMENT_NO = 0, /* use the hw_ptr as is and do no rounding */
|
||||
SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP = 1, /* round the slave_appl_ptr up to slave_period */
|
||||
SND_PCM_HW_PTR_ALIGNMENT_ROUNDDOWN = 2, /* round slave_hw_ptr and slave_appl_ptr down to slave_period */
|
||||
SND_PCM_HW_PTR_ALIGNMENT_AUTO = 3 /* automatic selection */
|
||||
} snd_pcm_direct_hw_ptr_alignment_t;
|
||||
|
||||
struct slave_params {
|
||||
snd_pcm_format_t format;
|
||||
int rate;
|
||||
|
|
@ -160,6 +167,7 @@ struct snd_pcm_direct {
|
|||
unsigned int *bindings;
|
||||
unsigned int recoveries; /* mirror of executed recoveries on slave */
|
||||
int direct_memory_access; /* use arch-optimized buffer RW */
|
||||
snd_pcm_direct_hw_ptr_alignment_t hw_ptr_alignment;
|
||||
union {
|
||||
struct {
|
||||
int shmid_sum; /* IPC global sum ring buffer memory identification */
|
||||
|
|
@ -342,6 +350,7 @@ struct snd_pcm_direct_open_conf {
|
|||
int max_periods;
|
||||
int var_periodsize;
|
||||
int direct_memory_access;
|
||||
snd_pcm_direct_hw_ptr_alignment_t hw_ptr_alignment;
|
||||
snd_config_t *slave;
|
||||
snd_config_t *bindings;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue