From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laxman Dewangan Subject: Re: [PATCH 5/6] i2c: tegra: Add runtime power-management support Date: Thu, 11 Aug 2016 20:31:02 +0530 Message-ID: <57AC932E.5060205@nvidia.com> References: <1470910620-9898-1-git-send-email-jonathanh@nvidia.com> <1470910620-9898-6-git-send-email-jonathanh@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1470910620-9898-6-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jon Hunter , Wolfram Sang , Stephen Warren , Thierry Reding , Alexandre Courbot Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-i2c@vger.kernel.org On Thursday 11 August 2016 03:46 PM, Jon Hunter wrote: > Update the Tegra I2C driver to use runtime PM and move the code in the > tegra_i2c_clock_enable/disable() functions to the PM runtime resume and > suspend callbacks, respectively. > > Note that given that CONFIG_PM is not mandatory for Tegra, if CONFIG_PM > is not enabled and so runtime PM is not enabled, ensure that the I2C > clocks are turned on during probe and kept on by calling the resume > callback directly. > > In the function tegra_i2c_init(), the variable 'err' does not need to be > initialised to zero in tegra_i2c_init() because it is initialised when > pm_runtime_get_sync() is called. Furthermore, to ensure we only return 0 > from tegra_i2c_init(), it is necessary to re-initialise 'err' to 0 after > a successful call to pm_runtime_get_sync() because it can return a > positive value on success. However, alternatively re-initialise 'err' by > using the return value of the function tegra_i2c_flush_fifos() because > it can only be 0 or -ETIMEDOUT. > > Signed-off-by: Jon Hunter > Acked-by: Laxman Dewangan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932458AbcHKPQ7 (ORCPT ); Thu, 11 Aug 2016 11:16:59 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:6744 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbcHKPQz (ORCPT ); Thu, 11 Aug 2016 11:16:55 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Thu, 11 Aug 2016 08:13:30 -0700 Message-ID: <57AC932E.5060205@nvidia.com> Date: Thu, 11 Aug 2016 20:31:02 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Jon Hunter , Wolfram Sang , Stephen Warren , Thierry Reding , Alexandre Courbot CC: , , Subject: Re: [PATCH 5/6] i2c: tegra: Add runtime power-management support References: <1470910620-9898-1-git-send-email-jonathanh@nvidia.com> <1470910620-9898-6-git-send-email-jonathanh@nvidia.com> In-Reply-To: <1470910620-9898-6-git-send-email-jonathanh@nvidia.com> X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: DRUKMAIL101.nvidia.com (10.25.59.19) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 11 August 2016 03:46 PM, Jon Hunter wrote: > Update the Tegra I2C driver to use runtime PM and move the code in the > tegra_i2c_clock_enable/disable() functions to the PM runtime resume and > suspend callbacks, respectively. > > Note that given that CONFIG_PM is not mandatory for Tegra, if CONFIG_PM > is not enabled and so runtime PM is not enabled, ensure that the I2C > clocks are turned on during probe and kept on by calling the resume > callback directly. > > In the function tegra_i2c_init(), the variable 'err' does not need to be > initialised to zero in tegra_i2c_init() because it is initialised when > pm_runtime_get_sync() is called. Furthermore, to ensure we only return 0 > from tegra_i2c_init(), it is necessary to re-initialise 'err' to 0 after > a successful call to pm_runtime_get_sync() because it can return a > positive value on success. However, alternatively re-initialise 'err' by > using the return value of the function tegra_i2c_flush_fifos() because > it can only be 0 or -ETIMEDOUT. > > Signed-off-by: Jon Hunter > Acked-by: Laxman Dewangan