* [PATCH 1/4] ideapad: uninitialized data in ideapad_acpi_add()
2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc
@ 2012-07-06 8:07 ` Ike Panhc
2012-07-06 8:07 ` [PATCH 2/4] ideapad: add Lenovo IdeaPad Z570 support (part 1) Ike Panhc
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Ike Panhc @ 2012-07-06 8:07 UTC (permalink / raw)
To: Matthew Garrett
Cc: Dan Carpenter, Maxim Mikityanskiy, Rob Landley, linux-kernel,
linux-doc, platform-driver-x86
From: Dan Carpenter <dan.carpenter@oracle.com>
We only initialize the high bits of "cfg". It probably doesn't cause
a problem given that this is platform specific code and doesn't have to
worry about endianness etc. But it's sort of messy.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
drivers/platform/x86/ideapad-laptop.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 4f20f8d..5fdd1aa 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -693,11 +693,10 @@ MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
{
- int ret, i;
- unsigned long cfg;
+ int ret, i, cfg;
struct ideapad_private *priv;
- if (read_method_int(adevice->handle, "_CFG", (int *)&cfg))
+ if (read_method_int(adevice->handle, "_CFG", &cfg))
return -ENODEV;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -721,7 +720,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
goto input_failed;
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
- if (test_bit(ideapad_rfk_data[i].cfgbit, &cfg))
+ if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
ideapad_register_rfkill(adevice, i);
else
priv->rfk[i] = NULL;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/4] ideapad: add Lenovo IdeaPad Z570 support (part 1)
2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc
2012-07-06 8:07 ` [PATCH 1/4] ideapad: uninitialized data in ideapad_acpi_add() Ike Panhc
@ 2012-07-06 8:07 ` Ike Panhc
2012-07-06 8:08 ` [PATCH 3/4] ideapad: add Lenovo IdeaPad Z570 support (part 2) Ike Panhc
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Ike Panhc @ 2012-07-06 8:07 UTC (permalink / raw)
To: Matthew Garrett
Cc: Dan Carpenter, Maxim Mikityanskiy, Rob Landley, linux-kernel,
linux-doc, platform-driver-x86
From: Maxim Mikityanskiy <maxtram95@gmail.com>
The patch adds support for Lenovo IdeaPad Z570 laptop. It makes all special
keys working, adds possibility to control fan like Windows does, controls
Touchpad Disabled LED, toggles touchpad state via keyboard controller and
corrects touchpad behavior on resume from suspend. It is new, modified
version of patch. Now it does not depend on psmouse and does not need patching
of input subsystem.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
This is part 1 for special button handling.
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
drivers/platform/x86/ideapad-laptop.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 5fdd1aa..36c76d0 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -65,6 +65,7 @@ enum {
VPCCMD_R_ODD, /* 0x21 */
VPCCMD_R_RF = 0x23,
VPCCMD_W_RF,
+ VPCCMD_R_SPECIAL_BUTTONS = 0x31,
VPCCMD_W_BL_POWER = 0x33,
};
@@ -518,9 +519,13 @@ static void ideapad_platform_exit(struct ideapad_private *priv)
*/
static const struct key_entry ideapad_keymap[] = {
{ KE_KEY, 6, { KEY_SWITCHVIDEOMODE } },
+ { KE_KEY, 7, { KEY_CAMERA } },
+ { KE_KEY, 11, { KEY_F16 } },
{ KE_KEY, 13, { KEY_WLAN } },
{ KE_KEY, 16, { KEY_PROG1 } },
{ KE_KEY, 17, { KEY_PROG2 } },
+ { KE_KEY, 64, { KEY_PROG3 } },
+ { KE_KEY, 65, { KEY_PROG4 } },
{ KE_END, 0 },
};
@@ -587,6 +592,28 @@ static void ideapad_input_novokey(struct ideapad_private *priv)
ideapad_input_report(priv, 16);
}
+static void ideapad_check_special_buttons(struct ideapad_private *priv)
+{
+ unsigned long bit, value;
+
+ read_ec_data(ideapad_handle, VPCCMD_R_SPECIAL_BUTTONS, &value);
+
+ for (bit = 0; bit < 16; bit++) {
+ if (test_bit(bit, &value)) {
+ switch (bit) {
+ case 6:
+ /* Thermal Management button */
+ ideapad_input_report(priv, 65);
+ break;
+ case 1:
+ /* OneKey Theater button */
+ ideapad_input_report(priv, 64);
+ break;
+ }
+ }
+ }
+}
+
/*
* backlight
*/
@@ -784,6 +811,8 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
ideapad_sync_rfk_state(priv);
break;
case 13:
+ case 11:
+ case 7:
case 6:
ideapad_input_report(priv, vpc_bit);
break;
@@ -796,6 +825,9 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
case 2:
ideapad_backlight_notify_power(priv);
break;
+ case 0:
+ ideapad_check_special_buttons(priv);
+ break;
default:
pr_info("Unknown event: %lu\n", vpc_bit);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/4] ideapad: add Lenovo IdeaPad Z570 support (part 2)
2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc
2012-07-06 8:07 ` [PATCH 1/4] ideapad: uninitialized data in ideapad_acpi_add() Ike Panhc
2012-07-06 8:07 ` [PATCH 2/4] ideapad: add Lenovo IdeaPad Z570 support (part 1) Ike Panhc
@ 2012-07-06 8:08 ` Ike Panhc
2012-07-06 8:08 ` [PATCH 4/4] ideapad: add Lenovo IdeaPad Z570 support (part 3) Ike Panhc
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Ike Panhc @ 2012-07-06 8:08 UTC (permalink / raw)
To: Matthew Garrett
Cc: Dan Carpenter, Maxim Mikityanskiy, Rob Landley, linux-kernel,
linux-doc, platform-driver-x86
From: Maxim Mikityanskiy <maxtram95@gmail.com>
The patch adds support for Lenovo IdeaPad Z570 laptop. It makes all special
keys working, adds possibility to control fan like Windows does, controls
Touchpad Disabled LED, toggles touchpad state via keyboard controller and
corrects touchpad behavior on resume from suspend. It is new, modified
version of patch. Now it does not depend on psmouse and does not need patching
of input subsystem.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
This is part 2 for touchpad toggle
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
drivers/platform/x86/Kconfig | 1 +
drivers/platform/x86/ideapad-laptop.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 2a262f5..355d840 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 36c76d0..b577766 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -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)
@@ -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 },
};
@@ -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(¶m, 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, cfg;
@@ -753,6 +774,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);
@@ -816,6 +838,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;
@@ -835,6 +860,13 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
}
}
+static int ideapad_acpi_resume(struct acpi_device *adevice)
+{
+ ideapad_sync_rfk_state(ideapad_priv);
+ ideapad_sync_touchpad_state(adevice);
+ return 0;
+}
+
static struct acpi_driver ideapad_acpi_driver = {
.name = "ideapad_acpi",
.class = "IdeaPad",
@@ -842,6 +874,7 @@ static struct acpi_driver ideapad_acpi_driver = {
.ops.add = ideapad_acpi_add,
.ops.remove = ideapad_acpi_remove,
.ops.notify = ideapad_acpi_notify,
+ .ops.resume = ideapad_acpi_resume,
.owner = THIS_MODULE,
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/4] ideapad: add Lenovo IdeaPad Z570 support (part 3)
2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc
` (2 preceding siblings ...)
2012-07-06 8:08 ` [PATCH 3/4] ideapad: add Lenovo IdeaPad Z570 support (part 2) Ike Panhc
@ 2012-07-06 8:08 ` Ike Panhc
2012-07-28 4:08 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Matthew Garrett
2012-08-03 12:01 ` Максим Микитянский
5 siblings, 0 replies; 8+ messages in thread
From: Ike Panhc @ 2012-07-06 8:08 UTC (permalink / raw)
To: Matthew Garrett
Cc: Dan Carpenter, Maxim Mikityanskiy, Rob Landley, linux-kernel,
linux-doc, platform-driver-x86
From: Maxim Mikityanskiy <maxtram95@gmail.com>
The patch adds support for Lenovo IdeaPad Z570 laptop. It makes all special
keys working, adds possibility to control fan like Windows does, controls
Touchpad Disabled LED, toggles touchpad state via keyboard controller and
corrects touchpad behavior on resume from suspend. It is new, modified
version of patch. Now it does not depend on psmouse and does not need patching
of input subsystem.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
This is the part 3 for fan control
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
.../ABI/testing/sysfs-platform-ideapad-laptop | 11 +++++
drivers/platform/x86/ideapad-laptop.c | 43 ++++++++++++++++++--
2 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-platform-ideapad-laptop b/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
index 814b013..b31e782 100644
--- a/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
+++ b/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
@@ -5,4 +5,15 @@ Contact: "Ike Panhc <ike.pan@canonical.com>"
Description:
Control the power of camera module. 1 means on, 0 means off.
+What: /sys/devices/platform/ideapad/fan_mode
+Date: June 2012
+KernelVersion: 3.6
+Contact: "Maxim Mikityanskiy <maxtram95@gmail.com>"
+Description:
+ Change fan mode
+ There are four available modes:
+ * 0 -> Super Silent Mode
+ * 1 -> Standard Mode
+ * 2 -> Dust Cleaning
+ * 4 -> Efficient Thermal Dissipation Mode
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index b577766..8231edf 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -64,8 +64,10 @@ enum {
VPCCMD_R_3G,
VPCCMD_W_3G,
VPCCMD_R_ODD, /* 0x21 */
- VPCCMD_R_RF = 0x23,
+ VPCCMD_W_FAN,
+ VPCCMD_R_RF,
VPCCMD_W_RF,
+ VPCCMD_R_FAN = 0x2B,
VPCCMD_R_SPECIAL_BUTTONS = 0x31,
VPCCMD_W_BL_POWER = 0x33,
};
@@ -358,14 +360,46 @@ static ssize_t store_ideapad_cam(struct device *dev,
return -EINVAL;
ret = write_ec_cmd(ideapad_handle, VPCCMD_W_CAMERA, state);
if (ret < 0)
- return ret;
+ return -EIO;
return count;
}
static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
+static ssize_t show_ideapad_fan(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ unsigned long result;
+
+ if (read_ec_data(ideapad_handle, VPCCMD_R_FAN, &result))
+ return sprintf(buf, "-1\n");
+ return sprintf(buf, "%lu\n", result);
+}
+
+static ssize_t store_ideapad_fan(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int ret, state;
+
+ if (!count)
+ return 0;
+ if (sscanf(buf, "%i", &state) != 1)
+ return -EINVAL;
+ if (state < 0 || state > 4 || state == 3)
+ return -EINVAL;
+ ret = write_ec_cmd(ideapad_handle, VPCCMD_W_FAN, state);
+ if (ret < 0)
+ return -EIO;
+ return count;
+}
+
+static DEVICE_ATTR(fan_mode, 0644, show_ideapad_fan, store_ideapad_fan);
+
static struct attribute *ideapad_attributes[] = {
&dev_attr_camera_power.attr,
+ &dev_attr_fan_mode.attr,
NULL
};
@@ -379,7 +413,10 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
if (attr == &dev_attr_camera_power.attr)
supported = test_bit(CFG_CAMERA_BIT, &(priv->cfg));
- else
+ else if (attr == &dev_attr_fan_mode.attr) {
+ unsigned long value;
+ supported = !read_ec_data(ideapad_handle, VPCCMD_R_FAN, &value);
+ } else
supported = true;
return supported ? attr->mode : 0;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 0/4] ideapad: patches for v3.6 merge window
2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc
` (3 preceding siblings ...)
2012-07-06 8:08 ` [PATCH 4/4] ideapad: add Lenovo IdeaPad Z570 support (part 3) Ike Panhc
@ 2012-07-28 4:08 ` Matthew Garrett
2012-07-30 1:39 ` Ike Panhc
2012-08-03 12:01 ` Максим Микитянский
5 siblings, 1 reply; 8+ messages in thread
From: Matthew Garrett @ 2012-07-28 4:08 UTC (permalink / raw)
To: Ike Panhc
Cc: Dan Carpenter, Maxim Mikityanskiy, Rob Landley, linux-kernel,
linux-doc, platform-driver-x86
This tree also seems to have ARM stuff in it?
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 0/4] ideapad: patches for v3.6 merge window
2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc
` (4 preceding siblings ...)
2012-07-28 4:08 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Matthew Garrett
@ 2012-08-03 12:01 ` Максим Микитянский
5 siblings, 0 replies; 8+ messages in thread
From: Максим Микитянский @ 2012-08-03 12:01 UTC (permalink / raw)
To: Ike Panhc
Cc: Matthew Garrett, Dan Carpenter, Rob Landley, linux-kernel,
linux-doc, platform-driver-x86
Will these patches appear in 3.6? RC1 is already available, but it
doesn't contain these patches.
2012/7/6 Ike Panhc <ike.pan@canonical.com>:
>
> One minor fix on part 2 for z570 is to let CONFIG_IDEAPAD depends on
> CONFIG_SERIO_I8042
>
>
> The following changes since commit 71351f14b3b941eb7178567b1272d934609cb785:
>
> Linux 3.5-rc5 (2012-07-05 14:09:43 +0800)
>
> are available in the git repository at:
>
> git://kernel.ubuntu.com/ikepanhc/public.git ideapad-3.6
>
> for you to fetch changes up to 583f18e1378d1b15fa35333be02b79e4f9315f59:
>
> ideapad: add Lenovo IdeaPad Z570 support (part 3) (2012-07-06 15:12:49 +0800)
>
>
> Dan Carpenter (1):
> ideapad: uninitialized data in ideapad_acpi_add()
>
> Maxim Mikityanskiy (3):
> ideapad: add Lenovo IdeaPad Z570 support (part 1)
> ideapad: add Lenovo IdeaPad Z570 support (part 2)
> ideapad: add Lenovo IdeaPad Z570 support (part 3)
>
> .../ABI/testing/sysfs-platform-ideapad-laptop | 11 ++
> drivers/platform/x86/Kconfig | 1 +
> drivers/platform/x86/ideapad-laptop.c | 115 ++++++++++++++++++--
> 3 files changed, 120 insertions(+), 7 deletions(-)
>
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 8+ messages in thread