All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar@ti.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>,
	Franklin S Cooper Jr <fcooper@ti.com>, <wsa@the-dreams.de>,
	<robh+dt@kernel.org>, <linux@armlinux.org.uk>,
	<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <vigneshr@ti.com>
Subject: Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support
Date: Tue, 12 Sep 2017 13:55:52 +0530	[thread overview]
Message-ID: <5d8778d8-281c-8926-fec3-f9acf82e342c@ti.com> (raw)
In-Reply-To: <94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>

On Tuesday 12 September 2017 01:41 AM, Grygorii Strashko wrote:
> 
> 
> On 09/11/2017 03:07 PM, Franklin S Cooper Jr wrote:
>>
>>
>> On 09/11/2017 06:29 AM, Sekhar Nori wrote:
>>> On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:
>>>> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain
>>>> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime
>>>
>>> unlike ?
>>>
>>>> is required to insure the power domain used by the specific I2C instance is
>>>> properly turned on along with its functional clock.
>>>>
>>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
>>>> ---
>>>> Version 3 changes:
>>>> Remove several statements that set clk to NULL
>>>> Fix error path
>>>>
>>>>   drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------
>>>>   1 file changed, 53 insertions(+), 11 deletions(-)
>>>
>>>> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>>>   	dev->clk = devm_clk_get(&pdev->dev, NULL);
>>>>   	if (IS_ERR(dev->clk))
>>>>   		return PTR_ERR(dev->clk);
>>>> -	clk_prepare_enable(dev->clk);
>>>>   
>>>>   	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>>   	dev->base = devm_ioremap_resource(&pdev->dev, mem);
>>>>   	if (IS_ERR(dev->base)) {
>>>> -		r = PTR_ERR(dev->base);
>>>> +		return PTR_ERR(dev->base);
>>>> +	}
>>>> +
>>>> +	pm_runtime_set_autosuspend_delay(dev->dev,
>>>> +					 DAVINCI_I2C_PM_TIMEOUT);
>>>> +	pm_runtime_use_autosuspend(dev->dev);
>>>> +
>>>> +	pm_runtime_enable(dev->dev);
>>>> +
>>>> +	r = pm_runtime_get_sync(dev->dev);
>>>> +	if (r < 0) {
>>>> +		dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
>>>>   		goto err_unuse_clocks;
>>>
>>> You end up doing a pm_runtime_put_sync() on failure here, instead of
>>> pm_runtime_put_noidle() like rest of the patch.
>>>
>>> May be handle this failure here instead of relying on the goto path.
>>
>> Ok
> 
> I think, it's not necessary - pm_runtime_put_sync() can be used in this case
>  (and used the same way in many other drivers).
> In case, of failure in this place - pm_runtime_put_sync() will just decrement usage counter.

Can you please explain why this is the case? At least on DA850, I see
the runtime_idle callback invoked from rpm_idle() if
pm_runtime_put_sync() is used in the failure path.

Thanks
Sekhar

WARNING: multiple messages have this Message-ID (diff)
From: Sekhar Nori <nsekhar@ti.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>,
	Franklin S Cooper Jr <fcooper@ti.com>,
	wsa@the-dreams.de, robh+dt@kernel.org, linux@armlinux.org.uk,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, vigneshr@ti.com
Subject: Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support
Date: Tue, 12 Sep 2017 13:55:52 +0530	[thread overview]
Message-ID: <5d8778d8-281c-8926-fec3-f9acf82e342c@ti.com> (raw)
In-Reply-To: <94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>

On Tuesday 12 September 2017 01:41 AM, Grygorii Strashko wrote:
> 
> 
> On 09/11/2017 03:07 PM, Franklin S Cooper Jr wrote:
>>
>>
>> On 09/11/2017 06:29 AM, Sekhar Nori wrote:
>>> On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:
>>>> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain
>>>> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime
>>>
>>> unlike ?
>>>
>>>> is required to insure the power domain used by the specific I2C instance is
>>>> properly turned on along with its functional clock.
>>>>
>>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
>>>> ---
>>>> Version 3 changes:
>>>> Remove several statements that set clk to NULL
>>>> Fix error path
>>>>
>>>>   drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------
>>>>   1 file changed, 53 insertions(+), 11 deletions(-)
>>>
>>>> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>>>   	dev->clk = devm_clk_get(&pdev->dev, NULL);
>>>>   	if (IS_ERR(dev->clk))
>>>>   		return PTR_ERR(dev->clk);
>>>> -	clk_prepare_enable(dev->clk);
>>>>   
>>>>   	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>>   	dev->base = devm_ioremap_resource(&pdev->dev, mem);
>>>>   	if (IS_ERR(dev->base)) {
>>>> -		r = PTR_ERR(dev->base);
>>>> +		return PTR_ERR(dev->base);
>>>> +	}
>>>> +
>>>> +	pm_runtime_set_autosuspend_delay(dev->dev,
>>>> +					 DAVINCI_I2C_PM_TIMEOUT);
>>>> +	pm_runtime_use_autosuspend(dev->dev);
>>>> +
>>>> +	pm_runtime_enable(dev->dev);
>>>> +
>>>> +	r = pm_runtime_get_sync(dev->dev);
>>>> +	if (r < 0) {
>>>> +		dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
>>>>   		goto err_unuse_clocks;
>>>
>>> You end up doing a pm_runtime_put_sync() on failure here, instead of
>>> pm_runtime_put_noidle() like rest of the patch.
>>>
>>> May be handle this failure here instead of relying on the goto path.
>>
>> Ok
> 
> I think, it's not necessary - pm_runtime_put_sync() can be used in this case
>  (and used the same way in many other drivers).
> In case, of failure in this place - pm_runtime_put_sync() will just decrement usage counter.

Can you please explain why this is the case? At least on DA850, I see
the runtime_idle callback invoked from rpm_idle() if
pm_runtime_put_sync() is used in the failure path.

Thanks
Sekhar

WARNING: multiple messages have this Message-ID (diff)
From: nsekhar@ti.com (Sekhar Nori)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support
Date: Tue, 12 Sep 2017 13:55:52 +0530	[thread overview]
Message-ID: <5d8778d8-281c-8926-fec3-f9acf82e342c@ti.com> (raw)
In-Reply-To: <94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>

On Tuesday 12 September 2017 01:41 AM, Grygorii Strashko wrote:
> 
> 
> On 09/11/2017 03:07 PM, Franklin S Cooper Jr wrote:
>>
>>
>> On 09/11/2017 06:29 AM, Sekhar Nori wrote:
>>> On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:
>>>> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain
>>>> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime
>>>
>>> unlike ?
>>>
>>>> is required to insure the power domain used by the specific I2C instance is
>>>> properly turned on along with its functional clock.
>>>>
>>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
>>>> ---
>>>> Version 3 changes:
>>>> Remove several statements that set clk to NULL
>>>> Fix error path
>>>>
>>>>   drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------
>>>>   1 file changed, 53 insertions(+), 11 deletions(-)
>>>
>>>> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>>>>   	dev->clk = devm_clk_get(&pdev->dev, NULL);
>>>>   	if (IS_ERR(dev->clk))
>>>>   		return PTR_ERR(dev->clk);
>>>> -	clk_prepare_enable(dev->clk);
>>>>   
>>>>   	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>>   	dev->base = devm_ioremap_resource(&pdev->dev, mem);
>>>>   	if (IS_ERR(dev->base)) {
>>>> -		r = PTR_ERR(dev->base);
>>>> +		return PTR_ERR(dev->base);
>>>> +	}
>>>> +
>>>> +	pm_runtime_set_autosuspend_delay(dev->dev,
>>>> +					 DAVINCI_I2C_PM_TIMEOUT);
>>>> +	pm_runtime_use_autosuspend(dev->dev);
>>>> +
>>>> +	pm_runtime_enable(dev->dev);
>>>> +
>>>> +	r = pm_runtime_get_sync(dev->dev);
>>>> +	if (r < 0) {
>>>> +		dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
>>>>   		goto err_unuse_clocks;
>>>
>>> You end up doing a pm_runtime_put_sync() on failure here, instead of
>>> pm_runtime_put_noidle() like rest of the patch.
>>>
>>> May be handle this failure here instead of relying on the goto path.
>>
>> Ok
> 
> I think, it's not necessary - pm_runtime_put_sync() can be used in this case
>  (and used the same way in many other drivers).
> In case, of failure in this place - pm_runtime_put_sync() will just decrement usage counter.

Can you please explain why this is the case? At least on DA850, I see
the runtime_idle callback invoked from rpm_idle() if
pm_runtime_put_sync() is used in the failure path.

Thanks
Sekhar

  reply	other threads:[~2017-09-12  8:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 17:54 [PATCH v3 0/2] ARM: dts: keystone-k2g: Add I2C support for 66AK2G Franklin S Cooper Jr
2017-09-08 17:54 ` Franklin S Cooper Jr
2017-09-08 17:54 ` Franklin S Cooper Jr
2017-09-08 17:54 ` [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support Franklin S Cooper Jr
2017-09-08 17:54   ` Franklin S Cooper Jr
2017-09-08 17:54   ` Franklin S Cooper Jr
2017-09-11 11:29   ` Sekhar Nori
2017-09-11 11:29     ` Sekhar Nori
2017-09-11 11:29     ` Sekhar Nori
2017-09-11 20:07     ` Franklin S Cooper Jr
2017-09-11 20:07       ` Franklin S Cooper Jr
2017-09-11 20:07       ` Franklin S Cooper Jr
2017-09-11 20:11       ` Grygorii Strashko
2017-09-11 20:11         ` Grygorii Strashko
2017-09-11 20:11         ` Grygorii Strashko
2017-09-12  8:25         ` Sekhar Nori [this message]
2017-09-12  8:25           ` Sekhar Nori
2017-09-12  8:25           ` Sekhar Nori
2017-09-08 17:54 ` [PATCH v3 2/2] dt-bindings: i2c: i2c-davinci: Update binding for 66AK2Gx pwr dm property Franklin S Cooper Jr
2017-09-08 17:54   ` Franklin S Cooper Jr
2017-09-08 17:54   ` Franklin S Cooper Jr

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=5d8778d8-281c-8926-fec3-f9acf82e342c@ti.com \
    --to=nsekhar@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fcooper@ti.com \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=vigneshr@ti.com \
    --cc=wsa@the-dreams.de \
    /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.