1. 09 10月, 2015 5 次提交
    • T
      ALSA: firewire-lib: avoid endless loop to transfer MIDI messages at fatal error · bde3e288
      Takashi Sakamoto 提交于
      Currently, when asynchronous transactions finish in error state and
      retries, work scheduling and work running also continues. This
      should be canceled at fatal error because it can cause endless loop.
      
      This commit enables to cancel transferring MIDI messages when transactions
      encounter fatal errors. This is achieved by setting error state.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      bde3e288
    • T
      ALSA: firewire-lib: add throttle for MIDI data rate · ea848b7b
      Takashi Sakamoto 提交于
      Typically, the target devices have internal buffer to adjust output of
      received MIDI messages for MIDI serial bus, while the capacity of the
      buffer is limited. IEEE 1394 transactions can transfer more MIDI messages
      than MIDI serial bus can. This can cause buffer over flow in device side.
      
      This commit adds throttle to limit MIDI data rate by counting intervals
      between two MIDI messages. Usual MIDI messages consists of two or three
      bytes. This requires 1.302 to 1.953 mili-seconds interval between these
      messages. This commit uses kernel monotonic time service to calculate the
      time of next transaction.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ea848b7b
    • T
      ALSA: firewire-lib: schedule work again when MIDI substream has rest of MIDI messages · e8a40d9b
      Takashi Sakamoto 提交于
      Currently, when two MIDI trigger callbacks can be called immediately,
      transactions for the second MIDI messages can be postpone till next trigger
      callback. This is not good for real-time message transmission.
      
      This commit schedules work again at response handling callback if the
      MIDI substream still includes untransferred MIDI messages.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e8a40d9b
    • T
      ALSA: firewire-lib: add a restriction for a transaction at once · d3ef9cb9
      Takashi Sakamoto 提交于
      Currently, when waiting for a response, callers can start another
      transaction by scheduling another work. This is not good for error
      processing of transaction, especially the first response is too late.
      
      This commit serialize request/response transactions, by adding one
      boolean member to represent idling state.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d3ef9cb9
    • T
      ALSA: firewire-lib: add helper functions for asynchronous transactions to transfer MIDI messages · 585d7cba
      Takashi Sakamoto 提交于
      Some models receive MIDI messages via IEEE 1394 asynchronous transactions.
      In this case, MIDI messages are transferred in fixed-length payload. It's
      nice that firewire-lib module has common helper functions.
      
      This commit implements this idea. Each driver adds
      'struct snd_fw_async_midi_port' in its instance structure. In probing,
      it should call snd_fw_async_midi_port_init() to initialize the
      structure with some parameters such as target address, the length
      of payload in a transaction and a pointer for callback function
      to fill the payload buffer. At 'struct snd_rawmidi_ops.trigger()'
      callback, it should call 'snd_fw_async_midi_port_run()' to start
      transactions. Each driver should ensure that the lifetime of MIDI
      substream continues till calling 'snd_fw_async_midi_port_finish()'.
      
      The helper functions support retries to transferring MIDI messages when
      transmission errors occur. When transactions are successful, the helper
      functions call 'snd_rawmidi_transmit_ack()' internally to consume MIDI
      bytes in the buffer. Therefore, Each driver is expected to use
      'snd_rawmidi_transmit_peek()' to tell the number of bytes to transfer to
      return value of 'fill' callback.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      585d7cba
  2. 04 10月, 2015 1 次提交
    • T
      ALSA: bebob: support Firewire I/O card of Mackie Onyx 1220/1620/1640 · 425a570e
      Takashi Sakamoto 提交于
      Current ALSA BeBoB drivers has an entry for this model, while the value of
      vendor ID seems to be wrong according to an user's report.
      
      The vendor had released no updated firmware, thus we can judge that this
      model had not changed the content of its config ROM. It's reasonable to fix
      the ID according to the report.
      
      $ ./linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
      
                     ROM header and bus information block
                     -----------------------------------------------------------------
      400  0425720f  bus_info_length 4, crc_length 37, crc 29199
      404  31333934  bus_name "1394"
      408  f0646122  irmc 1, cmc 1, isc 1, bmc 1, pmc 0, cyc_clk_acc 100,
                     max_rec 6 (128), max_rom 1, gen 2, spd 2 (S400)
      40c  00000ff2  company_id 00000f     |
      410  00004697  device_id f200004697  | EUI-64 00000ff200004697
      
                     root directory
                     -----------------------------------------------------------------
      414  000859be  directory_length 8, crc 22974
      418  04000082  hardware version
      41c  0c0083c0  node capabilities per IEEE 1394
      420  03000ff2  vendor
      424  8100000a  --> descriptor leaf at 44c
      428  17010065  model
      42c  8100000d  --> descriptor leaf at 460
      430  13000910  version
      434  d1000001  --> unit directory at 438
      
                     unit directory at 438
                     -----------------------------------------------------------------
      438  0004ccec  directory_length 4, crc 52460
      43c  1200a02d  specifier id: 1394 TA
      440  13010001  version: AV/C
      444  17010065  model
      448  8100000d  --> descriptor leaf at 47c
      
                     descriptor leaf at 44c
                     -----------------------------------------------------------------
      44c  0004152a  leaf_length 4, crc 5418
      450  00000000  textual descriptor
      454  00000000  minimal ASCII
      458  4d61636b  "Mack"
      45c  69650000  "ie"
      
                     descriptor leaf at 460
                     -----------------------------------------------------------------
      460  000612b5  leaf_length 6, crc 4789
      464  00000000  textual descriptor
      468  00000000  minimal ASCII
      46c  4f6e7978  "Onyx"
      470  20466972  " Fir"
      474  65776972  "ewir"
      478  65000000  "e"
      
                     descriptor leaf at 47c
                     -----------------------------------------------------------------
      47c  000612b5  leaf_length 6, crc 4789
      480  00000000  textual descriptor
      484  00000000  minimal ASCII
      488  4f6e7978  "Onyx"
      48c  20466972  " Fir"
      490  65776972  "ewir"
      494  65000000  "e"
      
      $ cat /proc/asound/card3/firewire/firmware
      Manufacturer:   bridgeCo
      Protocol Ver:   1
      Build Ver:      0
      GUID:           0x00000FF200004697
      Model ID:       0x82
      Model Rev:      1
      Firmware Date:  20040430
      Firmware Time:  131527
      Firmware ID:    0x10065
      Firmware Ver:   2320
      Base Addr:      0x20080000
      Max Size:       1572864
      Loader Date:    20040430
      Loader Time:    112036
      Reported-by: NAndrzej Gansiniec <andrzej@gansiniec.pl>
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      425a570e
  3. 03 10月, 2015 7 次提交
  4. 30 9月, 2015 7 次提交
    • T
      ALSA: firewire-digi00x: add support for asynchronous messaging · 44b73088
      Takashi Sakamoto 提交于
      Digi 002/003 family uses asynchronous transaction for messaging.
      The address to transmit this message is stored on a certain register.
      
      This commit allocates a range of address on OHCI 1394 host controller
      to handle the messaging. As long as I know, the purpose of this message
      seems to notify lost of synchronization. While, the meaning of content
      of the message is not clear.
      
      Actual examples of this messaging:
       * When clock source is set as internal:
       - 0x00007051
       - 0x00007052
       - 0x00007054
       - 0x00007057
       - 0x00007058
       * When clock source is set as somewhat external:
       - 0x00009000
       - 0x00009010
       - 0x00009020
       - 0x00009021
       - 0x00009022
      
      The lost often occurs when using internal clock source. In this case,
      users hear sounds with quite short gap every several minutes. In fact,
      the lost is recovered temporarily.
      
      When using with external clock source, the lost seems not to occur. The
      mechanism is not clear yet.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      44b73088
    • T
      ALSA: firewire-digi00x: add hwdep interface · 660dd3d5
      Takashi Sakamoto 提交于
      This commit adds hwdep interface so as the other sound drivers for units
      on IEEE 1394 bus have.
      
      This interface is designed for mixer/control applications. By using this
      interface, an application can get information about firewire node, can
      lock/unlock kernel streaming and can get notification at starting/stopping
      kernel streaming.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      660dd3d5
    • T
      ALSA: firewire-digi00x: add PCM functionality · 0120d0f1
      Takashi Sakamoto 提交于
      This commit adds PCM functionality to transmit/receive PCM samples.
      
      Any PCM substreams are jointed because incoming/outgoing AMDTP streams
      are bound. When one of PCM substream is running or external clock source
      is selected, current sampling rate is used. Else, the sampling rate is
      changed as an userspace application requests.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0120d0f1
    • T
      ALSA: firewire-digi00x: add proc node to show clock status · 927f17dc
      Takashi Sakamoto 提交于
      This commit adds proc node to show current clock status for debugging.
      
      As long as testing Digi 002 rack, registers can show local clock rate,
      local clock source. When external clock input such as S/PDIF is
      connected, the registers show the detection and external clock rate.
      
      Additionally, the registers show the mode of optical digital input
      interface. Although, a tester with Digi 003 rack reports this makes no
      sense. Further investigation is required for Digi 003 series.
      
      Besides, in Digi 002 rack, the S/PDIF format must be IEC 60958-4,
      so-called professional.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      927f17dc
    • T
      ALSA: firewire-digi00x: add stream functionality · 3a2a1797
      Takashi Sakamoto 提交于
      This commit adds a functionality to manage streaming.
      
      The streaming is not controlled by CMP in IEC 61883-6. It's controlled by
      IEEE 1394 write transaction to certain addresses.
      
      Several clock sources are available, while there're no differences about
      packet transmission. The value of SYT field in transmitted packets is
      always zero. Thus, streams in both direction don't build synchronization.
      
      And the device always requires received packets to transmit packets. This
      driver keeps to transfer outgoing stream even if they're not required.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3a2a1797
    • T
      ALSA: firewire-digi00x: add data block processing layer · 163ae6f3
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      163ae6f3
    • T
      ALSA: firewire-digi00x: add skeleton for Digi 002/003 family · 9edf723f
      Takashi Sakamoto 提交于
      This commit adds a new driver for Digidesign 002/003 family. This commit
      just creates/removes card instance according to bus event. More functions
      will be added in following commits.
      
      Digidesign 002/003 family consists of:
       * Agere FW802B for IEEE 1394 PHY layer
       * PDI 1394L40 for IEEE 1394 LINK layer and IEC 61883 interface
       * ALTERA ACEX EP1K50 for IEC 61883 layer and DSP controller
       * ADSP-21065L for signal processing
      
      [minor cleanup using skip_spaces() by tiwai]
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9edf723f
  5. 29 9月, 2015 16 次提交
  6. 24 9月, 2015 1 次提交
    • T
      ALSA: oxfw: add Mackie Onyx Satellite quirk to inform wrong value in 'dbs' field in tx CIP header · 13f3a46d
      Takashi Sakamoto 提交于
      Mackie Onyx Satellite has two usage; standalone and with base station.
      
      These two modes has different stream formats. In standalone mode, rx data
      block includes 2 Multi Bit Linear Audio (MBLA) data channels and tx data
      block includes 2. With base station, they're 6 and 2.
      
      Although, with base station, the actual tx packet include wrong value in
      'dbs' field in its CIP header. This quirk causes packet streaming layer to
      detect packet discontinuity and to stop PCM substream.
      
      This is a response of 'single' subfunction 'extended stream format
      information' command in AV/C Stream Format Information Specification 1.1.
      It means that a data block in tx packets includes 2 MBLA data channels.
      
      $ ./firewire-request /dev/fw1 fcp 0x01ffbfc001000000ffffffff
      response: 000: 0c ff bf c0 01 00 00 00 ff 00 90 40 03 02 01 02
      response: 010: 06
      
      Current OXFW driver parses the response and detects stream formats
      correctly.
      
      $ cat /proc/asound/card1/firewire/formation
      ...
      Output Stream from device:
      	Rate	PCM	MIDI
      * 	48000	2	0
       	44100	2	0
       	88200	2	0
      	96000	2	0
      
      On the other hand, in actual tx CIP, the 'dbs' field has 6. But the number
      of quadlets in CIP payload is not multiple of 6. Seeing the subtraction of
      two successive payload quadlets, it should be multiple of 2.
      
      payload  CIP      CIP
      quadlets header0  header1
            24 00060052 9002ffff
            24 0006005e 9002ffff
            26 0006006a 9002ffff
            24 00060077 9002ffff
            24 00060083 9002ffff
            26 0006008f 9002ffff
            24 0006009c 9002ffff
            24 000600a8 9002ffff
            26 000600b4 9002ffff
            24 000600c1 9002ffff
      
      This commit adds support for this quirk to OXFW driver, by using
      CIP_WRONG_DBS flag. When this flag is set, packet streaming layer uses
      the value of its 'data_block_quadlets' member instead of the value in CIP
      header. This value is already set by OXFW driver and no discontinuity is
      detected.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      13f3a46d
  7. 29 8月, 2015 1 次提交
  8. 07 8月, 2015 1 次提交
  9. 05 8月, 2015 1 次提交
    • T
      ALSA: fireworks/firewire-lib: add support for recent firmware quirk · 18f5ed36
      Takashi Sakamoto 提交于
      Fireworks uses TSB43CB43(IceLynx-Micro) as its IEC 61883-1/6 interface.
      This chip includes ARM7 core, and loads and runs program. The firmware
      is stored in on-board memory and loaded every powering-on from it.
      
      Echo Audio ships several versions of firmwares for each model. These
      firmwares have each quirk and the quirk changes a sequence of packets.
      
      As long as I investigated, AudioFire2/AudioFire4/AudioFirePre8 have a
      quirk to transfer a first packet with 0x02 in its dbc field. This causes
      ALSA Fireworks driver to detect discontinuity. In this case, firmware
      version 5.7.0, 5.7.3 and 5.8.0 are used.
      
      Payload  CIP      CIP
      quadlets header1  header2
      02       00050002 90ffffff <-
      42       0005000a 90013000
      42       00050012 90014400
      42       0005001a 90015800
      02       0005001a 90ffffff
      42       00050022 90019000
      42       0005002a 9001a400
      42       00050032 9001b800
      02       00050032 90ffffff
      42       0005003a 9001d000
      42       00050042 9001e400
      42       0005004a 9001f800
      02       0005004a 90ffffff
      (AudioFire2 with firmware version 5.7.)
      
      $ dmesg
      snd-fireworks fw1.0: Detect discontinuity of CIP: 00 02
      
      These models, AudioFire8 (since Jul 2009 ) and Gibson Robot Interface
      Pack series uses the same ARM binary as their firmware. Thus, this
      quirk may be observed among them.
      
      This commit adds a new member for AMDTP structure. This member represents
      the value of dbc field in a first AMDTP packet. Drivers can set it with
      a preferred value according to model's quirk.
      Tested-by: NJohannes Oertei <johannes.oertel@uni-due.de>
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      18f5ed36