summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Habibulla <moch@google.com>2016-03-29 16:42:08 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-03-29 16:42:08 +0000
commit4ce1b1c343fdfb16d2a3e9b5fb3895f3f3b71648 (patch)
tree43310254fb96de29eef1d228cdfc7643fc9a49c6
parent31834b5ae1603c90471275920b27f60085a638ed (diff)
parentfc5f9cbd0de03d86dea745d5c3c4b24ea35581fc (diff)
downloadmarvell-4ce1b1c343fdfb16d2a3e9b5fb3895f3f3b71648.tar.gz
Merge "To add the peripheral io hal"
-rw-r--r--peripheral/peripheral_io/Android.mk36
-rw-r--r--peripheral/peripheral_io/peripheral_io.cc94
-rw-r--r--soc/iap140/hal_modules.mk1
-rw-r--r--soc/iap140/modules/peripheral_io_hal_module.mk19
4 files changed, 150 insertions, 0 deletions
diff --git a/peripheral/peripheral_io/Android.mk b/peripheral/peripheral_io/Android.mk
new file mode 100644
index 0000000..a27213c
--- /dev/null
+++ b/peripheral/peripheral_io/Android.mk
@@ -0,0 +1,36 @@
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := peripheral_io.cc
+
+LOCAL_STATIC_LIBRARIES := \
+ peripheral_manager_hal_headers \
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libhardware \
+
+# do not prelink
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_MODULE := peripheral_io.mrvl
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/peripheral/peripheral_io/peripheral_io.cc b/peripheral/peripheral_io/peripheral_io.cc
new file mode 100644
index 0000000..7ad8951
--- /dev/null
+++ b/peripheral/peripheral_io/peripheral_io.cc
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2016. Marvell International Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ *********************************************
+ * Andromeda Box GPIO Mapping *
+ *********************************************
+ * Extension Board Phsical Pin Layout:
+ * +-+-+-+-+-+......+-+-+-+--+--+
+ * |2|4|6|8| |......| | | |38|40|
+ * +-+-+-+-+-+......+-+-+-+--+--+
+ * |1|3|5|7| |......| | | |37|39|
+ * +---------- ------------+
+ *
+ * PHY_PIN NAME DESCRIPTION DIRECTION
+ * 3 IO1 GPIO_45(UART1_CTSn) IN/OUT
+ * 5 IO2 GPIO_44(UART1_TXD) IN/OUT
+ * 7 IO3 GPIO_43(UART1_RXD) IN/OUT
+ * 9 IO4 GPIO_46(UART1_RTSn) IN/OUT
+ * 23 IO5 GPIO_72(TP_INT) IN/OUT
+ * 25 IO6 GPIO_09(GPIO_09) IN/OUT
+ * 27 IO7 GPIO_12(GPIO_12) IN/OUT
+ * 29 IO8 GPIO_51(PWM_GPIO51) IN/OUT
+ * 31 IO9 GPIO_67(CAM_RST_MAIN) IN/OUT
+ * 33 IO10 GPIO_69(CAM_RST_SUB) IN/OUT
+ * 16 IO11 GPIO_01(EXP_I2S_SYNC) OUT Only
+ * 18 IO12 GPIO_00(EXP_I2S_CLK) OUT Only
+ * 20 IO13 GPIO_02(EXP_I2S_DO) OUT Only
+ * 22 IO14 GPIO_03(EXP_I2S_DI) OUT Only
+ * 24 IO15 GPIO_75(TP_RESET) IN/OUT
+ * 26 IO16 GPIO_18(GPIO_18) IN/OUT
+ * 28 IO17 GPIO_100(LCD_CTRL) IN/OUT
+ * 30 IO18 GPIO_04(LCD_RESET_N) IN/OUT
+ * 32 IO19 GPIO_68(CAM_PD_MAIN) IN/OUT
+ * 34 IO20 GPIO_70(CAM_PD_SUB) IN/OUT
+ */
+
+#include <cutils/log.h>
+#include <string.h>
+#include <stdlib.h>
+#include <hardware/hardware.h>
+#include <hardware/peripheral_io.h>
+
+#define PIN_NUMBER 20
+#define UNUSED(x) (void)(x)
+
+int phy_pin_index[PIN_NUMBER] = {45,44,43,46,72,9,12,51,67,69,1,0,2,3,75,18,100,4,68,70};
+
+const char IO[] = "IO";
+
+static int io_register_devices(const peripheral_io_module_t* dev,
+ const peripheral_registration_cb_t* callbacks);
+
+struct peripheral_io_module_t HAL_MODULE_INFO_SYM = {
+ .common = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = PERIPHERAL_IO_HARDWARE_MODULE_ID,
+ .name = "peripheral_io module",
+ .author = "Marvell SEEDS",
+ },
+ .register_devices = io_register_devices
+};
+
+static int io_register_devices(const peripheral_io_module_t* dev,
+ const peripheral_registration_cb_t* callbacks)
+{
+ UNUSED(dev);
+
+ int i = 0;
+ char io_name[16] = {0};
+
+ for(i = 1; i <= PIN_NUMBER; i++)
+ {
+ memset(io_name,0,sizeof(io_name));
+ sprintf(io_name, "%s%d", IO, i);
+ callbacks->register_gpio_sysfs(io_name, phy_pin_index[i - 1]);
+ }
+ return true;
+}
diff --git a/soc/iap140/hal_modules.mk b/soc/iap140/hal_modules.mk
index 91a10e4..372a6b2 100644
--- a/soc/iap140/hal_modules.mk
+++ b/soc/iap140/hal_modules.mk
@@ -21,6 +21,7 @@
-include hardware/bsp/marvell/soc/iap140/modules/wifi_hal_module.mk
-include hardware/bsp/marvell/soc/iap140/modules/bluetooth_hal_moduel.mk
-include hardware/bsp/marvell/soc/iap140/modules/keystore_hal_module.mk
+-include hardware/bsp/marvell/soc/iap140/modules/peripheral_io_hal_module.mk
# the client and server of the wireless daemon
-include hardware/bsp/marvell/soc/iap140/modules/libwireless.mk
diff --git a/soc/iap140/modules/peripheral_io_hal_module.mk b/soc/iap140/modules/peripheral_io_hal_module.mk
new file mode 100644
index 0000000..997bb8a
--- /dev/null
+++ b/soc/iap140/modules/peripheral_io_hal_module.mk
@@ -0,0 +1,19 @@
+#
+# Copyright 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# peripheral_io-hal modules
+DEVICE_PACKAGES += \
+ peripheral_io.mrvl