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

This commit is contained in:
qctecmdr 2020-10-25 07:34:22 -07:00 • committed by Gerrit - the friendly Code Review server
commit 88318ed5e8

View file

@ -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)) {