29 Jul, 2020

1 commit

  • [ Upstream commit 5b78fac4b1ba731cf4177fdbc1e3a4661521bcd0 ]

    pm_runtime_get_sync() increments the runtime PM usage counter even
    when it returns an error code. Thus a pairing decrement is needed on
    the error handling path to keep the counter balanced.

    Signed-off-by: Dinghao Liu
    Reviewed-by: Jon Hunter
    Link: https://lore.kernel.org/r/20200624064626.19855-1-dinghao.liu@zju.edu.cn
    Signed-off-by: Vinod Koul
    Signed-off-by: Sasha Levin

    Dinghao Liu
     

27 May, 2020

1 commit

  • commit 3a5fd0dbd87853f8bd2ea275a5b3b41d6686e761 upstream.

    Commit b53611fb1ce9 ("dmaengine: tegra210-adma: Fix crash during probe")
    has moved some code in the probe function and reordered the error handling
    path accordingly.
    However, a goto has been missed.

    Fix it and goto the right label if 'dma_async_device_register()' fails, so
    that all resources are released.

    Fixes: b53611fb1ce9 ("dmaengine: tegra210-adma: Fix crash during probe")
    Signed-off-by: Christophe JAILLET
    Reviewed-by: Jon Hunter
    Acked-by: Thierry Reding
    Link: https://lore.kernel.org/r/20200516214205.276266-1-christophe.jaillet@wanadoo.fr
    Signed-off-by: Vinod Koul
    Signed-off-by: Greg Kroah-Hartman

    Christophe JAILLET
     

14 Oct, 2019

1 commit

  • >From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel
    configuration register(bits 7:4) which defines the maximum number of reads
    from the source and writes to the destination that may be outstanding at
    any given point of time. This field must be programmed with a value
    between 1 and 8. A value of 0 will prevent any transfers from happening.

    Thus added 'has_outstanding_reqs' bool member in chip data structure and is
    set to false for Tegra210, since the field is not applicable. For Tegra186
    it is set to true and channel configuration is updated with maximum
    outstanding requests.

    Fixes: 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sameer Pujar
    Acked-by: Jon Hunter
    Link: https://lore.kernel.org/r/1568626513-16541-1-git-send-email-spujar@nvidia.com
    Signed-off-by: Vinod Koul

    Sameer Pujar
     

18 Sep, 2019

1 commit

  • Pull dmaengine updates from Vinod Koul:

    - Move Dmaengine DT bindings to YAML and convert Allwinner to schema.

    - FSL dma device_synchronize implementation

    - DW split acpi and of helpers and updates to driver and support for
    Elkhart Lake

    - Move filter fn as private for omap-dma and edma drivers and
    improvements to these drivers

    - Mark expected switch fall-through in couple of drivers

    - Renames of shdma and nbpfaxi binding document

    - Minor updates to bunch of drivers

    * tag 'dmaengine-5.4-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (55 commits)
    dmaengine: ti: edma: Use bitmap_set() instead of open coded edma_set_bits()
    dmaengine: ti: edma: Only reset region0 access registers
    dmaengine: ti: edma: Do not reset reserved paRAM slots
    dmaengine: iop-adma.c: fix printk format warning
    dmaengine: stm32-dma: Use struct_size() helper
    dt-bindings: dmaengine: dma-common: Fix the dma-channel-mask property
    dmanegine: ioat/dca: Use struct_size() helper
    dmaengine: iop-adma: remove set but not used variable 'slots_per_op'
    dmaengine: dmatest: Add support for completion polling
    dmaengine: ti: omap-dma: Remove variable override in omap_dma_tx_status()
    dmaengine: ti: omap-dma: Remove 'Assignment in if condition'
    dmaengine: ti: edma: Remove 'Assignment in if condition'
    dmaengine: dw: platform: Split OF helpers to separate module
    dmaengine: dw: platform: Split ACPI helpers to separate module
    dmaengine: dw: platform: Move handle check to dw_dma_acpi_controller_register()
    dmaengine: dw: platform: Switch to acpi_dma_controller_register()
    dmaengine: dw: platform: Use devm_platform_ioremap_resource()
    dmaengine: dw: platform: Enable iDMA 32-bit on Intel Elkhart Lake
    dmaengine: dw: platform: Use struct dw_dma_chip_pdata
    dmaengine: dw: Export struct dw_dma_chip_pdata for wider use
    ...

    Linus Torvalds
     

31 Jul, 2019

1 commit

  • The Tegra210 ADMA supports two modes for transferring data to a FIFO
    which are ...

    1. Transfer data to/from the FIFO as soon as a single burst can be
    transferred.
    2. Transfer data to/from the FIFO based upon FIFO thresholds, where
    the FIFO threshold is specified in terms on multiple bursts.

    Currently, the ADMA driver programs the FIFO threshold values in the
    FIFO_CTRL register, but never enables the transfer mode that uses
    these threshold values. Given that these have never been used so far,
    simplify the ADMA driver by removing the programming of these threshold
    values.

    Signed-off-by: Jonathan Hunter
    Acked-by: Thierry Reding
    Link: https://lore.kernel.org/r/20190731101639.22755-1-jonathanh@nvidia.com
    Signed-off-by: Vinod Koul

    Jonathan Hunter
     

25 Jul, 2019

1 commit

  • If CONFIG_PM is not set, build warnings:

    drivers/dma/tegra210-adma.c:747:12: warning: tegra_adma_runtime_resume defined but not used [-Wunused-function]
    static int tegra_adma_runtime_resume(struct device *dev)
    drivers/dma/tegra210-adma.c:715:12: warning: tegra_adma_runtime_suspend defined but not used [-Wunused-function]
    static int tegra_adma_runtime_suspend(struct device *dev)

    Mark the two function as __maybe_unused.

    Reported-by: Hulk Robot
    Signed-off-by: YueHaibing
    Fixes: 3145d73e69ba ("dmaengine: tegra210-adma: remove PM_CLK dependency")
    Fixes: f46b195799b5 ("dmaengine: tegra-adma: Add support for Tegra210 ADMA")
    Reported-by: Arnd Bergmann
    Acked-by: Jon Hunter
    Link: https://lore.kernel.org/r/20190709083258.57112-1-yuehaibing@huawei.com
    Signed-off-by: Vinod Koul

    YueHaibing
     

09 Jun, 2019

1 commit

  • Pull dmaengine fixes from Vinod Koul:

    - jz4780 transfer fix for acking descriptors early

    - fsl-qdma: clean registers on error

    - dw-axi-dmac: null pointer dereference fix

    - mediatek-cqdma: fix sleeping in atomic context

    - tegra210-adma: fix bunch os issues like crashing in driver probe,
    channel FIFO configuration etc.

    - sprd: Fixes for possible crash on descriptor status, block length
    overflow. For 2-stage transfer fix incorrect start, configuration and
    interrupt handling.

    * tag 'dmaengine-fix-5.2-rc4' of git://git.infradead.org/users/vkoul/slave-dma:
    dmaengine: sprd: Add interrupt support for 2-stage transfer
    dmaengine: sprd: Fix the right place to configure 2-stage transfer
    dmaengine: sprd: Fix block length overflow
    dmaengine: sprd: Fix the incorrect start for 2-stage destination channels
    dmaengine: sprd: Add validation of current descriptor in irq handler
    dmaengine: sprd: Fix the possible crash when getting descriptor status
    dmaengine: tegra210-adma: Fix spelling
    dmaengine: tegra210-adma: Fix channel FIFO configuration
    dmaengine: tegra210-adma: Fix crash during probe
    dmaengine: mediatek-cqdma: sleeping in atomic context
    dmaengine: dw-axi-dmac: fix null dereference when pointer first is null
    dmaengine: fsl-qdma: Add improvement
    dmaengine: jz4780: Fix transfers being ACKed too soon

    Linus Torvalds
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not see http www gnu org
    licenses

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 228 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Steve Winslow
    Reviewed-by: Richard Fontana
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171438.107155473@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

3 commits

  • Correct spelling of 'register' in Tegra210 ADMA driver.

    Fixes: ded1f3db4cd6 ("dmaengine: tegra210-adma: prepare for supporting newer Tegra chips")

    Signed-off-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Jon Hunter
     
  • Commit ded1f3db4cd6 ("dmaengine: tegra210-adma: prepare for supporting
    newer Tegra chips") removed the default settings DMA channel RX and TX
    FIFO sizes and this is breaking DMA transfers. The intention was to
    move the default settings to the chip specific data structure because
    this commit was preparing for adding support for Tegra186 where the
    fields for the FIFO CTRL register are slightly different.

    Fix the configuration of the FIFO sizes by adding default values for
    the FIFO CTRL register for both Tegra210 and Tegra186 and store the
    values in the chip specific structure.

    Fixes: ded1f3db4cd6 ("dmaengine: tegra210-adma: prepare for supporting newer Tegra chips")

    Signed-off-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Jon Hunter
     
  • Commit f33e7bb3eb92 ("dmaengine: tegra210-adma: restore channel status")
    added support to save and restore the DMA channel registers when runtime
    suspending the ADMA. This change is causing the kernel to crash when
    probing the ADMA, if the device is probed deferred when looking up the
    channel interrupts. The crash occurs because not all of the channel base
    addresses have been setup at this point and in the clean-up path of the
    probe, pm_runtime_suspend() is called invoking its callback which
    expects all the channel base addresses to be initialised.

    Although this could be fixed by simply checking for a NULL address, on
    further review of the driver it seems more appropriate that we only call
    pm_runtime_get_sync() after all the channel interrupts and base
    addresses have been configured. Therefore, fix this crash by moving the
    calls to pm_runtime_enable(), pm_runtime_get_sync() and
    tegra_adma_init() after the DMA channels have been initialised.

    Fixes: f33e7bb3eb92 ("dmaengine: tegra210-adma: restore channel status")

    Signed-off-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Jon Hunter
     

04 May, 2019

5 commits

  • Status of ADMA channel registers is not saved and restored during system
    suspend. During active playback if system enters suspend, this results in
    wrong state of channel registers during system resume and playback fails
    to resume properly. Fix this by saving following channel registers in
    runtime suspend and restore during runtime resume.
    * ADMA_CH_LOWER_SRC_ADDR
    * ADMA_CH_LOWER_TRG_ADDR
    * ADMA_CH_FIFO_CTRL
    * ADMA_CH_CONFIG
    * ADMA_CH_CTRL
    * ADMA_CH_CMD
    * ADMA_CH_TC
    Runtime PM calls will be inovked during system resume path if a playback
    or capture needs to be resumed. Hence above changes work fine for system
    suspend case.

    Fixes: f46b195799b5 ("dmaengine: tegra-adma: Add support for Tegra210 ADMA")
    Signed-off-by: Sameer Pujar
    Reviewed-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sameer Pujar
     
  • Following kernel panic is seen during DMA driver unload->load sequence
    ==========================================================================
    Unable to handle kernel paging request at virtual address ffffff8001198880
    Internal error: Oops: 86000007 [#1] PREEMPT SMP
    CPU: 0 PID: 5907 Comm: HwBinder:4123_1 Tainted: G C 4.9.128-tegra-g065839f
    Hardware name: galen (DT)
    task: ffffffc3590d1a80 task.stack: ffffffc3d0678000
    PC is at 0xffffff8001198880
    LR is at of_dma_request_slave_channel+0xd8/0x1f8
    pc : [] lr : [] pstate: 60400045
    sp : ffffffc3d067b710
    x29: ffffffc3d067b710 x28: 000000000000002f
    x27: ffffff800949e000 x26: ffffff800949e750
    x25: ffffff800949e000 x24: ffffffbefe817d84
    x23: ffffff8009f77cb0 x22: 0000000000000028
    x21: ffffffc3ffda49c8 x20: 0000000000000029
    x19: 0000000000000001 x18: ffffffffffffffff
    x17: 0000000000000000 x16: ffffff80082b66a0
    x15: ffffff8009e78250 x14: 000000000000000a
    x13: 0000000000000038 x12: 0101010101010101
    x11: 0000000000000030 x10: 0101010101010101
    x9 : fffffffffffffffc x8 : 7f7f7f7f7f7f7f7f
    x7 : 62ff726b6b64622c x6 : 0000000000008064
    x5 : 6400000000000000 x4 : ffffffbefe817c44
    x3 : ffffffc3ffda3e08 x2 : ffffff8001198880
    x1 : ffffffc3d48323c0 x0 : ffffffc3d067b788

    Process HwBinder:4123_1 (pid: 5907, stack limit = 0xffffffc3d0678028)
    Call trace:
    [] 0xffffff8001198880
    [] dma_request_chan+0x50/0x1f0
    [] dma_request_slave_channel+0x28/0x40
    [] tegra_alt_pcm_open+0x114/0x170
    [] soc_pcm_open+0x10c/0x878
    [] snd_pcm_open_substream+0xc0/0x170
    [] snd_pcm_open+0xc4/0x240
    [] snd_pcm_playback_open+0x58/0x80
    [] snd_open+0xb4/0x178
    [] chrdev_open+0xb8/0x1d0
    [] do_dentry_open+0x214/0x318
    [] vfs_open+0x58/0x88
    [] do_last+0x450/0xde0
    [] path_openat+0xa8/0x368
    [] do_filp_open+0x8c/0x110
    [] do_sys_open+0x164/0x220
    [] compat_SyS_openat+0x3c/0x50
    [] el0_svc_naked+0x34/0x38
    ---[ end trace 67e6d544e65b5145 ]---
    Kernel panic - not syncing: Fatal exception
    ==========================================================================

    In device probe(), of_dma_controller_register() registers DMA controller.
    But when driver is removed, this is not freed. During driver reload this
    results in data abort and kernel panic. Add of_dma_controller_free() in
    driver remove path to fix the issue.

    Fixes: f46b195799b5 ("dmaengine: tegra-adma: Add support for Tegra210 ADMA")
    Signed-off-by: Sameer Pujar
    Reviewed-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sameer Pujar
     
  • During an audio playback session it is observed that, audio goes off after
    few seconds of continuous pause and play. No audio is heard even when the
    playback is resumed.

    The reason for above is, currently ADMA driver does not handle DMA_PAUSE/
    DMA_RESUME and relevant callbacks for dma_device are not implemented. This
    patch implements device_pause and device_resume callbacks for the device.
    During pause TRANSFER_PAUSE bit of dma channel control register is set and
    the same is cleared during resume.

    Signed-off-by: Sameer Pujar
    Reviewed-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sameer Pujar
     
  • Add Tegra186 specific macro defines and chip_data structure for chip
    specific information. New compatibility is added to select relevant
    chip details. There is no major change for Tegra194 and hence it can
    use the same chip data.

    The bits in the BURST_SIZE field of the ADMA CH_CONFIG register are
    encoded differently on Tegra186 and Tegra194 compared with Tegra210.
    On Tegra210 the bits are encoded as follows ...

    1 = WORD_1
    2 = WORDS_2
    3 = WORDS_4
    4 = WORDS_8
    5 = WORDS_16

    Where as on Tegra186 and Tegra194 the bits are encoded as ...

    0 = WORD_1
    1 = WORDS_2
    2 = WORDS_3
    3 = WORDS_4
    4 = WORDS_5
    ...
    15 = WORDS_16

    Add helper functions for generating the correct burst size.

    Signed-off-by: Sameer Pujar
    Reviewed-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sameer Pujar
     
  • This is a preparatory patch to add support for Tegra186 and Tegra194 chips.
    Following changes are necessary to make driver code generic.
    * chip_data structure is enhanced to have chip specific details and
    following are the additions to the structure
    * Offset addresses for ADMA global and channel registers
    * Offset values for Tx and Rx channel selection
    * Maximum supported Tx and Rx channels
    * Tx and Rx channel request mask
    * ADMA channel register space size
    * Make use of above chip_data to generalise the driver code

    Support for Tegra186 and Tegra194 will be added in subsequent patches of
    the series.

    Signed-off-by: Sameer Pujar
    Reviewed-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sameer Pujar
     

25 Mar, 2019

2 commits

  • If the driver is active till late suspend, where runtime PM cannot run,
    force suspend is essential in such case to put the device in low power
    state. Thus pm_runtime_force_suspend and pm_runtime_force_resume are
    used as system sleep callbacks during system wide PM transitions.
    Late system sleep callbacks are used to ensure, for instance, that the
    sound core has suspended any on-going activity, including stopping the
    ADMA if active, before we attempt to suspend the ADMA.

    Suggested-by: Jonathan Hunter
    Signed-off-by: Sameer Pujar
    Acked-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sameer Pujar
     
  • adma driver is using pm_clk_*() interface for managing clock resources.
    With this it is observed that clocks remain ON always. This happens on
    Tegra devices which use BPMP co-processor to manage clock resources,
    where clocks are enabled during prepare phase. This is necessary because
    clocks to BPMP are always blocking. When pm_clk_*() interface is used on
    such Tegra devices, clock prepare count is not balanced till remove call
    happens for the driver and hence clocks are seen ON always. Thus this
    patch replaces pm_clk_*() with devm_clk_*() framework.

    Suggested-by: Mohan Kumar D
    Reviewed-by: Jonathan Hunter
    Signed-off-by: Sameer Pujar
    Signed-off-by: Vinod Koul

    Sameer Pujar
     

20 Jan, 2019

1 commit

  • One of the more common cases of allocation size calculations is finding
    the size of a structure that has a zero-sized array at the end, along
    with memory for some number of elements for that array. For example:

    struct foo {
    int stuff;
    void *entry[];
    };

    instance = devm_kzalloc(dev, sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

    Instead of leaving these open-coded and prone to type mistakes, we can
    now use the new struct_size() helper:

    instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL);

    This code was detected with the help of Coccinelle.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Vinod Koul

    Gustavo A. R. Silva
     

09 Aug, 2017

1 commit

  • of_irq_get() may return 0 as well as negative error number on failure,
    while the driver only checks for the negative values. The driver would then
    call request_irq(0, ...) in tegra_adma_alloc_chan_resources() and never get
    valid channel interrupt.

    Check for 'tdc->irq
    Acked-by: Thierry Reding
    Acked-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Sergei Shtylyov
     

22 Aug, 2016

1 commit


13 May, 2016

1 commit

  • Add support for the Tegra210 Audio DMA controller that is used for
    transferring data between system memory and the Audio sub-system.
    The driver only supports cyclic transfers because this is being solely
    used for audio.

    This driver is based upon the work by Dara Ramesh .

    Signed-off-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Jon Hunter