1 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/arch/i386/Kconfig linux-2.6.1-gentoo-test/arch/i386/Kconfig
2 --- linux-2.6.1-gentoo/arch/i386/Kconfig 2004-01-09 23:40:12.000000000 +0000
3 +++ linux-2.6.1-gentoo-test/arch/i386/Kconfig 2004-01-09 22:33:09.000000000 +0000
5 Say Y if you intend to run this kernel on a Dell Inspiron 8000.
9 + tristate "HP Omnibook Support"
12 tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
14 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/arch/i386/kernel/cpu/cpufreq/powernow-k7.c linux-2.6.1-gentoo-test/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
15 --- linux-2.6.1-gentoo/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-01-09 23:40:12.000000000 +0000
16 +++ linux-2.6.1-gentoo-test/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2004-01-09 22:32:23.000000000 +0000
19 etuple |= (c->x86_model<<4)|(c->x86_mask);
21 + if (etuple == 0x7a0) { etuple = 0x781; }
23 for (i=0xC0000; i < 0xffff0 ; i+=16) {
26 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/Makefile linux-2.6.1-gentoo-test/drivers/char/Makefile
27 --- linux-2.6.1-gentoo/drivers/char/Makefile 2004-01-09 23:40:12.000000000 +0000
28 +++ linux-2.6.1-gentoo-test/drivers/char/Makefile 2004-01-09 22:33:09.000000000 +0000
31 obj-$(CONFIG_TOSHIBA) += toshiba.o
32 obj-$(CONFIG_I8K) += i8k.o
33 +obj-$(CONFIG_OMNIBOOK) += omnibook/
34 obj-$(CONFIG_DS1620) += ds1620.o
35 obj-$(CONFIG_HW_RANDOM) += hw_random.o
36 obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
37 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/drm/radeon_drv.h linux-2.6.1-gentoo-test/drivers/char/drm/radeon_drv.h
38 --- linux-2.6.1-gentoo/drivers/char/drm/radeon_drv.h 2004-01-09 23:40:12.000000000 +0000
39 +++ linux-2.6.1-gentoo-test/drivers/char/drm/radeon_drv.h 2004-01-09 22:32:40.000000000 +0000
42 drm_radeon_depth_clear_t depth_clear;
44 + unsigned long fb_base;
45 unsigned long fb_offset;
46 unsigned long mmio_offset;
47 unsigned long ring_offset;
50 wait_queue_head_t swi_queue;
53 } drm_radeon_private_t;
55 typedef struct drm_radeon_buf_priv {
56 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/drm/radeon_state.c linux-2.6.1-gentoo-test/drivers/char/drm/radeon_state.c
57 --- linux-2.6.1-gentoo/drivers/char/drm/radeon_state.c 2004-01-09 23:40:12.000000000 +0000
58 +++ linux-2.6.1-gentoo-test/drivers/char/drm/radeon_state.c 2004-01-09 22:32:40.000000000 +0000
60 OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) );
61 OUT_RING( tex[0].pp_txfilter );
62 OUT_RING( tex[0].pp_txformat );
63 - OUT_RING( tex[0].pp_txoffset );
64 + OUT_RING( tex[0].pp_txoffset + dev_priv->fb_base);
65 OUT_RING( tex[0].pp_txcblend );
66 OUT_RING( tex[0].pp_txablend );
67 OUT_RING( tex[0].pp_tfactor );
69 OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) );
70 OUT_RING( tex[1].pp_txfilter );
71 OUT_RING( tex[1].pp_txformat );
72 - OUT_RING( tex[1].pp_txoffset );
73 + OUT_RING( tex[1].pp_txoffset + dev_priv->fb_base);
74 OUT_RING( tex[1].pp_txcblend );
75 OUT_RING( tex[1].pp_txablend );
76 OUT_RING( tex[1].pp_tfactor );
78 OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) );
79 OUT_RING( tex[2].pp_txfilter );
80 OUT_RING( tex[2].pp_txformat );
81 - OUT_RING( tex[2].pp_txoffset );
82 + OUT_RING( tex[2].pp_txoffset + dev_priv->fb_base);
83 OUT_RING( tex[2].pp_txcblend );
84 OUT_RING( tex[2].pp_txablend );
85 OUT_RING( tex[2].pp_tfactor );
87 RADEON_GMC_CLR_CMP_CNTL_DIS |
88 RADEON_GMC_WR_MSK_DIS);
90 - buffer[2] = (tex->pitch << 22) | (tex->offset >> 10);
91 + buffer[2] = (tex->pitch << 22) | ((tex->offset + dev_priv->fb_base) >> 10);
92 buffer[3] = 0xffffffff;
93 buffer[4] = 0xffffffff;
94 buffer[5] = (image->y << 16) | image->x;
95 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/Makefile linux-2.6.1-gentoo-test/drivers/char/omnibook/Makefile
96 --- linux-2.6.1-gentoo/drivers/char/omnibook/Makefile 1970-01-01 01:00:00.000000000 +0100
97 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/Makefile 2004-01-09 22:33:10.000000000 +0000
100 +# Makefile -- makefile for the HP OmniBook support module
102 +# This program is free software; you can redistribute it and/or modify it
103 +# under the terms of the GNU General Public License as published by the
104 +# Free Software Foundation; either version 2, or (at your option) any
107 +# This program is distributed in the hope that it will be useful, but
108 +# WITHOUT ANY WARRANTY; without even the implied warranty of
109 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
110 +# General Public License for more details.
112 +# Written by Soós Péter <sp@osb.hu>, 2002,2003
114 +# Note! Dependencies are done automagically by 'make dep', which also
115 +# removes any old dependencies. DON'T put your own dependencies here
116 +# unless it's something special (ie not a .c file).
118 +# Note 2! The CFLAGS definitions are now in the main makefile...
120 +#export-objs := ac.o battery.o blank.o display.o dmi.o dock.o fan.o \
121 + fan_policy.o init.o lcd.o onetouch.o polling.o temperature.o \
124 +#O_TARGET := omnibook.o
126 +#obj-y := ac.o apmemu.o battery.o blank.o dmi.o display.o dock.o ec.o \
127 + fan.o fan_policy.o init.o lcd.o onetouch.o polling.o \
128 + temperature.o touchpad.o util.o
129 +#obj-m := $(O_TARGET)
131 +#include $(TOPDIR)/Rules.make
133 +obj-$(CONFIG_OMNIBOOK) += omnibook.o
135 +omnibook-objs := ac.o apmemu.o battery.o blank.o dmi.o display.o dock.o ec.o fan.o fan_policy.o init.o lcd.o onetouch.o temperature.o touchpad.o util.o
136 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/ac.c linux-2.6.1-gentoo-test/drivers/char/omnibook/ac.c
137 --- linux-2.6.1-gentoo/drivers/char/omnibook/ac.c 1970-01-01 01:00:00.000000000 +0100
138 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/ac.c 2004-01-09 22:33:49.000000000 +0000
141 + * ac.c -- AC adapter related functions
143 + * This program is free software; you can redistribute it and/or modify it
144 + * under the terms of the GNU General Public License as published by the
145 + * Free Software Foundation; either version 2, or (at your option) any
148 + * This program is distributed in the hope that it will be useful, but
149 + * WITHOUT ANY WARRANTY; without even the implied warranty of
150 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
151 + * General Public License for more details.
153 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
157 +#include <linux/config.h>
158 +#include <linux/module.h>
159 +#include <linux/version.h>
160 +#include <linux/types.h>
161 +#include <linux/init.h>
162 +#include <linux/proc_fs.h>
164 +#include <asm/system.h>
165 +#include <asm/errno.h>
167 +#include <asm/uaccess.h>
169 +#ifdef OMNIBOOK_STANDALONE
170 +#include "omnibook.h"
172 +#include <linux/omnibook.h>
178 +static struct proc_dir_entry *proc_ac;
180 +int omnibook_get_ac(void)
185 + switch (omnibook_ectype) {
187 + if ((retval = omnibook_ec_read(XE3GF_ADP, &ac)))
189 + retval = (ac & XE3GF_ADP_MASK) ? 1 : 0;
192 + if ((retval = omnibook_ec_read(XE3GC_STA1, &ac)))
194 + retval = (ac & XE3GC_ADP_MASK) ? 1 : 0;
201 + if ((retval = omnibook_ec_read(OB500_STA2, &ac)))
203 + retval = (ac & OB500_ADP_MASK) ? 1 : 0;
206 + if ((retval = omnibook_ec_read(OB4150_ADP, &ac)))
208 + retval = (ac & OB4150_ADP_MASK) ? 1 : 0;
211 + if ((retval = omnibook_ec_read(XE2_STA1, &ac)))
213 + retval = (ac & XE2_ADP_MASK) ? 1 : 0;
216 + printk(KERN_INFO "%s: AC adapter status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
222 +static int omnibook_proc_ac(char *buffer, char **start, off_t off, int count, int *eof, void *data)
227 + ac = omnibook_get_ac();
231 + b += sprintf(b, "AC %s\n", (ac) ? "on-line" : "off-line");
233 + return omnibook_proc_len(buffer, start, off, count, eof, b);
236 +int __init omnibook_ac_init(void)
240 + switch (omnibook_ectype) {
250 + pmode = S_IFREG | S_IRUGO;
251 + proc_ac = create_proc_read_entry("ac", pmode, omnibook_proc_root, omnibook_proc_ac, NULL);
254 + printk(KERN_INFO "%s: AC adapter status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
258 + printk(KERN_ERR "%s: Unable to create /proc/%s/ac.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
261 + printk(KERN_INFO "%s: AC adapter status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
265 +void __exit omnibook_ac_cleanup(void)
268 + remove_proc_entry("ac", omnibook_proc_root);
271 +EXPORT_SYMBOL(omnibook_get_ac);
274 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/apmemu.c linux-2.6.1-gentoo-test/drivers/char/omnibook/apmemu.c
275 --- linux-2.6.1-gentoo/drivers/char/omnibook/apmemu.c 1970-01-01 01:00:00.000000000 +0100
276 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/apmemu.c 2004-01-09 22:33:49.000000000 +0000
279 + * apmemu.c -- /proc/apm emulation
281 + * This program is free software; you can redistribute it and/or modify it
282 + * under the terms of the GNU General Public License as published by the
283 + * Free Software Foundation; either version 2, or (at your option) any
286 + * This program is distributed in the hope that it will be useful, but
287 + * WITHOUT ANY WARRANTY; without even the implied warranty of
288 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
289 + * General Public License for more details.
291 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
295 +#include <linux/config.h>
296 +#include <linux/module.h>
297 +#include <linux/version.h>
298 +#include <linux/types.h>
299 +#include <linux/init.h>
300 +#include <linux/proc_fs.h>
303 +#include <linux/apm_bios.h>
306 +#include <asm/system.h>
307 +#include <asm/errno.h>
309 +#include <asm/uaccess.h>
311 +#ifdef OMNIBOOK_STANDALONE
312 +#include "omnibook.h"
314 +#include <linux/omnibook.h>
320 +static struct proc_dir_entry *proc_apmemu;
322 +/* Arguments, with symbols from linux/apm_bios.h. Information is
323 + from the Get Power Status (0x0a) call unless otherwise noted.
324 + 0) Linux driver version (this will change if format changes)
325 + 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
326 + 2) APM flags from APM Installation Check (0x00):
327 + bit 0: APM_16_BIT_SUPPORT
328 + bit 1: APM_32_BIT_SUPPORT
329 + bit 2: APM_IDLE_SLOWS_CLOCK
330 + bit 3: APM_BIOS_DISABLED
331 + bit 4: APM_BIOS_DISENGAGED
335 + 0x02: On backup power (BIOS >= 1.1 only)
342 + 0x04: Selected battery not present (BIOS >= 1.2 only)
349 + bit 7: No system battery
351 + 6) Remaining battery life (percentage of charge):
354 + 7) Remaining battery life (time units):
355 + Number of remaining minutes or seconds
357 + 8) min = minutes; sec = seconds */
359 +static int omnibook_proc_apmemu(char *buffer, char **start, off_t off, int count)
365 + struct omnibook_battery_status battstat;
367 + struct apm_features {
379 + struct apm_features apm = {
380 + APMEMU_DRIVER_VERSION,
381 + APMEMU_APM_VERSION,
382 + APMEMU_32_BIT_SUPPORT | APMEMU_BIOS_DISABLED,
384 + APMEMU_BATTSTAT_UNKN,
386 + APMEMU_BATTLIFE_UNKN,
387 + APMEMU_BATTLIFE_UNKN,
391 + ac = omnibook_get_ac();
392 + apm.ac = (ac) ? APMEMU_AC_ONLINE : APMEMU_AC_OFFLINE;
393 + /* Asking for Battery 0 as APM does */
394 + retval = omnibook_get_battery_status(0, &battstat);
396 + apm.gauge = battstat.gauge;
397 + if (apm.gauge >= APMEMU_BATTERY_LOW) {
398 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_HIGH;
399 + apm.battstat = APMEMU_BATTSTAT_HIGH;
401 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_LOW;
402 + apm.battstat = APMEMU_BATTSTAT_LOW;
404 + if (battstat.status == OMNIBOOK_BATTSTAT_CHARGING) {
405 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_CHR;
406 + apm.battstat = APMEMU_BATTSTAT_CHR;
408 + if (battstat.status == OMNIBOOK_BATTSTAT_CRITICAL) {
409 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_CRIT;
410 + apm.battstat = APMEMU_BATTSTAT_CRIT;
413 + b += sprintf(b, "%s %s 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
428 +int __init omnibook_apmemu_init(void)
432 + switch (omnibook_ectype) {
436 + if (! apm_info.disabled) {
437 + printk(KERN_NOTICE "%s: Real APM support is present, emulation is not necessary.\n", OMNIBOOK_MODULE_NAME);
441 + pmode = S_IFREG | S_IRUGO;
442 + proc_apmemu = create_proc_info_entry("apm", pmode, NULL, omnibook_proc_apmemu);
445 + printk(KERN_INFO "%s: /proc/apm emulation is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
448 + if (! proc_apmemu) {
449 + printk(KERN_ERR "%s: Unable to create /proc/apm.\n", OMNIBOOK_MODULE_NAME);
452 + printk(KERN_INFO "%s: /proc/apm emulation enabled.\n", OMNIBOOK_MODULE_NAME);
456 +void __exit omnibook_apmemu_cleanup(void)
459 + remove_proc_entry("apm", NULL);
460 + printk(KERN_INFO "%s: /proc/apm emulation disabled.\n", OMNIBOOK_MODULE_NAME);
465 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/apmemu.h linux-2.6.1-gentoo-test/drivers/char/omnibook/apmemu.h
466 --- linux-2.6.1-gentoo/drivers/char/omnibook/apmemu.h 1970-01-01 01:00:00.000000000 +0100
467 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/apmemu.h 2004-01-09 22:33:49.000000000 +0000
470 + * apmemu.c -- code to emulate /proc/apm
472 + * This program is free software; you can redistribute it and/or modify it
473 + * under the terms of the GNU General Public License as published by the
474 + * Free Software Foundation; either version 2, or (at your option) any
477 + * This program is distributed in the hope that it will be useful, but
478 + * WITHOUT ANY WARRANTY; without even the implied warranty of
479 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
480 + * General Public License for more details.
482 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
486 +#define APMEMU_DRIVER_VERSION "1.16"
487 +#define APMEMU_APM_VERSION "1.2"
489 +#define APMEMU_BATTERY_LOW 30 /* Battery low threshold */
491 +#define APMEMU_16_BIT_SUPPORT 0x01 /* 16 bit APM BIOS */
492 +#define APMEMU_32_BIT_SUPPORT 0x02 /* 32 bit APM BIOS */
493 +#define APMEMU_IDLE_SLOWS_CLOCK 0x04
494 +#define APMEMU_BIOS_DISABLED 0x08 /* APM BIOS disabled */
495 +#define APMEMU_BIOS_DISENGAGED 0x10 /* APM BIOS disengaged */
497 +#define APMEMU_AC_OFFLINE 0x00 /* AC offline */
498 +#define APMEMU_AC_ONLINE 0x01 /* AC online */
499 +#define APMEMU_AC_BACKUP 0x02 /* On backup power */
500 +#define APMEMU_AC_UNKNOWN 0xFF /* Unkonwn status */
502 +#define APMEMU_BATTSTAT_HIGH 0x00 /* Remaining battery capacity is high */
503 +#define APMEMU_BATTSTAT_LOW 0x01 /* Remaining battery capacity is low */
504 +#define APMEMU_BATTSTAT_CRIT 0x02 /* Battery status is critical */
505 +#define APMEMU_BATTSTAT_CHR 0x03 /* Battery is charging */
506 +#define APMEMU_BATTSTAT_MISS 0x04 /* Battery is not present */
508 +#define APMEMU_BATTFLAG_HIGH 0x01 /* Remaining battery capacity is high bit */
509 +#define APMEMU_BATTFLAG_LOW 0x02 /* Remaining battery capacity is low bit */
510 +#define APMEMU_BATTFLAG_CRIT 0x04 /* Battery status is critical bit */
511 +#define APMEMU_BATTFLAG_CHR 0x08 /* Battery is charging bit */
512 +#define APMEMU_BATTFLAG_MISS 0x80 /* Battery is not present bit */
514 +#define APMEMU_BATTSTAT_UNKN 0xff /* Status is unknown */
516 +#define APMEMU_BATTLIFE_UNKN -1 /* Remaining battery capacity is unknown */
517 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/battery.c linux-2.6.1-gentoo-test/drivers/char/omnibook/battery.c
518 --- linux-2.6.1-gentoo/drivers/char/omnibook/battery.c 1970-01-01 01:00:00.000000000 +0100
519 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/battery.c 2004-01-09 22:33:49.000000000 +0000
522 + * battery.c -- battery related functions
524 + * This program is free software; you can redistribute it and/or modify it
525 + * under the terms of the GNU General Public License as published by the
526 + * Free Software Foundation; either version 2, or (at your option) any
529 + * This program is distributed in the hope that it will be useful, but
530 + * WITHOUT ANY WARRANTY; without even the implied warranty of
531 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
532 + * General Public License for more details.
534 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
538 +#include <linux/config.h>
539 +#include <linux/module.h>
540 +#include <linux/version.h>
541 +#include <linux/types.h>
542 +#include <linux/init.h>
543 +#include <linux/proc_fs.h>
545 +#include <asm/system.h>
546 +#include <asm/errno.h>
548 +#include <asm/uaccess.h>
550 +#ifdef OMNIBOOK_STANDALONE
551 +#include "omnibook.h"
553 +#include <linux/omnibook.h>
559 +static struct proc_dir_entry *proc_battery;
561 +int omnibook_battery_present(int num)
568 + switch (omnibook_ectype) {
572 + if ((retval = omnibook_ec_read(XE3GF_BAL, &bat)))
574 + mask = XE3GF_BAL0_MASK;
575 + for (i = 0; i < num; i++)
581 + if ((retval = omnibook_ec_read(XE3GC_BAT, &bat)))
583 + mask = XE3GC_BAT0_MASK;
584 + for (i = 0; i < num; i++)
588 + return (bat & mask) ? 1 : 0;
592 + * Get static battery information
593 + * All info have to be reread every time because battery sould be cahnged
594 + * when laptop is on AC power
598 + * 1 - Battery is not present
599 + * 2 - Not supported
601 +int omnibook_get_battery_info(int num, struct omnibook_battery_info *battinfo)
606 + switch (omnibook_ectype) {
609 + retval = omnibook_battery_present(num);
613 + if ((retval = omnibook_ec_read(XE3GF_BTY0 + (offset * num), &(*battinfo).type)))
615 + if ((retval = omnibook_ec_read16(XE3GF_BSN0 + (offset * num), &(*battinfo).sn)))
617 + if ((retval = omnibook_ec_read16(XE3GF_BDV0 + (offset * num), &(*battinfo).dv)))
619 + if ((retval = omnibook_ec_read16(XE3GF_BDC0 + (offset * num), &(*battinfo).dc)))
622 + (*battinfo).type = ((*battinfo).type & XE3GF_BTY_MASK) ? 1 : 0;
628 + retval = omnibook_battery_present(num);
632 + if ((retval = omnibook_ec_read16(XE3GC_BDV0 + (offset * num), &(*battinfo).dv)))
634 + if ((retval = omnibook_ec_read16(XE3GC_BDC0 + (offset * num), &(*battinfo).dc)))
636 + if ((retval = omnibook_ec_read(XE3GC_BTY0 + (offset * num), &(*battinfo).type)))
639 + (*battinfo).type = ((*battinfo).type & XE3GC_BTY_MASK) ? 1 : 0;
640 + (*battinfo).sn = 0; /* Unknown */
677 + * Get battery status
681 + * 1 - Battery is not present
682 + * 2 - Not supported
684 +int omnibook_get_battery_status(int num, struct omnibook_battery_status *battstat)
692 + switch (omnibook_ectype) {
695 + retval = omnibook_battery_present(num);
699 + if ((retval = omnibook_ec_read(XE3GF_BST0 + (offset * num), &status)))
701 + if ((retval = omnibook_ec_read16(XE3GF_BRC0 + (offset * num), &(*battstat).rc)))
703 + if ((retval = omnibook_ec_read16(XE3GF_BPV0 + (offset * num), &(*battstat).pv)))
705 + if ((retval = omnibook_ec_read16(XE3GF_BFC0 + (offset * num), &(*battstat).lc)))
707 + if ((retval = omnibook_ec_read(XE3GF_GAU0 + (offset * num), &(*battstat).gauge)))
710 + if (status & XE3GF_BST_MASK_CRT)
711 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
712 + else if (status & XE3GF_BST_MASK_CHR)
713 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
714 + else if (status & XE3GF_BST_MASK_DSC)
715 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
716 + else if (status & (XE3GF_BST_MASK_CHR | XE3GF_BST_MASK_DSC))
717 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
719 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
726 + retval = omnibook_battery_present(num);
730 + if ((retval = omnibook_ec_read(XE3GC_BST0 + (offset * num), &status)))
732 + if ((retval = omnibook_ec_read16(XE3GC_BRC0 + (offset * num), &(*battstat).rc)))
734 + if ((retval = omnibook_ec_read16(XE3GC_BPV0 + (offset * num), &(*battstat).pv)))
736 + if ((retval = omnibook_ec_read16(XE3GC_BDC0 + (offset * num), &dc)))
739 + if (status & XE3GC_BST_MASK_CRT)
740 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
741 + else if (status & XE3GC_BST_MASK_CHR)
742 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
743 + else if (status & XE3GC_BST_MASK_DSC)
744 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
745 + else if (status & (XE3GC_BST_MASK_CHR | XE3GC_BST_MASK_DSC))
746 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
748 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
750 + gauge = ((*battstat).rc * 100) / dc;
751 + (*battstat).gauge = gauge;
752 + (*battstat).lc = 0; /* Unknown */
759 + if ((retval = omnibook_ec_read(OB500_BT1S, &status)))
761 + if ((retval = omnibook_ec_read16(OB500_BT1C, &(*battstat).rc)))
763 + if ((retval = omnibook_ec_read16(OB500_BT1V, &(*battstat).pv)))
767 + if ((retval = omnibook_ec_read(OB500_BT2S, &status)))
769 + if ((retval = omnibook_ec_read16(OB500_BT2C, &(*battstat).rc)))
771 + if ((retval = omnibook_ec_read16(OB500_BT2V, &(*battstat).pv)))
775 + if ((retval = omnibook_ec_read(OB500_BT3S, &status)))
777 + if ((retval = omnibook_ec_read16(OB500_BT3C, &(*battstat).rc)))
779 + if ((retval = omnibook_ec_read16(OB500_BT3V, &(*battstat).pv)))
785 + if (status & OB500_BST_MASK_CRT)
786 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
787 + else if (status & OB500_BST_MASK_CHR)
788 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
789 + else if (status & OB500_BST_MASK_DSC)
790 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
791 + else if (status & (OB500_BST_MASK_CHR | OB500_BST_MASK_DSC))
792 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
794 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
802 + if ((retval = omnibook_ec_read(OB500_BT1S, &status)))
804 + if ((retval = omnibook_ec_read16(OB500_BT1C, &(*battstat).rc)))
806 + if ((retval = omnibook_ec_read16(OB500_BT1V, &(*battstat).pv)))
810 + if ((retval = omnibook_ec_read(OB500_BT3S, &status)))
812 + if ((retval = omnibook_ec_read16(OB500_BT3C, &(*battstat).rc)))
814 + if ((retval = omnibook_ec_read16(OB500_BT3V, &(*battstat).pv)))
820 + if (status & OB500_BST_MASK_CRT)
821 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
822 + else if (status & OB500_BST_MASK_CHR)
823 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
824 + else if (status & OB500_BST_MASK_DSC)
825 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
826 + else if (status & (OB500_BST_MASK_CHR | OB500_BST_MASK_DSC))
827 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
829 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
838 +static int omnibook_proc_battery(char *buffer, char **start, off_t off, int count, int *eof, void *data)
847 + struct omnibook_battery_info battinfo;
848 + struct omnibook_battery_status battstat;
850 + switch (omnibook_ectype) {
864 + for (i = 0; i < max; i++) {
865 + retval = omnibook_get_battery_info(i, &battinfo);
868 + omnibook_get_battery_status(i, &battstat);
869 + typestr = (battinfo.type) ? "Li-Ion" : "NiMH";
870 + switch (battstat.status) {
871 + case OMNIBOOK_BATTSTAT_CHARGED:
872 + statustr = "charged";
874 + case OMNIBOOK_BATTSTAT_DISCHARGING:
875 + statustr = "discharging";
877 + case OMNIBOOK_BATTSTAT_CHARGING:
878 + statustr = "charging";
880 + case OMNIBOOK_BATTSTAT_CRITICAL:
881 + statustr = "critical";
884 + statustr = "unknown";
887 + b += sprintf(b, "Battery: %11d\n", i);
888 + b += sprintf(b, "Type: %11s\n", typestr);
890 + b += sprintf(b, "Serial Number: %11d\n", battinfo.sn);
891 + b += sprintf(b, "Present Voltage: %11d mV\n", battstat.pv);
892 + b += sprintf(b, "Design Voltage: %11d mV\n", battinfo.dv);
893 + b += sprintf(b, "Remaining Capacity: %11d mAh\n", battstat.rc);
895 + b += sprintf(b, "Last Full Capacity: %11d mAh\n", battstat.lc);
896 + b += sprintf(b, "Design Capacity: %11d mAh\n", battinfo.dc);
897 + b += sprintf(b, "Gauge: %11d %%\n", battstat.gauge);
898 + b += sprintf(b, "Status: %11s\n", statustr);
899 + b += sprintf(b, "\n");
903 + b += sprintf(b, "No battery present\n");
905 + return omnibook_proc_len(buffer, start, off, count, eof, b);
908 +int __init omnibook_battery_init(void)
912 + switch (omnibook_ectype) {
921 + pmode = S_IFREG | S_IRUGO;
922 + proc_battery = create_proc_read_entry("battery", pmode, omnibook_proc_root, omnibook_proc_battery, NULL);
925 + printk(KERN_INFO "%s: Battery status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
928 + if (! proc_battery) {
929 + printk(KERN_ERR "%s: Unable to create /proc/%s/battery.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
932 + printk(KERN_INFO "%s: Battery status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
936 +void __exit omnibook_battery_cleanup(void)
939 + remove_proc_entry("battery", omnibook_proc_root);
942 +EXPORT_SYMBOL(omnibook_battery_present);
943 +EXPORT_SYMBOL(omnibook_get_battery_info);
944 +EXPORT_SYMBOL(omnibook_get_battery_status);
947 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/blank.c linux-2.6.1-gentoo-test/drivers/char/omnibook/blank.c
948 --- linux-2.6.1-gentoo/drivers/char/omnibook/blank.c 1970-01-01 01:00:00.000000000 +0100
949 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/blank.c 2004-01-09 22:33:49.000000000 +0000
952 + * blank.c -- blanking lcd console
954 + * This program is free software; you can redistribute it and/or modify it
955 + * under the terms of the GNU General Public License as published by the
956 + * Free Software Foundation; either version 2, or (at your option) any
959 + * This program is distributed in the hope that it will be useful, but
960 + * WITHOUT ANY WARRANTY; without even the implied warranty of
961 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
962 + * General Public License for more details.
964 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
968 +#include <linux/config.h>
969 +#include <linux/module.h>
970 +#include <linux/version.h>
971 +#include <linux/types.h>
972 +#include <linux/init.h>
973 +#include <linux/pm.h>
974 +#include <linux/proc_fs.h>
976 +#include <asm/system.h>
977 +#include <asm/errno.h>
979 +#include <asm/uaccess.h>
981 +#ifdef OMNIBOOK_STANDALONE
982 +#include "omnibook.h"
984 +#include <linux/omnibook.h>
990 +static struct proc_dir_entry *proc_blank;
991 +int omnibook_console_blank_enabled = 0;
993 +extern int (*console_blank_hook)(int);
996 + * Turn LCD display off at console blanking if APM does not do it
997 + * (e.g. using ACPI).
1000 +int omnibook_lcd_blank(int blank)
1006 + switch (omnibook_ectype) {
1009 + cmd = blank ? OMNIBOOK_KBC_CMD_LCD_OFF : OMNIBOOK_KBC_CMD_LCD_ON;
1010 + if ((retval = omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, cmd)))
1016 + if ((retval = omnibook_io_read(OB500_GPO1, &cmd)))
1018 + cmd = blank ? cmd & ~OB500_BKLT_MASK : cmd | OB500_BKLT_MASK;
1019 + if ((retval = omnibook_io_write(OB500_GPO1, cmd)))
1024 + if ((retval = omnibook_io_read(OB510_GPO2, &cmd)))
1026 + cmd = blank ? cmd & ~OB510_BKLT_MASK : cmd | OB510_BKLT_MASK;
1027 + if ((retval = omnibook_io_write(OB510_GPO2, cmd)))
1031 + printk(KERN_INFO "%s: LCD console blanking is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1038 +int omnibook_console_blank_enable(void)
1041 + if (omnibook_console_blank_enabled == 0) {
1042 + if (console_blank_hook == NULL) {
1043 + console_blank_hook = omnibook_lcd_blank;
1044 + printk(KERN_INFO "%s: LCD display turn off at console blanking enabled.\n", OMNIBOOK_MODULE_NAME);
1045 + omnibook_console_blank_enabled = 1;
1047 + printk(KERN_INFO "%s: There is a console blanking solution already registered.\n", OMNIBOOK_MODULE_NAME);
1054 +int omnibook_console_blank_disable(void)
1057 + if (console_blank_hook == omnibook_lcd_blank) {
1058 + console_blank_hook = NULL;
1059 + printk(KERN_INFO "%s: LCD display turn off at console blanking disabled.\n", OMNIBOOK_MODULE_NAME);
1060 + omnibook_console_blank_enabled = 0;
1061 + } else if (console_blank_hook) {
1062 + printk(KERN_WARNING "%s: You can not disable another console blanking solution.\n", OMNIBOOK_MODULE_NAME);
1065 + printk(KERN_INFO "%s: Console blanking already disabled.\n", OMNIBOOK_MODULE_NAME);
1072 +static int omnibook_console_blank_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
1076 + b += sprintf(b, "LCD console blanking is %s\n", (omnibook_console_blank_enabled) ? "enabled" : "disabled");
1078 + return omnibook_proc_len(buffer, start, off, count, eof, b);
1081 +static int omnibook_console_blank_set(struct file *file, const char *buffer, unsigned long count, void *data)
1083 + char status[1] = {'\0'};
1086 + if ((retval = copy_from_user(status, buffer, 1)))
1088 + switch (*status) {
1090 + if ((retval = omnibook_console_blank_disable()))
1094 + if ((retval = omnibook_console_blank_enable()))
1103 +int __init omnibook_console_blank_init(void)
1109 + switch (omnibook_ectype) {
1117 + if ((retval = omnibook_console_blank_enable()))
1119 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
1120 + if (omnibook_userset)
1121 + pmode = pmode | S_IWUGO;
1122 + proc_blank = create_proc_entry("blank", pmode, omnibook_proc_root);
1125 + printk(KERN_INFO "%s: LCD console blanking is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1130 + proc_blank->read_proc = omnibook_console_blank_status;
1131 + proc_blank->write_proc = omnibook_console_blank_set;
1133 + printk(KERN_ERR "%s: Unable to create /proc/%s/blank.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
1138 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
1143 +void __exit omnibook_console_blank_cleanup(void)
1147 + remove_proc_entry("blank", omnibook_proc_root);
1148 + omnibook_console_blank_disable();
1153 +EXPORT_SYMBOL(omnibook_console_blank_enabled);
1154 +EXPORT_SYMBOL(omnibook_lcd_blank);
1155 +EXPORT_SYMBOL(omnibook_console_blank_enable);
1156 +EXPORT_SYMBOL(omnibook_console_blank_disable);
1159 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/display.c linux-2.6.1-gentoo-test/drivers/char/omnibook/display.c
1160 --- linux-2.6.1-gentoo/drivers/char/omnibook/display.c 1970-01-01 01:00:00.000000000 +0100
1161 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/display.c 2004-01-09 22:33:49.000000000 +0000
1164 + * display.c -- external display related functions
1166 + * This program is free software; you can redistribute it and/or modify it
1167 + * under the terms of the GNU General Public License as published by the
1168 + * Free Software Foundation; either version 2, or (at your option) any
1171 + * This program is distributed in the hope that it will be useful, but
1172 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1173 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1174 + * General Public License for more details.
1176 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1180 +#include <linux/config.h>
1181 +#include <linux/module.h>
1182 +#include <linux/version.h>
1183 +#include <linux/types.h>
1184 +#include <linux/init.h>
1185 +#include <linux/proc_fs.h>
1187 +#include <asm/system.h>
1188 +#include <asm/errno.h>
1189 +#include <asm/io.h>
1190 +#include <asm/uaccess.h>
1192 +#ifdef OMNIBOOK_STANDALONE
1193 +#include "omnibook.h"
1195 +#include <linux/omnibook.h>
1201 +static struct proc_dir_entry *proc_display;
1203 +int omnibook_get_display(void)
1209 + switch (omnibook_ectype) {
1211 + if ((retval = omnibook_ec_read(XE3GF_STA1, &sta)))
1213 + retval = (sta & XE3GF_SHDD_MASK) ? 1 : 0;
1216 + if ((retval = omnibook_ec_read(XE3GC_STA1, &sta)))
1218 + retval = (sta & XE3GC_CRTI_MASK) ? 1 : 0;
1225 + if ((retval = omnibook_ec_read(OB500_STA1, &sta)))
1227 + retval = (sta & OB500_CRTS_MASK) ? 1 : 0;
1230 + if ((retval = omnibook_ec_read(OB4150_STA2, &sta)))
1232 + retval = (sta & OB4150_CRST_MASK) ? 1 : 0;
1235 + printk(KERN_INFO "%s: External display status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1242 +static int omnibook_proc_display(char *buffer, char **start, off_t off, int count, int *eof, void *data)
1247 + display = omnibook_get_display();
1251 + b += sprintf(b, "External display is %s\n", (display) ? "present" : "not present");
1253 + return omnibook_proc_len(buffer, start, off, count, eof, b);
1256 +int __init omnibook_display_init(void)
1261 + switch (omnibook_ectype) {
1270 + pmode = S_IFREG | S_IRUGO;
1271 + proc_display = create_proc_read_entry("display", pmode, omnibook_proc_root, omnibook_proc_display, NULL);
1274 + printk(KERN_INFO "%s: External display status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1277 + if (! proc_display) {
1278 + printk(KERN_ERR "%s: Unable to create /proc/%s/display.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
1281 + printk(KERN_INFO "%s: External display status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
1284 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
1289 +void __exit omnibook_display_cleanup(void)
1293 + remove_proc_entry("display", omnibook_proc_root);
1297 +EXPORT_SYMBOL(omnibook_get_display);
1300 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/dmi.c linux-2.6.1-gentoo-test/drivers/char/omnibook/dmi.c
1301 --- linux-2.6.1-gentoo/drivers/char/omnibook/dmi.c 1970-01-01 01:00:00.000000000 +0100
1302 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/dmi.c 2004-01-09 22:33:49.000000000 +0000
1305 + * dmi.c -- to get DMI information
1307 + * This code originally came from file arch/i386/kernel/dmi_scan.c from
1308 + * Linux kernel version 2.4.18
1310 + * This program is free software; you can redistribute it and/or modify it
1311 + * under the terms of the GNU General Public License as published by the
1312 + * Free Software Foundation; either version 2, or (at your option) any
1315 + * This program is distributed in the hope that it will be useful, but
1316 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1317 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1318 + * General Public License for more details.
1322 +#include <linux/config.h>
1323 +#include <linux/module.h>
1324 +#include <linux/version.h>
1325 +#include <linux/types.h>
1326 +#include <linux/kernel.h>
1327 +#include <linux/string.h>
1328 +#include <linux/init.h>
1329 +#include <linux/apm_bios.h>
1330 +#include <linux/slab.h>
1332 +#include <asm/io.h>
1333 +#include <asm/system.h>
1335 +#ifdef OMNIBOOK_STANDALONE
1336 +#include "omnibook.h"
1338 +#include <linux/omnibook.h>
1350 +static char * __init dmi_string(struct dmi_header *dm, u8 s)
1367 + * We have to be cautious here. We have seen BIOSes with DMI pointers
1368 + * pointing to completely the wrong place for example
1371 +static int __init dmi_table(u32 base, int len, int num, void (*decode)(struct dmi_header *))
1374 + struct dmi_header *dm;
1378 + buf = ioremap(base, len);
1385 + * Stop when we see all the items the table claimed to have
1386 + * OR we run off the end of the table (also happens)
1389 + while(i<num && data-buf+sizeof(struct dmi_header)<=len)
1391 + dm=(struct dmi_header *)data;
1393 + * We want to know the total length (formated area and strings)
1394 + * before decoding to make sure we won't run off the table in
1395 + * dmi_decode or dmi_string
1398 + while(data-buf<len-1 && (data[0] || data[1]))
1400 + if(data-buf<len-1)
1409 +inline static int __init dmi_checksum(u8 *buf)
1414 + for(a=0; a<15; a++)
1419 +static int __init dmi_iterate(void (*decode)(struct dmi_header *))
1424 +#ifdef CONFIG_SIMNOW
1426 + * Skip on x86/64 with simnow. Will eventually go away
1427 + * If you see this ifdef in 2.6pre mail me !
1432 + while( fp < 0xFFFFF)
1434 + isa_memcpy_fromio(buf, fp, 15);
1435 + if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
1437 + u16 num=buf[13]<<8|buf[12];
1438 + u16 len=buf[7]<<8|buf[6];
1439 + u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
1441 + if(dmi_table(base,len,num,decode)==0)
1449 +char *omnibook_dmi_ident[OMNIBOOK_STRING_MAX];
1452 + * Save a DMI string
1455 +static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
1457 + char *d = (char*)dm;
1458 + char *p = dmi_string(dm, d[string]);
1459 + if(p==NULL || *p == 0)
1461 + if (omnibook_dmi_ident[slot])
1463 + omnibook_dmi_ident[slot] = kmalloc(strlen(p)+1, GFP_KERNEL);
1464 + if(omnibook_dmi_ident[slot])
1465 + strcpy(omnibook_dmi_ident[slot], p);
1467 + printk(KERN_ERR "%s: dmi_save_ident: out of memory.\n", OMNIBOOK_MODULE_NAME);
1471 + * Process a DMI table entry. Right now all we care about are the BIOS
1472 + * and machine entries. For 2.5 we should pull the smbus controller info
1476 +static void __init dmi_decode(struct dmi_header *dm)
1481 + dmi_save_ident(dm, OMNIBOOK_BIOS_VENDOR, 4);
1482 + dmi_save_ident(dm, OMNIBOOK_BIOS_VERSION, 5);
1483 + dmi_save_ident(dm, OMNIBOOK_BIOS_DATE, 8);
1487 + dmi_save_ident(dm, OMNIBOOK_SYS_VENDOR, 4);
1488 + dmi_save_ident(dm, OMNIBOOK_PRODUCT_NAME, 5);
1489 + dmi_save_ident(dm, OMNIBOOK_PRODUCT_VERSION, 6);
1490 + dmi_save_ident(dm, OMNIBOOK_SERIAL_NUMBER, 7);
1493 + dmi_save_ident(dm, OMNIBOOK_BOARD_VENDOR, 4);
1494 + dmi_save_ident(dm, OMNIBOOK_BOARD_NAME, 5);
1495 + dmi_save_ident(dm, OMNIBOOK_BOARD_VERSION, 6);
1500 +int __init omnibook_dmi_scan_machine(void)
1502 + int err = dmi_iterate(dmi_decode);
1506 +EXPORT_SYMBOL(omnibook_dmi_ident);
1509 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/dmi.h linux-2.6.1-gentoo-test/drivers/char/omnibook/dmi.h
1510 --- linux-2.6.1-gentoo/drivers/char/omnibook/dmi.h 1970-01-01 01:00:00.000000000 +0100
1511 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/dmi.h 2004-01-09 22:33:49.000000000 +0000
1514 + * dmi.h -- code to get DMI information
1516 + * This code originally came from file arch/i386/kernel/dmi_scan.c from
1517 + * Linux kernel version 2.4.18
1519 + * This program is free software; you can redistribute it and/or modify it
1520 + * under the terms of the GNU General Public License as published by the
1521 + * Free Software Foundation; either version 2, or (at your option) any
1524 + * This program is distributed in the hope that it will be useful, but
1525 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1526 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1527 + * General Public License for more details.
1532 + OMNIBOOK_BIOS_VENDOR,
1533 + OMNIBOOK_BIOS_VERSION,
1534 + OMNIBOOK_BIOS_DATE,
1535 + OMNIBOOK_SYS_VENDOR,
1536 + OMNIBOOK_PRODUCT_NAME,
1537 + OMNIBOOK_PRODUCT_VERSION,
1538 + OMNIBOOK_SERIAL_NUMBER,
1539 + OMNIBOOK_BOARD_VENDOR,
1540 + OMNIBOOK_BOARD_NAME,
1541 + OMNIBOOK_BOARD_VERSION,
1542 + OMNIBOOK_STRING_MAX
1545 +extern char *omnibook_dmi_ident[OMNIBOOK_STRING_MAX];
1547 +extern int __init omnibook_dmi_scan_machine(void);
1550 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/dock.c linux-2.6.1-gentoo-test/drivers/char/omnibook/dock.c
1551 --- linux-2.6.1-gentoo/drivers/char/omnibook/dock.c 1970-01-01 01:00:00.000000000 +0100
1552 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/dock.c 2004-01-09 22:33:49.000000000 +0000
1555 + * dock.c -- docking station/port replicator support
1557 + * This program is free software; you can redistribute it and/or modify it
1558 + * under the terms of the GNU General Public License as published by the
1559 + * Free Software Foundation; either version 2, or (at your option) any
1562 + * This program is distributed in the hope that it will be useful, but
1563 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1564 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1565 + * General Public License for more details.
1567 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1571 +#include <linux/config.h>
1572 +#include <linux/module.h>
1573 +#include <linux/version.h>
1574 +#include <linux/types.h>
1575 +#include <linux/init.h>
1576 +#include <linux/pm.h>
1577 +#include <linux/proc_fs.h>
1579 +#include <asm/system.h>
1580 +#include <asm/errno.h>
1581 +#include <asm/io.h>
1582 +#include <asm/uaccess.h>
1584 +#ifdef OMNIBOOK_STANDALONE
1585 +#include "omnibook.h"
1587 +#include <linux/omnibook.h>
1593 +static struct proc_dir_entry *proc_dock;
1595 +int omnibook_get_dock(void)
1600 + switch (omnibook_ectype) {
1602 + if ((retval = omnibook_ec_read(XE3GF_CSPR, &dock)))
1604 + retval = (dock & XE3GF_CSPR_MASK) ? 1 : 0;
1610 + if ((retval = omnibook_ec_read(OB500_STA1, &dock)))
1612 + retval = (dock & OB500_DCKS_MASK) ? 1 : 0;
1615 + if ((retval = omnibook_ec_read(OB4150_DCID, &dock)))
1617 + retval = (dock) ? 1 : 0;
1620 + printk(KERN_INFO "%s: Docking station handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1627 +static int omnibook_dock_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
1632 + dock = omnibook_get_dock();
1636 + b += sprintf(b, "Laptop is %s\n", (dock) ? "docked" : "undocked");
1638 + return omnibook_proc_len(buffer, start, off, count, eof, b);
1641 +int __init omnibook_dock_init(void)
1645 + switch (omnibook_ectype) {
1652 + pmode = S_IFREG | S_IRUGO;
1653 + proc_dock = create_proc_read_entry("dock", pmode, omnibook_proc_root, omnibook_dock_status, NULL);
1656 + printk(KERN_INFO "%s: Docking station status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1660 + if (! proc_dock) {
1661 + printk(KERN_ERR "%s: Unable to create /proc/%s/dock.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
1664 + printk(KERN_INFO "%s: Docking station status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
1668 +void __exit omnibook_dock_cleanup(void)
1671 + remove_proc_entry("dock", omnibook_proc_root);
1674 +EXPORT_SYMBOL(omnibook_get_dock);
1677 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/ec.c linux-2.6.1-gentoo-test/drivers/char/omnibook/ec.c
1678 --- linux-2.6.1-gentoo/drivers/char/omnibook/ec.c 1970-01-01 01:00:00.000000000 +0100
1679 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/ec.c 2004-01-09 22:33:49.000000000 +0000
1682 + * ec.c -- low level functions to access Embedded Conrtroller,
1683 + * Keyboard Controller and system I/O ports or memory
1685 + * This program is free software; you can redistribute it and/or modify it
1686 + * under the terms of the GNU General Public License as published by the
1687 + * Free Software Foundation; either version 2, or (at your option) any
1690 + * This program is distributed in the hope that it will be useful, but
1691 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1692 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1693 + * General Public License for more details.
1695 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1699 +#include <linux/config.h>
1700 +#include <linux/types.h>
1701 +#include <linux/delay.h>
1702 +#include <linux/sched.h>
1704 +#ifdef CONFIG_ACPI_EC
1705 +#include <linux/acpi.h>
1706 +#ifdef ACPI_CA_VERSION
1707 +#if ACPI_CA_VERSION > 0x20021121
1708 +#define USE_ACPI_EC
1713 +#include <asm/io.h>
1718 + * Interrupt control
1721 +#ifdef CONFIG_SMP /* Are you ready for SMP laptops? Coming soon... ;) */
1722 +static spinlock_t omnibook_ec_lock = SPIN_LOCK_UNLOCKED;
1723 +#include <linux/spinlock.h>
1724 +#define omnibook_save_flags(x) spin_lock_irqsave(&omnibook_ec_lock, x)
1725 +#define omnibook_restore_flags(x) spin_unlock_irqrestore(&omnibook_ec_lock, x)
1727 +#include <linux/version.h>
1728 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28))
1729 +#define omnibook_save_flags(x) do { save_flags(x); cli(); } while (0)
1730 +#define omnibook_restore_flags(x) restore_flags(x)
1732 +#define omnibook_save_flags(x) local_irq_save(x)
1733 +#define omnibook_restore_flags(x) local_irq_restore(x)
1735 +#endif /* CONFIG_SMP */
1738 + * Timeout in ms for sending to controller
1741 +#define OMNIBOOK_TIMEOUT 250
1744 + * Registers of the embedded controller
1747 +#define OMNIBOOK_EC_DATA 0x62
1748 +#define OMNIBOOK_EC_SC 0x66
1751 + * Embedded controller status register bits
1754 +#define OMNIBOOK_EC_STAT_OBF 0x01 /* Output buffer full */
1755 +#define OMNIBOOK_EC_STAT_IBF 0x02 /* Input buffer full */
1756 +#define OMNIBOOK_EC_STAT_CMD 0x08 /* Last write was a command write (0=data) */
1759 + * Embedded controller commands
1762 +#define OMNIBOOK_EC_CMD_READ 0x80
1763 +#define OMNIBOOK_EC_CMD_WRITE 0x81
1764 +#define OMNIBOOK_EC_CMD_QUERY 0x84
1767 + * Wait for embedded controller buffer
1770 +static int omnibook_ec_wait(u8 event)
1772 + int timeout = OMNIBOOK_TIMEOUT;
1775 + case OMNIBOOK_EC_STAT_OBF:
1776 + while (!(inb(OMNIBOOK_EC_SC) & event) && timeout--)
1779 + case OMNIBOOK_EC_STAT_IBF:
1780 + while ((inb(OMNIBOOK_EC_SC) & event) && timeout--)
1792 + * Read from the embedded controller
1795 +int omnibook_ec_read(u8 addr, u8 *data)
1797 + unsigned long flags;
1801 + retval = ec_read(addr, data);
1805 + omnibook_save_flags(flags);
1806 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1809 + outb(OMNIBOOK_EC_CMD_READ, OMNIBOOK_EC_SC);
1810 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1813 + outb(addr, OMNIBOOK_EC_DATA);
1814 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_OBF);
1817 + *data = inb(OMNIBOOK_EC_DATA);
1819 + omnibook_restore_flags(flags);
1824 + * Write to the embedded controller
1827 +int omnibook_ec_write(u8 addr, u8 data)
1830 + unsigned long flags;
1834 + retval = ec_write(addr, data);
1838 + omnibook_save_flags(flags);
1839 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1842 + outb(OMNIBOOK_EC_CMD_WRITE, OMNIBOOK_EC_SC);
1843 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1846 + outb(addr, OMNIBOOK_EC_DATA);
1847 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1850 + outb(data, OMNIBOOK_EC_DATA);
1852 + omnibook_restore_flags(flags);
1856 +int omnibook_ec_read16(u8 addr, u16 *data)
1863 + retval = omnibook_ec_read(addr, &low);
1866 + retval = omnibook_ec_read(addr + 0x01, &high);
1867 + result = ((high << 8) + low);
1873 + * Registers of the keyboard controller
1876 +#define OMNIBOOK_KBC_DATA 0x60
1877 +#define OMNIBOOK_KBC_SC 0x64
1880 + * Keyboard controller status register bits
1883 +#define OMNIBOOK_KBC_STAT_OBF 0x01 /* Output buffer full */
1884 +#define OMNIBOOK_KBC_STAT_IBF 0x02 /* Input buffer full */
1885 +#define OMNIBOOK_KBC_STAT_CMD 0x08 /* Last write was a command write (0=data) */
1888 + * Wait for keyboard buffer
1891 +static int omnibook_kbc_wait(u8 event)
1893 + int timeout = OMNIBOOK_TIMEOUT;
1896 + case OMNIBOOK_KBC_STAT_OBF:
1897 + while (!(inb(OMNIBOOK_KBC_SC) & event) && timeout--)
1900 + case OMNIBOOK_KBC_STAT_IBF:
1901 + while ((inb(OMNIBOOK_KBC_SC) & event) && timeout--)
1913 + * Write to the keyboard command register
1916 +static int omnibook_kbc_write_command(u8 cmd)
1918 + unsigned long flags;
1921 + omnibook_save_flags(flags);
1922 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1925 + outb(cmd, OMNIBOOK_KBC_SC);
1926 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1928 + omnibook_restore_flags(flags);
1933 + * Write to the keyboard data register
1936 +static int omnibook_kbc_write_data(u8 data)
1938 + unsigned long flags;
1941 + omnibook_save_flags(flags);
1942 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1945 + outb(data, OMNIBOOK_KBC_DATA);
1946 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1948 + omnibook_restore_flags(flags);
1953 + * Send a command to keyboard controller
1956 +int omnibook_kbc_command(u8 cmd, u8 data)
1960 + retval = omnibook_kbc_write_command(cmd);
1963 + retval = omnibook_kbc_write_data(data);
1968 + * Read a value from a system I/O address
1971 +int omnibook_io_read(u32 addr, u8 *data)
1973 + unsigned long flags;
1975 + omnibook_save_flags(flags);
1976 + *data = inb(addr);
1977 + omnibook_restore_flags(flags);
1982 + * Write a value to a system I/O address
1985 +int omnibook_io_write(u32 addr, u8 data)
1987 + unsigned long flags;
1989 + omnibook_save_flags(flags);
1991 + omnibook_restore_flags(flags);
1996 + * Read a value from a system memory address
1999 +int omnibook_mem_read(u32 addr, u8 *data)
2001 + char *base = ioremap(addr, 1);
2003 + *data = readb(base);
2009 + * Write a value to a system memory address
2012 +int omnibook_mem_write(u32 addr, u8 data)
2014 + char *base = ioremap(addr, 1);
2016 + writeb(data, base);
2022 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/ec.h linux-2.6.1-gentoo-test/drivers/char/omnibook/ec.h
2023 --- linux-2.6.1-gentoo/drivers/char/omnibook/ec.h 1970-01-01 01:00:00.000000000 +0100
2024 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/ec.h 2004-01-09 22:33:49.000000000 +0000
2027 + * ec.h -- low level definitions to access Embedded Conrtroller
2028 + * and Keyboard Controller and system I/O ports or memory
2030 + * This program is free software; you can redistribute it and/or modify it
2031 + * under the terms of the GNU General Public License as published by the
2032 + * Free Software Foundation; either version 2, or (at your option) any
2035 + * This program is distributed in the hope that it will be useful, but
2036 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2037 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2038 + * General Public License for more details.
2040 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2043 +extern int omnibook_ec_read(u8 addr, u8 *data);
2044 +extern int omnibook_ec_read16(u8 addr, u16 *data);
2045 +extern int omnibook_ec_write(u8 addr, u8 data);
2046 +extern int omnibook_kbc_command(u8 cmd, u8 data);
2047 +extern int omnibook_io_read(u32 addr, u8 *data);
2048 +extern int omnibook_io_write(u32 addr, u8 data);
2049 +extern int omnibook_mem_read(u32 addr, u8 *data);
2050 +extern int omnibook_mem_write(u32 addr, u8 data);
2053 + * Embedded controller adresses
2056 +#define XE3GF_CHGM 0x90 /* , 16 bit */
2057 +#define XE3GF_CHGS 0x92 /* , 16 bit */
2058 +#define XE3GF_CHGC 0x94 /* Current charge of board, 16 bit */
2059 +#define XE3GF_CHGV 0x96 /* Current voltage, 16 bit */
2060 +#define XE3GF_CHGA 0x98 /* Current intensity, 16 bit */
2061 +#define XE3GF_BAL 0x9A /* Battery present status */
2062 +#define XE3GF_STA1 0x9C /* Various status bits*/
2063 +#define XE3GF_CSPR 0xA1 /* Port replicator status, 1 bit */
2064 +#define XE3GF_ADP 0xA3 /* AC acapter status, 1 bit */
2065 +#define XE3GF_FOT 0xA5 /* Fan off temperature, 8 bit */
2066 +#define XE3GF_FSD1 0xA6 /* Fan on temperature, 8 bit */
2067 +#define XE3GF_FSD2 0xA7 /* Fan level 2 temperature, 8 bit */
2068 +#define XE3GF_FSD3 0xA8 /* Fan level 3 temperature, 8 bit */
2069 +#define XE3GF_FSD4 0xA9 /* Fan level 4 temperature, 8 bit */
2070 +#define XE3GF_FSD5 0xAA /* Fan level 5 temperature, 8 bit */
2071 +#define XE3GF_FSD6 0xAB /* Fan level 6 temperature, 8 bit */
2072 +#define XE3GF_FSD7 0xAC /* Fan level 7 temperature, 8 bit */
2073 +#define XE3GF_FSRD 0xAD /* Fan status, 8 bit */
2074 +#define XE3GF_CTMP 0xB0 /* CPU tempetature, 8 bit */
2075 +#define XE3GF_BRTS 0xB9 /* LCD brightness, 4 bit */
2076 +#define XE3GF_BTY0 0xC0 /* Battery 0 type, 1 bit */
2077 +#define XE3GF_BST0 0xC1 /* Battery 0 status, 3 bit */
2078 +#define XE3GF_BRC0 0xC2 /* Battery 0 remaining capacity, 16 bit */
2079 +#define XE3GF_BSN0 0xC4 /* Battery 0 serial number 16 bit */
2080 +#define XE3GF_BPV0 0xC6 /* Battery 0 present voltage, 16 bit */
2081 +#define XE3GF_BDV0 0xC8 /* Battery 0 design voltage 16 bit */
2082 +#define XE3GF_BDC0 0xCA /* Battery 0 design capacity 16 bit */
2083 +#define XE3GF_BFC0 0xCC /* Battery 0 last full capacity 16 bit */
2084 +#define XE3GF_GAU0 0xCE /* Battery 0 gauge, 8 bit */
2085 +#define XE3GF_BTY1 0xD0 /* Battery 1 type, 1 bit */
2086 +#define XE3GF_BST1 0xD1 /* Battery 1 status, 3 bit */
2087 +#define XE3GF_BRC1 0xD2 /* Battery 1 remaining capacity, 16 bit */
2088 +#define XE3GF_BSN1 0xD4 /* Battery 1 serial number, 16 bit */
2089 +#define XE3GF_BPV1 0xD6 /* Battery 1 present voltage, 16 bit */
2090 +#define XE3GF_BDV1 0xD8 /* Battery 1 design voltage 16 bit */
2091 +#define XE3GF_BDC1 0xDA /* Battery 1 design capacity 16 bit */
2092 +#define XE3GF_BFC1 0xDC /* Battery 1 last full capacity 16 bit */
2093 +#define XE3GF_GAU1 0xDE /* Battery 1 gauge, 8 bit */
2096 + * Bitmasks for sub byte values
2099 +#define XE3GF_SHDD_MASK 0x40 /* External display status */
2100 +#define XE3GF_CSPR_MASK 0x01 /* Port replicator status */
2101 +#define XE3GF_ADP_MASK 0x20 /* AC acapter status */
2102 +#define XE3GF_BAL0_MASK 0x01 /* Battery 0 present */
2103 +#define XE3GF_BAL1_MASK 0x02 /* Battery 1 present */
2104 +#define XE3GF_BMF_MASK 0x70 /* Model code */
2105 +#define XE3GF_BTY_MASK 0x80 /* Type: Ni-MH or Li-Ion */
2106 +#define XE3GF_BST_MASK_DSC 0x01 /* Discarging */
2107 +#define XE3GF_BST_MASK_CHR 0x02 /* Charging */
2108 +#define XE3GF_BST_MASK_CRT 0x04 /* Critical */
2109 +#define XE3GF_FSRD_MASK_S1 0x01 /* Fan level 1 */
2110 +#define XE3GF_FSRD_MASK_S2 0x02 /* Fan level 2 */
2111 +#define XE3GF_FSRD_MASK_S3 0x04 /* Fan level 3 */
2112 +#define XE3GF_FSRD_MASK_S4 0x08 /* Fan level 4 */
2113 +#define XE3GF_FSRD_MASK_S5 0x10 /* Fan level 5 */
2114 +#define XE3GF_FSRD_MASK_S6 0x20 /* Fan level 6 */
2115 +#define XE3GF_FSRD_MASK_S7 0x40 /* Fan level 7 */
2116 +#define XE3GF_BRTS_MASK 0x0F /* LCD brightness */
2118 +#define XE3GF_FAN_ON_MASK 0x02 /* Fan on */
2121 + * OmniBook XE3 GC values
2124 +#define XE3GC_CTMP 0x28 /* CPU tempetature, 8 bit */
2125 +#define XE3GC_STA1 0x30 /* Various status bits */
2126 +#define XE3GC_Q0A 0x31 /* Various status bits */
2127 +#define XE3GC_CCUR 0x38 /* Current charge of board, 16 bit ? */
2128 +#define XE3GC_CVOL 0x3A /* Current voltage, 16 bit ? */
2129 +#define XE3GC_CARM 0x3C /* Current intensity, 16 bit ? */
2130 +#define XE3GC_BAT 0x3E /* Battery present status */
2131 +#define XE3GC_BST0 0x40 /* Battery 0 status, 3 bit */
2132 +#define XE3GC_BPR0 0x41 /* Battery 0 present rate, 16 bit ? */
2133 +#define XE3GC_BRC0 0x43 /* Battery 0 remaining capacity, 16 bit */
2134 +#define XE3GC_BPV0 0x45 /* Battery 0 present voltage, 16 bit */
2135 +#define XE3GC_BDV0 0x47 /* Battery 0 design voltage 16 bit */
2136 +#define XE3GC_BDC0 0x49 /* Battery 0 design capacity 16 bit */
2137 +#define XE3GC_BTY0 0x4A /* Battery 0 type, 1 bit ?*/
2138 +#define XE3GC_BTP0 0x4B /* Battery 0 ?, 1 bit */
2139 +#define XE3GC_BSN0 0x4C /* Battery 0 serial number, 8 bit ?*/
2140 +#define XE3GC_BMF0 0x4D /* Battery 0 ?,8 bit */
2141 +#define XE3GC_BST1 0x50 /* Battery 0 status, 3 bit */
2142 +#define XE3GC_BPR1 0x51 /* Battery 0 present rate, 16 bit ? */
2143 +#define XE3GC_BRC1 0x53 /* Battery 0 remaining capacity, 16 bit */
2144 +#define XE3GC_BPV1 0x55 /* Battery 0 present voltage, 16 bit */
2145 +#define XE3GC_BDV1 0x57 /* Battery 0 design voltage 16 bit */
2146 +#define XE3GC_BDC1 0x59 /* Battery 0 design capacity 16 bit */
2147 +#define XE3GC_BTY1 0x5A /* Battery 0 type, 1 bit ?*/
2148 +#define XE3GC_BTP1 0x5B /* Battery 0 ?, 1 bit */
2149 +#define XE3GC_BSN1 0x5C /* Battery 0 serial number, 8 bit ?*/
2150 +#define XE3GC_BMF1 0x5D /* Battery 0 ?,8 bit */
2151 +#define XE3GC_STA2 0x61 /* Various status bits */
2152 +#define XE3GC_BTVL 0x6A /* LCD brightness, 4 bit */
2155 + * Bitmasks for sub byte values
2158 +#define XE3GC_ADP_MASK 0x40 /* AC acapter status */
2159 +#define XE3GC_BAT0_MASK 0x01 /* Battery 0 present */
2160 +#define XE3GC_BAT1_MASK 0x02 /* Battery 1 present */
2161 +#define XE3GC_BTY_MASK 0x01 /* Type: Ni-MH or Li-Ion */
2162 +#define XE3GC_BST_MASK_DSC 0x01 /* Discarging */
2163 +#define XE3GC_BST_MASK_CHR 0x02 /* Charging */
2164 +#define XE3GC_BST_MASK_CRT 0x04 /* Critical */
2165 +#define XE3GC_CRTI_MASK 0x04 /* External display status */
2166 +#define XE3GC_SLPB_MASK 0x01 /* Sleep button pressed */
2167 +#define XE3GC_F5_MASK 0x02 /* Fn-F5 - LCD/CRT switch pressed */
2168 +#define XE3GC_VOLD_MASK 0x04 /* Fn-down arrow or Volume down pressed */
2169 +#define XE3GC_VOLU_MASK 0x08 /* Fn-up arrow or Volume up pressed */
2170 +#define XE3GC_MUTE_MASK 0x10 /* Fn+F7 - Volume mute pressed */
2171 +#define XE3GC_CNTR_MASK 0x20 /* Fn+F3/Fn+F4 - Contrast up or down pressed */
2172 +#define XE3GC_BRGT_MASK 0x40 /* Fn+F1/Fn+F2 - Brightness up or down pressed */
2173 +#define XE3GC_BTVL_MASK 0x0F /* LCD brightness */
2176 + * Emulated scancodes
2179 +#define XE3GC_VOLD_SCAN 0x2E /* Volume down button scancode */
2180 +#define XE3GC_VOLU_SCAN 0x30 /* Volume up button scancode */
2181 +#define XE3GC_MUTE_SCAN 0x20 /* Volume up button scancode */
2184 + * OmniBook 500, 510, 6000, 6100, XE2 values
2187 +#define OB500_STA1 0x44 /* Various status bits */
2188 +#define OB500_STA2 0x50 /* Various status bits */
2189 +#define OB500_CTMP 0x55 /* CPU tempetature, 8 bit */
2190 +#define OB500_BT1I 0x58 /* Battery 1 ? 16 bit */
2191 +#define OB500_BT1C 0x5A /* Battery 1 remaining capacity 16 bit ? */
2192 +#define OB500_BT1V 0x5C /* Battery 1 present voltage 16 bit ? */
2193 +#define OB500_BT1S 0x5E /* Battery 1 status 3 bit ? */
2194 +#define OB500_BT2I 0x6A /* Battery 2 ? 16 bit */
2195 +#define OB500_BT2C 0x6C /* Battery 2 remaining capacity 16 bit ? */
2196 +#define OB500_BT2V 0x6E /* Battery 2 present voltage 16 bit ? */
2197 +#define OB500_BT2S 0x70 /* Battery 2 status 3 bit ? */
2198 +#define OB500_BT3I 0x5F /* Battery 3 ? 16 bit */
2199 +#define OB500_BT3C 0x61 /* Battery 3 remaining capacity 16 bit ? */
2200 +#define OB500_BT3V 0x63 /* Battery 3 present voltage 16 bit ? */
2201 +#define OB500_BT3S 0x65 /* Battery 3 status 3 bit ? */
2203 +#define OB6000_STA1 0x77 /* Various status bits */
2205 +#define XE2_STA1 0x50 /* Various status bits */
2208 + * Bitmasks for sub byte values
2211 +#define OB500_LIDS_MASK 0x01 /* LID status */
2212 +#define OB500_CRTS_MASK 0x20 /* External display status */
2213 +#define OB500_SLPS_MASK 0x40 /* Sleep button status */
2214 +#define OB500_DCKS_MASK 0x80 /* Docking status */
2215 +#define OB500_ADP_MASK 0x02 /* AC acapter status */
2216 +#define OB500_BST_MASK_DSC 0x01 /* Discarging */
2217 +#define OB500_BST_MASK_CHR 0x02 /* Charging */
2218 +#define OB500_BST_MASK_CRT 0x04 /* Critical */
2220 +#define OB6000_FAN_MASK 0x10 /* Fan status */
2222 +#define XE2_ADP_MASK 0x02 /* AC acapter status */
2228 +#define OB4150_TMP 0x28 /* CPU tempetature, 8 bit */
2229 +#define OB4150_STA1 0x2E /* Various status bits */
2230 +#define OB4150_STA2 0x2F /* Various status bits */
2231 +#define OB4150_ADP 0x30 /* AC acapter status, 1 bit */
2232 +#define OB4150_DCID 0x2C /* Port replicator */
2235 + * Bitmasks for sub byte values
2238 +#define OB4150_FAN_MASK 0x01 /* Fan status */
2239 +#define OB4150_ADP_MASK 0x40 /* AC acapter status */
2240 +#define OB4150_CRST_MASK 0x20 /* External display status */
2243 + * Keyboard controller command for some laptop functions
2246 +#define OMNIBOOK_KBC_CONTROL_CMD 0x59
2249 + * Keyboard controller command parameters for functions available via kbc
2252 +#define OMNIBOOK_KBC_CMD_ONETOUCH_ENABLE 0x90 /* Enables OneTouch buttons */
2253 +#define OMNIBOOK_KBC_CMD_ONETOUCH_DISABLE 0x91 /* Disables OneTouch buttons */
2254 +#define OMNIBOOK_KBC_CMD_TOUCHPAD_ENABLE 0xAA /* Enables toucpad */
2255 +#define OMNIBOOK_KBC_CMD_TOUCHPAD_DISABLE 0xA9 /* Disables toucpad */
2256 +#define OMNIBOOK_KBC_CMD_LCD_ON 0xE1 /* Turns LCD display on */
2257 +#define OMNIBOOK_KBC_CMD_LCD_OFF 0xE2 /* Turns LCD display off */
2258 +#define OMNIBOOK_KBC_CMD_AC_POWER_ENABLE 0xC2 /* Enable AC power */
2259 +#define OMNIBOOK_KBC_CMD_AC_POWER_DISABLE 0xC1 /* Disable AC power */
2265 +#define ACL00_AC_STAT 0x11B9 /* AC adapter status on ACL00 */
2266 +#define ACL00_AC_MASK 0x04 /* Bitmask for AC adapter status on ACL00 */
2267 +#define TOSH3K_AC_STAT 0x102D /* AC adapter status on Toshiba 3000 */
2268 +#define TOSH3K_AC_MASK 0x08 /* Bitmask for AC adapter status on Toshiba 3000 */
2269 +#define XE3GF_AC_STAT 0x11B9 /* AC adapter status on XE3 GF */
2270 +#define XE3GF_AC_MASK 0x04 /* Bitmask for AC adapter status on XE3 GF */
2271 +#define XE3GF_LID_STAT 0x11AD /* LID switch status on XE3 GF */
2272 +#define XE3GF_LID_MASK 0x20 /* Bitmask for LID switch status on XE3 GF */
2273 +#define XE3GC_SMIC 0xFE00
2275 +#define OB500_GPO1 0x8034 /* Fan control */
2276 +#define OB510_GPO2 0x11B9 /* LCD backlight */
2277 +#define OB510_GPIO 0x118F /* Fan control */
2279 +#define OB500_FAN_ON_MASK 0x0A /* Turn fan on with zero bits */
2280 +#define OB500_FAN_OFF_MASK 0x08 /* Fan status/off */
2281 +#define OB500_BKLT_MASK 0x40 /* LCD backlight */
2282 +#define OB510_FAN_ON_MASK 0x18 /* Turn fan on with zero bits */
2283 +#define OB510_FAN_OFF_MASK 0x10 /* Turn fan on */
2284 +#define OB510_BKLT_MASK 0x01 /* LCD backlight */
2286 +#define XE2_FAN_MASK 0x02 /* Turn fan on with zero bit */
2292 +#define XE3GC_BCMD 0xFFFFEBC
2295 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/fan.c linux-2.6.1-gentoo-test/drivers/char/omnibook/fan.c
2296 --- linux-2.6.1-gentoo/drivers/char/omnibook/fan.c 1970-01-01 01:00:00.000000000 +0100
2297 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/fan.c 2004-01-09 22:33:49.000000000 +0000
2300 + * fan.c -- fan status/control
2302 + * This program is free software; you can redistribute it and/or modify it
2303 + * under the terms of the GNU General Public License as published by the
2304 + * Free Software Foundation; either version 2, or (at your option) any
2307 + * This program is distributed in the hope that it will be useful, but
2308 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2309 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2310 + * General Public License for more details.
2312 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2316 +#include <linux/config.h>
2317 +#include <linux/module.h>
2318 +#include <linux/version.h>
2319 +#include <linux/types.h>
2320 +#include <linux/init.h>
2321 +#include <linux/delay.h>
2322 +#include <linux/pm.h>
2323 +#include <linux/proc_fs.h>
2325 +#include <asm/system.h>
2326 +#include <asm/errno.h>
2327 +#include <asm/io.h>
2328 +#include <asm/uaccess.h>
2330 +#ifdef OMNIBOOK_STANDALONE
2331 +#include "omnibook.h"
2333 +#include <linux/omnibook.h>
2339 +static struct proc_dir_entry *proc_fan;
2341 +int omnibook_get_fan(void)
2346 + switch (omnibook_ectype) {
2348 + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan)))
2353 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2355 + retval = (fan & OB500_FAN_OFF_MASK) ? 0 : 1;
2358 + if ((retval = omnibook_io_read(OB510_GPIO, &fan)))
2360 + retval = (fan & OB510_FAN_OFF_MASK) ? 0 : 1;
2364 + if ((retval = omnibook_ec_read(OB6000_STA1, &fan)))
2366 + retval = (fan & OB6000_FAN_MASK) ? 1 : 0;
2369 + if ((retval = omnibook_ec_read(OB4150_STA1, &fan)))
2371 + retval = (fan & OB4150_FAN_MASK) ? 1 : 0;
2374 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2376 + retval = (fan & XE2_FAN_MASK) ? 0 : 1;
2379 + printk(KERN_INFO "%s: Fan status monitoring is unsupported on this machie.\n", OMNIBOOK_MODULE_NAME);
2386 +int omnibook_fan_on(void)
2391 + switch (omnibook_ectype) {
2393 + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan)))
2395 + if ((retval = omnibook_ec_write(XE3GF_FSRD, fan | XE3GF_FAN_ON_MASK)))
2399 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2401 + if ((retval = omnibook_io_write(OB500_GPO1, fan & ~OB500_FAN_ON_MASK)))
2405 + if ((retval = omnibook_io_read(OB510_GPIO, &fan)))
2407 + if ((retval = omnibook_io_write(OB510_GPIO, fan & ~OB510_FAN_ON_MASK)))
2412 + if ((retval = omnibook_ec_read(OB6000_STA1, &fan)))
2414 + if ((retval = omnibook_ec_write(OB6000_STA1, fan | OB6000_FAN_MASK)))
2418 + if ((retval = omnibook_ec_read(OB4150_STA1, &fan)))
2420 + if ((retval = omnibook_ec_write(OB4150_STA1, fan | OB4150_FAN_MASK)))
2424 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2426 + if ((retval = omnibook_io_write(OB500_GPO1, fan & ~XE2_FAN_MASK)))
2430 + printk(KERN_INFO "%s: Direct fan control is unsupported on this machie.\n", OMNIBOOK_MODULE_NAME);
2437 +int omnibook_fan_off(void)
2442 + switch (omnibook_ectype) {
2446 + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan)))
2449 + /* fan is already off */
2453 + /* now we set FOT to current temp, then reset to initial value */
2454 + if ((retval = omnibook_ec_read(XE3GF_FOT, &fot)))
2456 + if ((retval = omnibook_ec_read(XE3GF_CTMP, &temp)))
2460 + omnibook_ec_write(XE3GF_FOT, temp);
2462 + } while (omnibook_get_fan() != 0);
2464 + omnibook_ec_write(XE3GF_FOT, fot);
2468 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2470 + if ((retval = omnibook_io_write(OB500_GPO1, fan | OB500_FAN_OFF_MASK)))
2474 + if ((retval = omnibook_io_read(OB510_GPIO, &fan)))
2476 + if ((retval = omnibook_io_write(OB510_GPIO, fan | OB510_FAN_OFF_MASK)))
2481 + if ((retval = omnibook_ec_read(OB6000_STA1, &fan)))
2483 + if ((retval = omnibook_ec_write(OB6000_STA1, fan & ~OB6000_FAN_MASK)))
2487 + if ((retval = omnibook_ec_read(OB4150_STA1, &fan)))
2489 + if ((retval = omnibook_ec_write(OB4150_STA1, fan & ~OB4150_FAN_MASK)))
2493 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2495 + if ((retval = omnibook_io_write(OB500_GPO1, fan | XE2_FAN_MASK)))
2499 + printk(KERN_INFO "%s: Direct fan control is unsupported on this machie.\n", OMNIBOOK_MODULE_NAME);
2506 +static int omnibook_fan_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2512 + fan = omnibook_get_fan();
2515 + str = (fan) ? "on" : "off";
2518 + b += sprintf(b, "Fan is %s (level %d)\n", str, fan);
2520 + b += sprintf(b, "Fan is %s\n", str);
2522 + return omnibook_proc_len(buffer, start, off, count, eof, b);;
2525 +static int omnibook_fan_set(struct file *file, const char *buffer, unsigned long count, void *data)
2527 + char status[1] = {'\0'};
2529 + if (copy_from_user(status, buffer, 1))
2531 + switch (*status) {
2533 + omnibook_fan_off();
2536 + omnibook_fan_on();
2545 +int __init omnibook_fan_init(void)
2549 + switch (omnibook_ectype) {
2557 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
2558 + if (omnibook_userset)
2559 + pmode = pmode | S_IWUGO;
2560 + proc_fan = create_proc_entry("fan", pmode, omnibook_proc_root);
2563 + printk(KERN_INFO "%s: Fan status monitor and control is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2568 + proc_fan->read_proc = omnibook_fan_status;
2569 + proc_fan->write_proc = omnibook_fan_set;
2571 + printk(KERN_ERR "%s: Unable to create /proc/%s/fan.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
2574 + printk(KERN_INFO "%s: Fan status monitor and control is enabled.\n", OMNIBOOK_MODULE_NAME);
2578 +void __exit omnibook_fan_cleanup(void)
2581 + remove_proc_entry("fan", omnibook_proc_root);
2584 +EXPORT_SYMBOL(omnibook_get_fan);
2585 +EXPORT_SYMBOL(omnibook_fan_on);
2586 +EXPORT_SYMBOL(omnibook_fan_off);
2589 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/fan_policy.c linux-2.6.1-gentoo-test/drivers/char/omnibook/fan_policy.c
2590 --- linux-2.6.1-gentoo/drivers/char/omnibook/fan_policy.c 1970-01-01 01:00:00.000000000 +0100
2591 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/fan_policy.c 2004-01-09 22:33:49.000000000 +0000
2594 + * fan_policy.c -- fan policy support
2596 + * This program is free software; you can redistribute it and/or modify it
2597 + * under the terms of the GNU General Public License as published by the
2598 + * Free Software Foundation; either version 2, or (at your option) any
2601 + * This program is distributed in the hope that it will be useful, but
2602 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2603 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2604 + * General Public License for more details.
2606 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2610 +#include <linux/config.h>
2611 +#include <linux/module.h>
2612 +#include <linux/version.h>
2613 +#include <linux/types.h>
2614 +#include <linux/init.h>
2615 +#include <linux/proc_fs.h>
2617 +#include <asm/system.h>
2618 +#include <asm/errno.h>
2619 +#include <asm/io.h>
2620 +#include <asm/uaccess.h>
2622 +#ifdef OMNIBOOK_STANDALONE
2623 +#include "omnibook.h"
2625 +#include <linux/omnibook.h>
2631 +static struct proc_dir_entry *proc_fan_policy;
2633 +u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS];
2635 +int omnibook_get_fan_policy(void)
2641 + switch (omnibook_ectype) {
2643 + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) {
2644 + if ((retval = omnibook_ec_read(XE3GF_FOT + i, &tmp)))
2646 + omnibook_fan_policy[i] = tmp;
2650 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2657 +int omnibook_set_fan_policy(void)
2662 + switch (omnibook_ectype) {
2664 + if (omnibook_fan_policy[0] > OMNIBOOK_FOT_MAX)
2666 + for (i = 0; i < OMNIBOOK_FAN_LEVELS; i++) {
2667 + if ((omnibook_fan_policy[i] > omnibook_fan_policy[i + 1]) || (omnibook_fan_policy[i] < OMNIBOOK_FAN_MIN) || (omnibook_fan_policy[i] > OMNIBOOK_FAN_MAX))
2669 + if (omnibook_fan_policy[i + 1] > OMNIBOOK_FAN_MAX)
2672 + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) {
2673 + if ((retval = omnibook_ec_write(XE3GF_FOT + i, omnibook_fan_policy[i])))
2678 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2685 +int omnibook_set_fan_policy_defaults(void)
2689 + u8 fan_defaults[] = {
2690 + OMNIBOOK_FOT_DEFAULT,
2691 + OMNIBOOK_FAN1_DEFAULT,
2692 + OMNIBOOK_FAN2_DEFAULT,
2693 + OMNIBOOK_FAN3_DEFAULT,
2694 + OMNIBOOK_FAN4_DEFAULT,
2695 + OMNIBOOK_FAN5_DEFAULT,
2696 + OMNIBOOK_FAN6_DEFAULT,
2697 + OMNIBOOK_FAN7_DEFAULT,
2700 + switch (omnibook_ectype) {
2702 + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) {
2703 + if ((retval = omnibook_ec_write(XE3GF_FOT + i, fan_defaults[i])))
2708 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2715 +static int omnibook_proc_fan_policy_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2721 + if ((retval = omnibook_get_fan_policy()))
2724 + b += sprintf(b, "Fan off temperature: %2d C\n", omnibook_fan_policy[0]);
2725 + b += sprintf(b, "Fan on temperature: %2d C\n", omnibook_fan_policy[1]);
2726 + for (i = 2; i <= OMNIBOOK_FAN_LEVELS; i++) {
2727 + b += sprintf(b, "Fan level %1d temperature: %2d C\n", i, omnibook_fan_policy[i]);
2729 + b += sprintf(b, "Minimal temperature to set: %2d C\n", OMNIBOOK_FAN_MIN);
2730 + b += sprintf(b, "Maximal temperature to set: %2d C\n", OMNIBOOK_FAN_MAX);
2732 + return omnibook_proc_len(buffer, start, off, count, eof, b);
2735 +static int omnibook_proc_fan_policy_set(struct file *file, const char *buffer, unsigned long count, void *data)
2737 + unsigned int len = (count < OMNIBOOK_FAN_POLICY_STRING) ? count : OMNIBOOK_FAN_POLICY_STRING;
2738 + char status[OMNIBOOK_FAN_POLICY_STRING] = {'\0'};
2745 + if ((retval = omnibook_get_fan_policy()))
2748 + if (copy_from_user(status, buffer, len))
2756 + printk(KERN_INFO "%s: c=%d\n", OMNIBOOK_MODULE_NAME, c);
2757 + if (n > OMNIBOOK_FAN_LEVELS)
2759 + if (*b >= '0' && *b <= '9')
2760 + c = c * 10 + (*b - '0');
2761 + else if (((*b == ' ') || (*b == '\0') || (*b == '\n')) && (*prev >= '0') && (*prev <= '9')) {
2762 + omnibook_fan_policy[n] = c;
2770 + } while ((*prev != '\n') && (*prev != '\0'));
2772 + /* A zero value set the defaults */
2773 + if ((omnibook_fan_policy[0] == 0) && (n == 1)) {
2774 + if ((retval = omnibook_set_fan_policy_defaults()))
2777 + omnibook_set_fan_policy();
2782 +int __init omnibook_fan_policy_init(void)
2786 + switch (omnibook_ectype) {
2788 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
2789 + if (omnibook_userset)
2790 + pmode = pmode | S_IWUGO;
2791 + proc_fan_policy = create_proc_entry("fan_policy", pmode, omnibook_proc_root);
2794 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2797 + if (proc_fan_policy) {
2798 + proc_fan_policy->read_proc = omnibook_proc_fan_policy_status;
2799 + proc_fan_policy->write_proc = omnibook_proc_fan_policy_set;
2801 + printk(KERN_ERR "%s: Unable to create /proc/%s/fan_policy.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
2804 + printk(KERN_INFO "%s: Fan policy setting is enabled.\n", OMNIBOOK_MODULE_NAME);
2808 +void __exit omnibook_fan_policy_cleanup(void)
2810 + if (proc_fan_policy)
2811 + remove_proc_entry("fan_policy", omnibook_proc_root);
2814 +EXPORT_SYMBOL(omnibook_fan_policy);
2815 +EXPORT_SYMBOL(omnibook_get_fan_policy);
2816 +EXPORT_SYMBOL(omnibook_set_fan_policy);
2817 +EXPORT_SYMBOL(omnibook_set_fan_policy_defaults);
2820 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/init.c linux-2.6.1-gentoo-test/drivers/char/omnibook/init.c
2821 --- linux-2.6.1-gentoo/drivers/char/omnibook/init.c 1970-01-01 01:00:00.000000000 +0100
2822 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/init.c 2004-01-09 22:33:49.000000000 +0000
2825 + * init.c -- module initialization code
2827 + * This program is free software; you can redistribute it and/or modify it
2828 + * under the terms of the GNU General Public License as published by the
2829 + * Free Software Foundation; either version 2, or (at your option) any
2832 + * This program is distributed in the hope that it will be useful, but
2833 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2834 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2835 + * General Public License for more details.
2837 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2841 +#include <linux/config.h>
2842 +#include <linux/module.h>
2843 +#include <linux/version.h>
2844 +#include <linux/types.h>
2845 +#include <linux/init.h>
2846 +#include <linux/pm.h>
2847 +#include <linux/proc_fs.h>
2849 +#include <asm/system.h>
2850 +#include <asm/errno.h>
2851 +#include <asm/io.h>
2852 +#include <asm/uaccess.h>
2854 +#ifdef OMNIBOOK_STANDALONE
2855 +#include "omnibook.h"
2857 +#include <linux/omnibook.h>
2864 +int omnibook_ectype;
2865 +int omnibook_userset;
2867 +struct proc_dir_entry *omnibook_proc_root __initdata = NULL;
2868 +static struct proc_dir_entry *proc_version;
2869 +static struct proc_dir_entry *proc_dmi;
2872 + * Module parameters
2873 + * 0 disables the feature
2874 + * >1 enables the feature
2875 + * All feature enabled by default
2878 +static int ectype __initdata = NONE;
2879 +static int ac __initdata = 1;
2880 +static int battery __initdata = 1;
2881 +static int blank __initdata = 1;
2882 +static int display __initdata = 1;
2883 +static int dmi __initdata = 1;
2884 +static int fan __initdata = 1;
2885 +static int fan_policy __initdata = 1;
2886 +static int onetouch __initdata = 1;
2887 +static int lcd __initdata = 1;
2888 +static int temperature __initdata = 1;
2889 +static int touchpad __initdata = 1;
2890 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
2891 +static int key_polling __initdata = 1;
2894 +static int apmemu __initdata = 0;
2895 +static int dock __initdata = 0;
2896 +static int user __initdata = 0;
2898 +static int omnibook_proc_version(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2902 + b += sprintf(b, "%s\n", OMNIBOOK_MODULE_VERSION);
2904 + return omnibook_proc_len(buffer, start, off, count, eof, b);
2907 +static int omnibook_proc_dmi(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2911 + b += sprintf(b, "BIOS Vendor: %s\n", omnibook_dmi_ident[OMNIBOOK_BIOS_VENDOR]);
2912 + b += sprintf(b, "BIOS Version: %s\n", omnibook_dmi_ident[OMNIBOOK_BIOS_VERSION]);
2913 + b += sprintf(b, "BIOS Release: %s\n", omnibook_dmi_ident[OMNIBOOK_BIOS_DATE]);
2914 + b += sprintf(b, "System Vendor: %s\n", omnibook_dmi_ident[OMNIBOOK_SYS_VENDOR]);
2915 + b += sprintf(b, "Product Name: %s\n", omnibook_dmi_ident[OMNIBOOK_PRODUCT_NAME]);
2916 + b += sprintf(b, "Version: %s\n", omnibook_dmi_ident[OMNIBOOK_PRODUCT_VERSION]);
2917 + b += sprintf(b, "Serial Number: %s\n", omnibook_dmi_ident[OMNIBOOK_SERIAL_NUMBER]);
2918 + b += sprintf(b, "Board Vendor: %s\n", omnibook_dmi_ident[OMNIBOOK_BOARD_VENDOR]);
2919 + b += sprintf(b, "Board Name: %s\n", omnibook_dmi_ident[OMNIBOOK_BOARD_NAME]);
2920 + b += sprintf(b, "Board Version: %s\n", omnibook_dmi_ident[OMNIBOOK_BOARD_VERSION]);
2922 + return omnibook_proc_len(buffer, start, off, count, eof, b);
2925 +#define HP_SIGNATURE "Hewlett-Packard"
2927 +struct omnibook_models_t {
2928 + /* DMI field matchers (table inputs) */
2930 + char *product_name;
2931 + char *product_version;
2934 + /* Table outputs */
2935 + char *syslog_name; /* Name which will appear in the syslog */
2936 + int ectype; /* Type of the embedded controller firmware, see omnibook.h and README */
2939 +static struct omnibook_models_t omnibook_models[] __initdata = {
2940 + /* sys_vendor product_name product_version board_name syslog_name ectype */
2941 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GF*", NULL, NULL, XE3GF },
2942 + { NULL, "HP OmniBook PC*", "HP OmniBook XT1000*", NULL, NULL, XE3GF },
2943 + { NULL, "HP OmniBook PC*", "HP OmniBook XE2 DC*", NULL, NULL, XE2 },
2944 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GC*", NULL, NULL, XE3GC },
2945 + /* HP Pavilion N5430 */
2946 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GD*", NULL, NULL, XE3GC },
2947 + /* HP Pavilion N5415 */
2948 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GE*", NULL, NULL, XE3GC },
2949 + { NULL, "HP OmniBook PC*", "HP OmniBook 500 FA*", NULL, NULL, OB500 },
2950 + { NULL, "HP OmniBook PC*", "HP OmniBook 510 FB*", NULL, NULL, OB510 },
2951 + { NULL, "HP OmniBook PC*", "HP OmniBook 4150*", NULL, NULL, OB4150 },
2952 + { NULL, "HP OmniBook PC*", "HP OmniBook 900 B*", NULL, NULL, OB4150 },
2953 + { NULL, "HP OmniBook PC*", "HP OmniBook 6000 EA*", NULL, NULL, OB6000 },
2954 + { NULL, "HP OmniBook PC*", "HP OmniBook 6100 EB*", NULL, NULL, OB6100 },
2955 + /* HP OmniBook xe4100 */
2956 + { NULL, "HP OmniBook PC*", "HP OmniBook xe4000*", NULL, NULL, XE4500 },
2957 + { NULL, "HP OmniBook PC*", "HP OmniBook xe4400*", NULL, NULL, XE4500 },
2958 + { NULL, "HP OmniBook PC*", "HP OmniBook xe4500*", NULL, NULL, XE4500 },
2959 + /* HP OmniBook vt6200 and xt6200 */
2960 + { NULL, "HP OmniBook PC*", "HP OmniBook 6200 EG*", NULL, NULL, XE4500 },
2961 + /* HP Pavilion ze4125 */
2962 + { NULL, "HP NoteBook PC*", "HP NoteBook ze4000*", NULL, NULL, XE4500 },
2963 + /* There are no model specific strings of some HP Pavilion xt155 and some HP Pavilion ze4100 */
2964 + { NULL, "HP NoteBook PC*", "HP NoteBook PC*", NULL, NULL, XE4500 },
2965 + /* HP Pavilion ZU1155 and ZU1175 */
2966 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion ZU1000 FA*", NULL, NULL, OB500 },
2967 + /* HP Pavilion N5290 */
2968 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook XE3 GC*", NULL, NULL, XE3GC },
2969 + /* HP Pavilion N5441 */
2970 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook Model GD*", NULL, NULL, XE3GC },
2971 + /* HP Pavilion XH545 */
2972 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook Model GE*", NULL, NULL, XE3GC },
2973 + /* HP Pavilion ZT1141 */
2974 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook ZT1000*", NULL, NULL, XE3GF },
2975 + /* There are no model specific strings of some HP Pavilion ZT1175 and ZT1195 notebooks */
2976 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook*", NULL, NULL, XE3GF },
2977 + { NULL, "Pavilion ze4200*", NULL, NULL, "HP Pavilion ze4200 series", XE4500 },
2978 + /* Compaq nx9000 */
2979 + { NULL, "HP nx9000*", NULL, NULL, "HP/Compaq nx9000", XE4500 },
2980 + /* Compaq nx9005 */
2981 + { NULL, "HP nx9005*", NULL, NULL, "HP/Compaq nx9005", XE4500 },
2982 + /* Compaq nx9010 */
2983 + { NULL, "HP nx9010*", NULL, NULL, "HP/Compaq nx9010", XE4500 },
2984 + { "TOSHIBA", "S1000*", NULL, NULL, "Toshiba Satellite 1000", XE3GF },
2985 + { "TOSHIBA", "S1005*", NULL, NULL, "Toshiba Satellite 1005", XE3GF },
2986 + { "TOSHIBA", "S1110*", NULL, NULL, "Toshiba Satellite 1110", XE3GF },
2987 + { "TOSHIBA", "S1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF },
2988 + { "TOSHIBA", "S1900*", NULL, NULL, "Toshiba Satellite 1900", XE3GF },
2989 + { "TOSHIBA", "S1905*", NULL, NULL, "Toshiba Satellite 1905", XE3GF },
2990 + { "TOSHIBA", "S1950*", NULL, NULL, "Toshiba Satellite 1950", XE3GF },
2991 + { "TOSHIBA", "S2430*", NULL, NULL, "Toshiba Satellite 2430", XE3GF },
2992 + { "TOSHIBA", "S3000*", NULL, NULL, "Toshiba Satellite 3000", XE3GF },
2993 + { "TOSHIBA", "S3005*", NULL, NULL, "Toshiba Satellite 3005", XE3GF },
2994 + { "TOSHIBA", "Satellite 1000*", NULL, NULL, "Toshiba Satellite 1000", XE3GF },
2995 + { "TOSHIBA", "Satellite 1005*", NULL, NULL, "Toshiba Satellite 1005", XE3GF },
2996 + { "TOSHIBA", "Satellite 1110*", NULL, NULL, "Toshiba Satellite 1110", XE3GF },
2997 + { "TOSHIBA", "Satellite 1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF },
2998 + { "TOSHIBA", "Satellite 1900*", NULL, NULL, "Toshiba Satellite 1900", XE3GF },
2999 + { "TOSHIBA", "Satellite 1905*", NULL, NULL, "Toshiba Satellite 1905", XE3GF },
3000 + { "TOSHIBA", "Satellite 1950*", NULL, NULL, "Toshiba Satellite 1950", XE3GF },
3001 + { "TOSHIBA", "Satellite 2430*", NULL, NULL, "Toshiba Satellite 2430", XE3GF },
3002 + { "TOSHIBA", "Satellite 3000*", NULL, NULL, "Toshiba Satellite 3000", XE3GF },
3003 + { "TOSHIBA", "Satellite 3005*", NULL, NULL, "Toshiba Satellite 3005", XE3GF },
3004 + { "COMPAL", NULL, NULL, "ACL00", "Compal ACL00", XE3GF },
3005 + { "Acer", "Aspire 1400 series*", NULL, NULL, "Acer Aspire 1400 series", XE3GF },
3006 + /* This sentinel at the end catches all unsupported models */
3007 + { NULL, NULL, NULL, NULL, NONE }
3010 +struct omnibook_tc_t {
3015 +/* HP technology codes */
3016 +static struct omnibook_tc_t omnibook_tc[] __initdata = {
3017 + /* technology code ectype */
3018 + { "CI.", OB4150 },
3019 + { "CL.", OB4150 },
3021 + { "EA.", OB6000 },
3022 + { "EB.", OB6100 },
3023 + { "EG.", XE4500 },
3033 + { "KA.", XE4500 },
3034 + { "KB.", XE4500 },
3035 + { "KC.", XE4500 },
3036 + { "KD.", XE4500 },
3037 + { "KE.", XE4500 },
3042 + * Compare the saved DMI info at "index" with a string.
3043 + * A '*' at the end of the string will match anything.
3044 + * Returns 0 for a match.
3046 + * This preserves the semantics of the old omnibook_features[]
3047 + * table. I don't know if its generally useful or not.
3049 +static int __init cmp_with_glob(int index, char *str)
3056 + glob = strchr(str, '*');
3057 + len = glob ? glob - str : strlen(str);
3058 + retval = strncmp(omnibook_dmi_ident[index], str, len);
3064 +static int __init omnibook_ident(void)
3066 + struct omnibook_models_t *mp;
3068 + for (mp = omnibook_models; mp->ectype != NONE; ++mp) {
3069 + /* Check all fields for a match */
3070 + if (cmp_with_glob(OMNIBOOK_SYS_VENDOR, mp->sys_vendor))
3072 + if (cmp_with_glob(OMNIBOOK_PRODUCT_NAME, mp->product_name))
3074 + if (cmp_with_glob(OMNIBOOK_PRODUCT_VERSION, mp->product_version))
3076 + if (cmp_with_glob(OMNIBOOK_BOARD_NAME, mp->board_name))
3079 + /* All required fields matched */
3083 + return (mp - omnibook_models);
3086 +static int __init omnibook_get_tc(void)
3088 + struct omnibook_tc_t *tc;
3090 + for (tc = omnibook_tc; tc->ectype != NONE; ++tc) {
3092 + * Technology code appears in the first two chracters of BIOS version string
3093 + * ended by a dot, but it prefixed a space character on some models and BIOS
3095 + * The new HP/Compaq models use different codes, this is not supported yet.
3097 + if (strstr(omnibook_dmi_ident[OMNIBOOK_BIOS_VERSION], tc->tc))
3101 + return (tc - omnibook_tc);
3104 +static int __init omnibook_init(void)
3109 + char *syslog_name;
3113 + omnibook_userset = user;
3116 + printk(KERN_INFO "%s: module version %s.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_VERSION);
3118 + printk(KERN_INFO "%s: driver version %s.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_VERSION);
3121 + /* saving DMI information */
3122 + if (omnibook_dmi_scan_machine() != 0)
3125 + if (ectype != NONE)
3126 + printk(KERN_WARNING "%s: Forced load with EC firmware type %d.\n", OMNIBOOK_MODULE_NAME, ectype);
3128 + model = omnibook_ident();
3129 + if (omnibook_models[model].ectype != NONE) {
3130 + ectype = omnibook_models[model].ectype;
3131 + syslog_name = omnibook_models[model].syslog_name;
3132 + if (!syslog_name) {
3133 + syslog_name = omnibook_models[model].product_version;
3134 + glob = strchr(syslog_name, '*');
3138 + printk(KERN_INFO "%s: %s detected.\n", OMNIBOOK_MODULE_NAME, syslog_name);
3140 + /* Without explicite informations try chechking for technology code of HP laptops */
3141 + tc = omnibook_get_tc();
3142 + if ((strncmp(omnibook_dmi_ident[OMNIBOOK_SYS_VENDOR], HP_SIGNATURE, strlen(HP_SIGNATURE)) == 0) &&
3143 + (omnibook_tc[tc].ectype != NONE)) {
3144 + ectype = omnibook_tc[tc].ectype;
3145 + printk(KERN_INFO "%s: HP tecnology code %s detected.\n", OMNIBOOK_MODULE_NAME, omnibook_tc[tc].tc);
3147 + printk(KERN_INFO "%s: Unknown model detected.\n", OMNIBOOK_MODULE_NAME);
3160 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3166 + omnibook_ectype = ectype;
3168 + omnibook_proc_root = proc_mkdir(OMNIBOOK_MODULE_NAME, NULL);
3169 + if (! omnibook_proc_root) {
3170 + printk(KERN_ERR "%s: Unable to create /proc/%s.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3174 + pmode = S_IFREG | S_IRUGO;
3175 + proc_version = create_proc_read_entry("version", pmode, omnibook_proc_root, omnibook_proc_version, NULL);
3176 + if (! proc_version) {
3177 + printk(KERN_ERR "%s: Unable to create /proc/%s/version.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3182 + pmode = S_IFREG | S_IRUGO;
3183 + proc_dmi = create_proc_read_entry("dmi", pmode, omnibook_proc_root, omnibook_proc_dmi, NULL);
3185 + printk(KERN_ERR "%s: Unable to create /proc/%s/dmi.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3190 + if ((retval = (ac ? omnibook_ac_init() : 0)))
3194 + if ((retval = (battery ? omnibook_battery_init() : 0)))
3198 + /* /proc/apm emulation needs to read battery and AC adapter status */
3199 + if ((ac == 0) && (battery == 0) && apmemu) {
3200 + if ((retval = omnibook_apmemu_init()))
3204 + if ((retval = (blank ? omnibook_console_blank_init() : 0)))
3207 + if ((retval = (display ? omnibook_display_init() : 0)))
3210 + if ((retval = (dock ? omnibook_dock_init() : 0)))
3213 + if ((retval = (fan ? omnibook_fan_init() : 0)))
3216 + if ((retval = (fan_policy ? omnibook_fan_policy_init() : 0)))
3219 + if ((retval = (lcd ? omnibook_brightness_init() : 0)))
3222 + if ((retval = (onetouch ? omnibook_onetouch_init() : 0)))
3225 + if ((retval = (temperature ? omnibook_temperature_init() : 0)))
3228 + if ((retval = (touchpad ? omnibook_touchpad_init() : 0)))
3231 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3232 + if ((retval = (key_polling ? omnibook_key_polling_init() : 0)))
3235 + printk(KERN_WARNING "%s: module unloading does not work yet on 2.6 kernel.\n", OMNIBOOK_MODULE_NAME);
3241 +static void __exit omnibook_cleanup(void)
3243 + omnibook_ac_cleanup();
3244 + omnibook_apmemu_cleanup();
3245 + omnibook_battery_cleanup();
3246 + omnibook_brightness_cleanup();
3247 + omnibook_console_blank_cleanup();
3248 + omnibook_display_cleanup();
3249 + omnibook_dock_cleanup();
3250 + omnibook_fan_cleanup();
3251 + omnibook_fan_policy_cleanup();
3252 + omnibook_onetouch_cleanup();
3253 + omnibook_temperature_cleanup();
3254 + omnibook_touchpad_cleanup();
3255 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3256 + omnibook_key_polling_cleanup();
3259 + remove_proc_entry("version", omnibook_proc_root);
3261 + remove_proc_entry("dmi", omnibook_proc_root);
3262 + if (omnibook_proc_root)
3263 + remove_proc_entry("omnibook", NULL);
3264 + printk(KERN_INFO "%s: module is unloaded.\n", OMNIBOOK_MODULE_NAME);
3267 +module_init(omnibook_init);
3268 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3269 +module_exit(omnibook_cleanup);
3272 +EXPORT_SYMBOL(omnibook_ectype);
3273 +EXPORT_SYMBOL(omnibook_proc_root);
3275 +MODULE_AUTHOR("Soós Péter <sp@osb.hu>");
3276 +MODULE_DESCRIPTION("Kernel interface for HP OmniBook, HP Pavilion, Toshiba Satellite, Acer Aspire and Compal ACL00 laptops");
3277 +MODULE_LICENSE("GPL");
3278 +MODULE_PARM(ectype, "i");
3279 +MODULE_PARM(ac, "i");
3280 +MODULE_PARM(apmemu, "i");
3281 +MODULE_PARM(battery, "i");
3282 +MODULE_PARM(blank, "i");
3283 +MODULE_PARM(display, "i");
3284 +MODULE_PARM(dock, "i");
3285 +MODULE_PARM(dmi, "i");
3286 +MODULE_PARM(fan, "i");
3287 +MODULE_PARM(fan_policy, "i");
3288 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3289 +MODULE_PARM(key_polling, "i");
3291 +MODULE_PARM(lcd, "i");
3292 +MODULE_PARM(onetouch, "i");
3293 +MODULE_PARM(temperature, "i");
3294 +MODULE_PARM(touchpad, "i");
3295 +MODULE_PARM(user, "i");
3296 +MODULE_PARM_DESC(ectype, "Type of embedded controller firmware");
3297 +MODULE_PARM_DESC(ac, "Use 0 to disable, 1 to enable AC adapter status monitoring");
3298 +MODULE_PARM_DESC(apmemu, "Use 0 to disable, 1 to enable /proc/apm emulation");
3299 +MODULE_PARM_DESC(battery, "Use 0 to disable, 1 to enable battery status monitoring");
3300 +MODULE_PARM_DESC(blank, "Use 0 to disable, 1 to enable lcd console blanking");
3301 +MODULE_PARM_DESC(display, "Use 0 to disable, 1 to enable display status handling");
3302 +MODULE_PARM_DESC(dock, "Use 0 to disable, 1 to enable docking station support");
3303 +MODULE_PARM_DESC(dmi, "Use 0 to disable, 1 to enable /proc/omnibook/dmi");
3304 +MODULE_PARM_DESC(fan, "Use 0 to disable, 1 to enable fan status monitor and control");
3305 +MODULE_PARM_DESC(fan_policy, "Use 0 to disable, 1 to enable fan control policy support");
3306 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3307 +MODULE_PARM_DESC(key_polling, "Use 0 to disable, 1 to enable to scancode emulation for volume keys");
3309 +MODULE_PARM_DESC(lcd, "Use 0 to disable, 1 to enable to LCD brightness support");
3310 +MODULE_PARM_DESC(onetouch, "Use 0 to disable, 1 to enable onetouch handling");
3311 +MODULE_PARM_DESC(temperature, "Use 0 to disable, 1 to enable thermal status and policy support");
3312 +MODULE_PARM_DESC(touchpad, "Use 0 to disable, 1 to enable touchpad handling");
3313 +MODULE_PARM_DESC(user, "Use 0 to disable, 1 to enable users to set parameters");
3316 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/init.h linux-2.6.1-gentoo-test/drivers/char/omnibook/init.h
3317 --- linux-2.6.1-gentoo/drivers/char/omnibook/init.h 1970-01-01 01:00:00.000000000 +0100
3318 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/init.h 2004-01-09 22:33:49.000000000 +0000
3321 + * init.h -- initialization and cleanup functions
3323 + * This program is free software; you can redistribute it and/or modify it
3324 + * under the terms of the GNU General Public License as published by the
3325 + * Free Software Foundation; either version 2, or (at your option) any
3328 + * This program is distributed in the hope that it will be useful, but
3329 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3330 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3331 + * General Public License for more details.
3333 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3336 +extern int __init omnibook_ac_init(void);
3337 +extern void __exit omnibook_ac_cleanup(void);
3338 +extern int __init omnibook_apmemu_init(void);
3339 +extern void __exit omnibook_apmemu_cleanup(void);
3340 +extern int __init omnibook_battery_init(void);
3341 +extern void __exit omnibook_battery_cleanup(void);
3342 +extern int __init omnibook_console_blank_init(void);
3343 +extern void __exit omnibook_console_blank_cleanup(void);
3344 +extern int __init omnibook_display_init(void);
3345 +extern void __exit omnibook_display_cleanup(void);
3346 +extern int __init omnibook_dock_init(void);
3347 +extern void __exit omnibook_dock_cleanup(void);
3348 +extern int __init omnibook_fan_init(void);
3349 +extern void __exit omnibook_fan_cleanup(void);
3350 +extern int __init omnibook_fan_policy_init(void);
3351 +extern void __exit omnibook_fan_policy_cleanup(void);
3352 +extern int __init omnibook_onetouch_init(void);
3353 +extern void __exit omnibook_onetouch_cleanup(void);
3354 +extern int __init omnibook_key_polling_init(void);
3355 +extern void __exit omnibook_key_polling_cleanup(void);
3356 +extern int __init omnibook_touchpad_init(void);
3357 +extern void __exit omnibook_touchpad_cleanup(void);
3358 +extern int __init omnibook_temperature_init(void);
3359 +extern void __exit omnibook_temperature_cleanup(void);
3360 +extern int __init omnibook_brightness_init(void);
3361 +extern void __exit omnibook_brightness_cleanup(void);
3364 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/lcd.c linux-2.6.1-gentoo-test/drivers/char/omnibook/lcd.c
3365 --- linux-2.6.1-gentoo/drivers/char/omnibook/lcd.c 1970-01-01 01:00:00.000000000 +0100
3366 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/lcd.c 2004-01-09 22:33:49.000000000 +0000
3369 + * lcd.c -- LCD brightness and on/off
3371 + * This program is free software; you can redistribute it and/or modify it
3372 + * under the terms of the GNU General Public License as published by the
3373 + * Free Software Foundation; either version 2, or (at your option) any
3376 + * This program is distributed in the hope that it will be useful, but
3377 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3378 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3379 + * General Public License for more details.
3381 + * Written by Maciek Górniak <mago@acn.waw.pl>, 2002
3382 + * Modified by Soós Péter <sp@osb.hu>, 2002-2003
3385 +#include <linux/config.h>
3386 +#include <linux/module.h>
3387 +#include <linux/version.h>
3388 +#include <linux/types.h>
3389 +#include <linux/init.h>
3390 +#include <linux/proc_fs.h>
3392 +#include <asm/system.h>
3393 +#include <asm/errno.h>
3394 +#include <asm/io.h>
3395 +#include <asm/uaccess.h>
3397 +#ifdef OMNIBOOK_STANDALONE
3398 +#include "omnibook.h"
3400 +#include <linux/omnibook.h>
3406 +static struct proc_dir_entry *proc_brightness;
3408 +int omnibook_get_lcd_brightness(void)
3414 + switch (omnibook_ectype) {
3416 + if ((retval = omnibook_ec_read(XE3GF_BRTS, &brgt)))
3418 + retval = brgt &= XE3GF_BRTS_MASK;
3421 + if ((retval = omnibook_ec_read(XE3GC_BTVL, &brgt)))
3423 + retval = brgt &= XE3GC_BTVL_MASK;
3426 + printk(KERN_INFO "%s: LCD brightness handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3434 +int omnibook_set_lcd_brightness(u8 brgt)
3439 + brgt = (brgt > 10) ? 10 : brgt;
3441 + switch (omnibook_ectype) {
3443 + if ((retval = omnibook_ec_write(XE3GF_BRTS, brgt)))
3447 + if ((retval = omnibook_ec_write(XE3GC_BTVL, brgt)))
3451 + printk(KERN_INFO "%s: LCD brightness handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3458 +static int omnibook_proc_brightness_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
3463 + brgt = omnibook_get_lcd_brightness();
3467 + b += sprintf(b, "LCD brightness: %2d\n", brgt);
3469 + return omnibook_proc_len(buffer, start, off, count, eof, b);;
3472 +static int omnibook_proc_brightness_set(struct file *file, const char *buffer, unsigned long count, void *data)
3479 + len = sizeof(value) - 1;
3482 + if (copy_from_user(value, buffer, len))
3486 + if (strcmp(value, "off\n") == 0)
3487 + omnibook_lcd_blank(1);
3488 + else if (strcmp(value, "on\n") == 0)
3489 + omnibook_lcd_blank(0);
3492 + for (i = 0; (value[i] != '\0') && (value[i] != '\n'); i++)
3493 + if ((value[i] >= '0') && (value[i] <= '9'))
3494 + brgt = brgt * 10 + value[i] - '0';
3498 + if ((brgt >= 0) && (brgt <= 10))
3499 + omnibook_set_lcd_brightness(brgt);
3507 +int __init omnibook_brightness_init(void)
3512 + switch (omnibook_ectype) {
3515 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
3516 + if (omnibook_userset)
3517 + pmode = pmode | S_IWUGO;
3518 + proc_brightness = create_proc_entry("lcd", pmode, omnibook_proc_root);
3521 + printk(KERN_INFO "%s: LCD brightness handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3524 + if (! proc_brightness) {
3525 + printk(KERN_ERR "%s: Unable to create /proc/%s/lcd.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3528 + proc_brightness->read_proc = omnibook_proc_brightness_status;
3529 + proc_brightness->write_proc = omnibook_proc_brightness_set;
3531 + printk(KERN_INFO "%s: LCD brightness handling is enabled.\n", OMNIBOOK_MODULE_NAME);
3534 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
3539 +void __exit omnibook_brightness_cleanup(void)
3542 + if (proc_brightness)
3543 + remove_proc_entry("lcd", omnibook_proc_root);
3547 +EXPORT_SYMBOL(omnibook_get_lcd_brightness);
3548 +EXPORT_SYMBOL(omnibook_set_lcd_brightness);
3551 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/omnibook.h linux-2.6.1-gentoo-test/drivers/char/omnibook/omnibook.h
3552 --- linux-2.6.1-gentoo/drivers/char/omnibook/omnibook.h 1970-01-01 01:00:00.000000000 +0100
3553 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/omnibook.h 2004-01-09 22:33:49.000000000 +0000
3556 + * omnibook.h -- High level data structures and functions of omnibook
3559 + * This program is free software; you can redistribute it and/or modify it
3560 + * under the terms of the GNU General Public License as published by the
3561 + * Free Software Foundation; either version 2, or (at your option) any
3564 + * This program is distributed in the hope that it will be useful, but
3565 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3566 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3567 + * General Public License for more details.
3569 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3573 + * Module informations
3576 +#define OMNIBOOK_MODULE_NAME "omnibook"
3577 +#define OMNIBOOK_MODULE_VERSION "2003-12-08"
3583 +extern int omnibook_ectype;
3586 + XE3GF, /* HP OmniBook XE3 GF, most Toshiba Satellites and more*/
3587 + XE3GC, /* HP OmniBook XE3 GC, GD, GE and compatible */
3588 + OB500, /* HP OmniBook 500 and compatible */
3589 + OB510, /* HP OmniBook 510 */
3590 + OB6000, /* HP OmniBook 6000 */
3591 + OB6100, /* HP OmniBook 6100 */
3592 + XE4500, /* HP OmniBook xe4500 and compatible */
3593 + OB4150, /* HP OmniBook 4150 */
3594 + XE2 /* HP OmniBook XE2 */
3597 +extern struct __init proc_dir_entry *omnibook_proc_root;
3598 +extern int omnibook_userset;
3600 +extern int omnibook_get_ac(void);
3602 +struct omnibook_battery_info {
3603 + u8 type; /* 1 - Li-Ion, 2 NiMH */
3604 + u16 sn; /* Serial number */
3605 + u16 dv; /* Design Voltage */
3606 + u16 dc; /* Design Capacity */
3608 +struct omnibook_battery_status {
3609 + u16 pv; /* Present Voltage */
3610 + u16 rc; /* Remaining Capacity */
3611 + u16 lc; /* Last Full Capacity */
3612 + u8 gauge; /* Gauge in % */
3613 + u8 status; /* 0 - unknown, 1 - charged, 2 - discharging, 3 - charging, 4 - critical) */
3616 + OMNIBOOK_BATTSTAT_UNKNOWN,
3617 + OMNIBOOK_BATTSTAT_CHARGED,
3618 + OMNIBOOK_BATTSTAT_DISCHARGING,
3619 + OMNIBOOK_BATTSTAT_CHARGING,
3620 + OMNIBOOK_BATTSTAT_CRITICAL
3623 +extern int omnibook_battery_present(int num);
3624 +extern int omnibook_get_battery_info(int num, struct omnibook_battery_info *battinfo);
3625 +extern int omnibook_get_battery_status(int num, struct omnibook_battery_status *battstat);
3627 +extern int omnibook_console_blank_enabled;
3628 +extern int omnibook_lcd_blank(int blank);
3629 +extern int omnibook_console_blank_enable(void);
3630 +extern int omnibook_console_blank_disable(void);
3632 +extern int omnibook_get_display(void);
3634 +extern int omnibook_get_dock(void);
3636 +extern int omnibook_get_fan(void);
3637 +extern int omnibook_fan_on(void);
3638 +extern int omnibook_fan_off(void);
3641 + * Default temperature limits.
3642 + * Danger! You may overheat your CPU!
3643 + * Do not change these values unless you exactly know what you do.
3646 +#define OMNIBOOK_FAN_LEVELS 7
3647 +#define OMNIBOOK_FAN_MIN 25 /* Minimal value of fan off temperature */
3648 +#define OMNIBOOK_FOT_MAX 75 /* Maximal value of fan off temperature */
3649 +#define OMNIBOOK_FAN_MAX 95 /* Maximal value of fan on temperature */
3650 +#define OMNIBOOK_FOT_DEFAULT 60 /* Default value of fan off temperature */
3651 +#define OMNIBOOK_FAN1_DEFAULT 75 /* Default value of fan on temperature */
3652 +#define OMNIBOOK_FAN2_DEFAULT 85 /* Default value of fan level 2 temperature */
3653 +#define OMNIBOOK_FAN3_DEFAULT 90 /* Default value of fan level 3 temperature */
3654 +#define OMNIBOOK_FAN4_DEFAULT 95 /* Default value of fan level 4 temperature */
3655 +#define OMNIBOOK_FAN5_DEFAULT 95 /* Default value of fan level 5 temperature */
3656 +#define OMNIBOOK_FAN6_DEFAULT 95 /* Default value of fan level 6 temperature */
3657 +#define OMNIBOOK_FAN7_DEFAULT 95 /* Default value of fan level 7 temperature */
3658 +#define OMNIBOOK_FAN_POLICY_STRING 32 /* Maximal length of temperature policy control string */
3660 +extern u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS];
3662 +extern int omnibook_get_fan_policy(void);
3663 +extern int omnibook_set_fan_policy(void);
3664 +extern int omnibook_set_fan_policy_defaults(void);
3666 +extern int omnibook_get_lcd_brightness(void);
3667 +extern int omnibook_set_lcd_brightness(u8 brgt);
3669 +extern int omnibook_onetouch_enabled;
3670 +extern int omnibook_onetouch_enable(void);
3671 +extern int omnibook_onetouch_disable(void);
3673 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3674 +extern int omnibook_key_polling_enabled;
3675 +extern int omnibook_key_polling_enable(void);
3676 +extern int omnibook_key_polling_disable(void);
3679 +extern int omnibook_get_cpu_temp(void);
3681 +extern int omnibook_touchpad_enabled;
3682 +extern int omnibook_touchpad_enable(void);
3683 +extern int omnibook_touchpad_disable(void);
3686 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/onetouch.c linux-2.6.1-gentoo-test/drivers/char/omnibook/onetouch.c
3687 --- linux-2.6.1-gentoo/drivers/char/omnibook/onetouch.c 1970-01-01 01:00:00.000000000 +0100
3688 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/onetouch.c 2004-01-09 22:33:49.000000000 +0000
3691 + * onetouch.c -- code to handling OneTouch buttons
3693 + * This program is free software; you can redistribute it and/or modify it
3694 + * under the terms of the GNU General Public License as published by the
3695 + * Free Software Foundation; either version 2, or (at your option) any
3698 + * This program is distributed in the hope that it will be useful, but
3699 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3700 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3701 + * General Public License for more details.
3703 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3707 +#include <linux/config.h>
3708 +#include <linux/module.h>
3709 +#include <linux/version.h>
3710 +#include <linux/types.h>
3711 +#include <linux/init.h>
3712 +#include <linux/pm.h>
3713 +#include <linux/proc_fs.h>
3715 +#include <asm/system.h>
3716 +#include <asm/errno.h>
3717 +#include <asm/io.h>
3718 +#include <asm/uaccess.h>
3720 +#ifdef OMNIBOOK_STANDALONE
3721 +#include "omnibook.h"
3723 +#include <linux/omnibook.h>
3729 +static struct pm_dev *pm_onetouch;
3730 +static pm_callback pm_onetouch_callback = NULL;
3732 +static struct proc_dir_entry *proc_onetouch;
3734 +/* There is no information about reading OneTouch status */
3735 +int omnibook_onetouch_enabled = 0;
3737 +static int omnibook_onetouch_on(void)
3739 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_ONETOUCH_ENABLE)) {
3740 + printk(KERN_ERR "%s: failed OneTouch enable command.\n", OMNIBOOK_MODULE_NAME);
3746 +static int omnibook_onetouch_off(void)
3748 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_ONETOUCH_DISABLE)) {
3749 + printk(KERN_ERR "%s: failed OneTouch disable command.\n", OMNIBOOK_MODULE_NAME);
3756 + * Power management handler: on resume it reenables the OneTouch buttons it they were enabled previously
3759 +static int pm_onetouch_handler(struct pm_dev *dev, pm_request_t rqst, void *data)
3763 + if (omnibook_onetouch_enabled)
3764 + return omnibook_onetouch_on();
3767 + if (omnibook_onetouch_enabled)
3768 + return omnibook_onetouch_off();
3774 +static int omnibook_onetouch_register(void)
3776 + pm_onetouch_callback = pm_onetouch_handler;
3777 + pm_onetouch = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_onetouch_callback);
3778 + return (pm_onetouch ? 0 : -EFAULT);
3781 +static void omnibook_onetouch_unregister(void)
3783 + pm_onetouch_callback = NULL;
3784 + pm_unregister(pm_onetouch);
3787 +int omnibook_onetouch_enable(void)
3790 + switch (omnibook_ectype) {
3798 + if (! omnibook_onetouch_enabled) {
3799 + if (omnibook_onetouch_on())
3801 + omnibook_onetouch_enabled = 1;
3802 + printk(KERN_INFO "%s: OneTouch buttons are enabled.\n", OMNIBOOK_MODULE_NAME);
3806 + omnibook_onetouch_enabled = 0;
3813 +int omnibook_onetouch_disable(void)
3816 + switch (omnibook_ectype) {
3824 + if (omnibook_onetouch_enabled) {
3825 + if (omnibook_onetouch_off()) {
3828 + omnibook_onetouch_enabled = 0;
3829 + printk(KERN_INFO "%s: OneTouch buttons are disabled.\n", OMNIBOOK_MODULE_NAME);
3833 + omnibook_onetouch_enabled = 0;
3840 +static int omnibook_onetouch_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
3844 + b += sprintf(b, "OneTouch buttons are %s\n", (omnibook_onetouch_enabled) ? "enabled" : "disabled");
3846 + return omnibook_proc_len(buffer, start, off, count, eof, b);
3849 +static int omnibook_onetouch_set(struct file *file, const char *buffer, unsigned long count, void *data)
3851 + char status[1] = {'\0'};
3853 + if (copy_from_user(status, buffer, 1))
3855 + switch (*status) {
3857 + omnibook_onetouch_disable();
3860 + omnibook_onetouch_enable();
3868 +int __init omnibook_onetouch_init(void)
3874 + switch (omnibook_ectype) {
3882 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
3883 + if (omnibook_userset)
3884 + pmode = pmode | S_IWUGO;
3885 + proc_onetouch = create_proc_entry("onetouch", pmode, omnibook_proc_root);
3888 + printk(KERN_INFO "%s: OneTouch button handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3889 + omnibook_onetouch_enabled = 0;
3892 + if (proc_onetouch) {
3893 + proc_onetouch->read_proc = omnibook_onetouch_status;
3894 + proc_onetouch->write_proc = omnibook_onetouch_set;
3896 + printk(KERN_ERR "%s: Unable to create /proc/%s/onetouch.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3899 + if ((retval = omnibook_onetouch_register()))
3901 + if ((retval = omnibook_onetouch_enable()))
3906 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
3912 +void __exit omnibook_onetouch_cleanup(void)
3915 + if (proc_onetouch)
3916 + remove_proc_entry("onetouch", omnibook_proc_root);
3918 + omnibook_onetouch_unregister();
3920 + omnibook_onetouch_disable();
3924 +EXPORT_SYMBOL(omnibook_onetouch_enabled);
3925 +EXPORT_SYMBOL(omnibook_onetouch_enable);
3926 +EXPORT_SYMBOL(omnibook_onetouch_disable);
3929 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/polling.c linux-2.6.1-gentoo-test/drivers/char/omnibook/polling.c
3930 --- linux-2.6.1-gentoo/drivers/char/omnibook/polling.c 1970-01-01 01:00:00.000000000 +0100
3931 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/polling.c 2004-01-09 22:33:49.000000000 +0000
3934 + * polling.c -- scancode emulation for volume buttons on certain models
3936 + * This program is free software; you can redistribute it and/or modify it
3937 + * under the terms of the GNU General Public License as published by the
3938 + * Free Software Foundation; either version 2, or (at your option) any
3941 + * This program is distributed in the hope that it will be useful, but
3942 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3943 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3944 + * General Public License for more details.
3946 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3950 +#include <linux/config.h>
3951 +#include <linux/module.h>
3952 +#include <linux/version.h>
3953 +#include <linux/types.h>
3954 +#include <linux/init.h>
3955 +#include <linux/pm.h>
3956 +#include <linux/proc_fs.h>
3957 +#include <linux/version.h>
3958 +#include <linux/timer.h>
3959 +#include <linux/kbd_ll.h>
3961 +#include <asm/system.h>
3962 +#include <asm/errno.h>
3963 +#include <asm/io.h>
3964 +#include <asm/uaccess.h>
3966 +#ifdef OMNIBOOK_STANDALONE
3967 +#include "omnibook.h"
3969 +#include <linux/omnibook.h>
3976 + * Pollong interval for keys (50 ms)
3979 +#define OMNIBOOK_POLL 50 * HZ / 1000
3983 +static struct pm_dev *pm_key_polling;
3984 +static pm_callback pm_key_polling_callback = NULL;
3986 +static struct proc_dir_entry *proc_key_polling;
3988 +static struct timer_list omnibook_key_timer;
3990 +int omnibook_key_polling_enabled = 0;
3991 +static int pm_omnibook_key_polling_enabled;
3993 +static void omnibook_key_poller(unsigned long data)
3997 + switch (omnibook_ectype) {
3999 + omnibook_ec_read(XE3GC_Q0A, &q0a);
4000 + omnibook_ec_write(XE3GC_Q0A, 0);
4002 +// if (q0a & XE3GC_SLPB_MASK)
4003 +// printk(KERN_INFO "%s: Sleep button pressed.\n", OMNIBOOK_MODULE_NAME);
4004 +// if (q0a & XE3GC_F5_MASK)
4005 +// printk(KERN_INFO "%s: Fn-F5 - LCD/CRT switch pressed.\n", OMNIBOOK_MODULE_NAME);
4007 + * Volume button scancode emulaton
4008 + * It emulates a key press and a release without repeat as other OneTouch buttons do.
4010 + if (q0a & XE3GC_VOLD_MASK) {
4011 + printk(KERN_INFO "%s: Fn-down arrow or Volume down pressed.\n", OMNIBOOK_MODULE_NAME);
4012 + handle_scancode(0xe0, 1);
4013 + handle_scancode(XE3GC_VOLD_SCAN, 1);
4014 + handle_scancode(0xe0, 0);
4015 + handle_scancode(XE3GC_VOLD_SCAN, 0);
4017 + if (q0a & XE3GC_VOLU_MASK) {
4018 + printk(KERN_INFO "%s: Fn-up arrow or Volume up pressed.\n", OMNIBOOK_MODULE_NAME);
4019 + handle_scancode(0xe0, 1);
4020 + handle_scancode(XE3GC_VOLU_SCAN, 1);
4021 + handle_scancode(0xe0, 0);
4022 + handle_scancode(XE3GC_VOLU_SCAN, 0);
4024 + if (q0a & XE3GC_MUTE_MASK) {
4025 + printk(KERN_INFO "%s: Fn+F7 - Volume mute pressed.\n", OMNIBOOK_MODULE_NAME);
4026 + handle_scancode(0xe0, 1);
4027 + handle_scancode(XE3GC_MUTE_SCAN, 1);
4028 + handle_scancode(0xe0, 0);
4029 + handle_scancode(XE3GC_MUTE_SCAN, 0);
4031 +// if (q0a & XE3GC_CNTR_MASK)
4032 +// printk(KERN_INFO "%s: Fn+F3/Fn+F4 - Contrast up or down pressed.\n", OMNIBOOK_MODULE_NAME);
4033 +// if (q0a & XE3GC_BRGT_MASK)
4034 +// printk(KERN_INFO "%s: Fn+F1/Fn+F2 - Brightness up or down pressed.\n", OMNIBOOK_MODULE_NAME);
4038 + mod_timer(&omnibook_key_timer, jiffies + OMNIBOOK_POLL);
4041 +int omnibook_key_polling_enable(void)
4044 + switch (omnibook_ectype) {
4046 + printk(KERN_INFO "%s: Volume buttons do not generate scancodes on this model.\n", OMNIBOOK_MODULE_NAME);
4047 + init_timer(&omnibook_key_timer);
4048 + omnibook_key_timer.data = 0;
4049 + omnibook_key_timer.function = omnibook_key_poller;
4050 + omnibook_key_timer.expires = jiffies + OMNIBOOK_POLL;
4051 + add_timer(&omnibook_key_timer);
4052 + omnibook_key_polling_enabled = 1;
4053 + printk(KERN_INFO "%s: Scancode emulation for volume buttons enabled.\n", OMNIBOOK_MODULE_NAME);
4056 + omnibook_key_polling_enabled = 0;
4063 +int omnibook_key_polling_disable(void)
4066 + switch (omnibook_ectype) {
4068 + if (&omnibook_key_timer) {
4069 + del_timer(&omnibook_key_timer);
4070 + printk(KERN_INFO "%s: Scancode emulation for volume buttons disabled.\n", OMNIBOOK_MODULE_NAME);
4072 + omnibook_key_polling_enabled = 0;
4075 + omnibook_key_polling_enabled = 0;
4083 + * Power management handler: on resume it reenables key polling if it was enabled previously
4086 +static int pm_key_polling_handler(struct pm_dev *dev, pm_request_t rqst, void *data)
4091 + if (pm_omnibook_key_polling_enabled)
4092 + return omnibook_key_polling_enable();
4095 + if (omnibook_key_polling_enabled)
4096 + pm_omnibook_key_polling_enabled = omnibook_key_polling_enabled;
4097 + return omnibook_key_polling_disable();
4103 +static int omnibook_key_polling_register(void)
4105 + pm_key_polling_callback = pm_key_polling_handler;
4106 + pm_key_polling = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_key_polling_callback);
4107 + return (pm_key_polling ? 0 : -EFAULT);
4110 +static void omnibook_key_polling_unregister(void)
4112 + pm_key_polling_callback = NULL;
4113 + pm_unregister(pm_key_polling);
4116 +static int omnibook_key_polling_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
4120 + b += sprintf(b, "Volume buttons handling is %s\n", (omnibook_key_polling_enabled) ? "enabled" : "disabled");
4122 + return omnibook_proc_len(buffer, start, off, count, eof, b);
4125 +static int omnibook_key_polling_set(struct file *file, const char *buffer, unsigned long count, void *data)
4127 + char status[1] = {'\0'};
4129 + if (copy_from_user(status, buffer, 1))
4131 + switch (*status) {
4133 + omnibook_key_polling_disable();
4136 + omnibook_key_polling_enable();
4145 +int __init omnibook_key_polling_init(void)
4152 + switch (omnibook_ectype) {
4154 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
4155 + if (omnibook_userset)
4156 + pmode = pmode | S_IWUGO;
4157 + proc_key_polling = create_proc_entry("key_polling", pmode, omnibook_proc_root);
4160 + printk(KERN_INFO "%s: Key polling is unnecessary on this machine.\n", OMNIBOOK_MODULE_NAME);
4161 + omnibook_key_polling_enabled = 0;
4164 + if (proc_key_polling) {
4165 + proc_key_polling->read_proc = omnibook_key_polling_status;
4166 + proc_key_polling->write_proc = omnibook_key_polling_set;
4168 + printk(KERN_ERR "%s: Unable to create /proc/%s/key_polling.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
4171 + if ((retval = omnibook_key_polling_register()))
4173 +// if ((retval = omnibook_key_polling_enable()))
4176 + printk(KERN_INFO "%s: Key polling is enabled.\n", OMNIBOOK_MODULE_NAME);
4179 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
4184 +void __exit omnibook_key_polling_cleanup(void)
4187 + if (proc_key_polling)
4188 + remove_proc_entry("key_polling", omnibook_proc_root);
4189 + if (pm_key_polling)
4190 + omnibook_key_polling_unregister();
4192 + omnibook_key_polling_disable();
4196 +EXPORT_SYMBOL(omnibook_key_polling_enabled);
4197 +EXPORT_SYMBOL(omnibook_key_polling_enable);
4198 +EXPORT_SYMBOL(omnibook_key_polling_disable);
4201 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/temperature.c linux-2.6.1-gentoo-test/drivers/char/omnibook/temperature.c
4202 --- linux-2.6.1-gentoo/drivers/char/omnibook/temperature.c 1970-01-01 01:00:00.000000000 +0100
4203 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/temperature.c 2004-01-09 22:33:49.000000000 +0000
4206 + * temperature.c -- CPU temprature monitoring
4208 + * This program is free software; you can redistribute it and/or modify it
4209 + * under the terms of the GNU General Public License as published by the
4210 + * Free Software Foundation; either version 2, or (at your option) any
4213 + * This program is distributed in the hope that it will be useful, but
4214 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4215 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4216 + * General Public License for more details.
4218 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
4222 +#include <linux/config.h>
4223 +#include <linux/module.h>
4224 +#include <linux/version.h>
4225 +#include <linux/types.h>
4226 +#include <linux/init.h>
4227 +#include <linux/proc_fs.h>
4229 +#include <asm/system.h>
4230 +#include <asm/errno.h>
4231 +#include <asm/io.h>
4232 +#include <asm/uaccess.h>
4234 +#ifdef OMNIBOOK_STANDALONE
4235 +#include "omnibook.h"
4237 +#include <linux/omnibook.h>
4243 +static struct proc_dir_entry *proc_temperature;
4245 +int omnibook_get_cpu_temp(void)
4250 + switch (omnibook_ectype) {
4252 + if ((retval = omnibook_ec_read(XE3GF_CTMP, &temp)))
4257 + if ((retval = omnibook_ec_read(XE3GC_CTMP, &temp)))
4267 + if ((retval = omnibook_ec_read(OB500_CTMP, &temp)))
4272 + if ((retval = omnibook_ec_read(OB4150_TMP, &temp)))
4277 + printk(KERN_INFO "%s: Temperature monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
4278 + retval = -ENODEV ;
4283 +static int omnibook_proc_temperature(char *buffer, char **start, off_t off, int count, int *eof, void *data)
4288 + cpu_temp = omnibook_get_cpu_temp();
4292 + b += sprintf(b, "CPU temperature: %2d C\n", cpu_temp);
4294 + return omnibook_proc_len(buffer, start, off, count, eof, b);
4297 +int __init omnibook_temperature_init(void)
4301 + switch (omnibook_ectype) {
4311 + pmode = S_IFREG | S_IRUGO;
4312 + proc_temperature = create_proc_read_entry("temperature", pmode, omnibook_proc_root, omnibook_proc_temperature, NULL);
4315 + printk(KERN_INFO "%s: Temperature monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
4318 + if (! proc_temperature) {
4319 + printk(KERN_ERR "%s: Unable to create /proc/%s/temperature.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
4322 + printk(KERN_INFO "%s: Temperature monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
4326 +void __exit omnibook_temperature_cleanup(void)
4328 + if (proc_temperature)
4329 + remove_proc_entry("temperature", omnibook_proc_root);
4332 +EXPORT_SYMBOL(omnibook_get_cpu_temp);
4335 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/touchpad.c linux-2.6.1-gentoo-test/drivers/char/omnibook/touchpad.c
4336 --- linux-2.6.1-gentoo/drivers/char/omnibook/touchpad.c 1970-01-01 01:00:00.000000000 +0100
4337 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/touchpad.c 2004-01-09 22:33:49.000000000 +0000
4340 + * touchpad.c -- enable/disable touchpad
4342 + * This program is free software; you can redistribute it and/or modify it
4343 + * under the terms of the GNU General Public License as published by the
4344 + * Free Software Foundation; either version 2, or (at your option) any
4347 + * This program is distributed in the hope that it will be useful, but
4348 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4349 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4350 + * General Public License for more details.
4352 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
4356 +#include <linux/config.h>
4357 +#include <linux/module.h>
4358 +#include <linux/version.h>
4359 +#include <linux/types.h>
4360 +#include <linux/init.h>
4361 +#include <linux/pm.h>
4362 +#include <linux/proc_fs.h>
4364 +#include <asm/system.h>
4365 +#include <asm/errno.h>
4366 +#include <asm/io.h>
4367 +#include <asm/uaccess.h>
4369 +#ifdef OMNIBOOK_STANDALONE
4370 +#include "omnibook.h"
4372 +#include <linux/omnibook.h>
4378 +static struct pm_dev *pm_touchpad;
4379 +static pm_callback pm_touchpad_callback = NULL;
4381 +static struct proc_dir_entry *proc_touchpad;
4383 +#ifdef CONFIG_MOUSE_PS2
4384 +#define OMNIBOOK_TOUCHPAD
4387 +#ifdef CONFIG_PSMOUSE
4388 +#define OMNIBOOK_TOUCHPAD
4391 +#ifdef OMNIBOOK_TOUCHPAD
4392 +/* Touchpad is enabled by default */
4393 +int omnibook_touchpad_enabled = 1;
4395 +int omnibook_touchpad_enabled = 0;
4398 +static int omnibook_touchpad_on(void)
4400 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_TOUCHPAD_ENABLE)) {
4401 + printk(KERN_ERR "%s: failed touchpad enable command.\n", OMNIBOOK_MODULE_NAME);
4407 +static int omnibook_touchpad_off(void)
4409 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_TOUCHPAD_DISABLE)) {
4410 + printk(KERN_ERR "%s: failed touchpad disable command.\n", OMNIBOOK_MODULE_NAME);
4417 + * Power management handler: on resume it redisables the touchpad if it was disabled previously
4420 +static int pm_touchpad_handler(struct pm_dev *dev, pm_request_t rqst, void *data)
4424 + if (! omnibook_touchpad_enabled)
4425 + return omnibook_touchpad_off();
4431 +static int omnibook_touchpad_register(void)
4433 + pm_touchpad_callback = pm_touchpad_handler;
4434 + pm_touchpad = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_touchpad_callback);
4435 + return (pm_touchpad ? 0 : -EFAULT);
4438 +static void omnibook_touchpad_unregister(void)
4440 + pm_touchpad_callback = NULL;
4441 + pm_unregister(pm_touchpad);
4444 +int omnibook_touchpad_enable(void)
4446 +#ifdef OMNIBOOK_TOUCHPAD
4447 + switch (omnibook_ectype) {
4450 + if (! omnibook_touchpad_enabled) {
4451 + if (omnibook_touchpad_on())
4453 + omnibook_touchpad_enabled = 1;
4454 + printk(KERN_INFO "%s: Touchpad is enabled.\n", OMNIBOOK_MODULE_NAME);
4459 + omnibook_touchpad_enabled = 0;
4463 + omnibook_touchpad_enabled = 1;
4470 +int omnibook_touchpad_disable(void)
4472 +#ifdef OMNIBOOK_TOUCHPAD
4473 + switch (omnibook_ectype) {
4476 + if (omnibook_touchpad_enabled) {
4477 + if (omnibook_touchpad_off()) {
4480 + omnibook_touchpad_enabled = 0;
4481 + printk(KERN_INFO "%s: Touchpad is disabled.\n", OMNIBOOK_MODULE_NAME);
4486 + omnibook_touchpad_enabled = 0;
4490 + omnibook_touchpad_enabled = 1;
4497 +static int omnibook_touchpad_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
4501 + b += sprintf(b, "Touchpad is %s\n", (omnibook_touchpad_enabled) ? "enabled" : "disabled");
4503 + return omnibook_proc_len(buffer, start, off, count, eof, b);
4506 +static int omnibook_touchpad_set(struct file *file, const char *buffer, unsigned long count, void *data)
4508 + char status[1] = {'\0'};
4510 + if (copy_from_user(status, buffer, 1))
4512 + switch (*status) {
4514 + omnibook_touchpad_disable();
4517 + omnibook_touchpad_enable();
4525 +int __init omnibook_touchpad_init(void)
4527 +#ifdef OMNIBOOK_TOUCHPAD
4531 + switch (omnibook_ectype) {
4534 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
4535 + if (omnibook_userset)
4536 + pmode = pmode | S_IWUGO;
4537 + proc_touchpad = create_proc_entry("touchpad", pmode, omnibook_proc_root);
4540 + printk(KERN_INFO "%s: Touchpad handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
4541 + omnibook_touchpad_enabled = 1;
4544 + if (proc_touchpad) {
4545 + proc_touchpad->read_proc = omnibook_touchpad_status;
4546 + proc_touchpad->write_proc = omnibook_touchpad_set;
4548 + printk(KERN_ERR "%s: Unable to create /proc/%s/touchpad.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
4551 + if ((retval = omnibook_touchpad_register()))
4556 + printk(KERN_ERR "%s: PS/2 mouse support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
4562 +void __exit omnibook_touchpad_cleanup(void)
4564 +#ifdef OMNIBOOK_TOUCHPAD
4565 + if (proc_touchpad)
4566 + remove_proc_entry("touchpad", omnibook_proc_root);
4568 + omnibook_touchpad_unregister();
4569 + omnibook_touchpad_enable();
4573 +EXPORT_SYMBOL(omnibook_touchpad_enabled);
4574 +EXPORT_SYMBOL(omnibook_touchpad_enable);
4575 +EXPORT_SYMBOL(omnibook_touchpad_disable);
4578 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/util.c linux-2.6.1-gentoo-test/drivers/char/omnibook/util.c
4579 --- linux-2.6.1-gentoo/drivers/char/omnibook/util.c 1970-01-01 01:00:00.000000000 +0100
4580 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/util.c 2004-01-09 22:33:49.000000000 +0000
4583 + * util.c -- utility functions
4585 + * This program is free software; you can redistribute it and/or modify it
4586 + * under the terms of the GNU General Public License as published by the
4587 + * Free Software Foundation; either version 2, or (at your option) any
4590 + * This program is distributed in the hope that it will be useful, but
4591 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4592 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4593 + * General Public License for more details.
4595 + * Written by Soós Péter <sp@osb.hu>, 2003
4598 +#include <linux/types.h>
4600 +int omnibook_proc_len(char *buffer, char **start, off_t off, int count, int *eof, char *b)
4605 + if (len < off + count)
4607 + *start = buffer + off;
4617 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/char/omnibook/util.h linux-2.6.1-gentoo-test/drivers/char/omnibook/util.h
4618 --- linux-2.6.1-gentoo/drivers/char/omnibook/util.h 1970-01-01 01:00:00.000000000 +0100
4619 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/util.h 2004-01-09 22:33:49.000000000 +0000
4622 + * util.h -- Utility declarations
4624 + * This program is free software; you can redistribute it and/or modify it
4625 + * under the terms of the GNU General Public License as published by the
4626 + * Free Software Foundation; either version 2, or (at your option) any
4629 + * This program is distributed in the hope that it will be useful, but
4630 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4631 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4632 + * General Public License for more details.
4634 + * Written by Soós Péter <sp@osb.hu>, 2003
4637 +extern int omnibook_proc_len(char *buffer, char **start, off_t off, int count, int *eof, char *b);
4640 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/drivers/input/keyboard/atkbd.c linux-2.6.1-gentoo-test/drivers/input/keyboard/atkbd.c
4641 --- linux-2.6.1-gentoo/drivers/input/keyboard/atkbd.c 2004-01-09 23:40:12.000000000 +0000
4642 +++ linux-2.6.1-gentoo-test/drivers/input/keyboard/atkbd.c 2004-01-09 23:32:25.000000000 +0000
4644 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99,
4646 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4647 - 217,100,255, 0, 97,165, 0, 0,156, 0, 0, 0, 0, 0, 0,125,
4648 + 217,100,255,118, 97,165, 0, 0,156,117, 0, 0, 0, 0, 0,125,
4649 173,114, 0,113, 0, 0, 0,126,128, 0, 0,140, 0, 0, 0,127,
4650 159, 0,115, 0,164, 0, 0,116,158, 0,150,166, 0, 0, 0,142,
4651 157, 0, 0, 0, 0, 0, 0, 0,155, 0, 98, 0, 0,163, 0, 0,
4652 - 226, 0, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0,
4653 + 226,116, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0,
4654 0, 0, 0, 0, 0, 0, 0, 0, 0,107, 0,105,102, 0, 0,112,
4655 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119, 0,
4657 diff -Naur --exclude '*.orig' --exclude '*.rej' linux-2.6.1-gentoo/include/linux/omnibook.h linux-2.6.1-gentoo-test/include/linux/omnibook.h
4658 --- linux-2.6.1-gentoo/include/linux/omnibook.h 1970-01-01 01:00:00.000000000 +0100
4659 +++ linux-2.6.1-gentoo-test/include/linux/omnibook.h 2004-01-09 22:34:17.000000000 +0000
4662 + * omnibook.h -- High level data structures and functions of omnibook
4665 + * This program is free software; you can redistribute it and/or modify it
4666 + * under the terms of the GNU General Public License as published by the
4667 + * Free Software Foundation; either version 2, or (at your option) any
4670 + * This program is distributed in the hope that it will be useful, but
4671 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4672 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4673 + * General Public License for more details.
4675 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
4679 + * Module informations
4682 +#define OMNIBOOK_MODULE_NAME "omnibook"
4683 +#define OMNIBOOK_MODULE_VERSION "2003-12-08"
4689 +extern int omnibook_ectype;
4692 + XE3GF, /* HP OmniBook XE3 GF, most Toshiba Satellites and more*/
4693 + XE3GC, /* HP OmniBook XE3 GC, GD, GE and compatible */
4694 + OB500, /* HP OmniBook 500 and compatible */
4695 + OB510, /* HP OmniBook 510 */
4696 + OB6000, /* HP OmniBook 6000 */
4697 + OB6100, /* HP OmniBook 6100 */
4698 + XE4500, /* HP OmniBook xe4500 and compatible */
4699 + OB4150, /* HP OmniBook 4150 */
4700 + XE2 /* HP OmniBook XE2 */
4703 +extern struct __init proc_dir_entry *omnibook_proc_root;
4704 +extern int omnibook_userset;
4706 +extern int omnibook_get_ac(void);
4708 +struct omnibook_battery_info {
4709 + u8 type; /* 1 - Li-Ion, 2 NiMH */
4710 + u16 sn; /* Serial number */
4711 + u16 dv; /* Design Voltage */
4712 + u16 dc; /* Design Capacity */
4714 +struct omnibook_battery_status {
4715 + u16 pv; /* Present Voltage */
4716 + u16 rc; /* Remaining Capacity */
4717 + u16 lc; /* Last Full Capacity */
4718 + u8 gauge; /* Gauge in % */
4719 + u8 status; /* 0 - unknown, 1 - charged, 2 - discharging, 3 - charging, 4 - critical) */
4722 + OMNIBOOK_BATTSTAT_UNKNOWN,
4723 + OMNIBOOK_BATTSTAT_CHARGED,
4724 + OMNIBOOK_BATTSTAT_DISCHARGING,
4725 + OMNIBOOK_BATTSTAT_CHARGING,
4726 + OMNIBOOK_BATTSTAT_CRITICAL
4729 +extern int omnibook_battery_present(int num);
4730 +extern int omnibook_get_battery_info(int num, struct omnibook_battery_info *battinfo);
4731 +extern int omnibook_get_battery_status(int num, struct omnibook_battery_status *battstat);
4733 +extern int omnibook_console_blank_enabled;
4734 +extern int omnibook_lcd_blank(int blank);
4735 +extern int omnibook_console_blank_enable(void);
4736 +extern int omnibook_console_blank_disable(void);
4738 +extern int omnibook_get_display(void);
4740 +extern int omnibook_get_dock(void);
4742 +extern int omnibook_get_fan(void);
4743 +extern int omnibook_fan_on(void);
4744 +extern int omnibook_fan_off(void);
4747 + * Default temperature limits.
4748 + * Danger! You may overheat your CPU!
4749 + * Do not change these values unless you exactly know what you do.
4752 +#define OMNIBOOK_FAN_LEVELS 7
4753 +#define OMNIBOOK_FAN_MIN 25 /* Minimal value of fan off temperature */
4754 +#define OMNIBOOK_FOT_MAX 75 /* Maximal value of fan off temperature */
4755 +#define OMNIBOOK_FAN_MAX 95 /* Maximal value of fan on temperature */
4756 +#define OMNIBOOK_FOT_DEFAULT 60 /* Default value of fan off temperature */
4757 +#define OMNIBOOK_FAN1_DEFAULT 75 /* Default value of fan on temperature */
4758 +#define OMNIBOOK_FAN2_DEFAULT 85 /* Default value of fan level 2 temperature */
4759 +#define OMNIBOOK_FAN3_DEFAULT 90 /* Default value of fan level 3 temperature */
4760 +#define OMNIBOOK_FAN4_DEFAULT 95 /* Default value of fan level 4 temperature */
4761 +#define OMNIBOOK_FAN5_DEFAULT 95 /* Default value of fan level 5 temperature */
4762 +#define OMNIBOOK_FAN6_DEFAULT 95 /* Default value of fan level 6 temperature */
4763 +#define OMNIBOOK_FAN7_DEFAULT 95 /* Default value of fan level 7 temperature */
4764 +#define OMNIBOOK_FAN_POLICY_STRING 32 /* Maximal length of temperature policy control string */
4766 +extern u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS];
4768 +extern int omnibook_get_fan_policy(void);
4769 +extern int omnibook_set_fan_policy(void);
4770 +extern int omnibook_set_fan_policy_defaults(void);
4772 +extern int omnibook_get_lcd_brightness(void);
4773 +extern int omnibook_set_lcd_brightness(u8 brgt);
4775 +extern int omnibook_onetouch_enabled;
4776 +extern int omnibook_onetouch_enable(void);
4777 +extern int omnibook_onetouch_disable(void);
4779 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
4780 +extern int omnibook_key_polling_enabled;
4781 +extern int omnibook_key_polling_enable(void);
4782 +extern int omnibook_key_polling_disable(void);
4785 +extern int omnibook_get_cpu_temp(void);
4787 +extern int omnibook_touchpad_enabled;
4788 +extern int omnibook_touchpad_enable(void);
4789 +extern int omnibook_touchpad_disable(void);