From 7d3cfe37174feb905b2c1bded337fd5f13242ed5 Mon Sep 17 00:00:00 2001 From: rajaram Date: Fri, 28 Oct 2011 11:46:46 +0530 Subject: u8500 : USB :New notification events for BatMan Added notification events for ACA cases so that battery manager can distinguish between Standard Host and ACA charger. ST-Ericsson Linux next: NA ST-Ericsson ID: 362951 ST-Ericsson FOSS-OUT ID: Trivial Signed-off-by: rajaram Signed-off-by: Sakethram Bommisetti Change-Id: I02a19bced97b408990d8effb785418bf182ac27b Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34862 Tested-by: Rajaram REGUPATHY Reviewed-by: Praveena NADAHALLY Reviewed-by: Rabin VINCENT --- drivers/usb/musb/ux500.c | 1 + drivers/usb/otg/ab8500-usb.c | 23 ++++++++++++++--------- include/linux/usb/otg.h | 3 +++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 17da4e290f4..51f14effa1f 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -212,6 +212,7 @@ static int musb_otg_notifications(struct notifier_block *nb, switch (event) { case USB_EVENT_ID: + case USB_EVENT_RIDA: dev_dbg(musb->controller, "ID GND\n"); if (is_otg_enabled(musb)) { ux500_musb_set_vbus(musb, 1); diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c index eb4c6537532..93a99915b66 100644 --- a/drivers/usb/otg/ab8500-usb.c +++ b/drivers/usb/otg/ab8500-usb.c @@ -314,10 +314,11 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) lsts = (reg >> 3) & 0x0F; switch (lsts) { + case USB_LINK_ACA_RID_B: + event = USB_EVENT_RIDB; case USB_LINK_NOT_CONFIGURED: case USB_LINK_RESERVED: case USB_LINK_NOT_VALID_LINK: - case USB_LINK_ACA_RID_B: if (ab->mode == USB_HOST) ab8500_usb_host_phy_dis(ab); else if (ab->mode == USB_PERIPHERAL) @@ -325,18 +326,19 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) ab->mode = USB_IDLE; ab->phy.otg.default_a = false; ab->vbus_draw = 0; - event = USB_EVENT_NONE; + if (event != USB_EVENT_RIDB) + event = USB_EVENT_NONE; break; - + case USB_LINK_ACA_RID_C_NM: + case USB_LINK_ACA_RID_C_HS: + case USB_LINK_ACA_RID_C_HS_CHIRP: + event = USB_EVENT_RIDC; case USB_LINK_STD_HOST_NC: case USB_LINK_STD_HOST_C_NS: case USB_LINK_STD_HOST_C_S: case USB_LINK_HOST_CHG_NM: case USB_LINK_HOST_CHG_HS: case USB_LINK_HOST_CHG_HS_CHIRP: - case USB_LINK_ACA_RID_C_NM: - case USB_LINK_ACA_RID_C_HS: - case USB_LINK_ACA_RID_C_HS_CHIRP: if (ab->mode == USB_HOST) { ab->mode = USB_PERIPHERAL; ab8500_usb_host_phy_dis(ab); @@ -348,11 +350,13 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) ux500_restore_context(); ab8500_usb_peri_phy_en(ab); } - event = USB_EVENT_VBUS; + if (event != USB_EVENT_RIDC) + event = USB_EVENT_VBUS; break; - case USB_LINK_HM_IDGND: case USB_LINK_ACA_RID_A: + event = USB_EVENT_RIDA; + case USB_LINK_HM_IDGND: if (ab->mode == USB_PERIPHERAL) { ab->mode = USB_HOST; ab8500_usb_peri_phy_dis(ab); @@ -365,7 +369,8 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) ab8500_usb_host_phy_en(ab); } ab->phy.otg->default_a = true; - event = USB_EVENT_ID; + if (event != USB_EVENT_RIDA) + event = USB_EVENT_ID; break; case USB_LINK_DEDICATED_CHG: diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 38ab3f46346..c3b77fcdce7 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -41,6 +41,9 @@ enum usb_phy_events { USB_EVENT_ID, /* id was grounded */ USB_EVENT_CHARGER, /* usb dedicated charger */ USB_EVENT_ENUMERATED, /* gadget driver enumerated */ + USB_EVENT_RIDA, + USB_EVENT_RIDB, + USB_EVENT_RIDC, }; struct usb_phy; -- cgit v1.2.3