0

The i2c-gpio.c in the linux kernel modified by me to find device through ACPI mode can't probe device defined in the DSDT.

The i2c-gpio.c code just use OF(device tree) to find device running in the xeon d1527,I modified my i2c-gpio.c and DSDT table, the i2c_gpio_driver is defined as struct platform_driver,and the name in struct acpi_device_id is "HHH000".For this name driver can't not probe acpi device.When HHH000 is substituted as PNP0C0C,it can probe.PNP0C0C device is defined in DSDT table originally,and PNP0C0C is shown in /sys/devices/platform/PNP0C0C:00/.So I thought how can my defined device shown in /sys/devices/platform,may it can probe.

my i2c-gpio.c driver is modified as follow:

#ifdef CONFIG_ACPI
static const struct acpi_device_id i2cgpio_acpi_match[] = {
    {"HHH0000",0},
    {"", 0},
};
MODULE_DEVICE_TABLE(acpi, i2cgpio_acpi_match);
#endif

#if defined(CONFIG_OF)
static const struct of_device_id i2c_gpio_dt_ids[] = {
    { .compatible = "i2c-gpio", },
    { /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, i2c_gpio_dt_ids);
#endif
static struct platform_driver i2c_gpio_driver = {
    .driver     = {
        .name   = "my-i2c-gpio",
        .of_match_table = of_match_ptr(i2c_gpio_dt_ids),
        .acpi_match_table = ACPI_PTR(i2cgpio_acpi_match),
    },
    .probe      = i2c_gpio_probe,
    .remove     = i2c_gpio_remove,
};



the dsdt I modified as follow:
Scope(\_SB.PCI0.LPC0)
{
        Device (PCA9) /*pca9548*/
        {
           Name (_HID,"HHH0000")
        }
}
  • If you sure you have connected I²C mux (PCA9548) to certain controller by certain address, just use upstream driver. More information here: https://stackoverflow.com/a/54967620/2511795 Kernel documentation: https://www.kernel.org/doc/Documentation/i2c/muxes/i2c-mux-gpio.rst – 0andriy Nov 13 '19 at 19:41
  • Kernel documentation: https://www.kernel.org/doc/Documentation/i2c/muxes/i2c-mux-gpio.rst and https://www.kernel.org/doc/Documentation/acpi/i2c-muxes.txt – 0andriy Nov 13 '19 at 19:47
  • Thanks for your help,but my first problem is the device PAC9 just appear under /sys/devices/LNXSYSTM:00/LNXSYBUS:00/,when I use the function acpi_create_platform_device in my driver code ,the acpi device PAC9 can be converted as platform device, and my driver can probe the device.I doubt such a conversion is right or not.Why the kernel code just add the .acpi_match_table = ACPI_PTR() in the struct platfrom_driver,and such a way can probe the device. – thisisatest8 Nov 19 '19 at 09:27
  • I'm really not getting what is the issue with the driver in upstream and using correct ASL for it? – 0andriy Nov 19 '19 at 12:52
  • There may be someting wrong with the ASL. In the public material, the asl code (External (_SB_.PCI0.I2C0, DeviceObj) // Define Correct I2C controller) declare the the i2c controller defined in DSDT table, but in my DSDT table ,there is no i2c0 controller ,and there exists little code about how to define i2c controller on the Internet. – thisisatest8 Nov 20 '19 at 11:33
  • Dump ACPI tables `acpidump -o tables.dat` and share the file somewhere. And how you connected the device electrically? – 0andriy Nov 21 '19 at 09:20

0 Answers0