12 Sep, 2020

1 commit

  • The tasklet is an old API that should be deprecated, usually can be
    converted to another decent API. In FireWire driver, a tasklet is
    still used for offloading the AMDTP PCM stream handling. It can be
    achieved gracefully with a work queued, too.

    This patch replaces the tasklet usage in firewire-lib driver with a
    simple work. The conversion is fairly straightforward but for the
    in_interrupt() checks that are replaced with the check using the
    current_work().

    Note that in_interrupt() in amdtp_packet tracepoint is still kept as
    is. This is the place that is probed by both softirq of 1394 OHCI and
    a user task of a PCM application, and the work handling is already
    filtered in amdtp_domain_stream_pcm_pointer().

    Tested-by: Takashi Sakamoto
    Acked-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200909163659.21708-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

02 Sep, 2020

1 commit

  • In preparation for unconditionally passing the
    struct tasklet_struct pointer to all tasklet
    callbacks, switch to using the new tasklet_setup()
    and from_tasklet() to pass the tasklet pointer explicitly.

    Signed-off-by: Romain Perier
    Signed-off-by: Allen Pais
    Acked-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200902040221.354941-3-allen.lkml@gmail.com
    Signed-off-by: Takashi Iwai

    Allen Pais
     

08 May, 2020

9 commits

  • In previous commit, the sequence of syt offset and the number of data
    blocks per packet is calculated for pool in AMDTP domain structure in
    advance of processing outgoing packets.

    This commit uses the sequence for outgoing packet processing to obsolete
    per-stream processing of the sequence.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-11-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In current implementation, sequence of syt offset and the number of data
    blocks is generated when packets for outgoing stream are going to be
    queued.

    This commit generates and pools the sequence independently of the
    processing of outgoing packets for future extension.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-10-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • For future extension, storage is required to store packet sequence in
    incoming AMDTP stream to recover media clock for outgoing AMDTP stream.

    This commit adds the storage to AMDTP domain for this purpose. The
    packet sequence is represented by 'struct seq_desc' which has two
    members; syt_offset and the number of data blocks. The size of storage
    is decided according to the size of packet queue.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-9-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • When calculating the number of data blocks per packet, some states are
    stored in AMDTP stream structure. This is inconvenient when reuse the
    calculation from non-stream structure.

    This commit applies refactoring to helper function for the calculation
    so that the function doesn't touch AMDTP stream structure.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-8-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • When calculating syt offset, some states are stored in AMDTP stream
    structure. This is inconvenient when reuse the calculation from
    non-stream structure.

    This commit applies refactoring to helper function for the calculation
    so that the function doesn't touch AMDTP stream structure.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-7-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In current implementation for outgoing AMDTP packet, the value of syt
    field in CIP header is computed when calculating syt offset. For
    future extension, it's convenient to split the computation and
    calculation.

    This commit splits them.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-6-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Although the parameter for packet queue and IRQ timing is calculated when
    AMDTP stream starts, the calculated parameters are the same between
    streams in AMDTP domain.

    This commit moves the calculation and decide the parameters when AMDTP
    domain starts.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-5-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In current implementation, AMDTP domain structure and AMDTP stream
    structure has one way of reference from the former to the latter. For
    future extension, bidirectional reference is needed.

    This commit adds a member into stream structure to refer to domain
    structure to which the stream belongs.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-4-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • In descriptor of isochronous context in 1394 OHCI, the field of second
    has 3 bit, thus the maximum value is 8. The value is used for correct
    cycle calculation.

    This commit replaces hard-coded value with macro to obsolete magic
    number.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20200508043635.349339-3-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

19 Oct, 2019

5 commits

  • Some devices have a quirk to postpone transmission of isoc packet for
    several dozen or hundred isoc cycles since configured to transmit.
    Furthermore, some devices have a quirk to transmit isoc packet with
    discontinued data of its header.

    In 1394 OHCI specification, software allows to start isoc context with
    certain isoc cycle. Linux firewire subsystem has kernel API to use it
    as well.

    This commit uses the functionality of 1394 OHCI controller to handle
    the quirks. At present, this feature is convenient to ALSA bebob and
    fireface driver. As a result, some devices can be safely handled, as
    long as I know:
    - MAudio FireWire solo
    - MAudio ProFire Lightbridge
    - MAudio FireWire 410
    - Roland FA-66

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191018061911.24909-7-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • This commit changes AMDTP domain to run on an IT context of 1394 OHCI as
    IRQ target. No hardware interrupt is scheduled for the other isoc
    contexts. All of the isoc context are processed in a callback for an isoc
    context of IRQ target.

    The IRQ target is automatically selected from a list of AMDTP streams,
    thus users of AMDTP domain should add an AMDTP stream for IT context
    at least.

    The reason to select IT context as IRQ target is that the IT context
    runs on local 1394 OHCI controller and it can be used as reliable,
    constant IRQ generator. On the other hand, IR context can include skip
    cycle according to isoc packet transferred by device.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191018061911.24909-6-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • The aim of AMDTP domain is to process several isoc context in the same
    time. However, current implementation is against this idea because it
    flushes each isoc context in the end of processing context callback.

    This commit cancels it.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191018061911.24909-5-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • An isoc context for AMDTP stream is flushed to queue packet
    by a call of pcm.ack. This commit extends this for AMDTP
    domain.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191018061911.24909-4-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • An isoc context for AMDTP stream is flushed to queue packet
    by a call of pcm.pointer. This commit extends this for AMDTP
    domain.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191018061911.24909-3-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

18 Oct, 2019

4 commits

  • In IEC 61883-1/6, one isoc packet can transfer events up to the value of
    syt interval. This comes from the interval of isoc cycle. As 1394 OHCI
    controller can generate hardware IRQ per isoc packet, the interval is
    calculated as 125 usec.

    In IEC 61883-1/6, two ways of transmission is described; blocking and
    non-blocking methods. In blocking method, the sequence of packet includes
    'empty' or 'NODATA' packets which include no events. In non-blocking
    method, the number of events per packet is variable up to the syt
    interval.

    This commit uses double of the value of syt interval as minimum available
    size of PCM period due to the above protocol design.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191017155424.885-13-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Linux driver for 1394 OHCI controller voluntarily flushes isoc context
    when total size of accumulated context header reached PAGE_SIZE. This
    kicks tasklet for the isoc context. This is inconvenient to process
    runtime of PCM substream.

    This commit adds a restriction of the maximum size of PCM period to
    avoid this behaviour.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191017155424.885-12-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • ALSA IEC 61883-1/6 packet streaming engine controls 1394 OHCI controller
    to generate hardware IRQ for fixed number of isochronous packets (=16)
    since its first commit.

    This commit allow the engine to generate it for variable period according
    to the number of event to handle. For outgoing stream, internal
    calculator is used to check the accumulated events. For incoming stream,
    the number of data block in the packet of stream is used to check the
    accumulated events. When it's unavailable, fixed number of packet
    roughly calculated in advance is used instead of event counting.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191017155424.885-11-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • The number of packets in packet buffer has been fixed number (=48) since
    first commit of ALSA IEC 61883-1/6 packet streaming engine.

    This commit allows the engine to use variable number of packets in the
    buffer. The size is calculated by a parameter in AMDTP domain structure
    surely to store the number of events in the packets of buffer. Although
    the value of parameter is expected to come from 'period size' parameter
    of PCM substream, at present 48 is still used.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191017155424.885-2-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

17 Oct, 2019

1 commit

  • In IEC 61883-6, it's called as 'event' what has presentation time
    represented by timestamp in CIP header. Although the ratio of the number
    of event against the number of data block is different depending on
    event data type represented by the specific field in CIP header, it's
    just one in the most cases supported by ALSA IEC 61883-1/6 engine.

    In 1394 OHCI specification, applications can schedule hardware IRQ
    by configuring descriptor with IRQ flag for packet against each
    isochronous cycle. For future commit, I use the hardware IRQ for
    isoc IT context to acknowledge the elapse of PCM period for both
    playback/capture directions on AMDTP streams in the same domain.

    This commit is a preparation for the above idea. This commit adds
    a member into AMDTP domain structure to record the number of PCM frames.

    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20191007110532.30270-2-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

07 Sep, 2019

1 commit

  • The destructor of AMDTP domain has WARN_ON() for the list of associated
    AMDTP stream. Although this reminds a case that developers forget to
    program consumer drivers to stop AMDTP domain, it hits when AMDTP domain
    is not initialized yet. This occurs when initialization of sound card
    fails as well and it's superfluous.

    This commit removes the WARN_ON. Although the API to AMDTP domain does
    nothing, it's left for future usage.

    Fixes: 3ec3d7a3ff106 ("ALSA: firewire-lib: add AMDTP domain structure to handle several isoc contexts")
    Signed-off-by: Takashi Sakamoto
    Link: https://lore.kernel.org/r/20190906131414.15370-1-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

29 Aug, 2019

1 commit


06 Aug, 2019

5 commits


22 Jul, 2019

12 commits