From patchwork Tue Aug 7 12:37:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 1285511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 24528DF280 for ; Tue, 7 Aug 2012 12:44:07 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Syj5n-0004dk-UJ; Tue, 07 Aug 2012 12:41:00 +0000 Received: from na3sys009aog120.obsmtp.com ([74.125.149.140]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1Syj5k-0004dW-0q for linux-arm-kernel@lists.infradead.org; Tue, 07 Aug 2012 12:40:56 +0000 Received: from mail-lb0-f176.google.com ([209.85.217.176]) (using TLSv1) by na3sys009aob120.postini.com ([74.125.148.12]) with SMTP ID DSNKUCEM1RCyW2KixvYBmAeGTX7dlN6VRxPL@postini.com; Tue, 07 Aug 2012 05:40:55 PDT Received: by lboi15 with SMTP id i15so1127139lbo.21 for ; Tue, 07 Aug 2012 05:40:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=iNT+0WMAm1fyeXCGRiAfIK4vqdzCRbNLWkfYEPa3pFU=; b=j1V+LzwJOD6XJJzkGONsrxlzWLok26S9GjC+dSXijpYaVnxqQHQmj33RFS0XRGkBMB lid6VGRtSU68R3TeZyutX3GX/ARRvK8Gvt/k7i9id+8AAezBMQBoMe15Js/DJ82IJPF1 nzi+aHl0/EZqi2Uu9GdidWo6hTxzPNlvnS7rJOLxALPLtto4Cd5Gkynvw8O+vg9iQdXt IC6aUVyRX7o8snJqjArsIBFV8GTEOOwPbSJLUruSpSYrMooR3EsLA5wHqD5SyOgHm3pr VqkLtXfODN6Jo5N1Mnw/QTLxmSOW6TLnMFwkHIxEVe2SUy8mZI9l4C5KihtWUpp3WwDK CkNw== Received: by 10.152.106.233 with SMTP id gx9mr14367602lab.48.1344343249956; Tue, 07 Aug 2012 05:40:49 -0700 (PDT) Received: from localhost (cs78217178.pp.htv.fi. [62.78.217.178]) by mx.google.com with ESMTPS id o5sm4349308lbg.5.2012.08.07.05.40.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Aug 2012 05:40:49 -0700 (PDT) From: Felipe Balbi To: Shubhrajyoti Datta Subject: [PATCH v3] i2c: omap: switch over to autosuspend API Date: Tue, 7 Aug 2012 15:37:16 +0300 Message-Id: <1344343036-8832-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.12.rc0 X-Gm-Message-State: ALoCoQmyB3xBUHN7eaPkXbqPzluPMj+uyakvDRBAmgII/ANqj7QzRGwoy6oJuLCM3uBmRrzKx6WW X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.140 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linux OMAP Mailing List , Felipe Balbi , w.sang@pengutronix.de, Linux ARM Kernel Mailing List , vaibhav.bedia@ti.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org this helps us reduce unnecessary pm transitions in case we have another i2c message starting soon. Signed-off-by: Felipe Balbi --- drivers/i2c/busses/i2c-omap.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 60928f2..35e8207 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -55,6 +55,9 @@ /* timeout waiting for the controller to respond */ #define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000)) +/* timeout for pm runtime autosuspend */ +#define OMAP_I2C_PM_TIMEOUT 1000 /* ms */ + /* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */ enum { OMAP_I2C_REV_REG = 0, @@ -645,7 +648,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) omap_i2c_wait_for_bb(dev); out: - pm_runtime_put(dev->dev); + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); return r; } @@ -1113,6 +1117,9 @@ omap_i2c_probe(struct platform_device *pdev) dev->regs = (u8 *)reg_map_ip_v1; pm_runtime_enable(dev->dev); + pm_runtime_set_autosuspend_delay(dev->dev, OMAP_I2C_PM_TIMEOUT); + pm_runtime_use_autosuspend(dev->dev); + r = pm_runtime_get_sync(dev->dev); if (IS_ERR_VALUE(r)) goto err_free_mem; @@ -1189,7 +1196,8 @@ omap_i2c_probe(struct platform_device *pdev) of_i2c_register_devices(adap); - pm_runtime_put(dev->dev); + pm_runtime_mark_last_busy(dev->dev); + pm_runtime_put_autosuspend(dev->dev); return 0;