rpmsg: glink: Make wakeup timeout configurable

The Glink helioscom driver can guarantee that the packet gets queued
to the glinkpkt driver but cannot guarantee the client process will
get time to run if auto sleep is enabled. This config will help
mitigate missed packets on systems where auto sleep is too aggressive.
Use the pm_wakeup_ws_event() api so a hard wakeup can be specified.
This will ensure a resume occurs if the data coming in happens while
the device is going into suspend.

Change-Id: I774f7e402d6daad9d6625d9e1659a994a9dd7f0c
Signed-off-by: Kishore Kumar Ravi <quic_kiskum@quicinc.com>
This commit is contained in:
Kishore Kumar Ravi 2022-07-13 11:53:54 +05:30 committed by Gerrit - the friendly Code Review server
parent f113d0205d
commit 362b8b1bdb
2 changed files with 17 additions and 0 deletions

View File

@ -85,6 +85,17 @@ config RPMSG_VIRTIO
select RPMSG
select VIRTIO
config RPMSG_GLINK_HELIOSCOM_WAKEUP_MS
int "GLINK Helioscom Wakeup timeout"
default 0
help
This option is used to configure the wakesource timeout that GLINK
helioscom should take when a packet is received. The glink driver can
guarantee that the packet gets queued to glinkpkt driver but cannot
guarantee the client process will get time to run if auto sleep is
enabled. This config will help mitigate missed packets on systems
where auto sleep is aggressive.
config MSM_RPM_SMD
tristate "RPM driver using SMD protocol"
help

View File

@ -31,6 +31,7 @@
#include <linux/component.h>
#include <linux/ipc_logging.h>
#include <linux/termios.h>
#include <linux/pm_wakeup.h>
#include <linux/unistd.h>
#include "../soc/qcom/helioscom.h"
@ -189,6 +190,7 @@ struct glink_helioscom {
atomic_t activity_cnt;
atomic_t in_reset;
struct wakeup_source *ws;
void *ilc;
bool sent_read_notify;
@ -272,6 +274,8 @@ struct rx_pkt {
struct glink_helioscom_channel, ept)
static const struct rpmsg_endpoint_ops glink_endpoint_ops;
static unsigned int glink_helioscom_wakeup_ms =
CONFIG_RPMSG_GLINK_HELIOSCOM_WAKEUP_MS;
#define HELIOSCOM_CMD_VERSION 0
#define HELIOSCOM_CMD_VERSION_ACK 1
@ -2163,6 +2167,7 @@ static void glink_helioscom_event_handler(void *handle,
rx_pkt_info->rx_len = data->fifo_data.to_master_fifo_used;
rx_pkt_info->glink = glink;
kthread_init_work(&rx_pkt_info->kwork, rx_worker);
pm_wakeup_ws_event(glink->ws, glink_helioscom_wakeup_ms, true);
kthread_queue_work(&glink->kworker, &rx_pkt_info->kwork);
break;
case HELIOSCOM_EVENT_TO_SLAVE_FIFO_FREE:
@ -2290,6 +2295,7 @@ int glink_helioscom_probe(struct platform_device *pdev)
goto err_put_dev;
}
glink->ws = wakeup_source_register(NULL, "glink_helioscom_ws");
glink->ilc = ipc_log_context_create(GLINK_LOG_PAGE_CNT, glink->name, 0);
glink->helioscom_config.priv = (void *)glink;