1. 10 May, 2016 5 commits
    • 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 9 commits
    • Mark Brown's avatar
    • Mark Brown's avatar
      Merge remote-tracking branches 'asoc/fix/arizona', 'asoc/fix/cs35l32',... · 78cfca32
      Mark Brown authored
      Merge remote-tracking branches 'asoc/fix/arizona', 'asoc/fix/cs35l32', 'asoc/fix/hdac', 'asoc/fix/nau8825' and 'asoc/fix/rt5616' into asoc-linus
      78cfca32
    • Mark Brown's avatar
    • Mark Brown's avatar
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · a33d5959
      Takashi Iwai authored
      For taking back the recent change of HDA HDMI fixes for i915 HSW/BDW.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a33d5959
    • Takashi Iwai's avatar
      ALSA: hda - Update BCLK also at hotplug for i915 HSW/BDW · bb03ed21
      Takashi Iwai authored
      The recent bug report suggests that BCLK setup for i915 HSW/BDW needs
      to be updated at each HDMI hotplug, not only at initialization and
      resume.  That is, we need to update HSW_EM4 and HSW_EM5 registers at
      ELD notification, too.  Otherwise the HDMI audio may be out of sync
      and played in a wrong pitch.
      
      However, the HDA codec driver has no access to the controller
      registers, and currently the code managing these registers is in
      hda_intel.c, i.e. local to the controller driver.  For allowing the
      explicit BCLK update from the codec driver, as in this patch, the
      former haswell_set_bclk() in hda_intel.c is moved to hdac_i915.c and
      exposed as snd_hdac_i915_set_bclk().  This is called from both the HDA
      controller driver and intel_pin_eld_notify() in HDMI codec driver.
      
      Along with this change, snd_hdac_get_display_clk() gets dropped as
      it's no longer used.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91410
      Cc: <stable@vger.kernel.org> # v4.5+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      bb03ed21
    • Conrad Kostecki's avatar
      ALSA: hda - Add dock support for ThinkPad X260 · 037e1197
      Conrad Kostecki authored
      Fixes audio output on a ThinkPad X260, when using Lenovo CES 2013
      docking station series (basic, pro, ultra).
      Signed-off-by: default avatarConrad Kostecki <ck+linuxkernel@bl4ckb0x.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      037e1197
    • Takashi Iwai's avatar
      ALSA: au88x0: Fix overlapped PCM pointer · 58a8738c
      Takashi Iwai authored
      au88x0 hardware seems returning the current pointer at the buffer
      boundary instead of going back to zero.  This results in spewing
      warnings from PCM core.
      
      This patch corrects the return value from the pointer callback within
      the proper value range, just returning zero if the position is equal
      or above the buffer size.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      58a8738c
    • Takashi Iwai's avatar
      ALSA: hrtimer: Handle start/stop more properly · d2c5cf88
      Takashi Iwai authored
      This patch tries to address the still remaining issues in ALSA hrtimer
      driver:
      - Spurious use-after-free was detected in hrtimer callback
      - Incorrect rescheduling due to delayed start
      - WARN_ON() is triggered in hrtimer_forward() invoked in hrtimer
        callback
      
      The first issue happens only when the new timer is scheduled even
      while hrtimer is being closed.  It's related with the second and third
      items; since ALSA timer core invokes hw.start callback during hrtimer
      interrupt, this may result in the explicit call of hrtimer_start().
      
      Also, the similar problem is seen for the stop; ALSA timer core
      invokes hw.stop callback even in the hrtimer handler, too.  Since we
      must not call the synced hrtimer_cancel() in such a context, it's just
      a hrtimer_try_to_cancel() call that doesn't properly work.
      
      Another culprit of the second and third items is the call of
      hrtimer_forward_now() before snd_timer_interrupt().  The timer->stick
      value may change during snd_timer_interrupt() call, but this
      possibility is ignored completely.
      
      For covering these subtle and messy issues, the following changes have
      been done in this patch:
      - A new flag, in_callback, is introduced in the private data to
        indicate that the hrtimer handler is being processed.
      - Both start and stop callbacks skip when called from (during)
        in_callback flag.
      - The hrtimer handler returns properly HRTIMER_RESTART and NORESTART
        depending on the running state now.
      - The hrtimer handler reprograms the expiry properly after
        snd_timer_interrupt() call, instead of before.
      - The close callback clears running flag and sets in_callback flag
        to block any further start/stop calls.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d2c5cf88
  7. 25 Apr, 2016 2 commits