summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorjy910.yun <jy910.yun@samsung.com>2013-02-26 16:06:47 +0900
committerjy910.yun <jy910.yun@samsung.com>2013-02-26 16:07:44 +0900
commitf440d7952681e9bf4540f795cc709c9010c7024d (patch)
tree216eda99728aba84d4820fcfb194e054a6dd32dd /include
parentcdefbf11af164d3f3a7fbfebb7dfa8ff76e2b436 (diff)
downloadlibdevice-node-f440d7952681e9bf4540f795cc709c9010c7024d.tar.gz
libdevice-node-f440d7952681e9bf4540f795cc709c9010c7024d.tar.bz2
libdevice-node-f440d7952681e9bf4540f795cc709c9010c7024d.zip
Create new Library to control OAL APIssubmit/trunk/20130226.073610
separate some code about OAL from devman This module is a Library to control OAL APIs only used by system f/w Change-Id: I8ea27904950f402922d4df315c02881c70fb65ac
Diffstat (limited to 'include')
-rw-r--r--include/device-internal.h65
-rw-r--r--include/device-node.h219
-rw-r--r--include/devman_plugin_intf.h175
3 files changed, 459 insertions, 0 deletions
diff --git a/include/device-internal.h b/include/device-internal.h
new file mode 100644
index 0000000..7e3dbb7
--- /dev/null
+++ b/include/device-internal.h
@@ -0,0 +1,65 @@
+/*
+ * device-node
+ * Copyright (c) 2012 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 __DEVICE_INTERNAL_H__
+#define __DEVICE_INTERNAL_H__
+
+#include "device-node.h"
+
+#ifndef __CONSTRUCTOR__
+#define __CONSTRUCTOR__ __attribute__ ((constructor))
+#endif
+
+#ifndef __DESTRUCTOR__
+#define __DESTRUCTOR__ __attribute__ ((destructor))
+#endif
+
+#define FEATURE_DEVICE_NODE_DLOG
+#ifdef FEATURE_DEVICE_NODE_DLOG
+#define LOG_TAG "DEVICE_NODE"
+#include <dlog.h>
+#define DEVLOG(fmt, args...) SLOGD(fmt, ##args)
+#define DEVERR(fmt, args...) SLOGE(fmt, ##args)
+#else
+#define DEVLOG(x, ...) do { } while (0)
+#define DEVERR(x, ...) do { } while (0)
+#endif
+
+#define DEVMAN_PLUGIN_PATH "/usr/lib/libslp_devman_plugin.so"
+
+#ifndef PLUGIN_DEFINE
+#define PLUGIN_DEFINE
+#define PLUGIN_SYS(node) plugin_intf->OEM_sys_##node
+#define PLUGIN_GET(node) plugin_intf->OEM_sys_get_##node
+#define PLUGIN_SET(node) plugin_intf->OEM_sys_set_##node
+#endif
+
+struct device {
+ enum device_type type;
+ char *name;
+ int (*set_prop) (int property, int val);
+ int (*get_prop) (int property, int *val);
+};
+
+void add_device(enum device_type *devtype);
+void remove_device(enum device_type *devtype);
+
+extern const OEM_sys_devman_plugin_interface *plugin_intf;
+extern const OEM_sys_devman_plugin_interface default_plugin;
+
+#endif /* __DEVICE_INTERNAL_H__ */
diff --git a/include/device-node.h b/include/device-node.h
new file mode 100644
index 0000000..935bc18
--- /dev/null
+++ b/include/device-node.h
@@ -0,0 +1,219 @@
+/*
+ * device-node
+ * Copyright (c) 2012 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 __DEVICE_NODE_H__
+#define __DEVICE_NODE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "devman_plugin_intf.h"
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+/**
+ * @file device-node.h
+ * @ingroup FRAMEWORK/SYSTEM
+ * @brief This file contains the API for the status of devices
+ * @author TIZEN
+ * @date 2013-02-15
+ * @version 0.1
+ */
+
+/**
+ * @addtogroup DEVICE_NODE
+ * @{
+ */
+
+/**
+ * @par Description:
+ * device type enum
+ */
+enum device_type
+{
+ DEVICE_TYPE_DISPLAY, /**< display */
+ DEVICE_TYPE_VIBRATOR, /**< vibrator */
+ DEVICE_TYPE_EXTCON, /**< extcon - Micro USB, 3.5 pi jack etc */
+ DEVICE_TYPE_LED, /**< LED */
+ DEVICE_TYPE_POWER, /**< battery, PMIC, etc about power */
+ DEVICE_TYPE_MEMORY, /**< memory */
+ DEVICE_TYPE_CPU, /**< cpu */
+ DEVICE_TYPE_PROCESS, /**< process */
+ DEVICE_TYPE_MAX,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_DISPLAY property for generic APIs
+ */
+enum {
+ PROP_DISPLAY_DISPLAY_COUNT,
+ PROP_DISPLAY_BRIGHTNESS,
+ PROP_DISPLAY_ACL_CONTROL,
+ PROP_DISPLAY_ONOFF,
+ PROP_DISPLAY_BRIGHTNESS_BY_LUX,
+ PROP_DISPLAY_FRAME_RATE,
+ PROP_DISPLAY_IMAGE_ENHANCE_MODE,
+ PROP_DISPLAY_IMAGE_ENHANCE_SCENARIO,
+ PROP_DISPLAY_IMAGE_ENHANCE_TONE,
+ PROP_DISPLAY_IMAGE_ENHANCE_OUTDOOR,
+ PROP_DISPLAY_IMAGE_ENHANCE_TUNE,
+ PROP_DISPLAY_IMAGE_ENHANCE_INFO,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_HAPTIC property for generic APIs
+ */
+enum {
+ PROP_VIBRATOR_LEVEL_MAX,
+ PROP_VIBRATOR_LEVEL,
+ PROP_VIBRATOR_ENABLE,
+ PROP_VIBRATOR_ONESHOT,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_JACK property for generic APIs
+ */
+enum {
+ PROP_EXTCON_TA_ONLINE, /**< Travel Adapter(Charger) */
+ PROP_EXTCON_EARJACK_ONLINE, /**< Earjack */
+ PROP_EXTCON_EARKEY_ONLINE, /**< Earkey */
+ PROP_EXTCON_HDMI_ONLINE, /**< HDMI */
+ PROP_EXTCON_USB_ONLINE, /**< USB connection */
+ PROP_EXTCON_CRADLE_ONLINE, /**< Cradle connection */
+ PROP_EXTCON_TVOUT_ONLINE, /**< analog tvout */
+ PROP_EXTCON_KEYBOARD_ONLINE, /**< Microphone */
+ PROP_EXTCON_HDMI_SUPPORT, /**< Support HDMI*/
+ PROP_EXTCON_UART_PATH,
+ PROP_EXTCON_USB_PATH,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_LED property for generic APIs
+ */
+enum {
+ PROP_LED_BRIGHTNESS,
+ PROP_LED_MAX_BRIGHTNESS,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_POWER property for generic APIs
+ */
+enum {
+ PROP_POWER_CAPACITY, /**< Current remaining battery */
+ PROP_POWER_CAPACITY_RAW, /**< Current remaining battery expressed 1/10000 */
+ PROP_POWER_CHARGE_FULL, /**< Battery is full-charged.*/
+ PROP_POWER_CHARGE_NOW, /**< Battery is being charged now */
+ PROP_POWER_STATE,
+ PROP_POWER_WAKEUP_COUNT,
+ PROP_POWER_PRESENT,
+ PROP_POWER_HEALTH, /**< Battery status about cahrge */
+ PROP_POWER_INSUSPEND_CHARGING_SUPPORT,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_MEMORY property for generic APIs
+ */
+enum {
+ PROP_MEMORY_NODE,
+ PROP_MEMORY_VICTIM_TASK,
+ PROP_MEMORY_THRESHOLD_LV1,
+ PROP_MEMORY_THRESHOLD_LV2,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_CPU property for generic APIs
+ */
+enum {
+ PROP_CPU_CPUINFO_MAX_FREQ,
+ PROP_CPU_CPUINFO_MIN_FREQ,
+ PROP_CPU_SCALING_MAX_FREQ,
+ PROP_CPU_SCALING_MIN_FREQ,
+};
+
+/**
+ * @par Description:
+ * DEVICE_TYPE_PROCESS property for generic APIs
+ */
+enum {
+ PROP_PROCESS_NODE,
+ PROP_PROCESS_MP_PNP,
+ PROP_PROCESS_MP_VIP,
+};
+
+/**
+ * @fn int device_get_property(enum device_type devtype, int property, int *value)
+ * @par Description:
+ * This generic API is used to get the property values of supported devices.\n
+ * If the caller process does not have permission, it returns failure.
+ * @param[in] devtype device type that you want to get the value
+ * @param[in] property value property that you want to get the value
+ * @param[out] *value current value of device property
+ * @return 0 on success, -1 if failed
+ * @see device_set_property()
+ * @par Example:
+ * @code
+ * ...
+ * if( device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &val) < 0 )
+ * printf("Fail to get property\n");
+ * else
+ * printf("Property is %d\n", val);
+ * ...
+ * @endcode
+ */
+int device_get_property(enum device_type devtype, int property, int *value);
+
+/**
+ * @fn int device_set_property(enum device_type devtype, int property, int value)
+ * @par Description:
+ * This generic API is used to set the property values of supported devices.\n
+ * If the caller process does not have permission, it returns failure.
+ * @param[in] devtype device type that you want to set the value
+ * @param[in] property value property that you want to set the value
+ * @param[in] value value that you want to set
+ * @return 0 on success, -1 if failed
+ * @see device_get_property()
+ * @par Example
+ * @code
+ * ...
+ * if( device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_BRIGHTNESS, val) < 0 )
+ * printf("Fail to set property\n");
+ * else
+ * printf("Property is set %d\n", val);
+ * ...
+ * @endcode
+ */
+int device_set_property(enum device_type devtype, int property, int value);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/devman_plugin_intf.h b/include/devman_plugin_intf.h
new file mode 100644
index 0000000..7053c3a
--- /dev/null
+++ b/include/devman_plugin_intf.h
@@ -0,0 +1,175 @@
+/*
+ * device-node
+ * Copyright (c) 2012 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 __DEVMAN_PLUGIN_INTF_H__
+#define __DEVMAN_PLUGIN_INTF_H__
+
+enum {
+ STATUS_OFFLINE = 0,
+ STATUS_ONLINE,
+};
+
+enum {
+ STATUS_OFF = 0,
+ STATUS_ON,
+};
+
+enum {
+ PATH_CP = 0,
+ PATH_AP,
+};
+
+enum {
+ BATTERY_NOT_FULLY_CHARGED = 0,
+ BATTERY_FULLY_CHARGED,
+};
+
+enum {
+ BATTERY_UNKNOWN = 0,
+ BATTERY_GOOD,
+ BATTERY_OVERHEAT,
+ BATTERY_DEAD,
+ BATTERY_OVERVOLTAGE,
+ BATTERY_UNSPECIFIED,
+ BATTERY_COLD,
+ BATTERY_HEALTH_MAX,
+};
+
+enum {
+ POWER_STATE_SUSPEND = 0,
+ POWER_STATE_PRE_SUSPEND,
+ POWER_STATE_POST_RESUME,
+};
+
+enum {
+ LUX_DECREMENT,
+ LUX_NOCHANGE,
+ LUX_INCREMENT,
+};
+
+enum {
+ WM_MODE_MIN = 0x00,
+ WM_MODE_NORMAL = WM_MODE_MIN,
+ WM_MODE_CONSERVATIVE,
+ WM_MODE_MEDIUM,
+ WM_MODE_AGGRESSIVE,
+ WM_MODE_OUTDOOR,
+ WM_MODE_MAX = WM_MODE_OUTDOOR
+};
+
+typedef struct {
+ int (*OEM_sys_get_display_count) (int *value);
+
+ int (*OEM_sys_get_backlight_min_brightness) (int index, int *value);
+ int (*OEM_sys_get_backlight_max_brightness) (int index, int *value);
+ int (*OEM_sys_get_backlight_brightness) (int index, int *value, int power_saving);
+ int (*OEM_sys_set_backlight_brightness) (int index, int value, int power_saving);
+
+ int (*OEM_sys_set_backlight_dimming) (int index, int value);
+
+ int (*OEM_sys_get_backlight_acl_control) (int index, int *value);
+ int (*OEM_sys_set_backlight_acl_control) (int index, int value);
+
+ int (*OEM_sys_get_lcd_power) (int index, int *value);
+ int (*OEM_sys_set_lcd_power) (int index, int value);
+
+ int (*OEM_sys_get_image_enhance_mode) (int *value);
+ int (*OEM_sys_set_image_enhance_mode) (int value);
+ int (*OEM_sys_get_image_enhance_scenario) (int *value);
+ int (*OEM_sys_set_image_enhance_scenario) (int value);
+ int (*OEM_sys_get_image_enhance_tone) (int *value);
+ int (*OEM_sys_set_image_enhance_tone) (int value);
+ int (*OEM_sys_get_image_enhance_outdoor) (int *value);
+ int (*OEM_sys_set_image_enhance_outdoor) (int value);
+
+ int (*OEM_sys_get_image_enhance_tune) (int *value);
+ int (*OEM_sys_set_image_enhance_tune) (int value);
+
+ int (*OEM_sys_image_enhance_info) (int *value);
+
+ int (*OEM_sys_set_display_frame_rate) (int value);
+
+ int (*OEM_sys_get_uart_path) (int *value);
+ int (*OEM_sys_set_uart_path) (int value);
+
+ int (*OEM_sys_get_usb_path) (int *value);
+ int (*OEM_sys_set_usb_path) (int value);
+
+ int (*OEM_sys_get_haptic_vibetones_level_max) (int *value);
+ int (*OEM_sys_get_haptic_vibetones_level) (int *value);
+ int (*OEM_sys_set_haptic_vibetones_level) (int value);
+ int (*OEM_sys_set_haptic_vibetones_enable) (int value);
+ int (*OEM_sys_set_haptic_vibetones_oneshot) (int value);
+
+ int (*OEM_sys_get_battery_capacity) (int *value);
+ int (*OEM_sys_get_battery_capacity_raw) (int *value);
+ int (*OEM_sys_get_battery_charge_full) (int *value);
+ int (*OEM_sys_get_battery_charge_now) (int *value);
+ int (*OEM_sys_get_battery_present) (int *value);
+ int (*OEM_sys_get_battery_health) (int *value);
+ int (*OEM_sys_get_battery_polling_required) (int *value);
+ int (*OEM_sys_get_battery_support_insuspend_charging) (int *value);
+
+ int (*OEM_sys_get_jack_charger_online) (int *value);
+ int (*OEM_sys_get_jack_earjack_online) (int *value);
+ int (*OEM_sys_get_jack_earkey_online) (int *value);
+ int (*OEM_sys_get_jack_hdmi_online) (int *value);
+ int (*OEM_sys_get_jack_usb_online) (int *value);
+ int (*OEM_sys_get_jack_cradle_online) (int *value);
+ int (*OEM_sys_get_jack_tvout_online) (int *value);
+ int (*OEM_sys_get_jack_keyboard_online) (int *value);
+
+ int (*OEM_sys_get_leds_torch_max_brightness) (int *value);
+ int (*OEM_sys_get_leds_torch_brightness) (int *value);
+ int (*OEM_sys_set_leds_torch_brightness) (int value);
+
+ /* TODO: Change args type */
+ int (*OEM_sys_set_power_state) (int value);
+
+ /* TODO: Should determine enum values of wakeup_count nodes */
+ int (*OEM_sys_get_power_wakeup_count) (int *value);
+ int (*OEM_sys_set_power_wakeup_count) (int value);
+
+ int (*OEM_sys_get_memnotify_node) (char *node);
+ int (*OEM_sys_get_memnotify_victim_task) (int *value);
+ int (*OEM_sys_set_memnotify_threshold_lv1) (int value);
+ int (*OEM_sys_set_memnotify_threshold_lv2) (int value);
+
+ int (*OEM_sys_get_process_monitor_node) (char *node);
+ int (*OEM_sys_set_process_monitor_mp_pnp) (int value);
+ int (*OEM_sys_set_process_monitor_mp_vip) (int value);
+
+ int (*OEM_sys_get_cpufreq_cpuinfo_max_freq) (int *value);
+ int (*OEM_sys_get_cpufreq_cpuinfo_min_freq) (int *value);
+ int (*OEM_sys_get_cpufreq_scaling_max_freq) (int *value);
+ int (*OEM_sys_set_cpufreq_scaling_max_freq) (int value);
+ int (*OEM_sys_get_cpufreq_scaling_min_freq) (int *value);
+ int (*OEM_sys_set_cpufreq_scaling_min_freq) (int value);
+
+ int (*OEM_sys_get_backlight_brightness_by_lux) (int lux);
+
+ int (*OEM_sys_get_whitemagic_mode) (int index, int *value);
+ int (*OEM_sys_set_whitemagic_mode) (int index, int value);
+
+ int (*OEM_sys_get_hdmi_support) (int *value);
+
+} OEM_sys_devman_plugin_interface;
+
+const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_interface();
+
+#endif /* __DEVMAN_PLUGIN_INTF_H__ */