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

Commit 5936ba71 authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

soc: swr-mstr: Resolve swr overflow, underflow errors for wsa



SWR overflow, underflow interrupts are seen sometimes on bootup.
Check whether devnum is 0 during fifo read and write. Also assign
read and write fifo depth before master init to resolve errors.

Change-Id: Id7b687985e320396d2f9dab69db56cc7f5426b04
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent 1f152bcd
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -887,6 +887,11 @@ static int swrm_cmd_fifo_rd_cmd(struct swr_mstr_ctrl *swrm, int *cmd_data,
	u32 val;
	u32 retry_attempt = 0;

	if (!dev_addr) {
		dev_err(swrm->dev, "%s: invalid slave dev num\n", __func__);
		return -EINVAL;
	}

	mutex_lock(&swrm->iolock);
	val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
	if (swrm->read) {
@@ -942,6 +947,11 @@ static int swrm_cmd_fifo_wr_cmd(struct swr_mstr_ctrl *swrm, u8 cmd_data,
	u32 val;
	int ret = 0;

	if (!dev_addr) {
		dev_err(swrm->dev, "%s: invalid slave dev num\n", __func__);
		return -EINVAL;
	}

	mutex_lock(&swrm->iolock);
	if (!cmd_id)
		val = swrm_get_packed_reg_val(&swrm->wcmd_id, cmd_data,
@@ -2883,6 +2893,10 @@ static int swrm_probe(struct platform_device *pdev)
	mutex_lock(&swrm->mlock);
	swrm_clk_request(swrm, true);
	swrm->version = swr_master_read(swrm, SWRM_COMP_HW_VERSION);
	swrm->rd_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
				& SWRM_COMP_PARAMS_RD_FIFO_DEPTH) >> 15);
	swrm->wr_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
				& SWRM_COMP_PARAMS_WR_FIFO_DEPTH) >> 10);
	ret = swrm_master_init(swrm);
	if (ret < 0) {
		dev_err(&pdev->dev,
@@ -2899,11 +2913,6 @@ static int swrm_probe(struct platform_device *pdev)
	if (pdev->dev.of_node)
		of_register_swr_devices(&swrm->master);

	swrm->rd_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
				& SWRM_COMP_PARAMS_RD_FIFO_DEPTH) >> 15);
	swrm->wr_fifo_depth = ((swr_master_read(swrm, SWRM_COMP_PARAMS)
				& SWRM_COMP_PARAMS_WR_FIFO_DEPTH) >> 10);

#ifdef CONFIG_DEBUG_FS
	swrm->debugfs_swrm_dent = debugfs_create_dir(dev_name(&pdev->dev), 0);
	if (!IS_ERR(swrm->debugfs_swrm_dent)) {