"\\_SB.PCI0.LPC0.EC0",
};
+/* Toshiba's Hardware Control Interface method */
+static char hci_dev_list[][20] = {
+ "\\_SB.VALD",
+ "\\_SB.VALZ",
+};
+
#define TOSHIBA_ACPI_BT_CLASS "bluetooth"
#define TOSHIBA_ACPI_DEVICE_NAME "bluetooth adapter"
struct acpi_backend_data {
acpi_handle ec_handle; /* Handle on ACPI EC device */
acpi_handle bt_handle; /* Handle on ACPI BT device */
+ acpi_handle hci_handle; /* Handle on ACPI HCI 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 ? */
struct input_dev *acpi_input_dev;
* 1. Fn+Foo pressed
* 2. Scancode 0x6e generated by kbd controller
* 3. Scancode 0x6e caught by omnibook input handler
- * 4. TOHK Got keycode of last actually pressed Fn key
+ * 4. INFO method has keycode of last actually pressed Fn key
* 5. acpi_scan_table used to associate a detected keycode with a generated one
* 6. Generated keycode issued using the omnibook input device
*/
unsigned int scancode;
unsigned int keycode;
} acpi_scan_table[] = {
- { HCI_FN, KEY_RESERVED},
+ { HCI_FN_RELEASED, KEY_FN},
{ HCI_MUTE, KEY_MUTE},
{ HCI_BREAK, KEY_COFFEE},
{ HCI_1, KEY_ZOOMOUT},
{ HCI_BSM, KEY_PROG1},
{ HCI_SUSPEND, KEY_SLEEP},
{ HCI_HIBERNATE, KEY_SUSPEND},
+ { HCI_VIDEOOUT, KEY_SWITCHVIDEOMODE},
{ HCI_BRIGHTNESSDOWN, KEY_BRIGHTNESSDOWN},
{ HCI_BRIGHTNESSUP, KEY_BRIGHTNESSUP},
{ HCI_WLAN, KEY_WLAN},
{ HCI_TOUCHPAD, KEY_PROG2},
+ { HCI_FN_PRESSED, KEY_FN},
{ 0, 0},
};
set_bit(acpi_scan_table[i].keycode, acpi_input_dev->keybit);
retval = input_register_device(acpi_input_dev);
- if(retval) {
+ if (retval) {
input_free_device(acpi_input_dev);
goto out;
}
static int omnibook_acpi_init(const struct omnibook_operation *io_op)
{
int retval = 0;
- acpi_handle dev_handle, method_handle;
+ acpi_handle dev_handle, method_handle, hci_handle;
int i;
struct acpi_backend_data *priv_data;
goto error1;
}
+ /* Probe for HCI device only on TSX205 models */
+ if (omnibook_ectype & TSX205) {
+ if (acpi_get_handle(NULL, hci_dev_list[1], &hci_handle) == AE_OK) {
+ dprintk("Toshiba's HCI device found\n");
+ priv_data->hci_handle = hci_handle;
+ }
+
+ if (!hci_handle) {
+ printk(O_ERR "Couldn't get HCI handle.\n");
+ retval = -ENODEV;
+ goto error1;
+ }
+ }
+
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;
/* Function taken from toshiba_acpi */
static acpi_status hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
{
+ struct acpi_backend_data *priv_data = acpi_backend.data;
struct acpi_object_list params;
union acpi_object in_objs[HCI_WORDS];
struct acpi_buffer results;
results.length = sizeof(out_objs);
results.pointer = out_objs;
- status = acpi_evaluate_object(NULL, (char *)METHOD_HCI, ¶ms,
+ status = acpi_evaluate_object(priv_data->hci_handle, (char *)HCI_METHOD, ¶ms,
&results);
if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) {
for (i = 0; i < out_objs->package.count; ++i) {
{
int retval = 0;
- if(state) {
+ if (state) {
retval = omnibook_acpi_execute(priv_data->bt_handle, TOSH_BT_ACTIVATE_USB, NULL, NULL);
- if(retval)
+ if (retval)
goto out;
retval = omnibook_acpi_execute(priv_data->bt_handle, TOSH_BT_POWER_ON, NULL, NULL);
- if(retval)
+ if (retval)
goto out;
} else {
retval = omnibook_acpi_execute(priv_data->bt_handle, TOSH_BT_DISABLE_USB, NULL, NULL);
- if(retval)
+ if (retval)
goto out;
retval = omnibook_acpi_execute(priv_data->bt_handle, TOSH_BT_POWER_OFF, NULL, NULL);
- if(retval)
+ if (retval)
goto out;
}
out:
static int omnibook_acpi_bt_remove(struct acpi_device *device, int type)
{
- int retval;
+ int retval;
struct acpi_backend_data *priv_data = acpi_backend.data;
mutex_lock(&acpi_backend.mutex);
/*
* Get the Bluetooth + Wireless status using the ANTR method
- * FIXME: what if ANTR and BTST disagree ? we trust ANTR for now
+ * FIXME: what if ANTR and BTST disagree ? we thrust ANTR for now
*/
static int get_wireless_status(const struct acpi_backend_data *priv_data, unsigned int *state)
{
static int omnibook_acpi_get_events(unsigned int *state)
{
- int i;
- struct acpi_buffer results;
- union acpi_object out_objs[1];
- acpi_handle handle;
acpi_status status;
-
- for (i = 0; i < ARRAY_SIZE(ec_dev_list); i++) {
- status = acpi_get_handle(NULL, ec_dev_list[i], &handle);
- if (status == AE_OK)
- break;
+ struct acpi_backend_data *priv_data = acpi_backend.data;
+
+ /* We need to call the NTFY method first so it can activate the TECF variable */
+ status = omnibook_acpi_execute(priv_data->ec_handle, TSX205_NOTIFY_METHOD, NULL, NULL);
+ if (status != AE_OK) {
+ dprintk(O_ERR "Failed to activate NTFY method.\n");
+ return -EIO;
}
- results.length = sizeof(out_objs);
- results.pointer = out_objs;
+ /* Now we can poll the INFO method to get last pressed hotkey */
+ status = omnibook_acpi_execute(priv_data->hci_handle, TSX205_EVENTS_METHOD, NULL, state);
+ if (status != AE_OK) {
+ dprintk(O_ERR "Failed to get Hotkey event.\n");
+ return -EIO;
+ }
- status = acpi_evaluate_object(handle, (char *)TSX205_EVENTS_METHOD, 0, &results);
- *state = out_objs[0].integer.value;
- *state &= ~0x80;
+ /* We only care about a key press, so just report the Fn key Press/Release */
+ if ( ((*state & ~0x80) == 0x100) || ((*state & ~0x80) == 0x17f) )
+ *state &= ~0x80;
return status;
}
if(( retval = __backend_byte_read(io_op, &brgt)))
goto out;
- dprintk("Fn-F6/F7 pressed: adjusting britghtnes.\n");
+ dprintk("Fn-F6/F7 pressed: adjusting brightness.\n");
if (((int) brgt + delta) < 0)
brgt = 0;
}
for (i = 0 ; i < ARRAY_SIZE(acpi_scan_table); i++) {
- if ( gen_scan == acpi_scan_table[i].scancode && gen_scan != KEY_RESERVED) {
+ if (gen_scan == acpi_scan_table[i].scancode) {
dprintk("generating keycode %i.\n", acpi_scan_table[i].keycode);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19))
input_dev = container_of(work, struct acpi_backend_data, fnkey_work)->acpi_input_dev;
* Keyboard controller command for some laptop functions
*/
-#define OMNIBOOK_KBC_CONTROL_CMD 0x59
+#define OMNIBOOK_KBC_CONTROL_CMD 0x59
/*
* Keyboard controller command parameters for functions available via kbc
#define SMI_DOCK_SCAN 0x6e /* Dock scancode */
/* Toshiba HCI method and constants */
-#define METHOD_HCI "\\_SB.VALZ.SPFC"
+#define HCI_METHOD "SPFC"
#define HCI_WORDS 6
#define HCI_GET 0xfe00
#define HCI_NOT_SUPPORTED 0x8000
/* Toshiba Satellite X205 methods */
-#define TSX205_EVENTS_METHOD "TOHK"
+#define TSX205_EVENTS_METHOD "INFO"
+#define TSX205_NOTIFY_METHOD "NTFY"
#define TSX205_KILLSW_METHOD "KLSW"
#define ACPI_FN_MASK 0x01
#define ACPI_FN_SCAN 0x6e /* Fn key scancode */
/* HCI key definitions */
-#define HCI_FN 0x100
+#define HCI_FN_RELEASED 0x100
#define HCI_MUTE 0x101
#define HCI_1 0x102
#define HCI_2 0x103
#define HCI_BSM 0x13c
#define HCI_SUSPEND 0x13d
#define HCI_HIBERNATE 0x13e
+#define HCI_VIDEOOUT 0x13f
#define HCI_BRIGHTNESSDOWN 0x140
#define HCI_BRIGHTNESSUP 0x141
#define HCI_WLAN 0x142
#define HCI_TOUCHPAD 0x143
+#define HCI_FN_PRESSED 0x17f