Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bebf978 authored by Sudheer Papothi's avatar Sudheer Papothi Committed by Gerrit - the friendly Code Review server
Browse files

soundwire: Disable ports in both banks after playback usecase



Soundwire hardware has two banks for configuring soundwire
slave ports. After playback is stopped, disable soundwire slave
ports in both banks to avoid any port collisions during the start
of next playback on other slave device.

Change-Id: I5cfd1d985a1ca5fd7b4020d7e14697642f207501
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent c2752cc0
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -779,11 +779,14 @@ static int swrm_disconnect_port(struct swr_master *master,
	struct swr_port_info *port;
	struct swrm_mports *mport;
	struct list_head *ptr, *next;
	u8 bank;
	u8 bank, active_bank;
	int ret = 0;
	u8 mport_id = 0;
	int port_type = 0;
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(master);
	u32 reg[SWRM_MAX_PORT_REG];
	u32 val[SWRM_MAX_PORT_REG];
	int len = 0;

	if (!swrm) {
		dev_err(&master->dev,
@@ -798,6 +801,7 @@ static int swrm_disconnect_port(struct swr_master *master,
	}
	mutex_lock(&swrm->mlock);
	bank = get_inactive_bank_num(swrm);
	active_bank = bank ? 0 : 1;
	for (i = 0; i < portinfo->num_port; i++) {
		ret = swrm_get_master_port(&mport_id,
						portinfo->port_id[i]);
@@ -824,6 +828,12 @@ static int swrm_disconnect_port(struct swr_master *master,
			    0);
		swrm_cmd_fifo_wr_cmd(swrm, 0x00, port->dev_id, 0x00,
				SWRS_DP_CHANNEL_ENABLE_BANK(port_type, bank));
		reg[len] = SWRM_DP_PORT_CTRL_BANK((mport_id+1), active_bank);
		val[len++] = 0;
		reg[len] = SWRM_CMD_FIFO_WR_CMD;
		val[len++] = SWR_REG_VAL_PACK(0x00, port->dev_id, 0x00,
				SWRS_DP_CHANNEL_ENABLE_BANK(port_type,
							    active_bank));
		list_for_each_safe(ptr, next, &swrm->mport_list) {
			mport = list_entry(ptr, struct swrm_mports, list);
			if (mport->id == mport_id) {
@@ -833,6 +843,7 @@ static int swrm_disconnect_port(struct swr_master *master,
		}
	}
	enable_bank_switch(swrm, bank, SWR_MAX_ROW, SWR_MAX_COL);
	swrm->bulk_write(swrm->handle, reg, val, len);
	if (master->num_port >= SWR_MSTR_PORT_LEN)
		master->num_port = SWR_MSTR_PORT_LEN;