Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp102041pxb; Wed, 11 Nov 2020 21:37:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/hENT9+RWcy/d0gHZteTpyfCkbAkR6ENYQV/+rbnP8sSX6Q9Nx9IXPFhbreWCWCceozuu X-Received: by 2002:a17:906:854b:: with SMTP id h11mr29255835ejy.273.1605159452257; Wed, 11 Nov 2020 21:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605159452; cv=none; d=google.com; s=arc-20160816; b=RP16P92aLAIghvabblc3k7eqRQjmlsM809LI7zsoqdG+5ZJDL0yfndu3qbrw/7uNn/ hkdaU0a1z1z4BSEs8TM9gijym4FhFS964F2mah5CwbKm6aIMuySBNg39RiCzdlHLysCV MLcQHPA9WjrT5OHijUuwu7Vd3SASNgvxMLYBVvHVFcRa4mcXS0TUbQHfhZ87Pks8ysjV pyfEXmjGC4mJ0kOGmlIkwugSaD6A5SnByMGqiZvUUgaeXRzS2x9JQiLy/TGHDINcIevq 6w14beeO8fOS64yVLXLSd0MYg8JRLtur3Xk01ddoH150f2qtEIIzQdkG0nrvTiNj+qPx Yjvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=agD5Z/HPHNzuvJKrY5tAQ1Muv4F4fU5Z2f6dHhxZNIg=; b=dhmicTyI59acSjQDJQMeke/ctUvcl5uCz2Me5nPhkaeu73I7c+Zwi0yP58mcPPwNh5 GWaWaWoBFImsVa/ft1EiccGRReva9QAzF2cfyA6XsohubHkoblxwkChD0QDAvn6i2aVz cEgOmqCnJXgTlfIOjsoxSUSGCZp6dpyQuF/AE3VRgoiB9kCTePZ5kpc2mH168Sy/tU/c +T8xSpNeUpnHEA10VnZOSIwNtaHLvbHyp8GkFgiNfz6PDlz1EMkHNp9+ZITM+qcqGzH2 uQunFJTd+keIV9UysciqFAImA9VyD0ITB2iZyIotE1qXM9jXULZkX8BXKmyAN4AjGNVR cz5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si3395907edn.569.2020.11.11.21.36.40; Wed, 11 Nov 2020 21:37:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728670AbgKLFeP (ORCPT + 99 others); Thu, 12 Nov 2020 00:34:15 -0500 Received: from emcscan.emc.com.tw ([192.72.220.5]:54802 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgKLCAX (ORCPT ); Wed, 11 Nov 2020 21:00:23 -0500 X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="38118510" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 12 Nov 2020 09:58:20 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(2862:0:AUTH_RELAY) (envelope-from ); Thu, 12 Nov 2020 09:58:19 +0800 (CST) Received: from 49.216.112.142 by webmail.emc.com.tw with Mail2000 ESMTPA Server V7.00(2475:0:AUTH_LOGIN) (envelope-from ); Thu, 12 Nov 2020 09:58:18 +0800 (CST) From: "jingle.wu" To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com Cc: phoenix@emc.com.tw, dave.wang@emc.com.tw, josh.chen@emc.com.tw, "jingle.wu" Subject: [PATCH] Input: elan_i2c - Modify the correct input of the iap page type command. Date: Thu, 12 Nov 2020 09:58:10 +0800 Message-Id: <20201112015810.9559-1-jingle.wu@emc.com.tw> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The iap page type command of the parameter is page_size. Signed-off-by: Jingle Wu --- drivers/input/mouse/elan_i2c.h | 2 +- drivers/input/mouse/elan_i2c_core.c | 3 ++- drivers/input/mouse/elan_i2c_i2c.c | 10 +++++----- drivers/input/mouse/elan_i2c_smbus.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h index c75b00c45d75..36e3cd908671 100644 --- a/drivers/input/mouse/elan_i2c.h +++ b/drivers/input/mouse/elan_i2c.h @@ -78,7 +78,7 @@ struct elan_transport_ops { int (*iap_reset)(struct i2c_client *client); int (*prepare_fw_update)(struct i2c_client *client, u16 ic_type, - u8 iap_version); + u8 iap_version, u16 fw_page_size); int (*write_fw_block)(struct i2c_client *client, u16 fw_page_size, const u8 *page, u16 checksum, int idx); int (*finish_fw_update)(struct i2c_client *client, diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index c599e21a8478..61ed3f5ca219 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -497,7 +497,8 @@ static int __elan_update_firmware(struct elan_tp_data *data, u16 sw_checksum = 0, fw_checksum = 0; error = data->ops->prepare_fw_update(client, data->ic_type, - data->iap_version); + data->iap_version, + data->fw_page_size); if (error) return error; diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c index 5a496d4ffa49..13dc097eb6c6 100644 --- a/drivers/input/mouse/elan_i2c_i2c.c +++ b/drivers/input/mouse/elan_i2c_i2c.c @@ -517,7 +517,7 @@ static int elan_i2c_set_flash_key(struct i2c_client *client) return 0; } -static int elan_read_write_iap_type(struct i2c_client *client) +static int elan_read_write_iap_type(struct i2c_client *client, u16 fw_page_size) { int error; u16 constant; @@ -526,7 +526,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) do { error = elan_i2c_write_cmd(client, ETP_I2C_IAP_TYPE_CMD, - ETP_I2C_IAP_TYPE_REG); + fw_page_size / 2); if (error) { dev_err(&client->dev, "cannot write iap type: %d\n", error); @@ -543,7 +543,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) constant = le16_to_cpup((__le16 *)val); dev_dbg(&client->dev, "iap type reg: 0x%04x\n", constant); - if (constant == ETP_I2C_IAP_TYPE_REG) + if (constant == fw_page_size / 2) return 0; } while (--retry > 0); @@ -553,7 +553,7 @@ static int elan_read_write_iap_type(struct i2c_client *client) } static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, - u8 iap_version) + u8 iap_version, u16 fw_page_size) { struct device *dev = &client->dev; int error; @@ -594,7 +594,7 @@ static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, } if (ic_type >= 0x0D && iap_version >= 1) { - error = elan_read_write_iap_type(client); + error = elan_read_write_iap_type(client, fw_page_size); if (error) return error; } diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c index 8ff823751f3b..1820f1cfc1dc 100644 --- a/drivers/input/mouse/elan_i2c_smbus.c +++ b/drivers/input/mouse/elan_i2c_smbus.c @@ -340,7 +340,7 @@ static int elan_smbus_set_flash_key(struct i2c_client *client) } static int elan_smbus_prepare_fw_update(struct i2c_client *client, u16 ic_type, - u8 iap_version) + u8 iap_version, u16 fw_page_size) { struct device *dev = &client->dev; int len; -- 2.17.1