Re: Adding I2C devices to the SMBus (PIIX4) via the ACPI SSDT overlay method

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

 



On Fri, Nov 08, 2024 at 10:26:33AM +0200, Andy Shevchenko wrote:
> On Thu, Nov 07, 2024 at 06:51:03PM +0300, Konstantin Aladyshev wrote:

> > I'm trying to add I2C devices to I2C/SMBus buses via the ACPI SSDT
> > overlay method. I've managed to do it for the I2C buses, but can't get
> > it working for the SMBus (PIIX4).

...

> > Now I'm trying to add devices to the SMBus bus. Which in my case is
> > produced from the i2c_piix4 PCI device:
> > ```
> > $ lspci -s 00:14.0 -vvvxxx
> > 00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 61)
> >         Subsystem: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller
> >         Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop-
> > ParErr- Stepping- SERR- FastB2B- DisINTx+
> >         Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium
> > >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> >         NUMA node: 0
> >         IOMMU group: 58
> >         Kernel driver in use: piix4_smbus
> >         Kernel modules: i2c_piix4, sp5100_tco
> > 00: 22 10 0b 79 03 04 20 02 61 00 05 0c 00 00 80 00
> > 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 20: 00 00 00 00 00 00 00 00 00 00 00 00 22 10 0b 79
> > 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > ```
> > 
> > It is described as simple as this in the system ACPI code:
> > ```
> > Device (SMBS) // \_SB_.PCI0.SMBS
> > {
> >     Name (_ADR, 0x00140000)  // _ADR: Address
> 
> So, you need to add Device objects here
> 
> The driver (drivers/i2c/busses/i2c-piix4.c::1157) has this call:
> 
> 	acpi_preset_companion(&adap->dev, ACPI_COMPANION(&dev->dev), hw_port_nr);
> 
> Means, that the _ADR will be evaluated, but there is none for the ports, only
> for the physical device.
> 
> So, you need something like this:
> 
> 	Scope (\_SB_.PCI0.SMBS)
> 	{
> 	  Device (SMB1)
> 	  {
> 	    Name (_ADR, 0)
> 	  }
> 	  Device (SMB1)
> 	  {
> 	    Name (_ADR, 1)
> 	  }
> 	  Device (SMB2)
> 	  {
> 	    Name (_ADR, 2)
> 	  }
> 	}
> 
> 
> And then refer to the controller (respective port) as, for example,
> 
> 	\_SB_.PCI0.SMBS.SMB1
> 
> in your SSDT. Note, the above _ADR assignments you should also add to SSDT
> (better to the same one).
> 
> > }
> > ```
> > And produces several I2C busses to the system:
> > ```
> > i2c-7   unknown         SMBus PIIX4 adapter port 0 at 0b00      N/A
> > i2c-8   unknown         SMBus PIIX4 adapter port 2 at 0b00      N/A
> > i2c-9   unknown         SMBus PIIX4 adapter port 1 at 0b20      N/A
> > ```
> > 
> > No matter how I've tried, I can't get to add my custom devices to
> > these SMBus buses.
> > 
> > Apparently just using "\\_SB.PCI0.SMBS" is not enough for this case.
> > Maybe I need to somehow create port nodes for this Device? Or maybe it
> > is not possible at all with the current piix driver?
> > 
> > Anyway I've started digging and I've noticed that for the I2C device
> > there are two physical_nodes in the sysfs. Where the 'physical_node'
> > is a standard folder and 'physical_node1' is a direct link to the
> > proper i2c bus:
> 
> > Maybe I need to modify ACPI code somehow to create these
> > 'physical_nodesX' folders for the relevant i2c-7/8/9 buses?
> 
> If you succeed with the above, please add the respective section to
> the Documentation/i2c/busses/i2c-piix4.rst and send a patch. It will
> be very appreciated!

The last but not least remark: you have to load your SSDT _before_ the driver,
which means the only methods you may use either initramfs or EFI variable.
ACPI ConfigFS won't work!

-- 
With Best Regards,
Andy Shevchenko






[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