Merge "rpmsg: glink: add dev_pm_ops for tracking no irq phase"

This commit is contained in:
qctecmdr 2021-03-19 05:14:34 -07:00 • committed by Gerrit - the friendly Code Review server
commit 556bb4dde8
3 changed files with 29 additions and 3 deletions

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016-2017, Linaro Ltd
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/idr.h>
@ -23,6 +23,7 @@
#include <linux/kthread.h>
#include <linux/mailbox_client.h>
#include <linux/ipc_logging.h>
#include <linux/suspend.h>
#include <soc/qcom/subsystem_notif.h>
#include "rpmsg_internal.h"
@ -54,6 +55,8 @@ do { \
#define RPM_GLINK_CID_MIN 1
#define RPM_GLINK_CID_MAX 65536
static int should_wake;
struct glink_msg {
__le16 cmd;
__le16 param1;
@ -1240,6 +1243,8 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data)
unsigned int cmd;
int ret = 0;
if (should_wake)
pm_system_wakeup();
/* To wakeup any blocking writers */
wake_up_all(&glink->tx_avail_notify);
@ -2114,14 +2119,13 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
irq = of_irq_get(dev->of_node, 0);
ret = devm_request_irq(dev, irq,
qcom_glink_native_intr,
IRQF_SHARED,
IRQF_NO_SUSPEND | IRQF_SHARED,
glink->irqname, glink);
if (ret) {
dev_err(dev, "failed to request IRQ\n");
goto unregister;
}
enable_irq_wake(irq);
glink->irq = irq;
size = of_property_count_u32_elems(dev->of_node, "cpu-affinity");
@ -2212,5 +2216,25 @@ void qcom_glink_native_unregister(struct qcom_glink *glink)
}
EXPORT_SYMBOL_GPL(qcom_glink_native_unregister);
static int qcom_glink_suspend_no_irq(struct device *dev)
{
should_wake = true;
return 0;
}
static int qcom_glink_resume_no_irq(struct device *dev)
{
should_wake = false;
return 0;
}
const struct dev_pm_ops glink_native_pm_ops = {
.suspend_noirq = qcom_glink_suspend_no_irq,
.resume_noirq = qcom_glink_resume_no_irq,
};
EXPORT_SYMBOL(glink_native_pm_ops);
MODULE_DESCRIPTION("Qualcomm GLINK driver");
MODULE_LICENSE("GPL v2");

View file

@ -27,6 +27,7 @@ struct qcom_glink_pipe {
};
struct qcom_glink;
extern const struct dev_pm_ops glink_native_pm_ops;
struct qcom_glink *qcom_glink_native_probe(struct device *dev,
unsigned long features,

View file

@ -331,6 +331,7 @@ static struct platform_driver glink_rpm_driver = {
.driver = {
.name = "qcom_glink_rpm",
.of_match_table = glink_rpm_of_match,
.pm = &glink_native_pm_ops,
},
};