Re: [PATCH] Input: elan_i2c - Add new ic and modify some functions for new IC infomation Signed-off-by: KT Liao <kt.l...@emc.com.tw>

2017-05-11 Thread Dmitry Torokhov
On Tue, Nov 22, 2016 at 02:43:26PM +0800, KT Liao wrote:

Applied, thank you. Sorry for the delay.

> ---
>  drivers/input/mouse/elan_i2c.h   |  6 ++-
>  drivers/input/mouse/elan_i2c_core.c  | 40 +--
>  drivers/input/mouse/elan_i2c_i2c.c   | 74 
> 
>  drivers/input/mouse/elan_i2c_smbus.c |  9 -
>  4 files changed, 108 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
> index c0ec261..a1228dd 100644
> --- a/drivers/input/mouse/elan_i2c.h
> +++ b/drivers/input/mouse/elan_i2c.h
> @@ -56,9 +56,10 @@ struct elan_transport_ops {
>   int (*get_baseline_data)(struct i2c_client *client,
>bool max_baseliune, u8 *value);
>  
> - int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
> + int (*get_version)(struct i2c_client *client,
> +bool iap, u8 *version);
>   int (*get_sm_version)(struct i2c_client *client,
> -   u8* ic_type, u8 *version);
> +   u16 *ic_type, u8 *version);
>   int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
>   int (*get_product_id)(struct i2c_client *client, u16 *id);
>  
> @@ -82,6 +83,7 @@ struct elan_transport_ops {
>   int (*get_report)(struct i2c_client *client, u8 *report);
>   int (*get_pressure_adjustment)(struct i2c_client *client,
>  int *adjustment);
> + int (*get_pattern)(struct i2c_client *client, u8 *pattern);
>  };
>  
>  extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops;
> diff --git a/drivers/input/mouse/elan_i2c_core.c 
> b/drivers/input/mouse/elan_i2c_core.c
> index d15b338..818c73a 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -5,7 +5,7 @@
>   *
>   * Author: 林政維 (Duson Lin) 
>   * Author: KT Liao 
> - * Version: 1.6.2
> + * Version: 1.6.3
>   *
>   * Based on cyapa driver:
>   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> @@ -41,7 +41,7 @@
>  #include "elan_i2c.h"
>  
>  #define DRIVER_NAME  "elan_i2c"
> -#define ELAN_DRIVER_VERSION  "1.6.2"
> +#define ELAN_DRIVER_VERSION  "1.6.3"
>  #define ELAN_VENDOR_ID   0x04f3
>  #define ETP_MAX_PRESSURE 255
>  #define ETP_FWIDTH_REDUCE90
> @@ -78,6 +78,7 @@ struct elan_tp_data {
>   unsigned intx_res;
>   unsigned inty_res;
>  
> + u8  pattern;
>   u16 product_id;
>   u8  fw_version;
>   u8  sm_version;
> @@ -85,7 +86,7 @@ struct elan_tp_data {
>   u16 fw_checksum;
>   int pressure_adjustment;
>   u8  mode;
> - u8  ic_type;
> + u16 ic_type;
>   u16 fw_validpage_count;
>   u16 fw_signature_address;
>  
> @@ -96,10 +97,10 @@ struct elan_tp_data {
>   boolbaseline_ready;
>  };
>  
> -static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
> +static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
>  u16 *signature_address)
>  {
> - switch (iap_version) {
> + switch (ic_type) {
>   case 0x00:
>   case 0x06:
>   case 0x08:
> @@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 
> *validpage_count,
>   case 0x0E:
>   *validpage_count = 640;
>   break;
> + case 0x10:
> + *validpage_count = 1024;
> + break;
>   default:
>   /* unknown ic type clear value */
>   *validpage_count = 0;
> @@ -209,7 +213,8 @@ static int elan_query_product(struct elan_tp_data *data)
>   return error;
>  
>   error = data->ops->get_sm_version(data->client, >ic_type,
> -   >sm_version);
> + >sm_version);
> +
>   if (error)
>   return error;
>  
> @@ -302,7 +307,7 @@ static int elan_initialize(struct elan_tp_data *data)
>  
>  static int elan_query_device_info(struct elan_tp_data *data)
>  {
> - int error;
> + int error, ic_type;
>  
>   error = data->ops->get_version(data->client, false, >fw_version);
>   if (error)
> @@ -317,12 +322,22 @@ static int elan_query_device_info(struct elan_tp_data 
> *data)
>   if (error)
>   return error;
>  
> +
>   error = data->ops->get_pressure_adjustment(data->client,
>  >pressure_adjustment);
>   if (error)
>   return error;
>  
> - error = elan_get_fwinfo(data->iap_version, >fw_validpage_count,
> + error = data->ops->get_pattern(data->client, >pattern);
> + if (error)
> + 

Re: [PATCH] Input: elan_i2c - Add new ic and modify some functions for new IC infomation Signed-off-by: KT Liao <kt.l...@emc.com.tw>

2016-11-22 Thread 'Dmitry Torokhov'
Hi KT,

On Fri, Nov 18, 2016 at 04:32:18PM +0800, 廖崇榮 wrote:
> Hi Dmitry
> 
> -Original Message-
> From: Dmitry Torokhov [mailto:dmitry.torok...@gmail.com] 
> Sent: Friday, November 18, 2016 1:15 AM
> To: KT Liao
> Cc: linux-kernel@vger.kernel.org; linux-in...@vger.kernel.org; 
> phoe...@emc.com.tw; kt.l...@emc.com.tw
> Subject: Re: [PATCH] Input: elan_i2c - Add new ic and modify some functions 
> for new IC infomation Signed-off-by: KT Liao 
> 
> Hi KT,
> 
> On Thu, Nov 17, 2016 at 07:47:43PM +0800, KT Liao wrote:
> > ---
> >  drivers/input/mouse/elan_i2c.h   |  6 ++--
> >  drivers/input/mouse/elan_i2c_core.c  | 46 ++
> >  drivers/input/mouse/elan_i2c_i2c.c   | 63 
> > ++--
> >  drivers/input/mouse/elan_i2c_smbus.c | 11 +--
> >  4 files changed, 99 insertions(+), 27 deletions(-)  mode change 
> > 100644 => 100755 drivers/input/mouse/elan_i2c.h  mode change 100644 => 
> > 100755 drivers/input/mouse/elan_i2c_core.c
> >  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_i2c.c
> >  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_smbus.c
> 
> Why are you changing mode on the files?
> [KT]:Sorry, it's my fault to change file mode. I will fix it in next upstream.
> 
> > 
> > diff --git a/drivers/input/mouse/elan_i2c.h 
> > b/drivers/input/mouse/elan_i2c.h old mode 100644 new mode 100755 index 
> > c0ec261..a90df14
> > --- a/drivers/input/mouse/elan_i2c.h
> > +++ b/drivers/input/mouse/elan_i2c.h
> > @@ -56,9 +56,10 @@ struct elan_transport_ops {
> > int (*get_baseline_data)(struct i2c_client *client,
> >  bool max_baseliune, u8 *value);
> >  
> > -   int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
> > +   int (*get_version)(struct i2c_client *client,
> > +  bool iap, u8 *version, u8 pattern);
> > int (*get_sm_version)(struct i2c_client *client,
> > - u8* ic_type, u8 *version);
> > + u16 *ic_type, u8 *version, u8 pattern);
> > int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
> > int (*get_product_id)(struct i2c_client *client, u16 *id);
> >  
> > @@ -82,6 +83,7 @@ struct elan_transport_ops {
> > int (*get_report)(struct i2c_client *client, u8 *report);
> > int (*get_pressure_adjustment)(struct i2c_client *client,
> >int *adjustment);
> > +   int (*get_pattern)(struct i2c_client *client, u8 *pattern);
> >  };
> >  
> >  extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops; 
> > diff --git a/drivers/input/mouse/elan_i2c_core.c 
> > b/drivers/input/mouse/elan_i2c_core.c
> > old mode 100644
> > new mode 100755
> > index d15b338..bb0c832
> > --- a/drivers/input/mouse/elan_i2c_core.c
> > +++ b/drivers/input/mouse/elan_i2c_core.c
> > @@ -5,7 +5,7 @@
> >   *
> >   * Author: 林政維 (Duson Lin) 
> >   * Author: KT Liao 
> > - * Version: 1.6.2
> > + * Version: 1.6.3
> >   *
> >   * Based on cyapa driver:
> >   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> > @@ -41,7 +41,7 @@
> >  #include "elan_i2c.h"
> >  
> >  #define DRIVER_NAME"elan_i2c"
> > -#define ELAN_DRIVER_VERSION"1.6.2"
> > +#define ELAN_DRIVER_VERSION"1.6.3"
> >  #define ELAN_VENDOR_ID 0x04f3
> >  #define ETP_MAX_PRESSURE   255
> >  #define ETP_FWIDTH_REDUCE  90
> > @@ -78,6 +78,7 @@ struct elan_tp_data {
> > unsigned intx_res;
> > unsigned inty_res;
> >  
> > +   u8  pattern;
> > u16 product_id;
> > u8  fw_version;
> > u8  sm_version;
> > @@ -85,7 +86,7 @@ struct elan_tp_data {
> > u16 fw_checksum;
> > int pressure_adjustment;
> > u8  mode;
> > -   u8  ic_type;
> > +   u16 ic_type;
> > u16 fw_validpage_count;
> > u16 fw_signature_address;
> >  
> > @@ -96,10 +97,10 @@ struct elan_tp_data {
> > boolbaseline_ready;
> >  };
> >  
> > -static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
> > +static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
> >u16 *signature_address)
> >  {
> > -   switch (iap_version) {
> > +   switch (ic_type) {
> > case 0x00:
> > case 0x06:
> > case 0x08:
> > @@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 
> > *validpage_count,
> > case 0x0E:
> > *validpage_count = 640;
> > break;
> > +   case 0x10:
> > +   *validpage_count = 1024;
> > +   break;
> > default:
> > /* unknown ic type clear value */
> > *validpage_count = 0;
> > @@ -204,12 +208,17 @@ static int elan_query_product(struct 
> 

[PATCH] Input: elan_i2c - Add new ic and modify some functions for new IC infomation Signed-off-by: KT Liao <kt.l...@emc.com.tw>

2016-11-21 Thread KT Liao
---
 drivers/input/mouse/elan_i2c.h   |  6 ++-
 drivers/input/mouse/elan_i2c_core.c  | 40 +--
 drivers/input/mouse/elan_i2c_i2c.c   | 74 
 drivers/input/mouse/elan_i2c_smbus.c |  9 -
 4 files changed, 108 insertions(+), 21 deletions(-)

diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
index c0ec261..a1228dd 100644
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -56,9 +56,10 @@ struct elan_transport_ops {
int (*get_baseline_data)(struct i2c_client *client,
 bool max_baseliune, u8 *value);
 
-   int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
+   int (*get_version)(struct i2c_client *client,
+  bool iap, u8 *version);
int (*get_sm_version)(struct i2c_client *client,
- u8* ic_type, u8 *version);
+ u16 *ic_type, u8 *version);
int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
int (*get_product_id)(struct i2c_client *client, u16 *id);
 
@@ -82,6 +83,7 @@ struct elan_transport_ops {
int (*get_report)(struct i2c_client *client, u8 *report);
int (*get_pressure_adjustment)(struct i2c_client *client,
   int *adjustment);
+   int (*get_pattern)(struct i2c_client *client, u8 *pattern);
 };
 
 extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops;
diff --git a/drivers/input/mouse/elan_i2c_core.c 
b/drivers/input/mouse/elan_i2c_core.c
index d15b338..818c73a 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -5,7 +5,7 @@
  *
  * Author: ? (Duson Lin) 
  * Author: KT Liao 
- * Version: 1.6.2
+ * Version: 1.6.3
  *
  * Based on cyapa driver:
  * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -41,7 +41,7 @@
 #include "elan_i2c.h"
 
 #define DRIVER_NAME"elan_i2c"
-#define ELAN_DRIVER_VERSION"1.6.2"
+#define ELAN_DRIVER_VERSION"1.6.3"
 #define ELAN_VENDOR_ID 0x04f3
 #define ETP_MAX_PRESSURE   255
 #define ETP_FWIDTH_REDUCE  90
@@ -78,6 +78,7 @@ struct elan_tp_data {
unsigned intx_res;
unsigned inty_res;
 
+   u8  pattern;
u16 product_id;
u8  fw_version;
u8  sm_version;
@@ -85,7 +86,7 @@ struct elan_tp_data {
u16 fw_checksum;
int pressure_adjustment;
u8  mode;
-   u8  ic_type;
+   u16 ic_type;
u16 fw_validpage_count;
u16 fw_signature_address;
 
@@ -96,10 +97,10 @@ struct elan_tp_data {
boolbaseline_ready;
 };
 
-static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
+static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
   u16 *signature_address)
 {
-   switch (iap_version) {
+   switch (ic_type) {
case 0x00:
case 0x06:
case 0x08:
@@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 
*validpage_count,
case 0x0E:
*validpage_count = 640;
break;
+   case 0x10:
+   *validpage_count = 1024;
+   break;
default:
/* unknown ic type clear value */
*validpage_count = 0;
@@ -209,7 +213,8 @@ static int elan_query_product(struct elan_tp_data *data)
return error;
 
error = data->ops->get_sm_version(data->client, >ic_type,
- >sm_version);
+   >sm_version);
+
if (error)
return error;
 
@@ -302,7 +307,7 @@ static int elan_initialize(struct elan_tp_data *data)
 
 static int elan_query_device_info(struct elan_tp_data *data)
 {
-   int error;
+   int error, ic_type;
 
error = data->ops->get_version(data->client, false, >fw_version);
if (error)
@@ -317,12 +322,22 @@ static int elan_query_device_info(struct elan_tp_data 
*data)
if (error)
return error;
 
+
error = data->ops->get_pressure_adjustment(data->client,
   >pressure_adjustment);
if (error)
return error;
 
-   error = elan_get_fwinfo(data->iap_version, >fw_validpage_count,
+   error = data->ops->get_pattern(data->client, >pattern);
+   if (error)
+   return error;
+
+   if (data->pattern == 0x01)
+   ic_type = data->ic_type;
+   else
+   ic_type = data->iap_version;
+
+   error = elan_get_fwinfo(ic_type, >fw_validpage_count,
 

RE: [PATCH] Input: elan_i2c - Add new ic and modify some functions for new IC infomation Signed-off-by: KT Liao <kt.l...@emc.com.tw>

2016-11-18 Thread 廖崇榮
Hi Dmitry

-Original Message-
From: Dmitry Torokhov [mailto:dmitry.torok...@gmail.com] 
Sent: Friday, November 18, 2016 1:15 AM
To: KT Liao
Cc: linux-kernel@vger.kernel.org; linux-in...@vger.kernel.org; 
phoe...@emc.com.tw; kt.l...@emc.com.tw
Subject: Re: [PATCH] Input: elan_i2c - Add new ic and modify some functions for 
new IC infomation Signed-off-by: KT Liao 

Hi KT,

On Thu, Nov 17, 2016 at 07:47:43PM +0800, KT Liao wrote:
> ---
>  drivers/input/mouse/elan_i2c.h   |  6 ++--
>  drivers/input/mouse/elan_i2c_core.c  | 46 ++
>  drivers/input/mouse/elan_i2c_i2c.c   | 63 
> ++--
>  drivers/input/mouse/elan_i2c_smbus.c | 11 +--
>  4 files changed, 99 insertions(+), 27 deletions(-)  mode change 
> 100644 => 100755 drivers/input/mouse/elan_i2c.h  mode change 100644 => 
> 100755 drivers/input/mouse/elan_i2c_core.c
>  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_i2c.c
>  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_smbus.c

Why are you changing mode on the files?
[KT]:Sorry, it's my fault to change file mode. I will fix it in next upstream.

> 
> diff --git a/drivers/input/mouse/elan_i2c.h 
> b/drivers/input/mouse/elan_i2c.h old mode 100644 new mode 100755 index 
> c0ec261..a90df14
> --- a/drivers/input/mouse/elan_i2c.h
> +++ b/drivers/input/mouse/elan_i2c.h
> @@ -56,9 +56,10 @@ struct elan_transport_ops {
>   int (*get_baseline_data)(struct i2c_client *client,
>bool max_baseliune, u8 *value);
>  
> - int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
> + int (*get_version)(struct i2c_client *client,
> +bool iap, u8 *version, u8 pattern);
>   int (*get_sm_version)(struct i2c_client *client,
> -   u8* ic_type, u8 *version);
> +   u16 *ic_type, u8 *version, u8 pattern);
>   int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
>   int (*get_product_id)(struct i2c_client *client, u16 *id);
>  
> @@ -82,6 +83,7 @@ struct elan_transport_ops {
>   int (*get_report)(struct i2c_client *client, u8 *report);
>   int (*get_pressure_adjustment)(struct i2c_client *client,
>  int *adjustment);
> + int (*get_pattern)(struct i2c_client *client, u8 *pattern);
>  };
>  
>  extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops; 
> diff --git a/drivers/input/mouse/elan_i2c_core.c 
> b/drivers/input/mouse/elan_i2c_core.c
> old mode 100644
> new mode 100755
> index d15b338..bb0c832
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -5,7 +5,7 @@
>   *
>   * Author: 林政維 (Duson Lin) 
>   * Author: KT Liao 
> - * Version: 1.6.2
> + * Version: 1.6.3
>   *
>   * Based on cyapa driver:
>   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> @@ -41,7 +41,7 @@
>  #include "elan_i2c.h"
>  
>  #define DRIVER_NAME  "elan_i2c"
> -#define ELAN_DRIVER_VERSION  "1.6.2"
> +#define ELAN_DRIVER_VERSION  "1.6.3"
>  #define ELAN_VENDOR_ID   0x04f3
>  #define ETP_MAX_PRESSURE 255
>  #define ETP_FWIDTH_REDUCE90
> @@ -78,6 +78,7 @@ struct elan_tp_data {
>   unsigned intx_res;
>   unsigned inty_res;
>  
> + u8  pattern;
>   u16 product_id;
>   u8  fw_version;
>   u8  sm_version;
> @@ -85,7 +86,7 @@ struct elan_tp_data {
>   u16 fw_checksum;
>   int pressure_adjustment;
>   u8  mode;
> - u8  ic_type;
> + u16 ic_type;
>   u16 fw_validpage_count;
>   u16 fw_signature_address;
>  
> @@ -96,10 +97,10 @@ struct elan_tp_data {
>   boolbaseline_ready;
>  };
>  
> -static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
> +static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
>  u16 *signature_address)
>  {
> - switch (iap_version) {
> + switch (ic_type) {
>   case 0x00:
>   case 0x06:
>   case 0x08:
> @@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 
> *validpage_count,
>   case 0x0E:
>   *validpage_count = 640;
>   break;
> + case 0x10:
> + *validpage_count = 1024;
> + break;
>   default:
>   /* unknown ic type clear value */
>   *validpage_count = 0;
> @@ -204,12 +208,17 @@ static int elan_query_product(struct 
> elan_tp_data *data)  {
>   int error;
>  
> + error = data->ops->get_pattern(data->client, >pattern);
> + if (error)
> + return error;
> +
>   error = data->ops->get_product_id(data->client, >product_id);

Re: [PATCH] Input: elan_i2c - Add new ic and modify some functions for new IC infomation Signed-off-by: KT Liao <kt.l...@emc.com.tw>

2016-11-17 Thread Dmitry Torokhov
Hi KT,

On Thu, Nov 17, 2016 at 07:47:43PM +0800, KT Liao wrote:
> ---
>  drivers/input/mouse/elan_i2c.h   |  6 ++--
>  drivers/input/mouse/elan_i2c_core.c  | 46 ++
>  drivers/input/mouse/elan_i2c_i2c.c   | 63 
> ++--
>  drivers/input/mouse/elan_i2c_smbus.c | 11 +--
>  4 files changed, 99 insertions(+), 27 deletions(-)
>  mode change 100644 => 100755 drivers/input/mouse/elan_i2c.h
>  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_core.c
>  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_i2c.c
>  mode change 100644 => 100755 drivers/input/mouse/elan_i2c_smbus.c

Why are you changing mode on the files?

> 
> diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
> old mode 100644
> new mode 100755
> index c0ec261..a90df14
> --- a/drivers/input/mouse/elan_i2c.h
> +++ b/drivers/input/mouse/elan_i2c.h
> @@ -56,9 +56,10 @@ struct elan_transport_ops {
>   int (*get_baseline_data)(struct i2c_client *client,
>bool max_baseliune, u8 *value);
>  
> - int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
> + int (*get_version)(struct i2c_client *client,
> +bool iap, u8 *version, u8 pattern);
>   int (*get_sm_version)(struct i2c_client *client,
> -   u8* ic_type, u8 *version);
> +   u16 *ic_type, u8 *version, u8 pattern);
>   int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
>   int (*get_product_id)(struct i2c_client *client, u16 *id);
>  
> @@ -82,6 +83,7 @@ struct elan_transport_ops {
>   int (*get_report)(struct i2c_client *client, u8 *report);
>   int (*get_pressure_adjustment)(struct i2c_client *client,
>  int *adjustment);
> + int (*get_pattern)(struct i2c_client *client, u8 *pattern);
>  };
>  
>  extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops;
> diff --git a/drivers/input/mouse/elan_i2c_core.c 
> b/drivers/input/mouse/elan_i2c_core.c
> old mode 100644
> new mode 100755
> index d15b338..bb0c832
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -5,7 +5,7 @@
>   *
>   * Author: 林政維 (Duson Lin) 
>   * Author: KT Liao 
> - * Version: 1.6.2
> + * Version: 1.6.3
>   *
>   * Based on cyapa driver:
>   * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
> @@ -41,7 +41,7 @@
>  #include "elan_i2c.h"
>  
>  #define DRIVER_NAME  "elan_i2c"
> -#define ELAN_DRIVER_VERSION  "1.6.2"
> +#define ELAN_DRIVER_VERSION  "1.6.3"
>  #define ELAN_VENDOR_ID   0x04f3
>  #define ETP_MAX_PRESSURE 255
>  #define ETP_FWIDTH_REDUCE90
> @@ -78,6 +78,7 @@ struct elan_tp_data {
>   unsigned intx_res;
>   unsigned inty_res;
>  
> + u8  pattern;
>   u16 product_id;
>   u8  fw_version;
>   u8  sm_version;
> @@ -85,7 +86,7 @@ struct elan_tp_data {
>   u16 fw_checksum;
>   int pressure_adjustment;
>   u8  mode;
> - u8  ic_type;
> + u16 ic_type;
>   u16 fw_validpage_count;
>   u16 fw_signature_address;
>  
> @@ -96,10 +97,10 @@ struct elan_tp_data {
>   boolbaseline_ready;
>  };
>  
> -static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
> +static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
>  u16 *signature_address)
>  {
> - switch (iap_version) {
> + switch (ic_type) {
>   case 0x00:
>   case 0x06:
>   case 0x08:
> @@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 
> *validpage_count,
>   case 0x0E:
>   *validpage_count = 640;
>   break;
> + case 0x10:
> + *validpage_count = 1024;
> + break;
>   default:
>   /* unknown ic type clear value */
>   *validpage_count = 0;
> @@ -204,12 +208,17 @@ static int elan_query_product(struct elan_tp_data *data)
>  {
>   int error;
>  
> + error = data->ops->get_pattern(data->client, >pattern);
> + if (error)
> + return error;
> +
>   error = data->ops->get_product_id(data->client, >product_id);
>   if (error)
>   return error;
>  
>   error = data->ops->get_sm_version(data->client, >ic_type,
> -   >sm_version);
> + >sm_version, data->pattern);
> +
>   if (error)
>   return error;
>  
> @@ -302,9 +311,10 @@ static int elan_initialize(struct elan_tp_data *data)
>  
>  static int elan_query_device_info(struct elan_tp_data *data)
>  {
> - int error;
> + 

[PATCH] Input: elan_i2c - Add new ic and modify some functions for new IC infomation Signed-off-by: KT Liao <kt.l...@emc.com.tw>

2016-11-17 Thread KT Liao
---
 drivers/input/mouse/elan_i2c.h   |  6 ++--
 drivers/input/mouse/elan_i2c_core.c  | 46 ++
 drivers/input/mouse/elan_i2c_i2c.c   | 63 ++--
 drivers/input/mouse/elan_i2c_smbus.c | 11 +--
 4 files changed, 99 insertions(+), 27 deletions(-)
 mode change 100644 => 100755 drivers/input/mouse/elan_i2c.h
 mode change 100644 => 100755 drivers/input/mouse/elan_i2c_core.c
 mode change 100644 => 100755 drivers/input/mouse/elan_i2c_i2c.c
 mode change 100644 => 100755 drivers/input/mouse/elan_i2c_smbus.c

diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
old mode 100644
new mode 100755
index c0ec261..a90df14
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -56,9 +56,10 @@ struct elan_transport_ops {
int (*get_baseline_data)(struct i2c_client *client,
 bool max_baseliune, u8 *value);
 
-   int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
+   int (*get_version)(struct i2c_client *client,
+  bool iap, u8 *version, u8 pattern);
int (*get_sm_version)(struct i2c_client *client,
- u8* ic_type, u8 *version);
+ u16 *ic_type, u8 *version, u8 pattern);
int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
int (*get_product_id)(struct i2c_client *client, u16 *id);
 
@@ -82,6 +83,7 @@ struct elan_transport_ops {
int (*get_report)(struct i2c_client *client, u8 *report);
int (*get_pressure_adjustment)(struct i2c_client *client,
   int *adjustment);
+   int (*get_pattern)(struct i2c_client *client, u8 *pattern);
 };
 
 extern const struct elan_transport_ops elan_smbus_ops, elan_i2c_ops;
diff --git a/drivers/input/mouse/elan_i2c_core.c 
b/drivers/input/mouse/elan_i2c_core.c
old mode 100644
new mode 100755
index d15b338..bb0c832
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -5,7 +5,7 @@
  *
  * Author: 林政維 (Duson Lin) 
  * Author: KT Liao 
- * Version: 1.6.2
+ * Version: 1.6.3
  *
  * Based on cyapa driver:
  * copyright (c) 2011-2012 Cypress Semiconductor, Inc.
@@ -41,7 +41,7 @@
 #include "elan_i2c.h"
 
 #define DRIVER_NAME"elan_i2c"
-#define ELAN_DRIVER_VERSION"1.6.2"
+#define ELAN_DRIVER_VERSION"1.6.3"
 #define ELAN_VENDOR_ID 0x04f3
 #define ETP_MAX_PRESSURE   255
 #define ETP_FWIDTH_REDUCE  90
@@ -78,6 +78,7 @@ struct elan_tp_data {
unsigned intx_res;
unsigned inty_res;
 
+   u8  pattern;
u16 product_id;
u8  fw_version;
u8  sm_version;
@@ -85,7 +86,7 @@ struct elan_tp_data {
u16 fw_checksum;
int pressure_adjustment;
u8  mode;
-   u8  ic_type;
+   u16 ic_type;
u16 fw_validpage_count;
u16 fw_signature_address;
 
@@ -96,10 +97,10 @@ struct elan_tp_data {
boolbaseline_ready;
 };
 
-static int elan_get_fwinfo(u8 iap_version, u16 *validpage_count,
+static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
   u16 *signature_address)
 {
-   switch (iap_version) {
+   switch (ic_type) {
case 0x00:
case 0x06:
case 0x08:
@@ -119,6 +120,9 @@ static int elan_get_fwinfo(u8 iap_version, u16 
*validpage_count,
case 0x0E:
*validpage_count = 640;
break;
+   case 0x10:
+   *validpage_count = 1024;
+   break;
default:
/* unknown ic type clear value */
*validpage_count = 0;
@@ -204,12 +208,17 @@ static int elan_query_product(struct elan_tp_data *data)
 {
int error;
 
+   error = data->ops->get_pattern(data->client, >pattern);
+   if (error)
+   return error;
+
error = data->ops->get_product_id(data->client, >product_id);
if (error)
return error;
 
error = data->ops->get_sm_version(data->client, >ic_type,
- >sm_version);
+   >sm_version, data->pattern);
+
if (error)
return error;
 
@@ -302,9 +311,10 @@ static int elan_initialize(struct elan_tp_data *data)
 
 static int elan_query_device_info(struct elan_tp_data *data)
 {
-   int error;
+   int error, ic_type;
 
-   error = data->ops->get_version(data->client, false, >fw_version);
+   error = data->ops->get_version(data->client, false, >fw_version,
+  data->pattern);
if (error)