From patchwork Thu Feb 16 17:27:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 9577781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4CBB660209 for ; Thu, 16 Feb 2017 17:28:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F93C2863A for ; Thu, 16 Feb 2017 17:28:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3409428652; Thu, 16 Feb 2017 17:28:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EFEC42863A for ; Thu, 16 Feb 2017 17:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=vXHM/mrYFxpkXdPePHpCPts4/2Zt2Q/zT3scjW56ezk=; b=WSC x8UVdZE4I+UdL5Qj8kcE3PwsQSNXKsGEhS0+1RdNPGxwNcUeaTEfMGO6+1urxnDfhvIZoe+l3AYu3 tYfDNMKd8u9QbUVQD8FDYhaX9DpoUo0+lBeq9GA4ePtyYe+GB4BmJm2xMsAB87BOz6XfuGDdW5XkR Zu/KSEIvCrquzkIYl3thNvAr+TlmpOt9L9Bh0eZqevi6lWYiaIXrFPgyOwIQBEEEVT3lTsTga3gU+ 5aRDrrffpiOmk2B7WCm7uzHflntbZjCNkk8piNLHBBmt4DO+1r6FDSjFcU161GO2766SnbH2tiald 5Bedo4bkstI4XPMQmanr8ncG3VA32zA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cePr0-0007Gj-Ak; Thu, 16 Feb 2017 17:28:26 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cePqw-0007Ei-SS for linux-arm-kernel@lists.infradead.org; Thu, 16 Feb 2017 17:28:24 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id A3F372070B; Thu, 16 Feb 2017 18:28:01 +0100 (CET) Received: from localhost (unknown [88.191.26.124]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8030F2045B; Thu, 16 Feb 2017 18:28:01 +0100 (CET) From: Alexandre Belloni To: Wolfram Sang Subject: [PATCH v2] i2c: at91: ensure state is restored after suspending Date: Thu, 16 Feb 2017 18:27:59 +0100 Message-Id: <20170216172759.27837-1-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170216_092823_086024_E87DC5AB X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ludovic Desroches , Alexandre Belloni , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When going to suspend, the I2C registers may be lost because the power to VDDcore is cut. Restore them when resuming. Signed-off-by: Alexandre Belloni Acked-by: Ludovic Desroches --- Changes in v2: - don't cache unecessary registers and simply call at91_init_twi_bus() drivers/i2c/busses/i2c-at91.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 0b86c6173e07..c925a690cb32 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -1180,6 +1180,7 @@ static int at91_twi_suspend_noirq(struct device *dev) static int at91_twi_resume_noirq(struct device *dev) { + struct at91_twi_dev *twi_dev = dev_get_drvdata(dev); int ret; if (!pm_runtime_status_suspended(dev)) { @@ -1191,6 +1192,8 @@ static int at91_twi_resume_noirq(struct device *dev) pm_runtime_mark_last_busy(dev); pm_request_autosuspend(dev); + at91_init_twi_bus(twi_dev); + return 0; }