From decf75e60bfdccc44f20a7354fafe0b66952a57c Mon Sep 17 00:00:00 2001 From: Lakshit Tyagi Date: Mon, 8 Feb 2021 11:47:18 +0530 Subject: [PATCH] net: aquantia: Adding wake locks Add wake locks to prevent A7 from going into suspend. Change-Id: I46384d957593a461fdd3b24830bd27b19cad3425 Signed-off-by: Lakshit Tyagi --- .../net/ethernet/aquantia/atlantic-fwd/atl_ipa.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/ethernet/aquantia/atlantic-fwd/atl_ipa.c b/drivers/net/ethernet/aquantia/atlantic-fwd/atl_ipa.c index c31457c208e8..bbc13456b8b7 100644 --- a/drivers/net/ethernet/aquantia/atlantic-fwd/atl_ipa.c +++ b/drivers/net/ethernet/aquantia/atlantic-fwd/atl_ipa.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -103,6 +104,7 @@ struct aqo_device { union aqc_ipa_eth_hdr hdr_v4; union aqc_ipa_eth_hdr hdr_v6; + struct wakeup_source *ws; phys_addr_t mmio_phys_addr; unsigned long long exception_packets; }; @@ -1022,6 +1024,13 @@ static int atl_ipa_open_device(struct ipa_eth_device *eth_dev) if (!aqo_dev) return -ENOMEM; + aqo_dev->ws = wakeup_source_register(eth_dev->dev, "aqc-ipa"); + if (!aqo_dev->ws) { + aqo_log_err(aqo_dev, "Error in initializing wake up source\n"); + kfree(aqo_dev); + return -ENOMEM; + } + aqo_dev->eth_client.inst_id = AQC_IPA_INST_ID; aqo_dev->eth_client.client_type = IPA_ETH_CLIENT_AQC107; aqo_dev->eth_client.traffic_type = IPA_ETH_PIPE_BEST_EFFORT; @@ -1031,6 +1040,8 @@ static int atl_ipa_open_device(struct ipa_eth_device *eth_dev) eth_dev->net_dev = nic->ndev; aqo_dev->eth_dev = eth_dev; + __pm_stay_awake(aqo_dev->ws); + return 0; } @@ -1038,6 +1049,9 @@ static void atl_ipa_close_device(struct ipa_eth_device *eth_dev) { struct aqo_device *aqo_dev = eth_dev->od_priv; + __pm_relax(aqo_dev->ws); + wakeup_source_unregister(aqo_dev->ws); + eth_dev->od_priv = NULL; eth_dev->net_dev = NULL;