From c97fc9a70406d9e919f8a5b1eb4e25005f0bb157 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mathieu=20B=C3=A9rard?= Date: Sat, 19 Jan 2008 20:24:36 +0000 Subject: [PATCH] * Fix typo that was preventing debug statements from working * Fix acpi backend for vista-capable BIOS update on TSM70 --- acpi.c | 41 +++++++++++++++++++++++++++++++++++------ display.c | 10 +++++++++- omnibook.h | 2 +- polling.c | 4 ++-- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/acpi.c b/acpi.c index 2aef0f3..c6a45ff 100644 --- a/acpi.c +++ b/acpi.c @@ -72,7 +72,7 @@ static int omnibook_acpi_bt_remove(struct acpi_device *device, int type); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) -const struct acpi_device_id omnibook_bt_ids[] = { +static const struct acpi_device_id omnibook_bt_ids[] = { {"TOS6205", 0}, {"", 0}, }; @@ -106,6 +106,7 @@ struct acpi_backend_data { acpi_handle ec_handle; /* Handle on ACPI EC device */ acpi_handle bt_handle; /* Handle on ACPI BT device */ unsigned has_antr_antw:1; /* Are there ANTR/ANTW methods in the EC device ? */ + unsigned has_doss_dosw:1; /* Are there DOSS/DOSW methods in the EC device ? */ }; /* @@ -149,17 +150,23 @@ static int omnibook_acpi_init(const struct omnibook_operation *io_op) goto error1; } - if((acpi_get_handle( dev_handle, "ANTR", &method_handle) == AE_OK) && - (acpi_get_handle( dev_handle, "ANTW", &method_handle) == AE_OK)) + if((acpi_get_handle( dev_handle, GET_WIRELESS_METHOD, &method_handle) == AE_OK) && + (acpi_get_handle( dev_handle, SET_WIRELESS_METHOD, &method_handle) == AE_OK)) priv_data->has_antr_antw = 1; + + if((acpi_get_handle( dev_handle, GET_DISPLAY_METHOD, &method_handle) == AE_OK) && + (acpi_get_handle( dev_handle, SET_DISPLAY_METHOD, &method_handle) == AE_OK)) + priv_data->has_doss_dosw = 1; io_op->backend->data = (void *) priv_data; + mutex_unlock(&io_op->backend->mutex); + /* attempt to register Toshiba bluetooth ACPI driver */ acpi_bus_register_driver(&omnibook_bt_driver); dprintk("ACPI backend init OK\n"); - mutex_unlock(&io_op->backend->mutex); + return 0; } else { @@ -182,8 +189,16 @@ static void omnibook_acpi_free(struct kref *ref) struct omnibook_backend *backend; backend = container_of(ref, struct omnibook_backend, kref); dprintk("ACPI backend not used anymore: disposing\n"); + + + dprintk("ptr addr: %p driver name: %s\n",&omnibook_bt_driver, omnibook_bt_driver.name); acpi_bus_unregister_driver(&omnibook_bt_driver); + + mutex_lock(&backend->mutex); kfree(backend->data); + backend->data = NULL; + mutex_unlock(&backend->mutex); + mutex_destroy(&backend->mutex); } static void omnibook_acpi_exit(const struct omnibook_operation *io_op) @@ -263,6 +278,7 @@ static int set_bt_status(const struct acpi_backend_data *priv_data, unsigned int static int omnibook_acpi_bt_add(struct acpi_device *device) { + int retval; struct acpi_backend_data *priv_data = acpi_backend.data; dprintk("Enabling found Toshiba Bluetooth ACPI device.\n"); @@ -270,19 +286,26 @@ static int omnibook_acpi_bt_add(struct acpi_device *device) strcpy(acpi_device_class(device), TOSHIBA_ACPI_BT_CLASS); /* Save handle in backend private data structure. ugly. */ + + mutex_lock(&acpi_backend.mutex); priv_data->bt_handle = device->handle; + retval = set_bt_status(priv_data, 1); + mutex_unlock(&acpi_backend.mutex); - return set_bt_status(priv_data, 1); + return retval; } static int omnibook_acpi_bt_remove(struct acpi_device *device, int type) { int retval; - struct acpi_backend_data *priv_data = acpi_backend.data; + struct acpi_backend_data *priv_data = acpi_backend.data; + mutex_lock(&acpi_backend.mutex); dprintk("Disabling Toshiba Bluetooth ACPI device.\n"); retval = set_bt_status(priv_data, 0); priv_data->bt_handle = NULL; + mutex_unlock(&acpi_backend.mutex); + return retval; } @@ -384,6 +407,9 @@ static int omnibook_acpi_get_display(const struct omnibook_operation *io_op, uns int raw_state = 0; struct acpi_backend_data *priv_data = io_op->backend->data; + if(!priv_data->has_doss_dosw) + return -ENODEV; + retval = omnibook_acpi_execute(priv_data->ec_handle, GET_DISPLAY_METHOD, NULL, &raw_state); if (retval < 0) return retval; @@ -420,6 +446,9 @@ static int omnibook_acpi_set_display(const struct omnibook_operation *io_op, uns int matched = -1; struct acpi_backend_data *priv_data = io_op->backend->data; + if(!priv_data->has_doss_dosw) + return -ENODEV; + for (i = 0; i < ARRAY_SIZE(acpi_display_mode_list); i++) { if (acpi_display_mode_list[i] == state) { matched = i + 1; /* raw state is array row number + 1 */ diff --git a/display.c b/display.c index 9ae94a5..65df18c 100644 --- a/display.c +++ b/display.c @@ -73,10 +73,18 @@ static struct omnibook_feature display_driver; static int __init omnibook_display_init(struct omnibook_operation *io_op) { + int retval; + unsigned int state; + /* Disable file writing if unsuported by backend */ if (!io_op->backend->display_set) display_driver.write = NULL; - return 0; + + retval = backend_display_get(io_op, &state); + if (retval < 0) + return retval; + else + return 0; } static struct omnibook_tbl display_table[] __initdata = { diff --git a/omnibook.h b/omnibook.h index 2191982..49c4c41 100644 --- a/omnibook.h +++ b/omnibook.h @@ -133,7 +133,7 @@ void omnibook_report_key(struct input_dev *dev, unsigned int keycode); #define O_WARN KERN_WARNING OMNIBOOK_MODULE_NAME ": " #define O_ERR KERN_ERR OMNIBOOK_MODULE_NAME ": " -#ifdef OMNIBOOK_DEBUG +#ifdef CONFIG_OMNIBOOK_DEBUG #define dprintk(fmt, args...) printk(KERN_INFO "%s: " fmt, OMNIBOOK_MODULE_NAME, ## args) #define dprintk_simple(fmt, args...) printk(fmt, ## args) #else diff --git a/polling.c b/polling.c index 195e9b0..2d28f7e 100644 --- a/polling.c +++ b/polling.c @@ -60,7 +60,7 @@ static struct input_dev *poll_input_dev; __backend_byte_write(key_polling_driver.io_op, 0); mutex_unlock(&key_polling_driver.io_op->backend->mutex); -#ifdef OMNIBOOK_DEBUG +#ifdef CONFIG_OMNIBOOK_DEBUG if (unlikely(q0a & XE3GC_SLPB_MASK)) dprintk("Sleep button pressed.\n"); if (unlikely(q0a & XE3GC_F5_MASK)) @@ -144,7 +144,7 @@ static int omnibook_key_polling_read(char *buffer, struct omnibook_operation *io len += sprintf(buffer + len, "Volume buttons polling is %s.\n", (key_polling_enabled) ? "enabled" : "disabled"); -#ifdef OMNIBOOK_DEBUG +#ifdef CONFIG_OMNIBOOK_DEBUG if(key_polling_enabled) len += sprintf(buffer + len, "Will poll in %i msec.\n", jiffies_to_msecs(omnibook_poll_work.timer.expires - jiffies)); -- 2.43.5