Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3299000pxk; Mon, 21 Sep 2020 10:01:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcyFN3DomHWTIqAsBbdeLozQqORKUAS2Me+zGAkouVMCsw12AHL7NCywwUCD1QEt9OI9pk X-Received: by 2002:a17:906:9389:: with SMTP id l9mr358241ejx.537.1600707709157; Mon, 21 Sep 2020 10:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707709; cv=none; d=google.com; s=arc-20160816; b=A92hNmbhs/U4dpfqACQ2UeOLrIIkgl1Q8/9Ad25AgF2ouXu7TwALYYLU5kmJ4owThw PNkUS+txtpiw8ESMnDYFqRO0NrIWzQEaQVYAMQCLkZ/1Zd+Y92DyhvmMDTU8/BSY944J 2OSFQ9Qk3UZDIBP/Jg7SAjUojIVism2EOiSxQClkSSs6yABLaqMe2Qd4xA5gReqaYekn mPB+f0DTGiFX0jxuOzKAZOO7H7q5D6q9wH0LZGNA38ynZXafCyZBbf7xyuIZGH0TaCrs x6E5RRQdqXG1uZZ/Pyj97AM65Ee3ayNJtrSw/4PVn1RaDGctLhg3m9zSChNSNi7P7ANV hMKw== 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=12HC8pMxJbDGX1y+zXp1VzJdHB/v7eLkwuvfXKP/qXk=; b=kTwWsu157lhOXEXZ/RO8JbrayreWHiLEAV/x5kthBJSfvjiEJgcoFwiNEnR9BGItMr 2eNf/miGffTrqiXReLTsfAWzPEYbxSvsWQCdQY8YAbpTW7PnRmUiN++pibXG8FLec4TR bN7FyDml7WFev87++x7H6DUrEL5ywncyfYMToTeaxpT4AYR+3SL+C3pcaoqwp0OEneU1 0gWZiDfy6YRZtGzXQ+FdjrLMrzbZQYKUKR34jlzLomM/O+dbZ0iNb57ZLe0ivXNEovpn 0RKAHQCcyUDgec4zvhLiAabSBl7t+T4ybvernwTJdVx3DUgKND6ackJlr3WhKnH1U1Kn E43g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R3VCO38H; 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 a18si8359542edy.407.2020.09.21.10.01.24; Mon, 21 Sep 2020 10:01:49 -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=R3VCO38H; 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 S1729311AbgIURAJ (ORCPT + 99 others); Mon, 21 Sep 2020 13:00:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:43148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728666AbgIUQk0 (ORCPT ); Mon, 21 Sep 2020 12:40:26 -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 04458239D0; Mon, 21 Sep 2020 16:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706425; bh=W48MNXhmIRu0zX1L3yIErbAxgUvwDOfbwLyXGAfv3hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3VCO38Hb78aATVGupUN01HGTiFKNw/sxs5I0/KWDepjbPRqTEm75gaWgBAK1SHwr Icw9TjiOwKg5XX5ZZgTCUOoSi8ekD9in18ULkmdrpW3oFI+lhBTCC5m+jalMq7JL05 ZErHJYpjAB9ceYZdVsy4wqrjLmu3KgHTwuYSfTAk= 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 4.14 87/94] i2c: i801: Fix resume bug Date: Mon, 21 Sep 2020 18:28:14 +0200 Message-Id: <20200921162039.533447847@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@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 @@ -1499,6 +1499,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; @@ -1602,14 +1612,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"); @@ -1736,6 +1742,7 @@ static int i801_resume(struct device *de struct pci_dev *pci_dev = to_pci_dev(dev); struct i801_priv *priv = pci_get_drvdata(pci_dev); + i801_setup_hstcfg(priv); i801_enable_host_notify(&priv->adapter); return 0;