summaryrefslogtreecommitdiff
path: root/drivers/net/wwan/iosm/iosm_ipc_imem.c
diff options
context:
space:
mode:
authorM Chetan Kumar <m.chetan.kumar@linux.intel.com>2023-06-08 15:38:03 +0530
committerDavid S. Miller <davem@davemloft.net>2023-06-12 08:49:22 +0100
commite4f5073d53be6cec0c654fac98372047efb66947 (patch)
tree83f840663aead369c60bf90ab31a17b20d979c80 /drivers/net/wwan/iosm/iosm_ipc_imem.c
parentcbb1ca6d5f9a5a4972c4466a4b61e5bed1f4690f (diff)
downloadlinux-e4f5073d53be6cec0c654fac98372047efb66947.tar.gz
linux-e4f5073d53be6cec0c654fac98372047efb66947.tar.bz2
linux-e4f5073d53be6cec0c654fac98372047efb66947.zip
net: wwan: iosm: enable runtime pm support for 7560
Adds runtime pm support for 7560. As part of probe procedure auto suspend is enabled and auto suspend delay is set to 5000 ms for runtime pm use. Later auto flag is set to power manage the device at run time. On successful communication establishment between host and device the device usage counter is dropped and request to put the device into sleep state (suspend). In TX path, the device usage counter is raised and device is moved out of sleep(resume) for data transmission. In RX path, if the device has some data to be sent it request host platform to change the power state by giving PCI PME message. Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wwan/iosm/iosm_ipc_imem.c')
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_imem.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/wwan/iosm/iosm_ipc_imem.c b/drivers/net/wwan/iosm/iosm_ipc_imem.c
index 829515a601b3..635301d677e1 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_imem.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_imem.c
@@ -4,6 +4,7 @@
*/
#include <linux/delay.h>
+#include <linux/pm_runtime.h>
#include "iosm_ipc_chnl_cfg.h"
#include "iosm_ipc_devlink.h"
@@ -631,6 +632,11 @@ static void ipc_imem_run_state_worker(struct work_struct *instance)
/* Complete all memory stores after setting bit */
smp_mb__after_atomic();
+ if (ipc_imem->pcie->pci->device == INTEL_CP_DEVICE_7560_ID) {
+ pm_runtime_mark_last_busy(ipc_imem->dev);
+ pm_runtime_put_autosuspend(ipc_imem->dev);
+ }
+
return;
err_ipc_mux_deinit:
@@ -1234,6 +1240,7 @@ void ipc_imem_cleanup(struct iosm_imem *ipc_imem)
/* forward MDM_NOT_READY to listeners */
ipc_uevent_send(ipc_imem->dev, UEVENT_MDM_NOT_READY);
+ pm_runtime_get_sync(ipc_imem->dev);
hrtimer_cancel(&ipc_imem->td_alloc_timer);
hrtimer_cancel(&ipc_imem->tdupdate_timer);
@@ -1419,6 +1426,16 @@ struct iosm_imem *ipc_imem_init(struct iosm_pcie *pcie, unsigned int device_id,
set_bit(IOSM_DEVLINK_INIT, &ipc_imem->flag);
}
+
+ if (!pm_runtime_enabled(ipc_imem->dev))
+ pm_runtime_enable(ipc_imem->dev);
+
+ pm_runtime_set_autosuspend_delay(ipc_imem->dev,
+ IPC_MEM_AUTO_SUSPEND_DELAY_MS);
+ pm_runtime_use_autosuspend(ipc_imem->dev);
+ pm_runtime_allow(ipc_imem->dev);
+ pm_runtime_mark_last_busy(ipc_imem->dev);
+
return ipc_imem;
devlink_channel_fail:
ipc_devlink_deinit(ipc_imem->ipc_devlink);