[{"id":1763373,"web_url":"http://patchwork.ozlabs.org/comment/1763373/","msgid":"<20170905134821.vyrita5fssc5uxxh@valkosipuli.retiisi.org.uk>","list_archive_url":null,"date":"2017-09-05T13:48:22","subject":"Re: [PATCH v6 0/3] enable eeprom \"size\" property and runtime pm","submitter":{"id":1593,"url":"http://patchwork.ozlabs.org/api/people/1593/","name":"Sakari Ailus","email":"sakari.ailus@iki.fi"},"content":"Hi Divagar,\n\nOn Mon, Sep 04, 2017 at 03:58:45PM +0530, Divagar Mohandass wrote:\n> This series adds support for eeprom \"size\" property which will be read by the\n> driver for eeprom size. The existing ACPI has a different default size which\n> can be overridden with a DSD property value provided by the platform FW.\n> \n> This series also adds support for runtime PM. The eeprom driver currently\n> did not have support for runtime PM and the device was kept in D0 throughout.\n> \n> [v1]\n> - Add support for eeprom \"size\" property.\n> - Add runtime PM support to the driver.\n> \n> [v2]\n> - Improved the patch subject.\n> \n> [v3]\n> - Addressed comments from Sakari Ailus.\n> - Improved patch description.\n> - Improved pm support patch.\n> \n> [v4]\n> - Improved runtime pm support.\n> - Addressed comments from Sakari Ailus.\n> \n> [v5]\n> - Addressed comments from Sakari Ailus.\n> - Improved error handling for PM support.\n> \n> [v6]\n> - Addressed comments from Sakari Ailus.\n> \n> Divagar Mohandass (3):\n>   dt-bindings: add eeprom \"size\" property\n>   eeprom: at24: add support to fetch eeprom device property \"size\"\n>   eeprom: at24: enable runtime pm support\n> \n>  .../devicetree/bindings/eeprom/eeprom.txt          |  2 ++\n>  drivers/misc/eeprom/at24.c                         | 42 ++++++++++++++++++++++\n>  2 files changed, 44 insertions(+)\n\nThanks for the update!\n\nFor the set:\n\nReviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmp2h2l55z9t2m\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 23:48:28 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751332AbdIENs0 (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 5 Sep 2017 09:48:26 -0400","from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:41394 \"EHLO\n\thillosipuli.retiisi.org.uk\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1750959AbdIENsZ (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 5 Sep 2017 09:48:25 -0400","from valkosipuli.localdomain (valkosipuli.retiisi.org.uk\n\t[IPv6:2001:1bc8:1a6:d3d5::80:2])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 0D4D7600D6;\n\tTue,  5 Sep 2017 16:48:23 +0300 (EEST)","from sakke by valkosipuli.localdomain with local (Exim 4.89)\n\t(envelope-from <sakke@valkosipuli.retiisi.org.uk>)\n\tid 1dpEDG-0002Wr-F4; Tue, 05 Sep 2017 16:48:22 +0300"],"Date":"Tue, 5 Sep 2017 16:48:22 +0300","From":"Sakari Ailus <sakari.ailus@iki.fi>","To":"Divagar Mohandass <divagar.mohandass@intel.com>","Cc":"robh+dt@kernel.org, mark.rutland@arm.com, wsa@the-dreams.de,\n\tdevicetree@vger.kernel.org, linux-i2c@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, rajmohan.mani@intel.com","Subject":"Re: [PATCH v6 0/3] enable eeprom \"size\" property and runtime pm","Message-ID":"<20170905134821.vyrita5fssc5uxxh@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771537,"web_url":"http://patchwork.ozlabs.org/comment/1771537/","msgid":"<6F87890CF0F5204F892DEA1EF0D77A5972FC1250@FMSMSX114.amr.corp.intel.com>","list_archive_url":null,"date":"2017-09-20T03:51:36","subject":"RE: [PATCH v6 0/3] enable eeprom \"size\" property and runtime pm","submitter":{"id":71747,"url":"http://patchwork.ozlabs.org/api/people/71747/","name":"Mani, Rajmohan","email":"rajmohan.mani@intel.com"},"content":"Adding Tomasz...\n\n> -----Original Message-----\n> From: Sakari Ailus [mailto:sakari.ailus@iki.fi]\n> Sent: Tuesday, September 05, 2017 6:48 AM\n> To: Mohandass, Divagar <divagar.mohandass@intel.com>\n> Cc: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n> devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>\n> Subject: Re: [PATCH v6 0/3] enable eeprom \"size\" property and runtime pm\n> \n> Hi Divagar,\n> \n> On Mon, Sep 04, 2017 at 03:58:45PM +0530, Divagar Mohandass wrote:\n> > This series adds support for eeprom \"size\" property which will be read\n> > by the driver for eeprom size. The existing ACPI has a different\n> > default size which can be overridden with a DSD property value provided by\n> the platform FW.\n> >\n> > This series also adds support for runtime PM. The eeprom driver\n> > currently did not have support for runtime PM and the device was kept in D0\n> throughout.\n> >\n> > [v1]\n> > - Add support for eeprom \"size\" property.\n> > - Add runtime PM support to the driver.\n> >\n> > [v2]\n> > - Improved the patch subject.\n> >\n> > [v3]\n> > - Addressed comments from Sakari Ailus.\n> > - Improved patch description.\n> > - Improved pm support patch.\n> >\n> > [v4]\n> > - Improved runtime pm support.\n> > - Addressed comments from Sakari Ailus.\n> >\n> > [v5]\n> > - Addressed comments from Sakari Ailus.\n> > - Improved error handling for PM support.\n> >\n> > [v6]\n> > - Addressed comments from Sakari Ailus.\n> >\n> > Divagar Mohandass (3):\n> >   dt-bindings: add eeprom \"size\" property\n> >   eeprom: at24: add support to fetch eeprom device property \"size\"\n> >   eeprom: at24: enable runtime pm support\n> >\n> >  .../devicetree/bindings/eeprom/eeprom.txt          |  2 ++\n> >  drivers/misc/eeprom/at24.c                         | 42 ++++++++++++++++++++++\n> >  2 files changed, 44 insertions(+)\n> \n> Thanks for the update!\n> \n> For the set:\n> \n> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>\n> \n> --\n> Kind regards,\n> \n> Sakari Ailus\n> e-mail: sakari.ailus@iki.fi\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxm5C30Pyz9s2G\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 13:51:42 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751000AbdITDvk convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 19 Sep 2017 23:51:40 -0400","from mga14.intel.com ([192.55.52.115]:31062 \"EHLO mga14.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1750872AbdITDvj (ORCPT <rfc822;devicetree@vger.kernel.org>);\n\tTue, 19 Sep 2017 23:51:39 -0400","from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Sep 2017 20:51:39 -0700","from fmsmsx103.amr.corp.intel.com ([10.18.124.201])\n\tby fmsmga004.fm.intel.com with ESMTP; 19 Sep 2017 20:51:38 -0700","from fmsmsx102.amr.corp.intel.com (10.18.124.200) by\n\tFMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Tue, 19 Sep 2017 20:51:38 -0700","from fmsmsx114.amr.corp.intel.com ([169.254.6.69]) by\n\tFMSMSX102.amr.corp.intel.com ([169.254.10.194]) with mapi id\n\t14.03.0319.002; Tue, 19 Sep 2017 20:51:37 -0700"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,420,1500966000\"; d=\"scan'208\";a=\"314064933\"","From":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>","To":"Sakari Ailus <sakari.ailus@iki.fi>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>","CC":"\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"tfiga@chromium.org\" <tfiga@chromium.org>","Subject":"RE: [PATCH v6 0/3] enable eeprom \"size\" property and runtime pm","Thread-Topic":"[PATCH v6 0/3] enable eeprom \"size\" property and runtime pm","Thread-Index":"AQHTJWh9QDofkzNwkUSsCXjKod1+vKKmxc4AgBZ2t8A=","Date":"Wed, 20 Sep 2017 03:51:36 +0000","Message-ID":"<6F87890CF0F5204F892DEA1EF0D77A5972FC1250@FMSMSX114.amr.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<20170905134821.vyrita5fssc5uxxh@valkosipuli.retiisi.org.uk>","In-Reply-To":"<20170905134821.vyrita5fssc5uxxh@valkosipuli.retiisi.org.uk>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","dlp-product":"dlpe-windows","dlp-version":"11.0.0.116","dlp-reaction":"no-action","x-originating-ip":"[10.1.200.106]","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"8BIT","MIME-Version":"1.0","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771541,"web_url":"http://patchwork.ozlabs.org/comment/1771541/","msgid":"<6F87890CF0F5204F892DEA1EF0D77A5972FC126B@FMSMSX114.amr.corp.intel.com>","list_archive_url":null,"date":"2017-09-20T03:52:35","subject":"RE: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n\tproperty \"size\"","submitter":{"id":71747,"url":"http://patchwork.ozlabs.org/api/people/71747/","name":"Mani, Rajmohan","email":"rajmohan.mani@intel.com"},"content":"Adding Tomasz...\n\n> -----Original Message-----\n> From: Mohandass, Divagar\n> Sent: Monday, September 04, 2017 3:29 AM\n> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n> sakari.ailus@iki.fi\n> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>;\n> Mohandass, Divagar <divagar.mohandass@intel.com>\n> Subject: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n> property \"size\"\n> \n> Obtain the size of the EEPROM chip from DT if the \"size\" property is specified\n> for the device.\n> \n> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n> ---\n>  drivers/misc/eeprom/at24.c | 4 ++++\n>  1 file changed, 4 insertions(+)\n> \n> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n> 764ff5df..2199c42 100644\n> --- a/drivers/misc/eeprom/at24.c\n> +++ b/drivers/misc/eeprom/at24.c\n> @@ -570,6 +570,10 @@ static void at24_get_pdata(struct device *dev, struct\n> at24_platform_data *chip)\n>  \tif (device_property_present(dev, \"read-only\"))\n>  \t\tchip->flags |= AT24_FLAG_READONLY;\n> \n> +\terr = device_property_read_u32(dev, \"size\", &val);\n> +\tif (!err)\n> +\t\tchip->byte_len = val;\n> +\n>  \terr = device_property_read_u32(dev, \"pagesize\", &val);\n>  \tif (!err) {\n>  \t\tchip->page_size = val;\n> --\n> 1.9.1\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxm6J1D0Qz9s82\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 13:52:40 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751610AbdITDwi convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 19 Sep 2017 23:52:38 -0400","from mga06.intel.com ([134.134.136.31]:15998 \"EHLO mga06.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751605AbdITDwh (ORCPT <rfc822;devicetree@vger.kernel.org>);\n\tTue, 19 Sep 2017 23:52:37 -0400","from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga104.jf.intel.com with ESMTP; 19 Sep 2017 20:52:37 -0700","from fmsmsx105.amr.corp.intel.com ([10.18.124.203])\n\tby fmsmga002.fm.intel.com with ESMTP; 19 Sep 2017 20:52:36 -0700","from fmsmsx152.amr.corp.intel.com (10.18.125.5) by\n\tFMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Tue, 19 Sep 2017 20:52:36 -0700","from fmsmsx114.amr.corp.intel.com ([169.254.6.69]) by\n\tFMSMSX152.amr.corp.intel.com ([169.254.6.196]) with mapi id\n\t14.03.0319.002; Tue, 19 Sep 2017 20:52:36 -0700"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos; i=\"5.42,420,1500966000\"; d=\"scan'208\";\n\ta=\"1221249979\"","From":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>","To":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","CC":"\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"tfiga@chromium.org\" <tfiga@chromium.org>","Subject":"RE: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n\tproperty \"size\"","Thread-Topic":"[PATCH v6 2/3] eeprom: at24: add support to fetch eeprom\n\tdevice property \"size\"","Thread-Index":"AQHTJWiDXt3pjdNqP0iUn3Z9wjJBKaK9POFg","Date":"Wed, 20 Sep 2017 03:52:35 +0000","Message-ID":"<6F87890CF0F5204F892DEA1EF0D77A5972FC126B@FMSMSX114.amr.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-3-git-send-email-divagar.mohandass@intel.com>","In-Reply-To":"<1504520928-5191-3-git-send-email-divagar.mohandass@intel.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","dlp-product":"dlpe-windows","dlp-version":"11.0.0.116","dlp-reaction":"no-action","x-originating-ip":"[10.1.200.106]","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"8BIT","MIME-Version":"1.0","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771543,"web_url":"http://patchwork.ozlabs.org/comment/1771543/","msgid":"<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>","list_archive_url":null,"date":"2017-09-20T03:52:53","subject":"RE: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":71747,"url":"http://patchwork.ozlabs.org/api/people/71747/","name":"Mani, Rajmohan","email":"rajmohan.mani@intel.com"},"content":"Adding Tomasz...\n\n> -----Original Message-----\n> From: Mohandass, Divagar\n> Sent: Monday, September 04, 2017 3:29 AM\n> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n> sakari.ailus@iki.fi\n> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>;\n> Mohandass, Divagar <divagar.mohandass@intel.com>\n> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n> \n> Currently the device is kept in D0, there is an opportunity to save power by\n> enabling runtime pm.\n> \n> Device can be daisy chained from PMIC and we can't rely on I2C core for auto\n> resume/suspend. Driver will decide when to resume/suspend.\n> \n> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n> ---\n>  drivers/misc/eeprom/at24.c | 38\n> ++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 38 insertions(+)\n> \n> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n> 2199c42..d718a7a 100644\n> --- a/drivers/misc/eeprom/at24.c\n> +++ b/drivers/misc/eeprom/at24.c\n> @@ -24,6 +24,7 @@\n>  #include <linux/i2c.h>\n>  #include <linux/nvmem-provider.h>\n>  #include <linux/platform_data/at24.h>\n> +#include <linux/pm_runtime.h>\n> \n>  /*\n>   * I2C EEPROMs from most vendors are inexpensive and mostly\n> interchangeable.\n> @@ -501,11 +502,21 @@ static ssize_t at24_eeprom_write_i2c(struct\n> at24_data *at24, const char *buf,  static int at24_read(void *priv, unsigned int\n> off, void *val, size_t count)  {\n>  \tstruct at24_data *at24 = priv;\n> +\tstruct i2c_client *client;\n>  \tchar *buf = val;\n> +\tint ret;\n> \n>  \tif (unlikely(!count))\n>  \t\treturn count;\n> \n> +\tclient = at24_translate_offset(at24, &off);\n> +\n> +\tret = pm_runtime_get_sync(&client->dev);\n> +\tif (ret < 0) {\n> +\t\tpm_runtime_put_noidle(&client->dev);\n> +\t\treturn ret;\n> +\t}\n> +\n>  \t/*\n>  \t * Read data from chip, protecting against concurrent updates\n>  \t * from this host, but not from other I2C masters.\n> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned int off, void\n> *val, size_t count)\n>  \t\tstatus = at24->read_func(at24, buf, off, count);\n>  \t\tif (status < 0) {\n>  \t\t\tmutex_unlock(&at24->lock);\n> +\t\t\tpm_runtime_put(&client->dev);\n>  \t\t\treturn status;\n>  \t\t}\n>  \t\tbuf += status;\n> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned int off, void\n> *val, size_t count)\n> \n>  \tmutex_unlock(&at24->lock);\n> \n> +\tpm_runtime_put(&client->dev);\n> +\n>  \treturn 0;\n>  }\n> \n>  static int at24_write(void *priv, unsigned int off, void *val, size_t count)  {\n>  \tstruct at24_data *at24 = priv;\n> +\tstruct i2c_client *client;\n>  \tchar *buf = val;\n> +\tint ret;\n> \n>  \tif (unlikely(!count))\n>  \t\treturn -EINVAL;\n> \n> +\tclient = at24_translate_offset(at24, &off);\n> +\n> +\tret = pm_runtime_get_sync(&client->dev);\n> +\tif (ret < 0) {\n> +\t\tpm_runtime_put_noidle(&client->dev);\n> +\t\treturn ret;\n> +\t}\n> +\n>  \t/*\n>  \t * Write data to chip, protecting against concurrent updates\n>  \t * from this host, but not from other I2C masters.\n> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned int off, void\n> *val, size_t count)\n>  \t\tstatus = at24->write_func(at24, buf, off, count);\n>  \t\tif (status < 0) {\n>  \t\t\tmutex_unlock(&at24->lock);\n> +\t\t\tpm_runtime_put(&client->dev);\n>  \t\t\treturn status;\n>  \t\t}\n>  \t\tbuf += status;\n> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned int off, void\n> *val, size_t count)\n> \n>  \tmutex_unlock(&at24->lock);\n> \n> +\tpm_runtime_put(&client->dev);\n> +\n>  \treturn 0;\n>  }\n> \n> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n> struct i2c_device_id *id)\n> \n>  \ti2c_set_clientdata(client, at24);\n> \n> +\t/* enable runtime pm */\n> +\tpm_runtime_get_noresume(&client->dev);\n> +\tpm_runtime_set_active(&client->dev);\n> +\tpm_runtime_enable(&client->dev);\n> +\n>  \t/*\n>  \t * Perform a one-byte test read to verify that the\n>  \t * chip is functional.\n>  \t */\n>  \terr = at24_read(at24, 0, &test_byte, 1);\n> +\tpm_runtime_put(&client->dev);\n>  \tif (err) {\n>  \t\terr = -ENODEV;\n>  \t\tgoto err_clients;\n> @@ -795,6 +828,8 @@ static int at24_probe(struct i2c_client *client, const\n> struct i2c_device_id *id)\n>  \t\tif (at24->client[i])\n>  \t\t\ti2c_unregister_device(at24->client[i]);\n> \n> +\tpm_runtime_disable(&client->dev);\n> +\n>  \treturn err;\n>  }\n> \n> @@ -810,6 +845,9 @@ static int at24_remove(struct i2c_client *client)\n>  \tfor (i = 1; i < at24->num_addresses; i++)\n>  \t\ti2c_unregister_device(at24->client[i]);\n> \n> +\tpm_runtime_disable(&client->dev);\n> +\tpm_runtime_set_suspended(&client->dev);\n> +\n>  \treturn 0;\n>  }\n> \n> --\n> 1.9.1\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxm6d6y1Cz9s2G\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 13:52:57 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751503AbdITDw4 convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 19 Sep 2017 23:52:56 -0400","from mga09.intel.com ([134.134.136.24]:56662 \"EHLO mga09.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751378AbdITDw4 (ORCPT <rfc822;devicetree@vger.kernel.org>);\n\tTue, 19 Sep 2017 23:52:56 -0400","from orsmga005.jf.intel.com ([10.7.209.41])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Sep 2017 20:52:55 -0700","from fmsmsx104.amr.corp.intel.com ([10.18.124.202])\n\tby orsmga005.jf.intel.com with ESMTP; 19 Sep 2017 20:52:55 -0700","from fmsmsx114.amr.corp.intel.com ([169.254.6.69]) by\n\tfmsmsx104.amr.corp.intel.com ([169.254.3.185]) with mapi id\n\t14.03.0319.002; Tue, 19 Sep 2017 20:52:54 -0700"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,420,1500966000\"; d=\"scan'208\";a=\"151241161\"","From":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>","To":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","CC":"\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"tfiga@chromium.org\" <tfiga@chromium.org>","Subject":"RE: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","Thread-Topic":"[PATCH v6 3/3] eeprom: at24: enable runtime pm support","Thread-Index":"AQHTJWiFxfOMJzxx3kiVLiYlncrAOqK9PPvw","Date":"Wed, 20 Sep 2017 03:52:53 +0000","Message-ID":"<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>","In-Reply-To":"<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","dlp-product":"dlpe-windows","dlp-version":"11.0.0.116","dlp-reaction":"no-action","x-originating-ip":"[10.1.200.106]","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"8BIT","MIME-Version":"1.0","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771547,"web_url":"http://patchwork.ozlabs.org/comment/1771547/","msgid":"<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>","list_archive_url":null,"date":"2017-09-20T03:56:09","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":66090,"url":"http://patchwork.ozlabs.org/api/people/66090/","name":"Tomasz Figa","email":"tfiga@chromium.org"},"content":"Thanks Raj.\n\nLet me post my comments inline.\n\nOn Wed, Sep 20, 2017 at 12:52 PM, Mani, Rajmohan\n<rajmohan.mani@intel.com> wrote:\n> Adding Tomasz...\n>\n>> -----Original Message-----\n>> From: Mohandass, Divagar\n>> Sent: Monday, September 04, 2017 3:29 AM\n>> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n>> sakari.ailus@iki.fi\n>> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n>> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>;\n>> Mohandass, Divagar <divagar.mohandass@intel.com>\n>> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n>>\n>> Currently the device is kept in D0, there is an opportunity to save power by\n>> enabling runtime pm.\n>>\n>> Device can be daisy chained from PMIC and we can't rely on I2C core for auto\n>> resume/suspend. Driver will decide when to resume/suspend.\n>>\n>> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n>> ---\n>>  drivers/misc/eeprom/at24.c | 38\n>> ++++++++++++++++++++++++++++++++++++++\n>>  1 file changed, 38 insertions(+)\n>>\n>> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n>> 2199c42..d718a7a 100644\n>> --- a/drivers/misc/eeprom/at24.c\n>> +++ b/drivers/misc/eeprom/at24.c\n>> @@ -24,6 +24,7 @@\n>>  #include <linux/i2c.h>\n>>  #include <linux/nvmem-provider.h>\n>>  #include <linux/platform_data/at24.h>\n>> +#include <linux/pm_runtime.h>\n>>\n>>  /*\n>>   * I2C EEPROMs from most vendors are inexpensive and mostly\n>> interchangeable.\n>> @@ -501,11 +502,21 @@ static ssize_t at24_eeprom_write_i2c(struct\n>> at24_data *at24, const char *buf,  static int at24_read(void *priv, unsigned int\n>> off, void *val, size_t count)  {\n>>       struct at24_data *at24 = priv;\n>> +     struct i2c_client *client;\n>>       char *buf = val;\n>> +     int ret;\n>>\n>>       if (unlikely(!count))\n>>               return count;\n>>\n>> +     client = at24_translate_offset(at24, &off);\n>> +\n>> +     ret = pm_runtime_get_sync(&client->dev);\n>> +     if (ret < 0) {\n>> +             pm_runtime_put_noidle(&client->dev);\n>> +             return ret;\n>> +     }\n>> +\n>>       /*\n>>        * Read data from chip, protecting against concurrent updates\n>>        * from this host, but not from other I2C masters.\n>> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned int off, void\n>> *val, size_t count)\n>>               status = at24->read_func(at24, buf, off, count);\n>>               if (status < 0) {\n>>                       mutex_unlock(&at24->lock);\n>> +                     pm_runtime_put(&client->dev);\n>>                       return status;\n>>               }\n>>               buf += status;\n>> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned int off, void\n>> *val, size_t count)\n>>\n>>       mutex_unlock(&at24->lock);\n>>\n>> +     pm_runtime_put(&client->dev);\n>> +\n>>       return 0;\n>>  }\n>>\n>>  static int at24_write(void *priv, unsigned int off, void *val, size_t count)  {\n>>       struct at24_data *at24 = priv;\n>> +     struct i2c_client *client;\n>>       char *buf = val;\n>> +     int ret;\n>>\n>>       if (unlikely(!count))\n>>               return -EINVAL;\n>>\n>> +     client = at24_translate_offset(at24, &off);\n>> +\n>> +     ret = pm_runtime_get_sync(&client->dev);\n>> +     if (ret < 0) {\n>> +             pm_runtime_put_noidle(&client->dev);\n>> +             return ret;\n>> +     }\n>> +\n>>       /*\n>>        * Write data to chip, protecting against concurrent updates\n>>        * from this host, but not from other I2C masters.\n>> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned int off, void\n>> *val, size_t count)\n>>               status = at24->write_func(at24, buf, off, count);\n>>               if (status < 0) {\n>>                       mutex_unlock(&at24->lock);\n>> +                     pm_runtime_put(&client->dev);\n>>                       return status;\n>>               }\n>>               buf += status;\n>> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned int off, void\n>> *val, size_t count)\n>>\n>>       mutex_unlock(&at24->lock);\n>>\n>> +     pm_runtime_put(&client->dev);\n>> +\n>>       return 0;\n>>  }\n>>\n>> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n>> struct i2c_device_id *id)\n>>\n>>       i2c_set_clientdata(client, at24);\n>>\n>> +     /* enable runtime pm */\n>> +     pm_runtime_get_noresume(&client->dev);\n>> +     pm_runtime_set_active(&client->dev);\n>> +     pm_runtime_enable(&client->dev);\n\nDo we need this get_noresume/set_active dance? I remember it was for\nsome reason needed for PCI devices, but I don't see why for I2C\nanything else than just pm_runtime_enable() would be necessary.\n\nAlso, we enable runtime PM, but we don't provide any callbacks. If\nthere is no callback in any level of the hierarchy, NULL would be\nreturned in [3], making [2] return -ENOSYS and [1] fail. The behavior\ndepends on subsystem and whether the device is attached to a\npm_domain. In our particular case I'd guess the device would be in an\nACPI pm_domain and that would work, but the driver is generic and must\nwork in any cases.\n\n[1] http://elixir.free-electrons.com/linux/v4.4.88/source/drivers/base/power/runtime.c#L738\n[2] http://elixir.free-electrons.com/linux/v4.4.88/source/drivers/base/power/runtime.c#L364\n[3] http://elixir.free-electrons.com/linux/v4.4.88/source/drivers/base/power/runtime.c#L19\n\nBest regards,\nTomasz\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"NDpARFoL\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxmBr5Y0kz9s2G\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 13:56:36 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751016AbdITD4f (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 19 Sep 2017 23:56:35 -0400","from mail-yw0-f175.google.com ([209.85.161.175]:53502 \"EHLO\n\tmail-yw0-f175.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750733AbdITD4d (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 19 Sep 2017 23:56:33 -0400","by mail-yw0-f175.google.com with SMTP id x131so1077868ywa.10\n\tfor <devicetree@vger.kernel.org>;\n\tTue, 19 Sep 2017 20:56:33 -0700 (PDT)","from mail-yw0-f175.google.com (mail-yw0-f175.google.com.\n\t[209.85.161.175]) by smtp.gmail.com with ESMTPSA id\n\to2sm403259ywf.22.2017.09.19.20.56.30\n\tfor <devicetree@vger.kernel.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 20:56:31 -0700 (PDT)","by mail-yw0-f175.google.com with SMTP id r85so1095239ywg.1\n\tfor <devicetree@vger.kernel.org>;\n\tTue, 19 Sep 2017 20:56:30 -0700 (PDT)","by 10.129.153.6 with HTTP; Tue, 19 Sep 2017 20:56:09 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=d5QvbhXwypZf3ssayDypYe924bksyCPDbYRv5Tuh8ss=;\n\tb=NDpARFoL9/JezOwwXT7JEMMNy+DX4BbFBKmJuq2JrAcWqoUAHVyuY+M0hp1tLpg84t\n\tPkVOZeMFEf0as0rhi1ZH9DWTIXXqsW3/+S9RRTvEEHtDJ7+NrLF+Mcs5XZQ7Qa7eGG5j\n\tCmdnVBfo6Nta3ONReHfq6dxO1qdpKeZoBD+K8=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=d5QvbhXwypZf3ssayDypYe924bksyCPDbYRv5Tuh8ss=;\n\tb=P480vT3RW6ecbxNDsEx4Ta8+T3uxjBuygCZdikJ0xxE6CtamMGguwT6bidu4GcXCz0\n\tZdXAQJGYiV8ii44RRqpZo5JacB4TqXVf+yreR+g4f+jOPOYPed/fL6HEk8QPMVmvciEQ\n\tDXZx6RSOg+oYnEbaQrmAlhWIFqxQ9r2oeOoWSgIUQEcvFK9slVS03M3Jmi9RC0AWJZNW\n\tz3c62Hs7425RtKZMk3wlQ/MHQKXr7ExfatmMk/ZB7UeUCmVUi+zr2rB/U2ObSjIqHZG5\n\tzRAYNptcR0hjMQfa6qR/xMWZS7hNyCegWrmxmsv9pJWvKfqZbupAniFmcs5XTOIbwzRS\n\tqXVQ==","X-Gm-Message-State":"AHPjjUiqieU/vGz8ycdqjTQh5d0+C+2Z7MaARmPF7NefJzTWZ4LF10Qn\n\tR3uW1HoIIJjRMYhu86qti5Im4eZjtyA=","X-Received":["by 10.13.204.213 with SMTP id o204mr2701129ywd.1.1505879792459; \n\tTue, 19 Sep 2017 20:56:32 -0700 (PDT)","by 10.129.52.79 with SMTP id b76mr2883372ywa.195.1505879790486; \n\tTue, 19 Sep 2017 20:56:30 -0700 (PDT)"],"X-Google-Smtp-Source":"AOwi7QAU1L7n42cWl9+NQZ3rK5OZOg7gioBM2MZMInTxCPpIwb44iDr8mzhRMhVB44xTkLiOQ4+xFA3DXOHXPd3MkLw=","MIME-Version":"1.0","In-Reply-To":"<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>","From":"Tomasz Figa <tfiga@chromium.org>","Date":"Wed, 20 Sep 2017 12:56:09 +0900","X-Gmail-Original-Message-ID":"<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>","Message-ID":"<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","To":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>","Cc":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771684,"web_url":"http://patchwork.ozlabs.org/comment/1771684/","msgid":"<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>","list_archive_url":null,"date":"2017-09-20T08:45:20","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":1593,"url":"http://patchwork.ozlabs.org/api/people/1593/","name":"Sakari Ailus","email":"sakari.ailus@iki.fi"},"content":"Hi Tomasz,\n\nOn Wed, Sep 20, 2017 at 12:56:09PM +0900, Tomasz Figa wrote:\n> Thanks Raj.\n> \n> Let me post my comments inline.\n> \n> On Wed, Sep 20, 2017 at 12:52 PM, Mani, Rajmohan\n> <rajmohan.mani@intel.com> wrote:\n> > Adding Tomasz...\n> >\n> >> -----Original Message-----\n> >> From: Mohandass, Divagar\n> >> Sent: Monday, September 04, 2017 3:29 AM\n> >> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n> >> sakari.ailus@iki.fi\n> >> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n> >> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>;\n> >> Mohandass, Divagar <divagar.mohandass@intel.com>\n> >> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n> >>\n> >> Currently the device is kept in D0, there is an opportunity to save power by\n> >> enabling runtime pm.\n> >>\n> >> Device can be daisy chained from PMIC and we can't rely on I2C core for auto\n> >> resume/suspend. Driver will decide when to resume/suspend.\n> >>\n> >> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n> >> ---\n> >>  drivers/misc/eeprom/at24.c | 38\n> >> ++++++++++++++++++++++++++++++++++++++\n> >>  1 file changed, 38 insertions(+)\n> >>\n> >> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n> >> 2199c42..d718a7a 100644\n> >> --- a/drivers/misc/eeprom/at24.c\n> >> +++ b/drivers/misc/eeprom/at24.c\n> >> @@ -24,6 +24,7 @@\n> >>  #include <linux/i2c.h>\n> >>  #include <linux/nvmem-provider.h>\n> >>  #include <linux/platform_data/at24.h>\n> >> +#include <linux/pm_runtime.h>\n> >>\n> >>  /*\n> >>   * I2C EEPROMs from most vendors are inexpensive and mostly\n> >> interchangeable.\n> >> @@ -501,11 +502,21 @@ static ssize_t at24_eeprom_write_i2c(struct\n> >> at24_data *at24, const char *buf,  static int at24_read(void *priv, unsigned int\n> >> off, void *val, size_t count)  {\n> >>       struct at24_data *at24 = priv;\n> >> +     struct i2c_client *client;\n> >>       char *buf = val;\n> >> +     int ret;\n> >>\n> >>       if (unlikely(!count))\n> >>               return count;\n> >>\n> >> +     client = at24_translate_offset(at24, &off);\n> >> +\n> >> +     ret = pm_runtime_get_sync(&client->dev);\n> >> +     if (ret < 0) {\n> >> +             pm_runtime_put_noidle(&client->dev);\n> >> +             return ret;\n> >> +     }\n> >> +\n> >>       /*\n> >>        * Read data from chip, protecting against concurrent updates\n> >>        * from this host, but not from other I2C masters.\n> >> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned int off, void\n> >> *val, size_t count)\n> >>               status = at24->read_func(at24, buf, off, count);\n> >>               if (status < 0) {\n> >>                       mutex_unlock(&at24->lock);\n> >> +                     pm_runtime_put(&client->dev);\n> >>                       return status;\n> >>               }\n> >>               buf += status;\n> >> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned int off, void\n> >> *val, size_t count)\n> >>\n> >>       mutex_unlock(&at24->lock);\n> >>\n> >> +     pm_runtime_put(&client->dev);\n> >> +\n> >>       return 0;\n> >>  }\n> >>\n> >>  static int at24_write(void *priv, unsigned int off, void *val, size_t count)  {\n> >>       struct at24_data *at24 = priv;\n> >> +     struct i2c_client *client;\n> >>       char *buf = val;\n> >> +     int ret;\n> >>\n> >>       if (unlikely(!count))\n> >>               return -EINVAL;\n> >>\n> >> +     client = at24_translate_offset(at24, &off);\n> >> +\n> >> +     ret = pm_runtime_get_sync(&client->dev);\n> >> +     if (ret < 0) {\n> >> +             pm_runtime_put_noidle(&client->dev);\n> >> +             return ret;\n> >> +     }\n> >> +\n> >>       /*\n> >>        * Write data to chip, protecting against concurrent updates\n> >>        * from this host, but not from other I2C masters.\n> >> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned int off, void\n> >> *val, size_t count)\n> >>               status = at24->write_func(at24, buf, off, count);\n> >>               if (status < 0) {\n> >>                       mutex_unlock(&at24->lock);\n> >> +                     pm_runtime_put(&client->dev);\n> >>                       return status;\n> >>               }\n> >>               buf += status;\n> >> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned int off, void\n> >> *val, size_t count)\n> >>\n> >>       mutex_unlock(&at24->lock);\n> >>\n> >> +     pm_runtime_put(&client->dev);\n> >> +\n> >>       return 0;\n> >>  }\n> >>\n> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n> >> struct i2c_device_id *id)\n> >>\n> >>       i2c_set_clientdata(client, at24);\n> >>\n> >> +     /* enable runtime pm */\n> >> +     pm_runtime_get_noresume(&client->dev);\n> >> +     pm_runtime_set_active(&client->dev);\n> >> +     pm_runtime_enable(&client->dev);\n> \n> Do we need this get_noresume/set_active dance? I remember it was for\n> some reason needed for PCI devices, but I don't see why for I2C\n> anything else than just pm_runtime_enable() would be necessary.\n\nYou specifically do not need (all) this for PCI devices, but AFAIU for I²C\ndevices you do. The runtime PM status of a device is disabled by default\nand the use count is zero, but on ACPI based systems the device is still\npowered on.\n\n> \n> Also, we enable runtime PM, but we don't provide any callbacks. If\n> there is no callback in any level of the hierarchy, NULL would be\n> returned in [3], making [2] return -ENOSYS and [1] fail. The behavior\n> depends on subsystem and whether the device is attached to a\n> pm_domain. In our particular case I'd guess the device would be in an\n> ACPI pm_domain and that would work, but the driver is generic and must\n> work in any cases.\n\nAgreed.\n\nCc Mika, too.","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxtcX2CVvz9sNw\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 18:45:48 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751758AbdITIp3 (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tWed, 20 Sep 2017 04:45:29 -0400","from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:44444 \"EHLO\n\thillosipuli.retiisi.org.uk\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1751655AbdITIpX (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Wed, 20 Sep 2017 04:45:23 -0400","from valkosipuli.localdomain (valkosipuli.retiisi.org.uk\n\t[IPv6:2001:1bc8:1a6:d3d5::80:2])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id C9C8E600CC;\n\tWed, 20 Sep 2017 11:45:20 +0300 (EEST)","from sakke by valkosipuli.localdomain with local (Exim 4.89)\n\t(envelope-from <sakke@valkosipuli.retiisi.org.uk>)\n\tid 1duadE-0005Je-Bf; Wed, 20 Sep 2017 11:45:20 +0300"],"Date":"Wed, 20 Sep 2017 11:45:20 +0300","From":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","To":"Tomasz Figa <tfiga@chromium.org>","Cc":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\tmika.westerberg@linux.intel.com","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","Message-ID":"<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771698,"web_url":"http://patchwork.ozlabs.org/comment/1771698/","msgid":"<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>","list_archive_url":null,"date":"2017-09-20T08:59:18","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":66090,"url":"http://patchwork.ozlabs.org/api/people/66090/","name":"Tomasz Figa","email":"tfiga@chromium.org"},"content":"On Wed, Sep 20, 2017 at 5:45 PM, sakari.ailus@iki.fi\n<sakari.ailus@iki.fi> wrote:\n> Hi Tomasz,\n>\n> On Wed, Sep 20, 2017 at 12:56:09PM +0900, Tomasz Figa wrote:\n>> Thanks Raj.\n>>\n>> Let me post my comments inline.\n>>\n>> On Wed, Sep 20, 2017 at 12:52 PM, Mani, Rajmohan\n>> <rajmohan.mani@intel.com> wrote:\n>> > Adding Tomasz...\n>> >\n>> >> -----Original Message-----\n>> >> From: Mohandass, Divagar\n>> >> Sent: Monday, September 04, 2017 3:29 AM\n>> >> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n>> >> sakari.ailus@iki.fi\n>> >> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n>> >> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>;\n>> >> Mohandass, Divagar <divagar.mohandass@intel.com>\n>> >> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n>> >>\n>> >> Currently the device is kept in D0, there is an opportunity to save power by\n>> >> enabling runtime pm.\n>> >>\n>> >> Device can be daisy chained from PMIC and we can't rely on I2C core for auto\n>> >> resume/suspend. Driver will decide when to resume/suspend.\n>> >>\n>> >> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n>> >> ---\n>> >>  drivers/misc/eeprom/at24.c | 38\n>> >> ++++++++++++++++++++++++++++++++++++++\n>> >>  1 file changed, 38 insertions(+)\n>> >>\n>> >> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n>> >> 2199c42..d718a7a 100644\n>> >> --- a/drivers/misc/eeprom/at24.c\n>> >> +++ b/drivers/misc/eeprom/at24.c\n>> >> @@ -24,6 +24,7 @@\n>> >>  #include <linux/i2c.h>\n>> >>  #include <linux/nvmem-provider.h>\n>> >>  #include <linux/platform_data/at24.h>\n>> >> +#include <linux/pm_runtime.h>\n>> >>\n>> >>  /*\n>> >>   * I2C EEPROMs from most vendors are inexpensive and mostly\n>> >> interchangeable.\n>> >> @@ -501,11 +502,21 @@ static ssize_t at24_eeprom_write_i2c(struct\n>> >> at24_data *at24, const char *buf,  static int at24_read(void *priv, unsigned int\n>> >> off, void *val, size_t count)  {\n>> >>       struct at24_data *at24 = priv;\n>> >> +     struct i2c_client *client;\n>> >>       char *buf = val;\n>> >> +     int ret;\n>> >>\n>> >>       if (unlikely(!count))\n>> >>               return count;\n>> >>\n>> >> +     client = at24_translate_offset(at24, &off);\n>> >> +\n>> >> +     ret = pm_runtime_get_sync(&client->dev);\n>> >> +     if (ret < 0) {\n>> >> +             pm_runtime_put_noidle(&client->dev);\n>> >> +             return ret;\n>> >> +     }\n>> >> +\n>> >>       /*\n>> >>        * Read data from chip, protecting against concurrent updates\n>> >>        * from this host, but not from other I2C masters.\n>> >> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned int off, void\n>> >> *val, size_t count)\n>> >>               status = at24->read_func(at24, buf, off, count);\n>> >>               if (status < 0) {\n>> >>                       mutex_unlock(&at24->lock);\n>> >> +                     pm_runtime_put(&client->dev);\n>> >>                       return status;\n>> >>               }\n>> >>               buf += status;\n>> >> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned int off, void\n>> >> *val, size_t count)\n>> >>\n>> >>       mutex_unlock(&at24->lock);\n>> >>\n>> >> +     pm_runtime_put(&client->dev);\n>> >> +\n>> >>       return 0;\n>> >>  }\n>> >>\n>> >>  static int at24_write(void *priv, unsigned int off, void *val, size_t count)  {\n>> >>       struct at24_data *at24 = priv;\n>> >> +     struct i2c_client *client;\n>> >>       char *buf = val;\n>> >> +     int ret;\n>> >>\n>> >>       if (unlikely(!count))\n>> >>               return -EINVAL;\n>> >>\n>> >> +     client = at24_translate_offset(at24, &off);\n>> >> +\n>> >> +     ret = pm_runtime_get_sync(&client->dev);\n>> >> +     if (ret < 0) {\n>> >> +             pm_runtime_put_noidle(&client->dev);\n>> >> +             return ret;\n>> >> +     }\n>> >> +\n>> >>       /*\n>> >>        * Write data to chip, protecting against concurrent updates\n>> >>        * from this host, but not from other I2C masters.\n>> >> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned int off, void\n>> >> *val, size_t count)\n>> >>               status = at24->write_func(at24, buf, off, count);\n>> >>               if (status < 0) {\n>> >>                       mutex_unlock(&at24->lock);\n>> >> +                     pm_runtime_put(&client->dev);\n>> >>                       return status;\n>> >>               }\n>> >>               buf += status;\n>> >> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned int off, void\n>> >> *val, size_t count)\n>> >>\n>> >>       mutex_unlock(&at24->lock);\n>> >>\n>> >> +     pm_runtime_put(&client->dev);\n>> >> +\n>> >>       return 0;\n>> >>  }\n>> >>\n>> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n>> >> struct i2c_device_id *id)\n>> >>\n>> >>       i2c_set_clientdata(client, at24);\n>> >>\n>> >> +     /* enable runtime pm */\n>> >> +     pm_runtime_get_noresume(&client->dev);\n>> >> +     pm_runtime_set_active(&client->dev);\n>> >> +     pm_runtime_enable(&client->dev);\n>>\n>> Do we need this get_noresume/set_active dance? I remember it was for\n>> some reason needed for PCI devices, but I don't see why for I2C\n>> anything else than just pm_runtime_enable() would be necessary.\n>\n> You specifically do not need (all) this for PCI devices, but AFAIU for I涎\n> devices you do. The runtime PM status of a device is disabled by default\n> and the use count is zero, but on ACPI based systems the device is still\n> powered on.\n\nOkay, so _get_noresume() and _set_active() would do the thing for ACPI\nindeed, but not sure about other platforms. Perhaps _enable(),\n_get_sync() would be more general?\n\nBets regards,\nTomasz\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Nc7tSqBl\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxtwy71wVz9sNw\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 19:00:02 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751523AbdITI7s (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tWed, 20 Sep 2017 04:59:48 -0400","from mail-yw0-f170.google.com ([209.85.161.170]:47400 \"EHLO\n\tmail-yw0-f170.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751428AbdITI7m (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Wed, 20 Sep 2017 04:59:42 -0400","by mail-yw0-f170.google.com with SMTP id t127so1438472ywg.4\n\tfor <devicetree@vger.kernel.org>;\n\tWed, 20 Sep 2017 01:59:42 -0700 (PDT)","from mail-yw0-f179.google.com (mail-yw0-f179.google.com.\n\t[209.85.161.179]) by smtp.gmail.com with ESMTPSA id\n\tm12sm588833ywh.41.2017.09.20.01.59.39\n\tfor <devicetree@vger.kernel.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 20 Sep 2017 01:59:39 -0700 (PDT)","by mail-yw0-f179.google.com with SMTP id q80so1443969ywg.2\n\tfor <devicetree@vger.kernel.org>;\n\tWed, 20 Sep 2017 01:59:39 -0700 (PDT)","by 10.129.153.6 with HTTP; Wed, 20 Sep 2017 01:59:18 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=jEhRotSWYLCV/IxYspBQ4f6Yena0MCME3H9IT5CyrC4=;\n\tb=Nc7tSqBlo6k7fLEOIOKn9NTxtYVBX7LQCvG0hPRFaO6srPeHNEwjDstTHhbm4/ba0F\n\teFOVxMaT0vXKvl4civ9XrWmcY5lRNE4cPnP0fBibJayUmnLx+c7CJf11bQsGZi8PH1KD\n\tlWvtJwXLaIaZeTJ32RjCmab+2ubAL2cMEWvvc=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=jEhRotSWYLCV/IxYspBQ4f6Yena0MCME3H9IT5CyrC4=;\n\tb=FpszhD8GvQsHjZUcG4MkYxlKAzbfRUxUO2budIGf5b3ceRYUfSUcZIVh0uLKjZ1/zT\n\tYpVgv0W8NTp28cJjolWYzWEfJ+9TgWigFdud6nnPuWhmq69YILfr9BCIxILNUUiEaT8W\n\tPNsvUJlXHpvIqsgXxmDxGEftOJLucbh7BY/jTWHH82oQZxACU+H9a5S76ybMLvZ/WjB8\n\t98Yw6pmox9T5LDjRVBFBtsJSmqX4sXJVyeOWXW1UI5Kni2z1axj4PXmt9rZjunboD/Jp\n\tfK5fc3WFffUAKx3JxBTRY8kTwAUXDX4m+FQbOZkeUgtJj+ELtC5/QMNq7JIYW4eLjios\n\tZHyA==","X-Gm-Message-State":"AHPjjUhdw6JfmUleXKh7z0+fua3LJJnFlifQbnPe7THPzGtiOZhkQ0QM\n\tnRKgcbYNMDma5JvQ7XtAQYS+zqZ1yyg=","X-Received":["by 10.129.166.10 with SMTP id d10mr3173128ywh.108.1505897980983; \n\tWed, 20 Sep 2017 01:59:40 -0700 (PDT)","by 10.129.148.4 with SMTP id l4mr3310738ywg.96.1505897978570;\n\tWed, 20 Sep 2017 01:59:38 -0700 (PDT)"],"X-Google-Smtp-Source":"AOwi7QCNkPp++AXZttoSw/yaB7gV62Bj7jI8yQON0UNlVcgnRG6qoQ4RVzi0n9aolsTyby1qPf41x9ch+A0vJbUpU6U=","MIME-Version":"1.0","In-Reply-To":"<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>","From":"Tomasz Figa <tfiga@chromium.org>","Date":"Wed, 20 Sep 2017 17:59:18 +0900","X-Gmail-Original-Message-ID":"<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>","Message-ID":"<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","To":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","Cc":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\tmika.westerberg@linux.intel.com","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1771708,"web_url":"http://patchwork.ozlabs.org/comment/1771708/","msgid":"<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>","list_archive_url":null,"date":"2017-09-20T09:32:22","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":1593,"url":"http://patchwork.ozlabs.org/api/people/1593/","name":"Sakari Ailus","email":"sakari.ailus@iki.fi"},"content":"Hi Tomasz,\n\nOn Wed, Sep 20, 2017 at 05:59:18PM +0900, Tomasz Figa wrote:\n> On Wed, Sep 20, 2017 at 5:45 PM, sakari.ailus@iki.fi\n> <sakari.ailus@iki.fi> wrote:\n> > Hi Tomasz,\n> >\n> > On Wed, Sep 20, 2017 at 12:56:09PM +0900, Tomasz Figa wrote:\n> >> Thanks Raj.\n> >>\n> >> Let me post my comments inline.\n> >>\n> >> On Wed, Sep 20, 2017 at 12:52 PM, Mani, Rajmohan\n> >> <rajmohan.mani@intel.com> wrote:\n> >> > Adding Tomasz...\n> >> >\n> >> >> -----Original Message-----\n> >> >> From: Mohandass, Divagar\n> >> >> Sent: Monday, September 04, 2017 3:29 AM\n> >> >> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\n> >> >> sakari.ailus@iki.fi\n> >> >> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org; linux-\n> >> >> kernel@vger.kernel.org; Mani, Rajmohan <rajmohan.mani@intel.com>;\n> >> >> Mohandass, Divagar <divagar.mohandass@intel.com>\n> >> >> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n> >> >>\n> >> >> Currently the device is kept in D0, there is an opportunity to save power by\n> >> >> enabling runtime pm.\n> >> >>\n> >> >> Device can be daisy chained from PMIC and we can't rely on I2C core for auto\n> >> >> resume/suspend. Driver will decide when to resume/suspend.\n> >> >>\n> >> >> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n> >> >> ---\n> >> >>  drivers/misc/eeprom/at24.c | 38\n> >> >> ++++++++++++++++++++++++++++++++++++++\n> >> >>  1 file changed, 38 insertions(+)\n> >> >>\n> >> >> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n> >> >> 2199c42..d718a7a 100644\n> >> >> --- a/drivers/misc/eeprom/at24.c\n> >> >> +++ b/drivers/misc/eeprom/at24.c\n> >> >> @@ -24,6 +24,7 @@\n> >> >>  #include <linux/i2c.h>\n> >> >>  #include <linux/nvmem-provider.h>\n> >> >>  #include <linux/platform_data/at24.h>\n> >> >> +#include <linux/pm_runtime.h>\n> >> >>\n> >> >>  /*\n> >> >>   * I2C EEPROMs from most vendors are inexpensive and mostly\n> >> >> interchangeable.\n> >> >> @@ -501,11 +502,21 @@ static ssize_t at24_eeprom_write_i2c(struct\n> >> >> at24_data *at24, const char *buf,  static int at24_read(void *priv, unsigned int\n> >> >> off, void *val, size_t count)  {\n> >> >>       struct at24_data *at24 = priv;\n> >> >> +     struct i2c_client *client;\n> >> >>       char *buf = val;\n> >> >> +     int ret;\n> >> >>\n> >> >>       if (unlikely(!count))\n> >> >>               return count;\n> >> >>\n> >> >> +     client = at24_translate_offset(at24, &off);\n> >> >> +\n> >> >> +     ret = pm_runtime_get_sync(&client->dev);\n> >> >> +     if (ret < 0) {\n> >> >> +             pm_runtime_put_noidle(&client->dev);\n> >> >> +             return ret;\n> >> >> +     }\n> >> >> +\n> >> >>       /*\n> >> >>        * Read data from chip, protecting against concurrent updates\n> >> >>        * from this host, but not from other I2C masters.\n> >> >> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned int off, void\n> >> >> *val, size_t count)\n> >> >>               status = at24->read_func(at24, buf, off, count);\n> >> >>               if (status < 0) {\n> >> >>                       mutex_unlock(&at24->lock);\n> >> >> +                     pm_runtime_put(&client->dev);\n> >> >>                       return status;\n> >> >>               }\n> >> >>               buf += status;\n> >> >> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned int off, void\n> >> >> *val, size_t count)\n> >> >>\n> >> >>       mutex_unlock(&at24->lock);\n> >> >>\n> >> >> +     pm_runtime_put(&client->dev);\n> >> >> +\n> >> >>       return 0;\n> >> >>  }\n> >> >>\n> >> >>  static int at24_write(void *priv, unsigned int off, void *val, size_t count)  {\n> >> >>       struct at24_data *at24 = priv;\n> >> >> +     struct i2c_client *client;\n> >> >>       char *buf = val;\n> >> >> +     int ret;\n> >> >>\n> >> >>       if (unlikely(!count))\n> >> >>               return -EINVAL;\n> >> >>\n> >> >> +     client = at24_translate_offset(at24, &off);\n> >> >> +\n> >> >> +     ret = pm_runtime_get_sync(&client->dev);\n> >> >> +     if (ret < 0) {\n> >> >> +             pm_runtime_put_noidle(&client->dev);\n> >> >> +             return ret;\n> >> >> +     }\n> >> >> +\n> >> >>       /*\n> >> >>        * Write data to chip, protecting against concurrent updates\n> >> >>        * from this host, but not from other I2C masters.\n> >> >> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned int off, void\n> >> >> *val, size_t count)\n> >> >>               status = at24->write_func(at24, buf, off, count);\n> >> >>               if (status < 0) {\n> >> >>                       mutex_unlock(&at24->lock);\n> >> >> +                     pm_runtime_put(&client->dev);\n> >> >>                       return status;\n> >> >>               }\n> >> >>               buf += status;\n> >> >> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned int off, void\n> >> >> *val, size_t count)\n> >> >>\n> >> >>       mutex_unlock(&at24->lock);\n> >> >>\n> >> >> +     pm_runtime_put(&client->dev);\n> >> >> +\n> >> >>       return 0;\n> >> >>  }\n> >> >>\n> >> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n> >> >> struct i2c_device_id *id)\n> >> >>\n> >> >>       i2c_set_clientdata(client, at24);\n> >> >>\n> >> >> +     /* enable runtime pm */\n> >> >> +     pm_runtime_get_noresume(&client->dev);\n> >> >> +     pm_runtime_set_active(&client->dev);\n> >> >> +     pm_runtime_enable(&client->dev);\n> >>\n> >> Do we need this get_noresume/set_active dance? I remember it was for\n> >> some reason needed for PCI devices, but I don't see why for I2C\n> >> anything else than just pm_runtime_enable() would be necessary.\n> >\n> > You specifically do not need (all) this for PCI devices, but AFAIU for I涎\n> > devices you do. The runtime PM status of a device is disabled by default\n> > and the use count is zero, but on ACPI based systems the device is still\n> > powered on.\n> \n> Okay, so _get_noresume() and _set_active() would do the thing for ACPI\n> indeed, but not sure about other platforms. Perhaps _enable(),\n> _get_sync() would be more general?\n\nWhat I ended up doing in e.g. the smiapp driver was to explicitly power the\ndevice on first and then enable runtime PM. (See\ndrivers/media/i2c/smiapp/smiapp-core.c .) This approach works even if\nCONFIG_PM is disabled, both on DT and ACPI.","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxvfd1dKyz9sNw\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 19:32:41 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751499AbdITJc0 (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tWed, 20 Sep 2017 05:32:26 -0400","from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:44872 \"EHLO\n\thillosipuli.retiisi.org.uk\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1751189AbdITJcZ (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Wed, 20 Sep 2017 05:32:25 -0400","from valkosipuli.localdomain (valkosipuli.retiisi.org.uk\n\t[IPv6:2001:1bc8:1a6:d3d5::80:2])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id EE21D600E7;\n\tWed, 20 Sep 2017 12:32:22 +0300 (EEST)","from sakke by valkosipuli.localdomain with local (Exim 4.89)\n\t(envelope-from <sakke@valkosipuli.retiisi.org.uk>)\n\tid 1dubMk-0005Jx-Jh; Wed, 20 Sep 2017 12:32:22 +0300"],"Date":"Wed, 20 Sep 2017 12:32:22 +0300","From":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","To":"Tomasz Figa <tfiga@chromium.org>","Cc":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\tmika.westerberg@linux.intel.com","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","Message-ID":"<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>\n\t<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1773721,"web_url":"http://patchwork.ozlabs.org/comment/1773721/","msgid":"<CAHp75Ve_1oRe6w_yyQW_76NHf-boF+VqYNenTKit0PJPFj+N7A@mail.gmail.com>","list_archive_url":null,"date":"2017-09-22T16:11:40","subject":"Re: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n\tproperty \"size\"","submitter":{"id":4675,"url":"http://patchwork.ozlabs.org/api/people/4675/","name":"Andy Shevchenko","email":"andy.shevchenko@gmail.com"},"content":"On Wed, Sep 20, 2017 at 6:52 AM, Mani, Rajmohan <rajmohan.mani@intel.com> wrote:\n> Adding Tomasz...\n\nPlease, don't top post.\nBetter to resend entire series with all stakeholders included.\n\n>> Obtain the size of the EEPROM chip from DT if the \"size\" property is specified\n>> for the device.\n>>\n\nI guess it lacks\nSuggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>\n\nOther than that, looks good to me!\n\nReviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>\n\n\nWolfram, the binding is ACKed by Rob and this one is in a good shape.\nMoreover, it seems like a demand for the property since some IoT stuff\nwould like to use the driver on ACPI enabled platforms with different\nsizes.\n\nCan you go ahead and apply first two patches? It would be really appreciated.\n\n>> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n>> ---\n>>  drivers/misc/eeprom/at24.c | 4 ++++\n>>  1 file changed, 4 insertions(+)\n>>\n>> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index\n>> 764ff5df..2199c42 100644\n>> --- a/drivers/misc/eeprom/at24.c\n>> +++ b/drivers/misc/eeprom/at24.c\n>> @@ -570,6 +570,10 @@ static void at24_get_pdata(struct device *dev, struct\n>> at24_platform_data *chip)\n>>       if (device_property_present(dev, \"read-only\"))\n>>               chip->flags |= AT24_FLAG_READONLY;\n>>\n>> +     err = device_property_read_u32(dev, \"size\", &val);\n>> +     if (!err)\n>> +             chip->byte_len = val;\n>> +\n>>       err = device_property_read_u32(dev, \"pagesize\", &val);\n>>       if (!err) {\n>>               chip->page_size = val;\n>> --\n>> 1.9.1\n>","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"c/RC18O2\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzJQ8024lz9s83\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tSat, 23 Sep 2017 02:11:43 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752055AbdIVQLm (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tFri, 22 Sep 2017 12:11:42 -0400","from mail-qk0-f193.google.com ([209.85.220.193]:36124 \"EHLO\n\tmail-qk0-f193.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752013AbdIVQLl (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Fri, 22 Sep 2017 12:11:41 -0400","by mail-qk0-f193.google.com with SMTP id i14so924591qke.3;\n\tFri, 22 Sep 2017 09:11:41 -0700 (PDT)","by 10.12.134.221 with HTTP; Fri, 22 Sep 2017 09:11:40 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=6PB+/wS8L93HUOf9nk4KorJHA5g++8l/Yk3Z0Zvu2dM=;\n\tb=c/RC18O2b7X085RBx3Bf4/O7IL4iT1vGX1A6TMR4vHLTEBxqgqslbN2PgsHysNI6bN\n\tUHqA7Mq6gd7ZWj+l5isWbPbh9IgtOG0ObTAe+cLl1k3CEtLaLfCCebGvBBoMFflcwcBB\n\t44tCWG9TtU1QFWPeIDVysj12zgK96bX3kz2vca9VAOgxh5q2JydhdxUDfFNH6jYYm6Ge\n\tAxHCgEEvAjp4YkL5rQjAQlYjCZgHj7OcACi3X8RnqmyJirKuAM7ZfRm/DplVd/4d94uw\n\tC7Jt+9VPr+wQHZclDBNzQE3sIO1ltHe/3XhIXMaANwLMxr4P2LeheHAdNTzG1GIv32cE\n\tV53w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=6PB+/wS8L93HUOf9nk4KorJHA5g++8l/Yk3Z0Zvu2dM=;\n\tb=QSgCwXz6wsnOMKGCNZSsVss5RKsAzYgr9NZT9tnm5KX1JCD+KDpD6soQOwuc5Oai6F\n\tl4GuCHPeyz1DtLWGY8SN3v5lTpDX4/uEuw1h4j+TEEKDK1EFPDgEW7jGueyKdViUQqZ3\n\tOq+/TCNx75KWI8u+IIeSf0gO54GvZ6jnfP/mxcYvnZACizEYJZk6Y348tBCLnN70B/E+\n\t2DmDoB6rKChqWzb55sVpNh1LYIZXsa2lOAMX8QJp+Vy0YE7ZlUtX2HVuY0ucGISl31qM\n\td5huI4FLgOOfuhv/nA+Y1a2N10LKebPeyEDTxe57l61rBIwa5Zy//vRHjsxsYiEcTZtd\n\tQ2gg==","X-Gm-Message-State":"AHPjjUgdkfXTu3AZ0zfTDo1Xf7NQmUvHtGFEz/VEJlGH2DoQdNLVp9MZ\n\t1BXzIqD4Wp+J1Q0sXjKZ14tkYmaUAwSFtktwaS0=","X-Google-Smtp-Source":"AOwi7QBdjZY7WHVw5u46yhY7N7KOTQugWa53OBON5H+a62tfkAFqUfhleV7c2Lq/lvsR12qo0/0evDFyUqBp5mcUNLo=","X-Received":"by 10.55.131.67 with SMTP id f64mr8397196qkd.24.1506096700980;\n\tFri, 22 Sep 2017 09:11:40 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<6F87890CF0F5204F892DEA1EF0D77A5972FC126B@FMSMSX114.amr.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-3-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC126B@FMSMSX114.amr.corp.intel.com>","From":"Andy Shevchenko <andy.shevchenko@gmail.com>","Date":"Fri, 22 Sep 2017 19:11:40 +0300","Message-ID":"<CAHp75Ve_1oRe6w_yyQW_76NHf-boF+VqYNenTKit0PJPFj+N7A@mail.gmail.com>","Subject":"Re: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n\tproperty \"size\"","To":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>","Cc":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"tfiga@chromium.org\" <tfiga@chromium.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1775172,"web_url":"http://patchwork.ozlabs.org/comment/1775172/","msgid":"<7B8CE47BD58441468D2BB13285B50E6031DF0721@BGSMSX107.gar.corp.intel.com>","list_archive_url":null,"date":"2017-09-26T05:29:06","subject":"RE: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n\tproperty \"size\"","submitter":{"id":72054,"url":"http://patchwork.ozlabs.org/api/people/72054/","name":"Divagar Mohandass","email":"divagar.mohandass@intel.com"},"content":"Hi Andy,\r\n\r\nSorry missed the 'Suggested-by' tag. Can I resend the v6 with this change, so that Wolfram can pick these patches ?\r\n\r\n---\r\n^Divagar\r\n\r\n>-----Original Message-----\r\n>From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com]\r\n>Sent: Friday, September 22, 2017 9:42 PM\r\n>To: Mani, Rajmohan <rajmohan.mani@intel.com>\r\n>Cc: Mohandass, Divagar <divagar.mohandass@intel.com>;\r\n>robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-dreams.de;\r\n>sakari.ailus@iki.fi; devicetree@vger.kernel.org; linux-i2c@vger.kernel.org;\r\n>linux-kernel@vger.kernel.org; tfiga@chromium.org\r\n>Subject: Re: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom\r\n>device property \"size\"\r\n>\r\n>On Wed, Sep 20, 2017 at 6:52 AM, Mani, Rajmohan\r\n><rajmohan.mani@intel.com> wrote:\r\n>> Adding Tomasz...\r\n>\r\n>Please, don't top post.\r\n>Better to resend entire series with all stakeholders included.\r\n>\r\n>>> Obtain the size of the EEPROM chip from DT if the \"size\" property is\r\n>>> specified for the device.\r\n>>>\r\n>\r\n>I guess it lacks\r\n>Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>\r\n>\r\n>Other than that, looks good to me!\r\n>\r\n>Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>\r\n>\r\n>\r\n>Wolfram, the binding is ACKed by Rob and this one is in a good shape.\r\n>Moreover, it seems like a demand for the property since some IoT stuff\r\n>would like to use the driver on ACPI enabled platforms with different sizes.\r\n>\r\n>Can you go ahead and apply first two patches? It would be really appreciated.\r\n>\r\n>>> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\r\n>>> ---\r\n>>>  drivers/misc/eeprom/at24.c | 4 ++++\r\n>>>  1 file changed, 4 insertions(+)\r\n>>>\r\n>>> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c\r\n>>> index\r\n>>> 764ff5df..2199c42 100644\r\n>>> --- a/drivers/misc/eeprom/at24.c\r\n>>> +++ b/drivers/misc/eeprom/at24.c\r\n>>> @@ -570,6 +570,10 @@ static void at24_get_pdata(struct device *dev,\r\n>>> struct at24_platform_data *chip)\r\n>>>       if (device_property_present(dev, \"read-only\"))\r\n>>>               chip->flags |= AT24_FLAG_READONLY;\r\n>>>\r\n>>> +     err = device_property_read_u32(dev, \"size\", &val);\r\n>>> +     if (!err)\r\n>>> +             chip->byte_len = val;\r\n>>> +\r\n>>>       err = device_property_read_u32(dev, \"pagesize\", &val);\r\n>>>       if (!err) {\r\n>>>               chip->page_size = val;\r\n>>> --\r\n>>> 1.9.1\r\n>>\r\n>\r\n>\r\n>\r\n>--\r\n>With Best Regards,\r\n>Andy Shevchenko","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1TzJ6wmjz9t30\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 15:29:32 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S935768AbdIZF3V (ORCPT <rfc822; incoming-dt@patchwork.ozlabs.org>);\n\tTue, 26 Sep 2017 01:29:21 -0400","from mga02.intel.com ([134.134.136.20]:4349 \"EHLO mga02.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S934482AbdIZF3U (ORCPT <rfc822;devicetree@vger.kernel.org>);\n\tTue, 26 Sep 2017 01:29:20 -0400","from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Sep 2017 22:29:14 -0700","from fmsmsx103.amr.corp.intel.com ([10.18.124.201])\n\tby fmsmga006.fm.intel.com with ESMTP; 25 Sep 2017 22:29:14 -0700","from fmsmsx118.amr.corp.intel.com (10.18.116.18) by\n\tFMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Mon, 25 Sep 2017 22:29:14 -0700","from bgsmsx151.gar.corp.intel.com (10.224.48.42) by\n\tfmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Mon, 25 Sep 2017 22:29:13 -0700","from BGSMSX107.gar.corp.intel.com ([169.254.9.43]) by\n\tBGSMSX151.gar.corp.intel.com ([169.254.3.47]) with mapi id\n\t14.03.0319.002; Tue, 26 Sep 2017 10:59:07 +0530"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,439,1500966000\"; d=\"scan'208\";a=\"155993882\"","From":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>","To":"Andy Shevchenko <andy.shevchenko@gmail.com>,\n\t\"Mani, Rajmohan\" <rajmohan.mani@intel.com>","CC":"\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"tfiga@chromium.org\" <tfiga@chromium.org>","Subject":"RE: [PATCH v6 2/3] eeprom: at24: add support to fetch eeprom device\n\tproperty \"size\"","Thread-Topic":"[PATCH v6 2/3] eeprom: at24: add support to fetch eeprom\n\tdevice property \"size\"","Thread-Index":"AQHTJWiECibaB709iEy9EcM98aZcmKK84MWAgAPzKQCABeib4A==","Date":"Tue, 26 Sep 2017 05:29:06 +0000","Message-ID":"<7B8CE47BD58441468D2BB13285B50E6031DF0721@BGSMSX107.gar.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-3-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC126B@FMSMSX114.amr.corp.intel.com>\n\t<CAHp75Ve_1oRe6w_yyQW_76NHf-boF+VqYNenTKit0PJPFj+N7A@mail.gmail.com>","In-Reply-To":"<CAHp75Ve_1oRe6w_yyQW_76NHf-boF+VqYNenTKit0PJPFj+N7A@mail.gmail.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","dlp-product":"dlpe-windows","dlp-version":"11.0.0.116","dlp-reaction":"no-action","x-originating-ip":"[10.223.10.10]","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","MIME-Version":"1.0","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1775174,"web_url":"http://patchwork.ozlabs.org/comment/1775174/","msgid":"<7B8CE47BD58441468D2BB13285B50E6031DF0734@BGSMSX107.gar.corp.intel.com>","list_archive_url":null,"date":"2017-09-26T05:29:26","subject":"RE: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":72054,"url":"http://patchwork.ozlabs.org/api/people/72054/","name":"Divagar Mohandass","email":"divagar.mohandass@intel.com"},"content":"Hi Sakari & Tomas,\r\n\r\nAre you ok with the current revision, let me know if any changes are needed.\r\n\r\n---\r\n^Divagar\r\n\r\n>-----Original Message-----\r\n>From: sakari.ailus@iki.fi [mailto:sakari.ailus@iki.fi]\r\n>Sent: Wednesday, September 20, 2017 3:02 PM\r\n>To: Tomasz Figa <tfiga@chromium.org>\r\n>Cc: Mani, Rajmohan <rajmohan.mani@intel.com>; Mohandass, Divagar\r\n><divagar.mohandass@intel.com>; robh+dt@kernel.org;\r\n>mark.rutland@arm.com; wsa@the-dreams.de; devicetree@vger.kernel.org;\r\n>linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org;\r\n>mika.westerberg@linux.intel.com\r\n>Subject: Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\r\n>\r\n>Hi Tomasz,\r\n>\r\n>On Wed, Sep 20, 2017 at 05:59:18PM +0900, Tomasz Figa wrote:\r\n>> On Wed, Sep 20, 2017 at 5:45 PM, sakari.ailus@iki.fi\r\n>> <sakari.ailus@iki.fi> wrote:\r\n>> > Hi Tomasz,\r\n>> >\r\n>> > On Wed, Sep 20, 2017 at 12:56:09PM +0900, Tomasz Figa wrote:\r\n>> >> Thanks Raj.\r\n>> >>\r\n>> >> Let me post my comments inline.\r\n>> >>\r\n>> >> On Wed, Sep 20, 2017 at 12:52 PM, Mani, Rajmohan\r\n>> >> <rajmohan.mani@intel.com> wrote:\r\n>> >> > Adding Tomasz...\r\n>> >> >\r\n>> >> >> -----Original Message-----\r\n>> >> >> From: Mohandass, Divagar\r\n>> >> >> Sent: Monday, September 04, 2017 3:29 AM\r\n>> >> >> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-\r\n>dreams.de;\r\n>> >> >> sakari.ailus@iki.fi\r\n>> >> >> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org;\r\n>> >> >> linux- kernel@vger.kernel.org; Mani, Rajmohan\r\n>> >> >> <rajmohan.mani@intel.com>; Mohandass, Divagar\r\n>> >> >> <divagar.mohandass@intel.com>\r\n>> >> >> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\r\n>> >> >>\r\n>> >> >> Currently the device is kept in D0, there is an opportunity to\r\n>> >> >> save power by enabling runtime pm.\r\n>> >> >>\r\n>> >> >> Device can be daisy chained from PMIC and we can't rely on I2C\r\n>> >> >> core for auto resume/suspend. Driver will decide when to\r\n>resume/suspend.\r\n>> >> >>\r\n>> >> >> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\r\n>> >> >> ---\r\n>> >> >>  drivers/misc/eeprom/at24.c | 38\r\n>> >> >> ++++++++++++++++++++++++++++++++++++++\r\n>> >> >>  1 file changed, 38 insertions(+)\r\n>> >> >>\r\n>> >> >> diff --git a/drivers/misc/eeprom/at24.c\r\n>> >> >> b/drivers/misc/eeprom/at24.c index 2199c42..d718a7a 100644\r\n>> >> >> --- a/drivers/misc/eeprom/at24.c\r\n>> >> >> +++ b/drivers/misc/eeprom/at24.c\r\n>> >> >> @@ -24,6 +24,7 @@\r\n>> >> >>  #include <linux/i2c.h>\r\n>> >> >>  #include <linux/nvmem-provider.h>  #include\r\n>> >> >> <linux/platform_data/at24.h>\r\n>> >> >> +#include <linux/pm_runtime.h>\r\n>> >> >>\r\n>> >> >>  /*\r\n>> >> >>   * I2C EEPROMs from most vendors are inexpensive and mostly\r\n>> >> >> interchangeable.\r\n>> >> >> @@ -501,11 +502,21 @@ static ssize_t\r\n>> >> >> at24_eeprom_write_i2c(struct at24_data *at24, const char *buf,\r\n>> >> >> static int at24_read(void *priv, unsigned int off, void *val, size_t\r\n>count)  {\r\n>> >> >>       struct at24_data *at24 = priv;\r\n>> >> >> +     struct i2c_client *client;\r\n>> >> >>       char *buf = val;\r\n>> >> >> +     int ret;\r\n>> >> >>\r\n>> >> >>       if (unlikely(!count))\r\n>> >> >>               return count;\r\n>> >> >>\r\n>> >> >> +     client = at24_translate_offset(at24, &off);\r\n>> >> >> +\r\n>> >> >> +     ret = pm_runtime_get_sync(&client->dev);\r\n>> >> >> +     if (ret < 0) {\r\n>> >> >> +             pm_runtime_put_noidle(&client->dev);\r\n>> >> >> +             return ret;\r\n>> >> >> +     }\r\n>> >> >> +\r\n>> >> >>       /*\r\n>> >> >>        * Read data from chip, protecting against concurrent updates\r\n>> >> >>        * from this host, but not from other I2C masters.\r\n>> >> >> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned\r\n>> >> >> int off, void *val, size_t count)\r\n>> >> >>               status = at24->read_func(at24, buf, off, count);\r\n>> >> >>               if (status < 0) {\r\n>> >> >>                       mutex_unlock(&at24->lock);\r\n>> >> >> +                     pm_runtime_put(&client->dev);\r\n>> >> >>                       return status;\r\n>> >> >>               }\r\n>> >> >>               buf += status;\r\n>> >> >> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned\r\n>> >> >> int off, void *val, size_t count)\r\n>> >> >>\r\n>> >> >>       mutex_unlock(&at24->lock);\r\n>> >> >>\r\n>> >> >> +     pm_runtime_put(&client->dev);\r\n>> >> >> +\r\n>> >> >>       return 0;\r\n>> >> >>  }\r\n>> >> >>\r\n>> >> >>  static int at24_write(void *priv, unsigned int off, void *val, size_t\r\n>count)  {\r\n>> >> >>       struct at24_data *at24 = priv;\r\n>> >> >> +     struct i2c_client *client;\r\n>> >> >>       char *buf = val;\r\n>> >> >> +     int ret;\r\n>> >> >>\r\n>> >> >>       if (unlikely(!count))\r\n>> >> >>               return -EINVAL;\r\n>> >> >>\r\n>> >> >> +     client = at24_translate_offset(at24, &off);\r\n>> >> >> +\r\n>> >> >> +     ret = pm_runtime_get_sync(&client->dev);\r\n>> >> >> +     if (ret < 0) {\r\n>> >> >> +             pm_runtime_put_noidle(&client->dev);\r\n>> >> >> +             return ret;\r\n>> >> >> +     }\r\n>> >> >> +\r\n>> >> >>       /*\r\n>> >> >>        * Write data to chip, protecting against concurrent updates\r\n>> >> >>        * from this host, but not from other I2C masters.\r\n>> >> >> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned\r\n>> >> >> int off, void *val, size_t count)\r\n>> >> >>               status = at24->write_func(at24, buf, off, count);\r\n>> >> >>               if (status < 0) {\r\n>> >> >>                       mutex_unlock(&at24->lock);\r\n>> >> >> +                     pm_runtime_put(&client->dev);\r\n>> >> >>                       return status;\r\n>> >> >>               }\r\n>> >> >>               buf += status;\r\n>> >> >> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned\r\n>> >> >> int off, void *val, size_t count)\r\n>> >> >>\r\n>> >> >>       mutex_unlock(&at24->lock);\r\n>> >> >>\r\n>> >> >> +     pm_runtime_put(&client->dev);\r\n>> >> >> +\r\n>> >> >>       return 0;\r\n>> >> >>  }\r\n>> >> >>\r\n>> >> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client\r\n>> >> >> *client, const struct i2c_device_id *id)\r\n>> >> >>\r\n>> >> >>       i2c_set_clientdata(client, at24);\r\n>> >> >>\r\n>> >> >> +     /* enable runtime pm */\r\n>> >> >> +     pm_runtime_get_noresume(&client->dev);\r\n>> >> >> +     pm_runtime_set_active(&client->dev);\r\n>> >> >> +     pm_runtime_enable(&client->dev);\r\n>> >>\r\n>> >> Do we need this get_noresume/set_active dance? I remember it was\r\n>> >> for some reason needed for PCI devices, but I don't see why for I2C\r\n>> >> anything else than just pm_runtime_enable() would be necessary.\r\n>> >\r\n>> > You specifically do not need (all) this for PCI devices, but AFAIU\r\n>> > for I涎\r\n>> > devices you do. The runtime PM status of a device is disabled by\r\n>> > default and the use count is zero, but on ACPI based systems the\r\n>> > device is still powered on.\r\n>>\r\n>> Okay, so _get_noresume() and _set_active() would do the thing for ACPI\r\n>> indeed, but not sure about other platforms. Perhaps _enable(),\r\n>> _get_sync() would be more general?\r\n>\r\n>What I ended up doing in e.g. the smiapp driver was to explicitly power the\r\n>device on first and then enable runtime PM. (See\r\n>drivers/media/i2c/smiapp/smiapp-core.c .) This approach works even if\r\n>CONFIG_PM is disabled, both on DT and ACPI.\r\n>\r\n>--\r\n>Regards,\r\n>\r\n>Sakari Ailus\r\n>e-mail: sakari.ailus@iki.fi","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1TzZ4ghlz9t3B\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 15:29:46 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S936329AbdIZF3d (ORCPT <rfc822; incoming-dt@patchwork.ozlabs.org>);\n\tTue, 26 Sep 2017 01:29:33 -0400","from mga07.intel.com ([134.134.136.100]:39682 \"EHLO\n\tmga07.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S934482AbdIZF3c (ORCPT <rfc822;devicetree@vger.kernel.org>);\n\tTue, 26 Sep 2017 01:29:32 -0400","from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga105.jf.intel.com with ESMTP; 25 Sep 2017 22:29:31 -0700","from fmsmsx105.amr.corp.intel.com ([10.18.124.203])\n\tby orsmga002.jf.intel.com with ESMTP; 25 Sep 2017 22:29:30 -0700","from fmsmsx154.amr.corp.intel.com (10.18.116.70) by\n\tFMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Mon, 25 Sep 2017 22:29:30 -0700","from bgsmsx101.gar.corp.intel.com (10.223.4.170) by\n\tFMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP\n\tServer (TLS) id 14.3.319.2; Mon, 25 Sep 2017 22:29:30 -0700","from BGSMSX107.gar.corp.intel.com ([169.254.9.43]) by\n\tBGSMSX101.gar.corp.intel.com ([169.254.1.62]) with mapi id\n\t14.03.0319.002; Tue, 26 Sep 2017 10:59:26 +0530"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.42,439,1500966000\"; d=\"scan'208\";a=\"139437790\"","From":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>","To":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>,\n\tTomasz Figa <tfiga@chromium.org>","CC":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"mika.westerberg@linux.intel.com\" <mika.westerberg@linux.intel.com>","Subject":"RE: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","Thread-Topic":"[PATCH v6 3/3] eeprom: at24: enable runtime pm support","Thread-Index":"AQHTJWiHSjUrnL9UXU+AIW3QOhavW6K84NqAgAAA6oCAAFDMAIAAA+cAgAAJPQCACXygQA==","Date":"Tue, 26 Sep 2017 05:29:26 +0000","Message-ID":"<7B8CE47BD58441468D2BB13285B50E6031DF0734@BGSMSX107.gar.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>\n\t<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>\n\t<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>","In-Reply-To":"<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","dlp-product":"dlpe-windows","dlp-version":"11.0.0.116","dlp-reaction":"no-action","x-originating-ip":"[10.223.10.10]","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","MIME-Version":"1.0","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1775176,"web_url":"http://patchwork.ozlabs.org/comment/1775176/","msgid":"<CAAFQd5AQX+OuxkkXsyBXO3v-Fyv49kOK9Gdpcp1+XgZLm0KMHQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-26T05:33:37","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":66090,"url":"http://patchwork.ozlabs.org/api/people/66090/","name":"Tomasz Figa","email":"tfiga@chromium.org"},"content":"[+Rafael, Ulf]\n\nOn Tue, Sep 26, 2017 at 2:29 PM, Mohandass, Divagar\n<divagar.mohandass@intel.com> wrote:\n> Hi Sakari & Tomas,\n>\n> Are you ok with the current revision, let me know if any changes are needed.\n\nNope, my concerns have not been addressed, but we need someone from\nthe PM world to clarify how we should do this to work on all\nplatforms.\n\nBest regards,\nTomasz\n\nP.S. Please avoid top-posting on mailing lists, it is considered bad manner.\n\n>\n> ---\n> ^Divagar\n>\n>>-----Original Message-----\n>>From: sakari.ailus@iki.fi [mailto:sakari.ailus@iki.fi]\n>>Sent: Wednesday, September 20, 2017 3:02 PM\n>>To: Tomasz Figa <tfiga@chromium.org>\n>>Cc: Mani, Rajmohan <rajmohan.mani@intel.com>; Mohandass, Divagar\n>><divagar.mohandass@intel.com>; robh+dt@kernel.org;\n>>mark.rutland@arm.com; wsa@the-dreams.de; devicetree@vger.kernel.org;\n>>linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org;\n>>mika.westerberg@linux.intel.com\n>>Subject: Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n>>\n>>Hi Tomasz,\n>>\n>>On Wed, Sep 20, 2017 at 05:59:18PM +0900, Tomasz Figa wrote:\n>>> On Wed, Sep 20, 2017 at 5:45 PM, sakari.ailus@iki.fi\n>>> <sakari.ailus@iki.fi> wrote:\n>>> > Hi Tomasz,\n>>> >\n>>> > On Wed, Sep 20, 2017 at 12:56:09PM +0900, Tomasz Figa wrote:\n>>> >> Thanks Raj.\n>>> >>\n>>> >> Let me post my comments inline.\n>>> >>\n>>> >> On Wed, Sep 20, 2017 at 12:52 PM, Mani, Rajmohan\n>>> >> <rajmohan.mani@intel.com> wrote:\n>>> >> > Adding Tomasz...\n>>> >> >\n>>> >> >> -----Original Message-----\n>>> >> >> From: Mohandass, Divagar\n>>> >> >> Sent: Monday, September 04, 2017 3:29 AM\n>>> >> >> To: robh+dt@kernel.org; mark.rutland@arm.com; wsa@the-\n>>dreams.de;\n>>> >> >> sakari.ailus@iki.fi\n>>> >> >> Cc: devicetree@vger.kernel.org; linux-i2c@vger.kernel.org;\n>>> >> >> linux- kernel@vger.kernel.org; Mani, Rajmohan\n>>> >> >> <rajmohan.mani@intel.com>; Mohandass, Divagar\n>>> >> >> <divagar.mohandass@intel.com>\n>>> >> >> Subject: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n>>> >> >>\n>>> >> >> Currently the device is kept in D0, there is an opportunity to\n>>> >> >> save power by enabling runtime pm.\n>>> >> >>\n>>> >> >> Device can be daisy chained from PMIC and we can't rely on I2C\n>>> >> >> core for auto resume/suspend. Driver will decide when to\n>>resume/suspend.\n>>> >> >>\n>>> >> >> Signed-off-by: Divagar Mohandass <divagar.mohandass@intel.com>\n>>> >> >> ---\n>>> >> >>  drivers/misc/eeprom/at24.c | 38\n>>> >> >> ++++++++++++++++++++++++++++++++++++++\n>>> >> >>  1 file changed, 38 insertions(+)\n>>> >> >>\n>>> >> >> diff --git a/drivers/misc/eeprom/at24.c\n>>> >> >> b/drivers/misc/eeprom/at24.c index 2199c42..d718a7a 100644\n>>> >> >> --- a/drivers/misc/eeprom/at24.c\n>>> >> >> +++ b/drivers/misc/eeprom/at24.c\n>>> >> >> @@ -24,6 +24,7 @@\n>>> >> >>  #include <linux/i2c.h>\n>>> >> >>  #include <linux/nvmem-provider.h>  #include\n>>> >> >> <linux/platform_data/at24.h>\n>>> >> >> +#include <linux/pm_runtime.h>\n>>> >> >>\n>>> >> >>  /*\n>>> >> >>   * I2C EEPROMs from most vendors are inexpensive and mostly\n>>> >> >> interchangeable.\n>>> >> >> @@ -501,11 +502,21 @@ static ssize_t\n>>> >> >> at24_eeprom_write_i2c(struct at24_data *at24, const char *buf,\n>>> >> >> static int at24_read(void *priv, unsigned int off, void *val, size_t\n>>count)  {\n>>> >> >>       struct at24_data *at24 = priv;\n>>> >> >> +     struct i2c_client *client;\n>>> >> >>       char *buf = val;\n>>> >> >> +     int ret;\n>>> >> >>\n>>> >> >>       if (unlikely(!count))\n>>> >> >>               return count;\n>>> >> >>\n>>> >> >> +     client = at24_translate_offset(at24, &off);\n>>> >> >> +\n>>> >> >> +     ret = pm_runtime_get_sync(&client->dev);\n>>> >> >> +     if (ret < 0) {\n>>> >> >> +             pm_runtime_put_noidle(&client->dev);\n>>> >> >> +             return ret;\n>>> >> >> +     }\n>>> >> >> +\n>>> >> >>       /*\n>>> >> >>        * Read data from chip, protecting against concurrent updates\n>>> >> >>        * from this host, but not from other I2C masters.\n>>> >> >> @@ -518,6 +529,7 @@ static int at24_read(void *priv, unsigned\n>>> >> >> int off, void *val, size_t count)\n>>> >> >>               status = at24->read_func(at24, buf, off, count);\n>>> >> >>               if (status < 0) {\n>>> >> >>                       mutex_unlock(&at24->lock);\n>>> >> >> +                     pm_runtime_put(&client->dev);\n>>> >> >>                       return status;\n>>> >> >>               }\n>>> >> >>               buf += status;\n>>> >> >> @@ -527,17 +539,29 @@ static int at24_read(void *priv, unsigned\n>>> >> >> int off, void *val, size_t count)\n>>> >> >>\n>>> >> >>       mutex_unlock(&at24->lock);\n>>> >> >>\n>>> >> >> +     pm_runtime_put(&client->dev);\n>>> >> >> +\n>>> >> >>       return 0;\n>>> >> >>  }\n>>> >> >>\n>>> >> >>  static int at24_write(void *priv, unsigned int off, void *val, size_t\n>>count)  {\n>>> >> >>       struct at24_data *at24 = priv;\n>>> >> >> +     struct i2c_client *client;\n>>> >> >>       char *buf = val;\n>>> >> >> +     int ret;\n>>> >> >>\n>>> >> >>       if (unlikely(!count))\n>>> >> >>               return -EINVAL;\n>>> >> >>\n>>> >> >> +     client = at24_translate_offset(at24, &off);\n>>> >> >> +\n>>> >> >> +     ret = pm_runtime_get_sync(&client->dev);\n>>> >> >> +     if (ret < 0) {\n>>> >> >> +             pm_runtime_put_noidle(&client->dev);\n>>> >> >> +             return ret;\n>>> >> >> +     }\n>>> >> >> +\n>>> >> >>       /*\n>>> >> >>        * Write data to chip, protecting against concurrent updates\n>>> >> >>        * from this host, but not from other I2C masters.\n>>> >> >> @@ -550,6 +574,7 @@ static int at24_write(void *priv, unsigned\n>>> >> >> int off, void *val, size_t count)\n>>> >> >>               status = at24->write_func(at24, buf, off, count);\n>>> >> >>               if (status < 0) {\n>>> >> >>                       mutex_unlock(&at24->lock);\n>>> >> >> +                     pm_runtime_put(&client->dev);\n>>> >> >>                       return status;\n>>> >> >>               }\n>>> >> >>               buf += status;\n>>> >> >> @@ -559,6 +584,8 @@ static int at24_write(void *priv, unsigned\n>>> >> >> int off, void *val, size_t count)\n>>> >> >>\n>>> >> >>       mutex_unlock(&at24->lock);\n>>> >> >>\n>>> >> >> +     pm_runtime_put(&client->dev);\n>>> >> >> +\n>>> >> >>       return 0;\n>>> >> >>  }\n>>> >> >>\n>>> >> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client\n>>> >> >> *client, const struct i2c_device_id *id)\n>>> >> >>\n>>> >> >>       i2c_set_clientdata(client, at24);\n>>> >> >>\n>>> >> >> +     /* enable runtime pm */\n>>> >> >> +     pm_runtime_get_noresume(&client->dev);\n>>> >> >> +     pm_runtime_set_active(&client->dev);\n>>> >> >> +     pm_runtime_enable(&client->dev);\n>>> >>\n>>> >> Do we need this get_noresume/set_active dance? I remember it was\n>>> >> for some reason needed for PCI devices, but I don't see why for I2C\n>>> >> anything else than just pm_runtime_enable() would be necessary.\n>>> >\n>>> > You specifically do not need (all) this for PCI devices, but AFAIU\n>>> > for I涎\n>>> > devices you do. The runtime PM status of a device is disabled by\n>>> > default and the use count is zero, but on ACPI based systems the\n>>> > device is still powered on.\n>>>\n>>> Okay, so _get_noresume() and _set_active() would do the thing for ACPI\n>>> indeed, but not sure about other platforms. Perhaps _enable(),\n>>> _get_sync() would be more general?\n>>\n>>What I ended up doing in e.g. the smiapp driver was to explicitly power the\n>>device on first and then enable runtime PM. (See\n>>drivers/media/i2c/smiapp/smiapp-core.c .) This approach works even if\n>>CONFIG_PM is disabled, both on DT and ACPI.\n>>\n>>--\n>>Regards,\n>>\n>>Sakari Ailus\n>>e-mail: sakari.ailus@iki.fi\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"MyOigpeS\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1V4Y350rz9t3B\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 15:34:05 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S934482AbdIZFeC (ORCPT <rfc822; incoming-dt@patchwork.ozlabs.org>);\n\tTue, 26 Sep 2017 01:34:02 -0400","from mail-yw0-f180.google.com ([209.85.161.180]:50559 \"EHLO\n\tmail-yw0-f180.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S936450AbdIZFeB (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 26 Sep 2017 01:34:01 -0400","by mail-yw0-f180.google.com with SMTP id u11so6316759ywh.7\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 25 Sep 2017 22:34:01 -0700 (PDT)","from mail-yw0-f180.google.com (mail-yw0-f180.google.com.\n\t[209.85.161.180]) by smtp.gmail.com with ESMTPSA id\n\tu65sm3361337ywa.40.2017.09.25.22.33.58\n\tfor <devicetree@vger.kernel.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 25 Sep 2017 22:33:59 -0700 (PDT)","by mail-yw0-f180.google.com with SMTP id i6so6317408ywc.9\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 25 Sep 2017 22:33:58 -0700 (PDT)","by 10.129.153.6 with HTTP; Mon, 25 Sep 2017 22:33:37 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=+uX5kVDzqn13a1cgAfCRKiqkqTVwRk2lQwGHj+8Rbgk=;\n\tb=MyOigpeSfHJql4aC8RGcT8u0PwVEJdsCA5M8XAVlX+axj9UhFYJw6W4YeYdz6FRXKL\n\tHTfzEqRBtUiWl+HYm4RfK26UWOXCM/6vDHMvJua5/GNy13tvNJnT/O1WUTPhEJvVyLWQ\n\tWZuebHZNAe6LPnKwCVwmy0F6wxGVbqA2qe9tU=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=+uX5kVDzqn13a1cgAfCRKiqkqTVwRk2lQwGHj+8Rbgk=;\n\tb=G3m+DkCvofYel5nAbpVq2QxC7p1ZgYv/Nl8veouGIQR/kyOnXz0HaerdpK4gAgRn2l\n\twjC59QHyHOYqbWLb0Tog4Yh1jeigX13Cb6CrE0UOaatW1s+QeO4Lfh1nn/l7MNz33TYv\n\ttHEB2MYEYmTcH3Qh2beL7iCM/kUZ6DgjFmoDfoAlBmf6b5PGVFO+oq7Nlx/Zva8njfvo\n\tjdpIvG4UgMwrDUCNJhQq6sZhXO0m2zyEYsOt8mDY3T9FrdTDGc/B/qgduKP0btqHWVod\n\tAYe01MCc7MggpCIAlHm9Z04sNYD30JohDyE2pqXBg97cscThJjc4Rndlk3/UIXheau4g\n\tXjqA==","X-Gm-Message-State":"AHPjjUgMfKbFQPcLjhR5LtT5zIb4haHR2LZUQ9sm+t1uTKic3YHWFZaD\n\tXHaI3DQonBnJoLEcRMOVtDkev36tj6A=","X-Received":["by 10.129.102.10 with SMTP id a10mr6110426ywc.291.1506404040409; \n\tMon, 25 Sep 2017 22:34:00 -0700 (PDT)","by 10.37.101.66 with SMTP id z63mr5780881ybb.298.1506404038410; \n\tMon, 25 Sep 2017 22:33:58 -0700 (PDT)"],"X-Google-Smtp-Source":"AOwi7QCgPe+BWTCcJzjBn4EQG+1hRhdX/cfUXOlvVMQ1kUGImCk7hCRU1lvR8Y1BWFmxQVpn35dtuDWyXKR6Mdx35fE=","MIME-Version":"1.0","In-Reply-To":"<7B8CE47BD58441468D2BB13285B50E6031DF0734@BGSMSX107.gar.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>\n\t<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>\n\t<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>\n\t<7B8CE47BD58441468D2BB13285B50E6031DF0734@BGSMSX107.gar.corp.intel.com>","From":"Tomasz Figa <tfiga@chromium.org>","Date":"Tue, 26 Sep 2017 14:33:37 +0900","X-Gmail-Original-Message-ID":"<CAAFQd5AQX+OuxkkXsyBXO3v-Fyv49kOK9Gdpcp1+XgZLm0KMHQ@mail.gmail.com>","Message-ID":"<CAAFQd5AQX+OuxkkXsyBXO3v-Fyv49kOK9Gdpcp1+XgZLm0KMHQ@mail.gmail.com>","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","To":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>","Cc":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>,\n\t\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"mika.westerberg@linux.intel.com\" <mika.westerberg@linux.intel.com>, \n\t\"Rafael J. Wysocki\" <rjw@rjwysocki.net>,\n\tUlf Hansson <ulf.hansson@linaro.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1778987,"web_url":"http://patchwork.ozlabs.org/comment/1778987/","msgid":"<20171003135109.v7ch7oc4fvjwzl7w@valkosipuli.retiisi.org.uk>","list_archive_url":null,"date":"2017-10-03T13:51:09","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":1593,"url":"http://patchwork.ozlabs.org/api/people/1593/","name":"Sakari Ailus","email":"sakari.ailus@iki.fi"},"content":"Hi Tomasz,\n\nOn Wed, Sep 20, 2017 at 12:32:22PM +0300, sakari.ailus@iki.fi wrote:\n> > >> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n> > >> >> struct i2c_device_id *id)\n> > >> >>\n> > >> >>       i2c_set_clientdata(client, at24);\n> > >> >>\n> > >> >> +     /* enable runtime pm */\n> > >> >> +     pm_runtime_get_noresume(&client->dev);\n> > >> >> +     pm_runtime_set_active(&client->dev);\n> > >> >> +     pm_runtime_enable(&client->dev);\n> > >>\n> > >> Do we need this get_noresume/set_active dance? I remember it was for\n> > >> some reason needed for PCI devices, but I don't see why for I2C\n> > >> anything else than just pm_runtime_enable() would be necessary.\n> > >\n> > > You specifically do not need (all) this for PCI devices, but AFAIU for I涎\n> > > devices you do. The runtime PM status of a device is disabled by default\n> > > and the use count is zero, but on ACPI based systems the device is still\n> > > powered on.\n> > \n> > Okay, so _get_noresume() and _set_active() would do the thing for ACPI\n> > indeed, but not sure about other platforms. Perhaps _enable(),\n> > _get_sync() would be more general?\n> \n> What I ended up doing in e.g. the smiapp driver was to explicitly power the\n> device on first and then enable runtime PM. (See\n> drivers/media/i2c/smiapp/smiapp-core.c .) This approach works even if\n> CONFIG_PM is disabled, both on DT and ACPI.\n\npm_runtime_get_noresume() + pm_runtime_put() can be replaced by a single\npm_runtime_idle() call (where pm_runtime_put() was). pm_runtime_enable() is\nrequired to enable runtime PM for a device.\n\npm_runtime_allow() may be omitted but then to make the runtime PM framework\nto make the power state transitions this needs to be configured from the\nuser space --- which I don't think is intended.\n\nCc linux-pm, too.","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y60n06Pjzz9t2Z\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed,  4 Oct 2017 00:51:16 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751895AbdJCNvP (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 3 Oct 2017 09:51:15 -0400","from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:50142 \"EHLO\n\thillosipuli.retiisi.org.uk\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1751719AbdJCNvN (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 3 Oct 2017 09:51:13 -0400","from valkosipuli.localdomain (valkosipuli.retiisi.org.uk\n\t[IPv6:2001:1bc8:1a6:d3d5::80:2])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 07837600FF;\n\tTue,  3 Oct 2017 16:51:11 +0300 (EEST)","from sakke by valkosipuli.localdomain with local (Exim 4.89)\n\t(envelope-from <sakke@valkosipuli.retiisi.org.uk>)\n\tid 1dzNbK-0000SL-0l; Tue, 03 Oct 2017 16:51:10 +0300"],"Date":"Tue, 3 Oct 2017 16:51:09 +0300","From":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","To":"Tomasz Figa <tfiga@chromium.org>","Cc":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\tmika.westerberg@linux.intel.com, linux-pm@vger.kernel.org","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","Message-ID":"<20171003135109.v7ch7oc4fvjwzl7w@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>\n\t<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>\n\t<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1779011,"web_url":"http://patchwork.ozlabs.org/comment/1779011/","msgid":"<20171003142349.6uxwfime32dwzxwk@valkosipuli.retiisi.org.uk>","list_archive_url":null,"date":"2017-10-03T14:23:50","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":1593,"url":"http://patchwork.ozlabs.org/api/people/1593/","name":"Sakari Ailus","email":"sakari.ailus@iki.fi"},"content":"On Wed, Sep 20, 2017 at 11:45:20AM +0300, sakari.ailus@iki.fi wrote:\n> > >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n> > >> struct i2c_device_id *id)\n> > >>\n> > >>       i2c_set_clientdata(client, at24);\n> > >>\n> > >> +     /* enable runtime pm */\n> > >> +     pm_runtime_get_noresume(&client->dev);\n> > >> +     pm_runtime_set_active(&client->dev);\n> > >> +     pm_runtime_enable(&client->dev);\n> > \n> > Do we need this get_noresume/set_active dance? I remember it was for\n> > some reason needed for PCI devices, but I don't see why for I2C\n> > anything else than just pm_runtime_enable() would be necessary.\n> \n> You specifically do not need (all) this for PCI devices, but AFAIU for I²C\n> devices you do. The runtime PM status of a device is disabled by default\n> and the use count is zero, but on ACPI based systems the device is still\n> powered on.\n> \n> > \n> > Also, we enable runtime PM, but we don't provide any callbacks. If\n> > there is no callback in any level of the hierarchy, NULL would be\n> > returned in [3], making [2] return -ENOSYS and [1] fail. The behavior\n> > depends on subsystem and whether the device is attached to a\n> > pm_domain. In our particular case I'd guess the device would be in an\n> > ACPI pm_domain and that would work, but the driver is generic and must\n> > work in any cases.\n> \n> Agreed.\n\nI looked at the code and what actually happens here is the runtime_suspend\nand runtime_resume callbacks aren't set is that the first pm_runtime_put()\ncall itself succeeds because checking the the runtime_suspend callback will\nbe done in the work queue function. This leaves the device in RPM_ACTIVE\nstate, which I don't think is a problem since the driver did not have\nexplicit functions to control the device power state.\n\nFurther pm_runtime_put() and pm_runtime_get() calls will succeed because\nthe device is in RPM_ACTIVE state.\n\nSo I see no reason to set the callbacks if they would not actually control\nregulators, clocks or GPIOs required by the device.\n\nCc linux-pm.","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y61Vh5FWWz9t2Z\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tWed,  4 Oct 2017 01:23:56 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751460AbdJCOXz (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tTue, 3 Oct 2017 10:23:55 -0400","from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:50490 \"EHLO\n\thillosipuli.retiisi.org.uk\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1751156AbdJCOXx (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Tue, 3 Oct 2017 10:23:53 -0400","from valkosipuli.localdomain (valkosipuli.retiisi.org.uk\n\t[IPv6:2001:1bc8:1a6:d3d5::80:2])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id EDDC6600FD;\n\tTue,  3 Oct 2017 17:23:50 +0300 (EEST)","from sakke by valkosipuli.localdomain with local (Exim 4.89)\n\t(envelope-from <sakke@valkosipuli.retiisi.org.uk>)\n\tid 1dzO6w-0000Sk-FQ; Tue, 03 Oct 2017 17:23:50 +0300"],"Date":"Tue, 3 Oct 2017 17:23:50 +0300","From":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","To":"Tomasz Figa <tfiga@chromium.org>","Cc":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\tmika.westerberg@linux.intel.com, linux-pm@vger.kernel.org","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","Message-ID":"<20171003142349.6uxwfime32dwzxwk@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>","User-Agent":"NeoMutt/20170113 (1.7.2)","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1783418,"web_url":"http://patchwork.ozlabs.org/comment/1783418/","msgid":"<CAAFQd5CjjAfkcfLVDSk4mSakPA=ELM_XFwJhduNFL5rZxJdN5Q@mail.gmail.com>","list_archive_url":null,"date":"2017-10-10T03:54:52","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":66090,"url":"http://patchwork.ozlabs.org/api/people/66090/","name":"Tomasz Figa","email":"tfiga@chromium.org"},"content":"On Tue, Oct 3, 2017 at 11:23 PM, sakari.ailus@iki.fi\n<sakari.ailus@iki.fi> wrote:\n> On Wed, Sep 20, 2017 at 11:45:20AM +0300, sakari.ailus@iki.fi wrote:\n>> > >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client *client, const\n>> > >> struct i2c_device_id *id)\n>> > >>\n>> > >>       i2c_set_clientdata(client, at24);\n>> > >>\n>> > >> +     /* enable runtime pm */\n>> > >> +     pm_runtime_get_noresume(&client->dev);\n>> > >> +     pm_runtime_set_active(&client->dev);\n>> > >> +     pm_runtime_enable(&client->dev);\n>> >\n>> > Do we need this get_noresume/set_active dance? I remember it was for\n>> > some reason needed for PCI devices, but I don't see why for I2C\n>> > anything else than just pm_runtime_enable() would be necessary.\n>>\n>> You specifically do not need (all) this for PCI devices, but AFAIU for I涎\n>> devices you do. The runtime PM status of a device is disabled by default\n>> and the use count is zero, but on ACPI based systems the device is still\n>> powered on.\n>>\n>> >\n>> > Also, we enable runtime PM, but we don't provide any callbacks. If\n>> > there is no callback in any level of the hierarchy, NULL would be\n>> > returned in [3], making [2] return -ENOSYS and [1] fail. The behavior\n>> > depends on subsystem and whether the device is attached to a\n>> > pm_domain. In our particular case I'd guess the device would be in an\n>> > ACPI pm_domain and that would work, but the driver is generic and must\n>> > work in any cases.\n>>\n>> Agreed.\n>\n> I looked at the code and what actually happens here is the runtime_suspend\n> and runtime_resume callbacks aren't set is that the first pm_runtime_put()\n> call itself succeeds because checking the the runtime_suspend callback will\n> be done in the work queue function. This leaves the device in RPM_ACTIVE\n> state, which I don't think is a problem since the driver did not have\n> explicit functions to control the device power state.\n>\n> Further pm_runtime_put() and pm_runtime_get() calls will succeed because\n> the device is in RPM_ACTIVE state.\n>\n> So I see no reason to set the callbacks if they would not actually control\n> regulators, clocks or GPIOs required by the device.\n>\n> Cc linux-pm.\n\nSounds reasonable. I remember seeing some problems in the past, but\nlooks like they may be already fixed in current upstream. Thanks for\nchecking this thoroughly.\n\nBest regards,\nTomasz\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"QPaHfZPU\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yB3DT4GP0z9tY2\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue, 10 Oct 2017 14:55:37 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755048AbdJJDzR (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tMon, 9 Oct 2017 23:55:17 -0400","from mail-qt0-f170.google.com ([209.85.216.170]:45766 \"EHLO\n\tmail-qt0-f170.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1755968AbdJJDzQ (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Mon, 9 Oct 2017 23:55:16 -0400","by mail-qt0-f170.google.com with SMTP id p1so10262697qtg.2\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 09 Oct 2017 20:55:16 -0700 (PDT)","from mail-qt0-f175.google.com (mail-qt0-f175.google.com.\n\t[209.85.216.175]) by smtp.gmail.com with ESMTPSA id\n\tt9sm5980603qti.47.2017.10.09.20.55.13\n\tfor <devicetree@vger.kernel.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 09 Oct 2017 20:55:13 -0700 (PDT)","by mail-qt0-f175.google.com with SMTP id f15so47634739qtf.7\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 09 Oct 2017 20:55:13 -0700 (PDT)","by 10.13.212.4 with HTTP; Mon, 9 Oct 2017 20:54:52 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=wl55KZYpZeO00AplmdzD1+FVib7gmZtljuTAGZc5iaY=;\n\tb=QPaHfZPUF2U3AoTjIxBURBY9tKImq6YdavHTWktFLCaIFLQyXWEkF0bWLyRN24ImF1\n\tm8exdjvSL0FG4n31fd6+Vx3lIwqLVhfgQqnrJ3Osst+EbSglwebxDlyIuD5CxF18l7AB\n\tVAcEkYtYM8KCpLBv5KYqpUwg/uDrymMMw2OX0=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=wl55KZYpZeO00AplmdzD1+FVib7gmZtljuTAGZc5iaY=;\n\tb=et72EziKfE6KbhRadBCImWsGPr/Wwff7dklTZ20nNqr05z0RNAZ7zZCJJ/4JF3B3P0\n\tsRwSR1O5dpjQ/sWlCdJgjniSXNMMleftyjoFEDigouStyBmqZsV9AWzt56adifHEXkUF\n\tFaI5Y5bcVoKZBMK5p3TmJ7ckmZ1yJUouQopWWlofFA/WrV1CXXRrII7xabVjNRihUb1F\n\tAuudNiAVMIanpPqxVmM6x/yKCJTaWo5W9LBaCXrMsC3WooPrVodi3H0egVcKuKHXHtaI\n\tpBxrPV3ksTas07IkPBIVOZNwmT3ZMhuOZSU5qCXIcX5aijRzR71wDYoCQd1hFWG42Ry+\n\tNIwQ==","X-Gm-Message-State":"AMCzsaU7fDpxLM7gHM9xRtpDKNIUpWxQkOO/IiS92MSEnk5sx3O8rEmw\n\t4NeyAcCxJdPMoPLf5laJygZC9AwpMug=","X-Received":["by 10.55.221.68 with SMTP id n65mr12365928qki.27.1507607715056; \n\tMon, 09 Oct 2017 20:55:15 -0700 (PDT)","by 10.37.170.139 with SMTP id t11mr1243621ybi.99.1507607712735; \n\tMon, 09 Oct 2017 20:55:12 -0700 (PDT)"],"X-Google-Smtp-Source":"AOwi7QCc7g7xwyDeSGtosZxckPPAEgrnlik+5+AYmlqwg3B2TlLmLd5IqYQxKpaNu2hncZxvU5C+kw2o35ax2Fgikbw=","MIME-Version":"1.0","In-Reply-To":"<20171003142349.6uxwfime32dwzxwk@valkosipuli.retiisi.org.uk>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>\n\t<20171003142349.6uxwfime32dwzxwk@valkosipuli.retiisi.org.uk>","From":"Tomasz Figa <tfiga@chromium.org>","Date":"Tue, 10 Oct 2017 12:54:52 +0900","X-Gmail-Original-Message-ID":"<CAAFQd5CjjAfkcfLVDSk4mSakPA=ELM_XFwJhduNFL5rZxJdN5Q@mail.gmail.com>","Message-ID":"<CAAFQd5CjjAfkcfLVDSk4mSakPA=ELM_XFwJhduNFL5rZxJdN5Q@mail.gmail.com>","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","To":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>","Cc":"\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"Mohandass, Divagar\" <divagar.mohandass@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\tmika.westerberg@linux.intel.com,\n\t\"linux-pm@vger.kernel.org\" <linux-pm@vger.kernel.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}},{"id":1783420,"web_url":"http://patchwork.ozlabs.org/comment/1783420/","msgid":"<CAAFQd5CF5SOsPw9=t-XDj1ey0YV-+M04xzQLAjZEQjecOyYUdw@mail.gmail.com>","list_archive_url":null,"date":"2017-10-10T03:55:45","subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","submitter":{"id":66090,"url":"http://patchwork.ozlabs.org/api/people/66090/","name":"Tomasz Figa","email":"tfiga@chromium.org"},"content":"On Mon, Oct 9, 2017 at 12:14 PM, Mohandass, Divagar\n<divagar.mohandass@intel.com> wrote:\n> Hi Tomasz,\n>\n>>-----Original Message-----\n>>From: sakari.ailus@iki.fi [mailto:sakari.ailus@iki.fi]\n>>Sent: Tuesday, October 03, 2017 7:21 PM\n>>To: Tomasz Figa <tfiga@chromium.org>\n>>Cc: Mani, Rajmohan <rajmohan.mani@intel.com>; Mohandass, Divagar\n>><divagar.mohandass@intel.com>; robh+dt@kernel.org;\n>>mark.rutland@arm.com; wsa@the-dreams.de; devicetree@vger.kernel.org;\n>>linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org;\n>>mika.westerberg@linux.intel.com; linux-pm@vger.kernel.org\n>>Subject: Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support\n>>\n>>Hi Tomasz,\n>>\n>>On Wed, Sep 20, 2017 at 12:32:22PM +0300, sakari.ailus@iki.fi wrote:\n>>> > >> >> @@ -743,11 +770,17 @@ static int at24_probe(struct i2c_client\n>>> > >> >> *client, const struct i2c_device_id *id)\n>>> > >> >>\n>>> > >> >>       i2c_set_clientdata(client, at24);\n>>> > >> >>\n>>> > >> >> +     /* enable runtime pm */\n>>> > >> >> +     pm_runtime_get_noresume(&client->dev);\n>>> > >> >> +     pm_runtime_set_active(&client->dev);\n>>> > >> >> +     pm_runtime_enable(&client->dev);\n>>> > >>\n>>> > >> Do we need this get_noresume/set_active dance? I remember it was\n>>> > >> for some reason needed for PCI devices, but I don't see why for\n>>> > >> I2C anything else than just pm_runtime_enable() would be necessary.\n>>> > >\n>>> > > You specifically do not need (all) this for PCI devices, but AFAIU\n>>> > > for I涎\n>>> > > devices you do. The runtime PM status of a device is disabled by\n>>> > > default and the use count is zero, but on ACPI based systems the\n>>> > > device is still powered on.\n>>> >\n>>> > Okay, so _get_noresume() and _set_active() would do the thing for\n>>> > ACPI indeed, but not sure about other platforms. Perhaps _enable(),\n>>> > _get_sync() would be more general?\n>>>\n>>> What I ended up doing in e.g. the smiapp driver was to explicitly\n>>> power the device on first and then enable runtime PM. (See\n>>> drivers/media/i2c/smiapp/smiapp-core.c .) This approach works even if\n>>> CONFIG_PM is disabled, both on DT and ACPI.\n>>\n>>pm_runtime_get_noresume() + pm_runtime_put() can be replaced by a single\n>>pm_runtime_idle() call (where pm_runtime_put() was). pm_runtime_enable()\n>>is required to enable runtime PM for a device.\n>\n> Verified the change suggested by Sakari.\n> Let me know I can send a updated patch version with this change.\n\nOkay, looks like Sakari confirmed that the driver should work fine\nwithout callbacks, so please go ahead. Thanks for patience.\n\nBest regards,\nTomasz\n--\nTo unsubscribe from this list: send the line \"unsubscribe devicetree\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<devicetree-owner@vger.kernel.org>","X-Original-To":"incoming-dt@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming-dt@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=devicetree-owner@vger.kernel.org; receiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"l5t5WTkX\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yB3FP3WFwz9tY5\n\tfor <incoming-dt@patchwork.ozlabs.org>;\n\tTue, 10 Oct 2017 14:56:25 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1756061AbdJJD4L (ORCPT\n\t<rfc822;incoming-dt@patchwork.ozlabs.org>);\n\tMon, 9 Oct 2017 23:56:11 -0400","from mail-qt0-f179.google.com ([209.85.216.179]:50800 \"EHLO\n\tmail-qt0-f179.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1755975AbdJJD4J (ORCPT\n\t<rfc822; devicetree@vger.kernel.org>); Mon, 9 Oct 2017 23:56:09 -0400","by mail-qt0-f179.google.com with SMTP id f15so47638257qtf.7\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 09 Oct 2017 20:56:09 -0700 (PDT)","from mail-qt0-f179.google.com (mail-qt0-f179.google.com.\n\t[209.85.216.179]) by smtp.gmail.com with ESMTPSA id\n\tp64sm5742024qkd.67.2017.10.09.20.56.06\n\tfor <devicetree@vger.kernel.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 09 Oct 2017 20:56:06 -0700 (PDT)","by mail-qt0-f179.google.com with SMTP id p1so10265895qtg.2\n\tfor <devicetree@vger.kernel.org>;\n\tMon, 09 Oct 2017 20:56:06 -0700 (PDT)","by 10.13.212.4 with HTTP; Mon, 9 Oct 2017 20:55:45 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=VGtTziWqlGfq1tRUstn+DCfKlbUu46KUktatE9ZkOd8=;\n\tb=l5t5WTkXWwP+8QXXKxAc5zZ7qRZpl9iafAzJ2NHc2uoCJo6c8YzNhSKB3d+MF+EE5t\n\tcAKCeDm7dVKiXrtW2Q0FFFHcR5eskH3nWq+YpoSmVpZ8AWMKhSr5HHbIJ9hK/fH0Xexi\n\tw8hKeNIUN9sIm6ohf086tLEJ7zpqywuxj9C7A=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=VGtTziWqlGfq1tRUstn+DCfKlbUu46KUktatE9ZkOd8=;\n\tb=lo7uf0bf6RZQSK300T4SqNEqlG6xYzXZIdRm7fb3+ASvgCZY4twf06LtSj++up8l3U\n\teKMnkB0DXss5TvMJgu6pT7OvX5XwoY6ozv4wW8TXLF0Zan7QdxtHQxKk/7/Xi5WxLXJg\n\tL+vrACpqaCrVaYhj13K4tyWl/koqrN4dvDcB02ZIJa4zTm9qVoS7SZ/tRm6JyzUHwZq0\n\tWakHTMUxYP0Z0+G6L6BnLv4owdyoN8jVUCKPg0C/4KimTtTZbV9vBdOnyk8mI8+V/AQK\n\tNdarPDmtt/5KdHZg2bwGb3LNAcA+/SBWq5rV5ILo1O5BnJY47VxH3kB92LO6TgDI5nRi\n\tAvsA==","X-Gm-Message-State":"AMCzsaUyGzhGcSw27y0lT1gyG93PTp//Xnn0zB0PYAJC0NjVNvAvnH6G\n\tQbCCLv9yFoR1O3xycJONhjpeNIXNOmU=","X-Received":["by 10.237.49.162 with SMTP id 31mr11040161qth.240.1507607768693; \n\tMon, 09 Oct 2017 20:56:08 -0700 (PDT)","by 10.129.182.37 with SMTP id u37mr1280784ywh.205.1507607766335; \n\tMon, 09 Oct 2017 20:56:06 -0700 (PDT)"],"X-Google-Smtp-Source":"AOwi7QDMlcUVB2e+hF5mNS9QKfao5N0mb2yHFTg3GUwUNBbQ1bsaCUn+tENjxWt9j9lBNvGbZGwG7vXaBTykx2bPdSI=","MIME-Version":"1.0","In-Reply-To":"<7B8CE47BD58441468D2BB13285B50E6031DF530B@BGSMSX107.gar.corp.intel.com>","References":"<1504520928-5191-1-git-send-email-divagar.mohandass@intel.com>\n\t<1504520928-5191-4-git-send-email-divagar.mohandass@intel.com>\n\t<6F87890CF0F5204F892DEA1EF0D77A5972FC1278@FMSMSX114.amr.corp.intel.com>\n\t<CAAFQd5DUNHJ7fqWy5iD_fb=TBUqGy3AQ3uGXr-TdQ5v39f_hsw@mail.gmail.com>\n\t<20170920084519.asyfjxo6upt36woz@valkosipuli.retiisi.org.uk>\n\t<CAAFQd5B65bJHsZkMgtjGgyd3btuoWzJwYQRQb5j2kSaefxCZ7Q@mail.gmail.com>\n\t<20170920093222.yzfw2ctrupep5iqx@valkosipuli.retiisi.org.uk>\n\t<20171003135109.v7ch7oc4fvjwzl7w@valkosipuli.retiisi.org.uk>\n\t<7B8CE47BD58441468D2BB13285B50E6031DF530B@BGSMSX107.gar.corp.intel.com>","From":"Tomasz Figa <tfiga@chromium.org>","Date":"Tue, 10 Oct 2017 12:55:45 +0900","X-Gmail-Original-Message-ID":"<CAAFQd5CF5SOsPw9=t-XDj1ey0YV-+M04xzQLAjZEQjecOyYUdw@mail.gmail.com>","Message-ID":"<CAAFQd5CF5SOsPw9=t-XDj1ey0YV-+M04xzQLAjZEQjecOyYUdw@mail.gmail.com>","Subject":"Re: [PATCH v6 3/3] eeprom: at24: enable runtime pm support","To":"\"Mohandass, Divagar\" <divagar.mohandass@intel.com>","Cc":"\"sakari.ailus@iki.fi\" <sakari.ailus@iki.fi>,\n\t\"Mani, Rajmohan\" <rajmohan.mani@intel.com>,\n\t\"robh+dt@kernel.org\" <robh+dt@kernel.org>,\n\t\"mark.rutland@arm.com\" <mark.rutland@arm.com>,\n\t\"wsa@the-dreams.de\" <wsa@the-dreams.de>,\n\t\"devicetree@vger.kernel.org\" <devicetree@vger.kernel.org>,\n\t\"linux-i2c@vger.kernel.org\" <linux-i2c@vger.kernel.org>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>,\n\t\"mika.westerberg@linux.intel.com\" <mika.westerberg@linux.intel.com>, \n\t\"linux-pm@vger.kernel.org\" <linux-pm@vger.kernel.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Sender":"devicetree-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<devicetree.vger.kernel.org>","X-Mailing-List":"devicetree@vger.kernel.org"}}]