OSDN Git Service

android-x86/external-alsa-lib.git
5 years agoconf/ucm: bytcr-rt5645: Use the generic bytcr/PlatformEnableSeq.conf
Hans de Goede [Wed, 8 Aug 2018 09:05:31 +0000 (11:05 +0200)]
conf/ucm: bytcr-rt5645: Use the generic bytcr/PlatformEnableSeq.conf

Use the generic Intel SSP bytcr/PlatformEnableSeq.conf file, it is
identical to all the cset statements this commit removes.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: ioplug: Transfer all available data
Rob Duncan [Mon, 16 Jul 2018 23:35:23 +0000 (16:35 -0700)]
pcm: ioplug: Transfer all available data

The snd_pcm_mmap_begin() call returns the amount of contiguous data,
which is less than the total available if it wraps around the buffer
boundary.

If we don't handle this split we leave stale data in the buffer that
should have been overwritten, as well as unread data in the io_plugin
that gets transferred on a subsequent call at the wrong offset.

Signed-off-by: Rob Duncan <rduncan@teslamotors.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: Fix header guard in pcm_plugin.h
Guillaume Blanc [Fri, 6 Jul 2018 13:22:06 +0000 (15:22 +0200)]
pcm: Fix header guard in pcm_plugin.h

Signed-off-by: Guillaume Blanc <guillaume.blanc@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: rate: Add error check for snd_pcm_avail_update()
Timo Wischer [Wed, 4 Jul 2018 13:39:49 +0000 (15:39 +0200)]
pcm: rate: Add error check for snd_pcm_avail_update()

Without these changes a negative error code returned by
snd_pcm_avail_update() will be not handled correctly.

With this patch the returned error code of snd_pcm_avail_update() will be
returned by snd_pcm_rate_avail_update().

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: ioplug: Provide avail helper function for plugins
Timo Wischer [Tue, 3 Jul 2018 13:59:21 +0000 (15:59 +0200)]
pcm: ioplug: Provide avail helper function for plugins

This function can be called without calling snd_pcm_avail_update().

The call to snd_pcm_avail_update() can take some time.
Therefore some developers would not like to call it from a real-time
context (e.g. from JACK client context).

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: snd_interval_refine_first/last: exclude value only if also excluded before
Timo Wischer [Mon, 2 Jul 2018 14:53:06 +0000 (16:53 +0200)]
pcm: snd_interval_refine_first/last: exclude value only if also excluded before

Without this commit the following intervals [x y), (x y) were be
replaced to (y-1 y) by snd_interval_refine_last(). This was also done if
y-1 is part of the previous interval.
With this changes it will be replaced with [y-1 y) in case of y-1 is
part of the previous interval. A similar behavior will be used for
snd_interval_refine_first().

This solves the issue reported here:
https://bugzilla.opensuse.org/show_bug.cgi?id=1033179
and work arounded with commit
e736715 ("pcm: dmix: Disable var_periodsize as default").

I am able to reproduce the issue with a simplified aplay use case using
the following configuration:
pcm_slave.adr3_tdm_8ch {
    pcm {
        type hw
        card "Loopback"
        device 0
    }
    rate 48000
    period_size 128
    buffer_size 1024
    channels 2
}

pcm.dshare_Playback_3 {
    type dmix
    ipc_key 600
    ipc_perm 0660
    ipc_gid audio
    var_periodsize true
    slave adr3_tdm_8ch
}

pcm.AdevAcousticoutSpeech {
    type rate
    slave.pcm dshare_Playback_3
    slave.rate 48000
}

$ modprobe snd_aloop
$ aplay -v --period-size=352 -c2 -fS16_LE -r22500 -DAdevAcousticoutSpeech /dev/urandom
...
Rule 9 (0xffff91d1f230): PERIODS=(0 2) -> NONE BUFFER_SIZE=480 PERIOD_SIZE=[240 240]
refine_soft 'AdevAcousticoutSpeech' (end--22)
...
aplay: ../../alsa-utils-1.1.5/aplay/aplay.c:1390: set_params: Assertion `err >= 0' failed.
Aborted by signal Aborted...

The following stack trace shows where the -EINVAL will be thrown:
__snd_pcm_hw_params_set_period_size_near()
snd1_pcm_hw_param_set_near()
snd1_pcm_hw_param_set_last()
snd1_pcm_hw_refine_slave()
snd1_pcm_hw_refine_soft()
snd_pcm_hw_rule_div()
snd1_interval_refine()

This issue exists due to PERIODS does not include 2
Rule 9 (0xffff91d1f230): PERIODS=(0 9) -> (0 2) BUFFER_SIZE=[120 480]
PERIOD_SIZE=(240 241)
because of an invalid integer inverval of PERIOD_SIZE of (240 241).
This interval is set by snd_interval_refine_last().

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: Define refine mask bits explicitly (and fix missing DSD support)
Takashi Iwai [Thu, 28 Jun 2018 05:59:46 +0000 (07:59 +0200)]
pcm: Define refine mask bits explicitly (and fix missing DSD support)

Instead of the expanded bit numbers like 0x81ffffff, list up the all
supported PCM bits explicitly for refine_masks[] in pcm_params.c.
This makes easier to update any additional formats or other
parameters, and easier to spot out missing ones.

Actually the GSM and DSD formats were missing; with this commit, they
are supported properly now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: VEYRON-I2S: Add internal speakers and mic, other fixes
Urja Rannikko [Wed, 6 Jun 2018 17:52:42 +0000 (17:52 +0000)]
conf/ucm: VEYRON-I2S: Add internal speakers and mic, other fixes

Other fixes include output/input names (comments) for UIs (pavucontrol)
to display, and Playback/CapturePCM entries so pulseaudio initializes
correctly on this hardware.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: dmix: Fix hwptr updates at status call
Takashi Iwai [Tue, 12 Jun 2018 11:47:01 +0000 (13:47 +0200)]
pcm: dmix: Fix hwptr updates at status call

In the commit 38a2d2eda880 ("pcm: dmix: Do not discard slave reported
delay in status result"), the PCM dmix hwptr update code was rewritten
to follow the slave PCM hwptr update.  This is based on the similar
change in PCM dshare, the commit faf53c197cab.

There was a bug in the commit 38a2d2eda880 regarding the PCM state
change, and it was addressed in commit 3752e6b8733d ("pcm: dmix: Fix
the inconsistent PCM state").  However, we've hit yet another bug in
this commit.  Namely, the hwptr update was forgotten in the
snd_pcm_dmix_sync_ptr0() function.  So the hwptr value passed from
snd_pcm_dmix_status() isn't properly stored, and it screws up at some
long run occasionally.

This patch covers the bug by replacing with the right value.

Fixes: 38a2d2eda880 ("pcm: dmix: Do not discard slave reported delay in status result")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200013
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: chtnau8824: Add Cube iWork8 Air and Pipo W2S specific profiles
Hans de Goede [Thu, 31 May 2018 15:10:26 +0000 (17:10 +0200)]
conf/ucm: chtnau8824: Add Cube iWork8 Air and Pipo W2S specific profiles

The Cube iWork8 Air and Pipo W2S tablets both only have a single speaker.
Add long-name profiles for them which are identical to the default
chtnau8824 profile, except that they include the nau8824/MonoSpeaker.conf
snippet instead of the nau8824/Speaker.conf one.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf/ucm: chtnau8824: Add UCM profile for chtnau8824 boards
Hans de Goede [Thu, 31 May 2018 15:10:25 +0000 (17:10 +0200)]
conf/ucm: chtnau8824: Add UCM profile for chtnau8824 boards

Add UCM profile for chtnau8824 boards based on:
https://github.com/plbossart/UCM/blob/master/chtnau8824

Split into multiple files in the same way as this was done for the
bytcr-rt5640 support, re-using the existing ucm/PlatformEnableSeq.conf
and ucm/PlatformDisableSeq.conf files for the SST mixer settings.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf/ucm: bytcr-rt5640: Add default DisableSequence
Hans de Goede [Thu, 31 May 2018 15:10:24 +0000 (17:10 +0200)]
conf/ucm: bytcr-rt5640: Add default DisableSequence

Add a disable sequence powering off the SST mixer elements, loosely
based on the default DisableSequence from:
https://github.com/plbossart/UCM/blob/master/chtnau8824/HiFi.conf

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf/ucm: bytcr-rt5640: Add long-name UCM profiles
Hans de Goede [Thu, 31 May 2018 15:10:23 +0000 (17:10 +0200)]
conf/ucm: bytcr-rt5640: Add long-name UCM profiles

With a recently merged kernel commit, the kernel now sets a long-name for
bytcr-rt5640 boards which indicates if a single (mono) speaker or stereo
speakers are used and wether dmic1, in1 or in3 is used for the internal
mic (the headset mic sofar is always in2).

This commit adds UCM profiles for bytcr-rt5640 boards using these new
long-names, based on the generic bytcr-rt5640 profile.

The added profiles have the unnecessary input / output options from the
generic profile removed leaving only 2 input and 2 output options, which
are automatically switched between by e.g. pulse based on jack-detect.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf/ucm: bytcr-rt5640: Add generic bytcr-rt5640 UCM profile
Hans de Goede [Thu, 31 May 2018 15:10:22 +0000 (17:10 +0200)]
conf/ucm: bytcr-rt5640: Add generic bytcr-rt5640 UCM profile

This commit adds the generic UCM profile for bytcr-rt5640 boards from:
https://github.com/plbossart/UCM, plus the fixes from this pull-req:
https://github.com/plbossart/UCM/pull/31

The profile has been split up into separate per input / output files to
allow for creation of long-name profiles with the specific input / output
combinations found on a board without needing to copy and paste things.

Note this profile exports all inputs and both stereo/mono speaker setups
even though a typical device will not use all. Ideally a long-name based
device specific profile made up of the various parts should be used
instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm ioplug: fix some coverity issues (switch, missing unlock in snd_pcm_ioplug_drain())
Jaroslav Kysela [Wed, 23 May 2018 08:36:17 +0000 (10:36 +0200)]
pcm ioplug: fix some coverity issues (switch, missing unlock in snd_pcm_ioplug_drain())

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: add missing flags initialization for the fallback control data
Jaroslav Kysela [Wed, 23 May 2018 08:33:40 +0000 (10:33 +0200)]
pcm: add missing flags initialization for the fallback control data

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf: USB-audio: Fix for Xonar U7 SPDIF device
Takashi Iwai [Tue, 22 May 2018 12:10:59 +0000 (14:10 +0200)]
conf: USB-audio: Fix for Xonar U7 SPDIF device

Add the entry for Xonar U7 to make SPDIF working on it.

Reported-by: Steve Banks <eassbank@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotest: use position offset macro of TLV data
Takashi Sakamoto [Tue, 15 May 2018 12:36:39 +0000 (21:36 +0900)]
test: use position offset macro of TLV data

A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: softvol: use position offset macro of TLV data
Takashi Sakamoto [Tue, 15 May 2018 12:36:38 +0000 (21:36 +0900)]
pcm: softvol: use position offset macro of TLV data

A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: hw: use position offset macro of TLV data
Takashi Sakamoto [Tue, 15 May 2018 12:36:37 +0000 (21:36 +0900)]
pcm: hw: use position offset macro of TLV data

A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agohcontrol: use position offset macro of TLV data
Takashi Sakamoto [Tue, 15 May 2018 12:36:36 +0000 (21:36 +0900)]
hcontrol: use position offset macro of TLV data

A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agocontrol: use position offset macro of TLV data
Takashi Sakamoto [Tue, 15 May 2018 12:36:35 +0000 (21:36 +0900)]
control: use position offset macro of TLV data

A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agocontrol: add a series of macro for offset of several types of TLV
Takashi Sakamoto [Tue, 15 May 2018 12:36:34 +0000 (21:36 +0900)]
control: add a series of macro for offset of several types of TLV

In development period for Linux v4.18, a series of SNDRV_CTL_TLVO_XXX
macro was introduced to kernel stuffs for position offset of TLV data.

This commit adds these macros to backport header in this library.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconfigure: Fix forgotten ucm entry
Takashi Iwai [Thu, 3 May 2018 06:40:20 +0000 (08:40 +0200)]
configure: Fix forgotten ucm entry

The previous commit forgot to add to configure.ac.  Fix it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio
Takashi Iwai [Wed, 2 May 2018 14:23:21 +0000 (16:23 +0200)]
conf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio

USB-audio device on Dell WD15 docking station provides two individual
PCM streams, one for headphone and another for line out.  A UCM
profile gives the proper roles for these.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: chtrt5645: At config for the Lenovo Ideapad Miix 320
Hans de Goede [Sat, 28 Apr 2018 19:52:00 +0000 (21:52 +0200)]
conf/ucm: chtrt5645: At config for the Lenovo Ideapad Miix 320

The Lenovo Ideapad Miix 320 uses a digital mic connected to the DMIC2 input
(unlike the Asus T100HA which has it connected to the DMIC1 input), add a
long-name config specific for the Miix 320, which is a copy of the standard
chtrt5645 config with the internal analog mic section replaced with one
for a digital mic connected to the DMIC2 input.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: chtrt5645: At config for the Asus T100HA
Hans de Goede [Sat, 28 Apr 2018 19:51:59 +0000 (21:51 +0200)]
conf/ucm: chtrt5645: At config for the Asus T100HA

The Asus T100HA uses a digital mic rather then an analog one, add
long-name config specific for the T100HA, which is a copy of the standard
chtrt5645 config with the internal analog mic section replaced with one
for the digital mic found on the Asus T100HA.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: chtrt5645: Fix recording from internal analog microphone
Hans de Goede [Sat, 28 Apr 2018 19:51:58 +0000 (21:51 +0200)]
conf/ucm: chtrt5645: Fix recording from internal analog microphone

The internal analog mic switch is called 'Int Analog Mic Switch'
(not 'Int Mic Switch') and is connected to BST2 not BST1.

Also change the analog mic volume levels so that we get better
audio / less noise.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: chtrt5645: Microphone recording fixes
Pierre-Louis Bossart [Sat, 28 Apr 2018 19:51:57 +0000 (21:51 +0200)]
conf/ucm: chtrt5645: Microphone recording fixes

Apply microphone recording changes from:
https://github.com/plbossart/UCM.git

Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[hdegoede@redhat.com: Drop non generic DMIC changes]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: chtrt5645: Cleanup and playback fixes
Pierre-Louis Bossart [Sat, 28 Apr 2018 19:51:56 +0000 (21:51 +0200)]
conf/ucm: chtrt5645: Cleanup and playback fixes

Apply cleanup and playback fixes changes from:
https://github.com/plbossart/UCM.git

Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[hdegoede@redhat.com: Modify commit msg and paths for merging into alsa-lib]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: increase the input volume for LineIn
Hui Wang [Wed, 2 May 2018 06:08:06 +0000 (14:08 +0800)]
conf/ucm: increase the input volume for LineIn

Otherwise, the boost value is 0, and the sound captured from that
LineIn jack is too weak for users.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoucm: adding the folder of card_long_name when finding verb conf file
Hui Wang [Wed, 2 May 2018 06:08:05 +0000 (14:08 +0800)]
ucm: adding the folder of card_long_name when finding verb conf file

The board configuration file and verb conf file are allowed to be
in the folder named of card_long_name, so when finding the verb conf
file, we need to check if it is in the folder of card_long_name or
card_name.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: softvol: Allow up to 90 dB of gain
Ricard Wanderlof [Wed, 18 Apr 2018 15:03:09 +0000 (17:03 +0200)]
pcm: softvol: Allow up to 90 dB of gain

The gain algorithm used in softvol can handle gain factors of up to
32767 which is slightly more than 90 dB, so allow a max_dB of 90 dB.
This doesn't affect existing asound.conf files, but does allow a
max_dB of up to 90 dB when needed.

Tested using Audacity that there is no undue distorsion or other
artefacts when 90 dB of gain is applied to a suitable signal (i.e.
a signal quiet enough not be clipped whan applying 90 dB of gain).

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: topology: Add alias conf parameter names for hw_configs
Kirill Marinushkin [Mon, 16 Apr 2018 18:26:41 +0000 (20:26 +0200)]
ASoC: topology: Add alias conf parameter names for hw_configs

Currently, some parameter names in conf differ from field names in struct.
These look like typos.

This commit suggests to add aliases for such parameters, so that the names
in conf are similar to names in struct. This solution is backwards
compatible.

If the difference between conf names and struct names is done on purpose -
this commit can be dropped.

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Pan Xiuli <xiuli.pan@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: topology: Add definitions for mclk_direction values
Kirill Marinushkin [Mon, 16 Apr 2018 18:26:40 +0000 (20:26 +0200)]
ASoC: topology: Add definitions for mclk_direction values

Current comment makes not clear the direction of mclk. Previously, similar
description caused a misunderstanding for bclk_master and fsync_master.

This commit solves the potential confusion the same way it is solved for
bclk_master and fsync_master.

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Pan Xiuli <xiuli.pan@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: topology: Add missing clock gating parameter when parsing hw_configs
Kirill Marinushkin [Mon, 16 Apr 2018 18:26:39 +0000 (20:26 +0200)]
ASoC: topology: Add missing clock gating parameter when parsing hw_configs

Clock gating parameter is a part of `dai_fmt`. It is supported by
`alsa-lib` when creating a topology binary file, but ignored by kernel
when loading this topology file.

After applying this commit, the clock gating parameter is not ignored any
more. This solution is backwards compatible. The existing behaviour is
not broken, because by default the parameter value is 0 and is ignored.

snd_soc_tplg_hw_config.clock_gated = 0 => no effect
snd_soc_tplg_hw_config.clock_gated = 1 => SND_SOC_DAIFMT_GATED
snd_soc_tplg_hw_config.clock_gated = 2 => SND_SOC_DAIFMT_CONT

For example, the following config, based on
alsa-lib/src/conf/topology/broadwell/broadwell.conf, is now supported:

~~~~
SectionHWConfig."CodecHWConfig" {
        id "1"
        format "I2S"            # physical audio format.
        pm_gate_clocks "true"   # clock can be gated
}

SectionLink."Codec" {

        # used for binding to the physical link
        id "0"

        hw_configs [
                "CodecHWConfig"
        ]

        default_hw_conf_id "1"
}
~~~~

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Pan Xiuli <xiuli.pan@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Cc: alsa-devel@alsa-project.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: topology: Fix bclk and fsync inversion in set_link_hw_format()
Kirill Marinushkin [Mon, 16 Apr 2018 18:26:38 +0000 (20:26 +0200)]
ASoC: topology: Fix bclk and fsync inversion in set_link_hw_format()

The values of bclk and fsync are inverted WRT the codec. But the existing
solution already works for Broadwell, see the alsa-lib config:

`alsa-lib/src/conf/topology/broadwell/broadwell.conf`

This commit provides the backwards-compatible solution to fix this misuse.
This commit goes in pair with the corresponding patch for linux.

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Cc: alsa-devel@alsa-project.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconfigure: remove src/conf/alsa.conf.d/Makefile
Jaroslav Kysela [Tue, 10 Apr 2018 06:57:07 +0000 (08:57 +0200)]
configure: remove src/conf/alsa.conf.d/Makefile

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf: remove alsa.conf.d from the datadir
Jaroslav Kysela [Wed, 4 Apr 2018 08:02:49 +0000 (10:02 +0200)]
conf: remove alsa.conf.d from the datadir

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoalsa.conf: change the location for add-on configs to /etc/alsa/conf.d
Jaroslav Kysela [Wed, 4 Apr 2018 07:58:12 +0000 (09:58 +0200)]
alsa.conf: change the location for add-on configs to /etc/alsa/conf.d

The add-on configuration files should be placed to a volatile place.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoRelease v1.1.6
Jaroslav Kysela [Tue, 3 Apr 2018 07:01:36 +0000 (09:01 +0200)]
Release v1.1.6

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconf: USB-Audio: Add second S/PDIF device on Phiree U2SX
Bruno Pagani [Sun, 1 Apr 2018 17:11:20 +0000 (19:11 +0200)]
conf: USB-Audio: Add second S/PDIF device on Phiree U2SX

Phiree U2SX is the successor of Phiree U2 and has the same unusual
configuration.

See ea865bba4615d906144ae5d4f72a4aad2baffe1f for reference.

Signed-off-by: Bruno Pagani <bruno.n.pagani@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: ioplug: Implement proper drain behavior
Takashi Iwai [Thu, 29 Mar 2018 07:51:46 +0000 (09:51 +0200)]
pcm: ioplug: Implement proper drain behavior

This patch fixes the draining behavior of ioplug in the following
ways:

- When no draining ioplug callback is defined, implement the draining
  loop using snd_pcm_wait*() and sync with the drain finishes.
  This is equivalent with the implementation in the kernel write().
  Similarly as in kernel code, for non-blocking mode, it returns
  immediately after setting DRAINING state.

- The hw_ptr update function checks the PCM state and stops the stream
  if the draining finishes.

- When draining ioplug callback is defined, leave the whole draining
  operation to it.  The callback is supposed to return -EAGAIN for
  non-blocking case, too.

- When an error happens during draining, it drops the stream, for a
  safety reason.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: Skip avail_min check during draining
Takashi Iwai [Thu, 29 Mar 2018 07:18:00 +0000 (09:18 +0200)]
pcm: Skip avail_min check during draining

snd_pcm_wait() & co checks the current avail value and returns
immediately if it satisfies <= avail_min condition.  It's good in
general except for one situation: draining.  When the draining is
being performed in the non-blocking mode, apps are supposed to wait
via poll(), typically via snd_pcm_wait().  So this ends up with the
busy loop because of the immediate return from snd_pcm_wait().

A simple workaround is to put the PCM state check and ignore the
avail_min condition if it's DRAINING state.  The equivalent check is
found in the kernel xfer code, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoa set of fixes to reduce gcc warnings
Jaroslav Kysela [Tue, 27 Mar 2018 13:16:41 +0000 (15:16 +0200)]
a set of fixes to reduce gcc warnings

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agomodules: smixer_python - add support for python3
Jaroslav Kysela [Tue, 27 Mar 2018 12:50:36 +0000 (14:50 +0200)]
modules: smixer_python - add support for python3

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agocontrol ext: fix the default .rawmidi_next_device callback
Jaroslav Kysela [Mon, 26 Mar 2018 17:04:07 +0000 (19:04 +0200)]
control ext: fix the default .rawmidi_next_device callback

The previous default settings caused an endless loop.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: hw: Keep control data from kernel when SND_PCM_APPEND
Timo Wischer [Fri, 23 Mar 2018 14:27:23 +0000 (15:27 +0100)]
pcm: hw: Keep control data from kernel when SND_PCM_APPEND

Without this fix the application pointer would be reseted
whenever an application opens a device with SND_PCM_APPEND.

This would result in an Xrun if the device is already opened and
in running state and the appl_ptr is use.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotopology: Fix parsing config with multiple hw_configs
Kirill Marinushkin [Wed, 21 Mar 2018 19:08:04 +0000 (20:08 +0100)]
topology: Fix parsing config with multiple hw_configs

Currently, if the config file includes several hw_configs sections,
parse_hw_config_refs() returns after parsing only the first section.

For example, the following config, based on
alsa-lib/src/conf/topology/broadwell/broadwell.conf, is parsed incorrectly:

~~~~
SectionHWConfig."CodecHWConfig" {
        id "1"
        format "I2S"            # physical audio format.
        bclk   "master"         # Platform is master of bit clock
        fsync  "master"         # platform is master of fsync
}

SectionHWConfig."CodecHWConfig2" {
        id "2"
        format "AC97"
}

SectionLink."Codec" {

        # used for binding to the physical link
        id "0"

        hw_configs [
                "CodecHWConfig"
                "CodecHWConfig2"
        ]

        default_hw_conf_id "2"
}
~~~~

Signed-off-by: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: ioplug: update prepare and draining state correctly
Timo Wischer [Fri, 16 Mar 2018 10:20:46 +0000 (11:20 +0100)]
pcm: ioplug: update prepare and draining state correctly

PREPARED should only be set when it is done and it was successfully.

DRAINING should be signalled when starting to drain. There is no need to
check if draining was successfully because it will change to drop (SETUP)
in any case.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: Provide areas_copy function which handles buffer wrap around
Timo Wischer [Tue, 13 Mar 2018 08:34:43 +0000 (09:34 +0100)]
pcm: Provide areas_copy function which handles buffer wrap around

The already existing areas_copy functions do not care about the end of
the source and destination buffer.
Therefore the caller has to take care that the requested offset+size
is not exceeding any buffer limit.

This additional function will take care about the end of an buffer
and will continue at the beginning of the buffer.
For example this is required when copying between buffers with
different sizes (not multiple of).
This is often the case in IO plugins like the JACK plugin.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: ioplug: Provide hw_avail helper function for plugins
Timo Wischer [Tue, 13 Mar 2018 08:34:42 +0000 (09:34 +0100)]
pcm: ioplug: Provide hw_avail helper function for plugins

This function can be called without calling snd_pcm_avail_update().

The call to snd_pcm_avail_update() can take some time.
Therefore some developers would not like to call it from a real-time
context (e.g. from JACK client context).

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: Do not access lock_enabled if thread safe API
Timo Wischer [Thu, 1 Mar 2018 16:34:44 +0000 (17:34 +0100)]
pcm: Do not access lock_enabled if thread safe API

Without this commit compiling fails when THREAD_SAFE_API is not
enabled.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: ioplug: Use boundary for wrap around
Timo Wischer [Fri, 23 Feb 2018 09:28:51 +0000 (10:28 +0100)]
pcm: ioplug: Use boundary for wrap around

if requested by the IO plugin

Without this changes an IO plugin is not able to report
that buffer_size frames were read from the buffer.
When the buffer was full this is a valid action and
has not to be handled as an under run.

For example when the hw_ptr will be updated with
hw_ptr += buffer_size
and it is using the buffer_size as wrap around
hw_ptr %= buffer_size
would result in the same value as before the add operation.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: another fix for the snd_pcm_area_silence() fast path
Jaroslav Kysela [Mon, 5 Feb 2018 13:59:12 +0000 (14:59 +0100)]
pcm: another fix for the snd_pcm_area_silence() fast path

The 64-bit fast path can be used only in limited conditions:

- destination must be aligned to 64-bit (CPU aligned access)
- step must be equal to width
- physical with must be different than 24 (cannot be multiplied to 64)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: fix a bug to copy silent samples aligned to 64
Takashi Sakamoto [Fri, 2 Feb 2018 05:44:35 +0000 (14:44 +0900)]
pcm: fix a bug to copy silent samples aligned to 64

bits for
  24 bit sample cases

A function of 'snd_pcm_area_silence()' has a fast path to copy silent data
efficiently. However, the fast path works well just for a case that target
buffer consists of data samples for which unit of data alignment is
divisors of 64 bits.

At present, the fast path handles sample data aligned to 24 bit. In this
case, the buffer can includes extra 8 bits. This has no issue for 'signed'
case because silent data is zero, however it has an issue for 'unsigned'
case.

This commit fixes the bug by skipping cases of sample data of 24 bit.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: Fix two bugs in snd_pcm_area_silence()
furrywolf [Sun, 21 Jan 2018 03:27:03 +0000 (19:27 -0800)]
pcm: Fix two bugs in snd_pcm_area_silence()

First, after silencing the buffer 64 bits at a time, any remaining samples
need to be silenced by the following width-specific code.  However, instead
of silencing the end of the buffer, the code instead re-silences the start
of the buffer, leaving the end unsilenced.  To fix this, update the pointer
used by the width-specific code to point to the end of the area just
silenced, instead of leaving it pointing to the start of the buffer.

Second, the code for 24 bit samples can only silence a single sample, as
there's no loop for multiple samples as with other formats.  To fix this,
add a loop similar to the ones used for every other width.

The symptoms of these bugs are random data at the end of every supposedly
silenced buffer with certain format/buffer size combinations, resulting in
pops and noise.

Signed-off-by: furrywolf <alsa2@bushytails.net>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agopcm: Return the consistent error code for unexpected PCM states
Takashi Iwai [Wed, 17 Jan 2018 14:57:20 +0000 (15:57 +0100)]
pcm: Return the consistent error code for unexpected PCM states

Some PCM functions have the sanity check of the expected PCM states,
and most of them return -EBADFD if the current state doesn't match.
This is bad for some programs like aplay that expect the function
returning a proper code corresponding to the state, e.g. -ESTRPIPE for
the suspend.

This patch is an attempt to address such inconsistencies.  The sanity
checker bad_pcm_state() now returns the error code instead of bool, so
that the caller can pass the returned code as is.  And it calls a new
helper, pcm_state_to_error(), for obtaining the error code to certain
known PCM error state.

While we're at it, use the new pcm_state_to_error() for simplifying
the existing code to retrieve the error code, too.

Tested-by: Mirza Krak <mirza.krak@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: Add chtrt5645-mono-speaker-analog-mic configuration
Hans de Goede [Sat, 6 Jan 2018 22:03:20 +0000 (23:03 +0100)]
conf/ucm: Add chtrt5645-mono-speaker-analog-mic configuration

Add a configuration for Cherry Trail boards which use a rt5645 codec
connected to a mono speaker and with an analog mic on IN2N + IN2P.

The chtrt5645-mono-speaker-analog-mic/HiFi.conf for this is based on the
latest version from https://github.com/plbossart/UCM/tree/master/chtrt5645
with all the unused input options removed and some changes made to make
the analog mic work.

This commit also adds 2 ucm dirs with the longname of 2 boards known to use
this setup, which simply contain a symlink to the generic
chtrt5645-mono-speaker-analog-mic entry.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agocore: Proper reference of internal snd_dlopen()
Takashi Iwai [Thu, 4 Jan 2018 14:26:33 +0000 (15:26 +0100)]
core: Proper reference of internal snd_dlopen()

snd_dlopen() was recently rewritten to be versioned symbols, and we
have to call it with INTERNAL() wrapper from the library itself.

Add the proper declaration in the local header and fix the callers
appropriately.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotimer: Proper reference of internal versioned symbols
Takashi Iwai [Thu, 4 Jan 2018 14:24:14 +0000 (15:24 +0100)]
timer: Proper reference of internal versioned symbols

The multiply defined versioned symbols have to be called with
INTERNAL() wrapper.

Add the missing declarations of versioned timer API functions in the
local header, and use them in the callers in PCM.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agocontrol: Proper reference of internal versioned functions
Takashi Iwai [Thu, 4 Jan 2018 14:20:58 +0000 (15:20 +0100)]
control: Proper reference of internal versioned functions

The multiply defined versioned symbols have to be called with
INTERNAL() wrapper.

Add the missing declarations of the internal forms of
snd_ctl_elem_info_get_dimension*() in the local header, and use them
in the (still remaining) callers in alisp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotopology: Fix to skip writing of header for compound elements
GuruprasadX Pawse [Tue, 2 Jan 2018 05:20:01 +0000 (10:50 +0530)]
topology: Fix to skip writing of header for compound elements

While calculating the size of data to be written into the topology
binary file, the size of the compound elements is added as well. This
results in wrong file offset calculation and topology build failure.

The compound elements shouldn't be written to the topology as these are
already embedded as part of other elements. So, skip adding the size of
compound elements to the file offset size calculation.

Signed-off-by: GuruprasadX Pawse <guruprasadx.pawse@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: fix wrong comments for some cases of linear interpolation of PCM samples
Takashi Sakamoto [Wed, 20 Dec 2017 17:17:03 +0000 (02:17 +0900)]
pcm: fix wrong comments for some cases of linear interpolation of PCM samples

A commit 16b3bf447c28 ('Enhanced bitmasks in PCM - added support for more
formats by Takashi and me') adds support for some cases of linear
interpolation of PCM samples, however some of added comments are not
proper. This commit fixes them.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: remove unused macros of NORMS_LABELS/NORMS_END
Takashi Sakamoto [Wed, 20 Dec 2017 17:17:02 +0000 (02:17 +0900)]
pcm: remove unused macros of NORMS_LABELS/NORMS_END

A commit fcd164e6229c ("Permit to PCM plug configuration to specify unchanged
parameters. Added support for RT signals to async interface. Added ops for
PCM mix.") added a pair of NORMS_LABELS/NORMS_END, however they have been
no longer used.

This commit removes them in a point to reduce the amount of code to
maintain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: remove unused macros of GETU_LABELS/GETU_END
Takashi Sakamoto [Wed, 20 Dec 2017 17:17:01 +0000 (02:17 +0900)]
pcm: remove unused macros of GETU_LABELS/GETU_END

A commit 07c07da44f27 ("Fixed signess for route conversion") obsoletes
usage of a pair of GETU_LABEL/GETU_END, but it did not remove some
actual codes in 'src/pcm_plugin_ops.h'.

This commit removes them in a point to reduce the amount of code to
maintain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: remove unused macros of COPY_LABELS/COPY_END
Takashi Sakamoto [Wed, 20 Dec 2017 17:17:00 +0000 (02:17 +0900)]
pcm: remove unused macros of COPY_LABELS/COPY_END

A commit 7b054f4dce56 obsoleted usage of a pair of COPY_LABELS/COPY_END,
however it did not remove some codes in 'src/pcm/plugin_ops.h'.

This commit removes them in a point to reduce the amount of code to
maintain.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: plug: add SND_PCM_FORMAT_{S, U}20 to linear_preferred_formats
Maciej S. Szmigiero [Thu, 14 Dec 2017 13:54:29 +0000 (14:54 +0100)]
pcm: plug: add SND_PCM_FORMAT_{S, U}20 to linear_preferred_formats

This commit adds the recently added formats SND_PCM_FORMAT_{S,U}20 to
the linear_preferred_formats array in pcm_plug.
Let's give them lower priority than more standard S24 formats but a higher
priority than less typical 3-byte versions.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: linear, route: handle linear formats with 20-bit sample on 4 bytes
Maciej S. Szmigiero [Thu, 14 Dec 2017 13:53:41 +0000 (14:53 +0100)]
pcm: linear, route: handle linear formats with 20-bit sample on 4 bytes

The previous patch has added 20-bit PCM formats SND_PCM_FORMAT_{S,U}20 to
alsa-lib.
We need to extend the linear format conversion code with handling of these
sample formats so they can also be utilized by applications that only
recognize the more typical ones like SND_PCM_FORMAT_S16.

Since the conversion arrays are indexed by a format bit width divided by 8
the easiest way to handle these formats is to treat them like they were
40-bit wide (the next free integer multiple of 8 bits).
This doesn't create a collision risk with a future format since there can't
really be a 40-bit sample format that occupies 4 bytes.

Make sure we use the getput conversion method for these formats since a
direct conversion from / to them is not supported.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: add and describe SND_PCM_FORMAT_{S, U}20
Maciej S. Szmigiero [Thu, 14 Dec 2017 13:52:07 +0000 (14:52 +0100)]
pcm: add and describe SND_PCM_FORMAT_{S, U}20

This patch adds and describes in various functions that query format
properties SND_PCM_FORMAT_{S,U}20 formats that were recently added to the
kernel as SNDRV_PCM_FORMAT_{S,U}20.

These formats are similar to existing 20-bit PCM formats
SND_PCM_FORMAT_{S,U}20_3, however they occupy 4 bytes instead of 3.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoasound.h: add SNDRV_PCM_FORMAT_{S, U}20
Maciej S. Szmigiero [Thu, 14 Dec 2017 13:51:35 +0000 (14:51 +0100)]
asound.h: add SNDRV_PCM_FORMAT_{S, U}20

This patch adds definitions of 20-bit, 4-byte PCM formats
SNDRV_PCM_FORMAT_{S,U}20, that were recently added to the kernel, to
alsa-lib's own copy of asound.h.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: Add Gigabyte mobo UCM profile with dual HD-audio codecs
Takashi Iwai [Tue, 5 Dec 2017 14:08:01 +0000 (15:08 +0100)]
conf/ucm: Add Gigabyte mobo UCM profile with dual HD-audio codecs

Like the previous Lenovo laptops, some Gigabyte mobos have dual
HD-audio codecs and need to switch dynamically via UCM profile.
Reuse the same profile as Lenovo dual codecs, so far.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: Add dual HD-audio codecs config for Lenovo
Takashi Iwai [Tue, 5 Dec 2017 13:53:11 +0000 (14:53 +0100)]
conf/ucm: Add dual HD-audio codecs config for Lenovo

Some recent Lenovo laptops have dual codecs and we need to switch them
accordingly.  The kernel side already contains a fix and gives the
unique longname string for identifying the board, and here we hook up
the corresponding UCM profile.

The profile was corrected and tested by Hui Wang on Lenovo p520.

Tested-by: Kailang <kailang@realtek.com>
Tested-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: Rearrange Makefile.am
Takashi Iwai [Tue, 5 Dec 2017 13:58:30 +0000 (14:58 +0100)]
conf/ucm: Rearrange Makefile.am

Just rearrange and split to multiple lines to make future patches
cleaner.  No actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconfigure.ac: do not enable alisp code by default
Jaroslav Kysela [Mon, 27 Nov 2017 20:43:22 +0000 (21:43 +0100)]
configure.ac: do not enable alisp code by default

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoconfigure.ac: build extra mixer modules conditionally
Jaroslav Kysela [Mon, 27 Nov 2017 20:38:18 +0000 (21:38 +0100)]
configure.ac: build extra mixer modules conditionally

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoChange snd_dlopen() function to return the error string
Jaroslav Kysela [Wed, 22 Nov 2017 12:23:45 +0000 (13:23 +0100)]
Change snd_dlopen() function to return the error string

The dlopen() function might fail also for another reason than
a missing file, thus return the error string from dlerror().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agotest: correct emulation for channel-map TLV
Takashi Sakamoto [Fri, 24 Nov 2017 12:10:51 +0000 (21:10 +0900)]
test: correct emulation for channel-map TLV

Current implementation of channel-map TLV on test program is not valid.
Furthermore, it brings buffer-over-run due to byte counting.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: route: Fix use_getput flag computation for 3 byte formats
Maciej S. Szmigiero [Mon, 20 Nov 2017 12:12:32 +0000 (13:12 +0100)]
pcm: route: Fix use_getput flag computation for 3 byte formats

Commit de63b942acf520 ("pcm: route: Use get/put labels for all 3 byte formats")
wanted to make the route plugin use get / put labels not only for 24-bit
physical width formats but also for 18 and 20-bit ones.
There was, however, a typo in that commit so a check for these widths
didn't really work.

Let's fix it now.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoChange FSF address (Franklin Street)
Jaroslav Kysela [Tue, 14 Nov 2017 13:29:26 +0000 (14:29 +0100)]
Change FSF address (Franklin Street)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agoRelease v1.1.5
Jaroslav Kysela [Tue, 14 Nov 2017 07:52:09 +0000 (08:52 +0100)]
Release v1.1.5

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
6 years agotest: obsolete usage of APIs of dimensional information
Takashi Sakamoto [Mon, 13 Nov 2017 00:14:11 +0000 (09:14 +0900)]
test: obsolete usage of APIs of dimensional information

APIs of dimensional information are deprecated for future removal. This
commit removes test codes for user-defined element set in an aspect of
the feature.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoctl: deprecate APIs of dimensional information
Takashi Sakamoto [Mon, 13 Nov 2017 00:14:10 +0000 (09:14 +0900)]
ctl: deprecate APIs of dimensional information

In ALSA control interface in asound.h, 'struct snd_ctl_elem_info' has
'dimen' member to deliver information for multi-dimensional array, however
there's no common way to handle the member. As a result, drivers can
force userspace applications to handle the information by inconsistent
ways.

This issue was reported by a commit 51db452df07b ('Revert "ALSA: echoaudio:
purge contradictions between dimension matrix members and total number of
members"') to Linux kernel. As a result of discussion at Linux
miniconference 2017, usage of 'dimen' member of 'struct snd_ctl_elem_info'
is going to be deprecated for future removal.

A removal of kernel interface can cause regression issues. However no ALSA
driver in kernel land except for 'echoaudio' series utilizes this feature.
Actually it's reasonable to assume that 'echomixer' program is an unique
consumer of the interface in user land and the removal rarely brings any
impact to user land.

This commit deprecates some APIs corresponding to the kernel interface. The
kernel interface is kept till Linux kernel v4.20 at least, but actual
timing of removal is not fixed yet. After that, these APIs may also be
removed at a reasonable timing.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: rt5651: Mute speakers on boot
Carlo Caione [Wed, 8 Nov 2017 12:33:30 +0000 (12:33 +0000)]
conf/ucm: rt5651: Mute speakers on boot

The UCM configuration is enabling the speakers in the SectionDefaults.
This is a problem when booting with an headset already connected since
the audio output is routed at the same time both on speakers and
heaphones until the jack is disconnected and reconnected again.

Fix this disabling all the outputs in the default mixer configuration.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: rt5651: Add missing cdev
Carlo Caione [Wed, 8 Nov 2017 12:33:29 +0000 (12:33 +0000)]
conf/ucm: rt5651: Add missing cdev

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoalsa-lib: topology: fix DSP_B mode string
Liam Girdwood [Wed, 1 Nov 2017 12:26:24 +0000 (12:26 +0000)]
alsa-lib: topology: fix DSP_B mode string

Use the correct string for DSP_B mode.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: rt5651: Fix HiFi file name
Carlo Caione [Thu, 26 Oct 2017 15:05:01 +0000 (16:05 +0100)]
conf/ucm: rt5651: Fix HiFi file name

The conf HiFi file name is HiFi.conf, fix the name in the main
configuration file.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: rt5651: Add UCM config for bytcr-rt5651
Carlo Caione [Tue, 24 Oct 2017 11:27:12 +0000 (12:27 +0100)]
conf/ucm: rt5651: Add UCM config for bytcr-rt5651

Add a UCM configuration for the rt5651 codec on Intel's Cherry-Trail
platform. Adapted from [0].

[0] https://github.com/plbossart/UCM/tree/master/bytcr-rt5651

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotopology: fix coverity issues
Jaroslav Kysela [Sun, 22 Oct 2017 13:02:19 +0000 (15:02 +0200)]
topology: fix coverity issues

6 years agoconf: HdmiLpeAudio: remove the "front" pcm definition
Tanu Kaskinen [Wed, 4 Oct 2017 19:44:00 +0000 (22:44 +0300)]
conf: HdmiLpeAudio: remove the "front" pcm definition

PulseAudio assumes that the "front" pcm device always refers to an
analog device, not HDMI. While that assumption is not really valid, the
reality is that without that assumption PulseAudio can't know whether
"front" and "hdmi" refer to a different or the same device.

The HDMI LPE driver doesn't allow audio streaming while the HDMI cable
is unplugged, so PulseAudio has to know when it's plugged in and when
it's not. If both "front" and "hdmi" devices exist, PulseAudio will
notice that HDMI is unplugged, but it doesn't know that "front" refers
to the same device, and PulseAudio will try to use the "front" device
with bad consequences. The kernel driver's refusal to stream any audio
makes PulseAudio enter an infinite loop and then the kernel kills
PulseAudio, because it consumes too much CPU time in a realtime thread.

While the looping in PulseAudio could probably be fixed, that wouldn't
change the fact that PulseAudio thinks that there is an analog device. I
believe it's best to avoid having the same device as both "front" and
"hdmi" in alsa-lib.

I removed also the surround configuration includes. I don't think they
had any effect anyway, so I wonder why they were there in the first
place.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoctl: ext: Fail with error code if snd_ctl_ext_callback::read_event() callback is...
Timo Wischer [Thu, 5 Oct 2017 14:25:23 +0000 (16:25 +0200)]
ctl: ext: Fail with error code if snd_ctl_ext_callback::read_event() callback is not defined

The snd_ctl_ext_callback::read_event() callback is only optional
if no poll descriptor was given via
snd_ctl_ext_t::poll_fd
or
snd_ctl_ext_callback::snd_ctl_ext_poll_descriptors().

If a poll descriptor is given the
snd_ctl_ext_callback::read_event()
callback has also to be defined
because there is no minigful default behavior.

This callback will be called when ever the poll() on
the file descriptor indicates that there is an event pending.
Therefore returning a 0 which indicates that there is no event makes no
sense.

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotest/seq-decoder: enable timestamping for external subscribers
Antonio Ospite [Tue, 26 Sep 2017 14:44:49 +0000 (16:44 +0200)]
test/seq-decoder: enable timestamping for external subscribers

Events sent by external clients subscribed to the input port are not
timestamped.

This inconsistent behavior may surprise newbies who look at seq-decoder as
a reference example.

See the example below using "vkeybd --addr 128:0" to connect to seq-decoder,
the events sent by vkeybd are on a different queue with no timestamps:

  ...
  EVENT>>> Type = 66, flags = 0x0, time = 0 ticks
           Source = 0.1, dest = 128.0, queue = 253
           Event = Port Subscribed; 129:0 -> 128:0
  EVENT>>> Type = 66, flags = 0x1, time = 4.829712627
           Source = 0.1, dest = 128.0, queue = 0
           Event = Port Subscribed; 129:0 -> 128:0
  EVENT>>> Type = 10, flags = 0x0, time = 0 ticks
           Source = 129.0, dest = 128.0, queue = 253
           Event = Controller; ch=0, param=0, value=0
  EVENT>>> Type = 11, flags = 0x0, time = 0 ticks
           Source = 129.0, dest = 128.0, queue = 253
           Event = Program Change; ch=0, program=0
  ...

After the change events are on the main queue and are timestamped:

  ...
  EVENT>>> Type = 66, flags = 0x1, time = 4.280907223
           Source = 0.1, dest = 128.0, queue = 0
           Event = Port Subscribed; 129:0 -> 128:0
  EVENT>>> Type = 66, flags = 0x1, time = 4.280912063
           Source = 0.1, dest = 128.0, queue = 0
           Event = Port Subscribed; 129:0 -> 128:0
  EVENT>>> Type = 10, flags = 0x1, time = 4.280990702
           Source = 129.0, dest = 128.0, queue = 0
           Event = Controller; ch=0, param=0, value=0
  EVENT>>> Type = 11, flags = 0x1, time = 4.280994862
           Source = 129.0, dest = 128.0, queue = 0
           Event = Program Change; ch=0, program=0
  ...

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoseq: fix snd_seq_set_queue_tempo() usage example in the documentation
Antonio Ospite [Thu, 28 Sep 2017 13:46:15 +0000 (15:46 +0200)]
seq: fix snd_seq_set_queue_tempo() usage example in the documentation

snd_seq_set_queue_tempo() requires a queue id as the second argument,
fix the example in documentation to reflect that.

Also add the queue id as an argument of the set_tempo() function, just
to keep the whole example compilable.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agopcm: softvol: add support for S24_LE
Jörg Krause [Wed, 13 Sep 2017 14:21:10 +0000 (16:21 +0200)]
pcm: softvol: add support for S24_LE

Tested with the Wolfson WM8524 DAC on a i.MX6UL board and the following
ALSA configuration file using the pcm test utility from alsa-lib:

"""
$ cat /etc/asound.conf
pcm.!default {
    type plug
    slave.pcm "softvol"
}
pcm.softvol {
    type softvol
    slave {
        pcm "hw:0"
    }
    control {
        name "Master"
        card 0
    }
}
ctl.!default {
    type hw
    card 0
}
ctl.softvol {
    type hw
    card 0
}

$ pcm -D softvol -o S24_LE -c 2 -r 48000
"""

The data in the Synchronous Audio Interface (SAI) of the i.MX6UL is
aligned the following way:

"""
31 30 29 28 | 27 26 25 24 | 23 22 21 20 | .. | 3 2 1 0
## ## ## ##   ## ## ## ## [           DATA[23:0]       ]
"""

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotopology: fix usage of SND_TPLG_INDEX_ALL when checking routes
Liam Girdwood [Tue, 12 Sep 2017 20:47:42 +0000 (21:47 +0100)]
topology: fix usage of SND_TPLG_INDEX_ALL when checking routes

Make sure SND_TPLG_INDEX_ALL is used correctly when checking routes so
that connecting routes of different indexes does not emit any warnings.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotest: apply optimization for v4.14 kernel about changes for TLV data handling on...
Takashi Sakamoto [Thu, 24 Aug 2017 01:48:35 +0000 (10:48 +0900)]
test: apply optimization for v4.14 kernel about changes for TLV data handling on user-defined element set

At kernel v4.14, in initial state, elements on user-defined sets have
write-only flag. When applications write TLV data, then the elements
get readable flag and the TLV data is available. Originally TLV data
is shared by elements in the same set, thus events are generated for
all of elements in the set by the write operation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agotopology: Fix private data for BEs
Liam Girdwood [Tue, 22 Aug 2017 09:16:05 +0000 (10:16 +0100)]
topology: Fix private data for BEs

Private data was not being added to BEs. Fix this.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf: HdmiLpeAudio: add support for 3 devices
Pierre-Louis Bossart [Wed, 16 Aug 2017 16:08:48 +0000 (11:08 -0500)]
conf: HdmiLpeAudio: add support for 3 devices

The LPE Audio mode on BYT/CHT supports up to 3 devices, and also supports
IEC61937 passthrough. Add missing alsa-lib configurations so that
apps can use the usual -D'hdmi:CARD=X,DEV=Y,AES0=0x[4|6]' syntax, e.g.

aplay -D'hdmi:CARD=0,DEV=2,AES0=0x6' -c2 -r48000 -fs16_le
ac3_surround_test.spdif

Tested on Zotac PI330 with Onkyo receiver

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agorawmidi: symbols: use rawmidi_virt only when available
Thomas Petazzoni [Fri, 11 Aug 2017 21:24:03 +0000 (23:24 +0200)]
rawmidi: symbols: use rawmidi_virt only when available

src/rawmidi/Makefile.am only brings rawmidi_virt.c into the build when
BUILD_SEQ is defined (i.e when --enable-seq is passed). However,
rawmidi_symbols.c unconditionally refers to _snd_module_rawmidi_virt,
defined in rawmidi_virt.c.

This causes a link failure when BUILD_SEQ is disabled. For example
when linking ffmpeg against alsa-lib:

/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libasound.a(pcm_dmix.o): In function `snd_pcm_dmix_sync_ptr':
pcm_dmix.c:(.text+0x83c): warning:
/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libasound.a(rawmidi_symbols.o):(.data+0x4): undefined reference to `_snd_module_rawmidi_virt'
collect2: error: ld returned 1 exit status

To fix this, we make sure that rawmidi_symbols.c only uses
_snd_module_rawmidi_virt when available.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoconf/ucm: DB410c-HiFi: add CIC selection
Srinivas Kandagatla [Thu, 10 Aug 2017 11:36:16 +0000 (13:36 +0200)]
conf/ucm: DB410c-HiFi: add CIC selection

This patch adds CIC selection controls which have been added recently to
the kernel to select mic source.

Without this patch user has to manually select the control to record
from DMIC or AMIC.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>