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/devices.h"
25 #include "display/poll.h"
26 #include "core/common.h"
30 enum ta_connect_status{
35 static int __check_insuspend_charging(void)
39 ret = device_get_property(DEVICE_TYPE_POWER, PROP_POWER_INSUSPEND_CHARGING_SUPPORT, &val);
43 ret = pm_lock_internal(INTERNAL_LOCK_TA, LCD_OFF, STAY_CUR_STATE, 0);
49 static void ta_init(void *data)
54 if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_TA_ONLINE, &val) != 0)
57 if (val == TA_ONLINE) {
58 vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
59 VCONFKEY_SYSMAN_CHARGER_CONNECTED);
61 && __check_insuspend_charging() == -1) {
65 } else if (val == TA_OFFLINE) {
66 vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
67 VCONFKEY_SYSMAN_CHARGER_DISCONNECTED);
71 static const struct device_ops ta_device_ops = {
72 .priority = DEVICE_PRIORITY_NORMAL,
77 DEVICE_OPS_REGISTER(&ta_device_ops)