Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202503
b: refs/heads/master
c: 500de3d
h: refs/heads/master
i:
  202501: 60a1952
  202499: d31643b
  202495: f7e0dc1
v: v3
  • Loading branch information
Thomas Renninger authored and Matthew Garrett committed Aug 3, 2010
1 parent 49860b7 commit 2609fef
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: de4f10466e9347a2f1bfe39e501539557bed2c4b
refs/heads/master: 500de3dd46ac9f9ae9d124634c68907b7d50d2cb
11 changes: 8 additions & 3 deletions trunk/drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,19 @@ config ACPI_SYSFS_POWER

config ACPI_EC_DEBUGFS
tristate "EC read/write access through /sys/kernel/debug/ec"
default y
default n
help
Say N to disable Embedded Controller /sys/kernel/debug interface

Be aware that using this interface can confuse your Embedded
Controller in a way that a normal reboot is not enough. You then
have to power of your system, and remove the laptop battery for
some seconds.
An Embedded Controller typically is available on laptops and reads
sensor values like battery state and temperature.
The kernel access the EC through ACPI parsed code provided by BIOS
tables.
The kernel accesses the EC through ACPI parsed code provided by BIOS
tables. This option allows to access the EC directly without ACPI
code being involved.
Thus this option is a debug option that helps to write ACPI drivers
and can be used to identify ACPI code or EC firmware bugs.

Expand Down
31 changes: 24 additions & 7 deletions trunk/drivers/acpi/ec_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
MODULE_DESCRIPTION("ACPI EC sysfs access driver");
MODULE_LICENSE("GPL");

static bool write_support;
module_param(write_support, bool, 0644);
MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
"be needed.");

#define EC_SPACE_SIZE 256

struct sysdev_class acpi_ec_sysdev_class = {
Expand Down Expand Up @@ -102,6 +107,8 @@ int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
{
struct dentry *dev_dir;
char name[64];
mode_t mode = 0400;

if (ec_device_count == 0) {
acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL);
if (!acpi_ec_debugfs_dir)
Expand All @@ -111,17 +118,27 @@ int acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
sprintf(name, "ec%u", ec_device_count);
dev_dir = debugfs_create_dir(name, acpi_ec_debugfs_dir);
if (!dev_dir) {
if (ec_device_count == 0)
debugfs_remove_recursive(acpi_ec_debugfs_dir);
/* TBD: Proper cleanup for multiple ECs */
if (ec_device_count != 0)
goto error;
return -ENOMEM;
}

debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe);
debugfs_create_bool("use_global_lock", 0444, dev_dir,
(u32 *)&first_ec->global_lock);
debugfs_create_file("io", 0666, dev_dir, ec, &acpi_ec_io_ops);
if (!debugfs_create_x32("gpe", 0444, dev_dir, (u32 *)&first_ec->gpe))
goto error;
if (!debugfs_create_bool("use_global_lock", 0444, dev_dir,
(u32 *)&first_ec->global_lock))
goto error;

if (write_support)
mode = 0600;
if (!debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops))
goto error;

return 0;

error:
debugfs_remove_recursive(acpi_ec_debugfs_dir);
return -ENOMEM;
}

static int __init acpi_ec_sys_init(void)
Expand Down

0 comments on commit 2609fef

Please sign in to comment.