swr-wcd-ctrl: Handle soundwire slave device ungroup
Handle soundwire slave devices ungroup in master controller. Set the group device id to 0 when soundwire slave devices request ungroup for independent control. CRs-fixed: 1007465 Change-Id: I4f1b39dac949aa3f6aa3abb12ff0310fb0e98d1c Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
This commit is contained in:
parent
ae4cedcf33
commit
a8f8e620e7
1 changed files with 29 additions and 4 deletions
|
@ -601,6 +601,31 @@ static struct swr_port_info *swrm_get_port(struct swr_master *master,
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool swrm_remove_from_group(struct swr_master *master)
|
||||||
|
{
|
||||||
|
struct swr_device *swr_dev;
|
||||||
|
struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(master);
|
||||||
|
bool is_removed = false;
|
||||||
|
|
||||||
|
if (!swrm)
|
||||||
|
goto end;
|
||||||
|
|
||||||
|
mutex_lock(&swrm->mlock);
|
||||||
|
if ((swrm->num_rx_chs > 1) &&
|
||||||
|
(swrm->num_rx_chs == swrm->num_cfg_devs)) {
|
||||||
|
list_for_each_entry(swr_dev, &master->devices,
|
||||||
|
dev_list) {
|
||||||
|
swr_dev->group_id = SWR_GROUP_NONE;
|
||||||
|
master->gr_sid = 0;
|
||||||
|
}
|
||||||
|
is_removed = true;
|
||||||
|
}
|
||||||
|
mutex_unlock(&swrm->mlock);
|
||||||
|
|
||||||
|
end:
|
||||||
|
return is_removed;
|
||||||
|
}
|
||||||
|
|
||||||
static void swrm_slvdev_datapath_control(struct swr_master *master,
|
static void swrm_slvdev_datapath_control(struct swr_master *master,
|
||||||
bool enable)
|
bool enable)
|
||||||
{
|
{
|
||||||
|
@ -805,8 +830,8 @@ static int swrm_connect_port(struct swr_master *master,
|
||||||
|
|
||||||
swrm_get_port_config(master);
|
swrm_get_port_config(master);
|
||||||
swr_port_response(master, portinfo->tid);
|
swr_port_response(master, portinfo->tid);
|
||||||
if (swrm->num_rx_chs > 1) {
|
|
||||||
swrm->num_cfg_devs += 1;
|
swrm->num_cfg_devs += 1;
|
||||||
|
if (swrm->num_rx_chs > 1) {
|
||||||
if (swrm->num_rx_chs == swrm->num_cfg_devs)
|
if (swrm->num_rx_chs == swrm->num_cfg_devs)
|
||||||
swrm_apply_port_config(master);
|
swrm_apply_port_config(master);
|
||||||
} else {
|
} else {
|
||||||
|
@ -899,7 +924,6 @@ static int swrm_disconnect_port(struct swr_master *master,
|
||||||
|
|
||||||
master->num_port -= portinfo->num_port;
|
master->num_port -= portinfo->num_port;
|
||||||
swr_port_response(master, portinfo->tid);
|
swr_port_response(master, portinfo->tid);
|
||||||
if (swrm->num_rx_chs > 1)
|
|
||||||
swrm->num_cfg_devs -= 1;
|
swrm->num_cfg_devs -= 1;
|
||||||
mutex_unlock(&swrm->mlock);
|
mutex_unlock(&swrm->mlock);
|
||||||
|
|
||||||
|
@ -1218,6 +1242,7 @@ static int swrm_probe(struct platform_device *pdev)
|
||||||
swrm->master.connect_port = swrm_connect_port;
|
swrm->master.connect_port = swrm_connect_port;
|
||||||
swrm->master.disconnect_port = swrm_disconnect_port;
|
swrm->master.disconnect_port = swrm_disconnect_port;
|
||||||
swrm->master.slvdev_datapath_control = swrm_slvdev_datapath_control;
|
swrm->master.slvdev_datapath_control = swrm_slvdev_datapath_control;
|
||||||
|
swrm->master.remove_from_group = swrm_remove_from_group;
|
||||||
swrm->master.dev.parent = &pdev->dev;
|
swrm->master.dev.parent = &pdev->dev;
|
||||||
swrm->master.dev.of_node = pdev->dev.of_node;
|
swrm->master.dev.of_node = pdev->dev.of_node;
|
||||||
swrm->master.num_port = 0;
|
swrm->master.num_port = 0;
|
||||||
|
@ -1524,7 +1549,7 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data)
|
||||||
} else {
|
} else {
|
||||||
mutex_lock(&swrm->mlock);
|
mutex_lock(&swrm->mlock);
|
||||||
swrm->num_rx_chs = *(int *)data;
|
swrm->num_rx_chs = *(int *)data;
|
||||||
if (swrm->num_rx_chs > 1) {
|
if ((swrm->num_rx_chs > 1) && !swrm->num_cfg_devs) {
|
||||||
list_for_each_entry(swr_dev, &mstr->devices,
|
list_for_each_entry(swr_dev, &mstr->devices,
|
||||||
dev_list) {
|
dev_list) {
|
||||||
ret = swr_set_device_group(swr_dev,
|
ret = swr_set_device_group(swr_dev,
|
||||||
|
|
Loading…
Add table
Reference in a new issue