All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
To: Maulik <x0082077-l0cyMroinI0@public.gmane.org>
Cc: 'Hema HK' <hemahk-l0cyMroinI0@public.gmane.org>,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	'Felipe Balbi' <balbi-l0cyMroinI0@public.gmane.org>,
	'Tony Lindgren' <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	'Kevin Hilman'
	<khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>,
	"'Cousson, Benoit'" <b-cousson-l0cyMroinI0@public.gmane.org>,
	'Paul Walmsley' <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 9/9 v3] usb : musb: Offmode fix for idle path
Date: Thu, 23 Sep 2010 13:47:08 +0400	[thread overview]
Message-ID: <4C9B221C.5090807@ru.mvista.com> (raw)
In-Reply-To: <CE25F9D2A56A423C84BED8BC132A07FB-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>

Hello.

On 23-09-2010 9:50, Maulik wrote:

>> -----Original Message-----
>> From: Hema HK [mailto:hemahk-l0cyMroinI0@public.gmane.org]
>> Sent: Thursday, September 23, 2010 6:01 AM
>> To: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Cc: Hema HK; Maulik Mankad; Felipe Balbi; Tony Lindgren; Kevin Hilman;
>> Cousson, Benoit; Paul Walmsley
>> Subject: [PATCH 9/9 v3] usb : musb: Offmode fix for idle path

>> With OMAP core-off support musb was not functional as context was getting
>> lost after wakeup from core-off. And also musb was blocking the core-off
>> after loading the gadget driver even with no cable connected sometimes.

>> Added the idle and wakeup APIs in the platform layer which will
>> be called in the idle and wakeup path.

>> Used the pm_runtime_put_sysc API to configure the
>> musb to force idle/standby modes, saving the context and disable the clk
>> in
>> while idling if there is no activity on the usb bus.

>> Used the pm_runtime_get_sync API to configure the musb to
>> no idle/standby modes, enable the clock and restore the context
>> after wakeup when there is no activity on the usb bus.

>> Signed-off-by: Hema HK<hemahk-l0cyMroinI0@public.gmane.org>
>> Signed-off-by: Maulik Mankad<x0082077-l0cyMroinI0@public.gmane.org>
>> Cc: Felipe Balbi<balbi-l0cyMroinI0@public.gmane.org>
>> Cc: Tony Lindgren<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
>> Cc: Kevin Hilman<khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
>> Cc: Cousson, Benoit<b-cousson-l0cyMroinI0@public.gmane.org>
>> Cc: Paul Walmsley<paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>

[...]

>> Index: linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
>> ===================================================================
>> --- linux-omap-pm.orig/arch/arm/mach-omap2/usb-musb.c
>> +++ linux-omap-pm/arch/arm/mach-omap2/usb-musb.c
[...]
>> @@ -115,8 +126,101 @@ void __init usb_musb_init(struct omap_mu
>>   	put_device(dev);
>>   }
>>
>> +void musb_prepare_for_idle()
>> +{
>> +	int core_next_state;
>> +	struct omap_hwmod *oh = oh_p;
>> +	struct omap_device *od;
>> +	struct platform_device *pdev;
>> +	struct musb_hdrc_platform_data *pdata;
>> +	struct device *dev;
>> +
>> +	if (!core_pwrdm)
>> +		return;
>> +
>> +	core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
>> +	if (core_next_state>= PWRDM_POWER_INACTIVE)
>> +		return;
>> +	if (!oh)
>> +		return;
>> +
>> +	od = oh->od;
>> +	pdev =&od->pdev;
>> +
>> +	if (!pdev)
>> +		return;
>> +	dev =&pdev->dev;
>> +
>> +	if (dev->driver) {
>> +		pdata = dev->platform_data;
>> +
>> +	if (pdata->is_usb_active)

> Don't you need a start brace here?

    No if the *if* only embraces one statement as here. But the next *if* can 
be collapsed into this one.

> Also a tab is required if this if condition is under if (dev->driver)

    Yeah.

>> +		if (!pdata->is_usb_active(dev)) {

    Brace not necessary.

>> +			if (core_next_state == PWRDM_POWER_OFF) {
>> +				pdata->save_context = 1;
>> +				pm_runtime_put_sync(dev);
>> +			} else if  (core_next_state == PWRDM_POWER_RET) {
>> +				pdata->save_context = 0;
>> +				pm_runtime_put_sync(dev);
>> +			}
>> +		}
>> +	}
>> +}
>> +
>> +void musb_wakeup_from_idle()
>> +{
>> +	int core_next_state;
>> +	int core_prev_state;
>> +	struct omap_hwmod *oh = oh_p;
>> +	struct omap_device *od;
>> +	struct platform_device *pdev;
>> +	struct device *dev;
>> +	struct musb_hdrc_platform_data *pdata;
>> +
>> +	if (!core_pwrdm)
>> +		return;
>> +
>> +	core_next_state = pwrdm_read_next_pwrst(core_pwrdm);
>> +
>> +	if (core_next_state>= PWRDM_POWER_INACTIVE)
>> +		return;
>> +	 core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm);
>> +
>> +	 if (!oh)
>> +		return;
>> +	 od = oh->od;
>> +	 pdev =&od->pdev;
>> +
>> +	 if (!pdev)
>> +		return;
>> +
>> +	 dev =&pdev->dev;
>> +
>> +	 if (dev->driver) {
>> +		pdata = dev->platform_data;
>> +
>> +		if (pdata->is_usb_active)

> Braces needed for this if condition?

    No. But the next *if* can be collapsed into the previous.

>> +			if (!pdata->is_usb_active(dev)) {
>> +				if (core_prev_state == PWRDM_POWER_OFF) {
>> +					pdata->restore_context = 1;
>> +					 pm_runtime_get_sync(dev);
>> +				} else {
>> +					 pdata->restore_context = 0;
>> +					 pm_runtime_get_sync(dev);
>> +				}
>> +			 }
>> +	 }
>> +}

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-09-23  9:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23  0:30 [PATCH 9/9 v3] usb : musb: Offmode fix for idle path Hema HK
2010-09-23  5:50 ` Maulik
     [not found]   ` <CE25F9D2A56A423C84BED8BC132A07FB-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
2010-09-23  9:47     ` Sergei Shtylyov [this message]
     [not found] ` <1285201846-26599-1-git-send-email-hemahk-l0cyMroinI0@public.gmane.org>
2010-09-23  6:49   ` Felipe Balbi
2010-09-23  6:53     ` Felipe Balbi
2010-09-23  7:59     ` Kalliguddi, Hema
     [not found]       ` <E0D41E29EB0DAC4E9F3FF173962E9E94027863D9EB-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-09-23  8:10         ` Felipe Balbi
2010-09-23 15:37       ` Kalliguddi, Hema
2010-09-23 17:52         ` Kevin Hilman
2010-09-24 19:41 ` Kevin Hilman
2010-09-27  5:19   ` Kalliguddi, Hema
     [not found]     ` <E0D41E29EB0DAC4E9F3FF173962E9E9402DB3F8825-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-09-27 18:56       ` Kevin Hilman
2010-09-28  4:37         ` Kalliguddi, Hema
     [not found]           ` <E0D41E29EB0DAC4E9F3FF173962E9E9402DB3F8F1E-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-09-28  5:18             ` Kalliguddi, Hema
2010-09-28 15:43           ` Kevin Hilman
     [not found]             ` <87y6alho0d.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2010-09-30 11:29               ` Kalliguddi, Hema

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C9B221C.5090807@ru.mvista.com \
    --to=sshtylyov-igf4poytycdqt0dzr+alfa@public.gmane.org \
    --cc=b-cousson-l0cyMroinI0@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=hemahk-l0cyMroinI0@public.gmane.org \
    --cc=khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=x0082077-l0cyMroinI0@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.