28 Apr, 2016

1 commit

  • dmaengine_pcm currently only supports setups where FIFO reads/writes
    correspond to exactly one sample, eg 16-bit sample data is transferred
    via 16-bit FIFO accesses, 32-bit data via 32-bit accesses.

    This patch adds support for setups with fixed width FIFOs where
    multiple samples are packed into a larger word.

    For example setups with a 32-bit wide FIFO register that expect
    16-bit sample transfers to be done with the left+right sample data
    packed into a 32-bit word.

    Support for packed transfers is controlled via the
    SND_DMAENGINE_PCM_DAI_FLAG_PACK flag in snd_dmaengine_dai_dma_data.flags

    If this flag is set dmaengine_pcm doesn't put any restriction on the
    supported formats and sets the DMA transfer width to undefined.

    This means control over the constraints is now transferred to the DAI
    driver and it's responsible to provide proper configuration and
    check for possible corner cases that aren't handled by the ALSA core.

    Signed-off-by: Matthias Reichl
    Acked-by: Lars-Peter Clausen
    Tested-by: Martin Sperl
    Signed-off-by: Mark Brown

    Matthias Reichl
     

28 Apr, 2015

1 commit

  • Whether residue can be reported or not is not a property of the audio
    controller but of the DMA controller. The FLAG_NO_RESIDUE was initially
    added when the DMAengine framework had no support for describing the residue
    reporting capabilities of the controller. Support for this was added quite a
    while ago and recently the DMAengine framework started to complain if a
    driver does not describe its capabilities and a lot of patches have been
    merged that add support for this where it was missing. So it should be safe
    to assume that driver on actively used platforms properly implement the DMA
    capabilities API.

    This patch makes the FLAG_NO_RESIDUE internal and no longer allows audio
    controller drivers to manually set the flag. If a DMA driver against
    expectations does not support reporting its capabilities for now the generic
    DMAengine PCM driver will now emit a warning and simply assume that residue
    reporting is not supported. In the future this might be changed to aborting
    with an error.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

10 Dec, 2013

1 commit

  • Add fields to struct snd_dmaengine_pcm_config to allow custom:

    - DMA channel names.

    This is useful when the default "tx" and "rx" channel names don't
    apply, for example if a HW module supports multiple channels, each
    having different DMA channel names. This is the case with the FIFOs
    in Tegra's AHUB. This new facility can replace
    SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME.

    - DMA device

    This allows requesting DMA channels for a device other than the device
    which is registering the "PCM" driver. This is quite unusual, but is
    currently useful on Tegra. In much HW, and in Tegra20, each DAI HW
    module contains its own FIFOs which DMA writes to. However, in Tegra30,
    the DMA FIFOs were split out AHUB HW module, which then routes the data
    through a cross-bar, and into the DAI HW modules. However, the current
    ASoC driver structure does not expose this detail, and acts as if the
    FIFOs are still part of the DAI HW modules. Consequently, the "PCM"
    driver is registered with the DAI HW module, yet the DMA channels must
    be looked up in the AHUB HW module's device tree node. This new config
    field allows that to happen. Eventually, the Tegra drivers will be
    reworked to fully expose the AHUB, and this config field can be
    removed.

    Signed-off-by: Stephen Warren
    Acked-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Stephen Warren
     

28 Nov, 2013

1 commit

  • For many drivers using the generic dmaengine PCM driver one of the few (or the
    only) things left to do in the drivers remove function is to unregister the PCM
    device. This patch adds a resource managed version of snd_dmaengine_pcm_register()
    which makes it possible to simplify the remove function as well as the error
    path in the probe function for those drivers.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

24 Oct, 2013

1 commit

  • Some devices have more than just simple TX and RX DMA channels, for example
    modern Samsung I2S IPs support a secondary transmit DMA stream which is
    mixed into the primary stream during playback. Allow such devices to
    specify the names of the channels to be requested in their dma_data.

    Signed-off-by: Mark Brown
    Acked-by: Lars-Peter Clausen

    Mark Brown
     

20 Oct, 2013

1 commit

  • Currently each platform making use the the generic dmaengine PCM driver still
    needs to provide a custom snd_pcm_hardware struct which specifies the
    capabilities of the DMA controller, e.g. the maximum period size that can be
    supported. This patch adds code which uses the newly introduced
    dma_get_slave_caps() API to query this information from the dmaengine driver.
    The new code path will only be taken if the 'pcm_hardware' field of the
    snd_dmaengine_pcm_config struct is NULL.

    The patch also introduces a new 'fifo_size' field to the
    snd_dmaengine_dai_dma_data struct which is used to initialize the
    snd_pcm_hardware 'fifo_size' field and needs to be set by the DAI driver.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

22 Apr, 2013

1 commit


18 Apr, 2013

1 commit

  • Use the generic dmaengine PCM driver instead of a custom implemention. There is
    a minor functional change, the ux500 PCM driver did not preallocate the audio
    buffer, while the generic dmaengine PCM driver will do this.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Lee Jones
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

17 Apr, 2013

4 commits

  • Unfortunately there are still quite a few platforms with a dmaengine driver
    which do not support reporting the number of bytes left to transfer. If we want
    to support these platforms in the generic dmaengine PCM driver we have.

    Signed-off-by: Lars-Peter Clausen
    Tested-by: Stephen Warren
    Tested-by: Shawn Guo
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     
  • Add support for platforms which don't use devicetree yet or have to optionally
    support a non-devicetree way to request the DMA channel. The patch adds the
    compat_request_channel and compat_filter_fn callbacks to the
    snd_dmaengine_pcm_config struct. If the compat_request_channel is implemented it
    will be used to request the DMA channel. If not dma_request_channel with
    compat_filter_fn as the filter function will be used to request the channel.

    The patch also exports the snd_dmaengine_pcm_request_chan() function, since
    compat platforms will want to use it to request their DMA channel.

    Signed-off-by: Lars-Peter Clausen
    Tested-by: Stephen Warren
    Tested-by: Shawn Guo
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     
  • This patch adds a generic dmaengine PCM driver. It builds on top of the
    dmaengine PCM library and adds the missing pieces like DMA channel management,
    buffer management and channel configuration. It will be able to replace the
    majority of the existing platform specific dmaengine based PCM drivers.
    Devicetree is used to map the DMA channels to the PCM device.

    Signed-off-by: Lars-Peter Clausen
    Tested-by: Stephen Warren
    Tested-by: Shawn Guo
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     
  • Refactor the dmaengine PCM library to allow the DMA channel to be requested
    before opening a PCM substream. snd_dmaengine_pcm_open() now expects a DMA
    channel instead of a filter function and filter parameter as its parameters.
    snd_dmaengine_pcm_close() is updated to not release the DMA channel. This allows
    a dmaengine based PCM driver to request its channels before the substream is
    opened.

    The patch also introduces two new functions, snd_dmaengine_pcm_open_request_chan()
    and snd_dmaengine_pcm_close_release_chan(), which have the same signature and
    behaviour of the old snd_dmaengine_pcm_{open,close}() and internally use the new
    variants of these functions. All users of snd_dmaengine_pcm_{open,close}() are
    updated to use snd_dmaengine_pcm_open_request_chan() and
    snd_dmaengine_pcm_close_release_chan().

    Signed-off-by: Lars-Peter Clausen
    Tested-by: Stephen Warren
    Tested-by: Shawn Guo
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

04 Apr, 2013

1 commit

  • This patch adds a common DMA data struct which can be used by DAI drivers to
    communicate their DMA configuration requirements to the DMA pcm driver. Having
    a common data structure for this allows us to implement common functions on top
    of them, which can be used by multiple platforms.

    This patch also introduces a new function to initialize certain fields of a
    dma_slave_config struct from the common DAI DMA data struct.

    Signed-off-by: Lars-Peter Clausen
    Reviewed-by: Stephen Warren
    Tested-by: Stephen Warren
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     

26 Mar, 2013

1 commit


20 Jun, 2012

2 commits

  • Currently the sound dmaengine pcm helper functions implement the pcm_pointer
    callback by trying to count the number of elapsed periods. This is done by
    advancing the stream position in the dmaengine callback by one period.
    Unfortunately there is no guarantee that the callback will be called for each
    elapsed period. It may be possible that under high system load it is only called
    once for multiple elapsed periods. This patch addresses the issue by
    implementing support for querying the current stream position directly from the
    dmaengine driver. Since not all dmaengine drivers support reporting the stream
    position yet the old period counting implementation is kept for now.

    Furthermore the new mechanism allows to report the stream position with a
    sub-period granularity, given that the dmaengine driver supports this.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Vinod Koul
    Signed-off-by: Mark Brown

    Lars-Peter Clausen
     
  • Currently the sound dmaengine pcm helper functions implement the pcm_pointer
    callback by trying to count the number of elapsed periods. This is done by
    advancing the stream position in the dmaengine callback by one period.
    Unfortunately there is no guarantee that the callback will be called for each
    elapsed period. It may be possible that under high system load it is only called
    once for multiple elapsed periods. This patch renames the current implementation
    and documents its shortcomings and that it should not be used anymore in new
    drivers.

    The next patch will introduce a new snd_dmaengine_pcm_pointer which will be
    implemented based on querying the current stream position from the dma device.

    Signed-off-by: Lars-Peter Clausen
    Acked-by Vinod Koul
    Acked-by: Dong Aisheng

    Lars-Peter Clausen
     

02 Mar, 2012

1 commit