linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alban Browaeys <alban.browaeys@gmail.com>
To: Jean Delvare <jdelvare@suse.com>
Cc: Wolfram Sang <wsa@the-dreams.de>, linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: i801: Fix SMBus ENXIO on resume from suspend.
Date: Wed, 15 Nov 2017 21:25:25 +0100	[thread overview]
Message-ID: <1510777525.21208.4.camel@gmail.com> (raw)
In-Reply-To: <20171115170156.21532-1-alban.browaeys@gmail.com>

My apologies.

This fix is a partial one: it only fixes the issue once
we unload then reload i2c-i801 .
This as when we load a second time  orig_hstcfg is set to the value the
first module load leftover.
Thus I will investigate the initial orig_hstcfg at boot to further the
fix.
I bet this only a few missing bits like HST_EN.

Best regards
Alban


Le mercredi 15 novembre 2017 à 18:01 +0100, Alban Browaeys a écrit :
> Disabling I2C_EN on resume as it was restored in
> suspend when we set pci config to its original value.
> 
> ENXIO landing in rmi_smb_get_version,  i2c-i802 debug
> pointing at i801_check_post and guesswork from reading
> probe which has this tweak.
> 
> i801_smbus 0000:00:1f.3: No response
> rmi4_smbus 0-002c: failed to get SMBus version number!
> i801_smbus 0000:00:1f.3: No response
> rmi4_physical rmi4-00: rmi_driver_reset_handler: Failed to read
> current IRQ mask.
> i801_smbus 0000:00:1f.3: No response
> rmi4_f01 rmi4-00.fn01: Failed to restore normal operation: -6.
> rmi4_f01 rmi4-00.fn01: Resume failed with code -6.
> rmi4_physical rmi4-00: Failed to suspend functions: -6
> rmi4_smbus 0-002c: Failed to resume device: -6
> rmi4_f03 rmi4-00.fn03: rmi_f03_pt_write: Failed to write to F03 TX
> register (-6).
> i801_smbus 0000:00:1f.3: No response
> rmi4_f03 rmi4-00.fn03: rmi_f03_pt_write: Failed to write to F03 TX
> register (-6).
> 
> Signed-off-by: Alban Browaeys <alban.browaeys@gmail.com>
> ---
>  drivers/i2c/busses/i2c-i801.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-
> i801.c
> index 9e12a53ef7b8..b7b6c8ee2176 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1707,9 +1707,14 @@ static int i801_suspend(struct device *dev)
>  
>  static int i801_resume(struct device *dev)
>  {
> +	unsigned char temp;
>  	struct pci_dev *pci_dev = to_pci_dev(dev);
>  	struct i801_priv *priv = pci_get_drvdata(pci_dev);
>  
> +	pci_read_config_byte(pci_dev, SMBHSTCFG, &temp);
> +	temp &= ~SMBHSTCFG_I2C_EN;	/* SMBus timing */
> +	pci_write_config_byte(pci_dev, SMBHSTCFG, temp);
> +
>  	i801_enable_host_notify(&priv->adapter);
>  
>  	return 0;

  reply	other threads:[~2017-11-15 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 17:01 [PATCH] i2c: i801: Fix SMBus ENXIO on resume from suspend Alban Browaeys
2017-11-15 20:25 ` Alban Browaeys [this message]
2017-11-20  9:15   ` Jean Delvare
2017-11-20 14:18     ` Alban Browaeys
2017-12-07 21:11       ` Alban Browaeys
     [not found]     ` <f43a23f8-31e1-8498-c3e9-cfd1ec425150@t-online.de>
2017-11-21 11:49       ` Jean Delvare
2017-12-07 10:57         ` Wolfram Sang
2017-12-11 11:45           ` Alban Browaeys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510777525.21208.4.camel@gmail.com \
    --to=alban.browaeys@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).