Commit 02629e45 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: intel: introduce a helper to arm link synchronization

Move code from pre_bank_switch to dedicated helper, will be used in
follow-up patches as recommended by programming flows.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20200716150947.22119-4-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 4a17c441
...@@ -497,6 +497,21 @@ static int __maybe_unused intel_link_power_down(struct sdw_intel *sdw) ...@@ -497,6 +497,21 @@ static int __maybe_unused intel_link_power_down(struct sdw_intel *sdw)
return 0; return 0;
} }
static void intel_shim_sync_arm(struct sdw_intel *sdw)
{
void __iomem *shim = sdw->link_res->shim;
u32 sync_reg;
mutex_lock(sdw->link_res->shim_lock);
/* update SYNC register */
sync_reg = intel_readl(shim, SDW_SHIM_SYNC);
sync_reg |= (SDW_SHIM_SYNC_CMDSYNC << sdw->instance);
intel_writel(shim, SDW_SHIM_SYNC, sync_reg);
mutex_unlock(sdw->link_res->shim_lock);
}
/* /*
* PDI routines * PDI routines
*/ */
...@@ -710,21 +725,12 @@ static int intel_pre_bank_switch(struct sdw_bus *bus) ...@@ -710,21 +725,12 @@ static int intel_pre_bank_switch(struct sdw_bus *bus)
{ {
struct sdw_cdns *cdns = bus_to_cdns(bus); struct sdw_cdns *cdns = bus_to_cdns(bus);
struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_intel *sdw = cdns_to_intel(cdns);
void __iomem *shim = sdw->link_res->shim;
int sync_reg;
/* Write to register only for multi-link */ /* Write to register only for multi-link */
if (!bus->multi_link) if (!bus->multi_link)
return 0; return 0;
mutex_lock(sdw->link_res->shim_lock); intel_shim_sync_arm(sdw);
/* Read SYNC register */
sync_reg = intel_readl(shim, SDW_SHIM_SYNC);
sync_reg |= SDW_SHIM_SYNC_CMDSYNC << sdw->instance;
intel_writel(shim, SDW_SHIM_SYNC, sync_reg);
mutex_unlock(sdw->link_res->shim_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment