summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormasonwang <masonwang@google.com>2021-07-27 18:15:04 +0800
committermasonwang <masonwang@google.com>2021-07-27 18:16:08 +0800
commitc4f998d424f1fd2ef0743a1b6656cc307758d955 (patch)
treecd75c7931cfe2327607fb0174b10160dd5c977f9
parentcdc58ea5242971d8a7995f98627db5fe4d0a589b (diff)
downloadhimax_touch-c4f998d424f1fd2ef0743a1b6656cc307758d955.tar.gz
touch/himax: fix BB on kernel 5.10.
Because on Kernel 5.10, the vendor code should not write/read for any file operation in kernel side. Vendor only allows to use request_firwmare() for security. Bug: 192510777 Bug: 191845294 Test: Build pass Signed-off-by: masonwang <masonwang@google.com> Change-Id: Ie6e6508c75956186bac702c0f035d791ebe84568
-rw-r--r--himax_common.c26
-rw-r--r--himax_common.h11
-rw-r--r--himax_debug.c49
-rw-r--r--himax_ic_incell_core.c13
-rw-r--r--himax_inspection.c103
-rw-r--r--himax_platform.c10
6 files changed, 35 insertions, 177 deletions
diff --git a/himax_common.c b/himax_common.c
index 7b4584c..861859d 100644
--- a/himax_common.c
+++ b/himax_common.c
@@ -143,11 +143,6 @@ EXPORT_SYMBOL(g_target_report_data);
static void himax_report_all_leave_event(struct himax_ts_data *ts);
/*ts_work about end*/
-struct filename* (*kp_getname_kernel)(const char *filename);
-void (*kp_putname_kernel)(struct filename *name);
-struct file* (*kp_file_open_name)(struct filename *name,
- int flags, umode_t mode);
-
unsigned long FW_VER_MAJ_FLASH_ADDR;
EXPORT_SYMBOL(FW_VER_MAJ_FLASH_ADDR);
@@ -3019,27 +3014,6 @@ int himax_chip_common_init(void)
struct himax_ts_data *ts = private_ts;
struct himax_platform_data *pdata;
-
-
- I("Prepare kernel fp\n");
- kp_getname_kernel = (void *)symbol_get("getname_kernel");
- if (!kp_getname_kernel) {
- E("prepare kp_getname_kernel failed!\n");
- /*goto err_xfer_buff_fail;*/
- }
-
- kp_putname_kernel = (void *)symbol_get("putname");
- if (!kp_putname_kernel) {
- E("prepare kp_putname_kernel failed!\n");
- /*goto err_xfer_buff_fail;*/
- }
-
- kp_file_open_name = (void *)symbol_get("file_open_name");
- if (!kp_file_open_name) {
- E("prepare kp_file_open_name failed!\n");
- /*goto err_xfer_buff_fail;*/
- }
-
ts->xfer_buff = devm_kzalloc(ts->dev, 128 * sizeof(uint8_t),
GFP_KERNEL);
if (ts->xfer_buff == NULL) {
diff --git a/himax_common.h b/himax_common.h
index cc4e3ab..f879a91 100644
--- a/himax_common.h
+++ b/himax_common.h
@@ -38,6 +38,7 @@
#include "himax_platform.h"
#include <linux/kallsyms.h>
#include <linux/version.h>
+#include <linux/time64.h>
#if defined(CONFIG_OF)
#include <linux/of_gpio.h>
@@ -115,7 +116,6 @@ extern struct drm_panel gNotifier_dummy_panel;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
#define KERNEL_VER_ABOVE_5_10
-#include <linux/time64.h>
#endif
#if defined(HX_ZERO_FLASH)
@@ -332,8 +332,8 @@ enum cell_type {
#endif
enum fix_touch_info {
- FIX_HX_RX_NUM = 48,
- FIX_HX_TX_NUM = 32,
+ FIX_HX_RX_NUM = 40,
+ FIX_HX_TX_NUM = 28,
FIX_HX_BT_NUM = 0,
FIX_HX_MAX_PT = 10,
FIX_HX_INT_IS_EDGE = true,
@@ -598,11 +598,6 @@ extern uint32_t g_hx_chip_inited;
int himax_chip_common_suspend(struct himax_ts_data *ts);
int himax_chip_common_resume(struct himax_ts_data *ts);
-extern struct filename* (*kp_getname_kernel)(const char *filename);
-extern void (*kp_putname_kernel)(struct filename *name);
-extern struct file * (*kp_file_open_name)(struct filename *name,
- int flags, umode_t mode);
-
struct himax_core_fp;
extern struct himax_core_fp g_core_fp;
extern struct himax_ts_data *private_ts;
diff --git a/himax_debug.c b/himax_debug.c
index a442225..43c34ae 100644
--- a/himax_debug.c
+++ b/himax_debug.c
@@ -2100,12 +2100,6 @@ static int himax_flash_dump_show(struct seq_file *s, void *v)
uint8_t flash_progress = g_flash_progress;
// uint8_t flash_cmd = g_dump_show;
bool flash_rst = g_flash_dump_rst;
-#if !defined(KERNEL_VER_ABOVE_5_10)
- mm_segment_t fs;
-#endif
- struct file *fn = NULL;
- struct filename *vts_name = NULL;
- loff_t pos = 0;
I("dump_progress = %d\n", flash_progress);
@@ -2130,38 +2124,6 @@ static int himax_flash_dump_show(struct seq_file *s, void *v)
if (i % 16 == 15)
seq_puts(s, "\n");
}
- } else if (g_dump_show == 1) {
- I("Now Save to file!\n");
- if (!kp_getname_kernel && !kp_file_open_name) {
- E("kp_getname_kernel or kp_file_open_name is NULL, not open file!\n");
- } else {
-
- vts_name = kp_getname_kernel(g_file_path);
- I("Now vts_name=%s\n", vts_name->name);
- fn = kp_file_open_name(vts_name,
- O_TRUNC|O_CREAT|O_RDWR, 0660);
-
- if (IS_ERR(fn)) {
- E("%s Open file failed!\n", __func__);
- g_flash_dump_rst = false;
- } else {
- I("%s create file and ready to write\n",
- __func__);
-#if defined(KERNEL_VER_ABOVE_5_10)
- kernel_write(fn, g_dump_buffer,
- ic_data->flash_size * sizeof(uint8_t), &pos);
- filp_close(fn, NULL);
-#else
- fs = get_fs();
- set_fs(KERNEL_DS);
- vfs_write(fn, g_dump_buffer,
- ic_data->flash_size * sizeof(uint8_t), &pos);
- filp_close(fn, NULL);
- set_fs(fs);
-#endif
- }
- }
-
}
seq_puts(s, "DumpEnd\n");
@@ -2978,14 +2940,21 @@ CONTI:
return len;
if (buf[0] == 't') {
+ /* Update firmware */
debug_level_cmd = buf[0];
hx_node_update(buf, len);
- } else if (buf[0] == 'c' && buf[1] == 't' && buf[2] == 'i') {
+ } else if (buf[0] == 'c' && buf[1] == 't' && buf[2] == 'i') {
/* Compare Touch Information */
g_core_fp.fp_tp_info_check();
goto ENDFUCTION;
+#if !defined(HX_ZERO_FLASH)
+ } else if (buf[0] == 'e' && buf[1] == 'c') {
+ /* Erase firmware */
+ g_core_fp.fp_sense_off(true);
+ g_core_fp.fp_chip_erase();
+#endif
} else {
- /* others,do nothing */
+ /* others, do nothing */
debug_level_cmd = 0;
}
diff --git a/himax_ic_incell_core.c b/himax_ic_incell_core.c
index dc746ed..2cc443d 100644
--- a/himax_ic_incell_core.c
+++ b/himax_ic_incell_core.c
@@ -3765,19 +3765,6 @@ void himax_mcu_read_all_sram(uint8_t *addr, int read_len)
*}
*/
- /* need modify
- * I("Now Write File start!\n");
- * vts_name = kp_getname_kernel("/sdcard/dump_dsram.txt");
- * fn = kp_file_open_name(vts_name, O_CREAT | O_WRONLY, 0);
- * if (!IS_ERR (fn)) {
- * I("%s create file and ready to write\n", __func__);
- * fn->f_op->write(fn, temp_info_data, read_len*sizeof (uint8_t),
- * &fn->f_pos);
- * filp_close (fn, NULL);
- * }
- * I("Now Write File End!\n");
- */
-
kfree(temp_info_data);
I("%s, END\n", __func__);
diff --git a/himax_inspection.c b/himax_inspection.c
index 6532bb5..af2b122 100644
--- a/himax_inspection.c
+++ b/himax_inspection.c
@@ -234,9 +234,14 @@ static int hx_test_data_get(int RAW[], char *start_log, char *result,
}
len += snprintf((testdata + len), SZ_SIZE - len, "\n%s", result);
- memcpy(&g_rslt_data[0], testdata, len);
- g_rslt_data_len = len;
- I("%s: g_rslt_data_len=%d!\n", __func__, g_rslt_data_len);
+ if (g_rslt_data_len + len <= g_1kind_raw_size * HX_CRITERIA_ITEM - 1) {
+ memcpy(&g_rslt_data[g_rslt_data_len], testdata, len);
+ g_rslt_data_len += len;
+ I("%s: g_rslt_data_len=%d!\n", __func__, g_rslt_data_len);
+ } else {
+ E("%s: g_rslt_data_len=%d + len=%d over than %d.\n", __func__,
+ g_rslt_data_len, len, g_1kind_raw_size * HX_CRITERIA_ITEM);
+ }
/* dbg */
/* for(i = 0; i < SZ_SIZE; i++)
@@ -2405,9 +2410,14 @@ static void hx_print_fw_info(void)
"Project = %s\n", proj_info);
}
- memcpy(&g_rslt_data[0], prt_data, len);
- g_rslt_data_len = len;
- I("%s: g_rslt_data_len=%d!\n", __func__, g_rslt_data_len);
+ if (g_rslt_data_len + len <= g_1kind_raw_size * HX_CRITERIA_ITEM - 1) {
+ memcpy(&g_rslt_data[g_rslt_data_len], prt_data, len);
+ g_rslt_data_len += len;
+ I("%s: g_rslt_data_len=%d!\n", __func__, g_rslt_data_len);
+ } else {
+ E("%s: g_rslt_data_len=%d + len=%d over than %d.\n", __func__,
+ g_rslt_data_len, len, g_1kind_raw_size * HX_CRITERIA_ITEM);
+ }
kfree(prt_data);
}
@@ -2473,7 +2483,7 @@ static int himax_self_test_data_init(void)
g_rslt_data_len = 0;
if (g_rslt_data == NULL) {
- g_rslt_data = kcalloc(g_1kind_raw_size, sizeof(char),
+ g_rslt_data = kcalloc(g_1kind_raw_size * HX_CRITERIA_ITEM, sizeof(char),
GFP_KERNEL);
if (g_rslt_data == NULL) {
E("%s,%d: Memory allocation falied!\n",
@@ -2497,7 +2507,7 @@ static int himax_self_test_data_init(void)
I("%s: initialize g_rslt_data, length = %d\n",
__func__, g_1kind_raw_size);
- memset(g_rslt_data, 0x00, g_1kind_raw_size * sizeof(char));
+ memset(g_rslt_data, 0x00, g_1kind_raw_size * sizeof(char));
/* default path is /system/etc/firmware */
/* request criteria file*/
@@ -2611,12 +2621,6 @@ static int himax_chip_self_test(struct seq_file *s, void *v)
uint8_t tmp_addr[DATA_LEN_4] = {0x94, 0x72, 0x00, 0x10};
uint8_t tmp_data[DATA_LEN_4] = {0x01, 0x00, 0x00, 0x00};
#endif
- struct file *raw_file = NULL;
- struct filename *vts_name = NULL;
-#if !defined(KERNEL_VER_ABOVE_5_10)
- mm_segment_t fs;
-#endif
- loff_t pos = 0;
uint32_t rslt = HX_INSP_OK;
I("%s:IN\n", __func__);
@@ -2642,35 +2646,6 @@ static int himax_chip_self_test(struct seq_file *s, void *v)
}
#endif
- if (!kp_getname_kernel) {
- E("kp_getname_kernel is NULL, not open file!\n");
- file_w_flag = false;
- } else
- vts_name = kp_getname_kernel(g_file_path);
-
- if (!kp_file_open_name && raw_file == NULL && file_w_flag) {
- raw_file = kp_file_open_name(vts_name,
- O_TRUNC|O_CREAT|O_RDWR, 0660);
-
- if (IS_ERR(raw_file)) {
- E("%s open file failed = %ld\n",
- __func__, PTR_ERR(raw_file));
- file_w_flag = false;
- }
- }
-#if !defined(KERNEL_VER_ABOVE_5_10)
- fs = get_fs();
- set_fs(KERNEL_DS);
-#endif
- if (file_w_flag) {
-#if defined(KERNEL_VER_ABOVE_5_10)
- kernel_write(raw_file, g_rslt_data, g_rslt_data_len, &pos);
-#else
- vfs_write(raw_file, g_rslt_data, g_rslt_data_len, &pos);
-#endif
- pos += g_rslt_data_len;
- }
-
/*Do normal test items*/
for (i = 0; i < HX_CRITERIA_ITEM; i++) {
if (i < HX_LP_WT_NOISE) {
@@ -2678,18 +2653,6 @@ static int himax_chip_self_test(struct seq_file *s, void *v)
I("%d. %s Start\n", i,
g_himax_inspection_mode[i]);
rslt = mpTestFunc(i, test_size);
- if (file_w_flag &&
- ((rslt & HX_INSP_EGETRAW) == 0) &&
- ((rslt & HX_INSP_ESWITCHMODE) == 0)) {
-#if defined(KERNEL_VER_ABOVE_5_10)
- kernel_write(raw_file, g_rslt_data,
- g_rslt_data_len, &pos);
-#else
- vfs_write(raw_file, g_rslt_data,
- g_rslt_data_len, &pos);
-#endif
- pos += g_rslt_data_len;
- }
ret |= rslt;
I("%d. %s End, ret = %d\n", i,
@@ -2719,18 +2682,6 @@ static int himax_chip_self_test(struct seq_file *s, void *v)
I("%d.%s Start\n", i,
g_himax_inspection_mode[i]);
rslt = mpTestFunc(i, test_size);
- if (file_w_flag &&
- ((rslt & HX_INSP_EGETRAW) == 0) &&
- ((rslt & HX_INSP_ESWITCHMODE) == 0)) {
-#if defined(KERNEL_VER_ABOVE_5_10)
- kernel_write(raw_file, g_rslt_data,
- g_rslt_data_len, &pos);
-#else
- vfs_write(raw_file, g_rslt_data,
- g_rslt_data_len, &pos);
-#endif
- pos += g_rslt_data_len;
- }
ret |= rslt;
I("%d.%s End\n", i, g_himax_inspection_mode[i]);
@@ -2756,27 +2707,9 @@ SELF_TEST_FAIL:
/* output FW version */
#if defined(HX_ZERO_FLASH)
hx_print_fw_info();
-#if defined(KERNEL_VER_ABOVE_5_10)
- kernel_write(raw_file, g_rslt_data, g_rslt_data_len, &pos);
-#else
- vfs_write(raw_file, g_rslt_data, g_rslt_data_len, &pos);
-#endif
- pos += g_rslt_data_len;
#endif
}
- if (file_w_flag)
- filp_close(raw_file, NULL);
- if (!kp_putname_kernel) {
- E("kp_putname_kernel is NULL, not open file!\n");
- file_w_flag = false;
- } else if (file_w_flag != false)
- kp_putname_kernel(vts_name);
-
-#if !defined(KERNEL_VER_ABOVE_5_10)
- set_fs(fs);
-#endif
-
#if defined(HX_ZERO_FLASH)
UPDATE_MPFW_FAIL:
g_core_fp.fp_0f_op_file_dirly(g_fw_boot_upgrade_name);
diff --git a/himax_platform.c b/himax_platform.c
index f4bf58a..c207533 100644
--- a/himax_platform.c
+++ b/himax_platform.c
@@ -147,7 +147,7 @@ int himax_ts_check_dt(struct device_node *np)
int himax_parse_dt(struct himax_ts_data *ts, struct himax_platform_data *pdata)
{
- int rc, coords_size = 0;
+ int coords_size = 0;
uint32_t coords[4] = {0};
struct property *prop;
struct device_node *dt = ts->dev->of_node;
@@ -191,11 +191,11 @@ int himax_parse_dt(struct himax_ts_data *ts, struct himax_platform_data *pdata)
__func__, coords_size);
}
- rc = of_property_read_u32_array(dt, "himax,display-coords",
+ ret = of_property_read_u32_array(dt, "himax,display-coords",
coords, coords_size);
- if (rc && (rc != -EINVAL)) {
- D(" %s:Fail to read display-coords %d\n", __func__, rc);
- return rc;
+ if (ret && (ret != -EINVAL)) {
+ D(" %s:Fail to read display-coords %d\n", __func__, ret);
+ return ret;
}
pdata->screenWidth = coords[1];
pdata->screenHeight = coords[3];