控制 ACPI 的英特尔爱迪生 GPIO 问题 table
Control intel edison GPIO problem for ACPI table
我对 ACPI table 有一些疑问。我想在启动时控制 Intel Edison 默认的 GPIO,所以我让 ACPI table 来控制它。但没有引起任何变化。这是我的美国手语代码:
Device (DEV)
{
Name (_HID, "PRP0001")
Name (_DDN, "GPIO LEDs device")
Name (_CRS, ResourceTemplate()
{
GpioIo (Shared, PullNone, 0x0000, 0x0000,
IoRestrictionOutputOnly, "\_SB.PCI0.GPI0",
0x00, ResourceConsumer,,){12,13}
})
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "compatible", Package() { "gpio-leds" } },
},
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () {
Package () {"led-0", "LED0"},
Package () {"led-1", "LED1"},
}
})
/*
* For more information about these bindings see:
* Documentation/devicetree/bindings/leds/common.yaml,
* Documentation/devicetree/bindings/leds/leds-gpio.yaml and
* Documentation/firmware-guide/acpi/gpio-properties.rst.
*/
Name (LED0, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "green"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 0, 0}},
Package () {"retain-state-suspended", 1},
}
})
Name (LED1, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "red"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 1, 0}},
Package () {"retain-state-suspended", 1},
}
})
}
看起来我的 leds_test.aml 已加载。
这是我的 /sys/kernel/debug/gpio:
root@:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-191, parent: pci/0000:00:0c.0, 0000:00:0c.0:
gpio-47 ( |? ) out hi
gpio-71 ( |shutdown ) out hi
gpio-77 ( |sd_cd ) in hi IRQ
gpio-96 ( |ACPI:OpRegion ) out hi
gpio-110 ( |cs ) out hi
gpio-111 ( |cs ) out hi
gpio-112 ( |cs ) out lo
gpio-113 ( |cs ) out lo
gpio-184 ( |device-wakeup ) out lo
gpio-185 ( |host-wakeup ) in lo IRQ
root@:~# dmesg | grep ACPI
[ 0.002615] ACPI: Early table checksum verification disabled
[ 0.002631] ACPI: RSDP 0x00000000000E4500 000024 (v02 U-BOOT)
[ 0.002655] ACPI: XSDT 0x00000000000E45E0 00004C (v01 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002688] ACPI: FACP 0x00000000000E5310 0000F4 (v06 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002724] ACPI: DSDT 0x00000000000E4780 000A8A (v02 U-BOOT U-BOOTBL 00010000 INTL 20190215)
[ 0.002749] ACPI: APIC 0x00000000000E5410 000048 (v04 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002772] ACPI: MCFG 0x00000000000E5460 00003C (v01 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002794] ACPI: CSRT 0x00000000000E54A0 000058 (v00 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002817] ACPI: SPCR 0x00000000000E5500 000050 (v02 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002866] ACPI: Local APIC address 0xfee00000
[ 0.035260] ACPI: no legacy devices present
[ 0.035266] ACPI: probing for VGA not safe
[ 0.035281] ACPI: Local APIC address 0xfee00000
[ 0.035303] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[ 0.035315] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled)
[ 0.035338] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[ 0.035385] Using ACPI (MADT) for SMP configuration information
[ 0.035400] ACPI: SPCR: console: uart,mmio,0xff010180
[ 1.158446] ACPI: Core revision 20191018
[ 1.182930] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
[ 1.182938] ACPI: bus type PCI registered
[ 1.215373] ACPI: Added _OSI(Module Device)
[ 1.215771] ACPI: Added _OSI(Processor Device)
[ 1.215778] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 1.215784] ACPI: Added _OSI(Processor Aggregator Device)
[ 1.215793] ACPI: Added _OSI(Linux-Dell-Video)
[ 1.215801] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[ 1.215808] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[ 1.220700] ACPI: 1 ACPI AML tables successfully acquired and loaded
[ 1.222647] ACPI: Interpreter enabled
[ 1.222705] ACPI: (supports S0)
[ 1.222740] ACPI: Using IOAPIC for interrupt routing
[ 1.222853] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 1.236360] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[ 1.266154] ACPI: bus type USB registered
[ 2.126336] pnp: PnP ACPI init
[ 2.126853] pnp 00:00: Plug and Play ACPI device, IDs PNP0b00 (active)
[ 2.127373] system 00:01: Plug and Play ACPI device, IDs PNP0c02 (active)
[ 2.128692] pnp: PnP ACPI: found 2 devices
[ 3.028011] ACPI: Host-directed Dynamic ACPI Table Load:
[ 3.028045] ACPI: SSDT 0xFFFF8B1279103A80 0000A6 (v05 SPIDEV 00000001 INTL 20190215)
[ 3.059576] ACPI: Host-directed Dynamic ACPI Table Load:
[ 3.059611] ACPI: SSDT 0xFFFF8B12792C4C00 00016D (v05 LEDS 00000001 INTL 20190215)
[ 3.112334] ACPI: Host-directed Dynamic ACPI Table Load:
[ 3.112367] ACPI: SSDT 0xFFFF8B12793D6B00 0000E5 (v05 i2c 00000001 INTL 20190215)
但是我没有打开我的 LED,而且我在我的内核配置和构建内核中确保 CONFIG_LEDS_GPIO=y 和 CONFIG_LEDS_CLASS=y。
按照此 leds.asli 并尝试创建现在可用的测试示例。
示例:
Device (DEV)
{
Name (_HID, "PRP0001")
Name (_DDN, "GPIO LEDs device")
Name (_CRS, ResourceTemplate()
{
GpioIo (Shared, PullNone, 0x0000, 0x0000,
IoRestrictionOutputOnly, "\_SB.PCI0.GPI0",
0x00, ResourceConsumer,,){12,13}
})
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "compatible", Package() { "gpio-leds" } },
},
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () {
Package () {"led-0", "LED0"},
Package () {"led-1", "LED1"},
}
})
/*
* For more information about these bindings see:
* Documentation/devicetree/bindings/leds/common.yaml,
* Documentation/devicetree/bindings/leds/leds-gpio.yaml and
* Documentation/firmware-guide/acpi/gpio-properties.rst.
*/
Name (LED0, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "green"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 0, 0}},
Package () {"retain-state-suspended", 1},
}
})
Name (LED1, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "red"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 1, 0}},
Package () {"retain-state-suspended", 1},
}
})
}
/sys/kernel/debug/gpio:
root@:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-191, parent: pci/0000:00:0c.0, 0000:00:0c.0:
gpio-12 ( |green ) out lo
gpio-13 ( |red ) out lo
gpio-71 ( |shutdown ) out hi
gpio-77 ( |sd_cd ) in hi IRQ
gpio-96 ( |ACPI:OpRegion ) out hi
gpio-110 ( |cs ) out hi
gpio-111 ( |cs ) out hi
gpio-112 ( |cs ) out lo
gpio-113 ( |cs ) out lo
gpio-184 ( |device-wakeup ) out lo
gpio-185 ( |host-wakeup ) in lo IRQ
我对 ACPI table 有一些疑问。我想在启动时控制 Intel Edison 默认的 GPIO,所以我让 ACPI table 来控制它。但没有引起任何变化。这是我的美国手语代码:
Device (DEV)
{
Name (_HID, "PRP0001")
Name (_DDN, "GPIO LEDs device")
Name (_CRS, ResourceTemplate()
{
GpioIo (Shared, PullNone, 0x0000, 0x0000,
IoRestrictionOutputOnly, "\_SB.PCI0.GPI0",
0x00, ResourceConsumer,,){12,13}
})
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "compatible", Package() { "gpio-leds" } },
},
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () {
Package () {"led-0", "LED0"},
Package () {"led-1", "LED1"},
}
})
/*
* For more information about these bindings see:
* Documentation/devicetree/bindings/leds/common.yaml,
* Documentation/devicetree/bindings/leds/leds-gpio.yaml and
* Documentation/firmware-guide/acpi/gpio-properties.rst.
*/
Name (LED0, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "green"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 0, 0}},
Package () {"retain-state-suspended", 1},
}
})
Name (LED1, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "red"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 1, 0}},
Package () {"retain-state-suspended", 1},
}
})
}
看起来我的 leds_test.aml 已加载。 这是我的 /sys/kernel/debug/gpio:
root@:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-191, parent: pci/0000:00:0c.0, 0000:00:0c.0:
gpio-47 ( |? ) out hi
gpio-71 ( |shutdown ) out hi
gpio-77 ( |sd_cd ) in hi IRQ
gpio-96 ( |ACPI:OpRegion ) out hi
gpio-110 ( |cs ) out hi
gpio-111 ( |cs ) out hi
gpio-112 ( |cs ) out lo
gpio-113 ( |cs ) out lo
gpio-184 ( |device-wakeup ) out lo
gpio-185 ( |host-wakeup ) in lo IRQ
root@:~# dmesg | grep ACPI
[ 0.002615] ACPI: Early table checksum verification disabled
[ 0.002631] ACPI: RSDP 0x00000000000E4500 000024 (v02 U-BOOT)
[ 0.002655] ACPI: XSDT 0x00000000000E45E0 00004C (v01 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002688] ACPI: FACP 0x00000000000E5310 0000F4 (v06 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002724] ACPI: DSDT 0x00000000000E4780 000A8A (v02 U-BOOT U-BOOTBL 00010000 INTL 20190215)
[ 0.002749] ACPI: APIC 0x00000000000E5410 000048 (v04 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002772] ACPI: MCFG 0x00000000000E5460 00003C (v01 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002794] ACPI: CSRT 0x00000000000E54A0 000058 (v00 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002817] ACPI: SPCR 0x00000000000E5500 000050 (v02 U-BOOT U-BOOTBL 20200909 INTL 00000000)
[ 0.002866] ACPI: Local APIC address 0xfee00000
[ 0.035260] ACPI: no legacy devices present
[ 0.035266] ACPI: probing for VGA not safe
[ 0.035281] ACPI: Local APIC address 0xfee00000
[ 0.035303] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[ 0.035315] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled)
[ 0.035338] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[ 0.035385] Using ACPI (MADT) for SMP configuration information
[ 0.035400] ACPI: SPCR: console: uart,mmio,0xff010180
[ 1.158446] ACPI: Core revision 20191018
[ 1.182930] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
[ 1.182938] ACPI: bus type PCI registered
[ 1.215373] ACPI: Added _OSI(Module Device)
[ 1.215771] ACPI: Added _OSI(Processor Device)
[ 1.215778] ACPI: Added _OSI(3.0 _SCP Extensions)
[ 1.215784] ACPI: Added _OSI(Processor Aggregator Device)
[ 1.215793] ACPI: Added _OSI(Linux-Dell-Video)
[ 1.215801] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[ 1.215808] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[ 1.220700] ACPI: 1 ACPI AML tables successfully acquired and loaded
[ 1.222647] ACPI: Interpreter enabled
[ 1.222705] ACPI: (supports S0)
[ 1.222740] ACPI: Using IOAPIC for interrupt routing
[ 1.222853] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[ 1.236360] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[ 1.266154] ACPI: bus type USB registered
[ 2.126336] pnp: PnP ACPI init
[ 2.126853] pnp 00:00: Plug and Play ACPI device, IDs PNP0b00 (active)
[ 2.127373] system 00:01: Plug and Play ACPI device, IDs PNP0c02 (active)
[ 2.128692] pnp: PnP ACPI: found 2 devices
[ 3.028011] ACPI: Host-directed Dynamic ACPI Table Load:
[ 3.028045] ACPI: SSDT 0xFFFF8B1279103A80 0000A6 (v05 SPIDEV 00000001 INTL 20190215)
[ 3.059576] ACPI: Host-directed Dynamic ACPI Table Load:
[ 3.059611] ACPI: SSDT 0xFFFF8B12792C4C00 00016D (v05 LEDS 00000001 INTL 20190215)
[ 3.112334] ACPI: Host-directed Dynamic ACPI Table Load:
[ 3.112367] ACPI: SSDT 0xFFFF8B12793D6B00 0000E5 (v05 i2c 00000001 INTL 20190215)
但是我没有打开我的 LED,而且我在我的内核配置和构建内核中确保 CONFIG_LEDS_GPIO=y 和 CONFIG_LEDS_CLASS=y。
按照此 leds.asli 并尝试创建现在可用的测试示例。
示例:
Device (DEV)
{
Name (_HID, "PRP0001")
Name (_DDN, "GPIO LEDs device")
Name (_CRS, ResourceTemplate()
{
GpioIo (Shared, PullNone, 0x0000, 0x0000,
IoRestrictionOutputOnly, "\_SB.PCI0.GPI0",
0x00, ResourceConsumer,,){12,13}
})
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "compatible", Package() { "gpio-leds" } },
},
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () {
Package () {"led-0", "LED0"},
Package () {"led-1", "LED1"},
}
})
/*
* For more information about these bindings see:
* Documentation/devicetree/bindings/leds/common.yaml,
* Documentation/devicetree/bindings/leds/leds-gpio.yaml and
* Documentation/firmware-guide/acpi/gpio-properties.rst.
*/
Name (LED0, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "green"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 0, 0}},
Package () {"retain-state-suspended", 1},
}
})
Name (LED1, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"label", "red"},
Package () {"default-state", "off"},
Package () {"gpios", Package () {^LEDS, 0, 1, 0}},
Package () {"retain-state-suspended", 1},
}
})
}
/sys/kernel/debug/gpio:
root@:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-191, parent: pci/0000:00:0c.0, 0000:00:0c.0:
gpio-12 ( |green ) out lo
gpio-13 ( |red ) out lo
gpio-71 ( |shutdown ) out hi
gpio-77 ( |sd_cd ) in hi IRQ
gpio-96 ( |ACPI:OpRegion ) out hi
gpio-110 ( |cs ) out hi
gpio-111 ( |cs ) out hi
gpio-112 ( |cs ) out lo
gpio-113 ( |cs ) out lo
gpio-184 ( |device-wakeup ) out lo
gpio-185 ( |host-wakeup ) in lo IRQ