All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Vinod Koul <vinod.koul@intel.com>
Cc: liam.r.girdwood@linux.intel.com, tiwai@suse.de,
	alsa-devel@alsa-project.org,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	patches.audio@intel.com
Subject: Re: [RFC 6/9] ASoC: hda: Add Code Loader DMA support
Date: Fri, 24 Apr 2015 18:18:38 +0100	[thread overview]
Message-ID: <20150424171838.GV22845@sirena.org.uk> (raw)
In-Reply-To: <1429276567-29007-7-git-send-email-vinod.koul@intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 1794 bytes --]

On Fri, Apr 17, 2015 at 06:46:04PM +0530, Vinod Koul wrote:

> +void ssth_cldma_int_enable(struct ssth_lib *ctx)
> +{
> +	ssth_updatel_bits(ctx, HDA_ADSP_REG_ADSPIC,
> +			ADSPIC_CL_DMA, 0x2);
> +}
> +void ssth_cldma_int_disable(struct ssth_lib *ctx)
> +{
> +	ssth_updatel_bits(ctx, HDA_ADSP_REG_ADSPIC,
> +			ADSPIC_CL_DMA, 0);
> +}

Blank lines between functions.  Seems to be an Intel coding style thing?
:P

> +/* Code loader helper APIs */
> +static void ssth_skl_cl_setup_bdle(struct snd_dma_buffer *dmab_data,
> +		u32 **bdlp, u32 count)
> +{
> +	u32 *bdl = *bdlp;
> +	int i = 0;
> +
> +	for (i = 0; i < count; i++) {
> +		phys_addr_t addr = virt_to_phys(dmab_data->area + i * PAGE_SIZE);

So this we index by i and...

> +
> +		bdl[0] = cpu_to_le32(lower_32_bits(addr));
> +		bdl[1] = cpu_to_le32(upper_32_bits(addr));
> +		bdl[2] = cpu_to_le32(PAGE_SIZE);
> +		bdl[3] = 0;
> +		bdl += 4;
> +	}

...this we index by stepping through the array with increments in the
body of the loop.  Consistency would be nice (and more obviously
correct).

> +static void ssth_skl_cl_cleaup(struct ssth_lib  *ctx)
> +{

Can't we clean it up instead?

> +	if (ctx->cl_dev.bytes_left <= ctx->cl_dev.bufsize &&
> +			ctx->cl_dev.bytes_left > ctx->cl_dev.period_size) {
> +
> +		dev_dbg(ctx->dev, "%s: size less than buffer size: %u\n",
> +			       __func__, ctx->cl_dev.bytes_left);
> +		ssth_cldma_int_disable(ctx);
> +		ctx->cl_dev.curr_spib_pos = ctx->cl_dev.bytes_left;
> +		ssth_cl_dma_fill_buffer(ctx, size, false, false, 0, false, true);
> +		do {
> +			mdelay(5);
> +			link_pos = ssth_readl(ctx, CL_SD_LPIB);
> +		} while (link_pos < size);

Should time out in case the DMA got stuck somehow.

> +		goto cleanup;
> +	}

What if the buffer is just too big?  Looks like this would loop for
ever.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2015-04-24 17:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 13:15 [RFC 0/9] Add SKL ipc handling code Vinod Koul
2015-04-17 13:15 ` [RFC 1/9] ASoC: hda: Add helper to read/write to dsp mmio space Vinod Koul
2015-04-20 21:46   ` Mark Brown
2015-04-22  3:50     ` Vinod Koul
2015-04-24 17:33       ` Mark Brown
2015-04-26 14:34         ` Vinod Koul
2015-04-27 21:02           ` Mark Brown
2015-04-29 11:03             ` Vinod Koul
2015-04-17 13:16 ` [RFC 2/9] ASoC: hda: Add IPC library for SKL platform Vinod Koul
2015-04-20 21:56   ` Mark Brown
2015-04-22  3:54     ` Vinod Koul
2015-04-24 17:34       ` Mark Brown
2015-04-26 14:36         ` Vinod Koul
2015-04-17 13:16 ` [RFC 3/9] ASoC: hda: Add config option for SKL ipc library Vinod Koul
2015-04-17 13:16 ` [RFC 4/9] ASoC: hda: Add DSP init and boot up functionality Vinod Koul
2015-04-24 17:11   ` Mark Brown
2015-04-26 14:21     ` Vinod Koul
2015-04-17 13:16 ` [RFC 5/9] ASoC: hda: Add dsp loader ops Vinod Koul
2015-04-17 13:16 ` [RFC 6/9] ASoC: hda: Add Code Loader DMA support Vinod Koul
2015-04-24 17:18   ` Mark Brown [this message]
2015-04-26 14:28     ` Vinod Koul
2015-04-27 14:17       ` Mark Brown
2015-04-29 11:08         ` Vinod Koul
2015-04-17 13:16 ` [RFC 7/9] ASoC: hda: Add DSP library functions for SKL platform Vinod Koul
2015-04-17 13:16 ` [RFC 8/9] ASoC: hda: Add for CL DMA interrupt handling Vinod Koul
2015-04-24 17:30   ` Mark Brown
2015-04-26 14:28     ` Vinod Koul
2015-04-17 13:16 ` [RFC 9/9] ASoC: hda: Export API to change DSP power state Vinod Koul
2015-04-24 17:33   ` Mark Brown
2015-04-20 21:44 ` [RFC 0/9] Add SKL ipc handling code Mark Brown
2015-04-22  4:00   ` Vinod Koul
2015-04-22 11:19     ` Liam Girdwood
2015-04-22 15:53       ` Vinod Koul
2015-04-22 19:06         ` Mark Brown

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=20150424171838.GV22845@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=tiwai@suse.de \
    --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 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.