diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2007-04-24 16:48:19 +0200 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-04-25 08:00:27 +0200 |
commit | b616004c70dd7f60a1477c3e9d6fddd00ee1fa37 (patch) | |
tree | 5121e2aedfcedeee676146ed9ea559a0127806c0 /drivers/misc | |
parent | ACPI: thinkpad-acpi: add a safety net for TPEC fan control mode (diff) | |
download | linux-b616004c70dd7f60a1477c3e9d6fddd00ee1fa37.tar.xz linux-b616004c70dd7f60a1477c3e9d6fddd00ee1fa37.zip |
ACPI: thinkpad-acpi: add sysfs support to the cmos command subdriver
Add sysfs attributes to send ThinkPad CMOS commands.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 79abc6841e30..ba749df189ab 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -1743,8 +1743,30 @@ static struct ibm_struct bay_driver_data = { * CMOS subdriver */ +/* sysfs cmos_command -------------------------------------------------- */ +static ssize_t cmos_command_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + unsigned long cmos_cmd; + int res; + + if (parse_strtoul(buf, 21, &cmos_cmd)) + return -EINVAL; + + res = issue_thinkpad_cmos_command(cmos_cmd); + return (res)? res : count; +} + +static struct device_attribute dev_attr_cmos_command = + __ATTR(cmos_command, S_IWUSR, NULL, cmos_command_store); + +/* --------------------------------------------------------------------- */ + static int __init cmos_init(struct ibm_init_struct *iibm) { + int res; + vdbg_printk(TPACPI_DBG_INIT, "initializing cmos commands subdriver\n"); @@ -1752,9 +1774,19 @@ static int __init cmos_init(struct ibm_init_struct *iibm) vdbg_printk(TPACPI_DBG_INIT, "cmos commands are %s\n", str_supported(cmos_handle != NULL)); + + res = device_create_file(&tpacpi_pdev->dev, &dev_attr_cmos_command); + if (res) + return res; + return (cmos_handle)? 0 : 1; } +static void cmos_exit(void) +{ + device_remove_file(&tpacpi_pdev->dev, &dev_attr_cmos_command); +} + static int cmos_read(char *p) { int len = 0; @@ -1795,6 +1827,7 @@ static struct ibm_struct cmos_driver_data = { .name = "cmos", .read = cmos_read, .write = cmos_write, + .exit = cmos_exit, }; /************************************************************************* |