Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321879
b: refs/heads/master
c: 07a4a4f
h: refs/heads/master
i:
  321877: 583c3d1
  321875: a4cc0b4
  321871: 70a0ce4
v: v3
  • Loading branch information
Maxim Mikityanskiy authored and Matthew Garrett committed Aug 20, 2012
1 parent 30fc7a4 commit 3a39c08
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 296f9fe05d916e3d791dcd166aa41c1dadca4735
refs/heads/master: 07a4a4fc83dd95bc7eb842cf9510ddcb45691a88
1 change: 1 addition & 0 deletions trunk/drivers/platform/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ config IDEAPAD_LAPTOP
tristate "Lenovo IdeaPad Laptop Extras"
depends on ACPI
depends on RFKILL && INPUT
depends on SERIO_I8042
select INPUT_SPARSEKMAP
help
This is a driver for the rfkill switches on Lenovo IdeaPad netbooks.
Expand Down
35 changes: 35 additions & 0 deletions trunk/drivers/platform/x86/ideapad-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/fb.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/i8042.h>

#define IDEAPAD_RFKILL_DEV_NUM (3)

Expand Down Expand Up @@ -526,6 +527,8 @@ static const struct key_entry ideapad_keymap[] = {
{ KE_KEY, 17, { KEY_PROG2 } },
{ KE_KEY, 64, { KEY_PROG3 } },
{ KE_KEY, 65, { KEY_PROG4 } },
{ KE_KEY, 66, { KEY_TOUCHPAD_OFF } },
{ KE_KEY, 67, { KEY_TOUCHPAD_ON } },
{ KE_END, 0 },
};

Expand Down Expand Up @@ -718,6 +721,24 @@ static const struct acpi_device_id ideapad_device_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);

static void ideapad_sync_touchpad_state(struct acpi_device *adevice)
{
struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
unsigned long value;

/* Without reading from EC touchpad LED doesn't switch state */
if (!read_ec_data(adevice->handle, VPCCMD_R_TOUCHPAD, &value)) {
/* Some IdeaPads don't really turn off touchpad - they only
* switch the LED state. We (de)activate KBC AUX port to turn
* touchpad off and on. We send KEY_TOUCHPAD_OFF and
* KEY_TOUCHPAD_ON to not to get out of sync with LED */
unsigned char param;
i8042_command(&param, value ? I8042_CMD_AUX_ENABLE :
I8042_CMD_AUX_DISABLE);
ideapad_input_report(priv, value ? 67 : 66);
}
}

static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
{
int ret, i;
Expand Down Expand Up @@ -754,6 +775,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
priv->rfk[i] = NULL;
}
ideapad_sync_rfk_state(priv);
ideapad_sync_touchpad_state(adevice);

if (!acpi_video_backlight_support()) {
ret = ideapad_backlight_init(priv);
Expand Down Expand Up @@ -817,6 +839,9 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
case 6:
ideapad_input_report(priv, vpc_bit);
break;
case 5:
ideapad_sync_touchpad_state(adevice);
break;
case 4:
ideapad_backlight_notify_brightness(priv);
break;
Expand All @@ -836,13 +861,23 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
}
}

static int ideapad_acpi_resume(struct device *device)
{
ideapad_sync_rfk_state(ideapad_priv);
ideapad_sync_touchpad_state(to_acpi_device(device));
return 0;
}

static SIMPLE_DEV_PM_OPS(ideapad_pm, NULL, ideapad_acpi_resume);

static struct acpi_driver ideapad_acpi_driver = {
.name = "ideapad_acpi",
.class = "IdeaPad",
.ids = ideapad_device_ids,
.ops.add = ideapad_acpi_add,
.ops.remove = ideapad_acpi_remove,
.ops.notify = ideapad_acpi_notify,
.drv.pm = &ideapad_pm,
.owner = THIS_MODULE,
};

Expand Down

0 comments on commit 3a39c08

Please sign in to comment.