1. 10 May, 2016 10 commits
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: enable the same feature as CIP_SKIP_INIT_DBC_CHECK flag · 62f00e40
      Takashi Sakamoto authored
      In former commit, drivers in ALSA firewire stack always starts IT context
      before IR context. If IR context starts after packets are transmitted by
      peer unit, packet discontinuity may be detected because the context starts
      in the middle of packet streaming. This situation is rare because IT
      context usually starts immediately. However, it's better to solve this
      issue. This is suppressed with CIP_SKIP_INIT_DBC_CHECK flag.
      
      This commit enables the same feature as CIP_SKIP_INIT_DBC_CHECK.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      62f00e40
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: code cleanup for outgoing packet handling · 390a1512
      Takashi Sakamoto authored
      In previous commit, this module has no need to reuse parameters of
      incoming packets for outgoing packets anymore. This commit arranges some
      needless codes for outgoing packet processing.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      390a1512
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: code cleanup for incoming packet handling · d9a16fc9
      Takashi Sakamoto authored
      In previous commit, this module has no need to reuse parameters of
      incoming packets for outgoing packets anymore. This commit arranges some
      needless codes for incoming packet processing.
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d9a16fc9
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: handle IT/IR contexts in each software interrupt context · dec63cc8
      Takashi Sakamoto authored
      In clause 6.3 of IEC 61883-6:2000, there's an explanation about processing
      of presentation timestamp. In the clause, we can see "If a function block
      receives a CIP, processes it and subsequently re-transmits it, then the
      SYT of the outgoing CIP shall be the sum of the incoming SYT and the
      processing delay." ALSA firewire stack has an implementation to partly
      satisfy this specification. Developers assumed the stack to perform as an
      Audio function block[1].
      
      Following to the assumption, current implementation of ALSA firewire stack
      use one software interrupt context to handle both of in/out packets. In
      most case, this is processed in 1394 OHCI IR context independently of the
      opposite context. Thus, this implementation uses longer CPU time in the
      software interrupt context. This is not better for whole system.
      
      Against the assumption, I confirmed that each ASIC for IEC 61883-1/6
      doesn't necessarily expect it to the stack. Thus, current implementation
      of ALSA firewire stack includes over-engineering.
      
      This commit purges the implementation. As a result, packets of one
      direction are handled in one software interrupt context and spends
      minimum CPU time.
      
      [1] [alsa-devel] [PATCH 0/8] [RFC] new driver for Echo Audio's Fireworks based devices
      http://mailman.alsa-project.org/pipermail/alsa-devel/2013-June/062660.htmlSigned-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      dec63cc8
    • Takashi Sakamoto's avatar
      ALSA: firewire-tascam: drop reuse of incoming packet parameter for outgoing packet parameter · 28e64f51
      Takashi Sakamoto authored
      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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      28e64f51
    • Takashi Sakamoto's avatar
      ALSA: fireworks: drop reuse of incoming packet parameter for ougoing packet parameter · eb4a378f
      Takashi Sakamoto authored
      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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      eb4a378f
    • Takashi Sakamoto's avatar
      ALSA: bebob: drop reuse of incoming packet parameter for outgoing packet parameter · c71283cb
      Takashi Sakamoto authored
      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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c71283cb
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · 2e00fde5
      Takashi Iwai authored
      2e00fde5
    • Yura Pakhuchiy's avatar
      ALSA: hda - Fix subwoofer pin on ASUS N751 and N551 · 3231e205
      Yura Pakhuchiy authored
      Subwoofer does not work out of the box on ASUS N751/N551 laptops. This
      patch fixes it. Patch tested on N751 laptop. N551 part is not tested,
      but according to [1] and [2] this laptop requires similar changes, so I
      included them in the patch.
      
      1. https://github.com/honsiorovskyi/asus-n551-hda-fix
      2. https://bugs.launchpad.net/ubuntu/+source/alsa-tools/+bug/1405691
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=117781Signed-off-by: default avatarYura Pakhuchiy <pakhuchiy@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3231e205
    • Takashi Iwai's avatar
      ALSA: hda - Fix broken reconfig · addacd80
      Takashi Iwai authored
      The HD-audio reconfig function got broken in the recent kernels,
      typically resulting in a failure like:
        snd_hda_intel 0000:00:1b.0: control 3:0:0:Playback Channel Map:0 is already present
      
      This is because of the code restructuring to move the PCM and control
      instantiation into the codec drive probe, by the commit [bcd96557:
      ALSA: hda - Build PCMs and controls at codec driver probe].  Although
      the commit above removed the calls of snd_hda_codec_build_pcms() and
      *_build_controls() at the controller driver probe, the similar calls
      in the reconfig were still left forgotten.  This caused the
      conflicting and duplicated PCMs and controls.
      
      The fix is trivial: just remove these superfluous calls from
      reconfig_codec().
      
      Fixes: bcd96557 ('ALSA: hda - Build PCMs and controls at codec driver probe')
      Reported-by: default avatarJochen Henneberg <jh@henneberg-systemdesign.com>
      Cc: <stable@vger.kernel.org> # v4.1+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      addacd80
  2. 09 May, 2016 10 commits
    • Takashi Iwai's avatar
      ALSA: hda - Clarify CONFIG_SND_HDA_RECONFIG usages · 39f0ccde
      Takashi Iwai authored
      Since the recent rewrite of HD-audio infrastructure,
      CONFIG_SND_HDA_RECONFIG has a slightly different meaning.  In the
      earlier versions, it implicitly assumed only the usage via hwdep sysfs
      entries.  Meanwhile, in the recent version, this option is meant to
      enable the reconfig code in HD-audio driver, which may be used by the
      patch loader without hwdep interface.
      
      This patch tries to clarify the usage pattern a bit better, hopefully
      avoid the further confusion.
      Reported-by: default avatarJochen Henneberg <jh@henneberg-systemdesign.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      39f0ccde
    • Charles Keepax's avatar
      ALSA: compress: Replace complex if statement with switch · 875f6fff
      Charles Keepax authored
      A switch statement looks a bit cleaner than an if statement
      spread over 3 lines, as such update this to a switch.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      875f6fff
    • Charles Keepax's avatar
      ALSA: compress: Fix poll error return codes · 1d03f2bd
      Charles Keepax authored
      We can't return a negative error code from the poll callback the return
      type is unsigned and is checked against the poll specific flags we need
      to return POLLERR if we encounter an error.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1d03f2bd
    • Charles Keepax's avatar
      ALSA: compress: Remove pointless NULL check · 5bd05390
      Charles Keepax authored
      stream can't be NULL here as we have just taken the address of it, so no
      need for the check.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5bd05390
    • Charles Keepax's avatar
      ALSA: compress: Use snd_compr_get_poll on error path · 0b92b0cd
      Charles Keepax authored
      We have a function that returns the appropriate flags for the stream
      direction, so we should use it.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      0b92b0cd
    • Charles Keepax's avatar
      ALSA: pcm: Fix poll error return codes · e099aeea
      Charles Keepax authored
      We can't return a negative error code from the poll callback the return
      type is unsigned and is checked against the poll specific flags we need
      to return POLLERR if we encounter an error.
      Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e099aeea
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: add tracepoints to dump a part of isochronous packet data · 0c95c1d6
      Takashi Sakamoto authored
      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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      0c95c1d6
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: compute the value of second field in cycle count for IR context · f90e2ded
      Takashi Sakamoto authored
      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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f90e2ded
    • Takashi Sakamoto's avatar
      ALSA: firewire-lib: compute the value of second field in cycle count for IT context · 73fc7f08
      Takashi Sakamoto authored
      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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      73fc7f08
    • Kaho Ng's avatar
      ALSA: hda - Fix white noise on Asus UX501VW headset · 2da2dc9e
      Kaho Ng authored
      For reducing the noise from the headset output on ASUS UX501VW,
      call the existing fixup, alc_fixup_headset_mode_alc668(), additionally.
      
      Thread: https://bbs.archlinux.org/viewtopic.php?id=209554Signed-off-by: default avatarKaho Ng <ngkaho1234@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2da2dc9e
  3. 08 May, 2016 11 commits
  4. 29 Apr, 2016 2 commits
  5. 27 Apr, 2016 1 commit
  6. 26 Apr, 2016 6 commits