1. 29 Sep, 2015 10 commits
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: move PCM substream constraint to AM824 layer · bc8500da
      Takashi Sakamoto authored
      In IEC 61883-6, PCM frames are transferred in Multi Bit Linear Audio data
      channel. The data channel transfers 16/20/24 bit PCM samples. Thus, PCM
      substream has a constrain about it.
      
      This commit moves codes related to the constraint from packet streaming
      layer to AM824 data block processing layer.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      bc8500da
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: rename parameter setting function for AM824 with FDF field · 51c29fd2
      Takashi Sakamoto authored
      The value of FDF field in CIP header is protocol-dependent. Thus, it's
      better to allow data block processing layer to decide the value in any
      timing.
      
      In AM824 data format, the value of FDF field in CIP header indicates
      N-flag and Nominal Sampling Frequency Code (sfc). The N-flag is for
      switching 'Clock-based rate control mode' and 'Command-based rate control
      mode'. In our implementation, 'Clock-based rate control mode' is just
      supported. Therefore, When sampling transfer frequency is decided, then
      the FDF can be set.
      
      This commit replaces 'amdtp_stream_set_parameters' with
      'amdtp_am824_set_parameters' to set the FDF. This is the same timing
      to decide the ration between the number of data blocks and the number of
      PCM frames.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      51c29fd2
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: add data block processing layer for AM824 format · 5955815e
      Takashi Sakamoto authored
      This commit adds data block processing layer for AM824 format. The new
      layer initializes streaming layer with its value for fmt field.
      
      Currently, most implementation of data block processing still remains
      streaming layer. In later commits, these codes will be moved to the layer.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5955815e
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: rename 'amdtp' to 'amdtp-stream' to prepare for functional separation · d67c46b9
      Takashi Sakamoto authored
      In later commit, data block processing layer will be newly added. This
      layer will be named as 'amdtp-am824'.
      
      This commit renames current amdtp file to amdtp-stream, to distinguish it
      from the new layer.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d67c46b9
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: add support arbitrary value for fmt/fdf fields in CIP header · 414ba022
      Takashi Sakamoto authored
      Some vendor specific protocol uses its own value for fmt/fdf fields in
      CIP header.
      
      This commit support to set arbitrary values for the fields.
      
      In IEC 61883-6, NO-DATA code is defined for FDF field. A packet with this
      code includes no data even if it includes some data blocks. This commit
      still leaves a condition to handle this special packet.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      414ba022
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: add helper functions as interfaces between packet... · 20e44577
      Takashi Sakamoto authored
      ALSA: firewire-lib: add helper functions as interfaces between packet streaming layer and data block processing layer
      
      ALSA PCM framework uses PCM buffer with a concept of 'period' to
      synchronize userspace operations to hardware for nearly-realtime
      processing. Each driver implements snd_pcm_period_elapsed() to tell across
      of the period boundary to ALSA PCM middleware. To call the function, some
      drivers utilize hardware interrupt handlers, the others count handled PCM
      frames.
      
      Drivers for sound units on IEEE 1394 bus are the latter. They use two
      buffers; PCM buffer and DMA buffer for IEEE 1394 isochronous packet. PCM
      frames are copied between these two buffers and 'amdtp_stream' structure
      counts the handled PCM frames. Then, snd_pcm_period_elapsed() is called if
      required.
      
      Essentially, packet streaming layer should not be responsible for PCM
      frame processing. The PCM frame processing should be handled in each data
      block processing layer as a result of handling data blocks. Although, PCM
      frame counting is a common work for all of protocols which ALSA firewire
      stack is going to support.
      
      This commit adds two new helper functions as interfaces between packet
      streaming layer to data block processing layer. In future, each data block
      processing layer implements these functions. The packet streaming layer
      calls data block processing layer per packet by calling the functions. The
      data block processing layer processes data blocks and PCM frames, and
      returns the number of processed PCM frames. Then the packet streaming layer
      calculates handled PCM frames and calls snd_pcm_period_elapsed().
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      20e44577
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: add a member of frame_multiplier instead of double_pcm_frames · 6a4e89ff
      Takashi Sakamoto authored
      In future commit, interface between data block processing layer and packet
      stream processing layer is defined. These two layers communicate the
      number of data blocks and the number of PCM frames.
      
      The data block processing layer has a responsibility for calculating the
      number of PCM frames. Therefore, 'dual wire' of Dice quirk should be
      handled in data block processing layer.
      
      This commit adds a member of 'frame_multiplier'. This member represents
      the ratio of the number of PCM frames against the number of data blocks.
      Usually, the value of this member is 1, while it's 2 in Dice's 'dual wire'.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6a4e89ff
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: add an argument for Dice's dual wire mode · 27ec83b5
      Takashi Sakamoto authored
      In IEC 61883-6, one data block represents one event. In ALSA, the event is
      one PCM frame. Therefore, when processing one data block, current
      implementation counts one PCM frame.
      
      On the other hand, Dice platform has a quirk called as 'dual wire' at
      higher sampling rate. In detail, see comment of commit 6eb6c81e
      ("ALSA: dice: Split stream functionality into a file").
      
      Currently, to handle this quirk, AMDTP stream structure has a
      'double_pcm_frames' member. When this is enabled, two PCM frames are
      counted. Each driver set this flag by accessing the structure member
      directly.
      
      In future commit, some members related to AM824 data block will be moved
      to specific structure, to separate packet streaming layer and data block
      processing layer. The access will be limited by opaque pointer.
      
      For this reason, this commit adds an argument into
      amdtp_stream_set_parameter() to set the flag.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      27ec83b5
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: return error code when amdtp_stream_set_parameters() detects error · 547e631c
      Takashi Sakamoto authored
      Currently, amdtp_stream_set_parameters() returns no error even if wrong
      arguments are given. This is not good for streaming layer because drivers
      can continue processing ignoring capability of streaming layer.
      
      This commit changes this function to return error code.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      547e631c
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: arrange structure for AMDTP stream · 10b2b6dc
      Takashi Sakamoto authored
      In later commit, some members related to AM824 data format will be moved
      from AMDTP stream structure to data block structure. This commit is a
      preparation for it. Additionally, current layout of AMDTP stream structure
      is a bit mess by several extensions. This commit also arranges the layout.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      10b2b6dc
  2. 29 Aug, 2015 1 commit
  3. 07 Aug, 2015 1 commit
  4. 05 Aug, 2015 2 commits
    • Takashi Sakamoto's avatar
      ALSA: fireworks/firewire-lib: add support for recent firmware quirk · 18f5ed36
      Takashi Sakamoto authored
      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: default avatarJohannes Oertei <johannes.oertel@uni-due.de>
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      18f5ed36
    • Takashi Sakamoto's avatar
      Revert "ALSA: fireworks: add support for AudioFire2 quirk" · c85523d1
      Takashi Sakamoto authored
      This reverts commit 9c6893e0.
      
      The fix is superseded by the next commit as a better implementation
      for supporting AudioFire2/AudioFire4/AudioFirePre8 quirks.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c85523d1
  5. 27 Jul, 2015 1 commit
    • Takashi Sakamoto's avatar
      ALSA: fireworks: add support for AudioFire2 quirk · 9c6893e0
      Takashi Sakamoto authored
      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.
      
      Echo Audio ships several versions of firmwares for each model. These
      firmwares have each quirk and the quirk changes a sequence of packets.
      
      AudioFire2 has a quirk to transfer a first packet with non-zero in
      its dbc field. This causes ALSA Fireworks driver to detect discontinuity.
      As long as I investigated, firmware 5.7, 5.7.6 and 5.8 have this quirk.
      
      This commit adds a support for the quirk to handle AudioFire2 packets.
      For safe, CIP_SKIP_INIT_DBC_CHECK is applied to all versions of
      AudioFire2's firmwares.
      
      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
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9c6893e0
  6. 15 Jun, 2015 11 commits
  7. 27 May, 2015 1 commit
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: fix buffer-over-run when detecting packet discontinuity · 31ea49ba
      Takashi Sakamoto authored
      When detecting packet discontinuity, handle_in_packet() returns minus value
      and this value is assigned to unsigned int variable, then the variable has
      huge value. As a result, the variable causes buffer-over-run in
      handle_out_packet(). This brings invalid page request and system hangup.
      
      This commit fixes the bug to add a new argument into handle_in_packet()
      and the number of handled data blocks is assignd to it. The function
      return value is just used to check error.
      
      I also considered to change the type of local variable to 'int' in
      in_stream_callback(). This idea is based on type-conversion in C standard,
      while it may cause future problems when adding more works. Thus, I dropped
      this idea.
      
      Fixes: 6fc6b9ce('ALSA: firewire-lib: pass the number of data blocks in incoming packets to outgoing packets')
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      31ea49ba
  8. 24 May, 2015 5 commits
  9. 23 May, 2015 5 commits
  10. 08 Apr, 2015 1 commit
  11. 10 Mar, 2015 2 commits