2 * battery-charger-gauge-comm.h -- Communication APIS between battery charger
3 * and battery gauge driver.
5 * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
7 * Author: Laxman Dewangan <ldewangan@nvidia.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
14 * whether express or implied; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #ifndef _LINUX_POWER_BATTERY_CHARGER_GAUGE_COMM_H
25 #define _LINUX_POWER_BATTERY_CHARGER_GAUGE_COMM_H
27 #define BATTERY_SNAPSHOT_INTERVAL 2*HZ
29 enum battery_charger_status {
32 BATTERY_CHARGING_DONE,
35 struct battery_gauge_dev;
36 struct battery_charger_dev;
38 struct battery_gauge_ops {
39 int (*update_battery_status)(struct battery_gauge_dev *bg_device,
40 enum battery_charger_status status);
41 int (*set_current_broadcast) (struct battery_gauge_dev *bg_device);
42 int (*get_battery_temp)(void);
45 struct battery_charging_ops {
46 int (*get_charging_status)(struct battery_charger_dev *bc_dev);
47 int (*restart_charging)(struct battery_charger_dev *bc_dev);
48 int (*thermal_configure)(struct battery_charger_dev *bct_dev,
49 int temp, bool enable_charger, bool enable_charg_half_current,
51 int (*input_voltage_configure)(struct battery_charger_dev *bc_dev,
55 struct battery_charger_info {
59 bool enable_thermal_monitor;
60 struct battery_charging_ops *bc_ops;
63 struct battery_gauge_info {
66 const char *current_channel_name;
67 struct battery_gauge_ops *bg_ops;
70 struct battery_charger_dev *battery_charger_register(struct device *dev,
71 struct battery_charger_info *bci, void *drv_data);
72 void battery_charger_unregister(struct battery_charger_dev *bc_dev);
73 int battery_charging_status_update(struct battery_charger_dev *bc_dev,
74 enum battery_charger_status status);
75 int battery_charging_restart(struct battery_charger_dev *bc_dev, int after_sec);
76 void battery_charging_restart_cancel(struct battery_charger_dev *bc_dev);
77 int battery_charger_thermal_start_monitoring(
78 struct battery_charger_dev *bc_dev);
79 int battery_charger_thermal_stop_monitoring(
80 struct battery_charger_dev *bc_dev);
81 int battery_charger_acquire_wake_lock(struct battery_charger_dev *bc_dev);
82 int battery_charger_release_wake_lock(struct battery_charger_dev *bc_dev);
84 int battery_charging_wakeup(struct battery_charger_dev *bc_dev, int after_sec);
85 int battery_charging_system_reset_after(struct battery_charger_dev *bc_dev,
87 int battery_charging_system_power_on_usb_event(
88 struct battery_charger_dev *bc_dev);
89 int battery_gauge_get_battery_temperature(struct battery_gauge_dev *bg_dev,
91 int battery_gauge_get_battery_current(struct battery_gauge_dev *bg_dev,
93 int battery_charger_set_current_broadcast(struct battery_charger_dev *bc_dev);
94 struct battery_gauge_dev *battery_gauge_register(struct device *dev,
95 struct battery_gauge_info *bgi, void *drv_data);
96 void battery_gauge_unregister(struct battery_gauge_dev *bg_dev);
98 void *battery_charger_get_drvdata(struct battery_charger_dev *bc_dev);
99 void battery_charger_set_drvdata(struct battery_charger_dev *bc_dev,
101 void *battery_gauge_get_drvdata(struct battery_gauge_dev *bg_dev);
102 void battery_gauge_set_drvdata(struct battery_gauge_dev *bg_dev, void *data);
103 int battery_gauge_record_voltage_value(struct battery_gauge_dev *bg_dev,
105 int battery_gauge_record_capacity_value(struct battery_gauge_dev *bg_dev,
107 int battery_gauge_record_snapshot_values(struct battery_gauge_dev *bg_dev,
109 int battery_gauge_get_scaled_soc(struct battery_gauge_dev *bg_dev,
110 int actual_soc_semi, int thresod_soc);
111 int battery_gauge_get_adjusted_soc(struct battery_gauge_dev *bg_dev,
112 int min_soc, int max_soc, int actual_soc_semi);
113 int battery_gauge_report_battery_soc(struct battery_gauge_dev *bg_dev,
116 #endif /* _LINUX_POWER_BATTERY_CHARGER_GAUGE_COMM_H */