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

Commit a138d975 authored by Sudheer Papothi's avatar Sudheer Papothi
Browse files

soundwire: Remove hardcoding of soundwire slave devices



Remove hardcoding of soundwire slave devices and get
the soundwire slave devices count during registering of
the devices.

Change-Id: I933bdbd3cbd4dc004c6a291df68418005bf4357a
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent 84099f52
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ int of_register_swr_devices(struct swr_master *master)
			of_node_put(node);
			continue;
		}
		master->num_dev++;
	}
	return 0;
}
+3 −5
Original line number Diff line number Diff line
@@ -36,8 +36,6 @@ static u8 mstr_port_type[] = {SWR_DAC_PORT, SWR_COMP_PORT, SWR_BOOST_PORT,
			      SWR_DAC_PORT, SWR_COMP_PORT, SWR_BOOST_PORT,
			      SWR_VISENSE_PORT, SWR_VISENSE_PORT};

#define SWR_NUM_SLV_DEVICES		3 /* This includes dev_num_0 */

struct usecase uc[] = {
	{0, 0, 0},		/* UC0: no ports */
	{1, 1, 2400},		/* UC1: Spkr */
@@ -580,7 +578,7 @@ static void swrm_apply_port_config(struct swr_master *master)
		if (!port)
			continue;
		port_type = mstr_port_type[mport->id];
		if (!port->dev_id || (port->dev_id >= SWR_NUM_SLV_DEVICES)) {
		if (!port->dev_id || (port->dev_id > master->num_dev)) {
			dev_dbg(swrm->dev, "%s: invalid device id = %d\n",
				__func__, port->dev_id);
			continue;
@@ -762,7 +760,7 @@ static int swrm_check_slave_change_status(struct swr_mstr_ctrl *swrm,
	int ret = SWR_NOT_PRESENT;

	if (status != swrm->slave_status) {
		for (i = 0; i < SWR_NUM_SLV_DEVICES; i++) {
		for (i = 0; i < (swrm->master.num_dev + 1); i++) {
			if ((status & SWRM_MCP_SLV_STATUS_MASK) !=
			    (swrm->slave_status & SWRM_MCP_SLV_STATUS_MASK)) {
				ret = (status & SWRM_MCP_SLV_STATUS_MASK);
@@ -897,7 +895,7 @@ static int swrm_get_logical_dev_num(struct swr_master *mstr, u64 dev_id,
	struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(mstr);

	pm_runtime_get_sync(&swrm->pdev->dev);
	for (i = 1; i < SWR_NUM_SLV_DEVICES; i++) {
	for (i = 1; i < (mstr->num_dev + 1); i++) {
		id = ((u64)(swrm->read(swrm->handle,
			    SWRM_ENUMERATOR_SLAVE_DEV_ID_2(i))) << 32);
		id |= swrm->read(swrm->handle,
+1 −0
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ struct swr_master {
	struct swr_reg **reg_txn;
	u8 last_tid;
	u8 num_port;
	u8 num_dev;
	int (*connect_port)(struct swr_master *mstr, struct swr_params *txn);
	int (*disconnect_port)(struct swr_master *mstr, struct swr_params *txn);
	int (*read)(struct swr_master *mstr, u8 dev_num, u32 reg_addr,