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.
20 #ifndef __BATTERY_OPS_H__
21 #define __BATTERY_OPS_H__
24 #include "shared/common.h"
25 #include "power-supply.h"
26 #include <libsyscommon/libgdbus.h>
30 void (*init) (void *data);
31 void (*exit) (void *data);
32 int (*func) (unsigned int cmd, void *arg);
35 struct battery_plugin {
38 void (*launch_health_popup_by_display_state) (int display_state);
39 int (*check_power_supply_noti) (void);
40 /* Add plugins here */
43 void add_battery(const struct battery_ops *batt);
44 void remove_battery(const struct battery_ops *batt);
45 const struct battery_ops *find_battery_feature(const char *name);
47 void battery_ops_init(void *data);
48 void battery_ops_exit(void *data);
50 #define BATTERY_OPS_REGISTER(batt) \
51 static void __CONSTRUCTOR__ module_init(void) \
55 static void __DESTRUCTOR__ module_exit(void) \
57 remove_battery(batt); \
60 #define FIND_BATTERY(dev, name) do { \
61 if (!dev) dev = find_battery_feature(name); \