4 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include "core/devices.h"
20 #include "core/common.h"
26 static char *touchscreen_node;
29 * touchscreen_init - Initialize Touchscreen module
31 static void touchscreen_init(void *data)
36 touchscreen_node = getenv("PM_TOUCHSCREEN");
37 _D("touchscreen node : %s", touchscreen_node);
40 static int touchscreen_start(enum device_flags flags)
44 touchscreen_init((void *)NORMAL_MODE);
45 if (!touchscreen_node)
48 if (flags & TOUCH_SCREEN_OFF_MODE)
51 ret = sys_set_int(touchscreen_node, TOUCH_ON);
53 _E("Failed to on touch screen!");
58 static int touchscreen_stop(enum device_flags flags)
62 touchscreen_init((void *)NORMAL_MODE);
63 if (!touchscreen_node)
66 if (flags & AMBIENT_MODE)
69 ret = sys_set_int(touchscreen_node, TOUCH_OFF);
71 _E("Failed to off touch screen!");
76 static const struct device_ops touchscreen_device_ops = {
77 .priority = DEVICE_PRIORITY_NORMAL,
78 .name = "touchscreen",
79 .init = touchscreen_init,
80 .start = touchscreen_start,
81 .stop = touchscreen_stop,
84 DEVICE_OPS_REGISTER(&touchscreen_device_ops)