From patchwork Tue Aug 7 12:11:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 1285321 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id EFEBADF280 for ; Tue, 7 Aug 2012 12:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754004Ab2HGMOp (ORCPT ); Tue, 7 Aug 2012 08:14:45 -0400 Received: from na3sys009aog107.obsmtp.com ([74.125.149.197]:60551 "EHLO na3sys009aog107.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753998Ab2HGMOo (ORCPT ); Tue, 7 Aug 2012 08:14:44 -0400 Received: from mail-lpp01m010-f52.google.com ([209.85.215.52]) (using TLSv1) by na3sys009aob107.postini.com ([74.125.148.12]) with SMTP ID DSNKUCEGs4dZCTab1UNPz/6G81Zy54tgzIwo@postini.com; Tue, 07 Aug 2012 05:14:44 PDT Received: by lage4 with SMTP id e4so157874lag.11 for ; Tue, 07 Aug 2012 05:14:42 -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:in-reply-to:references :x-gm-message-state; bh=UEyO62MA03rTftD7uDYc1xcHm00TDbWEWACkjfA3OEQ=; b=ngQCXB5ybV4TQYq79RJHeWLQz5d8cnW4O6E12drmDDyFAkBa7dOd1yQMOlIe+SqZsr 45PiAL84I+LVNfpceUaGoPojaDZt9Ibkyp1dc4vsCKwhBq/Neo5p4yw31qgar8PUXBbl OojP2AuNVIpgXvP3UUqalqdmE096wjLECBA9dATDjmTIe4ENV3hwjvgEGnGUTIAC7Hzl dsRXgPeW97DtICrJaJmmd+jaJeLjpFEu6Sk4wNp0bq2hifhTLMgEzRQzy+vtZrx/lrJi YrWlFNdIb8LCq6e4c1ru2BPsZpDH9GB9mQ3AuA5wG2fu4edKjrbcnhkwxk3lnhpxqfTI tB0w== Received: by 10.112.45.230 with SMTP id q6mr6172368lbm.94.1344341682117; Tue, 07 Aug 2012 05:14:42 -0700 (PDT) Received: from localhost (cs78217178.pp.htv.fi. [62.78.217.178]) by mx.google.com with ESMTPS id b3sm4333624lbh.6.2012.08.07.05.14.40 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Aug 2012 05:14:41 -0700 (PDT) From: Felipe Balbi To: Shubhrajyoti Datta Cc: Linux OMAP Mailing List , Linux ARM Kernel Mailing List , w.sang@pengutronix.de, Felipe Balbi Subject: [PATCH] i2c: omap: switch over to autosuspend API Date: Tue, 7 Aug 2012 15:11:08 +0300 Message-Id: <1344341468-8144-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.12.rc0 In-Reply-To: <20120807120728.GW8468@arwen.pp.htv.fi> References: <20120807120728.GW8468@arwen.pp.htv.fi> X-Gm-Message-State: ALoCoQmhg0Bqu/smZYixO6+6PVVpERfK+qemsrt9hZ9vUmPGdcS4MX133H8wPO00nJwNBm2u3W5z Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org this helps us reduce unnecessary pm transitions in case we have another i2c message been started soon. Signed-off-by: Felipe Balbi --- drivers/i2c/busses/i2c-omap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 60928f2..c210b45 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -645,7 +645,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 +1114,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, 1000); + pm_runtime_use_autosuspend(dev->dev); + r = pm_runtime_get_sync(dev->dev); if (IS_ERR_VALUE(r)) goto err_free_mem; @@ -1189,7 +1193,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;