Using phandles in an ACPI SSDT overlay, is it possible?

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

 



Hi,

I am looking at using the special PRP0001 device ID to use a device-tree driver from an ACPI overlay.

Reading through the documentation, I've found how to pass most of the device-tree properties we need (gpio pins, integers, etc).
One thing that I've not been able to find however, is a mechanism equivalent to device-tree's phandles.

For our driver, we want to pass an i2c bus, (the bus itself, not just one address on the bus)
To do this with device-tree, we have been using the following:

&my_mux { /* I2C MUX */
	my_mux_channel: i2c@0 {
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0>;
	};
};

/ {
	sfpcage@1 {
		compatible = "atl,sfpcage";        
		...
		i2c-bus = <&my_mux_channel>;    /* this is what I'm unsure about doing in ACPI */
};

In our driver, we access the bus using:
    nadapter = of_parse_phandle(node, "i2c-bus", 0);
    ...
    adapter = of_find_i2c_adapter_by_node(nadapter);


My question is:

Is this possible to do this when using ACPI with its device-tree compatibility layer (PRP0001 and the daffd814-6eba-4d8c-8a91-bc9bbf4aa301 _DSD)?
Or are we going to need to change our driver to use a different mechanism to reference the i2c bus?

We are using kernel version 5.15.x. I have also included my work-in-progress ACPI source code below. 


Thank you for your time,
Joshua Scott


DefinitionBlock ("mux_and_sfp.aml", "SSDT", 1, "ATL", "TEST", 0x00000001)
{
    External (\_SB.I2CA, DeviceObj)

    Scope (\_SB.I2CA)
    {
        // 8-Channel i2c mux
        Device (MUX0)
        {
            Name (_HID, "PRP0001")
            Name (_CRS, ResourceTemplate () {
                I2cSerialBusV2 (0x74, ControllerInitiated,
                                400000, AddressingMode7Bit,
                                "\\_SB.I2CA", 0x00,
                                ResourceConsumer, , Exclusive, )
            })
            Name (_DSD, Package () {
                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), // Device Properties UUID
                Package () {
                    Package () { "compatible", "nxp,pca9548" },
                    Package () { "i2c-mux-idle-disconnect", "" },
                }
            })

            // Unused channels
            Device (CH00) { Name (_ADR, 0) }
            Device (CH01) { Name (_ADR, 1) }
            Device (CH02) { Name (_ADR, 2) }
            Device (CH03) { Name (_ADR, 3) }
            Device (CH04) { Name (_ADR, 4) }
            Device (CH05) { Name (_ADR, 5) }
            Device (CH06) { Name (_ADR, 6) }

            // Channel 7 contains GPIO expander.
            Device (CH07)
            {
                Name (_ADR, 7)

                Device (GPIO)
                {
                    Name (_HID, "PRP0001")
                    Name (_CRS, ResourceTemplate () {
                        I2cSerialBusV2 (0x25, ControllerInitiated,
                                        400000, AddressingMode7Bit,
                                        "^^CH07", 0x00,
                                        ResourceConsumer, , Exclusive, )
                    })
                    Name (_DSD, Package () {
                        ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), // Device Properties UUID
                        Package () {
                            Package () { "compatible", "nxp,pca9555" },
                        }
                    })
                }
            }
        }

        Device (SFP1)
        {
            Name (_HID, "PRP0001")
            Name (_CRS, ResourceTemplate ()
                {
                    // detect-gpio
                    GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,  "\\_SB.I2CA.MUX0.CH07.GPIO", 0, ResourceConsumer) { 2 }
                    // rxlos-gpio
                    GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,  "\\_SB.I2CA.MUX0.CH07.GPIO", 0, ResourceConsumer) { 0 }
                    //txdis-gpio
                    GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionOutputOnly, "\\_SB.I2CA.MUX0.CH07.GPIO", 0, ResourceConsumer) { 15 }
                    // i2c-bus, unsure if I2cSerialBusV2 is what we want to use here
                    I2cSerialBusV2 (???, ControllerInitiated, 400000, AddressingMode7Bit, "\\_SB.I2CA.MUX0.CH01", 0x00, ResourceConsumer, , Exclusive, )
                })

            Name (_DSD, Package () {
                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), // Device Properties UUID
                Package () {
                    Package () { "compatible", "atl,sfpcage" },
                    Package () { "board_index", 0 },
                    Package () { "label", "0.1" },
                    Package () { "port", "1" },
                    Package () { "detect-gpio", Package () {^SFP1, 0, 0, 1}}, // Device reference, index into _CRS, pin within GpioIo resource, active_low.
                    Package () { "rxlos-gpio", Package () {^SFP1, 1, 0, 0}},
                    Package () { "txdis-gpio", Package () {^SFP1, 2, 0, 0}},
                    Package () { "i2c-bus", ??? } // Unsure how to pass a devie-tree style phandle.
                }
            })

        }
    }
}



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux