History log of /linux-master/sound/usb/mixer_scarlett2.c
Revision Date Author Comments
# 762e6af3 11-May-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Increase mixer range to +12dB

The values loaded into the mixer are 16-bit values, with 8192
representing 0dB, going up to a current maximum of 16345 (+6dB). All
supported interfaces have no problem going up to 32612 (+12dB), so
update SCARLETT2_MIXER_MAX_DB and scarlett2_mixer_values[] to allow
for this.

Tested with:
- Scarlett 2nd Gen 6i6, 18i8, 18i20
- Scarlett 3rd Gen 4i4, 8i6, 18i8, 18i20
- Scarlett 4th Gen Solo, 2i2, 4i4
- Clarett+ 2Pre, 4Pre, 8Pre
- Vocaster One and Two

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/Zj+gYT4F2XeKTD93@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d5ca9ad5 11-May-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add S/PDIF source selection controls

Add S/PDIF Source/Digital I/O Mode selection controls for the Scarlett
3rd Gen 18i8/18i20 and Clarett 4Pre/8Pre interfaces. These models have
both coax S/PDIF and optical inputs, and the optical inputs are
switchable between being used as S/PDIF and ADAT inputs. The Scarlett
3rd Gen 18i20 also has a "Dual ADAT" mode for 8-channel audio at
88.2/96kHz.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/Zj8zCTjzPsTDENN+@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3a56855b 19-Apr-2024 Nathan Chancellor <nathan@kernel.org>

ALSA: scarlett2: Zero initialize ret in scarlett2_ag_target_ctl_get()

Clang warns (or errors with CONFIG_WERROR):

sound/usb/mixer_scarlett2.c:3697:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
3697 | if (private->autogain_updated) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
sound/usb/mixer_scarlett2.c:3707:9: note: uninitialized use occurs here
3707 | return err;
| ^~~
sound/usb/mixer_scarlett2.c:3697:2: note: remove the 'if' if its condition is always true
3697 | if (private->autogain_updated) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/usb/mixer_scarlett2.c:3688:9: note: initialize the variable 'err' to silence this warning
3688 | int err;
| ^
| = 0
1 error generated.

Initialize ret to zero to ensure ret is initialized in all paths within
scarlett2_ag_target_ctl_get(), which matches the style of other
functions in this driver.

Fixes: e30ea5340c25 ("ALSA: scarlett2: Add autogain target controls")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240419-alsa-scarlett2-fix-wsometimes-uninitialized-v1-1-e2ace8642e08@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5738cf65 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add Bluetooth volume control for Vocaster Two

The Vocaster Two has a Bluetooth module with a volume control. Add a
corresponding ALSA mixer control.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <b78687f7243142a4466f63c0aee9742b44ee395d.1710264833.git.g@b4.vu>


# e30ea534 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add autogain target controls

The Scarlett 4th Gen and Vocaster interfaces allow the autogain target
dBFS value(s) to be configured. Add Mean and Peak Target controls for
4th Gen, and a Hot Target control for Vocaster.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <33d7f6dc965ab09522361ec99745a0685e4b8272.1710264833.git.g@b4.vu>


# 16a7b277 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for Focusrite Vocaster One and Two

Add Focusrite Vocaster One and Two USB IDs, notification arrays,
config sets, and device info data.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <5fb48555a8db7bb322b25784b165829357cd6e42.1710264833.git.g@b4.vu>


# b64678eb 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add DSP controls

Add filter and compressor DSP controls for the Vocaster interfaces.
Mark scarlett2_notify_input_dsp() as __always_unused until it gets
used when the Vocaster callback function array is added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <a45316f79600b862dae38da24f13def638b06476.1710264833.git.g@b4.vu>


# bff5421a 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add input mute controls

Add controls for the input mute switches that the Vocaster interfaces
have. Mark scarlett2_notify_input_mute() as __always_unused until it
gets used when the Vocaster callback function array is added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <3b384b4e759241bd06f0c223e9f4f00467d88318.1710264833.git.g@b4.vu>


# 23715a21 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Define autogain status texts per-config-set

The autogain status texts are different for Vocaster vs. Scarlett 4th
Gen, so make them configurable per-config-set.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <b1adcd3dc48117d4ebe16812eeb7f1dbf1ede472.1710264833.git.g@b4.vu>


# 87b73d48 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Define the maximum preamp input gain per-config-set

Remove the #define SCARLETT2_MAX_GAIN_DB and replace with a
per-config-set TLV as the Vocaster has a maximum gain of 70dB vs the
4th Gen 69dB.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <ade8e18ce38927ea0224946ec7cfea23ad3793d8.1710264833.git.g@b4.vu>


# 1e48ddb7 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add additional input configuration parameters

The 4th Gen Scarlett interfaces added software-controllable input gain
along with channel select, channel link, auto-gain, and "safe" mode.
Vocaster has software-controllable input gain and auto-gain but not
channel select, channel link, or safe mode.

Add a device info field safe_input_count to indicate how many channels
have a safe mode control, and use the presence of the input select and
input link switch configuration parameters to determine if those
controls should be created.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <167f04a37d0fb23f3077705df835adbc4f2b6a8e.1710264833.git.g@b4.vu>


# b1b3b258 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for config items with size = 32

Update scarlett2_usb_get_config() to support 32-bit values which are
needed by the upcoming Vocaster support.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <ee35dce0172b2aa3fec8163ab8f35bdc35a141bd.1710264833.git.g@b4.vu>


# 7d20f7b4 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add pbuf field to struct scarlett2_config

scarlett2_usb_set_config() was using size = 0 as a signal to use the
parameter buffer. Replace that with an explicit indication (pbuf = 1),
as the upcoming Vocaster support has a config item written via the
parameter buffer with size = 1 rather than the implicit size of 8.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <50a7d85bb04f9a7f13f667c70a706826c8d3ef93.1710264833.git.g@b4.vu>


# 43900951 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Rename gen4_write_addr to param_buf_addr

The location pointed to by gen4_write_addr and gen4_write_addr + 1 is
officially known as the parameter buffer. Update the code to match.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <aa36ecb8d3ce67387b5edf6c900f0b8a509241ce.1710264833.git.g@b4.vu>


# 5bfb7c2a 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for reading from flash

Add hwdep read op so flash segments can be read.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <800d20a801e8c59c2905c82ecae5676cd4f31429.1710264833.git.g@b4.vu>


# 1b650889 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Implement handling of the ACK notification

After scarlett2_usb() sends a command, it seems that we should wait
for an ACK before attempting to read the response. Not doing that
didn't seem necessary previously but seems to be causing occasional
issues with 4th Gen devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <452d1263c40fa8eba1cfb24e2055e40a84cbc437.1710264833.git.g@b4.vu>


# 4074f8d2 12-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Move initialisation code lower in the source

So that more forward declarations won't be required when we add
handling of the ACK notification, move the initialisation functions to
after the notification functions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <0922071cb8be99a2394705de27b917d1e4e46f3f.1710264833.git.g@b4.vu>


# 6719cd5e 11-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Fix Scarlett 4th Gen input gain range again

The 4th Gen input preamp gain range is 0dB to +69dB, although the
control values range from 0 to 70. Replace SCARLETT2_MAX_GAIN with
SCARLETT2_MAX_GAIN_VALUE and SCARLETT2_MAX_GAIN_DB, and update the TLV
again.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: a45cf0a08347 ("ALSA: scarlett2: Fix Scarlett 4th Gen input gain range")
Message-ID: <Ze7OMA8ntG7KteGa@m.b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a45cf0a0 10-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Fix Scarlett 4th Gen input gain range

The input gain range TLV was declared as -70dB to 0dB, but the preamp
gain range is actually 0dB to +70dB. Rename SCARLETT2_GAIN_BIAS to
SCARLETT2_MAX_GAIN and update the TLV to fix.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <9168317b5ac5335943d3f14dbcd1cc2d9b2299d0.1710047969.git.g@b4.vu>


# be157c46 10-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Fix Scarlett 4th Gen autogain status values

The meanings of the raw_auto_gain_status values were originally
guessed through experimentation, but the official names have now been
discovered. Update the autogain status control strings accordingly.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <8bd12a5e7dc714801dd9887c4bc5cb35c384e27c.1710047969.git.g@b4.vu>


# 6ef1f08b 10-Mar-2024 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Fix Scarlett 4th Gen 4i4 low-voltage detection

The value currently being read to determine the low-voltage state is
actually the front panel state. Fix the code to use the correct offset
for the low-voltage state.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: d7cfa2fdfc8a ("ALSA: scarlett2: Add power status control")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <d97b7d87f43b0e54f37e1552394be2f3ae182704.1710047969.git.g@b4.vu>


# 3787ffdd 12-Jan-2024 Takashi Iwai <tiwai@suse.de>

ALSA: scarlett2: Fix yet more -Wformat-truncation warnings

The recent code change introduced a few false-positive compile
warnings with -Wformat-trucation again. Suppress them by replacing
snprintf() with scnprintf().

Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401062344.AzZCYlpa-lkp@intel.com/
Link: https://lore.kernel.org/r/20240112171000.31855-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4a2c8cc1 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add PCM Input Switch for Solo Gen 4

When the Direct button on the Solo Gen 4 is held for 3 seconds, the
PCM 1 and 2 inputs are toggled between DSP Outputs 1 and 2, and Mixer
Outputs E and F. This patch adds the corresponding ALSA control.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/8c67c6131c459588ac4edab11e1fbc40a8297328.1703612638.git.g@b4.vu


# 4e809a29 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for Solo, 2i2, and 4i4 Gen 4

Add new Focusrite Scarlett Gen 4 USB IDs, notification arrays, config
sets, and device info data.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/b33526d3b7a56bb2c86aa4eb2137a415bd23f1ce.1703612638.git.g@b4.vu


# 2ecca0df 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add R/O headphone volume control

The Scarlett 4i4 Gen 4 adds a R/O headphone volume control in addition
to a R/O master volume control (which is already supported).

Mark the new scarlett2_notify_volume() function with __always_unused
until it gets used when the Gen 4 notification callback function arrays
are added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/bd4a76da157f8cc3fbfa02eba96d02bdb86817c5.1703612638.git.g@b4.vu


# f6a817e6 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add minimum firmware version check

Early firmware for the Scarlett Gen 4 devices has sufficient
differences that it is better to enforce a minimum firmware version
than to try and work around those differences. Add a minimum firmware
version field to the device info struct, and display a message if the
firmware version is too old. Only create the Firmware Version and MSD
(optional) controls in this case.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/5455a7e54bda81556066abd7f761b10e9c5f8a16.1703612638.git.g@b4.vu


# 66946398 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Rename DSP mux channels

The DSP mux channels are of type SCARLETT2_PORT_TYPE_MIX so the
ALSA controls would refer to them "Mix X" and "Mixer Input X". This
patch fixes them to be called "DSP X" and "DSP Input X".

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/2d91d0a74d5c7f6179e950bed2c80a4498d16649.1703612638.git.g@b4.vu


# 166e1dfb 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for DSP mux channels

The DSP mux channels in the Scarlett 4th Gen appear as
SCARLETT2_PORT_TYPE_MIX ports but do not have corresponding mixer
controls. Add a dsp_count option to the device info struct to exclude
those DSP channels from the num_mix_in/num_mix_out counts.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/b78bdb1a7624d55783f5bf0e1ffbfa47a9e9a800.1703612638.git.g@b4.vu


# c6c9f0cf 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for custom Gen 4 Direct Monitor mixes

The mixes used by Direct Monitor feature on the Scarlett 4th Gen Solo
and 2i2 interfaces are configurable. This patch adds ALSA controls for
the gains which are copied to the mixer when Direct Monitor is
enabled.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/96282a805b45f04560e5923d170745363906b7f3.1703612638.git.g@b4.vu


# e8e14270 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Handle Gen 4 Direct Monitor mix updates

When the Direct Monitor feature on the Scarlett 4th Gen Solo and 2i2
interfaces is used, the Mix A and B gains are updated by the
interface. This patch calls snd_ctl_notify() for the ALSA mix controls
when a Direct Monitor notification is received.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/713d032e343e0547212368919bef17d6fa1c9d29.1703612638.git.g@b4.vu


# ac19be06 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Store mix_ctls for Gen 4 Direct Monitor

The Scarlett 4th Gen small interfaces have a software-controllable
mixer like the large 2nd and 3rd Gen interfaces do. Pressing the
"Direct" button on the interface updates the mixer controls, which
this driver hasn't needed to deal with previously.

This commit stores the ALSA mixer controls, and adds a mix_updated
flag so that the controls can be updated when a notification is
received.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/3ba27c60230511b80b0fa75727551ea70f17d829.1703612638.git.g@b4.vu


# d7cfa2fd 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add power status control

Add a control to retrieve the power status from the interface
(bus-powered, external-powered, or insufficient power).

Mark the new scarlett2_notify_power_status() function with
__always_unused until it gets used when the Gen 4 notification
callback function arrays are added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/d9806bc41adc45b1c19749562fec7765ba24351d.1703612638.git.g@b4.vu


# 882a2a36 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Disable autogain during phantom power state change

When phantom power is enabled or disabled, the autogain control cannot
be enabled until the interface has signalled that the change is
complete and the input is unmuted. Update those controls to be
read-only during this time.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/f49f7bf9358e1f20713d95d407d8d6a436859877.1703612638.git.g@b4.vu


# 0d2e791d 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Disable input controls while autogain is running

While the autogain function is running, the other input controls
(select, link, gain, safe, level, air, and phantom) can't be modified.
Update those controls to be read-only during this time.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/ad13bacae77860de8c2d7c89f6ec2a1ee104e65f.1703612638.git.g@b4.vu


# a1ed1d6c 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Minor refactor MSD mode check

Create local variable for storing private data pointer in
snd_scarlett2_controls_create(). It's currently only used for checking
msd_switch, but it will be used again.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/ab50939dca0fdc5fa3493fc8eee3a2fdefffa62d.1703612638.git.g@b4.vu


# 0a995e38 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for software-controllable input gain

Some devices in the Scarlett Gen 4 series have support for
software-controllable input gain. Along with this comes a channel
select option, an auto-gain feature, "safe" mode, and linking two
channels into a stereo pair.

Mark the new scarlett2_notify_input_*() functions with __always_unused
until they get used when the Gen 4 notification callback function
arrays are added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/fc39e80bb39863dd1579d342097203942b4f3034.1703612638.git.g@b4.vu


# 038216f2 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for Air Presence + Drive option

Extend the existing "air" option support from Scarlett Gen 3, which
had two states (off/on), to accommodate Scarlett Gen 4's new state:
Presence + Drive.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/a9ccda7222842a72e4ce7aa258614ff45248bb16.1703612638.git.g@b4.vu


# 1b53c116 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Allow for controls with a "mute mode"

Gen 2/3 interfaces would only use 0/1 values for input level and
phantom power switch controls. Gen 4 interfaces use the second bit to
indicate that the state should be changed (or is changing), and the
input is to be muted (or is muted) while that happens.

Add a "mute" flag to config items to enable this behaviour for the
level/phantom controls.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/f603cd16079c97fad910087e0302828a289d1c15.1703612638.git.g@b4.vu


# 4fa07ff7 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for Gen 4 style parameters

Writing Scarlett Gen 4 parameters differs from Gen 2 and Gen 3:
- the values are written into a shared write location
- the values are only byte-sized
- the read locations now extend beyond 0xFF
- a separate NVRAM save step is no longer required

This patch implements that alternate write style, triggered by setting
the config item size field to zero.

The write address is specified through a new config set field
gen4_write_addr.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/1624e6d8a0c629c3bdfe53825b16e8b589724fc4.1703612638.git.g@b4.vu


# dd57b121 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for air/phantom control on input 2

The Focusrite Scarlett Gen 4 Solo has Air and Phantom Power controls
on analogue input #2 (the Gen 3 Solo had these controls on analogue
input #1). Add air_input_first and phantom_first device info options
to cater for this.

These options are similar to the level_input_first option that was
added for the Gen 3 Solo, but these new options do not require
adjusting the index of the control.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/19511f18895b8c094985a4a5691fbc1dc028c108.1703612638.git.g@b4.vu


# 4dedf7ca 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Remove repeated elem->head.mixer references

Use a local variable *mixer rather than repeating elem->header.mixer
in scarlett2_direct_monitor_ctl_get() and scarlett2_meter_ctl_get().

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/b21bacf4056366e10e01077e224d2b4970fdfe31.1703612638.git.g@b4.vu


# d3cf557b 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Split direct_monitor out from monitor_other

The notification value for monitor_other on the large interfaces is
the same as the notification value for direct_monitor on the 3rd Gen
small interfaces. Add a separate scarlett3a_notifications array and
split out the direct_monitor handling.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/9b56a483e3e9c1447684f18239a88652c1f01445.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d9b63123 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Split input_other into level/pad/air/phantom

Gen 2/3 devices have a single notification value for "input other"
changes. Gen 4 has separate notification values for level, pad, air,
and phantom power changes. Therefore, split the input_other_updated
field and the scarlett2_update_input_other() function into the four
components so that they can be handled separately later.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/a1a1d190659d56689792aa20ceeb53a6175171ad.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ad517460 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Rename db_scale_scarlett2_gain to volume

db_scale_scarlett2_gain is the TLV for the output volume controls.
Gen 4 has software-controllable input gain controls, so rename this to
db_scale_scarlett2_volume so we can use that name for the inputs.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/d544ec7cc5d5a849da104a5a78b17f61f50657c1.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a1faecfc 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add #define for SCARLETT2_MIX_MAX

Add a #define for SCARLETT2_MIX_MAX (max of mixer inputs * outputs) as
that will be used again soon.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/83cec5ccd75f0db2bd061a76d31a7023d26300c1.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 56275126 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add scarlett2_mixer_value_to_db()

Refactor scarlett2_usb_get_mix(), moving the scarlett2_mixer_values[]
lookup into scarlett2_mixer_value_to_db().

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/7adf869852aba2819fddb850b0ea8df5f7d73931.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 90d8fef8 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Allow for interfaces without per-channel volume

Currently-supported interfaces with a mixer have per-channel volume
controls, but this changes in Gen 4. Add a check so that the Playback
Volume and associated controls don't get created unless the
SCARLETT2_CONFIG_LINE_OUT_VOLUME config item is present.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/30f68cb311e27f2cc1351cb846218f7248a90263.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c6b3e71e 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Remove line_out_hw_vol device info entry

By splitting config set gen2 into gen2a/b (for 6i6/18i8 vs 18i20), and
gen3b into gen3b/c (for 4i4/8i6 vs 18i8/18i20), we can use
scarlett2_has_config_item() instead of the per-device line_out_hw_vol.

As Gen 4 has a master volume control but no SW/HW switches, check for
both SCARLETT2_CONFIG_MASTER_VOLUME and SCARLETT2_CONFIG_SW_HW_SWITCH
as needed, even though for Gen 2 and Gen 3 the former implies the
latter.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/307c4f8d6d2e034f3e386b51d72a39d77c8a9fce.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e79aea57 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Split dim_mute_update from vol_updated

Scarlett Gen 2 and Gen 3 devices combine volume and dim/mute
notifications. The Scarlett 4i4 Gen 4 has volume change notification
but no dim/mute control so split dim_mute_update out from vol_update.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/bf63f48bcc68ae739bd9948c8ee2f87ee7af22a2.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 80c7933e 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Remove struct scarlett2_usb_volume_status

The struct scarlett2_usb_volume_status matched the config space layout
of a few volume controls that could be read together and were in fixed
locations between Gen 2 and Gen 3 devices.

Gen 4 devices have removed, moved, and new related controls, so this
needs to be cleaned up. By adding SCARLETT2_CONFIG_MASTER_VOLUME (the
only config item that didn't already have its own entry, because it is
read-only), we can remove:
- struct scarlett2_usb_volume_state,
- #define SCARLETT2_USB_VOLUME_STATUS_OFFSET, and
- scarlett2_usb_get_volume_status()
and replace with calls to scarlett2_usb_get_config().

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/2ee88994857246bf89fab8e62ac279f3bcf96192.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 42caae0e 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Refactor common port_count lookups

Rather than looking up the analogue and mixer I/O counts repeatedly in
info->port_count[SCARLETT2_PORT_TYPE_*][SCARLETT2_PORT_*], save those
numbers in private variables.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/db0a5b56bdff476e2e31ad8e5ee15008314412b7.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e5fab78c 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Change num_mux_* from int to u8

num_mux_srcs and num_mux_dsts will fit into a u8, so change the type.
More similar counts are coming soon.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/886fbd9ce7f06b13c6dbf36f64e6b2d107d16a83.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 648bd468 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Parameterise notifications

The notification values were previously #define'd, and checked with a
series of if() statements calling functions. Replace with an array of
masks/callback function pointers, and a pointer to that array in the
scarlett2_config_set definitions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/0ee2a3786f9d30c89eeae59d7e933424e8f39162.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b5fe6c47 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Formatting fixes

Add missing blank line before comment.

For consistency with other functions that have few parameters, move
the parameters onto the same line as the function name.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/72be568b02eea12621b0c4a96f8e8cc65b0c13c0.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9c2ea88e 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Refactor scarlett2_config_save()

Use the new scarlett2_usb_activate_config() helper function rather
than preparing the request manually and calling scarlett2_usb().

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/bbc733dc081f311fb3167e81b15cd76324aa6307.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7f4d8dbe 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Refactor scarlett2_usb_set_config()

Pull out common code from scarlett2_usb_set_config() and create
scarlett2_usb_set_data() and scarlett2_usb_activate_config().

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/257eca0b07708339133f916930e388057d116eb8.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 43222a61 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add check for config_item presence

Update scarlett2_usb_get_config() and scarlett2_usb_set_config() to
make sure that the config_item_num is valid for the device.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/b0572b23291ffd1b208f21d298adaf4d9f1fe4bc.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cbd6f148 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Remove scarlett2_config_sets array

Replace array index into config sets with a pointer to a config set.
Copy the config_set pointer to the scarlett2_data struct.

This simplifies both the definition and use of the config sets.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/61f69519fb6fbb677e066891a3a6771aeeec106d.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c0a7e1d8 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add config set struct

Add struct scarlett2_config_set so that data which is common to all
devices in a config set can be stored there rather than in the
model-specific data.

Accordingly, rename scarlett2_config_items[] to
scarlett2_config_sets[].

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/bfdb04cd6239af9a8c26a52da0537980f77c0437.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c13d43a8 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Check presence of mixer using mux_assignment

Currently the presence of a mixer is determined by checking if the
device uses the GEN_3A config set. Add scarlett2_has_mixer() function
which checks for the presence of mux_assignment entries instead.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/ef6f4d360c2fe682ab65f83cccbe5be66ccc6296.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2edc76dd 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Check for phantom persistence config item

Allow for the phantom persistence config item to not exist. This is
needed for the Scarlett Gen 4 series.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/3ccaf8069280827bd6c44f103fcb770bd50b7e2e.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3978fefd 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Infer standalone switch from config items

Rather than assuming the standalone switch is present for all devices
with a mixer, instead check for the presence of the
SCARLETT2_CONFIG_STANDALONE_SWITCH config item.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/59c30885b02d65feaab2c338cf46889d72d01813.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3a4e1afe 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Infer has_msd_mode from config items

Rather than storing has_msd_mode in the per-device structure, infer
this from the presence of the SCARLETT2_CONFIG_MSD_SWITCH entry in the
device's configuration set.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/ecbf3740e6b30a245333528ae4c504f37a9bc6bf.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a2bb6c7d 24-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Simplify enums by removing explicit values

This commit removes the explicit integer assignments from the enums.
The actual values matter little, and not assigning explicit values
makes it easier to modify the longer lists in the future.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/67f0f1bb8b90d7c76dfe7062d22d33bbde19cf93.1703444932.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1abfbd3c 29-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for uploading new firmware

Add ops.write to the hwdep interface. Once the upgrade firmware flash
segment has been erased, writes to the hwdep fd are permitted, and
translated to SCARLETT2_USB_WRITE_SEGMENT commands to the device.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/ZY65S0ojShSNSeRQ@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6a7508e6 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add ioctl commands to erase flash segments

Add ioctls:
- SCARLETT2_IOCTL_SELECT_FLASH_SEGMENT
- SCARLETT2_IOCTL_ERASE_FLASH_SEGMENT
- SCARLETT2_IOCTL_GET_ERASE_PROGRESS

The settings or the firmware flash segment can be selected and then
erased (asynchronous operation), and the erase progress can be
monitored.

If the erase progress is not monitored, then subsequent hwdep
operations will block until the erase is complete.

Once the erase is started, ALSA controls that communicate with the
device will all return -EBUSY, and the device must be rebooted.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/227409adb672f174bf3db211e9bda016fb4646ea.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 337b2f0e 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add skeleton hwdep/ioctl interface

Add skeleton hwdep/ioctl interface, beginning with
SCARLETT2_IOCTL_PVERSION and SCARLETT2_IOCTL_REBOOT.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/24ffcd47a8a02ebad3c8b2438104af8f0169164e.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 34101a0f 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Retrieve useful flash segment numbers

Call SCARLETT2_USB_INFO_FLASH and SCARLETT2_USB_INFO_SEGMENT to find
the App_Settings and App_Upgrade flash segment numbers, and store them
in the scarlett2_data struct. These will be used later to implement
reset to factory defaults and firmware upgrade functions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/70f0108a9cf99b69f7aa920c4bcdb0cf4bf3da98.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 103c23cc 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add #defines for firmware upgrade

Add #defines for SCARLETT2_USB_* needed for firmware upgrade:
reboot, info-flash, info-segment, erase-segment, get-erase, and
write-segment.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/3077651c21bc8d4f046c68b79ec387aa16fcc5e4.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 993f7b42 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add missing mutex lock around get meter levels

As scarlett2_meter_ctl_get() uses meter_level_map[], the data_mutex
should be locked while accessing it.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 3473185f31df ("ALSA: scarlett2: Remap Level Meter values")
Link: https://lore.kernel.org/r/77e093c27402c83d0730681448fa4f57583349dd.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 04f8f053 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add clamp() in scarlett2_mixer_ctl_put()

Ensure the value passed to scarlett2_mixer_ctl_put() is between 0 and
SCARLETT2_MIXER_MAX_VALUE so we don't attempt to access outside
scarlett2_mixer_values[].

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Link: https://lore.kernel.org/r/3b19fb3da641b587749b85fe1daa1b4e696c0c1b.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 50603a67 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add missing error checks to *_ctl_get()

The *_ctl_get() functions which call scarlett2_update_*() were not
checking the return value. Fix to check the return value and pass to
the caller.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Link: https://lore.kernel.org/r/32a5fdc83b05fa74e0fcdd672fbf71d75c5f0a6d.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ca459dfa 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add missing error check to scarlett2_usb_set_config()

scarlett2_usb_set_config() calls scarlett2_usb_get() but was not
checking the result. Return the error if it fails rather than
continuing with an invalid value.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 9e15fae6c51a ("ALSA: usb-audio: scarlett2: Allow bit-level access to config")
Link: https://lore.kernel.org/r/def110c5c31dbdf0a7414d258838a0a31c0fab67.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5f6ff693 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add missing error check to scarlett2_config_save()

scarlett2_config_save() was ignoring the return value from
scarlett2_usb(). As this function is not called from user-space we
can't return the error, so call usb_audio_err() instead.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Link: https://lore.kernel.org/r/bf0a15332d852d7825fa6da87d2a0d9c0b702053.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 649cc9e5 19-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Update maintainer info

Update MAINTAINERS and "enabled" message with GitHub repository links.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/62f32404eaa8663cc304648354b85bcb5914ce72.1703001053.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0b2dca55 26-Dec-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Convert meter levels from little-endian

Add missing conversion from little-endian data to CPU-endian in
scarlett2_usb_get_meter_levels().

Fixes: 3473185f31df ("ALSA: scarlett2: Remap Level Meter values")
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/ZYsBIE3DSKdi4YC/@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a5901f27 27-Oct-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add missing check with firmware version control

scarlett2_add_firmware_version_ctl() may return an error, but the
return value was not being checked. Add the missing check.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 701949cc0128 ("ALSA: scarlett2: Add support for reading firmware version")
Link: https://lore.kernel.org/r/ZTuKcXajVnuelBEb@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3473185f 26-Oct-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Remap Level Meter values

The values previously returned by the Level Meter control were passed
through from the interface without interpretation, but it has been
discovered that the order of the values matches the mux assignment
order (which is not presented to userspace). In addition, the values
for disabled mux outputs, and mux outputs which share a source are
invalid.

This patch adds a per-device meter_map[], and a dynamic
meter_level_map[] which is updated on routing changes. The meter level
map gets used by scarlett2_meter_ctl_get() to both present the values
in a standard order, and to fix up the invalid values by zeroing them
(for disabled outputs) and copying them (for mux outputs which share a
source).

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/d437ace603eff685d2e0c3d0960589d7a09dd647.1698342632.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2190b9ae 26-Oct-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Allow passing any output to line_out_remap()

Line outputs 3 & 4 on the Gen 3 18i8 are internally the analogue 7 and
8 outputs, and this renumbering is hidden from the user by
line_out_remap(). By allowing higher values (representing non-analogue
outputs) to be passed to line_out_remap(), repeated code from
scarlett2_mux_src_enum_ctl_get() and scarlett2_mux_src_enum_ctl_put()
can be removed.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/3b70267931f5994628ab27306c73cddd17b93c8f.1698342632.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 701949cc 26-Oct-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Add support for reading firmware version

The 84 bytes read during initialisation step 2 were previously
ignored. This patch retrieves the firmware version from bytes 8-11,
stores it in the scarlett2_data struct, and makes it available
through a new control "Firmware Version".

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/e76cd80c3445769e60c95df12c4635fc8abfe5c7.1698342632.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f3c42a2d 26-Oct-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Rename Gen 3 config sets

The config sets are named NO_MIXER, GEN_2, GEN_3, and CLARETT
currently. Rename NO_MIXER and GEN_3 to GEN_3A and GEN_3B respectively
as NO_MIXER is only for the smaller Gen 3 devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/19ae5eea7fc499945efa8eeda7fcd8afe73f62d9.1698342632.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# efc3d7d2 26-Oct-2023 Geoffrey D. Bennett <g@b4.vu>

ALSA: scarlett2: Rename scarlett_gen2 to scarlett2

This driver was originally developed for the Focusrite Scarlett Gen 2
series. Since then Focusrite have used a similar protocol for their
Gen 3, Gen 4, Clarett USB, Clarett+, and Vocaster series.

Let's call this common protocol the "Scarlett 2 Protocol" and rename
the driver to scarlett2 to not imply that it is restricted to Gen 2
series devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/e1ad7f69a1e20cdb39094164504389160c1a0a0b.1698342632.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>