aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman1-0/+1
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-22ALSA: firewire: add const qualifier to identifiers for read-only symbolsTakashi Sakamoto5-7/+7
Drivers in ALSA firewire stack still includes some symbols which can be moved to a section for read-only symbols. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-08ALSA: firewire: arrange common PCM info/constraints for AMDTP engine applicationsTakashi Sakamoto1-21/+0
In ALSA firewire stack, 8 drivers uses IEC 61883-1/6 engine for data transmission. They have common PCM info/constraints and duplicated codes. This commit unifies the codes into fireiwre-lib. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-07ALSA: firewire: process packets in 'struct snd_pcm_ops.ack' callbackTakashi Sakamoto1-0/+16
In recent commit for ALSA PCM core, some arrangement is done for 'struct snd_pcm_ops.ack' callback. This is called when appl_ptr is explicitly moved in intermediate buffer for PCM frames, except for some cases described later. For drivers in ALSA firewire stack, usage of this callback has a merit to reduce latency between time of PCM frame queueing and handling actual packets in recent isochronous cycle, because no need to wait for software IRQ context from isochronous context of OHCI 1394. If this works well in a case that mapped page frame is used for the intermediate buffer, user process should execute some commands for ioctl(2) to tell the number of handled PCM frames in the intermediate buffer just after handling them. Therefore, at present, with a combination of below conditions, this doesn't work as expected and user process should wait for the software IRQ context as usual: - when ALSA PCM core judges page frame mapping is available for status data (struct snd_pcm_mmap_status) and control data (struct snd_pcm_mmap_control). - user process handles PCM frames by loop just with 'snd_pcm_mmap_begin()' and 'snd_pcm_mmap_commit()'. - user process uses PCM hw plugin in alsa-lib to operate I/O without 'sync_ptr_ioctl' option. Unfortunately, major use case include these three conditions. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-30ALSA: declare snd_kcontrol_new structures as constBhumika Goyal1-4/+4
Declare snd_kcontrol_new structures as const as they are only passed an argument to the function snd_ctl_new1. This argument is of type const, so snd_kcontrol_new structures having this property can be made const. Done using Coccinelle: @r disable optional_qualifier@ identifier x; position p; @@ static struct snd_kcontrol_new x@p={...}; @ok@ identifier r.x; position p; @@ snd_ctl_new1(&x@p,...) @bad@ position p != {r.p,ok.p}; identifier r.x; @@ x@p @depends on !bad disable optional_qualifier@ identifier r.x; @@ +const struct snd_kcontrol_new x; Cross compiled these files: sound/aoa/codecs/tas.c - powerpc sound/mips/{hal2.c/sgio2audio.c} - mips sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc sound/soc/sh/siu_dai.c - sh Could not find an architecture to compile sound/sh/aica.c. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-22ALSA: firewire: remove support for 16 bit PCM samples in playback substreamTakashi Sakamoto1-4/+0
In IEC 61883-6, AM824 is described as format of data block. In this format, one data block consists of several data channels, which is aligned to 32 bit. One data channel has 8 bit label field and 24 bit data field. PCM frames are transferred in Multi Bit Linear Audio (MBLA) data channel. This channel can include 16/20/24 bit PCM sample. As long as I know, models which support IEC 61883-1/6 doesn't allow to switch bit length of PCM sample in MBLA data channel. They always transmit/receive PCM frames of 24 bit length. This can be seen for the other models which support protocols similar to IEC 61883-1/6. On the other hand, current drivers for these protocols supports 16 bit length PCM sample in playback substream. In this case, PCM sample is put into the MBLA data channel with 8 bit padding in LSB side. Although 16 bit PCM sample is major because it's in CD format, this doesn't represent device capability as is. This commit removes support for 16 bit PCM samples in playback substream. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-04-05ALSA: firewire-lib/bebob/oxfw: improve response evaluation for AV/C commandsTakashi Sakamoto1-8/+22
In ALSA firewire stack, some AV/C commands are supported, including vendor's extensions. Drivers includes response parser of each command, according to its requirements, while the parser is written with loose fashion in two points; error check and length check. This doesn't cause any issues such as kernel corruption, but should be improved. This commit modifies evaluations of return value on each parsers. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-02sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>Ingo Molnar1-0/+1
Fix up affected files that include this signal functionality via sched.h. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-12ALSA: firewire: Constify snd_rawmidi_opsTakashi Iwai1-2/+2
Now snd_rawmidi_ops is maintained as a const pointer in snd_rawmidi, we can constify the definitions. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-01-05ALSA: bebob: enclose identifiers referred by single functionTakashi Sakamoto3-49/+45
Some identifiers are referred just by one functions. In this case, they can be put into the function definition. This brings two merits; readers can easily follow codes related to the identifiers, developers are free from name conflict. This commit moves such identifiers to each function definition. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-11-18ALSA: bebob: compare whole string for model name so that readers are not confusedTakashi Sakamoto1-2/+2
A modalias of 'ieee1394:ven00000D6Cmo00010060sp' hits units for M-Audio FireWire Audiophile only. However the unit has two states relevant to loaded firmware. Initial firmware returns 'FW Audiophile Bootloader', while functional firmware returns 'FW Audiophile'. ALSA bebob driver compares the units' model name to strings of 24 characters by the first 15 characters. This is shorter way to differentiate these two states but confusing to readers. This commit improves the code for this point. Kernel stack is consumed more in call of check_audiophile_booted() by a bit. With initial firmware: $ ./linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04276da6 bus_info_length 4, crc_length 39, crc 28070 404 31333934 bus_name "1394" 408 006481f2 irmc 0, cmc 0, isc 0, bmc 0, pmc 0, cyc_clk_acc 100, max_rec 8 (512), max_rom 1, gen 15, spd 2 (S400) 40c 000d6c03 company_id 000d6c | 410 102b7e2e device_id 03102b7e2e | EUI-64 000d6c03102b7e2e root directory ----------------------------------------------------------------- 414 00067414 directory_length 6, crc 29716 418 0c0083c0 node capabilities per IEEE 1394 41c 03000d6c vendor 420 81000009 --> descriptor leaf at 444 424 17010060 model 428 8100000c --> descriptor leaf at 458 42c d1000001 --> unit directory at 430 unit directory at 430 ----------------------------------------------------------------- 430 00049da1 directory_length 4, crc 40353 (should be 48611) 434 1200a02d specifier id: 1394 TA 438 13014001 version: Vender Unique and AV/C 43c 17010060 model 440 8100000f --> descriptor leaf at 47c descriptor leaf at 444 ----------------------------------------------------------------- 444 0004073e leaf_length 4, crc 1854 448 00000000 textual descriptor 44c 00000000 minimal ASCII 450 4d2d4155 "M-AU" 454 44494f00 "DIO" descriptor leaf at 458 ----------------------------------------------------------------- 458 00086f21 leaf_length 8, crc 28449 45c 00000000 textual descriptor 460 00000000 minimal ASCII 464 46572041 "FW A" 468 7564696f "udio" 46c 7068696c "phil" 470 6520426f "e Bo" 474 6f746c6f "otlo" 478 61646572 "ader" descriptor leaf at 47c ----------------------------------------------------------------- 47c 00086f21 leaf_length 8, crc 28449 480 00000000 textual descriptor 484 00000000 minimal ASCII 488 46572041 "FW A" 48c 7564696f "udio" 490 7068696c "phil" 494 6520426f "e Bo" 498 6f746c6f "otlo" 49c 61646572 "ader" With functional firmware: $ ./linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 042de16f bus_info_length 4, crc_length 45, crc 57711 404 31333934 bus_name "1394" 408 f0648122 irmc 1, cmc 1, isc 1, bmc 1, pmc 0, cyc_clk_acc 100, max_rec 8 (512), max_rom 1, gen 2, spd 2 (S400) 40c 000d6c03 company_id 000d6c | 410 002b7e2e device_id 03002b7e2e | EUI-64 000d6c03002b7e2e root directory ----------------------------------------------------------------- 414 0009dac4 directory_length 9, crc 56004 418 0400000d hardware version 41c 0c0083c0 node capabilities per IEEE 1394 420 03000d6c vendor 424 81000012 --> descriptor leaf at 46c 428 17010060 model 42c 81000015 --> descriptor leaf at 480 430 13ffffff version 434 d1000002 --> unit directory at 43c 438 d4000006 --> dependent info directory at 450 unit directory at 43c ----------------------------------------------------------------- 43c 00041eb9 directory_length 4, crc 7865 440 1200a02d specifier id: 1394 TA 444 13014001 version: Vender Unique and AV/C 448 17010060 model 44c 81000014 --> descriptor leaf at 49c dependent info directory at 450 ----------------------------------------------------------------- 450 000637c7 directory_length 6, crc 14279 454 120007f5 specifier id 458 13000001 version 45c 3affffc7 (immediate value) 460 3b100000 (immediate value) 464 3cffffc7 (immediate value) 468 3d600000 (immediate value) descriptor leaf at 46c ----------------------------------------------------------------- 46c 0004b8e4 leaf_length 4, crc 47332 470 00000000 textual descriptor 474 00000000 minimal ASCII 478 4d2d4175 "M-Au" 47c 64696f00 "dio" descriptor leaf at 480 ----------------------------------------------------------------- 480 0006194b leaf_length 6, crc 6475 484 00000000 textual descriptor 488 00000000 minimal ASCII 48c 46572041 "FW A" 490 7564696f "udio" 494 7068696c "phil" 498 65000000 "e" descriptor leaf at 49c ----------------------------------------------------------------- 49c 0006194b leaf_length 6, crc 6475 4a0 00000000 textual descriptor 4a4 00000000 minimal ASCII 4a8 46572041 "FW A" 4ac 7564696f "udio" 4b0 7068696c "phil" 4b4 65000000 "e" Reported-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-08-24ALSA: bebob: unify configurations for some models produced by Yamaha/TerratecTakashi Sakamoto4-38/+9
The below models were developed with a cooperation by Yamaha and Terratec. - Yamaha GO 44/Terratec PHASE 24 FW - Yamaha GO 46/Terratec PHASE X24 FW They have the same configurations, thus it's better to unify corresponding codes. This commit merges them to reduce the amount of maintained codes. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-08-24ALSA: bebob: rename file with vendor-dependent code so that it's for Yamaha/TerratecTakashi Sakamoto2-4/+5
Once Yamaha and Terratec cooperated to develop some audio and music units on IEEE 1394 bus. On these models, the same embedded board is used, and similar configurations are also applied. This commit renames file for Yamaha's configuration so that it's for both of Yamaha and Terratec. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-05-10ALSA: firewire-lib: enable the same feature as CIP_SKIP_INIT_DBC_CHECK flagTakashi Sakamoto1-2/+0
In former commit, drivers in ALSA firewire stack always starts IT context before IR context. If IR context starts after packets are transmitted by peer unit, packet discontinuity may be detected because the context starts in the middle of packet streaming. This situation is rare because IT context usually starts immediately. However, it's better to solve this issue. This is suppressed with CIP_SKIP_INIT_DBC_CHECK flag. This commit enables the same feature as CIP_SKIP_INIT_DBC_CHECK. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-05-10ALSA: bebob: drop reuse of incoming packet parameter for outgoing packet parameterTakashi Sakamoto2-74/+26
Windows driver for BeBoB-based models mostly wait for transmitted packets, then transfer packets to the models. This looks for the relationship between incoming packets and outgoing packets to synchronize the sequence of presentation timestamp. However, the sequence between packets of both direction has no relationship. Even if receiving NO-DATA packets, the drivers transfer packets with meaningful value in SYT field. Additionally, the order of starting packets is always the same, independently of the source of clock. The corresponding driver is expected as a generator of presentation timestamp and these models can select it as a source of sampling clock. This commit drops reusing SYT sequence from ALSA bebob driver. The driver always transfer packets with presentation timestamp generated by ALSA firewire stack, without re-using the sequence of value in SYT field in incoming packets to outgoing packets. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-31ALSA: bebob: delayed registration of sound cardTakashi Sakamoto2-89/+131
Some bebob based units tends to fail asynchronous communication when IEEE 1394 bus is under bus-reset state. When registering sound card instance at unit probe callback, userspace applications can be involved to the state. This commit postpones the registration till the bus is calm. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-28ALSA: bebob: remove needless argument from local functionTakashi Sakamoto1-2/+2
The 'vendor_id' argument is not used in the local function. Let's remove it. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-20ALSA: bebob: give up updating streams at bus reset handlerTakashi Sakamoto3-20/+16
DM1000/DM1100/DM1500 chipsets transfer packets with discontinue value in 'dbc' field of CIP header. For ALSA bebob driver, this makes its bus-reset handler meaningless, because the discontinuity is detected quite earlier than executing the handler. This commit gives up updating streams at the bus reset handler. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-20ALSA: bebob: change type of substream counter from atomic_t to unsigned intTakashi Sakamoto4-11/+11
The counter is incremented/decremented in critical section protected with mutex. Therefore, no need to use atomic_t. This commit changes the type to unsigned int. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-20ALSA: bebob: move mutex from function callee to callersTakashi Sakamoto3-11/+24
Currently, critical section is protected by mutex in functions of fireworks_stream.c. Callers increments/decrements substreams counter before calling the functions. Moving mutex to the callers code allows to change type of the substream counter from atomic_t to unsigned int. This commit is a preparation for obsoleting usage of atomic_t for substream counter. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-20ALSA: bebob: simplify bus-reset handlingTakashi Sakamoto3-36/+5
At bus-reset, DM1000/DM1100/DM1500 chipsets transfer packets with discontinuous value in 'dbc' field of CIP header. In this case, packet streaming layer in firewire-lib module stops streaming and set XRUN to PCM substream. In ALSA, PCM applications are notified the XRUN status by the return value of ALSA PCM interface. They can recover this state by executing snd_pcm_prepare(), then PCM drivers' prepare handler is called, and start new PCM substream. For ALSA BeBoB driver, the handler establishes new connections and start new AMDTP streaming. Unfortunately, neither the PCM applications nor the driver know the reason of XRUN. The driver gets to know the reason when update handler is called by IEEE 1394 bus driver. As long as I tested, the order of below events are not fixed: * Detecting packet discontinuity in tasklet context of OHCI 1394 driver * Calling prepare handler in process context of ALSA PCM application * Calling update handler in kthread context of IEEE 1394 bus driver The unpredictable order is disadvantage for the driver to be compliant to CMP. In IEC 61883-1, new CMP establish operations should be done 1 sec (isoc_resource_delay) after bus-reset. Within 1 sec, CMP restore operations are allowed. For this reason, in former commit ('b6bc812327aa: ALSA: bebob/firewire-lib: Add a quirk for discontinuity at bus reset'), the process context is forced to wait for executing update handler. The process context wait for bus-reset up to 1 sec. This commit solves the issue, while causes more disadvantages. For PCM applications, calling snd_pcm_prepare() for recovering XRUN state takes more time and the driver got a bit complicated code, while the recovery is not always successful. As long as I tested, DM1000/DM1100/DM1500 and BeBoB firmware can allow drivers to establish new connections just after bus reset. Furthermore, any FCP transactions are handled correctly. Therefore, the driver don't need to wait for bus reset handler for starting new streaming. This commit removes the codes to reduce maintenance cost. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-26ALSA: bebob: Use a signed return type for get_formation_indexLucas Tanure1-5/+9
The return type "unsigned int" was used by the get_formation_index function despite of the aspect that it will eventually return a negative error code. So, change to signed int and get index by reference in the parameters. Done with the help of Coccinelle. [Fix the missing braces suggested by Julia Lawall -- tiwai] Signed-off-by: Lucas Tanure <tanure@linux.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: bebob: use correct type for __be32 dataTakashi Sakamoto1-1/+1
In former commit, metering is supported for BeBoB based models customized by M-Audio. The data in transaction is aligned to big-endianness, while in the driver code u16 typed variable is assigned to the data. This causes sparse warnings. bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 bebob_maudio.c:651:31: warning: cast to restricted __be16 This commit fixes this bug by using __be16 variable for the data. Fixes: 3149ac489ff8('ALSA: bebob: Add support for M-Audio special Firewire series') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-18ALSA: fireworks/bebob/oxfw/dice: enable to make as built-inTakashi Sakamoto1-1/+1
When committed to upstream, these four modules had wrong entries for Makefile. This forces them to be loadable modules even if they're set as built-in. This commit fixes this bug. Fixes: b5b04336015e('ALSA: fireworks: Add skelton for Fireworks based devices') Fixes: fd6f4b0dc167('ALSA: bebob: Add skelton for BeBoB based devices') Fixes: 1a4e39c2e5ca('ALSA: oxfw: Move to its own directory') Fixes: 14ff6a094815('ALSA: dice: Move file to its own directory') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-11ALSA: bebob: constify various snd_bebob structuresJulia Lawall9-61/+61
The structures of type snd_bebob_clock_spec, snd_bebob_rate_spec, snd_bebob_meter_spec, and snd_bebob_spec are never modified after they are initialized. Make them all const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-04ALSA: bebob: support Firewire I/O card of Mackie Onyx 1220/1620/1640Takashi Sakamoto1-3/+4
Current ALSA BeBoB drivers has an entry for this model, while the value of vendor ID seems to be wrong according to an user's report. The vendor had released no updated firmware, thus we can judge that this model had not changed the content of its config ROM. It's reasonable to fix the ID according to the report. $ ./linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 0425720f bus_info_length 4, crc_length 37, crc 29199 404 31333934 bus_name "1394" 408 f0646122 irmc 1, cmc 1, isc 1, bmc 1, pmc 0, cyc_clk_acc 100, max_rec 6 (128), max_rom 1, gen 2, spd 2 (S400) 40c 00000ff2 company_id 00000f | 410 00004697 device_id f200004697 | EUI-64 00000ff200004697 root directory ----------------------------------------------------------------- 414 000859be directory_length 8, crc 22974 418 04000082 hardware version 41c 0c0083c0 node capabilities per IEEE 1394 420 03000ff2 vendor 424 8100000a --> descriptor leaf at 44c 428 17010065 model 42c 8100000d --> descriptor leaf at 460 430 13000910 version 434 d1000001 --> unit directory at 438 unit directory at 438 ----------------------------------------------------------------- 438 0004ccec directory_length 4, crc 52460 43c 1200a02d specifier id: 1394 TA 440 13010001 version: AV/C 444 17010065 model 448 8100000d --> descriptor leaf at 47c descriptor leaf at 44c ----------------------------------------------------------------- 44c 0004152a leaf_length 4, crc 5418 450 00000000 textual descriptor 454 00000000 minimal ASCII 458 4d61636b "Mack" 45c 69650000 "ie" descriptor leaf at 460 ----------------------------------------------------------------- 460 000612b5 leaf_length 6, crc 4789 464 00000000 textual descriptor 468 00000000 minimal ASCII 46c 4f6e7978 "Onyx" 470 20466972 " Fir" 474 65776972 "ewir" 478 65000000 "e" descriptor leaf at 47c ----------------------------------------------------------------- 47c 000612b5 leaf_length 6, crc 4789 480 00000000 textual descriptor 484 00000000 minimal ASCII 488 4f6e7978 "Onyx" 48c 20466972 " Fir" 490 65776972 "ewir" 494 65000000 "e" $ cat /proc/asound/card3/firewire/firmware Manufacturer: bridgeCo Protocol Ver: 1 Build Ver: 0 GUID: 0x00000FF200004697 Model ID: 0x82 Model Rev: 1 Firmware Date: 20040430 Firmware Time: 131527 Firmware ID: 0x10065 Firmware Ver: 2320 Base Addr: 0x20080000 Max Size: 1572864 Loader Date: 20040430 Loader Time: 112036 Reported-by: Andrzej Gansiniec <andrzej@gansiniec.pl> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename macros with AM824 prefixTakashi Sakamoto2-5/+5
This commit renames some macros just related to AM824 format. In later commit, they're moved to AM824 layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename PCM format helper functionTakashi Sakamoto1-4/+4
Setting the format of PCM substream to AMDTP stream structure is important to set a handler to copy actual PCM samples between buffers. The processing should be in data block processing layer because essentially it has no relationship to packet streaming. This commit renames PCM format setting function to prepare for integrating AM824 layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: move MIDI trigger helper function to AM824 layerTakashi Sakamoto1-8/+8
In IEC 61883-6, MIDI messages are transferred in MIDI conformant data channel. Essentially, packet streaming layer is not responsible for MIDI functionality. This commit moves MIDI trigger helper function from the layer to AM824 layer. The rest of codes related to MIDI functionality will be moved in later commits. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add helper functions to set positions of data channelsTakashi Sakamoto1-2/+3
In IEC 61883-6, several types of data are available in AM824 format. The data is transferred in each data channel. The position of data channel in data block differs depending on model. Current implementation has an array to map the index of data channel in an data block to the position of actual data channel. The implementation allows each driver to access the mapping directly. In later commit, the mapping is in specific structure pushed into an opaque pointer. Helper functions are required. This commit adds the helper functions for this purpose. In IEC 61883-6, AM824 format supports many data types, while this specification easily causes over-engineering. Current AM824 implementation is allowed to handle two types of data, Multi Bit Linear Audio data (=PCM samples) and MIDI conformant data (=MIDI messages). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: move PCM substream constraint to AM824 layerTakashi Sakamoto1-1/+1
In IEC 61883-6, PCM frames are transferred in Multi Bit Linear Audio data channel. The data channel transfers 16/20/24 bit PCM samples. Thus, PCM substream has a constrain about it. This commit moves codes related to the constraint from packet streaming layer to AM824 data block processing layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename parameter setting function for AM824 with FDF fieldTakashi Sakamoto1-6/+6
The value of FDF field in CIP header is protocol-dependent. Thus, it's better to allow data block processing layer to decide the value in any timing. In AM824 data format, the value of FDF field in CIP header indicates N-flag and Nominal Sampling Frequency Code (sfc). The N-flag is for switching 'Clock-based rate control mode' and 'Command-based rate control mode'. In our implementation, 'Clock-based rate control mode' is just supported. Therefore, When sampling transfer frequency is decided, then the FDF can be set. This commit replaces 'amdtp_stream_set_parameters' with 'amdtp_am824_set_parameters' to set the FDF. This is the same timing to decide the ration between the number of data blocks and the number of PCM frames. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add data block processing layer for AM824 formatTakashi Sakamoto2-5/+5
This commit adds data block processing layer for AM824 format. The new layer initializes streaming layer with its value for fmt field. Currently, most implementation of data block processing still remains streaming layer. In later commits, these codes will be moved to the layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename 'amdtp' to 'amdtp-stream' to prepare for functional separationTakashi Sakamoto1-1/+1
In later commit, data block processing layer will be newly added. This layer will be named as 'amdtp-am824'. This commit renames current amdtp file to amdtp-stream, to distinguish it from the new layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add an argument for Dice's dual wire modeTakashi Sakamoto1-2/+4
In IEC 61883-6, one data block represents one event. In ALSA, the event is one PCM frame. Therefore, when processing one data block, current implementation counts one PCM frame. On the other hand, Dice platform has a quirk called as 'dual wire' at higher sampling rate. In detail, see comment of commit 6eb6c81eee2a ("ALSA: dice: Split stream functionality into a file"). Currently, to handle this quirk, AMDTP stream structure has a 'double_pcm_frames' member. When this is enabled, two PCM frames are counted. Each driver set this flag by accessing the structure member directly. In future commit, some members related to AM824 data block will be moved to specific structure, to separate packet streaming layer and data block processing layer. The access will be limited by opaque pointer. For this reason, this commit adds an argument into amdtp_stream_set_parameter() to set the flag. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: return error code when amdtp_stream_set_parameters() detects errorTakashi Sakamoto1-4/+9
Currently, amdtp_stream_set_parameters() returns no error even if wrong arguments are given. This is not good for streaming layer because drivers can continue processing ignoring capability of streaming layer. This commit changes this function to return error code. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-29ALSA: fireworks/bebob/dice/oxfw: fix substreams counting at vmalloc failureTakashi Sakamoto1-4/+16
In PCM core, when hw_params() in each driver returns error, the state of PCM substream is kept as 'open'. In this case, current drivers for sound units on IEEE 1394 bus doesn't decrement substream counter in hw_free() correctly. This causes these drivers to keep streams even if not required. This commit fixes this bug. When snd_pcm_lib_alloc_vmalloc_buffer() fails, hw_params function in each driver returns without incrementing the counter. Reported-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: add support for Behringer FCA 610/1616Takashi Sakamoto1-2/+4
They're based on DM1500 (ArchWave produced), and BeBoB version 3 is installed. $ cat /proc/asound/FCA610/firewire/firmware Manufacturer: bridgeCo Protocol Ver: 3 Build Ver: 0 GUID: 0x001564000002AD73 Model ID: 0x03 Model Rev: 0 Firmware Date: 20121102 Firmware Time: 153431 Firmware ID: 0x610 Firmware Ver: 8348 Base Addr: 0x400C0080 Max Size: 1422624 Loader Date: 20121015 Loader Time: 104710 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: keep duplex streams always to keep internal multiplexer properlyTakashi Sakamoto4-27/+16
Behringer FCA610 transmits packets with periodic noisy PCM samples when receiving no streams, and generates a bit noisy sound. ALSA BeBoB driver is programmed to establish both in/out connections when starting streaming, then transfers packets as userspace applications requested. This means that there's a case that one of incoming/outgoing streams is running, to save CPU and bandwidth usage. Although, it's natural to start transferring packets in both direction. This commit makes this driver to keeps duplex streams always. Tested-by: Kim Tore Jensen <kim@incendio.no> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: loosen up severity of checking continuity for BeBoB v3 quirkTakashi Sakamoto1-0/+11
PrismSound Orpheus, Behringer UFX1604 and FCA610 work with BeBoB v3, and they're confirmed to transmit discontinuous packets in the beginning of streaming. payload CIP headers 8 0x00070000 0x9002FFFF 8 0x00070000 0x9002FFFF 8 0x00070000 0x9002FFFF 8 0x00070008 0x9002FFFF <- 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 232 0x00070000 0x9002E798 <- 232 0x00070008 0x9002FB99 232 0x00070010 0x90021398 8 0x00070018 0x9002FFFF (This sample was got with Behringer FCA610 and FFADO library.) This commit sets CIP_EMPTY_HAS_WRONG_DBC and CIP_SKIP_DBC_ZERO_CHECK to ignore these discontinuities. Tested-by: Kim Tore Jensen <kim@incendio.no> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: expand timeout for DM1500 quirkTakashi Sakamoto1-1/+1
Behringer FCA610 and UFX1604 is confirmed to require more time till transmitting packets after establishing connections. This seems to be a quirk of DM1500 ASIC which ArchWave produced. For this quirk, this commit extends the time to wait up to 2 seconds. As a result, in worst cases, below userspace functions require 2 seconds to return. - snd_pcm_prepare() - snd_pcm_hw_params() - snd_pcm_recover() Tested-by: Kim Tore Jensen <kim@incendio.no> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: add 'version' member for BeBoB protocol versionTakashi Sakamoto2-0/+11
BeBoB installed devices have BeBoB register area. This area stores basic information about its firmware. A register has its protocol version. This commit adds 'version' member and store the device's protocol version to handle v3 quirks in following commits. Tested-by: Kim Tore Jensen <kim@incendio.no> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: add SYT-Match supportTakashi Sakamoto2-7/+18
In previous commits, this driver can detect the source of clock as mush as possible. SYT-Match mode is also available. This commit purge the restriction. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: obsolete string literal expression for clock sourceTakashi Sakamoto5-27/+6
The old string literals were completely replaced by new normalized representation. This commit obsoletes it. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: use normalized representation for the type of clock sourceTakashi Sakamoto4-31/+33
This commit changes function prototype and its processing. As a result, function caller can execute additional processing according to detected clock source. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: preparation for replacing string literals by normalized representation for model-dependent structuresTakashi Sakamoto4-12/+72
Previous commit adds a enumerator as a normalized representation of clock source, while model-dependent structures still use string literals for this purpose. This commit is a preparation for replacement. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: apply new enumerator to normalize the type of clock sourceTakashi Sakamoto1-0/+6
Previous commit allows this driver to detect several types of clock source, while there's no normalized expression for it. This commit adds a new enumerator for this purpose. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: improve signal mode detection for clock sourceTakashi Sakamoto2-9/+72
With BeBoB version 3, current ALSA BeBoB driver detects the type of current clock signal source wrongly. This is due to a lack of proper implementation to parse the information. This commit renews the parser. As a result, this driver detects SYT-Match clock signal, thus it can start streams with two modes; SYT-Match mode and the others. SYT-Match mode will be supported in future commits. There's a constrain about detected internal/external clock source. When detecting external clock source, this driver allows userspace applications to use current sampling rate only. This is due to consider abour synchronization to external clock sources such as S/PDIF, ADAT or word-clock. According to several information from some devices, I guesss that the internal clock of most devices synchronize to IEEE 1394 cycle start packet. In this case, by a usual way, it's detect as 'Sync type of output Music Sub-Unit' connected to 'Sync type of PCR output Unit (oPCR)', and this driver judges it as internal clock. Therefore, userspace applications is allowed to request arbitrary supported sampling rates. On the other hand, several devices based on BeBoB version 3 have additional internal clock. In this case, by a usual way, it's detect as 'Sync/Additional type of External input Unit'. Unfortunately, there's no way to distinguish this sync type from the other external clock sources such as word-clock. In this case, this driver handles it as external and userspace applications is forced to use current sampling rate. I note that when the source of clock is detected as 'Isochronous stream type of input PCR[0]', it's under 'SYT-Match' mode. In this mode, the synchronization clock is generated according to SYT-series in received packets. In this case, this driver generates the series by myself. I experienced this mode often make the device silent suddenly during playbacking. This means that the mode is easy to lost synchronization. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-24ALSA: bebob: add Digidesign Mbox 2 Pro supportTakashi Sakamoto1-0/+3
This device is based on DM1000E, and BeBoB version 1 firmware is installed. $ cat /proc/asound/cards 0 [Pro ]: BeBoB - Mbox 2 Pro DIGIDESIGN Mbox 2 Pro (id:1, rev:1), GUID 00a07e0100a90000 at fw1.0, S400 $ cat /proc/asound/Pro/firewire/firmware Manufacturer: bridgeCo Protocol Ver: 1 Build Ver: 0 GUID: 0x00A07E0100A90000 Model ID: 0x01 Model Rev: 1 Firmware Date: 20071031 Firmware Time: 034402 Firmware ID: 0xA9 Firmware Ver: 16777215 Base Addr: 0x20080000 Max Size: 1572864 Loader Date: 20051207 Loader Time: 205554 With this patch, ALSA BeBoB driver can start packet streaming to/from this model, while as a default, internal multiplexer of this model is not initialized and generates no sound even if the driver transfers any packets with PCM samples. To hear any sounds from this model, userspace applications should be developed to set parameters to the internal multiplexer. You can see raw information in FFADO website: http://subversion.ffado.org/wiki/AvcModels/DigiDesignMboxPro2 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08ALSA: bebob: fix to processing in big-endian machine for sending cueTakashi Sakamoto1-4/+4
Some M-Audio devices require to receive bootup command just after powering on, while codes in BeBoB driver doesn't work properly in big-endian machine because the command should be aligned by little-endian. This commit fixes this bug. This fix should go to stable kernel. Cc: Takayuki Shiroma <t.shiroma.oki@gmail.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>