Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320498
b: refs/heads/master
c: 45cd4fb
h: refs/heads/master
v: v3
  • Loading branch information
Chanwoo Choi authored and Anton Vorontsov committed Jul 14, 2012
1 parent d5496ef commit dd92ab8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bee737bccb03ebd27f2d52706e9aed2fa2c8dcc4
refs/heads/master: 45cd4fb28b43756afcd752ed1e8b3b836c1b1a2a
15 changes: 15 additions & 0 deletions trunk/drivers/power/charger-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,21 @@ static void charger_extcon_work(struct work_struct *work)
{
struct charger_cable *cable =
container_of(work, struct charger_cable, wq);
int ret;

if (cable->attached && cable->min_uA != 0 && cable->max_uA != 0) {
ret = regulator_set_current_limit(cable->charger->consumer,
cable->min_uA, cable->max_uA);
if (ret < 0) {
pr_err("Cannot set current limit of %s (%s)\n",
cable->charger->regulator_name, cable->name);
return;
}

pr_info("Set current limit of %s : %duA ~ %duA\n",
cable->charger->regulator_name,
cable->min_uA, cable->max_uA);
}

try_charger_enable(cable->cm, cable->attached);
}
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/linux/power/charger-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ struct charger_cable {
bool attached;

struct charger_regulator *charger;

/*
* Set min/max current of regulator to protect over-current issue
* according to a kind of charger cable when cable is attached.
*/
int min_uA;
int max_uA;

struct charger_manager *cm;
};

Expand Down

0 comments on commit dd92ab8

Please sign in to comment.