summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaeyoung <ty317.kim@samsung.com>2016-12-29 10:21:35 +0900
committertaeyoung <ty317.kim@samsung.com>2016-12-29 10:21:35 +0900
commit5040220f793aa280bc994bf6ba164e0d2c2b5077 (patch)
tree0221b255e3193c9b65fe7b477603a38f1b0537fc
parent2df6010e7e76a14aab752ec486731833acca7232 (diff)
parent22be1ab827e676e97bf8f3a03b26155e60b15fdb (diff)
downloadlibdevice-node-5040220f793aa280bc994bf6ba164e0d2c2b5077.tar.gz
libdevice-node-5040220f793aa280bc994bf6ba164e0d2c2b5077.tar.bz2
libdevice-node-5040220f793aa280bc994bf6ba164e0d2c2b5077.zip
Signed-off-by: taeyoung <ty317.kim@samsung.com> Change-Id: I4af8a6b19362cb83a5289815977fa87c3127c305
-rw-r--r--hw/cpu.h43
-rw-r--r--hw/display_internal.h79
-rw-r--r--hw/thermal.h66
-rw-r--r--src/device-node.c10
4 files changed, 188 insertions, 10 deletions
diff --git a/hw/cpu.h b/hw/cpu.h
new file mode 100644
index 0000000..c35f0c8
--- /dev/null
+++ b/hw/cpu.h
@@ -0,0 +1,43 @@
+/*
+ * libdevice-node
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., 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 requcpued 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.
+ */
+
+
+#ifndef __HW_CPU_H__
+#define __HW_CPU_H__
+
+#include <hw/common.h>
+
+/**
+ * The id of this device
+ */
+#define CPU_HARDWARE_DEVICE_ID "cpu"
+
+/**
+ * The version of this device
+ */
+#define CPU_HARDWARE_DEVICE_VERSION MAKE_VERSION(0,1)
+
+struct cpu_device {
+ struct hw_common common;
+
+ /* CPU boost */
+ int (*start_boost)(void *data);
+ int (*stop_boost)(void *data);
+};
+
+#endif
diff --git a/hw/display_internal.h b/hw/display_internal.h
new file mode 100644
index 0000000..125f0d9
--- /dev/null
+++ b/hw/display_internal.h
@@ -0,0 +1,79 @@
+/*
+ * libdevice-node
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., 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.
+ */
+
+/*******************************************/
+/* THIS IS THE HAL FOR EXPERIMENTAL USAGES */
+/*******************************************/
+
+
+#ifndef __HW_DISPLAY_INTERNAL_H__
+#define __HW_DISPLAY_INTERNAL_H__
+
+#include <hw/common.h>
+
+/**
+ * The id of this device
+ */
+#define DISPLAY_INTERNAL_HARDWARE_DEVICE_ID "display_internal"
+
+/**
+ * The version of this device
+ */
+#define DISPLAY_INTERNAL_HARDWARE_DEVICE_VERSION MAKE_VERSION(0,2)
+
+typedef enum display_internal_enhance_mode {
+ ENHANCE_MODE_NONE = 1001,
+ ENHANCE_MODE_DYNAMIC,
+ ENHANCE_MODE_STANDARD,
+ ENHANCE_MODE_NATURAL,
+ ENHANCE_MODE_GRAYSCALE,
+ ENHANCE_MODE_MOVIE,
+ ENHANCE_MODE_AUTO,
+} display_internal_enhance_mode_e;
+
+typedef enum display_internal_enhance_scenario {
+ ENHANCE_SCENARIO_NONE = 2001,
+ ENHANCE_SCENARIO_NORMAL,
+ ENHANCE_SCENARIO_GALLERY,
+ ENHANCE_SCENARIO_VIDEO,
+ ENHANCE_SCENARIO_VTCALL,
+ ENHANCE_SCENARIO_CAMERA,
+ ENHANCE_SCENARIO_BROWSER,
+ ENHANCE_SCENARIO_NEGATIVE,
+ ENHANCE_SCENARIO_EMAIL,
+ ENHANCE_SCENARIO_EBOOK,
+ ENHANCE_SCENARIO_GRAYSCALE,
+} display_intermal_enhance_scenario_e;
+
+struct display_internal_device {
+ struct hw_common common;
+
+ int (*set_enhance_mode)(display_internal_enhance_mode_e mode);
+ int (*get_enhance_mode)(display_internal_enhance_mode_e *mode);
+
+ int (*set_enhance_scenario)(display_internal_enhance_scenario_e scenario);
+ int (*get_enhance_scenario)(display_internal_enhance_scenario_e *scenario);
+
+ int (*set_enhance)(display_internal_enhance_mode_e mode,
+ display_internal_enhance_scenario_e scenario);
+ int (*get_enhance)(display_internal_enhance_mode_e *mode,
+ display_internal_enhance_scenario_e *scenario);
+
+};
+
+#endif
diff --git a/hw/thermal.h b/hw/thermal.h
new file mode 100644
index 0000000..8262a38
--- /dev/null
+++ b/hw/thermal.h
@@ -0,0 +1,66 @@
+/*
+ * libdevice-node
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., 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.
+ */
+
+
+#ifndef __HW_THERMAL_H__
+#define __HW_THERMAL_H__
+
+#include <hw/common.h>
+
+/**
+ * The id of this device
+ */
+#define THERMAL_HARDWARE_DEVICE_ID "thermal"
+
+/**
+ * The version of this device
+ */
+#define THERMAL_HARDWARE_DEVICE_VERSION MAKE_VERSION(0,1)
+
+typedef enum _thermal_state {
+ THERMAL_STATE_LOW,
+ THERMAL_STATE_NORMAL,
+ THERMAL_STATE_HIGH,
+} thermal_state_e;
+
+typedef enum _thermal_level {
+ THERMAL_LEVEL_NORMAL = 1001,
+ THERMAL_LEVEL_WARNING,
+ THERMAL_LEVEL_CRITICAL,
+ THERMAL_LEVEL_POWEROFF,
+} thermal_level_e;
+
+struct thermal_info {
+ thermal_state_e state;
+ thermal_level_e level;
+};
+
+typedef void (*ThermalUpdated)(struct thermal_info *info, void *data);
+
+struct thermal_device {
+ struct hw_common common;
+
+ /* Get thermal state */
+ int (*get_state)(struct thermal_info *info);
+
+ /* Register thermal event */
+ int (*register_changed_event)(ThermalUpdated updated_cb, void *data);
+ int (*unregister_changed_event)(ThermalUpdated updated_cb);
+};
+
+#endif /* __HW_THERMAL_H__ */
diff --git a/src/device-node.c b/src/device-node.c
index 07ba917..3000a76 100644
--- a/src/device-node.c
+++ b/src/device-node.c
@@ -68,11 +68,6 @@ API int device_get_property(enum device_type devtype, int property, int *value)
}
dev = container_of(type, struct device, type);
- if (dev == NULL) {
- _E("device cannot find");
- errno = EPERM;
- return -1;
- }
if (dev->get_prop == NULL) {
_E("devtype doesn't have getter function");
@@ -109,11 +104,6 @@ API int device_set_property(enum device_type devtype, int property, int value)
}
dev = container_of(type, struct device, type);
- if (dev == NULL) {
- _E("device cannot find");
- errno = EPERM;
- return -1;
- }
if (dev->set_prop == NULL) {
_E("devtype doesn't have setter function");