* [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support
@ 2012-06-04 11:56 Maxim Mikityanskiy
2012-06-26 18:31 ` Matthew Garrett
0 siblings, 1 reply; 18+ messages in thread
From: Maxim Mikityanskiy @ 2012-06-04 11:56 UTC (permalink / raw)
To: platform-driver-x86; +Cc: ike.pan
The patch adds support for Lenovo IdeaPad Z570 laptop. It makes all special
keys working, adds possibility to control fan like Windows does and controls
Touchpad Disabled LED.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
--- linux/drivers/platform/x86/ideapad-laptop.c
+++ linux/drivers/platform/x86/ideapad-laptop.c
@@ -62,9 +62,12 @@ enum {
VPCCMD_W_CAMERA,
VPCCMD_R_3G,
VPCCMD_W_3G,
- VPCCMD_R_ODD, /* 0x21 */
- VPCCMD_R_RF = 0x23,
- VPCCMD_W_RF,
+ VPCCMD_R_ODD,
+ VPCCMD_W_FAN,
+ VPCCMD_R_RF,
+ VPCCMD_W_RF, /* 0x24 */
+ VPCCMD_R_FAN = 0x2B,
+ VPCCMD_R_SPECIAL_BUTTONS = 0x31,
VPCCMD_W_BL_POWER = 0x33,
};
@@ -363,8 +366,47 @@ static ssize_t store_ideapad_cam(struct
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;
+ /* WARNING: these fan states are not speed
+ * so it isn't cooling_device interface
+ * 0 = super silent mode
+ * 1 = standard mode
+ * 2 = dust cleaning
+ * 4 = efficient thermal dissipation mode
+ */
+ if (state < 0 || state > 4 || state == 3)
+ return -EINVAL;
+ ret = write_ec_cmd(ideapad_handle, VPCCMD_W_FAN, state);
+ if (ret < 0)
+ return ret;
+ 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,6 +421,10 @@ static mode_t ideapad_is_visible(struct
if (attr == &dev_attr_camera_power.attr)
supported = test_bit(CFG_CAMERA_BIT, &(priv->cfg));
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;
@@ -519,9 +565,15 @@ static void ideapad_platform_exit(struct
*/
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_KEY, 66, { KEY_TOUCHPAD_OFF } },
+ { KE_KEY, 67, { KEY_TOUCHPAD_ON } },
{ KE_END, 0 },
};
@@ -767,6 +819,26 @@ static int __devexit ideapad_acpi_remove
return 0;
}
+static void ideapad_check_special_buttons(struct ideapad_private *priv,
+ unsigned long state)
+{
+ unsigned long bit;
+ for (bit = 0; bit < 16; bit++) {
+ if (test_bit(bit, &state)) {
+ switch (bit) {
+ case 6:
+ /* Thermal Management button */
+ ideapad_input_report(priv, 65);
+ break;
+ case 1:
+ /* OneKey Theater button */
+ ideapad_input_report(priv, 64);
+ break;
+ }
+ }
+ }
+}
+
static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
{
struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
@@ -785,6 +857,24 @@ static void ideapad_acpi_notify(struct a
case 9:
ideapad_sync_rfk_state(priv);
break;
+ case 5:
+ {
+ unsigned long value;
+ /* DO NOT DELETE: Without reading from EC
+ * touchpad LED doesn't switch state */
+ if (!read_ec_data(handle, VPCCMD_R_TOUCHPAD,
+ &value)) {
+ /* WARNING: IdeaPad doesn't really turn
+ * off touchpad - it only switches the
+ * LED state. Userspace should turn
+ * touchpad off and on. We send
+ * KEY_TOUCHPAD_OFF and KEY_TOUCHPAD_ON
+ * to not to get out of sync with LED */
+ ideapad_input_report(priv,
+ value ? 67 : 66);
+ }
+ }
+ break;
case 4:
ideapad_backlight_notify_brightness(priv);
break;
@@ -794,6 +884,14 @@ static void ideapad_acpi_notify(struct a
case 2:
ideapad_backlight_notify_power(priv);
break;
+ case 0:
+ {
+ unsigned long value;
+ read_ec_data(handle, VPCCMD_R_SPECIAL_BUTTONS,
+ &value);
+ ideapad_check_special_buttons(priv, value);
+ }
+ break;
default:
ideapad_input_report(priv, vpc_bit);
}
--- linux/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
+++ linux/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
@@ -5,4 +5,14 @@ Contact: "Ike Panhc <ike.pan@canonical.c
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.5
+Contact: "Ike Panhc <ike.pan@canonical.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
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support 2012-06-04 11:56 [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support Maxim Mikityanskiy @ 2012-06-26 18:31 ` Matthew Garrett 2012-06-28 9:55 ` Ike Panhc ` (4 more replies) 0 siblings, 5 replies; 18+ messages in thread From: Matthew Garrett @ 2012-06-26 18:31 UTC (permalink / raw) To: Maxim Mikityanskiy; +Cc: platform-driver-x86, ike.pan Ike, feelings on this? Do we know that these EC offsets are stable? -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support 2012-06-26 18:31 ` Matthew Garrett @ 2012-06-28 9:55 ` Ike Panhc 2012-07-04 10:09 ` Ike Panhc ` (3 subsequent siblings) 4 siblings, 0 replies; 18+ messages in thread From: Ike Panhc @ 2012-06-28 9:55 UTC (permalink / raw) To: Matthew Garrett; +Cc: Maxim Mikityanskiy, platform-driver-x86 On 06/27/2012 02:31 AM, Matthew Garrett wrote: > Ike, feelings on this? Do we know that these EC offsets are stable? > They are stable. Since we have several ideapad patches for this cycle, I will prepare the git branch for you to pull soon. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support 2012-06-26 18:31 ` Matthew Garrett 2012-06-28 9:55 ` Ike Panhc @ 2012-07-04 10:09 ` Ike Panhc 2012-07-04 15:09 ` Maxim Mikityanskiy 2012-07-04 10:17 ` [PATCH 1/3] ideapad: add Lenovo IdeaPad Z570 support (part 1) Ike Panhc ` (2 subsequent siblings) 4 siblings, 1 reply; 18+ messages in thread From: Ike Panhc @ 2012-07-04 10:09 UTC (permalink / raw) To: Matthew Garrett; +Cc: Maxim Mikityanskiy, platform-driver-x86 On 06/27/2012 02:31 AM, Matthew Garrett wrote: > Ike, feelings on this? Do we know that these EC offsets are stable? > Hi Maxim, I separate your patch into three smaller patch. It makes me easier to understand the detail. Please review if all function are still working fine on your ideapad ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support 2012-07-04 10:09 ` Ike Panhc @ 2012-07-04 15:09 ` Maxim Mikityanskiy 2012-07-05 11:09 ` Ike Panhc 2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc 0 siblings, 2 replies; 18+ messages in thread From: Maxim Mikityanskiy @ 2012-07-04 15:09 UTC (permalink / raw) To: Ike Panhc; +Cc: Matthew Garrett, platform-driver-x86 > Hi Maxim, > > I separate your patch into three smaller patch. It makes me easier to understand the detail. Please review if all function are still working fine on your ideapad Hello Ike, I have tested these patches and there is one problem in the part 2 of patch. Build fails, because you missed '+#include <linux/i8042.h>' line of original patch. Errors are at lines: > + i8042_command(¶m, value ? I8042_CMD_AUX_ENABLE : > + I8042_CMD_AUX_DISABLE); When I add '#include <linux/i8042.h>' manually, build succeeds and all functions work properly. Please add missing include to the second patch. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support 2012-07-04 15:09 ` Maxim Mikityanskiy @ 2012-07-05 11:09 ` Ike Panhc 2012-07-05 11:41 ` Maxim Mikityanskiy 2012-07-06 8:07 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Ike Panhc 1 sibling, 1 reply; 18+ messages in thread From: Ike Panhc @ 2012-07-05 11:09 UTC (permalink / raw) To: Maxim Mikityanskiy; +Cc: Matthew Garrett, platform-driver-x86 Thanks. I have the patch tested on my ideapads. They all looks fine. The last thing I need is ACK for psmouse patch. On 07/04/2012 11:09 PM, Maxim Mikityanskiy wrote: >> Hi Maxim, >> >> I separate your patch into three smaller patch. It makes me easier to understand the detail. Please review if all function are still working fine on your ideapad > > Hello Ike, > > I have tested these patches and there is one problem in the part 2 of patch. > Build fails, because you missed '+#include <linux/i8042.h>' line of original > patch. Errors are at lines: > >> + i8042_command(¶m, value ? I8042_CMD_AUX_ENABLE : >> + I8042_CMD_AUX_DISABLE); > > When I add '#include <linux/i8042.h>' manually, build succeeds and all > functions work properly. Please add missing include to the second patch. > > -- > To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support 2012-07-05 11:09 ` Ike Panhc @ 2012-07-05 11:41 ` Maxim Mikityanskiy 0 siblings, 0 replies; 18+ messages in thread From: Maxim Mikityanskiy @ 2012-07-05 11:41 UTC (permalink / raw) To: Ike Panhc; +Cc: Matthew Garrett, platform-driver-x86 > Thanks. I have the patch tested on my ideapads. They all looks fine. > > The last thing I need is ACK for psmouse patch. Psmouse patch is not needed any more, all things work without it because now touchpad is being toggled with i8042_command() without any intrusion into psmouse driver. ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0/4] ideapad: patches for v3.6 merge window 2012-07-04 15:09 ` Maxim Mikityanskiy 2012-07-05 11:09 ` Ike Panhc @ 2012-07-06 8:07 ` Ike Panhc 2012-07-06 8:07 ` [PATCH 1/4] ideapad: uninitialized data in ideapad_acpi_add() Ike Panhc ` (5 more replies) 1 sibling, 6 replies; 18+ 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 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] 18+ messages in thread
* [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; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ 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; 18+ 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] 18+ messages in thread
* Re: [PATCH 0/4] ideapad: patches for v3.6 merge window 2012-07-28 4:08 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Matthew Garrett @ 2012-07-30 1:39 ` Ike Panhc 0 siblings, 0 replies; 18+ messages in thread From: Ike Panhc @ 2012-07-30 1:39 UTC (permalink / raw) To: Matthew Garrett Cc: Dan Carpenter, Maxim Mikityanskiy, Rob Landley, linux-kernel, linux-doc, platform-driver-x86 On 07/28/2012 12:08 PM, Matthew Garrett wrote: > This tree also seems to have ARM stuff in it? > Just a public tree. If I need to publish patches for someone to pull. I will push a new branch onto it ^ permalink raw reply [flat|nested] 18+ 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; 18+ 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] 18+ messages in thread
* [PATCH 1/3] ideapad: add Lenovo IdeaPad Z570 support (part 1) 2012-06-26 18:31 ` Matthew Garrett 2012-06-28 9:55 ` Ike Panhc 2012-07-04 10:09 ` Ike Panhc @ 2012-07-04 10:17 ` Ike Panhc 2012-07-04 10:17 ` [PATCH 2/3] ideapad: add Lenovo IdeaPad Z570 support (part 2) Ike Panhc 2012-07-04 10:17 ` [PATCH 3/3] ideapad: add Lenovo IdeaPad Z570 support (part 3) Ike Panhc 4 siblings, 0 replies; 18+ messages in thread From: Ike Panhc @ 2012-07-04 10:17 UTC (permalink / raw) To: platform-driver-x86, maxtram95; +Cc: mjg59 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] 18+ messages in thread
* [PATCH 2/3] ideapad: add Lenovo IdeaPad Z570 support (part 2) 2012-06-26 18:31 ` Matthew Garrett ` (2 preceding siblings ...) 2012-07-04 10:17 ` [PATCH 1/3] ideapad: add Lenovo IdeaPad Z570 support (part 1) Ike Panhc @ 2012-07-04 10:17 ` Ike Panhc 2012-07-04 10:17 ` [PATCH 3/3] ideapad: add Lenovo IdeaPad Z570 support (part 3) Ike Panhc 4 siblings, 0 replies; 18+ messages in thread From: Ike Panhc @ 2012-07-04 10:17 UTC (permalink / raw) To: platform-driver-x86, maxtram95; +Cc: mjg59 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/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 36c76d0..c482785 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -526,6 +526,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 +720,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 +773,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 +837,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 +859,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 +873,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] 18+ messages in thread
* [PATCH 3/3] ideapad: add Lenovo IdeaPad Z570 support (part 3) 2012-06-26 18:31 ` Matthew Garrett ` (3 preceding siblings ...) 2012-07-04 10:17 ` [PATCH 2/3] ideapad: add Lenovo IdeaPad Z570 support (part 2) Ike Panhc @ 2012-07-04 10:17 ` Ike Panhc 4 siblings, 0 replies; 18+ messages in thread From: Ike Panhc @ 2012-07-04 10:17 UTC (permalink / raw) To: platform-driver-x86, maxtram95; +Cc: mjg59 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 c482785..9f33108 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -63,8 +63,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, }; @@ -357,14 +359,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 }; @@ -378,7 +412,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] 18+ messages in thread
end of thread, other threads:[~2012-08-03 12:01 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-06-04 11:56 [PATCH] drivers/platform/x86: Lenovo IdeaPad Z570 support Maxim Mikityanskiy 2012-06-26 18:31 ` Matthew Garrett 2012-06-28 9:55 ` Ike Panhc 2012-07-04 10:09 ` Ike Panhc 2012-07-04 15:09 ` Maxim Mikityanskiy 2012-07-05 11:09 ` Ike Panhc 2012-07-05 11:41 ` Maxim Mikityanskiy 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 ` [PATCH 3/4] ideapad: add Lenovo IdeaPad Z570 support (part 2) Ike Panhc 2012-07-06 8:08 ` [PATCH 4/4] ideapad: add Lenovo IdeaPad Z570 support (part 3) Ike Panhc 2012-07-28 4:08 ` [PATCH 0/4] ideapad: patches for v3.6 merge window Matthew Garrett 2012-07-30 1:39 ` Ike Panhc 2012-08-03 12:01 ` Максим Микитянский 2012-07-04 10:17 ` [PATCH 1/3] ideapad: add Lenovo IdeaPad Z570 support (part 1) Ike Panhc 2012-07-04 10:17 ` [PATCH 2/3] ideapad: add Lenovo IdeaPad Z570 support (part 2) Ike Panhc 2012-07-04 10:17 ` [PATCH 3/3] ideapad: add Lenovo IdeaPad Z570 support (part 3) Ike Panhc
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.