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

Commit b0f27cd9 authored by Laxminath Kasam's avatar Laxminath Kasam
Browse files

soc: swr-mstr: add changes to support native playback



For MCLK frequency switching to 11.2896 for native
playback support, frameshape also needs to be changed
accordingly. Add changes to support frameshape switch
based on mclk frequency for given master.

Change-Id: I0c4dd69b743f83b45eeed73f27ad10e878b9244b
Signed-off-by: default avatarLaxminath Kasam <lkasam@codeaurora.org>
parent 93ce3def
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ enum {
	SWR_DEVICE_UP,
	SWR_SUBSYS_RESTART,
	SWR_SET_NUM_RX_CH,
	SWR_CLK_FREQ,
};

struct swr_mstr_port {
@@ -30,6 +31,9 @@ struct swr_mstr_port {
	u8 *port;
};

#define MCLK_FREQ		9600000
#define MCLK_FREQ_NATIVE	11289600

#if (IS_ENABLED(CONFIG_SOUNDWIRE_WCD_CTRL) || \
	IS_ENABLED(CONFIG_SOUNDWIRE_MSTR_CTRL))
extern int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data);
+20 −1
Original line number Diff line number Diff line
@@ -956,7 +956,15 @@ static int swrm_slvdev_datapath_control(struct swr_master *master, bool enable)
			n_col = SWR_MAX_COL;
	}
	/* Use default 50 * x, frame shape. Change based on mclk */
	if (swrm->mclk_freq == MCLK_FREQ_NATIVE) {
		dev_dbg(swrm->dev, "setting 64 x %d frameshape\n",
			n_col ? 16 : 2);
		n_row = SWR_ROW_64;
	} else {
		dev_dbg(swrm->dev, "setting 50 x %d frameshape\n",
			n_col ? 16 : 2);
		n_row = SWR_ROW_50;
	}
	value = swr_master_read(swrm, SWRM_MCP_FRAME_CTRL_BANK_ADDR(bank));
	value &= (~mask);
	value |= ((n_row << SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_SHFT) |
@@ -1630,6 +1638,7 @@ static int swrm_probe(struct platform_device *pdev)
	swrm->slave_status = 0;
	swrm->num_rx_chs = 0;
	swrm->clk_ref_count = 0;
	swrm->mclk_freq = MCLK_FREQ;
	swrm->state = SWR_MSTR_RESUME;
	init_completion(&swrm->reset);
	init_completion(&swrm->broadcast);
@@ -1940,6 +1949,16 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
	mstr = &swrm->master;

	switch (id) {
	case SWR_CLK_FREQ:
		if (!data) {
			dev_err(swrm->dev, "%s: data is NULL\n", __func__);
			ret = -EINVAL;
		} else {
			mutex_lock(&swrm->mlock);
			swrm->mclk_freq = *(int *)data;
			mutex_unlock(&swrm->mlock);
		}
		break;
	case SWR_DEVICE_DOWN:
		dev_dbg(swrm->dev, "%s: swr master down called\n", __func__);
		mutex_lock(&swrm->mlock);
+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ struct swr_mstr_ctrl {
			void *data), void *swr_handle, int type);
	int irq;
	int version;
	int mclk_freq;
	u32 num_dev;
	int slave_status;
	struct swrm_mports mport_cfg[SWR_MAX_MSTR_PORT_NUM];