Takashi Iwai [Tue, 8 Jun 2021 14:04:52 +0000 (16:04 +0200)]
ALSA: als4000: Fix assignment in if condition
PCI ALS4000 driver code contains a few assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:51 +0000 (16:04 +0200)]
ALSA: als300: Fix assignment in if condition
PCI ALS300 driver code contains a few assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:50 +0000 (16:04 +0200)]
ALSA: ak4531: Fix assignment in if condition
AK4531 codec driver code contains a few assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:49 +0000 (16:04 +0200)]
ALSA: ad1889: Fix assignment in if condition
PCI AD1889 driver code contains a few assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:48 +0000 (16:04 +0200)]
ALSA: isa: Fix assignment in if condition
ISA ES1688 and WSS driver code contains a few assignments in if
condition, which is a bad coding style that may confuse readers and
occasionally lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:47 +0000 (16:04 +0200)]
ALSA: azt2320: Fix assignment in if condition
ISA AZT2320 driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:46 +0000 (16:04 +0200)]
ALSA: als100: Fix assignment in if condition
ISA ALS100 driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:45 +0000 (16:04 +0200)]
ALSA: cmi8330: Fix assignment in if condition
ISA CMI8330 driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:44 +0000 (16:04 +0200)]
ALSA: es18xx: Fix assignment in if condition
ISA ES18xx driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:43 +0000 (16:04 +0200)]
ALSA: opl3sa2: Fix assignment in if condition
ISA OPL3SA2 driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:42 +0000 (16:04 +0200)]
ALSA: opti9xx: Fix assignment in if condition
ISA Opti9xx driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:41 +0000 (16:04 +0200)]
ALSA: cs423x: Fix assignment in if condition
ISA CS423x driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:40 +0000 (16:04 +0200)]
ALSA: wavefront: Fix assignment in if condition
ISA WaveFront driver code contains lots of assignments in if
condition, which is a bad coding style that may confuse readers and
occasionally lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:39 +0000 (16:04 +0200)]
ALSA: ad1816a: Fix assignment in if condition
ISA AD1816A driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:38 +0000 (16:04 +0200)]
ALSA: gus: Fix assignment in if condition
ISA GUS driver code contains lots of assignments in if condition,
which is a bad coding style that may confuse readers and occasionally
lead to bugs.
This patch is merely for coding-style fixes, no functional changes.
Link: https://lore.kernel.org/r/20210608140540.17885-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:37 +0000 (16:04 +0200)]
ALSA: sb: Fix potential double-free of CSP mixer elements
snd_sb_qsound_destroy() contains the calls of removing the previously
created mixer controls, but it doesn't clear the pointers. As
snd_sb_qsound_destroy() itself may be repeatedly called via ioctl,
this could lead to double-free potentially.
Fix it by clearing the struct fields properly afterwards.
Link: https://lore.kernel.org/r/20210608140540.17885-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:36 +0000 (16:04 +0200)]
ALSA: sb: Minor coding style fixes
The handling of snd_ctl_new1() and snd_ctl_add() can be sometimes
tricky, as snd_ctl_add() automatically removes the passed object at
its error path. The recent fix addressed an overlooked issue that is
relevant with that in SB driver code, and it can be a bit more
simplified by assigning to a temporary variable, i.e. storing to the
struct field only after the creation succeeds.
Link: https://lore.kernel.org/r/20210608140540.17885-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 14:04:35 +0000 (16:04 +0200)]
ALSA: sb: Fix assignment in if condition
A lot of code for SB drivers is in a legacy style with assignment in
if condition. This also made harder to catch some bugs (e.g. the
commit
1c98f574403d "ALSA: emu8000: Fix a use after free in
snd_emu8000_create_mixer").
This patch fixes the coding style. All are rather simple conversions
and there should be no functional changes.
(The changes in snd_emu8000_new() for hw->res_port1, 2 and 3 are
slightly different from the older ones, but this shouldn't matter
much in practice.)
Link: https://lore.kernel.org/r/20210608140540.17885-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Geoffrey D. Bennett [Mon, 7 Jun 2021 19:13:51 +0000 (04:43 +0930)]
ALSA: usb-audio: scarlett2: Read mux at init time
Add support for retrieving the mux configuration from the hardware
when the driver is initialising. Previously the ALSA controls were
initialised to a default hard-coded state instead of being initialised
to match the hardware state.
Fixes:
9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
Tested-by: Alex Fellows <alex.fellows@gmail.com>
Tested-by: Daniel Sales <daniel.sales.z@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/15b17c60a2bca174bcddcec41c9419b746f21c1d.1623091570.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Geoffrey D. Bennett [Mon, 7 Jun 2021 19:13:25 +0000 (04:43 +0930)]
ALSA: usb-audio: scarlett2: Read mixer volumes at init time
Add support for reading the mixer volumes from the hardware when the
driver is initialising. Previously these ALSA volume controls were
initialised to zero instead of being initialised to match the hardware
state.
Fixes:
9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com>
Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
Tested-by: Alex Fellows <alex.fellows@gmail.com>
Tested-by: Daniel Sales <daniel.sales.z@gmail.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/bb33fa9b79efc6f7a0f0e6fb7018cc8d4d59b3ba.1623091570.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 8 Jun 2021 12:02:06 +0000 (14:02 +0200)]
Merge branch 'for-linus' into for-next
Jeremy Szu [Tue, 8 Jun 2021 11:47:48 +0000 (19:47 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP ZBook Power G8
The HP ZBook Power G8 using ALC236 codec which using 0x02 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/20210608114750.32009-1-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Hui Wang [Tue, 8 Jun 2021 02:46:00 +0000 (10:46 +0800)]
ALSA: hda/realtek: headphone and mic don't work on an Acer laptop
There are 2 issues on this machine, the 1st one is mic's plug/unplug
can't be detected, that is because the mic is set to manual detecting
mode, need to apply ALC255_FIXUP_XIAOMI_HEADSET_MIC to set it to auto
detecting mode. The other one is headphone's plug/unplug can't be
detected by pulseaudio, that is because the pulseaudio will use
ucm2/sof-hda-dsp on this machine, and the ucm2 only handle
'Headphone Jack', but on this machine the headphone's pincfg sets the
location to Front, then the alsa mixer name is "Front Headphone Jack"
instead of "Headphone Jack", so override the pincfg to change location
to Left.
BugLink: http://bugs.launchpad.net/bugs/1930188
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210608024600.6198-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:50 +0000 (17:12 +0900)]
ALSA: firewire-lib: delete unused kernel API
No driver use snd_fw_schedule_registration(). Let's delete it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-10-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:49 +0000 (17:12 +0900)]
ALSA: fireface: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-9-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:48 +0000 (17:12 +0900)]
ALSA: firewire-motu: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-8-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:47 +0000 (17:12 +0900)]
ALSA: firewire-tascam: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:46 +0000 (17:12 +0900)]
ALSA: firewire-digi00x: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:45 +0000 (17:12 +0900)]
ALSA: dice: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:44 +0000 (17:12 +0900)]
ALSA: oxfw: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:43 +0000 (17:12 +0900)]
ALSA: fireworks: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 7 Jun 2021 08:12:42 +0000 (17:12 +0900)]
ALSA: bebob: cease from delayed card registration
The delayed registration of sound card instance brings less benefit than
complication of kobject management. This commit ceases from it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210607081250.13397-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sun, 6 Jun 2021 04:34:09 +0000 (13:34 +0900)]
ALSA: firewire-motu: add support for hybrid model of MOTU Ultralite mk3
This commit adds support for the hybrid model of MOTU Ultralite mk3 with
alpha connector, which is already discontinued. The hardware specification
of the model is the same as the one of FireWire-only model.
$ cd linux-firewire-utils
$ python3 src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400
04101573 bus_info_length 4, crc_length 16, crc 5491
404
31333934 bus_name "1394"
408
20ff7000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
40c
0001f200 company_id 0001f2 |
410
000a059c device_id
00000a059c | EUI-64
0001f200000a059c
root directory
-----------------------------------------------------------------
414
0004ef04 directory_length 4, crc 61188
418
030001f2 vendor
41c
0c0083c0 node capabilities per IEEE 1394
420
d1000002 --> unit directory at 428
424
8d000005 --> eui-64 leaf at 438
unit directory at 428
-----------------------------------------------------------------
428
0003f00b directory_length 3, crc 61451
42c
120001f2 specifier id
430
13000030 version
434
17103800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438
0002d89c leaf_length 2, crc 55452
43c
0001f200 company_id 0001f2 |
440
000a059c device_id
00000a059c | EUI-64
0001f200000a059c
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210606043409.40019-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sun, 6 Jun 2021 02:56:51 +0000 (11:56 +0900)]
ALSA: firewire-lib: remove useless operations for kernel preemption
In all of drivers of ALSA firewire stack, the callback of .pointer and
.ack in snd_pcm_ops structure is done in acquired spin_lock of PCM
substream, therefore already under disabled kernel preemption.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210606025651.29970-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Dan Carpenter [Sat, 5 Jun 2021 12:46:39 +0000 (15:46 +0300)]
ALSA: firewire-lib: fix error codes for allocation failure
Return -ENOMEM if kcalloc() fails. Currently the code returns success.
Fixes:
f9e5ecdfc2c2 ("ALSA: firewire-lib: add replay target to cache sequence of packet")
Fixes:
6f24bb8a157c ("ALSA: firewire-lib: pool sequence of packet in IT context independently")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/YLtyL4VoArwVLor1@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sat, 5 Jun 2021 09:10:54 +0000 (18:10 +0900)]
ALSA: firewire-lib: fix the context to call snd_pcm_stop_xrun()
In the workqueue to queue wake-up event, isochronous context is not
processed, thus it's useless to check context for the workqueue to switch
status of runtime for PCM substream to XRUN. On the other hand, in
software IRQ context of 1394 OHCI, it's needed.
This commit fixes the bug introduced when tasklet was replaced with
workqueue.
Cc: <stable@vger.kernel.org>
Fixes:
2b3d2987d800 ("ALSA: firewire: Replace tasklet with work")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210605091054.68866-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Sat, 5 Jun 2021 08:25:38 +0000 (16:25 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 840 Aero G8
The HP EliteBook 840 Aero G8 using ALC285 codec which using 0x04 to
control mute LED and 0x01 to control micmute LED.
In the other hand, there is no output from right channel of speaker.
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/20210605082539.41797-3-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Sat, 5 Jun 2021 08:25:37 +0000 (16:25 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP EliteBook x360 1040 G8
The HP EliteBook x360 1040 G8 using ALC285 codec which using 0x04 to control
mute LED and 0x01 to control micmute LED.
In the other hand, there is no output from right channel of speaker.
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/20210605082539.41797-2-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Sat, 5 Jun 2021 08:25:36 +0000 (16:25 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Elite Dragonfly G2
The HP Elite Dragonfly G2 using ALC285 codec which using 0x04 to control
mute LED and 0x01 to control micmute LED.
In the other hand, there is no output from right channel of speaker.
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/20210605082539.41797-1-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Werner Sembach [Fri, 4 Jun 2021 14:02:07 +0000 (16:02 +0200)]
ALSA: hda/realtek: Change device names for quirks to barebone names
Change the name string of several devices needing quirks to the Clevo-barebone
ones. Also make the names follow the same pattern for multiple Clevo names
referring to the same mainboard.
Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Link: https://lore.kernel.org/r/20210604140207.8023-1-wse@tuxedocomputers.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Yang Yingliang [Thu, 3 Jun 2021 14:32:03 +0000 (22:32 +0800)]
ALSA: firewire-motu: fix error return code in snd_motu_stream_reserve_duplex()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Fixes:
e50dfac81f73 ("ALSA: firewire-motu: cache event ticks in source packet header per data block")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210603143203.582017-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Hui Wang [Wed, 2 Jun 2021 14:54:24 +0000 (22:54 +0800)]
ALSA: hda: update the power_state during the direct-complete
The patch_realtek.c needs to check if the power_state.event equals
PM_EVENT_SUSPEND, after using the direct-complete, the suspend() and
resume() will be skipped if the codec is already rt_suspended, in this
case, the patch_realtek.c will always get PM_EVENT_ON even the system
is really resumed from S3.
We could set power_state to PMSG_SUSPEND in the prepare(), if other
PM functions are called before complete(), those functions will
override power_state; if no other PM functions are called before
complete(), we could know the suspend() and resume() are skipped since
only S3 pm functions could be skipped by direct-complete, in this case
set power_state to PMSG_RESUME in the complete(). This could guarantee
the first time of calling hda_codec_runtime_resume() after complete()
has the correct power_state.
Fixes:
215a22ed31a1 ("ALSA: hda: Refactor codec PM to use direct-complete optimization")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210602145424.3132-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 2 Jun 2021 11:38:23 +0000 (13:38 +0200)]
ALSA: timer: Fix master timer notification
snd_timer_notify1() calls the notification to each slave for a master
event, but it passes a wrong event number. It should be +10 offset,
corresponding to SNDRV_TIMER_EVENT_MXXX, but it's incorrectly with
+100 offset. Casually this was spotted by UBSAN check via syzkaller.
Reported-by: syzbot+d102fa5b35335a7e544e@syzkaller.appspotmail.com
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/000000000000e5560e05c3bd1d63@google.com
Link: https://lore.kernel.org/r/20210602113823.23777-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Dongliang Mu [Wed, 2 Jun 2021 03:41:36 +0000 (11:41 +0800)]
ALSA: control led: fix memory leak in snd_ctl_led_register
The snd_ctl_led_sysfs_add and snd_ctl_led_sysfs_remove should contain
the refcount operations in pair. However, snd_ctl_led_sysfs_remove fails
to decrease the refcount to zero, which causes device_release never to
be invoked. This leads to memory leak to some resources, like struct
device_private. In addition, we also free some other similar memory
leaks in snd_ctl_led_init/snd_ctl_led_exit.
Fix this by replacing device_del to device_unregister
in snd_ctl_led_sysfs_remove/snd_ctl_led_init/snd_ctl_led_exit.
Note that, when CONFIG_DEBUG_KOBJECT_RELEASE is enabled, put_device will
call kobject_release and delay the release of kobject, which will cause
use-after-free when the memory backing the kobject is freed at once.
Reported-by: syzbot+08a7d8b51ea048a74ffb@syzkaller.appspotmail.com
Fixes:
a135dfb5de15 ("ALSA: led control - add sysfs kcontrol LED marking layer")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210602034136.2762497-1-mudongliangabcd@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 1 Jun 2021 16:24:57 +0000 (18:24 +0200)]
ALSA: usb-audio: Reduce latency at playback start
USB-audio driver behaves a bit strangely for the playback stream --
namely, it starts sending silent packets at PCM prepare state while
the actual data is submitted at first when the trigger START is kicked
off. This is a workaround for the behavior where URBs are processed
too quickly at the beginning. That is, if we start submitting URBs at
trigger START, the first few URBs will be immediately completed, and
this would result in the immediate period-elapsed calls right after
the start, which may confuse applications.
OTOH, submitting the data after silent URBs would, of course, result
in a certain delay of the actual data processing, and this is rather
more serious problem on modern systems, in practice.
This patch tries to revert the workaround and lets the URB submission
starting at PCM trigger for the playback again. As far as I've tested
with various backends (native ALSA, PA, JACK, PW), I haven't seen any
problems (famous last words :)
Note that the capture stream handling needs no such workaround, since
the capture is driven per received URB.
Link: https://lore.kernel.org/r/20210601162457.4877-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 1 Jun 2021 16:24:56 +0000 (18:24 +0200)]
ALSA: usb-audio: Factor out DSD bitrev copy function
Just minor code refactoring. Like DOP DSD code, it can be better in a
separate function for code readability.
Link: https://lore.kernel.org/r/20210601162457.4877-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 1 Jun 2021 16:24:55 +0000 (18:24 +0200)]
ALSA: usb-audio: Refactoring delay account code
The PCM delay accounting in USB-audio driver is a bit complex to
follow, and this is an attempt to improve the readability and provide
some potential fix.
Basically, the PCM position delay is calculated from two factors: the
in-flight data on URBs and the USB frame counter. For the playback
stream, we advance the hwptr already at submitting URBs. Those
"in-flight" data amount is now tracked, and this is used as the base
value for the PCM delay correction. The in-flight data is decreased
again at URB completion in return. For the capture stream, OTOH,
there is no in-flight data, hence the delay base is zero.
The USB frame counter is used in addition for correcting the current
position. The reference frame counter is updated at each submission
and receiving time, and the difference from the current counter value
is taken into account.
In this patch, each in-flight data bytes is recorded in the new
snd_usb_ctx.queued field, and the total in-flight amount is tracked in
snd_usb_substream.inflight_bytes field, as the replacement of
last_delay field.
Note that updating the hwptr after URB completion doesn't work for
PulseAudio who tries to scratch the buffer on the fly; USB-audio is
basically a double-buffer implementation, hence the scratching the
buffer can't work for the already submitted data. So we always update
hwptr beforehand. It's not ideal, but the delay account should give
enough correctness.
Link: https://lore.kernel.org/r/20210601162457.4877-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 1 Jun 2021 16:24:54 +0000 (18:24 +0200)]
ALSA: usb-audio: Pre-calculate buffer byte size
There are a bunch of lines calculating the buffer size in bytes at
each time. Keep the value in subs->buffer_bytes and use it
consistently for the code simplicity.
Link: https://lore.kernel.org/r/20210601162457.4877-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 1 Jun 2021 16:24:53 +0000 (18:24 +0200)]
ALSA: usb-audio: Make snd_usb_pcm_delay() static
It's a local function, let's make it static.
Link: https://lore.kernel.org/r/20210601162457.4877-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Wed, 2 Jun 2021 01:34:06 +0000 (10:34 +0900)]
ALSA: firewire-motu: sequence replay for source packet header
This commit takes ALSA firewire-motu driver to perform sequence replay for
media clock recovery.
Unlike the other types of device, the devices in MOTU FireWire series
require two levels of sequence replay; the sequence of the number of
data blocks per packet and the sequence of source packet header per data
block. The former is already cached by ALSA IEC 61883-1/6 packet streaming
engine and ready to be replayed. The latter is also cached by ALSA
firewire-motu driver itself with a previous patch. This commit takes
the driver to replay both of them from the caches.
The sequence replay is tested with below models:
* 828 mkII
* Traveler
* UltraLite
* 828 mk3 FireWire
* 828 mk3 Hybrid (except for high sampling transfer frequency
* UltraLite mk3 FireWire
* 4pre
* AudioExpress
Unfortunately, below models still don't generate better sound, requires
more work:
* 8pre
* 828 mk3 Hybrid at high sampling transfer frequency
As long as I know, MOTU protocol version 1 requires extra care of the
format of data block, thus below models are not supported yet in this
time:
* 828
* 896
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210602013406.26442-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Wed, 2 Jun 2021 01:34:05 +0000 (10:34 +0900)]
ALSA: firewire-motu: cache event ticks in source packet header per data block
The devices in MOTU FireWire series put source packet header (SPH) into
each data block of tx packet for presentation time of event. The format
of timestamp is compliant to IEC 61883-1, with cycle and offset fields
without sec field of 32 bit cycle time.
This commit takes ALSA firewire-motu driver to cache the presentation
time as offset from cycle in which the packet is transferred.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210602013406.26442-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Wed, 2 Jun 2021 01:34:04 +0000 (10:34 +0900)]
ALSA: firewire-motu: use macro for magic numbers relevant to IEC 61883-1
ALSA firewire-motu driver has some magic numbers from IEC 61883-1 to
operates source packet header (SPH). This commit replaces them with
macros.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210602013406.26442-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Tue, 1 Jun 2021 08:17:53 +0000 (17:17 +0900)]
ALSA: bebob: perform sequence replay for media clock recovery
This commit takes ALSA bebob driver to perform sequence replay for media
clock recovery.
Many users have reported discontinuity of data block counter field of CIP
header in tx packet from the devices based on BeBoB ASICs. In the worst
case, the device corrupts not to respond to any transaction, then generate
bus-reset voluntarily for recovery. The sequence replay for media clock
recovery is expected to suppress most of the problems.
In the beginning of packet streaming, the device transfers NODATA packets
for a while, then multiplexes any event and syt information. ALSA
IEC 61883-1/6 packet streaming engine has implementation for it to drop
the initial NODATA packets. It starts sequence replay when detecting any
event multiplexed to tx packets.
The sequence replay is tested with below models:
* Focusrite Saffire
* Focusrite Saffire LE
* Focusrite Saffire Pro 10 I/O
* Focusrite Saffire Pro 26 I/O
* M-Audio FireWire Solo
* M-Audio FireWire Audiophile
* M-Audio Ozonic
* M-Audio FireWire 410
* M-Audio FireWire 1814
* Edirol FA-66
* ESI Quatafire 610
* Apogee Ensemble
* Phonic Firefly 202
* Behringer F-Control Audio 610
Unfortunately, below models doesn't generate sound. This seems regression
introduced recent few years:
* Stanton Final Scratch ScratchAmp at middle sampling transfer frequency
* Yamaha GO44
* Yamaha GO46
* Terratec Phase x24
As I reported, below model has quirk of discontinuity:
* M-Audio ProFire Lightbridge
DM1000/DM1100 ASICs in BeBoB solution are known to have bugs at switch of
sampling transfer frequency between low/middle/high rates. The switch
generates the similar problems about which I mention in the above. Some
vendors customizes firmware so that the switch of frequency is done in
vendor-specific registers, then restrict users to switch the frequency.
For example of Focusrite Saffire Pro 10 i/o and 26 i/o, users allows to
switch the frequency within the three steps; e.g. 44.1/48.0 kHz are
available at low step. Between the steps, extra operation is required and
it always generates bus-reset.
Another example of Edirol FA-66, users are prohibited to switch the
frequency by software. It's done by hardware switch and power-off.
I note that the sequence replay is not a solution for the ASIC bugs. Users
need to disconnect the device corrupted by the bug, then reconnect it to
refresh state machine inner the ASIC.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210601081753.9191-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Tue, 1 Jun 2021 08:17:52 +0000 (17:17 +0900)]
ALSA: dice: perform sequence replay for media clock recovery
This commit takes ALSA dice driver to perform sequence replay for media
clock recovery.
Unlike the other types of device, DICE-based devices interpret the value
of syt field of CIP header in rx packets as presentation time for audio
playback, thus it's required for driver to compute value for outgoing
packet adequate to the device. It's done by media clock recovery by
handling tx packets.
The device starts packet transmission immediately at operation to
GLOBAL_ENABLE thus on-the-fly mode is not required.
DICE ASICs supports several pairs of isochronous packet streams.
Actually, maximum two pairs of streams are supported by devices.
We have three cases regarding to the number of streams:
1. a pair of streams
2. two tx packet streams and one rx packet streams
3. one tx packet streams and two rx packet streams
4. two pair of streams
The decision of playback timing is slightly different in the four cases.
In the case 1, sequence replay in the pair results in suitable playback
timing.
In the case 2, sequence replay from the first tx packet stream to rx
packet stream results in suitable playback timing.
In the case 3, sequence replay from tx packet stream to all of rx packet
stream results in suitable playback timing. Furthermore, the cycle to
start receiving packets should be the same between all rx packet streams.
In the case 4, sequence replay in each pair results in suitable playback
timing. Furthermore, the cycle to start receiving packets should be the
same between all rx packet streams.
The sequence replay is tested with below models:
* For case 1:
* TC Electronic Konnekt 24d (DiceII)
* TC Electronic Konnekt 8 (DiceII)
* TC Electronic Konnekt Live (DiceII)
* TC Electronic Impact Twin (DiceII)
* TC Electronic Digital Konnekt X32 (DiceII)
* TC Electronic Desktop Konnekt 6 (TCD2220)
* Solid State Logic Duende Classic (DiceII)
* Solid State Logic Duende Mini (DiceII)
* PreSonus FireStudio Project (TCD2210)
* PreSonus FireStudio Mobile (TCD2210)
* Lexicon I-ONIX FW810s (TCD2220)
* Avid Mbox 3 Pro (TCD2220)
* For case 2 (but case 1 depends on sampling transfer frequency):
* Alesis iO 26 (DiceII)
* Alesis iO 14 (DiceII)
* Alesis MultiMix 12 FireWire (DiceII)
* Focusrite Saffire Pro 26 (TCD2220)
* For case 3 (but case 1 depends on sampling transfer frequency):
* M-Audio Profire 610 (TCD2220)
* Loud Technology Mackie Onyx Blackbird (TCD2210)
* For case 4:
* TC Electronic Studio Konnekt 48 (DiceII + TCD2220)
* PreSonus FireStudio (DiceII)
* M-Audio Profire 2626 (TCD2220)
* Focusrite Liquid Saffire 56 (TCD2220)
* Focusrite Saffire Pro 40 (TCD2220)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210601081753.9191-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Tue, 1 Jun 2021 08:17:51 +0000 (17:17 +0900)]
ALSA: dice: wait just for NOTIFY_CLOCK_ACCEPTED after GLOBAL_CLOCK_SELECT operation
NOTIFY_CLOCK_ACCEPTED notification is always generated as a result of
GLOBAL_CLOCK_SELECT operation, however NOTIFY_LOCK_CHG notification
doesn't, as long as the selected clock is already configured. In the case,
ALSA dice driver waits so long. It's inconvenient for some devices to lock
to the sequence of value in syt field of CIP header in rx packets.
This commit wait just for NOTIFY_CLOCK_ACCEPTED notification by reverting
changes partially done by two commits below:
* commit
fbeac84dbe9e ("ALSA: dice: old firmware optimization for Dice notification")
* commit
aec045b80d79 ("ALSA: dice: change notification mask to detect lock status change")
I note that the successful lock to the sequence of value in syt field of
CIP header in rx packets results in NOTIFY_EXT_STATUS notification, then
EXT_STATUS_ARX1_LOCKED bit stands in GLOBAL_EXTENDED_STATUS register.
The notification can occur enough after receiving the batch of rx packets.
When the sequence doesn't include value in syt field of CIP header in rx
packets adequate to the device, the notification occurs again and the bit
is off.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210601081753.9191-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Carlos M [Mon, 31 May 2021 20:20:26 +0000 (22:20 +0200)]
ALSA: hda: Fix for mute key LED for HP Pavilion 15-CK0xx
For the HP Pavilion 15-CK0xx, with audio subsystem ID 0x103c:0x841c,
adding a line in patch_realtek.c to apply the ALC269_FIXUP_HP_MUTE_LED_MIC3
fix activates the mute key LED.
Signed-off-by: Carlos M <carlos.marr.pz@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210531202026.35427-1-carlos.marr.pz@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stefan Binding [Mon, 31 May 2021 16:37:54 +0000 (17:37 +0100)]
ALSA: hda/cirrus: Set Initial DMIC volume to -26 dB
Previously this fix was applied only to Bullseye variant laptops,
and should be applied to Cyborg and Warlock variants.
Fixes:
45b14fe200ba ("ALSA: hda/cirrus: Use CS8409 filter to fix abnormal sounds on Bullseye")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210531163754.136736-1-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 31 May 2021 02:51:03 +0000 (11:51 +0900)]
ALSA: fireface: perform sequence replay for media clock recovery
This commit takes ALSA fireface driver to perform sequence replay for
media clock recovery.
The protocol specific to RME Fireface series is not compliant to
IEC 61883-1/6 since it has no CIP header, therefore presentation time
is not used for media clock recovery. The sequence of the number of data
blocks per packet is important.
I note that the device skips an isochronous cycle corresponding to an
empty packet or a NODATA packet in blocking transmission method of
IEC 61883-1/6. For sequence replay, the cycle is handled as receiving an
empty packet. Furthermore, it doesn't start packet transmission till
receiving any packet.
The sequence replay is tested with below models:
* Fireface 400
* Fireface 800
* Fireface 802
I note that it is better to initialize Fireface 400 in advance by
initialization transaction implemented in snd-fireface-ctl-service of
snd-firewire-ctl-services project. You can see whether initialized or
not by HOST LED on the device. Unless, the device often stops packet
transmission even if session starts.
I guess the sequence replay also works well with below models:
* Fireface UFX
* Fireface UCX
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 31 May 2021 02:51:02 +0000 (11:51 +0900)]
ALSA: firewire-tascam: perform sequence replay for media clock recovery
This commit takes ALSA firewire-tascam driver to perform sequence replay
for media clock recovery.
The protocol specific to Tascam FireWire series is not compliant to
IEC 61883-1/6 in terms of syt field of CIP. The protocol doesn't use
presentation time in received CIP for playback timing. The sequence of
the number of data blocks per packet is important for media clock
recovery.
Although the devices in Tascam FireWire series transfer packets
regardless of receiving packets, the tx packets includes no events
in the beginning of streaming. It takes so long to multiplex any event
into the packet after receiving the sequence of packets. As long as I
experienced, it takes several thousands of isochronous cycle. Furthermore,
just after changing sampling transmission frequency, it stops multiplexing
event at once, then starts multiplexing again.
The sequence replay is tested with below models:
* FW-1884
* FW-1804
* FW-1082
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 31 May 2021 02:51:01 +0000 (11:51 +0900)]
ALSA: firewire-digi00x: perform sequence replay for media clock recovery
This commit takes ALSA firewire-digi00x driver to perform sequence replay
for media clock recovery.
All of models in Digidesign digi00x family don't transfer isochronous
packets till receiving isochronous packets. The on-the-fly mode is used
for the purpose. They don't interpret presentation time expressed in syt
field of received CIP, therefore the sequence of the number of data blocks
per packet is important for media clock recovery.
The sequence replay is tested with below models:
* Digidesign Digi 002
* Digidesign Digi 002 Rack
* Digidesign Digi 003
* Digidesign Digi 003 Rack
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 31 May 2021 02:51:00 +0000 (11:51 +0900)]
ALSA: oxfw: perform sequence replay for media clock recovery
This commit takes ALSA oxfw driver to perform sequence replay for media
clock recovery. Unfortunately, OXFW970 ASIC and its firmware has a quirk
called jumbo payload which skips several isochronous cycles for packet
transmission, thus the sequence replay is just adopted to OXFW971 ASIC.
As well as Fireworks, OXFW ASICs also ignores presentation time against
the way in IEC 61883-1/6.
The sequence replay is tested with below models:
* Tascam FireOne
* Stanton Magnetics SCS.1m
* Apogee Duet FireWire
For below models, the sequence replay is tested to be disabled:
* Griffin FireWave
* Behringer F-Control Audio 202
* Loud Technology Tapco Link.FireWire 4x6
* Loud Technology Mackie Onyx Satellite
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 31 May 2021 02:50:59 +0000 (11:50 +0900)]
ALSA: fireworks: perform sequence replay for media clock recovery
Echo Digital Audio Corporation had US patent US7599388B2 titled as
'System and method for high-bandwidth serial bus data transfer'. In the
patent, dual-banked shared memory is used to deliver data between
serial bus transmission and processor in FIFO way. The patent seems to be
used for Fireworks board module. The mechanism is not compliant to
synchronization based on presentation time expressed in syt field
of CIP header. Fireworks board module takes care of the sequence of
the number of data blocks per packet and just ignores the value of syt
field.
This commit takes fireworks driver to performs sequence replay for media
clock recovery. As long as I tested, Audiofire 2 and 4 have a quirk to
skip an isochronous cycle several thousands after starting packet
transmission.
The sequence replay is tested with below models:
* Loud Technology Mackie 400f
* Echo Audio Audiofire 12 (DSP model)
* Echo Audio Audiofire 12 (FPGA model)
* Echo Audio Audiofire 8 (DSP model)
* Echo Audio Audiofire 8 (FPGA model)
* Echo Audio Audiofire Pre8
* Echo Audio Audiofire 4
* Echo Audio Audiofire 2
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 31 May 2021 02:50:58 +0000 (11:50 +0900)]
ALSA: fireworks: delete SYTMATCH clock source
In the design of Fireworks board module, the device does't adjust its
media clock voluntarily by the sequence of presentation time expressed in
syt field of CIP header of received packet.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 31 May 2021 18:06:33 +0000 (20:06 +0200)]
ALSA: hda: Fix a regression in Capture Switch mixer read
The recent commit to drop the HDA-specific mute-LED control,
e65bf99718b5 ("ALSA: HDA - remove the custom implementation for the
audio LED trigger"), caused a regression on the mixer element read for
"Capture Switch" when it's built from bind controls. The function
create_bind_cap_vol_ctl() creates the snd_kcontrol_new object directly
via snd_hda_gen_add_kctl() instead of add_control(). Although the
commit above added a workaround for the SNDRV_CTL_ACCESS_READWRITE in
add_control() as default, this code path fell out from the radar. As
a result, now the driver gives -EPERM error because of the lack of the
proper access bit at reading "Capture Switch" element value.
Fix the regression by setting the access bit properly.
Fixes:
e65bf99718b5 ("ALSA: HDA - remove the custom implementation for the audio LED trigger")
BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1186634
Link: https://lore.kernel.org/r/20210531180633.27831-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Kai Vehmanen [Fri, 28 May 2021 18:51:23 +0000 (21:51 +0300)]
ALSA: hda: Add AlderLake-M PCI ID
Add HD Audio PCI ID for Intel AlderLake-M. Add rules to
snd_intel_dsp_find_config() to choose SOF driver for ADL-M systems with
PCH-DMIC or Soundwire codecs, and legacy driver for the rest.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210528185123.48332-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Shaokun Zhang [Sat, 29 May 2021 09:02:06 +0000 (17:02 +0800)]
ALSA: usb-audio: Remove the repeated declaration
Function 'snd_usb_endpoint_suspend' is declared twice, so remove the
repeated declaration.
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Link: https://lore.kernel.org/r/1622278926-63857-1-git-send-email-zhangshaokun@hisilicon.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
YueHaibing [Wed, 26 May 2021 12:18:28 +0000 (20:18 +0800)]
ALSA: core: use DEVICE_ATTR_*() macro
Use DEVICE_ATTR_*() helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210526121828.8460-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Thu, 27 May 2021 12:32:53 +0000 (21:32 +0900)]
ALSA: firewire-lib: support NO_PERIOD_WAKEUP in ALSA PCM runtime
Drivers of ALSA firewire stack can process packets for IT/IR context in
process context when the process operates ALSA PCM character device by
calling ioctl(2) with some requests. The ioctl requests are:
* SNDRV_PCM_IOCTL_HWSYNC
* SNDRV_PCM_IOCTL_SYNC_PTR
* SNDRV_PCM_IOCTL_REWIND
* SNDRV_PCM_IOCTL_FORWARD
* SNDRV_PCM_IOCTL_WRITEI_FRAMES
* SNDRV_PCM_IOCTL_READI_FRAMES
* SNDRV_PCM_IOCTL_WRITEN_FRAMES
* SNDRV_PCM_IOCTL_READN_FRAMES
This means that general application can process PCM frames apart from
hardware IRQ invocation, even if they are programmed by either IRQ-based
scheduling model or Timer-based scheduling model.
This commit add support for Timer-based scheduling model by allowing
PCM runtime to suppress both process wakeup per period and scheduling
hardware IRQ.
SNDRV_PCM_INFO_BATCH is obsoleted since ALSA IEC 61883-1/6 packet streaming
engine can report the number of transferred PCM frames within PCM period
boundary. The granularity equals to SYT_INTERVAL in blocking transmission.
In non-blocking transmission, it doesn't equal to SYT_INTERVAL but doesn't
exceed.
This patch is tested with PulseAudio, and --sched-model option of axfer
with fix against the issue reported at:
* https://lore.kernel.org/alsa-devel/
687f9871-7484-1370-04d1-
9c968e86f72b@linux.intel.com/#r
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210527123253.174315-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Thu, 27 May 2021 12:26:11 +0000 (21:26 +0900)]
ALSA: firewire-lib: transfer rx packets on-the-fly when replaying
Models in below series start transmission of packet after receiving the
sequence of packets:
* Digidesign Digi00x family
* RME Fireface series
Additionally, models in Tascam FireWire series start multiplexing PCM
frames into packets enough after receiving packets. It's required to
transfer packets on-the-fly for the above models according to nominal
sampling transfer frequency before starting sequence replay.
This commit allows drivers to decide whether the engine transfers packet
on-the-fly or not.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210527122611.173711-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Thu, 27 May 2021 12:26:10 +0000 (21:26 +0900)]
ALSA: firewire-lib: replay sequence of incoming packets for outgoing packets
ALSA IEC 61883-1/6 packet streaming engine uses pre-computed parameters
ideal for nominal sampling transfer frequency (STF) to transfer packets
to device since it was added 2011. As a result of user experience for a
decade, it is clear that the sequence is not suitable to some actual
devices. It takes the devices to generate noise, and causes any type of
discontinuity in the series of packet transferred from the device. It's
required for the engine to transfer packets according to effective STF.
The effective STF is given by media clock recovered by the sequence of
packet transferred from the target device. In the previous commit, the
sequence is already cached. The media clock recovery can be achieved by
analyzing the sequence.
In technological world, many ideas are proposed for media clock recovery.
However, the small part of them could be actually adopted in our case
since floating point arithmetic is not mostly available in Linux kernel
land.
This commit adopts the simple way from them; sequence replay, which means
that the sequence of parameters from incoming packet is used as is to
transfer outgoing packets. The media clock is not computed internally,
but the sequence of outgoing packet superficially looks to be generated by
the media clock.
The association between source and destination is decided when starting
AMDTP domain. When the target device supports a pair of isochronous packet
streams, the tx stream is source and the rx stream is destination. When it
supports two pair of streams, each of tx stream is associated to
corresponding rx stream in its order. When it supports less number of tx
streams than rx streams, the fist tx stream is selected for all of rx
streams. When it supports more tx streams than rx streams, the first tx
packet is associated to the rx stream.
As I noted in previous commit, the sequence of parameters from incoming
packet is different between devices, time to time. It is worse idea to
replay the sequence of parameters from a device for the sequence of
packet to the other devices even if they are in the same category of
device.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210527122611.173711-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Thu, 27 May 2021 12:26:09 +0000 (21:26 +0900)]
ALSA: firewire-lib: add replay target to cache sequence of packet
In design of audio and music unit in IEEE 1394 bus, feedback of
effective sampling transfer frequency (STF) is delivered by packets
transferred from device. The devices supported by ALSA firewire stack
are categorized to three groups regarding to it.
* Group 1:
* Echo Audio Fireworks board module
* Oxford Semiconductor OXFW971 ASIC
* Digidesign Digi00x family
* Tascam FireWire series
* RME Fireface series
* Group 2:
* BridgeCo. DM1000/DM1100/DM1500 ASICs for BeBoB solution
* TC Applied Technologies DICE ASICs
* Group 3:
* Mark of the Unicord FireWire series
In group 1, the effective STF is determined by the sequence of the number
of events per packet. In group 2, the sequence of presentation timestamp
expressed in syt field of CIP header is interpreted as well. In group 3,
the presentation timestamp is expressed in source packet header (SPH) of
each data block.
I note that some models doesn't take care of effective STF with large
internal buffer. It's reasonable to name it as group 0:
* Group 0
* Oxford Semiconductor OXFW970 ASIC
The effective STF is known to be slightly different from nominal STF for
all of devices, and to be different between the devices. Furthermore, the
effective STF is known to be shifted for long-period transmission. This
makes it hard for software to satisfy the effective STF when processing
packets to the device.
The effective STF is deterministic as a result of analyzing the batch of
packet transferred from the device. For the analysis, caching the sequence
of parameter in the packet is required.
This commit adds an option so that AMDTP domain structure takes AMDTP
stream structure to cache the sequence of parameters in packet transferred
from the device. The parameters are offset ticks of syt field against the
cycle to receive the packet and the number of data blocks per packet.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210527122611.173711-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Colin Ian King [Wed, 26 May 2021 16:06:16 +0000 (17:06 +0100)]
ALSA: hda/ca0132: Make a const array static, makes object smaller
Don't populate the const array dsp_dma_stream_ids the stack but instead
make it static. Makes the object code smaller by 21 bytes.
Before:
text data bss dec hex filename
189012 70376 192 259580 3f5fc ./sound/pci/hda/patch_ca0132.o
After:
text data bss dec hex filename
188927 70440 192 259559 3f5e7 ./sound/pci/hda/patch_ca0132.o
(gcc version 10.3.0)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210526160616.3764119-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Pierre-Louis Bossart [Wed, 26 May 2021 19:29:57 +0000 (14:29 -0500)]
ALSA: pci: lx6464es: remove useless self-comparison
Sparse throws the following warning:
sound/pci/lx6464es/lx_core.c:677:34: error: self-comparison always
evaluates to false
This comparison and error message make no sense, let's remove them.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210526192957.449515-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Pierre-Louis Bossart [Wed, 26 May 2021 19:29:56 +0000 (14:29 -0500)]
ALSA: drivers: opl3: fix useless self-comparison
Sparse throws the following warning:
sound/drivers/opl3/opl3_midi.c:183:60: error: self-comparison always
evaluates to false
This is likely a 16+ year old confusion between vp2 and vp.
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210526192957.449515-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
zuoqilin [Thu, 27 May 2021 03:04:45 +0000 (11:04 +0800)]
sound/oss/dmasound: Remove superfluous "break"
Remove superfluous "break", as there is a "return" before them.
Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Link: https://lore.kernel.org/r/20210527030445.1201-1-zuoqilin1@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Wed, 19 May 2021 17:03:56 +0000 (01:03 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook Fury 17 G8
The HP ZBook Studio 17.3 Inch G8 is using ALC285 codec which is
using 0x04 to control mute LED and 0x01 to control micmute LED.
In the other hand, there is no output from right channel of speaker.
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/20210519170357.58410-4-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Wed, 19 May 2021 17:03:55 +0000 (01:03 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook Fury 15 G8
The HP ZBook Fury 15.6 Inch G8 is using ALC285 codec which is
using 0x04 to control mute LED and 0x01 to control micmute LED.
In the other hand, there is no output from right channel of speaker.
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/20210519170357.58410-3-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Wed, 19 May 2021 17:03:54 +0000 (01:03 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook G8
The HP ZBook Studio 15.6 Inch G8 is using ALC285 codec which is
using 0x04 to control mute LED and 0x01 to control micmute LED.
In the other hand, there is no output from right channel of speaker.
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/20210519170357.58410-2-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jeremy Szu [Wed, 19 May 2021 17:03:53 +0000 (01:03 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP 855 G8
The HP EliteBook 855 G8 Notebook PC is using ALC285 codec which needs
ALC285_FIXUP_HP_MUTE_LED fixup to make it works. After applying the
fixup, the mute/micmute LEDs work good.
Signed-off-by: Jeremy Szu <jeremy.szu@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210519170357.58410-1-jeremy.szu@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Peter Ujfalusi [Mon, 24 May 2021 20:37:26 +0000 (23:37 +0300)]
ALSA: hda/realtek: Chain in pop reduction fixup for ThinkStation P340
Lenovo ThinkStation P340 uses ALC623 codec (SSID 17aa:1048) and it produces
bug plock/pop noise over line out (green jack on the back) which can be
fixed by applying ALC269_FIXUP_NO_SHUTUP tot he machine.
Convert the existing entry for the same SSID to chain to apply this fixup
as well.
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210524203726.2278-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
YueHaibing [Sun, 23 May 2021 07:11:09 +0000 (15:11 +0800)]
ALSA: control_led - use DEVICE_ATTR_*() macro
Use DEVICE_ATTR_*() helper instead of plain DEVICE_ATTR,
which makes the code a bit shorter and easier to read.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210523071109.28940-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
YueHaibing [Mon, 24 May 2021 12:00:07 +0000 (20:00 +0800)]
ALSA: pcm: use DEVICE_ATTR_RO macro
Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210524120007.39728-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Yufen Yu [Mon, 24 May 2021 09:38:11 +0000 (05:38 -0400)]
ALSA: ac97: fix PM reference leak in ac97_bus_remove()
pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Link: https://lore.kernel.org/r/20210524093811.612302-1-yuyufen@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 25 May 2021 06:58:01 +0000 (08:58 +0200)]
Merge tag 'asoc-fix-v5.13-rc3' of https://git./linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.13
A collection of fixes that have come in since the merge window, mainly
device specific things. The fixes to the generic cards from
Morimoto-san are handling regressions that were introduced in the merge
window on at least the Kontron sl28-var3-ads2.
zuoqilin [Mon, 24 May 2021 07:00:28 +0000 (15:00 +0800)]
sound/oss/dmasound: Remove superfluous "break"
Remove superfluous "break", as there is a "return" before them.
Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Link: https://lore.kernel.org/r/20210524070028.45-1-zuoqilin1@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 24 May 2021 03:13:46 +0000 (12:13 +0900)]
ALSA: bebob: distinguish M-Audio ProFire Lightbridge quirk
In former commit, ALSA IEC 61883-1/6 packet streaming engine drops
initial tx packets till the packet includes any event. This allows ALSA
bebob driver not to give option to skip initial packet since the engine
does drop the initial packet.
However, M-Audio ProFire Lightbridge has a quirk to stop packet
transmission after start multiplexing event to the packet. After several
thousands cycles, it restart packet transmission again.
This commit specializes the usage of initial skip option for the model.
Additionally, this commit expands timeout enough to wait processing
content of tx packet.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210524031346.50539-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 24 May 2021 03:13:45 +0000 (12:13 +0900)]
ALSA: bebob: cancel switching connection order
The order to establish connection seems to be meaningless.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210524031346.50539-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 24 May 2021 03:13:44 +0000 (12:13 +0900)]
ALSA: firewire-lib: obsolete callbacked member
The member of callbacked in AMDTP stream structure is not used anymore.
Instead, ready_processing member is used to wake up yielding task of user
process.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210524031346.50539-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Mon, 24 May 2021 03:13:43 +0000 (12:13 +0900)]
ALSA: firewire-lib: drop initial NODATA or empty packet
The devices based on BeBoB ASICs or the devices in Tascam FireWire
series transfer a batch of NODATA packet or empty packet in the beginning
of packet streaming. To avoid processing them, current implementation uses
an option to skip processing content of tx packet during some initial
cycles. However, the hard-coded number is not enough useful.
This commit drops content of packets till the packet includes any event
firstly. The function of option is to skip processing content of tx packet
with any event after dropping.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210524031346.50539-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 25 May 2021 06:50:03 +0000 (08:50 +0200)]
Merge branch 'topic/pci-rescan-prep-v2' into for-next
Pull PCI rescan prep work.
Link: https://lore.kernel.org/r/20210523090920.15345-1-tiwai@suse.de
Takashi Iwai [Sun, 23 May 2021 09:09:20 +0000 (11:09 +0200)]
ALSA: pcm: Block the release until the system resume finishes
The normal PCM operations are already blocked during the card power
off state in the PCM common ioctl handler, but the release isn't
covered. As the PCM stream release may also access the hardware,
let's block the release until the card power turns on.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 23 May 2021 09:09:19 +0000 (11:09 +0200)]
ALSA: Drop superfluous argument from snd_power_wait()
The power_state argument of snd_power_wait() is superfluous, receiving
only SNDRV_POWER_STATE_D0. Let's drop it in all callers for
simplicity.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210523090920.15345-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 23 May 2021 09:09:18 +0000 (11:09 +0200)]
ALSA: control: Minor optimization for SNDRV_CTL_IOCTL_POWER_STATE
Long long time ago, before the proper PM framework was introduced, it
was still possible to reach SNDRV_CTL_IOCTL_POWER ioctl during the
power off state. This ioctl existed as a main control for the suspend
resume state in the past, but the feature was already dropped along
with the standard PM framework. Now the read part,
SNDRV_IOCTL_POWER_STATE ioctl, returns practically always D0, and we
can do some minor optimization there.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 23 May 2021 09:09:17 +0000 (11:09 +0200)]
ALSA: control: Drop superfluous snd_power_wait() calls
Now we have more fine-grained power controls in each kcontrol ops, the
coarse checks of snd_power_wait() in a few control ioctls became
superfluous. Let's drop them.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 23 May 2021 09:09:16 +0000 (11:09 +0200)]
ALSA: control: Track in-flight control read/write/tlv accesses
Although the power state check is performed in various places (e.g. at
the entrance of quite a few ioctls), there can be still some pending
tasks that already went into the ioctl handler or other ops, and those
may access the hardware even after the power state check. For
example, kcontrol access ioctl paths that call info/get/put callbacks
may update the hardware registers. If a system wants to assure the
free from such hw access (like the case of PCI rescan feature we're
going to implement in future), this situation must be avoided, and we
have to sync such in-flight tasks finishing beforehand.
For that purpose, this patch introduces a few new things in core code:
- A refcount, power_ref, and a wait queue, power_ref_sleep, to the
card object
- A few new helpers, snd_power_ref(), snd_power_unref(),
snd_power_ref_and_wait(), and snd_power_sync_ref()
In the code paths that call kctl info/read/write/tlv ops, we check the
power state with the newly introduced snd_power_ref_and_wait(). This
function also takes the card.power_ref refcount for tracking this
in-flight task. Once after the access finishes, snd_power_unref() is
called to released the refcount in return. So the driver can sync via
snd_power_sync_ref() assuring that all in-flight tasks have been
finished.
As of this patch, snd_power_sync_ref() is called only at
snd_card_disconnect(), but it'll be used in other places in future.
Note that atomic_t is used for power_ref intentionally instead of
refcount_t. It's because of the design of refcount_t type; refcount_t
cannot be zero-based, and it cannot do dec_and_test() call for
multiple times, hence it's not suitable for our purpose.
Also, this patch changes snd_power_wait() to accept only
SNDRV_CTL_POWER_D0, which is the only value that makes sense.
In later patch, the snd_power_wait() calls will be cleaned up.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Sun, 23 May 2021 09:09:15 +0000 (11:09 +0200)]
ALSA: core: Use READ_ONCE() / WRITE_ONCE() for power state change
We need proper barriers to handle the power state change of the card
from different CPUs.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20210523090920.15345-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
kernel test robot [Sat, 22 May 2021 18:09:00 +0000 (02:09 +0800)]
ALSA: usb-audio: scarlett2: snd_scarlett_gen2_controls_create() can be static
sound/usb/mixer_scarlett_gen2.c:2000:5: warning: symbol 'snd_scarlett_gen2_controls_create' was not declared. Should it be static?
Fixes:
265d1a90e4fb ("ALSA: usb-audio: scarlett2: Improve driver startup messages")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210522180900.GA83915@f59a3af2f1d9
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Hui Wang [Sat, 22 May 2021 04:26:45 +0000 (12:26 +0800)]
ALSA: hda/realtek: the bass speaker can't output sound on Yoga 9i
The Lenovo Yoga 9i has bass speaker, but the bass speaker can't work,
that is because there is an i2s amplifier on that speaker, need to
run ideapad_s740_coef() to initialize the amplifier.
And also needs to apply ALC285_FIXUP_THINKPAD_HEADSET_JACK to rename
the speaker's mixer control name, otherwise the PA can't handle them.
BugLink: http://bugs.launchpad.net/bugs/1926165
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210522042645.14221-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Hui Wang [Sat, 22 May 2021 03:47:41 +0000 (11:47 +0800)]
ALSA: hda/realtek: Headphone volume is controlled by Front mixer
On some ASUS and MSI machines, the audio codec is alc1220 and the
Headphone is connected to audio mixer 0xf and DAC 0x5, in theory
the Headphone volume is controlled by DAC 0x5 (Heapdhone Playback
Volume), but somehow it is controlled by DAC 0x2 (Front Playback
Volume), maybe this is a defect on the codec alc1220.
Because of this issue, the PA couldn't switch the headphone and
Lineout correctly, If we apply the quirk CLEVO_P950 to those machines,
the Lineout and Headphone will share the audio mixer 0xc and DAC 0x2,
and generate Headphone+LO mixer, then PA could handle them when
switching between them.
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1206
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210522034741.13415-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sat, 22 May 2021 01:33:03 +0000 (10:33 +0900)]
ALSA: firewire-lib: code refactoring for transfer delay
In later commit, transfer delay is used in both IR and IT contexts. This
commit refactors regardless of transfer delay.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210522013303.49596-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>