Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1809849ybh; Fri, 17 Jul 2020 01:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYcEXod0Vv3FYiOgW4tgn8irXmno7l5QO/XlnSD50HP4wy+ObTgUmEPZVBFn6HI8y17kzu X-Received: by 2002:a17:907:1190:: with SMTP id uz16mr7390709ejb.385.1594974756766; Fri, 17 Jul 2020 01:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594974756; cv=none; d=google.com; s=arc-20160816; b=G5+tL5wOVae/zM+vz53elanQNF7dx35eC4BeWrkI88qHDdj/vE9eCAvzY+L/BBNZ6n oMz77suGpWzirdJM6iQGBE953ZP5dZ7Cv2DUgw8o8kqiNq9wklHwaoJyceUWKWIrzR3z acxWRb2QNmdkfFD/g4WE2LeLNzIRWRpzzQfnoT/peK5Ek5Al8EYveXeao9mfSP90OWIp D3QSFKcydGRcWP90qd3avAeLvS6zMdmzHdaPWf8cYWd11ejEGE3+X3EVuPmmmKKiDKLc oGTpICy/ZLIHdFkxerNw3pqn0Urg8uii/ZELHp0RUge2BCht0aFI867MiLqjNTKCqRSf 6RHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from; bh=QhTzEbBcxge+hcq4kz54vI7h7OZTn4XNPjK5/Jfm6CI=; b=ZyQ7I7EH5QWnIQAKlXj0luf6v4khswdpzs1o1Q4Cn8b7ud+/fco4FwfVp+k1kw48NI 1XpbMm/k/atmA3ucyE/JuW8S1bU3dwO1yEq9ddN9oyzQjmZzBBhY6zU+NTB0hVLYosEC trnYroii7DU09l7Mkx+EzaZ+fCv9eGQzXjfYWzX1AF+Z5oKzTzE1p6+xJTuTSKwR7YMe IOXTzO7Do6CbXNGMU/nn4iaFa+718258z3qZnlhDXNoOyW4qntkcEyeZBG9gTRF8MVxE WM+40xzPQHVB3z1nC1dizQ4k2ewybDaAsAj1dvkI7em4ov5rR7JTNmt/k2Uo8h0YdCMw NcJg== 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 ha25si4528525ejb.628.2020.07.17.01.32.13; Fri, 17 Jul 2020 01:32:36 -0700 (PDT) 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 S1726293AbgGQIcF (ORCPT + 99 others); Fri, 17 Jul 2020 04:32:05 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:4798 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726056AbgGQIcF (ORCPT ); Fri, 17 Jul 2020 04:32:05 -0400 X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="36478205" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 17 Jul 2020 16:32:02 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(195203:0:AUTH_RELAY) (envelope-from ); Fri, 17 Jul 2020 16:32:01 +0800 (CST) Received: from 192.168.33.11 by webmail.emc.com.tw with Mail2000 ESMTP Server V7.00(2484:0:AUTH_RELAY) (envelope-from ); Fri, 17 Jul 2020 16:31:59 +0800 (CST) From: "jingle" To: "'Dmitry Torokhov'" Cc: "'linux-kernel'" , "'linux-input'" , "'phoenix'" , "'josh.chen'" , "'kai.heng.feng'" References: <20200714105641.15151-1-jingle.wu@emc.com.tw> <20200716053912.GB1665100@dtor-ws> <1594880123.69588.jingle.wu@emc.com.tw> <20200717012719.GC1665100@dtor-ws> <20200717061010.GD1665100@dtor-ws> In-Reply-To: Subject: RE: [PATCH 2/2] Input: elan_i2c - Modify the IAP related functio n for page sizes 128, 512 bytes. Date: Fri, 17 Jul 2020 16:31:58 +0800 Message-ID: <002c01d65c14$bccb9c10$3662d430$@emc.com.tw> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIjNBmL5Bem/gD5U/Wevzos9rHsvgFMELwpAblpFq8B/K6BpwFpUkutqD5gC9CAAANZoA== Content-Language: zh-tw x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcMDYwMTFcYXBwZGF0YVxyb2FtaW5nXDA5ZDg0OWI2LTMyZDMtNGE0MC04NWVlLTZiODRiYTI5ZTM1Ylxtc2dzXG1zZy1mYTU0OTRmZC1jODA3LTExZWEtODE5YS1mMDc5NTk2OWU3NWVcYW1lLXRlc3RcZmE1NDk0ZmYtYzgwNy0xMWVhLTgxOWEtZjA3OTU5NjllNzVlYm9keS50eHQiIHN6PSIzNTY0IiB0PSIxMzIzOTQ0ODMxODg1NTA4NzciIGg9IkpxQjdpaXJjaFZQSDZMUFpUdjhudUFZZ2xvdz0iIGlkPSIiIGJsPSIwIiBibz0iMSIvPjwvbWV0YT4= x-dg-rorf: true Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry: 1. In this function elan_get_fwinfo(). +static int elan_get_fwinfo(u16 ic_type, u8 iap_version, u8 pattern, + u16 *validpage_count, u32 *signature_address, + u16 *page_size) { - switch (ic_type) { + u16 type = pattern >= 0x01 ? ic_type : iap_version; + + switch (type) { This iap_version in pattern0 is read from this command ETP_I2C_IAP_VERSION_CMD_OLD ,it is not from this command ETP_I2C_IAP_VERSION. So u16 type = pattern >= 0x01 ? ic_type : iap_version; <- wrong 2. In this "static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, u8 iap_version)" function. The ic is old pattern must be modify correct ic_type. (cmd is ETP_I2C_IAP_VERSION) THANKS -----Original Message----- From: jingle [mailto:jingle.wu@emc.com.tw] Sent: Friday, July 17, 2020 4:20 PM To: 'Dmitry Torokhov' Cc: 'linux-kernel'; 'linux-input'; 'phoenix'; 'josh.chen'; 'kai.heng.feng' Subject: RE: [PATCH 2/2] Input: elan_i2c - Modify the IAP related functio n for page sizes 128, 512 bytes. Hi Dmitry: In this "static int elan_i2c_prepare_fw_update(struct i2c_client *client, u16 ic_type, u8 iap_version)" function If IC is old_pattern, it must be modified to iap_version -> u16 type = pattern >= 0x01 ? ic_type : iap_version; Thanks -----Original Message----- From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] Sent: Friday, July 17, 2020 2:10 PM To: jingle.wu Cc: linux-kernel; linux-input; phoenix; josh.chen; kai.heng.feng Subject: Re: [PATCH 2/2] Input: elan_i2c - Modify the IAP related functio n for page sizes 128, 512 bytes. On Thu, Jul 16, 2020 at 06:27:19PM -0700, Dmitry Torokhov wrote: > Hi Jingle, > > On Thu, Jul 16, 2020 at 02:15:23PM +0800, jingle.wu wrote: > > HI Dmitry: > > > > Just to confirm, the older devices (I assume that pattern 0 means > > older) have version command that is numerically higher than the one > > for the newer (pattern >= 1) devices? > > > > >> Yes, Pattern 1, 2 are newer devices. > > > > > @@ -324,7 +342,14 @@ static int elan_i2c_get_sm_version(struct i2c_client *client, > > > return error; > > > } > > > *version = val[0]; > > > - *ic_type = val[1]; > > > + > > > + error = elan_i2c_read_cmd(client, ETP_I2C_IAP_VERSION_CMD, val); > > > + if (error) { > > > + dev_err(&client->dev, "failed to get ic type: %d\n", > > > + error); > > > + return error; > > > + } > > > > Could you please tell me why this chunk is needed? > > >> Modify the old pattern IC firmware read the correct ic_type. > > > > In the elan_i2c_core.c, move this code to elan_i2c_i2c.c. > > static int elan_query_device_info(struct elan_tp_data *data) { > > ..... > > if (data->pattern == 0x01) > > ic_type = data->ic_type; > > else > > ic_type = data->iap_version; > > ..... > > return 0; > > } > > I am concerned that unconditionally substituting iap_version for > ic_type for "pattern 0" devices will break check in > elan_check_ASUS_special_fw() as it operates on the ic_type returned by > ETP_I2C_OSM_VERSION_CMD and not iap_version. I split the firmware handling code into a few patches and uploaded it to a new elan-i2c branch: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git elan-i2c Please take a look and let me know if I messed it up or not. I will be looking at the new packet format next. Thanks. -- Dmitry