Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4824188ybl; Wed, 22 Jan 2020 05:26:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzf8shJGTQqUpp1817qlUFv3sxe9Rbr24uMFxE3fvqcQyKZxhkOJvOAcmd18dcsjUUPwKY2 X-Received: by 2002:a9d:6398:: with SMTP id w24mr7193435otk.15.1579699587112; Wed, 22 Jan 2020 05:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699587; cv=none; d=google.com; s=arc-20160816; b=APEqQWb06kaIAvfrY1vvM9iql/E+oDEOHcihY60jrM4qWlgbebiWucXQyZQ4CIgYFs h4PhIsH43+J2KYpgx6BYms5/uJafPue0QyE7KxpLAWtGfxZbxqQRoCA7rtMDrlpocWb1 +G4WOpMP6HbI+32faUR5rWBZ2ETZQUOklmTfNyL0k4r/cHd5JjaK0N8pwDQ5KNvnSUDA QX6s3yXkE89JAeGQ6ukQP5QCf3hZw9/6iLTgClesLAMXIifDOCfD5drZ5ZXj1YNCLBqX vYs/pV2ym55rVibUWNGRzHH0zGFGqSmB02JwDy+2FmB4C5UfDT7qtFzjTGeQcMd40PC5 1GTw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bsp2FUogYm16JzgJIfxjXFa0MmO9ewz0lh9vnn6UBq0=; b=0xlOAyACpHC7HK0amtbsnylr1H7UURTWeHJhYYv3z7nKptDoMVmO1hhWzN9MQ6msUc R0C072A6eZM/M4GKYTFjfHNFWU6bRS89jZPb8K9FSmLE8NO1Kc/uarw29ljTVvkae9QE XKcm3x7/Gzrrnqp27DRK6h7oOhcu5tXPpDmm/KqzEB93bgijwXdqpHnHj+VVbwvuhoVj OJ9Kr+ZiXV89uvAXXIogwM1SwzZV+mgYGY75ticH2M6V+S4tt8RA+hd+jtbVkmk7A1Jj 3vBXGVV3KWrhPjJy8MrjTmHKS12kyMu2OJldPuA4vp1UPud90xbtL6ht/uzg4oITzZgN 5siw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MJlVKFeo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si23477931otp.56.2020.01.22.05.26.14; Wed, 22 Jan 2020 05:26:27 -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=@kernel.org header.s=default header.b=MJlVKFeo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730958AbgAVNYV (ORCPT + 99 others); Wed, 22 Jan 2020 08:24:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:43202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729106AbgAVNYT (ORCPT ); Wed, 22 Jan 2020 08:24:19 -0500 Received: from localhost (unknown [84.241.205.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4401E24693; Wed, 22 Jan 2020 13:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699459; bh=HXomrs22PQspmxuVAw23cN1XL9+UTy6oECiBhvfe0rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJlVKFeolU3kcrGzAQbz1wiTMZzCazvYOpPBEIY/6gxAlLNFpSeOdafubJqnObhcx doxjRa6pmEb15yWo8zheRJpuRUzl2lYbanhCilFv/R5f5XTvAvX5D0FrUABZO1k1DK PJov2TvhGxjVMkPmjr0Ratc5VZxMM+Ep36Lv+Qp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Dmitry Osipenko , Wolfram Sang Subject: [PATCH 5.4 116/222] i2c: tegra: Fix suspending in active runtime PM state Date: Wed, 22 Jan 2020 10:28:22 +0100 Message-Id: <20200122092842.038196458@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 9f42de8d4ec2304f10bbc51dc0484f3503d61196 upstream. 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 Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-tegra.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1710,9 +1710,14 @@ static int tegra_i2c_remove(struct platf 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_resu if (err) return err; + err = pm_runtime_force_resume(dev); + if (err < 0) + return err; + i2c_mark_adapter_resumed(&i2c_dev->adapter); return 0;