1. 10 5月, 2016 3 次提交
    • T
      ALSA: firewire-tascam: drop reuse of incoming packet parameter for outgoing packet parameter · 28e64f51
      Takashi Sakamoto 提交于
      In packet streaming protocol applied to TASCAM FireWire series, the value
      of SYT field in CIP header is always zero, therefore it has no meaning.
      There's no need to synchronize packets in both direction for the series.
      
      In current implementation of ALSA firewire stack, driver for the series
      uses incoming packet parameter for outgoing packet parameter to calculate
      the number of data blocks. This can be simplified because the task of
      corresponding driver is to transfer data blocks enough to sampling transfer
      frequency.
      
      This commit purges support of full duplex synchronization to prevent
      over-engineering implementation.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      28e64f51
    • T
      ALSA: fireworks: drop reuse of incoming packet parameter for ougoing packet parameter · eb4a378f
      Takashi Sakamoto 提交于
      On Fireworks board module of Echo Audio, TSB43Cx43A (IceLynx Micro, iCEM)
      is used to process payload of isochronous packets. There's an public
      document of this chip[1]. This document is for firmware programmers to
      transfer/receive AMDTP with IEC60958 data format, however in clause 2.5,
      2.6 and 2.7, we can see system design to utilize the sequence of value in
      SYT field of CIP header. In clause 2.3, we can see the specification of
      Audio Master Clock (MCLK) from iCEM.
      
      Well, this clock is actually not used for sampling clock. This can be
      confirmed when corresponding driver transfer random value as the sequence
      of SYT field. Even if in this case, the unit generates proper sound.
      
      Additionally, in unique command set for this board module, the format
      of CIP is changed; for IEC 61883-6 mode which we use, and for Windows
      Operating System. In the latter mode, the whole 32 bit field in second CIP
      header from Windows driver is used to represent counter of packets (NO-DATA
      code is still used for packets without data blocks). If the master clock
      was physically used by DSP on the board module, the Windows driver must
      have transferred correct sequence of SYT field.
      
      Furthermore, as long as seeing capacities of AudioFire2, AudioFire4,
      AudioFire8, AudioFirePre8 and AudioFire12, these models don't support
      SYT-Match clock source.
      
      Summary, we have no need to relate incoming/outgoing packets. This commit
      drops reusing SYT sequence of incoming packets for outgoing packets.
      
      [1] Using TSB43Cx43A: S/PDIF over 1394 (2003, Texus Instruments
      Incorporated)
      http://www.ti.com/analog/docs/litabsmultiplefilelist.tsp?literatureNumber=slla148&docCategoryId=1&familyId=361Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      eb4a378f
    • T
      ALSA: bebob: drop reuse of incoming packet parameter for outgoing packet parameter · c71283cb
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c71283cb
  2. 09 5月, 2016 3 次提交
    • T
      ALSA: firewire-lib: add tracepoints to dump a part of isochronous packet data · 0c95c1d6
      Takashi Sakamoto 提交于
      When audio and music units have some quirks in their sequence of packet,
      it's really hard for non-owners to identify the quirks. Although developers
      need dumps for sequence of packets, it's difficult for users who have no
      knowledges and no equipments for this purpose.
      
      This commit adds tracepoints for this situation. When users encounter
      the issue, they can dump a part of packet data via Linux tracing framework
      as long as using drivers in ALSA firewire stack.
      
      Additionally, tracepoints for outgoing packets will be our help to check
      and debug packet processing of ALSA firewire stack.
      
      This commit newly adds 'snd_firewire_lib' subsystem with 'in_packet' and
      'out_packet' events. In the events, some attributes of packets and the
      index of packet managed by this module are recorded per packet.
      
      This is an usage:
      
      $ trace-cmd record -e snd_firewire_lib:out_packet \
                         -e snd_firewire_lib:in_packet
      /sys/kernel/tracing/events/snd_firewire_lib/out_packet/filter
      /sys/kernel/tracing/events/snd_firewire_lib/in_packet/filter
      Hit Ctrl^C to stop recording
      ^C
      $ trace-cmd report trace.dat
      ...
      23647.033934: in_packet:  01 4073 ffc0 ffc1 00 000f0040 9001b2d1 122 44
      23647.033936: in_packet:  01 4074 ffc0 ffc1 00 000f0048 9001c83b 122 45
      23647.033937: in_packet:  01 4075 ffc0 ffc1 00 000f0050 9001ffff 002 46
      23647.033938: in_packet:  01 4076 ffc0 ffc1 00 000f0050 9001e1a6 122 47
      23647.035426: out_packet: 01 4123 ffc1 ffc0 01 010f00d0 9001fb40 122 17
      23647.035428: out_packet: 01 4124 ffc1 ffc0 01 010f00d8 9001ffff 002 18
      23647.035429: out_packet: 01 4125 ffc1 ffc0 01 010f00d8 900114aa 122 19
      23647.035430: out_packet: 01 4126 ffc1 ffc0 01 010f00e0 90012a15 122 20
      (Here, some common fields are omitted so that a line to be within 80
      characters.)
      ...
      
      One line represent one packet. The legend for the last nine fields is:
       - The second of cycle scheduled for the packet
       - The count of cycle scheduled for the packet
       - The ID of node as source (hex)
        - Some devices transfer packets with invalid source node ID in their CIP
          header.
       - The ID of node as destination (hex)
        - The value is not in CIP header of packets.
       - The value of isochronous channel
       - The first quadlet of CIP header (hex)
       - The second quadlet of CIP header (hex)
       - The number of included quadlets
       - The index of packet in a buffer maintained by this module
      
      This is an example to parse these lines from text file by Python3 script:
      
      \#!/usr/bin/env python3
      import sys
      
      def parse_ts(second, cycle, syt):
          offset = syt & 0xfff
          syt >>= 12
          if cycle & 0x0f > syt:
              cycle += 0x10
          cycle &= 0x1ff0
          cycle |= syt
          second += cycle // 8000
          cycle %= 8000
          # In CYCLE_TIMER of 1394 OHCI, second is represented in 8 bit.
          second %= 128
          return (second, cycle, offset)
      
      def calc_ts(second, cycle, offset):
          ts = offset
          ts += cycle * 3072
          # In DMA descriptor of 1394 OHCI, second is represented in 3 bit.
          ts += (second % 8) * 8000 * 3072
          return ts
      
      def subtract_ts(minuend, subtrahend):
          # In DMA descriptor of 1394 OHCI, second is represented in 3 bit.
          if minuend < subtrahend:
              minuend += 8 * 8000 * 3072
          return minuend - subtrahend
      
      if len(sys.argv) != 2:
          print('At least, one argument is required for packet dump.')
          sys.exit()
      
      filename = sys.argv[1]
      
      data = []
      
      prev = 0
      with open(filename, 'r') as f:
          for line in f:
              pos = line.find('packet:')
              if pos < 0:
                  continue
      
              pos += len('packet:')
              line = line[pos:].strip()
              fields = line.split(' ')
      
              datum = []
      
              datum.append(fields[8])
      
              syt = int(fields[6][4:], 16)
      
              # Empty packet in IEC 61883-1, or NODATA in IEC 61883-6
              if syt == 0xffff:
                  data_blocks = 0
              else:
                  payload_size = int(fields[7], 10)
                  data_block_size = int(fields[5][2:4], 16)
                  data_blocks = (payload_size - 2) / data_block_size
              datum.append(data_blocks)
      
              second = int(fields[0], 10)
              cycle = int(fields[1], 10)
              start = (second << 25) | (cycle << 12)
              datum.append('0x{0:08x}'.format(start))
              start = calc_ts(second, cycle, 0)
      
              datum.append("0x" + fields[5])
              datum.append("0x" + fields[6])
      
              if syt == 0xffff:
                  second = 0
                  cycle = 0
                  tick = 0
              else:
                  second, cycle, tick = parse_ts(second, cycle, syt)
              ts = calc_ts(second, cycle, tick)
              datum.append(start)
              datum.append(ts)
              if ts == 0:
                  datum.append(0)
                  datum.append(0)
              else:
                  # Usual case, or a case over 8 seconds.
                  if ts > start or start > 7 * 8000 * 3072:
                      datum.append(subtract_ts(ts, start))
                      if ts > prev or start > 7 * 8000 * 3072:
                          gap = subtract_ts(ts, prev)
                          datum.append(gap)
                      else:
                          datum.append('backward')
                  else:
                      datum.append('invalid')
                  prev = ts
      
              data.append(datum)
      
      sys.exit()
      
      The data variable includes array with these elements:
      - The index of the packet
      - The number of data blocks in the packet
      - The value of cycle count (hex)
      - The value of CIP header 1 (hex)
      - The value of CIP header 2 (hex)
      - The value of cycle count (tick)
      - The value of calculated presentation timestamp (tick)
      - The offset between the cycle count and presentation timestamp
      - The elapsed ticks from the previous presentation timestamp
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0c95c1d6
    • T
      ALSA: firewire-lib: compute the value of second field in cycle count for IR context · f90e2ded
      Takashi Sakamoto 提交于
      In callback function of isochronous context, modules can queue packets to
      indicated isochronous cycles. Although the cycle to queue a packet is
      deterministic by calculation, this module doesn't implement the calculation
      because it's useless for processing.
      
      In future, the cycle count is going to be printed with the other parameters
      for debugging. This commit is the preparation. The cycle count is computed
      by cycle unit, and correctly arranged to corresponding packets. The
      calculated count is used in later commit.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f90e2ded
    • T
      ALSA: firewire-lib: compute the value of second field in cycle count for IT context · 73fc7f08
      Takashi Sakamoto 提交于
      In callback function of isochronous context, u32 variable is passed for
      cycle count. The value of this variable comes from DMA descriptors of 1394
      Open Host Controller Interface (1394 OHCI). In the specification, DMA
      descriptors transport lower 3 bits for second field and full cycle field in
      16 bits field, therefore 16 bits of the u32 variable are available. The
      value for second is modulo 8, and the value for cycle is modulo 8,000.
      
      Currently, ALSA firewire-lib module don't use the value of the second
      field, because the value is useless to calculate presentation timestamp in
      IEC 61883-6. However, the value may be useful for debugging. In later
      commit, it will be printed with the other parameters for debugging.
      
      This commit makes this module to handle the whole cycle count including
      second. The value is calculated by cycle unit. The existed code is already
      written with ignoring the value of second, thus this commit causes no
      issues.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      73fc7f08
  3. 08 5月, 2016 1 次提交
    • T
      ALSA: dice: add support for M-Audio Profire 610 and perhaps 2626 · f8ff65bc
      Takashi 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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f8ff65bc
  4. 25 4月, 2016 1 次提交
  5. 31 3月, 2016 7 次提交
  6. 28 3月, 2016 5 次提交
  7. 10 3月, 2016 1 次提交
  8. 09 3月, 2016 4 次提交
    • T
      ALSA: dice: force to add two pcm devices for listed models · 7cafc65b
      Takashi 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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7cafc65b
    • T
      ALSA: dice: handle several PCM substreams when any isochronous streams are available · 4bdc495c
      Takashi Sakamoto 提交于
      In former commits, ALSA dice driver can handle available isochronous
      streams. This commit adds support for several PCM substreams on the
      streams.
      
      The additional PCM substreams are available via another ALSA PCM character
      devices so that one ALSA PCM application can handle them without cumbersome
      operations. For example, two PCM substreams are available on each stream,
      two ALSA character devices are added for them. In configuration space of
      alsa-lib, it's represented with 'hw:0,0' and 'hw:0,1'.
      
      The PCM substreams are constraint to parameters of the corresponding
      streams. If the PCM substreams are unavailable for some reasons,
      open(2) to ALSA PCM character device returns error and reports ENXIO.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4bdc495c
    • T
      ALSA: dice: handle whole available isochronous streams · 436b5abe
      Takashi Sakamoto 提交于
      This commit enables ALSA dice driver to handle whole available streams.
      
      In Dice, certain registers represent the number of available streams at
      current sampling transfer frequency for both directions. The parameters
      of each stream are represented in a block of register. This block is
      aligned sequentially. These streams start simultaneously by writing
      enable bit to a register.
      
      This commit operates these registers when starting/stopping streams.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      436b5abe
    • T
      ALSA: dice: have two sets of isochronous resources/streams · 8ae25b76
      Takashi Sakamoto 提交于
      Currently ALSA dice driver handles a pair of isochronous resources for
      IEC 61883-1/6 packet streaming. While, according to some documents about
      ASICs named as 'Dice', several isochronous streams are available.
      
      Here, I start to describe ASICs produced under 'Dice' name.
       * Dice II (designed by wavefront semiconductor, including TCAT's IP)
         * STD (with limited functionality of DTCP)
         * CP  (with full functionality of DTCP)
       * TCD2210/2210-E (so-called 'Dice Mini')
       * TCD2220/2220-E (so-called 'Dice Jr.')
       * TCD3070-CH (so-called 'Dice III')
      
      Some documents are public and we can see hardware design of them. We can
      find some articles about hardware internal register definitions
      (not registers exported to IEEE 1394 bus).
      
      * DICE II User Guide
        * http://www.tctechnologies.tc/archive/downloads/dice_ii_user_guide.pdf
          * 6.1 AVS Audio Receivers
            * Table 6.1: AVS Audio Receiver Memory Map
              * ARX1-ARX4
          * 6.2 AVS Audio Transmitters
            * Table 6.2: AVS Audio Transmitter Memory Map
              * ATX1, ATX2
      * TCD22xx User Guide
        * http://www.tctechnologies.tc/downloads/tcd22xx_user_guide.pdf
          * 6.1 AVS Audio Receivers
            * Table 66: AVS Audio Receiver Memory Map
              * ARX1, ARX2
          * 6/2 AVS Audio Transmitters
            * Table 67: AVS Audio Transmitter Memory Map
              * ATX1, ATX2
      * DICE III
        * http://www.tctechnologies.tc/downloads/TCD3070-CH.pdf
          * Dual stream 63 channel transmitter/receiver
      
      For Dice II and TCD22xx series, maximum 16 data channels are transferred in
      an AMDTP packet, while for Dice III, maximum 32 data channels are
      transferred.
      
      According to the design of the series of these ASICs, this commit allows
      this driver to handle additional set of isochronous resources. For
      practical reason, two pair of isochronous resources are added. As of this
      commit, this driver still use a pair of the first isochronous resources.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      8ae25b76
  9. 28 2月, 2016 1 次提交
    • T
      ALSA: dice: drop duplex streams synchronization to transfer own time stamps · 1387e3ea
      Takashi Sakamoto 提交于
      This commit drops implementation of duplex streams synchronization
      from ALSA dice driver, due to a reason of hardware design. This patch
      allows dice-based units to generate sounds correctly when isochronous
      packet streaming starts at first time.
      
      In IEC 61883-6:2005, CIP packetization layer for AM824 data format
      utilizes the value of SYT field in CIP header of received packet for
      a reference to phase lock loop. Figure 3 in clause 4.3 describes it.
      The value is an offset from cycle_time field of every cycle start packet
      from cycle master on IEEE 1394 bus. The time calculated with these two
      fields is called as 'presentation timestamp' which represents the time
      to play data included in the packet.
      
      Although, this idea includes some problems due to accuracy of timekeep in
      cycle master, accuracy of transmission of cycle start packet on the bus
      with the other units, accuracy of sampling clock in data transmitter side
      and accuracy of replay in data receiver side. In most case, these
      accuracies somewhat worse because there's no such ideal hardwares in this
      world.
      
      For the issues, ASICs for Dice include Jitter Elimination Technologies
      (JET) PLL. The PLL can handle several sources of clock and compensate it
      with high-precision internal clock source. The sequence of value in syt
      field of received AMDTP packets is one of the sources, therefore
      transmitters on IEEE 1394 bus should transfer it.
      
      On the other hand, current ALSA dice driver is programmed with a mode of
      duplex streams with synchronization. In this mode, the driver outputs
      packets after some incoming packets are handled, to re-use the value of
      SYT field in incoming packets to the value for outgoing packets. This mode
      is enabled when source signal of sampling clock is set to internal, and
      this is a major use case. Thus, in most cases, the unit receives no packets
      during a short time after packet streaming starts.
      
      As long as I experienced, this causes the units to generate no sounds at
      first time to receive packets. This issue occurs only with Dice II. I guess
      this is due to a quirk of the PLL. In short, the PLL cannot generate firm
      signals to ADCs/DACs or the other ICs when no packets are received in the
      beginning of packet streaming. While, on second time or later, the unit
      generates sound correctly. I guess that starting packet streaming at first
      time sets the PLL correctly.
      
      Well, still based on my hypothesis and no way to prove it, this commit
      drops duplex streams synchronization from this driver. At least, the PLL
      requires the sequence of value in SYT field of received AMDTP packets as
      one of source of clock signals with internal clock source.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      1387e3ea
  10. 24 2月, 2016 2 次提交
    • T
      ALSA: oxfw: discontinue MIDI substream for scs1x at transaction failure · 956dea9e
      Takashi Sakamoto 提交于
      With a previous commit, ALSA oxfw driver retries transferring MIDI
      messages at transaction failure for scs1x. On the other hand, there're
      fatal transaction error. Then, no MIDI messages reach to the unit anymore.
      In this case, MIDI substream should be terminated.
      
      This commit stops MIDI transmission after the fatal error occurs.
      Unfortunately, unlike ALSA PCM functionality, ALSA rawmidi core has no
      feature to discontinue MIDI substream runtime in kernel side, thus this
      commit just stops MIDI transmission without notifying it to userspace.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      956dea9e
    • T
      ALSA: oxfw: retry MIDI transferring for scs1x at transaction failure · b4c23ab1
      Takashi Sakamoto 提交于
      Currently, ALSA oxfw driver has a TODO to retry MIDI transferring
      at transaction failure.
      
      This commit achieves it. Current implementation uses snd_rawmidi_transmit()
      to transfer messages, thus the target MIDI messages are not in buffer when
      transaction failure is detected. Although we cannot use a pair of
      snd_rawmidi_transmit_peek() and snd_ramwidi_transmit_ack(), the
      messages are still in scs1x specific structure and the data is available
      for retries.
      
      This commit adds a member to the structure for the length of buffered
      messages, and uses the value again at retries.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b4c23ab1
  11. 20 2月, 2016 5 次提交
    • T
      ALSA: fireworks: serialize transactions to update connections at bus reset · 99d73559
      Takashi Sakamoto 提交于
      In IEC 61883-1, at bus-reset, applications can continue isochronous
      streaming by updating connections. In ALSA fireworks driver, the
      operation is executed in 'update' handler for bus driver.
      
      The connection resources are also changed in process contexts of PCM/MIDI
      applications. Therefore, bus-reset handling has race condition
      against connection. Current ALSA fireworks driver has a bug for the
      condition.
      
      This commit fixes the bug, by expand critical section with mutex. As a
      result, connection updating operation in bus-reset handler and connection
      changing operation in process context are serialized.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      99d73559
    • T
      ALSA: bebob: give up updating streams at bus reset handler · 3800e6f9
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3800e6f9
    • T
      ALSA: bebob: change type of substream counter from atomic_t to unsigned int · 4fd6c6c7
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4fd6c6c7
    • T
      ALSA: bebob: move mutex from function callee to callers · 2a71e701
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2a71e701
    • T
      ALSA: bebob: simplify bus-reset handling · 14a37ac1
      Takashi Sakamoto 提交于
      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 ('b6bc8123:
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      14a37ac1
  12. 18 2月, 2016 1 次提交
    • T
      ALSA: oxfw: use workqueue instead of tasklet for scs1x · ea790053
      Takashi Sakamoto 提交于
      This commit replaces tasklet with workqueue for scs1x functionality of
      ALSA oxfw driver.
      
      This driver transfers MIDI message specific for SCS.1m and SCS.1d. This
      task is currently done in software IRQ context of tasklet. In a view of
      system, this context is limited resources and some important drivers (at
      least, more important than ALSA oxfw driver) use the context as its
      bottom-harf.
      
      If the work to transfer MIDI messages is done within a time, it's better
      to use the other context for the work. Actually, with recent CPUs, the
      work will be scheduled within a time. This is a reason of this commit.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ea790053
  13. 12 2月, 2016 2 次提交
  14. 09 2月, 2016 4 次提交
    • T
      ALSA: dice: ensure phase lock before starting streaming · dfabc0ee
      Takashi Sakamoto 提交于
      In former commits, probing process has no need to set sampling transfer
      frequency. Although it's OK to drop a function to change the frequency
      from this module, some models require it before streaming. This seems to
      be due to phase lock of clock source.
      
      This commit moves the function from transaction layer to stream layer, and
      rename it according to the purpose.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      dfabc0ee
    • T
      ALSA: dice: purge generating channel cache · 6f688268
      Takashi 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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6f688268
    • T
      ALSA: dice: get the number of MBLA data channel at opening PCM substream · c3007656
      Takashi Sakamoto 提交于
      This commit is a preparation to remove members related to channel cache
      for the number of channels for multi bit linear audio data and MIDI
      ports. This commit changes the way to get the number of multi bit linear
      audio data channel. It's directly retrieved by asynchronous transactions
      to some registers.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c3007656
    • T
      ALSA: dice: add MIDI ports according to current number of MIDI substreams · b9022f4d
      Takashi Sakamoto 提交于
      This commit changes the way to add ALSA MIDI ports. This driver read the
      number of multiplexed MIDI substreams from hardware register, then adds the
      same number of ALSA MIDI ports. This commit is based on my assumption that
      the number is fixed at all of supported sampling transfer frequency.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b9022f4d