All of lore.kernel.org
 help / color / mirror / Atom feed
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 06/53] dmaengine: Create a generic dma_slave_caps callback
Date: Wed, 22 Oct 2014 23:16:03 +0300	[thread overview]
Message-ID: <2111765.kYORi97jNj@avalon> (raw)
In-Reply-To: <20141016162453.GN19438@lukather>

Hi Maxime,

On Thursday 16 October 2014 18:24:53 Maxime Ripard wrote:
> On Thu, Oct 16, 2014 at 07:15:40PM +0300, Laurent Pinchart wrote:
> > On Thursday 16 October 2014 12:17:05 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 and a flag to trigger it. In case this
> > > flag hasn't been set, fall back to the old mechanism.
> > > 
> > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > ---
> > > 
> > >  include/linux/dmaengine.h | 25 +++++++++++++++++++++----
> > >  1 file changed, 21 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > > index 4d0294ec3567..85afd71df2e7 100644
> > > --- a/include/linux/dmaengine.h
> > > +++ b/include/linux/dmaengine.h
> > > @@ -643,6 +643,8 @@ struct dma_device {
> > > 
> > >  	int dev_id;
> > >  	struct device *dev;
> > > 
> > > +	bool generic_slave_caps;
> > > +
> > > 
> > >  	int (*device_alloc_chan_resources)(struct dma_chan *chan);
> > >  	void (*device_free_chan_resources)(struct dma_chan *chan);
> > > 
> > > @@ -772,17 +774,32 @@ static inline struct dma_async_tx_descriptor
> > > *dmaengine_prep_interleaved_dma(
> > > 
> > >  static inline int dma_get_slave_caps(struct dma_chan *chan, struct
> > > 
> > > dma_slave_caps *caps) {
> > 
> > This is getting too big for an inline function, it should be moved to
> > drivers/dma/dmaengine.c.
> 
> I agree, but I wanted to do that in another patch set. This one is
> just getting bigger and bigger, and this is not really the point of
> this serie.

If both get merged in the same kernel version I would be fine with this.

> > > +	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->generic_slave_caps)
> > >  		return -ENXIO;
> > 
> > Couldn't we replace that check with if (device->device_control) and get
> > rid of the generic_slave_caps field ? Drivers converted to the new API
> > would then get slave caps support for free.
> 
> Not really. Drivers might have converted to the splitted device_control (and
> actually all of them are), while they don't define the values needed to
> implement properly the generic slave caps retrieval (and the vast majority
> of them doesn't).

Indeed, my bad.

How about testing those fields then ? You could consider that the driver wants 
the generic slave caps implementation if device->directions is set to a non-
zero value for instance.

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: dmaengine@vger.kernel.org, "Vinod Koul" <vinod.koul@intel.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Antoine Ténart" <antoine@free-electrons.com>,
	lars@metafoo.de, "Russell King" <linux@arm.linux.org.uk>,
	"Dan Williams" <dan.j.williams@intel.com>
Subject: Re: [PATCH v2 06/53] dmaengine: Create a generic dma_slave_caps callback
Date: Wed, 22 Oct 2014 23:16:03 +0300	[thread overview]
Message-ID: <2111765.kYORi97jNj@avalon> (raw)
In-Reply-To: <20141016162453.GN19438@lukather>

Hi Maxime,

On Thursday 16 October 2014 18:24:53 Maxime Ripard wrote:
> On Thu, Oct 16, 2014 at 07:15:40PM +0300, Laurent Pinchart wrote:
> > On Thursday 16 October 2014 12:17:05 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 and a flag to trigger it. In case this
> > > flag hasn't been set, fall back to the old mechanism.
> > > 
> > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > > ---
> > > 
> > >  include/linux/dmaengine.h | 25 +++++++++++++++++++++----
> > >  1 file changed, 21 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > > index 4d0294ec3567..85afd71df2e7 100644
> > > --- a/include/linux/dmaengine.h
> > > +++ b/include/linux/dmaengine.h
> > > @@ -643,6 +643,8 @@ struct dma_device {
> > > 
> > >  	int dev_id;
> > >  	struct device *dev;
> > > 
> > > +	bool generic_slave_caps;
> > > +
> > > 
> > >  	int (*device_alloc_chan_resources)(struct dma_chan *chan);
> > >  	void (*device_free_chan_resources)(struct dma_chan *chan);
> > > 
> > > @@ -772,17 +774,32 @@ static inline struct dma_async_tx_descriptor
> > > *dmaengine_prep_interleaved_dma(
> > > 
> > >  static inline int dma_get_slave_caps(struct dma_chan *chan, struct
> > > 
> > > dma_slave_caps *caps) {
> > 
> > This is getting too big for an inline function, it should be moved to
> > drivers/dma/dmaengine.c.
> 
> I agree, but I wanted to do that in another patch set. This one is
> just getting bigger and bigger, and this is not really the point of
> this serie.

If both get merged in the same kernel version I would be fine with this.

> > > +	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->generic_slave_caps)
> > >  		return -ENXIO;
> > 
> > Couldn't we replace that check with if (device->device_control) and get
> > rid of the generic_slave_caps field ? Drivers converted to the new API
> > would then get slave caps support for free.
> 
> Not really. Drivers might have converted to the splitted device_control (and
> actually all of them are), while they don't define the values needed to
> implement properly the generic slave caps retrieval (and the vast majority
> of them doesn't).

Indeed, my bad.

How about testing those fields then ? You could consider that the driver wants 
the generic slave caps implementation if device->directions is set to a non-
zero value for instance.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2014-10-22 20:16 UTC|newest]

Thread overview: 147+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 10:16 [PATCH v2 00/53] dmaengine: Implement generic slave capabilities retrieval Maxime Ripard
2014-10-16 10:16 ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 01/53] dmaengine: Make the destination abbreviation coherent Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:25   ` Mark Brown
2014-10-16 10:25     ` Mark Brown
2014-10-16 10:32   ` Laurent Pinchart
2014-10-16 10:32     ` Laurent Pinchart
2014-10-16 15:26   ` Stephen Warren
2014-10-16 15:26     ` Stephen Warren
2014-10-16 10:17 ` [PATCH v2 02/53] dmaengine: Make channel allocation callbacks optional Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:35   ` Laurent Pinchart
2014-10-16 10:35     ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 03/53] dmaengine: Introduce a device_config callback Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:44   ` Laurent Pinchart
2014-10-16 10:44     ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 04/53] dmaengine: split out pause/resume operations from device_control Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:45   ` Laurent Pinchart
2014-10-16 10:45     ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 05/53] dmaengine: Add device_terminate_all callback Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:46   ` Laurent Pinchart
2014-10-16 10:46     ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 06/53] dmaengine: Create a generic dma_slave_caps callback Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 16:15   ` Laurent Pinchart
2014-10-16 16:15     ` Laurent Pinchart
2014-10-16 16:24     ` Maxime Ripard
2014-10-16 16:24       ` Maxime Ripard
2014-10-22 20:16       ` Laurent Pinchart [this message]
2014-10-22 20:16         ` Laurent Pinchart
2014-10-23  8:08         ` Maxime Ripard
2014-10-23  8:08           ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 07/53] dmaengine: Move slave caps to dma_device Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 08/53] dmaengine: pl08x: Split device_control Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 09/53] dmaengine: hdmac: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 10/53] dmaengine: bcm2835: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 15:27   ` Stephen Warren
2014-10-16 15:27     ` Stephen Warren
2014-10-16 10:17 ` [PATCH v2 11/53] dmaengine: coh901318: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-28 14:40   ` Linus Walleij
2014-10-28 14:40     ` Linus Walleij
2014-10-16 10:17 ` [PATCH v2 12/53] dmaengine: cppi41: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 13/53] dmaengine: jz4740: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 14/53] dmaengine: dw: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 11:17   ` Andy Shevchenko
2014-10-16 11:17     ` Andy Shevchenko
2014-10-16 14:05     ` Maxime Ripard
2014-10-16 14:05       ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 15/53] dmaengine: edma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 16/53] dmaengine: ep93xx: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 17/53] dmaengine: fsl-edma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 18/53] dmaengine: imx: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 19/53] dmaengine: imx-sdma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 20/53] dmaengine: intel-mid-dma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 21/53] dmaengine: ipu-idmac: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 22/53] dmaengine: k3: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 23/53] dmaengine: mmp-pdma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 24/53] dmaengine: mmp-tdma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 25/53] dmaengine: moxart: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 26/53] dmaengine: fsl-dma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 27/53] dmaengine: mpc512x: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 28/53] dmaengine: mxs: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 29/53] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 30/53] dmaengine: omap: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 31/53] dmaengine: pl330: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 32/53] dmaengine: bam-dma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 33/53] dmaengine: s3c24xx: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 34/53] dmaengine: sa11x0: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 35/53] dmaengine: sh: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 16:17   ` Laurent Pinchart
2014-10-16 16:17     ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 36/53] dmaengine: sirf: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 37/53] dmaengine: sun6i: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 38/53] dmaengine: d40: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-28 14:41   ` Linus Walleij
2014-10-28 14:41     ` Linus Walleij
2014-10-16 10:17 ` [PATCH v2 39/53] dmaengine: tegra20: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 40/53] dmaengine: xilinx: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 16:20   ` Laurent Pinchart
2014-10-16 16:20     ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 41/53] dmaengine: mv_xor: Remove device_control Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 42/53] dmaengine: pch-dma: Rename device_control Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 43/53] dmaengine: td: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 44/53] dmaengine: txx9: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 45/53] dmaengine: bcm2835: Declare slave capabilities for the generic code Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 15:27   ` Stephen Warren
2014-10-16 15:27     ` Stephen Warren
2014-10-16 10:17 ` [PATCH v2 46/53] dmaengine: fsl-edma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 47/53] dmaengine: edma: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 48/53] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 49/53] dmaengine: omap: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 50/53] dmaengine: pl330: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 51/53] dmaengine: sirf: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 52/53] dmaengine: sun6i: " Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 53/53] dmaengine: Mark device_control and device_slave_caps as deprecated Maxime Ripard
2014-10-16 10:17   ` Maxime Ripard

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=2111765.kYORi97jNj@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.