sound/firewire/digi00x/amdtp-dot.c:67: warning: type qualifiers ignored on function return type
Drop the bogus "const" type qualifier on the return type of dot_scrt()
to fix this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit 3beab0f844 added a member for control and status message, while
it's planned and not implemented yet.
This commit removes it.
Fixes: 3beab0f844fa('ALSA: firewire-tascam: add support for outgoing MIDI messages by asynchronous transaction')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently, 'struct snd_tscm_spec' has a member named as 'is_controller' to
identify MIDI controller. This member was originally added to skip
parse control and status messages in isochronous packets for non-controller
model.
As long as I investigate, FW-1804 (non-controller) also transfers the
control and status message, thus it becomes meaningless.
This commit removes it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This model supports:
* maximum 12 PCM channels for PCM playback
* maximum 18 PCM channels for PCM capture
* 4 ports for MIDI playback
* 4 ports for MIDI capture
* control and status messages in tx isochronous packets
* up to 96.0 kHz
This commit adds support for the model. As the other supported models,
all of available PCM channels are always enabled.
As I described in commit c0949b2785, Ilya Zimnovich had investigated
TASCAM FireWire series in 2011 with his FW-1804. In his report, this model
has internal multiplexer and any software implementation can control it.
Following to the design of ALSA firewire stack, this commit won't
implement it. It should be in userspace via Linux fw character device.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When unsupported models are connected, snd-firewire-tascam module causes
NULL pointer dereference in fw_core_remove_address_handler() (due to
list_del_rcu()).
This commit prevents this bug.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
Some users have reported that their Dice based models generate ETIMEDOUT
when starting PCM playback. It means that current timeout (=100msec) is
not enough for their models to transfer notifications.
This commit expands the timeout up to 2 sec. As a result, in a worst case,
any operations to start AMDTP streams takes 2 sec or more. Then, in
userspace, snd_pcm_hw_params(), snd_pcm_prepare(), snd_pcm_recover(),
snd_rawmidi_open(), snd_seq_connect_from() and snd_seq_connect_to() may
take the time.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In previous commit, card registration is processed under situation
with few bus reset. There's no need to add a workaround of transaction
re-initialization at timeout.
This commit purges the re-initialization.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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>
As long as I investigate SCS.1m, this model reports to transfer/receive
PCM data channels/MIDI conformant data channels in tx/rx AMDTP packet.
There's a contradiction that this model actually has no analog/digital
capture port for PCM frames and no physical MIDI ports.
I guess that SCS.1d also has the contradiction. This model has no
analog/digital ports for PCM frames and no physical MIDI ports, thus it
requires no streaming functionality.
This commit adds some modification codes to handle the contradiction,
as much as possible. Unfortunately, this module adds one PCM playback
substream for SCS.1d so as SCS.1m.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now ALSA oxfw driver gains functionalities which scs1x module has.
This commit obsoletes the scs1x module, and adds a line of MODULE_ALIAS
to load oxfw module instead of scs1x module.
In scs1x module, the name of 'shortname' field is fixed as 'SCS1x'. This
field is used to name MIDI ports for both of SCS.1m and SCS.1d. This is
not good because typically some SCS.1m and SCS.1d are used in the same
system. It's better to distinguish them according to name of the ports.
This commit applies model name in config ROM to the 'shortname'.
For the name of 'driver' and 'longname', this commit uses the same way
applied to the other models. This change may not bring disadvantages to
users because userspace applications use ALSA rawmidi or seq interface
and these interfaces are not influenced by them directly.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit copies some functions of asynchronous transactions for MIDI
playback, to merge scs1x module. The features of payload in asynchronous
transaction are the same as captured MIDI messages.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit copies some functions of asynchronous transactions for MIDI
capture, to merge scs1x module. The features of payload in asynchronous
transaction are:
* System exclusive messages for SCS.1 are encoded without ID data. In
this encoding scheme, 4 bits in LSB are available. The bits are squashed
in payload byte. Thus, one payload byte transfers two MIDI messages.
* The first byte of payload byte means:
* 0x00: depending on second payload byte
* 0xf9: including escaped system exclusive messages for SCS.1, up to
3 byte (= 6 MIDI messages)
* the others: including MIDI 1.0 messages
* the others: including escaped system exclusive messages for SCS.1, up
to 64 bytes
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When physical controls on SCS.1 models are operated, the models transfer
MIDI messages in asynchronous transactions on IEEE 1394 bus. The models
have a register to have an address for the transactions, and drivers
can register own address for this purpose.
This commit keeps a region of address, registers it and adds a handler for
the transactions.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stanton Controllers and Systems 1 (SCS.1) series is supported by ALSA
scs1x driver. This driver just supports MIDI functionality. On the other
hand, models in this series are based on OXFW971 and ALSA OXFW driver can
support them.
SCS.1 series has MIDI functionality to control its surface state such as
LED lighting. When operating physical knobs and faders, the models
generate MIDI messages. These MIDI messages are transferred by asynchronous
transactions. These transactions are really model-specific and ALSA OXFW
driver requires the functionality so as scs1x module implements.
This commit adds scs1x layer as a preparation to merge scs1x driver to
oxfw driver.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In former commits, some model-specific members are split from the
structure. The structure is just to keep names for compatibility to old
drivers.
This commit arranges name of the structure and localize it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In previous commit, some members are moved from 'struct snd_oxfw' because
they're model-specific. There are also the other model-specific parameters
in 'struct device_info'.
This commit moves these members to model-specific structure.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently, 'struct snd_oxfw' has some members for models supported by old
firewire-speakers driver, while these members are useless to the other
models.
This commit allocates new memory block and moves these members to
model-specific structure.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA oxfw driver should have backward compatibility to old
firewire-speakers driver. Additionally, in future commit, scs1x driver
will be merged. It's nice to add a pointer to have a memory block for
model-specific structures.
This commit adds a member to 'struct snd_oxfw' for this aim. Deallocation
is done at freeing ALSA card structure.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adding control elements is just for models supported by old
firewire-speakers modules. The processing should be in a function to add
model-dependent quirk.
This commit moves the codes to the function. As a result, the function
should handle error state, thus this commit also changes prototype of
the function.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently, assignment to model-dependent quirk is corresponding to
asynchronous transactions on IEEE 1394 bus. This is also achieved with
device entry.
This commit changes the processing of model-dependent quirk with the
entry. As a result, the transactions are sent only for Loud models.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA OXFW driver uses AV/C Audio Subunit commands to control some models.
The commands get/set the state of Feature function block of the subunit.
The commands are not specific to OXFW, thus there's a possibility to use
them in the other drivers.
Currently, helper functions for the commands require 'struct snd_oxfw',
although, it's not necessarily required. It's better to change prototype
of the functions without the structure for future use.
This commit changes the prototype.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit renames local functions with prefix 'spkr_', so that they're
for firewire-speakers.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In ALSA firewire stack, drivers basically has no control elements. This
is due to the fact that each model has own functionality even if they use
the same communication chipset. Implementing all of the functionalities in
kernel space unreasonably increases our efforts to maintain the stack. In
most case, these functionalities can be implemented in userspace via Linux
fw character devices.
However, ALSA OXFW driver has control elements comes from old
firewire-speakers driver. Adding the elements is in a file names as
'oxfw-control.c', while the elements are really model-specific. The
name is confusing because it gives an idea to handle control elements
for all of OXFW-based models.
This commit renames the file so that it's just for models supported by
old firewire-speakers driver.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
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 substeram 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>
Commit a471fcde8c ("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>
A commit to add support for this model should have added a comment
about this model to Kconfig.
Fixes: 759a2f40c9fa('ALSA: oxfw: add an entry for TASCAM FireOne')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Digi 002/003 family uses two ways to transfer MIDI messages. They're
different mechanisms, while it's better to handle the ways in different
ALSA rawmidi character devices because one character device has just a
set of operations.
This commit adds another rawmidi character device for control MIDI port. As
a result, first rawmidi character device is just for MIDI messages
transferred by isochronous packets.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Digi 002/003 family has two types of MIDI port; one is for physical MIDI
port and another is for MIDI control message. The former is transferred in
isochronous packet, and the latter is transferred by asynchronous
transaction. These transmission mechanisms are completely different, while
current ALSA digi00x driver defines a set of operations for them with
several condition statements. As a result, codes for the operation are
messy.
This commit adds a set of MIDI operation for control MIDI ports. In later
commit, it's applied as an operation for ALSA rawmidi character device.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In following commit, new functions and variables are added for operations
of MIDI control port.
This commit is a preparation. Current identifiers are renamed so that they
mean physical MIDI ports.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When MIDI buffer stores two or more MIDI messages, TASCAM driver
transfers asynchronous transactions including one MIDI message and
extra bytes from second MIDI message.
This commit fixes this bug by clearing needless bytes in the buffer. The
consumed bytes are already calculated correctly, thus the sequence of
transactions is already correct.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In transactions for MIDI messages, the first byte is used for label and
the rest is for MIDI bytes. In current code, these are handled correctly,
while there's a small mistake for loop condition to include meaningless
statement.
This commit adds two local variables for them and improve the loop
condition.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In the callback function of asynchronous MIDI port, the intension of some
local variables are not clear.
This commit improves them. The 'len' variable is used to calculate the
number of MIDI bytes including in the transaction. The 'consume' variable
is used to return the actual number of consumed bytes in ALSA MIDI buffer.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In the callback function of asynchronous MIDI port, some local variables
are declared 'unsigned int', while they're assigned to int value of return
from snd_rawmidi_transmit_peek().
This commit fixes the type.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The given buffer to callback function is cleared in caller side.
This commit removes buffer initialization in callee side.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Let's leave space for the NUL char otherwise the static checkers
complain that we go beyond the end of the array.
Fixes: 53b3ffee78 ('ALSA: firewire-tascam: change device probing processing')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
TASCAM FireOne is based on OXFW971 and ALSA OXFW driver can support it.
These are values of identical registers.
$ ./firewire-request /dev/fw1 read 0xfffff0050000
result: 97100105
$ ./firewire-request /dev/fw1 read 0xfffff0090020
result: 39373100
This commit adds an entry for this model. This model has physical controls
and its MIDI control messages are transferred to second MIDI data stream
multiplexed in one MIDI conformant data channel.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In IEC 61883-6, sequence multiplexing is applied to MIDI conformant data
channel. As a result, eight MIDI data streams are included in the channel.
Although ALSA AM824 data block processing layer implements this
multiplexing, current OXFW driver doesn't utilize it due to wrong
calculation of MIDI ports.
This commit fixes this bug to add proper calculation. Although this commit
allows to use 8 MIDI data streams, the number of available MIDI ports is
limited by the number of ALSA MIDI ports added by the driver.
Fixes: df075feefbd3('ALSA: firewire-lib: complete AM824 data block processing layer')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Current OXFW driver calculates the number of MIDI ports just before adding
ALSA MIDI ports. It's convenient for some devices with quirks to move
these codes before handling quirks.
This commit implements this idea.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When asynchronous MIDI port is closed before callbacked, the callback
function causes NULL pointer dereference to missing MIDI substream.
This commit fixes this bug.
Fixes: e8a40d9bcb23('ALSA: firewire-lib: schedule work again when MIDI substream has rest of MIDI messages')
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>
The contents of Config ROM in firewire device structure are already
aligned to CPU-endianness. Thus, no need to convert it again.
This commit removes needless conversions
Fixes: 9edf723fd858('ALSA: firewire-digi00x: add skeleton for Digi 002/003 family')
Fixes: c0949b278515('ALSA: firewire-tascam: add skeleton for TASCAM FireWire series')
Reported-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
In former commit, snd_efw_command_get_phys_meters() was added to handle
metering data. The given buffer is used to save transaction result and to
convert between endianness. But this causes sparse warnings.
fireworks_command.c:269:25: warning: incorrect type in argument 1 (different base types)
fireworks_command.c:269:25: expected unsigned int [usertype] *p
fireworks_command.c:269:25: got restricted __be32 [usertype] *
This commit fixes this bug.
Fixes: bde8a8f23bbe('ALSA: fireworks: Add transaction and some commands')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
Some local variables in some functions are typed as unsigned int, while
__be32 value is assigned to them. This causes sparse warnings.
dice-stream.c:50:17: warning: incorrect type in assignment (different base types)
dice-stream.c:50:17: expected unsigned int [unsigned] channel
dice-stream.c:50:17: got restricted __be32 [usertype] <noident>
dice-stream.c:74:17: warning: incorrect type in assignment (different base types)
dice-stream.c:74:17: expected unsigned int [unsigned] channel
dice-stream.c:74:17: got restricted __be32 [usertype] <noident>
This commit fixes this bug.
Fixes: 288a8d0cb04f('ALSA: dice: Change the way to start stream')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>