From: KT Liao <ktalex.liao@gmail.com> To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com Cc: phoenix@emc.com.tw, kt.liao@emc.com.tw Subject: [PATCH] Input: /input/mouse/elan_i2c_core.c Fix some Asus touchapod which casue TP no funciton sometimes, the patch detect some specific touchpad and run a special initialize Date: Fri, 8 Jul 2016 20:12:09 +0800 [thread overview] Message-ID: <1467979929-3409-1-git-send-email-kt.liao@emc.com.tw> (raw) Signed-off-by: KT Liao <kt.liao@emc.com.tw> --- drivers/input/mouse/elan_i2c_core.c | 81 +++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 16 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 2f58985..1c200fb 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -3,8 +3,8 @@ * * Copyright (c) 2013 ELAN Microelectronics Corp. * - * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw> - * Version: 1.6.0 + * Author: KT Liao <kt.liao@emc.com.tw> + * Version: 1.6.2 * * Based on cyapa driver: * copyright (c) 2011-2012 Cypress Semiconductor, Inc. @@ -40,7 +40,7 @@ #include "elan_i2c.h" #define DRIVER_NAME "elan_i2c" -#define ELAN_DRIVER_VERSION "1.6.1" +#define ELAN_DRIVER_VERSION "1.6.2" #define ELAN_VENDOR_ID 0x04f3 #define ETP_MAX_PRESSURE 255 #define ETP_FWIDTH_REDUCE 90 @@ -95,6 +95,8 @@ struct elan_tp_data { bool baseline_ready; }; +static int check_ASUS_special_fw(struct elan_tp_data *data); + static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count, u16 *signature_address) { @@ -210,21 +212,40 @@ static int __elan_initialize(struct elan_tp_data *data) return error; } - data->mode |= ETP_ENABLE_ABS; - error = data->ops->set_mode(client, data->mode); - if (error) { - dev_err(&client->dev, - "failed to switch to absolute mode: %d\n", error); - return error; - } + /* If it's the special FW, it need a different flow for mode change.*/ + if (check_ASUS_special_fw(data)) { + error = data->ops->sleep_control(client, false); + if (error) { + dev_err(&client->dev, + "failed to wake device up: %d\n", error); + return error; + } - error = data->ops->sleep_control(client, false); - if (error) { - dev_err(&client->dev, - "failed to wake device up: %d\n", error); - return error; - } + msleep(200); + data->mode |= ETP_ENABLE_ABS; + error = data->ops->set_mode(client, data->mode); + if (error) { + dev_err(&client->dev, + "failed to switch to absolute mode: %d\n", error); + return error; + } + } else { + data->mode |= ETP_ENABLE_ABS; + error = data->ops->set_mode(client, data->mode); + if (error) { + dev_err(&client->dev, + "failed to switch to absolute mode: %d\n", error); + return error; + } + + error = data->ops->sleep_control(client, false); + if (error) { + dev_err(&client->dev, + "failed to wake device up: %d\n", error); + return error; + } + } return 0; } @@ -757,6 +778,34 @@ out: return retval; } +static int check_ASUS_special_fw(struct elan_tp_data *data) +{ + struct i2c_client *client = data->client; + int error; + + error = data->ops->get_product_id(client, &data->product_id); + if (error) + return false; + + error = data->ops->get_sm_version(client, &data->ic_type, + &data->sm_version); + if (error) + return false; + + if (data->ic_type == 0x0E) { + switch (data->product_id) { + case 0x05: + case 0x06: + case 0x07: + case 0x09: + case 0x13: + return true; + default: + return false; + } + } + return false; +} static DEVICE_ATTR_WO(acquire); static DEVICE_ATTR_RO(min); -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: KT Liao <ktalex.liao@gmail.com> To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com Cc: phoenix@emc.com.tw, kt.liao@emc.com.tw Subject: [PATCH] Input: /input/mouse/elan_i2c_core.c Fix some Asus touchapod which casue TP no funciton sometimes, the patch detect some specific touchpad and run a special initialize Date: Fri, 8 Jul 2016 20:12:09 +0800 [thread overview] Message-ID: <1467979929-3409-1-git-send-email-kt.liao@emc.com.tw> (raw) Signed-off-by: KT Liao <kt.liao@emc.com.tw> --- drivers/input/mouse/elan_i2c_core.c | 81 +++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 16 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 2f58985..1c200fb 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -3,8 +3,8 @@ * * Copyright (c) 2013 ELAN Microelectronics Corp. * - * Author: 林政維 (Duson Lin) <dusonlin@emc.com.tw> - * Version: 1.6.0 + * Author: KT Liao <kt.liao@emc.com.tw> + * Version: 1.6.2 * * Based on cyapa driver: * copyright (c) 2011-2012 Cypress Semiconductor, Inc. @@ -40,7 +40,7 @@ #include "elan_i2c.h" #define DRIVER_NAME "elan_i2c" -#define ELAN_DRIVER_VERSION "1.6.1" +#define ELAN_DRIVER_VERSION "1.6.2" #define ELAN_VENDOR_ID 0x04f3 #define ETP_MAX_PRESSURE 255 #define ETP_FWIDTH_REDUCE 90 @@ -95,6 +95,8 @@ struct elan_tp_data { bool baseline_ready; }; +static int check_ASUS_special_fw(struct elan_tp_data *data); + static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count, u16 *signature_address) { @@ -210,21 +212,40 @@ static int __elan_initialize(struct elan_tp_data *data) return error; } - data->mode |= ETP_ENABLE_ABS; - error = data->ops->set_mode(client, data->mode); - if (error) { - dev_err(&client->dev, - "failed to switch to absolute mode: %d\n", error); - return error; - } + /* If it's the special FW, it need a different flow for mode change.*/ + if (check_ASUS_special_fw(data)) { + error = data->ops->sleep_control(client, false); + if (error) { + dev_err(&client->dev, + "failed to wake device up: %d\n", error); + return error; + } - error = data->ops->sleep_control(client, false); - if (error) { - dev_err(&client->dev, - "failed to wake device up: %d\n", error); - return error; - } + msleep(200); + data->mode |= ETP_ENABLE_ABS; + error = data->ops->set_mode(client, data->mode); + if (error) { + dev_err(&client->dev, + "failed to switch to absolute mode: %d\n", error); + return error; + } + } else { + data->mode |= ETP_ENABLE_ABS; + error = data->ops->set_mode(client, data->mode); + if (error) { + dev_err(&client->dev, + "failed to switch to absolute mode: %d\n", error); + return error; + } + + error = data->ops->sleep_control(client, false); + if (error) { + dev_err(&client->dev, + "failed to wake device up: %d\n", error); + return error; + } + } return 0; } @@ -757,6 +778,34 @@ out: return retval; } +static int check_ASUS_special_fw(struct elan_tp_data *data) +{ + struct i2c_client *client = data->client; + int error; + + error = data->ops->get_product_id(client, &data->product_id); + if (error) + return false; + + error = data->ops->get_sm_version(client, &data->ic_type, + &data->sm_version); + if (error) + return false; + + if (data->ic_type == 0x0E) { + switch (data->product_id) { + case 0x05: + case 0x06: + case 0x07: + case 0x09: + case 0x13: + return true; + default: + return false; + } + } + return false; +} static DEVICE_ATTR_WO(acquire); static DEVICE_ATTR_RO(min); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2016-07-08 12:12 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-07-08 12:12 KT Liao [this message] 2016-07-08 12:12 ` [PATCH] Input: /input/mouse/elan_i2c_core.c Fix some Asus touchapod which casue TP no funciton sometimes, the patch detect some specific touchpad and run a special initialize KT Liao 2016-07-09 0:24 ` Dmitry Torokhov 2016-07-09 0:24 ` Dmitry Torokhov 2016-07-11 12:40 ` 廖崇榮 2016-07-11 12:40 ` 廖崇榮 2016-07-11 17:03 ` 'Dmitry Torokhov' 2016-07-11 17:03 ` 'Dmitry Torokhov' 2016-07-12 14:19 ` 廖崇榮 2016-07-12 14:19 ` 廖崇榮
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1467979929-3409-1-git-send-email-kt.liao@emc.com.tw \ --to=ktalex.liao@gmail.com \ --cc=dmitry.torokhov@gmail.com \ --cc=kt.liao@emc.com.tw \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=phoenix@emc.com.tw \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.