#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},
};
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 ? */
};
/*
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 {
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)
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");
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;
}
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;
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 */
__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))
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));