hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/linux/power/charger-manager.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
34 * MyungJoo.Ham <myungjoo.ham@samsung.com>
....@@ -7,9 +8,6 @@
78 * monitor charging even in the context of suspend-to-RAM with
89 * an interface combining the chargers.
910 *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1311 **/
1412
1513 #ifndef _CHARGER_MANAGER_H
....@@ -33,22 +31,16 @@
3331 CM_POLL_CHARGING_ONLY,
3432 };
3533
36
-enum cm_event_types {
37
- CM_EVENT_UNKNOWN = 0,
38
- CM_EVENT_BATT_FULL,
39
- CM_EVENT_BATT_IN,
40
- CM_EVENT_BATT_OUT,
41
- CM_EVENT_BATT_OVERHEAT,
42
- CM_EVENT_BATT_COLD,
43
- CM_EVENT_EXT_PWR_IN_OUT,
44
- CM_EVENT_CHG_START_STOP,
45
- CM_EVENT_OTHERS,
34
+enum cm_batt_temp {
35
+ CM_BATT_OK = 0,
36
+ CM_BATT_OVERHEAT,
37
+ CM_BATT_COLD,
4638 };
4739
4840 /**
4941 * struct charger_cable
5042 * @extcon_name: the name of extcon device.
51
- * @name: the name of charger cable(external connector).
43
+ * @name: the name of the cable connector
5244 * @extcon_dev: the extcon device.
5345 * @wq: the workqueue to control charger according to the state of
5446 * charger cable. If charger cable is attached, enable charger.
....@@ -64,9 +56,10 @@
6456 struct charger_cable {
6557 const char *extcon_name;
6658 const char *name;
59
+ struct extcon_dev *extcon_dev;
60
+ u64 extcon_type;
6761
6862 /* The charger-manager use Extcon framework */
69
- struct extcon_specific_cable_nb extcon_dev;
7063 struct work_struct wq;
7164 struct notifier_block nb;
7265
....@@ -119,7 +112,7 @@
119112 struct charger_cable *cables;
120113 int num_cables;
121114
122
- struct attribute_group attr_g;
115
+ struct attribute_group attr_grp;
123116 struct device_attribute attr_name;
124117 struct device_attribute attr_state;
125118 struct device_attribute attr_externally_control;
....@@ -133,11 +126,10 @@
133126 * @psy_name: the name of power-supply-class for charger manager
134127 * @polling_mode:
135128 * Determine which polling mode will be used
136
- * @fullbatt_vchkdrop_ms:
137129 * @fullbatt_vchkdrop_uV:
138130 * Check voltage drop after the battery is fully charged.
139
- * If it has dropped more than fullbatt_vchkdrop_uV after
140
- * fullbatt_vchkdrop_ms, CM will restart charging.
131
+ * If it has dropped more than fullbatt_vchkdrop_uV
132
+ * CM will restart charging.
141133 * @fullbatt_uV: voltage in microvolt
142134 * If VBATT >= fullbatt_uV, it is assumed to be full.
143135 * @fullbatt_soc: state of Charge in %
....@@ -174,7 +166,6 @@
174166 enum polling_modes polling_mode;
175167 unsigned int polling_interval_ms;
176168
177
- unsigned int fullbatt_vchkdrop_ms;
178169 unsigned int fullbatt_vchkdrop_uV;
179170 unsigned int fullbatt_uV;
180171 unsigned int fullbatt_soc;
....@@ -186,6 +177,7 @@
186177
187178 int num_charger_regulators;
188179 struct charger_regulator *charger_regulators;
180
+ const struct attribute_group **sysfs_groups;
189181
190182 const char *psy_fuel_gauge;
191183
....@@ -212,9 +204,6 @@
212204 * @charger_stat: array of power_supply for chargers
213205 * @tzd_batt : thermal zone device for battery
214206 * @charger_enabled: the state of charger
215
- * @fullbatt_vchk_jiffies_at:
216
- * jiffies at the time full battery check will occur.
217
- * @fullbatt_vchk_work: work queue for full battery check
218207 * @emergency_stop:
219208 * When setting true, stop charging
220209 * @psy_name_buf: the name of power-supply-class for charger manager
....@@ -225,6 +214,7 @@
225214 * saved status of battery before entering suspend-to-RAM
226215 * @charging_start_time: saved start time of enabling charging
227216 * @charging_end_time: saved end time of disabling charging
217
+ * @battery_status: Current battery status
228218 */
229219 struct charger_manager {
230220 struct list_head entry;
....@@ -236,9 +226,6 @@
236226 #endif
237227 bool charger_enabled;
238228
239
- unsigned long fullbatt_vchk_jiffies_at;
240
- struct delayed_work fullbatt_vchk_work;
241
-
242229 int emergency_stop;
243230
244231 char psy_name_buf[PSY_NAME_MAX + 1];
....@@ -247,13 +234,8 @@
247234
248235 u64 charging_start_time;
249236 u64 charging_end_time;
237
+
238
+ int battery_status;
250239 };
251240
252
-#ifdef CONFIG_CHARGER_MANAGER
253
-extern void cm_notify_event(struct power_supply *psy,
254
- enum cm_event_types type, char *msg);
255
-#else
256
-static inline void cm_notify_event(struct power_supply *psy,
257
- enum cm_event_types type, char *msg) { }
258
-#endif
259241 #endif /* _CHARGER_MANAGER_H */