All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com,
	patches.audio@intel.com, broonie@kernel.org, "Kp,
	Jeeja" <jeeja.kp@intel.com>, Vinod Koul <vinod.koul@intel.com>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: [PATCH v2 1/6] ASoC: Intel: Add helper to poll register for DSP status
Date: Fri,  3 Jul 2015 16:04:02 +0530	[thread overview]
Message-ID: <1435919647-14049-2-git-send-email-vinod.koul@intel.com> (raw)
In-Reply-To: <1435919647-14049-1-git-send-email-vinod.koul@intel.com>

From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>

This patch adds helper to poll register for DSP status.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Kp, Jeeja <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/common/sst-dsp.c | 23 +++++++++++++++++++++++
 sound/soc/intel/common/sst-dsp.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/sound/soc/intel/common/sst-dsp.c b/sound/soc/intel/common/sst-dsp.c
index 64e94212d2d2..3356792d6933 100644
--- a/sound/soc/intel/common/sst-dsp.c
+++ b/sound/soc/intel/common/sst-dsp.c
@@ -20,6 +20,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/delay.h>
 
 #include "sst-dsp.h"
 #include "sst-dsp-priv.h"
@@ -222,6 +223,28 @@ int sst_dsp_shim_update_bits64(struct sst_dsp *sst, u32 offset,
 }
 EXPORT_SYMBOL_GPL(sst_dsp_shim_update_bits64);
 
+int sst_dsp_register_poll(struct sst_dsp *ctx, u32 offset, u32 mask,
+			 u32 expected_value, u32 timeout, char *operation)
+{
+	int time, ret;
+	u32 reg;
+
+	/* check if set state successful */
+	for (time = 0; time < timeout; time++) {
+		if ((sst_dsp_shim_read_unlocked(ctx, offset) & mask) == expected_value)
+			break;
+
+		mdelay(1);
+	}
+	reg = sst_dsp_shim_read_unlocked(ctx, offset);
+	dev_info(ctx->dev, "FW Poll Status: reg=%#x %s %s\n", reg, operation,
+			(time < timeout) ? "successful" : "timedout");
+	ret = time < timeout ? 0 : -ETIME;
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(sst_dsp_register_poll);
+
 void sst_dsp_dump(struct sst_dsp *sst)
 {
 	if (sst->ops->dump)
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
index 96aeb2556ad4..cc3197be4cf7 100644
--- a/sound/soc/intel/common/sst-dsp.h
+++ b/sound/soc/intel/common/sst-dsp.h
@@ -278,6 +278,8 @@ void sst_dsp_inbox_read(struct sst_dsp *dsp, void *message, size_t bytes);
 void sst_dsp_outbox_write(struct sst_dsp *dsp, void *message, size_t bytes);
 void sst_dsp_outbox_read(struct sst_dsp *dsp, void *message, size_t bytes);
 void sst_dsp_mailbox_dump(struct sst_dsp *dsp, size_t bytes);
+int sst_dsp_register_poll(struct sst_dsp  *dsp, u32 offset, u32 mask,
+		 u32 expected_value, u32 timeout, char *operation);
 
 /* Debug */
 void sst_dsp_dump(struct sst_dsp *sst);
-- 
1.9.1

  reply	other threads:[~2015-07-03 10:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03 10:34 [PATCH v2 0/6] ASoC: Intel: Sklyake - add IPC routines Vinod Koul
2015-07-03 10:34 ` Vinod Koul [this message]
2015-07-08 18:36   ` [PATCH v2 1/6] ASoC: Intel: Add helper to poll register for DSP status Mark Brown
2015-07-09  4:27     ` Vinod Koul
2015-07-09 10:48       ` Mark Brown
2015-07-09 10:53         ` Vinod Koul
2015-07-03 10:34 ` [PATCH v2 2/6] ASoC: Intel: Define SKL ADSP IPC and general purpose registers Vinod Koul
2015-07-03 10:34 ` [PATCH v2 3/6] ASoC: Intel: Reorganize the common dsp structure Vinod Koul
2015-07-08 18:38   ` Mark Brown
2015-07-09  4:32     ` Vinod Koul
2015-07-03 10:34 ` [PATCH v2 4/6] ASoC: Intel: Add helper to update register bits with attr RWC Vinod Koul
2015-07-08 18:47   ` Mark Brown
2015-07-09  4:44     ` Vinod Koul
2015-07-03 10:34 ` [PATCH v2 5/6] ASoC: Intel: Add Skylake IPC library Vinod Koul
2015-07-08 18:46   ` Mark Brown
2015-07-09  5:26     ` Vinod Koul
2015-07-09 13:18       ` Vinod Koul
2015-07-03 10:34 ` [PATCH v2 6/6] ASoC: Intel: Add DSP init and boot up functionality for SKL 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=1435919647-14049-2-git-send-email-vinod.koul@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=subhransu.s.prusty@intel.com \
    --cc=tiwai@suse.de \
    /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.