From patchwork Wed Jan 22 09:28:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=DATE_IN_PAST_03_06, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 297FFC2D0DB for ; Wed, 22 Jan 2020 13:24:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0CA92468A for ; Wed, 22 Jan 2020 13:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699469; bh=HXomrs22PQspmxuVAw23cN1XL9+UTy6oECiBhvfe0rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kmrzGUMa1wiLDbe1i93YNRekPpveFQOqpprMnCMCObKGATcR1h+vSrxi58RWHbj0I BaoINSnhcDim7JgYkuapLqsqyOvbNPRatovs8IfMFoGpFHNDeUtYP8DN7/iHW4XyMn c1EfSdjPDfHZ5RfbjF5TCjE7nnbVQVnXe0BWPCmU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbgAVNYV (ORCPT ); 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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;