From patchwork Thu Jul 9 15:20:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 34831 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n69FNT0I028496 for ; Thu, 9 Jul 2009 15:24:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759667AbZGIPYH (ORCPT ); Thu, 9 Jul 2009 11:24:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760333AbZGIPYH (ORCPT ); Thu, 9 Jul 2009 11:24:07 -0400 Received: from wf-out-1314.google.com ([209.85.200.174]:3145 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759667AbZGIPYF (ORCPT ); Thu, 9 Jul 2009 11:24:05 -0400 Received: by wf-out-1314.google.com with SMTP id 26so65585wfd.4 for ; Thu, 09 Jul 2009 08:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=f3bcL4W/P4oE+ZEyKo7v9Kpvy2spYpv6OIQkX/j+h88=; b=aHUMSCmH8+FaIDPS9ybrAZh26sAZVgh7ce1PDyZrNhr+ZKqY7jt8wZIB+nSUMJ1+aq pHJmah9c3rOatpdoq4RXiLb63p9gFvTF26QZzIvLHt88rc7qddu3VXbpC0nmzpLK9aDY XMNwL983PAa/Oa6dCZL0zZJuv7CmdDYlkyQTM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=rggSebXnSIgG+Zzij9PR/dCfKBJbJRSpTOUwLL09igCE5YKxR3tVnb/NcW9QEoXuTQ ID1fXaxVKiX4uwWzA3hjRT8ESwO83DyBiixiHz6Qi1E2A/SdB7P6dQz9eHYzlJANVujo SX/DR4hGyspnMOpTJqnAJ3Bmn7WjCGeOpPWYI= Received: by 10.142.234.16 with SMTP id g16mr329844wfh.310.1247153043938; Thu, 09 Jul 2009 08:24:03 -0700 (PDT) Received: from rx1.opensource.se (58x80x213x53.ap58.ftth.ucom.ne.jp [58.80.213.53]) by mx.google.com with ESMTPS id 32sm8115003wfc.34.2009.07.09.08.24.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 09 Jul 2009 08:24:03 -0700 (PDT) From: Magnus Damm To: linux-pm@lists.linux-foundation.org Cc: linux-sh@vger.kernel.org, gregkh@suse.de, rjw@sisk.pl, lethal@linux-sh.org, stern@rowland.harvard.edu, pavel@ucw.cz, Magnus Damm Date: Fri, 10 Jul 2009 00:20:11 +0900 Message-Id: <20090709152011.8385.40046.sendpatchset@rx1.opensource.se> In-Reply-To: <20090709151926.8385.92800.sendpatchset@rx1.opensource.se> References: <20090709151926.8385.92800.sendpatchset@rx1.opensource.se> Subject: [PATCH 05/06] i2c: Runtime PM for i2c-sh_mobile.c Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch modifies the SuperH Mobile i2c driver to support Runtime PM. These changes should be all that is needed for proper Runtime PM support in this driver. Driver callbacks for Runtime PM are not needed becuase the registers are always re-initialized. Signed-off-by: Magnus Damm --- drivers/i2c/busses/i2c-sh_mobile.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/drivers/i2c/busses/i2c-sh_mobile.c +++ work/drivers/i2c/busses/i2c-sh_mobile.c 2009-07-07 18:50:53.000000000 +0900 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -165,6 +166,9 @@ static void activate_ch(struct sh_mobile u_int32_t denom; u_int32_t tmp; + /* Runtime PM must wake up device */ + pm_runtime_resume(pd->dev); + /* Make sure the clock is enabled */ clk_enable(pd->clk); @@ -215,6 +219,9 @@ static void deactivate_ch(struct sh_mobi /* Disable clock */ clk_disable(pd->clk); + + /* Runtime PM code may suspend now */ + pm_runtime_suspend(pd->dev); } static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, @@ -572,6 +579,20 @@ static int sh_mobile_i2c_probe(struct pl goto err_irq; } + /* Enable Runtime PM for this device. + * + * Also tell the Runtime PM core to ignore children + * for this device since it is valid for us to suspend + * this I2C master driver even though the slave devices + * on the I2C bus may not be suspended. + * + * The state of the I2C hardware bus is unaffected by + * the Runtime PM state. + */ + pm_suspend_ignore_children(&dev->dev, true); + pm_runtime_set_suspended(&dev->dev); + pm_runtime_enable(&dev->dev); + /* setup the private data */ adap = &pd->adap; i2c_set_adapdata(adap, pd);