SoC: swr-mstr: Add support for device wakeup

Add support for soundwire device wakeup through bus driver.
These APIs will be used by slave driver through bus driver
to vote and unvote for master wakeup, when it requires
master for register access operations. Master will be
aware of the slave usage with the vote for device wakeup.

Change-Id: I24f0ec0344f05926dc866edb04294cb31348e1ce
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
This commit is contained in:
Sudheer Papothi
2018-09-05 05:57:04 +05:30
committed by Gerrit - the friendly Code Review server
parent 1b9932e154
commit 6abd2debae

View File

@@ -1535,6 +1535,32 @@ static int swrm_get_logical_dev_num(struct swr_master *mstr, u64 dev_id,
pm_runtime_put_autosuspend(swrm->dev); pm_runtime_put_autosuspend(swrm->dev);
return ret; return ret;
} }
static void swrm_device_wakeup_vote(struct swr_master *mstr)
{
struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(mstr);
if (!swrm) {
pr_err("%s: Invalid handle to swr controller\n",
__func__);
return;
}
pm_runtime_get_sync(swrm->dev);
}
static void swrm_device_wakeup_unvote(struct swr_master *mstr)
{
struct swr_mstr_ctrl *swrm = swr_get_ctrl_data(mstr);
if (!swrm) {
pr_err("%s: Invalid handle to swr controller\n",
__func__);
return;
}
pm_runtime_mark_last_busy(swrm->dev);
pm_runtime_put_autosuspend(swrm->dev);
}
static int swrm_master_init(struct swr_mstr_ctrl *swrm) static int swrm_master_init(struct swr_mstr_ctrl *swrm)
{ {
int ret = 0; int ret = 0;
@@ -1777,6 +1803,8 @@ static int swrm_probe(struct platform_device *pdev)
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.remove_from_group = swrm_remove_from_group;
swrm->master.device_wakeup_vote = swrm_device_wakeup_vote;
swrm->master.device_wakeup_unvote = swrm_device_wakeup_unvote;
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;