0

我修改的linux内核中的i2c-gpio.c通过ACPI方式查找设备无法探测DSDT中定义的设备。

i2c-gpio.c 代码只是使用 OF(device tree) 查找运行在 xeon d1527 中的设备,我修改了 i2c-gpio.c 和 DSDT 表,i2c_gpio_driver 定义为 struct platform_driver,struct acpi_device_id 中的名称为“HHH000”。对于这个名字驱动程序不能不探测acpi设备。当HHH000被替换为PNP0C0C时,它可以探测。PNP0C0C设备最初定义在DSDT表中,PNP0C0C显示在/sys/devices/platform/PNP0C0C中: 00/.所以我想我定义的设备如何显示在 /sys/devices/platform 中,它可以探测。

我的 i2c-gpio.c 驱动修改如下:

#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")
        }
}
4

0 回答 0