summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudheer Papothi <spapothi@codeaurora.org>2015-12-11 02:42:59 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:15:09 -0700
commitb12c7d2cd1fde2aa9da2a8eb6bdb4f333503fd30 (patch)
tree6cc99c07d10bb5d23afe908d1b75cb56b9e6dc6b
parentd9a1729d78d90e40b0915de8fb2eb463a9d9aff4 (diff)
soundwire: Add slave synchronization configuration
Slave synchronization is needed to sync frame shape consisting of different ports with different sample rates. Change sets the slave synchronization based on the frame shape. Change-Id: Iae726555b3c158394662c590d1ebc781ff7f54f5 Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
-rw-r--r--drivers/soundwire/swr-wcd-ctrl.c17
-rwxr-xr-xdrivers/soundwire/swrm_registers.h6
2 files changed, 16 insertions, 7 deletions
diff --git a/drivers/soundwire/swr-wcd-ctrl.c b/drivers/soundwire/swr-wcd-ctrl.c
index 3a43585f707e..7c5ded243fff 100644
--- a/drivers/soundwire/swr-wcd-ctrl.c
+++ b/drivers/soundwire/swr-wcd-ctrl.c
@@ -616,7 +616,8 @@ static void swrm_apply_port_config(struct swr_master *master)
int len = 0;
int mask = (SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK |
- SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK);
+ SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK |
+ SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK);
if (!swrm) {
pr_err("%s: Invalid handle to swr controller\n",
@@ -632,7 +633,8 @@ static void swrm_apply_port_config(struct swr_master *master)
value = swrm->read(swrm->handle, SWRM_MCP_FRAME_CTRL_BANK_ADDR(bank));
value &= (~mask);
value |= ((0 << SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_SHFT) |
- (7 << SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_SHFT));
+ (7 << SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_SHFT) |
+ (0 << SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_SHFT));
swrm->write(swrm->handle, SWRM_MCP_FRAME_CTRL_BANK_ADDR(bank), value);
dev_dbg(swrm->dev, "%s: regaddr: 0x%x, value: 0x%x\n", __func__,
SWRM_MCP_FRAME_CTRL_BANK_ADDR(bank), value);
@@ -1049,6 +1051,7 @@ static int swrm_master_init(struct swr_mstr_ctrl *swrm)
u32 val;
u8 row_ctrl = SWR_MAX_ROW;
u8 col_ctrl = SWR_MIN_COL;
+ u8 ssp_period = 1;
u8 retry_cmd_num = 3;
u32 reg[SWRM_MAX_INIT_REG];
u32 value[SWRM_MAX_INIT_REG];
@@ -1056,7 +1059,8 @@ static int swrm_master_init(struct swr_mstr_ctrl *swrm)
/* Clear Rows and Cols */
val = ((row_ctrl << SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_SHFT) |
- (col_ctrl << SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_SHFT));
+ (col_ctrl << SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_SHFT) |
+ (ssp_period << SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_SHFT));
reg[len] = SWRM_MCP_FRAME_CTRL_BANK_ADDR(0);
value[len++] = val;
@@ -1085,11 +1089,12 @@ static int swrm_master_init(struct swr_mstr_ctrl *swrm)
reg[len] = SWRM_COMP_CFG_ADDR;
value[len++] = 0x02;
- reg[len] = SWRM_MCP_BUS_CTRL_ADDR;
- value[len++] = 0x02;
-
reg[len] = SWRM_COMP_CFG_ADDR;
value[len++] = 0x03;
+
+ reg[len] = SWRM_INTERRUPT_CLEAR;
+ value[len++] = 0x08;
+
swrm->bulk_write(swrm->handle, reg, value, len);
return ret;
diff --git a/drivers/soundwire/swrm_registers.h b/drivers/soundwire/swrm_registers.h
index cbcb47603b6b..c6923f301f9f 100755
--- a/drivers/soundwire/swrm_registers.h
+++ b/drivers/soundwire/swrm_registers.h
@@ -136,8 +136,12 @@
#define SWRM_ENUMERATOR_SLAVE_DEV_ID_2(m) (SWRM_BASE_ADDRESS+0x534+0x8*m)
#define SWRM_MCP_FRAME_CTRL_BANK_ADDR(m) (SWRM_BASE_ADDRESS+0x101C+0x40*m)
-#define SWRM_MCP_FRAME_CTRL_BANK_RMSK 0x000007ff
+#define SWRM_MCP_FRAME_CTRL_BANK_RMSK 0x00ff07ff
#define SWRM_MCP_FRAME_CTRL_BANK_SHFT 0
+#define SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK 0xff0000
+#define SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_SHFT 16
+#define SWRM_MCP_FRAME_CTRL_BANK_PHASE_BMSK 0xf800
+#define SWRM_MCP_FRAME_CTRL_BANK_PHASE_SHFT 11
#define SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_VALUE_BMSK 0x700
#define SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_VALUE_SHFT 8
#define SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK 0xF8