Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3082292ybl; Sun, 12 Jan 2020 09:18:48 -0800 (PST) X-Google-Smtp-Source: APXvYqx5Vm6tT5xDli0G4JhbZvgs5r1QZ4DpEM0m2Hh77lwbhymHynQQ1GnNrhliPSQpppPc5tf6 X-Received: by 2002:a05:6808:181:: with SMTP id w1mr10238406oic.176.1578849528499; Sun, 12 Jan 2020 09:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578849528; cv=none; d=google.com; s=arc-20160816; b=UaRniNXTgCxZdM3uwLUQOCdMUJdGNsLmcU5TeaT1UTpQQoy6ozEW7qUWOFXEH18hX8 ygfNNvj5O/Cz5UiI7QiVg9VNEkfzquumr3Tjeaqd82JR2EuskI1vZ9s1fb4Xra8mMaZ6 DdBfRyc74GBQqs3rlC/9qA8U+7EH+QnDJlIG+HB+X/ho33JaQ3GCNkQS9aZOvQYamOT2 Yjb2qIRWU9uazeJ0CIi81NoSwxhDQ37HFhlgR+VPZ2pKyEekpCawyKDpsomiM+RlKiRz Wo4UWztmV7urV4BC0+qypp3KkvZrW1lN9Ic6bAh71uHDt1+/8UgYDYWdGptG9jVBi3MR TwXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tlNU9EUj3qjMJkvdyrf3SyjicgidrNBQwoqOOwsuvfM=; b=ZMaZXyUJLGbIW8KzIPwbMj4plE4JarFcPmjFErCKYSfvYSvocpYzmVsMSJ/PUoG+Fa 2L0mpAOnCRIbo2S1dKPmz6nXIX1nyy/x9k5UMnirxegXnIpacPOd3i+2NImPWLAArc1k G1Fp9XwfRloGjt3Oi3BmzIWDvnz9k6Q3pBTl4iSAQgV30PgalBC2d5yUZ74YfggcMRyG m8Hme5uBLjfAsqL8A/J2B2ORnlCQ3tcQyoWfnDCBcGGkzDe7H6iDYfO0sgUMo72r4R4m CCeIihFyMyRDMujzv+IAXML2GxltT/5rySsHjJPTAxcijEF4AS3OMKRCuBI0KmdpBSR6 Fh7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=boWiFTwb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v202si4777277oie.79.2020.01.12.09.18.36; Sun, 12 Jan 2020 09:18:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=boWiFTwb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733141AbgALRRo (ORCPT + 99 others); Sun, 12 Jan 2020 12:17:44 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42022 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732762AbgALRRm (ORCPT ); Sun, 12 Jan 2020 12:17:42 -0500 Received: by mail-lj1-f195.google.com with SMTP id y4so7417629ljj.9; Sun, 12 Jan 2020 09:17:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tlNU9EUj3qjMJkvdyrf3SyjicgidrNBQwoqOOwsuvfM=; b=boWiFTwbY2L7ablBt/qB3/1LiL/NpNhY61QyTTEn61/81dtiAIv3J33m5wTG1lEs4t 0lT/Jp5uaPecEYzrhvT2ZyL+xBbpL4SQDkU5vTaIJYe8CMATi6YKnhhW3qg/N3XEeNG8 Ygy5NQyvvt005EndxvIJYDHGTlO7vIHy2q00Fuha5hLzMqkXk/1qdawN1BzAtSGCKisX cNd/BRd0BzsN8XJ406Sp7yiHXhjzWfCaA7cZnugTuOjXblfLFTaVPDb84gTDmkClLE/s l9rpiPivAQTUtCdhfY3tRmGOJXT3sc/B1mG2N7MTPpsz5INdlQlEFAH5WPe0MDmPvGOq 7Nzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tlNU9EUj3qjMJkvdyrf3SyjicgidrNBQwoqOOwsuvfM=; b=rpzhSF+hCUW4jEEmJJzFl5o0sRuzaJj7B3JEHJtF6ozDSspgZixYFFh9bwIlSYckW3 +COMiw/cbdxo2anX85wk7Kjvf7B4d32SZdbz2PlfwnRP2LX037XjSH9y797hxTOWeLbC SEB/vEgo8btUkLtTWZSEIIPtZT+bZfXs2xFNtVomvrvczyQ8+s4lzvJrlTrgYkJ3Ex4/ 9S2C5Sn7Rk4+g3hgJ+kEBJ7cxBp13qx3sTdDXlgiriJTYqYZEmTbdbQB3cWZcMThj+Tf ZVYJgR1ahNAMn7aGfRLK0PjayqS7iLZcvAdEMvEIJ+nYo6wcRUmaoGDshWweFRBFcC7F GwmA== X-Gm-Message-State: APjAAAULa2iUqUei1e/k4suUUUmNoKT+0RRkroqH6r1wIfnr3O25IZ+T xF3OmgLx5bvzcSWJPvt+so0= X-Received: by 2002:a2e:858f:: with SMTP id b15mr6358563lji.275.1578849460326; Sun, 12 Jan 2020 09:17:40 -0800 (PST) Received: from localhost.localdomain (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.gmail.com with ESMTPSA id i13sm4506628ljg.89.2020.01.12.09.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2020 09:17:39 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Laxman Dewangan , Mikko Perttunen , Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/8] i2c: tegra: Fix suspending in active runtime PM state Date: Sun, 12 Jan 2020 20:14:23 +0300 Message-Id: <20200112171430.27219-2-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200112171430.27219-1-digetx@gmail.com> References: <20200112171430.27219-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I noticed that sometime I2C clock is kept enabled during suspend-resume. This happens because runtime PM defers dynamic suspension and thus it may happen that runtime PM is in active state when system enters into suspend. In particular I2C controller that is used for CPU's DVFS is often kept ON during suspend because CPU's voltage scaling happens quite often. Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase") Tested-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index a98bf31d0e5c..79d19f6ce94e 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1710,9 +1710,14 @@ static int tegra_i2c_remove(struct platform_device *pdev) static int __maybe_unused tegra_i2c_suspend(struct device *dev) { struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); + int err; i2c_mark_adapter_suspended(&i2c_dev->adapter); + err = pm_runtime_force_suspend(dev); + if (err < 0) + return err; + return 0; } @@ -1733,6 +1738,10 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev) if (err) return err; + err = pm_runtime_force_resume(dev); + if (err < 0) + return err; + i2c_mark_adapter_resumed(&i2c_dev->adapter); return 0; -- 2.24.0