[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/kernel/linux/v4.14/drivers/soc/mediatek/mtk-pmic-wrap-legacy.c b/src/kernel/linux/v4.14/drivers/soc/mediatek/mtk-pmic-wrap-legacy.c
new file mode 100644
index 0000000..73d81da
--- /dev/null
+++ b/src/kernel/linux/v4.14/drivers/soc/mediatek/mtk-pmic-wrap-legacy.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2015 MediaTek Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/******************************************************************************
+ * pmic_wrapper.c - Linux pmic_wrapper Driver
+ *
+ *
+ * DESCRIPTION:
+ *     This file provid the other drivers PMIC wrapper relative functions
+ *
+ ******************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+/*#include <mach/mt_typedefs.h>*/
+#include <linux/timer.h>
+//#include <mtk_pmic_wrap.h>
+#include <linux/syscore_ops.h>
+#include <linux/regmap.h>
+#include <linux/soc/mediatek/pmic_wrap.h>
+#include <linux/of_address.h>
+#include <linux/of_fdt.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+#include <linux/spinlock.h>
+
+static struct regmap *pmic_regmap;
+static spinlock_t   wrp_lock = __SPIN_LOCK_UNLOCKED(lock);
+
+s32 pwrap_read(u32 adr, u32 *rdata)
+{
+	int ret = 0;
+	unsigned long flags = 0;
+
+	if (pmic_regmap) {
+		spin_lock_irqsave(&wrp_lock, flags);
+		ret = regmap_read(pmic_regmap, adr, rdata);
+		spin_unlock_irqrestore(&wrp_lock, flags);
+	} else
+		pr_notice("%s %d rec.\n", __func__, __LINE__);
+	return ret;
+}
+EXPORT_SYMBOL(pwrap_read);
+
+s32 pwrap_write(u32 adr, u32 wdata)
+{
+	int ret = 0;
+	unsigned long flags = 0;
+
+	if (pmic_regmap) {
+		spin_lock_irqsave(&wrp_lock, flags);
+		ret = regmap_write(pmic_regmap, adr, wdata);
+		spin_unlock_irqrestore(&wrp_lock, flags);
+	} else
+		pr_notice("%s %d Error.\n", __func__, __LINE__);
+	return ret;
+}
+EXPORT_SYMBOL(pwrap_write);
+
+static int __init mt_pwrap_init(void)
+{
+	struct device_node *node, *pwrap_node;
+
+	pr_info("%s\n", __func__);
+	node = of_find_compatible_node(NULL, NULL, "mediatek,pwraph");
+	pwrap_node = of_parse_phandle(node, "mediatek,pwrap-regmap", 0);
+	if (pwrap_node) {
+		pmic_regmap = pwrap_node_to_regmap(pwrap_node);
+		if (IS_ERR(pmic_regmap)) {
+			pr_notice("%s %d Error.\n", __func__, __LINE__);
+			return PTR_ERR(pmic_regmap);
+		}
+	} else {
+		pr_notice("%s %d Error.\n", __func__, __LINE__);
+		return -EINVAL;
+	}
+	return 0;
+}
+subsys_initcall(mt_pwrap_init);
+
+MODULE_AUTHOR("mediatek");
+MODULE_DESCRIPTION("pmic_wrapper Driver  Revision");
+MODULE_LICENSE("GPL");