summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-09-24 02:00:31 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-24 02:00:31 -0700
commit33b8c0517bdbef7ce6eb7e921c6cdb75dc02f829 (patch)
treeeadffe3d3a354ea11b4e74ffab676a14352441ea /drivers
parentaa737148db566cb022d16163b8270a5e618a43c0 (diff)
parent18850432fdce433c55bd1a2f1ce3cc423552cbfd (diff)
Merge "input: touchscreen: Change late_init call to module_init"
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/touchscreen/gt9xx/goodix_tool.c98
-rw-r--r--drivers/input/touchscreen/gt9xx/gt9xx.c220
-rw-r--r--drivers/input/touchscreen/gt9xx/gt9xx.h50
-rw-r--r--drivers/input/touchscreen/gt9xx/gt9xx_update.c492
4 files changed, 446 insertions, 414 deletions
diff --git a/drivers/input/touchscreen/gt9xx/goodix_tool.c b/drivers/input/touchscreen/gt9xx/goodix_tool.c
index c67c4c8f1207..63fad6c46836 100644
--- a/drivers/input/touchscreen/gt9xx/goodix_tool.c
+++ b/drivers/input/touchscreen/gt9xx/goodix_tool.c
@@ -85,7 +85,6 @@ static void tool_set_proc_name(char *procname)
}
snprintf(procname, 20, "gmnode%04d%02d%02d", n_year, n_month, n_day);
- /* GTP_DEBUG("procname = %s", procname); */
}
static s32 tool_i2c_read_no_extra(u8 *buf, u16 len)
@@ -180,11 +179,11 @@ static void register_i2c_func(void)
&& strcmp(IC_TYPE, "GTxxx")) {
tool_i2c_read = tool_i2c_read_with_extra;
tool_i2c_write = tool_i2c_write_with_extra;
- GTP_DEBUG("I2C function: with pre and end cmd!");
+ pr_debug("I2C function: with pre and end cmd!\n");
} else {
tool_i2c_read = tool_i2c_read_no_extra;
tool_i2c_write = tool_i2c_write_no_extra;
- GTP_INFO("I2C function: without pre and end cmd!");
+ pr_info("I2C function: without pre and end cmd!\n");
}
}
@@ -192,7 +191,7 @@ static void unregister_i2c_func(void)
{
tool_i2c_read = NULL;
tool_i2c_write = NULL;
- GTP_INFO("I2C function: unregister i2c transfer function!");
+ pr_info("I2C function: unregister i2c transfer function!\n");
}
s32 init_wr_node(struct i2c_client *client)
@@ -215,7 +214,7 @@ s32 init_wr_node(struct i2c_client *client)
DATA_LENGTH = i * DATA_LENGTH_UINT;
dev_dbg(&client->dev, "Applied memory size:%d.", DATA_LENGTH);
} else {
- GTP_ERROR("Apply for memory failed.");
+ pr_err("Apply for memory failed.\n");
return FAIL;
}
@@ -228,7 +227,7 @@ s32 init_wr_node(struct i2c_client *client)
tool_set_proc_name(procname);
goodix_proc_entry = create_proc_entry(procname, 0660, NULL);
if (goodix_proc_entry == NULL) {
- GTP_ERROR("Couldn't create proc entry!");
+ pr_err("Couldn't create proc entry!\n");
return FAIL;
}
GTP_INFO("Create proc entry success!");
@@ -257,7 +256,7 @@ static u8 relation(u8 src, u8 dst, u8 rlt)
case 1:
ret = (src == dst) ? true : false;
- GTP_DEBUG("equal:src:0x%02x dst:0x%02x ret:%d.",
+ pr_debug("equal:src:0x%02x dst:0x%02x ret:%d.\n",
src, dst, (s32)ret);
break;
@@ -308,14 +307,14 @@ static u8 comfirm(void)
for (i = 0; i < cmd_head.times; i++) {
if (tool_i2c_read(buf, 1) <= 0) {
- GTP_ERROR("Read flag data failed!");
+ pr_err("Read flag data failed!\n");
return FAIL;
}
if (true == relation(buf[GTP_ADDR_LENGTH], cmd_head.flag_val,
cmd_head.flag_relation)) {
- GTP_DEBUG("value at flag addr:0x%02x.",
+ pr_debug("value at flag addr:0x%02x.\n",
buf[GTP_ADDR_LENGTH]);
- GTP_DEBUG("flag value:0x%02x.", cmd_head.flag_val);
+ pr_debug("flag value:0x%02x.\n", cmd_head.flag_val);
break;
}
@@ -323,7 +322,7 @@ static u8 comfirm(void)
}
if (i >= cmd_head.times) {
- GTP_ERROR("Didn't get the flag to continue!");
+ pr_debug("Didn't get the flag to continue!\n");
return FAIL;
}
@@ -344,41 +343,38 @@ static s32 goodix_tool_write(struct file *filp, const char __user *buff,
{
s32 ret = 0;
- GTP_DEBUG_FUNC();
- GTP_DEBUG_ARRAY((u8 *)buff, len);
-
mutex_lock(&lock);
ret = copy_from_user(&cmd_head, buff, CMD_HEAD_LENGTH);
if (ret) {
- GTP_ERROR("copy_from_user failed.");
+ pr_err("copy_from_user failed.\n");
ret = -EACCES;
goto exit;
}
- GTP_DEBUG("wr :0x%02x.", cmd_head.wr);
- GTP_DEBUG("flag:0x%02x.", cmd_head.flag);
- GTP_DEBUG("flag addr:0x%02x%02x.", cmd_head.flag_addr[0],
+ pr_debug("wr :0x%02x.\n", cmd_head.wr);
+ pr_debug("flag:0x%02x.\n", cmd_head.flag);
+ pr_debug("flag addr:0x%02x%02x.\n", cmd_head.flag_addr[0],
cmd_head.flag_addr[1]);
- GTP_DEBUG("flag val:0x%02x.", cmd_head.flag_val);
- GTP_DEBUG("flag rel:0x%02x.", cmd_head.flag_relation);
- GTP_DEBUG("circle :%d.", (s32)cmd_head.circle);
- GTP_DEBUG("times :%d.", (s32)cmd_head.times);
- GTP_DEBUG("retry :%d.", (s32)cmd_head.retry);
- GTP_DEBUG("delay :%d.", (s32)cmd_head.delay);
- GTP_DEBUG("data len:%d.", (s32)cmd_head.data_len);
- GTP_DEBUG("addr len:%d.", (s32)cmd_head.addr_len);
- GTP_DEBUG("addr:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
- GTP_DEBUG("len:%d.", (s32)len);
- GTP_DEBUG("buf[20]:0x%02x.", buff[CMD_HEAD_LENGTH]);
+ pr_debug("flag val:0x%02x.\n", cmd_head.flag_val);
+ pr_debug("flag rel:0x%02x.\n", cmd_head.flag_relation);
+ pr_debug("circle :%d.\n", (s32)cmd_head.circle);
+ pr_debug("times :%d.\n", (s32)cmd_head.times);
+ pr_debug("retry :%d.\n", (s32)cmd_head.retry);
+ pr_debug("delay :%d.\n", (s32)cmd_head.delay);
+ pr_debug("data len:%d.\n", (s32)cmd_head.data_len);
+ pr_debug("addr len:%d.\n", (s32)cmd_head.addr_len);
+ pr_debug("addr:0x%02x%02x.\n", cmd_head.addr[0], cmd_head.addr[1]);
+ pr_debug("len:%d.\n", (s32)len);
+ pr_debug("buf[20]:0x%02x.\n", buff[CMD_HEAD_LENGTH]);
if (cmd_head.data_len > (DATA_LENGTH - GTP_ADDR_LENGTH)) {
- pr_err("data len %d > data buff %d, rejected!\n",
+ pr_debug("data len %d > data buff %d, rejected!\n",
cmd_head.data_len, (DATA_LENGTH - GTP_ADDR_LENGTH));
ret = -EINVAL;
goto exit;
}
if (cmd_head.addr_len > GTP_ADDR_LENGTH) {
- pr_err(" addr len %d > data buff %d, rejected!\n",
+ pr_debug(" addr len %d > data buff %d, rejected!\n",
cmd_head.addr_len, GTP_ADDR_LENGTH);
ret = -EINVAL;
goto exit;
@@ -391,19 +387,14 @@ static s32 goodix_tool_write(struct file *filp, const char __user *buff,
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH],
&buff[CMD_HEAD_LENGTH], cmd_head.data_len);
if (ret)
- GTP_ERROR("copy_from_user failed.");
+ pr_err("copy_from_user failed.\n");
memcpy(&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],
cmd_head.addr, cmd_head.addr_len);
- GTP_DEBUG_ARRAY(cmd_head.data,
- cmd_head.data_len + cmd_head.addr_len);
- GTP_DEBUG_ARRAY((u8 *)&buff[CMD_HEAD_LENGTH],
- cmd_head.data_len);
-
if (cmd_head.flag == 1) {
if (comfirm() == FAIL) {
- GTP_ERROR("[WRITE]Comfirm fail!");
+ pr_err("[WRITE]Comfirm fail!\n");
ret = -EINVAL;
goto exit;
}
@@ -413,14 +404,11 @@ static s32 goodix_tool_write(struct file *filp, const char __user *buff,
if (tool_i2c_write(
&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],
cmd_head.data_len + cmd_head.addr_len) <= 0) {
- GTP_ERROR("[WRITE]Write data failed!");
+ pr_err("[WRITE]Write data failed!\n");
ret = -EIO;
goto exit;
}
- GTP_DEBUG_ARRAY(
- &cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],
- cmd_head.data_len + cmd_head.addr_len);
if (cmd_head.delay)
msleep(cmd_head.delay);
@@ -431,10 +419,10 @@ static s32 goodix_tool_write(struct file *filp, const char __user *buff,
ret = copy_from_user(&cmd_head.data[0], &buff[CMD_HEAD_LENGTH],
cmd_head.data_len);
if (ret)
- GTP_ERROR("copy_from_user failed.");
+ pr_err("copy_from_user failed.\n");
if (cmd_head.data_len > sizeof(IC_TYPE)) {
- pr_err("<<-GTP->> data len %d > data buff %d, rejected!\n",
+ pr_debug("<<-GTP->> data len %d > data buff %d, rejected!\n",
cmd_head.data_len, sizeof(IC_TYPE));
ret = -EINVAL;
goto exit;
@@ -473,13 +461,13 @@ static s32 goodix_tool_write(struct file *filp, const char __user *buff,
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH],
&buff[CMD_HEAD_LENGTH], cmd_head.data_len);
if (ret)
- GTP_DEBUG("copy_from_user failed.");
+ pr_debug("copy_from_user failed.\n");
if (cmd_head.data[GTP_ADDR_LENGTH]) {
- GTP_DEBUG("gtp enter rawdiff.");
+ pr_debug("gtp enter rawdiff.\n");
ts->gtp_rawdiff_mode = true;
} else {
ts->gtp_rawdiff_mode = false;
- GTP_DEBUG("gtp leave rawdiff.");
+ pr_debug("gtp leave rawdiff.\n");
}
ret = CMD_HEAD_LENGTH;
goto exit;
@@ -495,7 +483,7 @@ static s32 goodix_tool_write(struct file *filp, const char __user *buff,
show_len = 0;
total_len = 0;
if (cmd_head.data_len + 1 > DATA_LENGTH) {
- pr_err("<<-GTP->> data len %d > data buff %d, rejected!\n",
+ pr_debug("<<-GTP->> data len %d > data buff %d, rejected!\n",
cmd_head.data_len + 1, DATA_LENGTH);
ret = -EINVAL;
goto exit;
@@ -530,7 +518,6 @@ static s32 goodix_tool_read(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
s32 ret;
- GTP_DEBUG_FUNC();
mutex_lock(&lock);
if (cmd_head.wr % 2) {
@@ -544,7 +531,7 @@ static s32 goodix_tool_read(char *page, char **start, off_t off, int count,
if (cmd_head.flag == 1) {
if (comfirm() == FAIL) {
- GTP_ERROR("[READ]Comfirm fail!");
+ pr_err("[READ]Comfirm fail!\n");
ret = -EINVAL;
goto exit;
}
@@ -554,9 +541,9 @@ static s32 goodix_tool_read(char *page, char **start, off_t off, int count,
memcpy(cmd_head.data, cmd_head.addr, cmd_head.addr_len);
- GTP_DEBUG("[CMD HEAD DATA] ADDR:0x%02x%02x.", cmd_head.data[0],
+ pr_debug("[CMD HEAD DATA] ADDR:0x%02x%02x.\n", cmd_head.data[0],
cmd_head.data[1]);
- GTP_DEBUG("[CMD HEAD ADDR] ADDR:0x%02x%02x.", cmd_head.addr[0],
+ pr_debug("[CMD HEAD ADDR] ADDR:0x%02x%02x.\n", cmd_head.addr[0],
cmd_head.addr[1]);
if (cmd_head.delay)
@@ -572,16 +559,13 @@ static s32 goodix_tool_read(char *page, char **start, off_t off, int count,
data_len -= len;
if (tool_i2c_read(cmd_head.data, len) <= 0) {
- GTP_ERROR("[READ]Read data failed!");
+ pr_err("[READ]Read data failed!\n");
ret = -EINVAL;
goto exit;
}
memcpy(&page[loc], &cmd_head.data[GTP_ADDR_LENGTH],
len);
loc += len;
-
- GTP_DEBUG_ARRAY(&cmd_head.data[GTP_ADDR_LENGTH], len);
- GTP_DEBUG_ARRAY(page, len);
}
} else if (cmd_head.wr == 2) {
/* memcpy(page, "gt8", cmd_head.data_len);
@@ -589,7 +573,7 @@ static s32 goodix_tool_read(char *page, char **start, off_t off, int count,
* page[5] = 0;
*/
- GTP_DEBUG("Return ic type:%s len:%d.", page,
+ pr_debug("Return ic type:%s len:%d.\n", page,
(s32)cmd_head.data_len);
ret = cmd_head.data_len;
goto exit;
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.c b/drivers/input/touchscreen/gt9xx/gt9xx.c
index 6c3747108d75..1522093bd882 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.c
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.c
@@ -77,19 +77,13 @@
#if GTP_HAVE_TOUCH_KEY
static const u16 touch_key_array[] = {KEY_MENU, KEY_HOMEPAGE, KEY_BACK};
-#if GTP_DEBUG_ON
-static const int key_codes[] = {
- KEY_HOME, KEY_BACK, KEY_MENU, KEY_SEARCH
-};
-static const char *const key_names[] = {
- "Key_Home", "Key_Back", "Key_Menu", "Key_Search"
-};
-#endif
#endif
static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms);
static void gtp_int_sync(struct goodix_ts_data *ts, int ms);
static int gtp_i2c_test(struct i2c_client *client);
+static int goodix_power_off(struct goodix_ts_data *ts);
+static int goodix_power_on(struct goodix_ts_data *ts);
#if defined(CONFIG_FB)
static int fb_notifier_callback(struct notifier_block *self,
@@ -493,30 +487,19 @@ static void goodix_ts_work_func(struct work_struct *work)
memcpy(&point_data[12], &buf[2], 8 * (touch_num - 1));
}
-#if GTP_HAVE_TOUCH_KEY
+
key_value = point_data[3 + 8 * touch_num];
if (key_value || pre_key) {
- for (i = 0; i < ARRAY_SIZE(touch_key_array); i++) {
-#if GTP_DEBUG_ON
- for (ret = 0; ret < 4; ++ret) {
- if (key_codes[ret] == touch_key_array[i]) {
- GTP_DEBUG("Key: %s %s",
- key_names[ret],
- (key_value & (0x01 << i))
- ? "Down" : "Up");
- break;
- }
- }
-#endif
-
+ for (i = 0; i < ts->pdata->num_button; i++) {
input_report_key(ts->input_dev,
- touch_key_array[i], key_value & (0x01<<i));
+ ts->pdata->button_map[i],
+ key_value & (0x01<<i));
}
touch_num = 0;
pre_touch = 0;
}
-#endif
+
pre_key = key_value;
#if GTP_WITH_PEN
@@ -754,7 +737,7 @@ Input:
ts: private data.
Output:
Executive outcomes.
- 1: succeed, otherwise failed.
+ >0: succeed, otherwise failed.
*******************************************************/
static s8 gtp_enter_sleep(struct goodix_ts_data *ts)
{
@@ -765,12 +748,28 @@ static s8 gtp_enter_sleep(struct goodix_ts_data *ts)
(u8)GTP_REG_SLEEP, 5};
ret = gpio_direction_output(ts->pdata->irq_gpio, 0);
+ if (ret)
+ dev_err(&ts->client->dev,
+ "GTP sleep: Cannot reconfig gpio %d.\n",
+ ts->pdata->irq_gpio);
+ if (ts->pdata->enable_power_off) {
+ ret = gpio_direction_output(ts->pdata->reset_gpio, 0);
+ if (ret)
+ dev_err(&ts->client->dev,
+ "GTP sleep: Cannot reconfig gpio %d.\n",
+ ts->pdata->reset_gpio);
+ ret = goodix_power_off(ts);
+ if (ret) {
+ dev_err(&ts->client->dev, "GTP power off failed.\n");
+ return 0;
+ }
+ return 1;
+ }
usleep(5000);
while (retry++ < GTP_I2C_RETRY_5) {
ret = gtp_i2c_write(ts->client, i2c_control_buf, 3);
- if (ret > 0) {
- dev_dbg(&ts->client->dev,
- "GTP enter sleep!");
+ if (ret == 1) {
+ dev_dbg(&ts->client->dev, "GTP enter sleep!");
return ret;
}
msleep(20);
@@ -778,7 +777,7 @@ static s8 gtp_enter_sleep(struct goodix_ts_data *ts)
dev_err(&ts->client->dev, "GTP send sleep cmd failed.\n");
return ret;
}
-#endif
+#endif /* !GTP_SLIDE_WAKEUP */
/*******************************************************
Function:
@@ -794,17 +793,36 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts)
u8 retry = 0;
s8 ret = -1;
-#if GTP_POWER_CTRL_SLEEP
- gtp_reset_guitar(ts, 20);
+ if (ts->pdata->enable_power_off) {
+ ret = gpio_direction_output(ts->pdata->irq_gpio, 0);
+ if (ret)
+ dev_err(&ts->client->dev,
+ "GTP wakeup: Cannot reconfig gpio %d.\n",
+ ts->pdata->irq_gpio);
+ ret = gpio_direction_output(ts->pdata->reset_gpio, 0);
+ if (ret)
+ dev_err(&ts->client->dev,
+ "GTP wakeup: Cannot reconfig gpio %d.\n",
+ ts->pdata->reset_gpio);
+ ret = goodix_power_on(ts);
+ if (ret) {
+ dev_err(&ts->client->dev, "GTP power on failed.\n");
+ return 0;
+ }
+
+ gtp_reset_guitar(ts, 20);
+
+ ret = gtp_send_cfg(ts);
+ if (ret <= 0) {
+ dev_err(&ts->client->dev,
+ "GTP wakeup sleep failed.\n");
+ return ret;
+ }
- ret = gtp_send_cfg(ts);
- if (ret > 0) {
dev_dbg(&ts->client->dev,
- "Wakeup sleep send config success.");
- return 1;
- }
-#else
- while (retry++ < GTP_I2C_RETRY_10) {
+ "Wakeup sleep send config success.");
+ } else {
+err_retry:
#if GTP_SLIDE_WAKEUP
/* wakeup not by slide */
if (doze_status != DOZE_WAKEUP)
@@ -821,7 +839,7 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts)
}
#endif
ret = gtp_i2c_test(ts->client);
- if (ret > 0) {
+ if (ret == 2) {
dev_dbg(&ts->client->dev, "GTP wakeup sleep.");
#if (!GTP_SLIDE_WAKEUP)
if (chip_gt9xxs == 0) {
@@ -835,10 +853,10 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts)
return ret;
}
gtp_reset_guitar(ts, 20);
+ if (retry++ < GTP_I2C_RETRY_10)
+ goto err_retry;
+ dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n");
}
-#endif
-
- dev_err(&ts->client->dev, "GTP wakeup sleep failed.\n");
return ret;
}
#endif /* !CONFIG_HAS_EARLYSUSPEND && !CONFIG_FB*/
@@ -1051,9 +1069,7 @@ static int gtp_check_product_id(struct i2c_client *client)
dev_info(&client->dev, "Goodix Product ID = %s\n", product_id);
- if (!IS_ERR(ts->pdata->product_id))
- ret = strcmp(product_id, ts->pdata->product_id);
-
+ ret = strcmp(product_id, ts->pdata->product_id);
if (ret != 0)
return -EINVAL;
@@ -1232,12 +1248,11 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts)
/* in case of "out of memory" */
input_mt_init_slots(ts->input_dev, 10, 0);
-#if GTP_HAVE_TOUCH_KEY
- for (index = 0; index < ARRAY_SIZE(touch_key_array); index++) {
+ for (index = 0; index < ts->pdata->num_button; index++) {
input_set_capability(ts->input_dev,
- EV_KEY, touch_key_array[index]);
+ EV_KEY, ts->pdata->button_map[index]);
}
-#endif
+
#if GTP_SLIDE_WAKEUP
input_set_capability(ts->input_dev, EV_KEY, KEY_POWER);
@@ -1305,6 +1320,12 @@ static int goodix_power_on(struct goodix_ts_data *ts)
{
int ret;
+ if (ts->power_on) {
+ dev_info(&ts->client->dev,
+ "Device already power on\n");
+ return 0;
+ }
+
if (!IS_ERR(ts->avdd)) {
ret = reg_set_optimum_mode_check(ts->avdd,
GOODIX_VDD_LOAD_MAX_UA);
@@ -1371,6 +1392,7 @@ static int goodix_power_on(struct goodix_ts_data *ts)
}
}
+ ts->power_on = true;
return 0;
err_enable_vcc_i2c:
@@ -1389,6 +1411,7 @@ err_set_vtg_vdd:
regulator_disable(ts->avdd);
err_enable_avdd:
err_set_opt_avdd:
+ ts->power_on = false;
return ret;
}
@@ -1402,6 +1425,12 @@ static int goodix_power_off(struct goodix_ts_data *ts)
{
int ret;
+ if (!ts->power_on) {
+ dev_info(&ts->client->dev,
+ "Device already power off\n");
+ return 0;
+ }
+
if (!IS_ERR(ts->vcc_i2c)) {
ret = regulator_set_voltage(ts->vcc_i2c, 0,
GOODIX_I2C_VTG_MAX_UV);
@@ -1434,6 +1463,7 @@ static int goodix_power_off(struct goodix_ts_data *ts)
"Regulator avdd disable failed ret=%d\n", ret);
}
+ ts->power_on = false;
return 0;
}
@@ -1486,6 +1516,50 @@ static int goodix_power_deinit(struct goodix_ts_data *ts)
return 0;
}
+static ssize_t gtp_fw_name_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct goodix_ts_data *ts = dev_get_drvdata(dev);
+
+ if (!strlen(ts->fw_name))
+ return snprintf(buf, GTP_FW_NAME_MAXSIZE - 1,
+ "No fw name has been given.");
+ else
+ return snprintf(buf, GTP_FW_NAME_MAXSIZE - 1,
+ "%s\n", ts->fw_name);
+}
+
+static ssize_t gtp_fw_name_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ struct goodix_ts_data *ts = dev_get_drvdata(dev);
+
+ if (size > GTP_FW_NAME_MAXSIZE - 1) {
+ dev_err(dev, "FW name size exceeds the limit.");
+ return -EINVAL;
+ }
+
+ strlcpy(ts->fw_name, buf, size);
+ if (ts->fw_name[size-1] == '\n')
+ ts->fw_name[size-1] = '\0';
+
+ return size;
+}
+
+static DEVICE_ATTR(fw_name, (S_IRUGO | S_IWUSR | S_IWGRP),
+ gtp_fw_name_show,
+ gtp_fw_name_store);
+
+static struct attribute *gtp_attrs[] = {
+ &dev_attr_fw_name.attr,
+ NULL
+};
+
+static const struct attribute_group gtp_attr_grp = {
+ .attrs = gtp_attrs,
+};
+
static int goodix_ts_get_dt_coords(struct device *dev, char *name,
struct goodix_ts_platform_data *pdata)
{
@@ -1549,6 +1623,9 @@ static int goodix_parse_dt(struct device *dev,
pdata->no_force_update = of_property_read_bool(np,
"goodix,no-force-update");
+
+ pdata->enable_power_off = of_property_read_bool(np,
+ "goodix,enable-power-off");
/* reset, irq gpio info */
pdata->reset_gpio = of_get_named_gpio_flags(np, "reset-gpios",
0, &pdata->reset_gpio_flags);
@@ -1562,8 +1639,17 @@ static int goodix_parse_dt(struct device *dev,
rc = of_property_read_string(np, "goodix,product-id",
&pdata->product_id);
- if (rc < 0 || strlen(pdata->product_id) > GTP_PRODUCT_ID_MAXSIZE)
- return rc;
+ if (rc && (rc != -EINVAL)) {
+ dev_err(dev, "Failed to parse product_id.");
+ return -EINVAL;
+ }
+
+ rc = of_property_read_string(np, "goodix,fw_name",
+ &pdata->fw_name);
+ if (rc && (rc != -EINVAL)) {
+ dev_err(dev, "Failed to parse firmware name.\n");
+ return -EINVAL;
+ }
prop = of_find_property(np, "goodix,button-map", NULL);
if (prop) {
@@ -1578,6 +1664,9 @@ static int goodix_parse_dt(struct device *dev,
dev_err(dev, "Unable to read key codes\n");
return rc;
}
+ pdata->num_button = num_buttons;
+ memcpy(pdata->button_map, button_map,
+ pdata->num_button * sizeof(u32));
}
read_cfg_num = 0;
@@ -1670,6 +1759,7 @@ static int goodix_ts_probe(struct i2c_client *client,
spin_lock_init(&ts->irq_lock);
i2c_set_clientdata(client, ts);
ts->gtp_rawdiff_mode = 0;
+ ts->power_on = false;
ret = gtp_request_io_port(ts);
if (ret) {
@@ -1697,12 +1787,16 @@ static int goodix_ts_probe(struct i2c_client *client,
goto exit_power_off;
}
+ if (pdata->fw_name)
+ strlcpy(ts->fw_name, pdata->fw_name,
+ strlen(pdata->fw_name) + 1);
+
#if GTP_AUTO_UPDATE
ret = gup_init_update_proc(ts);
if (ret < 0) {
dev_err(&client->dev,
"GTP Create firmware update thread error.\n");
- goto exit_free_io_port;
+ goto exit_power_off;
}
#endif
@@ -1719,7 +1813,9 @@ static int goodix_ts_probe(struct i2c_client *client,
dev_err(&client->dev, "GTP request input dev failed.\n");
goto exit_free_inputdev;
}
+ input_set_drvdata(ts->input_dev, ts);
+ mutex_init(&ts->lock);
#if defined(CONFIG_FB)
ts->fb_notif.notifier_call = fb_notifier_callback;
ret = fb_register_client(&ts->fb_notif);
@@ -1762,9 +1858,16 @@ static int goodix_ts_probe(struct i2c_client *client,
#if GTP_ESD_PROTECT
gtp_esd_switch(client, SWITCH_ON);
#endif
+ ret = sysfs_create_group(&client->dev.kobj, &gtp_attr_grp);
+ if (ret < 0) {
+ dev_err(&client->dev, "sys file creation failed.\n");
+ goto exit_free_irq;
+ }
+
init_done = true;
return 0;
exit_free_irq:
+ mutex_destroy(&ts->lock);
#if defined(CONFIG_FB)
if (fb_unregister_client(&ts->fb_notif))
dev_err(&client->dev,
@@ -1813,6 +1916,8 @@ static int goodix_ts_remove(struct i2c_client *client)
{
struct goodix_ts_data *ts = i2c_get_clientdata(client);
+ sysfs_remove_group(&ts->input_dev->dev.kobj, &gtp_attr_grp);
+
#if defined(CONFIG_FB)
if (fb_unregister_client(&ts->fb_notif))
dev_err(&client->dev,
@@ -1820,6 +1925,7 @@ static int goodix_ts_remove(struct i2c_client *client)
#elif defined(CONFIG_HAS_EARLYSUSPEND)
unregister_early_suspend(&ts->early_suspend);
#endif
+ mutex_destroy(&ts->lock);
#if GTP_CREATE_WR_NODE
uninit_wr_node();
@@ -1873,6 +1979,7 @@ static void goodix_ts_suspend(struct goodix_ts_data *ts)
{
int ret = -1, i;
+ mutex_lock(&ts->lock);
#if GTP_ESD_PROTECT
ts->gtp_is_suspend = 1;
gtp_esd_switch(ts->client, SWITCH_OFF);
@@ -1893,12 +2000,13 @@ static void goodix_ts_suspend(struct goodix_ts_data *ts)
ret = gtp_enter_sleep(ts);
#endif
- if (ret < 0)
+ if (ret <= 0)
dev_err(&ts->client->dev, "GTP early suspend failed.\n");
/* to avoid waking up while not sleeping,
* delay 48 + 10ms to ensure reliability
*/
msleep(58);
+ mutex_unlock(&ts->lock);
}
/*******************************************************
@@ -1913,13 +2021,14 @@ static void goodix_ts_resume(struct goodix_ts_data *ts)
{
int ret = -1;
+ mutex_lock(&ts->lock);
ret = gtp_wakeup_sleep(ts);
#if GTP_SLIDE_WAKEUP
doze_status = DOZE_DISABLED;
#endif
- if (ret < 0)
+ if (ret <= 0)
dev_err(&ts->client->dev, "GTP resume failed.\n");
if (ts->use_irq)
@@ -1932,6 +2041,7 @@ static void goodix_ts_resume(struct goodix_ts_data *ts)
ts->gtp_is_suspend = 0;
gtp_esd_switch(ts->client, SWITCH_ON);
#endif
+ mutex_unlock(&ts->lock);
}
#if defined(CONFIG_FB)
@@ -2177,7 +2287,7 @@ static void __exit goodix_ts_exit(void)
i2c_del_driver(&goodix_ts_driver);
}
-late_initcall(goodix_ts_init);
+module_init(goodix_ts_init);
module_exit(goodix_ts_exit);
MODULE_DESCRIPTION("GTP Series Driver");
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx.h b/drivers/input/touchscreen/gt9xx/gt9xx.h
index 843e3d6c05b2..56e561ab3925 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx.h
+++ b/drivers/input/touchscreen/gt9xx/gt9xx.h
@@ -33,6 +33,7 @@
#include <linux/regulator/consumer.h>
#include <linux/firmware.h>
#include <linux/debugfs.h>
+#include <linux/mutex.h>
#if defined(CONFIG_FB)
#include <linux/notifier.h>
@@ -42,13 +43,17 @@
#define GOODIX_SUSPEND_LEVEL 1
#endif
+#define MAX_BUTTONS 4
#define GOODIX_MAX_CFG_GROUP 6
+#define GTP_FW_NAME_MAXSIZE 50
+
struct goodix_ts_platform_data {
int irq_gpio;
u32 irq_gpio_flags;
int reset_gpio;
u32 reset_gpio_flags;
const char *product_id;
+ const char *fw_name;
u32 x_max;
u32 y_max;
u32 x_min;
@@ -59,8 +64,11 @@ struct goodix_ts_platform_data {
u32 panel_maxy;
bool no_force_update;
bool i2c_pull_up;
+ bool enable_power_off;
size_t config_data_len[GOODIX_MAX_CFG_GROUP];
u8 *config_data[GOODIX_MAX_CFG_GROUP];
+ u32 button_map[MAX_BUTTONS];
+ u8 num_button;
};
struct goodix_ts_data {
spinlock_t irq_lock;
@@ -70,6 +78,7 @@ struct goodix_ts_data {
struct hrtimer timer;
struct workqueue_struct *goodix_wq;
struct work_struct work;
+ struct delayed_work goodix_update_work;
s32 irq_is_disabled;
s32 use_irq;
u16 abs_x_max;
@@ -86,6 +95,8 @@ struct goodix_ts_data {
u8 fixed_cfg;
u8 esd_running;
u8 fw_error;
+ bool power_on;
+ struct mutex lock;
struct regulator *avdd;
struct regulator *vdd;
struct regulator *vcc_i2c;
@@ -104,7 +115,6 @@ extern u16 total_len;
#define GTP_CHANGE_X2Y 0
#define GTP_DRIVER_SEND_CFG 1
#define GTP_HAVE_TOUCH_KEY 1
-#define GTP_POWER_CTRL_SLEEP 0
/* auto updated by .bin file as default */
#define GTP_AUTO_UPDATE 0
@@ -117,14 +127,11 @@ extern u16 total_len;
#define GTP_ESD_PROTECT 0
#define GTP_WITH_PEN 0
+/* This cannot work when enable-power-off is on */
#define GTP_SLIDE_WAKEUP 0
/* double-click wakeup, function together with GTP_SLIDE_WAKEUP */
#define GTP_DBL_CLK_WAKEUP 0
-#define GTP_DEBUG_ON 0
-#define GTP_DEBUG_ARRAY_ON 0
-#define GTP_DEBUG_FUNC_ON 0
-
/*************************** PART2:TODO define *******************************/
/* STEP_1(REQUIRED): Define Configuration Information Group(s) */
/* Sensor_ID Map: */
@@ -190,39 +197,6 @@ extern u16 total_len;
#define RESOLUTION_LOC 3
#define TRIGGER_LOC 8
-/* Log define */
-#define GTP_DEBUG(fmt, arg...) do {\
- if (GTP_DEBUG_ON) {\
- pr_debug("<<-GTP-DEBUG->> [%d]"fmt"\n",\
- __LINE__, ##arg); } \
- } while (0)
-
-#define GTP_DEBUG_ARRAY(array, num) do {\
- s32 i; \
- u8 *a = array; \
- if (GTP_DEBUG_ARRAY_ON) {\
- pr_debug("<<-GTP-DEBUG-ARRAY->>\n");\
- for (i = 0; i < (num); i++) { \
- pr_debug("%02x ", (a)[i]);\
- if ((i + 1) % 10 == 0) { \
- pr_debug("\n");\
- } \
- } \
- pr_debug("\n");\
- } \
- } while (0)
-
-#define GTP_DEBUG_FUNC() do {\
- if (GTP_DEBUG_FUNC_ON)\
- pr_debug("<<-GTP-FUNC->> Func:%s@Line:%d\n",\
- __func__, __LINE__);\
- } while (0)
-
-#define GTP_SWAP(x, y) do {\
- typeof(x) z = x;\
- x = y;\
- y = z;\
- } while (0)
/*****************************End of Part III********************************/
void gtp_esd_switch(struct i2c_client *client, int on);
diff --git a/drivers/input/touchscreen/gt9xx/gt9xx_update.c b/drivers/input/touchscreen/gt9xx/gt9xx_update.c
index 9fcf7f0bef86..c991bfd3ffdf 100644
--- a/drivers/input/touchscreen/gt9xx/gt9xx_update.c
+++ b/drivers/input/touchscreen/gt9xx/gt9xx_update.c
@@ -31,7 +31,6 @@
* 2. support firmware header array update.
* By Meta, 2013/03/11
*/
-#include <linux/kthread.h>
#include "gt9xx.h"
#if GTP_HEADER_FW_UPDATE
@@ -126,8 +125,6 @@ s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len)
},
};
- GTP_DEBUG_FUNC();
-
while (retries < 5) {
ret = i2c_transfer(client->adapter, msgs, 2);
if (ret == 2)
@@ -166,8 +163,6 @@ s32 gup_i2c_write(struct i2c_client *client, u8 *buf, s32 len)
.buf = buf,
};
- GTP_DEBUG_FUNC();
-
while (retries < 5) {
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret == 1)
@@ -215,25 +210,23 @@ static s32 gup_init_panel(struct goodix_ts_data *ts)
&sensor_id, 1);
if (ret == SUCCESS) {
if (sensor_id >= 0x06) {
- GTP_ERROR(
- "Invalid sensor_id(0x%02X), No Config Sent!",
- sensor_id);
+ pr_err("Invalid sensor_id(0x%02X), No Config Sent!\n",
+ sensor_id);
return -EINVAL;
}
} else {
- GTP_ERROR("Failed to get sensor_id, No config sent!");
+ pr_err("Failed to get sensor_id, No config sent!\n");
return -EINVAL;
}
}
- GTP_DEBUG("Sensor_ID: %d", sensor_id);
+ pr_debug("Sensor_ID: %d\n", sensor_id);
ts->gtp_cfg_len = cfg_info_len[sensor_id];
if (ts->gtp_cfg_len < GTP_CONFIG_MIN_LENGTH) {
- GTP_ERROR("Sensor_ID(%d) matches with NULL or INVALID CONFIG",
- " GROUP! NO Config Sent! You need to check you header",
- " file CFG_GROUP section!", sensor_id);
+ pr_err("Sensor_ID(%d) matches with NULL or INVALID CONFIG GROUP! NO Config Sent! You need to check you header file CFG_GROUP section!\n",
+ sensor_id);
return -EINVAL;
}
@@ -241,8 +234,8 @@ static s32 gup_init_panel(struct goodix_ts_data *ts)
&opr_buf[0], 1);
if (ret == SUCCESS) {
- GTP_DEBUG("CFG_GROUP%d Config Version: %d, IC Config Version:",
- " %d", sensor_id+1, send_cfg_buf[sensor_id][0], opr_buf[0]);
+ pr_debug("CFG_GROUP%d Config Version: %d, IC Config Version: %d\n",
+ sensor_id+1, send_cfg_buf[sensor_id][0], opr_buf[0]);
send_cfg_buf[sensor_id][0] = opr_buf[0];
ts->fixed_cfg = 0;
@@ -253,13 +246,11 @@ static s32 gup_init_panel(struct goodix_ts_data *ts)
* send_cfg_buf[sensor_id][0] = 0x00;
* ts->fixed_cfg = 0;
* } else { *** treated as fixed config, not send config ***
- * GTP_INFO("Ic fixed config with config version(%d)",
+ * pr_info("Ic fixed config with config version(%d)",
* opr_buf[0]);
* ts->fixed_cfg = 1;
* }
*/
- } else {
- GTP_ERROR("Failed to get ic config version!No config sent!");
return -EINVAL;
}
@@ -267,7 +258,7 @@ static s32 gup_init_panel(struct goodix_ts_data *ts)
memcpy(&config[GTP_ADDR_LENGTH], send_cfg_buf[sensor_id],
ts->gtp_cfg_len);
- GTP_DEBUG("X_MAX = %d, Y_MAX = %d, TRIGGER = 0x%02x",
+ pr_debug("X_MAX = %d, Y_MAX = %d, TRIGGER = 0x%02x\n",
ts->abs_x_max, ts->abs_y_max, ts->int_trigger_type);
config[RESOLUTION_LOC] = (u8)GTP_MAX_WIDTH;
@@ -286,10 +277,9 @@ static s32 gup_init_panel(struct goodix_ts_data *ts)
config[ts->gtp_cfg_len] = (~check_sum) + 1;
- GTP_DEBUG_FUNC();
ret = gtp_send_cfg(ts->client);
if (ret < 0)
- GTP_ERROR("Send config error.");
+ pr_err("Send config error.\n");
msleep(20);
return 0;
@@ -308,7 +298,7 @@ static u8 gup_get_ic_msg(struct i2c_client *client, u16 addr, u8 *msg, s32 len)
break;
if (i >= 5) {
- GTP_ERROR("Read data from 0x%02x%02x failed!", msg[0], msg[1]);
+ pr_err("Read data from 0x%02x%02x failed!\n", msg[0], msg[1]);
return FAIL;
}
@@ -329,7 +319,7 @@ static u8 gup_set_ic_msg(struct i2c_client *client, u16 addr, u8 val)
break;
if (i >= 5) {
- GTP_ERROR("Set data to 0x%02x%02x failed!", msg[0], msg[1]);
+ pr_err("Set data to 0x%02x%02x failed!\n", msg[0], msg[1]);
return FAIL;
}
@@ -347,7 +337,7 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client)
ret = gtp_i2c_read_dbl_check(client, GUP_REG_HW_INFO,
&buf[GTP_ADDR_LENGTH], 4);
if (ret == FAIL) {
- GTP_ERROR("[get_ic_fw_msg]get hw_info failed,exit");
+ pr_err("[get_ic_fw_msg]get hw_info failed,exit\n");
return FAIL;
}
@@ -356,7 +346,7 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client)
for (i = 0; i < 4; i++)
update_msg.ic_fw_msg.hw_info[i] = buf[GTP_ADDR_LENGTH + 3 - i];
- GTP_DEBUG("IC Hardware info:%02x%02x%02x%02x",
+ pr_debug("IC Hardware info:%02x%02x%02x%02x\n",
update_msg.ic_fw_msg.hw_info[0],
update_msg.ic_fw_msg.hw_info[1],
update_msg.ic_fw_msg.hw_info[2],
@@ -366,31 +356,31 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client)
for (retry = 0; retry < 2; retry++) {
ret = gup_get_ic_msg(client, GUP_REG_FW_MSG, buf, 1);
if (ret == FAIL) {
- GTP_ERROR("Read firmware message fail.");
+ pr_err("Read firmware message fail.\n");
return ret;
}
update_msg.force_update = buf[GTP_ADDR_LENGTH];
if ((update_msg.force_update != 0xBE) && (!retry)) {
- GTP_INFO("The check sum in ic is error.");
- GTP_INFO("The IC will be updated by force.");
+ pr_info("The check sum in ic is error.\n");
+ pr_info("The IC will be updated by force.\n");
continue;
}
break;
}
- GTP_DEBUG("IC force update flag:0x%x", update_msg.force_update);
+ pr_debug("IC force update flag:0x%x\n", update_msg.force_update);
/* step3:get pid & vid */
ret = gtp_i2c_read_dbl_check(client, GUP_REG_PID_VID,
&buf[GTP_ADDR_LENGTH], 6);
if (ret == FAIL) {
- GTP_ERROR("[get_ic_fw_msg]get pid & vid failed,exit");
+ pr_err("[get_ic_fw_msg]get pid & vid failed,exit\n");
return FAIL;
}
memset(update_msg.ic_fw_msg.pid, 0, sizeof(update_msg.ic_fw_msg.pid));
memcpy(update_msg.ic_fw_msg.pid, &buf[GTP_ADDR_LENGTH], 4);
- GTP_DEBUG("IC Product id:%s", update_msg.ic_fw_msg.pid);
+ pr_debug("IC Product id:%s\n", update_msg.ic_fw_msg.pid);
/* GT9XX PID MAPPING
* |-----FLASH-----RAM-----|
@@ -405,7 +395,7 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client)
*/
if (update_msg.ic_fw_msg.pid[0] != 0) {
if (!memcmp(update_msg.ic_fw_msg.pid, "9111", 4)) {
- GTP_DEBUG("IC Mapping Product id:%s",
+ pr_debug("IC Mapping Product id:%s\n",
update_msg.ic_fw_msg.pid);
memcpy(update_msg.ic_fw_msg.pid, "9110P", 5);
}
@@ -413,7 +403,7 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client)
update_msg.ic_fw_msg.vid = buf[GTP_ADDR_LENGTH + 4] +
(buf[GTP_ADDR_LENGTH + 5] << 8);
- GTP_DEBUG("IC version id:%04x", update_msg.ic_fw_msg.vid);
+ pr_debug("IC version id:%04x\n", update_msg.ic_fw_msg.vid);
return SUCCESS;
}
@@ -441,25 +431,25 @@ s32 gup_enter_update_mode(struct i2c_client *client)
/* step4:Hold ss51 & dsp */
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
if (ret <= 0) {
- GTP_DEBUG("Hold ss51 & dsp I2C error,retry:%d", retry);
+ pr_debug("Hold ss51 & dsp I2C error,retry:%d\n", retry);
continue;
}
/* step5:Confirm hold */
ret = gup_get_ic_msg(client, _rRW_MISCTL__SWRST_B0_, rd_buf, 1);
if (ret <= 0) {
- GTP_DEBUG("Hold ss51 & dsp I2C error,retry:%d", retry);
+ pr_debug("Hold ss51 & dsp I2C error,retry:%d\n", retry);
continue;
}
if (rd_buf[GTP_ADDR_LENGTH] == 0x0C) {
- GTP_DEBUG("Hold ss51 & dsp confirm SUCCESS");
+ pr_debug("Hold ss51 & dsp confirm SUCCESS\n");
break;
}
- GTP_DEBUG("Hold ss51 & dsp confirm 0x4180 failed,value:%d",
+ pr_debug("Hold ss51 & dsp confirm 0x4180 failed,value:%d\n",
rd_buf[GTP_ADDR_LENGTH]);
}
if (retry >= 200) {
- GTP_ERROR("Enter update Hold ss51 failed.");
+ pr_err("Enter update Hold ss51 failed.\n");
return FAIL;
}
@@ -474,7 +464,7 @@ void gup_leave_update_mode(void)
{
GTP_GPIO_AS_INT(GTP_INT_PORT);
- GTP_DEBUG("[leave_update_mode]reset chip.");
+ pr_debug("[leave_update_mode]reset chip.\n");
gtp_reset_guitar(i2c_connect_client, 20);
}
@@ -504,38 +494,37 @@ static u8 gup_enter_update_judge(st_fw_head *fw_head)
u16_tmp = fw_head->vid;
fw_head->vid = (u16)(u16_tmp>>8) + (u16)(u16_tmp<<8);
- GTP_DEBUG("FILE HARDWARE INFO:%02x%02x%02x%02x", fw_head->hw_info[0],
+ pr_debug("FILE HARDWARE INFO:%02x%02x%02x%02x\n", fw_head->hw_info[0],
fw_head->hw_info[1], fw_head->hw_info[2], fw_head->hw_info[3]);
- TP_DEBUG("FILE PID:%s", fw_head->pid);
- TP_DEBUG("FILE VID:%04x", fw_head->vid);
+ pr_debug("FILE PID:%s\n", fw_head->pid);
+ pr_debug("FILE VID:%04x\n", fw_head->vid);
- TP_DEBUG("IC HARDWARE INFO:%02x%02x%02x%02x",
+ pr_debug("IC HARDWARE INFO:%02x%02x%02x%02x\n",
update_msg.ic_fw_msg.hw_info[0],
update_msg.ic_fw_msg.hw_info[1],
update_msg.ic_fw_msg.hw_info[2],
update_msg.ic_fw_msg.hw_info[3]);
- TP_DEBUG("IC PID:%s", update_msg.ic_fw_msg.pid);
- TP_DEBUG("IC VID:%04x", update_msg.ic_fw_msg.vid);
+ pr_debug("IC PID:%s\n", update_msg.ic_fw_msg.pid);
+ pr_debug("IC VID:%04x\n", update_msg.ic_fw_msg.vid);
/* First two conditions */
if (!memcmp(fw_head->hw_info, update_msg.ic_fw_msg.hw_info,
sizeof(update_msg.ic_fw_msg.hw_info))) {
- GTP_DEBUG("Get the same hardware info.");
+ pr_debug("Get the same hardware info.\n");
if (update_msg.force_update != 0xBE) {
- GTP_INFO("FW chksum error,need enter update.");
+ pr_info("FW chksum error,need enter update.\n");
return SUCCESS;
}
/* 20130523 start */
if (strlen(update_msg.ic_fw_msg.pid) < 3) {
- GTP_INFO("Illegal IC pid, need enter update");
+ pr_info("Illegal IC pid, need enter update\n");
return SUCCESS;
}
for (i = 0; i < 3; i++) {
if ((update_msg.ic_fw_msg.pid[i] < 0x30) ||
(update_msg.ic_fw_msg.pid[i] > 0x39)) {
- GTP_INFO("Illegal IC pid, out of ",
- "bound, need enter update");
+ pr_info("Illegal IC pid, out of bound, need enter update\n");
return SUCCESS;
}
}
@@ -546,22 +535,22 @@ static u8 gup_enter_update_judge(st_fw_head *fw_head)
(!memcmp(update_msg.ic_fw_msg.pid, "91XX", 4)) ||
(!memcmp(fw_head->pid, "91XX", 4))) {
if (!memcmp(fw_head->pid, "91XX", 4))
- GTP_DEBUG("Force none same pid update mode.");
+ pr_debug("Force none same pid update mode.\n");
else
- GTP_DEBUG("Get the same pid.");
+ pr_debug("Get the same pid.\n");
/* The third condition */
if (fw_head->vid > update_msg.ic_fw_msg.vid) {
- GTP_INFO("Need enter update.");
+ pr_info("Need enter update.");
return SUCCESS;
}
- GTP_ERROR("Don't meet the third condition.");
- GTP_ERROR("File VID <= Ic VID, update aborted!");
+ pr_err("Don't meet the third condition.\n");
+ pr_err("File VID <= Ic VID, update aborted!\n");
} else {
- GTP_ERROR("File PID != Ic PID, update aborted!");
+ pr_err("File PID != Ic PID, update aborted!\n");
}
} else {
- GTP_ERROR("Different Hardware, update aborted!");
+ pr_err("Different Hardware, update aborted!\n");
}
return FAIL;
@@ -598,7 +587,7 @@ static s8 gup_update_config(struct i2c_client *client)
u8 pid[8];
if (update_msg.cfg_file == NULL) {
- GTP_ERROR("[update_cfg]No need to upgrade config!");
+ pr_err("[update_cfg]No need to upgrade config!\n");
return FAIL;
}
file_len = update_msg.cfg_file->f_op->llseek(update_msg.cfg_file,
@@ -606,11 +595,11 @@ static s8 gup_update_config(struct i2c_client *client)
ret = gup_get_ic_msg(client, GUP_REG_PID_VID, pid, 6);
if (ret == FAIL) {
- GTP_ERROR("[update_cfg]Read product id & version id fail.");
+ pr_err("[update_cfg]Read product id & version id fail.\n");
return FAIL;
}
pid[5] = '\0';
- GTP_DEBUG("update cfg get pid:%s", &pid[GTP_ADDR_LENGTH]);
+ pr_debug("update cfg get pid:%s\n", &pid[GTP_ADDR_LENGTH]);
chip_cfg_len = 186;
if (!memcmp(&pid[GTP_ADDR_LENGTH], "968", 3) ||
@@ -618,10 +607,10 @@ static s8 gup_update_config(struct i2c_client *client)
!memcmp(&pid[GTP_ADDR_LENGTH], "960", 3)) {
chip_cfg_len = 228;
}
- GTP_DEBUG("[update_cfg]config file len:%d", file_len);
- GTP_DEBUG("[update_cfg]need config len:%d", chip_cfg_len);
+ pr_debug("[update_cfg]config file len:%d\n", file_len);
+ pr_debug("[update_cfg]need config len:%d\n", chip_cfg_len);
if ((file_len+5) < chip_cfg_len*5) {
- GTP_ERROR("Config length error");
+ pr_err("Config length error");
return -EINVAL;
}
@@ -640,15 +629,15 @@ static s8 gup_update_config(struct i2c_client *client)
update_msg.cfg_file->f_op->llseek(update_msg.cfg_file, 0, SEEK_SET);
- GTP_DEBUG("[update_cfg]Read config from file.");
+ pr_debug("[update_cfg]Read config from file.\n");
ret = update_msg.cfg_file->f_op->read(update_msg.cfg_file,
(char *)pre_buf, file_len, &update_msg.cfg_file->f_pos);
if (ret < 0) {
- GTP_ERROR("[update_cfg]Read config file failed.");
+ pr_err("[update_cfg]Read config file failed.\n");
return ret;
}
- GTP_DEBUG("[update_cfg]Delete illegal character.");
+ pr_debug("[update_cfg]Delete illegal character.\n");
for (i = 0, count = 0; i < file_len; i++) {
if (pre_buf[i] == ' ' || pre_buf[i] == '\r'
|| pre_buf[i] == '\n')
@@ -656,7 +645,7 @@ static s8 gup_update_config(struct i2c_client *client)
buf[count++] = pre_buf[i];
}
- GTP_DEBUG("[update_cfg]Ascii to hex.");
+ pr_debug("[update_cfg]Ascii to hex.\n");
file_config[0] = GTP_REG_CONFIG_DATA >> 8;
file_config[1] = GTP_REG_CONFIG_DATA & 0xff;
for (i = 0, file_cfg_len = GTP_ADDR_LENGTH; i < count; i + = 5) {
@@ -669,13 +658,13 @@ static s8 gup_update_config(struct i2c_client *client)
if ((high == 0xFF) || (low == 0xFF)) {
ret = 0;
- GTP_ERROR("[update_cfg]Illegal config file.");
+ pr_err("[update_cfg]Illegal config file.\n");
return ret;
}
file_config[file_cfg_len++] = (high<<4) + low;
} else {
ret = 0;
- GTP_ERROR("[update_cfg]Illegal config file.");
+ pr_err("[update_cfg]Illegal config file.\n");
return ret;
}
}
@@ -687,17 +676,14 @@ static s8 gup_update_config(struct i2c_client *client)
* file_config[chip_cfg_len+1] = 0x01;
*/
- GTP_DEBUG("config:");
- GTP_DEBUG_ARRAY(file_config+2, file_cfg_len);
-
i = 0;
while (i++ < 5) {
ret = gup_i2c_write(client, file_config, file_cfg_len);
if (ret > 0) {
- GTP_INFO("[update_cfg]Send config SUCCESS.");
+ pr_info("[update_cfg]Send config SUCCESS.\n");
break;
}
- GTP_ERROR("[update_cfg]Send config i2c error.");
+ pr_err("[update_cfg]Send config i2c error.\n");
}
return ret;
@@ -713,13 +699,13 @@ static u8 gup_check_fs_mounted(char *path_name)
err = kern_path("/", LOOKUP_FOLLOW, &root_path);
if (err) {
- GTP_DEBUG("\"/\" NOT Mounted: %d", err);
+ pr_debug("\"/\" NOT Mounted: %d\n", err);
return FAIL;
}
err = kern_path(path_name, LOOKUP_FOLLOW, &path);
if (err) {
- GTP_DEBUG("/data/ NOT Mounted: %d", err);
+ pr_debug("/data/ NOT Mounted: %d\n", err);
return FAIL;
}
@@ -742,26 +728,26 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
u8 buf[FW_HEAD_LENGTH];
if (path) {
- GTP_DEBUG("Update File path:%s, %d", path, strlen(path));
+ pr_debug("Update File path:%s, %d\n", path, strlen(path));
update_msg.file = file_open(path, O_RDONLY, 0);
if (IS_ERR(update_msg.file)) {
- GTP_ERROR("Open update file(%s) error!", path);
+ pr_err("Open update file(%s) error!\n", path);
return FAIL;
}
} else {
#if GTP_HEADER_FW_UPDATE
for (i = 0; i < (GUP_SEARCH_FILE_TIMES); i++) {
- GTP_DEBUG("Waiting for /data mounted [%d]", i);
+ pr_debug("Waiting for /data mounted [%d]\n", i);
if (gup_check_fs_mounted("/data") == SUCCESS) {
- GTP_DEBUG("/data Mounted!");
+ pr_debug("/data Mounted!\n");
break;
}
msleep(3000);
}
if (i >= (GUP_SEARCH_FILE_TIMES)) {
- GTP_ERROR("Wait for /data mounted timeout!");
+ pr_err("Wait for /data mounted timeout!\n");
return FAIL;
}
@@ -770,25 +756,24 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
O_RDONLY, 0);
if (IS_ERR(update_msg.cfg_file)) {
- GTP_DEBUG("%s is unavailable", CONFIG_FILE_PATH_1);
+ pr_debug("%s is unavailable\n", CONFIG_FILE_PATH_1);
} else {
- GTP_INFO("Update Config File: %s", CONFIG_FILE_PATH_1);
+ pr_info("Update Config File: %s\n", CONFIG_FILE_PATH_1);
ret = gup_update_config(client);
if (ret <= 0)
- GTP_ERROR("Update config failed.");
+ pr_err("Update config failed.\n");
filp_close(update_msg.cfg_file, NULL);
}
if (sizeof(header_fw_array) < (FW_HEAD_LENGTH+FW_SECTION_LENGTH
*4 + FW_DSP_ISP_LENGTH+FW_DSP_LENGTH + FW_BOOT_LENGTH)) {
- GTP_ERROR("INVALID header_fw_array, check your ",
- "gt9xx_firmware.h file!");
+ pr_err("INVALID header_fw_array, check your gt9xx_firmware.h file!\n");
return FAIL;
}
update_msg.file = file_open(UPDATE_FILE_PATH_2, O_CREAT |
O_RDWR, 0666);
if ((IS_ERR(update_msg.file))) {
- GTP_ERROR("Failed to Create file: %s for fw_header!",
+ pr_err("Failed to Create file: %s for fw_header!\n",
UPDATE_FILE_PATH_2);
return FAIL;
}
@@ -819,8 +804,7 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
searching_file = 1;
for (i = 0; i < GUP_SEARCH_FILE_TIMES; i++) {
if (searching_file == 0) {
- GTP_INFO(".bin/.cfg update file search ",
- "forcely terminated!");
+ pr_info(".bin/.cfg update file search forcely terminated!\n");
return FAIL;
}
if (i % 2) {
@@ -839,7 +823,7 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
update_msg.file = file_open(search_update_path,
O_RDONLY, 0);
if (!IS_ERR(update_msg.file)) {
- GTP_DEBUG("Find the bin file");
+ pr_debug("Find the bin file\n");
got_file_flag |= 0x0F;
}
}
@@ -847,7 +831,7 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
update_msg.cfg_file = file_open(search_cfg_path,
O_RDONLY, 0);
if (!IS_ERR(update_msg.cfg_file)) {
- GTP_DEBUG("Find the cfg file");
+ pr_debug("Find the cfg file\n");
got_file_flag |= 0xF0;
}
}
@@ -857,7 +841,7 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
break;
i += 4;
}
- GTP_DEBUG("%3d:Searching %s %s file...", i,
+ pr_debug("%3d:Searching %s %s file...\n", i,
(got_file_flag & 0x0F) ? "" : "bin",
(got_file_flag & 0xF0) ? "" : "cfg");
@@ -867,22 +851,22 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
searching_file = 0;
if (!got_file_flag) {
- GTP_ERROR("Can't find update file.");
+ pr_err("Can't find update file.\n");
goto load_failed;
}
if (got_file_flag & 0xF0) {
- GTP_DEBUG("Got the update config file.");
+ pr_debug("Got the update config file.\n");
ret = gup_update_config(client);
if (ret <= 0)
- GTP_ERROR("Update config failed.");
+ pr_err("Update config failed.\n");
filp_close(update_msg.cfg_file, NULL);
msleep(500); /* waiting config to be stored in FLASH. */
}
if (got_file_flag & 0x0F) {
- GTP_DEBUG("Got the update firmware file.");
+ pr_debug("Got the update firmware file.\n");
} else {
- GTP_ERROR("No need to upgrade firmware.");
+ pr_err("No need to upgrade firmware.\n");
goto load_failed;
}
#endif
@@ -897,7 +881,7 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
ret = update_msg.file->f_op->read(update_msg.file, (char *)buf,
FW_HEAD_LENGTH, &update_msg.file->f_pos);
if (ret < 0) {
- GTP_ERROR("Read firmware head in update file error.");
+ pr_err("Read firmware head in update file error.\n");
goto load_failed;
}
memcpy(fw_head, buf, FW_HEAD_LENGTH);
@@ -911,17 +895,16 @@ static u8 gup_check_update_file(struct i2c_client *client, st_fw_head *fw_head,
ret = update_msg.file->f_op->read(update_msg.file, (char *)buf,
2, &update_msg.file->f_pos);
if (ret < 0) {
- GTP_ERROR("Read firmware file error.");
+ pr_err("Read firmware file error.\n");
goto load_failed;
}
- /* GTP_DEBUG("BUF[0]:%x", buf[0]); */
temp = (buf[0]<<8) + buf[1];
fw_checksum += temp;
}
- GTP_DEBUG("firmware checksum:%x", fw_checksum&0xFFFF);
+ pr_debug("firmware checksum:%x\n", fw_checksum&0xFFFF);
if (fw_checksum & 0xFFFF) {
- GTP_ERROR("Illegal firmware file.");
+ pr_err("Illegal firmware file.\n");
goto load_failed;
}
@@ -964,10 +947,10 @@ static u8 gup_burn_proc(struct i2c_client *client, u8 *burn_buf, u16 start_addr,
u8 rd_buf[PACK_SIZE + GTP_ADDR_LENGTH];
u8 retry = 0;
- GTP_DEBUG("Begin burn %dk data to addr 0x%x", (total_length/1024),
+ pr_debug("Begin burn %dk data to addr 0x%x\n", (total_length/1024),
start_addr);
while (burn_length < total_length) {
- GTP_DEBUG("B/T:%04d/%04d", burn_length, total_length);
+ pr_debug("B/T:%04d/%04d", burn_length, total_length);
frame_length = ((total_length - burn_length) > PACK_SIZE)
? PACK_SIZE : (total_length - burn_length);
wr_buf[0] = (u8)(burn_addr>>8);
@@ -981,33 +964,26 @@ static u8 gup_burn_proc(struct i2c_client *client, u8 *burn_buf, u16 start_addr,
ret = gup_i2c_write(client, wr_buf,
GTP_ADDR_LENGTH + frame_length);
if (ret <= 0) {
- GTP_ERROR("Write frame data i2c error.");
+ pr_err("Write frame data i2c error.\n");
continue;
}
ret = gup_i2c_read(client, rd_buf, GTP_ADDR_LENGTH +
frame_length);
if (ret <= 0) {
- GTP_ERROR("Read back frame data i2c error.");
+ pr_err("Read back frame data i2c error.\n");
continue;
}
if (memcmp(&wr_buf[GTP_ADDR_LENGTH],
&rd_buf[GTP_ADDR_LENGTH], frame_length)) {
- GTP_ERROR("Check frame data fail,not equal.");
- GTP_DEBUG("write array:");
- GTP_DEBUG_ARRAY(&wr_buf[GTP_ADDR_LENGTH],
- frame_length);
- GTP_DEBUG("read array:");
- GTP_DEBUG_ARRAY(&rd_buf[GTP_ADDR_LENGTH],
- frame_length);
+ pr_err("Check frame data fail,not equal.\n");
continue;
} else {
- /* GTP_DEBUG("Check frame data success."); */
break;
}
}
if (retry >= MAX_FRAME_CHECK_TIME) {
- GTP_ERROR("Burn frame data time out,exit.");
+ pr_err("Burn frame data time out,exit.\n");
return FAIL;
}
burn_length += frame_length;
@@ -1021,7 +997,7 @@ static u8 gup_load_section_file(u8 *buf, u16 offset, u16 length)
s32 ret = 0;
if (update_msg.file == NULL) {
- GTP_ERROR("cannot find update file,load section file fail.");
+ pr_err("cannot find update file,load section file fail.\n");
return FAIL;
}
update_msg.file->f_pos = FW_HEAD_LENGTH + offset;
@@ -1029,7 +1005,7 @@ static u8 gup_load_section_file(u8 *buf, u16 offset, u16 length)
ret = update_msg.file->f_op->read(update_msg.file, (char *)buf, length,
&update_msg.file->f_pos);
if (ret < 0) {
- GTP_ERROR("Read update file fail.");
+ pr_err("Read update file fail.\n");
return FAIL;
}
@@ -1050,24 +1026,20 @@ static u8 gup_recall_check(struct i2c_client *client, u8 *chk_src,
? PACK_SIZE : (chk_length - recall_length);
ret = gup_get_ic_msg(client, recall_addr, rd_buf, frame_length);
if (ret <= 0) {
- GTP_ERROR("recall i2c error,exit");
+ pr_err("recall i2c error,exit\n");
return FAIL;
}
if (memcmp(&rd_buf[GTP_ADDR_LENGTH], &chk_src[recall_length],
frame_length)) {
- GTP_ERROR("Recall frame data fail,not equal.");
- GTP_DEBUG("chk_src array:");
- GTP_DEBUG_ARRAY(&chk_src[recall_length], frame_length);
- GTP_DEBUG("recall array:");
- GTP_DEBUG_ARRAY(&rd_buf[GTP_ADDR_LENGTH], frame_length);
+ pr_err("Recall frame data fail,not equal.\n");
return FAIL;
}
recall_length += frame_length;
recall_addr += frame_length;
}
- GTP_DEBUG("Recall check %dk firmware success.", (chk_length/1024));
+ pr_debug("Recall check %dk firmware success.\n", (chk_length/1024));
return SUCCESS;
}
@@ -1081,14 +1053,14 @@ static u8 gup_burn_fw_section(struct i2c_client *client, u8 *fw_section,
/* step1:hold ss51 & dsp */
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]hold ss51 & dsp fail.");
+ pr_err("[burn_fw_section]hold ss51 & dsp fail.\n");
return FAIL;
}
/* step2:set scramble */
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]set scramble fail.");
+ pr_err("[burn_fw_section]set scramble fail.\n");
return FAIL;
}
@@ -1096,7 +1068,7 @@ static u8 gup_burn_fw_section(struct i2c_client *client, u8 *fw_section,
ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK,
(bank_cmd >> 4)&0x0F);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]select bank %d fail.",
+ pr_err("[burn_fw_section]select bank %d fail.\n",
(bank_cmd >> 4)&0x0F);
return FAIL;
}
@@ -1104,21 +1076,21 @@ static u8 gup_burn_fw_section(struct i2c_client *client, u8 *fw_section,
/* step4:enable accessing code */
ret = gup_set_ic_msg(client, _bRW_MISCTL__MEM_CD_EN, 0x01);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]enable accessing code fail.");
+ pr_err("[burn_fw_section]enable accessing code fail.\n");
return FAIL;
}
/* step5:burn 8k fw section */
ret = gup_burn_proc(client, fw_section, start_addr, FW_SECTION_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_section]burn fw_section fail.");
+ pr_err("[burn_fw_section]burn fw_section fail.\n");
return FAIL;
}
/* step6:hold ss51 & release dsp */
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x04);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]hold ss51 & release dsp fail.");
+ pr_err("[burn_fw_section]hold ss51 & release dsp fail.\n");
return FAIL;
}
/* must delay */
@@ -1127,27 +1099,24 @@ static u8 gup_burn_fw_section(struct i2c_client *client, u8 *fw_section,
/* step7:send burn cmd to move data to flash from sram */
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, bank_cmd&0x0f);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]send burn cmd fail.");
+ pr_err("[burn_fw_section]send burn cmd fail.\n");
return FAIL;
}
- GTP_DEBUG("[burn_fw_section]Wait for the burn is complete......");
+ pr_debug("[burn_fw_section]Wait for the burn is complete......\n");
do {
ret = gup_get_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, rd_buf, 1);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]Get burn state fail");
+ pr_err("[burn_fw_section]Get burn state fail\n");
return FAIL;
}
msleep(20);
- /* GTP_DEBUG("[burn_fw_section]Get burn state:%d.",
- * rd_buf[GTP_ADDR_LENGTH]);
- */
} while (rd_buf[GTP_ADDR_LENGTH]);
/* step8:select bank */
ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK,
(bank_cmd >> 4)&0x0F);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]select bank %d fail.",
+ pr_err("[burn_fw_section]select bank %d fail.\n",
(bank_cmd >> 4)&0x0F);
return FAIL;
}
@@ -1155,7 +1124,7 @@ static u8 gup_burn_fw_section(struct i2c_client *client, u8 *fw_section,
/* step9:enable accessing code */
ret = gup_set_ic_msg(client, _bRW_MISCTL__MEM_CD_EN, 0x01);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]enable accessing code fail.");
+ pr_err("[burn_fw_section]enable accessing code fail.\n");
return FAIL;
}
@@ -1163,14 +1132,14 @@ static u8 gup_burn_fw_section(struct i2c_client *client, u8 *fw_section,
ret = gup_recall_check(client, fw_section, start_addr,
FW_SECTION_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_section]recall check 8k firmware fail.");
+ pr_err("[burn_fw_section]recall check 8k firmware fail.\n");
return FAIL;
}
/* step11:disable accessing code */
ret = gup_set_ic_msg(client, _bRW_MISCTL__MEM_CD_EN, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_section]disable accessing code fail.");
+ pr_err("[burn_fw_section]disable accessing code fail.\n");
return FAIL;
}
@@ -1183,101 +1152,101 @@ static u8 gup_burn_dsp_isp(struct i2c_client *client)
u8 *fw_dsp_isp = NULL;
u8 retry = 0;
- GTP_DEBUG("[burn_dsp_isp]Begin burn dsp isp---->>");
+ pr_debug("[burn_dsp_isp]Begin burn dsp isp---->>\n");
/* step1:alloc memory */
- GTP_DEBUG("[burn_dsp_isp]step1:alloc memory");
+ pr_debug("[burn_dsp_isp]step1:alloc memory\n");
while (retry++ < 5) {
fw_dsp_isp = devm_kzalloc(&client->dev, FW_DSP_ISP_LENGTH,
GFP_KERNEL);
if (fw_dsp_isp == NULL) {
continue;
} else {
- GTP_INFO("[burn_dsp_isp]Alloc %dk byte memory success.",
+ pr_info("[burn_dsp_isp]Alloc %dk byte memory success.\n",
(FW_DSP_ISP_LENGTH/1024));
break;
}
}
if (retry == 5) {
- GTP_ERROR("[burn_dsp_isp]Alloc memory fail,exit.");
+ pr_err("[burn_dsp_isp]Alloc memory fail,exit.\n");
return FAIL;
}
/* step2:load dsp isp file data */
- GTP_DEBUG("[burn_dsp_isp]step2:load dsp isp file data");
+ pr_debug("[burn_dsp_isp]step2:load dsp isp file data\n");
ret = gup_load_section_file(fw_dsp_isp, (4 * FW_SECTION_LENGTH +
FW_DSP_LENGTH + FW_BOOT_LENGTH), FW_DSP_ISP_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_dsp_isp]load firmware dsp_isp fail.");
+ pr_err("[burn_dsp_isp]load firmware dsp_isp fail.\n");
return FAIL;
}
/* step3:disable wdt,clear cache enable */
- GTP_DEBUG("[burn_dsp_isp]step3:disable wdt,clear cache enable");
+ pr_debug("[burn_dsp_isp]step3:disable wdt,clear cache enable\n");
ret = gup_set_ic_msg(client, _bRW_MISCTL__TMR0_EN, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]disable wdt fail.");
+ pr_err("[burn_dsp_isp]disable wdt fail.\n");
return FAIL;
}
ret = gup_set_ic_msg(client, _bRW_MISCTL__CACHE_EN, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]clear cache enable fail.");
+ pr_err("[burn_dsp_isp]clear cache enable fail.\n");
return FAIL;
}
/* step4:hold ss51 & dsp */
- GTP_DEBUG("[burn_dsp_isp]step4:hold ss51 & dsp");
+ pr_debug("[burn_dsp_isp]step4:hold ss51 & dsp\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]hold ss51 & dsp fail.");
+ pr_err("[burn_dsp_isp]hold ss51 & dsp fail.\n");
return FAIL;
}
/* step5:set boot from sram */
- GTP_DEBUG("[burn_dsp_isp]step5:set boot from sram");
+ pr_debug("[burn_dsp_isp]step5:set boot from sram\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOTCTL_B0_, 0x02);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]set boot from sram fail.");
+ pr_err("[burn_dsp_isp]set boot from sram fail.\n");
return FAIL;
}
/* step6:software reboot */
- GTP_DEBUG("[burn_dsp_isp]step6:software reboot");
+ pr_debug("[burn_dsp_isp]step6:software reboot\n");
ret = gup_set_ic_msg(client, _bWO_MISCTL__CPU_SWRST_PULSE, 0x01);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]software reboot fail.");
+ pr_err("[burn_dsp_isp]software reboot fail.\n");
return FAIL;
}
/* step7:select bank2 */
- GTP_DEBUG("[burn_dsp_isp]step7:select bank2");
+ pr_debug("[burn_dsp_isp]step7:select bank2\n");
ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK, 0x02);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]select bank2 fail.");
+ pr_err("[burn_dsp_isp]select bank2 fail.\n");
return FAIL;
}
/* step8:enable accessing code */
- GTP_DEBUG("[burn_dsp_isp]step8:enable accessing code");
+ pr_debug("[burn_dsp_isp]step8:enable accessing code\n");
ret = gup_set_ic_msg(client, _bRW_MISCTL__MEM_CD_EN, 0x01);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]enable accessing code fail.");
+ pr_err("[burn_dsp_isp]enable accessing code fail.\n");
return FAIL;
}
/* step9:burn 4k dsp_isp */
- GTP_DEBUG("[burn_dsp_isp]step9:burn 4k dsp_isp");
+ pr_debug("[burn_dsp_isp]step9:burn 4k dsp_isp\n");
ret = gup_burn_proc(client, fw_dsp_isp, 0xC000, FW_DSP_ISP_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_dsp_isp]burn dsp_isp fail.");
+ pr_err("[burn_dsp_isp]burn dsp_isp fail.\n");
return FAIL;
}
/* step10:set scramble */
- GTP_DEBUG("[burn_dsp_isp]step10:set scramble");
+ pr_debug("[burn_dsp_isp]step10:set scramble\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_dsp_isp]set scramble fail.");
+ pr_err("[burn_dsp_isp]set scramble fail.\n");
return FAIL;
}
@@ -1290,98 +1259,98 @@ static u8 gup_burn_fw_ss51(struct i2c_client *client)
u8 retry = 0;
s32 ret = 0;
- GTP_DEBUG("[burn_fw_ss51]Begin burn ss51 firmware---->>");
+ pr_debug("[burn_fw_ss51]Begin burn ss51 firmware---->>\n");
/* step1:alloc memory */
- GTP_DEBUG("[burn_fw_ss51]step1:alloc memory");
+ pr_debug("[burn_fw_ss51]step1:alloc memory\n");
while (retry++ < 5) {
fw_ss51 = devm_kzalloc(&client->dev, FW_SECTION_LENGTH,
GFP_KERNEL);
if (fw_ss51 == NULL) {
continue;
} else {
- GTP_INFO("[burn_fw_ss51]Alloc %dk byte memory success.",
+ pr_info("[burn_fw_ss51]Alloc %dk byte memory success.\n",
(FW_SECTION_LENGTH/1024));
break;
}
}
if (retry == 5) {
- GTP_ERROR("[burn_fw_ss51]Alloc memory fail,exit.");
+ pr_err("[burn_fw_ss51]Alloc memory fail,exit.\n");
return FAIL;
}
/* step2:load ss51 firmware section 1 file data */
- GTP_DEBUG("[burn_fw_ss51]step2:load ss51 firmware section 1 file data");
+ pr_debug("[burn_fw_ss51]step2:load ss51 firmware section 1 file data\n");
ret = gup_load_section_file(fw_ss51, 0, FW_SECTION_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 1 fail.");
+ pr_err("[burn_fw_ss51]load ss51 firmware section 1 fail.\n");
return FAIL;
}
/* step3:clear control flag */
- GTP_DEBUG("[burn_fw_ss51]step3:clear control flag");
+ pr_debug("[burn_fw_ss51]step3:clear control flag\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_ss51]clear control flag fail.");
+ pr_err("[burn_fw_ss51]clear control flag fail.\n");
return FAIL;
}
/* step4:burn ss51 firmware section 1 */
- GTP_DEBUG("[burn_fw_ss51]step4:burn ss51 firmware section 1");
+ pr_debug("[burn_fw_ss51]step4:burn ss51 firmware section 1\n");
ret = gup_burn_fw_section(client, fw_ss51, 0xC000, 0x01);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 1 fail.");
+ pr_err("[burn_fw_ss51]burn ss51 firmware section 1 fail.\n");
return FAIL;
}
/* step5:load ss51 firmware section 2 file data */
- GTP_DEBUG("[burn_fw_ss51]step5:load ss51 firmware section 2 file data");
+ pr_debug("[burn_fw_ss51]step5:load ss51 firmware section 2 file data\n");
ret = gup_load_section_file(fw_ss51, FW_SECTION_LENGTH,
FW_SECTION_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 2 fail.");
+ pr_err("[burn_fw_ss51]load ss51 firmware section 2 fail.\n");
return FAIL;
}
/* step6:burn ss51 firmware section 2 */
- GTP_DEBUG("[burn_fw_ss51]step6:burn ss51 firmware section 2");
+ pr_debug("[burn_fw_ss51]step6:burn ss51 firmware section 2\n");
ret = gup_burn_fw_section(client, fw_ss51, 0xE000, 0x02);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 2 fail.");
+ pr_err("[burn_fw_ss51]burn ss51 firmware section 2 fail.\n");
return FAIL;
}
/* step7:load ss51 firmware section 3 file data */
- GTP_DEBUG("[burn_fw_ss51]step7:load ss51 firmware section 3 file data");
+ pr_debug("[burn_fw_ss51]step7:load ss51 firmware section 3 file data\n");
ret = gup_load_section_file(fw_ss51, 2*FW_SECTION_LENGTH,
FW_SECTION_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 3 fail.");
+ pr_err("[burn_fw_ss51]load ss51 firmware section 3 fail.\n");
return FAIL;
}
/* step8:burn ss51 firmware section 3 */
- GTP_DEBUG("[burn_fw_ss51]step8:burn ss51 firmware section 3");
+ pr_debug("[burn_fw_ss51]step8:burn ss51 firmware section 3\n");
ret = gup_burn_fw_section(client, fw_ss51, 0xC000, 0x13);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 3 fail.");
+ pr_err("[burn_fw_ss51]burn ss51 firmware section 3 fail.\n");
return FAIL;
}
/* step9:load ss51 firmware section 4 file data */
- GTP_DEBUG("[burn_fw_ss51]step9:load ss51 firmware section 4 file data");
+ pr_debug("[burn_fw_ss51]step9:load ss51 firmware section 4 file data\n");
ret = gup_load_section_file(fw_ss51, 3*FW_SECTION_LENGTH,
FW_SECTION_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]load ss51 firmware section 4 fail.");
+ pr_err("[burn_fw_ss51]load ss51 firmware section 4 fail.\n");
return FAIL;
}
/* step10:burn ss51 firmware section 4 */
- GTP_DEBUG("[burn_fw_ss51]step10:burn ss51 firmware section 4");
+ pr_debug("[burn_fw_ss51]step10:burn ss51 firmware section 4\n");
ret = gup_burn_fw_section(client, fw_ss51, 0xE000, 0x14);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_ss51]burn ss51 firmware section 4 fail.");
+ pr_err("[burn_fw_ss51]burn ss51 firmware section 4 fail.\n");
return FAIL;
}
@@ -1395,101 +1364,97 @@ static u8 gup_burn_fw_dsp(struct i2c_client *client)
u8 retry = 0;
u8 rd_buf[5];
- GTP_DEBUG("[burn_fw_dsp]Begin burn dsp firmware---->>");
+ pr_debug("[burn_fw_dsp]Begin burn dsp firmware---->>\n");
/* step1:alloc memory */
- GTP_DEBUG("[burn_fw_dsp]step1:alloc memory");
+ pr_debug("[burn_fw_dsp]step1:alloc memory\n");
while (retry++ < 5) {
fw_dsp = devm_kzalloc(&client->dev, FW_DSP_LENGTH,
GFP_KERNEL);
if (fw_dsp == NULL) {
continue;
} else {
- GTP_INFO("[burn_fw_dsp]Alloc %dk byte memory success.",
+ pr_info("[burn_fw_dsp]Alloc %dk byte memory success.\n",
(FW_SECTION_LENGTH/1024));
break;
}
}
if (retry == 5) {
- GTP_ERROR("[burn_fw_dsp]Alloc memory fail,exit.");
+ pr_err("[burn_fw_dsp]Alloc memory fail,exit.\n");
return FAIL;
}
/* step2:load firmware dsp */
- GTP_DEBUG("[burn_fw_dsp]step2:load firmware dsp");
+ pr_debug("[burn_fw_dsp]step2:load firmware dsp\n");
ret = gup_load_section_file(fw_dsp, 4*FW_SECTION_LENGTH, FW_DSP_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_dsp]load firmware dsp fail.");
+ pr_err("[burn_fw_dsp]load firmware dsp fail.\n");
return ret;
}
/* step3:select bank3 */
- GTP_DEBUG("[burn_fw_dsp]step3:select bank3");
+ pr_debug("[burn_fw_dsp]step3:select bank3\n");
ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK, 0x03);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_dsp]select bank3 fail.");
+ pr_err("[burn_fw_dsp]select bank3 fail.\n");
return FAIL;
}
/* Step4:hold ss51 & dsp */
- GTP_DEBUG("[burn_fw_dsp]step4:hold ss51 & dsp");
+ pr_debug("[burn_fw_dsp]step4:hold ss51 & dsp\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_dsp]hold ss51 & dsp fail.");
+ pr_err("[burn_fw_dsp]hold ss51 & dsp fail.\n");
return FAIL;
}
/* step5:set scramble */
- GTP_DEBUG("[burn_fw_dsp]step5:set scramble");
+ pr_debug("[burn_fw_dsp]step5:set scramble\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_dsp]set scramble fail.");
+ pr_err("[burn_fw_dsp]set scramble fail.\n");
return FAIL;
}
/* step6:release ss51 & dsp */
- GTP_DEBUG("[burn_fw_dsp]step6:release ss51 & dsp");
+ pr_debug("[burn_fw_dsp]step6:release ss51 & dsp\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x04);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_dsp]release ss51 & dsp fail.");
+ pr_err("[burn_fw_dsp]release ss51 & dsp fail.\n");
return FAIL;
}
/* must delay */
msleep(20);
/* step7:burn 4k dsp firmware */
- GTP_DEBUG("[burn_fw_dsp]step7:burn 4k dsp firmware");
+ pr_debug("[burn_fw_dsp]step7:burn 4k dsp firmware\n");
ret = gup_burn_proc(client, fw_dsp, 0x9000, FW_DSP_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_dsp]burn fw_section fail.");
+ pr_err("[burn_fw_dsp]burn fw_section fail.\n");
return ret;
}
/* step8:send burn cmd to move data to flash from sram */
- GTP_DEBUG("[burn_fw_dsp]step8:send burn cmd to move data to flash",
- "from sram");
+ pr_debug("[burn_fw_dsp]step8:send burn cmd to move data to flash from sram\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x05);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_dsp]send burn cmd fail.");
+ pr_err("[burn_fw_dsp]send burn cmd fail.\n");
return ret;
}
- GTP_DEBUG("[burn_fw_dsp]Wait for the burn is complete......");
+ pr_debug("[burn_fw_dsp]Wait for the burn is complete......\n");
do {
ret = gup_get_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, rd_buf, 1);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_dsp]Get burn state fail");
+ pr_err("[burn_fw_dsp]Get burn state fail\n");
return ret;
}
msleep(20);
- /* GTP_DEBUG("[burn_fw_dsp]Get burn state:%d.",
- * rd_buf[GTP_ADDR_LENGTH]);
- */
} while (rd_buf[GTP_ADDR_LENGTH]);
/* step9:recall check 4k dsp firmware */
- GTP_DEBUG("[burn_fw_dsp]step9:recall check 4k dsp firmware");
+ pr_debug("[burn_fw_dsp]step9:recall check 4k dsp firmware\n");
ret = gup_recall_check(client, fw_dsp, 0x9000, FW_DSP_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_dsp]recall check 4k dsp firmware fail.");
+ pr_err("[burn_fw_dsp]recall check 4k dsp firmware fail.\n");
return ret;
}
@@ -1503,119 +1468,115 @@ static u8 gup_burn_fw_boot(struct i2c_client *client)
u8 retry = 0;
u8 rd_buf[5];
- GTP_DEBUG("[burn_fw_boot]Begin burn bootloader firmware---->>");
+ pr_debug("[burn_fw_boot]Begin burn bootloader firmware---->>\n");
/* step1:Alloc memory */
- GTP_DEBUG("[burn_fw_boot]step1:Alloc memory");
+ pr_debug("[burn_fw_boot]step1:Alloc memory\n");
while (retry++ < 5) {
fw_boot = devm_kzalloc(&client->dev, FW_BOOT_LENGTH,
GFP_KERNEL);
if (fw_boot == NULL) {
continue;
} else {
- GTP_INFO("[burn_fw_boot]Alloc %dk byte memory success.",
+ pr_info("[burn_fw_boot]Alloc %dk byte memory success.\n",
(FW_BOOT_LENGTH/1024));
break;
}
}
if (retry == 5) {
- GTP_ERROR("[burn_fw_boot]Alloc memory fail,exit.");
+ pr_err("[burn_fw_boot]Alloc memory fail,exit.\n");
return FAIL;
}
/* step2:load firmware bootloader */
- GTP_DEBUG("[burn_fw_boot]step2:load firmware bootloader");
+ pr_debug("[burn_fw_boot]step2:load firmware bootloader\n");
ret = gup_load_section_file(fw_boot, (4 * FW_SECTION_LENGTH +
FW_DSP_LENGTH), FW_BOOT_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_boot]load firmware dsp fail.");
+ pr_err("[burn_fw_boot]load firmware dsp fail.\n");
return ret;
}
/* step3:hold ss51 & dsp */
- GTP_DEBUG("[burn_fw_boot]step3:hold ss51 & dsp");
+ pr_debug("[burn_fw_boot]step3:hold ss51 & dsp\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x0C);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]hold ss51 & dsp fail.");
+ pr_err("[burn_fw_boot]hold ss51 & dsp fail.\n");
return FAIL;
}
/* step4:set scramble */
- GTP_DEBUG("[burn_fw_boot]step4:set scramble");
+ pr_debug("[burn_fw_boot]step4:set scramble\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_OPT_B0_, 0x00);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]set scramble fail.");
+ pr_err("[burn_fw_boot]set scramble fail.\n");
return FAIL;
}
/* step5:release ss51 & dsp */
- GTP_DEBUG("[burn_fw_boot]step5:release ss51 & dsp");
+ pr_debug("[burn_fw_boot]step5:release ss51 & dsp\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x04);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]release ss51 & dsp fail.");
+ pr_err("[burn_fw_boot]release ss51 & dsp fail.\n");
return FAIL;
}
/* must delay */
msleep(20);
/* step6:select bank3 */
- GTP_DEBUG("[burn_fw_boot]step6:select bank3");
+ pr_debug("[burn_fw_boot]step6:select bank3\n");
ret = gup_set_ic_msg(client, _bRW_MISCTL__SRAM_BANK, 0x03);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]select bank3 fail.");
+ pr_err("[burn_fw_boot]select bank3 fail.\n");
return FAIL;
}
/* step7:burn 2k bootloader firmware */
- GTP_DEBUG("[burn_fw_boot]step7:burn 2k bootloader firmware");
+ pr_debug("[burn_fw_boot]step7:burn 2k bootloader firmware\n");
ret = gup_burn_proc(client, fw_boot, 0x9000, FW_BOOT_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_boot]burn fw_section fail.");
+ pr_err("[burn_fw_boot]burn fw_section fail.\n");
return ret;
}
/* step7:send burn cmd to move data to flash from sram */
- GTP_DEBUG("[burn_fw_boot]step7:send burn cmd to move data to",
- "flash from sram");
+ pr_debug("[burn_fw_boot]step7:send burn cmd to move data to flash from sram\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x06);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]send burn cmd fail.");
+ pr_err("[burn_fw_boot]send burn cmd fail.\n");
return ret;
}
- GTP_DEBUG("[burn_fw_boot]Wait for the burn is complete......");
+ pr_debug("[burn_fw_boot]Wait for the burn is complete......\n");
do {
ret = gup_get_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, rd_buf, 1);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]Get burn state fail");
+ pr_err("[burn_fw_boot]Get burn state fail\n");
return ret;
}
msleep(20);
- /* GTP_DEBUG("[burn_fw_boot]Get burn state:%d.",
- * rd_buf[GTP_ADDR_LENGTH]);
- */
} while (rd_buf[GTP_ADDR_LENGTH]);
/* step8:recall check 2k bootloader firmware */
- GTP_DEBUG("[burn_fw_boot]step8:recall check 2k bootloader firmware");
+ pr_debug("[burn_fw_boot]step8:recall check 2k bootloader firmware\n");
ret = gup_recall_check(client, fw_boot, 0x9000, FW_BOOT_LENGTH);
if (ret == FAIL) {
- GTP_ERROR("[burn_fw_boot]recall check 4k dsp firmware fail.");
+ pr_err("[burn_fw_boot]recall check 4k dsp firmware fail.\n");
return ret;
}
/* step9:enable download DSP code */
- GTP_DEBUG("[burn_fw_boot]step9:enable download DSP code ");
+ pr_debug("[burn_fw_boot]step9:enable download DSP code\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__BOOT_CTL_, 0x99);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]enable download DSP code fail.");
+ pr_err("[burn_fw_boot]enable download DSP code fail.\n");
return FAIL;
}
/* step10:release ss51 & hold dsp */
- GTP_DEBUG("[burn_fw_boot]step10:release ss51 & hold dsp");
+ pr_debug("[burn_fw_boot]step10:release ss51 & hold dsp\n");
ret = gup_set_ic_msg(client, _rRW_MISCTL__SWRST_B0_, 0x08);
if (ret <= 0) {
- GTP_ERROR("[burn_fw_boot]release ss51 & hold dsp fail.");
+ pr_err("[burn_fw_boot]release ss51 & hold dsp fail.\n");
return FAIL;
}
@@ -1629,7 +1590,7 @@ s32 gup_update_proc(void *dir)
st_fw_head fw_head;
struct goodix_ts_data *ts = NULL;
- GTP_DEBUG("[update_proc]Begin update ......");
+ pr_debug("[update_proc]Begin update ......\n");
show_len = 1;
total_len = 100;
@@ -1642,7 +1603,7 @@ s32 gup_update_proc(void *dir)
if (searching_file) {
/* exit .bin update file searching */
searching_file = 0;
- GTP_INFO("Exiting searching .bin update file...");
+ pr_info("Exiting searching .bin update file...\n");
/* wait for auto update quitted completely */
while ((show_len != 200) && (show_len != 100))
msleep(100);
@@ -1651,20 +1612,20 @@ s32 gup_update_proc(void *dir)
update_msg.file = NULL;
ret = gup_check_update_file(i2c_connect_client, &fw_head, (u8 *)dir);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]check update file fail.");
+ pr_err("[update_proc]check update file fail.\n");
goto file_fail;
}
/* gtp_reset_guitar(i2c_connect_client, 20); */
ret = gup_get_ic_fw_msg(i2c_connect_client);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]get ic message fail.");
+ pr_err("[update_proc]get ic message fail.\n");
goto file_fail;
}
ret = gup_enter_update_judge(&fw_head);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]Check *.bin file fail.");
+ pr_err("[update_proc]Check *.bin file fail.\n");
goto file_fail;
}
@@ -1675,7 +1636,7 @@ s32 gup_update_proc(void *dir)
#endif
ret = gup_enter_update_mode(i2c_connect_client);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]enter update mode fail.");
+ pr_err("[update_proc]enter update mode fail.\n");
goto update_fail;
}
@@ -1684,53 +1645,53 @@ s32 gup_update_proc(void *dir)
total_len = 100;
ret = gup_burn_dsp_isp(i2c_connect_client);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]burn dsp isp fail.");
+ pr_err("[update_proc]burn dsp isp fail.\n");
continue;
}
show_len += 10;
ret = gup_burn_fw_ss51(i2c_connect_client);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]burn ss51 firmware fail.");
+ pr_err("[update_proc]burn ss51 firmware fail.\n");
continue;
}
show_len += 40;
ret = gup_burn_fw_dsp(i2c_connect_client);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]burn dsp firmware fail.");
+ pr_err("[update_proc]burn dsp firmware fail.\n");
continue;
}
show_len += 20;
ret = gup_burn_fw_boot(i2c_connect_client);
if (ret == FAIL) {
- GTP_ERROR("[update_proc]burn bootloader fw fail.");
+ pr_err("[update_proc]burn bootloader fw fail.\n");
continue;
}
show_len += 10;
- GTP_INFO("[update_proc]UPDATE SUCCESS.");
+ pr_info("[update_proc]UPDATE SUCCESS.\n");
break;
}
if (retry >= 5) {
- GTP_ERROR("[update_proc]retry timeout,UPDATE FAIL.");
+ pr_err("[update_proc]retry timeout,UPDATE FAIL.\n");
goto update_fail;
}
- GTP_DEBUG("[update_proc]leave update mode.");
+ pr_debug("[update_proc]leave update mode.\n");
gup_leave_update_mode();
msleep(100);
- /* GTP_DEBUG("[update_proc]send config.");
+ /*
* ret = gtp_send_cfg(i2c_connect_client);
* if(ret < 0) {
- * GTP_ERROR("[update_proc]send config fail.");
+ * pr_err("[update_proc]send config fail.");
* }
*/
if (ts->fw_error) {
- GTP_INFO("firmware error auto update, resent config!");
+ pr_info("firmware error auto update, resent config!\n");
gup_init_panel(ts);
}
show_len = 100;
@@ -1761,17 +1722,20 @@ file_fail:
return FAIL;
}
+static void gup_update_work(struct work_struct *work)
+{
+ if (gup_update_proc(NULL) == FAIL)
+ pr_err("Goodix update work fail\n");
+}
+
#if GTP_AUTO_UPDATE
u8 gup_init_update_proc(struct goodix_ts_data *ts)
{
- struct task_struct *thread = NULL;
+ dev_dbg(&ts->client->dev, "Ready to run update work\n");
- GTP_INFO("Ready to run update thread.");
- thread = kthread_run(gup_update_proc, (void *)NULL, "guitar_update");
- if (IS_ERR(thread)) {
- GTP_ERROR("Failed to create update thread.\n");
- return -EINVAL;
- }
+ INIT_DELAYED_WORK(&ts->goodix_update_work, gup_update_work);
+ schedule_delayed_work(&ts->goodix_update_work,
+ msecs_to_jiffies(3000));
return 0;
}