From 99b58d0596996d5b5aaa179d952ca76091bb1671 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathieu=20B=C3=A9rard?= Date: Sat, 24 Mar 2007 17:52:20 +0000 Subject: [PATCH] * Fix cooling feature actual state output * Added dmi signature for P25 M60 and another flavor of Tecra S1 * Updated Changelog * Added support for upcoming 2.6.21 blacklight API changes, there is now 3 API versions supported (2.6.16 to 2.6.19 ; 2.6.20 only and 2.6.21 to ...) which of course leads to more #ifdef uglyness ... --- cooling.c | 18 +++++++++++++++--- doc/ChangeLog | 5 +++++ laptop.h | 27 +++++++++++++++++++++++++++ lcd.c | 34 ++++++++++++++++++++++++++++------ misc/dmi_strings.txt | 25 +++++++++++++++++++++++++ omnibook.h | 2 +- 6 files changed, 101 insertions(+), 10 deletions(-) diff --git a/cooling.c b/cooling.c index e2054c6..486aa86 100644 --- a/cooling.c +++ b/cooling.c @@ -35,16 +35,28 @@ static int omnibook_cooling_write(char *buffer, struct omnibook_operation *io_op { int retval = 0; + if(mutex_lock_interruptible(&io_op->backend->mutex)) + return -ERESTARTSYS; + + if (*buffer == '0') { - retval = backend_byte_write(io_op, + retval = __backend_byte_write(io_op, TSM70_COOLING_OFFSET + TSM70_COOLING_POWERSAVE); } else if (*buffer == '1') { - retval = backend_byte_write(io_op, + retval = __backend_byte_write(io_op, TSM70_COOLING_OFFSET + TSM70_COOLING_PERF); } else { - return -EINVAL; + retval = -EINVAL; + goto out; } + /* *buffer is either '0' or '1' here */ + if (!retval) + io_op->backend->cooling_state = *buffer - '0' ; + + mutex_unlock(&io_op->backend->mutex); + + out: return retval; } diff --git a/doc/ChangeLog b/doc/ChangeLog index 89952fc..f901feb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,6 +2,11 @@ Changelog file for omnibook package: ------------------------------------ 2.XXXXXXXX Mathieu Bérard +* DMI signature added: + Toshiba Satellite P25 (ectype 11) + Toshiba Satellite M60 (ectype 12) + +2.20070211 Mathieu Bérard * Disable Acer support, acerhk module should provided better support with a far more complete autodetection database (see http://www2.informatik.hu-berlin.de/~tauber/acerhk/) diff --git a/laptop.h b/laptop.h index cf8a81f..5aba4e1 100644 --- a/laptop.h +++ b/laptop.h @@ -658,6 +658,15 @@ static struct dmi_system_id omnibook_ids[] __initdata = { }, .driver_data = (void*) TSP10 }, + { + .callback = dmi_matched, + .ident = "Toshiba Satellite P25", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P25"), + }, + .driver_data = (void*) TSP10 + }, { .callback = dmi_matched, .ident = "Toshiba Satellite M30X", @@ -676,6 +685,15 @@ static struct dmi_system_id omnibook_ids[] __initdata = { }, .driver_data = (void*) TSM70 }, + { + .callback = dmi_matched, + .ident = "Toshiba Satellite M60", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite M60"), + }, + .driver_data = (void*) TSM70 + }, { .callback = dmi_matched, .ident = "Toshiba Satellite M70", @@ -748,6 +766,15 @@ static struct dmi_system_id omnibook_ids[] __initdata = { }, .driver_data = (void*) TSM40 }, + { + .callback = dmi_matched, + .ident = "Toshiba Tecra S1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Tecra S1"), + }, + .driver_data = (void*) TSM40 + }, { .callback = dmi_matched, .ident = "Toshiba Tecra S2", diff --git a/lcd.c b/lcd.c index 8aade89..020b8d6 100644 --- a/lcd.c +++ b/lcd.c @@ -33,8 +33,12 @@ static struct backlight_device *omnibook_backlight_device; static int omnibook_get_backlight(struct backlight_device *bd); static int omnibook_set_backlight(struct backlight_device *bd); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) +static struct backlight_ops omnibookbl_ops = { +#else /* 2.6.21 */ static struct backlight_properties omnibookbl_data = { .owner = THIS_MODULE, +#endif /* 2.6.21 */ .get_brightness = omnibook_get_backlight, .update_status = omnibook_set_backlight, }; @@ -55,7 +59,11 @@ static int omnibook_get_backlight(struct backlight_device *bd) static int omnibook_set_backlight(struct backlight_device *bd) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + u8 intensity = bd->props.brightness; +#else /* 2.6.21 */ u8 intensity = bd->props->brightness; +#endif /* 2.6.21 */ struct omnibook_operation *io_op; io_op = class_get_devdata(&bd->class_dev); @@ -93,8 +101,12 @@ static int omnibook_brightness_write(char *buffer, struct omnibook_operation *io else { backend_byte_write(io_op, brgt); #ifdef CONFIG_OMNIBOOK_BACKLIGHT +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + omnibook_backlight_device->props.brightness = brgt; +#else /* 2.6.21 */ omnibookbl_data.brightness = brgt; -#endif +#endif +#endif } } return 0; @@ -124,12 +136,14 @@ static int __init omnibook_brightness_init(struct omnibook_operation *io_op) } #ifdef CONFIG_OMNIBOOK_BACKLIGHT - backend_byte_read(io_op, (u8*) &omnibookbl_data.brightness); - omnibookbl_data.max_brightness = omnibook_max_brightness; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + omnibook_backlight_device = + backlight_device_register(OMNIBOOK_MODULE_NAME, NULL, (void *)io_op, &omnibookbl_ops); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) omnibook_backlight_device = backlight_device_register(OMNIBOOK_MODULE_NAME, NULL, (void *)io_op, &omnibookbl_data); -#else +#else /* < 2.6.20 */ omnibook_backlight_device = backlight_device_register(OMNIBOOK_MODULE_NAME, (void *)io_op, &omnibookbl_data); #endif @@ -137,10 +151,18 @@ static int __init omnibook_brightness_init(struct omnibook_operation *io_op) printk(O_ERR "Unable to register as backlight device.\n"); return -ENODEV; } + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) + omnibook_backlight_device->props.max_brightness = omnibook_max_brightness; + backend_byte_read(io_op, (u8*) &omnibook_backlight_device->props.brightness); +#else /* < 2.6.21 */ + omnibookbl_data.max_brightness = omnibook_max_brightness; + backend_byte_read(io_op, (u8*) &omnibookbl_data.brightness); #endif + +#endif /* CONFIG_OMNIBOOK_BACKLIGHT */ return 0; } - static void __exit omnibook_brightness_cleanup(struct omnibook_operation *io_op) { #ifdef CONFIG_OMNIBOOK_BACKLIGHT diff --git a/misc/dmi_strings.txt b/misc/dmi_strings.txt index 1842467..0668eaf 100644 --- a/misc/dmi_strings.txt +++ b/misc/dmi_strings.txt @@ -229,6 +229,19 @@ Board Vendor: TOSHIBA Board Name: DAL00 Board Version: Null +--------------------------------------------- +Toshiba Satellite P25 ----------------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V2.10 +BIOS Release: 12/27/2004 +System Vendor: TOSHIBA +Product Name: Satellite P25 +Version: PSP20U-19PS8R +Serial Number: Y3026615C +Board Vendor: TOSHIBA +Board Name: Null + --------------------------------------------- Toshiba Satellite P100 ---------------------- @@ -279,6 +292,18 @@ Board Vendor: TOSHIBA Board Name: EAL30 Board Version: Null +--------------------------------------------- +Toshiba Satellite M60 ----------------------- + +BIOS Vendor: TOSHIBA +BIOS Version: V1.60 +BIOS Release: 03/16/2006 +System Vendor: TOSHIBA +Product Name: Satellite M60 +Version: PSM60E-0CD01FIT +Board Vendor: TOSHIBA +Board Name: Null + --------------------------------------------- Toshiba Satellite M70 ----------------------- diff --git a/omnibook.h b/omnibook.h index 64e4030..7c8cac2 100644 --- a/omnibook.h +++ b/omnibook.h @@ -151,7 +151,7 @@ void omnibook_report_key(struct input_dev *dev, unsigned int keycode); */ #ifdef OMNIBOOK_STANDALONE -#if (defined (CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE)) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) +#if (defined (CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE)) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16)) #define CONFIG_OMNIBOOK_BACKLIGHT #else #undef CONFIG_OMNIBOOK_BACKLIGHT -- 2.43.5