History log of /linux-master/sound/firewire/digi00x/amdtp-dot.c
Revision Date Author Comments
# 7fc693e4 10-Jan-2023 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: obsolete return value from context payload processing layer

This commit obsoletes return value from the context payload processing layer
since the multiplier between the data block count and PCM frame count was
moved to the packet streaming processing layer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230110134933.322794-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a36183f6 10-Jan-2023 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: move parameter for pcm frame multiplier from context payload processing layer

The current implementation delegates the task to calculate the number of
processed PCM frames into the context payload processing layer. It looks
good as long as frame calculation is done for a single purpose.
Nevertheless, another purpose, the computation of extra delay for the
runtime of PCM substream, requires frame calculation, too.

This commit refactors the current implementation so that the packet stream
processing layer is responsible for the calculation of PCM frame, too. The
member is moved to stream structure for multiplier between data block
count and PCM frame count.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230110134933.322794-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0cac60c7 08-Jan-2023 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: use circular linked list for context payload processing layer

The list of packet descriptor is passed to context payload processing
layer so that each driver can copy PCM frames, MIDI messages, and device
specific data between packet payload buffer and intermediate buffer for
user space application.

The list of packet descriptor was replaced by circular linked list in a
previous commit. This commit uses circular linked in context payload
processing layer as well.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230109021738.75543-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 019af592 30-May-2021 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-digi00x: perform sequence replay for media clock recovery

This commit takes ALSA firewire-digi00x driver to perform sequence replay
for media clock recovery.

All of models in Digidesign digi00x family don't transfer isochronous
packets till receiving isochronous packets. The on-the-fly mode is used
for the purpose. They don't interpret presentation time expressed in syt
field of received CIP, therefore the sequence of the number of data blocks
per packet is important for media clock recovery.

The sequence replay is tested with below models:

* Digidesign Digi 002
* Digidesign Digi 002 Rack
* Digidesign Digi 003
* Digidesign Digi 003 Rack

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210531025103.17880-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ffe66bbe 18-May-2021 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib/motu: use int type for the value of bitwise OR with enumerator-constant

It brings some inconvenience in practice to use enumerated type for
variable to which bitwise OR with enumerator constant is assigned.

This commit replaces declarations of enumerated type with int type.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210518084557.102681-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9a738ad1 21-Jul-2019 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: process payload of isoc context according to packet descriptors

This commit changes each of data block processing layer so that it
receives list of packet descriptor.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bb473966 21-Jul-2019 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-digi00x: code refactoring for DOT data block processing layer

This is code refactoring for DOT data block processing layer so that
it can receive list of packet descriptor.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d2c104a3 21-Jul-2019 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: pass packet descriptor to data block processing layer

This commit changes signature of callback function to call data block
processing layer with packet descriptor. At present, the layer is called
per packet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 600c8018 21-Jul-2019 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: pass no syt information to data block processing layer

In a previous commit, the variable passed from packet streaming layer
for syt variable is useless. This commit obsoletes it.

In my future work, the syt information is passed to data block processing
layer by another way.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ab754812 21-Jul-2019 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: pass data block counter to data block processing layer

This is a preparation for future commit that 'struct
amdtp_stream.data_block_count' does not represent the value of
data block count for current data block.

However, data block count is required for calculation of sequence index
in sequence-multiplied data channel. Some of data block processing layer
require it; e.g. for AM824 data block.

This commit passes data block count to the processing layer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# da607e19 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345

Based on 1 normalized pattern(s):

licensed under the terms of the gnu general public license version 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 88 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000437.521539229@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d3d10a4a 21-May-2019 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: use union for directional parameters

Some parameters of struct amdtp_stream is dependent on direction.

This commit uses union for such parameters to distinguish from
common parameters.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6aa7de05 23-Oct-2017 Mark Rutland <mark.rutland@arm.com>

locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()

Please do not apply this to mainline directly, instead please re-run the
coccinelle script shown below and apply its output.

For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
preference to ACCESS_ONCE(), and new code is expected to use one of the
former. So far, there's been no reason to change most existing uses of
ACCESS_ONCE(), as these aren't harmful, and changing them results in
churn.

However, for some features, the read/write distinction is critical to
correct operation. To distinguish these cases, separate read/write
accessors must be used. This patch migrates (most) remaining
ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
coccinelle script:

----
// Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
// WRITE_ONCE()

// $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch

virtual patch

@ depends on patch @
expression E1, E2;
@@

- ACCESS_ONCE(E1) = E2
+ WRITE_ONCE(E1, E2)

@ depends on patch @
expression E;
@@

- ACCESS_ONCE(E)
+ READ_ONCE(E)
----

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: davem@davemloft.net
Cc: linux-arch@vger.kernel.org
Cc: mpe@ellerman.id.au
Cc: shuah@kernel.org
Cc: snitzer@redhat.com
Cc: thor.thayer@linux.intel.com
Cc: tj@kernel.org
Cc: viro@zeniv.linux.org.uk
Cc: will.deacon@arm.com
Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>


# a02cb8f8 22-May-2017 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire: remove support for 16 bit PCM samples in playback substream

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>


# 8820a4cf 02-Apr-2017 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-digi00x: handle all MIDI messages on streaming packets

At a commit 9dc5d31cdceb ("ALSA: firewire-digi00x: handle MIDI messages in
isochronous packets"), a functionality to handle MIDI messages on
isochronous packet was supported. But this includes some of my
misunderstanding. This commit is to fix them.

For digi00x series, first data channel of data blocks in rx/tx packet
includes MIDI messages. The data channel has 0x80 in 8 bit of its MSB,
however it's against IEC 61883-6. Unique data format is applied:
- Upper 4 bits of LSB represent port number.
- 0x0: port 1.
- 0x2: port 2.
- 0xe: console port.
- Lower 4 bits of LSB represent the number of included MIDI message bytes;
0x0/0x1/0x2.
- Two bytes of middle of this data channel have MIDI bytes.

Especially, MIDI messages from/to console surface are also transferred by
isochronous packets, as well as physical MIDI ports.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 62f00e40 09-May-2016 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-lib: enable the same feature as CIP_SKIP_INIT_DBC_CHECK flag

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>


# b8cb3750 07-Feb-2016 Geert Uytterhoeven <geert@linux-m68k.org>

ALSA: firewire-digi00x: Drop bogus const type qualifier on dot_scrt()

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>


# 9dc5d31c 10-Oct-2015 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-digi00x: handle MIDI messages in isochronous packets

In Digi 002/003 protocol, MIDI messages are transferred in the last data
channel of data blocks. Although this data channel has a label of 0x80,
it's not fully MIDI conformant data channel especially because the Counter
field always zero independently of included MIDI bytes. The 4th byte of
the data channel in LSB tells the number of included MIDI bytes. This byte
also includes the number of MIDI port. Therefore, the data format in this
data channel is:
* 1st: 0x80 as label
* 2nd: MIDI bytes
* 3rd: 0 or MIDI bytes
* 4th: the number of MIDI byte and the number of MIDI port

This commit adds support of MIDI messages in data block processing layer.

Like AM824 data format, this data channel has a capability to transfer
more MIDI messages than the capability of phisical MIDI bus. Therefore, a
throttle for data rate is required to prevent devices' internal buffer to
overflow.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 17385a38 10-Oct-2015 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-digi00x: use in-kernel representation for the type of 8 bits

Original code for 'DoubleOhThree' encoding was written with '__u8' type,
while the type is usually used to export something to userspace.

This commit replaces the type with 'u8'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 163ae6f3 29-Sep-2015 Takashi Sakamoto <o-takashi@sakamocchi.jp>

ALSA: firewire-digi00x: add data block processing layer

Digi 002/003 family uses its own format for data blocks. The format is
quite similar to AM824 in IEC 61883-6, while there're some differences:

* The Valid Bit Length (VBL) code is always 0x40 in Multi-bit Linear Audio
(MBLA) data channel.
* The first data channel includes MIDI messages, against IEC 61883-6
recommendation.
* The Counter field is always zero in MIDI conformant data channel.
* Sequence multiplexing in IEC 61883-6 is not applied to the MIDI
conformant data channel.
* PCM samples are scrambled in received AMDTP packets. We call the way
as Double-Oh-Three (DOT). The algorithm was discovered by
Robin Gareus and Damien Zammit in 2012.

This commit adds data processing layer to satisfy these differences.

There's a quirk about transmission mode for received packets. When this
driver applies non-blocking mode to outgoing packets with isochronous
channel 2 or more, after 15 to 20 seconds since playbacking, any PCM
samples causes noisy sound on the device. With isochronous channel 0 or 1,
this doesn't occur. As long as I investigated, this quirk is not observed
when applying blocking mode to the received packets.

This driver applies blocking mode to outgoing packets, while non-blocking
mode to incoming packgets.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>