Re: [PATCH 1/7] input: cyapa: change strings of gen5 to pip in the name when they are shared

2015-06-12 Thread Jeremiah Mahler
Dudley,

Just noticed a few spelling errors...

On Fri, Jun 12, 2015 at 02:56:32PM +0800, Dudley Du wrote:
> Change strings 'gen5' to 'pip' for all macros, varibales and functions when
 sp: ^

> they are shared to be used in for gen5 and gen6 modules. The change of these
> strings is aimed to keep name definition much more clear and readable.
> TEST=test on Chromebook.
> 
> Signed-off-by: Dudley Du 
> ---
>  drivers/input/mouse/cyapa.c  |   22 +-
>  drivers/input/mouse/cyapa.h  |  133 -
>  drivers/input/mouse/cyapa_gen3.c |2 +-
>  drivers/input/mouse/cyapa_gen5.c | 1092 
> ++
>  4 files changed, 661 insertions(+), 588 deletions(-)
> 
> diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> index efe1484..e7d4226 100644
> --- a/drivers/input/mouse/cyapa.c
> +++ b/drivers/input/mouse/cyapa.c
> @@ -6,7 +6,7 @@
>   *   Daniel Kurtz 
>   *   Benson Leung 
>   *
[...]
>   /* Size of packet not including output report register address */
>   __le16 length;
> @@ -352,7 +298,7 @@ struct gen5_app_cmd_head {
>   u8 parameter_data[0];  /* Parameter data variable based on cmd_code */
>  } __packed;
>  
> -/* Application get/set parameter command data structure */
> +/* Applicaton get/set parameter command data structure */
sp:   ^^

>  struct gen5_app_set_parameter_data {
>   u8 parameter_id;
>   u8 parameter_size;
> @@ -369,30 +315,26 @@ struct gen5_retrieve_panel_scan_data {
>   u8 data_id;
>  } __packed;
[...]
> + pip->irq_cmd_buf, length))) {
>   /*
> -  * Work around the Gen5 V1 firmware
> -  * that does not assert interrupt signalling
> -  * that command response is ready if user
> -  * keeps touching the trackpad while command
> -  * is sent to the device.
> +  * Cover the Gen5 V1 firmware issue.
> +  * The issue is there is no interrut will be
sp: 

> +  * asserted to notityf host to read a command
   sp: ^^^

> +  * data out when always has finger touch on
> +  * trackpad during the command is issued to
> +  * trackad device.
   sp: ^^^

> +  * This issue has the scenario is that,
> +  * user always has his fingers touched on
> +  * trackpad device when booting/rebooting
> +  * their chrome book.
>*/

The wording in the above section could be improved as well.


>   length = 0;
> - if (gen5_pip->resp_len)
> - length = *gen5_pip->resp_len;
> + if (pip->resp_len)
> + length = *pip->resp_len;
>   cyapa_empty_pip_output_data(cyapa,
> - gen5_pip->resp_data,
[...]

-- 
- Jeremiah Mahler
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/7] input: cyapa: change strings of gen5 to pip in the name when they are shared

2015-06-12 Thread Dudley Du
Change strings 'gen5' to 'pip' for all macros, varibales and functions when
they are shared to be used in for gen5 and gen6 modules. The change of these
strings is aimed to keep name definition much more clear and readable.
TEST=test on Chromebook.

Signed-off-by: Dudley Du 
---
 drivers/input/mouse/cyapa.c  |   22 +-
 drivers/input/mouse/cyapa.h  |  133 -
 drivers/input/mouse/cyapa_gen3.c |2 +-
 drivers/input/mouse/cyapa_gen5.c | 1092 ++
 4 files changed, 661 insertions(+), 588 deletions(-)

diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index efe1484..e7d4226 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -6,7 +6,7 @@
  *   Daniel Kurtz 
  *   Benson Leung 
  *
- * Copyright (C) 2011-2014 Cypress Semiconductor, Inc.
+ * Copyright (C) 2011-2015 Cypress Semiconductor, Inc.
  * Copyright (C) 2011-2012 Google, Inc.
  *
  * This file is subject to the terms and conditions of the GNU General Public
@@ -39,11 +39,27 @@ const char product_id[] = "CYTRA";
 
 static int cyapa_reinitialize(struct cyapa *cyapa);
 
-static inline bool cyapa_is_bootloader_mode(struct cyapa *cyapa)
+bool cyapa_is_pip_bl_mode(struct cyapa *cyapa)
 {
if (cyapa->gen == CYAPA_GEN5 && cyapa->state == CYAPA_STATE_GEN5_BL)
return true;
 
+   return false;
+}
+
+bool cyapa_is_pip_app_mode(struct cyapa *cyapa)
+{
+   if (cyapa->gen == CYAPA_GEN5 && cyapa->state == CYAPA_STATE_GEN5_APP)
+   return true;
+
+   return false;
+}
+
+static inline bool cyapa_is_bootloader_mode(struct cyapa *cyapa)
+{
+   if (cyapa_is_pip_bl_mode(cyapa))
+   return true;
+
if (cyapa->gen == CYAPA_GEN3 &&
cyapa->state >= CYAPA_STATE_BL_BUSY &&
cyapa->state <= CYAPA_STATE_BL_ACTIVE)
@@ -54,7 +70,7 @@ static inline bool cyapa_is_bootloader_mode(struct cyapa 
*cyapa)
 
 static inline bool cyapa_is_operational_mode(struct cyapa *cyapa)
 {
-   if (cyapa->gen == CYAPA_GEN5 && cyapa->state == CYAPA_STATE_GEN5_APP)
+   if (cyapa_is_pip_app_mode(cyapa))
return true;
 
if (cyapa->gen == CYAPA_GEN3 && cyapa->state == CYAPA_STATE_OP)
diff --git a/drivers/input/mouse/cyapa.h b/drivers/input/mouse/cyapa.h
index adc9ed5..e932d1c 100644
--- a/drivers/input/mouse/cyapa.h
+++ b/drivers/input/mouse/cyapa.h
@@ -3,7 +3,7 @@
  *
  * Author: Dudley Du 
  *
- * Copyright (C) 2014 Cypress Semiconductor, Inc.
+ * Copyright (C) 2014-2015 Cypress Semiconductor, Inc.
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file COPYING in the main directory of this archive for
@@ -159,12 +159,86 @@
 
 #define AUTOSUSPEND_DELAY   2000 /* unit : ms */
 
-#define UNINIT_SLEEP_TIME 0x
-#define UNINIT_PWR_MODE   0xFF
-
 #define BTN_ONLY_MODE_NAME   "buttononly"
 #define OFF_MODE_NAME"off"
 
+/* Common macros for PIP interface. */
+#define PIP_HID_DESCRIPTOR_ADDR0x0001
+#define PIP_REPORT_DESCRIPTOR_ADDR 0x0002
+#define PIP_INPUT_REPORT_ADDR  0x0003
+#define PIP_OUTPUT_REPORT_ADDR 0x0004
+#define PIP_CMD_DATA_ADDR  0x0006
+
+#define PIP_RETERIVE_DATA_STRUCTURE0x24
+#define PIP_CMD_CALIBRATE  0x28
+#define PIP_BL_CMD_VERIFY_APP_INTEGRITY0x31
+#define PIP_BL_CMD_GET_BL_INFO 0x38
+#define PIP_BL_CMD_PROGRAM_VERIFY_ROW  0x39
+#define PIP_BL_CMD_LAUNCH_APP  0x3b
+#define PIP_BL_CMD_INITIATE_BL 0x48
+#define PIP_INVALID_CMD0xff
+
+#define PIP_HID_DESCRIPTOR_SIZE32
+#define PIP_HID_APP_REPORT_ID  0xf7
+#define PIP_HID_BL_REPORT_ID   0xff
+
+#define PIP_BL_CMD_REPORT_ID   0x40
+#define PIP_BL_RESP_REPORT_ID  0x30
+#define PIP_APP_CMD_REPORT_ID  0x2f
+#define PIP_APP_RESP_REPORT_ID 0x1f
+
+#define PIP_READ_SYS_INFO_CMD_LENGTH   7
+#define PIP_BL_READ_APP_INFO_CMD_LENGTH13
+#define PIP_MIN_BL_CMD_LENGTH  13
+#define PIP_MIN_BL_RESP_LENGTH 11
+#define PIP_MIN_APP_CMD_LENGTH 7
+#define PIP_MIN_APP_RESP_LENGTH5
+#define PIP_UNSUPPORTED_CMD_RESP_LENGTH6
+#define PIP_READ_SYS_INFO_RESP_LENGTH  71
+#define PIP_BL_APP_INFO_RESP_LENGTH30
+#define PIP_BL_GET_INFO_RESP_LENGTH19
+
+#define PIP_PRODUCT_FAMILY_MASK0xf000
+#define PIP_PRODUCT_FAMILY_TRACKPAD0x1000
+
+#define PIP_DEEP_SLEEP_STATE_ON0x00
+#define PIP_DEEP_SLEEP_STATE_OFF   0x01
+#define PIP_DEEP_SLEEP_STATE_MASK  0x03
+#define PIP_APP_DEEP_SLEEP_REPORT_ID   0xf0
+#define PIP_DEEP_SLEEP_RESP_LENGTH 5
+#define PIP_DEEP_SLEEP_OPCODE  0x08
+#define PIP_DEEP_SLEEP_OPCODE_MASK 0x0f
+
+#define PIP_RESP_LENGTH_OFFSET 0
+#definePIP_RESP_LENGTH_SIZE2
+#define PIP_RESP_REPORT_ID_OFFSET  2
+#define PIP_RESP_RSVD_OFFSET   3
+#define