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
16#define _CHARGER_MANAGER_H16#define _CHARGER_MANAGER_H
17 17
18#include <linux/power_supply.h>18#include <linux/power_supply.h>
19#include <linux/extcon.h>
19 20
20enum data_source {21enum data_source {
21 CM_BATTERY_PRESENT,22 CM_BATTERY_PRESENT,
@@ -64,6 +65,62 @@ struct charger_global_desc { · 42 unmodified lines
64 bool assume_timer_stops_in_suspend;65 bool assume_timer_stops_in_suspend;
65};66};
66 67
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 */
84struct 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 */
111struct 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
67/**124/**
68 * struct charger_desc125 * struct charger_desc
69 * @psy_name: the name of power-supply-class for charger manager126 * @psy_name: the name of power-supply-class for charger manager
@@ -109,7 +166,7 @@ struct charger_desc { · 39 unmodified lines
109 char **psy_charger_stat;166 char **psy_charger_stat;
110 167
111 int num_charger_regulators;168 int num_charger_regulators;
112 struct regulator_bulk_data *charger_regulators;169 struct charger_regulator *charger_regulators;
113 170
114 char *psy_fuel_gauge;171 char *psy_fuel_gauge;
115 172

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