Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3291461pxk; Mon, 21 Sep 2020 09:50:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGUu5CMCQhpAW+umt9XG2kDKOsstjjmVta6gG4WOpn3yvR+QRJKl8xCaySeEp4f2g5RBHg X-Received: by 2002:a17:906:4f8d:: with SMTP id o13mr384616eju.20.1600707051526; Mon, 21 Sep 2020 09:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707051; cv=none; d=google.com; s=arc-20160816; b=KKBK0rbP2v8Sxd+X6/xmnxi40gcvnlpkkdbK9RKi/no5SHijlUI6FIdiJlWQOfdR9w hiJNKTyV84wH4Y0VyRKnTZwbDFBljBxY/RAx1/UBJvR1A3mUaU2FEaxKldnc5nEHO8xQ +WABVgH/lN5sPYK7qx/QS6fBR54spk7l1IJ+6X8qFQHTU2KfTtMbOhiFDBVZm70VHKGu OWASNBYnnd0NFM3yp4J2UU7zAlkEXQL5OyJFsUGx6vohWCSXwS30Lx0G2V6IpmQFIZdi iraR4JW17wdy0+OI/t+kUsbZpR0wW0g/xLPOVqO3f9Sb952+WpoQCvy5i5dvxyeqYR5f CQKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sF8uK1xcaQ716RevNp9q5Z4aEWA636XWVXzrJ+Sd6IU=; b=VJtlhMBXxrWfBUU2qS24DZZbMujICx4wa8EC5X+voS6rbAr9Ed5nvqkf5Cz9O072FJ eLXxQVAKHu9daRu2NQJQef4pj05bcjxDH3F3EH9oYJHqiN3KkWpebMyhHpYcYovKdCLR 5G8aalnj3uGfOA9STOfMWnle7hLReUg7k5jDtK6njubKo6fAUuamUr4rCXXKTun9EYoj nYxOXwVNN0LdcHPtB5IF44BBELlrQgJE3+Ef3vYFvTpYqFjPBJgKHm39QdueyWHdfzcQ JSgkrBJIandhOQpC666ztEmDkZ4bSP6CMoub2ySbSE4LHrUCvMIywuWBCIAMoVD5Dncl ws1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YFboQbRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h26si8550802eji.739.2020.09.21.09.50.25; Mon, 21 Sep 2020 09:50:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YFboQbRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729775AbgIUQrf (ORCPT + 99 others); Mon, 21 Sep 2020 12:47:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:54510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728576AbgIUQre (ORCPT ); Mon, 21 Sep 2020 12:47:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 66E282223E; Mon, 21 Sep 2020 16:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706852; bh=2rs8eb9EJlhp2pZtnu8luvIlNE/S4asWeLrkFEF6i3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFboQbRH92A4qo6fMHO3oxX3jbOKQk9daKbqGo3SJuot1gZfupHp/zsju9fRb5s9V NJ+83UqcsOw61s9z40WdBIe36AP5Rj1y2necPBh/f79WNw7dhVRRr81a2nfOcf5u0t QFdEca7dDfvJ7NbLjQcZLH6z8eTNOMsU8uNCYdU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Volker=20R=C3=BCmelin?= , Jean Delvare , Wolfram Sang Subject: [PATCH 5.8 091/118] i2c: i801: Fix resume bug Date: Mon, 21 Sep 2020 18:28:23 +0200 Message-Id: <20200921162040.586151198@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Volker RĂ¼melin commit 66d402e2e9455cf0213c42b97f22a0493372d7cc upstream. On suspend the original host configuration gets restored. The resume routine has to undo this, otherwise the SMBus master may be left in disabled state or in i2c mode. [JD: Rebased on v5.8, moved the write into i801_setup_hstcfg.] Signed-off-by: Volker RĂ¼melin Signed-off-by: Jean Delvare Signed-off-by: Wolfram Sang Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-i801.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1706,6 +1706,16 @@ static inline int i801_acpi_probe(struct static inline void i801_acpi_remove(struct i801_priv *priv) { } #endif +static unsigned char i801_setup_hstcfg(struct i801_priv *priv) +{ + unsigned char hstcfg = priv->original_hstcfg; + + hstcfg &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ + hstcfg |= SMBHSTCFG_HST_EN; + pci_write_config_byte(priv->pci_dev, SMBHSTCFG, hstcfg); + return hstcfg; +} + static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) { unsigned char temp; @@ -1826,14 +1836,10 @@ static int i801_probe(struct pci_dev *de return err; } - pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &temp); - priv->original_hstcfg = temp; - temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ - if (!(temp & SMBHSTCFG_HST_EN)) { + pci_read_config_byte(priv->pci_dev, SMBHSTCFG, &priv->original_hstcfg); + temp = i801_setup_hstcfg(priv); + if (!(priv->original_hstcfg & SMBHSTCFG_HST_EN)) dev_info(&dev->dev, "Enabling SMBus device\n"); - temp |= SMBHSTCFG_HST_EN; - } - pci_write_config_byte(priv->pci_dev, SMBHSTCFG, temp); if (temp & SMBHSTCFG_SMB_SMI_EN) { dev_dbg(&dev->dev, "SMBus using interrupt SMI#\n"); @@ -1959,6 +1965,7 @@ static int i801_resume(struct device *de { struct i801_priv *priv = dev_get_drvdata(dev); + i801_setup_hstcfg(priv); i801_enable_host_notify(&priv->adapter); return 0;