#include <errno.h>
#include <glib.h>
-#include <hw/thermal.h>
-#include <hw/shared.h>
+#include <hal/device/hal-thermal-interface.h>
+#include <hal/hal-common-interface.h>
+#include "common.h"
#define AP_PATH "/sys/class/thermal/thermal_zone0/temp"
return 0;
}
-static int thermal_open(struct hw_info *info,
- const char *id, struct hw_common **common)
+static int thermal_init(void **data)
{
- struct thermal_device *thermal_dev;
+ hal_backend_thermal_funcs *thermal_funcs;
- if (!info || !common)
- return -EINVAL;
-
- thermal_dev = calloc(1, sizeof(struct thermal_device));
- if (!thermal_dev)
+ thermal_funcs = calloc(1, sizeof(hal_backend_thermal_funcs));
+ if (!thermal_funcs)
return -ENOMEM;
- thermal_dev->common.info = info;
- thermal_dev->register_changed_event
- = thermal_register_changed_event;
- thermal_dev->unregister_changed_event
- = thermal_unregister_changed_event;
- thermal_dev->get_info
- = thermal_get_info;
+ thermal_funcs->get_info = thermal_get_info;
+ thermal_funcs->register_changed_event = thermal_register_changed_event;
+ thermal_funcs->unregister_changed_event = thermal_unregister_changed_event;
+
+ *data = (void *)thermal_funcs;
- *common = (struct hw_common *)thermal_dev;
return 0;
}
-static int thermal_close(struct hw_common *common)
+static int thermal_exit(void *data)
{
- if (!common)
- return -EINVAL;
+ if (!data)
+ return 0;
- free(common);
+ free(data);
return 0;
}
-HARDWARE_MODULE_STRUCTURE = {
- .magic = HARDWARE_INFO_TAG,
- .hal_version = HARDWARE_INFO_VERSION,
- .device_version = THERMAL_HARDWARE_DEVICE_VERSION,
- .id = THERMAL_HARDWARE_DEVICE_ID,
+hal_backend EXPORT hal_backend_device_thermal_data = {
.name = "thermal",
- .open = thermal_open,
- .close = thermal_close,
+ .vendor = "rpi3",
+ .abi_version = HAL_ABI_VERSION_TIZEN_6_5,
+ .init = thermal_init,
+ .exit = thermal_exit,
};