alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jie Yang <yang.jie@intel.com>
To: alsa-devel@alsa-project.org
Cc: mengdong.lin@intel.com, broonie@kernel.org, liam.r.girdwood@intel.com
Subject: [PATCH 4/5] ASoC: Intel: Add dummy read for SRAM block enable
Date: Mon, 14 Jul 2014 16:37:54 +0800	[thread overview]
Message-ID: <1405327075-27831-5-git-send-email-yang.jie@intel.com> (raw)
In-Reply-To: <1405327075-27831-1-git-send-email-yang.jie@intel.com>

Add dummy read after each block enable, to workaround
SRAM write missing bytes issue.

Signed-off-by: Jie Yang <yang.jie@intel.com>
---
 sound/soc/intel/sst-haswell-dsp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
index f4276fb..cc58b31 100644
--- a/sound/soc/intel/sst-haswell-dsp.c
+++ b/sound/soc/intel/sst-haswell-dsp.c
@@ -381,6 +381,17 @@ static u32 hsw_block_get_bit(struct sst_mem_block *block)
 	return bit;
 }
 
+/*dummy read a SRAM block.*/
+static void sst_mem_block_dummy_read(struct sst_mem_block *block)
+{
+	u32 size;
+	u8 tmp_buf[4];
+	struct sst_dsp *sst = block->dsp;
+
+	size = block->size > 4 ? 4 : block->size;
+	memcpy_fromio(tmp_buf, sst->addr.lpe + block->offset, size);
+}
+
 /* enable 32kB memory block - locks held by caller */
 static int hsw_block_enable(struct sst_mem_block *block)
 {
@@ -400,6 +411,8 @@ static int hsw_block_enable(struct sst_mem_block *block)
 	/* wait 18 DSP clock ticks */
 	udelay(10);
 
+	/*add a dummy read before the SRAM block is written, otherwise the writing may miss bytes sometimes.*/
+	sst_mem_block_dummy_read(block);
 	return 0;
 }
 
-- 
1.8.3.2

  parent reply	other threads:[~2014-07-14  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14  8:37 [PATCH 0/5] ASoC: Intel: Enable BDW/HSW SRAM power gating Jie Yang
2014-07-14  8:37 ` [PATCH 1/5] ASoC: Intel: Add persistent area alloc Jie Yang
2014-07-14  8:37 ` [PATCH 2/5] ASoC: Intel: Merge wild cat point ADSP DRAM regions Jie Yang
2014-07-14  8:37 ` [PATCH 3/5] ASoC: Intel: Use a table for ADSP SRAM shift Jie Yang
2014-07-14  8:37 ` Jie Yang [this message]
2014-07-14  8:37 ` [PATCH 5/5] ASoC: Intel: Start with all memory banks disabled Jie Yang

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=1405327075-27831-5-git-send-email-yang.jie@intel.com \
    --to=yang.jie@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=mengdong.lin@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;
as well as URLs for NNTP newsgroup(s).