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

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

Merge "soc: qcom: memory_dump: Restore memory_dump table during hibernation"

parents adb56f31 03c0e41a
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -23,6 +23,7 @@
#include <linux/of_device.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/syscore_ops.h>

#define MSM_DUMP_TABLE_VERSION		MSM_DUMP_MAKE_VERSION(2, 0)

@@ -168,12 +169,23 @@ struct dump_vaddr_entry *get_msm_dump_ptr(enum msm_dump_data_ids id)
}
EXPORT_SYMBOL(get_msm_dump_ptr);

static void __iomem *imem_base;
#ifdef CONFIG_HIBERNATION
static void memory_dump_syscore_resume(void)
{
	memcpy_toio(imem_base, &memdump.table_phys, sizeof(memdump.table_phys));
}

static struct syscore_ops memory_dump_syscore_ops = {
	.resume = memory_dump_syscore_resume,
};
#endif

static int __init init_memory_dump(void)
{
	struct msm_dump_table *table;
	struct msm_dump_entry entry;
	struct device_node *np;
	void __iomem *imem_base;
	int ret;

	np = of_find_compatible_node(NULL, NULL,
@@ -201,8 +213,9 @@ static int __init init_memory_dump(void)
	mb();
	pr_info("MSM Memory Dump base table set up\n");

#ifndef CONFIG_HIBERNATION
	iounmap(imem_base);

#endif
	table = kzalloc(sizeof(struct msm_dump_table), GFP_KERNEL);
	if (!table) {
		ret = -ENOMEM;
@@ -219,6 +232,9 @@ static int __init init_memory_dump(void)
	}
	pr_info("MSM Memory Dump apps data table set up\n");

#ifdef CONFIG_HIBERNATION
	register_syscore_ops(&memory_dump_syscore_ops);
#endif
	return 0;
err2:
	kfree(table);