From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: "Vinod Koul" <vinod.koul@intel.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
"Antoine Ténart" <antoine@free-electrons.com>,
"Russell King" <linux@arm.linux.org.uk>,
lars@metafoo.de
Subject: Re: [PATCH v4 10/58] dmaengine: Create a generic dma_slave_caps callback
Date: Wed, 29 Oct 2014 00:31:50 +0200 [thread overview]
Message-ID: <2404835.bBK1tFY7m2@avalon> (raw)
In-Reply-To: <1414531573-18807-11-git-send-email-maxime.ripard@free-electrons.com>
Hi Maxime,
Thank you for the patch.
On Tuesday 28 October 2014 22:25:25 Maxime Ripard wrote:
> dma_slave_caps is very important to the generic layers that might interact
> with dmaengine, such as ASoC. Unfortunately, it has been added as yet
> another dma_device callback, and most of the existing drivers haven't
> implemented it, reducing its reliability.
>
> Introduce a generic behaviour to implement this, that rely on both the split
> of device_control to derive which functions are supported and on new
> variables to be set in the dma_device structure.
>
> These variables holds what used to be the capabilities, that were set
> per-channel. However, this proved to be a bit overkill, since every driver
> filling these so far were hardcoding it, disregarding which channel was
> actually given.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
You might want to consider adding "dmaengine: Move dma_get_slave_caps()
implementation to dmaengine.c" to this series.
> ---
> include/linux/dmaengine.h | 41 +++++++++++++++++++++++++++++++++++++----
> 1 file changed, 37 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index b0efc805937a..be9e60aa8f5e 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -593,6 +593,14 @@ struct dma_tx_state {
> * @fill_align: alignment shift for memset operations
> * @dev_id: unique device ID
> * @dev: struct device reference for dma mapping api
> + * @src_addr_widths: bit mask of src addr widths the device supports
> + * @dst_addr_widths: bit mask of dst addr widths the device supports
> + * @directions: bit mask of slave direction the device supports since
> + * the enum dma_transfer_direction is not defined as bits for
> + * each type of direction, the dma controller should fill (1 <<
> + * <TYPE>) and same should be checked by controller as well
> + * @residue_granularity: granularity of the transfer residue reported
> + * by tx_status
> * @device_alloc_chan_resources: allocate resources and return the
> * number of allocated descriptors
> * @device_free_chan_resources: release DMA channel's resources
> @@ -642,6 +650,11 @@ struct dma_device {
> int dev_id;
> struct device *dev;
>
> + u32 src_addr_widths;
> + u32 dst_addr_widths;
> + u32 directions;
> + enum dma_residue_granularity residue_granularity;
> +
> int (*device_alloc_chan_resources)(struct dma_chan *chan);
> void (*device_free_chan_resources)(struct dma_chan *chan);
>
> @@ -783,17 +796,37 @@ static inline struct dma_async_tx_descriptor
> *dmaengine_prep_dma_sg(
>
> static inline int dma_get_slave_caps(struct dma_chan *chan, struct
> dma_slave_caps *caps) {
> + struct dma_device *device;
> +
> if (!chan || !caps)
> return -EINVAL;
>
> + device = chan->device;
> +
> /* check if the channel supports slave transactions */
> - if (!test_bit(DMA_SLAVE, chan->device->cap_mask.bits))
> + if (!test_bit(DMA_SLAVE, device->cap_mask.bits))
> + return -ENXIO;
> +
> + if (device->device_slave_caps)
> + return device->device_slave_caps(chan, caps);
> +
> + /*
> + * Check whether it reports it uses the generic slave
> + * capabilities, if not, that means it doesn't support any
> + * kind of slave capabilities reporting.
> + */
> + if (!device->directions)
> return -ENXIO;
>
> - if (chan->device->device_slave_caps)
> - return chan->device->device_slave_caps(chan, caps);
> + caps->src_addr_widths = device->src_addr_widths;
> + caps->dst_addr_widths = device->dst_addr_widths;
> + caps->directions = device->directions;
> + caps->residue_granularity = device->residue_granularity;
> +
> + caps->cmd_pause = !!device->device_pause;
> + caps->cmd_terminate = !!device->device_terminate_all;
>
> - return -ENXIO;
> + return 0;
> }
>
> static inline int dmaengine_terminate_all(struct dma_chan *chan)
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-10-28 22:31 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-28 21:25 [PATCH v4 00/58] dmaengine: Implement generic slave capabilities retrieval Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 01/58] crypto: ux500: Use dmaengine_terminate_all API Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 02/58] serial: at91: Use dmaengine_slave_config API Maxime Ripard
2014-11-03 11:12 ` Nicolas Ferre
2014-11-03 12:33 ` Maxime Ripard
2014-11-03 17:46 ` Nicolas Ferre
2014-10-28 21:25 ` [PATCH v4 03/58] dmaengine: Make the destination abbreviation coherent Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 04/58] dmaengine: Rework dma_chan_get Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 05/58] dmaengine: Make channel allocation callbacks optional Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 06/58] dmaengine: Introduce a device_config callback Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 07/58] dmaengine: split out pause/resume operations from device_control Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 08/58] dmaengine: Add device_terminate_all callback Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 09/58] dmaengine: Remove the need to declare device_control Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 10/58] dmaengine: Create a generic dma_slave_caps callback Maxime Ripard
2014-10-28 22:30 ` [PATCH] dmaengine: Move dma_get_slave_caps() implementation to dmaengine.c Laurent Pinchart
2015-01-17 10:15 ` Laurent Pinchart
2015-01-18 14:26 ` Vinod Koul
2014-10-28 22:31 ` Laurent Pinchart [this message]
2014-10-28 21:25 ` [PATCH v4 11/58] dmaengine: pl08x: Split device_control Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 12/58] dmaengine: hdmac: " Maxime Ripard
2014-11-03 11:15 ` Nicolas Ferre
2014-10-28 21:25 ` [PATCH v4 13/58] dmaengine: bcm2835: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 14/58] dmaengine: coh901318: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 15/58] dmaengine: cppi41: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 16/58] dmaengine: jz4740: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 17/58] dmaengine: dw: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 18/58] dmaengine: edma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 19/58] dmaengine: ep93xx: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 20/58] dmaengine: fsl-edma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 21/58] dmaengine: imx: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 22/58] dmaengine: imx-sdma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 23/58] dmaengine: intel-mid-dma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 24/58] dmaengine: ipu-idmac: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 25/58] dmaengine: k3: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 26/58] dmaengine: mmp-pdma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 27/58] dmaengine: mmp-tdma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 28/58] dmaengine: moxart: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 29/58] dmaengine: fsl-dma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 30/58] dmaengine: mpc512x: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 31/58] dmaengine: mxs: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 32/58] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 33/58] dmaengine: omap: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 34/58] dmaengine: pl330: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 35/58] dmaengine: bam-dma: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 36/58] dmaengine: s3c24xx: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 37/58] dmaengine: sa11x0: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 38/58] dmaengine: sh: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 39/58] dmaengine: sirf: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 40/58] dmaengine: sun6i: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 41/58] dmaengine: d40: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 42/58] dmaengine: tegra20: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 43/58] dmaengine: xilinx: " Maxime Ripard
2014-10-28 21:25 ` [PATCH v4 44/58] dmaengine: mv_xor: Remove device_control Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 45/58] dmaengine: pch-dma: Rename device_control Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 46/58] dmaengine: td: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 47/58] dmaengine: txx9: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 48/58] dmaengine: rapidio: tsi721: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 49/58] dmaengine: bcm2835: Declare slave capabilities for the generic code Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 50/58] dmaengine: fsl-edma: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 51/58] dmaengine: edma: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 52/58] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 53/58] dmaengine: omap: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 54/58] dmaengine: pl330: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 55/58] dmaengine: sirf: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 56/58] dmaengine: sun6i: " Maxime Ripard
2014-10-28 21:26 ` [PATCH v4 57/58] dmaengine: Add a warning for drivers not using the generic slave caps retrieval Maxime Ripard
2014-10-28 22:06 ` Laurent Pinchart
2014-10-28 21:26 ` [PATCH v4 58/58] dmaengine: Remove device_control and device_slave_caps Maxime Ripard
2014-11-06 14:33 ` [PATCH v4 00/58] dmaengine: Implement generic slave capabilities retrieval Maxime Ripard
2014-11-12 11:25 ` Vinod Koul
2014-11-12 13:15 ` Maxime Ripard
2014-11-13 15:30 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2404835.bBK1tFY7m2@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=antoine@free-electrons.com \
--cc=dmaengine@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=maxime.ripard@free-electrons.com \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox