Adding I2C device using ACPI SSDT table

Post Reply
Novakov
Posts: 3
Joined: Thu Aug 03, 2023 7:33 am
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Adding I2C device using ACPI SSDT table

Post by Novakov »

I have Ordroid H3+ with Ubuntu 22.04 with PCF8575 device connected to I2C0 bus on header. Using `i2cdetect` I verified that device is visible and responding to commands.

After informing kernel about I2C device using echo "pcf8575 0x20" > /sys/bus/i2c/devices/i2c-0/new_device I get new gpiochip instance under /sys/class/gpio, with that it is possible to export single GPIO pins and control them.

However I would like to assign predictable names to each element of this puzzle which lead to me ACPI SSDT table.

I'm trying to add I2C device using following ACPI SSDT exceprt:

Code: Select all

DefinitionBlock ("gpio-expander.aml", "SSDT", 1, "Vendor", "Accel", 0x00000004)
{
        External (\_SB.PC00.I2C0, DeviceObj)
        Scope (\_SB.PC00.I2C0)
        {
                Device (PCF0)
                {
                        Name (_HID, "PRP0001")
                        Name (_DDN, "GPIO-Expander")
                        Name (_DSD, Package ()
                        {
                                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                                Package ()
                                {
                                        Package () { "compatible", Package() { "nxp,pcf8575" } },
                                }
                        })
                        Method (_STA, 0, NotSerialized) 
                        {
                                Return (0x0F)
                        }
                        Name (_CRS, ResourceTemplate()
                        {
                                I2cSerialBus (
                                        0x20,
                                        ControllerInitiated,
                                        100000,
                                        AddressingMode7Bit,
                                        "\\_SB.PC00.I2C0",
                                        0x00
                                )
                        })
                }
        }
}
Loading using GRUB acpi /boot/gpio-expander.aml succeeds and Linux see new device:

Code: Select all

root@odroid:~# ls -l /sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-PRP0001:00
total 0
lrwxrwxrwx 1 root root    0 Aug  8 06:51 firmware_node -> ../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:6b/PRP0001:00
-r--r--r-- 1 root root 4096 Aug  8 06:51 modalias
-r--r--r-- 1 root root 4096 Aug  8 06:42 name
drwxr-xr-x 2 root root    0 Aug  8 06:51 power
lrwxrwxrwx 1 root root    0 Aug  8 06:42 subsystem -> ../../../../../../bus/i2c
-rw-r--r-- 1 root root 4096 Aug  8 06:42 uevent
-r--r--r-- 1 root root 4096 Aug  8 06:51 waiting_for_supplier

root@odroid:~# cat /sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-0/i2c-PRP0001:00/modalias
of:Npcf0TCnxp,pcf8575
Unfortunately, there is no driver node which means that kernel did not assign any driver to this particular device. The driver is available as it was loaded successfully using new_device method. ACPI snippet I'm using looks very similar to samples: https://github.com/westeri/meta-acpi/bl ... d1331.asli

Anyone had any luck with getting Odroid to work with SSDT tables?

User avatar
odroid
Site Admin
Posts: 41828
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3421 times
Been thanked: 1910 times
Contact:

Re: Adding I2C device using ACPI SSDT table

Post by odroid »

I have no experience of using SSDT. To be honest, I don't even know what it is.
I hope other users can help you.

Novakov
Posts: 3
Joined: Thu Aug 03, 2023 7:33 am
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Adding I2C device using ACPI SSDT table

Post by Novakov »

Thanks for answer :) It's not solving my problem but it is honest and that I'm thankful for (good work!).

I admit that's very obscure details of x86 architecture. I will keep digging and post my result here.

Novakov
Posts: 3
Joined: Thu Aug 03, 2023 7:33 am
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Adding I2C device using ACPI SSDT table

Post by Novakov »

Apprently problem was between keyboard and chair. Ubuntu 22.04 is using kernel 5.15 and in this version PCF driver is not yet capable of being bound using ACPI tables. That limitation was removed in kernel 6.3
These users thanked the author Novakov for the post (total 2):
odroid (Thu Aug 10, 2023 9:42 am) • domih (Tue Aug 15, 2023 12:23 am)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 0 guests