rpmsg: glink: Add wakeup information

Add a function to query the glink core layer on whether a packet has
caused a wakeup. This function also takes a parameter to specify if the
wakeup state should be reset after reading the variable.

Add print to log the wakeup packet for glink interrupts. Some channels
such as IPCRTR will already reset the wakeup info state and print their
own messages. This print is meant to be a default print for all other
channels.

Change-Id: Iff7ff4e08d595c63f1c6924b77436b8edf261485
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
This commit is contained in:
Chris Lew 2021-11-29 14:34:31 -08:00
parent f6cbe27c1f
commit b7c0a63b43
2 changed files with 26 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#define RPM_GLINK_CID_MAX 65536
static int should_wake;
static int glink_resume_pkt;
struct glink_msg {
__le16 cmd;
@ -897,6 +898,18 @@ static int qcom_glink_rx_defer(struct qcom_glink *glink, size_t extra)
return 0;
}
bool qcom_glink_is_wakeup(bool reset)
{
if (!glink_resume_pkt)
return false;
if (reset)
glink_resume_pkt = false;
return true;
}
EXPORT_SYMBOL(qcom_glink_is_wakeup);
static int qcom_glink_rx_data(struct qcom_glink *glink, size_t avail)
{
struct glink_core_rx_intent *intent;
@ -999,6 +1012,12 @@ static int qcom_glink_rx_data(struct qcom_glink *glink, size_t avail)
}
spin_unlock(&channel->recv_lock);
if (qcom_glink_is_wakeup(true)) {
pr_info("%s[%d:%d] %s: wakeup packet size:%d\n",
channel->name, channel->lcid, channel->rcid,
__func__, intent->offset);
}
intent->offset = 0;
channel->buf = NULL;
@ -1105,6 +1124,7 @@ static irqreturn_t qcom_glink_native_intr(int irq, void *data)
if (should_wake) {
pr_info("%s: wakeup %s\n", __func__, glink->irqname);
glink_resume_pkt = true;
should_wake = false;
pm_system_wakeup();
}

View File

@ -19,6 +19,7 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent,
struct device_node *node);
void qcom_glink_smem_unregister(struct qcom_glink *glink);
int qcom_glink_smem_start(struct qcom_glink *glink);
bool qcom_glink_is_wakeup(bool reset);
void qcom_glink_early_ssr_notify(void *data);
#else
@ -38,6 +39,11 @@ int qcom_glink_smem_start(struct qcom_glink *glink)
{
return -ENXIO;
}
static inline bool qcom_glink_is_wakeup(bool reset)
{
return false;
}
#endif
#endif