lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFp+6iEb4R3NQkvtrY8X4h8oMwPf7E+LDYfb_cS5z2WfdGHNWA@mail.gmail.com>
Date:	Mon, 28 Jan 2013 17:28:30 +0530
From:	Vivek Gautam <gautamvivek1987@...il.com>
To:	balbi@...com
Cc:	Vivek Gautam <gautam.vivek@...sung.com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
	linux-samsung-soc@...r.kernel.org, gregkh@...uxfoundation.org,
	sarah.a.sharp@...ux.intel.com, kgene.kim@...sung.com,
	dianders@...omium.org, sylvester.nawrocki@...il.com,
	tomasz.figa@...il.com
Subject: Re: [PATCH 3/4] usb: dwc3: exynos: Enable runtime power management

Hi Balbi,


On Mon, Jan 28, 2013 at 5:17 PM, Felipe Balbi <balbi@...com> wrote:
> On Mon, Jan 28, 2013 at 05:12:27PM +0530, Vivek Gautam wrote:
>> Enabling runtime power management on dwc3-exynos to save
>> power and allow its PHY's power to be managed at runtime.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@...sung.com>
>> ---
>>  drivers/usb/dwc3/dwc3-exynos.c |   47 ++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 47 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
>> index aae5328..c51e8c1 100644
>> --- a/drivers/usb/dwc3/dwc3-exynos.c
>> +++ b/drivers/usb/dwc3/dwc3-exynos.c
>> @@ -157,11 +157,15 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
>>               goto err4;
>>       }
>>
>> +     pm_runtime_set_active(&pdev->dev);
>> +     pm_runtime_enable(&pdev->dev);
>> +
>>       return 0;
>>
>>  err4:
>>       clk_disable(clk);
>>       clk_put(clk);
>> +     pm_runtime_disable(&pdev->dev);
>>  err3:
>>       platform_device_put(dwc3);
>>  err1:
>> @@ -174,6 +178,8 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
>>  {
>>       struct dwc3_exynos      *exynos = platform_get_drvdata(pdev);
>>
>> +     pm_runtime_disable(&pdev->dev);
>> +
>>       platform_device_unregister(exynos->dwc3);
>>       platform_device_unregister(exynos->usb2_phy);
>>       platform_device_unregister(exynos->usb3_phy);
>> @@ -186,6 +192,46 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
>>       return 0;
>>  }
>>
>> +static int dwc3_exynos_runtime_suspend(struct device *dev)
>> +{
>> +     struct dwc3_exynos      *exynos = dev_get_drvdata(dev);
>> +     struct platform_device  *pdev_dwc = exynos->dwc3;
>> +     struct dwc3             *dwc = NULL;
>> +
>> +     dwc = platform_get_drvdata(pdev_dwc);
>> +
>> +     if (!dwc)
>> +             return 0;
>> +
>> +     pm_runtime_put_sync(dwc->usb3_phy->dev);
>> +
>> +     clk_disable(exynos->clk);
>> +
>> +     return 0;
>> +}
>> +static int dwc3_exynos_runtime_resume(struct device *dev)
>> +{
>> +     struct dwc3_exynos      *exynos = dev_get_drvdata(dev);
>> +     struct platform_device  *pdev_dwc = exynos->dwc3;
>> +     struct dwc3             *dwc = NULL;
>> +
>> +     dwc = platform_get_drvdata(pdev_dwc);
>> +
>> +     clk_enable(exynos->clk);
>> +
>> +     if (!dwc)
>> +             return 0;
>> +
>> +     pm_runtime_get_sync(dwc->usb3_phy->dev);
>
> dude, this is wrong :-)
>
> look at this:
>
> pm_runtime_get() -> dwc3_exynos_runtime_resume() ->
> pm_runtime_get_sync() -> dwc3_exynos_runtime_resume() -> ...
>
> only your clock enalbe should do
>

We want to wake up "dwc->usb3_phy" so tried to call pm_runtime_get_sync()
with "dwc->usb3_phy->dev".
Missing something ? :-(




-- 
Thanks & Regards
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ