Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35f6b97e authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

msm: mhi_dev: Hold a wakelock during data transfer



Modem host interface (MHI) device supports software
channel data transfers. Hold a wakelock if MHI device
is in active state and host has not placed the device
in suspend.

Change-Id: I5000e8b9c6761c6f662ee01d557b78bc16fe1632
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent 998e5be1
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <linux/msm_ep_pcie.h>
#include <linux/ipa_mhi.h>
#include <linux/vmalloc.h>
#include <linux/wakelock.h>

#include "mhi.h"
#include "mhi_hwio.h"
@@ -1129,6 +1130,13 @@ static void mhi_dev_scheduler(struct work_struct *work)

void mhi_dev_notify_a7_event(struct mhi_dev *mhi)
{

	if (!atomic_read(&mhi->mhi_dev_wake)) {
		pm_stay_awake(mhi->dev);
		atomic_set(&mhi->mhi_dev_wake, 1);
	}
	mhi_log(MHI_MSG_VERBOSE, "acquiring mhi wakelock\n");

	schedule_work(&mhi->chdb_ctrl_work);
	mhi_log(MHI_MSG_VERBOSE, "mhi irq triggered\n");
}
@@ -1368,6 +1376,10 @@ int mhi_dev_suspend(struct mhi_dev *mhi)

	}

	atomic_set(&mhi->mhi_dev_wake, 0);
	pm_relax(mhi->dev);
	mhi_log(MHI_MSG_VERBOSE, "releasing mhi wakelock\n");

	mutex_unlock(&mhi_ctx->mhi_write_test);

	return rc;
@@ -2028,6 +2040,14 @@ static int get_device_tree_data(struct platform_device *pdev)
		}
	}

	device_init_wakeup(mhi->dev, true);
	/* MHI device will be woken up from PCIe event */
	device_set_wakeup_capable(mhi->dev, false);
	/* Hold a wakelock until completion of M0 */
	pm_stay_awake(mhi->dev);
	atomic_set(&mhi->mhi_dev_wake, 1);

	mhi_log(MHI_MSG_VERBOSE, "acquiring wakelock\n");

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -519,6 +519,7 @@ struct mhi_dev {

	atomic_t			write_active;
	atomic_t			is_suspended;
	atomic_t			mhi_dev_wake;
	struct mutex			mhi_write_test;
	u32				device_local_pa_base;
	u32				mhi_ep_msi_num;