From f857267b7bb48c406159832837820aa8019508e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathieu=20B=C3=A9rard?= Date: Mon, 17 Apr 2006 17:58:59 +0000 Subject: [PATCH 1/1] Create trunk directory --- Makefile | 124 ++++++ ac.c | 107 +++++ apmemu.c | 167 +++++++ apmemu.h | 48 +++ battery.c | 565 ++++++++++++++++++++++++ blank.c | 177 ++++++++ debian/README.Debian | 28 ++ debian/changelog | 6 + debian/compat | 1 + debian/control | 14 + debian/control.module.in | 21 + debian/control.modules.in | 21 + debian/copyright | 27 ++ debian/docs | 8 + debian/files | 1 + debian/postinst.module.in | 46 ++ debian/postinst.modules.in | 46 ++ debian/postrm.module.in | 45 ++ debian/postrm.modules.in | 45 ++ debian/rules | 179 ++++++++ debian/rules.old | 321 ++++++++++++++ display.c | 102 +++++ doc/BUGS | 40 ++ doc/COPYING | 340 +++++++++++++++ doc/CREDITS | 39 ++ doc/ChangeLog | 361 ++++++++++++++++ doc/INSTALL | 52 +++ doc/README | 528 +++++++++++++++++++++++ doc/README-1st | 16 + doc/README-2.6 | 20 + doc/README-OneTouch | 213 +++++++++ doc/TODO | 9 + dock.c | 88 ++++ dump.c | 97 +++++ ec.c | 328 ++++++++++++++ ec.h | 307 +++++++++++++ fan.c | 308 +++++++++++++ fan_policy.c | 225 ++++++++++ info.c | 84 ++++ init.c | 620 ++++++++++++++++++++++++++ init.h | 44 ++ lcd.c | 224 ++++++++++ misc/apm-disabled.patch | 15 + misc/dmi_strings.txt | 670 +++++++++++++++++++++++++++++ misc/hotkeys/README.hotkeys | 22 + misc/hotkeys/nx9xxx.def | 28 ++ misc/hotkeys/ob5xx.def | 30 ++ misc/hotkeys/xe3gc.def | 32 ++ misc/hotkeys/xe3gf.def | 32 ++ misc/hotkeys/xe4xxx.def | 28 ++ misc/hotkeys/xt155.def | 23 + misc/obtest/Makefile | 7 + misc/obtest/obtest.c | 400 +++++++++++++++++ misc/omnibook-dmi.patch | 15 + misc/omnibook-integration.patch | 86 ++++ misc/onetouch-xkb-2003-02-10.patch | 199 +++++++++ omnibook.h | 106 +++++ onetouch.c | 182 ++++++++ temperature.c | 100 +++++ touchpad.c | 167 +++++++ watch.c | 102 +++++ 61 files changed, 8286 insertions(+) create mode 100644 Makefile create mode 100644 ac.c create mode 100644 apmemu.c create mode 100644 apmemu.h create mode 100644 battery.c create mode 100644 blank.c create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/control.module.in create mode 100644 debian/control.modules.in create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/files create mode 100644 debian/postinst.module.in create mode 100644 debian/postinst.modules.in create mode 100644 debian/postrm.module.in create mode 100644 debian/postrm.modules.in create mode 100755 debian/rules create mode 100755 debian/rules.old create mode 100644 display.c create mode 100644 doc/BUGS create mode 100644 doc/COPYING create mode 100644 doc/CREDITS create mode 100644 doc/ChangeLog create mode 100644 doc/INSTALL create mode 100644 doc/README create mode 100644 doc/README-1st create mode 100644 doc/README-2.6 create mode 100644 doc/README-OneTouch create mode 100644 doc/TODO create mode 100644 dock.c create mode 100644 dump.c create mode 100644 ec.c create mode 100644 ec.h create mode 100644 fan.c create mode 100644 fan_policy.c create mode 100644 info.c create mode 100644 init.c create mode 100644 init.h create mode 100644 lcd.c create mode 100644 misc/apm-disabled.patch create mode 100644 misc/dmi_strings.txt create mode 100644 misc/hotkeys/README.hotkeys create mode 100644 misc/hotkeys/nx9xxx.def create mode 100644 misc/hotkeys/ob5xx.def create mode 100644 misc/hotkeys/xe3gc.def create mode 100644 misc/hotkeys/xe3gf.def create mode 100644 misc/hotkeys/xe4xxx.def create mode 100644 misc/hotkeys/xt155.def create mode 100644 misc/obtest/Makefile create mode 100644 misc/obtest/obtest.c create mode 100644 misc/omnibook-dmi.patch create mode 100644 misc/omnibook-integration.patch create mode 100644 misc/onetouch-xkb-2003-02-10.patch create mode 100644 omnibook.h create mode 100644 onetouch.c create mode 100644 temperature.c create mode 100644 touchpad.c create mode 100644 watch.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..738e760 --- /dev/null +++ b/Makefile @@ -0,0 +1,124 @@ +# +# Makefile -- makefile for the HP OmniBook support module +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# Written by Soós Péter , 2002-2004 +# + +MODULE_NAME = omnibook + +ifeq ($(KERNELRELEASE),) + +DESTDIR = +MODDIR = $(DESTDIR)/lib/modules +KVER = $(shell uname -r) +VMODDIR = $(MODDIR)/$(KVER) +INSTDIR = $(VMODDIR)/kernel/drivers/misc/omnibook +#KSRC = /usr/src/linux +KSRC = $(VMODDIR)/build +KMODDIR = $(KSRC)/drivers/misc/omnibook +KINCDIR = $(KSRC)/include/linux +KDOCDIR = $(KSRC)/Documentation/omnibook +BDIR = $(shell pwd) +TODAY = $(shell date +%Y%m%d) +KERNEL = $(shell uname -r | cut -c 1-3) + +CC = gcc +LD = ld +DEPMOD = depmod -a +RMMOD = modprobe -r +INSMOD = modprobe +INSTALL = install -m 644 +MKDIR = mkdir -p +RM = rm -f +FIND = find +endif + +DEBUG = # -D OMNIBOOK_DEBUG -g -O0 +# Used by 2.6 stuff, so let's be consistant. +EXTRA_CFLAGS += -D OMNIBOOK_STANDALONE $(DEBUG) + +OBJS = ac.o battery.o blank.o display.o dock.o \ + ec.o fan.o fan_policy.o init.o lcd.o onetouch.o \ + temperature.o touchpad.o dump.o info.o watch.o \ + apmemu.o + +# All extra flags delt with automagically +obj-m += $(MODULE_NAME).o +omnibook-objs := $(OBJS) + +all: $(MODULE_NAME).ko + +clean: + $(RM) .*.cmd *.map *.mod.c *.o *.ko *~ "#*#" + $(RM) -r .tmp_versions + $(RM) -r debian/omnibook-source *-stamp + $(RM) -r Modules.symvers + (cd misc/obtest; $(RM) obtest *.o) + +install: all + # Removing module from old location + $(RM) $(MODDIR)/char/$(MODULE_NAME).ko + $(RM) $(MODDIR)/misc/$(MODULE_NAME).ko + $(MKDIR) $(INSTDIR) + $(INSTALL) $(MODULE_NAME).ko $(INSTDIR) + $(DEPMOD) + +unload: + $(RMMOD) $(MODULE_NAME) || : + +load: install unload + $(INSMOD) $(MODULE_NAME) + +uninstall: unload + $(FIND) $(VMODDIR) -name "$(MODULE_NAME).ko" -exec $(RM) {} \; + $(DEPMOD) + +uninstall-all: unload + $(FIND) $(MODDIR) -name "$(MODULE_NAME).ko" -exec $(RM) {} \; + $(DEPMOD) + +$(MODULE_NAME).ko: + PWD=$(shell pwd) + $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules + +kinstall: + $(RM) -r $(KMODDIR) + $(RM) $(KINCDIR)/omnibook.h + $(MKDIR) $(KMODDIR) + $(INSTALL) *.c $(KMODDIR) + $(INSTALL) apmemu.h ec.h init.h $(KMODDIR) + $(INSTALL) omnibook.h $(KINCDIR) + $(MKDIR) $(KDOCDIR) + $(INSTALL) doc/README doc/README-OneTouch $(KDOCDIR) + +kpatch: kinstall + (cd $(KSRC); patch -p1 < $(BDIR)/misc/omnibook-integration.patch) + +deb: clean + dch -v $(TODAY) + fakeroot dpkg-buildpackage + + +release: clean + mkdir -p ../$(MODULE_NAME)-$(TODAY) + cp -a *.h *.c Makefile debian doc misc ../$(MODULE_NAME)-$(TODAY) + sed -i "s|^\(#define OMNIBOOK_MODULE_VERSION.*\)\".*\"|\1\"$(TODAY)\"|" ../$(MODULE_NAME)-$(TODAY)/omnibook.h + sed -i "s|^\(omnibook \)(current.*)|\1($(TODAY)-0)|" ../$(MODULE_NAME)-$(TODAY)/debian/changelog + rm -f ../$(MODULE_NAME)-$(TODAY).tar ../$(MODULE_NAME)-$(TODAY).tar.gz + (cd ..; tar cvf $(MODULE_NAME)-$(TODAY).tar $(MODULE_NAME)-$(TODAY); gzip -9 $(MODULE_NAME)-$(TODAY).tar) + +current: clean + rm -f ../$(MODULE_NAME)-current.tar ../$(MODULE_NAME)-current.tar.gz + (cd ..; tar cvf $(MODULE_NAME)-current.tar $(MODULE_NAME)-current; gzip -9 $(MODULE_NAME)-current.tar) + +# End of file diff --git a/ac.c b/ac.c new file mode 100644 index 0000000..a1c2e01 --- /dev/null +++ b/ac.c @@ -0,0 +1,107 @@ +/* + * ac.c -- AC adapter related functions + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +int omnibook_get_ac(void) +{ + u8 ac; + int retval; + /* + * XE3GF + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X) ) { + if ((retval = omnibook_ec_read(XE3GF_ADP, &ac))) + return retval; + retval = (ac & XE3GF_ADP_MASK) ? 1 : 0; + /* + * XE3GC + * AMILOD + */ + } else if (omnibook_ectype & (XE3GC|AMILOD) ) { + if ((retval = omnibook_ec_read(XE3GC_STA1, &ac))) + return retval; + retval = (ac & XE3GC_ADP_MASK) ? 1 : 0; + /* + * OB500 + * OB510 + * 0B6000 + * 0B61000 + * XE4500 + */ + } else if (omnibook_ectype & (OB500|OB510|OB6000|OB6100|XE4500) ) { + if ((retval = omnibook_ec_read(OB500_STA2, &ac))) + return retval; + retval = (ac & OB500_ADP_MASK) ? 1 : 0; + /* + * OB4150 + */ + } else if (omnibook_ectype & OB4150 ) { + if ((retval = omnibook_ec_read(OB4150_ADP, &ac))) + return retval; + retval = (ac & OB4150_ADP_MASK) ? 1 : 0; + /* + * XE2 + */ + } else if (omnibook_ectype & XE2) { + if ((retval = omnibook_ec_read(XE2_STA1, &ac))) + return retval; + retval = (ac & XE2_ADP_MASK) ? 1 : 0; + /* + * UNKNOWN + */ + } else { + printk(KERN_INFO + "%s: AC adapter status monitoring is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + return retval; +} + +static int omnibook_ac_read(char *buffer) +{ + int len = 0; + int ac; + + ac = omnibook_get_ac(); + if (ac < 0) + return ac; + + len += sprintf(buffer + len, "AC %s\n", (ac) ? "on-line" : "off-line"); + + return len; +} + +struct omnibook_feature ac_feature = { + .name = "ac", + .enabled = 1, + .read = omnibook_ac_read, + .ectypes = XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE4500|OB4150|XE2|AMILOD|TSP10|TSM30X, +}; + +module_param_named(ac, ac_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(ac, "Use 0 to disable, 1 to enable AC adapter status monitoring"); + +/* End of file */ diff --git a/apmemu.c b/apmemu.c new file mode 100644 index 0000000..9b306f0 --- /dev/null +++ b/apmemu.c @@ -0,0 +1,167 @@ +/* + * apmemu.c -- /proc/apm emulation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + + +#ifdef CONFIG_APM +#include +#endif + +#include +#include + +#include "apmemu.h" + +/* Arguments, with symbols from linux/apm_bios.h. Information is + from the Get Power Status (0x0a) call unless otherwise noted. + 0) Linux driver version (this will change if format changes) + 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2. + 2) APM flags from APM Installation Check (0x00): + bit 0: APM_16_BIT_SUPPORT + bit 1: APM_32_BIT_SUPPORT + bit 2: APM_IDLE_SLOWS_CLOCK + bit 3: APM_BIOS_DISABLED + bit 4: APM_BIOS_DISENGAGED + 3) AC line status + 0x00: Off-line + 0x01: On-line + 0x02: On backup power (BIOS >= 1.1 only) + 0xff: Unknown + 4) Battery status + 0x00: High + 0x01: Low + 0x02: Critical + 0x03: Charging + 0x04: Selected battery not present (BIOS >= 1.2 only) + 0xff: Unknown + 5) Battery flag + bit 0: High + bit 1: Low + bit 2: Critical + bit 3: Charging + bit 7: No system battery + 0xff: Unknown + 6) Remaining battery life (percentage of charge): + 0-100: valid + -1: Unknown + 7) Remaining battery life (time units): + Number of remaining minutes or seconds + -1: Unknown + 8) min = minutes; sec = seconds */ + +static int omnibook_apmemu_read(char *buffer) +{ + int retval; + int len = 0; + int ac; + + struct omnibook_battery_state battstat; + + struct apm_features { + char *drvver; + char *apmver; + u8 apmflags; + u8 ac; + u8 battstat; + u8 battflags; + u8 gauge; + int time; + char *units; + }; + + struct apm_features apm = { + APMEMU_DRIVER_VERSION, + APMEMU_APM_VERSION, + APMEMU_32_BIT_SUPPORT | APMEMU_BIOS_DISABLED, + APMEMU_AC_UNKNOWN, + APMEMU_BATTSTAT_UNKN, + 0x00, + APMEMU_BATTLIFE_UNKN, + APMEMU_BATTLIFE_UNKN, + "?" + }; + + ac = omnibook_get_ac(); + apm.ac = (ac) ? APMEMU_AC_ONLINE : APMEMU_AC_OFFLINE; + /* Asking for Battery 0 as APM does */ + retval = omnibook_get_battery_status(0, &battstat); + if (retval == 0) + apm.gauge = battstat.gauge; + if (apm.gauge >= APMEMU_BATTERY_LOW) { + apm.battflags = apm.battflags | APMEMU_BATTFLAG_HIGH; + apm.battstat = APMEMU_BATTSTAT_HIGH; + } else { + apm.battflags = apm.battflags | APMEMU_BATTFLAG_LOW; + apm.battstat = APMEMU_BATTSTAT_LOW; + } + if (battstat.status == OMNIBOOK_BATTSTAT_CHARGING) { + apm.battflags = apm.battflags | APMEMU_BATTFLAG_CHR; + apm.battstat = APMEMU_BATTSTAT_CHR; + } + if (battstat.status == OMNIBOOK_BATTSTAT_CRITICAL) { + apm.battflags = apm.battflags | APMEMU_BATTFLAG_CRIT; + apm.battstat = APMEMU_BATTSTAT_CRIT; + } + + len += sprintf(buffer + len, "%s %s 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", + apm.drvver, + apm.apmver, + apm.apmflags, + apm.ac, + apm.battstat, + apm.battflags, + apm.gauge, + apm.time, + apm.units + ); + + return len; +} + +static int __init omnibook_apmemu_init(void) +{ +#ifdef CONFIG_APM + if (!apm_info.disabled) { + printk(KERN_INFO "%s: Real APM support is present, emulation is not necessary.\n", OMNIBOOK_MODULE_NAME); + return -ENODEV; + } +#endif + return 0; +} + +struct omnibook_feature apmemu_feature = { + .name = "apmemu", + .proc_entry = "apm", /* create /proc/apm */ +#ifdef CONFIG_OMNIBOOK_APMEMU + .enabled = 1, +#else + .enabled = 0, +#endif + .read = omnibook_apmemu_read, + .init = omnibook_apmemu_init, + .ectypes = XE3GF|XE3GC|TSP10, +}; + + +module_param_named(apmemu, apmemu_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(apmemu, "Use 0 to disable, 1 to enable /proc/apm emulation"); + +/* End of file */ diff --git a/apmemu.h b/apmemu.h new file mode 100644 index 0000000..6d3af13 --- /dev/null +++ b/apmemu.h @@ -0,0 +1,48 @@ +/* + * apmemu.c -- code to emulate /proc/apm + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + + +#define APMEMU_DRIVER_VERSION "1.16" +#define APMEMU_APM_VERSION "1.2" + +#define APMEMU_BATTERY_LOW 30 /* Battery low threshold */ + +#define APMEMU_16_BIT_SUPPORT 0x01 /* 16 bit APM BIOS */ +#define APMEMU_32_BIT_SUPPORT 0x02 /* 32 bit APM BIOS */ +#define APMEMU_IDLE_SLOWS_CLOCK 0x04 +#define APMEMU_BIOS_DISABLED 0x08 /* APM BIOS disabled */ +#define APMEMU_BIOS_DISENGAGED 0x10 /* APM BIOS disengaged */ + +#define APMEMU_AC_OFFLINE 0x00 /* AC offline */ +#define APMEMU_AC_ONLINE 0x01 /* AC online */ +#define APMEMU_AC_BACKUP 0x02 /* On backup power */ +#define APMEMU_AC_UNKNOWN 0xFF /* Unkonwn status */ + +#define APMEMU_BATTSTAT_HIGH 0x00 /* Remaining battery capacity is high */ +#define APMEMU_BATTSTAT_LOW 0x01 /* Remaining battery capacity is low */ +#define APMEMU_BATTSTAT_CRIT 0x02 /* Battery status is critical */ +#define APMEMU_BATTSTAT_CHR 0x03 /* Battery is charging */ +#define APMEMU_BATTSTAT_MISS 0x04 /* Battery is not present */ + +#define APMEMU_BATTFLAG_HIGH 0x01 /* Remaining battery capacity is high bit */ +#define APMEMU_BATTFLAG_LOW 0x02 /* Remaining battery capacity is low bit */ +#define APMEMU_BATTFLAG_CRIT 0x04 /* Battery status is critical bit */ +#define APMEMU_BATTFLAG_CHR 0x08 /* Battery is charging bit */ +#define APMEMU_BATTFLAG_MISS 0x80 /* Battery is not present bit */ + +#define APMEMU_BATTSTAT_UNKN 0xff /* Status is unknown */ + +#define APMEMU_BATTLIFE_UNKN -1 /* Remaining battery capacity is unknown */ diff --git a/battery.c b/battery.c new file mode 100644 index 0000000..7443e8d --- /dev/null +++ b/battery.c @@ -0,0 +1,565 @@ +/* + * battery.c -- battery related functions + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +static int omnibook_ec_read16(u8 addr, u16 * data) +{ + int retval; + u8 high; + u8 low; + u16 result; + + retval = omnibook_ec_read(addr, &low); + if (retval) + return retval; + retval = omnibook_ec_read(addr + 0x01, &high); + result = ((high << 8) + low); + *data = result; + return retval; +} + +static int omnibook_battery_present(int num) +{ + int retval; + int i; + u8 bat; + u8 mask = 0; + + /* + * XE3GF + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X) ) { + + if (num >= 2) + return -EINVAL; + if ((retval = omnibook_ec_read(XE3GF_BAL, &bat))) + return retval; + mask = XE3GF_BAL0_MASK; + for (i = 0; i < num; i++) + mask = mask << 1; + /* + * XE3GC + * AMILOD + */ + } else if (omnibook_ectype & (XE3GC|AMILOD) ) { + if (num >= 2) + return -EINVAL; + if ((retval = omnibook_ec_read(XE3GC_BAT, &bat))) + return retval; + mask = XE3GC_BAT0_MASK; + for (i = 0; i < num; i++) + mask = mask << 1; + } + return (bat & mask) ? 1 : 0; +} + +/* + * Get static battery information + * All info have to be reread every time because battery sould be cahnged + * when laptop is on AC power + * return values: + * < 0 - ERROR + * 0 - OK + * 1 - Battery is not present + * 2 - Not supported + */ +static int omnibook_get_battery_info(int num, + struct omnibook_battery_info *battinfo) +{ + int retval; + u32 offset; + + /* + * XE3GF + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X) ) { + offset = 0x10; + retval = omnibook_battery_present(num); + if (retval < 0) + return retval; + if (retval) { + if ((retval = + omnibook_ec_read(XE3GF_BTY0 + (offset * num), + &(*battinfo).type))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GF_BSN0 + (offset * num), + &(*battinfo).sn))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GF_BDV0 + (offset * num), + &(*battinfo).dv))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GF_BDC0 + (offset * num), + &(*battinfo).dc))) + return retval; + + (*battinfo).type = + ((*battinfo).type & XE3GF_BTY_MASK) ? 1 : 0; + } else + return 1; + /* + * XE3GC + */ + } else if (omnibook_ectype & (XE3GC) ) { + offset = 0x10; + retval = omnibook_battery_present(num); + if (retval < 0) + return retval; + if (retval) { + if ((retval = + omnibook_ec_read16(XE3GC_BDV0 + (offset * num), + &(*battinfo).dv))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GC_BDC0 + (offset * num), + &(*battinfo).dc))) + return retval; + if ((retval = + omnibook_ec_read(XE3GC_BTY0 + (offset * num), + &(*battinfo).type))) + return retval; + + (*battinfo).type = + ((*battinfo).type & XE3GC_BTY_MASK) ? 1 : 0; + (*battinfo).sn = 0; /* Unknown */ + } else + return 1; + /* + * AMILOD + */ + } else if (omnibook_ectype & (AMILOD) ) { + offset = 0x10; + retval = omnibook_battery_present(num); + if (retval < 0) + return retval; + if (retval) { + if ((retval = + omnibook_ec_read16(AMILOD_BDV0 + (offset * num), + &(*battinfo).dv))) + return retval; + if ((retval = + omnibook_ec_read16(AMILOD_BDC0 + (offset * num), + &(*battinfo).dc))) + return retval; + if ((retval = + omnibook_ec_read(AMILOD_BTY0 + (offset * num), + &(*battinfo).type))) + return retval; + + (*battinfo).type = + ((*battinfo).type & AMILOD_BTY_MASK) ? 1 : 0; + (*battinfo).sn = 0; /* Unknown */ + } else + return 1; + /* + * FIXME + * OB500 + * OB510 + */ + } else if (omnibook_ectype & (OB500|OB510) ) { + switch (num) { + case 0: + break; + case 1: + break; + case 2: + break; + default: + return -EINVAL; + } + /* + * OB6000 + * OB6100 + * XE4500 + */ + } else if (omnibook_ectype & (OB6000|OB6100|XE4500) ) { + switch (num) { + case 0: + break; + case 1: + break; + default: + return -EINVAL; + } + } else { + return 2; + } + return 0; +} + +/* + * Get battery status + * return values: + * < 0 - ERROR + * 0 - OK + * 1 - Battery is not present + * 2 - Not supported + */ +int omnibook_get_battery_status(int num, + struct omnibook_battery_state *battstat) +{ + int retval; + u8 status; + u16 dc; + int gauge; + u8 offset; + + /* + * XE3GF + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X) ) { + offset = 0x10; + retval = omnibook_battery_present(num); + if (retval < 0) + return retval; + if (retval) { + if ((retval = + omnibook_ec_read(XE3GF_BST0 + (offset * num), &status))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GF_BRC0 + (offset * num), + &(*battstat).rc))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GF_BPV0 + (offset * num), + &(*battstat).pv))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GF_BFC0 + (offset * num), + &(*battstat).lc))) + return retval; + if ((retval = + omnibook_ec_read(XE3GF_GAU0 + (offset * num), + &(*battstat).gauge))) + return retval; + + if (status & XE3GF_BST_MASK_CRT) + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL; + else if (status & XE3GF_BST_MASK_CHR) + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING; + else if (status & XE3GF_BST_MASK_DSC) + (*battstat).status = + OMNIBOOK_BATTSTAT_DISCHARGING; + else if (status & + (XE3GF_BST_MASK_CHR | XE3GF_BST_MASK_DSC)) + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN; + else { + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED; + } + } else + return 1; + /* + * XE3GC + */ + } else if (omnibook_ectype & (XE3GC) ) { + offset = 0x10; + retval = omnibook_battery_present(num); + if (retval < 0) + return retval; + if (retval) { + if ((retval = + omnibook_ec_read(XE3GC_BST0 + (offset * num), &status))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GC_BRC0 + (offset * num), + &(*battstat).rc))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GC_BPV0 + (offset * num), + &(*battstat).pv))) + return retval; + if ((retval = + omnibook_ec_read16(XE3GC_BDC0 + (offset * num), &dc))) + return retval; + + if (status & XE3GC_BST_MASK_CRT) + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL; + else if (status & XE3GC_BST_MASK_CHR) + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING; + else if (status & XE3GC_BST_MASK_DSC) + (*battstat).status = + OMNIBOOK_BATTSTAT_DISCHARGING; + else if (status & + (XE3GC_BST_MASK_CHR | XE3GC_BST_MASK_DSC)) + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN; + else { + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED; + } + gauge = ((*battstat).rc * 100) / dc; + (*battstat).gauge = gauge; + (*battstat).lc = 0; /* Unknown */ + } else + return 1; + /* + * AMILOD + */ + } else if (omnibook_ectype & (AMILOD) ) { + offset = 0x10; + retval = omnibook_battery_present(num); + if (retval < 0) + return retval; + if (retval) { + if ((retval = + omnibook_ec_read(AMILOD_BST0 + (offset * num), &status))) + return retval; + if ((retval = + omnibook_ec_read16(AMILOD_BRC0 + (offset * num), + &(*battstat).rc))) + return retval; + if ((retval = + omnibook_ec_read16(AMILOD_BPV0 + (offset * num), + &(*battstat).pv))) + return retval; + if ((retval = + omnibook_ec_read16(AMILOD_BDC0 + (offset * num), &dc))) + return retval; + + if (status & AMILOD_BST_MASK_CRT) + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL; + else if (status & AMILOD_BST_MASK_CHR) + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING; + else if (status & AMILOD_BST_MASK_DSC) + (*battstat).status = + OMNIBOOK_BATTSTAT_DISCHARGING; + else if (status & + (AMILOD_BST_MASK_CHR | AMILOD_BST_MASK_DSC)) + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN; + else { + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED; + } + gauge = ((*battstat).rc * 100) / dc; + (*battstat).gauge = gauge; + (*battstat).lc = 0; /* Unknown */ + } else + return 1; + /* + * OB500 + * OB510 + */ + } else if (omnibook_ectype & (OB500|OB510) ) { + switch (num) { + case 0: + if ((retval = omnibook_ec_read(OB500_BT1S, &status))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT1C, &(*battstat).rc))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT1V, &(*battstat).pv))) + return retval; + break; + case 1: + if ((retval = omnibook_ec_read(OB500_BT2S, &status))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT2C, &(*battstat).rc))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT2V, &(*battstat).pv))) + return retval; + break; + case 2: + if ((retval = omnibook_ec_read(OB500_BT3S, &status))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT3C, &(*battstat).rc))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT3V, &(*battstat).pv))) + return retval; + break; + default: + return -EINVAL; + } + if (status & OB500_BST_MASK_CRT) + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL; + else if (status & OB500_BST_MASK_CHR) + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING; + else if (status & OB500_BST_MASK_DSC) + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING; + else if (status & (OB500_BST_MASK_CHR | OB500_BST_MASK_DSC)) + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN; + else { + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED; + } + /* + * OB6000 + * OB6100 + * XE4500 + */ + } else if (omnibook_ectype & (OB6000|OB6100|XE4500) ) { + switch (num) { + case 0: + if ((retval = omnibook_ec_read(OB500_BT1S, &status))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT1C, &(*battstat).rc))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT1V, &(*battstat).pv))) + return retval; + break; + case 1: + if ((retval = omnibook_ec_read(OB500_BT3S, &status))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT3C, &(*battstat).rc))) + return retval; + if ((retval = omnibook_ec_read16(OB500_BT3V, &(*battstat).pv))) + return retval; + break; + default: + return -EINVAL; + } + if (status & OB500_BST_MASK_CRT) + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL; + else if (status & OB500_BST_MASK_CHR) + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING; + else if (status & OB500_BST_MASK_DSC) + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING; + else if (status & (OB500_BST_MASK_CHR | OB500_BST_MASK_DSC)) + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN; + else { + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED; + } + } else { + return 2; + } + return 0; +} + +static int omnibook_battery_read(char *buffer) +{ + char *statustr; + char *typestr; + int max = 0; + int num = 0; + int len = 0; + int retval; + int i; + struct omnibook_battery_info battinfo; + struct omnibook_battery_state battstat; + /* + * XE3GF + * XE3GC + * 0B6000 + * 0B6100 + * XE4500 + * AMILOD + * TSP10 + */ + if (omnibook_ectype & (XE3GF|XE3GC|OB6000|OB6100|XE4500|AMILOD|TSP10) ) + max = 2; + /* + * OB500 + * 0B510 + */ + else if (omnibook_ectype & (OB500|OB510) ) + max = 3; + /* + * TSM30X + */ + else if (omnibook_ectype & (TSM30X) ) + max = 1; + + for (i = 0; i < max; i++) { + retval = omnibook_get_battery_info(i, &battinfo); + if (retval == 0) { + num++; + omnibook_get_battery_status(i, &battstat); + typestr = (battinfo.type) ? "Li-Ion" : "NiMH"; + switch (battstat.status) { + case OMNIBOOK_BATTSTAT_CHARGED: + statustr = "charged"; + break; + case OMNIBOOK_BATTSTAT_DISCHARGING: + statustr = "discharging"; + break; + case OMNIBOOK_BATTSTAT_CHARGING: + statustr = "charging"; + break; + case OMNIBOOK_BATTSTAT_CRITICAL: + statustr = "critical"; + break; + default: + statustr = "unknown"; + } + + len += + sprintf(buffer + len, "Battery: %11d\n", + i); + len += + sprintf(buffer + len, "Type: %11s\n", + typestr); + if (battinfo.sn) + len += + sprintf(buffer + len, + "Serial Number: %11d\n", + battinfo.sn); + len += + sprintf(buffer + len, + "Present Voltage: %11d mV\n", + battstat.pv); + len += + sprintf(buffer + len, + "Design Voltage: %11d mV\n", + battinfo.dv); + len += + sprintf(buffer + len, + "Remaining Capacity: %11d mAh\n", + battstat.rc); + if (battstat.lc) + len += + sprintf(buffer + len, + "Last Full Capacity: %11d mAh\n", + battstat.lc); + len += + sprintf(buffer + len, + "Design Capacity: %11d mAh\n", + battinfo.dc); + len += + sprintf(buffer + len, + "Gauge: %11d %%\n", + battstat.gauge); + len += + sprintf(buffer + len, "Status: %11s\n", + statustr); + len += sprintf(buffer + len, "\n"); + } + } + if (num == 0) + len += sprintf(buffer + len, "No battery present\n"); + + return len; +} + +struct omnibook_feature battery_feature = { + .name = "battery", + .enabled = 1, + .read = omnibook_battery_read, + .ectypes = XE3GF|XE3GC|AMILOD|TSP10|TSM30X, /* FIXME: OB500|OB6000|OB6100|XE4500 */ +}; + + +module_param_named(battery, battery_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(battery, "Use 0 to disable, 1 to enable battery status monitoring"); +/* End of file */ diff --git a/blank.c b/blank.c new file mode 100644 index 0000000..d9a2a89 --- /dev/null +++ b/blank.c @@ -0,0 +1,177 @@ +/* + * blank.c -- blanking lcd console + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +int omnibook_console_blank_enabled = 0; + +extern int (*console_blank_hook) (int); + +int omnibook_lcd_blank(int blank) +{ + int retval = 0; + u8 cmd; + /* + * XE3GF + * XE3GC + * AMILOD + * TSP10 + * TSM30X + * TSM40 + */ + if (omnibook_ectype & (XE3GF|XE3GC|AMILOD|TSP10|TSM30X|TSM40) ) { + cmd = + blank ? OMNIBOOK_KBC_CMD_LCD_OFF : OMNIBOOK_KBC_CMD_LCD_ON; + if ((retval = + omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, cmd))) + return retval; + /* + * OB500 + * OB6000 + * XE2 + */ + } else if (omnibook_ectype & (OB500|OB6000|XE2) ) { + if ((retval = omnibook_io_read(OB500_GPO1, &cmd))) + return retval; + cmd = blank ? cmd & ~OB500_BKLT_MASK : cmd | OB500_BKLT_MASK; + if ((retval = omnibook_io_write(OB500_GPO1, cmd))) + return retval; + /* + * OB510 + * 0B61000 + */ + } else if (omnibook_ectype & (OB510|OB6100) ) { + if ((retval = omnibook_io_read(OB510_GPO2, &cmd))) + return retval; + cmd = blank ? cmd & ~OB510_BKLT_MASK : cmd | OB510_BKLT_MASK; + if ((retval = omnibook_io_write(OB510_GPO2, cmd))) + return retval; + /* + * UNKNOWN + */ + } else { + printk(KERN_INFO + "%s: LCD console blanking is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + return retval; +} + +static int omnibook_console_blank_enable(void) +{ + if (omnibook_console_blank_enabled == 0) { + if (console_blank_hook == NULL) { + console_blank_hook = omnibook_lcd_blank; + printk(KERN_INFO + "%s: LCD backlight turn off at console blanking is enabled.\n", + OMNIBOOK_MODULE_NAME); + omnibook_console_blank_enabled = 1; + } else { + printk(KERN_INFO + "%s: There is a console blanking solution already registered.\n", + OMNIBOOK_MODULE_NAME); + } + } + return 0; +} + +static int omnibook_console_blank_disable(void) +{ + if (console_blank_hook == omnibook_lcd_blank) { + console_blank_hook = NULL; + printk(KERN_INFO + "%s: LCD backlight turn off at console blanking is disabled.\n", + OMNIBOOK_MODULE_NAME); + omnibook_console_blank_enabled = 0; + } else if (console_blank_hook) { + printk(KERN_WARNING + "%s: You can not disable another console blanking solution.\n", + OMNIBOOK_MODULE_NAME); + return -EBUSY; + } else { + printk(KERN_INFO "%s: Console blanking already disabled.\n", + OMNIBOOK_MODULE_NAME); + return 0; + } + return 0; +} + +static int omnibook_console_blank_read(char *buffer) +{ + int len = 0; + + len += + sprintf(buffer + len, "LCD console blanking is %s\n", + (omnibook_console_blank_enabled) ? "enabled" : "disabled"); + + return len; +} + +static int omnibook_console_blank_write(char *buffer) +{ + int retval; + + switch (*buffer) { + case '0': + if ((retval = omnibook_console_blank_disable())) + return retval; + break; + case '1': + if ((retval = omnibook_console_blank_enable())) + return retval; + break; + default: + return -EINVAL; + } + return 0; +} + +static int __init omnibook_console_blank_init(void) +{ + + int retval; + + if ((retval = omnibook_console_blank_enable())) + return retval; + + return 0; +} + +static void __exit omnibook_console_blank_cleanup(void) +{ + omnibook_console_blank_disable(); +} + +struct omnibook_feature blank_feature = { + .name = "blank", + .enabled = 1, + .read = omnibook_console_blank_read, + .write = omnibook_console_blank_write, + .init = omnibook_console_blank_init, + .exit = omnibook_console_blank_cleanup, + .ectypes = XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE2|AMILOD|TSP10|TSM30X|TSM40, +}; + +module_param_named(blank, blank_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(blank, "Use 0 to disable, 1 to enable lcd console blanking"); +/* End of file */ diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..3daed1d --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,28 @@ +omnibook for Debian +------------------- + +Please see docs/README for a description of the omnibook kernel module. + +The Debian omnibook source package provides omnibook-source, package +which provides the source for the kernel module. + +The omnibook-source package can be used in several ways, + + - Using the make-kpkg(1) command provided by the kernel-package Debian + package. This will produce a corresponding omnibook-modules package for + the Debian kernel-image package that you are using. + See the "modules_image" section of the make-kpkg(1) man page. + + - Using module-assistant. Simply issue the following command (as root): + $ module-assistant auto-install omnibook + Please see the module-assistant documentation for futher details. + + - Changing to the /usr/src/modules/omnibook/ directory and building as + the README file instructs using "make; make install". This will build + and install a module specific to the system you are building on and is + not under control of the packaging system. + +If your are not using module-assisatant, you have to unpack +/usr/src/omnibook-source.tar.gz to /usr/src. + + -- Peter Soos , Wed, 25 Jan 2006 21:06:28 +0100 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..d1bf915 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +omnibook (20060126-0) unstable; urgency=low + + * Locally built. + + -- Peter Soos Wed, 25 Jan 2006 21:06:28 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..f401484 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: omnibook +Section: misc +Priority: optional +Maintainer: Peter Soos +Build-Depends: debhelper (>> 4.0.0) +Standards-Version: 3.6.2 + +Package: omnibook-source +Architecture: all +Depends: make, module-assistant +Recommends: kernel-package +Description: Source for the omnibook driver + This package provides the source code for the omnibook kernel module. + Kernel source is required to compile this module. diff --git a/debian/control.module.in b/debian/control.module.in new file mode 100644 index 0000000..0a67bbd --- /dev/null +++ b/debian/control.module.in @@ -0,0 +1,21 @@ +Source: omnibook +Section: misc +Priority: optional +Maintainer: Peter Soos +Build-Depends: debhelper (>> 4.0.0) +Standards-Version: 3.6.2 + +Package: omnibook-module-_KVERS_ +Architecture: i386 +Provides: omnibook-module +Description: omnibook module for Linux (kernel _KVERS_) + This package contains the loadable kernel modules for the HP OmniBooks, + Pavilions, Toshiba Satellites and some other laptops manufactured by + Compal Electronics, Inc as ODM. + . + This package contains the compiled kernel modules for _KVERS_ + . + If you have compiled your own kernel, you will most likely need to build + your own omnibook-module. The omnibook-source package has been + provided for use with the Debian kernel-package utility to produce a version + of omnibook-module for your kernel. diff --git a/debian/control.modules.in b/debian/control.modules.in new file mode 100644 index 0000000..0a67bbd --- /dev/null +++ b/debian/control.modules.in @@ -0,0 +1,21 @@ +Source: omnibook +Section: misc +Priority: optional +Maintainer: Peter Soos +Build-Depends: debhelper (>> 4.0.0) +Standards-Version: 3.6.2 + +Package: omnibook-module-_KVERS_ +Architecture: i386 +Provides: omnibook-module +Description: omnibook module for Linux (kernel _KVERS_) + This package contains the loadable kernel modules for the HP OmniBooks, + Pavilions, Toshiba Satellites and some other laptops manufactured by + Compal Electronics, Inc as ODM. + . + This package contains the compiled kernel modules for _KVERS_ + . + If you have compiled your own kernel, you will most likely need to build + your own omnibook-module. The omnibook-source package has been + provided for use with the Debian kernel-package utility to produce a version + of omnibook-module for your kernel. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..8fd52c2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,27 @@ +This package was debianized by Peter Soos on +Wed, 25 Jan 2006 21:06:28 +0100. + +It was downloaded from http://www.sourceforge.net/projects/omke + +Copyright Holder: Peter Soos + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + 02110-1301, USA. + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..17b8303 --- /dev/null +++ b/debian/docs @@ -0,0 +1,8 @@ +doc/BUGS +doc/ChangeLog +doc/CREDITS +doc/README-1st +doc/README +doc/README-OneTouch +doc/TODO +misc/hotkeys diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..0ca39a5 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +omnibook-source_20060126-0_all.deb misc optional diff --git a/debian/postinst.module.in b/debian/postinst.module.in new file mode 100644 index 0000000..83345e5 --- /dev/null +++ b/debian/postinst.module.in @@ -0,0 +1,46 @@ +#! /bin/sh +# postinst script for omnibook-module-* +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +case "$1" in + configure) + + if [ "`uname -r`" = "_KVERS_" ] ; then + depmod -a > /dev/null 2>&1 || true + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postinst.modules.in b/debian/postinst.modules.in new file mode 100644 index 0000000..83345e5 --- /dev/null +++ b/debian/postinst.modules.in @@ -0,0 +1,46 @@ +#! /bin/sh +# postinst script for omnibook-module-* +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# + +case "$1" in + configure) + + if [ "`uname -r`" = "_KVERS_" ] ; then + depmod -a > /dev/null 2>&1 || true + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postrm.module.in b/debian/postrm.module.in new file mode 100644 index 0000000..dca24e8 --- /dev/null +++ b/debian/postrm.module.in @@ -0,0 +1,45 @@ +#! /bin/sh +# postrm script for omnibook-module-* +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|disappear) + + if [ "`uname -r`" = "_KVERS_" ] ; then + depmod -a > /dev/null 2>&1 || true + fi + + ;; + + purge|upgrade|failed-upgrade|abort-install|abort-upgrade) + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm.modules.in b/debian/postrm.modules.in new file mode 100644 index 0000000..dca24e8 --- /dev/null +++ b/debian/postrm.modules.in @@ -0,0 +1,45 @@ +#! /bin/sh +# postrm script for omnibook-module-* +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|disappear) + + if [ "`uname -r`" = "_KVERS_" ] ; then + depmod -a > /dev/null 2>&1 || true + fi + + ;; + + purge|upgrade|failed-upgrade|abort-install|abort-upgrade) + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..55f9bd1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,179 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. +# +# This version is for a hypothetical package that can build a kernel modules +# architecture-dependant package via make-kpkg, as well as an +# architecture-independent module source package, and other packages +# either dep/indep for things like common files or userspace components +# needed for the kernel modules. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +# some default definitions, important! +# +# Name of the source package +psource := omnibook-source + +# The short upstream name, used for the module source directory +sname := omnibook + +### KERNEL SETUP +### Setup the stuff needed for making kernel module packages +### taken from /usr/share/kernel-package/sample.module.rules + +# prefix of the target package name +PACKAGE=omnibook-module +# modifieable for experiments or debugging m-a +MA_DIR ?= /usr/share/modass +# load generic variable handling +-include $(MA_DIR)/include/generic.make +# load default rules, including kdist, kdist_image, ... +-include $(MA_DIR)/include/common-rules.make + +# module assistant calculates all needed things for us and sets +# following variables: +# KSRC (kernel source directory), KVERS (kernel version string), KDREV +# (revision of the Debian kernel-image package), CC (the correct +# compiler), VERSION (the final package version string), PKGNAME (full +# package name with KVERS included), DEB_DESTDIR (path to store DEBs) + +# The kdist_configure target is called by make-kpkg modules_config and +# by kdist* rules by dependency. It should configure the module so it is +# ready for compilation (mostly useful for calling configure). +# prep-deb-files from module-assistant creates the neccessary debian/ files +kdist_config: prep-deb-files + +# the kdist_clean target is called by make-kpkg modules_clean and from +# kdist* rules. It is responsible for cleaning up any changes that have +# been made by the other kdist_commands (except for the .deb files created) +kdist_clean: + -$(MAKE) KSRC=$(KSRC) clean + dh_clean +# +### end KERNEL SETUP + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + + +build-arch: configure-stamp build-arch-stamp +build-arch-stamp: + dh_testdir + touch build-arch-stamp + +#k = $(shell echo $(KVERS) | grep -q ^2.6 && echo k) + +# the binary-modules rule is invoked by module-assistant while processing the +# kdist* targets. It is called by module-assistant or make-kpkg and *not* +# during a normal build +binary-modules: prep-deb-files + dh_testroot + dh_clean -k + dh_installdirs lib/modules/$(KVERS)/drivers/misc/omnibook + + # Build the module + #$(MAKE) -C drivers KERNEL_DIR=$(KSRC) KVERS=$(KVERS) + $(MAKE) KSRC=$(KSRC) KVERS=$(KVERS) + + # Install the module + $(MAKE) install KSRC=$(KSRC) DESTDIR=$(CURDIR)/debian/$(PKGNAME) DEPMOD="" + + dh_installdocs + dh_installchangelogs + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol -- -v$(VERSION) + dh_md5sums + dh_builddeb --destdir=$(DEB_DESTDIR) + dh_clean -k + +build-indep: configure-stamp build-indep-stamp +build-indep-stamp: + dh_testdir + + touch build-indep-stamp + +build: build-arch build-indep + +clean: + dh_testdir + #dh_testroot + rm -f build-arch-stamp build-indep-stamp configure-stamp + + dh_clean + +install: DH_OPTIONS= +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Create the directories to install the source into + dh_installdirs -p$(psource) usr/src/modules/$(sname)/debian + + cp debian/compat debian/rules debian/changelog \ + debian/copyright debian/control \ + debian/$(psource)/usr/src/modules/$(sname)/debian + cp debian/*.modules.in debian/$(psource)/usr/src/modules/$(sname)/debian + + cp Makefile *.c *.h debian/$(psource)/usr/src/modules/$(sname)/ + + cd debian/$(psource)/usr/src && tar c modules | gzip -9 > $(sname).tar.gz && rm -rf modules + + dh_install + +# Build architecture-independent files here. +# Pass -i to all debhelper commands in this target to reduce clutter. +binary-indep: build install + dh_testdir -i + dh_testroot -i + dh_installchangelogs -i + dh_installdocs -i + dh_installexamples -i +# dh_install -i +# dh_installmenu -i +# dh_installdebconf -i +# dh_installlogrotate -i +# dh_installemacsen -i +# dh_installpam -i +# dh_installmime -i +# dh_installinit -i +# dh_installcron -i +# dh_installinfo -i + dh_installman -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i +# dh_perl -i +# dh_python -i +# dh_makeshlibs -i + dh_installdeb -i + dh_shlibdeps -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure binary-modules kdist kdist_config kdist_image kdist_clean diff --git a/debian/rules.old b/debian/rules.old new file mode 100755 index 0000000..4f3d2ad --- /dev/null +++ b/debian/rules.old @@ -0,0 +1,321 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. +# +# This version is for a hypothetical package that can build a kernel modules +# architecture-dependant package via make-kpkg, as well as an +# architecture-independent module source package, and other packages +# either dep/indep for things like common files or userspace components +# needed for the kernel modules. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +### KERNEL SETUP +### Setup the stuff needed for making kernel module packages +### taken from /usr/share/kernel-package/sample.module.rules + +# Name of package +package = omnibook +# KSRC is the location of the kernel source. This is the default value, +# when make-kpkg is used it will supply to real value +KSRC = /usr/src/linux +# KDREV is the package-revision, as given to make-kpkg by the user. +# Just put a simply default value in here which we use when we test +# the packagebuilding without make-kpkg +ifeq ($(strip $(KDREV)),) +KDREV = "test1.0" +endif + +## Now to determine the kernel version, normally supplied by make-kpkg +ifeq ($(strip $(KVERS)),) +# Now we need to get the kernel-version somehow (we are not running +# under make-kpkg?) +ifeq ($(strip $(KSRC)),) +$(error Error. I do not know how to determine the kernel version) +else +kversion :=$(shell grep -E '^VERSION +=' $(KSRC)/Makefile 2>/dev/null | \ + sed -e 's/[^0-9]*\([0-9]*\)/\1/') +kplevel :=$(shell grep -E '^PATCHLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \ + sed -e 's/[^0-9]*\([0-9]*\)/\1/') +ksublevel:=$(shell grep -E '^SUBLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \ + sed -e 's/[^0-9]*\([0-9]*\)/\1/') +EXTRA_VERSION:=$(shell grep -E '^EXTRAVERSION +=' $(KSRC)/Makefile 2>/dev/null | \ + sed -e 's/EXTRAVERSION[\t ]*=[\t ]*\(.*\)/\1/') +kextra:=$(strip $(EXTRA_VERSION)) +HAVE_NEW_MODLIB:=$(shell grep -E '\(INSTALL_MOD_PATH\)' \ + $(KSRC)/Makefile 2>/dev/null ) + +# If you want to have more than one kernel configuration per kernel +# version, set FLAVOUR in the top level kernel Makefile *before* +# invoking make-kpkg -- it will be appended to UTS_RELEASE in +# version.h (separated by a hyphen). This affects everything -- the +# names and versions of the image, source, headers, and doc packages, +# and where the modules are searched for in /lib/modules. + +ifdef FLAVOUR +# uhm - should check if we really have a Makefile capable of Flavours? +endif + +FLAVOUR:=$(shell grep ^FLAVOUR $(KSRC)/Makefile 2>/dev/null | \ + perl -ple 's/FLAVOUR[\s:=]+//g') + +ifneq ($(strip $(FLAVOUR)),) +INT_FLAV := -$(FLAVOUR) +FLAV_ARG := FLAVOUR=$(FLAVOUR) +else +INT_FLAV := +FLAV_ARG := +endif + +## This is the replacement for FLAVOUR +ifneq ($(strip $(APPEND_TO_VERSION)),) +iatv := $(strip $(APPEND_TO_VERSION)) +EXTRAV_ARG := EXTRAVERSION=${EXTRA_VERSION}${iatv} +else +iatv := +EXTRAV_ARG := +endif + +KVERS = $(kversion).$(kplevel).$(ksublevel)$(kextra)$(iatv)$(INT_FLAV) + +endif +endif + +non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://') +epoch=$(shell echo $(KVERS) | perl -ne 'm/^(\d+:)/ && print $$1') + +# We also need the package version +pversion = $(shell sed -ne '1s/.*\((.*)\).*/\1/' debian/changelog) +pversion = $(shell sed -ne '1s/.*(\(.*\)).*/\1/p' debian/changelog) + +# MODDIR is the place where the final .deb package should be made. This is the +# default value, when make-kpkg is used it will supply to real value +MODDIR = .. + +pmodules = $(package)-module-$(non_epoch_version) +psource = $(package)-source + +# Prepares the package for distribution. Intended for the kernel +# maintainer. +kdist: kdist_clean kdist_config kdist_image + +# The kdist_configure target is called by make-kpkg modules_config. It +# should configure the module so it is ready for compilation (mostly +# useful for calling configure) +kdist_config: + @echo Nothing to configure + +# the kdist_image target is called by make-kpkg modules_image. It is +# responsible for compiling the module and creating the package. It +# should also clean up after making the module. Please note we use a +# seperate binary-modules target to make testing the package building +# easier +kdist_image: + $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-modules + $(MAKE) $(MFLAGS) -f debian/rules clean + +# the kdist_clean target is called by make-kpkg modules_clean. It is +# responsible for cleaning up any changes that have been made by the +# other kdist_commands (except for the .deb files created). +kdist_clean: + $(MAKE) $(MFLAGS) -f debian/rules clean + +### end KERNEL SETUP + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build-arch: configure-stamp build-arch-stamp +build-arch-stamp: + dh_testdir + + # Add here command to compile/build the package. + #$(MAKE) + + touch build-arch-stamp + +# the binary-modules target prepares the $(pmodules) package. +# It is called by make-kpkg and *not* during a normal build +binary-modules: + export DH_OPTIONS='-p$(pmodules)' + + # Is this needed for setting up a Depends? + #echo "kpkg:Package-Version=$(epoch)$(pversion)+$(non_epoch_version)" \ + # >> debian/$(package).substvars + echo "kpkg:Kernel-Version=$(non_epoch_version)" > \ + debian/$(pmodules).substvars + + # The substvars mechanism seems slightly broken, hack to get around it + # stolen from the qce-ga package. Yaaaa! + sed -e 's/$${kpkg\:Kernel\-Version}/$(non_epoch_version)/' \ + debian/control.modules.in > debian/control + + dh_testdir + dh_testroot + dh_clean -k + + dh_installdirs lib/modules/$(KVERS)/drivers/char/omnibook + + # Build the module + $(MAKE) + + # Install the module + $(MAKE) DESTDIR=$(CURDIR)/debian/$(pmodules) DEPMOD="" install + + dh_installdebconf + # FIXME dh_installdocs README + dh_installchangelogs + + # We're not using this yet + #dh_installmodules + + dh_compress + dh_fixperms + dh_installdeb + #dh_gencontrol -- -v$(epoch)$(pversion)+$(non_epoch_version)+$(KDREV) + dh_gencontrol -- -v$(epoch)$(pversion) + dh_md5sums + dh_builddeb --destdir=$(KSRC)/.. + + +build-indep: configure-stamp build-indep-stamp +build-indep-stamp: + dh_testdir + + # Add here command to compile/build the arch indep package. + # It's ok not to do anything here, if you don't need to build + # anything for this package. + #docbook-to-man debian/omnibook.sgml > omnibook.1 + + touch build-indep-stamp + +build: build-arch build-indep + +clean: + dh_testdir + #dh_testroot + rm -f build-arch-stamp build-indep-stamp configure-stamp + + # Add here commands to clean up after the build process. + -$(MAKE) clean + + dh_clean + +install: DH_OPTIONS= +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Create the directories to install the source into + dh_installdirs -p$(psource) usr/src/modules/$(package) + dh_installdirs -p$(psource) usr/src/modules/$(package)/debian + + # Copy only the driver source to the proper location + cp Makefile *.c *.h debian/$(psource)/usr/src/modules/$(package) + # Copy the needed debian/ pieces to the proper location + cp debian/postinst.modules.in \ + debian/$(psource)/usr/src/modules/$(package)/debian/postinst + cp debian/postrm.modules.in \ + debian/$(psource)/usr/src/modules/$(package)/debian/postrm + cp debian/control.modules.in \ + debian/$(psource)/usr/src/modules/$(package)/debian/control + cp debian/control.modules.in \ + debian/$(psource)/usr/src/modules/$(package)/debian/control.modules.in + cp debian/rules \ + debian/$(psource)/usr/src/modules/$(package)/debian + cp debian/changelog \ + debian/$(psource)/usr/src/modules/$(package)/debian + cp debian/copyright \ + debian/$(psource)/usr/src/modules/$(package)/debian + (cd debian/$(psource)/usr/src/; tar cvfz $(package).tar.gz modules) + rm -rf debian/$(psource)/usr/src/modules + + dh_install + +# Build architecture-independent files here. +# Pass -i to all debhelper commands in this target to reduce clutter. +binary-indep: build install + dh_testdir -i + dh_testroot -i + dh_installchangelogs -i + dh_installdocs -i + dh_installexamples -i +# dh_install -i +# dh_installmenu -i +# dh_installdebconf -i +# dh_installlogrotate -i +# dh_installemacsen -i +# dh_installpam -i +# dh_installmime -i +# dh_installinit -i +# dh_installcron -i +# dh_installinfo -i + dh_installman -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i +# dh_perl -i +# dh_python -i +# dh_makeshlibs -i + dh_installdeb -i + dh_shlibdeps -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir -s + dh_testroot -s +# dh_installdebconf -s + dh_installdocs -s + dh_installexamples -s + dh_installmenu -s +# dh_installlogrotate -s +# dh_installemacsen -s +# dh_installpam -s +# dh_installmime -s +# dh_installinit -s + dh_installcron -s +# dh_installman -s + dh_installinfo -s + dh_installchangelogs -s + dh_strip -s + dh_link -s + dh_compress -s + dh_fixperms -s +# dh_makeshlibs -s + dh_installdeb -s +# dh_perl -s + dh_shlibdeps -s + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s + +#binary: binary-indep binary-arch +binary: binary-indep +.PHONY: build clean binary-indep binary-arch binary install configure binary-modules kdist kdist_config kdist_image kdist_clean diff --git a/display.c b/display.c new file mode 100644 index 0000000..652c78d --- /dev/null +++ b/display.c @@ -0,0 +1,102 @@ +/* + * display.c -- external display related functions + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +static int omnibook_get_display(void) +{ + int retval = 0; + u8 sta; + + /* + * XE3GF + * TSP10 + * TSM30X + * TSM40 + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X|TSM40) ) { + if ((retval = omnibook_ec_read(XE3GF_STA1, &sta))) + return retval; + retval = (sta & XE3GF_SHDD_MASK) ? 1 : 0; + /* + * XE3GC + */ + } else if (omnibook_ectype & XE3GC ) { + if ((retval = omnibook_ec_read(XE3GC_STA1, &sta))) + return retval; + retval = (sta & XE3GC_CRTI_MASK) ? 1 : 0; + /* + * OB500 + * OB510 + * OB6000 + * OB6100 + * XE4500 + */ + } else if (omnibook_ectype & (OB500|OB510|OB6000|OB6100|XE4500) ) { + if ((retval = omnibook_ec_read(OB500_STA1, &sta))) + return retval; + retval = (sta & OB500_CRTS_MASK) ? 1 : 0; + /* + * OB4150 + */ + } else if (omnibook_ectype & OB4150 ) { + if ((retval = omnibook_ec_read(OB4150_STA2, &sta))) + return retval; + retval = (sta & OB4150_CRST_MASK) ? 1 : 0; + /* + * UNKNOWN + */ + } else { + printk(KERN_INFO + "%s: External display status monitoring is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + return retval; +} + +static int omnibook_display_read(char *buffer) +{ + int len = 0; + int display; + + display = omnibook_get_display(); + if (display < 0) + return display; + + len += + sprintf(buffer + len, "External display is %s\n", + (display) ? "present" : "not present"); + + return len; +} + +struct omnibook_feature display_feature = { + .name = "display", + .enabled = 1, + .read = omnibook_display_read, + .ectypes = XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE4500|OB4150|TSP10|TSM30X|TSM40, +}; + +module_param_named(display, display_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(display, "Use 0 to disable, 1 to enable display status handling"); +/* End of file */ diff --git a/doc/BUGS b/doc/BUGS new file mode 100644 index 0000000..32883b4 --- /dev/null +++ b/doc/BUGS @@ -0,0 +1,40 @@ +Bugs and problems in omnibook module code +========================================= + +* You can use /proc/apm emulation for battery status monitoring only. +* Volume Control buttons do not generate scancodes on XE3GC style models. + Scancode emulation needs intensive testing to be reliable. +* Volume Control buttons on machine (not on docking station) do not generate + scancodes on OB500 style models. It is unhandled yet. +* Sometimes (I assume when the embedded controller is busy) the procfs + interface displays fake values. +* Setting the LCD brightness on HP OmniBook XE3 GF via /proc/omnibook/lcd + is working if you press one of the brightness control keys once after + writing the value into /proc/omnibook/lcd. +* After reenable the touchpad via /proc/omnibook/touchpad you may restart + X / gpm. +* I'm not a native English speaker so text corrections are welcome. + +Problems with OmniBook machines running Linux +============================================= + +* If you use APM there are a lot of mysterious hangs at suspend/resume on + the new models. The OmniBooks use ACPI not APM but ACPI for Linux does not + provide reliable power management functions yet. Use swsusp instead. +* In some cases the touchpad in XE3 GF models can freeze the laptop after + disabling and reenabling it with the disable button and doing a tap + action when neither gpm nor X is running. It seems to be a BIOS or + firmware bug. + Please report if you can reproduce it. +* On XE3 GC models Fn-s key combination try to suspend to ram which freezes + the machine completely. +* The ESS winmodem in XE3 (and other) machines is not working with Linux. + There are binary only drivers but those have a lot of problems (eg. lock + up the machine at disconnect etc.) + The divers can be downloaded from the URLs below: + HP OmniBook XE3 GF: + http://andrew.cait.org/ess/ES2839_4Linux2_4_18-2mdk.zip + HP OmniBook XE3 GC: + http://luftstrom.bastun.net/ess-modem-1989.tar.gz +* The 3Com winmodem in OmniBook 5xx (and other) laptops is unsupported by + Linux. diff --git a/doc/COPYING b/doc/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/doc/CREDITS b/doc/CREDITS new file mode 100644 index 0000000..6ebe8ad --- /dev/null +++ b/doc/CREDITS @@ -0,0 +1,39 @@ +The module is written by + +* Soós Péter + +Special thanks to the following persons and/or organisations (without +particular order): + +* Al Stone and Linux Systems Operation at HP for lending + an HP OmniBook 500 for the project purposes. +* Pavel Mihaylov for his omke project discovering a lot of + OmniBook features, providing some code for XE3 GC machines and testing. +* Ducrot Bruno sharing lots of information about + embedded controller and related code, added lots of Toshiba support, + writing tosh3k code, sending patches etc. + +Thanks to the following people (without particular order): + +* Al Stone for sharing some programming information. +* Guido Guenther for initial OneTouch enabling code. +* Jens Thoms Toerring for initial + OneTouch power management code. +* Maciek Gorniak for initial HP Pavilion N5415 detecting + code and initial lcd brighness code. +* Rick Richardson for some bugfixes and useful patches. +* Bob McElrath for initial Compal ACL00 + code. +* Luisimi Moya for Acer Aspire 1400 support. +* Bernhard Kaindl for bugfixes and patches +* Gabriele Vivinetto for documentation + enhancements and testing. +* Mark Chappell for building on kernel 2.6. +* Massimo Dal Zotto for his i8k code. +* Jonathan A. Buzzard for his toshiba code. +* Some others on OmniBook mailing list at + http://zurich.ai.mit.edu/mailman/listinfo/omnibook + for providing information and testing. + +Last but not least thanks to Linus Torvald and more for creating and +maintaining the Linux kernel. diff --git a/doc/ChangeLog b/doc/ChangeLog new file mode 100644 index 0000000..8d82b55 --- /dev/null +++ b/doc/ChangeLog @@ -0,0 +1,361 @@ +Changelog file for omnibook package: +------------------------------------ + +2006-XX-XX Mathieu Bérard +* Make the module linux 2.6 only +* Integrate with Driver Model: register as a platform device and optional + registration as a backlight device +* Get rid of deprecated pm_legacy functions +* Use kernel-provided DMI information +* MODULE_PARAM -> 2.6-style module_parm_* +* Move some code from "feature".c files back to init.c + Interface is provided by the new omnibook_feature struct + Enabled features are now in placed in a linked list + This eliminate util.c + Rationale: Reduce code duplication and create a standard template for features +* Move dmi and version display into their own file: info.c +* Remove all unneeded EXPORT_SYMBOL +* Misc fixes in Makefile +* Use sscanf and simple_stro{u}l for strings parsing instead of custom code +* Run lindent for better conformance with kernel coding style +* Add very limited support for Toshiba M40 +* Use bitmasks for EC types matching, this change is transparent for the user + (e.g. one can still use ectype=num module parameter) + Rationale: Reduce the size of the omnibook_feature struct +* Polish Debian support: Recommend module-assistant and fix all Lintian warning +* Update documentation and omnibook-integration.patch +* Fix spinlock usage: they can be used unconditionally as they are automatically + optimized out at build-time on UP. This should improve PREEMPT safety +* Spinlock protect omnibook_mem_* and use ioread8 and iowrite8 +* Fix: Custom EC access function are also used if ACPI is compiled but disabled +* Cleanup: remove lots of unneeded #ifdef +* Add two features for developers: dump and watch + Dump was stolen from the ibm_acpi driver + Watch is just an hack I made because using "obtest" to poll the registers of + my embedded controlled _badly_ confuse the kernel ACPI EC driver due to races + conditions + They are both disabled by default + +2006-01-26 Soós Péter +* Added support for kernels >= 2.6.15 (pm_legacy.h) +* Added Toshiba Satellite M30X +* Added support for Toshiba Satellite M70 +* Added support for HP Pavilion ze4300 series +* Fixed module unloading on 2.6 series kernels (thanks to + math_b@users.sourceforge.net) +* Changed version number to +%Y%m%d format +* Added Debian support + +2005-02-17 Soós Péter +* Fixed Makefile +* Updated Toshiba 1115 information + +2004-12-15 Scott Barnes +* Added Toshiba Satellite M35X + +2004-09-16 Soós Péter +* Added INSTALL-2.6 file +* Little spelling fixes in documentation +* Little bugfixes +* Added Compal ACL10 + +2004-07-01 Soós Péter +* Added new technology codes +* Added some new HP nx9000 detection string +* Added Toshiba Satellite P20 + +2004-06-07 Chris Green +* Added Toshiba Satellite P15 + +2004-06-01 Soós Péter +* Added Toshiba Satellite 1955 +* Added Toshiba Satellite 2435 +* Added Toshiba Satellite P10 (new ectype) +* Acer Aspire 1350 + +2004-01-23 Soós Péter +* Added HP Pavilion ze8500 (HP nx9010) +* fixed PM handler for OneTouch keys and touchpad + +2004-01-20 Soós Péter +* Only fan status supported on HP OmniBook 4150, XE2 and + Fujitsu-Siemens Amilo D, fan control is unsupported +* #include fixes in ec.c + +2004-01-16 Soós Péter +* Added fan support for Fujitsu-Siemens Amilo D series laptops + +2004-01-14 Soós Péter +* Fixed Makefile for kernels 2.6 +* Added Fujitsu-Siemens Amilo D series laptops (new ectype) + +2003-12-08 Soós Péter + +* Fixed tecnology code detection +* Added HP/Compaq nx9005 +* Fixed Makefile for kernel 2.4 + +2003-11-12 Soós Péter + +* Fixed KERNEL_WARNING in init.c + +2003-11-10 Soós Péter + +* Fixed timeout bugs in ec.c +* Fixed touchpad dependency code for kernel 2.6 +* Added Compaq nx9000 + +2003-11-10 Mark Chappell + +* Added kernel 2.6 support to Makefile + +2003-10-23 Soós Péter + +* Totally removed key polling code for kernels >= 2.5.0 but 2.5/2.6 kernels + is unsuported yet +* proc_battery is static +* Added HP OmniBook 900 B support +* Added HP OmniBook XE2 support (added new ectype value for it) +* Added Compaq nx9010 +* Reversed ChangeLog +* Some documentation changes + +2003-08-28 Soós Péter + +* Added Toshiba Satellite 2430 +* Documentation enhancements + +2003-04-03 Soós Péter + +* Really fixed __init bug in user parameter code +* Fixed omnibook_dmi_ident (it was static) + +2003-03-31 Soós Péter + +* Fixed HP technology code detection +* Key polling is disabled by default on XE3GC style machines +* Fixed PM code in polling.c +* Added util.c +* Fixed __init bug in user parameter code +* Cleaned up ec.h +* Added Toshiba Satellite 1950 detection +* Documentation enhancements + +2003-03-13 Soós Péter + +* Added HP Pavilion ZU1155 and ZU1175 detection + +2003-03-11 Soós Péter + +* Fixed bogus version information + +2003-03-06 Ducrot Bruno + +* Fan off hack for XE3GF style machines + +2003-03-04 Ducrot Bruno + +* Fixed spinlock problem + +2003-02-28 Soós Péter + +* Added /proc/omnibook/version +* Added OMNIBOOK_ prefix to MODULE_NAME and MODULE_VERSION definitions +* Fixed bugs in lcd.c (thanks to Bernhard Kaindl ) +* Some code tuning and cosmetic changes +* Fixed OmniBook 4150 support + +2003-02-26 Soós Péter + +* Fixed kernel Oops in technology code identification +* Some minor changes in logging + +2003-02-25 Soós Péter + +* Try to identify HP laptops by technology code if machine is unsupported +* Fixed dmi identification code + +2003-02-14 Soós Péter + +* Added HP Pavilion ze4100 support +* Added HP Pavilion ze4200 support +* Fixed HP Pavilion xt155 detection +* Added Acer Aspire 1400 series laptop support +* Fixed APM status detection bug +* Cleaned up dmi identification code +* Removed "Asset Tag:" field from dmi string structure + +2003-01-27 Soós Péter + +* Added HP Pavilion N5430 support +* EC functions are work even if boot parameter acpi=off is given +* Improved error handling in externally callable functions +* Fixed kernel integration patch +* Removed unreliable undocking feature for OB500 +* Fixed HP Pavilion N5415 support +* Added new format hotkeys sample files + +2003-01-09 Ducrot Bruno + +* Added to use ACPI_EC if available + +2003-01-09 Soós Péter + +* Fixed reverse console blanking bug on OB5xx and OB6xxx +* Disabled unreliable undocking feature on OB500 + +2003-01-08 Ducrot Bruno + +* Added Toshiba Satellite 3000, 3005, 1000, 1005, 1110, 1115, 1900, 1905 + support + +2003-01-08 Soós Péter + +* The ectype values changed again! See the README! +* Fixed new ectypes detection bug +* Added OmniBook xe4400 support +* Added LCD display turn off at console blanking on OB5xx and OB6xxx +* Documentation fixes + +2003-01-07 Soós Péter + +* Fixed bit level negation bug in fan.c +* Added turn fan on for Toshiba 3000 +* Corrected OmniBook 4150 support code + +2003-01-06 Soós Péter + +* Changed ectype values! See the README! +* Fixed some bugs in obtest utility +* Fixed second battery status bug in battery.c +* Added textual descriptions to some functions in /proc/omnibook +* Fix APM emulation to work when APM support is present but APM power + status reporting flagged broken +* Added docking station support +* Added fan support +* Added module parameter: user +* Added OmniBook xe155, xe4100 and ze4125 support +* Fan policy moved to /proc/omnibook/fan_policy +* Reorganized scancode emulation code for XE3 GC +* Polling of volume buttons on XE3CG style models can be enabled/disabled + via /proc/omnibook/key_polling +* Finished abstraction layer +* Some minor changes in Rick's model detection code +* New kernel integration code + +2002-12-22 Rick Richardson + +* Added on and off as valid input to /proc/omnibook/lcd, to turn + the LCD backlight on and off. + +2002-12-15 Rick Richardson + +* Reimplemented model detection so you only have to modify one file + to add a new model. features.h is now deprecated. +* Added the Toshiba Satellite 1115/S103 to the supported models +* Fixed bug in apmemu.c which caused /proc/apm to report the battery + status as critical when the battery was charging. + +2002-10-16 Soós Péter + +* Added HP Pavilion N5415 support +* Corrected HP Pavilion N5441 support +* Fix values of OB500 type machines in ec.h +* LCD brightness support added for XE3GC and XE3GF style machines +* Added HP OmniBook 510 FB support +* AC adapter status monitoring is working on all machines +* External display status monitoring is working on all machines +* CPU temperature monitoring is working on all machines +* __init functions gone to init.h +* Added an abstraction layer between the low level, hardware dependent + functions and the applications (not yet finished). See omnibook.h for + details. + +2002-09-20 Soós Péter + +* Using save_flags()/cli() instead spinlocks in ec.c because of laptops do + not have more than one CPU (yet ;)). This improves performance and + eliminates packet loss in ppp stack +* The previous version of XE3 GC scancode emulation was buggy: it worked only + when ACPI enabled. Current version is working ACPI independent way + +2002-09-05 Soós Péter + +* Added secondary battery support (untested, please report!) +* Added ectype module parameter to specify the type of embedded + controller firmware +* Added some OmniBook XE3 GC support code +* Added some OmniBook 500 style embedded controller firmware support code + (OmniBook 5xx, 6xxx and some Pavilions) +* Reorganized features matrix (again): the features depends on the embedded + controller firmware, not the model +* Added external display status monitoring on some machine +* Added scancode emulation on OmniBook XE3 GC + +2002-08-14 Soós Péter + +* Added HP OmniBook 6000 EA support (OneTouch only) +* Added HP OmniBook 6100 EB support (OneTouch only) +* Fixed Toshiba Satellite 3000-100 detection +* Fixed timeout and locking bugs in ec.c +* Added HP Pavilion Notebook ZT1141 +* Reorganized the feature matrix and parameter detection code to make easy + to add new features differents machine by machine + +2002-08-11 Soós Péter + +* Fixed removing of procfs entries +* Fixed APM detection +* Added kernel source integration +* Fixed __initdata bugs +* Handling difference between untesed and unsupported features + +2002-08-09 Soós Péter + +* Added Compal ACL00 laptop support +* Updated documentation +* Added touchpad support +* Some bugfixes +* /proc/apm emulation added + +2002-08-06 Soós Péter + +* Corrected full charged battery info +* Added OneTouch handling via procfs +* Added console blank handling via procfs +* Added temperature policy handling via procfs +* Corrected the bug in DMI code to report the serial number +* Added module parameter support +* Added HP Pavilion Notebook N5490, ZT1195 (and probably other Pavilions) + +2002-07-17 Soós Péter + +* Improved error handling +* Some text corrections +* Added Toshiba Satellite 3000-100 support +* Some code tuning +* Added omnibook prefix for variables and functions to prevent conflicts + with another code +* Added /proc filesystem support +* Added battery status monitoring +* Added CPU temperature monitoring + +2002-06-03 Soós Péter + +* Some code tuning + +2002-05-07 Soós Péter + +* Added missing #include to main.c +* Some text corrections +* Added HP OmniBook 500 FA support (OneTouch only) + +2002-05-06 Soós Péter + +* LCD display turn off at console blanking added +* Code cleanup + +2002-05-02 Soós Péter + +* The first release of omnibook module +* OneTouch button support diff --git a/doc/INSTALL b/doc/INSTALL new file mode 100644 index 0000000..9dba719 --- /dev/null +++ b/doc/INSTALL @@ -0,0 +1,52 @@ +Installation instructions for omnibook module on kernel series 2.6 +================================================================== + + This file explains how to install omnibook module from its sources on 2.6 + series kernels. + +Step 1 + + You must have full configured source for the Linux kernel which you + want to use for the omnibook module. Note that omnibook module is part + of the kernel, so there is necessary to resolve all symbol dependencies + between the used kernel and omnibook code. Partly installed kernels + (for example from distributor makers) can be unuseable for this action. + + You need same C compiler to kernel was compiled with (eg. gcc3 for gcc3 + compiled kernels) and GNU make. + +Step 2 + + Run `make install' as the super-user. This will install omnibook.ko kernel + module into modules directory of your currently running kernel + (usually in /lib/modules/version_of_your_kernel) and runs `depmod -a' to + rebuild module dependency database. + You may install and load the module with `make load' command. In this case + you may skip Step 3. + +Step 3 + + Load the installed module with `modprobe omnibook' command. It will + enables the OmniBook features on your machine. + To unload module issue an `modprobe -r omnibook' command. It will disable + the OmniBook features and unload the module. + +Step 4 (optional) + + Add necessary module options to your /etc/modprobe.conf or in a file + in /etc/modporbe.d/. E.g.: "options omnibook apmemu=1 dock=1 user=1" + +Step 5 (optional) + + Edit your startup scripts (eg. /etc/rc.local, /etc/rc.modules or /etc/modules) + to load this module at boot time. + +How to integrate omnibook module to kernel sources? +--------------------------------------------------- + + Run in the directory where you previously extracted the omnibook module sources: + + `make kpatch KSRC="/patch/to/kernel/source"' + + Configure and compile your kernel as usual. If you use `make menuconfig', the + omnibook module config options are in 'Processor type and feature'. diff --git a/doc/README b/doc/README new file mode 100644 index 0000000..6770ea8 --- /dev/null +++ b/doc/README @@ -0,0 +1,528 @@ +Kernel Support for HP OmniBooks, Pavilions, Toshiba Satellites, + and some Acer Aspire and Compal laptops +=============================================================== + + +This package intended to provide Linux kernel support for HP OmniBook +and Pavilion machines. The state of this code is experimental but it +wants to be a framework to extend the Linux support for HP OmniBook +and Pavilion, Toshiba Satellite, Acer Aspire and Compal ACL00 laptops +manufactured by Compal Electronics, Inc as ODM. + +There is a similar project for Toshiba Satellite laptops wich supports +some HP OmniBooks too at ftp://ftp.poupinou.org/tosh_3000/. + +How does it work? +----------------- + Some features of HP OmniBooks can be controlled via the keyboard control + and data registers. Commands and parameters were discovered by Pavel + Mihaylov. + + Some other features available via /proc/omnibook/* provided by the + Embedded Controller or other I/O registers of your laptop. Informations + comes from DSDT ACPI table of HP OmniBook XE3 GF dissassembled by Ducrot + Bruno and others or discovered by me. + + Note: You do not have to enable APM or ACPI to use this driver. + + All supported models seems to have same keyboard and embedded controller: + National Semiconductor PC87570 Keyboard and ACPI Embedded Controller or + compatible, but with different types of firmware. + See http://www.national.com/pf/PC/PC87570.html for more info. + + It seems there is more types of firmware (only the tested models are + listed): + 1. HP OmniBook XE3 GF + HP OmniBook XT1000 + HP Pavilion ZT1141 + HP Pavilion ZT1175 + HP Pavilion ZT1195 + Toshiba Satellite 1000 + Toshiba Satellite 1005 + Toshiba Satellite 1110 + Toshiba Satellite 1115 + Toshiba Satellite 1900 + Toshiba Satellite 1905 + Toshiba Satellite 1950 + Toshiba Satellite 1955 + Toshiba Satellite 3000 + Toshiba Satellite 3005 + Compal ACL00 + Compal ACL10 + Acer Aspire 1406 LC + 2. HP OmniBook XE3 GC + HP OmniBook XE3 GD + HP OmniBook XE3 GE + HP Pavilion N5290 + HP Pavilion N5415 + HP Pavilion N5430 + HP Pavilion N5441 + HP Pavilion XH545 + 3. HP OmniBook 500 + HP Pavilion ZU1155 + HP Pavilion ZU1175 + 4. HP OmniBook 510 + 5. HP OmniBook 6000 + 6. HP OmniBook 6100 + 7. HP OmniBook xe4100 + HP OmniBook xe4400 + HP OmniBook xe4500 + HP OmniBook vt6200 + HP OmniBook xt6200 + HP Pavilion xt155 + HP Pavilion ze4125 + HP/Compaq nx9000 + HP/Compaq nx9010 + Acer Aspire 1350 + 8. HP OmniBook 4150 + HP OmniBook 900B + 9. HP OmniBook XE2 + 10. Fujitsu-Siemens Amilo D (CY23) + 11. Toshiba Satellite P10 + Toshiba Satellite P15 + Toshiba Satellite P20 + 12. Toshiba Satellite M30X + Toshiba Satellite M35X + Toshiba Satellite M70 + 13. Toshiba Satellite M40 + + If your model is not listed above you may try to load the module. If it + have same DMI identification strigs as a supported machine it may works + out of the box. Please report it. + Only the /proc/omnibook/dmi and /proc/omnibook/version are working when + you load the module on an unsupported machine. + In this case you may load the module with ectype parameter to force using + a certain EC firmware type or see how became you machine supported at the + end of this documet. + +What is working? +---------------- + 1. Enabling OneTouch buttons. See README-OneTouch for details. + You may enable or disable it via /proc/omnibook/onetouch. + There is a power management handler for reenabling the buttons at resume + if they were enabled previously. + + 2. Console (LCD display) blanking if APM does not do it (e.g. using ACPI). + It turns off the backlight of LCD display for more intensive power + saving when your console is idle. + You may enable or disable it via /proc/omnibook/blank. + + 3. Battery status monitoring via /proc/omnibook/battery. + + 4. Fan and fan policy support via /proc/omnibook/fan and + /proc/omnibook/fan_policy. + + 5. You may enable or disable touchpad via /proc/omnibook/touchpad. + There is a power management handler for redisabling the touchpad + at resume if it was disabled previously. + + 6. Emulate /proc/apm battery status monitoring. On my HP OmniBook XE3 GF the + APM subsystem unable to monitor the battery but there are many status + monitoring application using /proc/apm to get info. So I disable APM and + use this module and I'm happy :). + Note: this is working only if you have AC adapter and battery status + monitoring enabled (see ac and battery module parameters). + + 7. AC Adapter status monitoring via /proc/omnibook/ac. + + 8. Display status monitoring /proc/omnibook/display. + + 9. LCD brightness setting and monitoring. + +10. Docking station/port replicator support. + +How to use? +----------- + 1. The OneTouch buttons are enabled by default by this module. + To disable it use the command: + + echo 0 > /proc/omnibook/onetouch + + The command + + echo 1 > /proc/omnibook/onetouch + + enables OneTouch buttons. + + 2. Console (LCD display) blanking is enabled by this module on machines that + support it. It only enabled if another blanking solution + (e.g. CONFIG_APM_DISPLAY_BLANK) is not used. + To disable this behavior use command: + + echo 0 > /proc/omnibook/blank + + To enable this behavior use command: + + echo 1 > /proc/omnibook/blank + + 3. To see the battery status use + + cat /proc/omnibook/battery + + command. It produce similar output to that you can see below. + + Battery: 0 + Type: Li-Ion + Serial Number: 20722 + Present Voltage: 12668 mV + Design Voltage: 11100 mV + Remaining Capacity: 4859 mAh + Last Full Capacity: 4933 mAh + Design Capacity: 5400 mAh + Gauge: 98 % + Status: charging + + On some models (e.g. HP OmniBook XE3 GF) /proc/apm does not work, even + apm is enabled, but via this file you can monitor your battery + independently from apm code. + + Current ACPI driver reports some bad value about battery at least on my + machine: + + $cat /proc/acpi/battery/BAT1/info + present: yes + design capacity: 5400 mAh + last full capacity: 5400 mAh + battery technology: rechargeable + design voltage: 8191 mV + design capacity warning: 540 mAh + design capacity low: 162 mAh + capacity granularity 1: 264 mAh + capacity granularity 2: 3780 mAh + model number: LIP9071 + serial number: + battery type: LiON + OEM info: HP + + This is because the methods used for batteries in the DSDT do + not give correct informations. If you want to fix it you may + have to change methods in the DSDT. + See http://www.intel.com/technology/iapc/acpi/bios_override.htm + for details. + + 4. The /proc/omnibook/fan file provides information about fan status: + + $ cat /proc/omnibook/fan + Fan is off + + or + + $ cat /proc/omnibook/fan + Fan is on + + On certain machines you may turn on the fan by + + echo 1 > /proc/omnibook/fan + + command and turn off by issuing + + echo 0 > /proc/omnibook/fan + + command. + + Note: On XE3 GF style machines direct fan control works only if the CPU + temperature is between fan on and fan off temperature (see below). + + The /proc/omnibook/fan_policy file provides information about fan control + policy of your machine. Currently it is available on XE3 GF style models + because ot these machines have easily available hardware fan policy + support. On other machines fan policy can be available via ACPI. To see + the fan policy settings see the file /proc/omnibook/fan_policy: + + $ cat /proc/omnibook/fan_policy + Fan off temperature: 60 C + Fan on temperature: 75 C + Fan level 2 temperature: 85 C + Fan level 3 temperature: 90 C + Fan level 4 temperature: 95 C + Fan level 5 temperature: 95 C + Fan level 6 temperature: 95 C + Fan level 7 temperature: 95 C + Minimal temperature to set: 25 C + Maximal temperature to set: 95 C + + The important values: + + Fan off temperature: If fan is cooling the CPU and reaches this + temperature it will be switched off. + Fan on temperature: If fan is off and the CPU temperature + reaches this value the fan turns on. + Fan level n temperature: Fan will be run at level n when CPU + temperature reaches this value. These are + informational values only expect the 7th + level. When CPU temperature reaches the 7th + value, the laptop (at least mine) turns off + so use it carefully. + + To set the fan policy write the proper values into the + /proc/omnibook/fan_policy file. Each value must be greater than or + equal to the prvious one. You do not have to write all values. + For example you may set fan off temperature to 60 C, fan on temperature + to 70 C and fan level 2 temperature to 80 C by + + echo 60 70 80 > /proc/omnibook/fan_policy + + command. + A zero value (echo 0 > /proc/omnibook/fan_policy) sets the default + values (60 75 85 90 95 95 95 95) of omnibook module. + + Note: These default values are not the hardware defaults. You may get + hardware defaults after resetting your machine (removing both + AC power and battery). + + Note: If you prefer the direct fan control on XE3 GF style machines + set the fan off temperature low and fan on temperature high and + use /proc/omnibook/fan to control the fan directly. + Warning: You may overheat your CPU. + + 5. The touchpad is enabled by default by the BIOS. + To disable it use the command: + + echo 0 > /proc/omnibook/touchpad + + The command + + echo 1 > /proc/omnibook/touchpad + + enables the touchpad. + + 6. The /proc/apm emulation is disabled by default on all machines. You have + to enable it explicit way by module parameter apmemu. To enable it use: + + insmod omnibook apmemu=1 + + You can enable it by /etc/modules.conf with the following entry: + + options omnibook apmemu=1 + + If your kernel have APM support, but the /proc/apm reports buggy values, + you may boot your kernel without apm support, and try to load omnibook + module with APM emulation. + + Note: This works only if battery and AC adapter monitoring is supported + on you machine. + + 7. To see the AC adapter status use + + cat /proc/omnibook/ac + + command. It produce similar output to that you can see below. + + $ cat /proc/omnibook/ac + AC on-line + + Or if you are on battery power: + + $ cat /proc/omnibook/ac + AC off-line + + 8. To see the display status use + + cat /proc/omnibook/display + + command. It produce similar output to that you can see below. + + $ cat /proc/omnibook/display + External display is not present + + Or if you have external monitor installed: + + $ cat /proc/omnibook/display + External display is present + + 9. To see the LCD brightness use + + cat /proc/omnibook/lcd + + command. It produce similar output to that you can see below. + + $ cat /proc/omnibook/lcd + LCD brightness: 7 + + To set it use similar command to that you can see below. + + echo 10 > /proc/omnibook/lcd + + The value of LCD brightness must be betwenn 0 and 10. + + Note: Setting the LCD brightness on HP OmniBook XE3 GF via + /proc/omnibook/lcd is working if you press one of the + brightness control keys once after writing the value + into /proc/omnibook/lcd. I'll try to fix it, but I have + no idea about reason yet. + + To turn off the LCD backlight use + + echo off > /proc/omnibook/lcd + + To turn it back on use + + echo on > /proc/omnibook/lcd + + This is useful if you have an X server, such as the ATI Radeon, + that does not know how to turn off the LCD backlight. Use a + long-running perl script which monitors xscreensaver activity + such as the one below: + + open(XS,"/usr/X11R6/bin/xscreensaver-command -watch|") or die; + while() { + if(/^BLANK/i) { + system("echo off > /proc/omnibook/lcd"); + } elsif(/^UNBLANK/i) { + system("echo on > /proc/omnibook/lcd"); + } + } + + Note: You have to enable users to set values in /proc/omnibook + (See the user parameter below). + +10. To check that your laptop is docked in a docking station or port + replicator use + + cat /proc/omnibook/dock + + command. It produce similar output to that you can see below. + + $ cat /proc/omnibook/dock + Laptop is undocked + + or + + $ cat /proc/omnibook/dock + Laptop is docked + + Note: docking station support is disabled by default on all machines. + You have to enable it explicit way by module parameter dock. To enable + it use: + + insmod omnibook dock=1 + + You can enable it by /etc/modules.conf with the following entry: + + options omnibook dock=1 + +You may enable features above via the proper module parameters. See the +output of + + modinfo omnibook + +command. + +Usually you have to be root to change anything via files in /proc/omnibook. +If you want to do it as ordinary user, and you trust the other (e.g. +networked) users or you are the only user of the laptop you may load the +module with the parameter user to enable non-root accounts to set omnibook +paremeters as follows: + + insmod omnibook user=1 + +You can enable users to set parameters by /etc/modules.conf with the +following entry: + + options omnibook user=1 + +Graphical frontends +------------------- +There are at least three graphical frontends for omnibook kernel module: + +1. wmtemp from Ducrot Bruno is a WindowMaker dockapp + to monitor the CPU temperature and control the fan. It is available from + http://sf.net/projects/omnibook. +2. komnibook from Guilherme Fortunato is a KDE + frontend that would stay in the tray and display/set status information + of the laptop. It is available from http://sf.net/projects/omnibook. +3. HAL and gnome-power-manager. HAL understand the LCD brightness level exported + in the /proc/omnibook/lcd file. gnome-power-manager uses HAL as its backend, + See http://hal.freedesktop.org/wiki/Software_2fhal and + http://www.gnome.org/projects/gnome-power-manager + Many thanks to Richard Hughes for the HAL patch that add omnibook support. + +How can your laptop be supported? +--------------------------------- +If your model is unsupported and you want it to be supported I need four +things: + +1. Test your machine with Pavel's omke.pl and report the result. You + should include that a feature works or not and details if any + (eg. OneTouch keycodes in hex as appears in syslog after enabling + them by omke.pl etc.). + +2. Force the module to load with an embedded controller firmware type + detailed above. For example if you want to test that your machine + is an XE3GF style model, use the following command: + + insmod omnibook ectype=1 + + then test the features are working properly, and send me the result. + + Warning!!! Forced load on an unsupported machine may cause + unpredictable result. You have been warned... + +3. Send me DMI strings of your machine (/proc/omnibook/dmi after + loading omnibook module on any machine). + +4. If possible send me the DSDT of your machine. If your kernel is + configured for ACPI you can found it at /proc/acpi/dsdt. Use the + following command to get the DSDT AML file. + + cat /proc/acpi/dsdt > my_model_name.aml + + If your kernel does not support ACPI you can get DSDT by pmtools + can be found on Intel's developer site at + http://www.intel.com/technology/IAPC/acpi/downloads.htm. + Compile it and issue command similar to below to create the DSDT AML + file. + + acpidmp DSDT > my_model_name.aml + + Please send me the AML file. Note: it is binary file. + +5. Developers or advanced users who want to help the developement of this driver + can enable two experimental features of the omnibook kernel module: + + -/proc/omnibook/dump which dump the content of the embedded + controller memory. + + -/proc/omnibook/watch which allow you to follow the content of + a specific EC, PIO or MMIO address. + + They can be manually enabled using the dump=1 and watch=1 kernel + module parameters respectivly. + These can be used in conjunction with a carefull examination of a + decompiled DSDT to spot where your laptop stores interesting informations + such as FAN speed or CPU temperature. + +This code was written without any documentation from HP or Compal so it +is provided as is without any warranty. + +Contributions, bug reports and text corrections are welcome. + +If you experience any problems after using this module try to reboot your +computer. If it does not help (eg. the laptop reboots in edless loop) turn +off the machine and remove the battery and the AC power cord for some +minutes. It it does not help too, remove the battery, plug in the AC power +cord, turn on the machine and unplug the AC power cord. It will reset your +laptop. + +Unfortunately the official HP technical support refusing to share any +information with similar messages (in 2002): + +> Thank you for contacting Hewlett Packard laptop email support. +> +> I'm sorry, but I won't be able to help you with that. HP does not +> recommend or support the installation of any version of Linux on any of +> our notebook products. + +Compal Electronics, Inc. does not response to information requests at all. + +Meanwhile (in 2002) Compaq and HP merged and as I know Compaq will the +supplier of the new laptop models in the merged company. + +Some new models of Toshiba Satellite notebooks (M70 and M40) seems to +be made by Compal. + +For more information you can see the OmniBook mailing list at +http://zurich.ai.mit.edu/mailman/listinfo/omnibook + +You can find actual version of this code at +http://sourceforge.net/projects/omke diff --git a/doc/README-1st b/doc/README-1st new file mode 100644 index 0000000..71e3450 --- /dev/null +++ b/doc/README-1st @@ -0,0 +1,16 @@ +This package intended to provide Linux kernel support for HP OmniBook, +HP Pavilion, Toshiba Satellite and some Acer Aspire and Compal laptops. +The state of this code is experimental. + +This code was written without any documentation about HP OmniBooks and +other machines so it is provided as is without any warranty. Use it on +your own risk. + +The code in the files in the omnibook distribution is licensed for use +under the terms of GNU General Public License, included as the file +named COPYING. + +For installation instructions please read the file named INSTALL. +For usage informations and/or bug reports you may read file named README. +For additional informations for using it on kernel 2.6 see README-2.6. +For current bugs and problems see file named BUGS. diff --git a/doc/README-2.6 b/doc/README-2.6 new file mode 100644 index 0000000..fa4051f --- /dev/null +++ b/doc/README-2.6 @@ -0,0 +1,20 @@ +Additional notes using omnibook module on kernel 2.6 +---------------------------------------------------- + +1. General support +------------------ + +Finally a working kernel 2.6 support solution was added to Makefile +(thanks to Mark Chappell ). It permit to build, +install and load the omnibook module. Now the module unload is working +for 2.6 series kernels (thanks to math_b@users.sourceforge.net). + +2. OneTouch buttons +------------------- + +OneTouch buttons are enabled on most models by kernel series 2.5/2.6 +at startup without this module, and someone asked me: Why have you need it +yet? Sometimes it is useful to disable them e.g. if you travel with your +laptop on train or plane, and want to prevent accidental pressing buttons +on front/side of your laptop. + diff --git a/doc/README-OneTouch b/doc/README-OneTouch new file mode 100644 index 0000000..a4d4313 --- /dev/null +++ b/doc/README-OneTouch @@ -0,0 +1,213 @@ +Kernel Support for OneTouch buttons of HP OmniBooks +=================================================== + +Some HP OmniBook (and other) laptops have special multimedia keys +(aka OneTouch buttons). These or some of them are disabled by default +and need to be enabled. + +Note: these buttons may be enabled by kernel series 2.5/2.6 at startup without + this module, but sometimes it is useful to disable them e.g. if you + travel with your laptop, and want to prevent accidental pressing + buttons on front/side of your laptop. + +This module try to detect your HP OmniBook and enable OneTouch buttons +to generate scancodes. +Look in syslog messages for "keyboard: unknown scancode e0 xx" messages to +identify the scancode assigned to button. Use setkeycodes from console-tools +package to assign keycodes to them. + +The scancodes are different on different models: + +HP OmniBook XE3 GC, GD, GE and HP Pavilion N5xxx +------------------------------------------------ + +WWW button: e073 +Mail button: e074 +Presentation button: e072 +Help button: e071 + +Previous Track button: e010 +Play / Pause button: e022 +Stop / Eject button: e024 +Next Track button: e019 + + +HP OmniBook XE3 GF +------------------ + +WWW button: e032 +Mail button: e06c +Presentation button: e074 +Help button: e073 + +Previous Track button: e010 +Play / Pause button: e022 +Stop / Eject button: e024 +Next Track button: e019 + +Volume down (& Fn-Down arrow): e02e +Volume up (& Fn-Up arrow): e030 +Mute / Unmute (Fn-F7): e020 + + +HP OmniBook xe4xxx and ze4xxx +----------------------------- + +Mail button: e06c +Presentation button: e073 +WWW button: e032 +Lock button: e071 +Help button: e070 + +Volume down button: e02e +Volume up button: e030 +Mute / Unmute button: e020 + + +HP OmniBook xt155 +----------------- + +Mail button: e06c +Presentation button: e073 +WWW button: e032 +Lock button: e071 +Help button: e070 + + +HP OmniBook XT1000 and ZT11xx +----------------------------- + +Mail button: e06c +Presentation button: e074 +WWW button: e032 +Lock button: e073 +Help button: e072 + +MP3 button: e071 +Previous Track button: e010 +Play / Pause button: e022 +Stop / Eject button: e024 +Next Track button: e019 + +Volume down button: e02e +Volume up button: e030 +Mute / Unmute button: e020 + + +HP OmniBook 5xx +--------------- + +Presentation button: e074 +Help button: e073 + +Previous Track button: e010 (*) +Play / Pause button: e022 (*) +Stop / Eject button: e024 (*) +Next Track button: e019 (*) + +Volume down button: e02e (*) +Volume up button: e030 (*) + +(*) On the docking station + + +Toshiba Satellite 3000-100 +-------------------------- + +WWW button: e071 +Mail button: e073 + +DVD button: e006 +CD button: e013 + +Stop / Eject button: e024 +Previous Track button: e010 +Next Track button: e019 +Play / Pause button: e022 + +Volume up button: e075 +Volume down button: e076 + + +HP/Compaq nx9000 +---------------- + +Mail button: e06c +Search button: e073 +Information button: e032 +Lock button: e071 +Help button: e070 + +Volume down button: e02e +Volume up button: e030 +Mute / Unmute button: e020 + + +Fujitsu-Siemens Amilo D +----------------------- + +User 1 / Stop / Eject button: e071 +User 1 / Play / Pause button: e072 +Email / Previous Track button: e074 +WWW / Next Track button: e073 + +Volume up button: e075 +Volume down button: e076 + + +Acer Aspire 1350 +---------------- + +Bluetooth e058 +Wifi e056 + + +Toshiba Satellite M70 +--------------------- + +Lock (Fn + F1) e06e +Light Bubble (Fn + F2) e062 +Suspend (Fn + F3) e017 +Hibernate (Fn + F4) e018 +Toggle Display (Fn + F5) e041 +Brightness Down (Fn + F6) e06f +Brightness Up (Fn + F7) e059 +Toggle Wifi (Fn + F8) e016 +Touchpad On/Off (Fn + F9) e01e/e01f +Zoom - (Fn + 1) e01a +Zoom + (Fn + 2) e01b +Zoom (Fn + Space) e043 +Internet e013 +Media Player e014 +Play/Pause e077 +Stop e012 +Next e039 +Prev e074 +Wifi Kill Switch e015 + + +There are programs specifically designed for such application keys (e.g. +hotkeys: http://ypwong.org/hotkeys/) or kernel level support for such +keys at http://rick.vanrein.org/linux/funkey/. + +XE3L machines are same as XE3 models but they have application launcher +buttons only but do not have multimedia (CD and volume control) buttons. + +The extra buttons near the touchpad are not OneTouch buttons. You need +driver for touchpad to use them. If you have Synaptics touchpad you may +try the driver can be found at http://www.mobilix.org/touchpad_driver.html. +Newer version can be found at +http://w1.894.telia.com/~u89404340/touchpad/index.html + +The ("Big Blue") Sleep button also not a OneTouch button, it usually +handled by APM or ACPI stuff depending on your BIOS implementation. + +Unfortunately the volume control buttons on XE3GC and OB5xx style models are +implemented in different way and do not generates scancodes. + +The volume control buttons on the right side of OB5xx and OB6xxxx wired into +the sound chip. The newer ALSA driver for maestro3 sound chip contains +support for these buttons. + +The volume control buttons on the docking station of OB500 are real OneTouch +buttons (see above). diff --git a/doc/TODO b/doc/TODO new file mode 100644 index 0000000..c3121fd --- /dev/null +++ b/doc/TODO @@ -0,0 +1,9 @@ +TODO +==== + +* Fix LCD brighness handling on XE3GF style machines +* Fully support OB5xx, OB6xxx and XE4500 style machines +* Battery support for OB5xx, OB6xxx and XE4500 style machines +* Adding more features of embedded controller +* Support more machines +* See if/how key polling can be ported to 2.6 diff --git a/dock.c b/dock.c new file mode 100644 index 0000000..9987017 --- /dev/null +++ b/dock.c @@ -0,0 +1,88 @@ +/* + * dock.c -- docking station/port replicator support + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +static int omnibook_get_dock(void) +{ + u8 dock; + int retval; + /* + * XE3GF + */ + if (omnibook_ectype & (XE3GF) ) { + if ((retval = omnibook_ec_read(XE3GF_CSPR, &dock))) + return retval; + retval = (dock & XE3GF_CSPR_MASK) ? 1 : 0; + /* + * OB500 + * OB510 + * OB6000 + * OB6100 + */ + } else if (omnibook_ectype & (OB500|OB510|OB6000|OB6100) ) { + if ((retval = omnibook_ec_read(OB500_STA1, &dock))) + return retval; + retval = (dock & OB500_DCKS_MASK) ? 1 : 0; + /* + * OB4150 + */ + } else if (omnibook_ectype & (OB4150) ) { + if ((retval = omnibook_ec_read(OB4150_DCID, &dock))) + return retval; + retval = (dock) ? 1 : 0; + } else { + printk(KERN_INFO + "%s: Docking station handling is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_dock_read(char *buffer) +{ + int len = 0; + int dock; + + dock = omnibook_get_dock(); + if (dock < 0) + return dock; + + len += + sprintf(buffer + len, "Laptop is %s\n", + (dock) ? "docked" : "undocked"); + + return len; +} + +struct omnibook_feature dock_feature = { + .name = "dock", + .enabled = 0, + .read = omnibook_dock_read, + .ectypes = XE3GF|OB500|OB510|OB6000|OB6100|OB4150, +}; + +module_param_named(dock, dock_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(dock, "Use 0 to disable, 1 to enable docking station support"); +/* End of file */ diff --git a/dump.c b/dump.c new file mode 100644 index 0000000..55f9e0d --- /dev/null +++ b/dump.c @@ -0,0 +1,97 @@ +/* + * dump.c - Raw dump of EC register, stolen from ibm_acpi.c + * + * + * Copyright (C) 2004-2005 Borislav Deianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +static u8 ecdump_regs[256]; + +static int ecdump_read(char *buffer) +{ + int len = 0; + int i, j; + u8 v; + + len += sprintf(buffer + len, "EC " + " +00 +01 +02 +03 +04 +05 +06 +07" + " +08 +09 +0a +0b +0c +0d +0e +0f\n"); + for (i = 0; i < 255; i += 16) { + len += sprintf(buffer + len, "EC 0x%02x:", i); + for (j = 0; j < 16; j++) { + if (omnibook_ec_read(i + j, &v)) + break; + if (v != ecdump_regs[i + j]) + len += sprintf(buffer + len, " *%02x", v); + else + len += sprintf(buffer + len, " %02x", v); + ecdump_regs[i + j] = v; + } + len += sprintf(buffer + len, "\n"); + if (j != 16) + break; + } + + /* These are way too dangerous to advertise openly... */ +#if 0 + len += sprintf(buffer + len, "commands:\t0x 0x" + " ( is 00-ff, is 00-ff)\n"); + len += sprintf(buffer + len, "commands:\t0x " + " ( is 00-ff, is 0-255)\n"); +#endif + return len; +} + +static int ecdump_write(char *buffer) +{ + + int i, v; + + if (sscanf(buffer, "0x%x 0x%x", &i, &v) == 2) { + /* i and v set */ + } else if (sscanf(buffer, "0x%x %u", &i, &v) == 2) { + /* i and v set */ + } else + return -EINVAL; + if (i >= 0 && i < 256 && v >= 0 && v < 256) { + if (omnibook_ec_write(i, v)) + return -EIO; + } else + return -EINVAL; + + return 0; +} + +struct omnibook_feature dump_feature = { + .name = "dump", + .enabled = 0, + .read = ecdump_read, + .write = ecdump_write, +}; + +module_param_named(dump, dump_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(dump, "Use 0 to disable, 1 to enable embedded controller register dump support"); +/* End of file */ + diff --git a/ec.c b/ec.c new file mode 100644 index 0000000..f821074 --- /dev/null +++ b/ec.c @@ -0,0 +1,328 @@ +/* + * ec.c -- low level functions to access Embedded Controller, + * Keyboard Controller and system I/O ports or memory + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include "ec.h" + +/* + * Interrupt control + */ + +static DEFINE_SPINLOCK(omnibook_ec_lock); + + +/* + * Timeout in ms for sending to controller + */ + +#define OMNIBOOK_TIMEOUT 250 + +/* + * Registers of the embedded controller + */ + +#define OMNIBOOK_EC_DATA 0x62 +#define OMNIBOOK_EC_SC 0x66 + +/* + * Embedded controller status register bits + */ + +#define OMNIBOOK_EC_STAT_OBF 0x01 /* Output buffer full */ +#define OMNIBOOK_EC_STAT_IBF 0x02 /* Input buffer full */ +#define OMNIBOOK_EC_STAT_CMD 0x08 /* Last write was a command write (0=data) */ + +/* + * Embedded controller commands + */ + +#define OMNIBOOK_EC_CMD_READ 0x80 +#define OMNIBOOK_EC_CMD_WRITE 0x81 +#define OMNIBOOK_EC_CMD_QUERY 0x84 + +/* + * Wait for embedded controller buffer + */ + +static int omnibook_ec_wait(u8 event) +{ + int timeout = OMNIBOOK_TIMEOUT; + + switch (event) { + case OMNIBOOK_EC_STAT_OBF: + while (!(inb(OMNIBOOK_EC_SC) & event) && timeout--) + mdelay(1); + break; + case OMNIBOOK_EC_STAT_IBF: + while ((inb(OMNIBOOK_EC_SC) & event) && timeout--) + mdelay(1); + break; + default: + return -EINVAL; + } + if (timeout>0) + return 0; + return -ETIME; +} + +/* + * Read from the embedded controller + * Decide at run-time if we can use the much cleaner ACPI EC driver instead of + * this implementation, this is the case if ACPI has been compiled and is not + * disabled. + */ + +int omnibook_ec_read(u8 addr, u8 *data) +{ + unsigned long flags; + int retval; + +#ifdef CONFIG_ACPI_EC + if (!acpi_disabled) + { + retval = ec_read(addr, data); + if (!retval) + return retval; + } +#endif + + spin_lock_irqsave(&omnibook_ec_lock, flags); + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF); + if (retval) + goto end; + outb(OMNIBOOK_EC_CMD_READ, OMNIBOOK_EC_SC); + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF); + if (retval) + goto end; + outb(addr, OMNIBOOK_EC_DATA); + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_OBF); + if (retval) + goto end; + *data = inb(OMNIBOOK_EC_DATA); +end: + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + return retval; +} + +/* + * Write to the embedded controller + * Decide at run-time if we can use the much cleaner ACPI EC driver instead of + * this implementation, this is the case if ACPI has been compiled and is not + * disabled. + */ + +int omnibook_ec_write(u8 addr, u8 data) +{ + + unsigned long flags; + int retval; + +#ifdef CONFIG_ACPI_EC + if (!acpi_disabled) + { + retval = ec_write(addr, data); + if (!retval) + return retval; + } +#endif + + spin_lock_irqsave(&omnibook_ec_lock, flags); + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF); + if (retval) + goto end; + outb(OMNIBOOK_EC_CMD_WRITE, OMNIBOOK_EC_SC); + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF); + if (retval) + goto end; + outb(addr, OMNIBOOK_EC_DATA); + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF); + if (retval) + goto end; + outb(data, OMNIBOOK_EC_DATA); +end: + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + return retval; +} + +/* + * Registers of the keyboard controller + */ + +#define OMNIBOOK_KBC_DATA 0x60 +#define OMNIBOOK_KBC_SC 0x64 + +/* + * Keyboard controller status register bits + */ + +#define OMNIBOOK_KBC_STAT_OBF 0x01 /* Output buffer full */ +#define OMNIBOOK_KBC_STAT_IBF 0x02 /* Input buffer full */ +#define OMNIBOOK_KBC_STAT_CMD 0x08 /* Last write was a command write (0=data) */ + +/* + * Wait for keyboard buffer + */ + +static int omnibook_kbc_wait(u8 event) +{ + int timeout = OMNIBOOK_TIMEOUT; + + switch (event) { + case OMNIBOOK_KBC_STAT_OBF: + while (!(inb(OMNIBOOK_KBC_SC) & event) && timeout--) + mdelay(1); + break; + case OMNIBOOK_KBC_STAT_IBF: + while ((inb(OMNIBOOK_KBC_SC) & event) && timeout--) + mdelay(1); + break; + default: + return -EINVAL; + } + if (timeout > 0) + return 0; + return -ETIME; +} + +/* + * Write to the keyboard command register + */ + +static int omnibook_kbc_write_command(u8 cmd) +{ + unsigned long flags; + int retval; + + spin_lock_irqsave(&omnibook_ec_lock, flags); + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF); + if (retval) + goto end; + outb(cmd, OMNIBOOK_KBC_SC); + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF); + end: + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + return retval; +} + +/* + * Write to the keyboard data register + */ + +static int omnibook_kbc_write_data(u8 data) +{ + unsigned long flags; + int retval; + + spin_lock_irqsave(&omnibook_ec_lock, flags); + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF); + if (retval) + goto end;; + outb(data, OMNIBOOK_KBC_DATA); + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF); + end: + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + return retval; +} + +/* + * Send a command to keyboard controller + */ + +int omnibook_kbc_command(u8 cmd, u8 data) +{ + int retval; + + retval = omnibook_kbc_write_command(cmd); + if (retval) + return retval; + retval = omnibook_kbc_write_data(data); + return retval; +} + +/* + * Read a value from a system I/O address + */ + +int omnibook_io_read(u32 addr, u8 * data) +{ + unsigned long flags; + + spin_lock_irqsave(&omnibook_ec_lock, flags); + *data = inb(addr); + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + return 0; +} + +/* + * Write a value to a system I/O address + */ + +int omnibook_io_write(u32 addr, u8 data) +{ + unsigned long flags; + + spin_lock_irqsave(&omnibook_ec_lock, flags); + outb(data, addr); + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + return 0; +} + +/* + * Read a value from a system memory address + */ + +int omnibook_mem_read(u32 addr, u8 * data) +{ + unsigned long flags; + char *base; + + spin_lock_irqsave(&omnibook_ec_lock, flags); + base = ioremap(addr, 1); + *data = ioread8(base); + iounmap(base); + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + + return 0; +} + +/* + * Write a value to a system memory address + */ + +int omnibook_mem_write(u32 addr, u8 data) +{ + unsigned long flags; + char *base; + + spin_lock_irqsave(&omnibook_ec_lock, flags); + base = ioremap(addr, 1); + iowrite8(data, base); + iounmap(base); + spin_unlock_irqrestore(&omnibook_ec_lock, flags); + + return 0; +} + +/* End of file */ diff --git a/ec.h b/ec.h new file mode 100644 index 0000000..d728420 --- /dev/null +++ b/ec.h @@ -0,0 +1,307 @@ +/* + * ec.h -- low level definitions to access Embedded Controller + * and Keyboard Controller and system I/O ports or memory + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +extern int omnibook_ec_read(u8 addr, u8 *data); +extern int omnibook_ec_write(u8 addr, u8 data); +extern int omnibook_kbc_command(u8 cmd, u8 data); +extern int omnibook_io_read(u32 addr, u8 * data); +extern int omnibook_io_write(u32 addr, u8 data); +extern int omnibook_mem_read(u32 addr, u8 * data); +extern int omnibook_mem_write(u32 addr, u8 data); + + +/* + * Embedded controller adresses + */ + +#define XE3GF_CHGM 0x90 /* , 16 bit */ +#define XE3GF_CHGS 0x92 /* , 16 bit */ +#define XE3GF_CHGC 0x94 /* Current charge of board, 16 bit */ +#define XE3GF_CHGV 0x96 /* Current voltage, 16 bit */ +#define XE3GF_CHGA 0x98 /* Current intensity, 16 bit */ +#define XE3GF_BAL 0x9A /* Battery present status */ +#define XE3GF_STA1 0x9C /* Various status bits */ +#define XE3GF_CSPR 0xA1 /* Port replicator status, 1 bit */ +#define XE3GF_ADP 0xA3 /* AC acapter status, 1 bit */ +#define XE3GF_FOT 0xA5 /* Fan off temperature, 8 bit */ +#define XE3GF_FSD1 0xA6 /* Fan on temperature, 8 bit */ +#define XE3GF_FSD2 0xA7 /* Fan level 2 temperature, 8 bit */ +#define XE3GF_FSD3 0xA8 /* Fan level 3 temperature, 8 bit */ +#define XE3GF_FSD4 0xA9 /* Fan level 4 temperature, 8 bit */ +#define XE3GF_FSD5 0xAA /* Fan level 5 temperature, 8 bit */ +#define XE3GF_FSD6 0xAB /* Fan level 6 temperature, 8 bit */ +#define XE3GF_FSD7 0xAC /* Fan level 7 temperature, 8 bit */ +#define XE3GF_FSRD 0xAD /* Fan status, 8 bit */ +#define XE3GF_CTMP 0xB0 /* CPU tempetature, 8 bit */ +#define XE3GF_BRTS 0xB9 /* LCD brightness, 4 bit */ +#define XE3GF_BTY0 0xC0 /* Battery 0 type, 1 bit */ +#define XE3GF_BST0 0xC1 /* Battery 0 status, 3 bit */ +#define XE3GF_BRC0 0xC2 /* Battery 0 remaining capacity, 16 bit */ +#define XE3GF_BSN0 0xC4 /* Battery 0 serial number 16 bit */ +#define XE3GF_BPV0 0xC6 /* Battery 0 present voltage, 16 bit */ +#define XE3GF_BDV0 0xC8 /* Battery 0 design voltage 16 bit */ +#define XE3GF_BDC0 0xCA /* Battery 0 design capacity 16 bit */ +#define XE3GF_BFC0 0xCC /* Battery 0 last full capacity 16 bit */ +#define XE3GF_GAU0 0xCE /* Battery 0 gauge, 8 bit */ +#define XE3GF_BTY1 0xD0 /* Battery 1 type, 1 bit */ +#define XE3GF_BST1 0xD1 /* Battery 1 status, 3 bit */ +#define XE3GF_BRC1 0xD2 /* Battery 1 remaining capacity, 16 bit */ +#define XE3GF_BSN1 0xD4 /* Battery 1 serial number, 16 bit */ +#define XE3GF_BPV1 0xD6 /* Battery 1 present voltage, 16 bit */ +#define XE3GF_BDV1 0xD8 /* Battery 1 design voltage 16 bit */ +#define XE3GF_BDC1 0xDA /* Battery 1 design capacity 16 bit */ +#define XE3GF_BFC1 0xDC /* Battery 1 last full capacity 16 bit */ +#define XE3GF_GAU1 0xDE /* Battery 1 gauge, 8 bit */ + +/* + * Bitmasks for sub byte values + */ + +#define XE3GF_SHDD_MASK 0x40 /* External display status */ +#define XE3GF_CSPR_MASK 0x01 /* Port replicator status */ +#define XE3GF_ADP_MASK 0x20 /* AC acapter status */ +#define XE3GF_BAL0_MASK 0x01 /* Battery 0 present */ +#define XE3GF_BAL1_MASK 0x02 /* Battery 1 present */ +#define XE3GF_BMF_MASK 0x70 /* Model code */ +#define XE3GF_BTY_MASK 0x80 /* Type: Ni-MH or Li-Ion */ +#define XE3GF_BST_MASK_DSC 0x01 /* Discarging */ +#define XE3GF_BST_MASK_CHR 0x02 /* Charging */ +#define XE3GF_BST_MASK_CRT 0x04 /* Critical */ +#define XE3GF_FSRD_MASK_S1 0x01 /* Fan level 1 */ +#define XE3GF_FSRD_MASK_S2 0x02 /* Fan level 2 */ +#define XE3GF_FSRD_MASK_S3 0x04 /* Fan level 3 */ +#define XE3GF_FSRD_MASK_S4 0x08 /* Fan level 4 */ +#define XE3GF_FSRD_MASK_S5 0x10 /* Fan level 5 */ +#define XE3GF_FSRD_MASK_S6 0x20 /* Fan level 6 */ +#define XE3GF_FSRD_MASK_S7 0x40 /* Fan level 7 */ +#define XE3GF_BRTS_MASK 0x0F /* LCD brightness */ + +#define XE3GF_FAN_ON_MASK 0x02 /* Fan on */ + +/* + * OmniBook XE3 GC values + */ + +#define XE3GC_CTMP 0x28 /* CPU tempetature, 8 bit */ +#define XE3GC_STA1 0x30 /* Various status bits */ +#define XE3GC_Q0A 0x31 /* Various status bits */ +#define XE3GC_CCUR 0x38 /* Current charge of board, 16 bit ? */ +#define XE3GC_CVOL 0x3A /* Current voltage, 16 bit ? */ +#define XE3GC_CARM 0x3C /* Current intensity, 16 bit ? */ +#define XE3GC_BAT 0x3E /* Battery present status */ +#define XE3GC_BST0 0x40 /* Battery 0 status, 3 bit */ +#define XE3GC_BPR0 0x41 /* Battery 0 present rate, 16 bit ? */ +#define XE3GC_BRC0 0x43 /* Battery 0 remaining capacity, 16 bit */ +#define XE3GC_BPV0 0x45 /* Battery 0 present voltage, 16 bit */ +#define XE3GC_BDV0 0x47 /* Battery 0 design voltage 16 bit */ +#define XE3GC_BDC0 0x49 /* Battery 0 design capacity 16 bit */ +#define XE3GC_BTY0 0x4A /* Battery 0 type, 1 bit ? */ +#define XE3GC_BTP0 0x4B /* Battery 0 ?, 1 bit */ +#define XE3GC_BSN0 0x4C /* Battery 0 serial number, 8 bit ? */ +#define XE3GC_BMF0 0x4D /* Battery 0 ?,8 bit */ +#define XE3GC_BST1 0x50 /* Battery 1 status, 3 bit */ +#define XE3GC_BPR1 0x51 /* Battery 1 present rate, 16 bit ? */ +#define XE3GC_BRC1 0x53 /* Battery 1 remaining capacity, 16 bit */ +#define XE3GC_BPV1 0x55 /* Battery 1 present voltage, 16 bit */ +#define XE3GC_BDV1 0x57 /* Battery 1 design voltage 16 bit */ +#define XE3GC_BDC1 0x59 /* Battery 1 design capacity 16 bit */ +#define XE3GC_BTY1 0x5A /* Battery 1 type, 1 bit ? */ +#define XE3GC_BTP1 0x5B /* Battery 1 ?, 1 bit */ +#define XE3GC_BSN1 0x5C /* Battery 1 serial number, 8 bit ? */ +#define XE3GC_BMF1 0x5D /* Battery 1 ?,8 bit */ +#define XE3GC_STA2 0x61 /* Various status bits */ +#define XE3GC_BTVL 0x6A /* LCD brightness, 4 bit */ + +/* + * Bitmasks for sub byte values + */ + +#define XE3GC_ADP_MASK 0x40 /* AC acapter status */ +#define XE3GC_BAT0_MASK 0x01 /* Battery 0 present */ +#define XE3GC_BAT1_MASK 0x02 /* Battery 1 present */ +#define XE3GC_BTY_MASK 0x01 /* Type: Ni-MH or Li-Ion */ +#define XE3GC_BST_MASK_DSC 0x01 /* Discarging */ +#define XE3GC_BST_MASK_CHR 0x02 /* Charging */ +#define XE3GC_BST_MASK_CRT 0x04 /* Critical */ +#define XE3GC_CRTI_MASK 0x04 /* External display status */ +#define XE3GC_SLPB_MASK 0x01 /* Sleep button pressed */ +#define XE3GC_F5_MASK 0x02 /* Fn-F5 - LCD/CRT switch pressed */ +#define XE3GC_VOLD_MASK 0x04 /* Fn-down arrow or Volume down pressed */ +#define XE3GC_VOLU_MASK 0x08 /* Fn-up arrow or Volume up pressed */ +#define XE3GC_MUTE_MASK 0x10 /* Fn+F7 - Volume mute pressed */ +#define XE3GC_CNTR_MASK 0x20 /* Fn+F3/Fn+F4 - Contrast up or down pressed */ +#define XE3GC_BRGT_MASK 0x40 /* Fn+F1/Fn+F2 - Brightness up or down pressed */ +#define XE3GC_BTVL_MASK 0x0F /* LCD brightness */ + +/* + * Emulated scancodes + */ + +#define XE3GC_VOLD_SCAN 0x2E /* Volume down button scancode */ +#define XE3GC_VOLU_SCAN 0x30 /* Volume up button scancode */ +#define XE3GC_MUTE_SCAN 0x20 /* Volume up button scancode */ + +/* + * Fujitsu Amilo D values + */ + +#define AMILOD_TMP 0x28 /* CPU tempetature, 8 bit */ +#define AMILOD_STA1 0x30 /* Various status bits */ +#define AMILOD_BAT 0x3E /* Battery present status */ +#define AMILOD_BDC0 0x40 /* Battery 0 design capacity 16 bit */ +#define AMILOD_BDV0 0x42 /* Battery 0 design voltage 16 bit */ +#define AMILOD_BTY0 0x44 /* Battery 0 type, 1 bit ? */ +#define AMILOD_BST0 0x45 /* Battery 0 status, 3 bit */ +#define AMILOD_BPR0 0x46 /* Battery 0 present rate, 16 bit ? */ +#define AMILOD_BRC0 0x48 /* Battery 0 remaining capacity, 16 bit */ +#define AMILOD_BPV0 0x4A /* Battery 0 present voltage, 16 bit */ +#define AMILOD_BTP0 0x4C /* Battery 0 ?, 1 bit */ +#define AMILOD_BDC1 0x50 /* Battery 1 design capacity 16 bit */ +#define AMILOD_BDV1 0x52 /* Battery 1 design voltage 16 bit */ +#define AMILOD_BTY1 0x54 /* Battery 1 type, 1 bit ? */ +#define AMILOD_BST1 0x55 /* Battery 1 status, 3 bit */ +#define AMILOD_BPR1 0x56 /* Battery 1 present rate, 16 bit ? */ +#define AMILOD_BRC1 0x58 /* Battery 1 remaining capacity, 16 bit */ +#define AMILOD_BPV1 0x5A /* Battery 1 present voltage, 16 bit */ +#define AMILOD_BTP1 0x5C /* Battery 1 ?, 1 bit */ +#define AMILOD_CBRG 0x6F /* LCD brightness, 4 bit */ + +/* + * Bitmasks for sub byte values + */ + +#define AMILOD_ADP_MASK 0x40 /* AC acapter status */ +#define AMILOD_BAT0_MASK 0x01 /* Battery 0 present */ +#define AMILOD_BAT1_MASK 0x02 /* Battery 1 present */ +#define AMILOD_BTY_MASK 0x01 /* Type: Ni-MH or Li-Ion */ +#define AMILOD_BST_MASK_DSC 0x01 /* Discarging */ +#define AMILOD_BST_MASK_CHR 0x02 /* Charging */ +#define AMILOD_BST_MASK_CRT 0x04 /* Critical */ +#define AMILOD_CBRG_MASK 0x0F /* LCD brightness */ + +/* + * OmniBook 500, 510, 6000, 6100, XE2 values + */ + +#define OB500_STA1 0x44 /* Various status bits */ +#define OB500_STA2 0x50 /* Various status bits */ +#define OB500_CTMP 0x55 /* CPU tempetature, 8 bit */ +#define OB500_BT1I 0x58 /* Battery 1 ? 16 bit */ +#define OB500_BT1C 0x5A /* Battery 1 remaining capacity 16 bit ? */ +#define OB500_BT1V 0x5C /* Battery 1 present voltage 16 bit ? */ +#define OB500_BT1S 0x5E /* Battery 1 status 3 bit ? */ +#define OB500_BT2I 0x6A /* Battery 2 ? 16 bit */ +#define OB500_BT2C 0x6C /* Battery 2 remaining capacity 16 bit ? */ +#define OB500_BT2V 0x6E /* Battery 2 present voltage 16 bit ? */ +#define OB500_BT2S 0x70 /* Battery 2 status 3 bit ? */ +#define OB500_BT3I 0x5F /* Battery 3 ? 16 bit */ +#define OB500_BT3C 0x61 /* Battery 3 remaining capacity 16 bit ? */ +#define OB500_BT3V 0x63 /* Battery 3 present voltage 16 bit ? */ +#define OB500_BT3S 0x65 /* Battery 3 status 3 bit ? */ + +#define OB6000_STA1 0x77 /* Various status bits */ + +#define XE2_STA1 0x50 /* Various status bits */ + +/* + * Bitmasks for sub byte values + */ + +#define OB500_LIDS_MASK 0x01 /* LID status */ +#define OB500_CRTS_MASK 0x20 /* External display status */ +#define OB500_SLPS_MASK 0x40 /* Sleep button status */ +#define OB500_DCKS_MASK 0x80 /* Docking status */ +#define OB500_ADP_MASK 0x02 /* AC acapter status */ +#define OB500_BST_MASK_DSC 0x01 /* Discarging */ +#define OB500_BST_MASK_CHR 0x02 /* Charging */ +#define OB500_BST_MASK_CRT 0x04 /* Critical */ + +#define OB6000_FAN_MASK 0x10 /* Fan status */ + +#define XE2_ADP_MASK 0x02 /* AC acapter status */ + +/* + * OmniBook 4150 + */ + +#define OB4150_TMP 0x28 /* CPU tempetature, 8 bit */ +#define OB4150_STA1 0x2E /* Various status bits */ +#define OB4150_STA2 0x2F /* Various status bits */ +#define OB4150_ADP 0x30 /* AC acapter status, 1 bit */ +#define OB4150_DCID 0x2C /* Port replicator */ + +/* + * Bitmasks for sub byte values + */ + +#define OB4150_FAN_MASK 0x01 /* Fan status */ +#define OB4150_ADP_MASK 0x40 /* AC acapter status */ +#define OB4150_CRST_MASK 0x20 /* External display status */ + +/* + * Keyboard controller command for some laptop functions + */ + +#define OMNIBOOK_KBC_CONTROL_CMD 0x59 + +/* + * Keyboard controller command parameters for functions available via kbc + */ + +#define OMNIBOOK_KBC_CMD_ONETOUCH_ENABLE 0x90 /* Enables OneTouch buttons */ +#define OMNIBOOK_KBC_CMD_ONETOUCH_DISABLE 0x91 /* Disables OneTouch buttons */ +#define OMNIBOOK_KBC_CMD_TOUCHPAD_ENABLE 0xAA /* Enables touchpad */ +#define OMNIBOOK_KBC_CMD_TOUCHPAD_DISABLE 0xA9 /* Disables touchpad */ +#define OMNIBOOK_KBC_CMD_LCD_ON 0xE1 /* Turns LCD display on */ +#define OMNIBOOK_KBC_CMD_LCD_OFF 0xE2 /* Turns LCD display off */ +#define OMNIBOOK_KBC_CMD_AC_POWER_ENABLE 0xC2 /* Enable AC power */ +#define OMNIBOOK_KBC_CMD_AC_POWER_DISABLE 0xC1 /* Disable AC power */ + +/* + * Other I/O ports + */ + +#define ACL00_AC_STAT 0x11B9 /* AC adapter status on ACL00 */ +#define ACL00_AC_MASK 0x04 /* Bitmask for AC adapter status on ACL00 */ +#define TOSH3K_AC_STAT 0x102D /* AC adapter status on Toshiba 3000 */ +#define TOSH3K_AC_MASK 0x08 /* Bitmask for AC adapter status on Toshiba 3000 */ +#define XE3GF_AC_STAT 0x11B9 /* AC adapter status on XE3 GF */ +#define XE3GF_AC_MASK 0x04 /* Bitmask for AC adapter status on XE3 GF */ +#define XE3GF_LID_STAT 0x11AD /* LID switch status on XE3 GF */ +#define XE3GF_LID_MASK 0x20 /* Bitmask for LID switch status on XE3 GF */ +#define XE3GC_SMIC 0xFE00 + +#define OB500_GPO1 0x8034 /* Fan control */ +#define OB510_GPO2 0x11B9 /* LCD backlight */ +#define OB510_GPIO 0x118F /* Fan control */ + +#define OB500_FAN_ON_MASK 0x0A /* Turn fan on with zero bits */ +#define OB500_FAN_OFF_MASK 0x08 /* Fan status/off */ +#define OB500_BKLT_MASK 0x40 /* LCD backlight */ +#define OB510_FAN_ON_MASK 0x18 /* Turn fan on with zero bits */ +#define OB510_FAN_OFF_MASK 0x10 /* Turn fan on */ +#define OB510_BKLT_MASK 0x01 /* LCD backlight */ + +#define XE2_FAN_MASK 0x02 /* Turn fan on with zero bit */ + +/* + * Memory adresses + */ + +#define XE3GC_BCMD 0xFFFFEBC + +/* End of file */ diff --git a/fan.c b/fan.c new file mode 100644 index 0000000..c46e418 --- /dev/null +++ b/fan.c @@ -0,0 +1,308 @@ +/* + * fan.c -- fan status/control + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include +#include "ec.h" + +static int omnibook_get_fan(void) +{ + u8 fan; + int retval; + + /* + * XE3GF + * TSP10 + */ + if (omnibook_ectype & (XE3GF|TSP10) ) { + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan))) + return retval; + retval = fan; + /* + * OB500 + */ + } else if (omnibook_ectype & (OB500) ) { + if ((retval = omnibook_io_read(OB500_GPO1, &fan))) + return retval; + retval = (fan & OB500_FAN_OFF_MASK) ? 0 : 1; + /* + * OB510 + */ + } else if (omnibook_ectype & (OB510) ) { + if ((retval = omnibook_io_read(OB510_GPIO, &fan))) + return retval; + retval = (fan & OB510_FAN_OFF_MASK) ? 0 : 1; + /* + * OB6000 + * OB6100 + */ + } else if (omnibook_ectype & (OB6000|OB6100) ) { + if ((retval = omnibook_ec_read(OB6000_STA1, &fan))) + return retval; + retval = (fan & OB6000_FAN_MASK) ? 1 : 0; + /* + * OB4150 + * AMILOD + */ + } else if (omnibook_ectype & (OB4150|AMILOD) ) { + if ((retval = omnibook_ec_read(OB4150_STA1, &fan))) + return retval; + retval = (fan & OB4150_FAN_MASK) ? 1 : 0; + /* + * XE2 + */ + } else if (omnibook_ectype & (XE2) ) { + if ((retval = omnibook_io_read(OB500_GPO1, &fan))) + return retval; + retval = (fan & XE2_FAN_MASK) ? 0 : 1; + } else { + printk(KERN_INFO + "%s: Fan status monitoring is unsupported on this machie.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_fan_on(void) +{ + u8 fan; + int retval; + + /* + * XE3GF + * TSP10 + */ + if (omnibook_ectype & (XE3GF|TSP10) ) { + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan))) + return retval; + if ((retval = omnibook_ec_write(XE3GF_FSRD, fan | XE3GF_FAN_ON_MASK))) + return retval; + /* + * OB500 + */ + } else if (omnibook_ectype & (OB500) ) { + + if ((retval = omnibook_io_read(OB500_GPO1, &fan))) + return retval; + if ((retval = + omnibook_io_write(OB500_GPO1, fan & ~OB500_FAN_ON_MASK))) + return retval; + /* + * OB510 + */ + } else if (omnibook_ectype & (OB510) ) { + + if ((retval = omnibook_io_read(OB510_GPIO, &fan))) + return retval; + if ((retval = + omnibook_io_write(OB510_GPIO, fan & ~OB510_FAN_ON_MASK))) + return retval; + /* + * OB6000 + * OB6100 + */ + } else if (omnibook_ectype & (OB6000|OB6100) ) { + + if ((retval = omnibook_ec_read(OB6000_STA1, &fan))) + return retval; + if ((retval = omnibook_ec_write(OB6000_STA1, fan | OB6000_FAN_MASK))) + return retval; + /* + * OB4150 + * AMILOD + */ + } else if (omnibook_ectype & (OB4150|AMILOD) ) { + if ((retval = omnibook_ec_read(OB4150_STA1, &fan))) + return retval; + if ((retval = omnibook_ec_write(OB4150_STA1, fan | OB4150_FAN_MASK))) + return retval; + /* + * XE2 + */ + } else if (omnibook_ectype & (XE2) ) { + + if ((retval = omnibook_io_read(OB500_GPO1, &fan))) + return retval; + if ((retval = + omnibook_io_write(OB500_GPO1, fan & ~XE2_FAN_MASK))) + return retval; + } else { + printk(KERN_INFO + "%s: Direct fan control is unsupported on this machie.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_fan_off(void) +{ + u8 fan; + int retval; + + /* + * XE3GF + * TSP10 + */ + if (omnibook_ectype & (XE3GF|TSP10) ) { + u8 fot, temp; + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan))) + return retval; + + /* fan is already off */ + if (!fan) + return 0; + + /* now we set FOT to current temp, then reset to initial value */ + if ((retval = omnibook_ec_read(XE3GF_FOT, &fot))) + return retval; + if ((retval = omnibook_ec_read(XE3GF_CTMP, &temp))) + return retval; + + do { + omnibook_ec_write(XE3GF_FOT, temp); + mdelay(1); + } while (omnibook_get_fan() != 0); + + omnibook_ec_write(XE3GF_FOT, fot); + /* + * OB500 + */ + } else if (omnibook_ectype & (OB500) ) { + if ((retval = omnibook_io_read(OB500_GPO1, &fan))) + return retval; + if ((retval = + omnibook_io_write(OB500_GPO1, fan | OB500_FAN_OFF_MASK))) + return retval; + /* + * OB510 + */ + } else if (omnibook_ectype & (OB510) ) { + if ((retval = omnibook_io_read(OB510_GPIO, &fan))) + return retval; + if ((retval = + omnibook_io_write(OB510_GPIO, fan | OB510_FAN_OFF_MASK))) + return retval; + /* + * OB6000 + * OB6100 + */ + } else if (omnibook_ectype & (OB6000|OB6100) ) { + if ((retval = omnibook_ec_read(OB6000_STA1, &fan))) + return retval; + if ((retval = omnibook_ec_write(OB6000_STA1, fan & ~OB6000_FAN_MASK))) + return retval; + /* + * OB4150 + * AMILOD + */ + } else if (omnibook_ectype & (OB4150|AMILOD) ) { + if ((retval = omnibook_ec_read(OB4150_STA1, &fan))) + return retval; + if ((retval = omnibook_ec_write(OB4150_STA1, fan & ~OB4150_FAN_MASK))) + return retval; + /* + * XE2 + */ + } else if (omnibook_ectype & (XE2) ) { + if ((retval = omnibook_io_read(OB500_GPO1, &fan))) + return retval; + if ((retval = + omnibook_io_write(OB500_GPO1, fan | XE2_FAN_MASK))) + return retval; + } else { + printk(KERN_INFO + "%s: Direct fan control is unsupported on this machie.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_fan_read(char *buffer) +{ + int fan; + int len = 0; + char *str; + + fan = omnibook_get_fan(); + if (fan < 0) + return fan; + str = (fan) ? "on" : "off"; + + if (fan > 1) + len += sprintf(buffer + len, "Fan is %s (level %d)\n", str, fan); + else + len += sprintf(buffer + len, "Fan is %s\n", str); + + return len; +} + +static int omnibook_fan_write(char *buffer) +{ + int retval; + + switch (*buffer) { + case '0': + if ((retval = omnibook_fan_off())) + return retval; + break; + case '1': + if ((retval = omnibook_fan_on())) + return retval; + break; + default: + return -EINVAL; + } + return 0; +} + +struct omnibook_feature fan_feature; + +static int __init omnibook_fan_init(void) +{ + /* + * OB4150 + * XE2 + * AMILOD + * They only support fan reading + */ + if (omnibook_ectype & (OB4150|XE2|AMILOD) ) + fan_feature.write = NULL; + return 0; +} + +struct omnibook_feature fan_feature = { + .name = "fan", + .enabled = 1, + .read = omnibook_fan_read, + .write = omnibook_fan_write, + .init = omnibook_fan_init, + .ectypes = XE3GF|OB500|OB510|OB6000|OB6100|OB4150|XE2|AMILOD|TSP10, +}; + +module_param_named(fan, fan_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(fan, "Use 0 to disable, 1 to enable fan status monitor and control"); +/* End of file */ diff --git a/fan_policy.c b/fan_policy.c new file mode 100644 index 0000000..64f3aa4 --- /dev/null +++ b/fan_policy.c @@ -0,0 +1,225 @@ +/* + * fan_policy.c -- fan policy support + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include +#include "ec.h" + +/* + * Default temperature limits. + * Danger! You may overheat your CPU! + * Do not change these values unless you exactly know what you do. + */ + +#define OMNIBOOK_FAN_LEVELS 7 +#define OMNIBOOK_FAN_MIN 25 /* Minimal value of fan off temperature */ +#define OMNIBOOK_FOT_MAX 75 /* Maximal value of fan off temperature */ +#define OMNIBOOK_FAN_MAX 95 /* Maximal value of fan on temperature */ +#define OMNIBOOK_FOT_DEFAULT 60 /* Default value of fan off temperature */ +#define OMNIBOOK_FAN1_DEFAULT 75 /* Default value of fan on temperature */ +#define OMNIBOOK_FAN2_DEFAULT 85 /* Default value of fan level 2 temperature */ +#define OMNIBOOK_FAN3_DEFAULT 90 /* Default value of fan level 3 temperature */ +#define OMNIBOOK_FAN4_DEFAULT 95 /* Default value of fan level 4 temperature */ +#define OMNIBOOK_FAN5_DEFAULT 95 /* Default value of fan level 5 temperature */ +#define OMNIBOOK_FAN6_DEFAULT 95 /* Default value of fan level 6 temperature */ +#define OMNIBOOK_FAN7_DEFAULT 95 /* Default value of fan level 7 temperature */ + +u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS]; + +static int omnibook_get_fan_policy(void) +{ + int retval = 0; + int i; + u8 tmp; + + /* + * XE3GF + */ + if (omnibook_ectype & (XE3GF) ) { + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) { + if ((retval = omnibook_ec_read(XE3GF_FOT + i, &tmp))) + return retval; + omnibook_fan_policy[i] = tmp; + } + } else { + printk(KERN_INFO + "%s: Fan policy is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_set_fan_policy(void) +{ + int retval; + int i; + + /* + * XE3GF + */ + if (omnibook_ectype & (XE3GF) ) { + if (omnibook_fan_policy[0] > OMNIBOOK_FOT_MAX) + return -EINVAL; + for (i = 0; i < OMNIBOOK_FAN_LEVELS; i++) { + if ((omnibook_fan_policy[i] > + omnibook_fan_policy[i + 1]) + || (omnibook_fan_policy[i] < OMNIBOOK_FAN_MIN) + || (omnibook_fan_policy[i] > OMNIBOOK_FAN_MAX)) + return -EINVAL; + if (omnibook_fan_policy[i + 1] > OMNIBOOK_FAN_MAX) + return -EINVAL; + } + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) { + if ((retval = + omnibook_ec_write(XE3GF_FOT + i, omnibook_fan_policy[i]))) + return retval; + } + } else { + printk(KERN_INFO + "%s: Fan policy is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_set_fan_policy_defaults(void) +{ + int retval; + int i; + u8 fan_defaults[] = { + OMNIBOOK_FOT_DEFAULT, + OMNIBOOK_FAN1_DEFAULT, + OMNIBOOK_FAN2_DEFAULT, + OMNIBOOK_FAN3_DEFAULT, + OMNIBOOK_FAN4_DEFAULT, + OMNIBOOK_FAN5_DEFAULT, + OMNIBOOK_FAN6_DEFAULT, + OMNIBOOK_FAN7_DEFAULT, + }; + + /* + * XE3GF + */ + if (omnibook_ectype & (XE3GF) ) { + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) { + if ((retval = omnibook_ec_write(XE3GF_FOT + i, fan_defaults[i]))) + return retval; + } + } else { + printk(KERN_INFO + "%s: Fan policy is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_fan_policy_read(char *buffer) +{ + int retval; + int len = 0; + u8 i; + + if ((retval = omnibook_get_fan_policy())) + return retval; + + len += + sprintf(buffer + len, "Fan off temperature: %2d C\n", + omnibook_fan_policy[0]); + len += + sprintf(buffer + len, "Fan on temperature: %2d C\n", + omnibook_fan_policy[1]); + for (i = 2; i <= OMNIBOOK_FAN_LEVELS; i++) { + len += + sprintf(buffer + len, + "Fan level %1d temperature: %2d C\n", i, + omnibook_fan_policy[i]); + } + len += + sprintf(buffer + len, "Minimal temperature to set: %2d C\n", + OMNIBOOK_FAN_MIN); + len += + sprintf(buffer + len, "Maximal temperature to set: %2d C\n", + OMNIBOOK_FAN_MAX); + + return len; +} + +static int omnibook_fan_policy_write(char *buffer) +{ + int n = 0; + char *b; + char *endp; + int retval; + int temp; + + if ((retval = omnibook_get_fan_policy())) + return retval; + + /* + * Could also be done much simpler using sscanf(,"%u %u ... + * but this would hardcode OMNIBOOK_FAN_LEVELS. + * The parsed format is "%u " repeated OMNIBOOK_FAN_LEVELS+1 times + */ + + b = buffer; + do { +#ifdef OMNIBOOK_DEBUG + printk("n=[%i] b=[%s]\n", n, b); +#endif + if (n > OMNIBOOK_FAN_LEVELS) + return -EINVAL; + if (!isspace(*b)) { + temp = simple_strtoul(b, &endp, 10); + if (endp != b) { /* there was a match */ + omnibook_fan_policy[n++] = temp; + b = endp; + } else + return -EINVAL; + } else + b++; + } while ((*b != '\0') && (*b != '\n')); + + /* A zero value set the defaults */ + if ((omnibook_fan_policy[0] == 0) && (n == 1)) { + if ((retval = omnibook_set_fan_policy_defaults())) + return retval; + } else if ((retval = omnibook_set_fan_policy())) + return retval; + return 0; +} + +struct omnibook_feature fan_policy_feature = { + .name = "fan_policy", + .enabled = 1, + .read = omnibook_fan_policy_read, + .write = omnibook_fan_policy_write, + .ectypes = XE3GF, +}; + +module_param_named(fan_policy, fan_policy_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(fan_policy, "Use 0 to disable, 1 to enable fan control policy support"); +/* End of file */ diff --git a/info.c b/info.c new file mode 100644 index 0000000..a1e0b93 --- /dev/null +++ b/info.c @@ -0,0 +1,84 @@ +/* + * info.c -- trivial informational features + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include + +static int omnibook_version_read(char *buffer) +{ + int len = 0; + + len += sprintf(buffer + len, "%s\n", OMNIBOOK_MODULE_VERSION); + + return len; +} + +static int omnibook_dmi_read(char *buffer) +{ + int len = 0; + + len += + sprintf(buffer + len, "BIOS Vendor: %s\n", + dmi_get_system_info(DMI_BIOS_VENDOR)); + len += + sprintf(buffer + len, "BIOS Version: %s\n", + dmi_get_system_info(DMI_BIOS_VERSION)); + len += + sprintf(buffer + len, "BIOS Release: %s\n", + dmi_get_system_info(DMI_BIOS_DATE)); + len += + sprintf(buffer + len, "System Vendor: %s\n", + dmi_get_system_info(DMI_SYS_VENDOR)); + len += + sprintf(buffer + len, "Product Name: %s\n", + dmi_get_system_info(DMI_PRODUCT_NAME)); + len += + sprintf(buffer + len, "Version: %s\n", + dmi_get_system_info(DMI_PRODUCT_VERSION)); + len += + sprintf(buffer + len, "Serial Number: %s\n", + dmi_get_system_info(DMI_PRODUCT_SERIAL)); + len += + sprintf(buffer + len, "Board Vendor: %s\n", + dmi_get_system_info(DMI_BOARD_VENDOR)); + len += + sprintf(buffer + len, "Board Name: %s\n", + dmi_get_system_info(DMI_BOARD_VERSION)); + + return len; +} + +struct omnibook_feature version_feature = { + .name = "version", + .enabled = 1, + .read = omnibook_version_read, +}; + +struct omnibook_feature dmi_feature = { + .name = "dmi", + .enabled = 1, + .read = omnibook_dmi_read, +}; + +module_param_named(dmi, dmi_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(dmi, "Use 0 to disable, 1 to enable DMI informations display support"); + +/* End of file */ diff --git a/init.c b/init.c new file mode 100644 index 0000000..bd50b40 --- /dev/null +++ b/init.c @@ -0,0 +1,620 @@ +/* + * init.c -- module initialization code + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include +#include +#include +#include +#include + +#include "init.h" +#include "ec.h" + + +static struct proc_dir_entry *omnibook_proc_root = NULL; + +int omnibook_ectype = NONE; +static int omnibook_userset = 0; + +static struct platform_device *omnibook_device; + +static struct platform_driver omnibook_driver = { + .probe = omnibook_probe, + .remove = omnibook_remove, +#ifdef CONFIG_PM + .suspend = omnibook_suspend, + .resume = omnibook_resume, +#endif + .driver = { + .name = OMNIBOOK_MODULE_NAME, + .owner = THIS_MODULE, + }, +}; + +/* Linked list of all enabled features */ +static struct omnibook_feature *omnibook_available_feature; + +/* + * Array of all the features provided by this module + */ +static struct omnibook_feature *omnibook_features[] __initdata = { + &ac_feature, + &apmemu_feature, + &battery_feature, + &blank_feature, + &display_feature, + &dock_feature, + &dump_feature, + &fan_feature, + &fan_policy_feature, + &dmi_feature, + &lcd_feature, + &onetouch_feature, + &temperature_feature, + &touchpad_feature, + &version_feature, + &watch_feature +}; + +#define HP_SIGNATURE "Hewlett-Packard" + +struct omnibook_models_t { + /* DMI field matchers (table inputs) */ + char *sys_vendor; + char *product_name; + char *product_version; + char *board_name; + /* Table outputs */ + char *syslog_name; /* Name which will appear in the syslog */ + int ectype; /* Type of the embedded controller firmware, see omnibook.h and README */ +}; + +static struct omnibook_models_t omnibook_models[] __initdata = { + /* sys_vendor product_name product_version board_name syslog_name ectype */ + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GF*", NULL, NULL, XE3GF }, + { NULL, "HP OmniBook PC*", "HP OmniBook XT1000*", NULL, NULL, XE3GF }, + { NULL, "HP OmniBook PC*", "HP OmniBook XE2 DC*", NULL, NULL, XE2 }, + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GC*", NULL, NULL, XE3GC }, + /* HP Pavilion N5430 */ + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GD*", NULL, NULL, XE3GC }, + /* HP Pavilion N5415 */ + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GE*", NULL, NULL, XE3GC }, + { NULL, "HP OmniBook PC*", "HP OmniBook 500 FA*", NULL, NULL, OB500 }, + { NULL, "HP OmniBook PC*", "HP OmniBook 510 FB*", NULL, NULL, OB510 }, + { NULL, "HP OmniBook PC*", "HP OmniBook 4150*", NULL, NULL, OB4150 }, + { NULL, "HP OmniBook PC*", "HP OmniBook 900 B*", NULL, NULL, OB4150 }, + { NULL, "HP OmniBook PC*", "HP OmniBook 6000 EA*", NULL, NULL, OB6000 }, + { NULL, "HP OmniBook PC*", "HP OmniBook 6100 EB*", NULL, NULL, OB6100 }, + /* HP OmniBook xe4100 */ + { NULL, "HP OmniBook PC*", "HP OmniBook xe4000*", NULL, NULL, XE4500 }, + { NULL, "HP OmniBook PC*", "HP OmniBook xe4400*", NULL, NULL, XE4500 }, + { NULL, "HP OmniBook PC*", "HP OmniBook xe4500*", NULL, NULL, XE4500 }, + /* HP OmniBook vt6200 and xt6200 */ + { NULL, "HP OmniBook PC*", "HP OmniBook 6200 EG*", NULL, NULL, XE4500 }, + /* There are no model specific strings of some HP OmniBook XT1500 */ + { NULL, "HP OmniBook PC*", "HP OmniBook*", NULL, NULL, XE3GF }, + /* HP Pavilion ze4125 */ + { NULL, "HP NoteBook PC*", "HP NoteBook ze4000*", NULL, NULL, XE4500 }, + /* There are no model specific strings of some HP Pavilion xt155 and some HP Pavilion ze4100 */ + { NULL, "HP NoteBook PC*", "HP NoteBook PC*", NULL, NULL, XE4500 }, + /* There are no model specific strings of some HP nx9000 */ + { NULL, "HP Notebook PC*", "HP Notebook PC*", NULL, NULL, XE4500 }, + /* HP Pavilion ZU1155 and ZU1175 */ + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion ZU1000 FA*", NULL, NULL, OB500 }, + /* HP Pavilion N5290 */ + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook XE3 GC*", NULL, NULL, XE3GC }, + /* HP Pavilion N5441 */ + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook Model GD*", NULL, NULL, XE3GC }, + /* HP Pavilion XH545 */ + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook Model GE*", NULL, NULL, XE3GC }, + /* HP Pavilion ZT1141 */ + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook ZT1000*", NULL, NULL, XE3GF }, + /* There are no model specific strings of some HP Pavilion ZT1175 and ZT1195 notebooks */ + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook*", NULL, NULL, XE3GF }, + { NULL, "Pavilion ze4200*", NULL, NULL, "HP Pavilion ze4200 series", XE4500 }, + { NULL, "Pavilion ze4300*", NULL, NULL, "HP Pavilion ze4300 series", XE4500 }, + { NULL, "Pavilion ze8500*", NULL, NULL, "HP Pavilion ze8500 series", XE4500 }, + /* Compaq nx9000 */ + { NULL, "HP nx9000*", NULL, NULL, "HP Compaq nx9000", XE4500 }, + /* Compaq nx9005 */ + { NULL, "HP nx9005*", NULL, NULL, "HP Compaq nx9005", XE4500 }, + /* Compaq nx9010 */ + { NULL, "HP nx9010*", NULL, NULL, "HP Compaq nx9010", XE4500 }, + { "TOSHIBA", "S1000*", NULL, NULL, "Toshiba Satellite 1000", XE3GF }, + { "TOSHIBA", "S1005*", NULL, NULL, "Toshiba Satellite 1005", XE3GF }, + { "TOSHIBA", "S1110*", NULL, NULL, "Toshiba Satellite 1110", XE3GF }, + { "TOSHIBA", "S1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF }, + { "TOSHIBA", "S1900*", NULL, NULL, "Toshiba Satellite 1900", XE3GF }, + { "TOSHIBA", "S1905*", NULL, NULL, "Toshiba Satellite 1905", XE3GF }, + { "TOSHIBA", "S1950*", NULL, NULL, "Toshiba Satellite 1950", XE3GF }, + { "TOSHIBA", "S1955*", NULL, NULL, "Toshiba Satellite 1955", XE3GF }, + { "TOSHIBA", "S2430*", NULL, NULL, "Toshiba Satellite 2430", XE3GF }, + { "TOSHIBA", "S2435*", NULL, NULL, "Toshiba Satellite 2435", XE3GF }, + { "TOSHIBA", "S3000*", NULL, NULL, "Toshiba Satellite 3000", XE3GF }, + { "TOSHIBA", "S3005*", NULL, NULL, "Toshiba Satellite 3005", XE3GF }, + { "TOSHIBA", "Satellite 1000*", NULL, NULL, "Toshiba Satellite 1000", XE3GF }, + { "TOSHIBA", "Satellite 1005*", NULL, NULL, "Toshiba Satellite 1005", XE3GF }, + { "TOSHIBA", "Satellite 1110*", NULL, NULL, "Toshiba Satellite 1110", XE3GF }, + { "TOSHIBA", "Satellite 1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF }, + { "TOSHIBA", "Toshiba 1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF }, + { "TOSHIBA", "Satellite 1900*", NULL, NULL, "Toshiba Satellite 1900", XE3GF }, + { "TOSHIBA", "Satellite 1905*", NULL, NULL, "Toshiba Satellite 1905", XE3GF }, + { "TOSHIBA", "Satellite 1950*", NULL, NULL, "Toshiba Satellite 1950", XE3GF }, + { "TOSHIBA", "Satellite 1955*", NULL, NULL, "Toshiba Satellite 1955", XE3GF }, + { "TOSHIBA", "Satellite 2430*", NULL, NULL, "Toshiba Satellite 2430", XE3GF }, + { "TOSHIBA", "Satellite 2435*", NULL, NULL, "Toshiba Satellite 2435", XE3GF }, + { "TOSHIBA", "Satellite 3000*", NULL, NULL, "Toshiba Satellite 3000", XE3GF }, + { "TOSHIBA", "Satellite 3005*", NULL, NULL, "Toshiba Satellite 3005", XE3GF }, + { "TOSHIBA", "Satellite P10*", NULL, NULL, "Toshiba Satellite P10", TSP10 }, + { "TOSHIBA", "Satellite P15*", NULL, NULL, "Toshiba Satellite P15", TSP10 }, + { "TOSHIBA", "Satellite P20*", NULL, NULL, "Toshiba Satellite P20", TSP10 }, + { "TOSHIBA", "Satellite M30X*", NULL, NULL, "Toshiba Satellite M30X", TSM30X }, + { "TOSHIBA", "Satellite M35X*", NULL, NULL, "Toshiba Satellite M35X", TSM30X }, + { "TOSHIBA", "Satellite M70*", NULL, NULL, "Toshiba Satellite M70", TSM30X }, + { "TOSHIBA", "Satellite M40*", NULL, NULL, "Toshiba Satellite M40", TSM40 }, + { "COMPAL", NULL, NULL, "ACL00", "Compal ACL00", XE3GF }, + { "COMPAL", NULL, NULL, "ACL10", "Compal ACL10", XE3GF }, + { "Acer", "Aspire 1400 series*", NULL, NULL, "Acer Aspire 1400 series", XE3GF }, + { "Acer", "Aspire 1350*", NULL, NULL, "Acer Aspire 1350", XE4500 }, + { "FUJITSU SIEMENS", "Amilo D-Series*", NULL, NULL, "Fujitsu-Siemens Amilo D series", AMILOD }, + /* This sentinel at the end catches all unsupported models */ + { NULL, NULL, NULL, NULL, NULL, NONE } +}; + +struct omnibook_tc_t { + char *tc; + int ectype; +}; + +/* HP technology codes */ +static struct omnibook_tc_t omnibook_tc[] __initdata = { + /* technology code ectype */ + {"CI.", OB4150}, + {"CL.", OB4150}, + {"DC.", XE2}, + {"EA.", OB6000}, + {"EB.", OB6100}, + {"EG.", XE4500}, + {"FA.", OB500}, + {"FB.", OB510}, + {"GC.", XE3GC}, + {"GD.", XE3GC}, + {"GE.", XE3GC}, + {"GF.", XE3GF}, + {"IB.", XE3GF}, + {"IC.", XE3GF}, + {"ID.", XE3GF}, + {"KA.", XE4500}, + {"KB.", XE4500}, + {"KC.", XE4500}, + {"KD.", XE4500}, + {"KE.", XE4500}, + {"KE_KG.", XE4500}, + {"KF_KH.", XE4500}, + {NULL, NONE} +}; + +/* + * Compare the saved DMI info at "index" with a string. + * A '*' at the end of the string will match anything. + * Returns 0 for a match. + * + * This preserves the semantics of the old omnibook_features[] + * table. I don't know if its generally useful or not. + */ +static int __init cmp_with_glob(int index, char *str) +{ + int retval = 0; + char *glob; + unsigned int len; + + if (str) { + glob = strchr(str, '*'); + len = glob ? glob - str : strlen(str); + retval = strncmp(dmi_get_system_info(index), str, len); + } + + return retval; +} + +static int __init omnibook_ident(void) +{ + struct omnibook_models_t *mp; + + for (mp = omnibook_models; mp->ectype != NONE; ++mp) { + /* Check all fields for a match */ + if (cmp_with_glob(DMI_SYS_VENDOR, mp->sys_vendor)) + continue; + if (cmp_with_glob(DMI_PRODUCT_NAME, mp->product_name)) + continue; + if (cmp_with_glob(DMI_PRODUCT_VERSION, mp->product_version)) + continue; + if (cmp_with_glob(DMI_BOARD_NAME, mp->board_name)) + continue; + + /* All required fields matched */ + break; + } + + return (mp - omnibook_models); +} + +static int __init omnibook_get_tc(void) +{ + struct omnibook_tc_t *tc; + + for (tc = omnibook_tc; tc->ectype != NONE; ++tc) { + /* + * Technology code appears in the first two chracters of BIOS version string + * ended by a dot, but it prefixed a space character on some models and BIOS + * versions. + * New HP/Compaq models use more characters (eg. KF_KH.). + */ + if (strstr(dmi_get_system_info(DMI_BIOS_VERSION), tc->tc)) + break; + } + + return (tc - omnibook_tc); +} + +/* + * Callback function for procfs file reading: the name of the file read was stored in *data + */ +static int procfile_read_dispatch(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct omnibook_feature *feature = (struct omnibook_feature *)data; + int len; + + if (!feature || !feature->read) + return -EINVAL; + + len = feature->read(page); + if (len < 0) + return len; + + if (len <= off + count) + *eof = 1; + *start = page + off; + len -= off; + if (len > count) + len = count; + if (len < 0) + len = 0; + + return len; +} + +/* + * Callback function for procfs file writing: the name of the file written was stored in *data + */ +static int procfile_write_dispatch(struct file *file, + const char __user * userbuf, + unsigned long count, void *data) +{ + struct omnibook_feature *feature = (struct omnibook_feature *)data; + char *kernbuf; + int retval; + + if (!feature || !feature->write) + return -EINVAL; + + kernbuf = kmalloc(count + 1, GFP_KERNEL); + if (!kernbuf) + return -ENOMEM; + + if (copy_from_user(kernbuf, userbuf, count)) { + kfree(kernbuf); + return -EFAULT; + } + + /* Make sure the string is \0 terminated */ + kernbuf[count] = '\0'; +#ifdef OMNIBOOK_DEBUG + printk("Input string length is %u and is: [%s]\n", (unsigned int)count, + kernbuf); +#endif + retval = feature->write(kernbuf); + if (retval == 0) + retval = count; + + kfree(kernbuf); + + return retval; +} + +/* + * Callback function for driver registering : + * Initialize the linked list of enabled features and call omnibook_init to populate it + */ +static int __init omnibook_probe(struct platform_device *dev) +{ + int i; + struct list_head *p; + struct omnibook_feature *feature; + + omnibook_available_feature = + kzalloc(sizeof(struct omnibook_feature), GFP_KERNEL); + if (!omnibook_available_feature) + return -ENOMEM; + INIT_LIST_HEAD(&omnibook_available_feature->list); + + for (i = 0; i < ARRAY_SIZE(omnibook_features); i++) { + if (!omnibook_features[i]->enabled) + continue; + if ((omnibook_ectype & omnibook_features[i]->ectypes) || (!omnibook_features[i]->ectypes)) + omnibook_init(omnibook_features[i]); + } + + printk(KERN_INFO "%s: Enabled features:",OMNIBOOK_MODULE_NAME); + list_for_each(p, &omnibook_available_feature->list) { + feature = list_entry(p, struct omnibook_feature, list); + if (feature->name) + printk(" %s", feature->name); + } + printk(".\n"); + + return 0; +} + +/* + * Initialise a feature and add it to the linked list of active features + */ +static int __init omnibook_init(struct omnibook_feature *feature) +{ + int retval; + mode_t pmode; + struct proc_dir_entry *proc_entry; + + if (!feature) + return -EINVAL; + + if (feature->init) { + retval = feature->init(); + if (retval) + return -ENODEV; + } + if (feature->name) { + if (feature->read) { + pmode = S_IFREG | S_IRUGO; + if (feature->write) { + pmode |= S_IWUSR; + if (omnibook_userset) + pmode |= S_IWUGO; + } + /* + * Special case for apmemu + */ + if (feature->proc_entry) { + proc_entry = + create_proc_entry(feature->proc_entry, pmode, + NULL); + } else { + proc_entry = + create_proc_entry(feature->name, pmode, + omnibook_proc_root); + } + if (!proc_entry) { + printk(KERN_ERR + "%s: unable to create proc entry %s\n", + OMNIBOOK_MODULE_NAME, feature->name); + return -ENOENT; + } + proc_entry->data = feature; + proc_entry->read_proc = &procfile_read_dispatch; + if (feature->write) + proc_entry->write_proc = + &procfile_write_dispatch; + } + } + list_add_tail(&feature->list, &omnibook_available_feature->list); + return 0; +} + +/* + * Callback function for driver removal + */ +static int __exit omnibook_remove(struct platform_device *dev) +{ + struct list_head *p, *n; + struct omnibook_feature *feature; + + list_for_each_safe(p, n, &omnibook_available_feature->list) { + feature = list_entry(p, struct omnibook_feature, list); + list_del(p); + if (feature->exit) + feature->exit(); + if (feature->proc_entry) + remove_proc_entry(feature->proc_entry, NULL); + else if (feature->name) + remove_proc_entry(feature->name, omnibook_proc_root); + } + kfree(omnibook_available_feature); + return 0; +} + +/* + * Callback function for system suspend + */ +static int omnibook_suspend(struct platform_device *dev, pm_message_t state) +{ + int retval; + struct list_head *p; + struct omnibook_feature *feature; + + list_for_each(p, &omnibook_available_feature->list) { + feature = list_entry(p, struct omnibook_feature, list); + if (feature->suspend) { + retval = feature->suspend(); + if (!retval) + printk(KERN_ERR + "%s: unable to suspend the %s feature", + OMNIBOOK_MODULE_NAME, feature->name); + } + } + return 0; +} + +/* + * Callback function for system resume + */ +static int omnibook_resume(struct platform_device *dev) +{ + int retval; + struct list_head *p; + struct omnibook_feature *feature; + + list_for_each(p, &omnibook_available_feature->list) { + feature = list_entry(p, struct omnibook_feature, list); + if (feature->resume) { + retval = feature->resume(); + if (!retval) + printk(KERN_ERR + "%s: unable to resume the %s feature", + OMNIBOOK_MODULE_NAME, feature->name); + } + } + return 0; +} + +/* + * Maintain compatibility with the old ectype numbers: + * ex: The user set/get ectype=12 for TSM30X=2^(12-1) + */ +static int __init set_ectype_param(const char *val, struct kernel_param *kp) +{ + char *endp; + int value; + + if (!val) return -EINVAL; + + value = simple_strtol(val, &endp, 10); + if (endp == val) /* No match */ + return -EINVAL; + omnibook_ectype = 1 << ( value - 1); + return 0; +} + +static int get_ectype_param(char *buffer, struct kernel_param *kp) +{ + return sprintf(buffer,"%i", ffs(omnibook_ectype)); +} + +static int __init omnibook_module_init(void) +{ + int model = 0; + int tc = 0; + char *syslog_name; + char *glob; + int retval; + + printk(KERN_INFO "%s: Driver version %s.\n", OMNIBOOK_MODULE_NAME, + OMNIBOOK_MODULE_VERSION); + + if (omnibook_ectype != NONE) + printk(KERN_WARNING + "%s: Forced load with EC firmware type %i.\n", + OMNIBOOK_MODULE_NAME, ffs(omnibook_ectype)); + + else { + model = omnibook_ident(); + if (omnibook_models[model].ectype != NONE) { + omnibook_ectype = omnibook_models[model].ectype; + syslog_name = omnibook_models[model].syslog_name; + if (!syslog_name) { + syslog_name = + omnibook_models[model].product_version; + glob = strchr(syslog_name, '*'); + if (glob) + *glob = '\0'; + } + printk(KERN_INFO "%s: %s detected.\n", + OMNIBOOK_MODULE_NAME, syslog_name); + } else { + /* Without explicit informations try chechking for technology code of HP laptops */ + tc = omnibook_get_tc(); + if ((strncmp + (dmi_get_system_info(DMI_SYS_VENDOR), HP_SIGNATURE, + strlen(HP_SIGNATURE)) == 0) + && (omnibook_tc[tc].ectype != NONE)) { + omnibook_ectype = omnibook_tc[tc].ectype; + printk(KERN_INFO + "%s: HP tecnology code %s detected.\n", + OMNIBOOK_MODULE_NAME, + omnibook_tc[tc].tc); + } else { + printk(KERN_INFO + "%s: Unknown model detected.\n", + OMNIBOOK_MODULE_NAME); + } + } + } + + omnibook_proc_root = proc_mkdir(OMNIBOOK_MODULE_NAME, NULL); + if (!omnibook_proc_root) { + printk(KERN_ERR "%s: Unable to create /proc/%s.\n", + OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME); + return -ENOENT; + } + + retval = platform_driver_register(&omnibook_driver); + if (retval < 0) + return retval; + + omnibook_device = platform_device_alloc(OMNIBOOK_MODULE_NAME, -1); + if (!omnibook_device) { + platform_driver_unregister(&omnibook_driver); + return -ENOMEM; + } + retval = platform_device_add(omnibook_device); + if (retval) { + platform_device_put(omnibook_device); + platform_driver_unregister(&omnibook_driver); + return retval; + } + + return 0; +} + +static void __exit omnibook_module_cleanup(void) +{ + platform_device_unregister(omnibook_device); + platform_driver_unregister(&omnibook_driver); + + if (omnibook_proc_root) + remove_proc_entry("omnibook", NULL); + printk(KERN_INFO "%s: module is unloaded.\n", OMNIBOOK_MODULE_NAME); +} + +module_init(omnibook_module_init); +module_exit(omnibook_module_cleanup); + +MODULE_AUTHOR("Soós Péter "); +MODULE_DESCRIPTION("Kernel interface for HP OmniBook, HP Pavilion, Toshiba Satellite, Acer Aspire and Compal ACL00 laptops"); +MODULE_LICENSE("GPL"); +module_param_call(ectype, set_ectype_param, get_ectype_param, NULL, S_IRUGO); +module_param_named(userset, omnibook_userset, int, S_IRUGO); +MODULE_PARM_DESC(ectype, "Type of embedded controller firmware"); +MODULE_PARM_DESC(userset, "Use 0 to disable, 1 to enable users to set parameters"); + + +/* End of file */ diff --git a/init.h b/init.h new file mode 100644 index 0000000..3ab490e --- /dev/null +++ b/init.h @@ -0,0 +1,44 @@ +/* + * init.h -- Interfaces functions with omnibook features + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + + + +struct omnibook_feature; + +static int __init omnibook_init(struct omnibook_feature *feature); +static int __init omnibook_probe(struct platform_device *dev); +static int __exit omnibook_remove(struct platform_device *dev); +static int omnibook_suspend(struct platform_device *dev, pm_message_t state); +static int omnibook_resume(struct platform_device *dev); + +extern struct omnibook_feature ac_feature; +extern struct omnibook_feature apmemu_feature; +extern struct omnibook_feature battery_feature; +extern struct omnibook_feature blank_feature; +extern struct omnibook_feature display_feature; +extern struct omnibook_feature dock_feature; +extern struct omnibook_feature dump_feature; +extern struct omnibook_feature fan_feature; +extern struct omnibook_feature fan_policy_feature; +extern struct omnibook_feature dmi_feature; +extern struct omnibook_feature lcd_feature; +extern struct omnibook_feature onetouch_feature; +extern struct omnibook_feature temperature_feature; +extern struct omnibook_feature touchpad_feature; +extern struct omnibook_feature version_feature; +extern struct omnibook_feature watch_feature; + +/* End of file */ diff --git a/lcd.c b/lcd.c new file mode 100644 index 0000000..985933e --- /dev/null +++ b/lcd.c @@ -0,0 +1,224 @@ +/* + * lcd.c -- LCD brightness and on/off + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Maciek Górniak , 2002 + * Modified by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include + +#ifdef CONFIG_OMNIBOOK_BACKLIGHT +#include +#endif + +#include "ec.h" + +static int omnibook_max_brightness; + +#ifdef CONFIG_OMNIBOOK_BACKLIGHT + +static struct backlight_device *omnibook_backlight_device; + +int omnibook_get_backlight(struct backlight_device *bd); +int omnibook_set_backlight(struct backlight_device *bd, int brgt); + +static struct backlight_properties omnibookbl_data = { + .owner = THIS_MODULE, + .get_brightness = omnibook_get_backlight, + .set_brightness = omnibook_set_backlight, +}; + +#endif + +static int omnibook_get_lcd_brightness(void) +{ + int retval = 0; + u8 brgt; + + /* + * XE3GF + * TSP10 + * TSM30X + * TSM40 + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X|TSM40) ) { + if ((retval = omnibook_ec_read(XE3GF_BRTS, &brgt))) + return retval; + retval = brgt &= XE3GF_BRTS_MASK; + /* + * XE3GC + */ + } else if (omnibook_ectype & (XE3GC) ) { + + if ((retval = omnibook_ec_read(XE3GC_BTVL, &brgt))) + return retval; + retval = brgt &= XE3GC_BTVL_MASK; + /* + * AMILOD + */ + } else if (omnibook_ectype & (AMILOD) ) { + + if ((retval = omnibook_ec_read(AMILOD_CBRG, &brgt))) + return retval; + retval = brgt &= AMILOD_CBRG_MASK; + } else { + printk(KERN_INFO + "%s: LCD brightness handling is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + + return retval; +} + +static int omnibook_set_lcd_brightness(int brgt) +{ + int retval = 0; + + brgt = + (brgt > omnibook_max_brightness) ? omnibook_max_brightness : brgt; + + /* + * XE3GF + * TSP10 + * TSM30X + * TSM40 + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X|TSM40) ) { + if ((retval = omnibook_ec_write(XE3GF_BRTS, brgt))) + return retval; + /* + * XE3GC + */ + } else if (omnibook_ectype & (XE3GC) ) { + if ((retval = omnibook_ec_write(XE3GC_BTVL, brgt))) + return retval; + /* + * AMILOD + */ + } else if (omnibook_ectype & (AMILOD) ) { + if ((retval = omnibook_ec_write(AMILOD_CBRG, brgt))) + return retval; + } else { + printk(KERN_INFO + "%s: LCD brightness handling is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + return retval; +} + +#ifdef CONFIG_OMNIBOOK_BACKLIGHT +int omnibook_get_backlight(struct backlight_device *bd) +{ + return omnibook_get_lcd_brightness(); +} + +int omnibook_set_backlight(struct backlight_device *bd, int brgt) +{ + return omnibook_set_lcd_brightness(brgt); +} +#endif + +static int omnibook_brightness_read(char *buffer) +{ + int len = 0; + int brgt; + + brgt = omnibook_get_lcd_brightness(); + if (brgt < 0) + return brgt; + + len += sprintf(buffer + len, "LCD brightness: %2d\n", brgt); + + return len; +} + +static int omnibook_brightness_write(char *buffer) +{ + int brgt = 0; + char *endp; + + if (strncmp(buffer, "off", 3) == 0) + omnibook_lcd_blank(1); + else if (strncmp(buffer, "on", 2) == 0) + omnibook_lcd_blank(0); + else { + brgt = simple_strtol(buffer, &endp, 10); + if ((endp == buffer) || (brgt < 0) || (brgt > omnibook_max_brightness)) + return -EINVAL; + else + omnibook_set_lcd_brightness(brgt); + } + return 0; +} + +static int __init omnibook_brightness_init(void) +{ + /* + * FIXME: What is exactly de max value for each model ? + * I know that it's 7 for the TSM30X and the TSM40 + * and previous versions of this driver assumed it was 10 for + * all models. + * + * TSM30X + * TSM40 + */ + if (omnibook_ectype & (TSM30X|TSM40) ) + omnibook_max_brightness = 7; + else + omnibook_max_brightness = 10; + + printk(KERN_INFO "%s: LCD brightness is between 0 and %i.\n", + OMNIBOOK_MODULE_NAME, omnibook_max_brightness); + +#ifdef CONFIG_OMNIBOOK_BACKLIGHT + omnibookbl_data.max_brightness = omnibook_max_brightness, + omnibook_backlight_device = + backlight_device_register(OMNIBOOK_MODULE_NAME, NULL, &omnibookbl_data); + if (IS_ERR(omnibook_backlight_device)) { + printk(KERN_ERR "%s: Unable to register as backlight device.\n", + OMNIBOOK_MODULE_NAME); + return -ENODEV; + } +#endif + return 0; +} + +static void __exit omnibook_brightness_cleanup(void) +{ +#ifdef CONFIG_OMNIBOOK_BACKLIGHT + backlight_device_unregister(omnibook_backlight_device); +#endif +} + +struct omnibook_feature lcd_feature = { + .name = "lcd", + .enabled = 1, + .read = omnibook_brightness_read, + .write = omnibook_brightness_write, + .init = omnibook_brightness_init, + .exit = omnibook_brightness_cleanup, + .ectypes = XE3GF|XE3GC|AMILOD|TSP10|TSM30X|TSM40, +}; + +module_param_named(lcd, lcd_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(lcd, "Use 0 to disable, 1 to enable to LCD brightness support"); + +/* End of file */ diff --git a/misc/apm-disabled.patch b/misc/apm-disabled.patch new file mode 100644 index 0000000..a76f545 --- /dev/null +++ b/misc/apm-disabled.patch @@ -0,0 +1,15 @@ +--- ./arch/i386/kernel/apm.c.orig Tue Mar 11 08:59:24 2003 ++++ ./arch/i386/kernel/apm.c Tue Mar 11 09:00:30 2003 +@@ -1906,10 +1906,12 @@ + } + if ((smp_num_cpus > 1) && !power_off) { + printk(KERN_NOTICE "apm: disabled - APM is not SMP safe.\n"); ++ apm_info.disabled = 1; + return -ENODEV; + } + if (PM_IS_ACTIVE()) { + printk(KERN_NOTICE "apm: overridden by ACPI.\n"); ++ apm_info.disabled = 1; + return -ENODEV; + } + pm_active = 1; diff --git a/misc/dmi_strings.txt b/misc/dmi_strings.txt new file mode 100644 index 0000000..f862e3b --- /dev/null +++ b/misc/dmi_strings.txt @@ -0,0 +1,670 @@ +HP OmniBook XT1000 ------------------------- + +BIOS Vendor: Insyde Software +BIOS Version: IB.M1.05 +BIOS Release: 02/28/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook XT1000 +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: HP OmniBook XT1000 + +--------------------------------------------- +HP OmniBook XT1500 -------------------------- + +BIOS Vendor: Insyde Software +BIOS Version: IC.M1.05 +BIOS Release: 08/13/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: HP OmniBook + +--------------------------------------------- +HP OmniBook XT1500 ------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: ID.M1.04 +BIOS Release: 08/14/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook XE3 GF +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook Zinfandel 4.5 + +--------------------------------------------- +HP OmniBook XE3 GC -------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GC.M1.63 +BIOS Release: 01/01/1992 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook XE3 GC +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-733 + +--------------------------------------------- +HP OmniBook XE3 GF -------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GF.M1.07 +BIOS Release: 03/05/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook XE3 GF +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-101 + +--------------------------------------------- +HP OmniBook 500 FA -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd +BIOS Version: FA.M2.62 +BIOS Release: 11/30/1999 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 500 FA +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 500 FA + +--------------------------------------------- +HP OmniBook 510 FB -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: FB.M1.20 +BIOS Release: 04/12/02 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 510 FB +Serial Number: o12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 510FB + +--------------------------------------------- +Toshiba Satellite 3000-100 ------------------ + +BIOS Vendor: TOSHIBA +BIOS Version: V2.20 +BIOS Release: 10/12/01 +System Vendor: TOSHIBA +Product Name: S3000-100 +Version: PS300E-03EKL-FR +Serial Number: 12345678GþSS300-03EKLFR +Board Vendor: Null +Board Name: 888M1 +Board Version: Null + +--------------------------------------------- +Toshiba Satellite 1115-s103------------------ + +BIOS Vendor: TOSHIBA +BIOS Version: V1.20 +BIOS Release: 09/11/2002 +System Vendor: TOSHIBA +Product Name: Satellite 1115 +Version: PS111U-001FUV +Serial Number: X1234567K +Board Vendor: TOSHIBA +Board Name: BTK20 +Board Version: Null + +--------------------------------------------- +Toshiba Satellite 1110 ---------------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V1.20 +BIOS Release: 09/11/2002 +System Vendor: TOSHIBA +Product Name: S1110 +Version: PS111E-003DN-GR +Serial Number: Y1234567K +Board Vendor: TOSHIBA +Board Name: BTK20 +Board Version: Null + +--------------------------------------------- +Toshiba Satellite 1900-704 ------------------ + +BIOS Vendor: TOSHIBA +BIOS Version: V1.50 +BIOS Release: 11/25/2002 +System Vendor: TOSHIBA +Product Name: Satellite 1950 +Version: PS195E-008QY-DU +Serial Number: Z1234567GþSS195-008QYDU+0OL +Board Vendor: TOSHIBA +Board Name: ATR60 + +--------------------------------------------- +Toshiba Satellite 1955-s805 ----------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V1.00 +BIOS Release: 01/17/2003 +System Vendor: TOSHIBA +Product Name: Satellite 1955 +Version: PS197U-000LEV +Serial Number: R1234567C +Board Vendor: TOSHIBA +Board Name: BTR80 +Board Version: Null + +--------------------------------------------- +Toshiba Satellite P10 ----------------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V1.20 +BIOS Release: 09/12/2003 +System Vendor: TOSHIBA +Product Name: Satellite P10 +Version: PSP10E-34FJR +Serial Number: Y1234567G +Board Vendor: TOSHIBA +Board Name: DAL00 +Board Version: Null + +--------------------------------------------- +Toshiba Satellite P15 ----------------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V1.20 +BIOS Release: 09/12/2003 +System Vendor: TOSHIBA +Product Name: Satellite P15 +Version: PSP10U-0DUJPV +Serial Number: 12345678K +Board Vendor: TOSHIBA +Board Name: DAL00 +Board Version: Null + +--------------------------------------------- +Toshiba Satellite M40 ----------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: 1.10 +BIOS Release: 08/24/05 +System Vendor: TOSHIBA +Product Name: Satellite M40 +Version: PSM44E-00U00EFR +Serial Number: 95096786Q +Board Vendor: ATI +Board Name: SB400 +Board Version: Rev0.4b + +--------------------------------------------- +Toshiba Satellite M70 ----------------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V1.10 +BIOS Release: 09/15/2005 +System Vendor: TOSHIBA +Product Name: Satellite M70 +Version: PSM71E-01100KFR +Serial Number: Y1234567K +Board Vendor: TOSHIBA +Board Name: HTW00 +Board Version: Null + +--------------------------------------------- +Compal ACL00 -------------------------------- + +BIOS Vendor: COMPAL +BIOS Version: V2.10C +BIOS Release: 03/25/02 +System Vendor: COMPAL +Product Name: * +Version: * +Serial Number: * +Board Vendor: Null +Board Name: ACL00 +Board Version: Null + +--------------------------------------------- +Compal ACL10 -------------------------------- + +BIOS Vendor: COMPAL +BIOS Version: V1.10 +BIOS Release: 04/12/2001 +System Vendor: * +Product Name: * +Version: * +Serial Number: * +Board Vendor: COMPAL +Board Name: ACL10 +Board Version: Null + +--------------------------------------------- +HP Pavilion ZT1195 -------------------------- + +BIOS Vendor: Insyde Software +BIOS Version: IC.M1.00 +BIOS Release: 03/20/2002 +System Vendor: Hewlett-Packard +Product Name: HP Pavilion Notebook PC +Version: HP Pavilion Notebook +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP Pavilion Notebook PC +Board Version: HP Pavilion Notebook + +--------------------------------------------- +HP Pavilion ZT1141 -------------------------- + +BIOS Vendor: Insyde Software +BIOS Version: IB.M1.05 +BIOS Release: 02/28/2002 +System Vendor: Hewlett-Packard +Product Name: HP Pavilion Notebook PC +Version: HP Pavilion Notebook ZT1000 +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP Pavilion Notebook PC +Board Version: HP Pavilion Notebook ZT1000 + +--------------------------------------------- +HP OmniBook 6100 EB ------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: EB.M2.20 +BIOS Release: 02/27/02 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 6100 EB +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 6100EB + +--------------------------------------------- +HP OmniBook 6000 EA ------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: EA.M1.81 +BIOS Release: 02/22/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 6000 EA +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 6000EA + +--------------------------------------------- +HP OmniBook xe4500 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KB.M1.30 +BIOS Release: 08/05/20022 +System Vendor: Hewlett-Packard. +Product Name: HP OmniBook PC +Version: HP OmniBook xe4500 +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: xe4500 + +--------------------------------------------- +HP Pavilion N5441 --------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GD.M1.08 +BIOS Release: 09/27/2001 +System Vendor: Hewlett-Packard +Product Name: HP Pavilion Notebook PC +Version: HP Pavilion Notebook Model GD +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-736 + +--------------------------------------------- +HP Pavilion N5430 --------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GD.M1.08 +BIOS Release: 09/27/2001 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook XE3 GD +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-736 + +--------------------------------------------- +HP Pavilion N5415 --------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GE.M1.04 +BIOS Release: 07/30/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook XE3 GE +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-736 + +--------------------------------------------- +HP Pavilion N5290 --------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GC.M1.63 +BIOS Release: 01/01/1992 +System Vendor: Hewlett-Packard +Product Name: HP Pavilion Notebook PC +Version: HP Pavilion Notebook XE3 GC +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-733 + +--------------------------------------------- +HP OmniBook vt6200 ------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: EG.M2.10 +BIOS Release: 09/19/02 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 6200 EG +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 6200EG + +--------------------------------------------- +HP OmniBook 4150 ---------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: CI.M2.250 +BIOS Release: 06/10/99 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 4150 +Serial Number: FR12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook TS32T2 + +--------------------------------------------- +HP OmniBook xt6200 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd +BIOS Version: EG.M2.10 +BIOS Release: 09/19/02 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 6200 EG +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 6200EG + +--------------------------------------------- +HP Pavilion ze4125 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd +BIOS Version: KA.M1.20 +BIOS Release: 09/13/2002 +System Vendor: Hewlett-Packard +Product Name: HP NoteBook PC +Version: HP NoteBook ze4000 +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP NoteBook PC +Board Version: HP NoteBook ze4000 + +--------------------------------------------- +HP OmniBook xt155 --------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KE.M1.40 +BIOS Release: 10/11/20022 +System Vendor: Hewlett-Packard +Product Name: HP NoteBook PC +Version: HP Notebook PC +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP NoteBook PC +Board Version: HP Notebook PC + +--------------------------------------------- +HP OmniBook xe4100 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KC.M1.10 +BIOS Release: 07/11/2002 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook xe4000 +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: 4000KC + +--------------------------------------------- +HP Omnibook xe4400 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KD.M1.60 +BIOS Release: 09/19/20022 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP Omnibook xe4400 +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP OmniBook PC +Board Version: xe4400 + +--------------------------------------------- +HP Pavilion ze4100 ------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KE.M1.40 +BIOS Release: 10/11/20022 +System Vendor: Hewlett-Packard +Product Name: HP NoteBook PC +Version: HP Notebook PC +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP NoteBook PC +Board Version: HP Notebook PC + +--------------------------------------------- +Acer Aspire 1350 ---------------------------- +BIOS Vendor: Acer +BIOS Version: 3A24 +BIOS Release: 12/01/2003 +System Vendor: Acer,Inc. +Product Name: Aspire 1350 +Version: 3A24 +Serial Number: LXA123456781234CF6EF15 +Board Vendor: Acer,Inc. +Board Name: Aspire 1350 +Board Version: Rev.A + +--------------------------------------------- +Acer Aspire 1406 LC ------------------------- + +BIOS Vendor: Acer +BIOS Version: V2.30 +BIOS Release: 10/04/02 +System Vendor: Acer +Product Name: Aspire 1400 series +Version: * +Serial Number: LXA123456789123456EB00 +Board Vendor: Null +Board Name: BR20 +Board Version: Null + +--------------------------------------------- +HP Pavilion ze4200 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KE.M1.53 +BIOS Release: 12/10/20022 +System Vendor: Hewlett-Packard +Product Name: Pavilion ze4200 +Version: KE.M1.53 +Serial Number: CN12345678 +Board Vendor: Hewlett-Packard +Board Name: 002A +Board Version: NS570 Version PQ1A74 + +--------------------------------------------- +HP Pavilion ZU1175 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: FA.M2.60 +BIOS Release: 11/30/1999 +System Vendor: Hewlett-Packard +Product Name: HP Pavilion Notebook PC +Version: HP Pavilion ZU1000 FA +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: HP Pavilion Notebook PC +Board Version: 1000FA + +--------------------------------------------- +HP Pavilion XH545 --------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: GE.M1.03 +BIOS Release: 11/08/2001 +System Vendor: Hewlett-Packard +Product Name: HP Pavilion Notebook PC +Version: HP Pavilion Notebook Model GE +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook N32N-736 + +--------------------------------------------- +Toshiba Satellite 2430-402 ------------------ + +BIOS Vendor: TOSHIBA +BIOS Version: V1.30 +BIOS Release: 01/16/2003 +System Vendor: TOSHIBA +Product Name: Satellite 2430 +Version: PS243E-06P4S-4V +Serial Number: 12345678GþSS243-06P4S4V+0OL +Board Vendor: TOSHIBA +Board Name: BTS88 +Board Version: Null + +--------------------------------------------- +HP OmniBook 900 B --------------------------- + +BIOS Vendor: Phoenix Technologies LTD +BIOS Version: CL.M3.13 +BIOS Release: 11/11/99 +System Vendor: Hewlett-Packard +Product Name: HP OmniBook PC +Version: HP OmniBook 900 B +Serial Number: TW12345678 +Board Vendor: Hewlett-Packard +Board Name: N/A +Board Version: OmniBook TS32U2 + +--------------------------------------------- +HP Compaq nx9000 ---------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KE_KG.M1.06 +BIOS Release: 05/16/2003 +System Vendor: Hewlett-Packard +Product Name: HP nx9000 (DG223T) +Version: KG.M1.06 +Serial Number: CNF12345TM +Board Vendor: Hewlett-Packard +Board Name: 002A +Board Version: NS570 Version PQ1A78 + +--------------------------------------------- +HP Compaq nx9000 ---------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KE_KG.M1.15 +BIOS Release: 12/19/2003 +System Vendor: Hewlett-Packard +Product Name: HP Notebook PC +Version: HP Notebook PC +Serial Number: +Board Vendor: +Board Name: +Board Version: + +--------------------------------------------- +HP Compaq nx9005 ---------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KAM1.46 +BIOS Release: 07/21/200392 +System Vendor: Hewlett-Packard +Product Name: HP nx9005 (DJ163A) +Version: KAM1.46 +Serial Number: CNF1234DWD +Board Vendor: Hewlett-Packard +Board Name: 0024 +Board Version: PQ1A78 + +---------------------------------------------- +HP Compaq nx9010 ----------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KF_KH.F.08 +BIOS Release: 06/06/2003 +System Vendor: Hewlett-Packard +Product Name: HP nx9010 (DJ123A) +Version: KH.F.08 +Serial Number: CNF1234D56 +Board Vendor: Hewlett-Packard +Board Name: 0850 +Board Version: NS570 Version PQ1B56 + +---------------------------------------------- +HP Pavilion ze8500 -------------------------- + +BIOS Vendor: Phoenix Technologies Ltd. +BIOS Version: KF_KH.F.18 +BIOS Release: 11/13/2003 +System Vendor: Hewlett-Packard +Product Name: Pavilion ze8500 (DJ317A) +Version: KH.F.18 +Serial Number: CNF1234M4Y +Board Vendor: Hewlett-Packard +Board Name: 0850 +Board Version: NS570 Version PQ1B60 + +--------------------------------------------- +Fujitsu-Siemens Amilo D --------------------- + +BIOS Vendor: Phoenix +BIOS Version: V1.20 +BIOS Release: 11/14/2001 +System Vendor: FUJITSU SIEMENS +Product Name: Amilo D-Series +Version: DESKTOP CPU ONLY +Serial Number: CELEON 800 - 1.2G , PIII 700 - 1.1G +Board Vendor: CY23 +Board Name: 8606-686B +Board Version: None + +--------------------------------------------- diff --git a/misc/hotkeys/README.hotkeys b/misc/hotkeys/README.hotkeys new file mode 100644 index 0000000..3522bdf --- /dev/null +++ b/misc/hotkeys/README.hotkeys @@ -0,0 +1,22 @@ +HotKeys is a program to use the special keys on internet/multimedia +keyboards. + +The HotKeys daemon listens for the "special" hotkeys that you won't +normally use on your Internet/Multimedia keyboards. The buttons +perform their intended behaviors, such as volume up and down, mute the +speaker, or launch applications. It has On-screen display (OSD) to +show the volume, program that's being started, etc. It features an +XML-based keycode configuration file format, which makes it possible +to define the hotkeys to launch any programs you want. + +You may reach it at http://ypwong.org/hotkeys/ + +Files in this directory provide examles for hotkeys definition files +for certain laptop models supported by omnibook module: + +ob5xx.def: HP OmniBook 5xx +xe3gc.def: HP OmniBook XE3 GC, GD, GE and HP Pavilion N5xxx +xe3gf.def: HP OmniBook XE3 GF +xe4xxx.def: HP OmniBook xe4xxx and ze4xxx +xt155.def: HP OmniBook xt155 +nx9xxx.def: HP/Compaq nx9xxx diff --git a/misc/hotkeys/nx9xxx.def b/misc/hotkeys/nx9xxx.def new file mode 100644 index 0000000..9d3f531 --- /dev/null +++ b/misc/hotkeys/nx9xxx.def @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + Sound muted + + + + + Soos, Peter + sp@osb.hu + + diff --git a/misc/hotkeys/ob5xx.def b/misc/hotkeys/ob5xx.def new file mode 100644 index 0000000..807b8d1 --- /dev/null +++ b/misc/hotkeys/ob5xx.def @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + Soos, Peter + sp@osb.hu + + diff --git a/misc/hotkeys/xe3gc.def b/misc/hotkeys/xe3gc.def new file mode 100644 index 0000000..5e418f2 --- /dev/null +++ b/misc/hotkeys/xe3gc.def @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + Sound muted + + + + + Soos, Peter + sp@osb.hu + + diff --git a/misc/hotkeys/xe3gf.def b/misc/hotkeys/xe3gf.def new file mode 100644 index 0000000..8f8b40e --- /dev/null +++ b/misc/hotkeys/xe3gf.def @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + Sound muted + + + + + Soos, Peter + sp@osb.hu + + diff --git a/misc/hotkeys/xe4xxx.def b/misc/hotkeys/xe4xxx.def new file mode 100644 index 0000000..6b14cde --- /dev/null +++ b/misc/hotkeys/xe4xxx.def @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + Sound muted + + + + + Soos, Peter + sp@osb.hu + + diff --git a/misc/hotkeys/xt155.def b/misc/hotkeys/xt155.def new file mode 100644 index 0000000..d200bf0 --- /dev/null +++ b/misc/hotkeys/xt155.def @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + Soos, Peter + sp@osb.hu + + diff --git a/misc/obtest/Makefile b/misc/obtest/Makefile new file mode 100644 index 0000000..5bb7595 --- /dev/null +++ b/misc/obtest/Makefile @@ -0,0 +1,7 @@ +all: obtest + +install: obtest + install -m 755 obtest /usr/local/sbin/obtest + +clean: + rm -f *.o *~ "#*#" obtest diff --git a/misc/obtest/obtest.c b/misc/obtest/obtest.c new file mode 100644 index 0000000..920100e --- /dev/null +++ b/misc/obtest/obtest.c @@ -0,0 +1,400 @@ +/* + * Utility to test embedded controller and keyboard controller + * can be found in HP OmniBooks and other laptops + * + * Original EC code comes from Ducrot Bruno + * Modified by Soós Péter + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ +#include +#include +#include +#include + +#define EC_DATA 0x62 +#define EC_SC 0x66 +#define KBC_DATA 0x60 +#define KBC_SC 0x64 + +/* Various bit mask for EC_SC (R) and KBC_SC*/ +#define OBF 0x01 +#define IBF 0x02 + +/* Commands for EC_SC (W) */ +#define RD_EC 0x80 +#define WR_EC 0x81 + +/* OmniBook command for KBC_SC (W) */ +#define OB_KBC 0x59 + +#define UDELAY 200 +#define EC_UDELAY 100 + +#define my_cli() do {asm ("cli");} while (0) +#define my_sti() do {asm ("sti");} while (0) + +typedef unsigned char u8; +typedef unsigned int u32; + +static int ec_wait (u8 event) +{ + u8 status = 0; + u32 i = UDELAY; + + switch (event) { + case OBF: + do { + status = inb(EC_SC); + if (status & OBF) + return 0; + usleep(EC_UDELAY); + } while (--i>0); + break; + case IBF: + do { + status = inb(EC_SC); + if (!(status & IBF)) + return 0; + usleep(EC_UDELAY); + } while (--i>0); + break; + default: + return -EINVAL; + } + return -ETIME; +} + +static int kbc_wait (u8 event) +{ + u8 status = 0; + u32 i = UDELAY; + + switch (event) { + case OBF: + do { + status = inb(KBC_SC); + if (status & OBF) + return 0; + usleep(EC_UDELAY); + } while (--i > 0); + break; + case IBF: + do { + status = inb(KBC_SC); + if (!(status & IBF)) + return 0; + usleep(EC_UDELAY); + } while (--i > 0); + break; + default: + return -EINVAL; + } + return -ETIME; +} + +static int ec_read(u8 address, u8 *data) +{ + int result = 0; + + *data = 0; + + my_cli(); + + result = ec_wait(IBF); + if(result) + return result; + outb(RD_EC, EC_SC); + + result = ec_wait(IBF); + if (result) + return result; + outb(address, EC_DATA); + + result = ec_wait(OBF); + if (result) + return result; + *data = inb(EC_DATA); + + my_sti(); + + return result; +} + +static int ec_write(u8 address, u8 data) +{ + int result = 0; + + my_cli(); + + result = ec_wait(IBF); + if (result) + return result; + outb(WR_EC, EC_SC); + + result = ec_wait(IBF); + if (result) + return result; + outb(address, EC_DATA); + + result = ec_wait(IBF); + if (result) + return result; + outb(data, EC_DATA); + + my_sti(); + + return result; +} + +static int sysio_write(u32 address, u8 data) +{ + my_cli(); + + outb(data, address); + + my_sti(); + + return 0; +} + +static int sysio_read(u32 address, u8 *data) +{ + my_cli(); + + *data = inb(address); + + my_sti(); + + return 0; +} + +int kbc_command(u8 cmd, u8 data) +{ + int result = 0; + + my_cli(); + + result = kbc_wait(IBF); + if (result) + return result; + outb(OB_KBC, KBC_SC); + + result = kbc_wait(IBF); + if (result) + return result; + outb(data, KBC_DATA); + + my_sti(); + + return result; +} + +char *itob(int a) +{ + static char buff[9]; + char *p; + int i; + + if (a < 0 || a > 255) + return NULL; + + for (p = buff, i = 0; i < 8; a <<= 1, i++) + *p++ = (a & 0x80) ? '1' : '0'; + *p = 0; + + return buff; +} + +long ntoi(const char *n) +{ + long a = 0; + int i = 0; + + if (n[0] == '0') { + if (n[1] == 'x' || n[1] == 'X') { + i = 2; + while (n[i]) { + if (n[i] >= '0' && n[i] <= '9') + a = 16 * a + (n[i] - '0'); + else if (n[i] >= 'a' && n[i] <= 'f') + a = 16 * a + (n[i] - 'a' + 10); + else if (n[i] >= 'A' && n[i] <= 'F') + a = 16 * a + (n[i] - 'A' + 10); + else + return -EINVAL; + i++; + } + if (i == 2) + return -EINVAL; + } else if (n[1] == 'b' || n[1] == 'B') { + i = 2; + while (n[i]) { + if (n[i] == '0' || n[i] == '1') + a = 2 * a + (n[i] - '0'); + else + return -EINVAL; + i++; + } + if (i == 2) + return -EINVAL; + } else if (n[1] >= '0' && n[1] <= '7') { + i = 1; + while (n[i]) { + if (n[i] >= '0' && n[i] <= '7') + a = 8 * a + (n[i] - '0'); + else + return -EINVAL; + i++; + } + } + } else { + while (n[i]) { + if (n[i] >= '0' && n[i] <= '9') + a = 10 * a + (n[i] - '0'); + else + return -EINVAL; + i++; + } + } + return a; +} + +void usage(char *argv) +{ + fprintf(stderr, "usage: `%s -r addr' to read from the address of EC\n", argv); + fprintf(stderr, " `%s -c addr' to read EC continuosly\n", argv); + fprintf(stderr, " `%s -w addr value' to write value to address of EC\n", argv); + fprintf(stderr, " `%s -k cmd' to send OmniBook commad to KBC\n", argv); + fprintf(stderr, " `%s -i addr' to read from an I/O address\n", argv); + fprintf(stderr, " `%s -s addr' to read from an I/O address continuosly\n", argv); + fprintf(stderr, " `%s -x addr value' to write value to an I/O address\n", argv); + exit(1); +} + +int main(int argc, char *argv[]) +{ + u8 data; + u32 a; + u8 cmd; + int result; + const char *p; + const char *q; + const char *sw; + + if ((argc < 3) || (argc > 4)) { + usage(argv[0]); + } + + sw = argv[1]; + if (sw[0] != '-') + usage(argv[0]); + + switch (sw[1]) { + case 'r': + case 'c': + case 'k': + case 'i': + case 's': + if (argc == 3) + p = argv[2]; + else + usage(argv[0]); + break; + case 'w': + case 'x': + if (argc == 4) { + p = argv[2]; + q = argv[3]; + } else + usage(argv[0]); + break; + default: + usage(argv[0]); + } + + if (iopl(3)) { + perror("iopl"); + exit (1); + } + + a = ntoi(p); + data = ntoi(q); + + switch (sw[1]) { + case 'w': + result = ec_write(a,data); + if (result) + return result; + printf("Writing to EC at address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + result = ec_read(a, &data); + if (result) + return result; + printf("Reading EC from address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + usleep(1000000); + result = ec_read(a, &data); + if (result) + return result; + printf("Reading EC from address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + break; + case 'x': + result = sysio_write(a,data); + if (result) + return result; + printf("Writing to address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + result = sysio_read(a, &data); + if (result) + return result; + printf("Reading from address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + usleep(1000000); + result = sysio_read(a, &data); + if (result) + return result; + printf("Reading from address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + break; + case 'r': + result = ec_read(a, &data); + if (result) + return result; + printf("Reading EC from address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + break; + case 'c': + do { + result = ec_read(a, &data); + printf("Reading EC from address 0x%.2x (%.3d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + } while (1); + break; + case 'i': + result = sysio_read(a, &data); + if (result) + return result; + printf("Reading from address 0x%.4x (%.5d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + break; + case 's': + do { + result = sysio_read(a, &data); + printf("Reading from address 0x%.4x (%.5d) : 0x%02x %s (%d)\n", a, a, data, itob(data), data); + usleep(50000); + } while (1); + break; + case 'k': + cmd = OB_KBC; + result = kbc_command(cmd, a); + if (result) + return result; + printf("Writing to KBC 0x%.2x command with 0x%.2x parameter.\n", cmd, a); + break; + } + + return result; +} + +/* End of file */ diff --git a/misc/omnibook-dmi.patch b/misc/omnibook-dmi.patch new file mode 100644 index 0000000..9519697 --- /dev/null +++ b/misc/omnibook-dmi.patch @@ -0,0 +1,15 @@ +diff -uNr linux-2.4.18/arch/i386/kernel/dmi_scan.c linux-2.4.18-patched/arch/i386/kernel/dmi_scan.c +--- linux-2.4.18/arch/i386/kernel/dmi_scan.c Mon Feb 25 20:37:53 2002 ++++ linux-2.4.18-patched/arch/i386/kernel/dmi_scan.c Sun Aug 11 12:28:27 2002 +@@ -452,6 +452,11 @@ + MATCH(DMI_BIOS_VERSION, "A04"), + MATCH(DMI_BIOS_DATE, "08/24/2000"), NO_MATCH + } }, ++ { broken_apm_power, "HP OmniBook XE3 GF", { /* Handle problems with APM on HP OmniBook XE3 GF */ ++ MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), ++ MATCH(DMI_PRODUCT_VERSION, "HP OmniBook XE3 GF"), ++ NO_MATCH, NO_MATCH ++ } }, + { set_realmode_power_off, "Award Software v4.60 PGMA", { /* broken PM poweroff bios */ + MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."), + MATCH(DMI_BIOS_VERSION, "4.60 PGMA"), diff --git a/misc/omnibook-integration.patch b/misc/omnibook-integration.patch new file mode 100644 index 0000000..3ea9500 --- /dev/null +++ b/misc/omnibook-integration.patch @@ -0,0 +1,86 @@ +diff -Nru linux-2.6.15/arch/i386/Kconfig linux-2.6.15-omnibook/arch/i386/Kconfig +--- linux-2.6.15/arch/i386/Kconfig 2006-01-03 04:21:10.000000000 +0100 ++++ linux-2.6.15-omnibook/arch/i386/Kconfig 2006-03-12 22:49:21.251157801 +0100 +@@ -320,6 +320,42 @@ + Say Y if you intend to run this kernel on a Toshiba portable. + Say N otherwise. + ++config OMNIBOOK ++ tristate "HP (omnibook) laptop support" ++ help ++ This adds a driver to support some features of laptops manufactured ++ by Compal Electronics, Inc as ODM such as HP OmniBook, Pavilion, ++ Compal ACL00 and Toshiba Satellite (wich have Pheonix BIOS and is ++ not supported by Toshiba driver) and Acer Aspire series laptops. ++ ++ For this driver see the site at: . ++ ++ Say Y if you intend to run this kernel on a supported portable. ++ Say N otherwise. ++ ++ This driver is also available as a module ( = code which can be ++ inserted in and removed from the running kernel whenever you want). ++ If you want to compile it as a module, say M here and read ++ Documentation/modules.txt. ++ The module is called omnibook.ko because originally it was intended ++ to support HP OmniBooks only. ++ ++config OMNIBOOK_APMEMU ++ bool "HP omnibook APM emulation" ++ depends on OMNIBOOK ++ help ++ Enable APM emulation by default in the omnibook module. This is ++ mainly for laptops that don't have perfect ACPI support for battery ++ level monitoring. ++ ++config OMNIBOOK_BACKLIGHT ++ bool "HP omnibook backlight support" ++ depends on OMNIBOOK ++ select BACKLIGHT_CLASS_DEVICE ++ help ++ Enable registration of the omnibook module as a backlight device. ++ This allow query and control of the LCD brightness via sysfs. ++ + config I8K + tristate "Dell laptop support" + ---help--- +diff -Nru linux-2.6.15/drivers/misc/Makefile linux-2.6.15-omnibook/drivers/misc/Makefile +--- linux-2.6.15/drivers/misc/Makefile 2006-01-03 04:21:10.000000000 +0100 ++++ linux-2.6.15-omnibook/drivers/misc/Makefile 2006-03-12 22:39:59.517415488 +0100 +@@ -5,3 +5,5 @@ + + obj-$(CONFIG_IBM_ASM) += ibmasm/ + obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ ++obj-$(CONFIG_OMNIBOOK) += omnibook/ ++ +diff -Nru linux-2.6.15/drivers/misc/omnibook/Makefile linux-2.6.15-omnibook/drivers/misc/omnibook/Makefile +--- linux-2.6.15/drivers/misc/omnibook/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.15-omnibook/drivers/misc/omnibook/Makefile 2006-03-12 22:43:34.087553100 +0100 +@@ -0,0 +1,27 @@ ++ ++# Makefile -- makefile for the HP OmniBook support module ++ ++# This program is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by the ++# Free Software Foundation; either version 2, or (at your option) any ++# later version. ++# ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# Written by Soós Péter , 2002-2004 ++# ++# Note! Dependencies are done automagically by 'make dep', which also ++# removes any old dependencies. DON'T put your own dependencies here ++# unless it's something special (ie not a .c file). ++# ++# Note 2! The CFLAGS definitions are now in the main makefile... ++ ++obj-$(CONFIG_OMNIBOOK) += omnibook.o ++ ++omnibook-objs := ac.o battery.o blank.o display.o dock.o ec.o fan.o \ ++fan_policy.o init.o lcd.o onetouch.o temperature.o touchpad.o dump.o info.o \ ++watch.o apmemu.o ++ diff --git a/misc/onetouch-xkb-2003-02-10.patch b/misc/onetouch-xkb-2003-02-10.patch new file mode 100644 index 0000000..31375e6 --- /dev/null +++ b/misc/onetouch-xkb-2003-02-10.patch @@ -0,0 +1,199 @@ +--- /usr/X11R6/lib/X11/xkb/rules/xfree86.onetouch Mon Feb 10 22:58:41 2003 ++++ /usr/X11R6/lib/X11/xkb/rules/xfree86 Mon Feb 10 23:47:38 2003 +@@ -89,6 +89,27 @@ + hp us = us(pc104)+inet(hp) + hp en_US = en_US(pc104)+inet(hp) + hp * = en_US(pc104)+inet(hp)+%l%(v) ++ xe3gc us = us(pc104)+inet(xe3gc) ++ xe3gc en_US = en_US(pc104)+inet(xe3gc) ++ xe3gc * = en_US(pc104)+inet(xe3gc)+%l%(v) ++ xe3gf us = us(pc104)+inet(xe3gf) ++ xe3gf en_US = en_US(pc104)+inet(xe3gf) ++ xe3gf * = en_US(pc104)+inet(xe3gf)+%l%(v) ++ xt1000 us = us(pc104)+inet(xt1000) ++ xt1000 en_US = en_US(pc104)+inet(xt1000) ++ xt1000 * = en_US(pc104)+inet(xt1000)+%l%(v) ++ xe4xxx us = us(pc104)+inet(xe4xxx) ++ xe4xxx en_US = en_US(pc104)+inet(xe4xxx) ++ xe4xxx * = en_US(pc104)+inet(xe4xxx)+%l%(v) ++ xt155 us = us(pc104)+inet(xt155) ++ xt155 en_US = en_US(pc104)+inet(xt155) ++ xt155 * = en_US(pc104)+inet(xt155)+%l%(v) ++ ob5xx us = us(pc104)+inet(ob5xx) ++ ob5xx en_US = en_US(pc104)+inet(ob5xx) ++ ob5xx * = en_US(pc104)+inet(ob5xx)+%l%(v) ++ s3000 us = us(pc104)+inet(s3000) ++ s3000 en_US = en_US(pc104)+inet(s3000) ++ s3000 * = en_US(pc104)+inet(s3000)+%l%(v) + compaq us = us(pc104)+inet(compaq) + compaq en_US = en_US(pc104)+inet(compaq) + compaq * = en_US(pc104)+inet(compaq)+%l%(v) +--- /usr/X11R6/lib/X11/xkb/rules/xfree86.lst.onetouch Mon Feb 10 22:58:42 2003 ++++ /usr/X11R6/lib/X11/xkb/rules/xfree86.lst Tue Feb 11 00:03:42 2003 +@@ -21,6 +21,13 @@ + pc98 PC-98xx Series + abnt2 Brazilian ABNT2 + hp HP Internet ++ xe3gc HP OmniBook XE3 GC, GD, GE and HP Pavilion N5xxx ++ xe3gf HP OmniBook XE3 GF ++ xt1000 HP OmniBook XT1000 and HP Pavilion zt11xx ++ xe4xxx HP OmniBook xe4xxx and ze4xxx ++ xt155 HP OmniBook xt155 ++ ob5xx HP OmniBook 5xx ++ s3000 Toshiba Satellite 3000 + itouch Logitech iTouch + logicordless Logitech Cordless Desktop Pro + logiinternet Logitech Internet Keyboard +--- /usr/X11R6/lib/X11/xkb/symbols/inet.onetouch Mon Feb 10 22:58:39 2003 ++++ /usr/X11R6/lib/X11/xkb/symbols/inet Tue Feb 11 00:03:21 2003 +@@ -14,6 +14,150 @@ + key { [ XF86AudioMute ] }; + }; + ++partial alphanumeric_keys ++xkb_symbols "xe3gc" { ++ ++ // Describes the OneTouch buttons on HP Omnibook XE3 GC and ++ // HP Pavilion N52xx models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "XE3GC"; ++ key { [ XF86WWW ] }; ++ key { [ XF86Mail ] }; ++ key { [ XF86Launch1 ] }; ++ key { [ Help ] }; ++ key { [ XF86AudioPrev ] }; ++ key { [ XF86AudioPlay, XF86AudioPause ] }; ++ key { [ XF86AudioStop, XF86Eject ] }; ++ key { [ XF86AudioNext ] }; ++}; ++ ++partial alphanumeric_keys ++xkb_symbols "xe3gf" { ++ ++ // Describes the OneTouch buttons on HP Omnibook XE3 GF models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "XE3GF"; ++ key { [ XF86WWW ] }; ++ key { [ XF86Mail ] }; ++ key { [ XF86Launch1 ] }; ++ key { [ Help ] }; ++ key { [ XF86AudioPrev ] }; ++ key { [ XF86AudioPlay, XF86AudioPause ] }; ++ key { [ XF86AudioStop, XF86Eject ] }; ++ key { [ XF86AudioNext ] }; ++ key { [ XF86AudioLowerVolume ] }; ++ key { [ XF86AudioRaiseVolume ] }; ++ key { [ XF86AudioMute ] }; ++}; ++ ++partial alphanumeric_keys ++xkb_symbols "xt1000" { ++ ++ // Describes the OneTouch buttons on HP Omnibook XT1000 and HP Pavilion ++ // ZT11xx models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "XT1000"; ++ key { [ XF86Mail ] }; ++ key { [ XF86Launch1 ] }; ++ key { [ XF86WWW ] }; ++ key { [ XF86Launch2 ] }; ++ key { [ Help ] }; ++ key { [ XF86Launch3 ] }; ++ key { [ XF86AudioPrev ] }; ++ key { [ XF86AudioNext ] }; ++ key { [ XF86AudioPlay, XF86AudioPause ] }; ++ key { [ XF86AudioStop, XF86Eject ] }; ++ key { [ XF86AudioLowerVolume ] }; ++ key { [ XF86AudioRaiseVolume ] }; ++ key { [ XF86AudioMute ] }; ++}; ++ ++partial alphanumeric_keys ++xkb_symbols "xe4xxx" { ++ ++ // Describes the OneTouch buttons on HP Omnibook xe4xxx and ze4xxx ++ // models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "xe4xxx"; ++ key { [ XF86Mail ] }; ++ key { [ XF86Launch1 ] }; ++ key { [ XF86WWW ] }; ++ key { [ XF86Launch2 ] }; ++ key { [ Help ] }; ++ key { [ XF86AudioLowerVolume ] }; ++ key { [ XF86AudioRaiseVolume ] }; ++ key { [ XF86AudioMute ] }; ++}; ++ ++partial alphanumeric_keys ++xkb_symbols "zt11xx" { ++ ++ // Describes the OneTouch buttons on HP Pavilion ZT11xx models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "ZT11xx"; ++ key { [ XF86Mail ] }; ++ key { [ XF86Launch1 ] }; ++ key { [ XF86WWW ] }; ++ key { [ XF86Launch2 ] }; ++ key { [ Help ] }; ++ key { [ XF86Launch3 ] }; ++ key { [ XF86AudioPrev ] }; ++ key { [ XF86AudioNext ] }; ++ key { [ XF86AudioPlay, XF86AudioPause ] }; ++ key { [ XF86AudioStop, XF86Eject ] }; ++ key { [ XF86AudioLowerVolume ] }; ++ key { [ XF86AudioRaiseVolume ] }; ++ key { [ XF86AudioMute ] }; ++}; ++ ++partial alphanumeric_keys ++xkb_symbols "ob5xx" { ++ ++ // Describes the OneTouch buttons on HP Omnibook 5xx models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "OB5xx"; ++ key { [ XF86Launch1 ] }; ++ key { [ Help ] }; ++ key { [ XF86AudioPrev ] }; ++ key { [ XF86AudioPlay, XF86AudioPause ] }; ++ key { [ XF86AudioStop, XF86Eject ] }; ++ key { [ XF86AudioNext ] }; ++ key { [ XF86AudioLowerVolume ] }; ++ key { [ XF86AudioRaiseVolume ] }; ++}; ++ ++partial alphanumeric_keys ++xkb_symbols "s3000" { ++ ++ // Describes the Special buttons on Toshiba Satellite 3000 models. ++ // See http://sourceforge.net/projects/omke for details on enabling ++ // these keys ++ ++ name[Group1]= "S3000"; ++ key { [ XF86WWW ] }; ++ key { [ XF86Mail ] }; ++ key { [ XF86Launch1 ] }; ++ key { [ XF86Launch2 ] }; ++ key { [ XF86AudioStop, XF86Eject ] }; ++ key { [ XF86AudioPrev ] }; ++ key { [ XF86AudioNext ] }; ++ key { [ XF86AudioPlay, XF86AudioPause ] }; ++ key { [ XF86AudioRaiseVolume ] }; ++ key { [ XF86AudioLowerVolume ] }; ++}; ++ + partial alphanumeric_keys + xkb_symbols "compaq" { + diff --git a/omnibook.h b/omnibook.h new file mode 100644 index 0000000..2b7562d --- /dev/null +++ b/omnibook.h @@ -0,0 +1,106 @@ +/* + * omnibook.h -- High level data structures and functions of omnibook + * support code + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#include +#include + +/* + * Module informations + */ + +#define OMNIBOOK_MODULE_NAME "omnibook" +#define OMNIBOOK_MODULE_VERSION "20060126" + +/* + * EC types + */ + +extern int omnibook_ectype; + + +#define NONE 0 /* Default/unknown EC type */ +#define XE3GF 1 /* HP OmniBook XE3 GF, most Toshiba Satellites and more */ +#define XE3GC 2 /* HP OmniBook XE3 GC, GD, GE and compatible */ +#define OB500 4 /* HP OmniBook 500 and compatible */ +#define OB510 8 /* HP OmniBook 510 */ +#define OB6000 16 /* HP OmniBook 6000 */ +#define OB6100 32 /* HP OmniBook 6100 */ +#define XE4500 64 /* HP OmniBook xe4500 and compatible */ +#define OB4150 128 /* HP OmniBook 4150 */ +#define XE2 256 /* HP OmniBook XE2 */ +#define AMILOD 512 /* Fujitsu Amilo D */ +#define TSP10 1024 /* Toshiba Satellite P10, P15, P20 and compatible */ +#define TSM30X 2048 /* Toshiba Satellite M30X, M35X, M70 and compatible */ +#define TSM40 4096 /* Toshiba Satellite M40 */ + +/* + * This represent a feature provided by this module + */ + +struct omnibook_feature { + struct list_head list; + char *name; /* Name */ + char *proc_entry; /* Specify proc entry relative to /proc (will be omnibook/name otherwise) */ + int enabled; /* Set from module parameter */ + int (*read) (char *); /* Procfile read function */ + int (*write) (char *); /* Procfile write function */ + int (*init) (void); /* Specific Initialization function */ + void (*exit) (void); /* Specific Cleanup function */ + int (*suspend) (void); /* PM Suspend function */ + int (*resume) (void); /* PM Resume function */ + int ectypes; /* Type(s) of EC we support for this feature (bitmask) */ +}; + +struct omnibook_battery_info { + u8 type; /* 1 - Li-Ion, 2 NiMH */ + u16 sn; /* Serial number */ + u16 dv; /* Design Voltage */ + u16 dc; /* Design Capacity */ +}; +struct omnibook_battery_state { + u16 pv; /* Present Voltage */ + u16 rc; /* Remaining Capacity */ + u16 lc; /* Last Full Capacity */ + u8 gauge; /* Gauge in % */ + u8 status; /* 0 - unknown, 1 - charged, 2 - discharging, 3 - charging, 4 - critical) */ +}; +enum { + OMNIBOOK_BATTSTAT_UNKNOWN, + OMNIBOOK_BATTSTAT_CHARGED, + OMNIBOOK_BATTSTAT_DISCHARGING, + OMNIBOOK_BATTSTAT_CHARGING, + OMNIBOOK_BATTSTAT_CRITICAL +}; + + +extern int omnibook_lcd_blank(int blank); +extern int omnibook_get_ac(void); +extern int omnibook_get_battery_status(int num, struct omnibook_battery_state *battstat); +extern int set_omnibook_param(const char *val, struct kernel_param *kp); + +/* Configuration for standalone compilation */ + +#ifdef OMNIBOOK_STANDALONE +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE +#define CONFIG_OMNIBOOK_BACKLIGHT +#else +#undef CONFIG_OMNIBOOK_BACKLIGHT +#endif /* BACKLIGHT_CLASS_DEVICE */ +#undef CONFIG_OMNIBOOK_APMEMU +#endif /* OMNIBOOK_STANDALONE */ + +/* End of file */ diff --git a/onetouch.c b/onetouch.c new file mode 100644 index 0000000..9977fae --- /dev/null +++ b/onetouch.c @@ -0,0 +1,182 @@ +/* + * onetouch.c -- code to handling OneTouch buttons + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +/* There is no information about reading OneTouch status */ +int omnibook_onetouch_enabled = 0; + +static int omnibook_onetouch_on(void) +{ + if (omnibook_kbc_command + (OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_ONETOUCH_ENABLE)) { + printk(KERN_ERR "%s: failed OneTouch enable command.\n", + OMNIBOOK_MODULE_NAME); + return -EIO; + } + return 0; +} + +static int omnibook_onetouch_off(void) +{ + if (omnibook_kbc_command + (OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_ONETOUCH_DISABLE)) { + printk(KERN_ERR "%s: failed OneTouch disable command.\n", + OMNIBOOK_MODULE_NAME); + return -EIO; + } + return 0; +} + +/* + * Power management handlers + */ +static int omnibook_onetouch_resume(void) +{ + int retval; + retval = (omnibook_onetouch_enabled ? omnibook_onetouch_on() : 0); + return retval; +} + +static int omnibook_onetouch_suspend(void) +{ + int retval; + retval = (omnibook_onetouch_enabled ? omnibook_onetouch_off() : 0); + return retval; +} + +static int omnibook_onetouch_enable(void) +{ + /* + * XE3GF + * XE3GC + * OB500 + * OB510 + * OB6000 + * OB6100 + * XE4500 + * AMILOD + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE4500|AMILOD|TSP10|TSM30X) ) { + if (!omnibook_onetouch_enabled) { + if (omnibook_onetouch_on()) + return -EIO; + omnibook_onetouch_enabled = 1; + printk(KERN_INFO + "%s: OneTouch buttons (if any) are enabled.\n", + OMNIBOOK_MODULE_NAME); + } + } else { + omnibook_onetouch_enabled = 0; + return -ENODEV; + } + return 0; +} + +static int omnibook_onetouch_disable(void) +{ + /* + * XE3GF + * XE3GC + * OB500 + * OB510 + * OB6000 + * OB6100 + * XE4500 + * AMILOD + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE4500|AMILOD|TSP10|TSM30X) ) { + if (omnibook_onetouch_enabled) { + if (omnibook_onetouch_off()) { + return -EIO; + } + omnibook_onetouch_enabled = 0; + printk(KERN_INFO + "%s: OneTouch buttons (if any) are disabled.\n", + OMNIBOOK_MODULE_NAME); + } + } else { + omnibook_onetouch_enabled = 0; + return -ENODEV; + } + return 0; +} + +static int omnibook_onetouch_read(char *buffer) +{ + int len = 0; + + len += + sprintf(buffer + len, "OneTouch buttons are %s\n", + (omnibook_onetouch_enabled) ? "enabled" : "disabled"); + + return len; +} + +static int omnibook_onetouch_write(char *buffer) +{ + switch (*buffer) { + case '0': + omnibook_onetouch_disable(); + break; + case '1': + omnibook_onetouch_enable(); + break; + default: + return -EINVAL; + } + return 0; +} + +static int __init omnibook_onetouch_init(void) +{ + int retval; + + if ((retval = omnibook_onetouch_enable())) + return retval; + return 0; +} + +static void __exit omnibook_onetouch_cleanup(void) +{ + omnibook_onetouch_disable(); +} + +struct omnibook_feature onetouch_feature = { + .name = "onetouch", + .enabled = 1, + .read = omnibook_onetouch_read, + .write = omnibook_onetouch_write, + .init = omnibook_onetouch_init, + .exit = omnibook_onetouch_cleanup, + .suspend = omnibook_onetouch_suspend, + .resume = omnibook_onetouch_resume, + .ectypes = XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE4500|AMILOD|TSP10|TSM30X, +}; + +module_param_named(onetouch, onetouch_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(onetouch, "Use 0 to disable, 1 to enable onetouch handling"); +/* End of file */ diff --git a/temperature.c b/temperature.c new file mode 100644 index 0000000..6572867 --- /dev/null +++ b/temperature.c @@ -0,0 +1,100 @@ +/* + * temperature.c -- CPU temprature monitoring + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +static int omnibook_get_cpu_temp(void) +{ + u8 temp = 0; + int retval; + /* + * XE3GF + * TSP10 + * TSM30X + */ + if (omnibook_ectype & (XE3GF|TSP10|TSM30X) ) { + if ((retval = omnibook_ec_read(XE3GF_CTMP, &temp))) + return retval; + retval = temp; + /* + * XE3GC + * AMILOD + */ + } else if (omnibook_ectype & (XE3GC|AMILOD) ) { + if ((retval = omnibook_ec_read(XE3GC_CTMP, &temp))) + return retval; + retval = temp; + /* + * OB500 + * OB510 + * OB6000 + * OB6100 + * XE4500 + * XE2 + */ + } else if (omnibook_ectype & (OB500|OB510|OB6000|OB6100|XE4500|XE2) ) { + if ((retval = omnibook_ec_read(OB500_CTMP, &temp))) + return retval; + retval = temp; + /* + * OB4150 + */ + } else if (omnibook_ectype & (OB4150) ) { + + if ((retval = omnibook_ec_read(OB4150_TMP, &temp))) + return retval; + retval = temp; + } else { + printk(KERN_INFO + "%s: Temperature monitoring is unsupported on this machine.\n", + OMNIBOOK_MODULE_NAME); + retval = -ENODEV; + } + return retval; +} + +int omnibook_temperature_read(char *buffer) +{ + int len = 0; + int cpu_temp; + + cpu_temp = omnibook_get_cpu_temp(); + if (cpu_temp < 0) + return cpu_temp; + + len += + sprintf(buffer + len, "CPU temperature: %2d C\n", + cpu_temp); + + return len; +} + +struct omnibook_feature temperature_feature = { + .name = "temperature", + .enabled = 1, + .read = omnibook_temperature_read, + .ectypes = XE3GF|XE3GC|OB500|OB510|OB6000|OB6100|XE4500|OB4150|XE2|AMILOD|TSP10|TSM30X, +}; + +module_param_named(temperature, temperature_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(temperature, "Use 0 to disable, 1 to enable thermal status and policy support"); +/* End of file */ diff --git a/touchpad.c b/touchpad.c new file mode 100644 index 0000000..7f84feb --- /dev/null +++ b/touchpad.c @@ -0,0 +1,167 @@ +/* + * touchpad.c -- enable/disable touchpad + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Soós Péter , 2002-2004 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +/* Touchpad is enabled by default */ +int omnibook_touchpad_enabled = 1; + +static int omnibook_touchpad_on(void) +{ + if (omnibook_kbc_command + (OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_TOUCHPAD_ENABLE)) { + printk(KERN_ERR "%s: failed touchpad enable command.\n", + OMNIBOOK_MODULE_NAME); + return -EIO; + } + return 0; +} + +static int omnibook_touchpad_off(void) +{ + if (omnibook_kbc_command + (OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_TOUCHPAD_DISABLE)) { + printk(KERN_ERR "%s: failed touchpad disable command.\n", + OMNIBOOK_MODULE_NAME); + return -EIO; + } + return 0; +} + +/* + * Power management handlers: redisable touchpad on resume + */ +int omnibook_touchpad_resume(void) +{ + int retval; + retval = (omnibook_touchpad_enabled ? 0 : omnibook_touchpad_off()); + return retval; +} + +static int omnibook_touchpad_enable(void) +{ + /* + * XE3GF + * XE3GC + * TSP10 + */ + if (omnibook_ectype & (XE3GF|XE3GC|TSP10) ) { + + if (!omnibook_touchpad_enabled) { + if (omnibook_touchpad_on()) + return -EIO; + omnibook_touchpad_enabled = 1; + printk(KERN_INFO "%s: Touchpad is enabled.\n", + OMNIBOOK_MODULE_NAME); + } + /* + * These models have stickpointer, not touchpad: + * OB500 + * OB510 + */ + } else if (omnibook_ectype & (OB500|OB510) ) { + + omnibook_touchpad_enabled = 0; + return -ENODEV; + } else { + omnibook_touchpad_enabled = 1; + return -ENODEV; + } + return 0; +} + +static int omnibook_touchpad_disable(void) +{ + /* + * XE3GF + * XE3GC + * TSP10 + */ + if (omnibook_ectype & (XE3GF|XE3GC|TSP10) ) { + if (omnibook_touchpad_enabled) { + if (omnibook_touchpad_off()) { + return -EIO; + } + omnibook_touchpad_enabled = 0; + printk(KERN_INFO "%s: Touchpad is disabled.\n", + OMNIBOOK_MODULE_NAME); + } + /* + * These models have stickpointer, not touchpad: + * OB500 + * OB510 + */ + } else if (omnibook_ectype & (OB500|OB510) ) { + omnibook_touchpad_enabled = 0; + return -ENODEV; + } else { + omnibook_touchpad_enabled = 1; + return -ENODEV; + } + return 0; +} + +static int omnibook_touchpad_read(char *buffer) +{ + int len = 0; + + len += + sprintf(buffer + len, "Touchpad is %s\n", + (omnibook_touchpad_enabled) ? "enabled" : "disabled"); + + return len; +} + +static int omnibook_touchpad_write(char *buffer) +{ + switch (*buffer) { + case '0': + omnibook_touchpad_disable(); + break; + case '1': + omnibook_touchpad_enable(); + break; + default: + return -EINVAL; + } + return 0; +} + +static void __exit omnibook_touchpad_cleanup(void) +{ + omnibook_touchpad_enable(); +} + +struct omnibook_feature touchpad_feature = { + .name = "touchpad", + .enabled = 1, + .read = omnibook_touchpad_read, + .write = omnibook_touchpad_write, + .exit = omnibook_touchpad_cleanup, + .resume = omnibook_touchpad_resume, + .ectypes = XE3GF|XE3GC|TSP10, +}; + +module_param_named(touchpad, touchpad_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(touchpad, "Use 0 to disable, 1 to enable touchpad handling"); + +/* End of file */ diff --git a/watch.c b/watch.c new file mode 100644 index 0000000..f34b558 --- /dev/null +++ b/watch.c @@ -0,0 +1,102 @@ +/* + * watch.c - Watch a specific ioport/iomem/ec register + * + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * Written by Mathieu Bérard , 2006 + */ + +#ifdef OMNIBOOK_STANDALONE +#include "omnibook.h" +#else +#include +#endif + +#include "ec.h" + +enum { + BAD, + EC, + PIO, + MMIO, +}; + +static u32 addr = 0; +static int addr_type = BAD; + +static int watch_read(char *buffer) +{ + int len = 0; + u8 v; + + switch (addr_type) { + case BAD: + len += sprintf(buffer + len, "Please first write to this file and address to watch\n"); + len += sprintf(buffer + len, "ex: 'TYPE 0x2f' where TYPE={EC,PIO,MMIO}\n"); + return len; + case EC: + omnibook_ec_read((u8) addr, &v); + break; + case PIO: + omnibook_io_read(addr, &v); + break; + case MMIO: + omnibook_mem_read(addr, &v); + break; + } + len += sprintf(buffer + len, "%02x\n",v ); + + return len; +} + +static int watch_write(char *buffer) +{ + int retval; + u32 value; + char type[5]; + + retval = sscanf(buffer, "%4s%x", type, &value); + + if (retval != 2) + return -EINVAL; + + if (strncmp(type,"EC",2) == 0) + addr_type = EC; + else if (strncmp(type,"PIO",3) == 0) + addr_type = PIO; + else if (strncmp(type,"MMIO",4) == 0) + addr_type = MMIO; + else + return -EINVAL; + + if ((value > 0xff) && (addr_type == EC)) + return -EINVAL; + else if ((value > 0xffff) && (addr_type == PIO)) + return -EINVAL; + else + addr = value; + + return 0; +} + +struct omnibook_feature watch_feature = { + .name = "watch", + .enabled = 0, + .read = watch_read, + .write = watch_write, +}; + + +module_param_named(watch, watch_feature.enabled, int, S_IRUGO); +MODULE_PARM_DESC(watch, "Use 0 to disable, 1 to enable register watching (DANGEROUS)"); + +/* End of file */ -- 2.43.5