From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org,
vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com,
srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com,
Bard liao <yung-chuan.liao@linux.intel.com>,
Rander Wang <rander.wang@linux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Hui Wang <hui.wang@canonical.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Sanyog Kale <sanyog.r.kale@intel.com>
Subject: [PATCH 7/7] soundwire: intel: introduce helper for link synchronization
Date: Wed, 11 Mar 2020 17:10:26 -0500 [thread overview]
Message-ID: <20200311221026.18174-8-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20200311221026.18174-1-pierre-louis.bossart@linux.intel.com>
After arming the synchronization, the SYNCGO field controls the
hardware-based synchronization between links.
Move the programming and wait for clear of SYNCGO to dedicated helper.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
drivers/soundwire/intel.c | 47 ++++++++++++++++++++++++++++++++-------
1 file changed, 39 insertions(+), 8 deletions(-)
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 93d157d04eb9..e2dac2f0b343 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -524,6 +524,44 @@ static void intel_shim_sync_arm(struct sdw_intel *sdw)
mutex_unlock(sdw->link_res->shim_lock);
}
+static int intel_shim_sync_go_unlocked(struct sdw_intel *sdw)
+{
+ void __iomem *shim = sdw->link_res->shim;
+ u32 sync_reg;
+ int ret;
+
+ /* Read SYNC register */
+ sync_reg = intel_readl(shim, SDW_SHIM_SYNC);
+
+ /*
+ * Set SyncGO bit to synchronously trigger a bank switch for
+ * all the masters. A write to SYNCGO bit clears CMDSYNC bit for all
+ * the Masters.
+ */
+ sync_reg |= SDW_SHIM_SYNC_SYNCGO;
+
+ ret = intel_clear_bit(shim, SDW_SHIM_SYNC, sync_reg,
+ SDW_SHIM_SYNC_SYNCGO);
+
+ if (ret < 0)
+ dev_err(sdw->cdns.dev, "SyncGO clear failed: %d\n", ret);
+
+ return ret;
+}
+
+static int intel_shim_sync_go(struct sdw_intel *sdw)
+{
+ int ret;
+
+ mutex_lock(sdw->link_res->shim_lock);
+
+ ret = intel_shim_sync_go_unlocked(sdw);
+
+ mutex_unlock(sdw->link_res->shim_lock);
+
+ return ret;
+}
+
/*
* PDI routines
*/
@@ -775,15 +813,8 @@ static int intel_post_bank_switch(struct sdw_bus *bus)
ret = 0;
goto unlock;
}
- /*
- * Set SyncGO bit to synchronously trigger a bank switch for
- * all the masters. A write to SYNCGO bit clears CMDSYNC bit for all
- * the Masters.
- */
- sync_reg |= SDW_SHIM_SYNC_SYNCGO;
- ret = intel_clear_bit(shim, SDW_SHIM_SYNC, sync_reg,
- SDW_SHIM_SYNC_SYNCGO);
+ ret = intel_shim_sync_go_unlocked(sdw);
unlock:
mutex_unlock(sdw->link_res->shim_lock);
--
2.20.1
prev parent reply other threads:[~2020-03-11 22:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 22:10 [PATCH 0/7] SoundWire: intel: fix SHIM programming sequences Pierre-Louis Bossart
2020-03-11 22:10 ` [PATCH 1/7] soundwire: intel: add helpers for link power down and shim wake Pierre-Louis Bossart
2020-03-11 22:10 ` [PATCH 2/7] soundwire: intel: reuse code for wait loops to set/clear bits Pierre-Louis Bossart
2020-03-20 13:38 ` Vinod Koul
2020-03-11 22:10 ` [PATCH 3/7] soundwire: intel: add mutex to prevent concurrent access to SHIM registers Pierre-Louis Bossart
2020-03-20 13:41 ` Vinod Koul
2020-03-20 14:07 ` Pierre-Louis Bossart
2020-03-23 12:18 ` Vinod Koul
2020-03-11 22:10 ` [PATCH 4/7] soundwire: intel: add definitions for shim_mask Pierre-Louis Bossart
2020-03-20 13:42 ` Vinod Koul
2020-03-20 14:13 ` Pierre-Louis Bossart
2020-03-23 12:28 ` Vinod Koul
2020-03-11 22:10 ` [PATCH 5/7] soundwire: intel: follow documentation sequences for SHIM registers Pierre-Louis Bossart
2020-03-20 13:51 ` Vinod Koul
2020-03-20 14:20 ` Pierre-Louis Bossart
2020-03-23 12:31 ` Vinod Koul
2020-03-11 22:10 ` [PATCH 6/7] soundwire: intel: introduce a helper to arm link synchronization Pierre-Louis Bossart
2020-03-11 22:10 ` Pierre-Louis Bossart [this message]
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=20200311221026.18174-8-pierre-louis.bossart@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hui.wang@canonical.com \
--cc=jank@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rander.wang@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=slawomir.blauciak@intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.de \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.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).