From: Madhusudhan Chikkature<[EMAIL PROTECTED]>

This patch calls the functionality supported by the TWL4030 battery charger
interface driver
to enable/disable battery charging upon cable attach/detach.

Signed-off-by: Madhusudhan Chikkature<[EMAIL PROTECTED]>
---
 drivers/i2c/chips/twl4030-usb.c |    7 +++++--
 include/linux/i2c/twl4030.h     |    7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

Index: linux-omap-2.6/drivers/i2c/chips/twl4030-usb.c
===================================================================
--- linux-omap-2.6.orig/drivers/i2c/chips/twl4030-usb.c 2008-07-03
16:09:05.000000000 +0530
+++ linux-omap-2.6/drivers/i2c/chips/twl4030-usb.c      2008-07-03
17:03:30.000000000 +0530
@@ -601,10 +601,13 @@ static irqreturn_t twl4030_usb_irq(int i
                goto done;
        }

-       if (val & USB_PRES_RISING)
+       if (val & USB_PRES_RISING) {
                twl4030_phy_resume();
-       else
+               twl4030charger_usb_en(1);
+       } else {
+               twl4030charger_usb_en(0);
                twl4030_phy_suspend(0);
+       }

        ret = IRQ_HANDLED;

Index: linux-omap-2.6/include/linux/i2c/twl4030.h
===================================================================
--- linux-omap-2.6.orig/include/linux/i2c/twl4030.h     2008-07-03
16:09:05.000000000 +0530
+++ linux-omap-2.6/include/linux/i2c/twl4030.h  2008-07-03 17:03:30.000000000 
+0530
@@ -127,4 +127,11 @@ int twl4030_set_gpio_edge_ctrl(int gpio,
 int twl4030_set_gpio_debounce(int gpio, int enable);
 int twl4030_free_gpio(int gpio);

+#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
+       defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
+       extern int twl4030charger_usb_en(int enable);
+#else
+       static inline int twl4030charger_usb_en(int enable) { return 0; }
+#endif
+
 #endif /* End of __TWL4030_H */


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to