hikey: Add open function to power HAL
am: 96c621c19a

Change-Id: I20d2b89fccb906ab47a93c811c60576818515c18
diff --git a/power/power_hikey.c b/power/power_hikey.c
index 158d732..df4743f 100644
--- a/power/power_hikey.c
+++ b/power/power_hikey.c
@@ -325,8 +325,40 @@
     }
 }
 
+static int power_open(const hw_module_t* module, const char* name,
+                    hw_device_t** device)
+{
+    int retval = 0; /* 0 is ok; -1 is error */
+    ALOGD("%s: enter; name=%s", __FUNCTION__, name);
+
+    if (strcmp(name, POWER_HARDWARE_MODULE_ID) == 0) {
+        power_module_t *dev = (power_module_t *)calloc(1,
+                sizeof(power_module_t));
+
+        if (dev) {
+            /* Common hw_device_t fields */
+            dev->common.tag = HARDWARE_DEVICE_TAG;
+            dev->common.module_api_version = POWER_MODULE_API_VERSION_0_5;
+            dev->common.hal_api_version = HARDWARE_HAL_API_VERSION;
+
+            dev->init = hikey_power_init;
+            dev->powerHint = hikey_power_hint;
+            dev->setInteractive = power_set_interactive;
+            dev->setFeature = set_feature;
+
+            *device = (hw_device_t*)dev;
+        } else
+            retval = -ENOMEM;
+    } else {
+        retval = -EINVAL;
+    }
+
+    ALOGD("%s: exit %d", __FUNCTION__, retval);
+    return retval;
+}
+
 static struct hw_module_methods_t power_module_methods = {
-    .open = NULL,
+    .open = power_open,
 };
 
 struct hikey_power_module HAL_MODULE_INFO_SYM = {