summaryrefslogtreecommitdiff
path: root/sound/firewire/dice/dice.c
AgeCommit message (Collapse)Author
2017-08-22ALSA: firewire: add const qualifier to identifiers for read-only symbolsTakashi Sakamoto
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>
2016-05-08ALSA: dice: add support for M-Audio Profire 610 and perhaps 2626Takashi Sakamoto
M-Audio Profire 610 has an unexpected value in version field of its config ROM, thus ALSA dice driver is not assigned to the model due to a mismatch of modalias. This commit adds an entry to support the model. I expect the entry is also for Profire 2626. I note that Profire 610 uses TCD2220 (so-called Dice Jr.), and supports a part of Extended Application Protocol (EAP). $ cd linux-firewire-utils/src $ ./crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ------------------------------------------------------------ 400 04047689 bus_info_length 4, crc_length 4, crc 30345 404 31333934 bus_name "1394" 408 e0ff8112 irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 255, max_rec 8 (512), max_rom 1, gen 1, spd 2 (S400) 40c 000d6c04 company_id 000d6c | 410 04400002 device_id 0404400002 | EUI-64 000d6c0404400002 root directory ------------------------------------------------------------ 414 000695fe directory_length 6, crc 38398 418 03000d6c vendor 41c 8100000a --> descriptor leaf at 444 420 17000011 model 424 8100000d --> descriptor leaf at 458 428 0c0087c0 node capabilities per IEEE 1394 42c d1000001 --> unit directory at 430 unit directory at 430 ------------------------------------------------------------ 430 0004fb14 directory_length 4, crc 64276 434 12000d6c specifier id 438 130100d1 version 43c 17000011 model 440 8100000c --> descriptor leaf at 470 descriptor leaf at 444 ------------------------------------------------------------ 444 0004b8e4 leaf_length 4, crc 47332 448 00000000 textual descriptor 44c 00000000 minimal ASCII 450 4d2d4175 "M-Au" 454 64696f00 "dio" descriptor leaf at 458 ------------------------------------------------------------ 458 00053128 leaf_length 5, crc 12584 45c 00000000 textual descriptor 460 00000000 minimal ASCII 464 50726f46 "ProF" 468 69726520 "ire " 46c 36313000 "610" descriptor leaf at 470 ------------------------------------------------------------ 470 00053128 leaf_length 5, crc 12584 474 00000000 textual descriptor 478 00000000 minimal ASCII 47c 50726f46 "ProF" 480 69726520 "ire " 484 36313000 "610" $ cat /proc/asound/card1/dice sections: global: offset 10, size 90 tx: offset 100, size 142 rx: offset 242, size 282 ext_sync: offset 524, size 4 unused2: offset 0, size 0 global: owner: ffc0:000100000000 notification: 00000040 nick name: FW610 clock select: internal 48000 enable: 1 status: locked 48000 ext status: 00000040 sample rate: 48000 version: 1.0.4.0 clock caps: 32000 44100 48000 88200 96000 176400 192000 aes1 aes4 aes adat tdif wc arx1 arx2 internal clock source names: SPDIF\AES34\AES56\TOS\AES_ANY\ADAT\ADAT_AUX\Word Clock\Unused\Unused\Unused\Unused\Internal\\ ... Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-31ALSA: firewire-lib: add new function to schedule a work for sound card ↵Takashi Sakamoto
registration In former commit, ALSA dice driver postpone sound card registration after IEEE 1394 bus is calm. This idea has advantages for the other drivers. This commit adds a helper function for it to firewire-lib module. The function is really for the specific purpose. Callers should initialize delayed work structure with callback function. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-31ALSA: dice: simplify unit probe processingTakashi Sakamoto
In former commit, ALSA dice driver doesn't generate kernel warnings when unplugging units before initializing stream data. This commit moves the initialization to delayed registration of sound card, to simplify unit probe processing. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-03-09ALSA: dice: force to add two pcm devices for listed modelsTakashi Sakamoto
Some models reduce the number of available isochronous streams for higher sampling transfer frequency. Such models bring an issue about how to add PCM substreams. When at lower sampling transfer frequency, the models reports whole available streams, thus this driver can add enough number of PCM substreams at probing time. On the other hand, at higher sampling transfer frequency, this driver can just add reduced number of PCM substreams. After probed, even if the sampling transfer frequency is changed to lower rate, fewer PCM substreams are actually available. This is inconvenience. For the reason, this commit adds a list so that this driver assume models on the list to have two pairs of PCM substreams. This list keeps the name of model in which the number of available streams differs depending on sampling transfer frequency. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-09ALSA: dice: purge generating channel cacheTakashi Sakamoto
Dice interface design doesn't allow drivers to read supported combination between sampling transfer frequencies and the number of Multi bit linear audio data channels. Due to the design, ALSA dice driver changes current sampling transfer frequency to generate cache of the combinations at device probing processing. Although, this idea is worse because ALSA dice driver changes the state of clock. This is not what users want when they save favorite configuration to the device in advance. Furthermore, there's a possibility that the format of data block is decided not only according to current sampling transfer frequency, but also the other factors, i.e. data format for digital interface. It's not good to generate channel cache according to the sampling transfer frequency only. This commit purges processing cache data and related structure members. As a result, users must set preferable sampling transfer frequency before using ALSA PCM applications, as long as they want to start any PCM substreams at the rate except for current one. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-06ALSA: dice: postpone card registrationTakashi Sakamoto
Some models based on ASIC for Dice II series (STD, CP) change their hardware configurations after appearing on IEEE 1394 bus. This is due to interactions of boot loader (RedBoot), firmwares (eCos) and vendor's configurations. This causes current ALSA dice driver to get wrong information about the hardware's capability because its probe function runs just after detecting unit of the model. As long as I investigated, it takes a bit time (less than 1 second) to load the firmware after bootstrap. Just after loaded, the driver can get information about the unit. Then the hardware is initialized according to vendor's configurations. After, the got information becomes wrong. Between bootstrap, firmware loading and post configuration, some bus resets are observed. This commit offloads most processing of probe function into workqueue and schedules the workqueue after successive bus resets. This has an effect to get correct hardware information and avoid involvement to bus reset storm. For code simplicity, this change effects all of Dice-based models, i.e. Dice II, Dice Jr., Dice Mini and Dice III. I use a loose strategy to manage a race condition between the work and the bus reset. This is due to a specification of dice transaction. When bus reset occurs, registered address for the transaction is cleared. Drivers must re-register their own address again. While, this operation is required for the work because the work includes to wait for the transaction. This commit uses no lock primitives for the race condition. Instead, checking 'registered' member of 'struct snd_dice' avoid executing the work again. If sound card is not registered, the work can be scheduled again by bus reset handler. When .remove callback is executed, the sound card is going to be released. The work should not be pending or executed in the releasing. This commit uses cancel_delayed_work_sync() in .remove callback and wait till the pending work finished. After .remove callback, .update callback is not executed, therefore no works are scheduled again. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-01-06ALSA: dice: split subaddress check from category checkTakashi Sakamoto
Before allocating an instance of sound card, ALSA dice driver checks chip_ID_hi in Bus information block of Config ROM, then also checks subaddresses. The former operation reads cache of Config ROM in Linux FireWire subsystem, while the latter operation sends read transaction. The latter can be merged into initialization of transaction system. This commit splits these two operations to reduce needless transactions in probe processing. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-11-14ALSA: dice: fix detection of Loud devicesTakashi Sakamoto
Commit a471fcde8c2c ("ALSA: dice: fix detection of Weiss devices") adds a quirk of Weiss models. According to users' reports, Loud models also have the similar quirk. They have 0x10 in the category field. This commit adds support for Mackie Onyx Blackbird and Onyx-i series. As long as I know, Dice-based models produced by Focusrite/Alesis/PreSonus/M-Audio/TC Electronic have default value (0x04) in their category field, thus it may be reasonable to add a condition statement for Loud models, instead of removing the check of category value. Reported-by: Rouge Etienne <erouge.externe@m6.fr> Reported-by: Etilem <contact@etilem.net> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-19ALSA: dice: assign converted data to the same type of variableTakashi Sakamoto
In former commit, u32 data was assigned to __be32 variable instead of an int variable. This is not enough solution because it still causes sparse warnings. dice.c:80:23: warning: incorrect type in assignment (different base types) dice.c:80:23: expected restricted __be32 [usertype] value dice.c:80:23: got unsigned int dice.c:81:21: warning: restricted __be32 degrades to integer dice.c:81:46: warning: restricted __be32 degrades to integer This commit fixes this bug. Fixes: 7c2d4c0cf5ba('ALSA: dice: Split transaction functionality into a file') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23ALSA: fireworks/bebob/dice/oxfw: make it possible to shutdown safelyTakashi Sakamoto
A part of these drivers, especially BeBoB driver, are programmed to wait some events. Thus the drivers should not destroy any data in .remove() context. This commit moves some destructors from 'struct fw_driver.remove()' to 'struct snd_card.private_free()' to shutdown safely. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> # 3.19+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23ALSA: fireworks/bebob/dice/oxfw: add reference-counting for FireWire unitTakashi Sakamoto
Fireworks and Dice drivers try to touch instances of FireWire unit after sound card object is released, while references to the unit is decremented in .remove(). When unplugging during streaming, sound card object is released after .remove(), thus Fireworks and Dice drivers causes GPF or Null-pointer-dereferencing to application processes because an instance of FireWire unit was already released. This commit adds reference-counting for FireWire unit in drivers to allow them to touch an instance of FireWire unit after .remove(). In most case, any operations after .remove() may be failed safely. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> # 3.19+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-10ALSA: dice: Add support for MIDI capture/playbackTakashi Sakamoto
This commit adds a support for MIDI capture/playback When MIDI substrams already start streaming and PCM substreams are going to join at different sampling rate, streams are stopped once. Then sampling rate is changed and streams are restarted. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-10ALSA: dice: Add support for duplex streams with synchronizationTakashi Sakamoto
This commit adds support for AMDTP in-stream. As a result, Dice driver supports full duplex streams with synchronization. AMDTP can transfer timestamps in its packets. By handling the timestamp, devices can synchronize to the other devices or drivers on the same bus. When Dice chipset is 'enabled', it starts streams with correct settings. This 'enable' register is global, thus, when a stream is started to run, an opposite stream can't start unless turning off 'enable'. Therefore a pair of streams must be running. This causes a loss of CPU usage when single stream is needed for neither playbacking or capturing. This commit assumes that playback-only models also have a functionality to transmit stream for delivering timestamps. Currently, sampling clock source is restricted to SYT-Match mode. This is improved in followed commit. I note that at SYT-Match mode, Dice can select from 4 streams for synchronization but this driver uses the 1st stream only for simplicity. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-12-10ALSA: dice: Change the way to start streamTakashi Sakamoto
Streaming functionality can start streams when rate is given but currently some codes are in PCM functionality. This commit changes the way to start stream and add some arrangement to make it easy to understand the way. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-29ALSA: dice: Split proc interface into a fileTakashi Sakamoto
This commit adds a file and move some codes related to proc output. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-29ALSA: dice: Split hwdep functionality into a fileTakashi Sakamoto
This commit adds a file and move some codes related to hwdep functionality. This interface is designed for mixer/control application. By using hwdep interface, the application can get information about firewire node, can lock/unlock kernel streaming and can get notification at starting/stopping kernel streaming. Additionally, this interface give a way to read Dice notification. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-29ALSA: dice: Split PCM functionality into a fileTakashi Sakamoto
This commit adds a file and move some codes related to PCM functionality. Currently PCM playback is supported. PCM capture will be supported in followed commits. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-29ALSA: dice: Split stream functionality into a fileTakashi Sakamoto
This commit adds a file with some helper functions for streaming, and move some codes into the file with some arrangements. Well-known CMP is not used to start/stop streams for Dice chipset. It's achieved by writing to specific address. We call this way as 'enable'. When devices are 'enabled', streaming starts in registered isochronous channel. Some helper functions are already implemented in previous commit. Basically, the stream is compliant to IEC 61883-6, so-called as AMDTP. But Dice has a specific quirk, so called-as 'Dual Wire'. This quirk is applied at 176.4/192.0kHz. In this mode, each packet includes double number of events than number in the specification, and stream runs at a half of sampling rate. There is another quirk at bus reset. Dice chipset handles drivers' request but don't re-enable streaming. So stream should be stopped. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-29ALSA: dice: Split transaction functionality into a fileTakashi Sakamoto
This commit adds a file with some helper functions for transaction, and move some codes into the file with some arrangements. For Dice chipset, well-known FCP or AV/C commands are not used to control devices. It's achieved by read/write transactions into specific addresses. Dice's address area is split into 5 areas. Each area has its own role. The offset for each area can be got by reading head of the address area. By reading these areas, drivers can get to know device status. By writing these areas, drivers can change device status. Dice has a specific mechanism called as 'notification'. When device status is changed, Dice devices tells the event by sending transaction. This notification is sent to an address which drivers register in advance. But this causes an issue to drivers. To handle the notification, drivers need to allocate its own callback function to the address region in host controller. This region is exclusive. For the other applications, drivers must give a mechanism to read the received notification. For this purpose, Dice driver already implements hwdep interface. Dice chipset doesn't allow drivers to register several addresses. In this reason, when this driver is applied to a device, the other drivers should _not_ try to register its own address to the device. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-11-29ALSA: dice: Move file to its own directoryTakashi Sakamoto
In followed commits, dice driver is split into several files. For easily managing these files, this commit adds subdirectory and move file into the directory. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>