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

Commit 88318ed5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 6de6dc28 5936ba71
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -891,6 +891,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) {
@@ -946,6 +951,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,
@@ -2868,6 +2878,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,
@@ -2884,11 +2898,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)) {