diff mbox

[v6,07/15] usb: phy: add notify suspend and resume callback

Message ID 1386897825-6130-8-git-send-email-peter.chen@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Chen Dec. 13, 2013, 1:23 a.m. UTC
They are used to notify PHY that the controller enters suspend
or finishes resume.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 include/linux/usb/phy.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

Comments

Felipe Balbi Dec. 13, 2013, 4:27 a.m. UTC | #1
On Fri, Dec 13, 2013 at 09:23:37AM +0800, Peter Chen wrote:
> They are used to notify PHY that the controller enters suspend
> or finishes resume.
> 
> Signed-off-by: Peter Chen <peter.chen@freescale.com>
> ---
>  include/linux/usb/phy.h |   23 +++++++++++++++++++++++
>  1 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
> index 6c0b1c5..a747960 100644
> --- a/include/linux/usb/phy.h
> +++ b/include/linux/usb/phy.h
> @@ -116,6 +116,11 @@ struct usb_phy {
>  			enum usb_device_speed speed);
>  	int	(*notify_disconnect)(struct usb_phy *x,
>  			enum usb_device_speed speed);
> +	int	(*notify_suspend)(struct usb_phy *x,
> +			enum usb_device_speed speed);
> +	int	(*notify_resume)(struct usb_phy *x,
> +			enum usb_device_speed speed);
> +

I still don't think this is necessary. Why don't you just call
usb_phy_set_suspend() directly ? And why do you need the extra speed
argument ?
Peter Chen Dec. 13, 2013, 6:23 a.m. UTC | #2
On Fri, Dec 13, 2013 at 12:27 PM, Felipe Balbi <balbi@ti.com> wrote:
> On Fri, Dec 13, 2013 at 09:23:37AM +0800, Peter Chen wrote:
>> They are used to notify PHY that the controller enters suspend
>> or finishes resume.
>>
>> Signed-off-by: Peter Chen <peter.chen@freescale.com>
>> ---
>>  include/linux/usb/phy.h |   23 +++++++++++++++++++++++
>>  1 files changed, 23 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
>> index 6c0b1c5..a747960 100644
>> --- a/include/linux/usb/phy.h
>> +++ b/include/linux/usb/phy.h
>> @@ -116,6 +116,11 @@ struct usb_phy {
>>                       enum usb_device_speed speed);
>>       int     (*notify_disconnect)(struct usb_phy *x,
>>                       enum usb_device_speed speed);
>> +     int     (*notify_suspend)(struct usb_phy *x,
>> +                     enum usb_device_speed speed);
>> +     int     (*notify_resume)(struct usb_phy *x,
>> +                     enum usb_device_speed speed);
>> +
>
> I still don't think this is necessary. Why don't you just call
> usb_phy_set_suspend() directly ? And why do you need the extra speed
> argument ?
>
> --

It is different with PHY's power/clock.

Eg, for .notify_resume, it needs to be called after host controller finishes
 sending resume signal. If its operation is executed before controller sends
resume signal, the disconnect operation during the resume will not be detected.

.notify_suspend and .notify_resume needs to be called during ehci suspend/
resume operation for mxs-phy typed controller.

For mxs-phy, this operation is only needed for high speed connection,
and to aligned with .nofity_connect/.notify_disconnect, I added the speed
argument. If the user doesn't need it, it can pass USB_SPEED_UNKNOWN like
below post.

http://marc.info/?l=linux-usb&m=138418998118519&w=2

BR,
Peter Chen
diff mbox

Patch

diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 6c0b1c5..a747960 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -116,6 +116,11 @@  struct usb_phy {
 			enum usb_device_speed speed);
 	int	(*notify_disconnect)(struct usb_phy *x,
 			enum usb_device_speed speed);
+	int	(*notify_suspend)(struct usb_phy *x,
+			enum usb_device_speed speed);
+	int	(*notify_resume)(struct usb_phy *x,
+			enum usb_device_speed speed);
+
 };
 
 /**
@@ -282,6 +287,24 @@  usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
 		return 0;
 }
 
+static inline int usb_phy_notify_suspend
+	(struct usb_phy *x, enum usb_device_speed speed)
+{
+	if (x && x->notify_suspend)
+		return x->notify_suspend(x, speed);
+	else
+		return 0;
+}
+
+static inline int usb_phy_notify_resume
+	(struct usb_phy *x, enum usb_device_speed speed)
+{
+	if (x && x->notify_resume)
+		return x->notify_resume(x, speed);
+	else
+		return 0;
+}
+
 /* notifiers */
 static inline int
 usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)