8cabd6
From c6bdde171e1532f7b37333a5a746b6e662f12c53 Mon Sep 17 00:00:00 2001
8cabd6
From: Takashi Iwai <tiwai@suse.de>
8cabd6
Date: Wed, 28 Dec 2016 15:58:51 +0100
8cabd6
Subject: [PATCH 1/4] alsaucm: Add alsaucm.rst to EXTRA_DIST
8cabd6
8cabd6
Otherwise it's missing in the tarball.
8cabd6
8cabd6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8cabd6
---
8cabd6
 alsaucm/Makefile.am | 2 ++
8cabd6
 1 file changed, 2 insertions(+)
8cabd6
8cabd6
diff --git a/alsaucm/Makefile.am b/alsaucm/Makefile.am
8cabd6
index 7047215..ee0391e 100644
8cabd6
--- a/alsaucm/Makefile.am
8cabd6
+++ b/alsaucm/Makefile.am
8cabd6
@@ -14,3 +14,5 @@ alsaucm_LDADD = -lasound
8cabd6
 
8cabd6
 %.1: %.rst
8cabd6
 	rst2man $< > $@
8cabd6
+
8cabd6
+EXTRA_DIST = alsaucm.rst
8cabd6
-- 
8cabd6
2.9.3
8cabd6
8cabd6
8cabd6
From e9a6d425b5f183fe1dc0829782a9ca506aeb6263 Mon Sep 17 00:00:00 2001
8cabd6
From: Paul Menzel <paulepanter@users.sourceforge.net>
8cabd6
Date: Tue, 8 Jul 2014 07:23:06 +0000
8cabd6
Subject: [PATCH 2/4] alsactl: Remove standard output definition in systemd
8cabd6
 unit
8cabd6
MIME-Version: 1.0
8cabd6
Content-Type: text/plain; charset=UTF-8
8cabd6
Content-Transfer-Encoding: 8bit
8cabd6
8cabd6
`/lib/systemd/system/alsa-restore.service` specifies
8cabd6
`StandardOutput=syslog`. This overrides the `DefaultStandardOutput`
8cabd6
setting from `/etc/systemd/system.conf`, which the system administrator
8cabd6
can use to specify how output gets logged. In particular, the sysadmin
8cabd6
may want output to go to the journal, or to syslog, or nowhere at all [1].
8cabd6
8cabd6
This patch removes the definition entirely, so the units can use the
8cabd6
system default.
8cabd6
8cabd6
Upstream the patch from the Debian package [2].
8cabd6
8cabd6
[1] https://bugs.debian.org/741123
8cabd6
    "systemd services should not use StandardOutput=syslog; should rely
8cabd6
     on DefaultStandardOutput"
8cabd6
[2] https://sources.debian.net/src/alsa-utils/1.1.2-1/debian/patches/systemd_standardoutput.patch/
8cabd6
8cabd6
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
8cabd6
CC: Jordi Mallach <jordi@debian.org>
8cabd6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8cabd6
---
8cabd6
 alsactl/alsa-restore.service.in | 1 -
8cabd6
 1 file changed, 1 deletion(-)
8cabd6
8cabd6
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
8cabd6
index 2884098..2583d4c 100644
8cabd6
--- a/alsactl/alsa-restore.service.in
8cabd6
+++ b/alsactl/alsa-restore.service.in
8cabd6
@@ -14,4 +14,3 @@ Type=oneshot
8cabd6
 RemainAfterExit=true
8cabd6
 ExecStart=-@sbindir@/alsactl restore
8cabd6
 ExecStop=-@sbindir@/alsactl store
8cabd6
-StandardOutput=syslog
8cabd6
-- 
8cabd6
2.9.3
8cabd6
8cabd6
8cabd6
From 541c7a6460835d6fa982253caf06bc971e2b9279 Mon Sep 17 00:00:00 2001
8cabd6
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
8cabd6
Date: Mon, 9 Jan 2017 18:32:23 -0600
8cabd6
Subject: [PATCH 3/4] alsa-info: provide more DMI information
8cabd6
8cabd6
Some manufacturers don't provide useful information for Manufacturer
8cabd6
and Product Name but instead use Board Vendor and Board Name fields,
8cabd6
add them to alsa-info log
8cabd6
8cabd6
Example on Intel NUC:
8cabd6
8cabd6
!!DMI Information
8cabd6
!!---------------
8cabd6
8cabd6
Manufacturer:
8cabd6
Product Name:
8cabd6
Product Version:
8cabd6
Firmware Version:  KYSKLi70.86A.0042.2016.0929.1933
8cabd6
Board Vendor:      Intel Corporation
8cabd6
Board Name:        NUC6i7KYB
8cabd6
8cabd6
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
8cabd6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8cabd6
---
8cabd6
 alsa-info/alsa-info.sh | 6 ++++++
8cabd6
 1 file changed, 6 insertions(+)
8cabd6
8cabd6
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
8cabd6
index 0bc4cd0..9684c6f 100755
8cabd6
--- a/alsa-info/alsa-info.sh
8cabd6
+++ b/alsa-info/alsa-info.sh
8cabd6
@@ -430,11 +430,15 @@ if [ -d /sys/class/dmi/id ]; then
8cabd6
     DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null)
8cabd6
     DMI_SYSTEM_PRODUCT_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null)
8cabd6
     DMI_SYSTEM_FIRMWARE_VERSION=$(cat /sys/class/dmi/id/bios_version 2>/dev/null)
8cabd6
+    DMI_BOARD_VENDOR=$(cat /sys/class/dmi/id/board_vendor 2>/dev/null)
8cabd6
+    DMI_BOARD_NAME=$(cat /sys/class/dmi/id/board_name 2>/dev/null)
8cabd6
 elif [ -x $DMIDECODE ]; then
8cabd6
     DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null)
8cabd6
     DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null)
8cabd6
     DMI_SYSTEM_PRODUCT_VERSION=$($DMIDECODE -s system-version 2>/dev/null)
8cabd6
     DMI_SYSTEM_FIRMWARE_VERSION=$($DMIDECODE -s bios-version 2>/dev/null)
8cabd6
+    DMI_BOARD_VENDOR=$($DMIDECODE -s baseboard-manufacturer 2>/dev/null)
8cabd6
+    DMI_BOARD_NAME=$($DMIDECODE -s baseboard-product-name 2>/dev/null)
8cabd6
 fi
8cabd6
 
8cabd6
 cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp
8cabd6
@@ -479,6 +483,8 @@ echo "Manufacturer:      $DMI_SYSTEM_MANUFACTURER" >> $FILE
8cabd6
 echo "Product Name:      $DMI_SYSTEM_PRODUCT_NAME" >> $FILE
8cabd6
 echo "Product Version:   $DMI_SYSTEM_PRODUCT_VERSION" >> $FILE
8cabd6
 echo "Firmware Version:  $DMI_SYSTEM_FIRMWARE_VERSION" >> $FILE
8cabd6
+echo "Board Vendor:      $DMI_BOARD_VENDOR" >> $FILE
8cabd6
+echo "Board Name:        $DMI_BOARD_NAME" >> $FILE
8cabd6
 echo "" >> $FILE
8cabd6
 echo "" >> $FILE
8cabd6
 echo "!!Kernel Information" >> $FILE
8cabd6
-- 
8cabd6
2.9.3
8cabd6
8cabd6
8cabd6
From 1fefc1440276f3a91649650d1dd9bcbb28bab7bd Mon Sep 17 00:00:00 2001
8cabd6
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
8cabd6
Date: Mon, 9 Jan 2017 18:32:24 -0600
8cabd6
Subject: [PATCH 4/4] alsa-info: add ACPI device status
8cabd6
8cabd6
BIOS vendors typically reuse the same definitions between different
8cabd6
platforms and expose the relevant hardware by changing the value of
8cabd6
the _STA method.
8cabd6
8cabd6
For example on the Asus T100HA, there are 3 HID values for audio
8cabd6
codecs in the DSDT table but two have a zero status and will be
8cabd6
ignored by the ACPI subsystem.
8cabd6
8cabd6
$ more /sys/bus/acpi/devices/10EC*/status
8cabd6
::::::::::::::
8cabd6
/sys/bus/acpi/devices/10EC3270:00/status
8cabd6
::::::::::::::
8cabd6
15
8cabd6
::::::::::::::
8cabd6
/sys/bus/acpi/devices/10EC5640:00/status
8cabd6
::::::::::::::
8cabd6
0
8cabd6
::::::::::::::
8cabd6
/sys/bus/acpi/devices/10EC5648:00/status
8cabd6
::::::::::::::
8cabd6
0
8cabd6
8cabd6
This information is very useful to figure out which HIDs/quirks need
8cabd6
to be supported. Add log to alsa-info.sh to only expose non-zero
8cabd6
results of the ACPI _STA method, e.g.
8cabd6
8cabd6
!!ACPI Device Status Information
8cabd6
!!---------------
8cabd6
8cabd6
/sys/bus/acpi/devices/10EC3270:00/status 	 15
8cabd6
8cabd6
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
8cabd6
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8cabd6
---
8cabd6
 alsa-info/alsa-info.sh | 16 ++++++++++++++++
8cabd6
 1 file changed, 16 insertions(+)
8cabd6
8cabd6
diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh
8cabd6
index 9684c6f..cda4125 100755
8cabd6
--- a/alsa-info/alsa-info.sh
8cabd6
+++ b/alsa-info/alsa-info.sh
8cabd6
@@ -441,6 +441,16 @@ elif [ -x $DMIDECODE ]; then
8cabd6
     DMI_BOARD_NAME=$($DMIDECODE -s baseboard-product-name 2>/dev/null)
8cabd6
 fi
8cabd6
 
8cabd6
+# Check for ACPI device status
8cabd6
+if [ -d /sys/bus/acpi/devices ]; then
8cabd6
+    for f in /sys/bus/acpi/devices/*/status; do
8cabd6
+	ACPI_STATUS=$(cat $f 2>/dev/null);
8cabd6
+	if [[ "$ACPI_STATUS" -ne 0 ]]; then
8cabd6
+	    echo $f $'\t' $ACPI_STATUS >>$TEMPDIR/acpidevicestatus.tmp;
8cabd6
+	fi
8cabd6
+    done
8cabd6
+fi
8cabd6
+
8cabd6
 cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp
8cabd6
 cat /proc/asound/cards >$TEMPDIR/alsacards.tmp
8cabd6
 if [[ ! -z "$LSPCI" ]]; then
8cabd6
@@ -487,6 +497,12 @@ echo "Board Vendor:      $DMI_BOARD_VENDOR" >> $FILE
8cabd6
 echo "Board Name:        $DMI_BOARD_NAME" >> $FILE
8cabd6
 echo "" >> $FILE
8cabd6
 echo "" >> $FILE
8cabd6
+echo "!!ACPI Device Status Information" >> $FILE
8cabd6
+echo "!!---------------" >> $FILE
8cabd6
+echo "" >> $FILE
8cabd6
+cat $TEMPDIR/acpidevicestatus.tmp >> $FILE
8cabd6
+echo "" >> $FILE
8cabd6
+echo "" >> $FILE
8cabd6
 echo "!!Kernel Information" >> $FILE
8cabd6
 echo "!!------------------" >> $FILE
8cabd6
 echo "" >> $FILE
8cabd6
-- 
8cabd6
2.9.3
8cabd6
8cabd6
--- alsa-utils-1.1.3/alsaucm/alsaucm.rst	1970-01-01 01:00:00.000000000 +0100
8cabd6
+++ /home/perex/alsa/alsa-utils/alsaucm/alsaucm.rst	2016-12-20 10:11:00.822592170 +0100
8cabd6
@@ -0,0 +1,235 @@
8cabd6
+=========
8cabd6
+ alsaucm
8cabd6
+=========
8cabd6
+
8cabd6
+---------------------
8cabd6
+ALSA Use Case Manager
8cabd6
+---------------------
8cabd6
+
8cabd6
+:Author: Antonio Ospite <ao2@ao2.it>
8cabd6
+:Date:   2016-09-22
8cabd6
+:Copyright: GPLv2+
8cabd6
+:Manual section: 1
8cabd6
+:Manual group: General Commands Manual
8cabd6
+
8cabd6
+SYNOPSIS
8cabd6
+========
8cabd6
+
8cabd6
+*alsaucm* <options> [command]
8cabd6
+
8cabd6
+DESCRIPTION
8cabd6
+===========
8cabd6
+
8cabd6
+alsaucm (ALSA Use Case Manager) is a program to use the ALSA `Use Case
8cabd6
+Interface`_ from the command line.
8cabd6
+
8cabd6
+On complex sound cards, setting up audio routes is not trivial and mixer
8cabd6
+settings can conflict one another preventing the audio card to work at all.
8cabd6
+
8cabd6
+The ALSA Use Case Manager is a mechanism for controlling complex audio
8cabd6
+hardware establishing a relationship between hardware configurations and
8cabd6
+meaningful use cases that the end-user can relate with.
8cabd6
+
8cabd6
+The use case manager can also be used to switch between use cases when
8cabd6
+necessary, in a consistent way.
8cabd6
+
8cabd6
+At a lower level, the use case manager works by configuring the sound card
8cabd6
+ALSA kcontrols to change the hardware digital and analog audio routing to
8cabd6
+match the requested device use case.
8cabd6
+
8cabd6
+The use case manager kcontrol configurations are stored in easy to modify text
8cabd6
+files. An audio use case can be defined by a **verb** and **device** parameter.
8cabd6
+
8cabd6
+The verb describes the use case action i.e. a phone call, listening to music,
8cabd6
+recording a conversation etc. The device describes the physical audio capture
8cabd6
+and playback hardware i.e. headphones, phone handset, bluetooth headset, etc.
8cabd6
+
8cabd6
+
8cabd6
+OPTIONS
8cabd6
+=======
8cabd6
+
8cabd6
+Available options:
8cabd6
+
8cabd6
+  **-h**, **--help**
8cabd6
+    this help
8cabd6
+
8cabd6
+  **-c**, **--card** `NAME`
8cabd6
+    open card NAME
8cabd6
+
8cabd6
+  **-i**, **--interactive**
8cabd6
+    interactive mode
8cabd6
+
8cabd6
+  **-b**, **--batch** `FILE`
8cabd6
+    batch mode (use ``'-'`` for the stdin input)
8cabd6
+
8cabd6
+  **-n**, **--no-open**
8cabd6
+    do not open first card found
8cabd6
+
8cabd6
+
8cabd6
+Available commands:
8cabd6
+
8cabd6
+  ``open`` `NAME`
8cabd6
+    open card NAME.
8cabd6
+
8cabd6
+    valid names are sound card names as listed in ``/usr/share/alsa/ucm``.
8cabd6
+
8cabd6
+  ``reset``
8cabd6
+    reset sound card to default state.
8cabd6
+
8cabd6
+  ``reload``
8cabd6
+    reload configuration.
8cabd6
+
8cabd6
+  ``listcards``
8cabd6
+    list available cards.
8cabd6
+
8cabd6
+  ``list`` `IDENTIFIER`
8cabd6
+    list command, for items returning two entries (value+comment).
8cabd6
+
8cabd6
+    the value of the `IDENTIFIER` argument can can be:
8cabd6
+
8cabd6
+    - ``_verbs`` - get verb list (in pair verb+comment)
8cabd6
+    - ``_devices[/{verb}]`` - get list of supported devices (in pair device+comment)
8cabd6
+    - ``_modifiers[/{verb}]`` - get list of supported modifiers (in pair modifier+comment)
8cabd6
+
8cabd6
+    The forms without the trailing ``/{verb}`` are valid only after a specific
8cabd6
+    verb has been set.
8cabd6
+
8cabd6
+  ``list1`` `IDENTIFIER`
8cabd6
+    list command, for lists returning one item per entry.
8cabd6
+
8cabd6
+    the value of the `IDENTIFIER` argument can vary depending on the context,
8cabd6
+    it can be:
8cabd6
+
8cabd6
+    - ``TQ[/{verb}]`` - get list of Tone Quality identifiers
8cabd6
+    - ``_enadevs`` - get list of enabled devices
8cabd6
+    - ``_enamods`` - get list of enabled modifiers
8cabd6
+    - ``_supporteddevs/{modifier}|{device}[/{verb}]`` - list of supported devices
8cabd6
+    - ``_conflictingdevs/{modifier}|{device}[/{verb}]`` - list of conflicting devices
8cabd6
+
8cabd6
+  ``get`` `IDENTIFIER`
8cabd6
+    get string value.
8cabd6
+
8cabd6
+    the value of the `IDENTIFIER` argument can can be:
8cabd6
+
8cabd6
+    - ``_verb`` - return current verb
8cabd6
+    - ``[=]{NAME}[/[{modifier}|{/device}][/{verb}]]`` (For valid NAMEs look at the
8cabd6
+      ALSA `Use Case Interface`_)
8cabd6
+
8cabd6
+
8cabd6
+  ``geti`` `IDENTIFIER`
8cabd6
+    get integer value.
8cabd6
+
8cabd6
+    the value of the `IDENTIFIER` argument can can be:
8cabd6
+
8cabd6
+    - ``_devstatus/{device}``
8cabd6
+    - ``_modtstaus/{device}``
8cabd6
+
8cabd6
+  ``set`` `IDENTIFIER` `VALUE`
8cabd6
+    set string value
8cabd6
+
8cabd6
+    The value of the `IDENTIFIER` argument can can be:
8cabd6
+
8cabd6
+    - ``_verb`` - set the verb to `VALUE`
8cabd6
+    - ``_enadev`` - enable the device specified by `VALUE`
8cabd6
+    - ``_disdev`` - disable the device specified by `VALUE`
8cabd6
+    - ``_swdev/{old_device}`` - switche device:
8cabd6
+
8cabd6
+      - disable `old_device` and then enable the device specified by
8cabd6
+        `VALUE`
8cabd6
+      - if no device was enabled just return
8cabd6
+
8cabd6
+    - ``_enamod`` - enable the modifier specified by `VALUE`
8cabd6
+    - ``_dismod`` - disable the modifier specified by `VALUE`
8cabd6
+    - ``_swmod/{old_modifier}`` - switch modifier:
8cabd6
+
8cabd6
+      - disable `old_modifier` and then enable the modifier specified by
8cabd6
+        `VALUE`
8cabd6
+      - if no modifier was enabled just return
8cabd6
+
8cabd6
+    Note that the identifiers referring to devices and modifiers are valid
8cabd6
+    only after setting a verb.
8cabd6
+
8cabd6
+  ``h``, ``help``
8cabd6
+    help
8cabd6
+
8cabd6
+  ``q``, ``quit``
8cabd6
+    quit
8cabd6
+
8cabd6
+
8cabd6
+FILES
8cabd6
+=====
8cabd6
+
8cabd6
+The master use case files for each supported sound card are in ``/usr/share/alsa/ucm``.
8cabd6
+
8cabd6
+For example, the master use case file for the `Pandaboard` card is in
8cabd6
+``/usr/share/alsa/ucm/PandaBoard/PandaBoard.conf``, this file lists all the
8cabd6
+supported use cases, e.g.
8cabd6
+
8cabd6
+::
8cabd6
+
8cabd6
+  SectionUseCase."HiFi" {
8cabd6
+                  File "hifi"
8cabd6
+                  Comment "Play HiFi quality Music."
8cabd6
+  }
8cabd6
+  ...
8cabd6
+
8cabd6
+
8cabd6
+Each use case defines a _verb, which is described in the file specified in
8cabd6
+the ``File`` directive, like above.
8cabd6
+
8cabd6
+The ``HiFi`` verb above is described in
8cabd6
+``/usr/share/alsa/ucm/PandaBoard/hifi``.
8cabd6
+
8cabd6
+For more details on the syntax of UCM files, see the alsa-lib source code:
8cabd6
+http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/ucm/parser.c
8cabd6
+
8cabd6
+
8cabd6
+EXAMPLES OF USE
8cabd6
+===============
8cabd6
+
8cabd6
+Some commands, like for instance ``list _devices``,
8cabd6
+can only work after setting a ``_verb`` in the **same execution**, for
8cabd6
+instance this sequence doesn't work:
8cabd6
+
8cabd6
+::
8cabd6
+
8cabd6
+  # alsaucm -c bytcr-rt5640 set _verb HiFi
8cabd6
+  # alsaucm -c bytcr-rt5640 list _devices
8cabd6
+
8cabd6
+
8cabd6
+However this command does:
8cabd6
+
8cabd6
+::
8cabd6
+
8cabd6
+  # alsaucm -n -b - <
8cabd6
+  open bytcr-rt5640
8cabd6
+  set _verb HiFi
8cabd6
+  list _devices
8cabd6
+  EOM
8cabd6
+
8cabd6
+
8cabd6
+An example of setting the `Speaker` device for the `HiFi` verb of the
8cabd6
+`bytcr-rt5640` card:
8cabd6
+
8cabd6
+::
8cabd6
+
8cabd6
+  # alsaucm -n -b - <
8cabd6
+  open bytcr-rt5640
8cabd6
+  reset
8cabd6
+  set _verb HiFi
8cabd6
+  set _enadev Speaker
8cabd6
+  EOM
8cabd6
+
8cabd6
+
8cabd6
+
8cabd6
+SEE ALSO
8cabd6
+========
8cabd6
+
8cabd6
+* Use Case Interface: http://www.alsa-project.org/alsa-doc/alsa-lib/group__ucm.html
8cabd6
+
8cabd6
+.. _Use Case Interface: http://www.alsa-project.org/alsa-doc/alsa-lib/group__ucm.html
8cabd6
+
8cabd6
+BUGS
8cabd6
+====
8cabd6
+
8cabd6
+None known.