Re: [PATCH 2/2] Input: elan_i2c - Modify the IAP related functio n for page sizes 128, 512 bytes.

From: Dmitry Torokhov
Date: Thu Jul 16 2020 - 21:27:25 EST


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.

Thanks.

--
Dmitry