From d099e2c58954f1b0063e8e2d5e24f3a663814482 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 05 2019 19:42:14 +0000 Subject: import alsa-lib-1.1.9-4.el8 --- diff --git a/.alsa-lib.metadata b/.alsa-lib.metadata index feeb5e3..c9df5ae 100644 --- a/.alsa-lib.metadata +++ b/.alsa-lib.metadata @@ -1 +1 @@ -b96002ef24b4155e5d86c081869d8d7b4b496fde SOURCES/alsa-lib-1.1.6.tar.bz2 +2404e1c377428908c5188076d5652a2a1ecd028e SOURCES/alsa-lib-1.1.9.tar.bz2 diff --git a/.gitignore b/.gitignore index 745582a..7200175 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/alsa-lib-1.1.6.tar.bz2 +SOURCES/alsa-lib-1.1.9.tar.bz2 diff --git a/SOURCES/alsa-git.patch b/SOURCES/alsa-git.patch new file mode 100644 index 0000000..2662484 --- /dev/null +++ b/SOURCES/alsa-git.patch @@ -0,0 +1,2202 @@ +From 63ba5243ab7a33b77be5b65c0a8a2a0d5e26983f Mon Sep 17 00:00:00 2001 +From: Vanitha Channaiah +Date: Wed, 15 May 2019 11:56:32 +0530 +Subject: [PATCH 01/25] pcm: direct: Add generic hw_ptr_alignment function for + dmix, dshare and dsnoop + +Move the code snd_pcm_direct_reset_slave_ptr() from pcm_dmix.c +to pcm_direct.c and its header so that the helper function can be +re-used by other direct-pcm plugins. +There is no change in the behavior or the functionality. + +Signed-off-by: Vanitha Channaiah +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_direct.c | 19 +++++++++++++++++++ + src/pcm/pcm_direct.h | 8 ++++++++ + src/pcm/pcm_dmix.c | 25 ++----------------------- + 3 files changed, 29 insertions(+), 23 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 666a8ce5..411a035b 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -2040,3 +2040,22 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf, + + return 0; + } ++ ++void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) ++{ ++ dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; ++ ++ if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP || ++ (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO && ++ pcm->buffer_size <= pcm->period_size * 2)) ++ dmix->slave_appl_ptr = ++ ((dmix->slave_appl_ptr + dmix->slave_period_size - 1) / ++ dmix->slave_period_size) * dmix->slave_period_size; ++ else if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDDOWN || ++ (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO && ++ (dmix->slave_period_size * SEC_TO_MS) / ++ pcm->rate < LOW_LATENCY_PERIOD_TIME)) ++ dmix->slave_appl_ptr = dmix->slave_hw_ptr = ++ ((dmix->slave_hw_ptr / dmix->slave_period_size) * ++ dmix->slave_period_size); ++} +diff --git a/src/pcm/pcm_direct.h b/src/pcm/pcm_direct.h +index da5e280e..a71aab13 100644 +--- a/src/pcm/pcm_direct.h ++++ b/src/pcm/pcm_direct.h +@@ -24,6 +24,11 @@ + + #define DIRECT_IPC_SEMS 1 + #define DIRECT_IPC_SEM_CLIENT 0 ++/* Seconds representing in Milli seconds */ ++#define SEC_TO_MS 1000 ++/* slave_period time for low latency requirements in ms */ ++#define LOW_LATENCY_PERIOD_TIME 10 ++ + + typedef void (mix_areas_t)(unsigned int size, + volatile void *dst, void *src, +@@ -257,6 +262,8 @@ struct snd_pcm_direct { + snd1_pcm_direct_get_chmap + #define snd_pcm_direct_set_chmap \ + snd1_pcm_direct_set_chmap ++#define snd_pcm_direct_reset_slave_ptr \ ++ snd1_pcm_direct_reset_slave_ptr + + int snd_pcm_direct_semaphore_create_or_connect(snd_pcm_direct_t *dmix); + +@@ -341,6 +348,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct); + int snd_pcm_direct_client_chk_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm); + int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid); + struct timespec snd_pcm_hw_fast_tstamp(snd_pcm_t *pcm); ++void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix); + + struct snd_pcm_direct_open_conf { + key_t ipc_key; +diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c +index c5592cdb..dcde40d9 100644 +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -55,9 +55,6 @@ const char *_snd_module_pcm_dmix = ""; + #define STATE_RUN_PENDING 1024 + #endif + +-#define SEC_TO_MS 1000 /* Seconds representing in Milli seconds */ +-#define LOW_LATENCY_PERIOD_TIME 10 /* slave_period time for low latency requirements in ms */ +- + /* + * + */ +@@ -560,30 +557,12 @@ static int snd_pcm_dmix_hwsync(snd_pcm_t *pcm) + } + } + +-static void reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) +-{ +- dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; +- +- if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP || +- (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO && +- pcm->buffer_size <= pcm->period_size * 2)) +- dmix->slave_appl_ptr = +- ((dmix->slave_appl_ptr + dmix->slave_period_size - 1) +- / dmix->slave_period_size) * dmix->slave_period_size; +- else if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDDOWN || +- (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO && +- (dmix->slave_period_size * SEC_TO_MS) / pcm->rate < LOW_LATENCY_PERIOD_TIME)) +- dmix->slave_appl_ptr = dmix->slave_hw_ptr = +- ((dmix->slave_hw_ptr / dmix->slave_period_size) * +- dmix->slave_period_size); +-} +- + static int snd_pcm_dmix_reset(snd_pcm_t *pcm) + { + snd_pcm_direct_t *dmix = pcm->private_data; + dmix->hw_ptr %= pcm->period_size; + dmix->appl_ptr = dmix->last_appl_ptr = dmix->hw_ptr; +- reset_slave_ptr(pcm, dmix); ++ snd_pcm_direct_reset_slave_ptr(pcm, dmix); + return 0; + } + +@@ -592,7 +571,7 @@ static int snd_pcm_dmix_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) + int err; + + snd_pcm_hwsync(dmix->spcm); +- reset_slave_ptr(pcm, dmix); ++ snd_pcm_direct_reset_slave_ptr(pcm, dmix); + err = snd_timer_start(dmix->timer); + if (err < 0) + return err; +-- +2.20.1 + + +From 7265e603bf880a9ec2cd01c3cf2afbd7709e5af4 Mon Sep 17 00:00:00 2001 +From: Vanitha Channaiah +Date: Wed, 15 May 2019 11:56:33 +0530 +Subject: [PATCH 02/25] pcm: dshare: Added "hw_ptr_alignment" option in + configuration for alignment of slave pointers + +This change adapt the fix commit 6b058fda9dce +("pcm: dmix: Add option to allow alignment of slave pointers") +for dshare plugin + +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 dshare configuration, +to allow the user to configure the slave application and hw pointer +alignment at startup + +Signed-off-by: Vanitha Channaiah +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_dshare.c | 40 +++++++++++++++++++++++++++++++++++----- + 1 file changed, 35 insertions(+), 5 deletions(-) + +diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c +index f135b5df..cf8a8631 100644 +--- a/src/pcm/pcm_dshare.c ++++ b/src/pcm/pcm_dshare.c +@@ -333,16 +333,16 @@ static int snd_pcm_dshare_reset(snd_pcm_t *pcm) + snd_pcm_direct_t *dshare = pcm->private_data; + dshare->hw_ptr %= pcm->period_size; + dshare->appl_ptr = dshare->last_appl_ptr = dshare->hw_ptr; +- dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr; ++ snd_pcm_direct_reset_slave_ptr(pcm, dshare); + return 0; + } + +-static int snd_pcm_dshare_start_timer(snd_pcm_direct_t *dshare) ++static int snd_pcm_dshare_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dshare) + { + int err; + + snd_pcm_hwsync(dshare->spcm); +- dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr; ++ snd_pcm_direct_reset_slave_ptr(pcm, dshare); + err = snd_timer_start(dshare->timer); + if (err < 0) + return err; +@@ -364,7 +364,8 @@ static int snd_pcm_dshare_start(snd_pcm_t *pcm) + else if (avail < 0) + return 0; + else { +- if ((err = snd_pcm_dshare_start_timer(dshare)) < 0) ++ err = snd_pcm_dshare_start_timer(pcm, dshare); ++ if (err < 0) + return err; + snd_pcm_dshare_sync_area(pcm); + } +@@ -547,7 +548,8 @@ static snd_pcm_sframes_t snd_pcm_dshare_mmap_commit(snd_pcm_t *pcm, + return 0; + snd_pcm_mmap_appl_forward(pcm, size); + if (dshare->state == STATE_RUN_PENDING) { +- if ((err = snd_pcm_dshare_start_timer(dshare)) < 0) ++ err = snd_pcm_dshare_start_timer(pcm, dshare); ++ if (err < 0) + return err; + } else if (dshare->state == SND_PCM_STATE_RUNNING || + dshare->state == SND_PCM_STATE_DRAINING) { +@@ -755,6 +757,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, + dshare->slowptr = opts->slowptr; + dshare->max_periods = opts->max_periods; + dshare->var_periodsize = opts->var_periodsize; ++ dshare->hw_ptr_alignment = opts->hw_ptr_alignment; + dshare->sync_ptr = snd_pcm_dshare_sync_ptr; + + retry: +@@ -912,6 +915,12 @@ pcm.name { + ipc_key INT # unique IPC key + ipc_key_add_uid BOOL # add current uid to unique IPC key + ipc_perm INT # IPC permissions (octal, default 0600) ++ hw_ptr_alignment STR # Slave application and hw pointer alignment type ++ # STR can be one of the below strings : ++ # no ++ # roundup ++ # rounddown ++ # auto (default) + slave STR + # or + slave { # Slave definition +@@ -936,6 +945,27 @@ pcm.name { + } + \endcode + ++hw_ptr_alignment specifies slave application and hw ++pointer alignment type. By default hw_ptr_alignment is auto. Below are ++the possible configurations: ++- no: minimal latency with minimal frames dropped at startup. But ++ wakeup of application (return from snd_pcm_wait() or poll()) can ++ take up to 2 * period. ++- roundup: It is guaranteed that all frames will be played at ++ startup. But the latency will increase upto period-1 frames. ++- rounddown: It is guaranteed that a wakeup will happen for each ++ period and frames can be written from application. But on startup ++ upto period-1 frames will be dropped. ++- auto: Selects the best approach depending on the used period and ++ buffer size. ++ If the application buffer size is < 2 * application period, ++ "roundup" will be selected to avoid under runs. If the slave_period ++ is < 10ms we could expect that there are low latency ++ requirements. Therefore "rounddown" will be chosen to avoid long ++ wakeup times. Such wakeup delay could otherwise end up with Xruns in ++ case of a dependency to another sound device (e.g. forwarding of ++ microphone to speaker). Else "no" will be chosen. ++ + \subsection pcm_plugins_dshare_funcref Function reference + +
    +-- +2.20.1 + + +From 3ab798004733ce65bd5c7a48d650de3465825210 Mon Sep 17 00:00:00 2001 +From: Vanitha Channaiah +Date: Wed, 15 May 2019 11:56:34 +0530 +Subject: [PATCH 03/25] pcm: dsnoop: Added "hw_ptr_alignment" option in + configuration for slave pointer alignment + +This change adapt the fix commit 6b058fda9dce +("pcm: dmix: Add option to allow alignment of slave pointers") +for dsnoop plugin + +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 dsnoop configuration, +to allow the user to configure the slave application and hw pointer +alignment at startup + +Signed-off-by: Vanitha Channaiah +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_direct.c | 1 - + src/pcm/pcm_dmix.c | 2 ++ + src/pcm/pcm_dshare.c | 2 ++ + src/pcm/pcm_dsnoop.c | 30 +++++++++++++++++++++++++++++- + 4 files changed, 33 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index 411a035b..54d99005 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -2043,7 +2043,6 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf, + + void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) + { +- dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; + + if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP || + (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO && +diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c +index dcde40d9..274726e4 100644 +--- a/src/pcm/pcm_dmix.c ++++ b/src/pcm/pcm_dmix.c +@@ -562,6 +562,7 @@ static int snd_pcm_dmix_reset(snd_pcm_t *pcm) + snd_pcm_direct_t *dmix = pcm->private_data; + dmix->hw_ptr %= pcm->period_size; + dmix->appl_ptr = dmix->last_appl_ptr = dmix->hw_ptr; ++ dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; + snd_pcm_direct_reset_slave_ptr(pcm, dmix); + return 0; + } +@@ -571,6 +572,7 @@ static int snd_pcm_dmix_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dmix) + int err; + + snd_pcm_hwsync(dmix->spcm); ++ dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr; + snd_pcm_direct_reset_slave_ptr(pcm, dmix); + err = snd_timer_start(dmix->timer); + if (err < 0) +diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c +index cf8a8631..b75809c8 100644 +--- a/src/pcm/pcm_dshare.c ++++ b/src/pcm/pcm_dshare.c +@@ -333,6 +333,7 @@ static int snd_pcm_dshare_reset(snd_pcm_t *pcm) + snd_pcm_direct_t *dshare = pcm->private_data; + dshare->hw_ptr %= pcm->period_size; + dshare->appl_ptr = dshare->last_appl_ptr = dshare->hw_ptr; ++ dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr; + snd_pcm_direct_reset_slave_ptr(pcm, dshare); + return 0; + } +@@ -342,6 +343,7 @@ static int snd_pcm_dshare_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dshare) + int err; + + snd_pcm_hwsync(dshare->spcm); ++ dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr; + snd_pcm_direct_reset_slave_ptr(pcm, dshare); + err = snd_timer_start(dshare->timer); + if (err < 0) +diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c +index d08b6241..58b1e534 100644 +--- a/src/pcm/pcm_dsnoop.c ++++ b/src/pcm/pcm_dsnoop.c +@@ -278,6 +278,7 @@ static int snd_pcm_dsnoop_reset(snd_pcm_t *pcm) + dsnoop->hw_ptr %= pcm->period_size; + dsnoop->appl_ptr = dsnoop->hw_ptr; + dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr; ++ snd_pcm_direct_reset_slave_ptr(pcm, dsnoop); + return 0; + } + +@@ -285,12 +286,13 @@ static int snd_pcm_dsnoop_start(snd_pcm_t *pcm) + { + snd_pcm_direct_t *dsnoop = pcm->private_data; + int err; +- ++ + if (dsnoop->state != SND_PCM_STATE_PREPARED) + return -EBADFD; + snd_pcm_hwsync(dsnoop->spcm); + snoop_timestamp(pcm); + dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr; ++ snd_pcm_direct_reset_slave_ptr(pcm, dsnoop); + err = snd_timer_start(dsnoop->timer); + if (err < 0) + return err; +@@ -627,6 +629,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, + dsnoop->max_periods = opts->max_periods; + dsnoop->var_periodsize = opts->var_periodsize; + dsnoop->sync_ptr = snd_pcm_dsnoop_sync_ptr; ++ dsnoop->hw_ptr_alignment = opts->hw_ptr_alignment; + + retry: + if (first_instance) { +@@ -771,6 +774,12 @@ pcm.name { + ipc_key INT # unique IPC key + ipc_key_add_uid BOOL # add current uid to unique IPC key + ipc_perm INT # IPC permissions (octal, default 0600) ++ hw_ptr_alignment STR # Slave application and hw pointer alignment type ++ # STR can be one of the below strings : ++ # no ++ # roundup ++ # rounddown ++ # auto (default) + slave STR + # or + slave { # Slave definition +@@ -795,6 +804,25 @@ pcm.name { + } + \endcode + ++hw_ptr_alignment specifies slave application and hw ++pointer alignment type. By default hw_ptr_alignment is auto. Below are ++the possible configurations: ++- no: minimal latency with minimal frames dropped at startup. But ++ wakeup of application (return from snd_pcm_wait() or poll()) can ++ take up to 2 * period. ++- roundup: It is guaranteed that all frames will be played at ++ startup. But the latency will increase upto period-1 frames. ++- rounddown: It is guaranteed that a wakeup will happen for each ++ period and frames can be written from application. But on startup ++ upto period-1 frames will be dropped. ++- auto: Selects the best approach depending on the used period and ++ buffer size. ++ If the application buffer size is < 2 * application period, ++ "roundup" will be selected to avoid over runs. If the slave_period ++ is < 10ms we could expect that there are low latency ++ requirements. Therefore "rounddown" will be chosen to avoid long ++ wakeup times. Else "no" will be chosen. ++ + \subsection pcm_plugins_dsnoop_funcref Function reference + +
      +-- +2.20.1 + + +From 5f2e5af61b0b8cfbf310e8b1e08a034d993e432f Mon Sep 17 00:00:00 2001 +From: Adam Miartus +Date: Tue, 21 May 2019 15:32:47 +0200 +Subject: [PATCH 04/25] pcm: file: add support for infile reading in non + interleaved mode + +add helper function to copy input file data to buffer mapped by areas, +in case of an error, do not fill the areas, allowing device read buffer +to be provided to api caller + +previously unused rbuf variable is reused for this purpose + +Signed-off-by: Adam Miartus +Reviewed-by: Timo Wischer +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_file.c | 67 ++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 56 insertions(+), 11 deletions(-) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 3a19cef9..3c682659 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -77,6 +77,7 @@ typedef struct { + snd_pcm_uframes_t appl_ptr; + snd_pcm_uframes_t file_ptr_bytes; + snd_pcm_uframes_t wbuf_size; ++ snd_pcm_uframes_t rbuf_size; + size_t wbuf_size_bytes; + size_t wbuf_used_bytes; + char *wbuf; +@@ -266,6 +267,39 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file) + return 0; + } + ++/* fill areas with data from input file, return bytes red */ ++static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm, ++ const snd_pcm_channel_area_t *areas, ++ snd_pcm_uframes_t offset, ++ snd_pcm_uframes_t frames) ++{ ++ snd_pcm_file_t *file = pcm->private_data; ++ snd_pcm_channel_area_t areas_if[pcm->channels]; ++ ssize_t bytes; ++ ++ if (file->ifd < 0) ++ return -EBADF; ++ ++ if (file->rbuf == NULL) ++ return -ENOMEM; ++ ++ if (file->rbuf_size < frames) { ++ SYSERR("requested more frames than pcm buffer"); ++ return -ENOMEM; ++ } ++ ++ bytes = read(file->ifd, file->rbuf, snd_pcm_frames_to_bytes(pcm, frames)); ++ if (bytes < 0) { ++ SYSERR("read from file failed, error: %d", bytes); ++ return bytes; ++ } ++ ++ snd_pcm_areas_from_buf(pcm, areas_if, file->rbuf); ++ snd_pcm_areas_copy(areas, offset, areas_if, 0, pcm->channels, snd_pcm_bytes_to_frames(pcm, bytes), pcm->format); ++ ++ return bytes; ++} ++ + static void setup_wav_header(snd_pcm_t *pcm, struct wav_fmt *fmt) + { + fmt->fmt = TO_LE16(0x01); +@@ -568,19 +602,19 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm + { + snd_pcm_file_t *file = pcm->private_data; + snd_pcm_channel_area_t areas[pcm->channels]; +- snd_pcm_sframes_t n; ++ snd_pcm_sframes_t frames; + +- if (file->ifd >= 0) { +- SNDERR("DEBUG: Noninterleaved read not yet implemented.\n"); +- return 0; /* TODO: Noninterleaved read */ +- } ++ __snd_pcm_lock(pcm); ++ frames = _snd_pcm_readn(file->gen.slave, bufs, size); ++ if (frames <= 0) ++ return frames; + +- n = _snd_pcm_readn(file->gen.slave, bufs, size); +- if (n > 0) { +- snd_pcm_areas_from_bufs(pcm, areas, bufs); +- snd_pcm_file_add_frames(pcm, areas, 0, n); +- } +- return n; ++ snd_pcm_areas_from_bufs(pcm, areas, bufs); ++ snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); ++ snd_pcm_file_add_frames(pcm, areas, 0, frames); ++ ++ __snd_pcm_unlock(pcm); ++ return frames; + } + + static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, +@@ -609,9 +643,11 @@ static int snd_pcm_file_hw_free(snd_pcm_t *pcm) + free(file->wbuf); + free(file->wbuf_areas); + free(file->final_fname); ++ free(file->rbuf); + file->wbuf = NULL; + file->wbuf_areas = NULL; + file->final_fname = NULL; ++ file->rbuf = NULL; + return snd_pcm_hw_free(file->gen.slave); + } + +@@ -638,6 +674,15 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + snd_pcm_file_hw_free(pcm); + return -ENOMEM; + } ++ assert(!file->rbuf); ++ file->rbuf_size = slave->buffer_size; ++ file->rbuf_size_bytes = snd_pcm_frames_to_bytes(slave, file->rbuf_size); ++ file->rbuf_used_bytes = 0; ++ file->rbuf = malloc(file->rbuf_size_bytes); ++ if (file->rbuf == NULL) { ++ snd_pcm_file_hw_free(pcm); ++ return -ENOMEM; ++ } + file->appl_ptr = file->file_ptr_bytes = 0; + for (channel = 0; channel < slave->channels; ++channel) { + snd_pcm_channel_area_t *a = &file->wbuf_areas[channel]; +-- +2.20.1 + + +From 349b42f5477c904fa3e10bac2fa2429fad2cbc65 Mon Sep 17 00:00:00 2001 +From: Adam Miartus +Date: Tue, 21 May 2019 15:33:08 +0200 +Subject: [PATCH 05/25] pcm: file: use snd_pcm_file_areas_read_infile for readi + +use previously introduced helper function, this commit unifies behavior +of readi and readn + +corner case behavior of readi is changed by this commit, previously, +in case 0 bytes were red from file (EOF), frames = 0 was returned, +signaling api user as if no data was red from slave, after the patch, +amount of frames red from slave with data red from slave stored in buffer +is returned when EOF is reached + +Signed-off-by: Adam Miartus +Reviewed-by: Timo Wischer +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_file.c | 27 +++++++++++++-------------- + 1 file changed, 13 insertions(+), 14 deletions(-) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 3c682659..dcaa41d1 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -579,22 +579,21 @@ static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pc + { + snd_pcm_file_t *file = pcm->private_data; + snd_pcm_channel_area_t areas[pcm->channels]; +- snd_pcm_sframes_t n; ++ snd_pcm_sframes_t frames; ++ ++ __snd_pcm_lock(pcm); ++ ++ frames = _snd_pcm_readi(file->gen.slave, buffer, size); ++ if (frames <= 0) ++ return frames; + +- n = _snd_pcm_readi(file->gen.slave, buffer, size); +- if (n <= 0) +- return n; +- if (file->ifd >= 0) { +- __snd_pcm_lock(pcm); +- n = read(file->ifd, buffer, n * pcm->frame_bits / 8); +- __snd_pcm_unlock(pcm); +- if (n < 0) +- return n; +- n = n * 8 / pcm->frame_bits; +- } + snd_pcm_areas_from_buf(pcm, areas, buffer); +- snd_pcm_file_add_frames(pcm, areas, 0, n); +- return n; ++ snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); ++ snd_pcm_file_add_frames(pcm, areas, 0, frames); ++ ++ __snd_pcm_unlock(pcm); ++ ++ return frames; + } + + /* locking */ +-- +2.20.1 + + +From 33c7ea0865b7f87cef1c3d3e767734c0edd02e84 Mon Sep 17 00:00:00 2001 +From: Adam Miartus +Date: Thu, 23 May 2019 11:44:30 +0200 +Subject: [PATCH 06/25] pcm: file: add missing unlock on early return + +Signed-off-by: Adam Miartus +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_file.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index dcaa41d1..8e2c70b1 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -584,8 +584,10 @@ static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pc + __snd_pcm_lock(pcm); + + frames = _snd_pcm_readi(file->gen.slave, buffer, size); +- if (frames <= 0) ++ if (frames <= 0) { ++ __snd_pcm_unlock(pcm); + return frames; ++ } + + snd_pcm_areas_from_buf(pcm, areas, buffer); + snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); +@@ -605,8 +607,10 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm + + __snd_pcm_lock(pcm); + frames = _snd_pcm_readn(file->gen.slave, bufs, size); +- if (frames <= 0) ++ if (frames <= 0) { ++ __snd_pcm_unlock(pcm); + return frames; ++ } + + snd_pcm_areas_from_bufs(pcm, areas, bufs); + snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); +-- +2.20.1 + + +From 108a2f43791fe769fd58726881b12ad908ebd2e0 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 18 Apr 2019 20:40:18 +0200 +Subject: [PATCH 07/25] ucm: Add UCM profile for CX2072X codec on + Baytrail/Cherrytrail profiles + +Adding a new Conexant CX2072X codec profile and reusing the existing +BYT/CHT platform snippets. + +Currently tested only on ASUS E200HA laptop. + +Signed-off-by: Takashi Iwai +--- + configure.ac | 2 ++ + src/conf/ucm/Makefile.am | 1 + + src/conf/ucm/bytcht-cx2072x/HiFi.conf | 24 ++++++++++++++++++ + src/conf/ucm/bytcht-cx2072x/Makefile.am | 4 +++ + .../ucm/bytcht-cx2072x/bytcht-cx2072x.conf | 8 ++++++ + src/conf/ucm/codecs/Makefile.am | 1 + + src/conf/ucm/codecs/cx2072x/DisableSeq.conf | 7 ++++++ + src/conf/ucm/codecs/cx2072x/EnableSeq.conf | 13 ++++++++++ + src/conf/ucm/codecs/cx2072x/HeadPhones.conf | 24 ++++++++++++++++++ + src/conf/ucm/codecs/cx2072x/HeadsetMic.conf | 25 +++++++++++++++++++ + src/conf/ucm/codecs/cx2072x/InternalMic.conf | 24 ++++++++++++++++++ + src/conf/ucm/codecs/cx2072x/Makefile.am | 6 +++++ + src/conf/ucm/codecs/cx2072x/Speaker.conf | 23 +++++++++++++++++ + 13 files changed, 162 insertions(+) + create mode 100644 src/conf/ucm/bytcht-cx2072x/HiFi.conf + create mode 100644 src/conf/ucm/bytcht-cx2072x/Makefile.am + create mode 100644 src/conf/ucm/bytcht-cx2072x/bytcht-cx2072x.conf + create mode 100644 src/conf/ucm/codecs/cx2072x/DisableSeq.conf + create mode 100644 src/conf/ucm/codecs/cx2072x/EnableSeq.conf + create mode 100644 src/conf/ucm/codecs/cx2072x/HeadPhones.conf + create mode 100644 src/conf/ucm/codecs/cx2072x/HeadsetMic.conf + create mode 100644 src/conf/ucm/codecs/cx2072x/InternalMic.conf + create mode 100644 src/conf/ucm/codecs/cx2072x/Makefile.am + create mode 100644 src/conf/ucm/codecs/cx2072x/Speaker.conf + +diff --git a/configure.ac b/configure.ac +index 0fb34de4..2e955760 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -720,6 +720,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ + src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile \ + src/conf/ucm/broadwell-rt286/Makefile \ + src/conf/ucm/broxton-rt298/Makefile \ ++ src/conf/ucm/bytcht-cx2072x/Makefile \ + src/conf/ucm/bytcht-es8316/Makefile \ + src/conf/ucm/bytcht-es8316-mono-spk-in1-mic/Makefile \ + src/conf/ucm/bytcht-es8316-mono-spk-in2-mic/Makefile \ +@@ -765,6 +766,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ + src/conf/ucm/tegraalc5632/Makefile \ + src/conf/ucm/VEYRON-I2S/Makefile \ + src/conf/ucm/codecs/Makefile \ ++ src/conf/ucm/codecs/cx2072x/Makefile \ + src/conf/ucm/codecs/es8316/Makefile \ + src/conf/ucm/codecs/nau8824/Makefile \ + src/conf/ucm/codecs/rt5640/Makefile \ +diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am +index e9f88ed6..02257048 100644 +--- a/src/conf/ucm/Makefile.am ++++ b/src/conf/ucm/Makefile.am +@@ -4,6 +4,7 @@ platforms \ + ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN \ + broadwell-rt286 \ + broxton-rt298 \ ++bytcht-cx2072x \ + bytcht-es8316 \ + bytcht-es8316-mono-spk-in1-mic \ + bytcht-es8316-mono-spk-in2-mic \ +diff --git a/src/conf/ucm/bytcht-cx2072x/HiFi.conf b/src/conf/ucm/bytcht-cx2072x/HiFi.conf +new file mode 100644 +index 00000000..e9c1f757 +--- /dev/null ++++ b/src/conf/ucm/bytcht-cx2072x/HiFi.conf +@@ -0,0 +1,24 @@ ++SectionVerb { ++ EnableSequence [ ++ cdev "hw:bytchtcx2072x" ++ ++ ++ ] ++ ++ DisableSequence [ ++ cdev "hw:bytchtcx2072x" ++ ++ ++ ] ++ ++ Value { ++ PlaybackPCM "hw:bytchtcx2072x" ++ CapturePCM "hw:bytchtcx2072x" ++ } ++} ++ ++ ++ ++ ++ ++ +diff --git a/src/conf/ucm/bytcht-cx2072x/Makefile.am b/src/conf/ucm/bytcht-cx2072x/Makefile.am +new file mode 100644 +index 00000000..373b2a77 +--- /dev/null ++++ b/src/conf/ucm/bytcht-cx2072x/Makefile.am +@@ -0,0 +1,4 @@ ++alsaconfigdir = @ALSA_CONFIG_DIR@ ++ucmdir = $(alsaconfigdir)/ucm/bytcht-cx2072x ++ucm_DATA = bytcht-cx2072x.conf HiFi.conf ++EXTRA_DIST = $(ucm_DATA) +diff --git a/src/conf/ucm/bytcht-cx2072x/bytcht-cx2072x.conf b/src/conf/ucm/bytcht-cx2072x/bytcht-cx2072x.conf +new file mode 100644 +index 00000000..fce04456 +--- /dev/null ++++ b/src/conf/ucm/bytcht-cx2072x/bytcht-cx2072x.conf +@@ -0,0 +1,8 @@ ++SectionUseCase."HiFi" { ++ File "HiFi.conf" ++ Comment "Play HiFi quality Music" ++} ++ ++SectionDefaults [ ++ cdev "hw:bytchtcx2072x" ++] +diff --git a/src/conf/ucm/codecs/Makefile.am b/src/conf/ucm/codecs/Makefile.am +index f78fd081..5987b9cf 100644 +--- a/src/conf/ucm/codecs/Makefile.am ++++ b/src/conf/ucm/codecs/Makefile.am +@@ -1,4 +1,5 @@ + SUBDIRS=\ ++cx2072x \ + es8316 \ + rt5640 \ + rt5645 \ +diff --git a/src/conf/ucm/codecs/cx2072x/DisableSeq.conf b/src/conf/ucm/codecs/cx2072x/DisableSeq.conf +new file mode 100644 +index 00000000..1e3d5489 +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/DisableSeq.conf +@@ -0,0 +1,7 @@ ++# Output Configuration ++cset "name='I2S DAC1L Switch' off" ++cset "name='I2S DAC1R Switch' off" ++ ++# Input Configuration ++cset "name='I2S ADC1L Switch' off" ++cset "name='I2S ADC1R Switch' off" +diff --git a/src/conf/ucm/codecs/cx2072x/EnableSeq.conf b/src/conf/ucm/codecs/cx2072x/EnableSeq.conf +new file mode 100644 +index 00000000..fb8e3fe2 +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/EnableSeq.conf +@@ -0,0 +1,13 @@ ++# Disable all inputs / outputs ++cset "name='Ext Spk Switch' off" ++cset "name='Headphone Switch' off" ++cset "name='Headset Mic Switch' off" ++cset "name='Int Mic Switch' off" ++ ++# Output Configuration ++cset "name='I2S DAC1L Switch' on" ++cset "name='I2S DAC1R Switch' on" ++ ++# Input Configuration ++cset "name='I2S ADC1L Switch' on" ++cset "name='I2S ADC1R Switch' on" +diff --git a/src/conf/ucm/codecs/cx2072x/HeadPhones.conf b/src/conf/ucm/codecs/cx2072x/HeadPhones.conf +new file mode 100644 +index 00000000..4e3ff950 +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/HeadPhones.conf +@@ -0,0 +1,24 @@ ++SectionDevice."Headphones" { ++ Comment "Headphones" ++ ++ ConflictingDevice [ ++ "Speaker" ++ ] ++ ++ EnableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Headphone Switch' on" ++ cset "name='PortA Out En Switch' on" ++ ] ++ ++ DisableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Headphone Switch' off" ++ cset "name='PortA Out En Switch' off" ++ ] ++ ++ Value { ++ PlaybackChannels "2" ++ JackControl "Headphone Jack" ++ } ++} +diff --git a/src/conf/ucm/codecs/cx2072x/HeadsetMic.conf b/src/conf/ucm/codecs/cx2072x/HeadsetMic.conf +new file mode 100644 +index 00000000..26b8df16 +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/HeadsetMic.conf +@@ -0,0 +1,25 @@ ++SectionDevice."HeadsetMic" { ++ Comment "Headset Microphone" ++ ++ ConflictingDevice [ ++ "InternalMic" ++ ] ++ ++ EnableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Headset Mic Switch' on" ++ cset "name='ADC1 Mux' 'PortD Switch'" ++ cset "name='PortD In En Switch' on" ++ ] ++ ++ DisableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Headset Mic Switch' off" ++ cset "name='PortD In En Switch' off" ++ ] ++ ++ Value { ++ CaptureChannels "2" ++ JackControl "Headset Mic Jack" ++ } ++} +diff --git a/src/conf/ucm/codecs/cx2072x/InternalMic.conf b/src/conf/ucm/codecs/cx2072x/InternalMic.conf +new file mode 100644 +index 00000000..a3e14538 +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/InternalMic.conf +@@ -0,0 +1,24 @@ ++SectionDevice."InternalMic" { ++ Comment "Internal Microphone" ++ ++ ConflictingDevice [ ++ "HeadsetMic" ++ ] ++ ++ EnableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Int Mic Switch' on" ++ cset "name='ADC1 Mux' 'PortC Switch'" ++ cset "name='PortC In En Switch' on" ++ ] ++ ++ DisableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Int Mic Switch' off" ++ cset "name='PortC In En Switch' off" ++ ] ++ ++ Value { ++ CaptureChannels "2" ++ } ++} +diff --git a/src/conf/ucm/codecs/cx2072x/Makefile.am b/src/conf/ucm/codecs/cx2072x/Makefile.am +new file mode 100644 +index 00000000..2990fd09 +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/Makefile.am +@@ -0,0 +1,6 @@ ++alsaconfigdir = @ALSA_CONFIG_DIR@ ++ucmdir = $(alsaconfigdir)/ucm/codecs/cx2072x ++ucm_DATA = EnableSeq.conf DisableSeq.conf \ ++ HeadPhones.conf Speaker.conf \ ++ InternalMic.conf HeadsetMic.conf ++EXTRA_DIST = $(ucm_DATA) +diff --git a/src/conf/ucm/codecs/cx2072x/Speaker.conf b/src/conf/ucm/codecs/cx2072x/Speaker.conf +new file mode 100644 +index 00000000..55e2b2ba +--- /dev/null ++++ b/src/conf/ucm/codecs/cx2072x/Speaker.conf +@@ -0,0 +1,23 @@ ++SectionDevice."Speaker" { ++ Comment "Speakers" ++ ++ ConflictingDevice [ ++ "Headphones" ++ ] ++ ++ EnableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Ext Spk Switch' on" ++ cset "name='PortG Out En Switch' on" ++ ] ++ ++ DisableSequence [ ++ cdev "hw:bytchtcx2072x" ++ cset "name='Ext Spk Switch' off" ++ cset "name='PortG Out En Switch' off" ++ ] ++ ++ Value { ++ PlaybackChannels "2" ++ } ++} +-- +2.20.1 + + +From e520f454803acfdb9af5cd7224129b37904eef4a Mon Sep 17 00:00:00 2001 +From: Adam Miartus +Date: Thu, 23 May 2019 15:00:39 +0200 +Subject: [PATCH 08/25] pcm: add mmap_begin callback to snd_pcm_fast_ops_t api + +main motivation for adding the callback is to use it to enable operation +on mmaped buffer before user access for pcm_file plugin + +support for MMAP read access with masking by data from input file is not +implemented for pcm_file plugin, by adding this callback implementing +such feature can be done by rewriting next continuous portion of buffer +on each mmap_begin call + +plugins like softvol use pcm_plugin interface and overwrite the buffer by +looping around it in avail_update callback, this patch hopes to simplify +the task by adding new api callback, removing the need for rewriting +pcm_file (to use pcm_plugin callbacks) and careful checking when looping +around whole mmaped buffer + +Signed-off-by: Adam Miartus +Reviewed-by: Timo Wischer +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm.c | 6 ++++++ + src/pcm/pcm_local.h | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index 3a71d79b..323926e1 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -7129,7 +7129,13 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, + snd_pcm_uframes_t f; + snd_pcm_uframes_t avail; + const snd_pcm_channel_area_t *xareas; ++ + assert(pcm && areas && offset && frames); ++ ++ if (pcm->fast_ops->mmap_begin) ++ return pcm->fast_ops->mmap_begin(pcm->fast_op_arg, areas, offset, frames); ++ ++ /* fallback for plugins that do not specify new callback */ + xareas = snd_pcm_mmap_areas(pcm); + if (xareas == NULL) + return -EBADFD; +diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h +index d52229d8..d5726eb2 100644 +--- a/src/pcm/pcm_local.h ++++ b/src/pcm/pcm_local.h +@@ -184,6 +184,7 @@ typedef struct { + int (*poll_descriptors)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space); /* locked */ + int (*poll_revents)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); /* locked */ + int (*may_wait_for_avail_min)(snd_pcm_t *pcm, snd_pcm_uframes_t avail); ++ int (*mmap_begin)(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames); /* locked */ + } snd_pcm_fast_ops_t; + + struct _snd_pcm { +-- +2.20.1 + + +From fe7ff721a954c3f8c2183febc7c3fa5736357b67 Mon Sep 17 00:00:00 2001 +From: Adam Miartus +Date: Thu, 23 May 2019 15:00:40 +0200 +Subject: [PATCH 09/25] pcm: file: add infile read support for mmap mode + +mmap_begin callback is used to copy data from input file to mmaped +buffer + +guard for corner use of api (multiple mmap_begin calls by user) is +introduced to check if next continuous buffer was already overwritten + +buffer is overwritten with input file data only in case of stream capture + +Signed-off-by: Adam Miartus +Reviewed-by: Timo Wischer +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_file.c | 31 +++++++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 8e2c70b1..52cc10a9 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -88,6 +88,7 @@ typedef struct { + size_t buffer_bytes; + struct wav_fmt wav_header; + size_t filelen; ++ char ifmmap_overwritten; + } snd_pcm_file_t; + + #if __BYTE_ORDER == __LITTLE_ENDIAN +@@ -630,6 +631,8 @@ static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, + const snd_pcm_channel_area_t *areas; + snd_pcm_sframes_t result; + ++ file->ifmmap_overwritten = 0; ++ + result = snd_pcm_mmap_begin(file->gen.slave, &areas, &ofs, &siz); + if (result >= 0) { + assert(ofs == offset && siz == size); +@@ -640,6 +643,32 @@ static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, + return result; + } + ++static int snd_pcm_file_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, ++ snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames) ++{ ++ snd_pcm_file_t *file = pcm->private_data; ++ snd_pcm_channel_area_t areas_if[pcm->channels]; ++ snd_pcm_uframes_t frames_if; ++ void *buffer = NULL; ++ int result; ++ ++ result = snd_pcm_mmap_begin(file->gen.slave, areas, offset, frames); ++ if (result < 0) ++ return result; ++ ++ if (pcm->stream != SND_PCM_STREAM_CAPTURE) ++ return result; ++ ++ /* user may run mmap_begin without mmap_commit multiple times in row */ ++ if (file->ifmmap_overwritten) ++ return result; ++ file->ifmmap_overwritten = 1; ++ ++ snd_pcm_file_areas_read_infile(pcm, *areas, *offset, *frames); ++ ++ return result; ++} ++ + static int snd_pcm_file_hw_free(snd_pcm_t *pcm) + { + snd_pcm_file_t *file = pcm->private_data; +@@ -666,6 +695,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + file->wbuf_size = slave->buffer_size * 2; + file->wbuf_size_bytes = snd_pcm_frames_to_bytes(slave, file->wbuf_size); + file->wbuf_used_bytes = 0; ++ file->ifmmap_overwritten = 0; + assert(!file->wbuf); + file->wbuf = malloc(file->wbuf_size_bytes); + if (file->wbuf == NULL) { +@@ -777,6 +807,7 @@ static const snd_pcm_fast_ops_t snd_pcm_file_fast_ops = { + .poll_descriptors = snd_pcm_generic_poll_descriptors, + .poll_revents = snd_pcm_generic_poll_revents, + .htimestamp = snd_pcm_generic_htimestamp, ++ .mmap_begin = snd_pcm_file_mmap_begin, + }; + + /** +-- +2.20.1 + + +From 47bc6d534102aca9cc2aed1b6bdd5633ef645a3f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 10:27:25 +0200 +Subject: [PATCH 10/25] aserver: fix resource leak coverity + +Signed-off-by: Jaroslav Kysela +--- + aserver/aserver.c | 33 +++++++++++++++++++-------------- + 1 file changed, 19 insertions(+), 14 deletions(-) + +diff --git a/aserver/aserver.c b/aserver/aserver.c +index 066414d8..6d20f330 100644 +--- a/aserver/aserver.c ++++ b/aserver/aserver.c +@@ -75,6 +75,7 @@ static int make_local_socket(const char *filename) + if (bind(sock, (struct sockaddr *) addr, size) < 0) { + int result = -errno; + SYSERROR("bind failed"); ++ close(sock); + return result; + } + +@@ -101,6 +102,7 @@ static int make_inet_socket(int port) + if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + int result = -errno; + SYSERROR("bind failed"); ++ close(sock); + return result; + } + +@@ -916,10 +918,9 @@ static int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED + + static int server(const char *sockname, int port) + { +- int err; ++ int err, result, sockn = -1, socki = -1; + unsigned int k; + long open_max; +- int result; + + if (!sockname && port < 0) + return -EINVAL; +@@ -933,36 +934,36 @@ static int server(const char *sockname, int port) + waiters = calloc((size_t) open_max, sizeof(*waiters)); + + if (sockname) { +- int sock = make_local_socket(sockname); +- if (sock < 0) +- return sock; +- if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { ++ sockn = make_local_socket(sockname); ++ if (sockn < 0) ++ return sockn; ++ if (fcntl(sockn, F_SETFL, O_NONBLOCK) < 0) { + result = -errno; + SYSERROR("fcntl O_NONBLOCK failed"); + goto _end; + } +- if (listen(sock, 4) < 0) { ++ if (listen(sockn, 4) < 0) { + result = -errno; + SYSERROR("listen failed"); + goto _end; + } +- add_waiter(sock, POLLIN, local_handler, NULL); ++ add_waiter(sockn, POLLIN, local_handler, NULL); + } + if (port >= 0) { +- int sock = make_inet_socket(port); +- if (sock < 0) +- return sock; +- if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { ++ socki = make_inet_socket(port); ++ if (socki < 0) ++ return socki; ++ if (fcntl(socki, F_SETFL, O_NONBLOCK) < 0) { + result = -errno; + SYSERROR("fcntl failed"); + goto _end; + } +- if (listen(sock, 4) < 0) { ++ if (listen(socki, 4) < 0) { + result = -errno; + SYSERROR("listen failed"); + goto _end; + } +- add_waiter(sock, POLLIN, inet_handler, NULL); ++ add_waiter(socki, POLLIN, inet_handler, NULL); + } + + while (1) { +@@ -991,6 +992,10 @@ static int server(const char *sockname, int port) + } + } + _end: ++ if (sockn >= 0) ++ close(sockn); ++ if (socki >= 0) ++ close(socki); + free(pollfds); + free(waiters); + return result; +-- +2.20.1 + + +From 4aa960c48b4d292425597d283f3ef15d02590082 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 10:39:05 +0200 +Subject: [PATCH 11/25] src/conf.c: add missing va_end() call (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index cda5518e..3a3c91bf 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -3034,8 +3034,10 @@ int snd_config_save(snd_config_t *config, snd_output_t *out) + if (!k) \ + break; \ + err = fcn(config, k, &n); \ +- if (err < 0) \ ++ if (err < 0) { \ ++ va_end(arg); \ + return err; \ ++ } \ + config = n; \ + } \ + va_end(arg); \ +@@ -3056,8 +3058,10 @@ int snd_config_save(snd_config_t *config, snd_output_t *out) + if (!k) \ + break; \ + err = fcn(root, config, k, &n); \ +- if (err < 0) \ ++ if (err < 0) { \ ++ va_end(arg); \ + return err; \ ++ } \ + config = n; \ + } \ + va_end(arg); \ +-- +2.20.1 + + +From 990b1a53ed800caac0bab1c2b7987205569861fe Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 10:44:49 +0200 +Subject: [PATCH 12/25] config: parse_string() fix the dynamic buffer + allocation failure code (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/conf.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/src/conf.c b/src/conf.c +index 3a3c91bf..3e4b76a3 100644 +--- a/src/conf.c ++++ b/src/conf.c +@@ -4747,8 +4747,11 @@ static int parse_string(const char **ptr, char **val) + return -EINVAL; + case '\\': + c = parse_char(ptr); +- if (c < 0) ++ if (c < 0) { ++ if (alloc > bufsize) ++ free(buf); + return c; ++ } + break; + default: + (*ptr)++; +@@ -4768,12 +4771,17 @@ static int parse_string(const char **ptr, char **val) + alloc *= 2; + if (old_alloc == bufsize) { + buf = malloc(alloc); ++ if (!buf) ++ return -ENOMEM; + memcpy(buf, _buf, old_alloc); + } else { +- buf = realloc(buf, alloc); ++ char *buf2 = realloc(buf, alloc); ++ if (!buf2) { ++ free(buf); ++ return -ENOMEM; ++ } ++ buf = buf2; + } +- if (!buf) +- return -ENOMEM; + } + buf[idx++] = c; + } +-- +2.20.1 + + +From 51881cacc05e7d5e3cc8fc1ec9a4ac93a6327703 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 10:51:47 +0200 +Subject: [PATCH 13/25] control_shm: remove duplicate code (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/control/control_shm.c | 18 +++--------------- + 1 file changed, 3 insertions(+), 15 deletions(-) + +diff --git a/src/control/control_shm.c b/src/control/control_shm.c +index d7b41398..1d9de8b7 100644 +--- a/src/control/control_shm.c ++++ b/src/control/control_shm.c +@@ -302,13 +302,9 @@ static int snd_ctl_shm_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev) + { + snd_ctl_shm_t *shm = ctl->private_data; + volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; +- int err; + ctrl->u.pcm_prefer_subdevice = subdev; + ctrl->cmd = SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE; +- err = snd_ctl_shm_action(ctl); +- if (err < 0) +- return err; +- return err; ++ return snd_ctl_shm_action(ctl); + } + + static int snd_ctl_shm_rawmidi_next_device(snd_ctl_t *ctl, int * device) +@@ -343,26 +339,18 @@ static int snd_ctl_shm_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev) + { + snd_ctl_shm_t *shm = ctl->private_data; + volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; +- int err; + ctrl->u.rawmidi_prefer_subdevice = subdev; + ctrl->cmd = SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE; +- err = snd_ctl_shm_action(ctl); +- if (err < 0) +- return err; +- return err; ++ return snd_ctl_shm_action(ctl); + } + + static int snd_ctl_shm_set_power_state(snd_ctl_t *ctl, unsigned int state) + { + snd_ctl_shm_t *shm = ctl->private_data; + volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl; +- int err; + ctrl->u.power_state = state; + ctrl->cmd = SNDRV_CTL_IOCTL_POWER; +- err = snd_ctl_shm_action(ctl); +- if (err < 0) +- return err; +- return err; ++ return snd_ctl_shm_action(ctl); + } + + static int snd_ctl_shm_get_power_state(snd_ctl_t *ctl, unsigned int *state) +-- +2.20.1 + + +From d6ba264038fde08baf5e62bdde2a5614792db5c8 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 10:53:09 +0200 +Subject: [PATCH 14/25] control_shm: add missing socket close to the error path + (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/control/control_shm.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/control/control_shm.c b/src/control/control_shm.c +index 1d9de8b7..40d42643 100644 +--- a/src/control/control_shm.c ++++ b/src/control/control_shm.c +@@ -424,8 +424,10 @@ static int make_local_socket(const char *filename) + addr->sun_family = AF_LOCAL; + memcpy(addr->sun_path, filename, l); + +- if (connect(sock, (struct sockaddr *) addr, size) < 0) ++ if (connect(sock, (struct sockaddr *) addr, size) < 0) { ++ close(sock); + return -errno; ++ } + return sock; + } + +-- +2.20.1 + + +From d5a1cf35b710d255508e56ed19633e1fbf41a2d4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 10:57:20 +0200 +Subject: [PATCH 15/25] pcm: fix memory leak in _snd_pcm_parse_config_chmaps() + (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c +index 323926e1..fa51ca99 100644 +--- a/src/pcm/pcm.c ++++ b/src/pcm/pcm.c +@@ -8391,6 +8391,7 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf) + free(chmap); + goto error; + } ++ free(chmap); + nums++; + } + return maps; +-- +2.20.1 + + +From 22ade9b8c150240a960ca683ee6d8f53ce8bc6ea Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 11:09:43 +0200 +Subject: [PATCH 16/25] pcm_file: call pclose() correctly for popen() + (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_file.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 52cc10a9..99db3754 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -227,7 +227,14 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file) + file->final_fname); + return -errno; + } +- fd = fileno(pipe); ++ fd = dup(fileno(pipe)); ++ err = -errno; ++ pclose(pipe); ++ if (fd < 0) { ++ SYSERR("unable to dup pipe file handle for command %s", ++ file->final_fname); ++ return err; ++ } + } else { + if (file->trunc) + fd = open(file->final_fname, O_WRONLY|O_CREAT|O_TRUNC, +-- +2.20.1 + + +From 3ae743efea704c16c9464f38d502c23759b71245 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 11:11:46 +0200 +Subject: [PATCH 17/25] pcm_hw: close file descriptor in the error path in + snd_pcm_hw_open() (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_hw.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c +index 91370a88..77d4dae1 100644 +--- a/src/pcm/pcm_hw.c ++++ b/src/pcm/pcm_hw.c +@@ -1724,12 +1724,15 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, + } + if (info.subdevice != (unsigned int) subdevice) { + close(fd); ++ fd = -1; + goto __again; + } + } + snd_ctl_close(ctl); + return snd_pcm_hw_open_fd(pcmp, name, fd, sync_ptr_ioctl); + _err: ++ if (fd >= 0) ++ close(fd); + snd_ctl_close(ctl); + return ret; + } +-- +2.20.1 + + +From 8ab0393b42e08655a5fee0a8e84b3ba84932465b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 20:31:24 +0200 +Subject: [PATCH 18/25] rawmidi: use snd_dlobj_cache_get2() in rawmidi open + (coverity) + +Use proper reference counting for the dynamic symbol. + +Signed-off-by: Jaroslav Kysela +--- + include/local.h | 3 +++ + src/dlmisc.c | 41 +++++++++++++++++++++++++++++------ + src/rawmidi/rawmidi.c | 43 ++++++++++++++++--------------------- + src/rawmidi/rawmidi_local.h | 2 +- + 4 files changed, 57 insertions(+), 32 deletions(-) + +diff --git a/include/local.h b/include/local.h +index 5edad317..e8390df5 100644 +--- a/include/local.h ++++ b/include/local.h +@@ -328,6 +328,8 @@ static inline int snd_open_device(const char *filename, int fmode) + /* make local functions really local */ + #define snd_dlobj_cache_get \ + snd1_dlobj_cache_get ++#define snd_dlobj_cache_get2 \ ++ snd1_dlobj_cache_get2 + #define snd_dlobj_cache_put \ + snd1_dlobj_cache_put + #define snd_dlobj_cache_cleanup \ +@@ -341,6 +343,7 @@ static inline int snd_open_device(const char *filename, int fmode) + + /* dlobj cache */ + void *snd_dlobj_cache_get(const char *lib, const char *name, const char *version, int verbose); ++void *snd_dlobj_cache_get2(const char *lib, const char *name, const char *version, int verbose); + int snd_dlobj_cache_put(void *open_func); + void snd_dlobj_cache_cleanup(void); + +diff --git a/src/dlmisc.c b/src/dlmisc.c +index 012e61bc..8c8f3ff7 100644 +--- a/src/dlmisc.c ++++ b/src/dlmisc.c +@@ -251,15 +251,15 @@ static inline void snd_dlobj_unlock(void) {} + + static LIST_HEAD(pcm_dlobj_list); + +-void *snd_dlobj_cache_get(const char *lib, const char *name, +- const char *version, int verbose) ++static struct dlobj_cache * ++snd_dlobj_cache_get0(const char *lib, const char *name, ++ const char *version, int verbose) + { + struct list_head *p; + struct dlobj_cache *c; + void *func, *dlobj; + char errbuf[256]; + +- snd_dlobj_lock(); + list_for_each(p, &pcm_dlobj_list) { + c = list_entry(p, struct dlobj_cache, list); + if (c->lib && lib && strcmp(c->lib, lib) != 0) +@@ -270,9 +270,7 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, + continue; + if (strcmp(c->name, name) == 0) { + c->refcnt++; +- func = c->func; +- snd_dlobj_unlock(); +- return func; ++ return c; + } + } + +@@ -285,7 +283,6 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, + SNDERR("Cannot open shared library %s (%s)", + lib ? lib : "[builtin]", + errbuf); +- snd_dlobj_unlock(); + return NULL; + } + +@@ -314,6 +311,36 @@ void *snd_dlobj_cache_get(const char *lib, const char *name, + c->dlobj = dlobj; + c->func = func; + list_add_tail(&c->list, &pcm_dlobj_list); ++ return c; ++} ++ ++void *snd_dlobj_cache_get(const char *lib, const char *name, ++ const char *version, int verbose) ++{ ++ struct dlobj_cache *c; ++ void *func = NULL; ++ ++ snd_dlobj_lock(); ++ c = snd_dlobj_cache_get0(lib, name, version, verbose); ++ if (c) ++ func = c->func; ++ snd_dlobj_unlock(); ++ return func; ++} ++ ++void *snd_dlobj_cache_get2(const char *lib, const char *name, ++ const char *version, int verbose) ++{ ++ struct dlobj_cache *c; ++ void *func = NULL; ++ ++ snd_dlobj_lock(); ++ c = snd_dlobj_cache_get0(lib, name, version, verbose); ++ if (c) { ++ func = c->func; ++ /* double reference */ ++ c->refcnt++; ++ } + snd_dlobj_unlock(); + return func; + } +diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c +index 2f419142..1b5f8525 100644 +--- a/src/rawmidi/rawmidi.c ++++ b/src/rawmidi/rawmidi.c +@@ -162,7 +162,7 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp + snd_config_t *rawmidi_conf, int mode) + { + const char *str; +- char buf[256], errbuf[256]; ++ char buf[256]; + int err; + snd_config_t *conf, *type_conf = NULL; + snd_config_iterator_t i, next; +@@ -174,7 +174,6 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp + #ifndef PIC + extern void *snd_rawmidi_open_symbols(void); + #endif +- void *h = NULL; + if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) { + if (name) + SNDERR("Invalid type for RAWMIDI %s definition", name); +@@ -239,41 +238,37 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp + #ifndef PIC + snd_rawmidi_open_symbols(); + #endif +- h = INTERNAL(snd_dlopen)(lib, RTLD_NOW, errbuf, sizeof(errbuf)); +- if (h) +- open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION)); +- err = 0; +- if (!h) { +- SNDERR("Cannot open shared library %s (%s)", lib, errbuf); +- err = -ENOENT; +- } else if (!open_func) { +- SNDERR("symbol %s is not defined inside %s", open_name, lib); +- snd_dlclose(h); ++ open_func = snd_dlobj_cache_get2(lib, open_name, ++ SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION), 1); ++ if (!open_func) { + err = -ENXIO; ++ goto _err; + } +- _err: + if (type_conf) + snd_config_delete(type_conf); +- if (err >= 0) +- err = open_func(inputp, outputp, name, rawmidi_root, rawmidi_conf, mode); +- if (err < 0) { +- if (h) +- snd_dlclose(h); +- return err; +- } ++ err = open_func(inputp, outputp, name, rawmidi_root, rawmidi_conf, mode); ++ if (err < 0) ++ goto _err; + if (inputp) { +- (*inputp)->dl_handle = h; h = NULL; ++ (*inputp)->open_func = open_func; + snd_rawmidi_params_default(*inputp, ¶ms); + err = snd_rawmidi_params(*inputp, ¶ms); + assert(err >= 0); + } + if (outputp) { +- (*outputp)->dl_handle = h; ++ (*outputp)->open_func = open_func; + snd_rawmidi_params_default(*outputp, ¶ms); + err = snd_rawmidi_params(*outputp, ¶ms); + assert(err >= 0); + } + return 0; ++ ++ _err: ++ if (open_func) ++ snd_dlobj_cache_put(open_func); ++ if (type_conf) ++ snd_config_delete(type_conf); ++ return err; + } + + static int snd_rawmidi_open_noupdate(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, +@@ -350,8 +345,8 @@ int snd_rawmidi_close(snd_rawmidi_t *rawmidi) + assert(rawmidi); + err = rawmidi->ops->close(rawmidi); + free(rawmidi->name); +- if (rawmidi->dl_handle) +- snd_dlclose(rawmidi->dl_handle); ++ if (rawmidi->open_func) ++ snd_dlobj_cache_put(rawmidi->open_func); + free(rawmidi); + return err; + } +diff --git a/src/rawmidi/rawmidi_local.h b/src/rawmidi/rawmidi_local.h +index d76b35a3..721e1ec9 100644 +--- a/src/rawmidi/rawmidi_local.h ++++ b/src/rawmidi/rawmidi_local.h +@@ -37,7 +37,7 @@ typedef struct { + } snd_rawmidi_ops_t; + + struct _snd_rawmidi { +- void *dl_handle; ++ void *open_func; + char *name; + snd_rawmidi_type_t type; + snd_rawmidi_stream_t stream; +-- +2.20.1 + + +From 6efa23f2837a6fa9982b4f34b837401a66941ee3 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 20:45:26 +0200 +Subject: [PATCH 19/25] rawmidi_hw: add sanity check for the invalid stream + arguments (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/rawmidi/rawmidi_hw.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/rawmidi/rawmidi_hw.c b/src/rawmidi/rawmidi_hw.c +index 7cc8c0d1..eaa8a76d 100644 +--- a/src/rawmidi/rawmidi_hw.c ++++ b/src/rawmidi/rawmidi_hw.c +@@ -186,6 +186,8 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, + *inputp = NULL; + if (outputp) + *outputp = NULL; ++ if (!inputp && !outputp) ++ return -EINVAL; + + if ((ret = snd_ctl_hw_open(&ctl, NULL, card, 0)) < 0) + return ret; +-- +2.20.1 + + +From 0d97f53c25b4dd36d3f6511fae85b597aebc61a1 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 20:52:00 +0200 +Subject: [PATCH 20/25] topology: various coverity fixes + +Signed-off-by: Jaroslav Kysela +--- + src/topology/ctl.c | 4 ++-- + src/topology/data.c | 19 +++++++++++++------ + src/topology/parser.c | 5 +++-- + 3 files changed, 18 insertions(+), 10 deletions(-) + +diff --git a/src/topology/ctl.c b/src/topology/ctl.c +index 9c13b12c..a0962522 100644 +--- a/src/topology/ctl.c ++++ b/src/topology/ctl.c +@@ -880,8 +880,8 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, + if (enum_ctl->texts != NULL) { + for (i = 0; i < num_items; i++) { + if (enum_ctl->texts[i] != NULL) +- strncpy(ec->texts[i], enum_ctl->texts[i], +- SNDRV_CTL_ELEM_ID_NAME_MAXLEN); ++ snd_strlcpy(ec->texts[i], enum_ctl->texts[i], ++ SNDRV_CTL_ELEM_ID_NAME_MAXLEN); + } + } + +diff --git a/src/topology/data.c b/src/topology/data.c +index fd72abbb..aa2b87e7 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -124,12 +124,12 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + + if (fclose(fp) == EOF) { + SNDERR("Cannot close data file."); +- ret = -errno; +- goto err; ++ return -errno; + } + return 0; + + err: ++ fclose(fp); + if (priv) + free(priv); + return ret; +@@ -422,7 +422,7 @@ static unsigned int get_tuple_size(int type) + static int copy_tuples(struct tplg_elem *elem, + struct tplg_vendor_tuples *tuples, struct tplg_vendor_tokens *tokens) + { +- struct snd_soc_tplg_private *priv = elem->data; ++ struct snd_soc_tplg_private *priv = elem->data, *priv2; + struct tplg_tuple_set *tuple_set; + struct tplg_tuple *tuple; + struct snd_soc_tplg_vendor_array *array; +@@ -447,10 +447,17 @@ static int copy_tuples(struct tplg_elem *elem, + return -EINVAL; + } + +- if (priv != NULL) +- priv = realloc(priv, sizeof(*priv) + size); +- else ++ if (priv != NULL) { ++ priv2 = realloc(priv, sizeof(*priv) + size); ++ if (priv2 == NULL) { ++ free(priv); ++ priv = NULL; ++ } else { ++ priv = priv2; ++ } ++ } else { + priv = calloc(1, sizeof(*priv) + size); ++ } + if (!priv) + return -ENOMEM; + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index cfc20e00..a7cff1c3 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -237,8 +237,9 @@ static int tplg_load_config(const char *file, snd_config_t **cfg) + + ret = snd_input_stdio_attach(&in, fp, 1); + if (ret < 0) { ++ fclose(fp); + SNDERR("error: could not attach stdio %s", file); +- goto err; ++ return ret; + } + ret = snd_config_top(&top); + if (ret < 0) +@@ -261,7 +262,7 @@ static int tplg_load_config(const char *file, snd_config_t **cfg) + err_load: + snd_config_delete(top); + err: +- fclose(fp); ++ snd_input_close(in); + return ret; + } + +-- +2.20.1 + + +From ed156a218644e3334bc452ef2bc948409735c330 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 24 May 2019 21:11:00 +0200 +Subject: [PATCH 21/25] ucm: coverity fixes + +Signed-off-by: Jaroslav Kysela +--- + src/ucm/parser.c | 18 ++++++++++++++---- + src/ucm/utils.c | 12 +++++++++--- + 2 files changed, 23 insertions(+), 7 deletions(-) + +diff --git a/src/ucm/parser.c b/src/ucm/parser.c +index ad6bcec7..61d5d7f9 100644 +--- a/src/ucm/parser.c ++++ b/src/ucm/parser.c +@@ -1114,7 +1114,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + if (err < 0) { + uc_error("error: %s failed to parse verb", + file); +- return err; ++ goto _err; + } + continue; + } +@@ -1126,7 +1126,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + if (err < 0) { + uc_error("error: %s failed to parse device", + file); +- return err; ++ goto _err; + } + continue; + } +@@ -1138,18 +1138,24 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, + if (err < 0) { + uc_error("error: %s failed to parse modifier", + file); +- return err; ++ goto _err; + } + continue; + } + } + ++ snd_config_delete(cfg); ++ + /* use case verb must have at least 1 device */ + if (list_empty(&verb->device_list)) { + uc_error("error: no use case device defined", file); + return -EINVAL; + } + return 0; ++ ++ _err: ++ snd_config_delete(cfg); ++ return err; + } + + /* +@@ -1399,6 +1405,7 @@ next_card: + + return -1; + } ++ + static int load_master_config(const char *card_name, snd_config_t **cfg) + { + char filename[MAX_FILE]; +@@ -1610,8 +1617,11 @@ int uc_mgr_scan_master_configs(const char **_list[]) + } + free(namelist); + +- if (err >= 0) ++ if (err >= 0) { + *_list = list; ++ } else { ++ free(list); ++ } + + return err; + } +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index 14227e0a..efd5a979 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -58,14 +58,18 @@ int uc_mgr_config_load(const char *file, snd_config_t **cfg) + int err; + + fp = fopen(file, "r"); +- err = fp == NULL ? -errno : snd_input_stdio_attach(&in, fp, 1); +- if (err < 0) { ++ if (!fp) { ++ err = -errno; ++ __err0: + uc_error("could not open configuration file %s", file); + return err; + } ++ err = snd_input_stdio_attach(&in, fp, 1); ++ if (err < 0) ++ goto __err0; + err = snd_config_top(&top); + if (err < 0) +- return err; ++ goto __err1; + + default_path = getenv(ALSA_CONFIG_UCM_VAR); + if (!default_path || !*default_path) +@@ -88,6 +92,8 @@ int uc_mgr_config_load(const char *file, snd_config_t **cfg) + + __err2: + snd_config_delete(top); ++ __err1: ++ snd_input_close(in); + return err; + } + +-- +2.20.1 + + +From 022c790aabc300eabad4da8947a3f2bdadce41e1 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 27 May 2019 13:57:12 +0200 +Subject: [PATCH 22/25] pcm_file: coverity fixes (including double locking) + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_file.c | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 99db3754..54142a3d 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -296,7 +296,10 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm, + return -ENOMEM; + } + +- bytes = read(file->ifd, file->rbuf, snd_pcm_frames_to_bytes(pcm, frames)); ++ bytes = snd_pcm_frames_to_bytes(pcm, frames); ++ if (bytes < 0) ++ return bytes; ++ bytes = read(file->ifd, file->rbuf, bytes); + if (bytes < 0) { + SYSERR("read from file failed, error: %d", bytes); + return bytes; +@@ -589,18 +592,14 @@ static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pc + snd_pcm_channel_area_t areas[pcm->channels]; + snd_pcm_sframes_t frames; + +- __snd_pcm_lock(pcm); +- + frames = _snd_pcm_readi(file->gen.slave, buffer, size); +- if (frames <= 0) { +- __snd_pcm_unlock(pcm); ++ if (frames <= 0) + return frames; +- } + + snd_pcm_areas_from_buf(pcm, areas, buffer); + snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); ++ __snd_pcm_lock(pcm); + snd_pcm_file_add_frames(pcm, areas, 0, frames); +- + __snd_pcm_unlock(pcm); + + return frames; +@@ -654,9 +653,6 @@ static int snd_pcm_file_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t + snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames) + { + snd_pcm_file_t *file = pcm->private_data; +- snd_pcm_channel_area_t areas_if[pcm->channels]; +- snd_pcm_uframes_t frames_if; +- void *buffer = NULL; + int result; + + result = snd_pcm_mmap_begin(file->gen.slave, areas, offset, frames); +-- +2.20.1 + + +From c6e7fd8b1e0d8729c7220734ca0b529c35d926ed Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 27 May 2019 14:05:12 +0200 +Subject: [PATCH 23/25] topology: next round of coverity fixes + +Signed-off-by: Jaroslav Kysela +--- + src/topology/data.c | 5 ++--- + src/topology/parser.c | 7 +++++-- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/topology/data.c b/src/topology/data.c +index aa2b87e7..b3f4421f 100644 +--- a/src/topology/data.c ++++ b/src/topology/data.c +@@ -88,8 +88,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem) + if (fp == NULL) { + SNDERR("error: invalid data file path '%s'\n", + filename); +- ret = -errno; +- goto err; ++ return -errno; + } + + fseek(fp, 0L, SEEK_END); +@@ -463,6 +462,7 @@ static int copy_tuples(struct tplg_elem *elem, + + off = priv->size; + priv->size = size; /* update private data size */ ++ elem->data = priv; + + array = (struct snd_soc_tplg_vendor_array *)(priv->data + off); + array->size = set_size; +@@ -499,7 +499,6 @@ static int copy_tuples(struct tplg_elem *elem, + } + } + +- elem->data = priv; + return 0; + } + +diff --git a/src/topology/parser.c b/src/topology/parser.c +index a7cff1c3..5940692d 100644 +--- a/src/topology/parser.c ++++ b/src/topology/parser.c +@@ -253,8 +253,10 @@ static int tplg_load_config(const char *file, snd_config_t **cfg) + } + + ret = snd_input_close(in); +- if (ret < 0) ++ if (ret < 0) { ++ in = NULL; + goto err_load; ++ } + + *cfg = top; + return 0; +@@ -262,7 +264,8 @@ static int tplg_load_config(const char *file, snd_config_t **cfg) + err_load: + snd_config_delete(top); + err: +- snd_input_close(in); ++ if (in) ++ snd_input_close(in); + return ret; + } + +-- +2.20.1 + + +From ac6df1106c314de5d027176d910b9bc43a1fa7f9 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 27 May 2019 20:10:32 +0200 +Subject: [PATCH 24/25] pcm_file: another locking fix (coverity) + +Signed-off-by: Jaroslav Kysela +--- + src/pcm/pcm_file.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c +index 54142a3d..1ef80b59 100644 +--- a/src/pcm/pcm_file.c ++++ b/src/pcm/pcm_file.c +@@ -612,18 +612,16 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm + snd_pcm_channel_area_t areas[pcm->channels]; + snd_pcm_sframes_t frames; + +- __snd_pcm_lock(pcm); + frames = _snd_pcm_readn(file->gen.slave, bufs, size); +- if (frames <= 0) { +- __snd_pcm_unlock(pcm); ++ if (frames <= 0) + return frames; +- } + + snd_pcm_areas_from_bufs(pcm, areas, bufs); + snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); ++ __snd_pcm_lock(pcm); + snd_pcm_file_add_frames(pcm, areas, 0, frames); +- + __snd_pcm_unlock(pcm); ++ + return frames; + } + +-- +2.20.1 + + +From 5905af199670ca34eaaafbd3319d94d230b7e4d4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 27 May 2019 20:10:52 +0200 +Subject: [PATCH 25/25] ucm: another coverity fix in uc_mgr_config_load() + +--- + src/ucm/utils.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/ucm/utils.c b/src/ucm/utils.c +index efd5a979..5607304e 100644 +--- a/src/ucm/utils.c ++++ b/src/ucm/utils.c +@@ -85,15 +85,18 @@ int uc_mgr_config_load(const char *file, snd_config_t **cfg) + goto __err2; + } + err = snd_input_close(in); +- if (err < 0) ++ if (err < 0) { ++ in = NULL; + goto __err2; ++ } + *cfg = top; + return 0; + + __err2: +- snd_config_delete(top); ++ snd_config_delete(top); + __err1: +- snd_input_close(in); ++ if (in) ++ snd_input_close(in); + return err; + } + +-- +2.20.1 + diff --git a/SOURCES/alsa-lib-1.0.24-config.patch b/SOURCES/alsa-lib-1.0.24-config.patch deleted file mode 100644 index f0e50e3..0000000 --- a/SOURCES/alsa-lib-1.0.24-config.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index 1889f01..60c12ac 100644 ---- a/src/conf/alsa.conf -+++ b/src/conf/alsa.conf -@@ -66,8 +66,7 @@ defaults.pcm.nonblock 1 - defaults.pcm.compat 0 - defaults.pcm.minperiodtime 5000 # in us - defaults.pcm.ipc_key 5678293 --defaults.pcm.ipc_gid audio --defaults.pcm.ipc_perm 0660 -+defaults.pcm.ipc_perm 0600 - defaults.pcm.dmix.max_periods 0 - defaults.pcm.dmix.rate 48000 - defaults.pcm.dmix.format "unchanged" -diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf -index e62cb29..a005488 100644 ---- a/src/conf/pcm/dmix.conf -+++ b/src/conf/pcm/dmix.conf -@@ -41,10 +41,6 @@ pcm.!dmix { - @func refer - name defaults.pcm.ipc_key - } -- ipc_gid { -- @func refer -- name defaults.pcm.ipc_gid -- } - ipc_perm { - @func refer - name defaults.pcm.ipc_perm -diff --git a/src/conf/pcm/dsnoop.conf b/src/conf/pcm/dsnoop.conf -index 49cfca9..842e1fb 100644 ---- a/src/conf/pcm/dsnoop.conf -+++ b/src/conf/pcm/dsnoop.conf -@@ -41,10 +41,6 @@ pcm.!dsnoop { - @func refer - name defaults.pcm.ipc_key - } -- ipc_gid { -- @func refer -- name defaults.pcm.ipc_gid -- } - ipc_perm { - @func refer - name defaults.pcm.ipc_perm diff --git a/SOURCES/alsa-lib-1.1.6-post.patch b/SOURCES/alsa-lib-1.1.6-post.patch deleted file mode 100644 index 7e0101f..0000000 --- a/SOURCES/alsa-lib-1.1.6-post.patch +++ /dev/null @@ -1,2858 +0,0 @@ -From 93e03bdc2a3dcd5d12516f5de78e14d88a32ff2c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Apr 2018 09:58:12 +0200 -Subject: [PATCH 01/26] alsa.conf: change the location for add-on configs to - /etc/alsa/conf.d - -The add-on configuration files should be placed to a volatile place. - -Signed-off-by: Jaroslav Kysela ---- - src/conf/alsa.conf | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - -diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf -index f22918fb..bb00ff40 100644 ---- a/src/conf/alsa.conf -+++ b/src/conf/alsa.conf -@@ -8,13 +8,7 @@ - { - func load - files [ -- { -- @func concat -- strings [ -- { @func datadir } -- "/alsa.conf.d/" -- ] -- } -+ "/etc/alsa/conf.d" - "/etc/asound.conf" - "~/.asoundrc" - ] --- -2.13.6 - - -From 78505dccd23546cc77e5221cb21c01325bc0138d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 4 Apr 2018 10:02:49 +0200 -Subject: [PATCH 02/26] conf: remove alsa.conf.d from the datadir - -Signed-off-by: Jaroslav Kysela ---- - src/conf/Makefile.am | 2 +- - src/conf/alsa.conf.d/Makefile.am | 8 -------- - src/conf/alsa.conf.d/README | 2 -- - 3 files changed, 1 insertion(+), 11 deletions(-) - delete mode 100644 src/conf/alsa.conf.d/Makefile.am - delete mode 100644 src/conf/alsa.conf.d/README - -diff --git a/src/conf/Makefile.am b/src/conf/Makefile.am -index ef2ea9c1..2b46f95c 100644 ---- a/src/conf/Makefile.am -+++ b/src/conf/Makefile.am -@@ -1,4 +1,4 @@ --SUBDIRS=cards pcm alsa.conf.d -+SUBDIRS=cards pcm - - if BUILD_UCM - SUBDIRS += ucm -diff --git a/src/conf/alsa.conf.d/Makefile.am b/src/conf/alsa.conf.d/Makefile.am -deleted file mode 100644 -index c91661e9..00000000 ---- a/src/conf/alsa.conf.d/Makefile.am -+++ /dev/null -@@ -1,8 +0,0 @@ --alsaconfigdir = @ALSA_CONFIG_DIR@ --alsadir = $(alsaconfigdir)/alsa.conf.d --cfg_files = README -- --alsa_DATA = $(cfg_files) -- --EXTRA_DIST = \ -- $(cfg_files) -diff --git a/src/conf/alsa.conf.d/README b/src/conf/alsa.conf.d/README -deleted file mode 100644 -index 99978848..00000000 ---- a/src/conf/alsa.conf.d/README -+++ /dev/null -@@ -1,2 +0,0 @@ --You can place files named *.conf in this folder and they will be processed --when initialising alsa-lib. --- -2.13.6 - - -From 17bc74d3a25f0d4b1ca25d2d92fcad9c2a9d7f79 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 10 Apr 2018 08:57:07 +0200 -Subject: [PATCH 03/26] configure: remove src/conf/alsa.conf.d/Makefile - -Signed-off-by: Jaroslav Kysela ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index cce195ae..5bc1994f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -713,7 +713,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ - src/rawmidi/Makefile src/timer/Makefile \ - src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \ - src/alisp/Makefile src/topology/Makefile \ -- src/conf/Makefile src/conf/alsa.conf.d/Makefile \ -+ src/conf/Makefile \ - src/conf/cards/Makefile \ - src/conf/pcm/Makefile \ - src/conf/ucm/Makefile \ --- -2.13.6 - - -From 3778a30bb0095c7d3275735718f33058e3c198d5 Mon Sep 17 00:00:00 2001 -From: Kirill Marinushkin -Date: Mon, 16 Apr 2018 20:26:38 +0200 -Subject: [PATCH 04/26] ASoC: topology: Fix bclk and fsync inversion in - set_link_hw_format() - -The values of bclk and fsync are inverted WRT the codec. But the existing -solution already works for Broadwell, see the alsa-lib config: - -`alsa-lib/src/conf/topology/broadwell/broadwell.conf` - -This commit provides the backwards-compatible solution to fix this misuse. -This commit goes in pair with the corresponding patch for linux. - -Signed-off-by: Kirill Marinushkin -Reviewed-by: Pierre-Louis Bossart -Tested-by: Pan Xiuli -Tested-by: Pierre-Louis Bossart -Cc: Jaroslav Kysela -Cc: Takashi Iwai -Cc: Mark Brown -Cc: Liam Girdwood -Cc: linux-kernel@vger.kernel.org -Cc: alsa-devel@alsa-project.org -Signed-off-by: Takashi Iwai ---- - include/sound/asoc.h | 16 ++++++++++++++-- - include/topology.h | 4 ++-- - src/conf/topology/broadwell/broadwell.conf | 4 ++-- - src/topology/pcm.c | 30 ++++++++++++++++++++++++++---- - 4 files changed, 44 insertions(+), 10 deletions(-) - -diff --git a/include/sound/asoc.h b/include/sound/asoc.h -index 0f5d9f9a..89b00703 100644 ---- a/include/sound/asoc.h -+++ b/include/sound/asoc.h -@@ -156,6 +156,18 @@ - #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) - #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) - -+/* DAI topology BCLK parameter -+ * For the backwards capability, by default codec is bclk master -+ */ -+#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ -+#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ -+ -+/* DAI topology FSYNC parameter -+ * For the backwards capability, by default codec is fsync master -+ */ -+#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ -+#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ -+ - /* - * Block Header. - * This header precedes all object and object arrays below. -@@ -311,8 +323,8 @@ struct snd_soc_tplg_hw_config { - __u8 clock_gated; /* 1 if clock can be gated to save power */ - __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ -- __u8 bclk_master; /* 1 for master of BCLK, 0 for slave */ -- __u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */ -+ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -+ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ - __u8 mclk_direction; /* 0 for input, 1 for output */ - __le16 reserved; /* for 32bit alignment */ - __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ -diff --git a/include/topology.h b/include/topology.h -index 8779da4d..5d7b46df 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -1000,8 +1000,8 @@ struct snd_tplg_hw_config_template { - unsigned char clock_gated; /* 1 if clock can be gated to save power */ - unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ -- unsigned char bclk_master; /* 1 for master of BCLK, 0 for slave */ -- unsigned char fsync_master; /* 1 for master of FSYNC, 0 for slave */ -+ unsigned char bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -+ unsigned char fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ - unsigned char mclk_direction; /* 0 for input, 1 for output */ - unsigned short reserved; /* for 32bit alignment */ - unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */ -diff --git a/src/conf/topology/broadwell/broadwell.conf b/src/conf/topology/broadwell/broadwell.conf -index b8405d93..09fc4daa 100644 ---- a/src/conf/topology/broadwell/broadwell.conf -+++ b/src/conf/topology/broadwell/broadwell.conf -@@ -393,8 +393,8 @@ SectionGraph."dsp" { - SectionHWConfig."CodecHWConfig" { - id "1" - format "I2S" # physical audio format. -- bclk "master" # Platform is master of bit clock -- fsync "master" # platform is master of fsync -+ bclk "codec_slave" # platform is master of bit clock (codec is slave) -+ fsync "codec_slave" # platform is master of fsync (codec is slave) - } - - SectionLink."Codec" { -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index bb47b9af..d0395182 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1141,8 +1141,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -- if (!strcmp(val, "master")) -- hw_cfg->bclk_master = true; -+ if (!strcmp(val, "master")) { -+ /* For backwards capability, -+ * "master" == "codec is slave" -+ */ -+ SNDERR("warning: deprecated bclk value '%s'\n", -+ val); -+ -+ hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS; -+ } else if (!strcmp(val, "codec_slave")) { -+ hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CS; -+ } else if (!strcmp(val, "codec_master")) { -+ hw_cfg->bclk_master = SND_SOC_TPLG_BCLK_CM; -+ } - continue; - } - -@@ -1167,8 +1178,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -- if (!strcmp(val, "master")) -- hw_cfg->fsync_master = true; -+ if (!strcmp(val, "master")) { -+ /* For backwards capability, -+ * "master" == "codec is slave" -+ */ -+ SNDERR("warning: deprecated fsync value '%s'\n", -+ val); -+ -+ hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS; -+ } else if (!strcmp(val, "codec_slave")) { -+ hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CS; -+ } else if (!strcmp(val, "codec_master")) { -+ hw_cfg->fsync_master = SND_SOC_TPLG_FSYNC_CM; -+ } - continue; - } - --- -2.13.6 - - -From bdb709ab2a091743980c9154950c01f0c540476b Mon Sep 17 00:00:00 2001 -From: Kirill Marinushkin -Date: Mon, 16 Apr 2018 20:26:39 +0200 -Subject: [PATCH 05/26] ASoC: topology: Add missing clock gating parameter when - parsing hw_configs - -Clock gating parameter is a part of `dai_fmt`. It is supported by -`alsa-lib` when creating a topology binary file, but ignored by kernel -when loading this topology file. - -After applying this commit, the clock gating parameter is not ignored any -more. This solution is backwards compatible. The existing behaviour is -not broken, because by default the parameter value is 0 and is ignored. - -snd_soc_tplg_hw_config.clock_gated = 0 => no effect -snd_soc_tplg_hw_config.clock_gated = 1 => SND_SOC_DAIFMT_GATED -snd_soc_tplg_hw_config.clock_gated = 2 => SND_SOC_DAIFMT_CONT - -For example, the following config, based on -alsa-lib/src/conf/topology/broadwell/broadwell.conf, is now supported: - -~~~~ -SectionHWConfig."CodecHWConfig" { - id "1" - format "I2S" # physical audio format. - pm_gate_clocks "true" # clock can be gated -} - -SectionLink."Codec" { - - # used for binding to the physical link - id "0" - - hw_configs [ - "CodecHWConfig" - ] - - default_hw_conf_id "1" -} -~~~~ - -Signed-off-by: Kirill Marinushkin -Reviewed-by: Pierre-Louis Bossart -Cc: Jaroslav Kysela -Cc: Takashi Iwai -Cc: Mark Brown -Cc: Pan Xiuli -Cc: Liam Girdwood -Cc: linux-kernel@vger.kernel.org -Cc: alsa-devel@alsa-project.org -Signed-off-by: Takashi Iwai ---- - include/sound/asoc.h | 7 ++++++- - include/topology.h | 2 +- - src/topology/pcm.c | 6 +++++- - 3 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/include/sound/asoc.h b/include/sound/asoc.h -index 89b00703..297e837c 100644 ---- a/include/sound/asoc.h -+++ b/include/sound/asoc.h -@@ -135,6 +135,11 @@ - #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) - #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) - -+/* DAI clock gating */ -+#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0 -+#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 -+#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 -+ - /* DAI physical PCM data formats. - * Add new formats to the end of the list. - */ -@@ -320,7 +325,7 @@ struct snd_soc_tplg_hw_config { - __le32 size; /* in bytes of this structure */ - __le32 id; /* unique ID - - used to match */ - __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ -- __u8 clock_gated; /* 1 if clock can be gated to save power */ -+ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ - __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ - __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -diff --git a/include/topology.h b/include/topology.h -index 5d7b46df..3793115c 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -997,7 +997,7 @@ struct snd_tplg_pcm_template { - struct snd_tplg_hw_config_template { - int id; /* unique ID - - used to match */ - unsigned int fmt; /* SND_SOC_DAI_FORMAT_ format value */ -- unsigned char clock_gated; /* 1 if clock can be gated to save power */ -+ unsigned char clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ - unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */ - unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ - unsigned char bclk_master; /* SND_SOC_TPLG_BCLK_ value */ -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index d0395182..b53f6b03 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1233,7 +1233,11 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - return -EINVAL; - - if (!strcmp(val, "true")) -- hw_cfg->clock_gated = true; -+ hw_cfg->clock_gated = -+ SND_SOC_TPLG_DAI_CLK_GATE_GATED; -+ else -+ hw_cfg->clock_gated = -+ SND_SOC_TPLG_DAI_CLK_GATE_CONT; - continue; - } - --- -2.13.6 - - -From 7cf73b56e4505ad194f5789293494a6ebaa1feff Mon Sep 17 00:00:00 2001 -From: Kirill Marinushkin -Date: Mon, 16 Apr 2018 20:26:40 +0200 -Subject: [PATCH 06/26] ASoC: topology: Add definitions for mclk_direction - values - -Current comment makes not clear the direction of mclk. Previously, similar -description caused a misunderstanding for bclk_master and fsync_master. - -This commit solves the potential confusion the same way it is solved for -bclk_master and fsync_master. - -Signed-off-by: Kirill Marinushkin -Acked-by: Pierre-Louis Bossart -Cc: Jaroslav Kysela -Cc: Takashi Iwai -Cc: Mark Brown -Cc: Pan Xiuli -Cc: Liam Girdwood -Cc: alsa-devel@alsa-project.org -Signed-off-by: Takashi Iwai ---- - include/sound/asoc.h | 6 +++++- - include/topology.h | 2 +- - src/topology/pcm.c | 15 +++++++++++++-- - 3 files changed, 19 insertions(+), 4 deletions(-) - -diff --git a/include/sound/asoc.h b/include/sound/asoc.h -index 297e837c..bb8aec78 100644 ---- a/include/sound/asoc.h -+++ b/include/sound/asoc.h -@@ -140,6 +140,10 @@ - #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 - #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2 - -+/* DAI mclk_direction */ -+#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ -+#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ -+ - /* DAI physical PCM data formats. - * Add new formats to the end of the list. - */ -@@ -330,7 +334,7 @@ struct snd_soc_tplg_hw_config { - __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ - __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ - __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ -- __u8 mclk_direction; /* 0 for input, 1 for output */ -+ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ - __le16 reserved; /* for 32bit alignment */ - __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ - __le32 bclk_rate; /* BCLK freqency in Hz */ -diff --git a/include/topology.h b/include/topology.h -index 3793115c..27da7308 100644 ---- a/include/topology.h -+++ b/include/topology.h -@@ -1002,7 +1002,7 @@ struct snd_tplg_hw_config_template { - unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */ - unsigned char bclk_master; /* SND_SOC_TPLG_BCLK_ value */ - unsigned char fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ -- unsigned char mclk_direction; /* 0 for input, 1 for output */ -+ unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ - unsigned short reserved; /* for 32bit alignment */ - unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */ - unsigned int bclk_rate; /* BCLK freqency in Hz */ -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index b53f6b03..2ce1651b 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1223,8 +1223,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -- if (!strcmp(val, "master")) -- hw_cfg->mclk_direction = true; -+ if (!strcmp(val, "master")) { -+ /* For backwards capability, -+ * "master" == "for codec, mclk is input" -+ */ -+ SNDERR("warning: deprecated mclk value '%s'\n", -+ val); -+ -+ hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI; -+ } else if (!strcmp(val, "codec_mclk_in")) { -+ hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI; -+ } else if (!strcmp(val, "codec_mclk_out")) { -+ hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CO; -+ } - continue; - } - --- -2.13.6 - - -From 4493f6a560a315970f5b068126120526a04ae6a2 Mon Sep 17 00:00:00 2001 -From: Kirill Marinushkin -Date: Mon, 16 Apr 2018 20:26:41 +0200 -Subject: [PATCH 07/26] ASoC: topology: Add alias conf parameter names for - hw_configs - -Currently, some parameter names in conf differ from field names in struct. -These look like typos. - -This commit suggests to add aliases for such parameters, so that the names -in conf are similar to names in struct. This solution is backwards -compatible. - -If the difference between conf names and struct names is done on purpose - -this commit can be dropped. - -Signed-off-by: Kirill Marinushkin -Acked-by: Pierre-Louis Bossart -Cc: Jaroslav Kysela -Cc: Takashi Iwai -Cc: Mark Brown -Cc: Pan Xiuli -Cc: Liam Girdwood -Cc: alsa-devel@alsa-project.org -Signed-off-by: Takashi Iwai ---- - src/topology/pcm.c | 30 ++++++++++++++++++++---------- - 1 file changed, 20 insertions(+), 10 deletions(-) - -diff --git a/src/topology/pcm.c b/src/topology/pcm.c -index 2ce1651b..8ebfafd8 100644 ---- a/src/topology/pcm.c -+++ b/src/topology/pcm.c -@@ -1126,7 +1126,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "format") == 0) { -+ if (strcmp(id, "format") == 0 || -+ strcmp(id, "fmt") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1137,7 +1138,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "bclk") == 0) { -+ if (strcmp(id, "bclk") == 0 || -+ strcmp(id, "bclk_master") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1157,7 +1159,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "bclk_freq") == 0) { -+ if (strcmp(id, "bclk_freq") == 0 || -+ strcmp(id, "bclk_rate") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1165,7 +1168,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "bclk_invert") == 0) { -+ if (strcmp(id, "bclk_invert") == 0 || -+ strcmp(id, "invert_bclk") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1174,7 +1178,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "fsync") == 0) { -+ if (strcmp(id, "fsync") == 0 || -+ strcmp(id, "fsync_master") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1194,7 +1199,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "fsync_invert") == 0) { -+ if (strcmp(id, "fsync_invert") == 0 || -+ strcmp(id, "invert_fsync") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1203,7 +1209,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "fsync_freq") == 0) { -+ if (strcmp(id, "fsync_freq") == 0 || -+ strcmp(id, "fsync_rate") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1211,7 +1218,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "mclk_freq") == 0) { -+ if (strcmp(id, "mclk_freq") == 0 || -+ strcmp(id, "mclk_rate") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1219,7 +1227,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "mclk") == 0) { -+ if (strcmp(id, "mclk") == 0 || -+ strcmp(id, "mclk_direction") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - -@@ -1239,7 +1248,8 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg, - continue; - } - -- if (strcmp(id, "pm_gate_clocks") == 0) { -+ if (strcmp(id, "pm_gate_clocks") == 0 || -+ strcmp(id, "clock_gated") == 0) { - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; - --- -2.13.6 - - -From 23a20cda111232b5d21dde12d10e19e4ecb71cea Mon Sep 17 00:00:00 2001 -From: Ricard Wanderlof -Date: Wed, 18 Apr 2018 17:03:09 +0200 -Subject: [PATCH 08/26] pcm: softvol: Allow up to 90 dB of gain - -The gain algorithm used in softvol can handle gain factors of up to -32767 which is slightly more than 90 dB, so allow a max_dB of 90 dB. -This doesn't affect existing asound.conf files, but does allow a -max_dB of up to 90 dB when needed. - -Tested using Audacity that there is no undue distorsion or other -artefacts when 90 dB of gain is applied to a suitable signal (i.e. -a signal quiet enough not be clipped whan applying 90 dB of gain). - -Signed-off-by: Ricard Wanderlof -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_softvol.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c -index 8bb4a397..0eaeacef 100644 ---- a/src/pcm/pcm_softvol.c -+++ b/src/pcm/pcm_softvol.c -@@ -59,7 +59,11 @@ typedef struct { - #define PRESET_RESOLUTION 256 - #define PRESET_MIN_DB -51.0 - #define ZERO_DB 0.0 --#define MAX_DB_UPPER_LIMIT 50 -+/* -+ * The gain algorithm as it stands supports gain factors up to 32767, which -+ * is a fraction more than 90 dB, so set 90 dB as the maximum possible gain. -+ */ -+#define MAX_DB_UPPER_LIMIT 90 - - static const unsigned int preset_dB_value[PRESET_RESOLUTION] = { - 0x00b8, 0x00bd, 0x00c1, 0x00c5, 0x00ca, 0x00cf, 0x00d4, 0x00d9, --- -2.13.6 - - -From 181f8e251bc05832f9c9401544e680ea0572a2e3 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Wed, 2 May 2018 14:08:05 +0800 -Subject: [PATCH 09/26] ucm: adding the folder of card_long_name when finding - verb conf file - -The board configuration file and verb conf file are allowed to be -in the folder named of card_long_name, so when finding the verb conf -file, we need to check if it is in the folder of card_long_name or -card_name. - -Signed-off-by: Hui Wang -Signed-off-by: Jaroslav Kysela ---- - src/ucm/parser.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/src/ucm/parser.c b/src/ucm/parser.c -index 2d76152f..219edb96 100644 ---- a/src/ucm/parser.c -+++ b/src/ucm/parser.c -@@ -1056,6 +1056,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - char filename[MAX_FILE]; - char *env = getenv(ALSA_CONFIG_UCM_VAR); - int err; -+ char *folder_name; - - /* allocate verb */ - verb = calloc(1, sizeof(struct use_case_verb)); -@@ -1082,12 +1083,17 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr, - } - - /* open Verb file for reading */ -+ if (!strncmp(uc_mgr->conf_file_name, uc_mgr->card_long_name, MAX_CARD_LONG_NAME)) -+ folder_name = uc_mgr->card_long_name; -+ else -+ folder_name = uc_mgr->card_name; -+ - if (env) - snprintf(filename, sizeof(filename), "%s/%s/%s", -- env, uc_mgr->card_name, file); -+ env, folder_name, file); - else - snprintf(filename, sizeof(filename), "%s/ucm/%s/%s", -- snd_config_topdir(), uc_mgr->card_name, file); -+ snd_config_topdir(), folder_name, file); - filename[sizeof(filename)-1] = '\0'; - - err = uc_mgr_config_load(filename, &cfg); --- -2.13.6 - - -From 81db276f8c2235adc83e9698b0174265f6482655 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Wed, 2 May 2018 14:08:06 +0800 -Subject: [PATCH 10/26] conf/ucm: increase the input volume for LineIn - -Otherwise, the boost value is 0, and the sound captured from that -LineIn jack is too weak for users. - -Signed-off-by: Hui Wang -Signed-off-by: Jaroslav Kysela ---- - src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf b/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf -index 50967896..ece780da 100644 ---- a/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf -+++ b/src/conf/ucm/HDAudio-Lenovo-DualCodecs/HiFi.conf -@@ -99,6 +99,7 @@ SectionDevice."LineIn" { - EnableSequence [ - cdev "hw:PCH" - cset "name='Input Source' Line" -+ cset "name='Line Boost Volume' 3" - ] - } - --- -2.13.6 - - -From f7c38c29d1be8bab9dd4f406aea3b0e9151c1c06 Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Sat, 28 Apr 2018 21:51:56 +0200 -Subject: [PATCH 11/26] conf/ucm: chtrt5645: Cleanup and playback fixes - -Apply cleanup and playback fixes changes from: -https://github.com/plbossart/UCM.git - -Cc: Pierre-Louis Bossart -Signed-off-by: Pierre-Louis Bossart -[hdegoede@redhat.com: Modify commit msg and paths for merging into alsa-lib] -Signed-off-by: Hans de Goede -Signed-off-by: Takashi Iwai ---- - src/conf/ucm/chtrt5645/HiFi.conf | 157 ++++++++++++++++++++++++++++++++------- - 1 file changed, 129 insertions(+), 28 deletions(-) - -diff --git a/src/conf/ucm/chtrt5645/HiFi.conf b/src/conf/ucm/chtrt5645/HiFi.conf -index 0c2c83cc..f63392d4 100644 ---- a/src/conf/ucm/chtrt5645/HiFi.conf -+++ b/src/conf/ucm/chtrt5645/HiFi.conf -@@ -11,51 +11,146 @@ SectionVerb { - EnableSequence [ - cdev "hw:chtrt5645" - -- # Enable audio output path -- cset "name='codec_out1 mix 0 pcm0_in Switch' on" -- cset "name='media0_out mix 0 media1_in Switch' on" -+ # media mixer settings -+ # compress -+ cset "name='media0_in Gain 0 Switch' on" -+ cset "name='media0_in Gain 0 Volume' 0" - -- cset "name='media1_in Gain 0 Ramp Delay' 50" -+ # normal - cset "name='media1_in Gain 0 Switch' on" -- cset "name='media1_in Gain 0 Volume' 80% 80%" -+ cset "name='media1_in Gain 0 Volume' 0" -+ # swm loopback -+ cset "name='media2_in Gain 0 Switch' off" -+ cset "name='media2_in Gain 0 Volume' 0%" -+ # deep buffer -+ cset "name='media3_in Gain 0 Switch' on" -+ cset "name='media3_in Gain 0 Volume' 0" -+ -+ cset "name='media0_out mix 0 media0_in Switch' on" -+ cset "name='media0_out mix 0 media1_in Switch' on" -+ cset "name='media0_out mix 0 media2_in Switch' off" -+ cset "name='media0_out mix 0 media3_in Switch' on" -+ -+ cset "name='media1_out mix 0 media0_in Switch' off" -+ cset "name='media1_out mix 0 media1_in Switch' off" -+ cset "name='media1_out mix 0 media2_in Switch' off" -+ cset "name='media1_out mix 0 media3_in Switch' off" - -- cset "name='pcm0_in Gain 0 Ramp Delay' 50" - cset "name='pcm0_in Gain 0 Switch' on" -- cset "name='pcm0_in Gain 0 Volume' 80% 80%" -+ cset "name='pcm0_in Gain 0 Volume' 0" -+ -+ cset "name='pcm1_in Gain 0 Switch' off" -+ cset "name='pcm1_in Gain 0 Volume' 0%" -+ -+ # codec0_out settings (used if ssp2 is connected to aif1) -+ cset "name='codec_out0 mix 0 codec_in0 Switch' off" -+ cset "name='codec_out0 mix 0 codec_in1 Switch' off" -+ cset "name='codec_out0 mix 0 media_loop1_in Switch' off" -+ cset "name='codec_out0 mix 0 media_loop2_in Switch' off" -+ cset "name='codec_out0 mix 0 pcm0_in Switch' on" -+ cset "name='codec_out0 mix 0 pcm1_in Switch' off" -+ cset "name='codec_out0 mix 0 sprot_loop_in Switch' off" -+ cset "name='codec_out0 Gain 0 Switch' on" -+ cset "name='codec_out0 Gain 0 Volume' 0" -+ -+ # modem_out settings (used if ssp0 is connected to aif2) -+ cset "name='modem_out mix 0 codec_in0 Switch' off" -+ cset "name='modem_out mix 0 codec_in1 Switch' off" -+ cset "name='modem_out mix 0 media_loop1_in Switch' off" -+ cset "name='modem_out mix 0 media_loop2_in Switch' off" -+ cset "name='modem_out mix 0 pcm0_in Switch' on" -+ cset "name='modem_out mix 0 pcm1_in Switch' off" -+ cset "name='modem_out mix 0 sprot_loop_in Switch' off" -+ cset "name='modem_out Gain 0 Switch' on" -+ cset "name='modem_out Gain 0 Volume' 0" -+ -+ # input settings -+ # pcm1_out settings -+ -+ # input used when SSP2 is connected -+ cset "name='codec_in0 Gain 0 Switch' on" -+ cset "name='codec_in0 Gain 0 Volume' 0" - -- cset "name='codec_out1 Gain 0 Ramp Delay' 50" -- cset "name='codec_out1 Gain 0 Switch' on" -- cset "name='codec_out1 Gain 0 Volume' 70% 70%" -+ # input used when SSP0 is connected -+ cset "name='modem_in Gain 0 Switch' on" -+ cset "name='modem_in Gain 0 Volume' 0" - -- # Enable audio input path -- cset "name='pcm1_out mix 0 media_loop2_in Switch' on" -- cset "name='media_loop2_out mix 0 codec_in0 Switch' on" -+ cset "name='pcm1_out mix 0 codec_in0 Switch' on" -+ cset "name='pcm1_out mix 0 modem_in Switch' on" -+ cset "name='pcm1_out mix 0 codec_in1 Switch' off" -+ cset "name='pcm1_out mix 0 media_loop1_in Switch' off" -+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off" -+ cset "name='pcm1_out mix 0 pcm0_in Switch' off" -+ cset "name='pcm1_out mix 0 pcm1_in Switch' off" -+ cset "name='pcm1_out mix 0 sprot_loop_in Switch' off" - -- cset "name='codec_in0 Gain 0 Ramp Delay' 50" -- cset "name='codec_in0 Gain 0 Switch' on" -- cset "name='codec_in0 Gain 0 Volume' 80% 80%" -+ cset "name='pcm1_out Gain 0 Switch' on" -+ cset "name='pcm1_out Gain 0 Volume' 0" - -- cset "name='media_loop2_out Gain 0 Ramp Delay' 50" -- cset "name='media_loop2_out Gain 0 Switch' on" -- cset "name='media_loop2_out Gain 0 Volume' 80% 80%" -+ # disable codec_out1 -+ cset "name='codec_out1 mix 0 codec_in0 Switch' off" -+ cset "name='codec_out1 mix 0 codec_in1 Switch' off" -+ cset "name='codec_out1 mix 0 media_loop1_in Switch' off" -+ cset "name='codec_out1 mix 0 media_loop2_in Switch' off" -+ cset "name='codec_out1 mix 0 pcm0_in Switch' off" -+ cset "name='codec_out1 mix 0 pcm1_in Switch' off" -+ cset "name='codec_out1 mix 0 sprot_loop_in Switch' off" -+ cset "name='codec_out1 Gain 0 Switch' off" -+ cset "name='codec_out1 Gain 0 Volume' 0%" - -- cset "name='pcm1_out Gain 0 Ramp Delay' 50" -- cset "name='pcm1_out Gain 0 Switch' on" -- cset "name='pcm1_out Gain 0 Volume' 80% 80%" -+ # disable codec_in1 -+ cset "name='codec_in1 Gain 0 Switch' off" -+ cset "name='codec_in1 Gain 0 Volume' 0%" -+ -+ # disable all loops -+ cset "name='media_loop1_out mix 0 codec_in0 Switch' off" -+ cset "name='media_loop1_out mix 0 codec_in1 Switch' off" -+ cset "name='media_loop1_out mix 0 media_loop1_in Switch' off" -+ cset "name='media_loop1_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop1_out mix 0 pcm0_in Switch' off" -+ cset "name='media_loop1_out mix 0 pcm1_in Switch' off" -+ cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off" -+ cset "name='media_loop2_out mix 0 codec_in1 Switch' off" -+ cset "name='media_loop2_out mix 0 media_loop1_in Switch' off" -+ cset "name='media_loop2_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop2_out mix 0 pcm0_in Switch' off" -+ cset "name='media_loop2_out mix 0 pcm1_in Switch' off" -+ cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='sprot_loop_out mix 0 codec_in0 Switch' off" -+ cset "name='sprot_loop_out mix 0 codec_in1 Switch' off" -+ cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off" -+ cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off" -+ cset "name='sprot_loop_out mix 0 pcm0_in Switch' off" -+ cset "name='sprot_loop_out mix 0 pcm1_in Switch' off" -+ cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off" - - # Output Configuration -- cset "name='DAC L2 Mux' 'IF1 DAC'" -- cset "name='DAC R2 Mux' 'IF1 DAC'" -+ cset "name='DAC1 L Mux' IF1 DAC" -+ cset "name='DAC1 R Mux' IF1 DAC" -+ cset "name='DAC1 MIXL DAC1 Switch' 1" -+ cset "name='DAC1 MIXR DAC1 Switch' 1" -+ cset "name='Stereo DAC MIXL DAC L1 Switch' 1" -+ cset "name='Stereo DAC MIXR DAC R1 Switch' 1" -+ -+ cset "name='DAC L2 Mux' IF2 DAC" -+ cset "name='DAC R2 Mux' IF2 DAC" - cset "name='Mono DAC MIXL DAC L2 Switch' on" - cset "name='Mono DAC MIXR DAC R2 Switch' on" - cset "name='DAC2 Playback Switch' on" - -+ cset "name='HPOVOL MIXL DAC1 Switch' on" -+ cset "name='HPOVOL MIXR DAC1 Switch' on" - cset "name='HPOVOL MIXL DAC2 Switch' on" - cset "name='HPOVOL MIXR DAC2 Switch' on" - cset "name='HPO MIX HPVOL Switch' on" - cset "name='HPOVOL L Switch' on" - cset "name='HPOVOL R Switch' on" - -+ cset "name='SPK MIXL DAC L1 Switch' on" -+ cset "name='SPK MIXR DAC R1 Switch' on" - cset "name='SPK MIXL DAC L2 Switch' on" - cset "name='SPK MIXR DAC R2 Switch' on" - cset "name='SPOL MIX SPKVOL L Switch' on" -@@ -105,15 +200,18 @@ SectionDevice."Speaker" { - } - - ConflictingDevice [ -- "Headphone" -+ "Headphones" - ] - - EnableSequence [ - cdev "hw:chtrt5645" - -+ cset "name='Headphone Switch' off" -+ cset "name='Headphone Channel Switch' off" -+ - cset "name='Ext Spk Switch' on" - cset "name='Speaker Channel Switch' on" -- cset "name='Speaker Playback Volume' 39" -+ cset "name='Speaker Playback Volume' 31" - ] - - DisableSequence [ -@@ -124,7 +222,7 @@ SectionDevice."Speaker" { - ] - } - --SectionDevice."Headphone".0 { -+SectionDevice."Headphones" { - Comment "Headphones" - - Value { -@@ -140,9 +238,12 @@ SectionDevice."Headphone".0 { - EnableSequence [ - cdev "hw:chtrt5645" - -+ cset "name='Ext Spk Switch' off" -+ cset "name='Speaker Channel Switch' off" -+ - cset "name='Headphone Switch' on" - cset "name='Headphone Channel Switch' on" -- cset "name='Headphone Playback Volume' 39" -+ cset "name='Headphone Playback Volume' 31" - ] - - DisableSequence [ --- -2.13.6 - - -From 4c0d983d7b4402e7275455ac43f39049b45037ea Mon Sep 17 00:00:00 2001 -From: Pierre-Louis Bossart -Date: Sat, 28 Apr 2018 21:51:57 +0200 -Subject: [PATCH 12/26] conf/ucm: chtrt5645: Microphone recording fixes - -Apply microphone recording changes from: -https://github.com/plbossart/UCM.git - -Cc: Pierre-Louis Bossart -Signed-off-by: Pierre-Louis Bossart -[hdegoede@redhat.com: Drop non generic DMIC changes] -Signed-off-by: Hans de Goede -Signed-off-by: Takashi Iwai ---- - src/conf/ucm/chtrt5645/HiFi.conf | 50 ++++++++++++++++++++++++++++++++-------- - 1 file changed, 41 insertions(+), 9 deletions(-) - -diff --git a/src/conf/ucm/chtrt5645/HiFi.conf b/src/conf/ucm/chtrt5645/HiFi.conf -index f63392d4..b97a9c00 100644 ---- a/src/conf/ucm/chtrt5645/HiFi.conf -+++ b/src/conf/ucm/chtrt5645/HiFi.conf -@@ -4,8 +4,8 @@ SectionVerb { - TQ "HiFi" - - # ALSA PCM device for HiFi -- PlaybackPCM "hw:chtrt5645,0" -- CapturePCM "hw:chtrt5645,0" -+ PlaybackPCM "hw:chtrt5645" -+ CapturePCM "hw:chtrt5645" - } - - EnableSequence [ -@@ -255,7 +255,7 @@ SectionDevice."Headphones" { - } - - SectionDevice."Mic".0 { -- Comment "Internal Microphone" -+ Comment "Internal Analog Microphones" - - Value { - CaptureChannels "2" -@@ -266,15 +266,33 @@ SectionDevice."Mic".0 { - cdev "hw:chtrt5645" - - cset "name='Int Mic Switch' on" -- cset "name='Sto1 ADC MIXL ADC2 Switch' on" -- cset "name='Sto1 ADC MIXR ADC2 Switch' on" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ cset "name='Mono ADC MIXL ADC2 Switch' off" -+ cset "name='Mono ADC MIXR ADC2 Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' on" -+ cset "name='RECMIXR BST1 Switch' on" -+ - ] - - DisableSequence [ - cdev "hw:chtrt5645" - -- cset "name='Sto1 ADC MIXL ADC2 Switch' off" -- cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC1 Switch' off" -+ cset "name='Mono ADC MIXR ADC1 Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' off" -+ cset "name='RECMIXR BST1 Switch' off" -+ - cset "name='Int Mic Switch' off" - ] - } -@@ -292,19 +310,33 @@ SectionDevice."HSMic".0 { - cdev "hw:chtrt5645" - - cset "name='Headset Mic Switch' on" -- cset "name='RECMIXL BST1 Switch' on" -- cset "name='RECMIXR BST1 Switch' on" -+ - cset "name='Sto1 ADC MIXL ADC1 Switch' on" - cset "name='Sto1 ADC MIXR ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ cset "name='Mono ADC MIXL ADC2 Switch' off" -+ cset "name='Mono ADC MIXR ADC2 Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' on" -+ cset "name='RECMIXR BST1 Switch' on" -+ - ] - - DisableSequence [ - cdev "hw:chtrt5645" - - cset "name='Headset Mic Switch' off" -+ - cset "name='RECMIXL BST1 Switch' off" - cset "name='RECMIXR BST1 Switch' off" - cset "name='Sto1 ADC MIXL ADC1 Switch' off" - cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ - ] - } --- -2.13.6 - - -From 76bc53e69a12163a86e6746fd3011de6b1652043 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 28 Apr 2018 21:51:58 +0200 -Subject: [PATCH 13/26] conf/ucm: chtrt5645: Fix recording from internal analog - microphone - -The internal analog mic switch is called 'Int Analog Mic Switch' -(not 'Int Mic Switch') and is connected to BST2 not BST1. - -Also change the analog mic volume levels so that we get better -audio / less noise. - -Signed-off-by: Hans de Goede -Signed-off-by: Takashi Iwai ---- - src/conf/ucm/chtrt5645/HiFi.conf | 38 ++++++++++++++++++++++++-------------- - 1 file changed, 24 insertions(+), 14 deletions(-) - -diff --git a/src/conf/ucm/chtrt5645/HiFi.conf b/src/conf/ucm/chtrt5645/HiFi.conf -index b97a9c00..e81866cf 100644 ---- a/src/conf/ucm/chtrt5645/HiFi.conf -+++ b/src/conf/ucm/chtrt5645/HiFi.conf -@@ -160,15 +160,24 @@ SectionVerb { - - # Input Configuration - cset "name='Stereo1 DMIC Mux' 0" -+ cset "name='Stereo1 ADC1 Mux' 1" - cset "name='Stereo1 ADC2 Mux' 1" - cset "name='ADC Capture Switch' on" -- cset "name='ADC Capture Volume' 31" -- cset "name='ADC Boost Capture Volume' 3" -- cset "name='Mono ADC Capture Volume' 63" -- cset "name='Mono ADC Boost Capture Volume' 2" -- cset "name='IN Capture Volume' 63" -+ # 55/63 -+ cset "name='ADC Capture Volume' 55" -+ # set ADC Boost to 0/3, higher vals cause a lot of white noise -+ cset "name='ADC Boost Capture Volume' 0" -+ # 55/63 -+ cset "name='Mono ADC Capture Volume' 55" -+ # 0/3 -+ cset "name='Mono ADC Boost Capture Volume' 0" -+ # 27/31 -+ cset "name='IN Capture Volume' 27" - cset "name='I2S2 Func Switch' on" -- -+ # 3/12 the headphone mic tends to be quite loud -+ cset "name='IN1 Boost' 3" -+ # 8/8 the internal analog mic tends to be quite soft -+ cset "name='IN2 Boost' 8" - ] - - DisableSequence [ -@@ -243,7 +252,8 @@ SectionDevice."Headphones" { - - cset "name='Headphone Switch' on" - cset "name='Headphone Channel Switch' on" -- cset "name='Headphone Playback Volume' 31" -+ # 25/39 higher values cause crackling on some boards -+ cset "name='Headphone Playback Volume' 25" - ] - - DisableSequence [ -@@ -255,7 +265,7 @@ SectionDevice."Headphones" { - } - - SectionDevice."Mic".0 { -- Comment "Internal Analog Microphones" -+ Comment "Internal Analog Microphone" - - Value { - CaptureChannels "2" -@@ -265,7 +275,7 @@ SectionDevice."Mic".0 { - EnableSequence [ - cdev "hw:chtrt5645" - -- cset "name='Int Mic Switch' on" -+ cset "name='Int Analog Mic Switch' on" - - cset "name='Sto1 ADC MIXL ADC1 Switch' on" - cset "name='Sto1 ADC MIXR ADC1 Switch' on" -@@ -277,8 +287,8 @@ SectionDevice."Mic".0 { - cset "name='Mono ADC MIXL ADC2 Switch' off" - cset "name='Mono ADC MIXR ADC2 Switch' off" - -- cset "name='RECMIXL BST1 Switch' on" -- cset "name='RECMIXR BST1 Switch' on" -+ cset "name='RECMIXL BST2 Switch' on" -+ cset "name='RECMIXR BST2 Switch' on" - - ] - -@@ -290,10 +300,10 @@ SectionDevice."Mic".0 { - cset "name='Mono ADC MIXL ADC1 Switch' off" - cset "name='Mono ADC MIXR ADC1 Switch' off" - -- cset "name='RECMIXL BST1 Switch' off" -- cset "name='RECMIXR BST1 Switch' off" -+ cset "name='RECMIXL BST2 Switch' off" -+ cset "name='RECMIXR BST2 Switch' off" - -- cset "name='Int Mic Switch' off" -+ cset "name='Int Analog Mic Switch' off" - ] - } - --- -2.13.6 - - -From c22a7f423ddef2a1376bc84f2aafc0a167192ab6 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 28 Apr 2018 21:51:59 +0200 -Subject: [PATCH 14/26] conf/ucm: chtrt5645: At config for the Asus T100HA - -The Asus T100HA uses a digital mic rather then an analog one, add -long-name config specific for the T100HA, which is a copy of the standard -chtrt5645 config with the internal analog mic section replaced with one -for the digital mic found on the Asus T100HA. - -Signed-off-by: Hans de Goede -Signed-off-by: Takashi Iwai ---- - configure.ac | 1 + - .../ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf | 5 + - .../HiFi.conf | 348 +++++++++++++++++++++ - .../Makefile.am | 4 + - src/conf/ucm/Makefile.am | 1 + - 5 files changed, 359 insertions(+) - create mode 100644 src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf - create mode 100644 src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf - create mode 100644 src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am - -diff --git a/configure.ac b/configure.ac -index 5bc1994f..94baf055 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -717,6 +717,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ - src/conf/cards/Makefile \ - src/conf/pcm/Makefile \ - src/conf/ucm/Makefile \ -+ src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile \ - src/conf/ucm/broadwell-rt286/Makefile \ - src/conf/ucm/broxton-rt298/Makefile \ - src/conf/ucm/bytcr-rt5651/Makefile \ -diff --git a/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf -new file mode 100644 -index 00000000..5afe5f0b ---- /dev/null -+++ b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf -@@ -0,0 +1,5 @@ -+Comment "Intel SoC Audio Device" -+SectionUseCase."HiFi" { -+ File "../ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf" -+ Comment "Default" -+} -diff --git a/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf -new file mode 100644 -index 00000000..78bf9823 ---- /dev/null -+++ b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/HiFi.conf -@@ -0,0 +1,348 @@ -+SectionVerb { -+ # ALSA PCM -+ Value { -+ TQ "HiFi" -+ -+ # ALSA PCM device for HiFi -+ PlaybackPCM "hw:chtrt5645" -+ CapturePCM "hw:chtrt5645" -+ } -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ # media mixer settings -+ # compress -+ cset "name='media0_in Gain 0 Switch' on" -+ cset "name='media0_in Gain 0 Volume' 0" -+ -+ # normal -+ cset "name='media1_in Gain 0 Switch' on" -+ cset "name='media1_in Gain 0 Volume' 0" -+ # swm loopback -+ cset "name='media2_in Gain 0 Switch' off" -+ cset "name='media2_in Gain 0 Volume' 0%" -+ # deep buffer -+ cset "name='media3_in Gain 0 Switch' on" -+ cset "name='media3_in Gain 0 Volume' 0" -+ -+ cset "name='media0_out mix 0 media0_in Switch' on" -+ cset "name='media0_out mix 0 media1_in Switch' on" -+ cset "name='media0_out mix 0 media2_in Switch' off" -+ cset "name='media0_out mix 0 media3_in Switch' on" -+ -+ cset "name='media1_out mix 0 media0_in Switch' off" -+ cset "name='media1_out mix 0 media1_in Switch' off" -+ cset "name='media1_out mix 0 media2_in Switch' off" -+ cset "name='media1_out mix 0 media3_in Switch' off" -+ -+ cset "name='pcm0_in Gain 0 Switch' on" -+ cset "name='pcm0_in Gain 0 Volume' 0" -+ -+ cset "name='pcm1_in Gain 0 Switch' off" -+ cset "name='pcm1_in Gain 0 Volume' 0%" -+ -+ # codec0_out settings (used if ssp2 is connected to aif1) -+ cset "name='codec_out0 mix 0 codec_in0 Switch' off" -+ cset "name='codec_out0 mix 0 codec_in1 Switch' off" -+ cset "name='codec_out0 mix 0 media_loop1_in Switch' off" -+ cset "name='codec_out0 mix 0 media_loop2_in Switch' off" -+ cset "name='codec_out0 mix 0 pcm0_in Switch' on" -+ cset "name='codec_out0 mix 0 pcm1_in Switch' off" -+ cset "name='codec_out0 mix 0 sprot_loop_in Switch' off" -+ cset "name='codec_out0 Gain 0 Switch' on" -+ cset "name='codec_out0 Gain 0 Volume' 0" -+ -+ # modem_out settings (used if ssp0 is connected to aif2) -+ cset "name='modem_out mix 0 codec_in0 Switch' off" -+ cset "name='modem_out mix 0 codec_in1 Switch' off" -+ cset "name='modem_out mix 0 media_loop1_in Switch' off" -+ cset "name='modem_out mix 0 media_loop2_in Switch' off" -+ cset "name='modem_out mix 0 pcm0_in Switch' on" -+ cset "name='modem_out mix 0 pcm1_in Switch' off" -+ cset "name='modem_out mix 0 sprot_loop_in Switch' off" -+ cset "name='modem_out Gain 0 Switch' on" -+ cset "name='modem_out Gain 0 Volume' 0" -+ -+ # input settings -+ # pcm1_out settings -+ -+ # input used when SSP2 is connected -+ cset "name='codec_in0 Gain 0 Switch' on" -+ cset "name='codec_in0 Gain 0 Volume' 0" -+ -+ # input used when SSP0 is connected -+ cset "name='modem_in Gain 0 Switch' on" -+ cset "name='modem_in Gain 0 Volume' 0" -+ -+ cset "name='pcm1_out mix 0 codec_in0 Switch' on" -+ cset "name='pcm1_out mix 0 modem_in Switch' on" -+ cset "name='pcm1_out mix 0 codec_in1 Switch' off" -+ cset "name='pcm1_out mix 0 media_loop1_in Switch' off" -+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off" -+ cset "name='pcm1_out mix 0 pcm0_in Switch' off" -+ cset "name='pcm1_out mix 0 pcm1_in Switch' off" -+ cset "name='pcm1_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='pcm1_out Gain 0 Switch' on" -+ cset "name='pcm1_out Gain 0 Volume' 0" -+ -+ # disable codec_out1 -+ cset "name='codec_out1 mix 0 codec_in0 Switch' off" -+ cset "name='codec_out1 mix 0 codec_in1 Switch' off" -+ cset "name='codec_out1 mix 0 media_loop1_in Switch' off" -+ cset "name='codec_out1 mix 0 media_loop2_in Switch' off" -+ cset "name='codec_out1 mix 0 pcm0_in Switch' off" -+ cset "name='codec_out1 mix 0 pcm1_in Switch' off" -+ cset "name='codec_out1 mix 0 sprot_loop_in Switch' off" -+ cset "name='codec_out1 Gain 0 Switch' off" -+ cset "name='codec_out1 Gain 0 Volume' 0%" -+ -+ # disable codec_in1 -+ cset "name='codec_in1 Gain 0 Switch' off" -+ cset "name='codec_in1 Gain 0 Volume' 0%" -+ -+ # disable all loops -+ cset "name='media_loop1_out mix 0 codec_in0 Switch' off" -+ cset "name='media_loop1_out mix 0 codec_in1 Switch' off" -+ cset "name='media_loop1_out mix 0 media_loop1_in Switch' off" -+ cset "name='media_loop1_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop1_out mix 0 pcm0_in Switch' off" -+ cset "name='media_loop1_out mix 0 pcm1_in Switch' off" -+ cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off" -+ cset "name='media_loop2_out mix 0 codec_in1 Switch' off" -+ cset "name='media_loop2_out mix 0 media_loop1_in Switch' off" -+ cset "name='media_loop2_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop2_out mix 0 pcm0_in Switch' off" -+ cset "name='media_loop2_out mix 0 pcm1_in Switch' off" -+ cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='sprot_loop_out mix 0 codec_in0 Switch' off" -+ cset "name='sprot_loop_out mix 0 codec_in1 Switch' off" -+ cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off" -+ cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off" -+ cset "name='sprot_loop_out mix 0 pcm0_in Switch' off" -+ cset "name='sprot_loop_out mix 0 pcm1_in Switch' off" -+ cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off" -+ -+ # Output Configuration -+ cset "name='DAC1 L Mux' IF1 DAC" -+ cset "name='DAC1 R Mux' IF1 DAC" -+ cset "name='DAC1 MIXL DAC1 Switch' 1" -+ cset "name='DAC1 MIXR DAC1 Switch' 1" -+ cset "name='Stereo DAC MIXL DAC L1 Switch' 1" -+ cset "name='Stereo DAC MIXR DAC R1 Switch' 1" -+ -+ cset "name='DAC L2 Mux' IF2 DAC" -+ cset "name='DAC R2 Mux' IF2 DAC" -+ cset "name='Mono DAC MIXL DAC L2 Switch' on" -+ cset "name='Mono DAC MIXR DAC R2 Switch' on" -+ cset "name='DAC2 Playback Switch' on" -+ -+ cset "name='HPOVOL MIXL DAC1 Switch' on" -+ cset "name='HPOVOL MIXR DAC1 Switch' on" -+ cset "name='HPOVOL MIXL DAC2 Switch' on" -+ cset "name='HPOVOL MIXR DAC2 Switch' on" -+ cset "name='HPO MIX HPVOL Switch' on" -+ cset "name='HPOVOL L Switch' on" -+ cset "name='HPOVOL R Switch' on" -+ -+ cset "name='SPK MIXL DAC L1 Switch' on" -+ cset "name='SPK MIXR DAC R1 Switch' on" -+ cset "name='SPK MIXL DAC L2 Switch' on" -+ cset "name='SPK MIXR DAC R2 Switch' on" -+ cset "name='SPOL MIX SPKVOL L Switch' on" -+ cset "name='SPOR MIX SPKVOL R Switch' on" -+ cset "name='SPKVOL L Switch' on" -+ cset "name='SPKVOL R Switch' on" -+ -+ # Input Configuration -+ cset "name='Stereo1 DMIC Mux' 0" -+ cset "name='Stereo1 ADC1 Mux' 1" -+ cset "name='Stereo1 ADC2 Mux' 1" -+ cset "name='ADC Capture Switch' on" -+ # 55/63 -+ cset "name='ADC Capture Volume' 55" -+ # set ADC Boost to 0/3, higher vals cause a lot of white noise -+ cset "name='ADC Boost Capture Volume' 0" -+ # 55/63 -+ cset "name='Mono ADC Capture Volume' 55" -+ # 0/3 -+ cset "name='Mono ADC Boost Capture Volume' 0" -+ # 27/31 -+ cset "name='IN Capture Volume' 27" -+ cset "name='I2S2 Func Switch' on" -+ # 3/12 the headphone mic tends to be quite loud -+ cset "name='IN1 Boost' 3" -+ # 8/8 the internal analog mic tends to be quite soft -+ cset "name='IN2 Boost' 8" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ # Disable audio output path -+ cset "name='codec_out1 mix 0 pcm0_in Switch' off" -+ cset "name='media0_out mix 0 media1_in Switch' off" -+ -+ cset "name='media1_in Gain 0 Switch' off" -+ cset "name='pcm0_in Gain 0 Switch' off" -+ cset "name='codec_out1 Gain 0 Switch' off" -+ -+ # Disable audio input path -+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off" -+ -+ cset "name='media_loop2_out Gain 0 Switch' off" -+ cset "name='pcm1_out Gain 0 Switch' off" -+ cset "name='codec_in0 Gain 0 Switch' off" -+ ] -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ Value { -+ PlaybackChannels "2" -+ } -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headphone Switch' off" -+ cset "name='Headphone Channel Switch' off" -+ -+ cset "name='Ext Spk Switch' on" -+ cset "name='Speaker Channel Switch' on" -+ cset "name='Speaker Playback Volume' 31" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Ext Spk Switch' off" -+ cset "name='Speaker Channel Switch' off" -+ ] -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackChannels "2" -+ JackControl "Headphone Jack" -+ JackHWMute "Speaker" -+ } -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Ext Spk Switch' off" -+ cset "name='Speaker Channel Switch' off" -+ -+ cset "name='Headphone Switch' on" -+ cset "name='Headphone Channel Switch' on" -+ # 25/39 higher values cause crackling on some boards -+ cset "name='Headphone Playback Volume' 25" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headphone Switch' off" -+ cset "name='Headphone Channel Switch' off" -+ ] -+} -+ -+SectionDevice."DMic".0 { -+ Comment "Internal Microphone" -+ -+ Value { -+ CaptureChannels "2" -+ CapturePriority "150" -+ } -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Int Mic Switch' on" -+ -+ cset "name='Stereo1 DMIC Mux' DMIC1" -+ cset "name='Stereo1 ADC2 Mux' DMIC" -+ cset "name='Mono ADC L2 Mux' DMIC" -+ cset "name='Mono ADC R2 Mux' DMIC" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' on" -+ cset "name='Mono ADC MIXL ADC1 Switch' off" -+ cset "name='Mono ADC MIXR ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC2 Switch' on" -+ cset "name='Mono ADC MIXR ADC2 Switch' on" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ cset "name='Mono ADC MIXL ADC2 Switch' off" -+ cset "name='Mono ADC MIXR ADC2 Switch' off" -+ cset "name='Int Mic Switch' off" -+ ] -+} -+ -+SectionDevice."HSMic".0 { -+ Comment "Headset Microphone" -+ -+ Value { -+ CaptureChannels "2" -+ JackControl "Headset Mic Jack" -+ JackHWMute "DMic" -+ } -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headset Mic Switch' on" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ cset "name='Mono ADC MIXL ADC2 Switch' off" -+ cset "name='Mono ADC MIXR ADC2 Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' on" -+ cset "name='RECMIXR BST1 Switch' on" -+ -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headset Mic Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' off" -+ cset "name='RECMIXR BST1 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ -+ ] -+} -diff --git a/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am -new file mode 100644 -index 00000000..dd8b372a ---- /dev/null -+++ b/src/conf/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN/Makefile.am -@@ -0,0 +1,4 @@ -+alsaconfigdir = @ALSA_CONFIG_DIR@ -+ucmdir = $(alsaconfigdir)/ucm/ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN -+ucm_DATA = ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN.conf HiFi.conf -+EXTRA_DIST = $(ucm_DATA) -diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am -index 3b4f13a8..e496ca89 100644 ---- a/src/conf/ucm/Makefile.am -+++ b/src/conf/ucm/Makefile.am -@@ -1,4 +1,5 @@ - SUBDIRS=\ -+ASUSTeKCOMPUTERINC.-T100HAN-1.0-T100HAN \ - broadwell-rt286 \ - broxton-rt298 \ - bytcr-rt5651 \ --- -2.13.6 - - -From 5a2df9449d0b17e3579bde60ba48244ba24ea604 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Sat, 28 Apr 2018 21:52:00 +0200 -Subject: [PATCH 15/26] conf/ucm: chtrt5645: At config for the Lenovo Ideapad - Miix 320 - -The Lenovo Ideapad Miix 320 uses a digital mic connected to the DMIC2 input -(unlike the Asus T100HA which has it connected to the DMIC1 input), add a -long-name config specific for the Miix 320, which is a copy of the standard -chtrt5645 config with the internal analog mic section replaced with one -for a digital mic connected to the DMIC2 input. - -Signed-off-by: Hans de Goede -Signed-off-by: Takashi Iwai ---- - configure.ac | 1 + - .../HiFi.conf | 350 +++++++++++++++++++++ - ...ENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf | 5 + - .../Makefile.am | 4 + - src/conf/ucm/Makefile.am | 1 + - 5 files changed, 361 insertions(+) - create mode 100644 src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf - create mode 100644 src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf - create mode 100644 src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am - -diff --git a/configure.ac b/configure.ac -index 94baf055..3ee989eb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -729,6 +729,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ - src/conf/ucm/gpd-win-pocket-rt5645/Makefile \ - src/conf/ucm/HDAudio-Gigabyte-ALC1220DualCodecs/Makefile \ - src/conf/ucm/HDAudio-Lenovo-DualCodecs/Makefile \ -+ src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile \ - src/conf/ucm/PandaBoard/Makefile \ - src/conf/ucm/PandaBoardES/Makefile \ - src/conf/ucm/PAZ00/Makefile \ -diff --git a/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf -new file mode 100644 -index 00000000..8cc9c7f2 ---- /dev/null -+++ b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf -@@ -0,0 +1,350 @@ -+SectionVerb { -+ # ALSA PCM -+ Value { -+ TQ "HiFi" -+ -+ # ALSA PCM device for HiFi -+ PlaybackPCM "hw:chtrt5645" -+ CapturePCM "hw:chtrt5645" -+ } -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ # media mixer settings -+ # compress -+ cset "name='media0_in Gain 0 Switch' on" -+ cset "name='media0_in Gain 0 Volume' 0" -+ -+ # normal -+ cset "name='media1_in Gain 0 Switch' on" -+ cset "name='media1_in Gain 0 Volume' 0" -+ # swm loopback -+ cset "name='media2_in Gain 0 Switch' off" -+ cset "name='media2_in Gain 0 Volume' 0%" -+ # deep buffer -+ cset "name='media3_in Gain 0 Switch' on" -+ cset "name='media3_in Gain 0 Volume' 0" -+ -+ cset "name='media0_out mix 0 media0_in Switch' on" -+ cset "name='media0_out mix 0 media1_in Switch' on" -+ cset "name='media0_out mix 0 media2_in Switch' off" -+ cset "name='media0_out mix 0 media3_in Switch' on" -+ -+ cset "name='media1_out mix 0 media0_in Switch' off" -+ cset "name='media1_out mix 0 media1_in Switch' off" -+ cset "name='media1_out mix 0 media2_in Switch' off" -+ cset "name='media1_out mix 0 media3_in Switch' off" -+ -+ cset "name='pcm0_in Gain 0 Switch' on" -+ cset "name='pcm0_in Gain 0 Volume' 0" -+ -+ cset "name='pcm1_in Gain 0 Switch' off" -+ cset "name='pcm1_in Gain 0 Volume' 0%" -+ -+ # codec0_out settings (used if ssp2 is connected to aif1) -+ cset "name='codec_out0 mix 0 codec_in0 Switch' off" -+ cset "name='codec_out0 mix 0 codec_in1 Switch' off" -+ cset "name='codec_out0 mix 0 media_loop1_in Switch' off" -+ cset "name='codec_out0 mix 0 media_loop2_in Switch' off" -+ cset "name='codec_out0 mix 0 pcm0_in Switch' on" -+ cset "name='codec_out0 mix 0 pcm1_in Switch' off" -+ cset "name='codec_out0 mix 0 sprot_loop_in Switch' off" -+ cset "name='codec_out0 Gain 0 Switch' on" -+ cset "name='codec_out0 Gain 0 Volume' 0" -+ -+ # modem_out settings (used if ssp0 is connected to aif2) -+ cset "name='modem_out mix 0 codec_in0 Switch' off" -+ cset "name='modem_out mix 0 codec_in1 Switch' off" -+ cset "name='modem_out mix 0 media_loop1_in Switch' off" -+ cset "name='modem_out mix 0 media_loop2_in Switch' off" -+ cset "name='modem_out mix 0 pcm0_in Switch' on" -+ cset "name='modem_out mix 0 pcm1_in Switch' off" -+ cset "name='modem_out mix 0 sprot_loop_in Switch' off" -+ cset "name='modem_out Gain 0 Switch' on" -+ cset "name='modem_out Gain 0 Volume' 0" -+ -+ # input settings -+ # pcm1_out settings -+ -+ # input used when SSP2 is connected -+ cset "name='codec_in0 Gain 0 Switch' on" -+ cset "name='codec_in0 Gain 0 Volume' 0" -+ -+ # input used when SSP0 is connected -+ cset "name='modem_in Gain 0 Switch' on" -+ cset "name='modem_in Gain 0 Volume' 0" -+ -+ cset "name='pcm1_out mix 0 codec_in0 Switch' on" -+ cset "name='pcm1_out mix 0 modem_in Switch' on" -+ cset "name='pcm1_out mix 0 codec_in1 Switch' off" -+ cset "name='pcm1_out mix 0 media_loop1_in Switch' off" -+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off" -+ cset "name='pcm1_out mix 0 pcm0_in Switch' off" -+ cset "name='pcm1_out mix 0 pcm1_in Switch' off" -+ cset "name='pcm1_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='pcm1_out Gain 0 Switch' on" -+ cset "name='pcm1_out Gain 0 Volume' 0" -+ -+ # disable codec_out1 -+ cset "name='codec_out1 mix 0 codec_in0 Switch' off" -+ cset "name='codec_out1 mix 0 codec_in1 Switch' off" -+ cset "name='codec_out1 mix 0 media_loop1_in Switch' off" -+ cset "name='codec_out1 mix 0 media_loop2_in Switch' off" -+ cset "name='codec_out1 mix 0 pcm0_in Switch' off" -+ cset "name='codec_out1 mix 0 pcm1_in Switch' off" -+ cset "name='codec_out1 mix 0 sprot_loop_in Switch' off" -+ cset "name='codec_out1 Gain 0 Switch' off" -+ cset "name='codec_out1 Gain 0 Volume' 0%" -+ -+ # disable codec_in1 -+ cset "name='codec_in1 Gain 0 Switch' off" -+ cset "name='codec_in1 Gain 0 Volume' 0%" -+ -+ # disable all loops -+ cset "name='media_loop1_out mix 0 codec_in0 Switch' off" -+ cset "name='media_loop1_out mix 0 codec_in1 Switch' off" -+ cset "name='media_loop1_out mix 0 media_loop1_in Switch' off" -+ cset "name='media_loop1_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop1_out mix 0 pcm0_in Switch' off" -+ cset "name='media_loop1_out mix 0 pcm1_in Switch' off" -+ cset "name='media_loop1_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off" -+ cset "name='media_loop2_out mix 0 codec_in1 Switch' off" -+ cset "name='media_loop2_out mix 0 media_loop1_in Switch' off" -+ cset "name='media_loop2_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop2_out mix 0 pcm0_in Switch' off" -+ cset "name='media_loop2_out mix 0 pcm1_in Switch' off" -+ cset "name='media_loop2_out mix 0 sprot_loop_in Switch' off" -+ -+ cset "name='sprot_loop_out mix 0 codec_in0 Switch' off" -+ cset "name='sprot_loop_out mix 0 codec_in1 Switch' off" -+ cset "name='sprot_loop_out mix 0 media_loop1_in Switch' off" -+ cset "name='sprot_loop_out mix 0 media_loop2_in Switch' off" -+ cset "name='sprot_loop_out mix 0 pcm0_in Switch' off" -+ cset "name='sprot_loop_out mix 0 pcm1_in Switch' off" -+ cset "name='sprot_loop_out mix 0 sprot_loop_in Switch' off" -+ -+ # Output Configuration -+ cset "name='DAC1 L Mux' IF1 DAC" -+ cset "name='DAC1 R Mux' IF1 DAC" -+ cset "name='DAC1 MIXL DAC1 Switch' 1" -+ cset "name='DAC1 MIXR DAC1 Switch' 1" -+ cset "name='Stereo DAC MIXL DAC L1 Switch' 1" -+ cset "name='Stereo DAC MIXR DAC R1 Switch' 1" -+ -+ cset "name='DAC L2 Mux' IF2 DAC" -+ cset "name='DAC R2 Mux' IF2 DAC" -+ cset "name='Mono DAC MIXL DAC L2 Switch' on" -+ cset "name='Mono DAC MIXR DAC R2 Switch' on" -+ cset "name='DAC2 Playback Switch' on" -+ -+ cset "name='HPOVOL MIXL DAC1 Switch' on" -+ cset "name='HPOVOL MIXR DAC1 Switch' on" -+ cset "name='HPOVOL MIXL DAC2 Switch' on" -+ cset "name='HPOVOL MIXR DAC2 Switch' on" -+ cset "name='HPO MIX HPVOL Switch' on" -+ cset "name='HPOVOL L Switch' on" -+ cset "name='HPOVOL R Switch' on" -+ -+ cset "name='SPK MIXL DAC L1 Switch' on" -+ cset "name='SPK MIXR DAC R1 Switch' on" -+ cset "name='SPK MIXL DAC L2 Switch' on" -+ cset "name='SPK MIXR DAC R2 Switch' on" -+ cset "name='SPOL MIX SPKVOL L Switch' on" -+ cset "name='SPOR MIX SPKVOL R Switch' on" -+ cset "name='SPKVOL L Switch' on" -+ cset "name='SPKVOL R Switch' on" -+ -+ # Input Configuration -+ cset "name='Stereo1 DMIC Mux' 0" -+ cset "name='Stereo1 ADC1 Mux' 1" -+ cset "name='Stereo1 ADC2 Mux' 1" -+ cset "name='ADC Capture Switch' on" -+ # 55/63 -+ cset "name='ADC Capture Volume' 55" -+ # set ADC Boost to 0/3, higher vals cause a lot of white noise -+ cset "name='ADC Boost Capture Volume' 0" -+ # 55/63 -+ cset "name='Mono ADC Capture Volume' 55" -+ # 0/3 -+ cset "name='Mono ADC Boost Capture Volume' 0" -+ # 27/31 -+ cset "name='IN Capture Volume' 27" -+ cset "name='I2S2 Func Switch' on" -+ # 3/12 the headphone mic tends to be quite loud -+ cset "name='IN1 Boost' 3" -+ # 8/8 the internal analog mic tends to be quite soft -+ cset "name='IN2 Boost' 8" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ # Disable audio output path -+ cset "name='codec_out1 mix 0 pcm0_in Switch' off" -+ cset "name='media0_out mix 0 media1_in Switch' off" -+ -+ cset "name='media1_in Gain 0 Switch' off" -+ cset "name='pcm0_in Gain 0 Switch' off" -+ cset "name='codec_out1 Gain 0 Switch' off" -+ -+ # Disable audio input path -+ cset "name='pcm1_out mix 0 media_loop2_in Switch' off" -+ cset "name='media_loop2_out mix 0 codec_in0 Switch' off" -+ -+ cset "name='media_loop2_out Gain 0 Switch' off" -+ cset "name='pcm1_out Gain 0 Switch' off" -+ cset "name='codec_in0 Gain 0 Switch' off" -+ ] -+} -+ -+SectionDevice."Speaker" { -+ Comment "Speaker" -+ -+ Value { -+ PlaybackChannels "2" -+ } -+ -+ ConflictingDevice [ -+ "Headphones" -+ ] -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headphone Switch' off" -+ cset "name='Headphone Channel Switch' off" -+ -+ cset "name='Ext Spk Switch' on" -+ cset "name='Speaker Channel Switch' on" -+ cset "name='Speaker Playback Volume' 31" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Ext Spk Switch' off" -+ cset "name='Speaker Channel Switch' off" -+ ] -+} -+ -+SectionDevice."Headphones" { -+ Comment "Headphones" -+ -+ Value { -+ PlaybackChannels "2" -+ JackControl "Headphone Jack" -+ JackHWMute "Speaker" -+ } -+ -+ ConflictingDevice [ -+ "Speaker" -+ ] -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Ext Spk Switch' off" -+ cset "name='Speaker Channel Switch' off" -+ -+ cset "name='Headphone Switch' on" -+ cset "name='Headphone Channel Switch' on" -+ # 25/39 higher values cause crackling on some boards -+ cset "name='Headphone Playback Volume' 25" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headphone Switch' off" -+ cset "name='Headphone Channel Switch' off" -+ ] -+} -+ -+SectionDevice."DMic".0 { -+ Comment "Internal Microphone" -+ -+ Value { -+ CaptureChannels "2" -+ CapturePriority "150" -+ } -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Int Mic Switch' on" -+ -+ cset "name='Stereo1 DMIC Mux' DMIC2" -+ cset "name='Stereo1 ADC2 Mux' DMIC" -+ cset "name='Mono DMIC L Mux' DMIC2" -+ cset "name='Mono DMIC R Mux' DMIC2" -+ cset "name='Mono ADC L2 Mux' DMIC" -+ cset "name='Mono ADC R2 Mux' DMIC" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' on" -+ cset "name='Mono ADC MIXL ADC1 Switch' off" -+ cset "name='Mono ADC MIXR ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC2 Switch' on" -+ cset "name='Mono ADC MIXR ADC2 Switch' on" -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ cset "name='Mono ADC MIXL ADC2 Switch' off" -+ cset "name='Mono ADC MIXR ADC2 Switch' off" -+ cset "name='Int Mic Switch' off" -+ ] -+} -+ -+SectionDevice."HSMic".0 { -+ Comment "Headset Microphone" -+ -+ Value { -+ CaptureChannels "2" -+ JackControl "Headset Mic Jack" -+ JackHWMute "DMic" -+ } -+ -+ EnableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headset Mic Switch' on" -+ -+ cset "name='Sto1 ADC MIXL ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' on" -+ cset "name='Sto1 ADC MIXL ADC2 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC2 Switch' off" -+ -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ cset "name='Mono ADC MIXL ADC2 Switch' off" -+ cset "name='Mono ADC MIXR ADC2 Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' on" -+ cset "name='RECMIXR BST1 Switch' on" -+ -+ ] -+ -+ DisableSequence [ -+ cdev "hw:chtrt5645" -+ -+ cset "name='Headset Mic Switch' off" -+ -+ cset "name='RECMIXL BST1 Switch' off" -+ cset "name='RECMIXR BST1 Switch' off" -+ cset "name='Sto1 ADC MIXL ADC1 Switch' off" -+ cset "name='Sto1 ADC MIXR ADC1 Switch' off" -+ cset "name='Mono ADC MIXL ADC1 Switch' on" -+ cset "name='Mono ADC MIXR ADC1 Switch' on" -+ -+ ] -+} -diff --git a/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf -new file mode 100644 -index 00000000..50bda000 ---- /dev/null -+++ b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf -@@ -0,0 +1,5 @@ -+Comment "Intel SoC Audio Device" -+SectionUseCase."HiFi" { -+ File "../LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/HiFi.conf" -+ Comment "Default" -+} -diff --git a/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am -new file mode 100644 -index 00000000..18963c21 ---- /dev/null -+++ b/src/conf/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216/Makefile.am -@@ -0,0 +1,4 @@ -+alsaconfigdir = @ALSA_CONFIG_DIR@ -+ucmdir = $(alsaconfigdir)/ucm/LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216 -+ucm_DATA = LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216.conf HiFi.conf -+EXTRA_DIST = $(ucm_DATA) -diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am -index e496ca89..02df25f0 100644 ---- a/src/conf/ucm/Makefile.am -+++ b/src/conf/ucm/Makefile.am -@@ -11,6 +11,7 @@ GoogleNyan \ - gpd-win-pocket-rt5645 \ - HDAudio-Gigabyte-ALC1220DualCodecs \ - HDAudio-Lenovo-DualCodecs \ -+LENOVO-80XF-LenovoMIIX320_10ICR-LNVNB161216 \ - PandaBoard \ - PandaBoardES \ - PAZ00 \ --- -2.13.6 - - -From 8ebb40c96970c913719a75deb2fe82ba2e257386 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Wed, 2 May 2018 16:23:21 +0200 -Subject: [PATCH 16/26] conf/ucm: Add a UCM profile for Dell WD15 Dock - USB-audio - -USB-audio device on Dell WD15 docking station provides two individual -PCM streams, one for headphone and another for line out. A UCM -profile gives the proper roles for these. - -Signed-off-by: Takashi Iwai ---- - src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf | 5 +++++ - src/conf/ucm/Dell-WD15-Dock/HiFi.conf | 26 +++++++++++++++++++++++++ - src/conf/ucm/Dell-WD15-Dock/Makefile.am | 4 ++++ - src/conf/ucm/Makefile.am | 1 + - 4 files changed, 36 insertions(+) - create mode 100644 src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf - create mode 100644 src/conf/ucm/Dell-WD15-Dock/HiFi.conf - create mode 100644 src/conf/ucm/Dell-WD15-Dock/Makefile.am - -diff --git a/src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf b/src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf -new file mode 100644 -index 00000000..f4f0a8d9 ---- /dev/null -+++ b/src/conf/ucm/Dell-WD15-Dock/Dell-WD15-Dock.conf -@@ -0,0 +1,5 @@ -+Comment "USB-audio on Dell WD15 docking station" -+SectionUseCase."HiFi" { -+ File "HiFi.conf" -+ Comment "Default" -+} -diff --git a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -new file mode 100644 -index 00000000..b07f3440 ---- /dev/null -+++ b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -@@ -0,0 +1,26 @@ -+SectionDevice."Headphone" { -+ Comment "Headphone" -+ -+ Value { -+ PlaybackChannels "2" -+ PlaybackPCM "hw:WD15Dock,0" -+ } -+} -+ -+SectionDevice."LineOut" { -+ Comment "Line Out" -+ -+ Value { -+ PlaybackChannels "2" -+ PlaybackPCM "hw:WD15Dock,1" -+ } -+} -+ -+SectionDevice."Mic" { -+ Comment "Microphone" -+ -+ Value { -+ CaptureChannels "2" -+ CapturePCM "hw:WD15Dock,0" -+ } -+} -diff --git a/src/conf/ucm/Dell-WD15-Dock/Makefile.am b/src/conf/ucm/Dell-WD15-Dock/Makefile.am -new file mode 100644 -index 00000000..7ab58730 ---- /dev/null -+++ b/src/conf/ucm/Dell-WD15-Dock/Makefile.am -@@ -0,0 +1,4 @@ -+alsaconfigdir = @ALSA_CONFIG_DIR@ -+ucmdir = $(alsaconfigdir)/ucm/Dell-WD15-Dock -+ucm_DATA = Dell-WD15-Dock.conf HiFi.conf -+EXTRA_DIST = $(ucm_DATA) -diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am -index 02df25f0..38fc6b25 100644 ---- a/src/conf/ucm/Makefile.am -+++ b/src/conf/ucm/Makefile.am -@@ -7,6 +7,7 @@ chtrt5645 \ - chtrt5645-mono-speaker-analog-mic \ - DAISY-I2S \ - DB410c \ -+Dell-WD15-Dock \ - GoogleNyan \ - gpd-win-pocket-rt5645 \ - HDAudio-Gigabyte-ALC1220DualCodecs \ --- -2.13.6 - - -From 44f499bb22f3923f966e11a234455e3d06936b8b Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 3 May 2018 08:40:20 +0200 -Subject: [PATCH 17/26] configure: Fix forgotten ucm entry - -The previous commit forgot to add to configure.ac. Fix it. - -Signed-off-by: Takashi Iwai ---- - configure.ac | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configure.ac b/configure.ac -index 3ee989eb..693b5d53 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -725,6 +725,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ - src/conf/ucm/chtrt5645-mono-speaker-analog-mic/Makefile \ - src/conf/ucm/DAISY-I2S/Makefile \ - src/conf/ucm/DB410c/Makefile \ -+ src/conf/ucm/Dell-WD15-Dock/Makefile \ - src/conf/ucm/GoogleNyan/Makefile \ - src/conf/ucm/gpd-win-pocket-rt5645/Makefile \ - src/conf/ucm/HDAudio-Gigabyte-ALC1220DualCodecs/Makefile \ --- -2.13.6 - - -From 5eb78219f6bc0114cbb6518dae1c9256a63ec23a Mon Sep 17 00:00:00 2001 -From: Takashi Sakamoto -Date: Tue, 15 May 2018 21:36:34 +0900 -Subject: [PATCH 18/26] control: add a series of macro for offset of several - types of TLV - -In development period for Linux v4.18, a series of SNDRV_CTL_TLVO_XXX -macro was introduced to kernel stuffs for position offset of TLV data. - -This commit adds these macros to backport header in this library. - -Signed-off-by: Takashi Sakamoto -Signed-off-by: Takashi Iwai ---- - include/sound/tlv.h | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/include/sound/tlv.h b/include/sound/tlv.h -index b4df440c..2ea47685 100644 ---- a/include/sound/tlv.h -+++ b/include/sound/tlv.h -@@ -41,6 +41,10 @@ - #define SNDRV_CTL_TLVD_LENGTH(...) \ - ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) - -+/* Accessor offsets for TLV data items */ -+#define SNDRV_CTL_TLVO_TYPE 0 -+#define SNDRV_CTL_TLVO_LEN 1 -+ - #define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ - SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) - #define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ -@@ -60,6 +64,10 @@ - SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ - } - -+/* Accessor offsets for min, mute and step items in dB scale type TLV */ -+#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 -+#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 -+ - /* dB scale specified with min/max values instead of step */ - #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ - SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB)) -@@ -74,6 +82,10 @@ - SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ - } - -+/* Accessor offsets for min, max items in db-minmax types of TLV. */ -+#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2 -+#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3 -+ - /* linear volume between min_dB and max_dB (.01dB unit) */ - #define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ - SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB)) -@@ -82,6 +94,10 @@ - SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \ - } - -+/* Accessor offsets for min, max items in db-linear type of TLV. */ -+#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2 -+#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3 -+ - /* dB range container: - * Items in dB range container must be ordered by their values and by their - * dB values. This implies that larger values must correspond with larger --- -2.13.6 - - -From f61193c96c52cbd99e22d9cbb94937374ce2cb39 Mon Sep 17 00:00:00 2001 -From: Takashi Sakamoto -Date: Tue, 15 May 2018 21:36:35 +0900 -Subject: [PATCH 19/26] control: use position offset macro of TLV data - -A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset -of TLV data. This commit applies a code optimization. - -Signed-off-by: Takashi Sakamoto -Signed-off-by: Takashi Iwai ---- - src/control/control.c | 12 ++++---- - src/control/control_hw.c | 6 ++-- - src/control/control_local.h | 1 + - src/control/tlv.c | 72 ++++++++++++++++++++++++--------------------- - 4 files changed, 51 insertions(+), 40 deletions(-) - -diff --git a/src/control/control.c b/src/control/control.c -index 11f7815a..82cd1a05 100644 ---- a/src/control/control.c -+++ b/src/control/control.c -@@ -938,10 +938,10 @@ int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - * and compare the returned value after ioctl for checking - * the validity of TLV. - */ -- tlv[0] = -1; -- tlv[1] = 0; -+ tlv[SNDRV_CTL_TLVO_TYPE] = -1; -+ tlv[SNDRV_CTL_TLVO_LEN] = 0; - err = snd_ctl_tlv_do(ctl, 0, id, tlv, tlv_size); -- if (err >= 0 && tlv[0] == (unsigned int)-1) -+ if (err >= 0 && tlv[SNDRV_CTL_TLVO_TYPE] == (unsigned int)-1) - err = -ENXIO; - return err; - } -@@ -967,7 +967,8 @@ int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - const unsigned int *tlv) - { - assert(ctl && id && (id->name[0] || id->numid) && tlv); -- return snd_ctl_tlv_do(ctl, 1, id, (unsigned int *)tlv, tlv[1] + 2 * sizeof(unsigned int)); -+ return snd_ctl_tlv_do(ctl, 1, id, (unsigned int *)tlv, -+ tlv[SNDRV_CTL_TLVO_LEN] + 2 * sizeof(unsigned int)); - } - - /** -@@ -991,7 +992,8 @@ int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, - const unsigned int *tlv) - { - assert(ctl && id && (id->name[0] || id->numid) && tlv); -- return snd_ctl_tlv_do(ctl, -1, id, (unsigned int *)tlv, tlv[1] + 2 * sizeof(unsigned int)); -+ return snd_ctl_tlv_do(ctl, -1, id, (unsigned int *)tlv, -+ tlv[SNDRV_CTL_TLVO_LEN] + 2 * sizeof(unsigned int)); - } - - /** -diff --git a/src/control/control_hw.c b/src/control/control_hw.c -index 4cbd306f..68eca522 100644 ---- a/src/control/control_hw.c -+++ b/src/control/control_hw.c -@@ -240,11 +240,13 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag, - return -errno; - } - if (op_flag == 0) { -- if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size) { -+ unsigned int size; -+ size = xtlv->tlv[SNDRV_CTL_TLVO_LEN] + 2 * sizeof(unsigned int); -+ if (size > tlv_size) { - free(xtlv); - return -EFAULT; - } -- memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int)); -+ memcpy(tlv, xtlv->tlv, size); - } - free(xtlv); - return 0; -diff --git a/src/control/control_local.h b/src/control/control_local.h -index 30218c6c..9568968e 100644 ---- a/src/control/control_local.h -+++ b/src/control/control_local.h -@@ -20,6 +20,7 @@ - */ - - #include "local.h" -+#include - - typedef struct _snd_ctl_ops { - int (*close)(snd_ctl_t *handle); -diff --git a/src/control/tlv.c b/src/control/tlv.c -index 467023b3..d6944b52 100644 ---- a/src/control/tlv.c -+++ b/src/control/tlv.c -@@ -65,8 +65,8 @@ int snd_tlv_parse_dB_info(unsigned int *tlv, - int err; - - *db_tlvp = NULL; -- type = tlv[0]; -- size = tlv[1]; -+ type = tlv[SNDRV_CTL_TLVO_TYPE]; -+ size = tlv[SNDRV_CTL_TLVO_LEN]; - tlv_size -= 2 * sizeof(int); - if (size > tlv_size) { - SNDERR("TLV size error"); -@@ -83,7 +83,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv, - return err; /* error */ - if (err > 0) - return err; /* found */ -- len = int_index(tlv[1]) + 2; -+ len = int_index(tlv[SNDRV_CTL_TLVO_LEN]) + 2; - size -= len * sizeof(int); - tlv += len; - } -@@ -131,10 +131,10 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax, - { - int err; - -- switch (tlv[0]) { -+ switch (tlv[SNDRV_CTL_TLVO_TYPE]) { - case SND_CTL_TLVT_DB_RANGE: { - unsigned int pos, len; -- len = int_index(tlv[1]); -+ len = int_index(tlv[SNDRV_CTL_TLVO_LEN]); - if (len > MAX_TLV_RANGE_SIZE) - return -EINVAL; - pos = 2; -@@ -167,22 +167,23 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax, - } - case SND_CTL_TLVT_DB_SCALE: { - int step; -- if (tlv[3] & 0x10000) -+ if (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0x10000) - *min = SND_CTL_TLV_DB_GAIN_MUTE; - else -- *min = (int)tlv[2]; -- step = (tlv[3] & 0xffff); -- *max = (int)tlv[2] + step * (rangemax - rangemin); -+ *min = (int)tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN]; -+ step = (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0xffff); -+ *max = (int)tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] + -+ step * (rangemax - rangemin); - return 0; - } - case SND_CTL_TLVT_DB_MINMAX: - case SND_CTL_TLVT_DB_LINEAR: -- *min = (int)tlv[2]; -- *max = (int)tlv[3]; -+ *min = (int)tlv[SNDRV_CTL_TLVO_DB_LINEAR_MIN]; -+ *max = (int)tlv[SNDRV_CTL_TLVO_DB_LINEAR_MAX]; - return 0; - case SND_CTL_TLVT_DB_MINMAX_MUTE: - *min = SND_CTL_TLV_DB_GAIN_MUTE; -- *max = (int)tlv[3]; -+ *max = (int)tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX]; - return 0; - } - return -EINVAL; -@@ -200,10 +201,12 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax, - int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax, - long volume, long *db_gain) - { -- switch (tlv[0]) { -+ unsigned int type = tlv[SNDRV_CTL_TLVO_TYPE]; -+ -+ switch (type) { - case SND_CTL_TLVT_DB_RANGE: { - unsigned int pos, len; -- len = int_index(tlv[1]); -+ len = int_index(tlv[SNDRV_CTL_TLVO_LEN]); - if (len > MAX_TLV_RANGE_SIZE) - return -EINVAL; - pos = 2; -@@ -220,9 +223,9 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax, - } - case SND_CTL_TLVT_DB_SCALE: { - int min, step, mute; -- min = tlv[2]; -- step = (tlv[3] & 0xffff); -- mute = (tlv[3] >> 16) & 1; -+ min = tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN]; -+ step = (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0xffff); -+ mute = (tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] >> 16) & 1; - if (mute && volume <= rangemin) - *db_gain = SND_CTL_TLV_DB_GAIN_MUTE; - else -@@ -232,10 +235,10 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax, - case SND_CTL_TLVT_DB_MINMAX: - case SND_CTL_TLVT_DB_MINMAX_MUTE: { - int mindb, maxdb; -- mindb = tlv[2]; -- maxdb = tlv[3]; -+ mindb = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MIN]; -+ maxdb = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX]; - if (volume <= rangemin || rangemax <= rangemin) { -- if (tlv[0] == SND_CTL_TLVT_DB_MINMAX_MUTE) -+ if (type == SND_CTL_TLVT_DB_MINMAX_MUTE) - *db_gain = SND_CTL_TLV_DB_GAIN_MUTE; - else - *db_gain = mindb; -@@ -248,8 +251,8 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax, - } - #ifndef HAVE_SOFT_FLOAT - case SND_CTL_TLVT_DB_LINEAR: { -- int mindb = tlv[2]; -- int maxdb = tlv[3]; -+ int mindb = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MIN]; -+ int maxdb = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MAX]; - if (volume <= rangemin || rangemax <= rangemin) - *db_gain = mindb; - else if (volume >= rangemax) -@@ -289,11 +292,13 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax, - int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax, - long db_gain, long *value, int xdir) - { -- switch (tlv[0]) { -+ unsigned int type = tlv[SNDRV_CTL_TLVO_TYPE]; -+ -+ switch (type) { - case SND_CTL_TLVT_DB_RANGE: { - long dbmin, dbmax, prev_submax; - unsigned int pos, len; -- len = int_index(tlv[1]); -+ len = int_index(tlv[SNDRV_CTL_TLVO_LEN]); - if (len < 6 || len > MAX_TLV_RANGE_SIZE) - return -EINVAL; - pos = 2; -@@ -324,13 +329,14 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax, - return 0; - } - case SND_CTL_TLVT_DB_SCALE: { -- int min, step, max; -- min = tlv[2]; -- step = (tlv[3] & 0xffff); -+ int min, step, max, mute; -+ min = tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN]; -+ step = tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0xffff; -+ mute = tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] & 0x10000; - max = min + (int)(step * (rangemax - rangemin)); - if (db_gain <= min) - if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 && -- (tlv[3] & 0x10000)) -+ mute) - *value = rangemin + 1; - else - *value = rangemin; -@@ -348,11 +354,11 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax, - case SND_CTL_TLVT_DB_MINMAX: - case SND_CTL_TLVT_DB_MINMAX_MUTE: { - int min, max; -- min = tlv[2]; -- max = tlv[3]; -+ min = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MIN]; -+ max = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX]; - if (db_gain <= min) - if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 && -- tlv[0] == SND_CTL_TLVT_DB_MINMAX_MUTE) -+ type == SND_CTL_TLVT_DB_MINMAX_MUTE) - *value = rangemin + 1; - else - *value = rangemin; -@@ -370,8 +376,8 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax, - #ifndef HAVE_SOFT_FLOAT - case SND_CTL_TLVT_DB_LINEAR: { - int min, max; -- min = tlv[2]; -- max = tlv[3]; -+ min = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MIN]; -+ max = tlv[SNDRV_CTL_TLVO_DB_LINEAR_MAX]; - if (db_gain <= min) - *value = rangemin; - else if (db_gain >= max) --- -2.13.6 - - -From 33f0888f0da191af49f17916f6548076d7125ea9 Mon Sep 17 00:00:00 2001 -From: Takashi Sakamoto -Date: Tue, 15 May 2018 21:36:36 +0900 -Subject: [PATCH 20/26] hcontrol: use position offset macro of TLV data - -A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset -of TLV data. This commit applies a code optimization. - -Signed-off-by: Takashi Sakamoto -Signed-off-by: Takashi Iwai ---- - src/control/hcontrol.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c -index 7e775248..0cac8956 100644 ---- a/src/control/hcontrol.c -+++ b/src/control/hcontrol.c -@@ -870,7 +870,7 @@ int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv) - { - assert(elem); - assert(tlv); -- assert(tlv[1] >= 4); -+ assert(tlv[SNDRV_CTL_TLVO_LEN] >= 4); - return snd_ctl_elem_tlv_write(elem->hctl->ctl, &elem->id, tlv); - } - -@@ -886,7 +886,7 @@ int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv) - { - assert(elem); - assert(tlv); -- assert(tlv[1] >= 4); -+ assert(tlv[SNDRV_CTL_TLVO_LEN] >= 4); - return snd_ctl_elem_tlv_command(elem->hctl->ctl, &elem->id, tlv); - } - --- -2.13.6 - - -From b0b720513ee35ec0a5afada0b240310f2f2e1b30 Mon Sep 17 00:00:00 2001 -From: Takashi Sakamoto -Date: Tue, 15 May 2018 21:36:37 +0900 -Subject: [PATCH 21/26] pcm: hw: use position offset macro of TLV data - -A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset -of TLV data. This commit applies a code optimization. - -Signed-off-by: Takashi Sakamoto -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_hw.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c -index 65b198c5..a728b23b 100644 ---- a/src/pcm/pcm_hw.c -+++ b/src/pcm/pcm_hw.c -@@ -1199,6 +1199,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev, - snd_ctl_t *ctl; - snd_ctl_elem_id_t id = {0}; - unsigned int tlv[2048], *start; -+ unsigned int type; - snd_pcm_chmap_query_t **map; - int i, ret, nums; - -@@ -1223,9 +1224,10 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev, - /* FIXME: the parser below assumes that the TLV only contains - * chmap-related blocks - */ -- if (tlv[0] != SND_CTL_TLVT_CONTAINER) { -- if (!is_chmap_type(tlv[0])) { -- SYSMSG("Invalid TLV type %d\n", tlv[0]); -+ type = tlv[SNDRV_CTL_TLVO_TYPE]; -+ if (type != SND_CTL_TLVT_CONTAINER) { -+ if (!is_chmap_type(type)) { -+ SYSMSG("Invalid TLV type %d\n", type); - return NULL; - } - start = tlv; -@@ -1234,7 +1236,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev, - unsigned int *p; - int size; - start = tlv + 2; -- size = tlv[1]; -+ size = tlv[SNDRV_CTL_TLVO_LEN]; - nums = 0; - for (p = start; size > 0; ) { - if (!is_chmap_type(p[0])) { --- -2.13.6 - - -From 6dc2ed4090bee0e5516839173166c6a35c3d80be Mon Sep 17 00:00:00 2001 -From: Takashi Sakamoto -Date: Tue, 15 May 2018 21:36:38 +0900 -Subject: [PATCH 22/26] pcm: softvol: use position offset macro of TLV data - -A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset -of TLV data. This commit applies a code optimization. - -Signed-off-by: Takashi Sakamoto -Signed-off-by: Takashi Iwai ---- - src/pcm/pcm_softvol.c | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c -index 0eaeacef..f08208f8 100644 ---- a/src/pcm/pcm_softvol.c -+++ b/src/pcm/pcm_softvol.c -@@ -31,6 +31,8 @@ - #include "pcm_local.h" - #include "pcm_plugin.h" - -+#include -+ - #ifndef PIC - /* entry for static linking */ - const char *_snd_module_pcm_softvol = ""; -@@ -708,10 +710,11 @@ static void snd_pcm_softvol_dump(snd_pcm_t *pcm, snd_output_t *out) - static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo) - { - unsigned int tlv[4]; -- tlv[0] = SND_CTL_TLVT_DB_SCALE; -- tlv[1] = 2 * sizeof(int); -- tlv[2] = (int)(svol->min_dB * 100); -- tlv[3] = (int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val); -+ tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE; -+ tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int); -+ tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100); -+ tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] = -+ (int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val); - return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv); - } - --- -2.13.6 - - -From 275a438d425c3477be21e1929061f0c1605876f2 Mon Sep 17 00:00:00 2001 -From: Takashi Sakamoto -Date: Tue, 15 May 2018 21:36:39 +0900 -Subject: [PATCH 23/26] test: use position offset macro of TLV data - -A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset -of TLV data. This commit applies a code optimization. - -Signed-off-by: Takashi Sakamoto -Signed-off-by: Takashi Iwai ---- - test/user-ctl-element-set.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/user-ctl-element-set.c b/test/user-ctl-element-set.c -index e94152b9..fee130e2 100644 ---- a/test/user-ctl-element-set.c -+++ b/test/user-ctl-element-set.c -@@ -660,7 +660,7 @@ static int check_tlv(struct elem_set_trial *trial) - if (err < 0) - return err; - -- len = tlv[1] + sizeof(unsigned int) * 2; -+ len = tlv[SNDRV_CTL_TLVO_LEN] + sizeof(unsigned int) * 2; - curr = malloc(len); - if (curr == NULL) { - free(tlv); --- -2.13.6 - - -From 9ee3e4338f46f18a5cddc267bbb19c7a222c5801 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Tue, 22 May 2018 14:10:59 +0200 -Subject: [PATCH 24/26] conf: USB-audio: Fix for Xonar U7 SPDIF device - -Add the entry for Xonar U7 to make SPDIF working on it. - -Reported-by: Steve Banks -Signed-off-by: Takashi Iwai ---- - src/conf/cards/USB-Audio.conf | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 2b8f9a29..05779c47 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -38,6 +38,7 @@ USB-Audio.pcm.surround40_type { - USB-Audio.pcm.iec958_device { - # "NoiseBlaster 3000" 42 - "USB Sound Blaster HD" 1 -+ "Xonar U7" 1 - - # The below don't have digital in/out, so prevent them from being opened. - "Andrea PureAudio USB-SA Headset" 999 --- -2.13.6 - - -From 4740dd97bf54d67f0edef80e1b9e86c04c8ed402 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 23 May 2018 10:33:40 +0200 -Subject: [PATCH 25/26] pcm: add missing flags initialization for the fallback - control data - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_hw.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c -index a728b23b..59a24200 100644 ---- a/src/pcm/pcm_hw.c -+++ b/src/pcm/pcm_hw.c -@@ -1018,7 +1018,7 @@ static int map_status_and_control_data(snd_pcm_t *pcm, bool force_fallback) - snd_pcm_set_appl_ptr(pcm, &hw->mmap_control->appl_ptr, hw->fd, - SNDRV_PCM_MMAP_OFFSET_CONTROL); - if (hw->mmap_control_fallbacked) { -- unsigned int flags; -+ unsigned int flags = 0; - /* read appl_ptr and avail_min from kernel when device opened - * with SND_PCM_APPEND flag - */ --- -2.13.6 - - -From ad5aea89226f131f27790c98c4638e4596060f81 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 23 May 2018 10:36:17 +0200 -Subject: [PATCH 26/26] pcm ioplug: fix some coverity issues (switch, missing - unlock in snd_pcm_ioplug_drain()) - -Signed-off-by: Jaroslav Kysela ---- - src/pcm/pcm_ioplug.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c -index db64853b..4d44ae22 100644 ---- a/src/pcm/pcm_ioplug.c -+++ b/src/pcm/pcm_ioplug.c -@@ -533,6 +533,7 @@ static int snd_pcm_ioplug_drain(snd_pcm_t *pcm) - case SND_PCM_STATE_OPEN: - case SND_PCM_STATE_DISCONNECTED: - case SND_PCM_STATE_SUSPENDED: -+ snd_pcm_unlock(pcm); - return -EBADFD; - case SND_PCM_STATE_PREPARED: - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { -@@ -545,6 +546,8 @@ static int snd_pcm_ioplug_drain(snd_pcm_t *pcm) - case SND_PCM_STATE_RUNNING: - io->data->state = SND_PCM_STATE_DRAINING; - break; -+ default: -+ break; - } - - if (io->data->state == SND_PCM_STATE_DRAINING) { --- -2.13.6 - -From 7ca1f6e78c15846951e5d970a864382180be7213 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Wed, 28 Nov 2018 17:16:45 +0800 -Subject: [PATCH] conf: USB-Audio: Add Dell WD19 Dock in the IEC958 blacklist - -This Dock doesn't have IEC958 physical output, so add it to the -blacklist to prevent it being opened. - -[ Also adding WD15 Dock entry that has the same problem -- tiwai ] - -Signed-off-by: Hui Wang -Signed-off-by: Takashi Iwai ---- - src/conf/cards/USB-Audio.conf | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf -index 05779c47..1c677937 100644 ---- a/src/conf/cards/USB-Audio.conf -+++ b/src/conf/cards/USB-Audio.conf -@@ -60,6 +60,8 @@ USB-Audio.pcm.iec958_device { - "SWTOR Gaming Headset by Razer" 999 - "USB Device 0x46d_0x821" 999 - "USB Device 0x46d_0x992" 999 -+ "WD15 Dock" 999 -+ "WD19 Dock" 999 - } - - # Second iec958 device number, if any. --- -2.13.6 - -From 6eced6b4b6dca9f62ea3d13a40c5991231df3c5c Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Thu, 18 Oct 2018 09:38:38 +0200 -Subject: [PATCH] conf/ucm/Dell-WD15-Dock: Fix incorrect device names - -The device name string for Dell WD15 (and its variants) dock is set as -"WD15Dock", while the actual device name to be used is "Dock". - -Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1112292 -Fixes: 8ebb40c96970 ("conf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio") -Signed-off-by: Takashi Iwai ---- - src/conf/ucm/Dell-WD15-Dock/HiFi.conf | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -index b07f3440..1b6bd212 100644 ---- a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -+++ b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf -@@ -3,7 +3,7 @@ SectionDevice."Headphone" { - - Value { - PlaybackChannels "2" -- PlaybackPCM "hw:WD15Dock,0" -+ PlaybackPCM "hw:Dock,0" - } - } - -@@ -12,7 +12,7 @@ SectionDevice."LineOut" { - - Value { - PlaybackChannels "2" -- PlaybackPCM "hw:WD15Dock,1" -+ PlaybackPCM "hw:Dock,1" - } - } - -@@ -21,6 +21,6 @@ SectionDevice."Mic" { - - Value { - CaptureChannels "2" -- CapturePCM "hw:WD15Dock,0" -+ CapturePCM "hw:Dock,0" - } - } --- -2.13.6 - diff --git a/SOURCES/alsa-lib-1.1.9-config.patch b/SOURCES/alsa-lib-1.1.9-config.patch new file mode 100644 index 0000000..f8c2c59 --- /dev/null +++ b/SOURCES/alsa-lib-1.1.9-config.patch @@ -0,0 +1,44 @@ +diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf +index 09980586..c4525f0b 100644 +--- a/src/conf/alsa.conf ++++ b/src/conf/alsa.conf +@@ -67,8 +67,7 @@ defaults.pcm.nonblock 1 + defaults.pcm.compat 0 + defaults.pcm.minperiodtime 5000 # in us + defaults.pcm.ipc_key 5678293 +-defaults.pcm.ipc_gid audio +-defaults.pcm.ipc_perm 0660 ++defaults.pcm.ipc_perm 0600 + defaults.pcm.dmix.max_periods 0 + defaults.pcm.dmix.channels 2 + defaults.pcm.dmix.rate 48000 +diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf +index 7fa5c8b2..97936a82 100644 +--- a/src/conf/pcm/dmix.conf ++++ b/src/conf/pcm/dmix.conf +@@ -48,10 +48,6 @@ pcm.!dmix { + @func refer + name defaults.pcm.ipc_key + } +- ipc_gid { +- @func refer +- name defaults.pcm.ipc_gid +- } + ipc_perm { + @func refer + name defaults.pcm.ipc_perm +diff --git a/src/conf/pcm/dsnoop.conf b/src/conf/pcm/dsnoop.conf +index abbd44f7..528fb6ad 100644 +--- a/src/conf/pcm/dsnoop.conf ++++ b/src/conf/pcm/dsnoop.conf +@@ -41,10 +41,6 @@ pcm.!dsnoop { + @func refer + name defaults.pcm.ipc_key + } +- ipc_gid { +- @func refer +- name defaults.pcm.ipc_gid +- } + ipc_perm { + @func refer + name defaults.pcm.ipc_perm diff --git a/SPECS/alsa-lib.spec b/SPECS/alsa-lib.spec index 767bede..1469320 100644 --- a/SPECS/alsa-lib.spec +++ b/SPECS/alsa-lib.spec @@ -4,8 +4,8 @@ Summary: The Advanced Linux Sound Architecture (ALSA) library Name: alsa-lib -Version: 1.1.6 -Release: 3%{?prever_dot}%{?dist} +Version: 1.1.9 +Release: 4%{?prever_dot}%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: http://www.alsa-project.org/ @@ -14,8 +14,8 @@ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?post Source10: asound.conf Source11: modprobe-dist-alsa.conf Source12: modprobe-dist-oss.conf -Patch0: alsa-lib-1.1.6-post.patch -Patch1: alsa-lib-1.0.24-config.patch +Patch0: alsa-git.patch +Patch1: alsa-lib-1.1.9-config.patch Patch2: alsa-lib-1.0.14-glibc-open.patch BuildRequires: doxygen @@ -44,17 +44,28 @@ This package includes the ALSA development libraries for developing against the ALSA libraries and interfaces. %package -n alsa-ucm -Summary: ALSA Universal Configuration Manager -Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} +Summary: ALSA Use Case Manager configuration +Group: System Environment/Libraries +BuildArch: noarch +Requires: %{name} = %{version}-%{release} %description -n alsa-ucm The Advanced Linux Sound Architecture (ALSA) Universal Configuration Manager allows configuration of Audio input/output names and routing +%package -n alsa-topology +Summary: ALSA Topology configuration +Group: System Environment/Libraries +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description -n alsa-topology +The Advanced Linux Sound Architecture (ALSA) topology configuration +contains alsa-lib configuration of SoC topology + %prep %setup -q -n %{name}-%{version}%{?prever}%{?postver} -%patch0 -p1 -b .post +%patch0 -p1 -b .alsa-git %patch1 -p1 -b .config %patch2 -p1 -b .glibc-open @@ -70,6 +81,8 @@ make %{?_smp_mflags} V=1 make doc %install +%global sysmodprobedir %{_prefix}/lib/modprobe.d + make DESTDIR=%{buildroot} install # We need the library to be available even before /usr might be mounted @@ -82,17 +95,23 @@ mkdir -p -m 755 %{buildroot}/etc install -p -m 644 %{SOURCE10} %{buildroot}/etc # Install the modprobe files for ALSA -mkdir -p -m 755 %{buildroot}/lib/modprobe.d/ -install -p -m 644 %{SOURCE11} %{buildroot}/lib/modprobe.d/dist-alsa.conf +mkdir -p -m 755 %{buildroot}%{sysmodprobedir} +install -p -m 644 %{SOURCE11} %{buildroot}%{sysmodprobedir}/dist-alsa.conf # bug#926973, place this file to the doc directory install -p -m 644 %{SOURCE12} . # Create UCM directory mkdir -p %{buildroot}/%{_datadir}/alsa/ucm -#Remove libtool archives. +# Create topology directory +mkdir -p %{buildroot}/%{_datadir}/alsa/topology + +# Remove libtool archives. find %{buildroot} -name '*.la' -delete +# Remove /usr/include/asoundlib.h +rm %{buildroot}/%{_includedir}/asoundlib.h + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -107,7 +126,8 @@ find %{buildroot} -name '*.la' -delete #{_libdir}/alsa-lib/ %{_datadir}/alsa/ %exclude %{_datadir}/alsa/ucm -/lib/modprobe.d/dist-* +%exclude %{_datadir}/alsa/topology +%{sysmodprobedir}/dist-* %files devel %doc TODO doc/doxygen/ @@ -120,7 +140,14 @@ find %{buildroot} -name '*.la' -delete %files -n alsa-ucm %{_datadir}/alsa/ucm +%files -n alsa-topology +%{_datadir}/alsa/topology + %changelog +* Mon May 27 2019 Jaroslav Kysela - 1.1.9-4 +- Moved topology files to alsa-topology +- Updated to 1.1.9 + * Fri Jan 25 2019 Jaroslav Kysela - 1.1.6-3 - Sync with the RHEL 7 - Add Dell WD15/WD19 Dock to USB-Audio.conf and create UCM configs