4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
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.
21 #include <device-node.h>
24 #include "core/data.h"
25 #include "core/devices.h"
26 #include "display/poll.h"
27 #include "core/common.h"
31 enum ta_connect_status{
36 static int __check_insuspend_charging(void)
40 ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_INSUSPEND_CHARGING_SUPPORT, &val);
44 ret = pm_lock_internal(INTERNAL_LOCK_TA, LCD_OFF, STAY_CUR_STATE, 0);
50 static void ta_init(void *data)
55 if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_TA_ONLINE, &val) != 0)
58 if (val == TA_ONLINE) {
59 vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
60 VCONFKEY_SYSMAN_CHARGER_CONNECTED);
62 && __check_insuspend_charging() == -1) {
66 } else if (val == TA_OFFLINE) {
67 vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
68 VCONFKEY_SYSMAN_CHARGER_DISCONNECTED);
72 static const struct device_ops ta_device_ops = {
73 .priority = DEVICE_PRIORITY_NORMAL,
78 DEVICE_OPS_REGISTER(&ta_device_ops)