public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Vinod Koul <vinod.koul@intel.com>, <dmaengine@vger.kernel.org>
Cc: lars@metafoo.de, "Russell King" <linux@arm.linux.org.uk>,
	linux-kernel@vger.kernel.org,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	linux-arm-kernel@lists.infradead.org,
	"Antoine Ténart" <antoine@free-electrons.com>
Subject: Re: [PATCH v4 12/58] dmaengine: hdmac: Split device_control
Date: Mon, 3 Nov 2014 12:15:52 +0100	[thread overview]
Message-ID: <545763E8.9050204@atmel.com> (raw)
In-Reply-To: <1414531573-18807-13-git-send-email-maxime.ripard@free-electrons.com>

On 28/10/2014 22:25, Maxime Ripard :
> Split the device_control callback of the Atmel HDMAC driver to make use
> of the newly introduced callbacks, that will eventually be used to retrieve
> slave capabilities.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

It seems okay:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks.

> ---
>  drivers/dma/at_hdmac.c | 121 +++++++++++++++++++++++++++++--------------------
>  1 file changed, 73 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index ca9dd2613283..86450b3442f2 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -972,11 +972,13 @@ err_out:
>  	return NULL;
>  }
>  
> -static int set_runtime_config(struct dma_chan *chan,
> -			      struct dma_slave_config *sconfig)
> +static int atc_config(struct dma_chan *chan,
> +		      struct dma_slave_config *sconfig)
>  {
>  	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
>  
> +	dev_vdbg(chan2dev(chan), "%s\n", __func__);
> +
>  	/* Check if it is chan is configured for slave transfers */
>  	if (!chan->private)
>  		return -EINVAL;
> @@ -989,9 +991,28 @@ static int set_runtime_config(struct dma_chan *chan,
>  	return 0;
>  }
>  
> +static int atc_pause(struct dma_chan *chan)
> +{
> +	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
> +	struct at_dma		*atdma = to_at_dma(chan->device);
> +	int			chan_id = atchan->chan_common.chan_id;
> +	unsigned long		flags;
>  
> -static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
> -		       unsigned long arg)
> +	LIST_HEAD(list);
> +
> +	dev_vdbg(chan2dev(chan), "%s\n", __func__);
> +
> +	spin_lock_irqsave(&atchan->lock, flags);
> +
> +	dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
> +	set_bit(ATC_IS_PAUSED, &atchan->status);
> +
> +	spin_unlock_irqrestore(&atchan->lock, flags);
> +
> +	return 0;
> +}
> +
> +static int atc_resume(struct dma_chan *chan)
>  {
>  	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
>  	struct at_dma		*atdma = to_at_dma(chan->device);
> @@ -1000,60 +1021,61 @@ static int atc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
>  
>  	LIST_HEAD(list);
>  
> -	dev_vdbg(chan2dev(chan), "atc_control (%d)\n", cmd);
> +	dev_vdbg(chan2dev(chan), "%s\n", __func__);
>  
> -	if (cmd == DMA_PAUSE) {
> -		spin_lock_irqsave(&atchan->lock, flags);
> +	if (!atc_chan_is_paused(atchan))
> +		return 0;
>  
> -		dma_writel(atdma, CHER, AT_DMA_SUSP(chan_id));
> -		set_bit(ATC_IS_PAUSED, &atchan->status);
> +	spin_lock_irqsave(&atchan->lock, flags);
>  
> -		spin_unlock_irqrestore(&atchan->lock, flags);
> -	} else if (cmd == DMA_RESUME) {
> -		if (!atc_chan_is_paused(atchan))
> -			return 0;
> +	dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
> +	clear_bit(ATC_IS_PAUSED, &atchan->status);
>  
> -		spin_lock_irqsave(&atchan->lock, flags);
> +	spin_unlock_irqrestore(&atchan->lock, flags);
>  
> -		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id));
> -		clear_bit(ATC_IS_PAUSED, &atchan->status);
> +	return 0;
> +}
>  
> -		spin_unlock_irqrestore(&atchan->lock, flags);
> -	} else if (cmd == DMA_TERMINATE_ALL) {
> -		struct at_desc	*desc, *_desc;
> -		/*
> -		 * This is only called when something went wrong elsewhere, so
> -		 * we don't really care about the data. Just disable the
> -		 * channel. We still have to poll the channel enable bit due
> -		 * to AHB/HSB limitations.
> -		 */
> -		spin_lock_irqsave(&atchan->lock, flags);
> +static int atc_terminate_all(struct dma_chan *chan)
> +{
> +	struct at_dma_chan	*atchan = to_at_dma_chan(chan);
> +	struct at_dma		*atdma = to_at_dma(chan->device);
> +	int			chan_id = atchan->chan_common.chan_id;
> +	struct at_desc		*desc, *_desc;
> +	unsigned long		flags;
>  
> -		/* disabling channel: must also remove suspend state */
> -		dma_writel(atdma, CHDR, AT_DMA_RES(chan_id) | atchan->mask);
> +	LIST_HEAD(list);
>  
> -		/* confirm that this channel is disabled */
> -		while (dma_readl(atdma, CHSR) & atchan->mask)
> -			cpu_relax();
> +	dev_vdbg(chan2dev(chan), "%s\n", __func__);
>  
> -		/* active_list entries will end up before queued entries */
> -		list_splice_init(&atchan->queue, &list);
> -		list_splice_init(&atchan->active_list, &list);
> +	/*
> +	 * This is only called when something went wrong elsewhere, so
> +	 * we don't really care about the data. Just disable the
> +	 * channel. We still have to poll the channel enable bit due
> +	 * to AHB/HSB limitations.
> +	 */
> +	spin_lock_irqsave(&atchan->lock, flags);
>  
> -		/* Flush all pending and queued descriptors */
> -		list_for_each_entry_safe(desc, _desc, &list, desc_node)
> -			atc_chain_complete(atchan, desc);
> +	/* disabling channel: must also remove suspend state */
> +	dma_writel(atdma, CHDR, AT_DMA_RES(chan_id) | atchan->mask);
>  
> -		clear_bit(ATC_IS_PAUSED, &atchan->status);
> -		/* if channel dedicated to cyclic operations, free it */
> -		clear_bit(ATC_IS_CYCLIC, &atchan->status);
> +	/* confirm that this channel is disabled */
> +	while (dma_readl(atdma, CHSR) & atchan->mask)
> +		cpu_relax();
>  
> -		spin_unlock_irqrestore(&atchan->lock, flags);
> -	} else if (cmd == DMA_SLAVE_CONFIG) {
> -		return set_runtime_config(chan, (struct dma_slave_config *)arg);
> -	} else {
> -		return -ENXIO;
> -	}
> +	/* active_list entries will end up before queued entries */
> +	list_splice_init(&atchan->queue, &list);
> +	list_splice_init(&atchan->active_list, &list);
> +
> +	/* Flush all pending and queued descriptors */
> +	list_for_each_entry_safe(desc, _desc, &list, desc_node)
> +		atc_chain_complete(atchan, desc);
> +
> +	clear_bit(ATC_IS_PAUSED, &atchan->status);
> +	/* if channel dedicated to cyclic operations, free it */
> +	clear_bit(ATC_IS_CYCLIC, &atchan->status);
> +
> +	spin_unlock_irqrestore(&atchan->lock, flags);
>  
>  	return 0;
>  }
> @@ -1505,7 +1527,10 @@ static int __init at_dma_probe(struct platform_device *pdev)
>  		/* controller can do slave DMA: can trigger cyclic transfers */
>  		dma_cap_set(DMA_CYCLIC, atdma->dma_common.cap_mask);
>  		atdma->dma_common.device_prep_dma_cyclic = atc_prep_dma_cyclic;
> -		atdma->dma_common.device_control = atc_control;
> +		atdma->dma_common.device_config = atc_config;
> +		atdma->dma_common.device_pause = atc_pause;
> +		atdma->dma_common.device_resume = atc_resume;
> +		atdma->dma_common.device_terminate_all = atc_terminate_all;
>  	}
>  
>  	dma_writel(atdma, EN, AT_DMA_ENABLE);
> @@ -1622,7 +1647,7 @@ static void atc_suspend_cyclic(struct at_dma_chan *atchan)
>  	if (!atc_chan_is_paused(atchan)) {
>  		dev_warn(chan2dev(chan),
>  		"cyclic channel not paused, should be done by channel user\n");
> -		atc_control(chan, DMA_PAUSE, 0);
> +		atc_pause(chan);
>  	}
>  
>  	/* now preserve additional data for cyclic operations */
> 


-- 
Nicolas Ferre

  reply	other threads:[~2014-11-03 11:15 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   ` [PATCH v4 10/58] dmaengine: Create a generic dma_slave_caps callback Laurent Pinchart
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 [this message]
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=545763E8.9050204@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=antoine@free-electrons.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --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