1. 12 10月, 2015 1 次提交
    • T
      ALSA: firewire-lib: continue packet processing at detecting wrong CIP headers · 2a7e1713
      Takashi Sakamoto 提交于
      In firewire-lib, isochronous packet streaming is stopped when detecting
      wrong value for FMT field of CIP headers. Although this is appropriate
      to IEC 61883-1 and 6, some BeBoB based devices with vendors' customization
      use invalid value to FMT field of CIP headers in the beginning of
      streaming.
      
      $ journalctl
        snd-bebob fw1.0: Detect unexpected protocol: 01000000 8000ffff
      
      I got this log with M-Audio FireWire 1814. In this line, the value of FMT
      field is 0x00, while it should be 0x10 in usual AMDTP.
      
      Except for the beginning, these devices continue to transfer packets with
      valid value for FMT field, except for the beginning. Therefore, in this
      case, firewire-lib should continue to process packets. The former
      implementation of firewire-lib performs it.
      
      This commit loosens the handling of wrong value, to continue packet
      processing in the case.
      
      Fixes: 414ba022 ('ALSA: firewire-lib: add support arbitrary value for fmt/fdf fields in CIP header')
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2a7e1713
  2. 29 9月, 2015 12 次提交
  3. 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
  4. 27 5月, 2015 1 次提交
    • T
      ALSA: firewire-lib: fix buffer-over-run when detecting packet discontinuity · 31ea49ba
      Takashi Sakamoto 提交于
      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: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      31ea49ba
  5. 24 5月, 2015 4 次提交
  6. 23 5月, 2015 5 次提交
  7. 10 3月, 2015 1 次提交
  8. 23 2月, 2015 2 次提交
  9. 17 1月, 2015 2 次提交
  10. 10 11月, 2014 1 次提交
    • T
      ALSA: pcm: Add snd_pcm_stop_xrun() helper · 1fb8510c
      Takashi Iwai 提交于
      Add a new helper function snd_pcm_stop_xrun() to the standard sequnce
      lock/snd_pcm_stop(XRUN)/unlock by a single call, and replace the
      existing open codes with this helper.
      
      The function checks the PCM running state to prevent setting the wrong
      state, too, for more safety.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      1fb8510c
  11. 29 8月, 2014 1 次提交
    • T
      ALSA: firewire-lib/dice: add arrangements of PCM pointer and interrupts for Dice quirk · 65845f29
      Takashi Sakamoto 提交于
      In IEC 61883-6, one data block transfers one event. In ALSA, the event equals one PCM frame,
      hence one data block transfers one PCM frame. But Dice has a quirk at higher sampling rate
      (176.4/192.0 kHz) that one data block transfers two PCM frames.
      
      Commit 10550bea ("ALSA: dice/firewire-lib: Keep dualwire mode but obsolete
      CIP_HI_DUALWIRE") moved some codes related to this quirk into Dice driver. But the commit
      forgot to add arrangements for PCM period interrupts and DMA pointer updates. As a result, Dice
      driver cannot work correctly at higher sampling rate.
      
      This commit adds 'double_pcm_frames' parameter to amdtp structure for this quirk. When this
      parameter is set, PCM period interrupts and DMA pointer updates occur at double speed than in
      IEC 61883-6.
      Reported-by: NDaniel Robbins <drobbins@funtoo.org>
      Fixes: 10550bea ("ALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRE")
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # 3.16
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      65845f29
  12. 02 6月, 2014 1 次提交
    • T
      ALSA: firewire-lib: Use IEC 61883-6 compliant labels for Raw Audio data · a6975f2a
      Takashi Sakamoto 提交于
      According to AM824 in IEC 61883-6:2002, 2 bits in LSB of label for Raw Audio
      data means Valid Length Code (VBL). Ths value is:
      - b00 for 24 bits sample (label is 0x40)
      - b01 for 20 bits sample (label is 0x41)
      - b10 for 16 bits sample (label is 0x42)
      
      But current firewire-lib apply 24 bits label for both of 16/24 bits samples.
      
      As long as developers investigate BeBoB/Fireworks/OXFW/Dice, all of them
      have a behaviour to ignore the label. They can generate correct sound even
      if firewire-lib gives wrong label (i.e. 0xff). On BeBoB, this is not only
      for Raw Audio data channel, but also for IEC 60958 Conformant data channel.
      
      So there is little possibility of regression.
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a6975f2a
  13. 27 5月, 2014 1 次提交
  14. 26 5月, 2014 7 次提交
    • T
      ALSA: bebob/firewire-lib: Add a quirk of wrong dbc in empty packet for M-Audio... · 9d59124c
      Takashi Sakamoto 提交于
      ALSA: bebob/firewire-lib: Add a quirk of wrong dbc in empty packet for M-Audio special Firewire series
      
      M-Audio Firewire 1814 has a quirk, ProjectMix I/O also has. They transmit
      empty packet with wrong value of dbc incremented by 8 at high sampling rate.
      According to IEC 61883-1, this value should be the same as the one in
      previous packet.
      
      This commit adds a flag named as CIP_EMPTY_HAS_WRONG_DBC. With flag, the value
      of dbc in empty packet is overwittern by an expected value.
      
      This is an example of this quirk:
      CIP Header 0	CIP Header 1	Payload size
      010D0000	9004F759	210
      010D0010	90040B59	210
      010D0020	90042359	210
      01020028	9004FFFF	2  <-
      010D0030	90043759	210
      010D0040	90044B59	210
      010D0050	90046359	210
      01020058	9004FFFF	2  <-
      010D0060	90047759	210
      010D0070	90048B59	210
      010D0080	9004A359	210
      01020088	9004FFFF	2  <-
      010D0090	9004B759	210
      010D00A0	9004CB59	210
      010D00B0	9004E359	210
      010200B8	9004FFFF	2  <-
      010D00C0	9004F759	210
      010D00D0	90040B59	210
      010D00E0	90042359	210
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9d59124c
    • T
      ALSA: bebob/firewire-lib: Add a quirk for discontinuity at bus reset · b6bc8123
      Takashi Sakamoto 提交于
      Normal BeBoB firmware has a quirk. When receiving bus reset, it transmits
      packets with discontinuous value in dbc field.
      
      This causes two situation, one is to abort streaming by firewire-lib as a
      result of detecting the discontinuity. Another is to call driver's .update()
      because of bus reset. These two is generated independently. (The former
      depends on isochronous stream and the latter depends on IEEE1394 bus driver.)
      
      When BeBoB driver works with XRUN-recoverable applications, this situation
      looks like stream_start_duplex() call followed by stream_update_duplex() call
      because applications will call snd_pcm_prepare() immediately at XRUN.
      
      To update connections and streams at first, this commit use completion. When
      queueing error occurs, stream_start_duplex() is forced to wait maximum
      1000msec. During this, when .update() is called, the completion is waken and
      stream_start_duplex() is processed without breaking connections.
      
      At bus reset, stream_start_duplex() shouldn't break/establish connections and
      stream_update_duplex() should update connections because a caller of
      fw_iso_resources_allocate() is responsible for calling
      fw_iso_resources_update() on bus reset.
      
      This commit also adds a flag, which has an effect to skip checking continuity
      for first packet. This flag is useful for BeBoB quirk to start handling packets
      during streaming.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b6bc8123
    • T
      ALSA: fireworks/firewire-lib: Add a quirk of data blocks for MIDI in out-stream · 53111cdc
      Takashi Sakamoto 提交于
      Fireworks has a quirk to ignore MIDI messages in data blocks more than 8.
      This commit adds a flag for this quirk and codes to skip 8 or more data
      blocks to transfer MIDI messages.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      53111cdc
    • T
      ALSA: fireworks/firewire-lib: Add a quirk to reset data block counter at bus reset · b84b1a27
      Takashi Sakamoto 提交于
      Fireworks has a quirk to reset data block counter at bus reset.
      
      This commit adds a flag of CIP_SKIP_DBC_ZERO_CHECK. This flag has an effect
      to skip checking dbc continuity when dbc is zero.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b84b1a27
    • T
      ALSA: fireworks/firewire-lib: Add a quirk for fixed interval of reported dbc · d9cd0065
      Takashi Sakamoto 提交于
      Fireworks firmware version 5.5 reports fix interval for dbc in each packet.
      
      For example, AudioFire4:
      CIP0     CIP1     Payload
      00070000 900484FF 72
      00070008 9004A8FF 72
      00070008 90FFFFFF 02
      00070010 9004D0FF 72
      00070018 9004C4FF 72
      00070020 9004E8FF 72
      00070020 90FFFFFF 02
      00070028 900410FE 72
      
      The interval of each dbc should be 16 except for empty packet but it's still 8.
      
      This commit adds a flag for this quirk and codes to refer to a fixed value.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d9cd0065
    • T
      ALSA: fireworks/firewire-lib: Add a quirk for wrong dbs in tx packets · 69702239
      Takashi Sakamoto 提交于
      One of Fireworks firmware, named  as 'AudioFire9', seems to transmit
      packets with wrong value of dbs. It's always 0x11 but actual size of
      data block is different.
      
      This commit adds a flag for this quirk and some codes to calculate
      correct size.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      69702239
    • T
      ALSA: fireworks/firewire-lib: Add a quirk for the meaning of dbc · c8bdf49b
      Takashi Sakamoto 提交于
      Fireworks has a quirk for the value of dbc field in transmitted packets.
      For Fireworks, dbc means the end of events in current packet. This is out
      of specification.
      
      For example, AudioFire4:
      CIP0        CIP1    Payload
      01070092 90FFFFFF 02
      0107009A 9001E17B 3A <-
      010700A2 9001F6E5 3A
      010700A2 90FFFFFF 02
      010700AA 9001104F 3A <-
      010700B2 900125B9 3A
      010700BA 90013B23 3A
      010700BA 90FFFFFF 02
      010700C2 9001548E 3A <-
      010700CA 900169F8 3A
      010700CA 90FFFFFF 02
      010700D2 90018362 3A <-
      010700DA 900198CC 3A
      
      According to IEC 61883-1/6, a packet following to empty packet has the same
      value for its dbc. But for Fireworks, it's incremented and empty packet has
      the same value as previous packet in dbc field.
      
      This commit adds a flag for Fireworks and some codes to checking dbc continuity.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c8bdf49b