ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/marvell/linux/drivers/misc/audio-regs.c b/marvell/linux/drivers/misc/audio-regs.c
new file mode 100644
index 0000000..f2f99e1
--- /dev/null
+++ b/marvell/linux/drivers/misc/audio-regs.c
@@ -0,0 +1,111 @@
+/*
+ * ASRMICRO Audio driver
+ *
+ * Copyright (C) 2022 ASRMICRO.
+ *
+ * Author: Wen Chen <wenchen@asrmicro.com>
+ *
+ * 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.
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <linux/delay.h>
+#include <linux/regulator/machine.h>
+#include <linux/platform_device.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/edge_wakeup_mmp.h>
+#include <linux/mfd/88pm80x.h>
+#include <soc/asr/addr-map.h>
+
+char * vir_MCLK_start_addr = NULL;
+
+char * get_MCLK_start_addr(void)
+{
+    return vir_MCLK_start_addr;
+}
+EXPORT_SYMBOL_GPL(get_MCLK_start_addr);
+
+static int audio_regs_probe(struct platform_device *pdev)
+{
+    struct resource *MCLK_reg_res = NULL;
+
+    printk(KERN_INFO "enter %s. \n", __FUNCTION__);
+
+    /* get the resource */
+    MCLK_reg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+    if (!MCLK_reg_res) {
+        printk(KERN_INFO "Couldn't platform_get_resource.\n");
+        return -ENOENT;
+    }
+
+    vir_MCLK_start_addr = ioremap(MCLK_reg_res->start, resource_size(MCLK_reg_res));
+    if (!vir_MCLK_start_addr) {
+        printk(KERN_INFO "Couldn't ioremap\n");
+        return -ENOMEM;
+    }
+
+    printk(KERN_INFO"%s, phy MCLK_reg_res start is 0x%0x, vir_MCLK_start_addr is 0x%0x.\n",
+            __FUNCTION__, (unsigned int)(MCLK_reg_res->start), (unsigned int)vir_MCLK_start_addr);
+
+    return 0;
+}
+
+static int audio_regs_remove(struct platform_device *pdev)
+{
+    printk(KERN_INFO "enter %s. \n", __FUNCTION__);
+
+    if (vir_MCLK_start_addr) {
+        iounmap(vir_MCLK_start_addr);
+    }
+
+    return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id audio_regs_dt_match[] = {
+    { .compatible = "ASRMICRO,audio-registers", },
+    {},
+};
+#endif
+
+static struct platform_driver audio_regs_driver = {
+    .driver		= {
+        .name	= "audio-registers",
+        .owner	= THIS_MODULE,
+#ifdef CONFIG_OF
+        .of_match_table = of_match_ptr(audio_regs_dt_match),
+#endif
+    },
+    .probe		= audio_regs_probe,
+    .remove		= audio_regs_remove,
+};
+
+static int audio_regs_init(void)
+{
+    return platform_driver_register(&audio_regs_driver);
+}
+
+static void audio_regs_exit(void)
+{
+    platform_driver_unregister(&audio_regs_driver);
+}
+
+subsys_initcall(audio_regs_init);
+//module_init(audio_regs_init);
+module_exit(audio_regs_exit);
+
+MODULE_AUTHOR("Wen Chen <wenchen@asrmicro.com>");
+MODULE_DESCRIPTION("driver for audio registers config");
+MODULE_LICENSE("GPL v2");