Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4640905ybl; Mon, 13 Jan 2020 17:39:20 -0800 (PST) X-Google-Smtp-Source: APXvYqyXN4zL/ESScRJVLtLOlvY2WIVEHDZF3zv1PQ5J6Ecvpv2PEvBIkiacR2w2ePiFI3oXbxYV X-Received: by 2002:a9d:4692:: with SMTP id z18mr14825959ote.163.1578965960637; Mon, 13 Jan 2020 17:39:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578965960; cv=none; d=google.com; s=arc-20160816; b=DvaNAMPWAEXZNyjb91WMlYjMV52QtNsbTAeJJUHZ8vbJauQ7gTCOPlb+GLqhg4OQOr US8Bifn0/cIcOT4XvYy8M3qEBh5E60omHaPa8DGwNLvDGQlZrP84bcQa6DMrtca41A6p TCA2YyKDp6oVBHv3p4yWcCTdj6LkDYqDoE2aoccTTWHx8+zmF+ynZHo8pxPdXpre/sNx T/WcaCt0M0aoTrwY1fOo4FtMdo/nP2yQSxtMSNRsc+G7H/MYGjucjqXkVLdQ1IARuS3Y 2IdDZ82gcTkq05qbHy7qEajXvJRjvGOXQ7aC6KV+vpQcKNpot2uDDBulkETOQSdpW6PP vu7A== 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=QVU0l94ZGKYq2v7mTNWPaJoWlqCeIiCLa/ETRf3XXY8=; b=GscAFNlzbbv2+wY3Q+CmeVB9RqfoW7TloxTJLTrSuJBdL1Z23AbKMPeXLjWib85EOf V1MB1KmA659b4vL3v3OAfN7wmdj1RcgReGEPAzJR3oYl9RmNwK90cwcRU+LMp1HY2X9i Vn7vQUO36V2/FitzEnK/zb+3F3+dHffA2p/ZnM2fu+tl3IgXaWRJyOQJRz/12/N/Z0C3 eJrRhc/2lES8UwGbhxDhw8nzJUWJ/Yap9g5erH8qr5incCIGd2ywyx1yD7SZm0sjAvJ9 z5bswUlU0RlnCApv07Sg5ePMHWQpNAy0DUtLcPneWpC+HuoBAla7UzYL6+/AogF4zw0/ VYYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PRTPGsNc; 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 f22si7439029otp.178.2020.01.13.17.39.09; Mon, 13 Jan 2020 17:39:20 -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=PRTPGsNc; 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 S1729121AbgANBg6 (ORCPT + 99 others); Mon, 13 Jan 2020 20:36:58 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37227 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728944AbgANBg4 (ORCPT ); Mon, 13 Jan 2020 20:36:56 -0500 Received: by mail-lj1-f193.google.com with SMTP id o13so12381736ljg.4; Mon, 13 Jan 2020 17:36:54 -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=QVU0l94ZGKYq2v7mTNWPaJoWlqCeIiCLa/ETRf3XXY8=; b=PRTPGsNcR6uDo2LcQlNAYMn4RrcFdLzb/GGSel85h3gujCai+G1NT97EckXsCIHCiN t31iT1gC74nZ7PLkkTByZY14HZZl4/TcshWRDYYCbKTshv6UrGXFrRIV0F/tDomIZkdi OMYqdj04mH9SoweRsnxdy2tuGTDwDzHJRIpLBTKNvDi7vxfOJTqWmrlRJIionEVqCh5G GolwbM6Gl3/gS99iAeyDbyTn6A6HpcxzaRrr8Pob+G9kp3zQdoiO5PCRTVFnSfVVwbAj UbZ144C+fnf5p2wQfBT4jifD6glikKmTjcjK1rYWCUb9xBVthj5CRYmi94y0k9HB756l OIRA== 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=QVU0l94ZGKYq2v7mTNWPaJoWlqCeIiCLa/ETRf3XXY8=; b=Jg/NeJIQkUl/n1Dli4fsLFMh1RBOW4jYgWfQB/2U8CK4h/8INJMYvmA7kE9yZtzMET x0LPDlo+98XlXmECdG+r3GMWTGLzsmzcBUMm58rVW7Rsi6eXHoNwOodE4/G3J0wzjanb yYGW1Z7F6OcCPODPGjbRtBRy//kqpzMz5VVBuqNPWmr80pRACDKO/QokgN/f1Rq0WKx6 2USpjXE5Q2cdo+ZYfRoSLWET15couBe9+I9hzGebQrMB5sjfxBo2s7KrT89lgmuUZxF8 7F1Oi1gVsOqr9DJtJgIAAMmrPcBro/U8z6o12ijTpkWmvjJPfcNhe8rqdVVwSmH2Pgeu 49Bg== X-Gm-Message-State: APjAAAWz1Ytt+gNaQeg0K43HYZ0dRJXk1K5b0hV+SIIPPvlus/rUVB2S jF0uBOau68b3mQ1UWJLactQ= X-Received: by 2002:a2e:9a04:: with SMTP id o4mr12756284lji.214.1578965814262; Mon, 13 Jan 2020 17:36:54 -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 m189sm6427627lfd.92.2020.01.13.17.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 17:36:53 -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 v5 1/8] i2c: tegra: Fix suspending in active runtime PM state Date: Tue, 14 Jan 2020 04:34:35 +0300 Message-Id: <20200114013442.28448-2-digetx@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200114013442.28448-1-digetx@gmail.com> References: <20200114013442.28448-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") Cc: # v5.4+ 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