This adds current_event variable to the struct otg_bc_cap. The current_event allows...
authorHao Wu <hao.wu@intel.com>
Thu, 25 Aug 2011 11:20:35 +0000 (12:20 +0100)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:38:27 +0000 (12:38 -0800)
Change-Id: Id6a7c412d769bc9bcc6c0358838a9a4e13e588db
Signed-off-by: Hao Wu <hao.wu@intel.com>
[Rewrote the commit message]
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
drivers/usb/otg/penwell_otg.c
include/linux/usb/penwell_otg.h

index 890dcc7..d639263 100644 (file)
@@ -264,6 +264,7 @@ static void _penwell_otg_update_chrg_cap(enum usb_charger_type charger,
 
        if (flag) {
                pnw->charging_cap.mA = mA;
+               pnw->charging_cap.current_event = event;
 
                /* Notify EM the charging current update */
                dev_dbg(pnw->dev, "Notify EM charging capability change\n");
@@ -333,6 +334,7 @@ int penwell_otg_query_charging_cap(struct otg_bc_cap *cap)
        spin_lock_irqsave(&pnw->charger_lock, flags);
        cap->chrg_type = pnw->charging_cap.chrg_type;
        cap->mA = pnw->charging_cap.mA;
+       cap->current_event = pnw->charging_cap.current_event;
        spin_unlock_irqrestore(&pnw->charger_lock, flags);
 
        dev_dbg(pnw->dev, "%s <---\n", __func__);
@@ -2577,6 +2579,7 @@ static int penwell_otg_probe(struct pci_dev *pdev,
        spin_lock_init(&pnw->charger_lock);
        pnw->charging_cap.mA = CHRG_CURR_DISCONN;
        pnw->charging_cap.chrg_type = CHRG_UNKNOWN;
+       pnw->charging_cap.current_event = USBCHRG_EVENT_DISCONN;
 
        ATOMIC_INIT_NOTIFIER_HEAD(&pnw->iotg.iotg_notifier);
 
index 77776ca..90d4652 100644 (file)
@@ -275,6 +275,7 @@ struct otg_bc_cap {
 #define CHRG_CURR_CDP_HS       950
 #define CHRG_CURR_DCP  1500
 #define CHRG_CURR_ACA  1500
+       unsigned int            current_event;
 };
 
 /* define event ids to notify battery driver */