Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74030
b: refs/heads/master
c: a3f095a
h: refs/heads/master
v: v3
  • Loading branch information
Len Brown committed Nov 21, 2007
1 parent f6bf24d commit 699c9f9
Show file tree
Hide file tree
Showing 25 changed files with 748 additions and 352 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: e790cc8bbb990df900eabdda18a5a480d22a60c8
refs/heads/master: a3f095ade0f5fd2a09a7f523632d762314452871
73 changes: 45 additions & 28 deletions trunk/Documentation/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ThinkPad ACPI Extras Driver

Version 0.16
August 2nd, 2007
Version 0.17
October 04th, 2007

Borislav Deianov <borislav@users.sf.net>
Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Expand Down Expand Up @@ -923,19 +923,34 @@ sysfs backlight device "thinkpad_screen"
This feature allows software control of the LCD brightness on ThinkPad
models which don't have a hardware brightness slider.

It has some limitations: the LCD backlight cannot be actually turned on or off
by this interface, and in many ThinkPad models, the "dim while on battery"
functionality will be enabled by the BIOS when this interface is used, and
cannot be controlled.

The backlight control has eight levels, ranging from 0 to 7. Some of the
levels may not be distinct.

There are two interfaces to the firmware for brightness control, EC and CMOS.
To select which one should be used, use the brightness_mode module parameter:
brightness_mode=1 selects EC mode, brightness_mode=2 selects CMOS mode,
brightness_mode=3 selects both EC and CMOS. The driver tries to autodetect
which interface to use.
It has some limitations: the LCD backlight cannot be actually turned on or
off by this interface, and in many ThinkPad models, the "dim while on
battery" functionality will be enabled by the BIOS when this interface is
used, and cannot be controlled.

On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
has eight brightness levels, ranging from 0 to 7. Some of the levels
may not be distinct. Later Lenovo models that implement the ACPI
display backlight brightness control methods have 16 levels, ranging
from 0 to 15.

There are two interfaces to the firmware for direct brightness control,
EC and CMOS. To select which one should be used, use the
brightness_mode module parameter: brightness_mode=1 selects EC mode,
brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC
and CMOS. The driver tries to autodetect which interface to use.

When display backlight brightness controls are available through the
standard ACPI interface, it is best to use it instead of this direct
ThinkPad-specific interface. The driver will disable its native
backlight brightness control interface if it detects that the standard
ACPI interface is available in the ThinkPad.

The brightness_enable module parameter can be used to control whether
the LCD brightness control feature will be enabled when available.
brightness_enable=0 forces it to be disabled. brightness_enable=1
forces it to be enabled when available, even if the standard ACPI
interface is also available.

Procfs notes:

Expand All @@ -947,11 +962,11 @@ Procfs notes:

Sysfs notes:

The interface is implemented through the backlight sysfs class, which is poorly
documented at this time.
The interface is implemented through the backlight sysfs class, which is
poorly documented at this time.

Locate the thinkpad_screen device under /sys/class/backlight, and inside it
there will be the following attributes:
Locate the thinkpad_screen device under /sys/class/backlight, and inside
it there will be the following attributes:

max_brightness:
Reads the maximum brightness the hardware can be set to.
Expand All @@ -961,17 +976,19 @@ there will be the following attributes:
Reads what brightness the screen is set to at this instant.

brightness:
Writes request the driver to change brightness to the given
value. Reads will tell you what brightness the driver is trying
to set the display to when "power" is set to zero and the display
has not been dimmed by a kernel power management event.
Writes request the driver to change brightness to the
given value. Reads will tell you what brightness the
driver is trying to set the display to when "power" is set
to zero and the display has not been dimmed by a kernel
power management event.

power:
power management mode, where 0 is "display on", and 1 to 3 will
dim the display backlight to brightness level 0 because
thinkpad-acpi cannot really turn the backlight off. Kernel
power management events can temporarily increase the current
power management level, i.e. they can dim the display.
power management mode, where 0 is "display on", and 1 to 3
will dim the display backlight to brightness level 0
because thinkpad-acpi cannot really turn the backlight
off. Kernel power management events can temporarily
increase the current power management level, i.e. they can
dim the display.


Volume control -- /proc/acpi/ibm/volume
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/x86/kernel/acpi/processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
if (cpu_has(c, X86_FEATURE_EST))
buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;

if (cpu_has(c, X86_FEATURE_ACPI))
buf[2] |= ACPI_PDC_T_FFH;

obj->type = ACPI_TYPE_BUFFER;
obj->buffer.length = 12;
obj->buffer.pointer = (u8 *) buf;
Expand Down
3 changes: 0 additions & 3 deletions trunk/arch/x86/kernel/acpi/sleep_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,3 @@ static int __init acpi_sleep_setup(char *str)

__setup("acpi_sleep=", acpi_sleep_setup);

void acpi_pci_link_exit(void)
{
}
21 changes: 20 additions & 1 deletion trunk/arch/x86/kernel/io_apic_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq)
#define default_MCA_trigger(idx) (1)
#define default_MCA_polarity(idx) (0)

static int __init MPBIOS_polarity(int idx)
static int MPBIOS_polarity(int idx)
{
int bus = mp_irqs[idx].mpc_srcbus;
int polarity;
Expand Down Expand Up @@ -2830,6 +2830,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
return 0;
}

int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
{
int i;

if (skip_ioapic_setup)
return -1;

for (i = 0; i < mp_irq_entries; i++)
if (mp_irqs[i].mpc_irqtype == mp_INT &&
mp_irqs[i].mpc_srcbusirq == bus_irq)
break;
if (i >= mp_irq_entries)
return -1;

*trigger = irq_trigger(i);
*polarity = irq_polarity(i);
return 0;
}

#endif /* CONFIG_ACPI */

static int __init parse_disable_timer_pin_1(char *arg)
Expand Down
24 changes: 22 additions & 2 deletions trunk/arch/x86/kernel/io_apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
#define default_PCI_trigger(idx) (1)
#define default_PCI_polarity(idx) (1)

static int __init MPBIOS_polarity(int idx)
static int MPBIOS_polarity(int idx)
{
int bus = mp_irqs[idx].mpc_srcbus;
int polarity;
Expand Down Expand Up @@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
return 0;
}

#endif /* CONFIG_ACPI */

int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
{
int i;

if (skip_ioapic_setup)
return -1;

for (i = 0; i < mp_irq_entries; i++)
if (mp_irqs[i].mpc_irqtype == mp_INT &&
mp_irqs[i].mpc_srcbusirq == bus_irq)
break;
if (i >= mp_irq_entries)
return -1;

*trigger = irq_trigger(i);
*polarity = irq_polarity(i);
return 0;
}

#endif /* CONFIG_ACPI */

/*
* This function currently is only a helper for the i386 smp boot process where
Expand Down Expand Up @@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void)
}
}
#endif

2 changes: 1 addition & 1 deletion trunk/arch/x86/pci/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
return 0;
}

static struct dmi_system_id acpi_pciprobe_dmi_table[] = {
static struct dmi_system_id acpi_pciprobe_dmi_table[] __devinitdata = {
/*
* Systems where PCI IO resource ISA alignment can be skipped
* when the ISA enable bit in the bridge control is not set
Expand Down
18 changes: 15 additions & 3 deletions trunk/drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ config ACPI_SLEEP
config ACPI_PROCFS
bool "Deprecated /proc/acpi files"
depends on PROC_FS
default y
---help---
For backwards compatibility, this option allows
deprecated /proc/acpi/ files to exist, even when
Expand All @@ -61,15 +60,28 @@ config ACPI_PROCFS
/proc/acpi/info (/sys/modules/acpi/parameters/acpica_version)
/proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
/proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
/proc/acpi/battery (/sys/class/power_supply)
/proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
/proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)

This option has no effect on /proc/acpi/ files
and functions which do not yet exist in /sys.

Say N to delete /proc/acpi/ files that have moved to /sys/

config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi folders"
depends on PROC_FS
default y
---help---
For backwards compatibility, this option allows
deprecated power /proc/acpi/ folders to exist, even when
they have been replaced by functions in /sys.
The deprecated folders (and their replacements) include:
/proc/acpi/battery/* (/sys/class/power_supply/*)
/proc/acpi/ac_adapter/* (sys/class/power_supply/*)
This option has no effect on /proc/acpi/ folders
and functions, which do not yet exist in /sys

Say N to delete power /proc/acpi/ folders that have moved to /sys/
config ACPI_PROC_EVENT
bool "Deprecated /proc/acpi/event support"
depends on PROC_FS
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-y += cm_sbs.o
obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
obj-$(CONFIG_ACPI_SBS) += sbs.o
obj-$(CONFIG_ACPI_SBS) += sbshc.o
20 changes: 10 additions & 10 deletions trunk/drivers/acpi/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#endif
Expand All @@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
MODULE_LICENSE("GPL");

#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
extern struct proc_dir_entry *acpi_lock_ac_dir(void);
extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
Expand Down Expand Up @@ -86,7 +86,7 @@ struct acpi_ac {

#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);

#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
static const struct file_operations acpi_ac_fops = {
.open = acpi_ac_open_fs,
.read = seq_read,
Expand Down Expand Up @@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
return 0;
}

#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
Expand Down Expand Up @@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device)
if (result)
goto end;

#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_ac_add_fs(device);
#endif
if (result)
Expand All @@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device)

end:
if (result) {
#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs(device);
#endif
kfree(ac);
Expand Down Expand Up @@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
ACPI_ALL_NOTIFY, acpi_ac_notify);
if (ac->charger.dev)
power_supply_unregister(&ac->charger);
#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs(device);
#endif

Expand All @@ -355,15 +355,15 @@ static int __init acpi_ac_init(void)
if (acpi_disabled)
return -ENODEV;

#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_dir = acpi_lock_ac_dir();
if (!acpi_ac_dir)
return -ENODEV;
#endif

result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) {
#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_ac_dir(acpi_ac_dir);
#endif
return -ENODEV;
Expand All @@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void)

acpi_bus_unregister_driver(&acpi_ac_driver);

#ifdef CONFIG_ACPI_PROCFS
#ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_ac_dir(acpi_ac_dir);
#endif

Expand Down
Loading

0 comments on commit 699c9f9

Please sign in to comment.