Subject: [PATCH] [acpi ec] Add skelton EC driver - Only registers driver on load - Empty proc, sysfs, and event interfaces Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/ec/Makefile | 7 +++++ drivers/acpi/drivers/ec/device.c | 15 ++++++++++ drivers/acpi/drivers/ec/driver.c | 55 ++++++++++++++++++++++++++++++++++++++ drivers/acpi/drivers/ec/ec.h | 21 +++++++++++++++ drivers/acpi/drivers/ec/event.c | 11 ++++++++ drivers/acpi/drivers/ec/proc.c | 16 +++++++++++ drivers/acpi/drivers/ec/sysfs.c | 11 ++++++++ 7 files changed, 136 insertions(+), 0 deletions(-) create mode 100644 drivers/acpi/drivers/ec/Makefile create mode 100644 drivers/acpi/drivers/ec/device.c create mode 100644 drivers/acpi/drivers/ec/driver.c create mode 100644 drivers/acpi/drivers/ec/ec.h create mode 100644 drivers/acpi/drivers/ec/event.c create mode 100644 drivers/acpi/drivers/ec/proc.c create mode 100644 drivers/acpi/drivers/ec/sysfs.c applies-to: ef4f37fa01d76f5face6d5c8042880e126f49dbe a512f3787e5f95760509c58619d02980b14ca35c diff --git a/drivers/acpi/drivers/ec/Makefile b/drivers/acpi/drivers/ec/Makefile new file mode 100644 index 0000000..a6222b5 --- /dev/null +++ b/drivers/acpi/drivers/ec/Makefile @@ -0,0 +1,7 @@ +obj-$(CONFIG_ACPI_EC) += ec.o + +ec-y := driver.o device.o event.o + +ec-$(CONFIG_ACPI_DM_PROC) += proc.o +ec-$(CONFIG_ACPI_DM_SYSFS) += sysfs.o + diff --git a/drivers/acpi/drivers/ec/device.c b/drivers/acpi/drivers/ec/device.c new file mode 100644 index 0000000..b1a3a02 --- /dev/null +++ b/drivers/acpi/drivers/ec/device.c @@ -0,0 +1,15 @@ +/** + * drivers/acpi/drivers/ec/device.c - Low-level ec access + * + * Copyright (C) 2006 Patrick Mochel + * + * Based on drivers/acpi/ec.c, which was: + * Copyright (C) 2004 Luming Yu + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * + * This file is released under the GPLv2. + */ + +#include "ec.h" + diff --git a/drivers/acpi/drivers/ec/driver.c b/drivers/acpi/drivers/ec/driver.c new file mode 100644 index 0000000..62d35c9 --- /dev/null +++ b/drivers/acpi/drivers/ec/driver.c @@ -0,0 +1,55 @@ +/*** + * drivers/acpi/drivers/ec/driver.c - New school ACPI ec driver + * + * Copyright (C) 2006 Patrick Mochel + * + * Based on drivers/acpi/ec.c, which was + * + * Copyright (C) 2004 Luming Yu + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * + * This file is released under the GPLv2. + */ + +#include +#include "ec.h" + +static int ec_add(struct acpi_dev * ad) +{ + struct acpi_ec * ae; + int ret = 0; + + ae = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); + if (!ae) + return -ENOMEM; + + ae->e_ad = ad; + + dev_set_drvdata(&ad->dev, ae); + + printk(KERN_INFO PREFIX "ec [%s]\n", + acpi_dev_bid(ad)); + return ret; +} + +static int ec_remove(struct acpi_dev * ad) +{ + struct acpi_ec * af = dev_get_drvdata(&ad->dev); + + dev_set_drvdata(&ad->dev, NULL); + kfree(af); + return 0; +} + +acpi_no_start(ec); +acpi_no_stop(ec); +acpi_no_shutdown(ec); +acpi_no_suspend(ec); +acpi_no_resume(ec); + +declare_acpi_driver(ec, ACPI_EC_HID); + +MODULE_AUTHOR("Patrick Mochel"); +MODULE_DESCRIPTION("ACPI EC Driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/acpi/drivers/ec/ec.h b/drivers/acpi/drivers/ec/ec.h new file mode 100644 index 0000000..5ae6d73 --- /dev/null +++ b/drivers/acpi/drivers/ec/ec.h @@ -0,0 +1,21 @@ +#include + +#ifdef DEBUG +#define dbg(fmt, ...) printk(KERN_DEBUG PREFIX "ec: " fmt "\n", ## __VA_ARGS__) +#else +#define dbg(fmt, ...) +#endif + +#define err(fmt, ...) printk(KERN_ERR PREFIX "ec: " fmt "\n", ## __VA_ARGS__) + +#define _COMPONENT ACPI_EC_COMPONENT +ACPI_MODULE_NAME("acpi_ec"); + + +#define ACPI_EC_HID "PNP0C09" + + +struct acpi_ec { + struct acpi_dev * e_ad; +}; + diff --git a/drivers/acpi/drivers/ec/event.c b/drivers/acpi/drivers/ec/event.c new file mode 100644 index 0000000..f3d6aa9 --- /dev/null +++ b/drivers/acpi/drivers/ec/event.c @@ -0,0 +1,11 @@ +/** + * drivers/acpi/drivers/ec/event.c - ACPI Event notification for ec + * + * Copyright (C) 2006 Patrick Mochel + * + * This file is released under the GPLv2. + */ + +#include "ec.h" + +acpi_device_event_none(ec); diff --git a/drivers/acpi/drivers/ec/proc.c b/drivers/acpi/drivers/ec/proc.c new file mode 100644 index 0000000..c65fb27 --- /dev/null +++ b/drivers/acpi/drivers/ec/proc.c @@ -0,0 +1,16 @@ +/** + * drivers/acpi/drivers/ec/proc.c - procfs interface for ec driver + * + * Copyright (C) 2006 Patrick Mochel + * + * Based on drivers/acpi/ec.c, which was: + * Copyright (C) 2004 Luming Yu + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * + * This file is released under the GPLv2. + */ + +#include "ec.h" + +acpi_driver_proc_none(ec); diff --git a/drivers/acpi/drivers/ec/sysfs.c b/drivers/acpi/drivers/ec/sysfs.c new file mode 100644 index 0000000..7d1eb51 --- /dev/null +++ b/drivers/acpi/drivers/ec/sysfs.c @@ -0,0 +1,11 @@ +/** + * drivers/acpi/drivers/ec/sysfs.c - sysfs interface for ec driver. + * + * Copyright (C) 2006 Patrick Mochel + * + * This file is released under the GPLv2. + */ + +#include "ec.h" + +acpi_driver_sysfs_none(ec); --- 0.99.9.GIT