Merge "soc: swr-mstr: Ignore redundant slave path control command"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

melakukan
b112aeeb50
@@ -19,6 +19,7 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
|
#include <linux/bitops.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
@@ -58,6 +59,11 @@ enum {
|
|||||||
MASTER_ID_RX,
|
MASTER_ID_RX,
|
||||||
MASTER_ID_TX
|
MASTER_ID_TX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ENABLE_PENDING,
|
||||||
|
DISABLE_PENDING
|
||||||
|
};
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
@@ -958,18 +964,28 @@ static int swrm_slvdev_datapath_control(struct swr_master *master, bool enable)
|
|||||||
bank = get_inactive_bank_num(swrm);
|
bank = get_inactive_bank_num(swrm);
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
if (!test_bit(ENABLE_PENDING, &swrm->port_req_pending)) {
|
||||||
|
dev_dbg(swrm->dev, "%s:No pending connect port req\n",
|
||||||
|
__func__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
clear_bit(ENABLE_PENDING, &swrm->port_req_pending);
|
||||||
ret = swrm_get_port_config(swrm);
|
ret = swrm_get_port_config(swrm);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
/* cannot accommodate ports */
|
/* cannot accommodate ports */
|
||||||
swrm_cleanup_disabled_port_reqs(master);
|
swrm_cleanup_disabled_port_reqs(master);
|
||||||
pm_runtime_mark_last_busy(swrm->dev);
|
|
||||||
pm_runtime_put_autosuspend(swrm->dev);
|
|
||||||
mutex_unlock(&swrm->mlock);
|
mutex_unlock(&swrm->mlock);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/* apply the new port config*/
|
/* apply the new port config*/
|
||||||
swrm_apply_port_config(master);
|
swrm_apply_port_config(master);
|
||||||
} else {
|
} else {
|
||||||
|
if (!test_bit(DISABLE_PENDING, &swrm->port_req_pending)) {
|
||||||
|
dev_dbg(swrm->dev, "%s:No pending disconn port req\n",
|
||||||
|
__func__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
clear_bit(DISABLE_PENDING, &swrm->port_req_pending);
|
||||||
swrm_disable_ports(master, bank);
|
swrm_disable_ports(master, bank);
|
||||||
}
|
}
|
||||||
dev_dbg(swrm->dev, "%s: enable: %d, cfg_devs: %d\n",
|
dev_dbg(swrm->dev, "%s: enable: %d, cfg_devs: %d\n",
|
||||||
@@ -1022,6 +1038,7 @@ static int swrm_slvdev_datapath_control(struct swr_master *master, bool enable)
|
|||||||
pm_runtime_mark_last_busy(swrm->dev);
|
pm_runtime_mark_last_busy(swrm->dev);
|
||||||
pm_runtime_put_autosuspend(swrm->dev);
|
pm_runtime_put_autosuspend(swrm->dev);
|
||||||
}
|
}
|
||||||
|
exit:
|
||||||
mutex_unlock(&swrm->mlock);
|
mutex_unlock(&swrm->mlock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1098,6 +1115,7 @@ static int swrm_connect_port(struct swr_master *master,
|
|||||||
master->port_en_mask |= (1 << mstr_port_id);
|
master->port_en_mask |= (1 << mstr_port_id);
|
||||||
}
|
}
|
||||||
master->num_port += portinfo->num_port;
|
master->num_port += portinfo->num_port;
|
||||||
|
set_bit(ENABLE_PENDING, &swrm->port_req_pending);
|
||||||
swr_port_response(master, portinfo->tid);
|
swr_port_response(master, portinfo->tid);
|
||||||
|
|
||||||
mutex_unlock(&swrm->mlock);
|
mutex_unlock(&swrm->mlock);
|
||||||
@@ -1158,6 +1176,7 @@ static int swrm_disconnect_port(struct swr_master *master,
|
|||||||
mport->req_ch &= ~mstr_ch_mask;
|
mport->req_ch &= ~mstr_ch_mask;
|
||||||
}
|
}
|
||||||
master->num_port -= portinfo->num_port;
|
master->num_port -= portinfo->num_port;
|
||||||
|
set_bit(DISABLE_PENDING, &swrm->port_req_pending);
|
||||||
swr_port_response(master, portinfo->tid);
|
swr_port_response(master, portinfo->tid);
|
||||||
mutex_unlock(&swrm->mlock);
|
mutex_unlock(&swrm->mlock);
|
||||||
|
|
||||||
|
@@ -135,6 +135,7 @@ struct swr_mstr_ctrl {
|
|||||||
int slave_status;
|
int slave_status;
|
||||||
struct swrm_mports mport_cfg[SWR_MAX_MSTR_PORT_NUM];
|
struct swrm_mports mport_cfg[SWR_MAX_MSTR_PORT_NUM];
|
||||||
struct list_head port_req_list;
|
struct list_head port_req_list;
|
||||||
|
unsigned long port_req_pending;
|
||||||
int state;
|
int state;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
int num_rx_chs;
|
int num_rx_chs;
|
||||||
|
Reference in New Issue
Block a user