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

Commit 266a2197 authored by Rama Krishna Phani A's avatar Rama Krishna Phani A Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: smem: Add support for suspend to disk



Add support to smem driver for suspend to disk feature.
SMEM is cleared during Hibernation. Initialize SMEM
during resume from Hibernation.

Change-Id: I6e9b912f5be46aa21923ce357cc9c0e7fa97c5a7
Signed-off-by: default avatarRama Krishna Phani A <rphani@codeaurora.org>
parent 62d644e7
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -1057,6 +1057,40 @@ static int qcom_smem_remove(struct platform_device *pdev)
	return 0;
}

static int qcom_smem_freeze(struct device *dev)
{
	struct platform_device *pdev = container_of(dev, struct
					platform_device, dev);
	dev_dbg(dev, "%s\n", __func__);

	qcom_smem_remove(pdev);

	return 0;
}

static int qcom_smem_restore(struct device *dev)
{
	int ret = 0;
	struct platform_device *pdev = container_of(dev, struct
					platform_device, dev);
	dev_dbg(dev, "%s\n", __func__);

	/*
	 * SMEM related information has to fetched again
	 * during resuming from Hibernation, Hence call probe.
	 */
	ret = qcom_smem_probe(pdev);
	if (ret)
		dev_err(dev, "Error getting SMEM information");

	return ret;
}

static const struct dev_pm_ops qcom_smem_pm_ops = {
	.freeze = qcom_smem_freeze,
	.restore = qcom_smem_restore,
};

static const struct of_device_id qcom_smem_of_match[] = {
	{ .compatible = "qcom,smem" },
	{}
@@ -1070,6 +1104,7 @@ static struct platform_driver qcom_smem_driver = {
		.name = "qcom-smem",
		.of_match_table = qcom_smem_of_match,
		.suppress_bind_attrs = true,
		.pm = &qcom_smem_pm_ops,
	},
};