[{"id":1766238,"web_url":"http://patchwork.ozlabs.org/comment/1766238/","msgid":"<57153767-6dee-a5b5-548c-f7b0dc104b46@ti.com>","list_archive_url":null,"date":"2017-09-11T11:29:10","subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","submitter":{"id":3234,"url":"http://patchwork.ozlabs.org/api/people/3234/","name":"Sekhar Nori","email":"nsekhar@ti.com"},"content":"On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:\n> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain\n> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime\n\nunlike ?\n\n> is required to insure the power domain used by the specific I2C instance is\n> properly turned on along with its functional clock.\n> \n> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>\n> ---\n> Version 3 changes:\n> Remove several statements that set clk to NULL\n> Fix error path\n> \n>  drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------\n>  1 file changed, 53 insertions(+), 11 deletions(-)\n\n> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>  \tdev->clk = devm_clk_get(&pdev->dev, NULL);\n>  \tif (IS_ERR(dev->clk))\n>  \t\treturn PTR_ERR(dev->clk);\n> -\tclk_prepare_enable(dev->clk);\n>  \n>  \tmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n>  \tdev->base = devm_ioremap_resource(&pdev->dev, mem);\n>  \tif (IS_ERR(dev->base)) {\n> -\t\tr = PTR_ERR(dev->base);\n> +\t\treturn PTR_ERR(dev->base);\n> +\t}\n> +\n> +\tpm_runtime_set_autosuspend_delay(dev->dev,\n> +\t\t\t\t\t DAVINCI_I2C_PM_TIMEOUT);\n> +\tpm_runtime_use_autosuspend(dev->dev);\n> +\n> +\tpm_runtime_enable(dev->dev);\n> +\n> +\tr = pm_runtime_get_sync(dev->dev);\n> +\tif (r < 0) {\n> +\t\tdev_err(dev->dev, \"failed to runtime_get device: %d\\n\", r);\n>  \t\tgoto err_unuse_clocks;\n\nYou end up doing a pm_runtime_put_sync() on failure here, instead of\npm_runtime_put_noidle() like rest of the patch.\n\nMay be handle this failure here instead of relying on the goto path.\n\n>  \t}\n>  \n> @@ -849,27 +878,40 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>  \tif (r)\n>  \t\tgoto err_unuse_clocks;\n>  \n> +\tpm_runtime_mark_last_busy(dev->dev);\n> +\tpm_runtime_put_autosuspend(dev->dev);\n> +\n>  \treturn 0;\n>  \n>  err_unuse_clocks:\n> -\tclk_disable_unprepare(dev->clk);\n> -\tdev->clk = NULL;\n> +\tpm_runtime_dont_use_autosuspend(dev->dev);\n> +\tpm_runtime_put_sync(dev->dev);\n> +\tpm_runtime_disable(dev->dev);\n> +\n>  \treturn r;\n>  }\n\nThanks,\nSekhar","headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"eS836+iu\";\n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xrQh21jxSz9sBd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 21:29:54 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751145AbdIKL3x (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 11 Sep 2017 07:29:53 -0400","from lelnx194.ext.ti.com ([198.47.27.80]:45824 \"EHLO\n\tlelnx194.ext.ti.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751079AbdIKL3w (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Mon, 11 Sep 2017 07:29:52 -0400","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8BBTExK017552; \n\tMon, 11 Sep 2017 06:29:14 -0500","from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8BBTEFc004393;\n\tMon, 11 Sep 2017 06:29:14 -0500","from DFLE115.ent.ti.com (10.64.6.36) by DFLE105.ent.ti.com\n\t(10.64.6.26) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tMon, 11 Sep 2017 06:29:14 -0500","from dflp33.itg.ti.com (10.64.6.16) by DFLE115.ent.ti.com\n\t(10.64.6.36) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Mon, 11 Sep 2017 06:29:14 -0500","from [172.24.190.171] (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8BBTBVf010450;\n\tMon, 11 Sep 2017 06:29:11 -0500"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1505129354;\n\tbh=4ppH4/R7zSBgKJljFL5NZaUMXuTTJtGxx6FM+vOAJpE=;\n\th=Subject:To:References:From:Date:In-Reply-To;\n\tb=eS836+iuBN3bx5N9h0vppEXIvTN+lcvl+PUn/AAy7QoNpNn/GiJA78h9NcXs/8tdA\n\taOmAnYu6yCqPLAjtNWXiqeGiGohu5vPGbX08ZztvHQpxFrzTZS+MfjN0It9FrNAdwi\n\tNpFiUXVClgzjh0+2SVLLy3MTh9lVNL0IPUG2Vuwk=","Subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","To":"Franklin S Cooper Jr <fcooper@ti.com>, <wsa@the-dreams.de>,\n\t<robh+dt@kernel.org>, <linux@armlinux.org.uk>,\n\t<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>,\n\t<linux-arm-kernel@lists.infradead.org>, <grygorii.strashko@ti.com>,\n\t<vigneshr@ti.com>","References":"<20170908175448.3367-1-fcooper@ti.com>\n\t<20170908175448.3367-2-fcooper@ti.com>","From":"Sekhar Nori <nsekhar@ti.com>","Message-ID":"<57153767-6dee-a5b5-548c-f7b0dc104b46@ti.com>","Date":"Mon, 11 Sep 2017 16:59:10 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170908175448.3367-2-fcooper@ti.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"}},{"id":1766496,"web_url":"http://patchwork.ozlabs.org/comment/1766496/","msgid":"<f185afb9-e877-1916-fcbc-c2a28f23b0cc@ti.com>","list_archive_url":null,"date":"2017-09-11T20:07:15","subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","submitter":{"id":64326,"url":"http://patchwork.ozlabs.org/api/people/64326/","name":"Franklin S Cooper Jr","email":"fcooper@ti.com"},"content":"On 09/11/2017 06:29 AM, Sekhar Nori wrote:\n> On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:\n>> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain\n>> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime\n> \n> unlike ?\n> \n>> is required to insure the power domain used by the specific I2C instance is\n>> properly turned on along with its functional clock.\n>>\n>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>\n>> ---\n>> Version 3 changes:\n>> Remove several statements that set clk to NULL\n>> Fix error path\n>>\n>>  drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------\n>>  1 file changed, 53 insertions(+), 11 deletions(-)\n> \n>> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>>  \tdev->clk = devm_clk_get(&pdev->dev, NULL);\n>>  \tif (IS_ERR(dev->clk))\n>>  \t\treturn PTR_ERR(dev->clk);\n>> -\tclk_prepare_enable(dev->clk);\n>>  \n>>  \tmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n>>  \tdev->base = devm_ioremap_resource(&pdev->dev, mem);\n>>  \tif (IS_ERR(dev->base)) {\n>> -\t\tr = PTR_ERR(dev->base);\n>> +\t\treturn PTR_ERR(dev->base);\n>> +\t}\n>> +\n>> +\tpm_runtime_set_autosuspend_delay(dev->dev,\n>> +\t\t\t\t\t DAVINCI_I2C_PM_TIMEOUT);\n>> +\tpm_runtime_use_autosuspend(dev->dev);\n>> +\n>> +\tpm_runtime_enable(dev->dev);\n>> +\n>> +\tr = pm_runtime_get_sync(dev->dev);\n>> +\tif (r < 0) {\n>> +\t\tdev_err(dev->dev, \"failed to runtime_get device: %d\\n\", r);\n>>  \t\tgoto err_unuse_clocks;\n> \n> You end up doing a pm_runtime_put_sync() on failure here, instead of\n> pm_runtime_put_noidle() like rest of the patch.\n> \n> May be handle this failure here instead of relying on the goto path.\n\nOk\n> \n>>  \t}\n>>  \n>> @@ -849,27 +878,40 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>>  \tif (r)\n>>  \t\tgoto err_unuse_clocks;\n>>  \n>> +\tpm_runtime_mark_last_busy(dev->dev);\n>> +\tpm_runtime_put_autosuspend(dev->dev);\n>> +\n>>  \treturn 0;\n>>  \n>>  err_unuse_clocks:\n>> -\tclk_disable_unprepare(dev->clk);\n>> -\tdev->clk = NULL;\n>> +\tpm_runtime_dont_use_autosuspend(dev->dev);\n>> +\tpm_runtime_put_sync(dev->dev);\n>> +\tpm_runtime_disable(dev->dev);\n>> +\n>>  \treturn r;\n>>  }\n> \n> Thanks,\n> Sekhar\n>","headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"uGIZ0sTP\";\n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xrf9l05dNz9s8J\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 06:07:55 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751111AbdIKUHx (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 11 Sep 2017 16:07:53 -0400","from lelnx193.ext.ti.com ([198.47.27.77]:52807 \"EHLO\n\tlelnx193.ext.ti.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750969AbdIKUHw (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Mon, 11 Sep 2017 16:07:52 -0400","from dlelxv90.itg.ti.com ([172.17.2.17])\n\tby lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8BK7FGj010969; \n\tMon, 11 Sep 2017 15:07:15 -0500","from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113])\n\tby dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8BK7FeI030318; \n\tMon, 11 Sep 2017 15:07:15 -0500","from [128.247.59.135] (128.247.59.135) by DLEE70.ent.ti.com\n\t(157.170.170.113) with Microsoft SMTP Server id 14.3.294.0;\n\tMon, 11 Sep 2017 15:07:15 -0500"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1505160435;\n\tbh=ZKXfmVZ90wY0PUWhN+jjUV/kdKXiCRrfunr1xXx7U8E=;\n\th=Subject:To:References:From:Date:In-Reply-To;\n\tb=uGIZ0sTPMZjZpLp+U00CurTtp4DUdTFnc0K9jMrZnj0JR03dZ5O5uy/RckgjqR+pK\n\t7zJnrIrVFlEzLC37W1XAQBuX0m4bY/BB0t8uS5B6tMtJxFS8WRwoS0OQOKVBHO3yht\n\tGXWoiQpbF1wsqsdbyHMrVXBE3b6xO87C3cuPq1g8=","Subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","To":"Sekhar Nori <nsekhar@ti.com>, <wsa@the-dreams.de>,\n\t<robh+dt@kernel.org>, <linux@armlinux.org.uk>,\n\t<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>,\n\t<linux-arm-kernel@lists.infradead.org>, <grygorii.strashko@ti.com>,\n\t<vigneshr@ti.com>","References":"<20170908175448.3367-1-fcooper@ti.com>\n\t<20170908175448.3367-2-fcooper@ti.com>\n\t<57153767-6dee-a5b5-548c-f7b0dc104b46@ti.com>","From":"Franklin S Cooper Jr <fcooper@ti.com>","Message-ID":"<f185afb9-e877-1916-fcbc-c2a28f23b0cc@ti.com>","Date":"Mon, 11 Sep 2017 15:07:15 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<57153767-6dee-a5b5-548c-f7b0dc104b46@ti.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Originating-IP":"[128.247.59.135]","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"}},{"id":1766503,"web_url":"http://patchwork.ozlabs.org/comment/1766503/","msgid":"<94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>","list_archive_url":null,"date":"2017-09-11T20:11:42","subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","submitter":{"id":25084,"url":"http://patchwork.ozlabs.org/api/people/25084/","name":"Grygorii Strashko","email":"grygorii.strashko@ti.com"},"content":"On 09/11/2017 03:07 PM, Franklin S Cooper Jr wrote:\n> \n> \n> On 09/11/2017 06:29 AM, Sekhar Nori wrote:\n>> On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:\n>>> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain\n>>> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime\n>>\n>> unlike ?\n>>\n>>> is required to insure the power domain used by the specific I2C instance is\n>>> properly turned on along with its functional clock.\n>>>\n>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>\n>>> ---\n>>> Version 3 changes:\n>>> Remove several statements that set clk to NULL\n>>> Fix error path\n>>>\n>>>   drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------\n>>>   1 file changed, 53 insertions(+), 11 deletions(-)\n>>\n>>> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>>>   \tdev->clk = devm_clk_get(&pdev->dev, NULL);\n>>>   \tif (IS_ERR(dev->clk))\n>>>   \t\treturn PTR_ERR(dev->clk);\n>>> -\tclk_prepare_enable(dev->clk);\n>>>   \n>>>   \tmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n>>>   \tdev->base = devm_ioremap_resource(&pdev->dev, mem);\n>>>   \tif (IS_ERR(dev->base)) {\n>>> -\t\tr = PTR_ERR(dev->base);\n>>> +\t\treturn PTR_ERR(dev->base);\n>>> +\t}\n>>> +\n>>> +\tpm_runtime_set_autosuspend_delay(dev->dev,\n>>> +\t\t\t\t\t DAVINCI_I2C_PM_TIMEOUT);\n>>> +\tpm_runtime_use_autosuspend(dev->dev);\n>>> +\n>>> +\tpm_runtime_enable(dev->dev);\n>>> +\n>>> +\tr = pm_runtime_get_sync(dev->dev);\n>>> +\tif (r < 0) {\n>>> +\t\tdev_err(dev->dev, \"failed to runtime_get device: %d\\n\", r);\n>>>   \t\tgoto err_unuse_clocks;\n>>\n>> You end up doing a pm_runtime_put_sync() on failure here, instead of\n>> pm_runtime_put_noidle() like rest of the patch.\n>>\n>> May be handle this failure here instead of relying on the goto path.\n> \n> Ok\n\nI think, it's not necessary - pm_runtime_put_sync() can be used in this case\n (and used the same way in many other drivers).\nIn case, of failure in this place - pm_runtime_put_sync() will just decrement usage counter.\n\n\n>>\n>>>   \t}\n>>>   \n>>> @@ -849,27 +878,40 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>>>   \tif (r)\n>>>   \t\tgoto err_unuse_clocks;\n>>>   \n>>> +\tpm_runtime_mark_last_busy(dev->dev);\n>>> +\tpm_runtime_put_autosuspend(dev->dev);\n>>> +\n>>>   \treturn 0;\n>>>   \n>>>   err_unuse_clocks:\n>>> -\tclk_disable_unprepare(dev->clk);\n>>> -\tdev->clk = NULL;\n>>> +\tpm_runtime_dont_use_autosuspend(dev->dev);\n>>> +\tpm_runtime_put_sync(dev->dev);\n>>> +\tpm_runtime_disable(dev->dev);\n>>> +\n>>>   \treturn r;\n>>>   }\n>>\n>> Thanks,\n>> Sekhar\n>>","headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"J8CMEPUD\";\n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xrfJ52CNtz9sCZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 06:13:25 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751052AbdIKUNX (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 11 Sep 2017 16:13:23 -0400","from fllnx209.ext.ti.com ([198.47.19.16]:31644 \"EHLO\n\tfllnx209.ext.ti.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750987AbdIKUNW (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Mon, 11 Sep 2017 16:13:22 -0400","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8BKBllI014465; \n\tMon, 11 Sep 2017 15:11:47 -0500","from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8BKBgOe024355;\n\tMon, 11 Sep 2017 15:11:42 -0500","from [128.247.59.147] (128.247.59.147) by DLEE70.ent.ti.com\n\t(157.170.170.113) with Microsoft SMTP Server id 14.3.294.0;\n\tMon, 11 Sep 2017 15:11:42 -0500"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1505160707;\n\tbh=PjmBID5mWy8b/C5Xa9VeeFRsDNkmtE/7XtbwQPlOE3U=;\n\th=Subject:To:References:From:Date:In-Reply-To;\n\tb=J8CMEPUDplzLK7IHR7oYaBErzVcFOSsDgfQg/64CRMEHmcbBaArAtutzvog0YADmc\n\tYhEN5BKeCqCTpKIzMNqUwmSVs+3TW2wo7Fbbow3gdFdyy+JnyZx+U/T27Bpz9A2/Tf\n\tFF1SMJnzmjslR2v/Fbnfnx0Sdlf9qF76/EUdYRIo=","Subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","To":"Franklin S Cooper Jr <fcooper@ti.com>,\n\tSekhar Nori <nsekhar@ti.com>, <wsa@the-dreams.de>,\n\t<robh+dt@kernel.org>, <linux@armlinux.org.uk>,\n\t<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>,\n\t<linux-arm-kernel@lists.infradead.org>, <vigneshr@ti.com>","References":"<20170908175448.3367-1-fcooper@ti.com>\n\t<20170908175448.3367-2-fcooper@ti.com>\n\t<57153767-6dee-a5b5-548c-f7b0dc104b46@ti.com>\n\t<f185afb9-e877-1916-fcbc-c2a28f23b0cc@ti.com>","From":"Grygorii Strashko <grygorii.strashko@ti.com>","Message-ID":"<94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>","Date":"Mon, 11 Sep 2017 15:11:42 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<f185afb9-e877-1916-fcbc-c2a28f23b0cc@ti.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Originating-IP":"[128.247.59.147]","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"}},{"id":1766753,"web_url":"http://patchwork.ozlabs.org/comment/1766753/","msgid":"<5d8778d8-281c-8926-fec3-f9acf82e342c@ti.com>","list_archive_url":null,"date":"2017-09-12T08:25:52","subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","submitter":{"id":3234,"url":"http://patchwork.ozlabs.org/api/people/3234/","name":"Sekhar Nori","email":"nsekhar@ti.com"},"content":"On Tuesday 12 September 2017 01:41 AM, Grygorii Strashko wrote:\n> \n> \n> On 09/11/2017 03:07 PM, Franklin S Cooper Jr wrote:\n>>\n>>\n>> On 09/11/2017 06:29 AM, Sekhar Nori wrote:\n>>> On Friday 08 September 2017 11:24 PM, Franklin S Cooper Jr wrote:\n>>>> 66AK2G has I2C instances that are not apart of the ALWAYS_ON power domain\n>>>> like other Keystone 2 SoCs and OMAPL138. Therefore, pm_runtime\n>>>\n>>> unlike ?\n>>>\n>>>> is required to insure the power domain used by the specific I2C instance is\n>>>> properly turned on along with its functional clock.\n>>>>\n>>>> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>\n>>>> ---\n>>>> Version 3 changes:\n>>>> Remove several statements that set clk to NULL\n>>>> Fix error path\n>>>>\n>>>>   drivers/i2c/busses/i2c-davinci.c | 64 +++++++++++++++++++++++++++++++++-------\n>>>>   1 file changed, 53 insertions(+), 11 deletions(-)\n>>>\n>>>> @@ -802,12 +821,22 @@ static int davinci_i2c_probe(struct platform_device *pdev)\n>>>>   \tdev->clk = devm_clk_get(&pdev->dev, NULL);\n>>>>   \tif (IS_ERR(dev->clk))\n>>>>   \t\treturn PTR_ERR(dev->clk);\n>>>> -\tclk_prepare_enable(dev->clk);\n>>>>   \n>>>>   \tmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n>>>>   \tdev->base = devm_ioremap_resource(&pdev->dev, mem);\n>>>>   \tif (IS_ERR(dev->base)) {\n>>>> -\t\tr = PTR_ERR(dev->base);\n>>>> +\t\treturn PTR_ERR(dev->base);\n>>>> +\t}\n>>>> +\n>>>> +\tpm_runtime_set_autosuspend_delay(dev->dev,\n>>>> +\t\t\t\t\t DAVINCI_I2C_PM_TIMEOUT);\n>>>> +\tpm_runtime_use_autosuspend(dev->dev);\n>>>> +\n>>>> +\tpm_runtime_enable(dev->dev);\n>>>> +\n>>>> +\tr = pm_runtime_get_sync(dev->dev);\n>>>> +\tif (r < 0) {\n>>>> +\t\tdev_err(dev->dev, \"failed to runtime_get device: %d\\n\", r);\n>>>>   \t\tgoto err_unuse_clocks;\n>>>\n>>> You end up doing a pm_runtime_put_sync() on failure here, instead of\n>>> pm_runtime_put_noidle() like rest of the patch.\n>>>\n>>> May be handle this failure here instead of relying on the goto path.\n>>\n>> Ok\n> \n> I think, it's not necessary - pm_runtime_put_sync() can be used in this case\n>  (and used the same way in many other drivers).\n> In case, of failure in this place - pm_runtime_put_sync() will just decrement usage counter.\n\nCan you please explain why this is the case? At least on DA850, I see\nthe runtime_idle callback invoked from rpm_idle() if\npm_runtime_put_sync() is used in the failure path.\n\nThanks\nSekhar","headers":{"Return-Path":"<linux-i2c-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"DuPRMgqA\";\n\tdkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xryZY0SKDz9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 18:27:01 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751266AbdILI0k (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 12 Sep 2017 04:26:40 -0400","from lelnx194.ext.ti.com ([198.47.27.80]:46435 \"EHLO\n\tlelnx194.ext.ti.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751144AbdILI0i (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Tue, 12 Sep 2017 04:26:38 -0400","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8C8PvV0026737; \n\tTue, 12 Sep 2017 03:25:57 -0500","from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8C8Pvwj020963;\n\tTue, 12 Sep 2017 03:25:57 -0500","from DFLE100.ent.ti.com (10.64.6.21) by DFLE104.ent.ti.com\n\t(10.64.6.25) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tTue, 12 Sep 2017 03:25:56 -0500","from dflp33.itg.ti.com (10.64.6.16) by DFLE100.ent.ti.com\n\t(10.64.6.21) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Tue, 12 Sep 2017 03:25:56 -0500","from [172.24.190.171] (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8C8PrFd031610;\n\tTue, 12 Sep 2017 03:25:54 -0500"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1505204757;\n\tbh=DAfWoveJrxhgfnqNfVloGqFd9QtyfmKXgnOCTiXV5jg=;\n\th=Subject:To:References:From:Date:In-Reply-To;\n\tb=DuPRMgqAGlrz1NS2iqLV5IeWItEZIO9urQaaFBZups3wU85zpBca53kD93emEAr/i\n\tow6AtF9WkpBMMLlkuE/lm0CeRO2GCRLFzwlDhlzl6tmTXojFqgYNTnYTrJAeTewYKi\n\tUNh0kWK3AFG7Pg8r9+Cdh/HfLzJFTd/o4revZS34=","Subject":"Re: [PATCH v3 1/2] i2c: davinci: Add PM Runtime Support","To":"Grygorii Strashko <grygorii.strashko@ti.com>,\n\tFranklin S Cooper Jr <fcooper@ti.com>, <wsa@the-dreams.de>,\n\t<robh+dt@kernel.org>, <linux@armlinux.org.uk>,\n\t<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,\n\t<linux-kernel@vger.kernel.org>,\n\t<linux-arm-kernel@lists.infradead.org>, <vigneshr@ti.com>","References":"<20170908175448.3367-1-fcooper@ti.com>\n\t<20170908175448.3367-2-fcooper@ti.com>\n\t<57153767-6dee-a5b5-548c-f7b0dc104b46@ti.com>\n\t<f185afb9-e877-1916-fcbc-c2a28f23b0cc@ti.com>\n\t<94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>","From":"Sekhar Nori <nsekhar@ti.com>","Message-ID":"<5d8778d8-281c-8926-fec3-f9acf82e342c@ti.com>","Date":"Tue, 12 Sep 2017 13:55:52 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<94b7a185-4cde-03e6-cc17-f64d5d28c9f2@ti.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","Sender":"linux-i2c-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-i2c.vger.kernel.org>","X-Mailing-List":"linux-i2c@vger.kernel.org"}}]