Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
Hi Felipe, On Monday 10 November 2014 08:56 PM, Felipe Balbi wrote: Hi, On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote: @@ -1469,6 +1484,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) abx500_usb_link_status_update(ab); +usb_phy_wsource_init(ab-phy); instead of adding this to all drivers, you can just it to usb_add_phy_dev() and conversely, to usb_remove_phy(). 'usb_phy_wsource_init' seems specific to usb and when these drivers are adapted to the generic PHY framework we can't add it to phy_create. Should it be added in extcon instead? Thanks Kishon -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
Hi, On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote: @@ -1469,6 +1484,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) abx500_usb_link_status_update(ab); + usb_phy_wsource_init(ab-phy); instead of adding this to all drivers, you can just it to usb_add_phy_dev() and conversely, to usb_remove_phy(). -- balbi signature.asc Description: Digital signature
Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
Hi Felipe, On 10 November 2014 20:56, Felipe Balbi ba...@ti.com wrote: Hi, On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote: @@ -1469,6 +1484,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) abx500_usb_link_status_update(ab); + usb_phy_wsource_init(ab-phy); instead of adding this to all drivers, you can just it to usb_add_phy_dev() and conversely, to usb_remove_phy(). Definitely,Thanks for your input. Regards, Kiran -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote: From: Todd Poynor toddpoy...@google.com usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode Some systems require a mechanism to prevent system to enter into suspend state when USB is connected and enumerated in peripheral mode. This patch provides an interface to hold a wakeupsource to prevent suspend. PHY drivers can use this interface when USB is connected and enumerated in peripheral mode. A timed wakeupsource is temporarily held on USB disconnect events, to allow the rest of the system to react to the USB disconnection (dropping host sessions, updating charger status, etc.) prior to re-allowing suspend. Cc: Kishon Vijay Abraham I kis...@ti.com Cc: Felipe Balbi ba...@ti.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team kernel-t...@android.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Cc: Arve Hj�nnev�g a...@android.com Cc: Benoit Goby ben...@android.com Signed-off-by: Todd Poynor toddpoy...@google.com [kiran: Added context to commit message, squished build fixes from Benoit Goby and Arve Hj�nnev�g, changed wakelocks usage to wakeupsource, merged Todd's refactoring logic and simplified the structures and code and addressed community feedback] Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org you still didn't get this right. I asked that you introduce usb_phy_set_event() as a separate patch, then make PHY drivers use it and only on a third patch should you hold a wakeupsource. -- balbi signature.asc Description: Digital signature
Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
Hi Felipe, On 6 November 2014 01:10, Felipe Balbi ba...@ti.com wrote: On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote: From: Todd Poynor toddpoy...@google.com usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode Some systems require a mechanism to prevent system to enter into suspend state when USB is connected and enumerated in peripheral mode. This patch provides an interface to hold a wakeupsource to prevent suspend. PHY drivers can use this interface when USB is connected and enumerated in peripheral mode. A timed wakeupsource is temporarily held on USB disconnect events, to allow the rest of the system to react to the USB disconnection (dropping host sessions, updating charger status, etc.) prior to re-allowing suspend. Cc: Kishon Vijay Abraham I kis...@ti.com Cc: Felipe Balbi ba...@ti.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team kernel-t...@android.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Cc: Arve Hjønnevåg a...@android.com Cc: Benoit Goby ben...@android.com Signed-off-by: Todd Poynor toddpoy...@google.com [kiran: Added context to commit message, squished build fixes from Benoit Goby and Arve Hjønnevåg, changed wakelocks usage to wakeupsource, merged Todd's refactoring logic and simplified the structures and code and addressed community feedback] Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org you still didn't get this right. I asked that you introduce usb_phy_set_event() as a separate patch, then make PHY drivers use it and only on a third patch should you hold a wakeupsource. Thanks for your time. Sure,I'll resend the patches as per your suggestion,could you please let me know whether you are okay with this new approach?. This will help me to consolidate all your inputs in new patch set. Regards, Kiran -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
On Thu, Nov 06, 2014 at 10:04:01AM +0530, Kiran Raparthy wrote: Hi Felipe, On 6 November 2014 01:10, Felipe Balbi ba...@ti.com wrote: On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote: From: Todd Poynor toddpoy...@google.com usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode Some systems require a mechanism to prevent system to enter into suspend state when USB is connected and enumerated in peripheral mode. This patch provides an interface to hold a wakeupsource to prevent suspend. PHY drivers can use this interface when USB is connected and enumerated in peripheral mode. A timed wakeupsource is temporarily held on USB disconnect events, to allow the rest of the system to react to the USB disconnection (dropping host sessions, updating charger status, etc.) prior to re-allowing suspend. Cc: Kishon Vijay Abraham I kis...@ti.com Cc: Felipe Balbi ba...@ti.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team kernel-t...@android.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Cc: Arve Hjønnevåg a...@android.com Cc: Benoit Goby ben...@android.com Signed-off-by: Todd Poynor toddpoy...@google.com [kiran: Added context to commit message, squished build fixes from Benoit Goby and Arve Hjønnevåg, changed wakelocks usage to wakeupsource, merged Todd's refactoring logic and simplified the structures and code and addressed community feedback] Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org you still didn't get this right. I asked that you introduce usb_phy_set_event() as a separate patch, then make PHY drivers use it and only on a third patch should you hold a wakeupsource. Thanks for your time. Sure,I'll resend the patches as per your suggestion,could you please let me know whether you are okay with this new approach?. This will help me to consolidate all your inputs in new patch set. I'll review again in the morning, sure. cheers -- balbi signature.asc Description: Digital signature
[RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode
From: Todd Poynor toddpoy...@google.com usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode Some systems require a mechanism to prevent system to enter into suspend state when USB is connected and enumerated in peripheral mode. This patch provides an interface to hold a wakeupsource to prevent suspend. PHY drivers can use this interface when USB is connected and enumerated in peripheral mode. A timed wakeupsource is temporarily held on USB disconnect events, to allow the rest of the system to react to the USB disconnection (dropping host sessions, updating charger status, etc.) prior to re-allowing suspend. Cc: Kishon Vijay Abraham I kis...@ti.com Cc: Felipe Balbi ba...@ti.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-ker...@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: Android Kernel Team kernel-t...@android.com Cc: John Stultz john.stu...@linaro.org Cc: Sumit Semwal sumit.sem...@linaro.org Cc: Arve Hj?nnev?g a...@android.com Cc: Benoit Goby ben...@android.com Signed-off-by: Todd Poynor toddpoy...@google.com [kiran: Added context to commit message, squished build fixes from Benoit Goby and Arve Hj?nnev?g, changed wakelocks usage to wakeupsource, merged Todd's refactoring logic and simplified the structures and code and addressed community feedback] Signed-off-by: Kiran Raparthy kiran.ku...@linaro.org --- v5: * with the new approach,i was able to chnage only 5 phy drivers as mentioned below to use the wakeupsource funtionality. drivers/phy/phy-omap-control.c drivers/usb/phy/phy-ab8500-usb.c drivers/usb/phy/phy-tahvo.c drivers/usb/phy/phy-mv-usb.c drivers/usb/phy/phy-gpio-vbus-usb.c * Notification method not used any more. * introduced usb_phy_set_event in phy.c to hold wakeupsource * introduced usb_phy_wsource_init/usb_phy_wsource_trash in phy.c to initialize/relese per-PHY wakeupsource.These interfaces called from probe/remove functions of phy drivers. * usb_phy_set_event called from phy drivers where usb enumeration event is handled. * usb_phy_set_event expects usb_phy handle where as phy-omap-control.c provides its own type(omap_control_phy), so directly called __pm_stay_awake and __pm_awake_event from phy-omap-control.c instead of calling usb_phy_set_event. v4: * Temporarily hold wakeupsource patch integrated into main patch. * As per feedback,dropped enabled module parameter. * Introduced otgws_otg_usb3_notifications function to handle event notifications from usb3 phy. * Handled wakeupsource initialization,spinlock,registration of notifier block per-PHY. * Updated usb_phy structure. v3: * As per the feedback,no global phy pointer used. * called the one-liner wakeupsource handling calls directly instead of indirect functions implemented in v2. * Removed indirect function get_phy_hook and used usb_get_phy to get the phy handle.. v2: * wakeupsource handling implemeted per-PHY * Implemented wakeupsource handling calls in phy * included Todd's refactoring logic. v1: * changed to disabled by default from enable by default. * Kconfig help text modified * Included better commit text * otgws_nb moved to otg_wakeupsource_init function * Introduced get_phy_hook to handle otgws_xceiv per-PHY Initial RFC: * Included build fix from Benoit Goby and Arve Hj?nnev?g * Removed lock-held field in driver as this mechanism is provided in wakeupsource driver. * wakelock(wl) terminology replaced with wakeup_source(ws). drivers/phy/phy-omap-control.c | 9 ++ drivers/usb/phy/phy-ab8500-usb.c | 17 +++ drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +++ drivers/usb/phy/phy-mv-usb.c | 4 +++ drivers/usb/phy/phy-tahvo.c | 5 drivers/usb/phy/phy.c| 56 include/linux/phy/omap_control_phy.h | 4 +++ include/linux/usb/phy.h | 8 ++ 8 files changed, 107 insertions(+) diff --git a/drivers/phy/phy-omap-control.c b/drivers/phy/phy-omap-control.c index 311b4f9..efc629f 100644 --- a/drivers/phy/phy-omap-control.c +++ b/drivers/phy/phy-omap-control.c @@ -24,6 +24,7 @@ #include linux/err.h #include linux/io.h #include linux/clk.h +#include linux/usb/phy.h #include linux/phy/omap_control_phy.h /** @@ -196,9 +197,12 @@ void omap_control_usb_set_mode(struct device *dev, break; case USB_MODE_DEVICE: omap_control_usb_device_mode(ctrl_phy); + __pm_stay_awake(ctrl_phy-wsource); break; case USB_MODE_DISCONNECT: omap_control_usb_set_sessionend(ctrl_phy); + __pm_wakeup_event(ctrl_phy-wsource, + msecs_to_jiffies(TEMPORARY_HOLD_TIME)); break; default: dev_vdbg(dev, invalid omap control usb mode\n); @@ -246,6 +250,7 @@ static int omap_control_phy_probe(struct platform_device *pdev) struct resource *res; const struct of_device_id *of_id; struct omap_control_phy