Merge "icnss: Add support for suspend/resume"
This commit is contained in:
commit
da3d93c35c
1 changed files with 54 additions and 0 deletions
|
@ -133,6 +133,7 @@ enum icnss_driver_state {
|
|||
ICNSS_FW_READY,
|
||||
ICNSS_DRIVER_PROBED,
|
||||
ICNSS_FW_TEST_MODE,
|
||||
ICNSS_SUSPEND,
|
||||
};
|
||||
|
||||
struct ce_irq_list {
|
||||
|
@ -2002,6 +2003,9 @@ static int icnss_stats_show_state(struct seq_file *s, struct icnss_data *priv)
|
|||
case ICNSS_FW_TEST_MODE:
|
||||
seq_puts(s, "FW TEST MODE");
|
||||
continue;
|
||||
case ICNSS_SUSPEND:
|
||||
seq_puts(s, "DRIVER SUSPENDED");
|
||||
continue;
|
||||
}
|
||||
|
||||
seq_printf(s, "UNKNOWN-%d", i);
|
||||
|
@ -2362,6 +2366,54 @@ static int icnss_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int icnss_suspend(struct platform_device *pdev,
|
||||
pm_message_t state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!penv) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
icnss_pr_dbg("Driver suspending, state: 0x%lx\n",
|
||||
penv->state);
|
||||
|
||||
if (!penv->ops)
|
||||
goto out;
|
||||
|
||||
if (penv->ops->suspend)
|
||||
ret = penv->ops->suspend(&pdev->dev, state);
|
||||
|
||||
out:
|
||||
if (ret == 0)
|
||||
set_bit(ICNSS_SUSPEND, &penv->state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int icnss_resume(struct platform_device *pdev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!penv) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
icnss_pr_dbg("Driver resuming, state: 0x%lx\n",
|
||||
penv->state);
|
||||
|
||||
if (!penv->ops)
|
||||
goto out;
|
||||
|
||||
if (penv->ops->resume)
|
||||
ret = penv->ops->resume(&pdev->dev);
|
||||
|
||||
out:
|
||||
if (ret == 0)
|
||||
clear_bit(ICNSS_SUSPEND, &penv->state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id icnss_dt_match[] = {
|
||||
{.compatible = "qcom,icnss"},
|
||||
|
@ -2373,6 +2425,8 @@ MODULE_DEVICE_TABLE(of, icnss_dt_match);
|
|||
static struct platform_driver icnss_driver = {
|
||||
.probe = icnss_probe,
|
||||
.remove = icnss_remove,
|
||||
.suspend = icnss_suspend,
|
||||
.resume = icnss_resume,
|
||||
.driver = {
|
||||
.name = "icnss",
|
||||
.owner = THIS_MODULE,
|
||||
|
|
Loading…
Add table
Reference in a new issue