Detailed changes v1.2.5.1 v1.2.6

From AlsaProject
Revision as of 13:08, 6 December 2021 by Perex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Detailed changelog between 1.2.5 and 1.2.6 releases

Changelog between 1.2.5.1 and 1.2.6 releases

alsa-plugins

Core

- Release v1.2.6 - rate-lav: Convert to libswresample

The libavresample has been deprecated.  Convert to the new API for
libswresample.

The phase shift and cutoff seem to be either redundant or not-working
properly, so those are dropped.

A52 Output plugin

- a52: fix NULL pointer dereference in a52_dump() - a52: add speaker-test command to the configuration file comment - a52: fix the double free for rec->slave and rec

The function snd_pcm_ioplug_delete() calls the close ops callback already,
thus exit more early in the error path.

- a52: add support for SND_PCM_IOPLUG_FLAG_BOUNDARY_WA - a52: fix a52_pointer return value

BugLink: https://github.com/alsa-project/alsa-plugins/issues/28

- a52: fix memory leak in the close callback - a52: fix restricted parameter for swab()

pcm_a52.c: In function ‘convert_data’:
pcm_a52.c:183:24: warning: passing argument 2 to ‘restrict’-qualified parameter aliases with argument 1 [-Wrestrict]
  183 |   swab(rec->outbuf, rec->outbuf, out_bytes + 8);
      |        ~~~~~~~~~~~  ~~~^~~~~~~~

- a52: fix two signess warnings - a52: don't call avcodec_register_all() for 58.91.0 (proved) - a52: the packet alloc is suppoted since 58.91.0 (proved) - a52: add more info lines to the dump function - a52: the dump callback should be void - a52: cleanup write_out_pending() function - a52: fix possible string overflow and double space - a52: implement dump callback to dump the output parameters - a52: allow to specify the avcodec - a52: Use av_frame_get_buffer() for buffer allocation

A more modern one for the recent API.

- a52: Correct data transfer in planar mode

The buffer offset was incorrectly calculated in samples.

- a52: handle the source sample format correctly

The recent a52 encoder in ffmpeg accepts planar S32 (fixed encoder)
or planar float (normal encoder) only. Extend the routines to support
all combinations of 16-bit, 32-bit and float source samples.

BugLink: https://github.com/alsa-project/alsa-plugins/pull/23

- a52: limit the number of periods for ioplug from slave PCM

Intel HDMI:

  PERIOD_SIZE: [32 4272000]
  PERIOD_BYTES: [128 17088000]
  PERIODS: [2 32]
  BUFFER_SIZE: [64 8544000]
  BUFFER_BYTES: [256 34176000]

Selected:

  PERIOD_SIZE: 768
  PERIOD_BYTES: 3072
  PERIODS: 32
  BUFFER_SIZE: 24576
  BUFFER_BYTES: 98304

The a52_hw_params() tries to set the big 4271616 buffer size (frames)
for speaker-test which is beyond the maximal slave buffer.

BugLink: https://github.com/alsa-project/alsa-plugins/pull/23

- a52: don't call avcodec_register_all() on newer libavocdec versions

It's no longer available starting with LIBAVCODEC_VERSION_MAJOR == 59.

BugLink: https://github.com/alsa-project/alsa-plugins/pull/23

- a52: support the new libavcodec encode API

ffmpeg 4.4 is the last version with avcodec_encode_audio2(). Starting from the
next release the new decoupled input-output API will be the only one available.

BugLink: https://github.com/alsa-project/alsa-plugins/pull/23

- a52: propagate errors from do_encode()

BugLink: https://github.com/alsa-project/alsa-plugins/pull/23

- a52: add some padding bytes to outbuf

Since it's used as AVPacket payload, the API requires it to be padded.

BugLink: https://github.com/alsa-project/alsa-plugins/pull/23

Documentation

- doc: new a52 input formats, global config

Document the new preconfiguration and libavcodec version-dependent input formats.

- rate-lav: Convert to libswresample

The libavresample has been deprecated.  Convert to the new API for
libswresample.

The phase shift and cutoff seem to be either redundant or not-working
properly, so those are dropped.

Jack PCM plugin

- jack: add -lpthread to Makefile - jack: Make the running state tracing code more robust to multi-thread access. - jack: trace the running state

Rate Converter plugins

- rate: Simplify with snd_pcm_channel_area_addr()

Use the new common helper instead of the open code.

- samplerate: Support multiple formats

Now that ALSA rate plugin core allows each rate plugin dealing with
multiple formats, this patch extends the libsamplerate plugin to
accept more formats, namely, S16 and S32.  The code has been carefully
modified so that it should still be compilable with old alsa-lib.

USB stream plugin

- usb_stream: ignore hint section in configuration

libavcodec's resampler

- rate: Simplify with snd_pcm_channel_area_addr()

Use the new common helper instead of the open code.

- rate-lav: Support multiple formats

Now that ALSA rate plugin core allows each rate plugin dealing with
multiple formats, this patch extends the rate-lav plugin to accept
more formats, namely, U8, S16 and S32.  The code has been carefully
modified so that it should still be compilable with old alsa-lib.

- rate-lav: Convert to libswresample

The libavresample has been deprecated.  Convert to the new API for
libswresample.

The phase shift and cutoff seem to be either redundant or not-working
properly, so those are dropped.

Detailed changelog between 1.1.6 and 1.2.6 releases

Changelog between 1.2.5.1 and 1.2.6 releases

alsa-python

Core

- Release v1.2.6

pyalsa.alsahcontrol module

- Fix PyTuple_SET_ITEM() usage - no return value

As noted in bpo-30459 (link bellow) the PyTuple_SET_ITEM() macro
has not a return value. Let's make code compatible with python 3.10.

Link: https://bugs.python.org/issue30459
BugLink: https://github.com/alsa-project/alsa-python/issues/2

pyalsa.alsamixer module

- Fix PyTuple_SET_ITEM() usage - no return value

As noted in bpo-30459 (link bellow) the PyTuple_SET_ITEM() macro
has not a return value. Let's make code compatible with python 3.10.

Link: https://bugs.python.org/issue30459
BugLink: https://github.com/alsa-project/alsa-python/issues/2

pyalsa.alsaseq module

- alsaseq: fix constant objects in Python 3

In Py3 everything is a long, so we can't get away with duplicating the
integer object layout any more. Properly subclass PyLong_Type instead,
with a bit of a hack to add an extra name field after the variable-sized
data section.

Also get rid of the enum type stuff, which seems to be unused cruft, and
the numprotocol stuff, because the base type can take care of that (and
we can't map arbitrary arithmetic results back to constants anyway).

Detailed changelog between 1.2.5.1 and 1.2.6 releases

Changelog between 1.2.5.1 and 1.2.6 releases

alsa-lib

Core

- Release v1.2.6 - conf: add safe_strtoll_base() like safe_strtol_base() - conf: introduce safe_strtol_base()

It is useful to parse hexadecimal strings, too.

- configure: bumb version to 1.2.6pre1 (for alsactl/alsa-utils) - fix build with --disable-ucm

Link: https://mailman.alsa-project.org/pipermail/alsa-devel/2021-June/186729.html

Config API

- conf: introduce snd_config_load_string() - conf: add possibility to evaluate simple integer math expressions

It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.

Examples:

        $[1 + 1]
        $[$[2 + 2] / $var1]
        $[0xa0 | 0x05]

As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.

Control API

- control: remap - assign right name to the child handle for no-op (2nd case) - control: remap - assign right name to the child handle for no-op - control: Minor documentation fixes. - control: Add documentation for snd_ctl_card_* and friends.

In this patch series, I added a description about control interface
handling and how control interfaces are identified.

In addition, I added/improved Doxygen documentation for the
snd_ctl_card_info_t type and related corresponding functions,
e.g. snd_ctl_card_info(). I also documented other card-related like
snd_card_next().

Along the way I did minor documentation improvements.

- control: empty - fix the static build

PCM API

- pcm: softvol - mark _snd_pcm_parse_control_id as static - pcm: partially revert "pcm: softvol - make snd_pcm_parse_control_id private"

This reverts partially commit b9a4997e92e4c16147fcf96453a4c3e08080ac66.

It seems that we have have some users for this very specific function.
Mark it deprecated and keep the softvol implementation separate,
so we can remove this function easily in future.

- pcm: multi plugin - adjust appl_ptr on rewind/forward operations

When doing rewind or forward operations, application pointer needs to
be properly adjusted, in the same way when doing commit/write
operations.

- pcm: add a note about return values of snd_pcm_state() - pcm: rate - fix some gcc warnings - pcm: direct plugins - fix bad memory access when channel bindings do not match hw

Fix and cleanup snd_pcm_direct_check_interleave() function.
Add requested / hardware channel check and use goto when the interleaved

- pcm: Move snd_pcm_channel_area_addr() and _step() to public header

Used in the rate plugins commonly.

- pcm: direct plugins - fix hw_ptr in the status callback

The parent hw_ptr may be in another range (boundary limit).
Set the correct value for the caller.

BugLink: https://github.com/alsa-project/alsa-lib/issues/155

- pcm: dmix - use pcm_frame_diff() in snd_pcm_dmix_sync_ptr0() - pcm: improve docs for snd_pcm_sw_params_get_avail_min() and snd_pcm_status_get_avail_max() - pcm: rate: Improve the support multiple formats

This patch extends the PCM rate plugin for allowing its converter
plugin to deal with multiple formats.  Currently, the converter plugin
is allowed to take different formats only when convert callback is
defined.  And for this way (so far only the standard linear rate
plugin does), all linear formats have to be handled, and it's
cumbersome.

OTOH, most other rate plugins are implemented with convert_s16
callback, which accepts only S16 format.  This is often not ideal
because many converter engines can handle 32bit formats.  Also, the
target format is often 32bit format, hence this would require
additional conversion even if the converter engine can output 32bit
natively.

In this patch, for addressing the problems above, the rate plugin API
is extended in the following way:

- The new get_supported_formats callback is added; this stores the bit
  masks of the supported input and output formats, as well as the
  behavior flags.  Currently only linear formats are allowed.
- When the plugin accepts only the interleaved stream, set
  SND_PCM_RATE_FLAG_INTERLEAVED flag bit.  Otherwise the code has to
  handle snd_pcm_channel_area at each call.
- When both input and output formats have to be identical, pass
  SND_PCM_RATE_FLAG_SYNC_FORMATS flag bit.
- When the converter wants to process different formats, use convert
  callback instead of convert_s16.  You can put both in the ops for
  compatibility, too.
  The input and output formats are found in the info argument of init
  callback.
- Now the PCM rate plugin core will skip the temporary buffer
  allocation and conversions for pre- and post-process if not needed
  (i.e. matching with the requested input or output format).

The rate plugin API version is bumped to 0x010003.

- pcm: rate: Refactoring temporary buffer allocations

Introduce common helpers to allocate and release the temporary buffers
and the associated snd_pcm_channel.  Now two allocated objects are
used instead of one malloc to be split.

Also, change the snd_pcm_channel set up to be in interleaved mode.
This will be necessary in the following change in the rate plugin.

RawMidi API

- rawmidi: allocate the read buffer in the params call

It is better to allocate the read buffer for the framing stream
in the params setup call.

Suggested-by: David Henningsson <coding@diwic.se>

- rawmidi: free framing read bufffer when the framing mode becomes inactive - rawmidi: add support for SNDRV_RAWMIDI_IOCTL_USER_PVERSION - rawmidi: return ENOTSUP when timestamp reads are not supported by plugins - rawmidi: allow timestamp reads only for the appropriate read mode - rawmidi: doc - fix the framing / read mode section

Follow the previous changes and describe the current API.

- rawmidi: rename enum snd_rawmidi_framing to snd_rawmidi_read_mode

We hide the internal data transfers using the data frames. Rename
the snd_rawmidi_framing enum to snd_rawmidi_read_mode to make
API more straight and understandable.

- rawmidi: define more abstract API for the timestamp reads

The frame structure is a bit internal thing for the kernel
data transfer implementation. Introduce snd_rawmidi_tread()
function which is straight for the application usage and hides
the framing data transfers (kernel space API).

The current code implements the read cache and does the merging
of the frame reads with the similar timestamps (opposite
to the kernel data split for big chunks).

If the application wants to use super-duper-lighting-fast reads,
the snd_rawmidi_read() may be used, but the structure must be
defined on it's own, because this mechanism is not preferred
and unsupported.

BugLink: https://github.com/alsa-project/alsa-lib/issues/172

- rawmidi: initialize the reserved space in snd_rawmidi_params_default()

BugLink: https://github.com/alsa-project/alsa-lib/issues/178

- rawmidi: Add rawmidi framing API

Optionally, incoming rawmidi bytes can be put inside a frame of type
snd_rawmidi_framing_tstamp_t.
The main current benefit is that can enable in-kernel timestamping of
incoming bytes, and that timestamp is likely to be more precise than
what userspace can offer.

Tstamp type framing requires a kernel >= 5.14 and a buffer size that
is a multiple of sizeof(snd_rawmidi_framing_tstamp_t). It is only
available on input streams.

Rawmidi API

- rawmidi: rename enum snd_rawmidi_framing to snd_rawmidi_read_mode

We hide the internal data transfers using the data frames. Rename
the snd_rawmidi_framing enum to snd_rawmidi_read_mode to make
API more straight and understandable.

- rawmidi: define more abstract API for the timestamp reads

The frame structure is a bit internal thing for the kernel
data transfer implementation. Introduce snd_rawmidi_tread()
function which is straight for the application usage and hides
the framing data transfers (kernel space API).

The current code implements the read cache and does the merging
of the frame reads with the similar timestamps (opposite
to the kernel data split for big chunks).

If the application wants to use super-duper-lighting-fast reads,
the snd_rawmidi_read() may be used, but the structure must be
defined on it's own, because this mechanism is not preferred
and unsupported.

BugLink: https://github.com/alsa-project/alsa-lib/issues/172

- rawmidi: Use the standard types for snd_rawmidi_framing_tstamp_t definition

Using the kernel-specific types like __u8 breaks the compilation of
applications.  Also we need the packed attribute.

Although we may want to move to an opaque type later, let's put the
workaround at first.

- rawmidi: Add rawmidi framing API

Optionally, incoming rawmidi bytes can be put inside a frame of type
snd_rawmidi_framing_tstamp_t.
The main current benefit is that can enable in-kernel timestamping of
incoming bytes, and that timestamp is likely to be more precise than
what userspace can offer.

Tstamp type framing requires a kernel >= 5.14 and a buffer size that
is a multiple of sizeof(snd_rawmidi_framing_tstamp_t). It is only
available on input streams.

Topology API

- topology: do not call strtol directly

Introduce safe_strtol_base() function and redirects all
strtol calls there. Also, improve error and value handling
in callers.

BugLink: https://github.com/alsa-project/alsa-lib/issues/187

Use Case Manager API

- ucm: add initial doxygen documenation

This is an attempt to explain the UCM in a more verbose way.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/103

- conf: introduce snd_config_load_string() - ucm: add ${eval:EXPR} substitution (Syntax 5)

It is useful to do simple integer math in UCM configurations, too.
Use snd_config_evaluate_string() string for this job.

Example:

    ${eval:1+1}
    ${eval:100*$var1}
    ${eval:$[$var2+1]/5}

- ucm: fix parsing of the internal hexadecimal card identifier (2)

I forgot to change the passed variable name.

- ucm: fix parsing of the internal hexadecimal card identifier

Too many code was removed.

- ucm: fix DeviceModifier parser

The bellow commit caused regression for the SectionModifier parser. Revert
the single line change.

- conf: introduce safe_strtol_base()

It is useful to parse hexadecimal strings, too.

- ucm: suppress the no device (no UCM card) errors on request

It seems that users are confused when the UCM configuration
is not ready for the particular hardware. Actually, we don't
allow a fine grained message classification in alsa-lib and
UCM API. Allow suppression of this specific type of messages
on the application request (typically alsactl).

BugLink: https://github.com/alsa-project/alsa-utils/issues/111

- ucm: substitute the before/after identifiers

This allows to handle correctly declarations like:
  Before.SectionDevice "${var:DeviceMic}"

- ucm: fix the parsing of the hexadecimal prefix

The safe_strtol() function use strtol() which expects
to have the '0x' prefix for the hexadecimal number (when
base argument is zero).

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1553

- ucm: avoid zero card instance number

/src/Makefile.am

- conf: add possibility to evaluate simple integer math expressions

It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.

Examples:

        $[1 + 1]
        $[$[2 + 2] / $var1]
        $[0xa0 | 0x05]

As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.

Configuration

- conf: introduce snd_config_load_string() - conf: confeval - fix _to_integer error code - conf: improve simple integer math expressions - brackets

Add brackets to the simple math expressions like:

  $[($a+($val+100))/2]

- ucm: add ${eval:EXPR} substitution (Syntax 5)

It is useful to do simple integer math in UCM configurations, too.
Use snd_config_evaluate_string() string for this job.

Example:

    ${eval:1+1}
    ${eval:100*$var1}
    ${eval:$[$var2+1]/5}

- conf: add possibility to evaluate simple integer math expressions

It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.

Examples:

        $[1 + 1]
        $[$[2 + 2] / $var1]
        $[0xa0 | 0x05]

As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.

- conf: add safe_strtoll_base() like safe_strtol_base() - conf: introduce safe_strtol_base()

It is useful to parse hexadecimal strings, too.

Documentation

- ucm: add initial doxygen documenation

This is an attempt to explain the UCM in a more verbose way.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/103

Dynamic Loader helpers

- dlmisc.c: Avoid double unlock in snd_dlobj_cache_get0()

Remove call to snd_dlobj_unlock() in snd_dlobj_cache_get0()
All lock/unlock is done by callers of the function.

Buglink: https://github.com/alsa-project/alsa-lib/issues/181

External PCM Plugin SDK

- pcm: partially revert "pcm: softvol - make snd_pcm_parse_control_id private"

This reverts partially commit b9a4997e92e4c16147fcf96453a4c3e08080ac66.

It seems that we have have some users for this very specific function.
Mark it deprecated and keep the softvol implementation separate,
so we can remove this function easily in future.

External Rate Converter Plugin SDK

- pcm: rate: Improve the support multiple formats

This patch extends the PCM rate plugin for allowing its converter
plugin to deal with multiple formats.  Currently, the converter plugin
is allowed to take different formats only when convert callback is
defined.  And for this way (so far only the standard linear rate
plugin does), all linear formats have to be handled, and it's
cumbersome.

OTOH, most other rate plugins are implemented with convert_s16
callback, which accepts only S16 format.  This is often not ideal
because many converter engines can handle 32bit formats.  Also, the
target format is often 32bit format, hence this would require
additional conversion even if the converter engine can output 32bit
natively.

In this patch, for addressing the problems above, the rate plugin API
is extended in the following way:

- The new get_supported_formats callback is added; this stores the bit
  masks of the supported input and output formats, as well as the
  behavior flags.  Currently only linear formats are allowed.
- When the plugin accepts only the interleaved stream, set
  SND_PCM_RATE_FLAG_INTERLEAVED flag bit.  Otherwise the code has to
  handle snd_pcm_channel_area at each call.
- When both input and output formats have to be identical, pass
  SND_PCM_RATE_FLAG_SYNC_FORMATS flag bit.
- When the converter wants to process different formats, use convert
  callback instead of convert_s16.  You can put both in the ops for
  compatibility, too.
  The input and output formats are found in the info argument of init
  callback.
- Now the PCM rate plugin core will skip the temporary buffer
  allocation and conversions for pre- and post-process if not needed
  (i.e. matching with the requested input or output format).

The rate plugin API version is bumped to 0x010003.

Kernel Headers

- rawmidi: add support for SNDRV_RAWMIDI_IOCTL_USER_PVERSION - asound.h: fix the __packed use for the out-of-kernel code

Also, move __kernel_long_t to type_compat.h for the consistency.

- rawmidi: Add rawmidi framing API

Optionally, incoming rawmidi bytes can be put inside a frame of type
snd_rawmidi_framing_tstamp_t.
The main current benefit is that can enable in-kernel timestamping of
incoming bytes, and that timestamp is likely to be more precise than
what userspace can offer.

Tstamp type framing requires a kernel >= 5.14 and a buffer size that
is a multiple of sizeof(snd_rawmidi_framing_tstamp_t). It is only
available on input streams.

Test/Example code

- conf: introduce snd_config_load_string() - conf: fix test/lsb/config.c - conf: improve simple integer math expressions - brackets

Add brackets to the simple math expressions like:

  $[($a+($val+100))/2]

- conf: add possibility to evaluate simple integer math expressions

It is useful to use the math expressions for the values in configuration.
This patch adds a simple expression evaluation routines (integer only).
The syntax is simplified unix shell (bash) style.

Examples:

        $[1 + 1]
        $[$[2 + 2] / $var1]
        $[0xa0 | 0x05]

As a bonus, the variable substitutions were more abstracted.
The function snd_config_expand_custom() was introduced to be used
for example in the topology pre-precessor.

- rawmidi: rename enum snd_rawmidi_framing to snd_rawmidi_read_mode

We hide the internal data transfers using the data frames. Rename
the snd_rawmidi_framing enum to snd_rawmidi_read_mode to make
API more straight and understandable.

- rawmidi: define more abstract API for the timestamp reads

The frame structure is a bit internal thing for the kernel
data transfer implementation. Introduce snd_rawmidi_tread()
function which is straight for the application usage and hides
the framing data transfers (kernel space API).

The current code implements the read cache and does the merging
of the frame reads with the similar timestamps (opposite
to the kernel data split for big chunks).

If the application wants to use super-duper-lighting-fast reads,
the snd_rawmidi_read() may be used, but the structure must be
defined on it's own, because this mechanism is not preferred
and unsupported.

BugLink: https://github.com/alsa-project/alsa-lib/issues/172

- test: rawmidi: Add test for rawmidi framing API

Adds a "clock type" parameter to the "rawmidi" test program, that when
used and combined with -i (and -v to be useful), activates tstamp type
framing with the specified clock type.

alsa-utils

Core

- Release v1.2.6

ALSA Control (alsactl)

- alsactl: fix the check for additional elements

The driver may export only write-only elements. The previous
heuristics code do not handle this use case correctly.
Iterate through all elements and skip the write-only ones.

- alsactl: suppress no device 'errors' for UCM

This patch adds --ucm-nodev (or -X) option to get those
messages back. The code works only with library 1.2.6+.

By default, these messages are suppressed:

  alsactl[xxx]: alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HDA Intel PCH...)
  alsactl[xxx]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6

Link: https://lore.kernel.org/alsa-devel/20211027144008.27002-1-tiwai@suse.de/
Link: https://github.com/alsa-project/alsa-lib/commit/23198a72cd4f8f8759e650362b4adb485fc9fb12

ALSA RawMidi Utility (amidi)

- amidi: remove unused variable - amidi: add timestamp option for dump

Added -T / --timestamp option (with parameter "realtime", "monotonic" or "raw") which prints
a timestamp before each received message when using the --dump mode.

alsa-info.sh

- alsa-info.sh: Fix alsa-usbstream.tmp test

alsaloop

- alsaloop: Support "Playback Pitch 1000000" rate shift

Linux 5.15 will introduce a new control element "Playback Pitch 1000000"
(commit 6fec018 ("usb: gadget: u_audio.c: Adding Playback Pitch ctl for
sync playback") which provides feedback mechanism for playback direction
of USB Audio Gadget. The control operates in the same way as the
existing control element "Capture Pitch 1000000".

This patch adds support for this feature.

- alsaloop: Renamed field capt_pitch to ctl_pitch

Renaming capt_pitch to ctl_pitch to respect the naming style of
snd_ctl_elem_value_t fields in loopback_handle. Also making the variable
name suitable for planned support of playback pitch.

- alsaloop: fixed parsing value 'auto' of option 'sync'

The value 'auto' was not checked which resulted in using
SYNC_TYPE_NONE instead of SYNC_TYPE_AUTO.

- alsaloop: added option prateshift for PLAYSHIFT ctl elem used in PLAYSHIFT

If snd-aloop device is on playback side, the required sync mode is
PLAYSHIFT. That means Loopback ctl elem "PCM Rate Shift 100000" of the
corresponding capture side of the Loopback pipe must be controlled (by
a reciprocal).

ASCII name of the playback rate shift ctl elem is specified with newly
added option -x/--prateshift, e.g.:
  -P hw:Loopback,0 -S playshift \
  -x iface=PCM,name='PCM Rate Shift 100000',device=1

- alsaloop: Adding openctl_elem debug log

When debugging what ctl elem was found and opened (if any) a debug log is
helpful.

- alsaloop: Support "Capture Pitch 1000000" rate shift

In Linux 5.14, a new feedback mechanism for USB Audio
Gadget is introduced (commit e89bb428), along with a
new control element "Capture Pitch 1000000". This patch
adds support for this feature. Note that this property
seems to be the reverse of PCM Rate Shift, so we have
to take reciprocal of pitch.

alsamixer

- alsamixer: fix typo in man page (and/of -> and/or) - alsamixer: Allow setting the default background color in config

The recent commit c867aa8a84a7 ("alsamixer: use background color
instead of COLOR_BLACK") changed the behavior of alsamixer to take the
system default background color instead of black.  This caused
problems on the terminal setups that have bright background colors,
e.g. yellow is very hard to read.

It could be "fixed" by setting up the color configurations in
~/.config/alsamixer.rc, but this needs to change the all colors in
every element, which is pretty cumbersome.  Instead, this patch
extends the config set command to allow user to specify the default
background color.  A user like me can create their own
~/.config/alsamixer.rc file containing the line

  set background black

and the old good black background is back again.

Note that, for achieving the above, we also had to shuffle the
function call order, to parse the config at first, then initialize
curses.  This shouldn't matter for other behavior.

- alsamixer: Check the availability of mouse

Let's check the availiabiy via has_mouse().  Otherwise the program
aborts unexpectedly just focusing on my rxvt terminal :-(

- Added configuration information to manual page

Added sections FILES and CONFIGURATION.
Removed section BUGS, because the described terminal issues have been fixed.

alsatplg (topology)

- topology: fix compilation for older alsa-lib - topology: change include path

Add support for relative (based on the path from the parsed
configuration file) and absolute include path without
ALSA_CONFIG_DIR environment variable usage. The dependency
on the alsa-lib config tree may be added on demand.

Link: https://github.com/alsa-project/alsa-utils/pull/117
Link: https://github.com/alsa-project/alsa-utils/issues/118

- topology: pre-processor: Add support for conditional includes

Add a new keyword "IncludeByKey" that will be used to conditional
include configuration files based on the argument value supplied during
build time. For example:

IncludeByKey.DMIC_CH_COUNT {
        "[1-4]" "include/platform/intel/dmic-generic.conf"
}

The above config will include the dmic-generic.conf file if the argument
value for DMIC_CH_COUNT is between 1 and 4.

- topology: Add option to pass pre-processor definitions

Add a -D switch to be able to pass pre-processor definitions that will
be used to expand arguments in the input config file. This will be
useful to generate multiple topology binaries from the same input config
file with different argument values.

For example: if we had a pipeline config as follows:

Object.Pipeline {
        volume-playback.1 {
                dynamic_pipeline $DYNAMIC_PIPELINE
        }
}

We can define the variable for DYNAMIC_PIPELINE as:

Define {
        DYNAMIC_PIPELINE 0
}

And when pre-processing the conf file pass "-D DYNAMIC_PIPELINE=1" to
override the default value for dynamic_pipeline attribute in the input
conf file.

- alsatplg: use standard include/asoundlib.h instead direct headers

BugLink: https://github.com/alsa-project/alsa-lib/pull/169

- topology:pre-process-object: merge object config with parent object config

An object can be declared within a class definition as follows:

Class.Pipeline.volume-playback {
        Object.Widget.pga.0 {
                ramp_step_ms 250
        }
}

While instantiating the volume-pipeline class, the pga object
could be modified as follows:

Object.Pipeline.volume-playback.0 {
        Object.Widget.pga.0 {
                format "s24le"
        }
}

When building the pga.0 object in the class definition, merge
the attributes declared in the volume-playback.0 object to create
a new config as follows to make sure that all attributes are
set for the pga object.

        Object.Widget.pga.0 {
                ramp_step_ms 250
                format "s24le"
        }

- pre-process-object: set tlv name if config exists already

Do not create TLV config if it exists already. Just
set the string value with the name name.

- pre-process-dapm: add data section for kcontrols

Allow support for adding data section for kcontrols.

- topology: pre-processor: fix typo in pre_process_config()

Fix typo in config variable name. Should be n2 instead of n.

- topology: pre-process-object: dont create if section already exists

Skip creating section when it exists already.

- pre-process-object: skip parent update if parent is NULL

Nothing to do for top-level objects with no parent.
Also, add access to the bytes control template.

- pre-process-dapm: fix source and sink for DAPM routes

Switch source and sink widgets in the DAPM route.

- topology: pre-process-object: Add support for pre-process objects with no builder

Some objects just need tobe processed to add their attributes
to the private data section of their parent objects.
An example of this would be the pdm_config objects for
DMIC DAI's. Each pdm_config object's attributes need
to be added as separate arrays in the DAI object's
private data.

Modify the signature of tplg_add_object_data() to pass
the array_name parameter when multiple objects of the
same type in the same parent are processed.

- topology: pre-process-dapm: update automatic attributes for buffer

Add the function to compute the value for the
"size" automatic attribute in the buffer objects.

- topology: pre-process-object: add support for updating automatic attributes

Classes definitions in Topology2.0 can have attributes
qualified with the "automatic" constraint. Values for
these attributes will be calculated by the compiler.
This patch provides a generic method for defining automatic
attributes computation logic for different classes.

To update automatic attributes for a class, add an item
in object_build_map with auto_attr_updater defined, and then
add updating logic in the custom auto_attr_updater function.

- alsatplg: do not do NULL check for string arrays - alsatplg: fix memory-leak in tplg_construct_object_name()

amixer

- amixer: print help and add doc for 'sevents' and 'events' commands

aplay/arecord

- aplay: Fix out-of-bound access in stereo VU meter drawing

The left channel drawing of a stereo VU meter has a bug where it may
access a negative array index.

- aplay: Handle upper bound in peak calculations

Make sure that the calculated max_peak[] won't go beyond the sample
max resolution.

- aplay: Don't pass most negative integer to abs() in peak calculations

The return value from abs() for the most negative integer is
undefined.  Cap it properly for the 32bit sample handling.

- aplay: Handle 16bit sample negative overflow in peak calculations

The handling of 16bit samples in the peak calculations has a bug when
a sample with 0x8000 is passed.  As abs() treats 32bit int, it returns
0x8000.  And yet the code stores back into 16bit value again.

To fix that overflow, use 32bit value (i.e. val instead of sval) for
the further calculations.

- aplay: Fix conversion of unsigned samples in peak calculation

The XOR with the mask has to be applied before calculating abs value.

aseqnet

- aseqnet: add ipv6 support - aseqnet: use getaddrinfo() instead obsolete gethostbyname()

- modernize code (preparation for IPv6)

alsa-ucm-conf

Configuration

- HDA: improve support for HDAudio-Gigabyte-ALC1220DualCodecs

BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/48

- HDA: improve init.conf (Capture volume, switches) - HDA: Fix the DualCodecs condition - ucm.conf: turn off support for V2Module and V2Name by default

The only preferred lookup path is conf.d/ subtree.

- HDA: shuffle order for HiFi-analog.conf include - HDA-Intel: rename config directory to HDA

It's not related only to Intel. We have AMD, NVidia
HDA hardware, too.

- sof-soundwire: add to conf.d - hda-dsp: move to /Intel/hda-dsp, update conf.d - sof-hda-dsp: move to /Intel/sof-hda-dsp, update conf.d - SOF: move to /Intel/SOF, update conf.d - sof-ehl-rt5660: move to /Intel/sof-ehl-rt5660, update conf.d - skylake-rt286: move to /Intel/skylake-rt286, update conf.d - kblrt5660: move to /Intel/kblrt5660, update conf.d - chtnau8824: move to /Intel/chtnau8824, update conf.d - chtrt5650: move to /Intel/chtrt5650, update conf.d - chtrt5645: move to /Intel/chtrt5645, update conf.d - chtmax98090: move to /Intel/chtmax98090, update conf.d - cht-bsw-rt5672: move to /Intel/cht-bsw-rt5672, update conf.d - bytcht-es8316: move to /Intel/bytcht-es8316, update conf.d - bytcht-cx2072x: move to /Intel/bytcht-cx2072x, update conf.d - bytcr-wm5102: move to /Intel/bytcr-wm5102, update conf.d - bytcr-rt5651: move to /Intel/bytcr-rt5651, update conf.d - bytcr-rt5640: move to /Intel/bytcr-rt5640, update conf.d - broxton-rt298: move to /Intel/broxton-rt298, update conf.d - broadwell-rt286: move to /Intel/broadwell-rt286, update conf.d - bdw-rt5677: move to /Intel/bdw-rt5677, update conf.d - HDA-Intel: use conf.d/ move DualCodecs config to separate directory - USB-Audio: use conf.d/

Change relative paths to absolute.

- acp: move linked configuration from modules/ to conf.d/ - USB-Audio: move Realtek config to separate directory - USB-Audio: move Lenovo P620 configs to separate directory - USB-Audio: move Gigabyte Aorus configs to separate directory - USB-Audio: add GoXLR configuration

This hardware has multichannel output and input, but it's expected
to work in separate stereo groups.

Use dsnoop/dshare alsa-lib plugins to split the multichannel stream to
stereo devices.

- ucm2: join two front configs of Dell Desktop into one

This patch makes the speaker and headset configs join to one config.

- HDA-Intel: AMD ACP - add LED support

- create 'Mic ACP LED Capture Switch'
- load the snd_ctl_led module when ACP microphone device is detected
- attach 'Mic ACP LED Capture Switch' to Mic LED
- add 'Mic ACP LED Capture Switch' control to ACP microphone device

- HDA-Intel: fixes for Headphone+LO variant (Realtek ALC233)

This commit implements the support for shared Headphone and
Line Out and adds support for the Front Mic.

Controls for Headphone and Lineout:

Simple mixer control 'Headphone',0       # Switch only
Simple mixer control 'Headphone+LO',0    # Volume only
Simple mixer control 'Line Out',0        # Switch only
Jack 'Front Headphone Jack'
Jack 'Line Out Jack'

Control for Mic:

Simple mixer control 'Mic',0
Simple mixer control 'Mic Boost',0
Jack 'Mic Jack'

Control for Front Mic:

Simple mixer control 'Front Mic',0
Simple mixer control 'Front Mic Boost',0
Jack 'Front Mic Jack'

- USB-Audio: move Dell configs to own subdirectory - ucm2: Add UCM support for Dell Desktop

The Dell Desktop uses two USB audio codecs as front and rear panel.
The front UAC has two outputs of speaker/headphone and one input of headset mic.
The rear UAC has one output of line-out.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/120

- ucm2: Add UCM support for rockchip_es8316 on Pinebook Pro

Add UCM config files for Pinebook Pro's audio. The config files are
transformed and tuned from Manjaro ARM's packages:
* pinebookpro-post-install's asound.state [1]
* pinebookpro-audio's audio_jack_plugged_in.sh [2]

By the way, with these config files, the Speaker and Headphones will be
switched according to the (un)plugged state automatically.

[1] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state
[2] https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh

- bytcr-rt5640: Add support for a second headset input

Some devices (HP Elitepad 1000 G2) have a second headphones output
(1 on the dock, 2nd on the tablet itself) the headset mic input of
this second headset is connected to IN1, add support for this.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213415

- bytcr-rt5640: Add support for a second headphones output

Some devices (HP Elitepad 1000 G2) have a second headphones output
(1 on the dock, 2nd on the tablet itself) which is implemented through
the line-out output of the codec combined with an external hp-amp.

The kernel has recently gotten support for this setup and will
advertise this to userspace by adding cfg-hp2:lineout to the
components string, add support for this.

- bytcr-rt5640: Add support for devices using the DMIC2 input for their internal mic(s)

Add support for devices using the DMIC2 input for their internal mic(s),
this has been tested on a HP Elitepad 1000 G2.

- codecs/rt5640: Rename DAPM PIN switches to avoid having 2 Speaker and Headphones switches

Now that we rename the mutes from their weird 'Channel Switch' postfix
to the standard 'Playback Switch' postfix we end up having 2 Switches
for the 'Speaker' resp. 'Headphones' volume controls, with 1 of the two
getting ignored by the alsa-lib mixer code because it is duplicate.

This is caused by the bytcr-rt5640 machine driver adding DAPM PIN
Switches which are named 'Headphone Switch' resp. 'Speaker Switch',
rename these to 'Headphone Output Switch' / 'Speaker Output Switch'
so that they get seen as separate controls by the alsa-lib mixer code.

- bytcr-rt5640: Fix 'Headphone Switch' / 'Headset Mic Switch' no longer getting set

Commit 446d0a71b47f ("codecs/rt5640: Move out BayTrail-specific pin switches")
moved the setting of the 'Headphone Switch' / 'Headset Mic Switch' into
"If.hp" resp "If.hsmic" blocks. But instead of making them part of the
True {} block inside that If, the statements where added add the top-level
of the If {} block where they are no-ops.

Move them to inside the True blocks so that these Switches again get
properly turned on/off. This fixes the Headphones and Headset-mic no longer
working on bytcr-rt5640 devices.

- hda: improve the microphone device allocation

This change use the local variables for the UCM microphone
device names. Also, handle the no-dmic case for sof-hda-dsp
hardware.

- sof-soundwire: rt1316 - DAC L and R is replaced by DAC

In the latest codec driver rt1316-sdw.c, the DAC L and DAC R are
replaced by DAC, so we change the ucm to add the condition checking,
if 'DAC L' exists, will set those mixers in the old way, otherwise,
set the mixers with new name.

The codec rt1316 is used on a Dell TGL soundwire audio machine.

- sof-hda-dsp: Set Capture Switch on in the BootSequence

We found an issue that the PA source of Mic2/Headset and Mic2 is
muted by default after newly install an OS, the root cause is the
'Capture Switch' is set to off in the kernel.

Without ucm, the /usr/share/alsa/init/default will set the 'Capture
Switch' to on, similarly we set it to on in the BootSequence of ucm.

- sof-ehl-rt5660: Add UCM for Intel sof-ehl-rt5660

Add the UCM support for the sof-ehl-rt5660 platform.

- HDA-Intel: add Boost volume control for Headset Mic

Ubuntu Linux users complain even they set the input volume to maximum,
they still can't record sound with a pretty satisfied volume, they
need to run commandline commands to adjust "Mic Boost/Headset Mic
Boost/Headphone Mic boost" value to increase the input volume.

That is because the current ucm only defines "Capture Volume" to
control the input volume. Here we add Boost control, then users could
adjust both "Capture Volume" and "Boost Volume" through Pulseaudio and
Gnome.

BugLink: https://bugs.launchpad.net/bugs/1930188

- Librem 5 Devkit: modernize config

- remove extra default values
- remove explicit zeros
- add PlaybackMixerElem

- Add UCM for Librem 5 Devkit

The DTS configuration is in Linux mainline since 5.13-rc1:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts?h=v5.13-rc1#n167

Description

- Release v1.2.6