summaryrefslogtreecommitdiff
path: root/devices/led.c
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 /devices/led.c
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 'devices/led.c')
-rw-r--r--devices/led.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/devices/led.c b/devices/led.c
new file mode 100644
index 0000000..925b306
--- /dev/null
+++ b/devices/led.c
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+
+#include <stdio.h>
+#include "device-internal.h"
+
+static int led_get_prop(int prop, int *val)
+{
+ switch (prop) {
+ case PROP_LED_MAX_BRIGHTNESS:
+ return PLUGIN_GET(leds_torch_max_brightness)(val);
+ case PROP_LED_BRIGHTNESS:
+ return PLUGIN_GET(leds_torch_brightness)(val);
+ }
+
+ return -1;
+}
+
+static int led_set_prop(int prop, int val)
+{
+ switch (prop) {
+ case PROP_LED_BRIGHTNESS:
+ return PLUGIN_SET(leds_torch_brightness)(val);
+ }
+
+ return -1;
+}
+
+static const struct device led = {
+ .name = "led",
+ .set_prop = led_set_prop,
+ .get_prop = led_get_prop,
+ .type = DEVICE_TYPE_LED,
+};
+
+static void __CONSTRUCTOR__ module_init(void)
+{
+ add_device(&(led.type));
+}
+
+static void __DESTRUCTOR__ module_fini(void)
+{
+ remove_device(&(led.type));
+}