From: vinod.koul@intel.com (Vinod Koul)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 6/8] dmaengine: bcm2835: move controlblock chain generation into separate method
Date: Wed, 13 Jan 2016 18:53:33 +0530 [thread overview]
Message-ID: <20160113132333.GC11130@localhost> (raw)
In-Reply-To: <1452187987-2605-7-git-send-email-kernel@martin.sperl.org>
On Thu, Jan 07, 2016 at 05:33:04PM +0000, kernel at martin.sperl.org wrote:
> +static inline bool bcm2835_dma_is_lite(struct bcm2835_chan *c)
> +{
> + /* dma channels >= 7 are LITE channels */
> + return (c->ch >= 7);
Why not DT data here as well
> +}
> +
> +static inline size_t bcm2835_dma_max_frame_length(struct bcm2835_chan *c)
> +{
> + /* lite and normal channels have different max frame length */
> + return bcm2835_dma_is_lite(c) ? MAX_LITE_DMA_LEN : MAX_DMA_LEN;
Or rather get length from DT..
> +static struct bcm2835_desc *bcm2835_dma_create_cb_chain(
> + struct dma_chan *chan, enum dma_transfer_direction direction,
> + bool cyclic, u32 info, u32 finalextrainfo, size_t frames,
> + dma_addr_t src, dma_addr_t dst, size_t buf_len,
> + size_t period_len, gfp_t gfp)
> +{
> + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
> + size_t len = buf_len, total_len;
> + size_t frame;
> + struct bcm2835_desc *d;
> + struct bcm2835_cb_entry *cb_entry;
> + struct bcm2835_dma_cb *control_block;
> + size_t max_len = bcm2835_dma_max_frame_length(c);
> +
> + /* allocate and setup the descriptor. */
> + d = kzalloc(sizeof(*d) + frames * sizeof(struct bcm2835_cb_entry),
> + gfp);
odd style.. btw should flag be GFP_NOWAIT ..?
> + /* fill in the control block */
> + control_block = cb_entry->cb;
> + control_block->info = info;
> + control_block->src = src;
> + control_block->dst = dst;
> + if (buf_len) {
> + control_block->length = min(max_len, len);
> + if (period_len &&
> + (total_len + control_block->length >=
> + period_len)) {
> + /* set to end of period_len */
> + control_block->length =
> + period_len - total_len;
> + /* add extrainfo when cyclic */
> + if (cyclic)
> + control_block->info |=
> + finalextrainfo;
> + /* and reset total_len */
> + total_len = 0;
> + }
this looks hard to read, perhpas a helper will make it look better
> + /* the last frame requires extra flags */
> + d->cb_list[d->frames - 1].cb->info |= finalextrainfo;
> +
> + /* check the size - if there is some missmatch,
> + * then this is detected here
> + */
this is not kernel style for multi-line comments
> /* Grab configuration */
> if (!is_slave_direction(direction)) {
> - dev_err(chan->device->dev, "%s: bad direction?\n", __func__);
> + dev_err(chan->device->dev,
> + "%s: bad direction?\n", __func__);
unrelated change
> - /* Now allocate and setup the descriptor. */
> - d = kzalloc(sizeof(*d), GFP_NOWAIT);
> - if (!d)
> - return NULL;
> + /* warn if buf_len is not a multiple of period_lenas this may leed
> + * to unexpected latencies for interrupts and thus audiable clicks
> + */
here too
> /*
> - * Iterate over all frames, create a control block
> - * for each frame and link them together.
> + * allocate the CB chain
> + * note that we need to use GFP_ATOMIC, as the ALSA i2s dmaengine
dmaengine drivers use GFP_NOWAIT in these cases
--
~Vinod
next prev parent reply other threads:[~2016-01-13 13:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 17:32 [PATCH V2 0/8] dmaengine: bcm2835: enhancement of driver kernel at martin.sperl.org
2016-01-07 17:32 ` [PATCH V2 1/8] dmaengine: bcm2835: set residue_granularity field kernel at martin.sperl.org
2016-01-28 19:53 ` Eric Anholt
2016-01-07 17:33 ` [PATCH V2 2/8] dmaengine: bcm2835: remove unnecessary masking of dma channels kernel at martin.sperl.org
2016-01-30 3:08 ` Eric Anholt
2016-01-07 17:33 ` [PATCH V2 3/8] dmaengine: bcm2835: use shared interrupt for channel 11 to 14 kernel at martin.sperl.org
2016-01-13 12:26 ` Vinod Koul
2016-01-13 13:30 ` Martin Sperl
2016-01-13 13:43 ` Vinod Koul
2016-01-13 14:24 ` Martin Sperl
2016-01-14 4:07 ` Vinod Koul
2016-01-14 8:48 ` Martin Sperl
2016-02-29 17:10 ` Martin Sperl
2016-03-03 15:45 ` Vinod Koul
2016-02-18 4:09 ` Eric Anholt
2016-01-07 17:33 ` [PATCH V2 4/8] dmaengine: bcm2835: add additional defines for DMA-registers kernel at martin.sperl.org
2016-01-13 12:32 ` Vinod Koul
2016-02-18 4:18 ` Eric Anholt
2016-01-07 17:33 ` [PATCH V2 5/8] dmaengine: bcm2835: move cyclic member from bcm2835_chan into bcm2835_desc kernel at martin.sperl.org
2016-02-18 4:19 ` Eric Anholt
2016-01-07 17:33 ` [PATCH V2 6/8] dmaengine: bcm2835: move controlblock chain generation into separate method kernel at martin.sperl.org
2016-01-13 13:23 ` Vinod Koul [this message]
2016-01-13 13:38 ` Martin Sperl
2016-02-18 3:24 ` Eric Anholt
2016-02-29 18:14 ` Martin Sperl
2016-01-07 17:33 ` [PATCH V2 7/8] dmaengine: bcm2835: add slave_sg support to bcm2835-dma kernel at martin.sperl.org
2016-02-18 4:39 ` Eric Anholt
2016-01-07 17:33 ` [PATCH V2 8/8] dmaengine: bcm2835: add dma_memcopy " kernel at martin.sperl.org
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=20160113132333.GC11130@localhost \
--to=vinod.koul@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).