1. 19 10月, 2015 12 次提交
  2. 18 10月, 2015 4 次提交
  3. 17 10月, 2015 2 次提交
  4. 16 10月, 2015 2 次提交
  5. 15 10月, 2015 4 次提交
  6. 13 10月, 2015 3 次提交
    • R
      ALSA: usb-audio: Fix max packet size calculation for USB audio · ab30965d
      Ricard Wanderlof 提交于
      Rounding must take place before multiplication with the frame size, since
      each packet contains a whole number of frames.
      
      We must also properly consider the data interval, as a larger data
      interval will result in larger packets, which, depending on the sampling
      frequency, can result in packet sizes that are less than integral
      multiples of the packet size for a lower data interval.
      
      Detailed explanation and rationale:
      
      The code before this commit had the following expression on line 613 to
      calculate the maximum isochronous packet size:
      
      	maxsize = ((ep->freqmax + 0xffff) * (frame_bits >> 3))
      			>> (16 - ep->datainterval);
      
      Here, ep->freqmax is the maximum assumed sample frequency, calculated from the
      nominal sample frequency plus 25%. It is ultimately derived from ep->freqn,
      which is in the units of frames per packet, from get_usb_full_speed_rate()
      or usb_high_speed_rate(), as applicable, in Q16.16 format.
      
      The expression essentially adds the Q16.16 equivalent of 0.999... (i.e.
      the largest number less than one) to the sample rate, in order to get a
      rate whose integer part is rounded up from the fractional value. The
      multiplication with (frame_bits >> 3) yields the number of bytes in a
      packet, and the (16 >> ep->datainterval) then converts it from Q16.16 back
      to an integer, taking into consideration the bDataInterval field of the
      endpoint descriptor (which describes how often isochronous packets are
      transmitted relative to the (micro)frame rate (125us or 1ms, for USB high
      speed and full speed, respectively)). For this discussion we will initially
      assume a bDataInterval of 0, so the second line of the expression just
      converts the Q16.16 value to an integer.
      
      In order to illustrate the problem, we will set frame_bits 64, which
      corresponds to a frame size of 8 bytes.
      
      The problem here is twofold. First, the rounding operation consists
      of the addition of 0x0.ffff and subsequent conversion to integer, but as the
      expression stands, the conversion to integer is done after multiplication
      with the frame size, rather than before. This results in the resulting
      maxsize becoming too large.
      
      Let's take an example. We have a sample rate of 96 kHz, so our ep->freqn is
      0xc0000 (see usb_high_speed_rate()). Add 25% (line 612) and we get 0xf0000.
      The calculated maxsize is then ((0xf0000 + 0x0ffff) * 8) >> 16 = 127 .
      However, if we do the number of bytes calculation in a less obscure way it's
      more apparent what the true corresponding packet size is: we get
      ceil(96000 * 1.25 / 8000) * 8 = 120, where 1.25 is the 25% from line 612,
      and the 8000 is the number of isochronous packets per second on a high
      speed USB connection (125 us microframe interval).
      
      This is fixed by performing the complete rounding operation prior to
      multiplication with the frame rate.
      
      The second problem is that when considering the ep->datainterval, this
      must be done before rounding, in order to take the advantage of the fact
      that if the number of bytes per packet is not an integer, the resulting
      rounded-up integer is not necessarily a factor of two when the data
      interval is increased by the same factor.
      
      For instance, assuming a freqency of 41 kHz, the resulting
      bytes-per-packet value for USB high speed is 41 kHz / 8000 = 5.125, or
      0x52000 in Q16.16 format. With a data interval of 1 (ep->datainterval = 0),
      this means that 6 frames per packet are needed, whereas with a data
      interval of 2 we need 10.25, i.e. 11 frames needed.
      
      Rephrasing the maxsize expression to:
      
      	maxsize = (((ep->freqmax << ep->datainterval) + 0xffff) >> 16) *
      			 (frame_bits >> 3);
      
      for the above 96 kHz example we instead get
      ((0xf0000 + 0xffff) >> 16) * 8 = 120 which is the correct value.
      
      We can also do the calculation with a non-integer sample rate which is when
      rounding comes into effect: say we have 44.1 kHz (resulting ep->freqn =
      0x58333, and resulting ep->freqmax 0x58333 * 1.25 = 0x6e3ff (rounded down)):
      
      Original maxsize = ((0x6e3ff + 0xffff) * 8) << 16 = 63 (63.124.. rounded down)
      True maxsize = ceil(44100 * 1.25 / 8000) * 8 = 7 * 8 = 56
      New maxsize = ((0x6e3ff + 0xffff) >> 16) * 8 = 7 * 8 = 56
      
      This is also corroborated by the wMaxPacketSize check on line 616. Assume
      that wMaxPacketSize = 104, with ep->maxpacksize then having the same value.
      As 104 < 127, we get maxsize = 104. ep->freqmax is then recalculated to
      (104 / 8) << 16 = 0xd0000 . Putting that rate into the original maxsize
      calculation yields a maxsize of ((0xd0000 + 0xffff) * 8) >> 16 = 111
      (with decimals 111.99988). Clearly, we should get back the 104 here,
      which we would with the new expression: ((0xd0000 + 0xffff) >> 16) * 8 = 104 .
      
      (The error has not been a problem because it only results in maxsize being
      a bit too big which just wastes a couple of bytes, either as a result of
      the first maxsize calculation, or because the resulting calculation will
      hit the wMaxPacketSize value before the packet is too big, resulting in
      fixing the size to wMaxPacketSize even though the packet is actually not
      too long.)
      
      Tested with an Edirol UA-5 both at 44.1 kHz and 96 kHz.
      Signed-off-by: NRicard Wanderlof <ricardw@axis.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ab30965d
    • D
      ALSA: hda - Fix inverted internal mic on Lenovo G50-80 · e8d65a8d
      David Henningsson 提交于
      Add the appropriate quirk to indicate the Lenovo G50-80 has a stereo
      mic input where one channel has reverse polarity.
      
      Alsa-info available at:
      https://launchpadlibrarian.net/220846272/AlsaInfo.txt
      
      Cc: stable@vger.kernel.org
      BugLink: https://bugs.launchpad.net/bugs/1504778Signed-off-by: NDavid Henningsson <david.henningsson@canonical.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e8d65a8d
    • V
      ALSA: hdac: Explicitly add io.h · 42f2bb1c
      Vinod Koul 提交于
      Compiling the hdac extended core on arm fails with below error:
      
        sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_writel':
      >> sound/hda/ext/hdac_ext_bus.c:29:2: error: implicit declaration of
      >> function
      +'writel' [-Werror=implicit-function-declaration]
           writel(value, addr);
           ^
         sound/hda/ext/hdac_ext_bus.c: In function 'hdac_ext_readl':
      >> sound/hda/ext/hdac_ext_bus.c:34:2: error: implicit declaration of
      >> function
      +'readl' [-Werror=implicit-function-declaration]
           return readl(addr);
      
      This is fixed by explicitly including io.h
      
      Fixes: 99463b3a - ('ALSA: hda: provide default bus io ops extended hdac')
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Suggested-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NVinod Koul <vinod.koul@intel.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      42f2bb1c
  7. 12 10月, 2015 13 次提交
    • T
      ALSA: firewire-tascam: change device probing processing · 53b3ffee
      Takashi Sakamoto 提交于
      Currently, this driver picks up model name with be32_to_cpu() macro
      to align characters. This is wrong operation because the result is
      different depending on CPU endiannness.
      
      Additionally, vendor released several versions of firmware for this
      series. It's not better to assign model-dependent information to
      device entry according to the version field.
      
      This commit fixes these bugs. The name of model is picked up correctly
      and used to identify model-dependent information.
      
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Fixes: c0949b27 ('ALSA: firewire-tascam: add skeleton for TASCAM FireWire series')
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      53b3ffee
    • T
      ALSA: firewire-tascam: Turn on/off FireWire LED · e65e2cb9
      Takashi Sakamoto 提交于
      TASCAM FireWire series has some LEDs on its surface. These LEDs can be
      turned on/off by receiving asynchronous transactions to a certain
      address. One of the LEDs is labels as 'FireWire'. It's better to light it
      up when this driver starts to work. Besides, the LED for 'FireWire' is
      turned off at bus reset.
      
      This commit implements this idea.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e65e2cb9
    • T
      ALSA: firewire-tascam: add support for MIDI functionality · 0db18e7e
      Takashi Sakamoto 提交于
      In former commits, this driver got functionalities to transfer/receive
      MIDI messages to/from TASCAM FireWire series.
      
      This commit adds some ALSA MIDI ports to enable userspace applications
      to use the functionalities.
      
      I note that this commit doesn't support virtual MIDI ports which console
      models support. A physical controls can be assigned to a certain MIDI
      ports including physical and virtual. But the way is not clear.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0db18e7e
    • T
      ALSA: firewire-tascam: add support for outgoing MIDI messages by asynchronous transaction · 3beab0f8
      Takashi Sakamoto 提交于
      TASCAM FireWire series use asynchronous transaction to receive MIDI
      messages. The transaction should be sent to a certain address.
      
      This commit supports the outgoing MIDI messages. The messages in the
      transaction includes some quirks:
       * One MIDI message is transferred in one quadlet transaction, except for
         system exclusives.
       * MIDI running status is not allowed, thus transactions always include
         status byte.
       * The basic data format is the same as transferring MIDI messages
         supported in previous commit.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3beab0f8
    • T
      ALSA: firewire-tascam: add support for incoming MIDI messages by asynchronous transaction · 107cc012
      Takashi Sakamoto 提交于
      TASCAM FireWire series use asynchronous transaction to transfer MIDI
      messages. The transaction is sent to a registered address.
      
      This commit supports the incoming MIDI messages. The messages in the
      transaction include some quirks:
       * Two quadlets are used for one MIDI message and one timestamp.
       * Usually, the first byte of the first quadlet includes MIDI port and MSB
         4 bit of MIDI status. For system exclusive message, the first byte
         includes MIDI port and 0x04, or 0x07 in the end of the message.
       * The rest of the first quadlet includes MIDI bytes up to 3.
       * Several set of MIDI messages and timestamp can be transferred in one
         block transaction, up to 8 sets.
      
      I note that TASCAM FireWire series ignores ID bytes of system exclusive
      message. When receiving system exclusive messages with ID bytes on physical
      MIDI bus, the series transfers the messages without ID bytes on IEEE 1394
      bus, and vice versa.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      107cc012
    • T
      ALSA: firewire-digi00x: add support for MIDI ports for physical controls · e8bd577a
      Takashi Sakamoto 提交于
      In former commits, asynchronous transactions are supported for physical
      controls. This commit adds a pair of MIDI ports for them.
      
      This driver already adds diferrent number of ALSA MIDI ports for physical
      MIDI ports, and the number of in/out ports are different. As seeing as
      'amidi' program in alsa-utils package, a pair of in/out MIDI ports is
      expected with the same name. Therefore, this commit adds a pair of new
      ports to the first.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      e8bd577a
    • T
      ALSA: firewire-digi00x: add support of asynchronous transaction for outgoing... · b47f525f
      Takashi Sakamoto 提交于
      ALSA: firewire-digi00x: add support of asynchronous transaction for outgoing MIDI messages to physical controls
      
      In previous commit, asynchronous transaction for incoming MIDI messages
      from physical controls is supported. The physical controls may be
      controlled by receiving MIDI messages at a certain address.
      
      This commit supports asynchronous transaction for this purpose.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b47f525f
    • T
      ALSA: firewire-digi00x: add support of asynchronous transaction for incoming... · 3646a54a
      Takashi Sakamoto 提交于
      ALSA: firewire-digi00x: add support of asynchronous transaction for incoming MIDI messages from physical controls
      
      Digi 00x series has two types of model; rack and console. The console
      models have physical controls. The model can transmit control messages.
      These control messages are transferred by asynchronous transactions to
      registered address.
      
      This commit supports the asynchronous transaction.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3646a54a
    • T
      ALSA: firewire-digi00x: add support for MIDI ports corresponding to isochronous packet streaming · 9fbfd38b
      Takashi Sakamoto 提交于
      This commit adds MIDI functionality to capture/playback MIDI messages
      from/to physical MIDI ports. These messages are transferred in isochronous
      packets.
      
      When no substreams request AMDTP streams to run, this driver starts the
      streams at current sampling rate. When other substreams start at different
      sampling rate, the streams are stopped temporarily, then start again at
      requested sampling rate. This operation can generate missing MIDI bytes,
      thus it's preferable to start PCM substreams at favorite sampling rate in
      advance.
      
      Digi 002/003 console also has a set of MIDI port for physical controls.
      These ports are added in later commits.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9fbfd38b
    • T
      ALSA: firewire-digi00x: handle MIDI messages in isochronous packets · 9dc5d31c
      Takashi Sakamoto 提交于
      In Digi 002/003 protocol, MIDI messages are transferred in the last data
      channel of data blocks. Although this data channel has a label of 0x80,
      it's not fully MIDI conformant data channel especially because the Counter
      field always zero independently of included MIDI bytes. The 4th byte of
      the data channel in LSB tells the number of included MIDI bytes. This byte
      also includes the number of MIDI port. Therefore, the data format in this
      data channel is:
       * 1st: 0x80 as label
       * 2nd: MIDI bytes
       * 3rd: 0 or MIDI bytes
       * 4th: the number of MIDI byte and the number of MIDI port
      
      This commit adds support of MIDI messages in data block processing layer.
      
      Like AM824 data format, this data channel has a capability to transfer
      more MIDI messages than the capability of phisical MIDI bus. Therefore, a
      throttle for data rate is  required to prevent devices' internal buffer to
      overflow.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9dc5d31c
    • T
      ALSA: firewire-digi00x: use in-kernel representation for the type of 8 bits · 17385a38
      Takashi Sakamoto 提交于
      Original code for 'DoubleOhThree' encoding was written with '__u8' type,
      while the type is usually used to export something to userspace.
      
      This commit replaces the type with 'u8'.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      17385a38
    • K
      ALSA: usb-audio: Allow any MIDI endpoint to drive use of interrupt transfer on newer Roland devices · ac774236
      Keith A. Milner 提交于
      This patch enables interrupt transfer mode for MIDI ports on newer
      Boss/Roland devices such as the GT-100/001 which support interrupt
      transfer on both IN and OUT MIDI endpoints. Previously this wasn't being
      enabled for these devices as the code was specifically looking for the
      scenario where the IN endpoint supported interrupt transfer and the OUT
      endpoint was bulk transfer. Newer devices support interrupt transfer for
      both endpoints.
      
      This has been tested on Boss devices GT-001, BR-80 and JS-8 and Roland
      VS-20.
      
      It would benefit from some regresison testing with other devices if
      possible.
      Signed-off-by: NKeith A. Milner <maillist@superlative.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ac774236
    • 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