Merge "(CR):[Kane]kernel:add frimware upgrade status node" into huaqin/exynos9609
authorhq_qiaoquanbin_tmp <qiaoquanbin@huaqin.com>
Sat, 3 Nov 2018 02:01:17 +0000 (10:01 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:29:53 +0000 (17:29 +0800)
Change-Id: I0dccabbb98129b54a159474052d5b520c00a1c2b
Signed-off-by: hq_qiaoquanbin_tmp <qiaoquanbin@huaqin.com>
drivers/input/touchscreen/hxchipset/himax_common.c
drivers/input/touchscreen/hxchipset/himax_common.h
drivers/input/touchscreen/hxchipset/himax_debug.c
drivers/input/touchscreen/hxchipset/himax_debug.h

index 98867c9b57ae0644d44a1057800fb87b8075344e..82fbe9543b6f1acc3a54b667dacb7261ae48f9fe 100755 (executable)
@@ -705,11 +705,12 @@ static int himax_auto_update_check(void)
 {
        I("%s:Entering!\n", __func__);
        if (g_core_fp.fp_fw_ver_bin() == 0) {
-               if (((ic_data->vendor_fw_ver < g_i_FW_VER) || (ic_data->vendor_config_ver < g_i_CFG_VER))) {
+               if (((ic_data->vendor_fw_ver != g_i_FW_VER) || (ic_data->vendor_config_ver != g_i_CFG_VER))) {
                        I("Need to update!\n");
                        return NO_ERR;
                }       else {
                        I("No need to update!\n");
+                       private_ts->fw_upgrade_status = NO_ERR;
                        return 1;
                }
        } else {
@@ -773,11 +774,13 @@ update_retry:
                        goto update_retry;
                }       else {
                        result = -1;
+                       private_ts->fw_upgrade_status = FW_NOT_READY;
                } /*upgrade fail*/
        } else {
                g_core_fp.fp_read_FW_ver();
                g_core_fp.fp_touch_information();
                result = 1;/*upgrade success*/
+               private_ts->fw_upgrade_status = READY_TO_SERVE;
                I("%s: TP upgrade OK\n", __func__);
        }
 
@@ -2168,6 +2171,11 @@ static int himax_fw_updater (struct himax_ts_data *ts, const char *fileName) {
                E("%s: Flash command fail: %d\n", __func__, __LINE__);
                break;
        }
+       if (result == 0)
+               private_ts->fw_upgrade_status = FW_NOT_READY;
+       else
+               private_ts->fw_upgrade_status = READY_TO_SERVE;
+
        release_firmware(fw);
        g_core_fp.fp_read_FW_ver();
        g_core_fp.fp_touch_information();
index b230d1dfa23bf9b9d98132b6e10ece617bacd043..ae99bf5bc0e32782d76ef3f4c8ed20a38da82509 100755 (executable)
@@ -296,6 +296,7 @@ struct himax_ts_data {
 
 
        uint32_t debug_log_level;
+       int fw_upgrade_status;
        uint32_t widthFactor;
        uint32_t heightFactor;
        uint32_t tw_x_min;
index 1050e903fdaf1ca0839051315f7d59c2e7695040..4db8d0a5596a55ec2eb0b5b3315d9fdc5c4db9e5 100755 (executable)
@@ -1815,6 +1815,11 @@ static ssize_t himax_debug_write(struct file *file, const char *buff,
                        fw_update_complete = false;
                        break;
                }
+               if (fw_update_complete != true)
+                       private_ts->fw_upgrade_status = FW_NOT_READY;
+               else
+                       private_ts->fw_upgrade_status = READY_TO_SERVE;
+
                release_firmware(fw);
                goto firmware_upgrade_done;
 #endif
@@ -2344,7 +2349,35 @@ void himax_ts_flash_func(void)
        */
 }
 
+static ssize_t himax_fw_upgrade_read(struct file *file, char *buf,
+                                                                               size_t len, loff_t *pos)
+{
+       struct himax_ts_data *ts_data;
+       size_t ret = 0;
+       char *temp_buf;
+       ts_data = private_ts;
+
+       if (*pos != 0)
+               return 0;
+
+       temp_buf = kzalloc(len, GFP_KERNEL);
+       ret = snprintf(temp_buf + ret, len - ret, "%d\n", ts_data->fw_upgrade_status);
+       I("[%s][%d]read:%s\n", __func__, __LINE__, temp_buf);
+
+       if (copy_to_user(buf, temp_buf, len))
+               E("%s,here:%d\n", __func__, __LINE__);
 
+       *pos += ret;
+
+       kfree(temp_buf);
+
+       return ret;
+}
+
+static struct file_operations himax_proc_fw_upgrade_ops = {
+       .owner = THIS_MODULE,
+       .read = himax_fw_upgrade_read,
+};
 
 static ssize_t himax_sense_on_off_write(struct file *file, const char *buff,
                                                                                size_t len, loff_t *pos)
@@ -2575,7 +2608,16 @@ int himax_touch_proc_init(void)
                goto fail_18;
        }
 
+       himax_proc_fw_upgrade_file = proc_create(HIMAX_PROC_FW_UPGRADE_FILE, (S_IWUSR | S_IRUGO),
+                                                                 himax_touch_proc_dir, &himax_proc_fw_upgrade_ops);
+       if (himax_proc_fw_upgrade_file == NULL) {
+               E(" %s: proc fw_upgrade_status file create failed!\n", __func__);
+               goto fail_19;
+       }
+
        return 0 ;
+fail_19:
+       remove_proc_entry(HIMAX_PROC_CRC_TEST_FILE, himax_touch_proc_dir);
 fail_18:
 #ifdef HX_ESD_RECOVERY
        remove_proc_entry(HIMAX_PROC_ESD_CNT_FILE, himax_touch_proc_dir);
index 90d634ec6d9dd9a2d7341c290761d9fa664e5ae6..28646174e452654a37aa5d7c3853e6fdce8293ce 100755 (executable)
@@ -32,6 +32,7 @@
 #define HIMAX_PROC_INT_EN_FILE         "int_en"
 #define HIMAX_PROC_LAYOUT_FILE         "layout"
 #define HIMAX_PROC_CRC_TEST_FILE               "CRC_test"
+#define HIMAX_PROC_FW_UPGRADE_FILE             "fw_upgrade_status"
 
 static struct proc_dir_entry *himax_proc_debug_level_file;
 static struct proc_dir_entry *himax_proc_vendor_file;
@@ -39,6 +40,7 @@ static struct proc_dir_entry *himax_proc_attn_file;
 static struct proc_dir_entry *himax_proc_int_en_file;
 static struct proc_dir_entry *himax_proc_layout_file;
 static struct proc_dir_entry *himax_proc_CRC_test_file;
+static struct proc_dir_entry *himax_proc_fw_upgrade_file;
 
 int himax_touch_proc_init(void);
 void himax_touch_proc_deinit(void);