David Ward [Sat, 27 Feb 2021 14:45:39 +0000 (09:45 -0500)]
broadwell-rt286, bdw-rt5677: Fix inconsistency in card detection
This file is only read when the driver name is 'SOF'. Other entries
in this file do not check if a card name contains the 'sof-' prefix.
Adjust these new entries for Broadwell cards so they are consistent.
This conveniently provides a workaround for a bug in kernel 5.10+:
https://bugzilla.kernel.org/show_bug.cgi?id=211985
It happens to let the catpt driver work in kernels where this bug is
present for Broadwell cards. This is possible because the SOF driver
and catpt driver share the same use case configuration for the card.
Signed-off-by: David Ward <david.ward@gatech.edu> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Mon, 8 Mar 2021 22:05:54 +0000 (23:05 +0100)]
codecs/rt5640: Specify Playback/CaptureMasterElem for HW volume-control
Newer kernels add "aif:1" or "aif:2" to the components string to let
us know which AIF is being used.
Use this to specify the correct Playback/CaptureMasterElem for HW
volume-control, based on which AIF is being used.
On older kernels, where there is no "aif:%d" string in the components
string, no Playback/CaptureMasterElem is specified.
In DigitalMics.conf the master mixer is used as regular CaptureMixerElem
instead of as CaptureMasterElem since the DMICs don't have any analog
volume control.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Wed, 17 Feb 2021 14:34:36 +0000 (15:34 +0100)]
codecs/rt5672: Add hardware volume-control support
For the speaker and DMICs configs this uses "DAC1 Playback Volume"
resp. "ADC Capture Volume" as main mixer elements, since there are
no other volume-controls in their paths.
For the (analog) headset-mic and headphones this used the analog
"IN1 Boost" resp. "HP Playback Volume" controls as main mixer elements
while using the "ADC Capture Volume" resp. "DAC1 Playback Volume"
(which have the mute switches) as master mixer elements.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Wed, 17 Feb 2021 14:34:35 +0000 (15:34 +0100)]
codecs/rt5672: Move +12dB input boost from 'STO1 ADC Boost Gain' to 'ADC Capture Volume'
Both the 'STO1 ADC Boost Gain' and the 'ADC Capture Volume' controls are
digital and the 'ADC Capture Volume' control goes up to +30dB.
When adding hw-volume-control support adding the +12dB boost gain on to of
the max +30dB of 'ADC Capture Volume' is a bit too much.
So move the +12dB from the 'STO1 ADC Boost Gain' control to the
'ADC Capture Volume' control.
This way we keep the same setting for userspace which does not support
hw-volume-control, while getting a better range when we start using
'ADC Capture Volume' as hw-volume-control.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Mon, 8 Mar 2021 22:05:53 +0000 (23:05 +0100)]
codecs/rt5640: Add hardware volume-control support
Add hardware volume-control support for the rt5640 codec.
Note this commit does not add support for the (digital) master
ADC/DAC Volume / Mute controls. There are 2 of each, and which
one should be used depends on which AIF is being used.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Mon, 8 Mar 2021 22:05:52 +0000 (23:05 +0100)]
codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths
The rt5640 codec is sometimes used with AIF1 connected to the
SoC and sometimes with AIF2 connected to the SoC.
The rt5640 UCM configuration deals with this by accepting input from
and sending output to both AIFs, relying on the kernels DAPM framework to
disable parts of the graph which are connected to the unconnected AIF.
Before this commit codecs/rt5640/EnableSeq.conf was adding a +9dB
(digital) boost to recording going through the 'ADC' path to AIF1,
while not touching the 'Mono ADC' path to AIF2.
This was causing recordings on devices using AIF2 to be somewhat soft.
This commit unifies the record volume control settings for both paths by
only using the '[Mono ]ADC Capture Volume' control, which is present
in both paths and setting it to +9dB on both paths.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Mon, 8 Mar 2021 22:05:50 +0000 (23:05 +0100)]
codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene
Cleanup: no functional changes intended.
Do the 'SPK MIXL' / 'SPK MIXR' setup only once from the main
EnableSequene, like we do for the 'OUT MIXL' / 'OUT MIXR' setup
used by the headphones already.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Mon, 8 Mar 2021 22:05:49 +0000 (23:05 +0100)]
codecs/rt5640: Cleanup: Initially disable all inputs and outputs
Cleanup: no functional changes intended.
Disable all inputs and outputs from the main EnableSequence.
This allows removing some weirdness from the individual input/output
EnableSequences where they were turning controls for other inputs/outputs
then themselves off.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The rt5640 codec is sometimes used with AIF1 connected to the SoC
and sometimes with AIF2 connected to the SoC.
The rt5640 UCM configuration deals with this by accepting input from
and sending output to both AIFs, relying on the kernels DAPM framework to
disable parts of the graph which are connected to the unconnected AIF.
On the output side we solve this by enabling both the IF1_DAC and
IF2_DAC data inputs to the digital 'Stereo DAC MIX' mixer.
On the input side handling this is somewhat more complicated, the
"Digital Mixer Path" leading to the IF1_ADC and IF2_ADC outputs
are entirely separate paths. To solve this we enable the active
input (DMIC or ADC) in both the Stereo ADC (connected to IF1_ADC)
and the Mono ADC (IF2_ADC) paths.
So far we've not been entirely consistent in our handling of
the Stereo ADC vs Mono ADC paths, this commit cleans this up:
1. Set the 'Mono ADC Capture Switch' to on once from EnableSeq.conf,
like we do for the 'ADC Capture Switch' instead of toggling it on/off
from the individual input Enable/Disable sequences.
2. Group all the 'Mono ADC ...' mixer cset calls together with their
stereo ADC counterparts.
3. Explicitly select DMIC L/R 1 for the Mono ADC L/R 2 Mux input, instead
of relying on this being the default.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Sun, 7 Mar 2021 20:03:07 +0000 (21:03 +0100)]
codecs/es8316: Fix 'HP Mixer Volume' setting
The 'HP Mixer Volume' control is interesting in that it has a hole
in its range which should not be used (described in the tlv table),
valid values are 0-4 and 8-11
I assume that the "Set HP mixer vol to -6 dB (4/7) louder does not work"
comment which this patch changes comes from attempts to use values in
that hole in the range (also notice the wrong max value in the comment).
Setting the HP mixer to -6 dB causes the sound to be significantly
softer then under Windows. This commit fixes this by initializing the
HP mixer control to 11 / 0 dB.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Sun, 7 Mar 2021 20:03:06 +0000 (21:03 +0100)]
codecs/es8316: Fix capture settings
Fix the following issues with the capture settings:
1. Disable ALC / Auto Level Control, it tries to always get an
input signal even when the user is not talking into the mic
leading to it cranking up the volume till there is noise at
the same level as the user talking.
2. The 'ADC PGA Gain Volume' volume control is not the main
'ADC vol' control, it is the mic amplifier control and
setting it to 10 sets it to 24dB not 0dB.
Adjust the comment and set it to 7 which is 16dB which
gives a good microphone signal strength without introducing
too much noise (with 'ADC Capture Volume' set to 0dB).
3. There actually is a main 'ADC vol' control which goes from -96 to 0dB
which is simply called the 'ADC Capture Volume' and when disabling ALC
it defaults to -96 dB. Add a line setting it to 0dB.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Wed, 3 Feb 2021 16:13:01 +0000 (17:13 +0100)]
ucm2: Separate the configuration lookups (hw based) from the configuration tree
Introduce ucm2/conf.d/ tree with symlinks to the real hardware configurations.
In this way, we do not rely to create the configuration paths based on
simple driver / device identification, but we can store the configurations
more logically to make the maintenance (code reuse, multiple changes)
more easy.
This commit keeps the older lookup paths active, but they will be
turned off in the next release.
Hans de Goede [Tue, 9 Feb 2021 21:01:01 +0000 (22:01 +0100)]
codecs/rt5672: Remove Intel SST specific HeadsetMic workaround
There used to be an issue with the HeadsetMic on BYT devices with
a rt5672 codec only being recorded on the left channel, while the
right channel recorded silence.
The ucm2/codecs/rt5672/HeadsetMic.conf contains a workaround for
this which changes the SST record-stream demuxer settings to
use "slot 0" for both the left and right channels when recording
from the HeadsetMic.
There are 2 problems with this workaround:
1. It uses SST specific mixer settings causing things to break
when using the SOF driver.
2. Files under uc2m/codecs should be architecture agnostic and should
not depend on platform dependent mixer settings such as the SST driver
mixer settings.
The problem which the workaround used to work around has since been
fixed in the kernel by switching the wire format from TDM/DSP A to I2S:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ceb8a36d023d4bb4ffca3474a452fb1dfaa0ef2
This fix has landed in 5.8 and has been backported to all recent
stable kernel releases.
Since this is fixed in the kernel now, we can drop the workaround,
fixing the 2 problems mentioned above.
This was tested on a ThinkPad 8 tablet, which is the same device as
where the HeadsetMic problem was originally noticed.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Existing platforms can have 1,2,3 or 4 microphones. The SOF firmware
will generate 2 or 4 channels. Since by default CaptureChannels is 2,
we need to add the case for cfg-dmics = 3.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Wed, 16 Dec 2020 15:38:38 +0000 (16:38 +0100)]
chtnau8824: Add support for using the SOF driver
The old (and currently the default) SST driver uses TDM 4 slots 24 bit
as wire format to the codec. Where as the new SOF driver uses standard
I2S 2 channel 24 bit.
Normally this should not impact the UCM settings, but on the NAU8824
the "DAC Right Channel Source" mixer setting must be set to 1 when
using TDM 4 slots and to 0 when using I2S 2 channel mode.
Getting this wrong (in either case) results in the right channel not
outputting any sound.
This commit introduces a RightOutputChannel variable which gets
set to 0/1 depending on the driver and then uses that for the
"DAC Right Channel Source" mixer setting so that we do the right
thing depending on the driver.
This has been tested on the following devices:
Medion E2215T: Stereo speakers, analog mic
Medion E2228T: Stereo speakers, stereo digital mics
Cube iWork 8 Air: Mono speaker, analog mic
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Marijn Suijten [Thu, 14 Jan 2021 13:11:50 +0000 (14:11 +0100)]
USB-Audio/ALC1220: Bump analog Speaker priority over S/PDIF
The `S/PDIF` port does not have any jack sensing, and with a priority
higher than the `Speakers` it will always be selected by default instead
of the `Speakers` even if unplugged.
Swapping the priorities around allows analog `Speakers` to be selected
first, _if_ they are plugged in. Otherwise `S/PDIF` is used.
Signed-off-by: Marijn Suijten <marijns95@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Sat, 9 Jan 2021 21:02:52 +0000 (22:02 +0100)]
rt5640: Move standard DAC setup to EnableSeq.conf
No matter which output is used, we always need to setup the standard
DAC config. Move this to the shared EnableSeq.conf to avoid having
to duplicate it in various places.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Sat, 9 Jan 2021 21:02:51 +0000 (22:02 +0100)]
bytcr-rt5640: Add support for devices without speakers and/or an internal mic
There are kernel patches pending upstream for the bytcr-rt5640 machine-driver
to support devices without speakers and/or an internal mic.
Since the UCM profile already conditionally loads the speaker and
internal-mic codec include files, these will simply get skipped in this
case, so this almost works with the current UCM profile without changes.
The only troublesome part is the ConflictingDevice sections in the codec
HeadPhones.conf and HeadsetMic.conf files, which refer to resp. a "Speaker"
and a "Mic" device. Without any of the speaker or mic codec conf files
being included there will not by any "Speaker" / "Mic" devices leading
to an error while parsing the HeadPhones.conf / HeadsetMic.conf files.
This commit makes the ConflictingDevice section conditional, fixing this.
Cc: Rasmus Porsager <rasmus@beat.dk> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hui Wang [Thu, 29 Oct 2020 05:34:02 +0000 (13:34 +0800)]
sof-hda-dsp: Set Master Playback Switch on in the BootSequence
Otherwise, the audio output will be muted by default if there is no
/var/lib/alsa/asound.state. I have experienced this issue When newly
install an OS.
Signed-off-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Sun, 6 Dec 2020 12:47:16 +0000 (13:47 +0100)]
chtnau8824: Fix mono speaker config not working
Fix the Speaker define / var being changed from "Speaker" to "MonoSpeaker"
not having any effect because the variable gets expanded before the if
making the change is interpreted.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This solution does not work. The mute state is shared between
the HDA and AMD ACP in PA, so it may cause the security issue, if
the users do not set the mute manually.
Hui Wang [Mon, 17 Aug 2020 04:37:44 +0000 (12:37 +0800)]
USB-Audio: Dell-WD15-Dock: make input and output volume adjustable
Recently we found the input volume is too low for some specific
headset-mic, even we adjust the input volume to max from PA, we still
can't record the sound from that headset-mic. That is because we
change the input or output volume from PA, but the mixer's volume
is not changed, only PA's soft-volume is changed.
Checking the amixer controls for the sound card in the WD19, it
supports MixerElem, Volume and Switch, and checking the sound card in
the WD15, it doesn't have Volume and Switch for Headphone and Line,
So adding the volume and switch control in the ucm conditionally.
Hui Wang [Mon, 17 Aug 2020 03:28:04 +0000 (11:28 +0800)]
HDA-Intel: HiFi-dual: Fix the Rear Mic's Jack name
On the LENOVO P520 (dual codecs machine), the Jack name of Rear Mic is
"Rear Mic Jack" instead of "Mic Jack".
Below is picked from alsa-info.txt on the LENOVO p520 machine:
control.18 {
iface CARD
name 'Rear Mic Jack'
value true
comment {
access read
type BOOLEAN
count 1
}
}
jacobopantoja [Thu, 6 Aug 2020 11:53:07 +0000 (13:53 +0200)]
Correct conflicting mic in max98090
'mic' was conflicting 'mic' instead of 'headset', thus preventing correct configuration regarding microphones.
With this corrected, introducing a headset enables 'headset' mic and disables internal 'mic', whereas releasing the headset disables 'headset' mic and enables internal 'mic'
This is the internal card for a number of ChromeOS devices based on the
Gru board. Config is taken from ChromeOS sources [1] and modified to
mostly look like Rockchip/max98090. Tested on a Samsung Chromebook Plus
(rk3399-gru-kevin) running Linux 5.7+.
Hans de Goede [Sun, 28 Jun 2020 17:44:21 +0000 (19:44 +0200)]
chtrt5645: Restore stereo sound output when switching from MonoSpeaker to Headphones
Commit fe3b0bdc2f43 ("chtrt5645: merge all possible configurations to
HiFi.conf") missed the part of the removed HiFi-mono-speaker-analog-mic.conf
file which restores stereo mixing (instead of mixing left + right to the
left DAC mixer output) when switching from the mono speaker setup to the
headphones output.
This was causing both left and right channels to only be played on the
left ear of the headphones. This commit fixes this.
Fixes: fe3b0bdc2f43 ("chtrt5645: merge all possible configurations to HiFi.conf") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Sun, 28 Jun 2020 17:44:20 +0000 (19:44 +0200)]
cht-bsw-rt5672: Boost ADC volume a bit
Both the DMICs and the headset mic are quite soft, even with the 20 dB
IN1 boost we already congfigure for the headset.
This commit sets the ADC Boost gain (range 0-3) to 1 = 12 dB, which makes
the volume a lot better. The next step of the ADC Boost gain setting is
24 dB which is a bit too much.
This has been tested with both the builtin DMIC and with a headset mic
on the following devices:
Hans de Goede [Sun, 28 Jun 2020 17:44:18 +0000 (19:44 +0200)]
cht-bsw-rt5672: Add Lenovo Miix 2 10 specific configuration
By default the cht-bsw-rt5672 config lets the user figure out if a device
has a Mono spaker or Stereo speakers and which DMIC input is used.
Since this is not very user-friendly we do regex matches on the DMI derived
longname to automaticaly select the right options (and to only advertise
those options).
This commit adds support for automatically selecting the right options
on the Lenovo Miix 2 10 tablet. Since this is the first device for which
we do longname matching using a DMIC on DMIC1, this also fixes a fixme :)
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Mon, 22 Jun 2020 15:52:54 +0000 (17:52 +0200)]
ucm.conf: add support for the kernel module name tree
It seems that some ASoC drivers (mainly created from the DT tree)
does not offer any good identification for the common part.
This change adds the sysfs kernel module name lookup to
module/<KernelModuleName>.conf .
Also, modularize V1, V2Name, V2Module blocks. The V1 compatibility
is turned off by default now.
Hans de Goede [Mon, 8 Jun 2020 20:21:41 +0000 (22:21 +0200)]
bytcr-rt5651: Fix high noise level + soft input on DMIC
The DMIC needs to have the DMIC ASRC enabled, otherwise capturing audio
from it results in mostly capturing noise + the actual recorded voice
very soft in the background of the noise.
This has been tested on a Point of View P1006W v1.0 tablet, which is the
only RT5651 X86 device using a DMIC that I am aware of.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hans de Goede [Mon, 8 Jun 2020 20:21:40 +0000 (22:21 +0200)]
bytcr-rt5640: Fix DMIC1 not working when connected over AIF2
The RT5640 codec has 2 ADC-s which are caled the Stereo ADC and the
Mono ADC (even though the mono ADC seems to be stereo too?). The Stereo
ADC is connected to the AIF1 interface of the codec and the Mono ADC
to the AIF2 interface.
Almost all X86 BYT/CHT design use the AIF1 interface, but a few models
use the AIF2 interface. For this reason the IN?-InternalMic.conf bits
not only select/enable the microphone input on the Stereo ADC, but
also on the Mono ADC, so that the analog mic. inputs also work in devices
using the AIF2 interface.
Before this commit DigitalMics.conf was only setting up the DMIC input
on the Stereo ADC and not on the Mono ADC, causing DMIC1 to not work
when connected over AIF2.
This commit adds selecting / enabling DMIC1 on the Mono ADC.
This fixes the internal microphone not working on the Toshiba Encore WT10A.
Note that for devices which use the AIF1 interface this is a no-op since
the AIF1 interface is not connected to anything, there is no complete
chain so DAPM will not enable any of the elements in the chain.
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>