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

Commit 0969a2a4 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 0bf6c5df 266a2197
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,
	},
};