battery.temperature = atoi(env_value) / 10;
}
-static void update_capacity_full(void)
-{
- static int old;
- int delta;
-
- if (battery.charger_connected == 0 ||
- old == 0 ||
- old >= battery.capacity) {
- old = battery.capacity;
- return;
- }
- delta = battery.capacity - old;
- old = battery.capacity;
- extcon_update_count(EXTCON_BATTERY_FULL, delta);
-}
-
-static void update_battery_cycle(void)
-{
- static int first = 1;
- static int old;
- int delta;
-
- if (first) {
- first = 0;
- extcon_update_count(EXTCON_BATTERY_CYCLE, 0);
- return;
- }
-
- if (battery.charger_connected == 1 ||
- old == 0 ||
- old <= battery.capacity) {
- old = battery.capacity;
- return;
- }
- delta = old - battery.capacity;
- old = battery.capacity;
- extcon_update_count(EXTCON_BATTERY_CYCLE, delta);
-}
-
static void process_power_supply(void *data)
{
bool broadcasted = true;
device_notify(DEVICE_NOTIFIER_BATTERY_CHARGING, &battery.charge_now);
old_battery.charge_now = battery.charge_now;
}
- update_capacity_full();
- update_battery_cycle();
if (disp_plgn->pm_unlock_internal) {
if (ret_lock == 0) {
if (status != EARJACK_DICONNECTED) {
if (disp_plgn->pm_change_internal)
disp_plgn->pm_change_internal(INTERNAL_LOCK_EARJACK, LCD_NORMAL);
-
- extcon_update_count(EXTCON_EARJACK, 1);
}
return 0;
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2019 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.
- */
-
-#ifndef __EXTCON_COUNT_H__
-#define __EXTCON_COUNT_H__
-
-#include "shared/common.h"
-
-typedef enum {
- EXTCON_TA = 0,
- EXTCON_EARJACK,
- EXTCON_BATTERY_FULL,
- EXTCON_BATTERY_CYCLE,
-} extcon_index_type_e;
-
-struct extcon_notifier {
- extcon_index_type_e index;
- unsigned long count;
-};
-
-#endif /* __EXTCON_COUNT_H__ */
return dev->status;
}
-void extcon_update_count(extcon_index_type_e index, unsigned long count)
-{
- struct extcon_notifier extcon;
- extcon.index = index;
- extcon.count = count;
-
- device_notify(DEVICE_NOTIFIER_EXTCON_COUNT, (void *)&extcon);
-}
-
static int extcon_update(const char *name, const char *index, const char *value)
{
struct extcon_ops *dev;
#include "shared/common.h"
#include <libsyscommon/list.h>
#include <hal/device/hal-external_connection.h>
-#include "extcon-count.h"
/**
* Extcon cable name is shared with kernel extcon class.
int extcon_get_status(const char *name);
int extcon_enable_device(const char *name);
int extcon_disable_device(const char *name);
-void extcon_update_count(extcon_index_type_e index, unsigned long count);
#endif /* __EXTCON_H__ */
NOTIFY_STR(DEVICE_NOTIFIER_BEZEL_WAKEUP),
NOTIFY_STR(DEVICE_NOTIFIER_DISPLAY_BRIGHTNESS),
NOTIFY_STR(DEVICE_NOTIFIER_ULTRAPOWERSAVING),
- NOTIFY_STR(DEVICE_NOTIFIER_EXTCON_COUNT),
NOTIFY_STR(DEVICE_NOTIFIER_KEY_PRESS),
NOTIFY_STR(DEVICE_NOTIFIER_KEY_RELEASE),
NOTIFY_STR(DEVICE_NOTIFIER_EVENT_ACQUIRE_WAKELOCK),
DEVICE_NOTIFIER_BEZEL_WAKEUP,
DEVICE_NOTIFIER_DISPLAY_BRIGHTNESS,
DEVICE_NOTIFIER_ULTRAPOWERSAVING,
- DEVICE_NOTIFIER_EXTCON_COUNT,
DEVICE_NOTIFIER_KEY_PRESS,
DEVICE_NOTIFIER_KEY_RELEASE,
DEVICE_NOTIFIER_EVENT_ACQUIRE_WAKELOCK,