drivers_aocpu: init drivers_aocpu [1/1]

PD#SWPL-66844

Problem:
init drivers_aocpu

Solution:
init drivers_aocpu

Verify:
N/A

Signed-off-by: Kelvin Zhang <kelvin.zhang@amlogic.com>
Change-Id: Iadc845929b1cead1375024a8ad4723334bad4015
diff --git a/pmic/pmic.c b/pmic/pmic.c
new file mode 100644
index 0000000..2b4d4ad
--- /dev/null
+++ b/pmic/pmic.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014-2018 Amlogic, Inc. All rights reserved.
+ *
+ * All information contained herein is Amlogic confidential.
+ *
+ * This software is provided to you pursuant to Software License Agreement
+ * (SLA) with Amlogic Inc ("Amlogic"). This software may be used
+ * only in accordance with the terms of this agreement.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification is strictly prohibited without prior written permission from
+ * Amlogic.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "pmic.h"
+#include "myprintf.h"
+
+struct pmic_regulator *pmic_regulators[PMIC_MAXNUM] = {NULL1,NULL1,NULL1,NULL1,NULL1};
+
+int pmic_regulators_register(struct pmic_regulator *PmicRegulator, int *dev_id)
+{
+	for (int i = 0;i < PMIC_MAXNUM;i++) {
+		if (pmic_regulators[i] == NULL1) {
+			pmic_regulators[i] = PmicRegulator;
+			*dev_id = i;
+			return 0;
+		}
+	}
+	printf("pmic_regulators has Greatered than PMIC_MAXNUM\n");
+	return -1;
+}
+
+void pmic_i2c_init(int dev_id,struct pmic_i2c *pmic_i2c) {
+	((pmic_regulators[dev_id])->pmic_i2c_config)(pmic_i2c);
+}
+
+int pmic_regulator_ctrl(int dev_id, int id, int status){
+	struct regulator_desc pmic_desc = ((pmic_regulators[dev_id])->rdev)[id];
+	pmic_desc.ops->ctrl(&pmic_desc, status);
+	return 0;
+}
+
+int pmic_regulator_set_voltage(int dev_id, int id,int sel){
+	struct regulator_desc pmic_desc = ((pmic_regulators[dev_id])->rdev)[id];
+	pmic_desc.ops->set_voltage(&pmic_desc, sel);
+	return 0;
+}
+
+void pmic_osc(int dev_id, int status){
+	((pmic_regulators[dev_id])->osc_ctrl)(status);
+}
+
+
+