aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-07-05ALSA: bebob: correct duplicated entries with TerraTec OUITakashi Sakamoto1-3/+2
ALSA bebob driver has duplicated entries for modalias of 'ieee1394:ven00000AACmo00000002sp0000A02Dver00010001' since entries for two devices below have the same parameters: * Acoustic Reality eAR Master One, Eroica, Figaro, and Ciaccona * TerraTec Aureon 7.1 FireWire I relied on FFADO revision 737 to add the former entry, on the other hand, the latter is based on message posted by actual user with information of sysfs node: * https://sourceforge.net/p/ffado/mailman/ffado-user/thread/5743F969.2080204%40marcobaldo.ch/ It appears that they have OUI of Terratec Electronic GmbH (0x000aac) and the same model ID, thus suffice to say that they have something common in their internals. Although it's not going to make a big difference, this commit arranges the entries. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210705111455.63788-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-20ALSA: bebob: add support for ToneWeal FW66Takashi Sakamoto1-0/+3
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-18ALSA: bebob: fix rx packet format for Yamaha GO44/GO46, Terratec Phase 24/x24Takashi Sakamoto1-2/+7
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 1bd1b3be8655 ("ALSA: bebob: perform sequence replay for media clock recovery"). Cc: <stable@vger.kernel.org> Fixes: 5c6ea94f2b7c ("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-16ALSA: bebob: Fix bit flag quirk constantsColin Ian King1-2/+2
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: 93cd12d6e88a ("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-12ALSA: bebob: correct device entries for Phonic Helix Board and FireFly seriesTakashi Sakamoto1-9/+7
Phonic shipped Helix board and FireFly series with IEEE 1394 functionality. Regarding to the parameters in unit directory, these series have two cases below: 1. the same parameters in unit directory * Firefly 202 * Firefly 302 * Firefly 808 Universal * HelixBoard 12 FireWire, 12 Universal * HelixBoard 18 FireWire, 18 Universal * HelixBoard 24 FireWire, 24 Universal 2. Unique parameters in unit directory * FireFly 808 * HelixBoard 12 FireWire MkII * HelixBoard 18 FireWire MkII * HelixBoard 24 FireWire MkII Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611093730.78254-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-12ALSA: bebob: code refactoring for M-Audio modelsTakashi Sakamoto1-17/+17
For M-Audio FireWire 410, the value of immediate entry for vendor in unit directory is the value for BridgeCo. AG OUI. It seems that M-Audio uses initial settings as is for its product. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611093730.78254-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-12ALSA: bebob: correct device entry for Acoustic Reality eAR Master One, Eroica, Figaro, and CiacconaTakashi Sakamoto1-3/+2
The value of vendor OUI is invalid. Furthermore it seems to be Terratec OEM. * http://subversion.ffado.org/wiki/AvcModels/AcousticRealityeARMasterOne Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611093730.78254-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-12ALSA: bebob: correct device entry for Mackie D.2 FireWire option cardTakashi Sakamoto1-4/+3
For Mackie D.2 FireWire option card, 0x00000f is used for the value of immediate entry for vendor in unit directory. The value comes from report by FFADO user in below page: * http://subversion.ffado.org/wiki/AvcModels/MackieD.2. However, it seems to be wrong. There are two causes; vendor's mistake to decide value for GUID field in configuration ROM against standard, as Stefan Richter mentioned in below post: * https://lore.kernel.org/alsa-devel/1443917823-13516-1-git-send-email-o-takashi@sakamocchi.jp/#t Another is implementation of libffado. The library doesn't print out the value from immediate entry for vendor in unit directory. It just print out the first 6 bytes of GUID as vendor ID. This commit replaces with correct vendor OUI. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611093730.78254-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-12ALSA: bebob: fulfil device entriesTakashi Sakamoto2-22/+17
Although unit directory in root directory of configuration ROM has the same value (0x00a02d) for its specifier_id entry to express AV/C device, it has two cases for the value (0x010001/0x014001) to version entry. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611093730.78254-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-11ALSA: bebob: code refactoring for model-dependent quirksTakashi Sakamoto3-18/+42
This commit adds enumeration and structure member as code refactoring regarding to model-dependent quirks. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611035003.26852-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-11ALSA: bebob: delete workaround for protocol version 3Takashi Sakamoto3-17/+0
In a commit c4d860a0d256 ("ALSA: bebob: loosen up severity of checking continuity for BeBoB v3 quirk"), a workaround was added for the quirk in BeBoB protocol version 3 against the discontinuity of data block counter. As long as seeing with sequence replay for media clock recovery, such quirk disappears. This commit deletes the workaround. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611035003.26852-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-11ALSA: bebob: dismiss sleep after breaking connectionsTakashi Sakamoto1-6/+0
In a commit d3eabe939aee ("ALSA: bebob: expand sleep just after breaking connections for protocol version 1"), a workaround was added for a quirk of freeze in BeBoB protocol version 1. As long as seeing with sequence replay for media clock recovery, the quirk disappears. This commit removes the workaround. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210611035003.26852-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-07ALSA: bebob: cease from delayed card registrationTakashi Sakamoto2-106/+57
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>
2021-06-01ALSA: bebob: perform sequence replay for media clock recoveryTakashi Sakamoto1-4/+9
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>
2021-05-28ALSA: firewire-lib: transfer rx packets on-the-fly when replayingTakashi Sakamoto1-1/+1
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>
2021-05-28ALSA: firewire-lib: add replay target to cache sequence of packetTakashi Sakamoto1-1/+1
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>
2021-05-25ALSA: bebob: distinguish M-Audio ProFire Lightbridge quirkTakashi Sakamoto3-6/+17
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>
2021-05-25ALSA: bebob: cancel switching connection orderTakashi Sakamoto1-11/+2
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>
2021-05-20ALSA: firewire-lib: change waking up timing to process packetsTakashi Sakamoto1-6/+2
When starting AMDTP domain, tasks in process context yields running CPU till all of isochronous context get callback, with an assumption that it's OK to process content of packet. However several isochronous cycles are skipped to transfer rx packets, or the content of rx packets are dropped, to manage the timing to start processing the packets. This commit changes the timing for tasks in process context to wake up when processing content of packet is actually ready. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210520040154.80450-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-20ALSA: firewire-lib: skip initial packets instead of scheduling IR contextTakashi Sakamoto1-13/+8
Current implementation of ALSA IEC 61883-1/6 packet streaming engine allows drivers to decide isochronous cycle to start IR context. This option is mainly used to avoid processing the sequence of packet with some quirks; e.g. discontinuity of counter. However, it's inconvenient to fail to continue packet processing when the target device doesn't start transmission of packet till the decided cycle. This commit changes the behaviour. As an alternative to the start cycle for IR context, the cycle count to drop content of packet in the beginning of IR context. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210520040154.80450-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-18Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"Takashi Sakamoto1-1/+1
This reverts commit 0edabdfe89581669609eaac5f6a8d0ae6fe95e7f. I've explained that optional FireWire card for d.2 is also built-in to d.2 Pro, however it's wrong. The optional card uses DM1000 ASIC and has 'Mackie DJ Mixer' in its model name of configuration ROM. On the other hand, built-in FireWire card for d.2 Pro and d.4 Pro uses OXFW971 ASIC and has 'd.Pro' in its model name according to manuals and user experiences. The former card is not the card for d.2 Pro. They are similar in appearance but different internally. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210518084557.102681-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-14ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 ProTakashi Sakamoto1-1/+1
Mackie d.2 has an extension card for IEEE 1394 communication, which uses BridgeCo DM1000 ASIC. On the other hand, Mackie d.4 Pro has built-in function for IEEE 1394 communication by Oxford Semiconductor OXFW971, according to schematic diagram available in Mackie website. Although I misunderstood that Mackie d.2 Pro would be also a model with OXFW971, it's wrong. Mackie d.2 Pro is a model which includes the extension card as factory settings. This commit fixes entries in Kconfig and comment in ALSA OXFW driver. Cc: <stable@vger.kernel.org> Fixes: fd6f4b0dc167 ("ALSA: bebob: Add skelton for BeBoB based devices") Fixes: ec4dba5053e1 ("ALSA: oxfw: Add support for Behringer/Mackie devices") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210513125652.110249-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-22ALSA: bebob: enable to deliver MIDI messages for multiple portsTakashi Sakamoto1-5/+7
Current implementation of bebob driver doesn't correctly handle the case that the device has multiple MIDI ports. The cause is the number of MIDI conformant data channels is passed to AM824 data block processing layer. This commit fixes the bug. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210321032831.340278-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-22ALSA: bebob: detect the number of available MIDI portsTakashi Sakamoto3-32/+89
Current implementation counts the number of input/output plugs for MIDI type and uses the count as the number of physical MIDI ports. However, the number of channels of the port represents the count. This commit fixes the bug by additional vendor-specific AVC command extension. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210321032831.340278-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-22ALSA: bebob: code refactoring for stream format detectionTakashi Sakamoto1-44/+24
ALSA bebob driver scans supported formats of packet for each direction when probing the target device. Some helper functions are used for the scanning, however its implementation is not necessarily irredundant. This commit refactors the helper functions to remove redundant codes. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210321032831.340278-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-26ALSA: bebob: remove an unnecessary condition in hwdep_read()Takashi Sakamoto1-5/+3
Drivers in ALSA firewire stack supports eventing to userspace applications via ALSA hwdep interface. All of the drivers supports stream lock events. Some of them supports their unique events according to specification of target device. ALSA bebob driver supports the stream lock event only. In the case, it's enough to check condition only in loop with process blocking. However, current implementation check it again after breaking the loop. This commit removes the redundant check. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210125140208.26318-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-08ALSA: Convert strlcpy to strscpy when return value is unusedJoe Perches1-1/+1
strlcpy is deprecated. see: Documentation/process/deprecated.rst Change the calls that do not use the strlcpy return value to the preferred strscpy. Done with cocci script: @@ expression e1, e2, e3; @@ - strlcpy( + strscpy( e1, e2, e3); This cocci script leaves the instances where the return value is used unchanged. After this patch, sound/ has 3 uses of strlcpy() that need to be manually inspected for conversion and changed one day. $ git grep -w strlcpy sound/ sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname)); sound/usb/mixer.c: return strlcpy(buf, p->name, buflen); sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen); Miscellenea: o Remove trailing whitespace in conversion of sound/core/hwdep.c Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-10-07ALSA: bebob: potential info leak in hwdep_read()Dan Carpenter1-2/+1
The "count" variable needs to be capped on every path so that we don't copy too much information to the user. Fixes: 618eabeae711 ("ALSA: bebob: Add hwdep interface") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20201007074928.GA2529578@mwanda Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-03-06ALSA: firewire: use KBUILD_MODNAME for struct driver.name instead of stringTakashi Sakamoto1-1/+1
KBUILD_MODNAME is available to name kernel modules according to its object name. This commit uses the macro instead of string for name field of struct driver since drivers in ALSA firewire stack have the same name of each object name. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200306135229.11659-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11ALSA: firewire: Drop superfluous ioctl PCM opsTakashi Iwai1-2/+0
All the PCM ioctl ops of ALSA FireWire drivers do nothing but calling the default handler. Now PCM core accepts NULL as the default ioctl ops(*), so let's drop altogether. (*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops") Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191210061145.24641-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11ALSA: firewire: Use managed buffer allocationTakashi Iwai1-8/+3
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped. Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191209192422.23902-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-07Merge branch 'for-linus' into for-nextTakashi Iwai1-0/+3
Merge 5.4-devel branch for applying the further ALSA timer fixes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-06ALSA: firewire: Convert to the common vmalloc memallocTakashi Iwai1-5/+4
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code. (*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the default mmap handler Link: https://lore.kernel.org/r/20191105151856.10785-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-04ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o seriesTakashi Sakamoto1-0/+3
For Focusrite Saffire Pro i/o, the lowest 8 bits of register represents configured source of sampling clock. The next lowest 8 bits represents whether the configured source is actually detected or not just after the register is changed for the source. Current implementation evaluates whole the register to detect configured source. This results in failure due to the next lowest 8 bits when the source is connected in advance. This commit fixes the bug. Fixes: 25784ec2d034 ("ALSA: bebob: Add support for Focusrite Saffire/SaffirePro series") Cc: <stable@vger.kernel.org> # v3.16+ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191102150920.20367-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-02ALSA: bebob: link the order of establishing connections and Syt-match clock modeTakashi Sakamoto1-29/+22
Originally BeBeB ASICs and firmware supports clock mode to synchronizing to syt field of received isoc packet. This mode is known as 'SYT Match' slightly described in IEC 61883-6 (but no detail mechanisms). In this mode, drivers can control sampling clock in device. Driver for Windows and macOS uses this feature to perform synchronization for devices on the same bus. In this mode, a plug of Music subunit for synchronization is connected to a plug of isoc unit for incoming packet streaming, then the order to establish connections is INPUT_PLUG first, OUTPUT_PLUG second. This commit implements the above. Actually each device works with its own clock for sampling, therefore the original design is hardly implemented to vendor's products. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191101131323.17300-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-02ALSA: bebob: expand delay of start for IR context just for version 3 firmwareTakashi Sakamoto1-4/+10
As long as I investigated, there's some cases about the delay for device between establishing OUTPUT_PLUG and transmitting first isoc packet. For devices which support BeBoB protocol version 1 can transmit the packet within several hundred milliseconds, while for devices which support BeBoB protocol version 3 can transmit the packet within 2 seconds. Devices with protocol version 1: * Edirol FA-66 * Yamaha GO46 * Terratec Phase x24 FW * M-Audio FireWire AudioPhile * M-Audio FireWire Solo * M-Audio FireWire 1814 * M-Audio FireWire 410 * Focusrite Saffire Pro 26 I/O Devices with protocol version 3: * M-Audio Profire Lightbridge * Behringer FCA610 * Phonic Firefly 202 At present ALSA bebob driver postpones starting IR context during 1.5 sec for all of supported devices. The delay is too long for devices with protocol version 1, while it's not enough for devices with protocol version 3. This commit improves the delay for these protocols. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191101131323.17300-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-02ALSA: bebob: expand sleep just after breaking connections for protocol version 1Takashi Sakamoto1-5/+6
As long as I investigated, some devices with BeBoB protocol version 1 can be freezed during several hundreds milliseconds after breaking connections. When accessing during the freezed time, any transaction is corrupted. In the worst case, the device is going to reboot. I can see this issue in: * Roland FA-66 * M-Audio FireWire Solo This commit expands sleep just after breaking connections to avoid the freezed time as much as possible. I note that the freeze/reboot behaviour is similar to below models: * Focusrite Saffire Pro 10 I/O * Focusrite Saffire Pro 26 I/O The above models certainly reboot after breaking connections. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191101131323.17300-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-28Merge branch 'for-linus' into for-nextTakashi Iwai1-2/+1
Back-merge the development process for catching up the HD-audio fix (and apply a new one on top of that). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-26ALSA: bebob: Fix prototype of helper function to return negative valueTakashi Sakamoto1-2/+1
A helper function of ALSA bebob driver returns negative value in a function which has a prototype to return unsigned value. This commit fixes it by changing the prototype. Fixes: eb7b3a056cd8 ("ALSA: bebob: Add commands and connections/streams management") Cc: <stable@vger.kernel.org> # v3.16+ Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191026030620.12077-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-19ALSA: firewire-lib: postpone to start IR contextTakashi Sakamoto1-1/+9
Some devices have a quirk to postpone transmission of isoc packet for several dozen or hundred isoc cycles since configured to transmit. Furthermore, some devices have a quirk to transmit isoc packet with discontinued data of its header. In 1394 OHCI specification, software allows to start isoc context with certain isoc cycle. Linux firewire subsystem has kernel API to use it as well. This commit uses the functionality of 1394 OHCI controller to handle the quirks. At present, this feature is convenient to ALSA bebob and fireface driver. As a result, some devices can be safely handled, as long as I know: - MAudio FireWire solo - MAudio ProFire Lightbridge - MAudio FireWire 410 - Roland FA-66 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-19ALSA: firewire-lib: replace ack callback to flush isoc contexts in AMDTP domainTakashi Sakamoto1-2/+2
An isoc context for AMDTP stream is flushed to queue packet by a call of pcm.ack. This commit extends this for AMDTP domain. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-19ALSA: firewire-lib: replace pointer callback to flush isoc contexts in AMDTP domainTakashi Sakamoto1-6/+8
An isoc context for AMDTP stream is flushed to queue packet by a call of pcm.pointer. This commit extends this for AMDTP domain. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-18ALSA: bebob: share PCM buffer size for both directionTakashi Sakamoto4-5/+17
This commit allows ALSA bebob driver to share PCM buffer size for both capture and playback PCM substream. When AMDTP domain starts for one of the PCM substream, buffer size of the PCM substream is stores to AMDTP domain structure. Some AMDTP streams have already run with the buffer size when another PCM substream starts, therefore the PCM substream has a constraint to its buffer size. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191017155424.885-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-18ALSA: firewire-lib: use variable size of queue for isoc packets instead of fixed sizeTakashi Sakamoto1-1/+1
The number of packets in packet buffer has been fixed number (=48) since first commit of ALSA IEC 61883-1/6 packet streaming engine. This commit allows the engine to use variable number of packets in the buffer. The size is calculated by a parameter in AMDTP domain structure surely to store the number of events in the packets of buffer. Although the value of parameter is expected to come from 'period size' parameter of PCM substream, at present 48 is still used. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191017155424.885-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-17ALSA: bebob: use the same size of period for PCM substream in AMDTP streamsTakashi Sakamoto1-12/+27
In current implementation, when opening a PCM substream, it's needed to check whether the opposite PCM substream runs. This is to assign effectual constraints (e.g. sampling rate) to opened PCM substream. The number of PCM substreams and MIDI substreams on AMDTP streams in domain is recorded in own structure. Usage of this count is an alternative of the above check. This is better because the count is incremented in pcm.hw_params earlier than pcm.trigger. This idea has one issue because it's incremented for MIDI substreams as well. In current implementation, for a case that any MIDI substream run and a PCM substream is going to start, PCM application to start the PCM substream can decide hardware parameters by restart packet streaming. Just checking the substream count can brings regression. Now AMDTP domain structure has a member for the size of PCM period in PCM substream which starts AMDTP streams in domain. When the value has zero and the substream count is greater than 1, it means that any MIDI substream starts AMDTP streams in domain. Usage of the value can resolve the above issue. This commit replaces the check with the substream count and the value for the size of PCM period. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191007110532.30270-11-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-17ALSA: bebob: register the size of PCM period to AMDTP domainTakashi Sakamoto4-4/+16
This commit is a preparation to share the size of PCM period between PCM substreams on AMDTP streams in the same domain. At this time, the size of PCM period in PCM substream which starts AMDTP streams in the same domain is recorded. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191007110532.30270-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05ALSA: bebob: support AMDTP domainTakashi Sakamoto2-35/+29
This commit adds AMDTP domain support for ALSA bebob driver. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-08Merge tag 'asoc-v5.3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linusTakashi Iwai12-24/+12
ASoC: Updates for v5.3 This is a very big update, mainly thanks to Morimoto-san's refactoring work and some fairly large new drivers. - Lots more work on moving towards a component based framework from Morimoto-san. - Support for force disconnecting muxes from Jerome Brunet. - New drivers for Cirrus Logic CS47L35, CS47L85 and CS47L90, Conexant CX2072X, Realtek RT1011 and RT1308. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-07ALSA: bebob: fix wrong reference count for stream functionality at error path of rawmidi interfaceTakashi Sakamoto1-0/+2
In IEC 61883-6, several types of sampling data can be multiplexed into payload of common isochronous packet (CIP). For typical audio and music units, PCM samples and MIDI messages are multiplexed into one packet streaming. ALSA bebob driver allows applications of rawmidi interface to start packet streaming for transmission of MIDI messages. However at error path, the reference count of stream functionality is not operated correctly. This can brings a bug that packet streaming is not stopped when all referrers release the count. This commit fixes the bug. Fixes: ac2888b958f2 ("ALSA: bebob: configure sampling transfer frequency in pcm.hw_params callback") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-21ALSA: bebob: ensure to release isochronous resources in pcm.hw_params callbackTakashi Sakamoto1-0/+3
When stopping packet streaming in reserve function for duplex streams, isochronous resources should be released. Fixes: 7bc93821a70a ("ALSA: firewire-lib: split allocation of isochronous resources from establishment of connection") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>