diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 4744c77..19a2dec 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -29,4 +29,5 @@ obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_RAR_REGISTER) += intel_rar_register.o obj-$(CONFIG_INTEL_IPS) += intel_ips.o obj-$(CONFIG_GPIO_INTEL_PMIC) += intel_pmic_gpio.o +obj-m += intel_lpc.o diff --git a/drivers/platform/x86/intel_lpc.c b/drivers/platform/x86/intel_lpc.c new file mode 100644 index 0000000..d3c5ef5 --- /dev/null +++ b/drivers/platform/x86/intel_lpc.c @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2010 Intel Corporation + * Jesse Barnes + * + * Simple ICH7 driver to verify ACPI PM settings. + */ + +#include + +#define ACPI_GEN_PMCON1 0xa0 +#define ACPI_GEN_PMCON2 0xa2 +#define ACPI_GEN_PMCON3 0xa4 +#define ACPI_CX_STATE_CONF 0xa9 +#define ACPI_C4_TIMING_CNTRL 0xaa +#define ACPI_BM_BREAK_EN 0xab +#define ACPI_MISC_FUNC 0xad +#define ACPI_EL_STS 0xb0 +#define ACPI_EL_CNTL1 0xb1 +#define ACPI_EL_CNTL2 0xb3 +#define ACPI_GPI_ROUTE 0xb8 + +static DEFINE_PCI_DEVICE_TABLE(ich7_lpc_id_table) = { + { .vendor = PCI_VENDOR_ID_INTEL, + .device = 0x27b9, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .class = PCI_CLASS_BRIDGE_ISA << 8, + .class_mask = 0xffff0000, + }, + { 0, } +}; + +MODULE_DEVICE_TABLE(pci, ich7_lpc_id_table); + +static int lpc_probe(struct pci_dev *dev, const struct pci_device_id *id) +{ + int ret = 0; + u8 cxstate, break_en; + + if (dev->bus->number != 0 || dev->devfn != PCI_DEVFN(0x1f, 0)) { + dev_err(&dev->dev, "LPC device not found at 0:1f.0, aborting\n"); + ret = -ENODEV; + goto out; + } + + pci_read_config_byte(dev, ACPI_CX_STATE_CONF, &cxstate); + pci_read_config_byte(dev, ACPI_BM_BREAK_EN, &break_en); + + /* Check ACPI PM bits for correctness */ + dev_err(&dev->dev, "ACPI_CX_STATE_CONF: 0x%02x\n", cxstate); + dev_err(&dev->dev, "ACPI_BM_BREAK_EN: 0x%02x\n", break_en); + +out: + return ret; +} + +static void lpc_remove(struct pci_dev *dev) +{ +} + +#ifdef CONFIG_PM +static int lpc_suspend(struct pci_dev *dev, pm_message_t state) +{ + return 0; +} + +static int lpc_resume(struct pci_dev *dev) +{ + return 0; +} +#else +#define lpc_suspend NULL +#define lpc_resume NULL +#endif /* CONFIG_PM */ + +static void lpc_shutdown(struct pci_dev *dev) +{ +} + +static struct pci_driver lpc_pci_driver = { + .name = "intel lpc", + .id_table = ich7_lpc_id_table, + .probe = lpc_probe, + .remove = lpc_remove, + .suspend = lpc_suspend, + .resume = lpc_resume, + .shutdown = lpc_shutdown, +}; + +static int __init lpc_init(void) +{ + return pci_register_driver(&lpc_pci_driver); +} +module_init(lpc_init); + +static void lpc_exit(void) +{ + pci_unregister_driver(&lpc_pci_driver); + return; +} +module_exit(lpc_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Jesse Barnes "); +MODULE_DESCRIPTION("Intel ICH7 LPC driver"); +