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_cp.c linux-2.6.1-gentoo-test/drivers/char/drm/radeon_cp.c
38 --- linux-2.6.1-gentoo/drivers/char/drm/radeon_cp.c 2004-01-09 23:40:12.000000000 +0000
39 +++ linux-2.6.1-gentoo-test/drivers/char/drm/radeon_cp.c 2004-01-09 23:33:45.000000000 +0000
42 /* Initialize the memory controller */
43 RADEON_WRITE( RADEON_MC_FB_LOCATION,
44 - (dev_priv->gart_vm_start - 1) & 0xffff0000 );
45 + ((dev_priv->gart_vm_start - 1) & 0xffff0000 ) |
46 + (dev_priv->fb_base >> 16));
49 if ( !dev_priv->is_pci ) {
50 @@ -1071,13 +1072,6 @@
51 dev_priv->depth_offset = init->depth_offset;
52 dev_priv->depth_pitch = init->depth_pitch;
54 - dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) |
55 - (dev_priv->front_offset >> 10));
56 - dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) |
57 - (dev_priv->back_offset >> 10));
58 - dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) |
59 - (dev_priv->depth_offset >> 10));
61 /* Hardware state for depth clears. Remove this if/when we no
62 * longer clear the depth buffer with a 3D rectangle. Hard-code
63 * all values to prevent unwanted 3D state from slipping through
64 @@ -1204,9 +1198,17 @@
65 dev_priv->buffers->handle );
68 + dev_priv->fb_base = (RADEON_READ( RADEON_MC_FB_LOCATION ) & 0xffff) << 16;
69 + dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) |
70 + ((dev_priv->front_offset+dev_priv->fb_base) >> 10));
71 + dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) |
72 + ((dev_priv->back_offset+dev_priv->fb_base) >> 10));
73 + dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) |
74 + ((dev_priv->depth_offset+dev_priv->fb_base) >> 10));
76 dev_priv->gart_size = init->gart_size;
77 - dev_priv->gart_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE );
78 + dev_priv->gart_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE ) + dev_priv->fb_base;
81 if ( !dev_priv->is_pci )
82 dev_priv->gart_buffers_offset = (dev_priv->buffers->offset
83 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
84 --- linux-2.6.1-gentoo/drivers/char/drm/radeon_drv.h 2004-01-09 23:40:12.000000000 +0000
85 +++ linux-2.6.1-gentoo-test/drivers/char/drm/radeon_drv.h 2004-01-09 22:32:40.000000000 +0000
88 drm_radeon_depth_clear_t depth_clear;
90 + unsigned long fb_base;
91 unsigned long fb_offset;
92 unsigned long mmio_offset;
93 unsigned long ring_offset;
96 wait_queue_head_t swi_queue;
99 } drm_radeon_private_t;
101 typedef struct drm_radeon_buf_priv {
102 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
103 --- linux-2.6.1-gentoo/drivers/char/drm/radeon_state.c 2004-01-09 23:40:12.000000000 +0000
104 +++ linux-2.6.1-gentoo-test/drivers/char/drm/radeon_state.c 2004-01-09 22:32:40.000000000 +0000
106 OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) );
107 OUT_RING( tex[0].pp_txfilter );
108 OUT_RING( tex[0].pp_txformat );
109 - OUT_RING( tex[0].pp_txoffset );
110 + OUT_RING( tex[0].pp_txoffset + dev_priv->fb_base);
111 OUT_RING( tex[0].pp_txcblend );
112 OUT_RING( tex[0].pp_txablend );
113 OUT_RING( tex[0].pp_tfactor );
115 OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) );
116 OUT_RING( tex[1].pp_txfilter );
117 OUT_RING( tex[1].pp_txformat );
118 - OUT_RING( tex[1].pp_txoffset );
119 + OUT_RING( tex[1].pp_txoffset + dev_priv->fb_base);
120 OUT_RING( tex[1].pp_txcblend );
121 OUT_RING( tex[1].pp_txablend );
122 OUT_RING( tex[1].pp_tfactor );
124 OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) );
125 OUT_RING( tex[2].pp_txfilter );
126 OUT_RING( tex[2].pp_txformat );
127 - OUT_RING( tex[2].pp_txoffset );
128 + OUT_RING( tex[2].pp_txoffset + dev_priv->fb_base);
129 OUT_RING( tex[2].pp_txcblend );
130 OUT_RING( tex[2].pp_txablend );
131 OUT_RING( tex[2].pp_tfactor );
132 @@ -1178,7 +1178,7 @@
133 RADEON_GMC_CLR_CMP_CNTL_DIS |
134 RADEON_GMC_WR_MSK_DIS);
136 - buffer[2] = (tex->pitch << 22) | (tex->offset >> 10);
137 + buffer[2] = (tex->pitch << 22) | ((tex->offset + dev_priv->fb_base) >> 10);
138 buffer[3] = 0xffffffff;
139 buffer[4] = 0xffffffff;
140 buffer[5] = (image->y << 16) | image->x;
141 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
142 --- linux-2.6.1-gentoo/drivers/char/omnibook/Makefile 1970-01-01 01:00:00.000000000 +0100
143 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/Makefile 2004-01-09 22:33:10.000000000 +0000
146 +# Makefile -- makefile for the HP OmniBook support module
148 +# This program is free software; you can redistribute it and/or modify it
149 +# under the terms of the GNU General Public License as published by the
150 +# Free Software Foundation; either version 2, or (at your option) any
153 +# This program is distributed in the hope that it will be useful, but
154 +# WITHOUT ANY WARRANTY; without even the implied warranty of
155 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
156 +# General Public License for more details.
158 +# Written by Soós Péter <sp@osb.hu>, 2002,2003
160 +# Note! Dependencies are done automagically by 'make dep', which also
161 +# removes any old dependencies. DON'T put your own dependencies here
162 +# unless it's something special (ie not a .c file).
164 +# Note 2! The CFLAGS definitions are now in the main makefile...
166 +#export-objs := ac.o battery.o blank.o display.o dmi.o dock.o fan.o \
167 + fan_policy.o init.o lcd.o onetouch.o polling.o temperature.o \
170 +#O_TARGET := omnibook.o
172 +#obj-y := ac.o apmemu.o battery.o blank.o dmi.o display.o dock.o ec.o \
173 + fan.o fan_policy.o init.o lcd.o onetouch.o polling.o \
174 + temperature.o touchpad.o util.o
175 +#obj-m := $(O_TARGET)
177 +#include $(TOPDIR)/Rules.make
179 +obj-$(CONFIG_OMNIBOOK) += omnibook.o
181 +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
182 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
183 --- linux-2.6.1-gentoo/drivers/char/omnibook/ac.c 1970-01-01 01:00:00.000000000 +0100
184 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/ac.c 2004-01-09 22:33:49.000000000 +0000
187 + * ac.c -- AC adapter related functions
189 + * This program is free software; you can redistribute it and/or modify it
190 + * under the terms of the GNU General Public License as published by the
191 + * Free Software Foundation; either version 2, or (at your option) any
194 + * This program is distributed in the hope that it will be useful, but
195 + * WITHOUT ANY WARRANTY; without even the implied warranty of
196 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
197 + * General Public License for more details.
199 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
203 +#include <linux/config.h>
204 +#include <linux/module.h>
205 +#include <linux/version.h>
206 +#include <linux/types.h>
207 +#include <linux/init.h>
208 +#include <linux/proc_fs.h>
210 +#include <asm/system.h>
211 +#include <asm/errno.h>
213 +#include <asm/uaccess.h>
215 +#ifdef OMNIBOOK_STANDALONE
216 +#include "omnibook.h"
218 +#include <linux/omnibook.h>
224 +static struct proc_dir_entry *proc_ac;
226 +int omnibook_get_ac(void)
231 + switch (omnibook_ectype) {
233 + if ((retval = omnibook_ec_read(XE3GF_ADP, &ac)))
235 + retval = (ac & XE3GF_ADP_MASK) ? 1 : 0;
238 + if ((retval = omnibook_ec_read(XE3GC_STA1, &ac)))
240 + retval = (ac & XE3GC_ADP_MASK) ? 1 : 0;
247 + if ((retval = omnibook_ec_read(OB500_STA2, &ac)))
249 + retval = (ac & OB500_ADP_MASK) ? 1 : 0;
252 + if ((retval = omnibook_ec_read(OB4150_ADP, &ac)))
254 + retval = (ac & OB4150_ADP_MASK) ? 1 : 0;
257 + if ((retval = omnibook_ec_read(XE2_STA1, &ac)))
259 + retval = (ac & XE2_ADP_MASK) ? 1 : 0;
262 + printk(KERN_INFO "%s: AC adapter status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
268 +static int omnibook_proc_ac(char *buffer, char **start, off_t off, int count, int *eof, void *data)
273 + ac = omnibook_get_ac();
277 + b += sprintf(b, "AC %s\n", (ac) ? "on-line" : "off-line");
279 + return omnibook_proc_len(buffer, start, off, count, eof, b);
282 +int __init omnibook_ac_init(void)
286 + switch (omnibook_ectype) {
296 + pmode = S_IFREG | S_IRUGO;
297 + proc_ac = create_proc_read_entry("ac", pmode, omnibook_proc_root, omnibook_proc_ac, NULL);
300 + printk(KERN_INFO "%s: AC adapter status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
304 + printk(KERN_ERR "%s: Unable to create /proc/%s/ac.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
307 + printk(KERN_INFO "%s: AC adapter status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
311 +void __exit omnibook_ac_cleanup(void)
314 + remove_proc_entry("ac", omnibook_proc_root);
317 +EXPORT_SYMBOL(omnibook_get_ac);
320 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
321 --- linux-2.6.1-gentoo/drivers/char/omnibook/apmemu.c 1970-01-01 01:00:00.000000000 +0100
322 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/apmemu.c 2004-01-09 22:33:49.000000000 +0000
325 + * apmemu.c -- /proc/apm emulation
327 + * This program is free software; you can redistribute it and/or modify it
328 + * under the terms of the GNU General Public License as published by the
329 + * Free Software Foundation; either version 2, or (at your option) any
332 + * This program is distributed in the hope that it will be useful, but
333 + * WITHOUT ANY WARRANTY; without even the implied warranty of
334 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
335 + * General Public License for more details.
337 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
341 +#include <linux/config.h>
342 +#include <linux/module.h>
343 +#include <linux/version.h>
344 +#include <linux/types.h>
345 +#include <linux/init.h>
346 +#include <linux/proc_fs.h>
349 +#include <linux/apm_bios.h>
352 +#include <asm/system.h>
353 +#include <asm/errno.h>
355 +#include <asm/uaccess.h>
357 +#ifdef OMNIBOOK_STANDALONE
358 +#include "omnibook.h"
360 +#include <linux/omnibook.h>
366 +static struct proc_dir_entry *proc_apmemu;
368 +/* Arguments, with symbols from linux/apm_bios.h. Information is
369 + from the Get Power Status (0x0a) call unless otherwise noted.
370 + 0) Linux driver version (this will change if format changes)
371 + 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2.
372 + 2) APM flags from APM Installation Check (0x00):
373 + bit 0: APM_16_BIT_SUPPORT
374 + bit 1: APM_32_BIT_SUPPORT
375 + bit 2: APM_IDLE_SLOWS_CLOCK
376 + bit 3: APM_BIOS_DISABLED
377 + bit 4: APM_BIOS_DISENGAGED
381 + 0x02: On backup power (BIOS >= 1.1 only)
388 + 0x04: Selected battery not present (BIOS >= 1.2 only)
395 + bit 7: No system battery
397 + 6) Remaining battery life (percentage of charge):
400 + 7) Remaining battery life (time units):
401 + Number of remaining minutes or seconds
403 + 8) min = minutes; sec = seconds */
405 +static int omnibook_proc_apmemu(char *buffer, char **start, off_t off, int count)
411 + struct omnibook_battery_status battstat;
413 + struct apm_features {
425 + struct apm_features apm = {
426 + APMEMU_DRIVER_VERSION,
427 + APMEMU_APM_VERSION,
428 + APMEMU_32_BIT_SUPPORT | APMEMU_BIOS_DISABLED,
430 + APMEMU_BATTSTAT_UNKN,
432 + APMEMU_BATTLIFE_UNKN,
433 + APMEMU_BATTLIFE_UNKN,
437 + ac = omnibook_get_ac();
438 + apm.ac = (ac) ? APMEMU_AC_ONLINE : APMEMU_AC_OFFLINE;
439 + /* Asking for Battery 0 as APM does */
440 + retval = omnibook_get_battery_status(0, &battstat);
442 + apm.gauge = battstat.gauge;
443 + if (apm.gauge >= APMEMU_BATTERY_LOW) {
444 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_HIGH;
445 + apm.battstat = APMEMU_BATTSTAT_HIGH;
447 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_LOW;
448 + apm.battstat = APMEMU_BATTSTAT_LOW;
450 + if (battstat.status == OMNIBOOK_BATTSTAT_CHARGING) {
451 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_CHR;
452 + apm.battstat = APMEMU_BATTSTAT_CHR;
454 + if (battstat.status == OMNIBOOK_BATTSTAT_CRITICAL) {
455 + apm.battflags = apm.battflags | APMEMU_BATTFLAG_CRIT;
456 + apm.battstat = APMEMU_BATTSTAT_CRIT;
459 + b += sprintf(b, "%s %s 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
474 +int __init omnibook_apmemu_init(void)
478 + switch (omnibook_ectype) {
482 + if (! apm_info.disabled) {
483 + printk(KERN_NOTICE "%s: Real APM support is present, emulation is not necessary.\n", OMNIBOOK_MODULE_NAME);
487 + pmode = S_IFREG | S_IRUGO;
488 + proc_apmemu = create_proc_info_entry("apm", pmode, NULL, omnibook_proc_apmemu);
491 + printk(KERN_INFO "%s: /proc/apm emulation is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
494 + if (! proc_apmemu) {
495 + printk(KERN_ERR "%s: Unable to create /proc/apm.\n", OMNIBOOK_MODULE_NAME);
498 + printk(KERN_INFO "%s: /proc/apm emulation enabled.\n", OMNIBOOK_MODULE_NAME);
502 +void __exit omnibook_apmemu_cleanup(void)
505 + remove_proc_entry("apm", NULL);
506 + printk(KERN_INFO "%s: /proc/apm emulation disabled.\n", OMNIBOOK_MODULE_NAME);
511 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
512 --- linux-2.6.1-gentoo/drivers/char/omnibook/apmemu.h 1970-01-01 01:00:00.000000000 +0100
513 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/apmemu.h 2004-01-09 22:33:49.000000000 +0000
516 + * apmemu.c -- code to emulate /proc/apm
518 + * This program is free software; you can redistribute it and/or modify it
519 + * under the terms of the GNU General Public License as published by the
520 + * Free Software Foundation; either version 2, or (at your option) any
523 + * This program is distributed in the hope that it will be useful, but
524 + * WITHOUT ANY WARRANTY; without even the implied warranty of
525 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
526 + * General Public License for more details.
528 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
532 +#define APMEMU_DRIVER_VERSION "1.16"
533 +#define APMEMU_APM_VERSION "1.2"
535 +#define APMEMU_BATTERY_LOW 30 /* Battery low threshold */
537 +#define APMEMU_16_BIT_SUPPORT 0x01 /* 16 bit APM BIOS */
538 +#define APMEMU_32_BIT_SUPPORT 0x02 /* 32 bit APM BIOS */
539 +#define APMEMU_IDLE_SLOWS_CLOCK 0x04
540 +#define APMEMU_BIOS_DISABLED 0x08 /* APM BIOS disabled */
541 +#define APMEMU_BIOS_DISENGAGED 0x10 /* APM BIOS disengaged */
543 +#define APMEMU_AC_OFFLINE 0x00 /* AC offline */
544 +#define APMEMU_AC_ONLINE 0x01 /* AC online */
545 +#define APMEMU_AC_BACKUP 0x02 /* On backup power */
546 +#define APMEMU_AC_UNKNOWN 0xFF /* Unkonwn status */
548 +#define APMEMU_BATTSTAT_HIGH 0x00 /* Remaining battery capacity is high */
549 +#define APMEMU_BATTSTAT_LOW 0x01 /* Remaining battery capacity is low */
550 +#define APMEMU_BATTSTAT_CRIT 0x02 /* Battery status is critical */
551 +#define APMEMU_BATTSTAT_CHR 0x03 /* Battery is charging */
552 +#define APMEMU_BATTSTAT_MISS 0x04 /* Battery is not present */
554 +#define APMEMU_BATTFLAG_HIGH 0x01 /* Remaining battery capacity is high bit */
555 +#define APMEMU_BATTFLAG_LOW 0x02 /* Remaining battery capacity is low bit */
556 +#define APMEMU_BATTFLAG_CRIT 0x04 /* Battery status is critical bit */
557 +#define APMEMU_BATTFLAG_CHR 0x08 /* Battery is charging bit */
558 +#define APMEMU_BATTFLAG_MISS 0x80 /* Battery is not present bit */
560 +#define APMEMU_BATTSTAT_UNKN 0xff /* Status is unknown */
562 +#define APMEMU_BATTLIFE_UNKN -1 /* Remaining battery capacity is unknown */
563 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
564 --- linux-2.6.1-gentoo/drivers/char/omnibook/battery.c 1970-01-01 01:00:00.000000000 +0100
565 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/battery.c 2004-01-09 22:33:49.000000000 +0000
568 + * battery.c -- battery related functions
570 + * This program is free software; you can redistribute it and/or modify it
571 + * under the terms of the GNU General Public License as published by the
572 + * Free Software Foundation; either version 2, or (at your option) any
575 + * This program is distributed in the hope that it will be useful, but
576 + * WITHOUT ANY WARRANTY; without even the implied warranty of
577 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
578 + * General Public License for more details.
580 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
584 +#include <linux/config.h>
585 +#include <linux/module.h>
586 +#include <linux/version.h>
587 +#include <linux/types.h>
588 +#include <linux/init.h>
589 +#include <linux/proc_fs.h>
591 +#include <asm/system.h>
592 +#include <asm/errno.h>
594 +#include <asm/uaccess.h>
596 +#ifdef OMNIBOOK_STANDALONE
597 +#include "omnibook.h"
599 +#include <linux/omnibook.h>
605 +static struct proc_dir_entry *proc_battery;
607 +int omnibook_battery_present(int num)
614 + switch (omnibook_ectype) {
618 + if ((retval = omnibook_ec_read(XE3GF_BAL, &bat)))
620 + mask = XE3GF_BAL0_MASK;
621 + for (i = 0; i < num; i++)
627 + if ((retval = omnibook_ec_read(XE3GC_BAT, &bat)))
629 + mask = XE3GC_BAT0_MASK;
630 + for (i = 0; i < num; i++)
634 + return (bat & mask) ? 1 : 0;
638 + * Get static battery information
639 + * All info have to be reread every time because battery sould be cahnged
640 + * when laptop is on AC power
644 + * 1 - Battery is not present
645 + * 2 - Not supported
647 +int omnibook_get_battery_info(int num, struct omnibook_battery_info *battinfo)
652 + switch (omnibook_ectype) {
655 + retval = omnibook_battery_present(num);
659 + if ((retval = omnibook_ec_read(XE3GF_BTY0 + (offset * num), &(*battinfo).type)))
661 + if ((retval = omnibook_ec_read16(XE3GF_BSN0 + (offset * num), &(*battinfo).sn)))
663 + if ((retval = omnibook_ec_read16(XE3GF_BDV0 + (offset * num), &(*battinfo).dv)))
665 + if ((retval = omnibook_ec_read16(XE3GF_BDC0 + (offset * num), &(*battinfo).dc)))
668 + (*battinfo).type = ((*battinfo).type & XE3GF_BTY_MASK) ? 1 : 0;
674 + retval = omnibook_battery_present(num);
678 + if ((retval = omnibook_ec_read16(XE3GC_BDV0 + (offset * num), &(*battinfo).dv)))
680 + if ((retval = omnibook_ec_read16(XE3GC_BDC0 + (offset * num), &(*battinfo).dc)))
682 + if ((retval = omnibook_ec_read(XE3GC_BTY0 + (offset * num), &(*battinfo).type)))
685 + (*battinfo).type = ((*battinfo).type & XE3GC_BTY_MASK) ? 1 : 0;
686 + (*battinfo).sn = 0; /* Unknown */
723 + * Get battery status
727 + * 1 - Battery is not present
728 + * 2 - Not supported
730 +int omnibook_get_battery_status(int num, struct omnibook_battery_status *battstat)
738 + switch (omnibook_ectype) {
741 + retval = omnibook_battery_present(num);
745 + if ((retval = omnibook_ec_read(XE3GF_BST0 + (offset * num), &status)))
747 + if ((retval = omnibook_ec_read16(XE3GF_BRC0 + (offset * num), &(*battstat).rc)))
749 + if ((retval = omnibook_ec_read16(XE3GF_BPV0 + (offset * num), &(*battstat).pv)))
751 + if ((retval = omnibook_ec_read16(XE3GF_BFC0 + (offset * num), &(*battstat).lc)))
753 + if ((retval = omnibook_ec_read(XE3GF_GAU0 + (offset * num), &(*battstat).gauge)))
756 + if (status & XE3GF_BST_MASK_CRT)
757 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
758 + else if (status & XE3GF_BST_MASK_CHR)
759 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
760 + else if (status & XE3GF_BST_MASK_DSC)
761 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
762 + else if (status & (XE3GF_BST_MASK_CHR | XE3GF_BST_MASK_DSC))
763 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
765 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
772 + retval = omnibook_battery_present(num);
776 + if ((retval = omnibook_ec_read(XE3GC_BST0 + (offset * num), &status)))
778 + if ((retval = omnibook_ec_read16(XE3GC_BRC0 + (offset * num), &(*battstat).rc)))
780 + if ((retval = omnibook_ec_read16(XE3GC_BPV0 + (offset * num), &(*battstat).pv)))
782 + if ((retval = omnibook_ec_read16(XE3GC_BDC0 + (offset * num), &dc)))
785 + if (status & XE3GC_BST_MASK_CRT)
786 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
787 + else if (status & XE3GC_BST_MASK_CHR)
788 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
789 + else if (status & XE3GC_BST_MASK_DSC)
790 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
791 + else if (status & (XE3GC_BST_MASK_CHR | XE3GC_BST_MASK_DSC))
792 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
794 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
796 + gauge = ((*battstat).rc * 100) / dc;
797 + (*battstat).gauge = gauge;
798 + (*battstat).lc = 0; /* Unknown */
805 + if ((retval = omnibook_ec_read(OB500_BT1S, &status)))
807 + if ((retval = omnibook_ec_read16(OB500_BT1C, &(*battstat).rc)))
809 + if ((retval = omnibook_ec_read16(OB500_BT1V, &(*battstat).pv)))
813 + if ((retval = omnibook_ec_read(OB500_BT2S, &status)))
815 + if ((retval = omnibook_ec_read16(OB500_BT2C, &(*battstat).rc)))
817 + if ((retval = omnibook_ec_read16(OB500_BT2V, &(*battstat).pv)))
821 + if ((retval = omnibook_ec_read(OB500_BT3S, &status)))
823 + if ((retval = omnibook_ec_read16(OB500_BT3C, &(*battstat).rc)))
825 + if ((retval = omnibook_ec_read16(OB500_BT3V, &(*battstat).pv)))
831 + if (status & OB500_BST_MASK_CRT)
832 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
833 + else if (status & OB500_BST_MASK_CHR)
834 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
835 + else if (status & OB500_BST_MASK_DSC)
836 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
837 + else if (status & (OB500_BST_MASK_CHR | OB500_BST_MASK_DSC))
838 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
840 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
848 + if ((retval = omnibook_ec_read(OB500_BT1S, &status)))
850 + if ((retval = omnibook_ec_read16(OB500_BT1C, &(*battstat).rc)))
852 + if ((retval = omnibook_ec_read16(OB500_BT1V, &(*battstat).pv)))
856 + if ((retval = omnibook_ec_read(OB500_BT3S, &status)))
858 + if ((retval = omnibook_ec_read16(OB500_BT3C, &(*battstat).rc)))
860 + if ((retval = omnibook_ec_read16(OB500_BT3V, &(*battstat).pv)))
866 + if (status & OB500_BST_MASK_CRT)
867 + (*battstat).status = OMNIBOOK_BATTSTAT_CRITICAL;
868 + else if (status & OB500_BST_MASK_CHR)
869 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGING;
870 + else if (status & OB500_BST_MASK_DSC)
871 + (*battstat).status = OMNIBOOK_BATTSTAT_DISCHARGING;
872 + else if (status & (OB500_BST_MASK_CHR | OB500_BST_MASK_DSC))
873 + (*battstat).status = OMNIBOOK_BATTSTAT_UNKNOWN;
875 + (*battstat).status = OMNIBOOK_BATTSTAT_CHARGED;
884 +static int omnibook_proc_battery(char *buffer, char **start, off_t off, int count, int *eof, void *data)
893 + struct omnibook_battery_info battinfo;
894 + struct omnibook_battery_status battstat;
896 + switch (omnibook_ectype) {
910 + for (i = 0; i < max; i++) {
911 + retval = omnibook_get_battery_info(i, &battinfo);
914 + omnibook_get_battery_status(i, &battstat);
915 + typestr = (battinfo.type) ? "Li-Ion" : "NiMH";
916 + switch (battstat.status) {
917 + case OMNIBOOK_BATTSTAT_CHARGED:
918 + statustr = "charged";
920 + case OMNIBOOK_BATTSTAT_DISCHARGING:
921 + statustr = "discharging";
923 + case OMNIBOOK_BATTSTAT_CHARGING:
924 + statustr = "charging";
926 + case OMNIBOOK_BATTSTAT_CRITICAL:
927 + statustr = "critical";
930 + statustr = "unknown";
933 + b += sprintf(b, "Battery: %11d\n", i);
934 + b += sprintf(b, "Type: %11s\n", typestr);
936 + b += sprintf(b, "Serial Number: %11d\n", battinfo.sn);
937 + b += sprintf(b, "Present Voltage: %11d mV\n", battstat.pv);
938 + b += sprintf(b, "Design Voltage: %11d mV\n", battinfo.dv);
939 + b += sprintf(b, "Remaining Capacity: %11d mAh\n", battstat.rc);
941 + b += sprintf(b, "Last Full Capacity: %11d mAh\n", battstat.lc);
942 + b += sprintf(b, "Design Capacity: %11d mAh\n", battinfo.dc);
943 + b += sprintf(b, "Gauge: %11d %%\n", battstat.gauge);
944 + b += sprintf(b, "Status: %11s\n", statustr);
945 + b += sprintf(b, "\n");
949 + b += sprintf(b, "No battery present\n");
951 + return omnibook_proc_len(buffer, start, off, count, eof, b);
954 +int __init omnibook_battery_init(void)
958 + switch (omnibook_ectype) {
967 + pmode = S_IFREG | S_IRUGO;
968 + proc_battery = create_proc_read_entry("battery", pmode, omnibook_proc_root, omnibook_proc_battery, NULL);
971 + printk(KERN_INFO "%s: Battery status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
974 + if (! proc_battery) {
975 + printk(KERN_ERR "%s: Unable to create /proc/%s/battery.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
978 + printk(KERN_INFO "%s: Battery status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
982 +void __exit omnibook_battery_cleanup(void)
985 + remove_proc_entry("battery", omnibook_proc_root);
988 +EXPORT_SYMBOL(omnibook_battery_present);
989 +EXPORT_SYMBOL(omnibook_get_battery_info);
990 +EXPORT_SYMBOL(omnibook_get_battery_status);
993 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
994 --- linux-2.6.1-gentoo/drivers/char/omnibook/blank.c 1970-01-01 01:00:00.000000000 +0100
995 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/blank.c 2004-01-09 22:33:49.000000000 +0000
998 + * blank.c -- blanking lcd console
1000 + * This program is free software; you can redistribute it and/or modify it
1001 + * under the terms of the GNU General Public License as published by the
1002 + * Free Software Foundation; either version 2, or (at your option) any
1005 + * This program is distributed in the hope that it will be useful, but
1006 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1007 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1008 + * General Public License for more details.
1010 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1014 +#include <linux/config.h>
1015 +#include <linux/module.h>
1016 +#include <linux/version.h>
1017 +#include <linux/types.h>
1018 +#include <linux/init.h>
1019 +#include <linux/pm.h>
1020 +#include <linux/proc_fs.h>
1022 +#include <asm/system.h>
1023 +#include <asm/errno.h>
1024 +#include <asm/io.h>
1025 +#include <asm/uaccess.h>
1027 +#ifdef OMNIBOOK_STANDALONE
1028 +#include "omnibook.h"
1030 +#include <linux/omnibook.h>
1036 +static struct proc_dir_entry *proc_blank;
1037 +int omnibook_console_blank_enabled = 0;
1039 +extern int (*console_blank_hook)(int);
1042 + * Turn LCD display off at console blanking if APM does not do it
1043 + * (e.g. using ACPI).
1046 +int omnibook_lcd_blank(int blank)
1052 + switch (omnibook_ectype) {
1055 + cmd = blank ? OMNIBOOK_KBC_CMD_LCD_OFF : OMNIBOOK_KBC_CMD_LCD_ON;
1056 + if ((retval = omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, cmd)))
1062 + if ((retval = omnibook_io_read(OB500_GPO1, &cmd)))
1064 + cmd = blank ? cmd & ~OB500_BKLT_MASK : cmd | OB500_BKLT_MASK;
1065 + if ((retval = omnibook_io_write(OB500_GPO1, cmd)))
1070 + if ((retval = omnibook_io_read(OB510_GPO2, &cmd)))
1072 + cmd = blank ? cmd & ~OB510_BKLT_MASK : cmd | OB510_BKLT_MASK;
1073 + if ((retval = omnibook_io_write(OB510_GPO2, cmd)))
1077 + printk(KERN_INFO "%s: LCD console blanking is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1084 +int omnibook_console_blank_enable(void)
1087 + if (omnibook_console_blank_enabled == 0) {
1088 + if (console_blank_hook == NULL) {
1089 + console_blank_hook = omnibook_lcd_blank;
1090 + printk(KERN_INFO "%s: LCD display turn off at console blanking enabled.\n", OMNIBOOK_MODULE_NAME);
1091 + omnibook_console_blank_enabled = 1;
1093 + printk(KERN_INFO "%s: There is a console blanking solution already registered.\n", OMNIBOOK_MODULE_NAME);
1100 +int omnibook_console_blank_disable(void)
1103 + if (console_blank_hook == omnibook_lcd_blank) {
1104 + console_blank_hook = NULL;
1105 + printk(KERN_INFO "%s: LCD display turn off at console blanking disabled.\n", OMNIBOOK_MODULE_NAME);
1106 + omnibook_console_blank_enabled = 0;
1107 + } else if (console_blank_hook) {
1108 + printk(KERN_WARNING "%s: You can not disable another console blanking solution.\n", OMNIBOOK_MODULE_NAME);
1111 + printk(KERN_INFO "%s: Console blanking already disabled.\n", OMNIBOOK_MODULE_NAME);
1118 +static int omnibook_console_blank_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
1122 + b += sprintf(b, "LCD console blanking is %s\n", (omnibook_console_blank_enabled) ? "enabled" : "disabled");
1124 + return omnibook_proc_len(buffer, start, off, count, eof, b);
1127 +static int omnibook_console_blank_set(struct file *file, const char *buffer, unsigned long count, void *data)
1129 + char status[1] = {'\0'};
1132 + if ((retval = copy_from_user(status, buffer, 1)))
1134 + switch (*status) {
1136 + if ((retval = omnibook_console_blank_disable()))
1140 + if ((retval = omnibook_console_blank_enable()))
1149 +int __init omnibook_console_blank_init(void)
1155 + switch (omnibook_ectype) {
1163 + if ((retval = omnibook_console_blank_enable()))
1165 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
1166 + if (omnibook_userset)
1167 + pmode = pmode | S_IWUGO;
1168 + proc_blank = create_proc_entry("blank", pmode, omnibook_proc_root);
1171 + printk(KERN_INFO "%s: LCD console blanking is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1176 + proc_blank->read_proc = omnibook_console_blank_status;
1177 + proc_blank->write_proc = omnibook_console_blank_set;
1179 + printk(KERN_ERR "%s: Unable to create /proc/%s/blank.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
1184 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
1189 +void __exit omnibook_console_blank_cleanup(void)
1193 + remove_proc_entry("blank", omnibook_proc_root);
1194 + omnibook_console_blank_disable();
1199 +EXPORT_SYMBOL(omnibook_console_blank_enabled);
1200 +EXPORT_SYMBOL(omnibook_lcd_blank);
1201 +EXPORT_SYMBOL(omnibook_console_blank_enable);
1202 +EXPORT_SYMBOL(omnibook_console_blank_disable);
1205 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
1206 --- linux-2.6.1-gentoo/drivers/char/omnibook/display.c 1970-01-01 01:00:00.000000000 +0100
1207 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/display.c 2004-01-09 22:33:49.000000000 +0000
1210 + * display.c -- external display related functions
1212 + * This program is free software; you can redistribute it and/or modify it
1213 + * under the terms of the GNU General Public License as published by the
1214 + * Free Software Foundation; either version 2, or (at your option) any
1217 + * This program is distributed in the hope that it will be useful, but
1218 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1219 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1220 + * General Public License for more details.
1222 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1226 +#include <linux/config.h>
1227 +#include <linux/module.h>
1228 +#include <linux/version.h>
1229 +#include <linux/types.h>
1230 +#include <linux/init.h>
1231 +#include <linux/proc_fs.h>
1233 +#include <asm/system.h>
1234 +#include <asm/errno.h>
1235 +#include <asm/io.h>
1236 +#include <asm/uaccess.h>
1238 +#ifdef OMNIBOOK_STANDALONE
1239 +#include "omnibook.h"
1241 +#include <linux/omnibook.h>
1247 +static struct proc_dir_entry *proc_display;
1249 +int omnibook_get_display(void)
1255 + switch (omnibook_ectype) {
1257 + if ((retval = omnibook_ec_read(XE3GF_STA1, &sta)))
1259 + retval = (sta & XE3GF_SHDD_MASK) ? 1 : 0;
1262 + if ((retval = omnibook_ec_read(XE3GC_STA1, &sta)))
1264 + retval = (sta & XE3GC_CRTI_MASK) ? 1 : 0;
1271 + if ((retval = omnibook_ec_read(OB500_STA1, &sta)))
1273 + retval = (sta & OB500_CRTS_MASK) ? 1 : 0;
1276 + if ((retval = omnibook_ec_read(OB4150_STA2, &sta)))
1278 + retval = (sta & OB4150_CRST_MASK) ? 1 : 0;
1281 + printk(KERN_INFO "%s: External display status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1288 +static int omnibook_proc_display(char *buffer, char **start, off_t off, int count, int *eof, void *data)
1293 + display = omnibook_get_display();
1297 + b += sprintf(b, "External display is %s\n", (display) ? "present" : "not present");
1299 + return omnibook_proc_len(buffer, start, off, count, eof, b);
1302 +int __init omnibook_display_init(void)
1307 + switch (omnibook_ectype) {
1316 + pmode = S_IFREG | S_IRUGO;
1317 + proc_display = create_proc_read_entry("display", pmode, omnibook_proc_root, omnibook_proc_display, NULL);
1320 + printk(KERN_INFO "%s: External display status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1323 + if (! proc_display) {
1324 + printk(KERN_ERR "%s: Unable to create /proc/%s/display.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
1327 + printk(KERN_INFO "%s: External display status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
1330 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
1335 +void __exit omnibook_display_cleanup(void)
1339 + remove_proc_entry("display", omnibook_proc_root);
1343 +EXPORT_SYMBOL(omnibook_get_display);
1346 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
1347 --- linux-2.6.1-gentoo/drivers/char/omnibook/dmi.c 1970-01-01 01:00:00.000000000 +0100
1348 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/dmi.c 2004-01-09 22:33:49.000000000 +0000
1351 + * dmi.c -- to get DMI information
1353 + * This code originally came from file arch/i386/kernel/dmi_scan.c from
1354 + * Linux kernel version 2.4.18
1356 + * This program is free software; you can redistribute it and/or modify it
1357 + * under the terms of the GNU General Public License as published by the
1358 + * Free Software Foundation; either version 2, or (at your option) any
1361 + * This program is distributed in the hope that it will be useful, but
1362 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1363 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1364 + * General Public License for more details.
1368 +#include <linux/config.h>
1369 +#include <linux/module.h>
1370 +#include <linux/version.h>
1371 +#include <linux/types.h>
1372 +#include <linux/kernel.h>
1373 +#include <linux/string.h>
1374 +#include <linux/init.h>
1375 +#include <linux/apm_bios.h>
1376 +#include <linux/slab.h>
1378 +#include <asm/io.h>
1379 +#include <asm/system.h>
1381 +#ifdef OMNIBOOK_STANDALONE
1382 +#include "omnibook.h"
1384 +#include <linux/omnibook.h>
1396 +static char * __init dmi_string(struct dmi_header *dm, u8 s)
1413 + * We have to be cautious here. We have seen BIOSes with DMI pointers
1414 + * pointing to completely the wrong place for example
1417 +static int __init dmi_table(u32 base, int len, int num, void (*decode)(struct dmi_header *))
1420 + struct dmi_header *dm;
1424 + buf = ioremap(base, len);
1431 + * Stop when we see all the items the table claimed to have
1432 + * OR we run off the end of the table (also happens)
1435 + while(i<num && data-buf+sizeof(struct dmi_header)<=len)
1437 + dm=(struct dmi_header *)data;
1439 + * We want to know the total length (formated area and strings)
1440 + * before decoding to make sure we won't run off the table in
1441 + * dmi_decode or dmi_string
1444 + while(data-buf<len-1 && (data[0] || data[1]))
1446 + if(data-buf<len-1)
1455 +inline static int __init dmi_checksum(u8 *buf)
1460 + for(a=0; a<15; a++)
1465 +static int __init dmi_iterate(void (*decode)(struct dmi_header *))
1470 +#ifdef CONFIG_SIMNOW
1472 + * Skip on x86/64 with simnow. Will eventually go away
1473 + * If you see this ifdef in 2.6pre mail me !
1478 + while( fp < 0xFFFFF)
1480 + isa_memcpy_fromio(buf, fp, 15);
1481 + if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
1483 + u16 num=buf[13]<<8|buf[12];
1484 + u16 len=buf[7]<<8|buf[6];
1485 + u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
1487 + if(dmi_table(base,len,num,decode)==0)
1495 +char *omnibook_dmi_ident[OMNIBOOK_STRING_MAX];
1498 + * Save a DMI string
1501 +static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
1503 + char *d = (char*)dm;
1504 + char *p = dmi_string(dm, d[string]);
1505 + if(p==NULL || *p == 0)
1507 + if (omnibook_dmi_ident[slot])
1509 + omnibook_dmi_ident[slot] = kmalloc(strlen(p)+1, GFP_KERNEL);
1510 + if(omnibook_dmi_ident[slot])
1511 + strcpy(omnibook_dmi_ident[slot], p);
1513 + printk(KERN_ERR "%s: dmi_save_ident: out of memory.\n", OMNIBOOK_MODULE_NAME);
1517 + * Process a DMI table entry. Right now all we care about are the BIOS
1518 + * and machine entries. For 2.5 we should pull the smbus controller info
1522 +static void __init dmi_decode(struct dmi_header *dm)
1527 + dmi_save_ident(dm, OMNIBOOK_BIOS_VENDOR, 4);
1528 + dmi_save_ident(dm, OMNIBOOK_BIOS_VERSION, 5);
1529 + dmi_save_ident(dm, OMNIBOOK_BIOS_DATE, 8);
1533 + dmi_save_ident(dm, OMNIBOOK_SYS_VENDOR, 4);
1534 + dmi_save_ident(dm, OMNIBOOK_PRODUCT_NAME, 5);
1535 + dmi_save_ident(dm, OMNIBOOK_PRODUCT_VERSION, 6);
1536 + dmi_save_ident(dm, OMNIBOOK_SERIAL_NUMBER, 7);
1539 + dmi_save_ident(dm, OMNIBOOK_BOARD_VENDOR, 4);
1540 + dmi_save_ident(dm, OMNIBOOK_BOARD_NAME, 5);
1541 + dmi_save_ident(dm, OMNIBOOK_BOARD_VERSION, 6);
1546 +int __init omnibook_dmi_scan_machine(void)
1548 + int err = dmi_iterate(dmi_decode);
1552 +EXPORT_SYMBOL(omnibook_dmi_ident);
1555 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
1556 --- linux-2.6.1-gentoo/drivers/char/omnibook/dmi.h 1970-01-01 01:00:00.000000000 +0100
1557 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/dmi.h 2004-01-09 22:33:49.000000000 +0000
1560 + * dmi.h -- code to get DMI information
1562 + * This code originally came from file arch/i386/kernel/dmi_scan.c from
1563 + * Linux kernel version 2.4.18
1565 + * This program is free software; you can redistribute it and/or modify it
1566 + * under the terms of the GNU General Public License as published by the
1567 + * Free Software Foundation; either version 2, or (at your option) any
1570 + * This program is distributed in the hope that it will be useful, but
1571 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1572 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1573 + * General Public License for more details.
1578 + OMNIBOOK_BIOS_VENDOR,
1579 + OMNIBOOK_BIOS_VERSION,
1580 + OMNIBOOK_BIOS_DATE,
1581 + OMNIBOOK_SYS_VENDOR,
1582 + OMNIBOOK_PRODUCT_NAME,
1583 + OMNIBOOK_PRODUCT_VERSION,
1584 + OMNIBOOK_SERIAL_NUMBER,
1585 + OMNIBOOK_BOARD_VENDOR,
1586 + OMNIBOOK_BOARD_NAME,
1587 + OMNIBOOK_BOARD_VERSION,
1588 + OMNIBOOK_STRING_MAX
1591 +extern char *omnibook_dmi_ident[OMNIBOOK_STRING_MAX];
1593 +extern int __init omnibook_dmi_scan_machine(void);
1596 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
1597 --- linux-2.6.1-gentoo/drivers/char/omnibook/dock.c 1970-01-01 01:00:00.000000000 +0100
1598 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/dock.c 2004-01-09 22:33:49.000000000 +0000
1601 + * dock.c -- docking station/port replicator support
1603 + * This program is free software; you can redistribute it and/or modify it
1604 + * under the terms of the GNU General Public License as published by the
1605 + * Free Software Foundation; either version 2, or (at your option) any
1608 + * This program is distributed in the hope that it will be useful, but
1609 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1610 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1611 + * General Public License for more details.
1613 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1617 +#include <linux/config.h>
1618 +#include <linux/module.h>
1619 +#include <linux/version.h>
1620 +#include <linux/types.h>
1621 +#include <linux/init.h>
1622 +#include <linux/pm.h>
1623 +#include <linux/proc_fs.h>
1625 +#include <asm/system.h>
1626 +#include <asm/errno.h>
1627 +#include <asm/io.h>
1628 +#include <asm/uaccess.h>
1630 +#ifdef OMNIBOOK_STANDALONE
1631 +#include "omnibook.h"
1633 +#include <linux/omnibook.h>
1639 +static struct proc_dir_entry *proc_dock;
1641 +int omnibook_get_dock(void)
1646 + switch (omnibook_ectype) {
1648 + if ((retval = omnibook_ec_read(XE3GF_CSPR, &dock)))
1650 + retval = (dock & XE3GF_CSPR_MASK) ? 1 : 0;
1656 + if ((retval = omnibook_ec_read(OB500_STA1, &dock)))
1658 + retval = (dock & OB500_DCKS_MASK) ? 1 : 0;
1661 + if ((retval = omnibook_ec_read(OB4150_DCID, &dock)))
1663 + retval = (dock) ? 1 : 0;
1666 + printk(KERN_INFO "%s: Docking station handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1673 +static int omnibook_dock_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
1678 + dock = omnibook_get_dock();
1682 + b += sprintf(b, "Laptop is %s\n", (dock) ? "docked" : "undocked");
1684 + return omnibook_proc_len(buffer, start, off, count, eof, b);
1687 +int __init omnibook_dock_init(void)
1691 + switch (omnibook_ectype) {
1698 + pmode = S_IFREG | S_IRUGO;
1699 + proc_dock = create_proc_read_entry("dock", pmode, omnibook_proc_root, omnibook_dock_status, NULL);
1702 + printk(KERN_INFO "%s: Docking station status monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
1706 + if (! proc_dock) {
1707 + printk(KERN_ERR "%s: Unable to create /proc/%s/dock.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
1710 + printk(KERN_INFO "%s: Docking station status monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
1714 +void __exit omnibook_dock_cleanup(void)
1717 + remove_proc_entry("dock", omnibook_proc_root);
1720 +EXPORT_SYMBOL(omnibook_get_dock);
1723 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
1724 --- linux-2.6.1-gentoo/drivers/char/omnibook/ec.c 1970-01-01 01:00:00.000000000 +0100
1725 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/ec.c 2004-01-09 22:33:49.000000000 +0000
1728 + * ec.c -- low level functions to access Embedded Conrtroller,
1729 + * Keyboard Controller and system I/O ports or memory
1731 + * This program is free software; you can redistribute it and/or modify it
1732 + * under the terms of the GNU General Public License as published by the
1733 + * Free Software Foundation; either version 2, or (at your option) any
1736 + * This program is distributed in the hope that it will be useful, but
1737 + * WITHOUT ANY WARRANTY; without even the implied warranty of
1738 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1739 + * General Public License for more details.
1741 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
1745 +#include <linux/config.h>
1746 +#include <linux/types.h>
1747 +#include <linux/delay.h>
1748 +#include <linux/sched.h>
1750 +#ifdef CONFIG_ACPI_EC
1751 +#include <linux/acpi.h>
1752 +#ifdef ACPI_CA_VERSION
1753 +#if ACPI_CA_VERSION > 0x20021121
1754 +#define USE_ACPI_EC
1759 +#include <asm/io.h>
1764 + * Interrupt control
1767 +#ifdef CONFIG_SMP /* Are you ready for SMP laptops? Coming soon... ;) */
1768 +static spinlock_t omnibook_ec_lock = SPIN_LOCK_UNLOCKED;
1769 +#include <linux/spinlock.h>
1770 +#define omnibook_save_flags(x) spin_lock_irqsave(&omnibook_ec_lock, x)
1771 +#define omnibook_restore_flags(x) spin_unlock_irqrestore(&omnibook_ec_lock, x)
1773 +#include <linux/version.h>
1774 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28))
1775 +#define omnibook_save_flags(x) do { save_flags(x); cli(); } while (0)
1776 +#define omnibook_restore_flags(x) restore_flags(x)
1778 +#define omnibook_save_flags(x) local_irq_save(x)
1779 +#define omnibook_restore_flags(x) local_irq_restore(x)
1781 +#endif /* CONFIG_SMP */
1784 + * Timeout in ms for sending to controller
1787 +#define OMNIBOOK_TIMEOUT 250
1790 + * Registers of the embedded controller
1793 +#define OMNIBOOK_EC_DATA 0x62
1794 +#define OMNIBOOK_EC_SC 0x66
1797 + * Embedded controller status register bits
1800 +#define OMNIBOOK_EC_STAT_OBF 0x01 /* Output buffer full */
1801 +#define OMNIBOOK_EC_STAT_IBF 0x02 /* Input buffer full */
1802 +#define OMNIBOOK_EC_STAT_CMD 0x08 /* Last write was a command write (0=data) */
1805 + * Embedded controller commands
1808 +#define OMNIBOOK_EC_CMD_READ 0x80
1809 +#define OMNIBOOK_EC_CMD_WRITE 0x81
1810 +#define OMNIBOOK_EC_CMD_QUERY 0x84
1813 + * Wait for embedded controller buffer
1816 +static int omnibook_ec_wait(u8 event)
1818 + int timeout = OMNIBOOK_TIMEOUT;
1821 + case OMNIBOOK_EC_STAT_OBF:
1822 + while (!(inb(OMNIBOOK_EC_SC) & event) && timeout--)
1825 + case OMNIBOOK_EC_STAT_IBF:
1826 + while ((inb(OMNIBOOK_EC_SC) & event) && timeout--)
1838 + * Read from the embedded controller
1841 +int omnibook_ec_read(u8 addr, u8 *data)
1843 + unsigned long flags;
1847 + retval = ec_read(addr, data);
1851 + omnibook_save_flags(flags);
1852 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1855 + outb(OMNIBOOK_EC_CMD_READ, OMNIBOOK_EC_SC);
1856 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1859 + outb(addr, OMNIBOOK_EC_DATA);
1860 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_OBF);
1863 + *data = inb(OMNIBOOK_EC_DATA);
1865 + omnibook_restore_flags(flags);
1870 + * Write to the embedded controller
1873 +int omnibook_ec_write(u8 addr, u8 data)
1876 + unsigned long flags;
1880 + retval = ec_write(addr, data);
1884 + omnibook_save_flags(flags);
1885 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1888 + outb(OMNIBOOK_EC_CMD_WRITE, OMNIBOOK_EC_SC);
1889 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1892 + outb(addr, OMNIBOOK_EC_DATA);
1893 + retval = omnibook_ec_wait(OMNIBOOK_EC_STAT_IBF);
1896 + outb(data, OMNIBOOK_EC_DATA);
1898 + omnibook_restore_flags(flags);
1902 +int omnibook_ec_read16(u8 addr, u16 *data)
1909 + retval = omnibook_ec_read(addr, &low);
1912 + retval = omnibook_ec_read(addr + 0x01, &high);
1913 + result = ((high << 8) + low);
1919 + * Registers of the keyboard controller
1922 +#define OMNIBOOK_KBC_DATA 0x60
1923 +#define OMNIBOOK_KBC_SC 0x64
1926 + * Keyboard controller status register bits
1929 +#define OMNIBOOK_KBC_STAT_OBF 0x01 /* Output buffer full */
1930 +#define OMNIBOOK_KBC_STAT_IBF 0x02 /* Input buffer full */
1931 +#define OMNIBOOK_KBC_STAT_CMD 0x08 /* Last write was a command write (0=data) */
1934 + * Wait for keyboard buffer
1937 +static int omnibook_kbc_wait(u8 event)
1939 + int timeout = OMNIBOOK_TIMEOUT;
1942 + case OMNIBOOK_KBC_STAT_OBF:
1943 + while (!(inb(OMNIBOOK_KBC_SC) & event) && timeout--)
1946 + case OMNIBOOK_KBC_STAT_IBF:
1947 + while ((inb(OMNIBOOK_KBC_SC) & event) && timeout--)
1959 + * Write to the keyboard command register
1962 +static int omnibook_kbc_write_command(u8 cmd)
1964 + unsigned long flags;
1967 + omnibook_save_flags(flags);
1968 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1971 + outb(cmd, OMNIBOOK_KBC_SC);
1972 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1974 + omnibook_restore_flags(flags);
1979 + * Write to the keyboard data register
1982 +static int omnibook_kbc_write_data(u8 data)
1984 + unsigned long flags;
1987 + omnibook_save_flags(flags);
1988 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1991 + outb(data, OMNIBOOK_KBC_DATA);
1992 + retval = omnibook_kbc_wait(OMNIBOOK_KBC_STAT_IBF);
1994 + omnibook_restore_flags(flags);
1999 + * Send a command to keyboard controller
2002 +int omnibook_kbc_command(u8 cmd, u8 data)
2006 + retval = omnibook_kbc_write_command(cmd);
2009 + retval = omnibook_kbc_write_data(data);
2014 + * Read a value from a system I/O address
2017 +int omnibook_io_read(u32 addr, u8 *data)
2019 + unsigned long flags;
2021 + omnibook_save_flags(flags);
2022 + *data = inb(addr);
2023 + omnibook_restore_flags(flags);
2028 + * Write a value to a system I/O address
2031 +int omnibook_io_write(u32 addr, u8 data)
2033 + unsigned long flags;
2035 + omnibook_save_flags(flags);
2037 + omnibook_restore_flags(flags);
2042 + * Read a value from a system memory address
2045 +int omnibook_mem_read(u32 addr, u8 *data)
2047 + char *base = ioremap(addr, 1);
2049 + *data = readb(base);
2055 + * Write a value to a system memory address
2058 +int omnibook_mem_write(u32 addr, u8 data)
2060 + char *base = ioremap(addr, 1);
2062 + writeb(data, base);
2068 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
2069 --- linux-2.6.1-gentoo/drivers/char/omnibook/ec.h 1970-01-01 01:00:00.000000000 +0100
2070 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/ec.h 2004-01-09 22:33:49.000000000 +0000
2073 + * ec.h -- low level definitions to access Embedded Conrtroller
2074 + * and Keyboard Controller and system I/O ports or memory
2076 + * This program is free software; you can redistribute it and/or modify it
2077 + * under the terms of the GNU General Public License as published by the
2078 + * Free Software Foundation; either version 2, or (at your option) any
2081 + * This program is distributed in the hope that it will be useful, but
2082 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2083 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2084 + * General Public License for more details.
2086 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2089 +extern int omnibook_ec_read(u8 addr, u8 *data);
2090 +extern int omnibook_ec_read16(u8 addr, u16 *data);
2091 +extern int omnibook_ec_write(u8 addr, u8 data);
2092 +extern int omnibook_kbc_command(u8 cmd, u8 data);
2093 +extern int omnibook_io_read(u32 addr, u8 *data);
2094 +extern int omnibook_io_write(u32 addr, u8 data);
2095 +extern int omnibook_mem_read(u32 addr, u8 *data);
2096 +extern int omnibook_mem_write(u32 addr, u8 data);
2099 + * Embedded controller adresses
2102 +#define XE3GF_CHGM 0x90 /* , 16 bit */
2103 +#define XE3GF_CHGS 0x92 /* , 16 bit */
2104 +#define XE3GF_CHGC 0x94 /* Current charge of board, 16 bit */
2105 +#define XE3GF_CHGV 0x96 /* Current voltage, 16 bit */
2106 +#define XE3GF_CHGA 0x98 /* Current intensity, 16 bit */
2107 +#define XE3GF_BAL 0x9A /* Battery present status */
2108 +#define XE3GF_STA1 0x9C /* Various status bits*/
2109 +#define XE3GF_CSPR 0xA1 /* Port replicator status, 1 bit */
2110 +#define XE3GF_ADP 0xA3 /* AC acapter status, 1 bit */
2111 +#define XE3GF_FOT 0xA5 /* Fan off temperature, 8 bit */
2112 +#define XE3GF_FSD1 0xA6 /* Fan on temperature, 8 bit */
2113 +#define XE3GF_FSD2 0xA7 /* Fan level 2 temperature, 8 bit */
2114 +#define XE3GF_FSD3 0xA8 /* Fan level 3 temperature, 8 bit */
2115 +#define XE3GF_FSD4 0xA9 /* Fan level 4 temperature, 8 bit */
2116 +#define XE3GF_FSD5 0xAA /* Fan level 5 temperature, 8 bit */
2117 +#define XE3GF_FSD6 0xAB /* Fan level 6 temperature, 8 bit */
2118 +#define XE3GF_FSD7 0xAC /* Fan level 7 temperature, 8 bit */
2119 +#define XE3GF_FSRD 0xAD /* Fan status, 8 bit */
2120 +#define XE3GF_CTMP 0xB0 /* CPU tempetature, 8 bit */
2121 +#define XE3GF_BRTS 0xB9 /* LCD brightness, 4 bit */
2122 +#define XE3GF_BTY0 0xC0 /* Battery 0 type, 1 bit */
2123 +#define XE3GF_BST0 0xC1 /* Battery 0 status, 3 bit */
2124 +#define XE3GF_BRC0 0xC2 /* Battery 0 remaining capacity, 16 bit */
2125 +#define XE3GF_BSN0 0xC4 /* Battery 0 serial number 16 bit */
2126 +#define XE3GF_BPV0 0xC6 /* Battery 0 present voltage, 16 bit */
2127 +#define XE3GF_BDV0 0xC8 /* Battery 0 design voltage 16 bit */
2128 +#define XE3GF_BDC0 0xCA /* Battery 0 design capacity 16 bit */
2129 +#define XE3GF_BFC0 0xCC /* Battery 0 last full capacity 16 bit */
2130 +#define XE3GF_GAU0 0xCE /* Battery 0 gauge, 8 bit */
2131 +#define XE3GF_BTY1 0xD0 /* Battery 1 type, 1 bit */
2132 +#define XE3GF_BST1 0xD1 /* Battery 1 status, 3 bit */
2133 +#define XE3GF_BRC1 0xD2 /* Battery 1 remaining capacity, 16 bit */
2134 +#define XE3GF_BSN1 0xD4 /* Battery 1 serial number, 16 bit */
2135 +#define XE3GF_BPV1 0xD6 /* Battery 1 present voltage, 16 bit */
2136 +#define XE3GF_BDV1 0xD8 /* Battery 1 design voltage 16 bit */
2137 +#define XE3GF_BDC1 0xDA /* Battery 1 design capacity 16 bit */
2138 +#define XE3GF_BFC1 0xDC /* Battery 1 last full capacity 16 bit */
2139 +#define XE3GF_GAU1 0xDE /* Battery 1 gauge, 8 bit */
2142 + * Bitmasks for sub byte values
2145 +#define XE3GF_SHDD_MASK 0x40 /* External display status */
2146 +#define XE3GF_CSPR_MASK 0x01 /* Port replicator status */
2147 +#define XE3GF_ADP_MASK 0x20 /* AC acapter status */
2148 +#define XE3GF_BAL0_MASK 0x01 /* Battery 0 present */
2149 +#define XE3GF_BAL1_MASK 0x02 /* Battery 1 present */
2150 +#define XE3GF_BMF_MASK 0x70 /* Model code */
2151 +#define XE3GF_BTY_MASK 0x80 /* Type: Ni-MH or Li-Ion */
2152 +#define XE3GF_BST_MASK_DSC 0x01 /* Discarging */
2153 +#define XE3GF_BST_MASK_CHR 0x02 /* Charging */
2154 +#define XE3GF_BST_MASK_CRT 0x04 /* Critical */
2155 +#define XE3GF_FSRD_MASK_S1 0x01 /* Fan level 1 */
2156 +#define XE3GF_FSRD_MASK_S2 0x02 /* Fan level 2 */
2157 +#define XE3GF_FSRD_MASK_S3 0x04 /* Fan level 3 */
2158 +#define XE3GF_FSRD_MASK_S4 0x08 /* Fan level 4 */
2159 +#define XE3GF_FSRD_MASK_S5 0x10 /* Fan level 5 */
2160 +#define XE3GF_FSRD_MASK_S6 0x20 /* Fan level 6 */
2161 +#define XE3GF_FSRD_MASK_S7 0x40 /* Fan level 7 */
2162 +#define XE3GF_BRTS_MASK 0x0F /* LCD brightness */
2164 +#define XE3GF_FAN_ON_MASK 0x02 /* Fan on */
2167 + * OmniBook XE3 GC values
2170 +#define XE3GC_CTMP 0x28 /* CPU tempetature, 8 bit */
2171 +#define XE3GC_STA1 0x30 /* Various status bits */
2172 +#define XE3GC_Q0A 0x31 /* Various status bits */
2173 +#define XE3GC_CCUR 0x38 /* Current charge of board, 16 bit ? */
2174 +#define XE3GC_CVOL 0x3A /* Current voltage, 16 bit ? */
2175 +#define XE3GC_CARM 0x3C /* Current intensity, 16 bit ? */
2176 +#define XE3GC_BAT 0x3E /* Battery present status */
2177 +#define XE3GC_BST0 0x40 /* Battery 0 status, 3 bit */
2178 +#define XE3GC_BPR0 0x41 /* Battery 0 present rate, 16 bit ? */
2179 +#define XE3GC_BRC0 0x43 /* Battery 0 remaining capacity, 16 bit */
2180 +#define XE3GC_BPV0 0x45 /* Battery 0 present voltage, 16 bit */
2181 +#define XE3GC_BDV0 0x47 /* Battery 0 design voltage 16 bit */
2182 +#define XE3GC_BDC0 0x49 /* Battery 0 design capacity 16 bit */
2183 +#define XE3GC_BTY0 0x4A /* Battery 0 type, 1 bit ?*/
2184 +#define XE3GC_BTP0 0x4B /* Battery 0 ?, 1 bit */
2185 +#define XE3GC_BSN0 0x4C /* Battery 0 serial number, 8 bit ?*/
2186 +#define XE3GC_BMF0 0x4D /* Battery 0 ?,8 bit */
2187 +#define XE3GC_BST1 0x50 /* Battery 0 status, 3 bit */
2188 +#define XE3GC_BPR1 0x51 /* Battery 0 present rate, 16 bit ? */
2189 +#define XE3GC_BRC1 0x53 /* Battery 0 remaining capacity, 16 bit */
2190 +#define XE3GC_BPV1 0x55 /* Battery 0 present voltage, 16 bit */
2191 +#define XE3GC_BDV1 0x57 /* Battery 0 design voltage 16 bit */
2192 +#define XE3GC_BDC1 0x59 /* Battery 0 design capacity 16 bit */
2193 +#define XE3GC_BTY1 0x5A /* Battery 0 type, 1 bit ?*/
2194 +#define XE3GC_BTP1 0x5B /* Battery 0 ?, 1 bit */
2195 +#define XE3GC_BSN1 0x5C /* Battery 0 serial number, 8 bit ?*/
2196 +#define XE3GC_BMF1 0x5D /* Battery 0 ?,8 bit */
2197 +#define XE3GC_STA2 0x61 /* Various status bits */
2198 +#define XE3GC_BTVL 0x6A /* LCD brightness, 4 bit */
2201 + * Bitmasks for sub byte values
2204 +#define XE3GC_ADP_MASK 0x40 /* AC acapter status */
2205 +#define XE3GC_BAT0_MASK 0x01 /* Battery 0 present */
2206 +#define XE3GC_BAT1_MASK 0x02 /* Battery 1 present */
2207 +#define XE3GC_BTY_MASK 0x01 /* Type: Ni-MH or Li-Ion */
2208 +#define XE3GC_BST_MASK_DSC 0x01 /* Discarging */
2209 +#define XE3GC_BST_MASK_CHR 0x02 /* Charging */
2210 +#define XE3GC_BST_MASK_CRT 0x04 /* Critical */
2211 +#define XE3GC_CRTI_MASK 0x04 /* External display status */
2212 +#define XE3GC_SLPB_MASK 0x01 /* Sleep button pressed */
2213 +#define XE3GC_F5_MASK 0x02 /* Fn-F5 - LCD/CRT switch pressed */
2214 +#define XE3GC_VOLD_MASK 0x04 /* Fn-down arrow or Volume down pressed */
2215 +#define XE3GC_VOLU_MASK 0x08 /* Fn-up arrow or Volume up pressed */
2216 +#define XE3GC_MUTE_MASK 0x10 /* Fn+F7 - Volume mute pressed */
2217 +#define XE3GC_CNTR_MASK 0x20 /* Fn+F3/Fn+F4 - Contrast up or down pressed */
2218 +#define XE3GC_BRGT_MASK 0x40 /* Fn+F1/Fn+F2 - Brightness up or down pressed */
2219 +#define XE3GC_BTVL_MASK 0x0F /* LCD brightness */
2222 + * Emulated scancodes
2225 +#define XE3GC_VOLD_SCAN 0x2E /* Volume down button scancode */
2226 +#define XE3GC_VOLU_SCAN 0x30 /* Volume up button scancode */
2227 +#define XE3GC_MUTE_SCAN 0x20 /* Volume up button scancode */
2230 + * OmniBook 500, 510, 6000, 6100, XE2 values
2233 +#define OB500_STA1 0x44 /* Various status bits */
2234 +#define OB500_STA2 0x50 /* Various status bits */
2235 +#define OB500_CTMP 0x55 /* CPU tempetature, 8 bit */
2236 +#define OB500_BT1I 0x58 /* Battery 1 ? 16 bit */
2237 +#define OB500_BT1C 0x5A /* Battery 1 remaining capacity 16 bit ? */
2238 +#define OB500_BT1V 0x5C /* Battery 1 present voltage 16 bit ? */
2239 +#define OB500_BT1S 0x5E /* Battery 1 status 3 bit ? */
2240 +#define OB500_BT2I 0x6A /* Battery 2 ? 16 bit */
2241 +#define OB500_BT2C 0x6C /* Battery 2 remaining capacity 16 bit ? */
2242 +#define OB500_BT2V 0x6E /* Battery 2 present voltage 16 bit ? */
2243 +#define OB500_BT2S 0x70 /* Battery 2 status 3 bit ? */
2244 +#define OB500_BT3I 0x5F /* Battery 3 ? 16 bit */
2245 +#define OB500_BT3C 0x61 /* Battery 3 remaining capacity 16 bit ? */
2246 +#define OB500_BT3V 0x63 /* Battery 3 present voltage 16 bit ? */
2247 +#define OB500_BT3S 0x65 /* Battery 3 status 3 bit ? */
2249 +#define OB6000_STA1 0x77 /* Various status bits */
2251 +#define XE2_STA1 0x50 /* Various status bits */
2254 + * Bitmasks for sub byte values
2257 +#define OB500_LIDS_MASK 0x01 /* LID status */
2258 +#define OB500_CRTS_MASK 0x20 /* External display status */
2259 +#define OB500_SLPS_MASK 0x40 /* Sleep button status */
2260 +#define OB500_DCKS_MASK 0x80 /* Docking status */
2261 +#define OB500_ADP_MASK 0x02 /* AC acapter status */
2262 +#define OB500_BST_MASK_DSC 0x01 /* Discarging */
2263 +#define OB500_BST_MASK_CHR 0x02 /* Charging */
2264 +#define OB500_BST_MASK_CRT 0x04 /* Critical */
2266 +#define OB6000_FAN_MASK 0x10 /* Fan status */
2268 +#define XE2_ADP_MASK 0x02 /* AC acapter status */
2274 +#define OB4150_TMP 0x28 /* CPU tempetature, 8 bit */
2275 +#define OB4150_STA1 0x2E /* Various status bits */
2276 +#define OB4150_STA2 0x2F /* Various status bits */
2277 +#define OB4150_ADP 0x30 /* AC acapter status, 1 bit */
2278 +#define OB4150_DCID 0x2C /* Port replicator */
2281 + * Bitmasks for sub byte values
2284 +#define OB4150_FAN_MASK 0x01 /* Fan status */
2285 +#define OB4150_ADP_MASK 0x40 /* AC acapter status */
2286 +#define OB4150_CRST_MASK 0x20 /* External display status */
2289 + * Keyboard controller command for some laptop functions
2292 +#define OMNIBOOK_KBC_CONTROL_CMD 0x59
2295 + * Keyboard controller command parameters for functions available via kbc
2298 +#define OMNIBOOK_KBC_CMD_ONETOUCH_ENABLE 0x90 /* Enables OneTouch buttons */
2299 +#define OMNIBOOK_KBC_CMD_ONETOUCH_DISABLE 0x91 /* Disables OneTouch buttons */
2300 +#define OMNIBOOK_KBC_CMD_TOUCHPAD_ENABLE 0xAA /* Enables toucpad */
2301 +#define OMNIBOOK_KBC_CMD_TOUCHPAD_DISABLE 0xA9 /* Disables toucpad */
2302 +#define OMNIBOOK_KBC_CMD_LCD_ON 0xE1 /* Turns LCD display on */
2303 +#define OMNIBOOK_KBC_CMD_LCD_OFF 0xE2 /* Turns LCD display off */
2304 +#define OMNIBOOK_KBC_CMD_AC_POWER_ENABLE 0xC2 /* Enable AC power */
2305 +#define OMNIBOOK_KBC_CMD_AC_POWER_DISABLE 0xC1 /* Disable AC power */
2311 +#define ACL00_AC_STAT 0x11B9 /* AC adapter status on ACL00 */
2312 +#define ACL00_AC_MASK 0x04 /* Bitmask for AC adapter status on ACL00 */
2313 +#define TOSH3K_AC_STAT 0x102D /* AC adapter status on Toshiba 3000 */
2314 +#define TOSH3K_AC_MASK 0x08 /* Bitmask for AC adapter status on Toshiba 3000 */
2315 +#define XE3GF_AC_STAT 0x11B9 /* AC adapter status on XE3 GF */
2316 +#define XE3GF_AC_MASK 0x04 /* Bitmask for AC adapter status on XE3 GF */
2317 +#define XE3GF_LID_STAT 0x11AD /* LID switch status on XE3 GF */
2318 +#define XE3GF_LID_MASK 0x20 /* Bitmask for LID switch status on XE3 GF */
2319 +#define XE3GC_SMIC 0xFE00
2321 +#define OB500_GPO1 0x8034 /* Fan control */
2322 +#define OB510_GPO2 0x11B9 /* LCD backlight */
2323 +#define OB510_GPIO 0x118F /* Fan control */
2325 +#define OB500_FAN_ON_MASK 0x0A /* Turn fan on with zero bits */
2326 +#define OB500_FAN_OFF_MASK 0x08 /* Fan status/off */
2327 +#define OB500_BKLT_MASK 0x40 /* LCD backlight */
2328 +#define OB510_FAN_ON_MASK 0x18 /* Turn fan on with zero bits */
2329 +#define OB510_FAN_OFF_MASK 0x10 /* Turn fan on */
2330 +#define OB510_BKLT_MASK 0x01 /* LCD backlight */
2332 +#define XE2_FAN_MASK 0x02 /* Turn fan on with zero bit */
2338 +#define XE3GC_BCMD 0xFFFFEBC
2341 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
2342 --- linux-2.6.1-gentoo/drivers/char/omnibook/fan.c 1970-01-01 01:00:00.000000000 +0100
2343 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/fan.c 2004-01-09 22:33:49.000000000 +0000
2346 + * fan.c -- fan status/control
2348 + * This program is free software; you can redistribute it and/or modify it
2349 + * under the terms of the GNU General Public License as published by the
2350 + * Free Software Foundation; either version 2, or (at your option) any
2353 + * This program is distributed in the hope that it will be useful, but
2354 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2355 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2356 + * General Public License for more details.
2358 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2362 +#include <linux/config.h>
2363 +#include <linux/module.h>
2364 +#include <linux/version.h>
2365 +#include <linux/types.h>
2366 +#include <linux/init.h>
2367 +#include <linux/delay.h>
2368 +#include <linux/pm.h>
2369 +#include <linux/proc_fs.h>
2371 +#include <asm/system.h>
2372 +#include <asm/errno.h>
2373 +#include <asm/io.h>
2374 +#include <asm/uaccess.h>
2376 +#ifdef OMNIBOOK_STANDALONE
2377 +#include "omnibook.h"
2379 +#include <linux/omnibook.h>
2385 +static struct proc_dir_entry *proc_fan;
2387 +int omnibook_get_fan(void)
2392 + switch (omnibook_ectype) {
2394 + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan)))
2399 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2401 + retval = (fan & OB500_FAN_OFF_MASK) ? 0 : 1;
2404 + if ((retval = omnibook_io_read(OB510_GPIO, &fan)))
2406 + retval = (fan & OB510_FAN_OFF_MASK) ? 0 : 1;
2410 + if ((retval = omnibook_ec_read(OB6000_STA1, &fan)))
2412 + retval = (fan & OB6000_FAN_MASK) ? 1 : 0;
2415 + if ((retval = omnibook_ec_read(OB4150_STA1, &fan)))
2417 + retval = (fan & OB4150_FAN_MASK) ? 1 : 0;
2420 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2422 + retval = (fan & XE2_FAN_MASK) ? 0 : 1;
2425 + printk(KERN_INFO "%s: Fan status monitoring is unsupported on this machie.\n", OMNIBOOK_MODULE_NAME);
2432 +int omnibook_fan_on(void)
2437 + switch (omnibook_ectype) {
2439 + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan)))
2441 + if ((retval = omnibook_ec_write(XE3GF_FSRD, fan | XE3GF_FAN_ON_MASK)))
2445 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2447 + if ((retval = omnibook_io_write(OB500_GPO1, fan & ~OB500_FAN_ON_MASK)))
2451 + if ((retval = omnibook_io_read(OB510_GPIO, &fan)))
2453 + if ((retval = omnibook_io_write(OB510_GPIO, fan & ~OB510_FAN_ON_MASK)))
2458 + if ((retval = omnibook_ec_read(OB6000_STA1, &fan)))
2460 + if ((retval = omnibook_ec_write(OB6000_STA1, fan | OB6000_FAN_MASK)))
2464 + if ((retval = omnibook_ec_read(OB4150_STA1, &fan)))
2466 + if ((retval = omnibook_ec_write(OB4150_STA1, fan | OB4150_FAN_MASK)))
2470 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2472 + if ((retval = omnibook_io_write(OB500_GPO1, fan & ~XE2_FAN_MASK)))
2476 + printk(KERN_INFO "%s: Direct fan control is unsupported on this machie.\n", OMNIBOOK_MODULE_NAME);
2483 +int omnibook_fan_off(void)
2488 + switch (omnibook_ectype) {
2492 + if ((retval = omnibook_ec_read(XE3GF_FSRD, &fan)))
2495 + /* fan is already off */
2499 + /* now we set FOT to current temp, then reset to initial value */
2500 + if ((retval = omnibook_ec_read(XE3GF_FOT, &fot)))
2502 + if ((retval = omnibook_ec_read(XE3GF_CTMP, &temp)))
2506 + omnibook_ec_write(XE3GF_FOT, temp);
2508 + } while (omnibook_get_fan() != 0);
2510 + omnibook_ec_write(XE3GF_FOT, fot);
2514 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2516 + if ((retval = omnibook_io_write(OB500_GPO1, fan | OB500_FAN_OFF_MASK)))
2520 + if ((retval = omnibook_io_read(OB510_GPIO, &fan)))
2522 + if ((retval = omnibook_io_write(OB510_GPIO, fan | OB510_FAN_OFF_MASK)))
2527 + if ((retval = omnibook_ec_read(OB6000_STA1, &fan)))
2529 + if ((retval = omnibook_ec_write(OB6000_STA1, fan & ~OB6000_FAN_MASK)))
2533 + if ((retval = omnibook_ec_read(OB4150_STA1, &fan)))
2535 + if ((retval = omnibook_ec_write(OB4150_STA1, fan & ~OB4150_FAN_MASK)))
2539 + if ((retval = omnibook_io_read(OB500_GPO1, &fan)))
2541 + if ((retval = omnibook_io_write(OB500_GPO1, fan | XE2_FAN_MASK)))
2545 + printk(KERN_INFO "%s: Direct fan control is unsupported on this machie.\n", OMNIBOOK_MODULE_NAME);
2552 +static int omnibook_fan_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2558 + fan = omnibook_get_fan();
2561 + str = (fan) ? "on" : "off";
2564 + b += sprintf(b, "Fan is %s (level %d)\n", str, fan);
2566 + b += sprintf(b, "Fan is %s\n", str);
2568 + return omnibook_proc_len(buffer, start, off, count, eof, b);;
2571 +static int omnibook_fan_set(struct file *file, const char *buffer, unsigned long count, void *data)
2573 + char status[1] = {'\0'};
2575 + if (copy_from_user(status, buffer, 1))
2577 + switch (*status) {
2579 + omnibook_fan_off();
2582 + omnibook_fan_on();
2591 +int __init omnibook_fan_init(void)
2595 + switch (omnibook_ectype) {
2603 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
2604 + if (omnibook_userset)
2605 + pmode = pmode | S_IWUGO;
2606 + proc_fan = create_proc_entry("fan", pmode, omnibook_proc_root);
2609 + printk(KERN_INFO "%s: Fan status monitor and control is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2614 + proc_fan->read_proc = omnibook_fan_status;
2615 + proc_fan->write_proc = omnibook_fan_set;
2617 + printk(KERN_ERR "%s: Unable to create /proc/%s/fan.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
2620 + printk(KERN_INFO "%s: Fan status monitor and control is enabled.\n", OMNIBOOK_MODULE_NAME);
2624 +void __exit omnibook_fan_cleanup(void)
2627 + remove_proc_entry("fan", omnibook_proc_root);
2630 +EXPORT_SYMBOL(omnibook_get_fan);
2631 +EXPORT_SYMBOL(omnibook_fan_on);
2632 +EXPORT_SYMBOL(omnibook_fan_off);
2635 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
2636 --- linux-2.6.1-gentoo/drivers/char/omnibook/fan_policy.c 1970-01-01 01:00:00.000000000 +0100
2637 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/fan_policy.c 2004-01-09 22:33:49.000000000 +0000
2640 + * fan_policy.c -- fan policy support
2642 + * This program is free software; you can redistribute it and/or modify it
2643 + * under the terms of the GNU General Public License as published by the
2644 + * Free Software Foundation; either version 2, or (at your option) any
2647 + * This program is distributed in the hope that it will be useful, but
2648 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2649 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2650 + * General Public License for more details.
2652 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2656 +#include <linux/config.h>
2657 +#include <linux/module.h>
2658 +#include <linux/version.h>
2659 +#include <linux/types.h>
2660 +#include <linux/init.h>
2661 +#include <linux/proc_fs.h>
2663 +#include <asm/system.h>
2664 +#include <asm/errno.h>
2665 +#include <asm/io.h>
2666 +#include <asm/uaccess.h>
2668 +#ifdef OMNIBOOK_STANDALONE
2669 +#include "omnibook.h"
2671 +#include <linux/omnibook.h>
2677 +static struct proc_dir_entry *proc_fan_policy;
2679 +u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS];
2681 +int omnibook_get_fan_policy(void)
2687 + switch (omnibook_ectype) {
2689 + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) {
2690 + if ((retval = omnibook_ec_read(XE3GF_FOT + i, &tmp)))
2692 + omnibook_fan_policy[i] = tmp;
2696 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2703 +int omnibook_set_fan_policy(void)
2708 + switch (omnibook_ectype) {
2710 + if (omnibook_fan_policy[0] > OMNIBOOK_FOT_MAX)
2712 + for (i = 0; i < OMNIBOOK_FAN_LEVELS; i++) {
2713 + if ((omnibook_fan_policy[i] > omnibook_fan_policy[i + 1]) || (omnibook_fan_policy[i] < OMNIBOOK_FAN_MIN) || (omnibook_fan_policy[i] > OMNIBOOK_FAN_MAX))
2715 + if (omnibook_fan_policy[i + 1] > OMNIBOOK_FAN_MAX)
2718 + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) {
2719 + if ((retval = omnibook_ec_write(XE3GF_FOT + i, omnibook_fan_policy[i])))
2724 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2731 +int omnibook_set_fan_policy_defaults(void)
2735 + u8 fan_defaults[] = {
2736 + OMNIBOOK_FOT_DEFAULT,
2737 + OMNIBOOK_FAN1_DEFAULT,
2738 + OMNIBOOK_FAN2_DEFAULT,
2739 + OMNIBOOK_FAN3_DEFAULT,
2740 + OMNIBOOK_FAN4_DEFAULT,
2741 + OMNIBOOK_FAN5_DEFAULT,
2742 + OMNIBOOK_FAN6_DEFAULT,
2743 + OMNIBOOK_FAN7_DEFAULT,
2746 + switch (omnibook_ectype) {
2748 + for (i = 0; i <= OMNIBOOK_FAN_LEVELS; i++) {
2749 + if ((retval = omnibook_ec_write(XE3GF_FOT + i, fan_defaults[i])))
2754 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2761 +static int omnibook_proc_fan_policy_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2767 + if ((retval = omnibook_get_fan_policy()))
2770 + b += sprintf(b, "Fan off temperature: %2d C\n", omnibook_fan_policy[0]);
2771 + b += sprintf(b, "Fan on temperature: %2d C\n", omnibook_fan_policy[1]);
2772 + for (i = 2; i <= OMNIBOOK_FAN_LEVELS; i++) {
2773 + b += sprintf(b, "Fan level %1d temperature: %2d C\n", i, omnibook_fan_policy[i]);
2775 + b += sprintf(b, "Minimal temperature to set: %2d C\n", OMNIBOOK_FAN_MIN);
2776 + b += sprintf(b, "Maximal temperature to set: %2d C\n", OMNIBOOK_FAN_MAX);
2778 + return omnibook_proc_len(buffer, start, off, count, eof, b);
2781 +static int omnibook_proc_fan_policy_set(struct file *file, const char *buffer, unsigned long count, void *data)
2783 + unsigned int len = (count < OMNIBOOK_FAN_POLICY_STRING) ? count : OMNIBOOK_FAN_POLICY_STRING;
2784 + char status[OMNIBOOK_FAN_POLICY_STRING] = {'\0'};
2791 + if ((retval = omnibook_get_fan_policy()))
2794 + if (copy_from_user(status, buffer, len))
2802 + printk(KERN_INFO "%s: c=%d\n", OMNIBOOK_MODULE_NAME, c);
2803 + if (n > OMNIBOOK_FAN_LEVELS)
2805 + if (*b >= '0' && *b <= '9')
2806 + c = c * 10 + (*b - '0');
2807 + else if (((*b == ' ') || (*b == '\0') || (*b == '\n')) && (*prev >= '0') && (*prev <= '9')) {
2808 + omnibook_fan_policy[n] = c;
2816 + } while ((*prev != '\n') && (*prev != '\0'));
2818 + /* A zero value set the defaults */
2819 + if ((omnibook_fan_policy[0] == 0) && (n == 1)) {
2820 + if ((retval = omnibook_set_fan_policy_defaults()))
2823 + omnibook_set_fan_policy();
2828 +int __init omnibook_fan_policy_init(void)
2832 + switch (omnibook_ectype) {
2834 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
2835 + if (omnibook_userset)
2836 + pmode = pmode | S_IWUGO;
2837 + proc_fan_policy = create_proc_entry("fan_policy", pmode, omnibook_proc_root);
2840 + printk(KERN_INFO "%s: Fan policy is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
2843 + if (proc_fan_policy) {
2844 + proc_fan_policy->read_proc = omnibook_proc_fan_policy_status;
2845 + proc_fan_policy->write_proc = omnibook_proc_fan_policy_set;
2847 + printk(KERN_ERR "%s: Unable to create /proc/%s/fan_policy.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
2850 + printk(KERN_INFO "%s: Fan policy setting is enabled.\n", OMNIBOOK_MODULE_NAME);
2854 +void __exit omnibook_fan_policy_cleanup(void)
2856 + if (proc_fan_policy)
2857 + remove_proc_entry("fan_policy", omnibook_proc_root);
2860 +EXPORT_SYMBOL(omnibook_fan_policy);
2861 +EXPORT_SYMBOL(omnibook_get_fan_policy);
2862 +EXPORT_SYMBOL(omnibook_set_fan_policy);
2863 +EXPORT_SYMBOL(omnibook_set_fan_policy_defaults);
2866 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
2867 --- linux-2.6.1-gentoo/drivers/char/omnibook/init.c 1970-01-01 01:00:00.000000000 +0100
2868 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/init.c 2004-01-09 22:33:49.000000000 +0000
2871 + * init.c -- module initialization code
2873 + * This program is free software; you can redistribute it and/or modify it
2874 + * under the terms of the GNU General Public License as published by the
2875 + * Free Software Foundation; either version 2, or (at your option) any
2878 + * This program is distributed in the hope that it will be useful, but
2879 + * WITHOUT ANY WARRANTY; without even the implied warranty of
2880 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2881 + * General Public License for more details.
2883 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
2887 +#include <linux/config.h>
2888 +#include <linux/module.h>
2889 +#include <linux/version.h>
2890 +#include <linux/types.h>
2891 +#include <linux/init.h>
2892 +#include <linux/pm.h>
2893 +#include <linux/proc_fs.h>
2895 +#include <asm/system.h>
2896 +#include <asm/errno.h>
2897 +#include <asm/io.h>
2898 +#include <asm/uaccess.h>
2900 +#ifdef OMNIBOOK_STANDALONE
2901 +#include "omnibook.h"
2903 +#include <linux/omnibook.h>
2910 +int omnibook_ectype;
2911 +int omnibook_userset;
2913 +struct proc_dir_entry *omnibook_proc_root __initdata = NULL;
2914 +static struct proc_dir_entry *proc_version;
2915 +static struct proc_dir_entry *proc_dmi;
2918 + * Module parameters
2919 + * 0 disables the feature
2920 + * >1 enables the feature
2921 + * All feature enabled by default
2924 +static int ectype __initdata = NONE;
2925 +static int ac __initdata = 1;
2926 +static int battery __initdata = 1;
2927 +static int blank __initdata = 1;
2928 +static int display __initdata = 1;
2929 +static int dmi __initdata = 1;
2930 +static int fan __initdata = 1;
2931 +static int fan_policy __initdata = 1;
2932 +static int onetouch __initdata = 1;
2933 +static int lcd __initdata = 1;
2934 +static int temperature __initdata = 1;
2935 +static int touchpad __initdata = 1;
2936 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
2937 +static int key_polling __initdata = 1;
2940 +static int apmemu __initdata = 0;
2941 +static int dock __initdata = 0;
2942 +static int user __initdata = 0;
2944 +static int omnibook_proc_version(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2948 + b += sprintf(b, "%s\n", OMNIBOOK_MODULE_VERSION);
2950 + return omnibook_proc_len(buffer, start, off, count, eof, b);
2953 +static int omnibook_proc_dmi(char *buffer, char **start, off_t off, int count, int *eof, void *data)
2957 + b += sprintf(b, "BIOS Vendor: %s\n", omnibook_dmi_ident[OMNIBOOK_BIOS_VENDOR]);
2958 + b += sprintf(b, "BIOS Version: %s\n", omnibook_dmi_ident[OMNIBOOK_BIOS_VERSION]);
2959 + b += sprintf(b, "BIOS Release: %s\n", omnibook_dmi_ident[OMNIBOOK_BIOS_DATE]);
2960 + b += sprintf(b, "System Vendor: %s\n", omnibook_dmi_ident[OMNIBOOK_SYS_VENDOR]);
2961 + b += sprintf(b, "Product Name: %s\n", omnibook_dmi_ident[OMNIBOOK_PRODUCT_NAME]);
2962 + b += sprintf(b, "Version: %s\n", omnibook_dmi_ident[OMNIBOOK_PRODUCT_VERSION]);
2963 + b += sprintf(b, "Serial Number: %s\n", omnibook_dmi_ident[OMNIBOOK_SERIAL_NUMBER]);
2964 + b += sprintf(b, "Board Vendor: %s\n", omnibook_dmi_ident[OMNIBOOK_BOARD_VENDOR]);
2965 + b += sprintf(b, "Board Name: %s\n", omnibook_dmi_ident[OMNIBOOK_BOARD_NAME]);
2966 + b += sprintf(b, "Board Version: %s\n", omnibook_dmi_ident[OMNIBOOK_BOARD_VERSION]);
2968 + return omnibook_proc_len(buffer, start, off, count, eof, b);
2971 +#define HP_SIGNATURE "Hewlett-Packard"
2973 +struct omnibook_models_t {
2974 + /* DMI field matchers (table inputs) */
2976 + char *product_name;
2977 + char *product_version;
2980 + /* Table outputs */
2981 + char *syslog_name; /* Name which will appear in the syslog */
2982 + int ectype; /* Type of the embedded controller firmware, see omnibook.h and README */
2985 +static struct omnibook_models_t omnibook_models[] __initdata = {
2986 + /* sys_vendor product_name product_version board_name syslog_name ectype */
2987 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GF*", NULL, NULL, XE3GF },
2988 + { NULL, "HP OmniBook PC*", "HP OmniBook XT1000*", NULL, NULL, XE3GF },
2989 + { NULL, "HP OmniBook PC*", "HP OmniBook XE2 DC*", NULL, NULL, XE2 },
2990 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GC*", NULL, NULL, XE3GC },
2991 + /* HP Pavilion N5430 */
2992 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GD*", NULL, NULL, XE3GC },
2993 + /* HP Pavilion N5415 */
2994 + { NULL, "HP OmniBook PC*", "HP OmniBook XE3 GE*", NULL, NULL, XE3GC },
2995 + { NULL, "HP OmniBook PC*", "HP OmniBook 500 FA*", NULL, NULL, OB500 },
2996 + { NULL, "HP OmniBook PC*", "HP OmniBook 510 FB*", NULL, NULL, OB510 },
2997 + { NULL, "HP OmniBook PC*", "HP OmniBook 4150*", NULL, NULL, OB4150 },
2998 + { NULL, "HP OmniBook PC*", "HP OmniBook 900 B*", NULL, NULL, OB4150 },
2999 + { NULL, "HP OmniBook PC*", "HP OmniBook 6000 EA*", NULL, NULL, OB6000 },
3000 + { NULL, "HP OmniBook PC*", "HP OmniBook 6100 EB*", NULL, NULL, OB6100 },
3001 + /* HP OmniBook xe4100 */
3002 + { NULL, "HP OmniBook PC*", "HP OmniBook xe4000*", NULL, NULL, XE4500 },
3003 + { NULL, "HP OmniBook PC*", "HP OmniBook xe4400*", NULL, NULL, XE4500 },
3004 + { NULL, "HP OmniBook PC*", "HP OmniBook xe4500*", NULL, NULL, XE4500 },
3005 + /* HP OmniBook vt6200 and xt6200 */
3006 + { NULL, "HP OmniBook PC*", "HP OmniBook 6200 EG*", NULL, NULL, XE4500 },
3007 + /* HP Pavilion ze4125 */
3008 + { NULL, "HP NoteBook PC*", "HP NoteBook ze4000*", NULL, NULL, XE4500 },
3009 + /* There are no model specific strings of some HP Pavilion xt155 and some HP Pavilion ze4100 */
3010 + { NULL, "HP NoteBook PC*", "HP NoteBook PC*", NULL, NULL, XE4500 },
3011 + /* HP Pavilion ZU1155 and ZU1175 */
3012 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion ZU1000 FA*", NULL, NULL, OB500 },
3013 + /* HP Pavilion N5290 */
3014 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook XE3 GC*", NULL, NULL, XE3GC },
3015 + /* HP Pavilion N5441 */
3016 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook Model GD*", NULL, NULL, XE3GC },
3017 + /* HP Pavilion XH545 */
3018 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook Model GE*", NULL, NULL, XE3GC },
3019 + /* HP Pavilion ZT1141 */
3020 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook ZT1000*", NULL, NULL, XE3GF },
3021 + /* There are no model specific strings of some HP Pavilion ZT1175 and ZT1195 notebooks */
3022 + { NULL, "HP Pavilion Notebook PC*", "HP Pavilion Notebook*", NULL, NULL, XE3GF },
3023 + { NULL, "Pavilion ze4200*", NULL, NULL, "HP Pavilion ze4200 series", XE4500 },
3024 + /* Compaq nx9000 */
3025 + { NULL, "HP nx9000*", NULL, NULL, "HP/Compaq nx9000", XE4500 },
3026 + /* Compaq nx9005 */
3027 + { NULL, "HP nx9005*", NULL, NULL, "HP/Compaq nx9005", XE4500 },
3028 + /* Compaq nx9010 */
3029 + { NULL, "HP nx9010*", NULL, NULL, "HP/Compaq nx9010", XE4500 },
3030 + { "TOSHIBA", "S1000*", NULL, NULL, "Toshiba Satellite 1000", XE3GF },
3031 + { "TOSHIBA", "S1005*", NULL, NULL, "Toshiba Satellite 1005", XE3GF },
3032 + { "TOSHIBA", "S1110*", NULL, NULL, "Toshiba Satellite 1110", XE3GF },
3033 + { "TOSHIBA", "S1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF },
3034 + { "TOSHIBA", "S1900*", NULL, NULL, "Toshiba Satellite 1900", XE3GF },
3035 + { "TOSHIBA", "S1905*", NULL, NULL, "Toshiba Satellite 1905", XE3GF },
3036 + { "TOSHIBA", "S1950*", NULL, NULL, "Toshiba Satellite 1950", XE3GF },
3037 + { "TOSHIBA", "S2430*", NULL, NULL, "Toshiba Satellite 2430", XE3GF },
3038 + { "TOSHIBA", "S3000*", NULL, NULL, "Toshiba Satellite 3000", XE3GF },
3039 + { "TOSHIBA", "S3005*", NULL, NULL, "Toshiba Satellite 3005", XE3GF },
3040 + { "TOSHIBA", "Satellite 1000*", NULL, NULL, "Toshiba Satellite 1000", XE3GF },
3041 + { "TOSHIBA", "Satellite 1005*", NULL, NULL, "Toshiba Satellite 1005", XE3GF },
3042 + { "TOSHIBA", "Satellite 1110*", NULL, NULL, "Toshiba Satellite 1110", XE3GF },
3043 + { "TOSHIBA", "Satellite 1115*", NULL, NULL, "Toshiba Satellite 1115", XE3GF },
3044 + { "TOSHIBA", "Satellite 1900*", NULL, NULL, "Toshiba Satellite 1900", XE3GF },
3045 + { "TOSHIBA", "Satellite 1905*", NULL, NULL, "Toshiba Satellite 1905", XE3GF },
3046 + { "TOSHIBA", "Satellite 1950*", NULL, NULL, "Toshiba Satellite 1950", XE3GF },
3047 + { "TOSHIBA", "Satellite 2430*", NULL, NULL, "Toshiba Satellite 2430", XE3GF },
3048 + { "TOSHIBA", "Satellite 3000*", NULL, NULL, "Toshiba Satellite 3000", XE3GF },
3049 + { "TOSHIBA", "Satellite 3005*", NULL, NULL, "Toshiba Satellite 3005", XE3GF },
3050 + { "COMPAL", NULL, NULL, "ACL00", "Compal ACL00", XE3GF },
3051 + { "Acer", "Aspire 1400 series*", NULL, NULL, "Acer Aspire 1400 series", XE3GF },
3052 + /* This sentinel at the end catches all unsupported models */
3053 + { NULL, NULL, NULL, NULL, NONE }
3056 +struct omnibook_tc_t {
3061 +/* HP technology codes */
3062 +static struct omnibook_tc_t omnibook_tc[] __initdata = {
3063 + /* technology code ectype */
3064 + { "CI.", OB4150 },
3065 + { "CL.", OB4150 },
3067 + { "EA.", OB6000 },
3068 + { "EB.", OB6100 },
3069 + { "EG.", XE4500 },
3079 + { "KA.", XE4500 },
3080 + { "KB.", XE4500 },
3081 + { "KC.", XE4500 },
3082 + { "KD.", XE4500 },
3083 + { "KE.", XE4500 },
3088 + * Compare the saved DMI info at "index" with a string.
3089 + * A '*' at the end of the string will match anything.
3090 + * Returns 0 for a match.
3092 + * This preserves the semantics of the old omnibook_features[]
3093 + * table. I don't know if its generally useful or not.
3095 +static int __init cmp_with_glob(int index, char *str)
3102 + glob = strchr(str, '*');
3103 + len = glob ? glob - str : strlen(str);
3104 + retval = strncmp(omnibook_dmi_ident[index], str, len);
3110 +static int __init omnibook_ident(void)
3112 + struct omnibook_models_t *mp;
3114 + for (mp = omnibook_models; mp->ectype != NONE; ++mp) {
3115 + /* Check all fields for a match */
3116 + if (cmp_with_glob(OMNIBOOK_SYS_VENDOR, mp->sys_vendor))
3118 + if (cmp_with_glob(OMNIBOOK_PRODUCT_NAME, mp->product_name))
3120 + if (cmp_with_glob(OMNIBOOK_PRODUCT_VERSION, mp->product_version))
3122 + if (cmp_with_glob(OMNIBOOK_BOARD_NAME, mp->board_name))
3125 + /* All required fields matched */
3129 + return (mp - omnibook_models);
3132 +static int __init omnibook_get_tc(void)
3134 + struct omnibook_tc_t *tc;
3136 + for (tc = omnibook_tc; tc->ectype != NONE; ++tc) {
3138 + * Technology code appears in the first two chracters of BIOS version string
3139 + * ended by a dot, but it prefixed a space character on some models and BIOS
3141 + * The new HP/Compaq models use different codes, this is not supported yet.
3143 + if (strstr(omnibook_dmi_ident[OMNIBOOK_BIOS_VERSION], tc->tc))
3147 + return (tc - omnibook_tc);
3150 +static int __init omnibook_init(void)
3155 + char *syslog_name;
3159 + omnibook_userset = user;
3162 + printk(KERN_INFO "%s: module version %s.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_VERSION);
3164 + printk(KERN_INFO "%s: driver version %s.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_VERSION);
3167 + /* saving DMI information */
3168 + if (omnibook_dmi_scan_machine() != 0)
3171 + if (ectype != NONE)
3172 + printk(KERN_WARNING "%s: Forced load with EC firmware type %d.\n", OMNIBOOK_MODULE_NAME, ectype);
3174 + model = omnibook_ident();
3175 + if (omnibook_models[model].ectype != NONE) {
3176 + ectype = omnibook_models[model].ectype;
3177 + syslog_name = omnibook_models[model].syslog_name;
3178 + if (!syslog_name) {
3179 + syslog_name = omnibook_models[model].product_version;
3180 + glob = strchr(syslog_name, '*');
3184 + printk(KERN_INFO "%s: %s detected.\n", OMNIBOOK_MODULE_NAME, syslog_name);
3186 + /* Without explicite informations try chechking for technology code of HP laptops */
3187 + tc = omnibook_get_tc();
3188 + if ((strncmp(omnibook_dmi_ident[OMNIBOOK_SYS_VENDOR], HP_SIGNATURE, strlen(HP_SIGNATURE)) == 0) &&
3189 + (omnibook_tc[tc].ectype != NONE)) {
3190 + ectype = omnibook_tc[tc].ectype;
3191 + printk(KERN_INFO "%s: HP tecnology code %s detected.\n", OMNIBOOK_MODULE_NAME, omnibook_tc[tc].tc);
3193 + printk(KERN_INFO "%s: Unknown model detected.\n", OMNIBOOK_MODULE_NAME);
3206 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3212 + omnibook_ectype = ectype;
3214 + omnibook_proc_root = proc_mkdir(OMNIBOOK_MODULE_NAME, NULL);
3215 + if (! omnibook_proc_root) {
3216 + printk(KERN_ERR "%s: Unable to create /proc/%s.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3220 + pmode = S_IFREG | S_IRUGO;
3221 + proc_version = create_proc_read_entry("version", pmode, omnibook_proc_root, omnibook_proc_version, NULL);
3222 + if (! proc_version) {
3223 + printk(KERN_ERR "%s: Unable to create /proc/%s/version.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3228 + pmode = S_IFREG | S_IRUGO;
3229 + proc_dmi = create_proc_read_entry("dmi", pmode, omnibook_proc_root, omnibook_proc_dmi, NULL);
3231 + printk(KERN_ERR "%s: Unable to create /proc/%s/dmi.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3236 + if ((retval = (ac ? omnibook_ac_init() : 0)))
3240 + if ((retval = (battery ? omnibook_battery_init() : 0)))
3244 + /* /proc/apm emulation needs to read battery and AC adapter status */
3245 + if ((ac == 0) && (battery == 0) && apmemu) {
3246 + if ((retval = omnibook_apmemu_init()))
3250 + if ((retval = (blank ? omnibook_console_blank_init() : 0)))
3253 + if ((retval = (display ? omnibook_display_init() : 0)))
3256 + if ((retval = (dock ? omnibook_dock_init() : 0)))
3259 + if ((retval = (fan ? omnibook_fan_init() : 0)))
3262 + if ((retval = (fan_policy ? omnibook_fan_policy_init() : 0)))
3265 + if ((retval = (lcd ? omnibook_brightness_init() : 0)))
3268 + if ((retval = (onetouch ? omnibook_onetouch_init() : 0)))
3271 + if ((retval = (temperature ? omnibook_temperature_init() : 0)))
3274 + if ((retval = (touchpad ? omnibook_touchpad_init() : 0)))
3277 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3278 + if ((retval = (key_polling ? omnibook_key_polling_init() : 0)))
3281 + printk(KERN_WARNING "%s: module unloading does not work yet on 2.6 kernel.\n", OMNIBOOK_MODULE_NAME);
3287 +static void __exit omnibook_cleanup(void)
3289 + omnibook_ac_cleanup();
3290 + omnibook_apmemu_cleanup();
3291 + omnibook_battery_cleanup();
3292 + omnibook_brightness_cleanup();
3293 + omnibook_console_blank_cleanup();
3294 + omnibook_display_cleanup();
3295 + omnibook_dock_cleanup();
3296 + omnibook_fan_cleanup();
3297 + omnibook_fan_policy_cleanup();
3298 + omnibook_onetouch_cleanup();
3299 + omnibook_temperature_cleanup();
3300 + omnibook_touchpad_cleanup();
3301 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3302 + omnibook_key_polling_cleanup();
3305 + remove_proc_entry("version", omnibook_proc_root);
3307 + remove_proc_entry("dmi", omnibook_proc_root);
3308 + if (omnibook_proc_root)
3309 + remove_proc_entry("omnibook", NULL);
3310 + printk(KERN_INFO "%s: module is unloaded.\n", OMNIBOOK_MODULE_NAME);
3313 +module_init(omnibook_init);
3314 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3315 +module_exit(omnibook_cleanup);
3318 +EXPORT_SYMBOL(omnibook_ectype);
3319 +EXPORT_SYMBOL(omnibook_proc_root);
3321 +MODULE_AUTHOR("Soós Péter <sp@osb.hu>");
3322 +MODULE_DESCRIPTION("Kernel interface for HP OmniBook, HP Pavilion, Toshiba Satellite, Acer Aspire and Compal ACL00 laptops");
3323 +MODULE_LICENSE("GPL");
3324 +MODULE_PARM(ectype, "i");
3325 +MODULE_PARM(ac, "i");
3326 +MODULE_PARM(apmemu, "i");
3327 +MODULE_PARM(battery, "i");
3328 +MODULE_PARM(blank, "i");
3329 +MODULE_PARM(display, "i");
3330 +MODULE_PARM(dock, "i");
3331 +MODULE_PARM(dmi, "i");
3332 +MODULE_PARM(fan, "i");
3333 +MODULE_PARM(fan_policy, "i");
3334 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3335 +MODULE_PARM(key_polling, "i");
3337 +MODULE_PARM(lcd, "i");
3338 +MODULE_PARM(onetouch, "i");
3339 +MODULE_PARM(temperature, "i");
3340 +MODULE_PARM(touchpad, "i");
3341 +MODULE_PARM(user, "i");
3342 +MODULE_PARM_DESC(ectype, "Type of embedded controller firmware");
3343 +MODULE_PARM_DESC(ac, "Use 0 to disable, 1 to enable AC adapter status monitoring");
3344 +MODULE_PARM_DESC(apmemu, "Use 0 to disable, 1 to enable /proc/apm emulation");
3345 +MODULE_PARM_DESC(battery, "Use 0 to disable, 1 to enable battery status monitoring");
3346 +MODULE_PARM_DESC(blank, "Use 0 to disable, 1 to enable lcd console blanking");
3347 +MODULE_PARM_DESC(display, "Use 0 to disable, 1 to enable display status handling");
3348 +MODULE_PARM_DESC(dock, "Use 0 to disable, 1 to enable docking station support");
3349 +MODULE_PARM_DESC(dmi, "Use 0 to disable, 1 to enable /proc/omnibook/dmi");
3350 +MODULE_PARM_DESC(fan, "Use 0 to disable, 1 to enable fan status monitor and control");
3351 +MODULE_PARM_DESC(fan_policy, "Use 0 to disable, 1 to enable fan control policy support");
3352 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3353 +MODULE_PARM_DESC(key_polling, "Use 0 to disable, 1 to enable to scancode emulation for volume keys");
3355 +MODULE_PARM_DESC(lcd, "Use 0 to disable, 1 to enable to LCD brightness support");
3356 +MODULE_PARM_DESC(onetouch, "Use 0 to disable, 1 to enable onetouch handling");
3357 +MODULE_PARM_DESC(temperature, "Use 0 to disable, 1 to enable thermal status and policy support");
3358 +MODULE_PARM_DESC(touchpad, "Use 0 to disable, 1 to enable touchpad handling");
3359 +MODULE_PARM_DESC(user, "Use 0 to disable, 1 to enable users to set parameters");
3362 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
3363 --- linux-2.6.1-gentoo/drivers/char/omnibook/init.h 1970-01-01 01:00:00.000000000 +0100
3364 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/init.h 2004-01-09 22:33:49.000000000 +0000
3367 + * init.h -- initialization and cleanup functions
3369 + * This program is free software; you can redistribute it and/or modify it
3370 + * under the terms of the GNU General Public License as published by the
3371 + * Free Software Foundation; either version 2, or (at your option) any
3374 + * This program is distributed in the hope that it will be useful, but
3375 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3376 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3377 + * General Public License for more details.
3379 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3382 +extern int __init omnibook_ac_init(void);
3383 +extern void __exit omnibook_ac_cleanup(void);
3384 +extern int __init omnibook_apmemu_init(void);
3385 +extern void __exit omnibook_apmemu_cleanup(void);
3386 +extern int __init omnibook_battery_init(void);
3387 +extern void __exit omnibook_battery_cleanup(void);
3388 +extern int __init omnibook_console_blank_init(void);
3389 +extern void __exit omnibook_console_blank_cleanup(void);
3390 +extern int __init omnibook_display_init(void);
3391 +extern void __exit omnibook_display_cleanup(void);
3392 +extern int __init omnibook_dock_init(void);
3393 +extern void __exit omnibook_dock_cleanup(void);
3394 +extern int __init omnibook_fan_init(void);
3395 +extern void __exit omnibook_fan_cleanup(void);
3396 +extern int __init omnibook_fan_policy_init(void);
3397 +extern void __exit omnibook_fan_policy_cleanup(void);
3398 +extern int __init omnibook_onetouch_init(void);
3399 +extern void __exit omnibook_onetouch_cleanup(void);
3400 +extern int __init omnibook_key_polling_init(void);
3401 +extern void __exit omnibook_key_polling_cleanup(void);
3402 +extern int __init omnibook_touchpad_init(void);
3403 +extern void __exit omnibook_touchpad_cleanup(void);
3404 +extern int __init omnibook_temperature_init(void);
3405 +extern void __exit omnibook_temperature_cleanup(void);
3406 +extern int __init omnibook_brightness_init(void);
3407 +extern void __exit omnibook_brightness_cleanup(void);
3410 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
3411 --- linux-2.6.1-gentoo/drivers/char/omnibook/lcd.c 1970-01-01 01:00:00.000000000 +0100
3412 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/lcd.c 2004-01-09 22:33:49.000000000 +0000
3415 + * lcd.c -- LCD brightness and on/off
3417 + * This program is free software; you can redistribute it and/or modify it
3418 + * under the terms of the GNU General Public License as published by the
3419 + * Free Software Foundation; either version 2, or (at your option) any
3422 + * This program is distributed in the hope that it will be useful, but
3423 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3424 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3425 + * General Public License for more details.
3427 + * Written by Maciek Górniak <mago@acn.waw.pl>, 2002
3428 + * Modified by Soós Péter <sp@osb.hu>, 2002-2003
3431 +#include <linux/config.h>
3432 +#include <linux/module.h>
3433 +#include <linux/version.h>
3434 +#include <linux/types.h>
3435 +#include <linux/init.h>
3436 +#include <linux/proc_fs.h>
3438 +#include <asm/system.h>
3439 +#include <asm/errno.h>
3440 +#include <asm/io.h>
3441 +#include <asm/uaccess.h>
3443 +#ifdef OMNIBOOK_STANDALONE
3444 +#include "omnibook.h"
3446 +#include <linux/omnibook.h>
3452 +static struct proc_dir_entry *proc_brightness;
3454 +int omnibook_get_lcd_brightness(void)
3460 + switch (omnibook_ectype) {
3462 + if ((retval = omnibook_ec_read(XE3GF_BRTS, &brgt)))
3464 + retval = brgt &= XE3GF_BRTS_MASK;
3467 + if ((retval = omnibook_ec_read(XE3GC_BTVL, &brgt)))
3469 + retval = brgt &= XE3GC_BTVL_MASK;
3472 + printk(KERN_INFO "%s: LCD brightness handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3480 +int omnibook_set_lcd_brightness(u8 brgt)
3485 + brgt = (brgt > 10) ? 10 : brgt;
3487 + switch (omnibook_ectype) {
3489 + if ((retval = omnibook_ec_write(XE3GF_BRTS, brgt)))
3493 + if ((retval = omnibook_ec_write(XE3GC_BTVL, brgt)))
3497 + printk(KERN_INFO "%s: LCD brightness handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3504 +static int omnibook_proc_brightness_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
3509 + brgt = omnibook_get_lcd_brightness();
3513 + b += sprintf(b, "LCD brightness: %2d\n", brgt);
3515 + return omnibook_proc_len(buffer, start, off, count, eof, b);;
3518 +static int omnibook_proc_brightness_set(struct file *file, const char *buffer, unsigned long count, void *data)
3525 + len = sizeof(value) - 1;
3528 + if (copy_from_user(value, buffer, len))
3532 + if (strcmp(value, "off\n") == 0)
3533 + omnibook_lcd_blank(1);
3534 + else if (strcmp(value, "on\n") == 0)
3535 + omnibook_lcd_blank(0);
3538 + for (i = 0; (value[i] != '\0') && (value[i] != '\n'); i++)
3539 + if ((value[i] >= '0') && (value[i] <= '9'))
3540 + brgt = brgt * 10 + value[i] - '0';
3544 + if ((brgt >= 0) && (brgt <= 10))
3545 + omnibook_set_lcd_brightness(brgt);
3553 +int __init omnibook_brightness_init(void)
3558 + switch (omnibook_ectype) {
3561 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
3562 + if (omnibook_userset)
3563 + pmode = pmode | S_IWUGO;
3564 + proc_brightness = create_proc_entry("lcd", pmode, omnibook_proc_root);
3567 + printk(KERN_INFO "%s: LCD brightness handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3570 + if (! proc_brightness) {
3571 + printk(KERN_ERR "%s: Unable to create /proc/%s/lcd.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3574 + proc_brightness->read_proc = omnibook_proc_brightness_status;
3575 + proc_brightness->write_proc = omnibook_proc_brightness_set;
3577 + printk(KERN_INFO "%s: LCD brightness handling is enabled.\n", OMNIBOOK_MODULE_NAME);
3580 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
3585 +void __exit omnibook_brightness_cleanup(void)
3588 + if (proc_brightness)
3589 + remove_proc_entry("lcd", omnibook_proc_root);
3593 +EXPORT_SYMBOL(omnibook_get_lcd_brightness);
3594 +EXPORT_SYMBOL(omnibook_set_lcd_brightness);
3597 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
3598 --- linux-2.6.1-gentoo/drivers/char/omnibook/omnibook.h 1970-01-01 01:00:00.000000000 +0100
3599 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/omnibook.h 2004-01-09 22:33:49.000000000 +0000
3602 + * omnibook.h -- High level data structures and functions of omnibook
3605 + * This program is free software; you can redistribute it and/or modify it
3606 + * under the terms of the GNU General Public License as published by the
3607 + * Free Software Foundation; either version 2, or (at your option) any
3610 + * This program is distributed in the hope that it will be useful, but
3611 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3612 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3613 + * General Public License for more details.
3615 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3619 + * Module informations
3622 +#define OMNIBOOK_MODULE_NAME "omnibook"
3623 +#define OMNIBOOK_MODULE_VERSION "2003-12-08"
3629 +extern int omnibook_ectype;
3632 + XE3GF, /* HP OmniBook XE3 GF, most Toshiba Satellites and more*/
3633 + XE3GC, /* HP OmniBook XE3 GC, GD, GE and compatible */
3634 + OB500, /* HP OmniBook 500 and compatible */
3635 + OB510, /* HP OmniBook 510 */
3636 + OB6000, /* HP OmniBook 6000 */
3637 + OB6100, /* HP OmniBook 6100 */
3638 + XE4500, /* HP OmniBook xe4500 and compatible */
3639 + OB4150, /* HP OmniBook 4150 */
3640 + XE2 /* HP OmniBook XE2 */
3643 +extern struct __init proc_dir_entry *omnibook_proc_root;
3644 +extern int omnibook_userset;
3646 +extern int omnibook_get_ac(void);
3648 +struct omnibook_battery_info {
3649 + u8 type; /* 1 - Li-Ion, 2 NiMH */
3650 + u16 sn; /* Serial number */
3651 + u16 dv; /* Design Voltage */
3652 + u16 dc; /* Design Capacity */
3654 +struct omnibook_battery_status {
3655 + u16 pv; /* Present Voltage */
3656 + u16 rc; /* Remaining Capacity */
3657 + u16 lc; /* Last Full Capacity */
3658 + u8 gauge; /* Gauge in % */
3659 + u8 status; /* 0 - unknown, 1 - charged, 2 - discharging, 3 - charging, 4 - critical) */
3662 + OMNIBOOK_BATTSTAT_UNKNOWN,
3663 + OMNIBOOK_BATTSTAT_CHARGED,
3664 + OMNIBOOK_BATTSTAT_DISCHARGING,
3665 + OMNIBOOK_BATTSTAT_CHARGING,
3666 + OMNIBOOK_BATTSTAT_CRITICAL
3669 +extern int omnibook_battery_present(int num);
3670 +extern int omnibook_get_battery_info(int num, struct omnibook_battery_info *battinfo);
3671 +extern int omnibook_get_battery_status(int num, struct omnibook_battery_status *battstat);
3673 +extern int omnibook_console_blank_enabled;
3674 +extern int omnibook_lcd_blank(int blank);
3675 +extern int omnibook_console_blank_enable(void);
3676 +extern int omnibook_console_blank_disable(void);
3678 +extern int omnibook_get_display(void);
3680 +extern int omnibook_get_dock(void);
3682 +extern int omnibook_get_fan(void);
3683 +extern int omnibook_fan_on(void);
3684 +extern int omnibook_fan_off(void);
3687 + * Default temperature limits.
3688 + * Danger! You may overheat your CPU!
3689 + * Do not change these values unless you exactly know what you do.
3692 +#define OMNIBOOK_FAN_LEVELS 7
3693 +#define OMNIBOOK_FAN_MIN 25 /* Minimal value of fan off temperature */
3694 +#define OMNIBOOK_FOT_MAX 75 /* Maximal value of fan off temperature */
3695 +#define OMNIBOOK_FAN_MAX 95 /* Maximal value of fan on temperature */
3696 +#define OMNIBOOK_FOT_DEFAULT 60 /* Default value of fan off temperature */
3697 +#define OMNIBOOK_FAN1_DEFAULT 75 /* Default value of fan on temperature */
3698 +#define OMNIBOOK_FAN2_DEFAULT 85 /* Default value of fan level 2 temperature */
3699 +#define OMNIBOOK_FAN3_DEFAULT 90 /* Default value of fan level 3 temperature */
3700 +#define OMNIBOOK_FAN4_DEFAULT 95 /* Default value of fan level 4 temperature */
3701 +#define OMNIBOOK_FAN5_DEFAULT 95 /* Default value of fan level 5 temperature */
3702 +#define OMNIBOOK_FAN6_DEFAULT 95 /* Default value of fan level 6 temperature */
3703 +#define OMNIBOOK_FAN7_DEFAULT 95 /* Default value of fan level 7 temperature */
3704 +#define OMNIBOOK_FAN_POLICY_STRING 32 /* Maximal length of temperature policy control string */
3706 +extern u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS];
3708 +extern int omnibook_get_fan_policy(void);
3709 +extern int omnibook_set_fan_policy(void);
3710 +extern int omnibook_set_fan_policy_defaults(void);
3712 +extern int omnibook_get_lcd_brightness(void);
3713 +extern int omnibook_set_lcd_brightness(u8 brgt);
3715 +extern int omnibook_onetouch_enabled;
3716 +extern int omnibook_onetouch_enable(void);
3717 +extern int omnibook_onetouch_disable(void);
3719 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
3720 +extern int omnibook_key_polling_enabled;
3721 +extern int omnibook_key_polling_enable(void);
3722 +extern int omnibook_key_polling_disable(void);
3725 +extern int omnibook_get_cpu_temp(void);
3727 +extern int omnibook_touchpad_enabled;
3728 +extern int omnibook_touchpad_enable(void);
3729 +extern int omnibook_touchpad_disable(void);
3732 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
3733 --- linux-2.6.1-gentoo/drivers/char/omnibook/onetouch.c 1970-01-01 01:00:00.000000000 +0100
3734 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/onetouch.c 2004-01-09 22:33:49.000000000 +0000
3737 + * onetouch.c -- code to handling OneTouch buttons
3739 + * This program is free software; you can redistribute it and/or modify it
3740 + * under the terms of the GNU General Public License as published by the
3741 + * Free Software Foundation; either version 2, or (at your option) any
3744 + * This program is distributed in the hope that it will be useful, but
3745 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3746 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3747 + * General Public License for more details.
3749 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3753 +#include <linux/config.h>
3754 +#include <linux/module.h>
3755 +#include <linux/version.h>
3756 +#include <linux/types.h>
3757 +#include <linux/init.h>
3758 +#include <linux/pm.h>
3759 +#include <linux/proc_fs.h>
3761 +#include <asm/system.h>
3762 +#include <asm/errno.h>
3763 +#include <asm/io.h>
3764 +#include <asm/uaccess.h>
3766 +#ifdef OMNIBOOK_STANDALONE
3767 +#include "omnibook.h"
3769 +#include <linux/omnibook.h>
3775 +static struct pm_dev *pm_onetouch;
3776 +static pm_callback pm_onetouch_callback = NULL;
3778 +static struct proc_dir_entry *proc_onetouch;
3780 +/* There is no information about reading OneTouch status */
3781 +int omnibook_onetouch_enabled = 0;
3783 +static int omnibook_onetouch_on(void)
3785 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_ONETOUCH_ENABLE)) {
3786 + printk(KERN_ERR "%s: failed OneTouch enable command.\n", OMNIBOOK_MODULE_NAME);
3792 +static int omnibook_onetouch_off(void)
3794 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_ONETOUCH_DISABLE)) {
3795 + printk(KERN_ERR "%s: failed OneTouch disable command.\n", OMNIBOOK_MODULE_NAME);
3802 + * Power management handler: on resume it reenables the OneTouch buttons it they were enabled previously
3805 +static int pm_onetouch_handler(struct pm_dev *dev, pm_request_t rqst, void *data)
3809 + if (omnibook_onetouch_enabled)
3810 + return omnibook_onetouch_on();
3813 + if (omnibook_onetouch_enabled)
3814 + return omnibook_onetouch_off();
3820 +static int omnibook_onetouch_register(void)
3822 + pm_onetouch_callback = pm_onetouch_handler;
3823 + pm_onetouch = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_onetouch_callback);
3824 + return (pm_onetouch ? 0 : -EFAULT);
3827 +static void omnibook_onetouch_unregister(void)
3829 + pm_onetouch_callback = NULL;
3830 + pm_unregister(pm_onetouch);
3833 +int omnibook_onetouch_enable(void)
3836 + switch (omnibook_ectype) {
3844 + if (! omnibook_onetouch_enabled) {
3845 + if (omnibook_onetouch_on())
3847 + omnibook_onetouch_enabled = 1;
3848 + printk(KERN_INFO "%s: OneTouch buttons are enabled.\n", OMNIBOOK_MODULE_NAME);
3852 + omnibook_onetouch_enabled = 0;
3859 +int omnibook_onetouch_disable(void)
3862 + switch (omnibook_ectype) {
3870 + if (omnibook_onetouch_enabled) {
3871 + if (omnibook_onetouch_off()) {
3874 + omnibook_onetouch_enabled = 0;
3875 + printk(KERN_INFO "%s: OneTouch buttons are disabled.\n", OMNIBOOK_MODULE_NAME);
3879 + omnibook_onetouch_enabled = 0;
3886 +static int omnibook_onetouch_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
3890 + b += sprintf(b, "OneTouch buttons are %s\n", (omnibook_onetouch_enabled) ? "enabled" : "disabled");
3892 + return omnibook_proc_len(buffer, start, off, count, eof, b);
3895 +static int omnibook_onetouch_set(struct file *file, const char *buffer, unsigned long count, void *data)
3897 + char status[1] = {'\0'};
3899 + if (copy_from_user(status, buffer, 1))
3901 + switch (*status) {
3903 + omnibook_onetouch_disable();
3906 + omnibook_onetouch_enable();
3914 +int __init omnibook_onetouch_init(void)
3920 + switch (omnibook_ectype) {
3928 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
3929 + if (omnibook_userset)
3930 + pmode = pmode | S_IWUGO;
3931 + proc_onetouch = create_proc_entry("onetouch", pmode, omnibook_proc_root);
3934 + printk(KERN_INFO "%s: OneTouch button handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
3935 + omnibook_onetouch_enabled = 0;
3938 + if (proc_onetouch) {
3939 + proc_onetouch->read_proc = omnibook_onetouch_status;
3940 + proc_onetouch->write_proc = omnibook_onetouch_set;
3942 + printk(KERN_ERR "%s: Unable to create /proc/%s/onetouch.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
3945 + if ((retval = omnibook_onetouch_register()))
3947 + if ((retval = omnibook_onetouch_enable()))
3952 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
3958 +void __exit omnibook_onetouch_cleanup(void)
3961 + if (proc_onetouch)
3962 + remove_proc_entry("onetouch", omnibook_proc_root);
3964 + omnibook_onetouch_unregister();
3966 + omnibook_onetouch_disable();
3970 +EXPORT_SYMBOL(omnibook_onetouch_enabled);
3971 +EXPORT_SYMBOL(omnibook_onetouch_enable);
3972 +EXPORT_SYMBOL(omnibook_onetouch_disable);
3975 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
3976 --- linux-2.6.1-gentoo/drivers/char/omnibook/polling.c 1970-01-01 01:00:00.000000000 +0100
3977 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/polling.c 2004-01-09 22:33:49.000000000 +0000
3980 + * polling.c -- scancode emulation for volume buttons on certain models
3982 + * This program is free software; you can redistribute it and/or modify it
3983 + * under the terms of the GNU General Public License as published by the
3984 + * Free Software Foundation; either version 2, or (at your option) any
3987 + * This program is distributed in the hope that it will be useful, but
3988 + * WITHOUT ANY WARRANTY; without even the implied warranty of
3989 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3990 + * General Public License for more details.
3992 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
3996 +#include <linux/config.h>
3997 +#include <linux/module.h>
3998 +#include <linux/version.h>
3999 +#include <linux/types.h>
4000 +#include <linux/init.h>
4001 +#include <linux/pm.h>
4002 +#include <linux/proc_fs.h>
4003 +#include <linux/version.h>
4004 +#include <linux/timer.h>
4005 +#include <linux/kbd_ll.h>
4007 +#include <asm/system.h>
4008 +#include <asm/errno.h>
4009 +#include <asm/io.h>
4010 +#include <asm/uaccess.h>
4012 +#ifdef OMNIBOOK_STANDALONE
4013 +#include "omnibook.h"
4015 +#include <linux/omnibook.h>
4022 + * Pollong interval for keys (50 ms)
4025 +#define OMNIBOOK_POLL 50 * HZ / 1000
4029 +static struct pm_dev *pm_key_polling;
4030 +static pm_callback pm_key_polling_callback = NULL;
4032 +static struct proc_dir_entry *proc_key_polling;
4034 +static struct timer_list omnibook_key_timer;
4036 +int omnibook_key_polling_enabled = 0;
4037 +static int pm_omnibook_key_polling_enabled;
4039 +static void omnibook_key_poller(unsigned long data)
4043 + switch (omnibook_ectype) {
4045 + omnibook_ec_read(XE3GC_Q0A, &q0a);
4046 + omnibook_ec_write(XE3GC_Q0A, 0);
4048 +// if (q0a & XE3GC_SLPB_MASK)
4049 +// printk(KERN_INFO "%s: Sleep button pressed.\n", OMNIBOOK_MODULE_NAME);
4050 +// if (q0a & XE3GC_F5_MASK)
4051 +// printk(KERN_INFO "%s: Fn-F5 - LCD/CRT switch pressed.\n", OMNIBOOK_MODULE_NAME);
4053 + * Volume button scancode emulaton
4054 + * It emulates a key press and a release without repeat as other OneTouch buttons do.
4056 + if (q0a & XE3GC_VOLD_MASK) {
4057 + printk(KERN_INFO "%s: Fn-down arrow or Volume down pressed.\n", OMNIBOOK_MODULE_NAME);
4058 + handle_scancode(0xe0, 1);
4059 + handle_scancode(XE3GC_VOLD_SCAN, 1);
4060 + handle_scancode(0xe0, 0);
4061 + handle_scancode(XE3GC_VOLD_SCAN, 0);
4063 + if (q0a & XE3GC_VOLU_MASK) {
4064 + printk(KERN_INFO "%s: Fn-up arrow or Volume up pressed.\n", OMNIBOOK_MODULE_NAME);
4065 + handle_scancode(0xe0, 1);
4066 + handle_scancode(XE3GC_VOLU_SCAN, 1);
4067 + handle_scancode(0xe0, 0);
4068 + handle_scancode(XE3GC_VOLU_SCAN, 0);
4070 + if (q0a & XE3GC_MUTE_MASK) {
4071 + printk(KERN_INFO "%s: Fn+F7 - Volume mute pressed.\n", OMNIBOOK_MODULE_NAME);
4072 + handle_scancode(0xe0, 1);
4073 + handle_scancode(XE3GC_MUTE_SCAN, 1);
4074 + handle_scancode(0xe0, 0);
4075 + handle_scancode(XE3GC_MUTE_SCAN, 0);
4077 +// if (q0a & XE3GC_CNTR_MASK)
4078 +// printk(KERN_INFO "%s: Fn+F3/Fn+F4 - Contrast up or down pressed.\n", OMNIBOOK_MODULE_NAME);
4079 +// if (q0a & XE3GC_BRGT_MASK)
4080 +// printk(KERN_INFO "%s: Fn+F1/Fn+F2 - Brightness up or down pressed.\n", OMNIBOOK_MODULE_NAME);
4084 + mod_timer(&omnibook_key_timer, jiffies + OMNIBOOK_POLL);
4087 +int omnibook_key_polling_enable(void)
4090 + switch (omnibook_ectype) {
4092 + printk(KERN_INFO "%s: Volume buttons do not generate scancodes on this model.\n", OMNIBOOK_MODULE_NAME);
4093 + init_timer(&omnibook_key_timer);
4094 + omnibook_key_timer.data = 0;
4095 + omnibook_key_timer.function = omnibook_key_poller;
4096 + omnibook_key_timer.expires = jiffies + OMNIBOOK_POLL;
4097 + add_timer(&omnibook_key_timer);
4098 + omnibook_key_polling_enabled = 1;
4099 + printk(KERN_INFO "%s: Scancode emulation for volume buttons enabled.\n", OMNIBOOK_MODULE_NAME);
4102 + omnibook_key_polling_enabled = 0;
4109 +int omnibook_key_polling_disable(void)
4112 + switch (omnibook_ectype) {
4114 + if (&omnibook_key_timer) {
4115 + del_timer(&omnibook_key_timer);
4116 + printk(KERN_INFO "%s: Scancode emulation for volume buttons disabled.\n", OMNIBOOK_MODULE_NAME);
4118 + omnibook_key_polling_enabled = 0;
4121 + omnibook_key_polling_enabled = 0;
4129 + * Power management handler: on resume it reenables key polling if it was enabled previously
4132 +static int pm_key_polling_handler(struct pm_dev *dev, pm_request_t rqst, void *data)
4137 + if (pm_omnibook_key_polling_enabled)
4138 + return omnibook_key_polling_enable();
4141 + if (omnibook_key_polling_enabled)
4142 + pm_omnibook_key_polling_enabled = omnibook_key_polling_enabled;
4143 + return omnibook_key_polling_disable();
4149 +static int omnibook_key_polling_register(void)
4151 + pm_key_polling_callback = pm_key_polling_handler;
4152 + pm_key_polling = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_key_polling_callback);
4153 + return (pm_key_polling ? 0 : -EFAULT);
4156 +static void omnibook_key_polling_unregister(void)
4158 + pm_key_polling_callback = NULL;
4159 + pm_unregister(pm_key_polling);
4162 +static int omnibook_key_polling_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
4166 + b += sprintf(b, "Volume buttons handling is %s\n", (omnibook_key_polling_enabled) ? "enabled" : "disabled");
4168 + return omnibook_proc_len(buffer, start, off, count, eof, b);
4171 +static int omnibook_key_polling_set(struct file *file, const char *buffer, unsigned long count, void *data)
4173 + char status[1] = {'\0'};
4175 + if (copy_from_user(status, buffer, 1))
4177 + switch (*status) {
4179 + omnibook_key_polling_disable();
4182 + omnibook_key_polling_enable();
4191 +int __init omnibook_key_polling_init(void)
4198 + switch (omnibook_ectype) {
4200 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
4201 + if (omnibook_userset)
4202 + pmode = pmode | S_IWUGO;
4203 + proc_key_polling = create_proc_entry("key_polling", pmode, omnibook_proc_root);
4206 + printk(KERN_INFO "%s: Key polling is unnecessary on this machine.\n", OMNIBOOK_MODULE_NAME);
4207 + omnibook_key_polling_enabled = 0;
4210 + if (proc_key_polling) {
4211 + proc_key_polling->read_proc = omnibook_key_polling_status;
4212 + proc_key_polling->write_proc = omnibook_key_polling_set;
4214 + printk(KERN_ERR "%s: Unable to create /proc/%s/key_polling.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
4217 + if ((retval = omnibook_key_polling_register()))
4219 +// if ((retval = omnibook_key_polling_enable()))
4222 + printk(KERN_INFO "%s: Key polling is enabled.\n", OMNIBOOK_MODULE_NAME);
4225 + printk(KERN_ERR "%s: Virtual terminal support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
4230 +void __exit omnibook_key_polling_cleanup(void)
4233 + if (proc_key_polling)
4234 + remove_proc_entry("key_polling", omnibook_proc_root);
4235 + if (pm_key_polling)
4236 + omnibook_key_polling_unregister();
4238 + omnibook_key_polling_disable();
4242 +EXPORT_SYMBOL(omnibook_key_polling_enabled);
4243 +EXPORT_SYMBOL(omnibook_key_polling_enable);
4244 +EXPORT_SYMBOL(omnibook_key_polling_disable);
4247 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
4248 --- linux-2.6.1-gentoo/drivers/char/omnibook/temperature.c 1970-01-01 01:00:00.000000000 +0100
4249 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/temperature.c 2004-01-09 22:33:49.000000000 +0000
4252 + * temperature.c -- CPU temprature monitoring
4254 + * This program is free software; you can redistribute it and/or modify it
4255 + * under the terms of the GNU General Public License as published by the
4256 + * Free Software Foundation; either version 2, or (at your option) any
4259 + * This program is distributed in the hope that it will be useful, but
4260 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4261 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4262 + * General Public License for more details.
4264 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
4268 +#include <linux/config.h>
4269 +#include <linux/module.h>
4270 +#include <linux/version.h>
4271 +#include <linux/types.h>
4272 +#include <linux/init.h>
4273 +#include <linux/proc_fs.h>
4275 +#include <asm/system.h>
4276 +#include <asm/errno.h>
4277 +#include <asm/io.h>
4278 +#include <asm/uaccess.h>
4280 +#ifdef OMNIBOOK_STANDALONE
4281 +#include "omnibook.h"
4283 +#include <linux/omnibook.h>
4289 +static struct proc_dir_entry *proc_temperature;
4291 +int omnibook_get_cpu_temp(void)
4296 + switch (omnibook_ectype) {
4298 + if ((retval = omnibook_ec_read(XE3GF_CTMP, &temp)))
4303 + if ((retval = omnibook_ec_read(XE3GC_CTMP, &temp)))
4313 + if ((retval = omnibook_ec_read(OB500_CTMP, &temp)))
4318 + if ((retval = omnibook_ec_read(OB4150_TMP, &temp)))
4323 + printk(KERN_INFO "%s: Temperature monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
4324 + retval = -ENODEV ;
4329 +static int omnibook_proc_temperature(char *buffer, char **start, off_t off, int count, int *eof, void *data)
4334 + cpu_temp = omnibook_get_cpu_temp();
4338 + b += sprintf(b, "CPU temperature: %2d C\n", cpu_temp);
4340 + return omnibook_proc_len(buffer, start, off, count, eof, b);
4343 +int __init omnibook_temperature_init(void)
4347 + switch (omnibook_ectype) {
4357 + pmode = S_IFREG | S_IRUGO;
4358 + proc_temperature = create_proc_read_entry("temperature", pmode, omnibook_proc_root, omnibook_proc_temperature, NULL);
4361 + printk(KERN_INFO "%s: Temperature monitoring is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
4364 + if (! proc_temperature) {
4365 + printk(KERN_ERR "%s: Unable to create /proc/%s/temperature.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
4368 + printk(KERN_INFO "%s: Temperature monitoring is enabled.\n", OMNIBOOK_MODULE_NAME);
4372 +void __exit omnibook_temperature_cleanup(void)
4374 + if (proc_temperature)
4375 + remove_proc_entry("temperature", omnibook_proc_root);
4378 +EXPORT_SYMBOL(omnibook_get_cpu_temp);
4381 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
4382 --- linux-2.6.1-gentoo/drivers/char/omnibook/touchpad.c 1970-01-01 01:00:00.000000000 +0100
4383 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/touchpad.c 2004-01-09 22:33:49.000000000 +0000
4386 + * touchpad.c -- enable/disable touchpad
4388 + * This program is free software; you can redistribute it and/or modify it
4389 + * under the terms of the GNU General Public License as published by the
4390 + * Free Software Foundation; either version 2, or (at your option) any
4393 + * This program is distributed in the hope that it will be useful, but
4394 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4395 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4396 + * General Public License for more details.
4398 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
4402 +#include <linux/config.h>
4403 +#include <linux/module.h>
4404 +#include <linux/version.h>
4405 +#include <linux/types.h>
4406 +#include <linux/init.h>
4407 +#include <linux/pm.h>
4408 +#include <linux/proc_fs.h>
4410 +#include <asm/system.h>
4411 +#include <asm/errno.h>
4412 +#include <asm/io.h>
4413 +#include <asm/uaccess.h>
4415 +#ifdef OMNIBOOK_STANDALONE
4416 +#include "omnibook.h"
4418 +#include <linux/omnibook.h>
4424 +static struct pm_dev *pm_touchpad;
4425 +static pm_callback pm_touchpad_callback = NULL;
4427 +static struct proc_dir_entry *proc_touchpad;
4429 +#ifdef CONFIG_MOUSE_PS2
4430 +#define OMNIBOOK_TOUCHPAD
4433 +#ifdef CONFIG_PSMOUSE
4434 +#define OMNIBOOK_TOUCHPAD
4437 +#ifdef OMNIBOOK_TOUCHPAD
4438 +/* Touchpad is enabled by default */
4439 +int omnibook_touchpad_enabled = 1;
4441 +int omnibook_touchpad_enabled = 0;
4444 +static int omnibook_touchpad_on(void)
4446 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_TOUCHPAD_ENABLE)) {
4447 + printk(KERN_ERR "%s: failed touchpad enable command.\n", OMNIBOOK_MODULE_NAME);
4453 +static int omnibook_touchpad_off(void)
4455 + if (omnibook_kbc_command(OMNIBOOK_KBC_CONTROL_CMD, OMNIBOOK_KBC_CMD_TOUCHPAD_DISABLE)) {
4456 + printk(KERN_ERR "%s: failed touchpad disable command.\n", OMNIBOOK_MODULE_NAME);
4463 + * Power management handler: on resume it redisables the touchpad if it was disabled previously
4466 +static int pm_touchpad_handler(struct pm_dev *dev, pm_request_t rqst, void *data)
4470 + if (! omnibook_touchpad_enabled)
4471 + return omnibook_touchpad_off();
4477 +static int omnibook_touchpad_register(void)
4479 + pm_touchpad_callback = pm_touchpad_handler;
4480 + pm_touchpad = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_touchpad_callback);
4481 + return (pm_touchpad ? 0 : -EFAULT);
4484 +static void omnibook_touchpad_unregister(void)
4486 + pm_touchpad_callback = NULL;
4487 + pm_unregister(pm_touchpad);
4490 +int omnibook_touchpad_enable(void)
4492 +#ifdef OMNIBOOK_TOUCHPAD
4493 + switch (omnibook_ectype) {
4496 + if (! omnibook_touchpad_enabled) {
4497 + if (omnibook_touchpad_on())
4499 + omnibook_touchpad_enabled = 1;
4500 + printk(KERN_INFO "%s: Touchpad is enabled.\n", OMNIBOOK_MODULE_NAME);
4505 + omnibook_touchpad_enabled = 0;
4509 + omnibook_touchpad_enabled = 1;
4516 +int omnibook_touchpad_disable(void)
4518 +#ifdef OMNIBOOK_TOUCHPAD
4519 + switch (omnibook_ectype) {
4522 + if (omnibook_touchpad_enabled) {
4523 + if (omnibook_touchpad_off()) {
4526 + omnibook_touchpad_enabled = 0;
4527 + printk(KERN_INFO "%s: Touchpad is disabled.\n", OMNIBOOK_MODULE_NAME);
4532 + omnibook_touchpad_enabled = 0;
4536 + omnibook_touchpad_enabled = 1;
4543 +static int omnibook_touchpad_status(char *buffer, char **start, off_t off, int count, int *eof, void *data)
4547 + b += sprintf(b, "Touchpad is %s\n", (omnibook_touchpad_enabled) ? "enabled" : "disabled");
4549 + return omnibook_proc_len(buffer, start, off, count, eof, b);
4552 +static int omnibook_touchpad_set(struct file *file, const char *buffer, unsigned long count, void *data)
4554 + char status[1] = {'\0'};
4556 + if (copy_from_user(status, buffer, 1))
4558 + switch (*status) {
4560 + omnibook_touchpad_disable();
4563 + omnibook_touchpad_enable();
4571 +int __init omnibook_touchpad_init(void)
4573 +#ifdef OMNIBOOK_TOUCHPAD
4577 + switch (omnibook_ectype) {
4580 + pmode = S_IFREG | S_IWUSR | S_IRUGO;
4581 + if (omnibook_userset)
4582 + pmode = pmode | S_IWUGO;
4583 + proc_touchpad = create_proc_entry("touchpad", pmode, omnibook_proc_root);
4586 + printk(KERN_INFO "%s: Touchpad handling is unsupported on this machine.\n", OMNIBOOK_MODULE_NAME);
4587 + omnibook_touchpad_enabled = 1;
4590 + if (proc_touchpad) {
4591 + proc_touchpad->read_proc = omnibook_touchpad_status;
4592 + proc_touchpad->write_proc = omnibook_touchpad_set;
4594 + printk(KERN_ERR "%s: Unable to create /proc/%s/touchpad.\n", OMNIBOOK_MODULE_NAME, OMNIBOOK_MODULE_NAME);
4597 + if ((retval = omnibook_touchpad_register()))
4602 + printk(KERN_ERR "%s: PS/2 mouse support is not compiled into your kernel.\n", OMNIBOOK_MODULE_NAME);
4608 +void __exit omnibook_touchpad_cleanup(void)
4610 +#ifdef OMNIBOOK_TOUCHPAD
4611 + if (proc_touchpad)
4612 + remove_proc_entry("touchpad", omnibook_proc_root);
4614 + omnibook_touchpad_unregister();
4615 + omnibook_touchpad_enable();
4619 +EXPORT_SYMBOL(omnibook_touchpad_enabled);
4620 +EXPORT_SYMBOL(omnibook_touchpad_enable);
4621 +EXPORT_SYMBOL(omnibook_touchpad_disable);
4624 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
4625 --- linux-2.6.1-gentoo/drivers/char/omnibook/util.c 1970-01-01 01:00:00.000000000 +0100
4626 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/util.c 2004-01-09 22:33:49.000000000 +0000
4629 + * util.c -- utility functions
4631 + * This program is free software; you can redistribute it and/or modify it
4632 + * under the terms of the GNU General Public License as published by the
4633 + * Free Software Foundation; either version 2, or (at your option) any
4636 + * This program is distributed in the hope that it will be useful, but
4637 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4638 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4639 + * General Public License for more details.
4641 + * Written by Soós Péter <sp@osb.hu>, 2003
4644 +#include <linux/types.h>
4646 +int omnibook_proc_len(char *buffer, char **start, off_t off, int count, int *eof, char *b)
4651 + if (len < off + count)
4653 + *start = buffer + off;
4663 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
4664 --- linux-2.6.1-gentoo/drivers/char/omnibook/util.h 1970-01-01 01:00:00.000000000 +0100
4665 +++ linux-2.6.1-gentoo-test/drivers/char/omnibook/util.h 2004-01-09 22:33:49.000000000 +0000
4668 + * util.h -- Utility declarations
4670 + * This program is free software; you can redistribute it and/or modify it
4671 + * under the terms of the GNU General Public License as published by the
4672 + * Free Software Foundation; either version 2, or (at your option) any
4675 + * This program is distributed in the hope that it will be useful, but
4676 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4677 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4678 + * General Public License for more details.
4680 + * Written by Soós Péter <sp@osb.hu>, 2003
4683 +extern int omnibook_proc_len(char *buffer, char **start, off_t off, int count, int *eof, char *b);
4686 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
4687 --- linux-2.6.1-gentoo/drivers/input/keyboard/atkbd.c 2004-01-09 23:40:12.000000000 +0000
4688 +++ linux-2.6.1-gentoo-test/drivers/input/keyboard/atkbd.c 2004-01-09 23:32:25.000000000 +0000
4690 82, 83, 80, 76, 77, 72, 1, 69, 87, 78, 81, 74, 55, 73, 70, 99,
4692 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4693 - 217,100,255, 0, 97,165, 0, 0,156, 0, 0, 0, 0, 0, 0,125,
4694 + 217,100,255,118, 97,165, 0, 0,156,117, 0, 0, 0, 0, 0,125,
4695 173,114, 0,113, 0, 0, 0,126,128, 0, 0,140, 0, 0, 0,127,
4696 159, 0,115, 0,164, 0, 0,116,158, 0,150,166, 0, 0, 0,142,
4697 157, 0, 0, 0, 0, 0, 0, 0,155, 0, 98, 0, 0,163, 0, 0,
4698 - 226, 0, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0,
4699 + 226,116, 0, 0, 0, 0, 0, 0, 0,255, 96, 0, 0, 0,143, 0,
4700 0, 0, 0, 0, 0, 0, 0, 0, 0,107, 0,105,102, 0, 0,112,
4701 110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119, 0,
4703 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
4704 --- linux-2.6.1-gentoo/include/linux/omnibook.h 1970-01-01 01:00:00.000000000 +0100
4705 +++ linux-2.6.1-gentoo-test/include/linux/omnibook.h 2004-01-09 22:34:17.000000000 +0000
4708 + * omnibook.h -- High level data structures and functions of omnibook
4711 + * This program is free software; you can redistribute it and/or modify it
4712 + * under the terms of the GNU General Public License as published by the
4713 + * Free Software Foundation; either version 2, or (at your option) any
4716 + * This program is distributed in the hope that it will be useful, but
4717 + * WITHOUT ANY WARRANTY; without even the implied warranty of
4718 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4719 + * General Public License for more details.
4721 + * Written by Soós Péter <sp@osb.hu>, 2002-2003
4725 + * Module informations
4728 +#define OMNIBOOK_MODULE_NAME "omnibook"
4729 +#define OMNIBOOK_MODULE_VERSION "2003-12-08"
4735 +extern int omnibook_ectype;
4738 + XE3GF, /* HP OmniBook XE3 GF, most Toshiba Satellites and more*/
4739 + XE3GC, /* HP OmniBook XE3 GC, GD, GE and compatible */
4740 + OB500, /* HP OmniBook 500 and compatible */
4741 + OB510, /* HP OmniBook 510 */
4742 + OB6000, /* HP OmniBook 6000 */
4743 + OB6100, /* HP OmniBook 6100 */
4744 + XE4500, /* HP OmniBook xe4500 and compatible */
4745 + OB4150, /* HP OmniBook 4150 */
4746 + XE2 /* HP OmniBook XE2 */
4749 +extern struct __init proc_dir_entry *omnibook_proc_root;
4750 +extern int omnibook_userset;
4752 +extern int omnibook_get_ac(void);
4754 +struct omnibook_battery_info {
4755 + u8 type; /* 1 - Li-Ion, 2 NiMH */
4756 + u16 sn; /* Serial number */
4757 + u16 dv; /* Design Voltage */
4758 + u16 dc; /* Design Capacity */
4760 +struct omnibook_battery_status {
4761 + u16 pv; /* Present Voltage */
4762 + u16 rc; /* Remaining Capacity */
4763 + u16 lc; /* Last Full Capacity */
4764 + u8 gauge; /* Gauge in % */
4765 + u8 status; /* 0 - unknown, 1 - charged, 2 - discharging, 3 - charging, 4 - critical) */
4768 + OMNIBOOK_BATTSTAT_UNKNOWN,
4769 + OMNIBOOK_BATTSTAT_CHARGED,
4770 + OMNIBOOK_BATTSTAT_DISCHARGING,
4771 + OMNIBOOK_BATTSTAT_CHARGING,
4772 + OMNIBOOK_BATTSTAT_CRITICAL
4775 +extern int omnibook_battery_present(int num);
4776 +extern int omnibook_get_battery_info(int num, struct omnibook_battery_info *battinfo);
4777 +extern int omnibook_get_battery_status(int num, struct omnibook_battery_status *battstat);
4779 +extern int omnibook_console_blank_enabled;
4780 +extern int omnibook_lcd_blank(int blank);
4781 +extern int omnibook_console_blank_enable(void);
4782 +extern int omnibook_console_blank_disable(void);
4784 +extern int omnibook_get_display(void);
4786 +extern int omnibook_get_dock(void);
4788 +extern int omnibook_get_fan(void);
4789 +extern int omnibook_fan_on(void);
4790 +extern int omnibook_fan_off(void);
4793 + * Default temperature limits.
4794 + * Danger! You may overheat your CPU!
4795 + * Do not change these values unless you exactly know what you do.
4798 +#define OMNIBOOK_FAN_LEVELS 7
4799 +#define OMNIBOOK_FAN_MIN 25 /* Minimal value of fan off temperature */
4800 +#define OMNIBOOK_FOT_MAX 75 /* Maximal value of fan off temperature */
4801 +#define OMNIBOOK_FAN_MAX 95 /* Maximal value of fan on temperature */
4802 +#define OMNIBOOK_FOT_DEFAULT 60 /* Default value of fan off temperature */
4803 +#define OMNIBOOK_FAN1_DEFAULT 75 /* Default value of fan on temperature */
4804 +#define OMNIBOOK_FAN2_DEFAULT 85 /* Default value of fan level 2 temperature */
4805 +#define OMNIBOOK_FAN3_DEFAULT 90 /* Default value of fan level 3 temperature */
4806 +#define OMNIBOOK_FAN4_DEFAULT 95 /* Default value of fan level 4 temperature */
4807 +#define OMNIBOOK_FAN5_DEFAULT 95 /* Default value of fan level 5 temperature */
4808 +#define OMNIBOOK_FAN6_DEFAULT 95 /* Default value of fan level 6 temperature */
4809 +#define OMNIBOOK_FAN7_DEFAULT 95 /* Default value of fan level 7 temperature */
4810 +#define OMNIBOOK_FAN_POLICY_STRING 32 /* Maximal length of temperature policy control string */
4812 +extern u8 omnibook_fan_policy[OMNIBOOK_FAN_LEVELS];
4814 +extern int omnibook_get_fan_policy(void);
4815 +extern int omnibook_set_fan_policy(void);
4816 +extern int omnibook_set_fan_policy_defaults(void);
4818 +extern int omnibook_get_lcd_brightness(void);
4819 +extern int omnibook_set_lcd_brightness(u8 brgt);
4821 +extern int omnibook_onetouch_enabled;
4822 +extern int omnibook_onetouch_enable(void);
4823 +extern int omnibook_onetouch_disable(void);
4825 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
4826 +extern int omnibook_key_polling_enabled;
4827 +extern int omnibook_key_polling_enable(void);
4828 +extern int omnibook_key_polling_disable(void);
4831 +extern int omnibook_get_cpu_temp(void);
4833 +extern int omnibook_touchpad_enabled;
4834 +extern int omnibook_touchpad_enable(void);
4835 +extern int omnibook_touchpad_disable(void);