History

charger-manager: Use EXTCON Subsystem to detect charger cables for charging

This patch support that charger-manager use EXTCON(External Connector) Subsystem to detect the state of charger cables for enabling or disabling charger(regulator) and select the charger cable for charging among a number of external cable according to policy of H/W board.

Chanwoo Choi committed 14 years ago

Commit bee737b1 parent 85a392d2 files · +179 −17Browse files

Showing the changes to include/linux/power (1 of 2 files). Show all

Unified · Split

include/linux/power/charger-manager.h+58−1
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #define _CHARGER_MANAGER_H
1717
1818 #include <linux/power_supply.h>
19+#include <linux/extcon.h>
1920
2021 enum data_source {
2122 CM_BATTERY_PRESENT,
@@ -64,6 +65,62 @@ struct charger_global_desc { · 42 unmodified lines
6465 bool assume_timer_stops_in_suspend;
6566 };
6667
68+/**
69+ * struct charger_cable
70+ * @extcon_name: the name of extcon device.
71+ * @name: the name of charger cable(external connector).
72+ * @extcon_dev: the extcon device.
73+ * @wq: the workqueue to control charger according to the state of
74+ * charger cable. If charger cable is attached, enable charger.
75+ * But if charger cable is detached, disable charger.
76+ * @nb: the notifier block to receive changed state from EXTCON
77+ * (External Connector) when charger cable is attached/detached.
78+ * @attached: the state of charger cable.
79+ * true: the charger cable is attached
80+ * false: the charger cable is detached
81+ * @charger: the instance of struct charger_regulator.
82+ * @cm: the Charger Manager representing the battery.
83+ */
84+struct charger_cable {
85+ const char *extcon_name;
86+ const char *name;
87+
88+ /* The charger-manager use Exton framework*/
89+ struct extcon_specific_cable_nb extcon_dev;
90+ struct work_struct wq;
91+ struct notifier_block nb;
92+
93+ /* The state of charger cable */
94+ bool attached;
95+
96+ struct charger_regulator *charger;
97+ struct charger_manager *cm;
98+};
99+
100+/**
101+ * struct charger_regulator
102+ * @regulator_name: the name of regulator for using charger.
103+ * @consumer: the regulator consumer for the charger.
104+ * @cables:
105+ * the array of charger cables to enable/disable charger
106+ * and set current limit according to constratint data of
107+ * struct charger_cable if only charger cable included
108+ * in the array of charger cables is attached/detached.
109+ * @num_cables: the number of charger cables.
110+ */
111+struct charger_regulator {
112+ /* The name of regulator for charging */
113+ const char *regulator_name;
114+ struct regulator *consumer;
115+
116+ /*
117+ * Store constraint information related to current limit,
118+ * each cable have different condition for charging.
119+ */
120+ struct charger_cable *cables;
121+ int num_cables;
122+};
123+
67124 /**
68125 * struct charger_desc
69126 * @psy_name: the name of power-supply-class for charger manager
@@ -109,7 +166,7 @@ struct charger_desc { · 39 unmodified lines
109166 char **psy_charger_stat;
110167
111168 int num_charger_regulators;
112− struct regulator_bulk_data *charger_regulators;
169+ struct charger_regulator *charger_regulators;
113170
114171 char *psy_fuel_gauge;
115172

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t