diff mbox

[v1,2/3] usb: phy: Handle per-PHY event for connect and disconnect events

Message ID 7a23b5f0af4463aea85384b6a67678b9c41b9d2d.1416547297.git.kiran.kumar@linaro.org
State New
Headers show

Commit Message

Kiran Kumar Raparthy Nov. 21, 2014, 6:01 a.m. UTC
usb: phy: Handle per-PHY event for connnect and disconnect events

When usb is connected and enumerated in device mode or when usb is
disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event.

Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Arve Hjřnnevĺg <arve@android.com>
Cc: Benoit Goby <benoit@android.com>
[Original patch in Android from Todd]
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
---
 drivers/usb/phy/phy-ab8500-usb.c    | 15 +++++++++++++++
 drivers/usb/phy/phy-gpio-vbus-usb.c |  2 ++
 drivers/usb/phy/phy-mv-usb.c        |  2 ++
 drivers/usb/phy/phy-tahvo.c         |  2 ++
 4 files changed, 21 insertions(+)

Comments

Felipe Balbi Nov. 21, 2014, 3:11 p.m. UTC | #1
On Fri, Nov 21, 2014 at 11:31:21AM +0530, Kiran Raparthy wrote:
> usb: phy: Handle per-PHY event for connnect and disconnect events
> 
> When usb is connected and enumerated in device mode or when usb is
> disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event.
> 
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-usb@vger.kernel.org
> Cc: Android Kernel Team <kernel-team@android.com>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Arve Hj�nnev�g <arve@android.com>
> Cc: Benoit Goby <benoit@android.com>
> [Original patch in Android from Todd]
> Cc: Todd Poynor <toddpoynor@google.com>
> Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>

this patch doesn't apply, please rebase entire series on my testing/next.
Kiran Kumar Raparthy Nov. 21, 2014, 3:43 p.m. UTC | #2
On 21 November 2014 20:41, Felipe Balbi <balbi@ti.com> wrote:
> On Fri, Nov 21, 2014 at 11:31:21AM +0530, Kiran Raparthy wrote:
>> usb: phy: Handle per-PHY event for connnect and disconnect events
>>
>> When usb is connected and enumerated in device mode or when usb is
>> disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event.
>>
>> Cc: Felipe Balbi <balbi@ti.com>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: linux-kernel@vger.kernel.org
>> Cc: linux-usb@vger.kernel.org
>> Cc: Android Kernel Team <kernel-team@android.com>
>> Cc: John Stultz <john.stultz@linaro.org>
>> Cc: Sumit Semwal <sumit.semwal@linaro.org>
>> Cc: Arve Hj�nnev�g <arve@android.com>
>> Cc: Benoit Goby <benoit@android.com>
>> [Original patch in Android from Todd]
>> Cc: Todd Poynor <toddpoynor@google.com>
>> Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
>
> this patch doesn't apply, please rebase entire series on my testing/next.
Sure,
Regards,
Kiran
>
> --
> balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Sumit Semwal Nov. 24, 2014, 3:49 p.m. UTC | #3
Hi Felipe,

On 24 November 2014 at 20:08, Felipe Balbi <balbi@ti.com> wrote:
> Hi,
>
> On Fri, Nov 21, 2014 at 09:13:00PM +0530, Kiran Raparthy wrote:
>> On 21 November 2014 20:41, Felipe Balbi <balbi@ti.com> wrote:
>> > On Fri, Nov 21, 2014 at 11:31:21AM +0530, Kiran Raparthy wrote:
>> >> usb: phy: Handle per-PHY event for connnect and disconnect events
>> >>
>> >> When usb is connected and enumerated in device mode or when usb is
>> >> disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event.
>> >>
>> >> Cc: Felipe Balbi <balbi@ti.com>
>> >> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> >> Cc: linux-kernel@vger.kernel.org
>> >> Cc: linux-usb@vger.kernel.org
>> >> Cc: Android Kernel Team <kernel-team@android.com>
>> >> Cc: John Stultz <john.stultz@linaro.org>
>> >> Cc: Sumit Semwal <sumit.semwal@linaro.org>
>> >> Cc: Arve Hj�nnev�g <arve@android.com>
>> >> Cc: Benoit Goby <benoit@android.com>
>> >> [Original patch in Android from Todd]
>> >> Cc: Todd Poynor <toddpoynor@google.com>
>> >> Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
>> >
>> > this patch doesn't apply, please rebase entire series on my testing/next.
>
> your rebased version didn't apply either. Can you make sure you're
> rebasing on top of my today's testing/next branch ?
>
I just verified that I am able to apply both this patch (and the next
one - so 2/3 and 3/3) on your testing/next branch - just to make sure,
this is the git/branch right?

https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
branch:testing/next

> cheers
>
> --
> balbi
Sumit Semwal Nov. 24, 2014, 4:15 p.m. UTC | #4
On 24 November 2014 at 21:24, Felipe Balbi <balbi@ti.com> wrote:
> On Mon, Nov 24, 2014 at 09:19:09PM +0530, Sumit Semwal wrote:
>> Hi Felipe,
>>
>> On 24 November 2014 at 20:08, Felipe Balbi <balbi@ti.com> wrote:
>> > Hi,
>> >
>> > On Fri, Nov 21, 2014 at 09:13:00PM +0530, Kiran Raparthy wrote:
>> >> On 21 November 2014 20:41, Felipe Balbi <balbi@ti.com> wrote:
>> >> > On Fri, Nov 21, 2014 at 11:31:21AM +0530, Kiran Raparthy wrote:
>> >> >> usb: phy: Handle per-PHY event for connnect and disconnect events
>> >> >>
>> >> >> When usb is connected and enumerated in device mode or when usb is
>> >> >> disconnected,call usb_phy_set_event from phy drivers to handle per-PHY event.
>> >> >>
>> >> >> Cc: Felipe Balbi <balbi@ti.com>
>> >> >> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> >> >> Cc: linux-kernel@vger.kernel.org
>> >> >> Cc: linux-usb@vger.kernel.org
>> >> >> Cc: Android Kernel Team <kernel-team@android.com>
>> >> >> Cc: John Stultz <john.stultz@linaro.org>
>> >> >> Cc: Sumit Semwal <sumit.semwal@linaro.org>
>> >> >> Cc: Arve Hj�nnev�g <arve@android.com>
>> >> >> Cc: Benoit Goby <benoit@android.com>
>> >> >> [Original patch in Android from Todd]
>> >> >> Cc: Todd Poynor <toddpoynor@google.com>
>> >> >> Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
>> >> >
>> >> > this patch doesn't apply, please rebase entire series on my testing/next.
>> >
>> > your rebased version didn't apply either. Can you make sure you're
>> > rebasing on top of my today's testing/next branch ?
>> >
>> I just verified that I am able to apply both this patch (and the next
>> one - so 2/3 and 3/3) on your testing/next branch - just to make sure,
>> this is the git/branch right?
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
>> branch:testing/next
>
> that's the correct branch, but here's what I get:

That's very odd - I pulled your branch for the first time about 5
minutes before I sent the mail? perhaps local branch updates?
>
> checking file drivers/usb/phy/phy-ab8500-usb.c
> Hunk #1 FAILED at 447.
> Hunk #2 succeeded at 459 (offset -2 lines).
> Hunk #3 succeeded at 502 (offset -2 lines).
> Hunk #4 succeeded at 527 (offset -2 lines).
> Hunk #5 FAILED at 589.
> Hunk #6 succeeded at 600 (offset -2 lines).
> Hunk #7 succeeded at 629 (offset -2 lines).
> Hunk #8 succeeded at 652 (offset -2 lines).
> Hunk #9 FAILED at 701.
> Hunk #10 succeeded at 712 (offset -2 lines).
> Hunk #11 succeeded at 740 (offset -2 lines).
> Hunk #12 FAILED at 786.
> Hunk #13 succeeded at 801 (offset -2 lines).
> Hunk #14 succeeded at 828 (offset -2 lines).
> 4 out of 14 hunks FAILED
> checking file drivers/usb/phy/phy-gpio-vbus-usb.c
> checking file drivers/usb/phy/phy-mv-usb.c
> checking file drivers/usb/phy/phy-tahvo.c
> Hunk #1 FAILED at 87.
> Hunk #2 FAILED at 105.
> 2 out of 2 hunks FAILED
>
> cheers
>
> --
> balbi


Best,
Sumit.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 11ab2c4..d79fa3e 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -447,6 +447,7 @@  static int ab9540_usb_link_status_update(struct ab8500_usb *ab,
 			event = UX500_MUSB_NONE;
 		/* Fallback to default B_IDLE as nothing is connected. */
 		ab->phy.state = OTG_STATE_B_IDLE;
+		usb_phy_set_event(&ab->phy, USB_EVENT_NONE);
 		break;
 
 	case USB_LINK_ACA_RID_C_NM_9540:
@@ -461,12 +462,14 @@  static int ab9540_usb_link_status_update(struct ab8500_usb *ab,
 			ab8500_usb_peri_phy_en(ab);
 			atomic_notifier_call_chain(&ab->phy.notifier,
 					UX500_MUSB_PREPARE, &ab->vbus_draw);
+			usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED);
 		}
 		if (ab->mode == USB_IDLE) {
 			ab->mode = USB_PERIPHERAL;
 			ab8500_usb_peri_phy_en(ab);
 			atomic_notifier_call_chain(&ab->phy.notifier,
 					UX500_MUSB_PREPARE, &ab->vbus_draw);
+			usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED);
 		}
 		if (event != UX500_MUSB_RIDC)
 			event = UX500_MUSB_VBUS;
@@ -502,6 +505,7 @@  static int ab9540_usb_link_status_update(struct ab8500_usb *ab,
 		event = UX500_MUSB_CHARGER;
 		atomic_notifier_call_chain(&ab->phy.notifier,
 				event, &ab->vbus_draw);
+		usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER);
 		break;
 
 	case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_9540:
@@ -526,6 +530,7 @@  static int ab9540_usb_link_status_update(struct ab8500_usb *ab,
 				ab->mode = USB_IDLE;
 				ab->phy.otg->default_a = false;
 				ab->vbus_draw = 0;
+				usb_phy_set_event(&ab->phy, USB_EVENT_NONE);
 			}
 		}
 		break;
@@ -585,6 +590,7 @@  static int ab8540_usb_link_status_update(struct ab8500_usb *ab,
 		 * is connected
 		 */
 		ab->phy.state = OTG_STATE_B_IDLE;
+		usb_phy_set_event(&ab->phy, USB_EVENT_NONE);
 		break;
 
 	case USB_LINK_ACA_RID_C_NM_8540:
@@ -598,6 +604,7 @@  static int ab8540_usb_link_status_update(struct ab8500_usb *ab,
 			ab8500_usb_peri_phy_en(ab);
 			atomic_notifier_call_chain(&ab->phy.notifier,
 					UX500_MUSB_PREPARE, &ab->vbus_draw);
+			usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED);
 		}
 		if (event != UX500_MUSB_RIDC)
 			event = UX500_MUSB_VBUS;
@@ -626,6 +633,7 @@  static int ab8540_usb_link_status_update(struct ab8500_usb *ab,
 		event = UX500_MUSB_CHARGER;
 		atomic_notifier_call_chain(&ab->phy.notifier,
 				event, &ab->vbus_draw);
+		usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER);
 		break;
 
 	case USB_LINK_PHYEN_NO_VBUS_NO_IDGND_8540:
@@ -648,6 +656,7 @@  static int ab8540_usb_link_status_update(struct ab8500_usb *ab,
 			ab->mode = USB_IDLE;
 			ab->phy.otg->default_a = false;
 			ab->vbus_draw = 0;
+		usb_phy_set_event(&ab->phy, USB_EVENT_NONE);
 		}
 		break;
 
@@ -694,6 +703,7 @@  static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
 		 * is connected
 		 */
 		ab->phy.state = OTG_STATE_B_IDLE;
+		usb_phy_set_event(&ab->phy, USB_EVENT_NONE);
 		break;
 
 	case USB_LINK_ACA_RID_C_NM_8505:
@@ -707,6 +717,7 @@  static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
 			ab8500_usb_peri_phy_en(ab);
 			atomic_notifier_call_chain(&ab->phy.notifier,
 					UX500_MUSB_PREPARE, &ab->vbus_draw);
+			usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED);
 		}
 		if (event != UX500_MUSB_RIDC)
 			event = UX500_MUSB_VBUS;
@@ -734,6 +745,7 @@  static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
 		event = UX500_MUSB_CHARGER;
 		atomic_notifier_call_chain(&ab->phy.notifier,
 				event, &ab->vbus_draw);
+		usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER);
 		break;
 
 	default:
@@ -777,6 +789,7 @@  static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
 			event = UX500_MUSB_NONE;
 		/* Fallback to default B_IDLE as nothing is connected */
 		ab->phy.state = OTG_STATE_B_IDLE;
+		usb_phy_set_event(&ab->phy, USB_EVENT_NONE);
 		break;
 
 	case USB_LINK_ACA_RID_C_NM_8500:
@@ -794,6 +807,7 @@  static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
 			ab8500_usb_peri_phy_en(ab);
 			atomic_notifier_call_chain(&ab->phy.notifier,
 					UX500_MUSB_PREPARE, &ab->vbus_draw);
+			usb_phy_set_event(&ab->phy, USB_EVENT_ENUMERATED);
 		}
 		if (event != UX500_MUSB_RIDC)
 			event = UX500_MUSB_VBUS;
@@ -820,6 +834,7 @@  static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
 		event = UX500_MUSB_CHARGER;
 		atomic_notifier_call_chain(&ab->phy.notifier,
 				event, &ab->vbus_draw);
+		usb_phy_set_event(&ab->phy, USB_EVENT_CHARGER);
 		break;
 
 	case USB_LINK_RESERVED_8500:
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index f4b14bd..840dc2b 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -134,6 +134,7 @@  static void gpio_vbus_work(struct work_struct *work)
 
 		atomic_notifier_call_chain(&gpio_vbus->phy.notifier,
 					   status, gpio_vbus->phy.otg->gadget);
+		usb_phy_set_event(&gpio_vbus->phy, USB_EVENT_ENUMERATED);
 	} else {
 		/* optionally disable D+ pullup */
 		if (gpio_is_valid(gpio))
@@ -148,6 +149,7 @@  static void gpio_vbus_work(struct work_struct *work)
 
 		atomic_notifier_call_chain(&gpio_vbus->phy.notifier,
 					   status, gpio_vbus->phy.otg->gadget);
+		usb_phy_set_event(&gpio_vbus->phy, USB_EVENT_NONE);
 	}
 }
 
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
index 7d80c54..8ed9f95 100644
--- a/drivers/usb/phy/phy-mv-usb.c
+++ b/drivers/usb/phy/phy-mv-usb.c
@@ -441,10 +441,12 @@  run:
 				mv_otg_start_periphrals(mvotg, 0);
 			mv_otg_reset(mvotg);
 			mv_otg_disable(mvotg);
+			usb_phy_set_event(&mvotg->phy, USB_EVENT_NONE);
 			break;
 		case OTG_STATE_B_PERIPHERAL:
 			mv_otg_enable(mvotg);
 			mv_otg_start_periphrals(mvotg, 1);
+			usb_phy_set_event(&mvotg->phy, USB_EVENT_ENUMERATED);
 			break;
 		case OTG_STATE_A_IDLE:
 			otg->default_a = 1;
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index cc61ee4..5551ef0 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -87,6 +87,7 @@  static void check_vbus_state(struct tahvo_usb *tu)
 			if (tu->phy.otg->gadget)
 				usb_gadget_vbus_connect(tu->phy.otg->gadget);
 			tu->phy.state = OTG_STATE_B_PERIPHERAL;
+			usb_phy_set_event(&tu->phy, USB_EVENT_ENUMERATED);
 			break;
 		case OTG_STATE_A_IDLE:
 			/*
@@ -105,6 +106,7 @@  static void check_vbus_state(struct tahvo_usb *tu)
 			if (tu->phy.otg->gadget)
 				usb_gadget_vbus_disconnect(tu->phy.otg->gadget);
 			tu->phy.state = OTG_STATE_B_IDLE;
+			usb_phy_set_event(&tu->phy, USB_EVENT_NONE);
 			break;
 		case OTG_STATE_A_HOST:
 			tu->phy.state = OTG_STATE_A_IDLE;