Re: [PATCH] i2c: i801: Save register SMBSLVCMD value only once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Apr 2018 11:12:41 -0400, Jason Andryuk wrote:
> On Wed, Apr 11, 2018 at 10:54 AM, Jean Delvare <jdelvare@xxxxxxx> wrote:
> > On Wed, 11 Apr 2018 09:09:25 -0400, Jason Andryuk wrote:  
> >> At power-off, I see:
> >> i2c i2c-6: i801_enable_host_notify: SMBSLVCMD value before initialization: 01  
> >
> > My debug patch did not have this message. And it looks wrong to me...
> > value before initialization should be 00. And it must be, as that's the
> > value to which the register is restored below.  
> 
> This output is correct. I just didn't output all the i2c-i801
> messages.  See below.
> 
> >> i2c i2c-6: i801_enable_host_notify: SMBSLVCMD value after initialization: 01  
> >
> > This is from the i801_resume function, which oddly enough is called
> > before tearing down the device.  
> 
> Yes, it is called during shutdown, which I found unexpected.

As I understand it, i801_suspend is being called when the device goes
to sleep (immediately after loading) and i801_resume is being called
whenever it wakes up - including right before being shut down. I don't
think we actually want to do that, but I'll address it with a separate
patch later.

> Also it is unexpected that i801_remove is not called at shutdown.

I'm not so surprised. When you are shutting down, there's a lot of
cleanup steps which don't really make sense, and skipping them would
allow to stop the system faster. If remove was called at shutdown time
then it would make little sense to have a separate shutdown callback. I
see the shutdown callback as a subset of the remove callback, not the
other way around.

> >> i801_smbus 0000:00:1f.4: i801_shutdown is called
> >> i2c i2c-6: i801_disable_host_notify: SMBSLVCMD value at removal time: 01
> >> i2c i2c-6: i801_disable_host_notify: SMBSLVCMD reset to: 00  
> >
> > I'm curious how you managed to capture these... serial console, rsyslog?  
> 
> I took a video on my phone and transcribed the messages.  My system
> runs rsyslog, but that exits before the shutdown initscripts call
> halt.  However, at that time we are back in text mode and messages are
> printed to the laptop display.  That is why I didn't write down all
> the messages from earlier - they were captured by rsyslog.  The full
> output of messages is something like:
> 
> i801_smbus 0000:00:1f.4: Original SMBSLVCMD value: 00
> i801_smbus 0000:00:1f.4: SMBus using PCI interrupt
> i2c i2c-6: i801_enable_host_notify: SMBSLVCMD value before initialization: 00
> i2c i2c-6: i801_enable_host_notify: SMBSLVCMD value after initialization: 01
> <shutdown called>
> i2c i2c-6: i801_enable_host_notify: SMBSLVCMD value before initialization: 01
> i2c i2c-6: i801_enable_host_notify: SMBSLVCMD value after initialization: 01
> i801_smbus 0000:00:1f.4: i801_shutdown is called
> i2c i2c-6: i801_disable_host_notify: SMBSLVCMD value at removal time: 01
> i2c i2c-6: i801_disable_host_notify: SMBSLVCMD reset to: 00

So you added the "SMBSLVCMD value before initialization" message at the
beginning of i801_enable_host_notify(), right? If so then the values
are correct even though the message itself is a bit confusing. But
anyway, this should be all clearer after I fix the unwanted
suspend/resume cycles.

-- 
Jean Delvare
SUSE L3 Support



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux