Commit graph

1013779 commits

Author SHA1 Message Date
Geoffrey D. Bennett
a5b3612305 ALSA: usb-audio: scarlett2: Add support for "input-other" notify
Some models allow the level and pad settings to be controlled from the
front-panel of the device. For these, the device will send an
"input-other" notification to prompt the driver to re-read the status
of those settings.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/06289a7697455e96b7dbdfd2d384d4b20f8df6e0.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:42:24 +02:00
Geoffrey D. Bennett
4be47798d7 ALSA: usb-audio: scarlett2: Add Gen 3 mixer support
Add mixer support for the Focusrite Scarlett 4i4, 8i6, 18i8, and 18i20
Gen 3 devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/22d0dc877dec026eb19630edec217ab72ebcd50a.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:42:23 +02:00
Takashi Iwai
785b6f29a7 ALSA: usb-audio: scarlett2: Fix wrong resume call
The current way of the scarlett2 mixer code managing the
usb_mixer_elem_info object is wrong in two ways: it passes its
internal index to the head.id field, and the val_type field is
uninitialized.  This ended up with the wrong execution at the resume
because a bogus unit id is passed wrongly.  Also, in the later code
extensions, we'll have more mixer elements, and passing the index will
overflow the unit id size (of 256).

This patch corrects those issues.  It introduces a new value type,
USB_MIXER_BESPOKEN, which indicates a non-standard mixer element, and
use this type for all scarlett2 mixer elements, as well as
initializing the fixed unit id 0 for avoiding the overflow.

Tested-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/49721219f45b7e175e729b0d9d9c142fd8f4342a.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:39:19 +02:00
Geoffrey D. Bennett
b126bbac98 ALSA: usb-audio: scarlett2: Fix Level Meter control
The Level Meter control had a fixed number of channels and therefore
only worked with the 18i20 Gen 2. Fix the control to contain the
correct number of channels.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/5e9a2d5c136270db2d048db53a3b4b6e6d4a63de.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:07 +02:00
Geoffrey D. Bennett
e2cc91ac8f ALSA: usb-audio: scarlett2: Split struct scarlett2_ports
The scarlett2_ports struct contains both generic (hardware IDs and
descriptions) and model-specific (port count) data. Remove the generic
data from the scarlett2_device_info struct so it is not repeated for
every model.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/7a9e57e4e55a482390c692a9e60731d72b664a15.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:07 +02:00
Geoffrey D. Bennett
6522c36419 ALSA: usb-audio: scarlett2: Allow arbitrary ordering of mux entries
Some Gen 3 devices do not put all of the mux entries for the same port
types together in order in the "set mux" message data. To prepare for
this, replace the struct scarlett2_ports num[] array and the
assignment_order[] array with mux_assignment[], a list of port types
and ranges that is defined in the struct scarlett2_device_info.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/08e8d784d78262cb57496d28ef1ad7b6213a90ab.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:06 +02:00
Geoffrey D. Bennett
0c88f9db19 ALSA: usb-audio: scarlett2: Add mute support
For each analogue output, in addition to the output volume (gain)
control, the hardware also has a mute control. Add ALSA mute controls
for each analogue output.

If the device has the line_out_hw_vol feature, then the mute control
is disabled along with the output volume control when the switch is
set to HW.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/6fad82174b44633e46cfd96332a038de74d544f2.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:05 +02:00
Geoffrey D. Bennett
06250c89d4 ALSA: usb-audio: scarlett2: Add scarlett2_vol_ctl_write() helper
Add helper function for setting the read/write status of a volume
control. This will simplify the upcoming mute control support.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/00dd57e1abb3fa379fb51d4ac8537dbddc09f0ea.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:04 +02:00
Geoffrey D. Bennett
904e6da1fd ALSA: usb-audio: scarlett2: Remove repeated device info comments
Document the fields of struct scarlett2_device_info in the definition
of the struct, not in each instantiation.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/3486e4d38973333d4ec38f32578c16a9f97bf6c8.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:04 +02:00
Geoffrey D. Bennett
6fd9d695f3 ALSA: usb-audio: scarlett2: Move info lookup out of init function
The info variable is not used by snd_scarlett_gen2_init() except to
pass it to snd_scarlett_gen2_controls_create(), so move the lookup
into that function.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/c4b6d17708e104503d9a2b88f9b3320bb9904cfa.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:03 +02:00
Geoffrey D. Bennett
d92b91576e ALSA: usb-audio: scarlett2: Improve device info lookup
Add the USB device ID to the scarlett2_device_info struct so that the
switch statement which finds the appropriate struct can be replaced
with a loop that looks through an array of pointers to those structs.

Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/474c408c29fb280a611e47e49e59ca2fb9810d27.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:03 +02:00
Geoffrey D. Bennett
76cb680603 ALSA: usb-audio: scarlett2: Reformat scarlett2_config_items[]
Use designated initializers and merge lines in preparation for more
configuration items coming soon.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/512d14eeb3571a266810c954d0f83140a3af7afc.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:02 +02:00
Geoffrey D. Bennett
077e104e2e ALSA: usb-audio: scarlett2: Merge common line in capture strings
Use a common sprintf() format for the mixer element names generated in
scarlett2_add_line_in_ctls() in preparation for more of them.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/d91dce45ac75a541c21f47540ecbda24bd83f68c.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:01 +02:00
Geoffrey D. Bennett
f3c6104301 ALSA: usb-audio: scarlett2: Add "Sync Status" control
Add "Sync Status" control to display the sync locked/unlocked status.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/d6967d7a34b2ea7e0672ba819e4ed8b99e8dcd35.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:01 +02:00
Geoffrey D. Bennett
e840ee3036 ALSA: usb-audio: scarlett2: Always enable interrupt polling
Always enable interrupt polling as every model has some sort of
status to report.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/8f49a6b9a9805ee0db221706193b7bb43b7fff75.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:36:00 +02:00
Geoffrey D. Bennett
c712c6c0ff ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptions
There are two headphone outputs, and they map to the four analogue
outputs.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/205e5e5348f08ded0cc4da5446f604d4b91db5bf.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:35:59 +02:00
Geoffrey D. Bennett
acf91b8122 ALSA: usb-audio: scarlett2: Update initialisation sequence
The old initialisation code only works with Gen 2 devices. Replace it
with an initialisation sequence that works on both Gen 2 and Gen 3
devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/6e5c4fedb74b813872f6a4b7fba30b6c471fa63a.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:35:59 +02:00
Geoffrey D. Bennett
1f7fa6e5af ALSA: usb-audio: scarlett2: Add usb_tx/rx functions
Pull out snd_usb_ctl_msg() calls from scarlett2_usb() and put into
scarlett2_usb_tx() and scarlett2_usb_rx() functions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/720d1d6f227fc8f5d7d6191a8de62db796940235.1624294591.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:35:58 +02:00
Dan Carpenter
0f7c956533 ALSA: hdsp: fix a test for copy_to_user() failure
The copy_to_user() function returns the number of bytes remaining to be
copied.  It doesn't return negatives.

Fixes: 66c8f75919 ("ALSA: hdsp: Fix assignment in if condition")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YNIzqpVR6L2t/RwJ@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 21:33:24 +02:00
Jiajun Cao
8c13212443 ALSA: hda: Add IRQ check for platform_get_irq()
The function hda_tegra_first_init() neglects to check the return
value after executing platform_get_irq().

hda_tegra_first_init() should check the return value (if negative
error number) for errors so as to not pass a negative value to
the devm_request_irq().

Fix it by adding a check for the return value irq_id.

Signed-off-by: Jiajun Cao <jjcao20@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210622131947.94346-1-jjcao20@fudan.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 16:12:03 +02:00
Takashi Iwai
362372ceb6 ALSA: usb-audio: Fix OOB access at proc output
At extending the available mixer values for 32bit types, we forgot to
add the corresponding entries for the format dump in the proc output.
This may result in OOB access.  Here adds the missing entries.

Fixes: bc18e31c30 ("ALSA: usb-audio: Fix parameter block size for UAC2 control requests")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210622090647.14021-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22 11:08:27 +02:00
Geoffrey D. Bennett
6c0a207813 ALSA: usb-audio: scarlett2: Remove hard-coded USB #defines
Remove the hard-coded interface number and related constants for the
vendor-specific interface and look them up from the USB endpoint
descriptor.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164652.GA9237@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:38:11 +02:00
Geoffrey D. Bennett
2967263192 ALSA: usb-audio: scarlett2: Don't copy struct scarlett2_config
scarlett2_usb_set_config() and scarlett2_usb_get_config() were copying
struct scarlett2_config. Use a pointer instead.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164648.GA9231@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:38:03 +02:00
Geoffrey D. Bennett
64c02a9d3f ALSA: usb-audio: scarlett2: Fix union usage in mixer control callbacks
Fix mixer control callbacks to use the correct members of the struct
snd_ctl_elem_value. The use of value.integer and value.enumerated were
swapped in a few places.

Update scarlett2_mux_src_enum_ctl_put() to use min() instead of
clamp() as value.enumerated.item is unsigned.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164647.GA9226@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:57 +02:00
Geoffrey D. Bennett
c5d8e00803 ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return values
Mixer control put callbacks should return 1 if the value is changed.
Fix the sw_hw, level, pad, and button controls accordingly.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164645.GA9221@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:50 +02:00
Geoffrey D. Bennett
9b5ddea9ce ALSA: usb-audio: scarlett2: Fix data_mutex lock
The private->vol_updated flag was being checked outside of the
mutex_lock/unlock() of private->data_mutex leading to the volume data
being fetched twice from the device unnecessarily or old volume data
being returned.

Update scarlett2_*_ctl_get() and include the private->vol_updated flag
check inside the critical region.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164643.GA9216@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:37 +02:00
Geoffrey D. Bennett
3eeb2a19db ALSA: usb-audio: scarlett2: Add temp variable for consistency
Add index temporary variable to scarlett2_mixer_ctl_put() for
consistency with the other *_ctl_put() functions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164641.GA9211@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:30 +02:00
Geoffrey D. Bennett
e46f2195c8 ALSA: usb-audio: scarlett2: Rename struct scarlett2_mixer_data
Rename struct scarlett2_mixer_data to struct scarlett2_data. A
less-wordy name is better because it is used everywhere, and although
this is a mixer driver, it also controls other vendor-specific
features.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164639.GA9206@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:22 +02:00
Geoffrey D. Bennett
dbd82c0550 ALSA: usb-audio: scarlett2: Rename buttons/interrupts/vol
To match the vendor's terminology, change #defines, identifiers, and
comments:
- mute/dim/hardware buttons are now called dim/mute
- mixer status/interrupt is now notify
- vol is now monitor

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164636.GA9199@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:16 +02:00
Geoffrey D. Bennett
03bdbcf08a ALSA: usb-audio: scarlett2: Remove redundant info->button_count
The per-model button_count value was used to determine whether
dim/mute controls should be added, but these are present iff
line_out_hw_vol is true. Remove button_count and replace with
SCARLETT2_BUTTON_MAX and a check for line_out_hw_vol true.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164634.GA9193@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:07 +02:00
Geoffrey D. Bennett
411b22ed67 ALSA: usb-audio: scarlett2: Remove interrupt debug message
Just ignore instead of printing an error if the interrupt data is not
the expected length. This check was for development and the condition
has not been observed.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164632.GA9186@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:37:00 +02:00
Geoffrey D. Bennett
b677b6c6d8 ALSA: usb-audio: scarlett2: Remove unused/useless code
Remove #define not used.
Remove useless assignments and copies.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164630.GA9180@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:36:51 +02:00
Geoffrey D. Bennett
06a2162179 ALSA: usb-audio: scarlett2: Coding style improvements
Improve alignment and readability with:
- Whitespace fixes
- Add leading zeros to 32-bit flag values
- Rename SCARLETT2_USB_GET_METER_LEVELS to SCARLETT2_USB_GET_METER
- Rename SCARLETT2_PORT_DIRECTIONS to SCARLETT2_PORT_DIRNS

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164628.GA9172@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:36:43 +02:00
Geoffrey D. Bennett
c5210f2134 ALSA: usb-audio: scarlett2: Fix 18i8 Gen 2 PCM Input count
The 18i8 Gen 2 has 8 PCM Inputs, not 20. Fix the ports entry in
s18i8_gen2_info.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164625.GA9165@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:36:36 +02:00
Geoffrey D. Bennett
2975c588df ALSA: usb-audio: scarlett2: Remove incorrect S/PDIF comment
The 18i8 Gen 2 S/PDIF outputs are available at 192kHz, unlike
the 18i20 Gen 2. Remove the comment that says otherwise.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/20210620164622.GA9155@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21 08:36:19 +02:00
Takashi Iwai
f8fbcdfb06 ALSA: hda/realtek: Fix bass speaker DAC mapping for Asus UM431D
Asus Zenbook 14 UM431D has two speaker pins and a headphone pin, and
the auto-parser ends up assigning the bass to the third DAC 0x06.
Although the tone comes out, it's inconvenient because this DAC has no
volume control unlike two other DACs.

For obtaining the volume control for the bass speaker, this patch
enforces the mapping to let both front and bass speaker pins sharing
the same DAC.  It's not ideal but a little bit of improvement.

Since we've already applied the same workaround for another ASUS
machine, we just need to hook the chain to the existing quirk.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212547
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210620065952.18948-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-20 09:00:31 +02:00
Elia Devito
434591b2a7 ALSA: hda/realtek: Improve fixup for HP Spectre x360 15-df0xxx
On HP Spectre x360 15-df0xxx, after system boot with plugged headset, the
headset mic are not detected.
Moving pincfg and DAC's config to single fixup function fix this.

[ The actual bug in the original code was that it used a chain to
  ALC286_FIXUP_SPEAKER2_TO_DAC1, and it contains not only the DAC1
  route fix but also another chain to ALC269_FIXUP_THINKPAD_ACPI.
  I thought the latter one is harmless for non-Thinkpad, but it
  doesn't seem so; it contains again yet another chain to
  ALC269_FIXUP_SKI_IGNORE, and this might be bad for some machines,
  including this HP machine.  -- tiwai ]

Signed-off-by: Elia Devito <eliadevito@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210619204105.5682-1-eliadevito@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-20 08:48:29 +02:00
Takashi Sakamoto
50ebe56222 ALSA: bebob: add support for ToneWeal FW66
A user of FFADO project reported the issue of ToneWeal FW66. As a result,
the device is identified as one of applications of BeBoB solution.

I note that in the report the device returns contradictory result in plug
discovery process for audio subunit. Fortunately ALSA BeBoB driver doesn't
perform it thus it's likely to handle the device without issues.

I receive no reaction to test request for this patch yet, however it would
be worth to add support for it.

daniel@gibbonmoon:/sys/bus/firewire/devices/fw1$ grep -r . *
Binary file config_rom matches
dev:244:1
guid:0x0023270002000000
hardware_version:0x000002
is_local:0
model:0x020002
model_name:FW66
power/runtime_active_time:0
power/runtime_active_kids:0
power/runtime_usage:0
power/runtime_status:unsupported
power/async:disabled
power/runtime_suspended_time:0
power/runtime_enabled:disabled
power/control:auto
subsystem/drivers_autoprobe:1
uevent:MAJOR=244
uevent:MINOR=1
uevent:DEVNAME=fw1
units:0x00a02d:0x010001
vendor:0x002327
vendor_name:ToneWeal
fw1.0/uevent:MODALIAS=ieee1394:ven00002327mo00020002sp0000A02Dver00010001
fw1.0/power/runtime_active_time:0
fw1.0/power/runtime_active_kids:0
fw1.0/power/runtime_usage:0
fw1.0/power/runtime_status:unsupported
fw1.0/power/async:disabled
fw1.0/power/runtime_suspended_time:0
fw1.0/power/runtime_enabled:disabled
fw1.0/power/control:auto
fw1.0/model:0x020002
fw1.0/rom_index:15
fw1.0/specifier_id:0x00a02d
fw1.0/model_name:FW66
fw1.0/version:0x010001
fw1.0/modalias:ieee1394:ven00002327mo00020002sp0000A02Dver00010001

Cc: Daniel Jozsef <daniel.jozsef@gmail.com>
Reference: https://lore.kernel.org/alsa-devel/20200119164335.GA11974@workstation/
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210619083922.16060-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-20 08:42:27 +02:00
Takashi Iwai
1948fc065a ALSA: hda/realtek: Add another ALC236 variant support
The codec chip 10ec:0230 is another variant of ALC236, combined with a
card reader.  Apply the equivalent setup as 10ec:0236.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1184869
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210618161720.28694-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-18 18:46:03 +02:00
Takashi Sakamoto
5b24119e91 ALSA: firewire-motu: fix rx packet format at higher rate for MOTU 828 mk3 Hybrid
I assumed that the combination of packet formats for MOTU 828 mk3 Hybrid
is the same as MOTU 828 mk3 FireWire. However at higher sampling rate, it
is different. MOTU 828 mk3 Hybrid has additional 4 dummy data chunks for
rx packet.

This commit fixes the issue to which I address at a commit f2ac3b8395
("ALSA: firewire-motu: sequence replay for source packet header").

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210618040713.114611-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-18 09:42:42 +02:00
Takashi Sakamoto
6b6c17fe6f ALSA: bebob: fix rx packet format for Yamaha GO44/GO46, Terratec Phase 24/x24
Below devices reports zero as the number of channels for external output
plug with MIDI type:

 * Yamaha GO44/GO46
 * Terratec Phase 24/X24

As a result, rx packet format is invalid and they generate silent sound.
This is a regression added in v5.13.

This commit fixes the bug, addressed at a commit 1bd1b3be86 ("ALSA:
bebob: perform sequence replay for media clock recovery").

Cc: <stable@vger.kernel.org>
Fixes: 5c6ea94f2b ("ALSA: bebob: detect the number of available MIDI ports")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210618040447.113306-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-18 09:42:00 +02:00
Jeremy Szu
c3d2c88209 ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook x360 830 G8
The HP EliteBook x360 830 G8 using ALC285 codec which using 0x04 to
control mute LED and 0x01 to control micmute LED.
Therefore, add a quirk to make it works.

Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210617171422.16652-1-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-18 09:41:21 +02:00
Zhen Lei
37d122c576 ALSA: aoa: remove unnecessary oom message
Fixes scripts/checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Remove it can help us save a bit of memory.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210617102746.1709-1-thunder.leizhen@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 17:31:38 +02:00
Takashi Iwai
c485f7e986 ALSA: seq: oss: Fix error check at system port creation
The system port creation in ALSA OSS sequencer was wrongly checked
against to the port number that can be never negative.  The error code
should be checked rather against the ioctl call.

This patch corrects the error check.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210617134742.6321-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 16:02:26 +02:00
Takashi Sakamoto
fc36ef80ca ALSA: firewire-motu: fix stream format for MOTU 8pre FireWire
My previous refactoring for ALSA firewire-motu driver brought regression
to handle MOTU 8pre FireWire. The packet format is not operated correctly.

Cc: <stable@vger.kernel.org>
Fixes: dfbaa4dc11 ("ALSA: firewire-motu: add model-specific table of chunk count")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210614083133.39753-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 12:06:00 +02:00
Daehwan Jung
aecc19ec40 ALSA: usb-audio: fix rate on Ozone Z90 USB headset
It mislabels its 96 kHz altsetting and that's why it causes some noise

Signed-off-by: Daehwan Jung <dh10.jung@samsung.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1623836097-61918-1-git-send-email-dh10.jung@samsung.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 11:38:46 +02:00
Takashi Sakamoto
b431f16f16 ALSA: firewire-motu: add support for MOTU 896
MOTU 896 is a second model in MOTU FireWire series, produced in 2001. This
model consists of three chips:

 * Texas Instruments TSB41AB2 (Physical layer for IEEE 1394 bus)
 * Philips Semiconductors PDI 1394L21BE (Link layer for IEEE 1394 bus and
   packet processing layer)
 * QuickLogic QuickRAM QL4016 (Data block processing layer and digital
   signal processing)

This commit adds a support for the model, with its unique protocol as
version 1. The features of this protocol are:

 * no MIDI support.
 * Rx packets have no data chunks for control and status messages.
 * Tx packets have 2 bytes for control and status messages in the end of
   each data block.
 * The most of settings are represented in bit flag in one quadlet address
   (0x'ffff'f000'0b14).
 * It's selectable to use signal on optical interface, however the device
   has no register specific to it. The state has effect just to whether
   to exclude differed data chunks.
 * The internal multiplexer is not configured by software.

Just after powering on, the device has a quirk to fail handling
transaction. I recommend users to connect the device enough after powering
on.

$ python3 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04102814  bus_info_length 4, crc_length 16, crc 10260
404  31333934  bus_name "1394"
408  20001000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4)
40c  0001f200  company_id 0001f2     |
410  0000d645  device_id 000000d645  | EUI-64 0001f2000000d645

               root directory
               -----------------------------------------------------------------
414  0004c65c  directory_length 4, crc 50780
418  030001f2  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  8d000006  --> eui-64 leaf at 438
424  d1000001  --> unit directory at 428

               unit directory at 428
               -----------------------------------------------------------------
428  0003ab34  directory_length 3, crc 43828
42c  120001f2  specifier id
430  13000002  version
434  17102801  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  0002057d  leaf_length 2, crc 1405
43c  0001f200  company_id 0001f2     |
440  0000d645  device_id 000000d645  | EUI-64 0001f2000000d645

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210616082847.124688-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 11:37:24 +02:00
Takashi Sakamoto
d13d6b284d ALSA: firewire-motu: add support for MOTU 828
MOTU 828 is a first model in MOTU FireWire series, produced in 2001. This
model consists of three chips:
 * Texas Instruments TSB41AB1 (Physical layer for IEEE 1394 bus)
 * Philips Semiconductors 1394L21BE (Link layer for IEEE 1394 bus and
   packet processing layer)
 * QuickLogic QuickRAM QL4016 (Data block processing layer and digital
   signal processing)

This commit adds a support for this model, with its unique protocol as
version 1. The features of this protocol are:

 * no MIDI support.
 * Rx packets have no data chunks for control and status messages.
 * Tx packets have 2 data chunks for control and status messages in the
   end of each data block. The chunks consist of data block counter
   (4 byte) and message (2 byte).
 * All of settings are represented in bit flag in one quadlet address
   (0x'ffff'f000'0b00).
 * When optical interface is configured as S/PDIF, signals of the interface
   is multiplexed for packets, instead of signals of coaxial interface.
 * The internal multiplexer is not configured by software.

I note that the device has a quirk to mute output voluntarily during
receiving batch of packets in the beginning of packet streaming. The
operation to unmute should be done by software enough after the device
shifts the state, however it's not deterministic. Furthermore, just
after switching rate of sampling clock, the device keeps the state longer.
This patch manages to sleep 100 msec before unmute operation, but it may
fail to release the mute in the case that the rate is changed. As a
workaround, users can restart packet streaming at the same rate, or write
to specific register from userspace.

$ python3 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04105c54  bus_info_length 4, crc_length 16, crc 23636
404  31333934  bus_name "1394"
408  20001000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4)
40c  0001f200  company_id 0001f2     |
410  00005015  device_id 0000005015  | EUI-64 0001f20000005015

               root directory
               -----------------------------------------------------------------
414  0004c65c  directory_length 4, crc 50780
418  030001f2  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  8d000006  --> eui-64 leaf at 438
424  d1000001  --> unit directory at 428

               unit directory at 428
               -----------------------------------------------------------------
428  00035052  directory_length 3, crc 20562
42c  120001f2  specifier id
430  13000001  version
434  17101800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  0002eeb6  leaf_length 2, crc 61110
43c  0001f200  company_id 0001f2     |
440  00005015  device_id 0000005015  | EUI-64 0001f20000005015

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210616082847.124688-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17 11:37:08 +02:00
Colin Ian King
36d1a6729b ALSA: bebob: Fix bit flag quirk constants
The quirking bit-flags are currently set as contiguous integer enum values
and so currently SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC is zero and so
he quirking never getting set or tested correctly for this quirk. Fix this
by setting the quirking constants as shifted bit values.

Addresses-Coverity: ("Bitwise-and with zero")
Fixes: 93cd12d6e8 ("ALSA: bebob: code refactoring for model-dependent quirks")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210615142048.59900-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-16 08:53:24 +02:00
Yang Yingliang
80b9c1be56 ALSA: ppc: fix error return code in snd_pmac_probe()
If snd_pmac_tumbler_init() or snd_pmac_tumbler_post_init() fails,
snd_pmac_probe() need return error code.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210616021121.1991502-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-16 08:52:29 +02:00