1. 29 9月, 2015 5 次提交
    • T
      ALSA: firewire-lib: add helper functions to set positions of data channels · f65be911
      Takashi Sakamoto 提交于
      In IEC 61883-6, several types of data are available in AM824 format. The
      data is transferred in each data channel. The position of data channel in
      data block differs depending on model.
      
      Current implementation has an array to map the index of data channel in an
      data block to the position of actual data channel. The implementation
      allows each driver to access the mapping directly.
      
      In later commit, the mapping is in specific structure pushed into an
      opaque pointer. Helper functions are required.
      
      This commit adds the helper functions for this purpose. In IEC 61883-6,
      AM824 format supports many data types, while this specification easily
      causes over-engineering. Current AM824 implementation is allowed to handle
      two types of data, Multi Bit Linear Audio data (=PCM samples) and MIDI
      conformant data (=MIDI messages).
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f65be911
    • T
      ALSA: firewire-lib: rename parameter setting function for AM824 with FDF field · 51c29fd2
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      51c29fd2
    • T
      ALSA: firewire-lib: add data block processing layer for AM824 format · 5955815e
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      5955815e
    • T
      ALSA: firewire-lib: add an argument for Dice's dual wire mode · 27ec83b5
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      27ec83b5
    • T
      ALSA: firewire-lib: return error code when amdtp_stream_set_parameters() detects error · 547e631c
      Takashi Sakamoto 提交于
      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: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      547e631c
  2. 23 2月, 2015 1 次提交
    • T
      ALSA: fireworks/bebob/dice/oxfw: allow stream destructor after releasing runtime · d23c2cc4
      Takashi Sakamoto 提交于
      Currently stream destructor in each driver has a problem to be called in
      a context in which sound card object is released, because the destructors
      call amdtp_stream_pcm_abort() and touch PCM runtime data.
      
      The PCM runtime data is destroyed in application's context with
      snd_pcm_close(), on the other hand PCM substream data is destroyed after
      sound card object is released, in most case after all of ALSA character
      devices are released. When PCM runtime is destroyed and PCM substream is
      remained, amdtp_stream_pcm_abort() touches PCM runtime data and causes
      Null-pointer-dereference.
      
      This commit changes stream destructors and allows each driver to call
      it after releasing runtime.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # 3.19+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d23c2cc4
  3. 10 12月, 2014 4 次提交
    • T
      ALSA: dice: Add support for MIDI capture/playback · a113ff88
      Takashi Sakamoto 提交于
      This commit adds a support for MIDI capture/playback
      
      When MIDI substrams already start streaming and PCM substreams are going to
      join at different sampling rate, streams are stopped once. Then sampling rate
      is changed and streams are restarted.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a113ff88
    • T
      ALSA: dice: Support for non SYT-Match sampling clock source mode · 8fc01fc0
      Takashi Sakamoto 提交于
      This commit allows this driver to handle devices with non SYT-Match
      sampling clock source.
      
      When sampling clock source is SYT-Match mode, devices handle
      'presentation timestamp' in received packets and generates sampling clock
      according to the information. In this case, driver is synchronization master
      and must transfer correct value in SYT field of each packets in outgoing
      stream, then the outgoing stream is a master stream.
      
      On the other hand, non SYT-Match mode, devices do this. So drivers must pick
      up the value in SYT field of incoming packets and use the value for outgoing
      stream. Currently firewire-lib module achieve this work.
      
      Furthermore, without SYT-Match and internal clock source, the sampling rate
      should be fixed for the other devices connected to the handled device. This
      commit add a restriction of sampling rate at this situation.
      
      With these implementations, this driver has no need to set clock source.
      This commit remove set function.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      8fc01fc0
    • T
      ALSA: dice: Add support for duplex streams with synchronization · 9a02843c
      Takashi Sakamoto 提交于
      This commit adds support for AMDTP in-stream. As a result, Dice driver
      supports full duplex streams with synchronization.
      
      AMDTP can transfer timestamps in its packets. By handling the timestamp,
      devices can synchronize to the other devices or drivers on the same bus.
      
      When Dice chipset is 'enabled', it starts streams with correct settings.
      This 'enable' register is global, thus, when a stream is started to run,
      an opposite stream can't start unless turning off 'enable'. Therefore
      a pair of streams must be running. This causes a loss of CPU usage when
      single stream is needed for neither playbacking or capturing.
      
      This commit assumes that playback-only models also have a functionality
      to transmit stream for delivering timestamps.
      
      Currently, sampling clock source is restricted to SYT-Match mode. This is
      improved in followed commit. I note that at SYT-Match mode, Dice can select
      from 4 streams for synchronization but this driver uses the 1st stream only
      for simplicity.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9a02843c
    • T
      ALSA: dice: Change the way to start stream · 288a8d0c
      Takashi Sakamoto 提交于
      Streaming functionality can start streams when rate is given but currently
      some codes are in PCM functionality.
      
      This commit changes the way to start stream and add some arrangement
      to make it easy to understand the way.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      288a8d0c
  4. 30 11月, 2014 2 次提交
    • T
      ALSA: dice: Split PCM functionality into a file · c50fb91f
      Takashi Sakamoto 提交于
      This commit adds a file and move some codes related to PCM functionality.
      
      Currently PCM playback is supported. PCM capture will be supported in followed
      commits.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c50fb91f
    • T
      ALSA: dice: Split stream functionality into a file · 6eb6c81e
      Takashi Sakamoto 提交于
      This commit adds a file with some helper functions for streaming, and move some
      codes into the file with some arrangements.
      
      Well-known CMP is not used to start/stop streams for Dice chipset. It's
      achieved by writing to specific address. We call this way as 'enable'.
      When devices are 'enabled', streaming starts in registered isochronous channel.
      Some helper functions are already implemented in previous commit.
      
      Basically, the stream is compliant to IEC 61883-6, so-called as AMDTP. But Dice
      has a specific quirk, so called-as 'Dual Wire'. This quirk is applied at
      176.4/192.0kHz. In this mode, each packet includes double number of events than
      number in the specification, and stream runs at a half of sampling rate.
      
      There is another quirk at bus reset. Dice chipset handles drivers' request but
      don't re-enable streaming. So stream should be stopped.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6eb6c81e