Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242588
b: refs/heads/master
c: b5db7cd
h: refs/heads/master
v: v3
  • Loading branch information
Anton Vorontsov committed Feb 28, 2011
1 parent 00325f9 commit 1b5c9e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9e912f452931b3da9d13d716a381ba0d5fb74ced
refs/heads/master: b5db7cde69f87178fb771970a2b512a452a9d680
25 changes: 19 additions & 6 deletions trunk/drivers/power/twl4030_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ struct twl4030_bci {
struct power_supply usb;
struct otg_transceiver *transceiver;
struct notifier_block otg_nb;
struct work_struct work;
int irq_chg;
int irq_bci;

unsigned long event;
};

/*
Expand Down Expand Up @@ -258,14 +261,11 @@ static irqreturn_t twl4030_bci_interrupt(int irq, void *arg)
return IRQ_HANDLED;
}

static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
void *priv)
static void twl4030_bci_usb_work(struct work_struct *data)
{
struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);
struct twl4030_bci *bci = container_of(data, struct twl4030_bci, work);

dev_dbg(bci->dev, "OTG notify %lu\n", val);

switch (val) {
switch (bci->event) {
case USB_EVENT_VBUS:
case USB_EVENT_CHARGER:
twl4030_charger_enable_usb(bci, true);
Expand All @@ -274,6 +274,17 @@ static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
twl4030_charger_enable_usb(bci, false);
break;
}
}

static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
void *priv)
{
struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb);

dev_dbg(bci->dev, "OTG notify %lu\n", val);

bci->event = val;
schedule_work(&bci->work);

return NOTIFY_OK;
}
Expand Down Expand Up @@ -466,6 +477,8 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
goto fail_bci_irq;
}

INIT_WORK(&bci->work, twl4030_bci_usb_work);

bci->transceiver = otg_get_transceiver();
if (bci->transceiver != NULL) {
bci->otg_nb.notifier_call = twl4030_bci_usb_ncb;
Expand Down

0 comments on commit 1b5c9e3

Please sign in to comment.