4 * Copyright (c) 2013 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.
24 #include "touch-controller.h"
26 #include "core/devices.h"
27 #include "core/common.h"
29 void touch_boost_enable(struct touch_control *touch_control,
30 enum touch_type type, enum touch_boost_state state)
37 touch_control->mask |= (1 << type);
40 touch_control->mask &= ~(1 << type);
43 _E("Unknow touch boost state");
48 * Touch should update touch_control->cur_state after updating
49 * touch_control->mask variable because Touch need what some module
50 * turn on/off touch boost feature.
52 if (touch_control->cur_state == state)
56 case TOUCH_TYPE_VCONF_SIP:
57 set_cpufreq_touch_boost_off(state);
60 _E("Unknow touch type");
64 touch_control->cur_state = state;
66 _I("Touch Boost is %s", state == TOUCH_BOOST_ON ? "ON" : "OFF");
69 /* Define global variable of struct touch_control */
70 static struct touch_control touch_control;
72 static int touch_stop(enum device_flags flags)
74 /* Restore touch boost state as ON state */
75 set_cpufreq_touch_boost_off(TOUCH_BOOST_ON);
77 touch_controller_stop();
84 static int touch_start(enum device_flags flags)
88 /* Touch Boost is default on state */
89 touch_control.cur_state = TOUCH_BOOST_ON;
91 for (i = 0; i < TOUCH_TYPE_MAX; i++)
92 touch_control.mask |= (1 << i);
94 touch_controller_start();
102 * touch_init - Initialize Touch module
104 static void touch_init(void *data)
106 touch_controller_init(&touch_control);
110 * touch_exit - Exit Touch module
112 static void touch_exit(void *data)
114 touch_controller_exit();
117 static const struct device_ops touch_device_ops = {
118 .priority = DEVICE_PRIORITY_NORMAL,
122 .start = touch_start,
126 DEVICE_OPS_REGISTER(&touch_device_ops)