Accepting request 689242 from multimedia:libs
OBS-URL: https://build.opensuse.org/request/show/689242 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa?expand=0&rev=189
This commit is contained in:
commit
96337fa077
@ -0,0 +1,93 @@
|
|||||||
|
From 9c1439a76cea33d2cec65a42d499230d2f9a5205 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Wed, 9 Jan 2019 12:02:56 +0100
|
||||||
|
Subject: [PATCH 01/14] pcm: Preserve period_event in snd_pcm_hw_sw_params()
|
||||||
|
call
|
||||||
|
|
||||||
|
snd_pcm_hw_sw_params() in pcm_hw.c tries to abuse the reserved bits
|
||||||
|
for passing period_Event flag. In this hackish way, we clear the
|
||||||
|
reserved bits at beginning, and restore before returning. However,
|
||||||
|
the code paths that return earlier don't restore the value, hence when
|
||||||
|
user calls this function twice, it may pass an unexpected value.
|
||||||
|
|
||||||
|
This patch fixes the failure, restoring the value always before
|
||||||
|
returning from the function.
|
||||||
|
|
||||||
|
Reported-by: Jamey Sharp <jamey@minilop.net>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_hw.c | 22 +++++++++++++---------
|
||||||
|
1 file changed, 13 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
|
||||||
|
index 59a242009e9f..91370a88c0fd 100644
|
||||||
|
--- a/src/pcm/pcm_hw.c
|
||||||
|
+++ b/src/pcm/pcm_hw.c
|
||||||
|
@@ -496,7 +496,7 @@ static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
||||||
|
static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||||
|
{
|
||||||
|
snd_pcm_hw_t *hw = pcm->private_data;
|
||||||
|
- int fd = hw->fd, err;
|
||||||
|
+ int fd = hw->fd, err = 0;
|
||||||
|
int old_period_event = sw_get_period_event(params);
|
||||||
|
sw_set_period_event(params, 0);
|
||||||
|
if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
|
||||||
|
@@ -508,22 +508,25 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||||
|
params->silence_size == pcm->silence_size &&
|
||||||
|
old_period_event == hw->period_event) {
|
||||||
|
hw->mmap_control->avail_min = params->avail_min;
|
||||||
|
- return issue_avail_min(hw);
|
||||||
|
+ err = issue_avail_min(hw);
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
|
||||||
|
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
|
||||||
|
SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
|
||||||
|
- return -EINVAL;
|
||||||
|
+ err = -EINVAL;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC &&
|
||||||
|
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
|
||||||
|
SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
|
||||||
|
- return -EINVAL;
|
||||||
|
+ err = -EINVAL;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
|
||||||
|
err = -errno;
|
||||||
|
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||||
|
- return err;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
if ((snd_pcm_tstamp_type_t) params->tstamp_type != pcm->tstamp_type) {
|
||||||
|
if (hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
|
||||||
|
@@ -532,20 +535,21 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||||
|
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
|
||||||
|
err = -errno;
|
||||||
|
SNDMSG("TSTAMP failed\n");
|
||||||
|
- return err;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pcm->tstamp_type = params->tstamp_type;
|
||||||
|
}
|
||||||
|
- sw_set_period_event(params, old_period_event);
|
||||||
|
hw->mmap_control->avail_min = params->avail_min;
|
||||||
|
if (hw->period_event != old_period_event) {
|
||||||
|
err = snd_pcm_hw_change_timer(pcm, old_period_event);
|
||||||
|
if (err < 0)
|
||||||
|
- return err;
|
||||||
|
+ goto out;
|
||||||
|
hw->period_event = old_period_event;
|
||||||
|
}
|
||||||
|
- return 0;
|
||||||
|
+ out:
|
||||||
|
+ sw_set_period_event(params, old_period_event);
|
||||||
|
+ return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
239
0004-ucm-Add-ucm-files-for-DB820c-board.patch
Normal file
239
0004-ucm-Add-ucm-files-for-DB820c-board.patch
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
From 7442c8b9be91ef576871eed5efce9499fcdeab4a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
Date: Tue, 29 Jan 2019 10:48:28 +0000
|
||||||
|
Subject: [PATCH 04/14] ucm: Add ucm files for DB820c board
|
||||||
|
|
||||||
|
DB820c board is based of MSM8996 Qualcomm SoC, which has support for both
|
||||||
|
Digital and Analog audio. Digital audio is over HDMI and analog is over
|
||||||
|
WCD9335 codec via SLIMbus.
|
||||||
|
|
||||||
|
Board itself has HDMI port, a 3.5mm audio Jack and an Audio expansion
|
||||||
|
connector.
|
||||||
|
This patch adds support for HDMI port and 3.5mm jack.
|
||||||
|
|
||||||
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
configure.ac | 1 +
|
||||||
|
src/conf/ucm/DB820c/DB820c.conf | 9 ++++
|
||||||
|
src/conf/ucm/DB820c/HDMI | 37 ++++++++++++++
|
||||||
|
src/conf/ucm/DB820c/HiFi | 110 ++++++++++++++++++++++++++++++++++++++++
|
||||||
|
src/conf/ucm/DB820c/Makefile.am | 4 ++
|
||||||
|
src/conf/ucm/Makefile.am | 1 +
|
||||||
|
6 files changed, 162 insertions(+)
|
||||||
|
create mode 100644 src/conf/ucm/DB820c/DB820c.conf
|
||||||
|
create mode 100644 src/conf/ucm/DB820c/HDMI
|
||||||
|
create mode 100644 src/conf/ucm/DB820c/HiFi
|
||||||
|
create mode 100644 src/conf/ucm/DB820c/Makefile.am
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index a0c346ef46e4..e9e1a3698bed 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -747,6 +747,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
|
||||||
|
src/conf/ucm/cube-i1_TF-Defaultstring-CherryTrailCR/Makefile \
|
||||||
|
src/conf/ucm/DAISY-I2S/Makefile \
|
||||||
|
src/conf/ucm/DB410c/Makefile \
|
||||||
|
+ src/conf/ucm/DB820c/Makefile \
|
||||||
|
src/conf/ucm/Dell-WD15-Dock/Makefile \
|
||||||
|
src/conf/ucm/GoogleNyan/Makefile \
|
||||||
|
src/conf/ucm/gpd-win-pocket-rt5645/Makefile \
|
||||||
|
diff --git a/src/conf/ucm/DB820c/DB820c.conf b/src/conf/ucm/DB820c/DB820c.conf
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..58b7ff4e098c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/conf/ucm/DB820c/DB820c.conf
|
||||||
|
@@ -0,0 +1,9 @@
|
||||||
|
+SectionUseCase."HiFi" {
|
||||||
|
+ File "HiFi"
|
||||||
|
+ Comment "HiFi quality Music."
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+SectionUseCase."HDMI" {
|
||||||
|
+ File "HDMI"
|
||||||
|
+ Comment "HDMI output."
|
||||||
|
+}
|
||||||
|
diff --git a/src/conf/ucm/DB820c/HDMI b/src/conf/ucm/DB820c/HDMI
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..39b28692dde7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/conf/ucm/DB820c/HDMI
|
||||||
|
@@ -0,0 +1,37 @@
|
||||||
|
+# Use case configuration for DB820c board.
|
||||||
|
+# Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
+
|
||||||
|
+SectionVerb {
|
||||||
|
+ EnableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='HDMI Mixer MultiMedia1' 1"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ DisableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='HDMI Mixer MultiMedia1' 0"
|
||||||
|
+ ]
|
||||||
|
+ Value {
|
||||||
|
+ TQ "HiFi"
|
||||||
|
+ PlaybackPCM "plughw:0,0"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+SectionDevice."HDMI-stereo" {
|
||||||
|
+ #Name "HDMI-stereo"
|
||||||
|
+ Comment "HDMI Digital Stereo Output"
|
||||||
|
+
|
||||||
|
+ EnableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='HDMI Mixer MultiMedia1' 1"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ DisableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='HDMI Mixer MultiMedia1' 0"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ Value {
|
||||||
|
+ PlaybackChannels "2"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/conf/ucm/DB820c/HiFi b/src/conf/ucm/DB820c/HiFi
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..4457329fe07c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/conf/ucm/DB820c/HiFi
|
||||||
|
@@ -0,0 +1,110 @@
|
||||||
|
+# Use case configuration for DB820c board.
|
||||||
|
+# Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
+
|
||||||
|
+SectionVerb {
|
||||||
|
+
|
||||||
|
+ EnableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='SLIM RX0 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX1 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX2 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX3 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX4 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX5 MUX' AIF4_PB"
|
||||||
|
+ cset "name='SLIM RX6 MUX' AIF4_PB"
|
||||||
|
+ cset "name='SLIM RX7 MUX' ZERO"
|
||||||
|
+ cset "name='RX INT1_2 MUX' RX5"
|
||||||
|
+ cset "name='RX INT2_2 MUX' RX6"
|
||||||
|
+ ## gain to 0dB
|
||||||
|
+ cset "name='RX5 Digital Volume' 68"
|
||||||
|
+ ## gain to 0dB
|
||||||
|
+ cset "name='RX6 Digital Volume' 68"
|
||||||
|
+ cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 1"
|
||||||
|
+ cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 1"
|
||||||
|
+ cset "name='RX INT1 DEM MUX' CLSH_DSM_OUT"
|
||||||
|
+ cset "name='RX INT2 DEM MUX' CLSH_DSM_OUT"
|
||||||
|
+ cset "name='AIF1_CAP Mixer SLIM TX0' 1"
|
||||||
|
+ cset "name='SLIM TX0 MUX' DEC0"
|
||||||
|
+ cset "name='ADC2 Volume' 12"
|
||||||
|
+ cset "name='ADC MUX0' AMIC"
|
||||||
|
+ cset "name='AMIC MUX0' ADC2"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ DisableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 0"
|
||||||
|
+ cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 0"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ # ALSA PCM
|
||||||
|
+ Value {
|
||||||
|
+ # ALSA PCM device for HiFi
|
||||||
|
+ PlaybackPCM "plughw:0,1"
|
||||||
|
+ CapturePCM "plughw:0,2"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+SectionDevice."Headphones" {
|
||||||
|
+ Comment "Headphones playback"
|
||||||
|
+
|
||||||
|
+ EnableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='SLIM RX0 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX1 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX2 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX3 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX4 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX5 MUX' AIF4_PB"
|
||||||
|
+ cset "name='SLIM RX6 MUX' AIF4_PB"
|
||||||
|
+ cset "name='SLIM RX7 MUX' ZERO"
|
||||||
|
+ cset "name='RX INT1_2 MUX' RX5"
|
||||||
|
+ cset "name='RX INT2_2 MUX' RX6"
|
||||||
|
+ ## gain to 0dB
|
||||||
|
+ cset "name='RX5 Digital Volume' 68"
|
||||||
|
+ ## gain to 0dB
|
||||||
|
+ cset "name='RX6 Digital Volume' 68"
|
||||||
|
+ cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 1"
|
||||||
|
+ cset "name='RX INT1 DEM MUX' CLSH_DSM_OUT"
|
||||||
|
+ cset "name='RX INT2 DEM MUX' CLSH_DSM_OUT"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ DisableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='RX5 Digital Volume' 0"
|
||||||
|
+ cset "name='RX6 Digital Volume' 0"
|
||||||
|
+ cset "name='SLIM RX5 MUX' ZERO"
|
||||||
|
+ cset "name='SLIM RX6 MUX' ZERO"
|
||||||
|
+ cset "name='SLIMBUS_6_RX Audio Mixer MultiMedia2' 0"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ Value {
|
||||||
|
+ PlaybackChannels "2"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+SectionDevice."Handset" {
|
||||||
|
+ Comment "Headset Microphone"
|
||||||
|
+
|
||||||
|
+ EnableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 1"
|
||||||
|
+ cset "name='AIF1_CAP Mixer SLIM TX0' 1"
|
||||||
|
+ cset "name='SLIM TX0 MUX' DEC0"
|
||||||
|
+ cset "name='ADC2 Volume' 12"
|
||||||
|
+ cset "name='ADC MUX0' AMIC"
|
||||||
|
+ cset "name='AMIC MUX0' ADC2"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ DisableSequence [
|
||||||
|
+ cdev "hw:0"
|
||||||
|
+ cset "name='MultiMedia3 Mixer SLIMBUS_0_TX' 0"
|
||||||
|
+ cset "name='AIF1_CAP Mixer SLIM TX0' 0"
|
||||||
|
+ cset "name='AMIC MUX0' ZERO"
|
||||||
|
+ cset "name='SLIM TX0 MUX' ZERO"
|
||||||
|
+ cset "name='ADC2 Volume' 0"
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+ Value {
|
||||||
|
+ CaptureChannels "1"
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/conf/ucm/DB820c/Makefile.am b/src/conf/ucm/DB820c/Makefile.am
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..16e985e5c45d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/conf/ucm/DB820c/Makefile.am
|
||||||
|
@@ -0,0 +1,4 @@
|
||||||
|
+alsaconfigdir = @ALSA_CONFIG_DIR@
|
||||||
|
+ucmdir = $(alsaconfigdir)/ucm/DB820c
|
||||||
|
+ucm_DATA = DB820c.conf HDMI HiFi
|
||||||
|
+EXTRA_DIST = $(ucm_DATA)
|
||||||
|
diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am
|
||||||
|
index ee850ee62b97..e9f88ed683a2 100644
|
||||||
|
--- a/src/conf/ucm/Makefile.am
|
||||||
|
+++ b/src/conf/ucm/Makefile.am
|
||||||
|
@@ -31,6 +31,7 @@ chtrt5650 \
|
||||||
|
cube-i1_TF-Defaultstring-CherryTrailCR \
|
||||||
|
DAISY-I2S \
|
||||||
|
DB410c \
|
||||||
|
+DB820c \
|
||||||
|
Dell-WD15-Dock \
|
||||||
|
GoogleNyan \
|
||||||
|
gpd-win-pocket-rt5645 \
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
@ -0,0 +1,58 @@
|
|||||||
|
From 4d9374e61d23a5fc219ec172fe9613017f9ae79c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Hans de Goede <hdegoede@redhat.com>
|
||||||
|
Date: Sun, 3 Feb 2019 12:37:41 +0100
|
||||||
|
Subject: [PATCH 05/14] ucm: bytcr/PlatformEnableSeq.conf update some comments
|
||||||
|
|
||||||
|
Commit f91cc3c7d6b7 ("Update chtrt5645 ucm variants to use
|
||||||
|
bytcr/PlatformEnableSeq.conf component") updated the
|
||||||
|
following 2 comments:
|
||||||
|
|
||||||
|
# codec0_out settings (used if SSP2 is connected to aif1)
|
||||||
|
# modem_out settings (used if SSP0 is connected to aif2)
|
||||||
|
|
||||||
|
Specifically it added the " to aif1" resp. " to aif2" part of the comments.
|
||||||
|
|
||||||
|
This is not correct, AIF1 / AIF2 are something which is present on
|
||||||
|
Realtek codecs only, and either one can be used indepedent of
|
||||||
|
SSP0 or SSP2 being used (the comments in the chtrt5645 UCM profile
|
||||||
|
before this change were wrong / outdated).
|
||||||
|
|
||||||
|
Besides there not being any relationship between SSP0 or SSP2 being
|
||||||
|
used, bytcr/PlatformEnableSeq.conf is also used with other codecs,
|
||||||
|
e.g. the ESS8316 codec where this is not applicable at all.
|
||||||
|
|
||||||
|
Therefor this commit removes the " to aif?" part of the comments again
|
||||||
|
to avoid confusing people reading this in the future.
|
||||||
|
|
||||||
|
Cc: Russell Parker <russell.parker7@gmail.com>
|
||||||
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf b/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf
|
||||||
|
index 6f5e899ce567..b5ee2b415831 100644
|
||||||
|
--- a/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf
|
||||||
|
+++ b/src/conf/ucm/platforms/bytcr/PlatformEnableSeq.conf
|
||||||
|
@@ -29,7 +29,7 @@ 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)
|
||||||
|
+# codec0_out settings (used if SSP2 is connected)
|
||||||
|
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"
|
||||||
|
@@ -40,7 +40,7 @@ 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)
|
||||||
|
+# modem_out settings (used if SSP0 is connected)
|
||||||
|
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"
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 7cea8c156204ebae7c0dc60801dde5ddfa5bb7d0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Brendan Shanks <brendan.shanks@teradek.com>
|
||||||
|
Date: Mon, 11 Feb 2019 11:51:26 -0800
|
||||||
|
Subject: [PATCH 06/14] pcm: dshare: Fix overflow when slave_hw_ptr rolls over
|
||||||
|
boundary
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
In snd_pcm_dshare_sync_area() when 'slave_hw_ptr' rolls over
|
||||||
|
'slave_boundary', the wrong variable is checked ('dshare->slave_hw_ptr' vs
|
||||||
|
the local 'slave_hw_ptr'). In some cases, this results in 'slave_hw_ptr'
|
||||||
|
not rolling over correctly. 'slave_size' and 'size' are then much too
|
||||||
|
large, and the for loop blocks for several minutes copying samples.
|
||||||
|
|
||||||
|
This was likely only triggered on 32-bit systems, since the PCM boundary
|
||||||
|
is computed based on LONG_MAX and is much larger on 64-bit systems.
|
||||||
|
|
||||||
|
This same change was made to pcm_dmix in commit
|
||||||
|
6c7f60f7a982fdba828e4530a9d7aa0aa2b704ae ("Fix boundary overlap”) from
|
||||||
|
June 2005.
|
||||||
|
|
||||||
|
Signed-off-by: Brendan Shanks <brendan.shanks@teradek.com>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_dshare.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
|
||||||
|
index 2bb735fe1b46..f135b5dfce8b 100644
|
||||||
|
--- a/src/pcm/pcm_dshare.c
|
||||||
|
+++ b/src/pcm/pcm_dshare.c
|
||||||
|
@@ -121,7 +121,7 @@ static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm)
|
||||||
|
*/
|
||||||
|
slave_hw_ptr -= slave_hw_ptr % dshare->slave_period_size;
|
||||||
|
slave_hw_ptr += dshare->slave_buffer_size;
|
||||||
|
- if (dshare->slave_hw_ptr > dshare->slave_boundary)
|
||||||
|
+ if (slave_hw_ptr >= dshare->slave_boundary)
|
||||||
|
slave_hw_ptr -= dshare->slave_boundary;
|
||||||
|
if (slave_hw_ptr < dshare->slave_appl_ptr)
|
||||||
|
slave_size = slave_hw_ptr + (dshare->slave_boundary - dshare->slave_appl_ptr);
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
From deb07a0b208225393efc6347556310f3d8adb54d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
Date: Fri, 1 Mar 2019 12:43:19 +0100
|
||||||
|
Subject: [PATCH 07/14] test/latency: use frame bytes correctly in writebuf()
|
||||||
|
|
||||||
|
Reported-by: Alessandro Lapini <alessandro.lapini@gmail.com>
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
test/latency.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/test/latency.c b/test/latency.c
|
||||||
|
index e926856be495..ddd5a7af5281 100644
|
||||||
|
--- a/test/latency.c
|
||||||
|
+++ b/test/latency.c
|
||||||
|
@@ -374,6 +374,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *frames, size_t *max
|
||||||
|
long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
|
||||||
|
{
|
||||||
|
long r;
|
||||||
|
+ int frame_bytes = (snd_pcm_format_width(format) / 8) * channels;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
r = snd_pcm_writei(handle, buf, len);
|
||||||
|
@@ -383,7 +384,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
// showstat(handle, 0);
|
||||||
|
- buf += r * 4;
|
||||||
|
+ buf += r * frame_bytes;
|
||||||
|
len -= r;
|
||||||
|
*frames += r;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
64
0008-conf-pcm-dmix-add-CHANNELS-argument.patch
Normal file
64
0008-conf-pcm-dmix-add-CHANNELS-argument.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From 3c199a0d199f0fae78c9c1b19c11878a6134b3a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
Date: Wed, 13 Mar 2019 10:45:35 +0100
|
||||||
|
Subject: [PATCH 08/14] conf: pcm dmix - add CHANNELS argument
|
||||||
|
|
||||||
|
It seems that some audio devices do use only mono audio for some
|
||||||
|
applications (RPi).
|
||||||
|
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
src/conf/alsa.conf | 1 +
|
||||||
|
src/conf/pcm/dmix.conf | 10 +++++++++-
|
||||||
|
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf
|
||||||
|
index bb00ff409cd9..099805864788 100644
|
||||||
|
--- a/src/conf/alsa.conf
|
||||||
|
+++ b/src/conf/alsa.conf
|
||||||
|
@@ -70,6 +70,7 @@ defaults.pcm.ipc_key 5678293
|
||||||
|
defaults.pcm.ipc_gid audio
|
||||||
|
defaults.pcm.ipc_perm 0660
|
||||||
|
defaults.pcm.dmix.max_periods 0
|
||||||
|
+defaults.pcm.dmix.channels 2
|
||||||
|
defaults.pcm.dmix.rate 48000
|
||||||
|
defaults.pcm.dmix.format "unchanged"
|
||||||
|
defaults.pcm.dmix.card defaults.pcm.card
|
||||||
|
diff --git a/src/conf/pcm/dmix.conf b/src/conf/pcm/dmix.conf
|
||||||
|
index 7d0aa0158c42..7fa5c8b2e20a 100644
|
||||||
|
--- a/src/conf/pcm/dmix.conf
|
||||||
|
+++ b/src/conf/pcm/dmix.conf
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
#
|
||||||
|
|
||||||
|
pcm.!dmix {
|
||||||
|
- @args [ CARD DEV SUBDEV FORMAT RATE ]
|
||||||
|
+ @args [ CARD DEV SUBDEV FORMAT RATE CHANNELS ]
|
||||||
|
@args.CARD {
|
||||||
|
type string
|
||||||
|
default {
|
||||||
|
@@ -36,6 +36,13 @@ pcm.!dmix {
|
||||||
|
name defaults.pcm.dmix.rate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ @args.CHANNELS {
|
||||||
|
+ type integer
|
||||||
|
+ default {
|
||||||
|
+ @func refer
|
||||||
|
+ name defaults.pcm.dmix.channels
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
type dmix
|
||||||
|
ipc_key {
|
||||||
|
@func refer
|
||||||
|
@@ -58,6 +65,7 @@ pcm.!dmix {
|
||||||
|
}
|
||||||
|
format $FORMAT
|
||||||
|
rate $RATE
|
||||||
|
+ channels $CHANNELS
|
||||||
|
period_size {
|
||||||
|
@func refer
|
||||||
|
name {
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
43
0009-Android-avoid-using-versionsort.patch
Normal file
43
0009-Android-avoid-using-versionsort.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 59715fb0783335b59309969c949da53cd3460900 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@android-x86.org>
|
||||||
|
Date: Fri, 15 Mar 2019 17:17:02 +0800
|
||||||
|
Subject: [PATCH 09/14] Android: avoid using versionsort
|
||||||
|
|
||||||
|
Android doesn't have versionsort yet.
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
src/conf.c | 2 +-
|
||||||
|
src/ucm/parser.c | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/conf.c b/src/conf.c
|
||||||
|
index b8db490ca06a..cda5518e673b 100644
|
||||||
|
--- a/src/conf.c
|
||||||
|
+++ b/src/conf.c
|
||||||
|
@@ -3750,7 +3750,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
||||||
|
int n;
|
||||||
|
|
||||||
|
#ifndef DOC_HIDDEN
|
||||||
|
-#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun)
|
||||||
|
+#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
|
||||||
|
#define SORTFUNC versionsort
|
||||||
|
#else
|
||||||
|
#define SORTFUNC alphasort
|
||||||
|
diff --git a/src/ucm/parser.c b/src/ucm/parser.c
|
||||||
|
index 5e1a8862fac1..ad6bcec78622 100644
|
||||||
|
--- a/src/ucm/parser.c
|
||||||
|
+++ b/src/ucm/parser.c
|
||||||
|
@@ -1532,7 +1532,7 @@ int uc_mgr_scan_master_configs(const char **_list[])
|
||||||
|
snd_config_topdir());
|
||||||
|
filename[MAX_FILE-1] = '\0';
|
||||||
|
|
||||||
|
-#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun)
|
||||||
|
+#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
|
||||||
|
#define SORTFUNC versionsort
|
||||||
|
#else
|
||||||
|
#define SORTFUNC alphasort
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
28
0010-pcm-add-the-missing-strings.h-include.patch
Normal file
28
0010-pcm-add-the-missing-strings.h-include.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From e6f8998258d23492e00cd14e23f88c4b68fbf1ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@android-x86.org>
|
||||||
|
Date: Fri, 15 Mar 2019 17:17:03 +0800
|
||||||
|
Subject: [PATCH 10/14] pcm: add the missing <strings.h> include
|
||||||
|
|
||||||
|
To define the prototype of ffs. See 'man ffs'.
|
||||||
|
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
src/pcm/mask_inline.h | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/mask_inline.h b/src/pcm/mask_inline.h
|
||||||
|
index e9fb9f81dc3a..75ad35947131 100644
|
||||||
|
--- a/src/pcm/mask_inline.h
|
||||||
|
+++ b/src/pcm/mask_inline.h
|
||||||
|
@@ -19,6 +19,7 @@
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <strings.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define MASK_INLINE static inline
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
68
0011-alisp-add-the-missing-include.patch
Normal file
68
0011-alisp-add-the-missing-include.patch
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
From 639d404df69a47ed853b87960797c5db45305b67 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@android-x86.org>
|
||||||
|
Date: Fri, 15 Mar 2019 17:17:04 +0800
|
||||||
|
Subject: [PATCH 11/14] alisp: add the missing include
|
||||||
|
|
||||||
|
Commit d4e08c5e865 changed to use internal versioned functions.
|
||||||
|
However, the header is not included. It generates the errors:
|
||||||
|
|
||||||
|
In file included from external/alsa-lib/src/alisp/alisp.c:3038:
|
||||||
|
external/alsa-lib/src/alisp/alisp_snd.c:583:64: error: implicit declaration of function '__snd_ctl_elem_info_get_dimension' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
|
||||||
|
p2 = add_cons2(instance, p2, idx > 0, new_integer(instance, INTERNAL(snd_ctl_elem_info_get_dimension)(&info, idx)));
|
||||||
|
^
|
||||||
|
external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
|
||||||
|
#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
|
||||||
|
^
|
||||||
|
external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
|
||||||
|
#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
|
||||||
|
^
|
||||||
|
<scratch space>:396:1: note: expanded from here
|
||||||
|
__snd_ctl_elem_info_get_dimension
|
||||||
|
^
|
||||||
|
external/alsa-lib/src/alisp/alisp_snd.c:583:64: note: did you mean '__snd_ctl_elem_info_get_dimensions'?
|
||||||
|
external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
|
||||||
|
#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
|
||||||
|
^
|
||||||
|
external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
|
||||||
|
#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
|
||||||
|
^
|
||||||
|
<scratch space>:396:1: note: expanded from here
|
||||||
|
__snd_ctl_elem_info_get_dimension
|
||||||
|
^
|
||||||
|
external/alsa-lib/src/alisp/alisp_snd.c:578:8: note: '__snd_ctl_elem_info_get_dimensions' declared here
|
||||||
|
err = INTERNAL(snd_ctl_elem_info_get_dimensions)(&info);
|
||||||
|
^
|
||||||
|
external/alsa-lib/include/alsa-symbols.h:30:24: note: expanded from macro 'INTERNAL'
|
||||||
|
#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
|
||||||
|
^
|
||||||
|
external/alsa-lib/include/alsa-symbols.h:29:39: note: expanded from macro 'INTERNAL_CONCAT2_2'
|
||||||
|
#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
|
||||||
|
^
|
||||||
|
<scratch space>:395:1: note: expanded from here
|
||||||
|
__snd_ctl_elem_info_get_dimensions
|
||||||
|
^
|
||||||
|
2 errors generated.
|
||||||
|
|
||||||
|
Fixes: d4e08c5e865 ("control: Proper reference of internal versioned functions")
|
||||||
|
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
src/alisp/alisp_snd.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/alisp/alisp_snd.c b/src/alisp/alisp_snd.c
|
||||||
|
index 16115236f159..744dce90e25e 100644
|
||||||
|
--- a/src/alisp/alisp_snd.c
|
||||||
|
+++ b/src/alisp/alisp_snd.c
|
||||||
|
@@ -19,6 +19,8 @@
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include "../control/control_local.h"
|
||||||
|
+
|
||||||
|
struct acall_table {
|
||||||
|
const char *name;
|
||||||
|
struct alisp_object * (*func) (struct alisp_instance *instance, struct acall_table * item, struct alisp_object * args);
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
520
0012-add-snd_strlcpy-and-use-it-everywhere.patch
Normal file
520
0012-add-snd_strlcpy-and-use-it-everywhere.patch
Normal file
@ -0,0 +1,520 @@
|
|||||||
|
From 1755df1d9e6e2ec1e83e5367a224f81884aefffa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
Date: Mon, 25 Mar 2019 16:45:43 +0100
|
||||||
|
Subject: [PATCH 12/14] add snd_strlcpy() and use it everywhere
|
||||||
|
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
include/local.h | 1 +
|
||||||
|
src/control/control.c | 6 +++---
|
||||||
|
src/error.c | 22 ++++++++++++++++++++++
|
||||||
|
src/pcm/pcm_direct.c | 6 +++---
|
||||||
|
src/pcm/pcm_ioplug.c | 6 +++---
|
||||||
|
src/pcm/pcm_null.c | 6 +++---
|
||||||
|
src/seq/seq.c | 10 +++++-----
|
||||||
|
src/topology/ctl.c | 9 ++++-----
|
||||||
|
src/topology/dapm.c | 16 ++++++++--------
|
||||||
|
src/topology/data.c | 8 ++++----
|
||||||
|
src/topology/elem.c | 6 +++---
|
||||||
|
src/topology/pcm.c | 28 ++++++++++++++--------------
|
||||||
|
src/topology/text.c | 2 +-
|
||||||
|
src/topology/tplg_local.h | 9 ---------
|
||||||
|
14 files changed, 74 insertions(+), 61 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/local.h b/include/local.h
|
||||||
|
index e2cc291e2597..5edad317e955 100644
|
||||||
|
--- a/include/local.h
|
||||||
|
+++ b/include/local.h
|
||||||
|
@@ -236,6 +236,7 @@ int safe_strtol(const char *str, long *val);
|
||||||
|
|
||||||
|
int snd_send_fd(int sock, void *data, size_t len, int fd);
|
||||||
|
int snd_receive_fd(int sock, void *data, size_t len, int *fd);
|
||||||
|
+size_t snd_strlcpy(char *dst, const char *src, size_t size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* error messages
|
||||||
|
diff --git a/src/control/control.c b/src/control/control.c
|
||||||
|
index 90fab8776e9d..c49b77a39d2a 100644
|
||||||
|
--- a/src/control/control.c
|
||||||
|
+++ b/src/control/control.c
|
||||||
|
@@ -1805,7 +1805,7 @@ void snd_ctl_elem_id_set_subdevice(snd_ctl_elem_id_t *obj, unsigned int val)
|
||||||
|
void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val)
|
||||||
|
{
|
||||||
|
assert(obj);
|
||||||
|
- strncpy((char *)obj->name, val, sizeof(obj->name));
|
||||||
|
+ snd_strlcpy((char *)obj->name, val, sizeof(obj->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -2723,7 +2723,7 @@ void snd_ctl_elem_info_set_subdevice(snd_ctl_elem_info_t *obj, unsigned int val)
|
||||||
|
void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val)
|
||||||
|
{
|
||||||
|
assert(obj);
|
||||||
|
- strncpy((char *)obj->id.name, val, sizeof(obj->id.name));
|
||||||
|
+ snd_strlcpy((char *)obj->id.name, val, sizeof(obj->id.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -2945,7 +2945,7 @@ void snd_ctl_elem_value_set_subdevice(snd_ctl_elem_value_t *obj, unsigned int va
|
||||||
|
void snd_ctl_elem_value_set_name(snd_ctl_elem_value_t *obj, const char *val)
|
||||||
|
{
|
||||||
|
assert(obj);
|
||||||
|
- strncpy((char *)obj->id.name, val, sizeof(obj->id.name));
|
||||||
|
+ snd_strlcpy((char *)obj->id.name, val, sizeof(obj->id.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index 628b7c8870b1..2e617f87a7cf 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -177,3 +177,25 @@ static void snd_err_msg_default(const char *file, int line, const char *function
|
||||||
|
snd_lib_error_handler_t snd_err_msg = snd_err_msg_default;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * \brief Copy a C-string into a sized buffer
|
||||||
|
+ * \param dst Where to copy the string to
|
||||||
|
+ * \param src Where to copy the string from
|
||||||
|
+ * \param size Size of destination buffer
|
||||||
|
+ * \retval The source string length
|
||||||
|
+ *
|
||||||
|
+ * The result is always a valid NUL-terminated string that fits
|
||||||
|
+ * in the buffer (unless, of course, the buffer size is zero).
|
||||||
|
+ * It does not pad out the result like strncpy() does.
|
||||||
|
+ */
|
||||||
|
+size_t snd_strlcpy(char *dst, const char *src, size_t size)
|
||||||
|
+{
|
||||||
|
+ size_t ret = strlen(src);
|
||||||
|
+ if (size) {
|
||||||
|
+ size_t len = ret >= size ? size - 1 : ret;
|
||||||
|
+ memcpy(dst, src, len);
|
||||||
|
+ dst[len] = '\0';
|
||||||
|
+ }
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
|
||||||
|
index 8998943a5844..666a8ce5b130 100644
|
||||||
|
--- a/src/pcm/pcm_direct.c
|
||||||
|
+++ b/src/pcm/pcm_direct.c
|
||||||
|
@@ -766,9 +766,9 @@ int snd_pcm_direct_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||||
|
info->card = -1;
|
||||||
|
/* FIXME: fill this with something more useful: we know the hardware name */
|
||||||
|
if (pcm->name) {
|
||||||
|
- strncpy((char *)info->id, pcm->name, sizeof(info->id));
|
||||||
|
- strncpy((char *)info->name, pcm->name, sizeof(info->name));
|
||||||
|
- strncpy((char *)info->subname, pcm->name, sizeof(info->subname));
|
||||||
|
+ snd_strlcpy((char *)info->id, pcm->name, sizeof(info->id));
|
||||||
|
+ snd_strlcpy((char *)info->name, pcm->name, sizeof(info->name));
|
||||||
|
+ snd_strlcpy((char *)info->subname, pcm->name, sizeof(info->subname));
|
||||||
|
}
|
||||||
|
info->subdevices_count = 1;
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
|
||||||
|
index 1e25190a0f71..a437ca326778 100644
|
||||||
|
--- a/src/pcm/pcm_ioplug.c
|
||||||
|
+++ b/src/pcm/pcm_ioplug.c
|
||||||
|
@@ -94,9 +94,9 @@ static int snd_pcm_ioplug_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
|
||||||
|
info->stream = pcm->stream;
|
||||||
|
info->card = -1;
|
||||||
|
if (pcm->name) {
|
||||||
|
- strncpy((char *)info->id, pcm->name, sizeof(info->id));
|
||||||
|
- strncpy((char *)info->name, pcm->name, sizeof(info->name));
|
||||||
|
- strncpy((char *)info->subname, pcm->name, sizeof(info->subname));
|
||||||
|
+ snd_strlcpy((char *)info->id, pcm->name, sizeof(info->id));
|
||||||
|
+ snd_strlcpy((char *)info->name, pcm->name, sizeof(info->name));
|
||||||
|
+ snd_strlcpy((char *)info->subname, pcm->name, sizeof(info->subname));
|
||||||
|
}
|
||||||
|
info->subdevices_count = 1;
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c
|
||||||
|
index 7afe15811e17..ff6162447000 100644
|
||||||
|
--- a/src/pcm/pcm_null.c
|
||||||
|
+++ b/src/pcm/pcm_null.c
|
||||||
|
@@ -71,9 +71,9 @@ static int snd_pcm_null_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
||||||
|
info->stream = pcm->stream;
|
||||||
|
info->card = -1;
|
||||||
|
if (pcm->name) {
|
||||||
|
- strncpy((char *)info->id, pcm->name, sizeof(info->id));
|
||||||
|
- strncpy((char *)info->name, pcm->name, sizeof(info->name));
|
||||||
|
- strncpy((char *)info->subname, pcm->name, sizeof(info->subname));
|
||||||
|
+ snd_strlcpy((char *)info->id, pcm->name, sizeof(info->id));
|
||||||
|
+ snd_strlcpy((char *)info->name, pcm->name, sizeof(info->name));
|
||||||
|
+ snd_strlcpy((char *)info->subname, pcm->name, sizeof(info->subname));
|
||||||
|
}
|
||||||
|
info->subdevices_count = 1;
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/seq/seq.c b/src/seq/seq.c
|
||||||
|
index c6a1ad155bfb..afc884241179 100644
|
||||||
|
--- a/src/seq/seq.c
|
||||||
|
+++ b/src/seq/seq.c
|
||||||
|
@@ -1744,7 +1744,7 @@ void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client)
|
||||||
|
void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name)
|
||||||
|
{
|
||||||
|
assert(info && name);
|
||||||
|
- strncpy(info->name, name, sizeof(info->name));
|
||||||
|
+ snd_strlcpy(info->name, name, sizeof(info->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -2177,7 +2177,7 @@ void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t
|
||||||
|
void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name)
|
||||||
|
{
|
||||||
|
assert(info && name);
|
||||||
|
- strncpy(info->name, name, sizeof(info->name));
|
||||||
|
+ snd_strlcpy(info->name, name, sizeof(info->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -3122,7 +3122,7 @@ unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info)
|
||||||
|
void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name)
|
||||||
|
{
|
||||||
|
assert(info && name);
|
||||||
|
- strncpy(info->name, name, sizeof(info->name));
|
||||||
|
+ snd_strlcpy(info->name, name, sizeof(info->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -3198,7 +3198,7 @@ int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name)
|
||||||
|
memset(&info, 0, sizeof(info));
|
||||||
|
info.locked = 1;
|
||||||
|
if (name)
|
||||||
|
- strncpy(info.name, name, sizeof(info.name) - 1);
|
||||||
|
+ snd_strlcpy(info.name, name, sizeof(info.name));
|
||||||
|
return snd_seq_create_queue(seq, &info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -3279,7 +3279,7 @@ int snd_seq_query_named_queue(snd_seq_t *seq, const char *name)
|
||||||
|
int err;
|
||||||
|
snd_seq_queue_info_t info;
|
||||||
|
assert(seq && name);
|
||||||
|
- strncpy(info.name, name, sizeof(info.name));
|
||||||
|
+ snd_strlcpy(info.name, name, sizeof(info.name));
|
||||||
|
err = seq->ops->get_named_queue(seq, &info);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
diff --git a/src/topology/ctl.c b/src/topology/ctl.c
|
||||||
|
index 144bf51f0416..9c13b12c4bf4 100644
|
||||||
|
--- a/src/topology/ctl.c
|
||||||
|
+++ b/src/topology/ctl.c
|
||||||
|
@@ -380,7 +380,7 @@ int tplg_parse_control_bytes(snd_tplg_t *tplg,
|
||||||
|
|
||||||
|
be = elem->bytes_ext;
|
||||||
|
be->size = elem->size;
|
||||||
|
- elem_copy_text(be->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(be->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
be->hdr.type = SND_SOC_TPLG_TYPE_BYTES;
|
||||||
|
|
||||||
|
tplg_dbg(" Control Bytes: %s\n", elem->id);
|
||||||
|
@@ -505,7 +505,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg,
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ec = elem->enum_ctrl;
|
||||||
|
- elem_copy_text(ec->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(ec->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
ec->hdr.type = SND_SOC_TPLG_TYPE_ENUM;
|
||||||
|
ec->size = elem->size;
|
||||||
|
tplg->channel_idx = 0;
|
||||||
|
@@ -606,7 +606,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg,
|
||||||
|
|
||||||
|
/* init new mixer */
|
||||||
|
mc = elem->mixer_ctrl;
|
||||||
|
- elem_copy_text(mc->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(mc->hdr.name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
mc->hdr.type = SND_SOC_TPLG_TYPE_MIXER;
|
||||||
|
mc->size = elem->size;
|
||||||
|
tplg->channel_idx = 0;
|
||||||
|
@@ -721,8 +721,7 @@ static int init_ctl_hdr(struct snd_soc_tplg_ctl_hdr *hdr,
|
||||||
|
hdr->size = sizeof(struct snd_soc_tplg_ctl_hdr);
|
||||||
|
hdr->type = t->type;
|
||||||
|
|
||||||
|
- elem_copy_text(hdr->name, t->name,
|
||||||
|
- SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(hdr->name, t->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
/* clean up access flag */
|
||||||
|
if (t->access == 0)
|
||||||
|
diff --git a/src/topology/dapm.c b/src/topology/dapm.c
|
||||||
|
index e5d473a89745..97c9695b9ebe 100644
|
||||||
|
--- a/src/topology/dapm.c
|
||||||
|
+++ b/src/topology/dapm.c
|
||||||
|
@@ -348,7 +348,7 @@ static int tplg_parse_line(const char *text,
|
||||||
|
unsigned int len, i;
|
||||||
|
const char *source = NULL, *sink = NULL, *control = NULL;
|
||||||
|
|
||||||
|
- elem_copy_text(buf, text, LINE_SIZE);
|
||||||
|
+ snd_strlcpy(buf, text, LINE_SIZE);
|
||||||
|
|
||||||
|
len = strlen(buf);
|
||||||
|
if (len <= 2) {
|
||||||
|
@@ -488,7 +488,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
|
||||||
|
tplg_dbg(" Widget: %s\n", elem->id);
|
||||||
|
|
||||||
|
widget = elem->widget;
|
||||||
|
- elem_copy_text(widget->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(widget->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
widget->size = elem->size;
|
||||||
|
|
||||||
|
snd_config_for_each(i, next, cfg) {
|
||||||
|
@@ -523,7 +523,7 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
|
||||||
|
if (snd_config_get_string(n, &val) < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
- elem_copy_text(widget->sname, val,
|
||||||
|
+ snd_strlcpy(widget->sname, val,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
tplg_dbg("\t%s: %s\n", id, val);
|
||||||
|
continue;
|
||||||
|
@@ -642,11 +642,11 @@ int tplg_add_route(snd_tplg_t *tplg, struct snd_tplg_graph_elem *t)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
line = elem->route;
|
||||||
|
- elem_copy_text(line->source, t->src, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(line->source, t->src, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
if (t->ctl)
|
||||||
|
- elem_copy_text(line->control, t->ctl,
|
||||||
|
+ snd_strlcpy(line->control, t->ctl,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
- elem_copy_text(line->sink, t->sink, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(line->sink, t->sink, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -684,9 +684,9 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
|
w->size = elem->size;
|
||||||
|
|
||||||
|
w->id = wt->id;
|
||||||
|
- elem_copy_text(w->name, wt->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(w->name, wt->name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
if (wt->sname)
|
||||||
|
- elem_copy_text(w->sname, wt->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(w->sname, wt->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
w->reg = wt->reg;
|
||||||
|
w->shift = wt->shift;
|
||||||
|
w->mask = wt->mask;
|
||||||
|
diff --git a/src/topology/data.c b/src/topology/data.c
|
||||||
|
index 6b7c3f6ce8f8..70a63d4a1fb9 100644
|
||||||
|
--- a/src/topology/data.c
|
||||||
|
+++ b/src/topology/data.c
|
||||||
|
@@ -473,7 +473,7 @@ static int copy_tuples(struct tplg_elem *elem,
|
||||||
|
case SND_SOC_TPLG_TUPLE_TYPE_STRING:
|
||||||
|
string = &array->string[j];
|
||||||
|
string->token = token_val;
|
||||||
|
- elem_copy_text(string->string, tuple->string,
|
||||||
|
+ snd_strlcpy(string->string, tuple->string,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
@@ -587,7 +587,7 @@ static int parse_tuple_set(snd_config_t *cfg,
|
||||||
|
continue;
|
||||||
|
|
||||||
|
tuple = &set->tuple[set->num_tuples];
|
||||||
|
- elem_copy_text(tuple->token, id,
|
||||||
|
+ snd_strlcpy(tuple->token, id,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
@@ -597,7 +597,7 @@ static int parse_tuple_set(snd_config_t *cfg,
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SND_SOC_TPLG_TUPLE_TYPE_STRING:
|
||||||
|
- elem_copy_text(tuple->string, value,
|
||||||
|
+ snd_strlcpy(tuple->string, value,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
tplg_dbg("\t\t%s = %s\n", tuple->token, tuple->string);
|
||||||
|
break;
|
||||||
|
@@ -818,7 +818,7 @@ int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg,
|
||||||
|
if (snd_config_get_string(n, &value) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- elem_copy_text(tokens->token[tokens->num_tokens].id, id,
|
||||||
|
+ snd_strlcpy(tokens->token[tokens->num_tokens].id, id,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
tokens->token[tokens->num_tokens].value = atoi(value);
|
||||||
|
tplg_dbg("\t\t %s : %d\n", tokens->token[tokens->num_tokens].id,
|
||||||
|
diff --git a/src/topology/elem.c b/src/topology/elem.c
|
||||||
|
index 16ad44235dca..a9d1d8547bd2 100644
|
||||||
|
--- a/src/topology/elem.c
|
||||||
|
+++ b/src/topology/elem.c
|
||||||
|
@@ -47,7 +47,7 @@ int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref)
|
||||||
|
|
||||||
|
ref->type = elem_ref->type;
|
||||||
|
ref->elem = elem_ref;
|
||||||
|
- elem_copy_text(ref->id, elem_ref->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(ref->id, elem_ref->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
list_add_tail(&ref->list, &elem->ref_list);
|
||||||
|
return 0;
|
||||||
|
@@ -169,7 +169,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg,
|
||||||
|
/* do we get name from cfg */
|
||||||
|
if (cfg) {
|
||||||
|
snd_config_get_id(cfg, &id);
|
||||||
|
- elem_copy_text(elem->id, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(elem->id, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
elem->id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN - 1] = 0;
|
||||||
|
/* as we insert new elem based on the index value, move index
|
||||||
|
parsing here */
|
||||||
|
@@ -186,7 +186,7 @@ struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (name != NULL)
|
||||||
|
- elem_copy_text(elem->id, name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(elem->id, name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case SND_TPLG_TYPE_DATA:
|
||||||
|
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
|
||||||
|
index 8ebfafd8396b..5f586dc133e7 100644
|
||||||
|
--- a/src/topology/pcm.c
|
||||||
|
+++ b/src/topology/pcm.c
|
||||||
|
@@ -383,7 +383,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg,
|
||||||
|
|
||||||
|
sc = elem->stream_caps;
|
||||||
|
sc->size = elem->size;
|
||||||
|
- elem_copy_text(sc->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(sc->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
tplg_dbg(" PCM Capabilities: %s\n", elem->id);
|
||||||
|
|
||||||
|
@@ -562,7 +562,7 @@ static int tplg_parse_streams(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
||||||
|
/* store stream caps name, to find and merge
|
||||||
|
* the caps in building phase.
|
||||||
|
*/
|
||||||
|
- elem_copy_text(caps[stream].name, value,
|
||||||
|
+ snd_strlcpy(caps[stream].name, value,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
tplg_dbg("\t\t%s\n\t\t\t%s\n", id, value);
|
||||||
|
@@ -586,7 +586,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
||||||
|
|
||||||
|
snd_config_get_id(cfg, &id);
|
||||||
|
tplg_dbg("\t\tFE DAI %s:\n", id);
|
||||||
|
- elem_copy_text(pcm->dai_name, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(pcm->dai_name, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
snd_config_for_each(i, next, cfg) {
|
||||||
|
|
||||||
|
@@ -653,7 +653,7 @@ int tplg_parse_pcm(snd_tplg_t *tplg,
|
||||||
|
|
||||||
|
pcm = elem->pcm;
|
||||||
|
pcm->size = elem->size;
|
||||||
|
- elem_copy_text(pcm->pcm_name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(pcm->pcm_name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
tplg_dbg(" PCM: %s\n", elem->id);
|
||||||
|
|
||||||
|
@@ -754,7 +754,7 @@ int tplg_parse_dai(snd_tplg_t *tplg,
|
||||||
|
|
||||||
|
dai = elem->dai;
|
||||||
|
dai->size = elem->size;
|
||||||
|
- elem_copy_text(dai->dai_name, elem->id,
|
||||||
|
+ snd_strlcpy(dai->dai_name, elem->id,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
tplg_dbg(" DAI: %s\n", elem->id);
|
||||||
|
@@ -920,7 +920,7 @@ int tplg_parse_link(snd_tplg_t *tplg,
|
||||||
|
|
||||||
|
link = elem->link;
|
||||||
|
link->size = elem->size;
|
||||||
|
- elem_copy_text(link->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
+ snd_strlcpy(link->name, elem->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
tplg_dbg(" Link: %s\n", elem->id);
|
||||||
|
|
||||||
|
@@ -949,7 +949,7 @@ int tplg_parse_link(snd_tplg_t *tplg,
|
||||||
|
if (snd_config_get_string(n, &val) < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
- elem_copy_text(link->stream_name, val,
|
||||||
|
+ snd_strlcpy(link->stream_name, val,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
tplg_dbg("\t%s: %s\n", id, val);
|
||||||
|
continue;
|
||||||
|
@@ -1319,7 +1319,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
|
||||||
|
static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm,
|
||||||
|
struct snd_tplg_stream_template *strm_tpl)
|
||||||
|
{
|
||||||
|
- elem_copy_text(strm->name, strm_tpl->name,
|
||||||
|
+ snd_strlcpy(strm->name, strm_tpl->name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
strm->format = strm_tpl->format;
|
||||||
|
strm->rate = strm_tpl->rate;
|
||||||
|
@@ -1331,7 +1331,7 @@ static void tplg_add_stream_object(struct snd_soc_tplg_stream *strm,
|
||||||
|
static void tplg_add_stream_caps(struct snd_soc_tplg_stream_caps *caps,
|
||||||
|
struct snd_tplg_stream_caps_template *caps_tpl)
|
||||||
|
{
|
||||||
|
- elem_copy_text(caps->name, caps_tpl->name,
|
||||||
|
+ snd_strlcpy(caps->name, caps_tpl->name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
caps->formats = caps_tpl->formats;
|
||||||
|
@@ -1370,9 +1370,9 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
|
pcm = elem->pcm;
|
||||||
|
pcm->size = elem->size;
|
||||||
|
|
||||||
|
- elem_copy_text(pcm->pcm_name, pcm_tpl->pcm_name,
|
||||||
|
+ snd_strlcpy(pcm->pcm_name, pcm_tpl->pcm_name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
- elem_copy_text(pcm->dai_name, pcm_tpl->dai_name,
|
||||||
|
+ snd_strlcpy(pcm->dai_name, pcm_tpl->dai_name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
pcm->pcm_id = pcm_tpl->pcm_id;
|
||||||
|
pcm->dai_id = pcm_tpl->dai_id;
|
||||||
|
@@ -1478,9 +1478,9 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
|
|
||||||
|
/* ID and names */
|
||||||
|
link->id = link_tpl->id;
|
||||||
|
- elem_copy_text(link->name, link_tpl->name,
|
||||||
|
+ snd_strlcpy(link->name, link_tpl->name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
- elem_copy_text(link->stream_name, link_tpl->stream_name,
|
||||||
|
+ snd_strlcpy(link->stream_name, link_tpl->stream_name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
|
||||||
|
/* stream configs */
|
||||||
|
@@ -1540,7 +1540,7 @@ int tplg_add_dai_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
|
dai = elem->dai;
|
||||||
|
dai->size = elem->size;
|
||||||
|
|
||||||
|
- elem_copy_text(dai->dai_name, dai_tpl->dai_name,
|
||||||
|
+ snd_strlcpy(dai->dai_name, dai_tpl->dai_name,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
dai->dai_id = dai_tpl->dai_id;
|
||||||
|
|
||||||
|
diff --git a/src/topology/text.c b/src/topology/text.c
|
||||||
|
index cba68870dacc..72647fe04955 100644
|
||||||
|
--- a/src/topology/text.c
|
||||||
|
+++ b/src/topology/text.c
|
||||||
|
@@ -46,7 +46,7 @@ static int parse_text_values(snd_config_t *cfg, struct tplg_elem *elem)
|
||||||
|
if (snd_config_get_string(n, &value) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- elem_copy_text(&texts->items[j][0], value,
|
||||||
|
+ snd_strlcpy(&texts->items[j][0], value,
|
||||||
|
SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||||
|
tplg_dbg("\t%s\n", &texts->items[j][0]);
|
||||||
|
|
||||||
|
diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h
|
||||||
|
index af599145f9a9..8d58b2ae019e 100644
|
||||||
|
--- a/src/topology/tplg_local.h
|
||||||
|
+++ b/src/topology/tplg_local.h
|
||||||
|
@@ -282,15 +282,6 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base,
|
||||||
|
struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg,
|
||||||
|
snd_config_t *cfg, const char *name, enum snd_tplg_type type);
|
||||||
|
|
||||||
|
-static inline void elem_copy_text(char *dest, const char *src, int len)
|
||||||
|
-{
|
||||||
|
- if (!dest || !src || !len)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- strncpy(dest, src, len);
|
||||||
|
- dest[len - 1] = 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
int tplg_parse_channel(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
||||||
|
snd_config_t *cfg, void *private);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From f9056d013cf1cea70f6819cc7e2e7b689dbb3fb7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
Date: Mon, 25 Mar 2019 16:56:34 +0100
|
||||||
|
Subject: [PATCH 13/14] pcm: rate plugin - fix signess in
|
||||||
|
snd_pcm_rate_avail_update() comparison
|
||||||
|
|
||||||
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_rate.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||||
|
index 031a43dcba54..5dc8a927ad36 100644
|
||||||
|
--- a/src/pcm/pcm_rate.c
|
||||||
|
+++ b/src/pcm/pcm_rate.c
|
||||||
|
@@ -988,7 +988,7 @@ static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm)
|
||||||
|
size = pcm->buffer_size - xfer;
|
||||||
|
hw_offset = snd_pcm_mmap_hw_offset(pcm);
|
||||||
|
while (size >= pcm->period_size &&
|
||||||
|
- slave_size >= rate->gen.slave->period_size) {
|
||||||
|
+ (snd_pcm_uframes_t)slave_size >= rate->gen.slave->period_size) {
|
||||||
|
int err = snd_pcm_rate_grab_next_period(pcm, hw_offset);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
55
0014-Drop-I-includedir-alsa-from-alsa.pc.patch
Normal file
55
0014-Drop-I-includedir-alsa-from-alsa.pc.patch
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
From fc0e54c3cc6ad48d12d2cdad18df4473c559a448 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Tue, 26 Mar 2019 14:48:23 +0100
|
||||||
|
Subject: [PATCH] Drop -I$includedir/alsa from alsa.pc
|
||||||
|
|
||||||
|
We used to put the additional include path $includedir/alsa in
|
||||||
|
pkgconfig just because some applications have included asoundlib.h
|
||||||
|
like
|
||||||
|
#include <asoundlib.h>
|
||||||
|
although the canonical form should be
|
||||||
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
|
However, adding this include path is significantly dangerous due to
|
||||||
|
possible conflicts of file names like version.h. It's already the
|
||||||
|
reason to discourage people using alsa.pc for the packages.
|
||||||
|
|
||||||
|
In this patch, the additional include path from alsa.pc is dropped
|
||||||
|
finally. At the same time, as a rescue plan for the programs
|
||||||
|
including via <asoundlib.h>, a stub header file is provided in
|
||||||
|
include/sound/asoundlib.h. It just includes alsa/asoundlib.h with a
|
||||||
|
warning to suggest for replacing with alsa/asoundlib.h.
|
||||||
|
Actually this is the same file as we install into sys/asoundlib.h, so
|
||||||
|
the whole changes are very minimal here.
|
||||||
|
|
||||||
|
Acked-by: Jaroslav Kysela <perex@perex.cz>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
include/Makefile.am | 1 +
|
||||||
|
utils/alsa.pc.in | 4 +---
|
||||||
|
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/Makefile.am b/include/Makefile.am
|
||||||
|
index 67f32e36c911..665704a32129 100644
|
||||||
|
--- a/include/Makefile.am
|
||||||
|
+++ b/include/Makefile.am
|
||||||
|
@@ -96,3 +96,4 @@ AM_CPPFLAGS=-I$(top_srcdir)/include
|
||||||
|
install-data-hook:
|
||||||
|
test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
|
||||||
|
$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
|
||||||
|
+ $(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(includedir)/asoundlib.h
|
||||||
|
diff --git a/utils/alsa.pc.in b/utils/alsa.pc.in
|
||||||
|
index 8de9859f42db..444f66d85a34 100644
|
||||||
|
--- a/utils/alsa.pc.in
|
||||||
|
+++ b/utils/alsa.pc.in
|
||||||
|
@@ -9,6 +9,4 @@ Version: @VERSION@
|
||||||
|
Requires:
|
||||||
|
Libs: -L${libdir} -lasound
|
||||||
|
Libs.private: @ALSA_DEPLIBS@
|
||||||
|
-# -I${includedir}/alsa below is just for backward compatibility
|
||||||
|
-# (it was set so mistakely in the older version)
|
||||||
|
-Cflags: -I${includedir} -I${includedir}/alsa
|
||||||
|
+Cflags: -I${includedir}
|
||||||
|
--
|
||||||
|
2.16.4
|
||||||
|
|
19
alsa.changes
19
alsa.changes
@ -1,3 +1,22 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Mar 28 07:53:14 CET 2019 - tiwai@suse.de
|
||||||
|
|
||||||
|
- Backport upstream fixes: PCM sw_params behavior fix, UCM additions and
|
||||||
|
corrections, dshare position overflow fix, build fixes for Android:
|
||||||
|
0001-pcm-Preserve-period_event-in-snd_pcm_hw_sw_params-ca.patch
|
||||||
|
0004-ucm-Add-ucm-files-for-DB820c-board.patch
|
||||||
|
0005-ucm-bytcr-PlatformEnableSeq.conf-update-some-comment.patch
|
||||||
|
0006-pcm-dshare-Fix-overflow-when-slave_hw_ptr-rolls-over.patch
|
||||||
|
0007-test-latency-use-frame-bytes-correctly-in-writebuf.patch
|
||||||
|
0008-conf-pcm-dmix-add-CHANNELS-argument.patch
|
||||||
|
0009-Android-avoid-using-versionsort.patch
|
||||||
|
0010-pcm-add-the-missing-strings.h-include.patch
|
||||||
|
0011-alisp-add-the-missing-include.patch
|
||||||
|
0012-add-snd_strlcpy-and-use-it-everywhere.patch
|
||||||
|
0013-pcm-rate-plugin-fix-signess-in-snd_pcm_rate_avail_up.patch
|
||||||
|
- Drop -Iinclude/alsa from alsa.pc (bsc#1130333)
|
||||||
|
0014-Drop-I-includedir-alsa-from-alsa.pc.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Mar 17 18:27:59 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
|
Sun Mar 17 18:27:59 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
|
||||||
|
|
||||||
|
28
alsa.spec
28
alsa.spec
@ -12,7 +12,7 @@
|
|||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
# published by the Open Source Initiative.
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +48,19 @@ Source32: all_notes_off.mid
|
|||||||
Source34: alsa-init.sh
|
Source34: alsa-init.sh
|
||||||
Source40: 50-alsa.conf
|
Source40: 50-alsa.conf
|
||||||
Source41: install-snd-module
|
Source41: install-snd-module
|
||||||
|
# upstream fixes
|
||||||
|
Patch1: 0001-pcm-Preserve-period_event-in-snd_pcm_hw_sw_params-ca.patch
|
||||||
|
Patch4: 0004-ucm-Add-ucm-files-for-DB820c-board.patch
|
||||||
|
Patch5: 0005-ucm-bytcr-PlatformEnableSeq.conf-update-some-comment.patch
|
||||||
|
Patch6: 0006-pcm-dshare-Fix-overflow-when-slave_hw_ptr-rolls-over.patch
|
||||||
|
Patch7: 0007-test-latency-use-frame-bytes-correctly-in-writebuf.patch
|
||||||
|
Patch8: 0008-conf-pcm-dmix-add-CHANNELS-argument.patch
|
||||||
|
Patch9: 0009-Android-avoid-using-versionsort.patch
|
||||||
|
Patch10: 0010-pcm-add-the-missing-strings.h-include.patch
|
||||||
|
Patch11: 0011-alisp-add-the-missing-include.patch
|
||||||
|
Patch12: 0012-add-snd_strlcpy-and-use-it-everywhere.patch
|
||||||
|
Patch13: 0013-pcm-rate-plugin-fix-signess-in-snd_pcm_rate_avail_up.patch
|
||||||
|
Patch14: 0014-Drop-I-includedir-alsa-from-alsa.pc.patch
|
||||||
# rest suse fixes
|
# rest suse fixes
|
||||||
Patch101: alsa-lib-ignore-non-accessible-ALSA_CONFIG_PATH.patch
|
Patch101: alsa-lib-ignore-non-accessible-ALSA_CONFIG_PATH.patch
|
||||||
Source101: chtcx2072x.conf
|
Source101: chtcx2072x.conf
|
||||||
@ -114,6 +127,18 @@ Architecture.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n alsa-lib-%{version}
|
%setup -q -n alsa-lib-%{version}
|
||||||
|
%patch1 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
%patch9 -p1
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
%patch12 -p1
|
||||||
|
%patch13 -p1
|
||||||
|
%patch14 -p1
|
||||||
%patch101 -p1
|
%patch101 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -261,6 +286,7 @@ exit 0
|
|||||||
%{_libdir}/libasound.so
|
%{_libdir}/libasound.so
|
||||||
%{_includedir}/sys/*
|
%{_includedir}/sys/*
|
||||||
%{_includedir}/alsa
|
%{_includedir}/alsa
|
||||||
|
%{_includedir}/asoundlib.h
|
||||||
%{_datadir}/aclocal/*.m4
|
%{_datadir}/aclocal/*.m4
|
||||||
%{_libdir}/pkgconfig/*.pc
|
%{_libdir}/pkgconfig/*.pc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user