diff --git a/0007-speaker-test-Add-option-to-specify-signal-scale.patch b/0007-speaker-test-Add-option-to-specify-signal-scale.patch new file mode 100644 index 0000000..6021cce --- /dev/null +++ b/0007-speaker-test-Add-option-to-specify-signal-scale.patch @@ -0,0 +1,164 @@ +From 791ae1c18016707ee046b430cf3cf0412276c744 Mon Sep 17 00:00:00 2001 +From: Julian Scheel +Date: Tue, 30 Jun 2015 08:57:49 +0200 +Subject: [PATCH] speaker-test: Add option to specify signal scale + +Allow generated signals (sine and noise) to have a specified signal scale +instead of using hardcoded limits of 80%. This can be handy for debugging, ie +when analysing clipping issues with audio drivers. + +Signed-off-by: Julian Scheel +Signed-off-by: Takashi Iwai +--- + speaker-test/speaker-test.c | 30 ++++++++++++++++++------------ + 1 file changed, 18 insertions(+), 12 deletions(-) + +diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c +index ccf2671725a3..25970af1c9bc 100644 +--- a/speaker-test/speaker-test.c ++++ b/speaker-test/speaker-test.c +@@ -100,6 +100,7 @@ static unsigned int period_time = 0; /* period time in us */ + static unsigned int nperiods = 4; /* number of periods */ + static double freq = 440.0; /* sinusoidal wave frequency in Hz */ + static int test_type = TEST_PINK_NOISE; /* Test type. 1 = noise, 2 = sine wave */ ++static float generator_scale = 0.8; /* Scale to use for sine volume */ + static pink_noise_t pink; + static snd_pcm_uframes_t buffer_size; + static snd_pcm_uframes_t period_size; +@@ -306,7 +307,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas + switch (format) { + case SND_PCM_FORMAT_S8: + if (chn==channel) { +- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */ ++ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff; + ires = res; + *samp8++ = ires >> 24; + } else { +@@ -315,7 +316,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas + break; + case SND_PCM_FORMAT_S16_LE: + if (chn==channel) { +- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */ ++ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff; + ires = res; + *samp16++ = LE_SHORT(ires >> 16); + } else { +@@ -324,7 +325,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas + break; + case SND_PCM_FORMAT_S16_BE: + if (chn==channel) { +- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */ ++ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff; + ires = res; + *samp16++ = BE_SHORT(ires >> 16); + } else { +@@ -333,7 +334,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas + break; + case SND_PCM_FORMAT_FLOAT_LE: + if (chn==channel) { +- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0.75 ; /* Don't use MAX volume */ ++ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale; + fres = res; + *samp_f++ = fres; + } else { +@@ -342,7 +343,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas + break; + case SND_PCM_FORMAT_S32_LE: + if (chn==channel) { +- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */ ++ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff; + ires = res; + *samp32++ = LE_INT(ires); + } else { +@@ -351,7 +352,7 @@ static void generate_sine(uint8_t *frames, int channel, int count, double *_phas + break; + case SND_PCM_FORMAT_S32_BE: + if (chn==channel) { +- res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * 0x03fffffff; /* Don't use MAX volume */ ++ res = (sin((phase * 2 * M_PI) / max_phase - M_PI)) * generator_scale * 0x7fffffff; + ires = res; + *samp32++ = BE_INT(ires); + } else { +@@ -389,7 +390,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) { + switch (format) { + case SND_PCM_FORMAT_S8: + if (chn==channel) { +- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */ ++ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff; + ires = res; + *samp8++ = ires >> 24; + } else { +@@ -398,7 +399,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) { + break; + case SND_PCM_FORMAT_S16_LE: + if (chn==channel) { +- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */ ++ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff; + ires = res; + *samp16++ = LE_SHORT(ires >> 16); + } else { +@@ -407,7 +408,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) { + break; + case SND_PCM_FORMAT_S16_BE: + if (chn==channel) { +- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */ ++ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff; + ires = res; + *samp16++ = BE_SHORT(ires >> 16); + } else { +@@ -416,7 +417,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) { + break; + case SND_PCM_FORMAT_S32_LE: + if (chn==channel) { +- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */ ++ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff; + ires = res; + *samp32++ = LE_INT(ires); + } else { +@@ -425,7 +426,7 @@ static void generate_pink_noise( uint8_t *frames, int channel, int count) { + break; + case SND_PCM_FORMAT_S32_BE: + if (chn==channel) { +- res = generate_pink_noise_sample(&pink) * 0x03fffffff; /* Don't use MAX volume */ ++ res = generate_pink_noise_sample(&pink) * generator_scale * 0x07fffffff; + ires = res; + *samp32++ = BE_INT(ires); + } else { +@@ -1017,6 +1018,7 @@ static void help(void) + "-W,--wavdir Specify the directory containing WAV files\n" + "-m,--chmap Specify the channel map to override\n" + "-X,--force-frequency force frequencies outside the 30-8000hz range\n" ++ "-S,--scale Scale of generated test tones in percent (default=80)\n" + "\n")); + printf(_("Recognized sample formats are:")); + for (fmt = supported_formats; *fmt >= 0; fmt++) { +@@ -1060,6 +1062,7 @@ int main(int argc, char *argv[]) { + {"wavdir", 1, NULL, 'W'}, + {"debug", 0, NULL, 'd'}, + {"force-frequency", 0, NULL, 'X'}, ++ {"scale", 1, NULL, 'S'}, + #ifdef CONFIG_SUPPORT_CHMAP + {"chmap", 1, NULL, 'm'}, + #endif +@@ -1081,7 +1084,7 @@ int main(int argc, char *argv[]) { + while (1) { + int c; + +- if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d:X" ++ if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d:XS:" + #ifdef CONFIG_SUPPORT_CHMAP + "m:" + #endif +@@ -1182,6 +1185,9 @@ int main(int argc, char *argv[]) { + chmap = optarg; + break; + #endif ++ case 'S': ++ generator_scale = atoi(optarg) / 100.0; ++ break; + default: + fprintf(stderr, _("Unknown option '%c'\n"), c); + exit(EXIT_FAILURE); +-- +2.5.0 + diff --git a/0008-topology-Add-command-line-topology-tool-to-build-top.patch b/0008-topology-Add-command-line-topology-tool-to-build-top.patch new file mode 100644 index 0000000..c09ed6d --- /dev/null +++ b/0008-topology-Add-command-line-topology-tool-to-build-top.patch @@ -0,0 +1,206 @@ +From 665d980aa5b779575fbb9eac394ef5c2d03e091e Mon Sep 17 00:00:00 2001 +From: Liam Girdwood +Date: Tue, 4 Aug 2015 16:23:03 +0100 +Subject: [PATCH] topology: Add command line topology tool to build topology + binaries + +Add a command line tool that will parse topology text files and convert to the binary +topology data as used by the kernel. + +Signed-off-by: Liam Girdwood +Signed-off-by: Takashi Iwai +--- + Makefile.am | 3 ++ + configure.ac | 5 ++- + topology/Makefile.am | 10 +++++ + topology/topology.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 134 insertions(+), 1 deletion(-) + create mode 100644 topology/Makefile.am + create mode 100644 topology/topology.c + +diff --git a/Makefile.am b/Makefile.am +index 5bbe588a8d84..613f62dc359a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -25,6 +25,9 @@ endif + if HAVE_UCM + SUBDIRS += alsaucm + endif ++if HAVE_TOPOLOGY ++SUBDIRS += topology ++endif + + EXTRA_DIST= TODO gitcompile + AUTOMAKE_OPTIONS=foreign +diff --git a/configure.ac b/configure.ac +index f09aa5484d1d..4c279a952eef 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -50,6 +50,8 @@ AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"], + [#include ]) + AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"], + [#include ]) ++AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"], ++ [#include ]) + AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"], + [#include ]) + +@@ -58,6 +60,7 @@ AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes") + AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes") + AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes") + AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes") ++AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") + AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") + + dnl Check for librt +@@ -358,7 +361,7 @@ AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ + m4/Makefile po/Makefile.in \ + alsaconf/alsaconf alsaconf/Makefile \ + alsaconf/po/Makefile \ +- alsaucm/Makefile \ ++ alsaucm/Makefile topology/Makefile \ + aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \ + utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \ + seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \ +diff --git a/topology/Makefile.am b/topology/Makefile.am +new file mode 100644 +index 000000000000..c370b149f632 +--- /dev/null ++++ b/topology/Makefile.am +@@ -0,0 +1,10 @@ ++bin_PROGRAMS = \ ++ alsatplg ++ ++alsatplg_SOURCES = topology.c ++ ++AM_CPPFLAGS = \ ++ -Wall -I$(top_srcdir)/include ++ ++alsatplg_LDADD = -lasound ++ +diff --git a/topology/topology.c b/topology/topology.c +new file mode 100644 +index 000000000000..33c327662166 +--- /dev/null ++++ b/topology/topology.c +@@ -0,0 +1,117 @@ ++/* ++ Copyright(c) 2014-2015 Intel Corporation ++ Copyright(c) 2010-2011 Texas Instruments Incorporated, ++ All rights reserved. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of version 2 of the GNU General Public License as ++ published by the Free Software Foundation. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. ++ The full GNU General Public License is included in this distribution ++ in the file called LICENSE.GPL. ++*/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include "gettext.h" ++ ++static snd_output_t *log; ++ ++static void usage(char *name) ++{ ++ printf( ++_("Usage: %s [OPTIONS]...\n" ++"\n" ++"-h, --help help\n" ++"-c, --compile=FILE compile file\n" ++"-v, --verbose=LEVEL set verbosity level (0...1)\n" ++"-o, --output=FILE set output file\n" ++), name); ++} ++ ++int main(int argc, char *argv[]) ++{ ++ snd_tplg_t *snd_tplg; ++ static const char short_options[] = "hc:v:o:"; ++ static const struct option long_options[] = { ++ {"help", 0, 0, 'h'}, ++ {"verbose", 0, 0, 'v'}, ++ {"compile", 0, 0, 'c'}, ++ {"output", 0, 0, 'o'}, ++ {0, 0, 0, 0}, ++ }; ++ char *source_file = NULL, *output_file = NULL; ++ int c, err, verbose = 0, option_index; ++ ++#ifdef ENABLE_NLS ++ setlocale(LC_ALL, ""); ++ textdomain(PACKAGE); ++#endif ++ ++ err = snd_output_stdio_attach(&log, stderr, 0); ++ assert(err >= 0); ++ ++ while ((c = getopt_long(argc, argv, short_options, long_options, &option_index)) != -1) { ++ switch (c) { ++ case 'h': ++ usage(argv[0]); ++ return 0; ++ case 'v': ++ verbose = atoi(optarg); ++ break; ++ case 'c': ++ source_file = optarg; ++ break; ++ case 'o': ++ output_file = optarg; ++ break; ++ default: ++ fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); ++ return 1; ++ } ++ } ++ ++ if (source_file == NULL || output_file == NULL) { ++ usage(argv[0]); ++ return 1; ++ } ++ ++ snd_tplg = snd_tplg_new(); ++ if (snd_tplg == NULL) { ++ fprintf(stderr, _("failed to create new topology context\n")); ++ return 1; ++ } ++ ++ snd_tplg_verbose(snd_tplg, verbose); ++ ++ err = snd_tplg_build_file(snd_tplg, source_file, output_file); ++ if (err < 0) { ++ fprintf(stderr, _("failed to compile context %s\n"), source_file); ++ snd_tplg_free(snd_tplg); ++ return 1; ++ } ++ ++ snd_tplg_free(snd_tplg); ++ return 0; ++} ++ +-- +2.5.0 + diff --git a/0009-alsactl-Add-path-condition-to-alsa-store-and-alsa-re.patch b/0009-alsactl-Add-path-condition-to-alsa-store-and-alsa-re.patch new file mode 100644 index 0000000..9009967 --- /dev/null +++ b/0009-alsactl-Add-path-condition-to-alsa-store-and-alsa-re.patch @@ -0,0 +1,50 @@ +From 0e864e1a3aaf79d451556064eb09052530a0a085 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 10 Aug 2015 14:42:24 +0200 +Subject: [PATCH] alsactl: Add path condition to alsa-store and alsa-restore + services + +With alsa-restore.service and alsa-store.service, systemd invokes +alsactl at boot and shutdown times. When this is invoked on a system +without sound cards, it results in an ugly error message from alsact + + /usr/sbin/alsactl: save_state:1590: No soundcards found... + return code is "19" + +Add ConditionPathExistsGlob checks of /dev/snd/control* devices for +avoiding unnecessary invocations of alsactl on such a system. + +Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=940950 +Signed-off-by: Takashi Iwai +--- + alsactl/alsa-restore.service.in | 1 + + alsactl/alsa-store.service.in | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in +index 245a439798fc..d1a74d637457 100644 +--- a/alsactl/alsa-restore.service.in ++++ b/alsactl/alsa-restore.service.in +@@ -6,6 +6,7 @@ + [Unit] + Description=Restore Sound Card State + ConditionPathExists=!@daemonswitch@ ++ConditionPathExistsGlob=/dev/snd/control* + DefaultDependencies=no + After=alsa-state.service + Before=shutdown.target +diff --git a/alsactl/alsa-store.service.in b/alsactl/alsa-store.service.in +index f1a56bb9dbb5..c89cfff04f35 100644 +--- a/alsactl/alsa-store.service.in ++++ b/alsactl/alsa-store.service.in +@@ -6,6 +6,7 @@ + [Unit] + Description=Store Sound Card State + ConditionPathExists=!@daemonswitch@ ++ConditionPathExistsGlob=/dev/snd/control* + DefaultDependencies=no + Before=shutdown.target + +-- +2.5.0 + diff --git a/alsa-utils.changes b/alsa-utils.changes index 49c497d..5a8255b 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Mon Aug 10 15:05:45 CEST 2015 - tiwai@suse.de + +- Suppress alsactl invocation on systems without sound cards + (bsc#940950): + 0009-alsactl-Add-path-condition-to-alsa-store-and-alsa-re.patch + +------------------------------------------------------------------- +Tue Aug 4 17:48:44 CEST 2015 - tiwai@suse.de + +- Upstream patch to add -S option to speaker-test + 0007-speaker-test-Add-option-to-specify-signal-scale.patch +- Upstream patch to add alsatplg parser program + 0008-topology-Add-command-line-topology-tool-to-build-top.patch +- Reenable autoreconf call to regenerate after patching + +------------------------------------------------------------------- +Fri Jul 31 07:40:12 UTC 2015 - dimstar@opensuse.org + +- Change libudev-devel BuildRequires to pkgconfig(udev): makes us + less prone to packaging changes, and in the end udev.pc is + exactly what we need to define _udevdir. + ------------------------------------------------------------------- Mon Jul 13 16:41:51 CEST 2015 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index f7f3f54..8a417b8 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -51,6 +51,9 @@ Patch3: 0003-alsa-info-Don-t-try-update-when-wget-isn-t-available.patch Patch4: 0004-aplay-Fix-type-for-signal-flag.patch Patch5: 0005-aplay-Fix-uninterruptible-aplay.patch Patch6: 0006-alsactl-terminate-readlink-result-string.patch +Patch7: 0007-speaker-test-Add-option-to-specify-signal-scale.patch +Patch8: 0008-topology-Add-command-line-topology-tool-to-build-top.patch +Patch9: 0009-alsactl-Add-path-condition-to-alsa-store-and-alsa-re.patch # Patch99: alsa-utils-gettext-version-removal.diff BuildRequires: alsa-devel @@ -65,7 +68,7 @@ Requires: pciutils Provides: alsa-conf BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} > 1200 -BuildRequires: libudev-devel +BuildRequires: pkgconfig(udev) %endif %description @@ -84,6 +87,9 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 # %if 0%{?suse_version} < 1020 %patch99 -p1 @@ -94,7 +100,7 @@ export AUTOMAKE_JOBS="%{?_smp_mflags}" %if 0%{?suse_version} < 1020 # gettextize -f %endif -# autoreconf -fi +autoreconf -fi opts="" %if %{use_systemd} opts="$opts --with-systemdsystemunitdir=%{_unitdir}"