goodix_driver_gt9886: cleanup and fix code styling
Fix code problems noted by checkpatch.pl Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ int goodix_start_cfg_bin(struct goodix_ts_core *ts_core)
|
||||
{
|
||||
struct task_struct *cfg_bin_thrd;
|
||||
/* create and run update thread */
|
||||
ts_err("enter::%s\n",__func__);
|
||||
ts_err("enter::%s\n", __func__);
|
||||
cfg_bin_thrd = kthread_run(goodix_cfg_bin_proc, ts_core, "goodix-parse_cfg_bin");
|
||||
if (IS_ERR_OR_NULL(cfg_bin_thrd)) {
|
||||
ts_err("Failed to create update thread:%ld", PTR_ERR(cfg_bin_thrd));
|
||||
@@ -24,6 +24,7 @@ int goodix_parse_cfg_bin(struct goodix_cfg_bin *cfg_bin)
|
||||
u8 checksum;
|
||||
int i, r;
|
||||
u16 offset1, offset2;
|
||||
|
||||
if (!cfg_bin->bin_data || cfg_bin->bin_data_len == 0) {
|
||||
ts_err("NO cfg_bin data, cfg_bin data length:%d", cfg_bin->bin_data_len);
|
||||
r = -EINVAL;
|
||||
@@ -50,9 +51,9 @@ int goodix_parse_cfg_bin(struct goodix_cfg_bin *cfg_bin)
|
||||
|
||||
/*check cfg_bin valid*/
|
||||
checksum = 0;
|
||||
for (i = TS_BIN_VERSION_START_INDEX; i < cfg_bin->bin_data_len; i++) {
|
||||
for (i = TS_BIN_VERSION_START_INDEX; i < cfg_bin->bin_data_len; i++)
|
||||
checksum += cfg_bin->bin_data[i];
|
||||
}
|
||||
|
||||
if (checksum != cfg_bin->head.checksum) {
|
||||
ts_err("cfg_bin checksum ERROR, checksum in cfg_bin:0x%02x, checksum caculate:0x%02x",
|
||||
cfg_bin->head.checksum, checksum);
|
||||
@@ -63,7 +64,6 @@ int goodix_parse_cfg_bin(struct goodix_cfg_bin *cfg_bin)
|
||||
/*allocate memory for cfg packages*/
|
||||
cfg_bin->cfg_pkgs = kzalloc(sizeof(struct goodix_cfg_package) * cfg_bin->head.pkg_num, GFP_KERNEL);
|
||||
if (!cfg_bin->cfg_pkgs) {
|
||||
ts_err("cfg_pkgs, allocate memory ERROR");
|
||||
r = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
@@ -147,8 +147,8 @@ int goodix_cfg_bin_proc(void *data)
|
||||
int r;
|
||||
|
||||
struct goodix_cfg_bin *cfg_bin = kzalloc(sizeof(struct goodix_cfg_bin), GFP_KERNEL);
|
||||
|
||||
if (!cfg_bin) {
|
||||
ts_err("Failed to alloc memory for cfg_bin");
|
||||
r = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
@@ -222,7 +222,8 @@ int goodix_cfg_bin_proc(void *data)
|
||||
core_data->cfg_group_parsed = true;
|
||||
|
||||
/* inform the external module manager that
|
||||
* touch core layer is ready now */
|
||||
* touch core layer is ready now
|
||||
*/
|
||||
core_data->fod_status = 1;
|
||||
goodix_modules.core_data = core_data;
|
||||
goodix_modules.core_exit = false;
|
||||
@@ -263,6 +264,7 @@ int goodix_get_reg_and_cfg(struct goodix_ts_device *ts_dev, struct goodix_cfg_bi
|
||||
u8 temp_fw_mask[TS_CFG_BLOCK_FW_MASK_LEN] = {0x00};
|
||||
u8 temp_pid[TS_CFG_BLOCK_PID_LEN] = {0x00};
|
||||
int r = -EINVAL;
|
||||
|
||||
normal_pkg = NULL;
|
||||
high_sense_pkg = NULL;
|
||||
|
||||
@@ -343,10 +345,10 @@ int goodix_get_reg_and_cfg(struct goodix_ts_device *ts_dev, struct goodix_cfg_bi
|
||||
ts_err("read pid FAILED, I2C ERROR, pkg: %d, pid reg:0x%02x", i, addr);
|
||||
goto exit;
|
||||
} else if (strncmp(temp_pid, cfg_bin->cfg_pkgs[i].cnst_info.hw_pid, read_len)) {
|
||||
ts_err("pkg:%d, pid contrast FAILED, reg:0x%02x", i, addr);
|
||||
ts_err("pid from i2c:%s, pid of cfg bin:%s", temp_pid,
|
||||
cfg_bin->cfg_pkgs[i].cnst_info.hw_pid);
|
||||
continue;
|
||||
ts_err("pkg:%d, pid contrast FAILED, reg:0x%02x", i, addr);
|
||||
ts_err("pid from i2c:%s, pid of cfg bin:%s", temp_pid,
|
||||
cfg_bin->cfg_pkgs[i].cnst_info.hw_pid);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*contrast success, cfg_type*/
|
||||
@@ -406,10 +408,9 @@ int goodix_get_reg_and_cfg(struct goodix_ts_device *ts_dev, struct goodix_cfg_bi
|
||||
if (!ts_dev->normal_cfg) {
|
||||
ts_dev->normal_cfg = devm_kzalloc(ts_dev->dev,
|
||||
sizeof(*ts_dev->normal_cfg), GFP_KERNEL);
|
||||
if (!ts_dev->normal_cfg) {
|
||||
ts_err("Failed to alloc memory for normal cfg");
|
||||
if (!ts_dev->normal_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mutex_init(&ts_dev->normal_cfg->lock);
|
||||
}
|
||||
|
||||
@@ -424,10 +425,9 @@ int goodix_get_reg_and_cfg(struct goodix_ts_device *ts_dev, struct goodix_cfg_bi
|
||||
if (!ts_dev->highsense_cfg) {
|
||||
ts_dev->highsense_cfg = devm_kzalloc(ts_dev->dev,
|
||||
sizeof(*ts_dev->highsense_cfg), GFP_KERNEL);
|
||||
if (!ts_dev->highsense_cfg) {
|
||||
ts_err("Failed to alloc memory for high sense cfg");
|
||||
if (!ts_dev->highsense_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mutex_init(&ts_dev->highsense_cfg->lock);
|
||||
}
|
||||
|
||||
@@ -492,10 +492,9 @@ int goodix_read_cfg_bin(struct device *dev, struct goodix_cfg_bin *cfg_bin)
|
||||
cfg_bin->bin_data_len = firmware->size;
|
||||
/*allocate memory for cfg_bin->bin_data*/
|
||||
cfg_bin->bin_data = kzalloc(cfg_bin->bin_data_len, GFP_KERNEL);
|
||||
if (!cfg_bin->bin_data) {
|
||||
ts_err("Allocate memory for cfg_bin->bin_data FAILED");
|
||||
if (!cfg_bin->bin_data)
|
||||
r = -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(cfg_bin->bin_data, firmware->data, cfg_bin->bin_data_len);
|
||||
r = 0;
|
||||
exit:
|
||||
@@ -520,10 +519,9 @@ int goodix_read_cfg_bin_from_dts(struct device_node *node, struct goodix_cfg_bin
|
||||
cfg_bin->bin_data_len = len;
|
||||
/*allocate memory for cfg_bin->bin_data*/
|
||||
cfg_bin->bin_data = kzalloc(cfg_bin->bin_data_len, GFP_KERNEL);
|
||||
if (!cfg_bin->bin_data) {
|
||||
ts_err("Allocate memory for cfg_bin->bin_data FAILED");
|
||||
if (!cfg_bin->bin_data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(cfg_bin->bin_data, prop->value, cfg_bin->bin_data_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,9 @@
|
||||
#define TS_CHECK_ISP_STATE_RETRY_TIMES 200
|
||||
#define TS_READ_FLASH_STATE_RETRY_TIMES 200
|
||||
|
||||
/*0: Header update
|
||||
*1: request firmware update*/
|
||||
/* 0: Header update
|
||||
* 1: request firmware update
|
||||
*/
|
||||
atomic_t fw_update_mode = ATOMIC_INIT(1);
|
||||
|
||||
/**
|
||||
@@ -202,7 +203,8 @@ static int goodix_parse_firmware(struct firmware_data *fw_data)
|
||||
}
|
||||
|
||||
/* calculate checksum, note: sum of bytes, but check
|
||||
* by u16 checksum */
|
||||
* by u16 checksum
|
||||
*/
|
||||
for (i = 6, checksum = 0; i < firmware->size; i++)
|
||||
checksum += firmware->data[i];
|
||||
|
||||
@@ -277,22 +279,23 @@ static int goodix_check_update(struct goodix_ts_device *dev,
|
||||
|
||||
/* read version from chip, if we got invalid
|
||||
* firmware version, maybe fimware in flash is
|
||||
* incorrect, so we need to update firmware */
|
||||
* incorrect, so we need to update firmware
|
||||
*/
|
||||
r = dev->hw_ops->read_version(dev, &fw_ver);
|
||||
if (r == -EBUS)
|
||||
return r;
|
||||
|
||||
if (fw_ver.valid) {
|
||||
ts_info("pid_len=%d\n",dev->reg.pid_len);
|
||||
ts_info("tp.pid=%s fw.pid=%s\n",fw_ver.pid,fw_info->fw_pid);
|
||||
ts_info("pid_len=%d\n", dev->reg.pid_len);
|
||||
ts_info("tp.pid=%s fw.pid=%s\n", fw_ver.pid, fw_info->fw_pid);
|
||||
if (memcmp(fw_ver.pid, fw_info->fw_pid, dev->reg.pid_len)) {
|
||||
ts_err("tp.pid=0x%s fw.pid=0x%hhn\n",fw_ver.pid,fw_info->fw_pid);
|
||||
ts_err("tp.pid=0x%s fw.pid=0x%hhn\n", fw_ver.pid, fw_info->fw_pid);
|
||||
ts_err("Product ID is not match");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
ts_info("vid_len=%d\n",dev->reg.vid_len);
|
||||
ts_info("Touchpanel VID:0x%02x 0x%02x 0x%02x 0x%02x",fw_ver.vid[0], fw_ver.vid[1], fw_ver.vid[2], fw_ver.vid[3]);
|
||||
ts_info("vid_len=%d\n", dev->reg.vid_len);
|
||||
ts_info("Touchpanel VID:0x%02x 0x%02x 0x%02x 0x%02x", fw_ver.vid[0], fw_ver.vid[1], fw_ver.vid[2], fw_ver.vid[3]);
|
||||
ts_info("Fimware VID:0x%02X 0x%02x 0x%02x 0x%02x", fw_info->fw_vid[0], fw_info->fw_vid[1], fw_info->fw_vid[2], fw_info->fw_vid[3]);
|
||||
res = memcmp(fw_ver.vid, fw_info->fw_vid, dev->reg.vid_len);
|
||||
if (res == 0) {
|
||||
@@ -325,13 +328,10 @@ static int goodix_reg_write_confirm(struct goodix_ts_device *dev,
|
||||
|
||||
if (len > sizeof(cfm_buf)) {
|
||||
cfm = kzalloc(len, GFP_KERNEL);
|
||||
if (!cfm) {
|
||||
ts_err("Mem alloc failed");
|
||||
if (!cfm)
|
||||
return -ENOMEM;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
cfm = &cfm_buf[0];
|
||||
}
|
||||
|
||||
for (i = 0; i < GOODIX_BUS_RETRY_TIMES; i++) {
|
||||
r = dev->hw_ops->write_trans(dev, addr, data, len);
|
||||
@@ -569,6 +569,7 @@ static int goodix_format_fw_packet(u8 *pkt, u32 flash_addr,
|
||||
u16 len, const u8 *data)
|
||||
{
|
||||
u16 checksum;
|
||||
|
||||
if (!pkt || !data)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -754,7 +755,8 @@ static int goodix_flash_firmware(struct goodix_ts_device *dev,
|
||||
int i, r = 0, fw_num, prog_step;
|
||||
|
||||
/* start from subsystem 1,
|
||||
* subsystem 0 is the ISP program */
|
||||
* subsystem 0 is the ISP program
|
||||
*/
|
||||
fw_ctrl = container_of(fw_data, struct fw_update_ctrl, fw_data);
|
||||
fw_info = &fw_data->fw_info;
|
||||
fw_num = fw_info->subsys_num;
|
||||
@@ -951,7 +953,7 @@ static int goodix_fw_update_thread(void *data)
|
||||
static DEFINE_MUTEX(fwu_lock);
|
||||
int r;
|
||||
|
||||
ts_err("%s:start\n",__func__);
|
||||
ts_err("%s:start\n", __func__);
|
||||
if (!fwu_ctrl) {
|
||||
ts_err("Invaid thread params");
|
||||
goodix_unregister_ext_module(&goodix_fwu_module);
|
||||
@@ -1037,7 +1039,8 @@ static ssize_t goodix_sysfs_update_en_store(
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
int val = 0, r;
|
||||
r = sscanf(buf, "%d", &val);
|
||||
|
||||
r = kstrtoint(buf, 0, &val);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r) {
|
||||
@@ -1053,6 +1056,7 @@ static ssize_t goodix_sysfs_update_progress_show(
|
||||
char *buf)
|
||||
{
|
||||
struct fw_update_ctrl *fw_ctrl = module->priv_data;
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%d\n", fw_ctrl->progress);
|
||||
}
|
||||
|
||||
@@ -1138,10 +1142,8 @@ static ssize_t goodix_sysfs_fwsize_store(struct goodix_ext_module *module,
|
||||
}
|
||||
|
||||
fw = vmalloc(sizeof(*fw) + size);
|
||||
if (fw == NULL) {
|
||||
ts_err("Failed to alloc memory,size:%zu", size + sizeof(*fw));
|
||||
if (fw == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(fw, 0x00, sizeof(*fw) + size);
|
||||
data = (u8 **)&fw->data;
|
||||
@@ -1186,7 +1188,7 @@ static ssize_t goodix_sysfs_force_update_store(
|
||||
struct fw_update_ctrl *fw_ctrl = module->priv_data;
|
||||
int val = 0, r;
|
||||
|
||||
r = sscanf(buf, "%d", &val);
|
||||
r = kstrtoint(buf, 0, &val);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r)
|
||||
@@ -1197,12 +1199,12 @@ static ssize_t goodix_sysfs_force_update_store(
|
||||
}
|
||||
|
||||
static struct goodix_ext_attribute goodix_fwu_attrs[] = {
|
||||
__EXTMOD_ATTR(update_en, S_IWUGO, NULL, goodix_sysfs_update_en_store),
|
||||
__EXTMOD_ATTR(progress, S_IRUGO, goodix_sysfs_update_progress_show, NULL),
|
||||
__EXTMOD_ATTR(result, S_IRUGO, goodix_sysfs_update_result_show, NULL),
|
||||
__EXTMOD_ATTR(fwversion, S_IRUGO, goodix_sysfs_update_fwversion_show, NULL),
|
||||
__EXTMOD_ATTR(fwsize, S_IRUGO | S_IWUGO, goodix_sysfs_fwsize_show, goodix_sysfs_fwsize_store),
|
||||
__EXTMOD_ATTR(force_update, S_IWUGO, NULL, goodix_sysfs_force_update_store),
|
||||
__EXTMOD_ATTR(update_en, 0222, NULL, goodix_sysfs_update_en_store),
|
||||
__EXTMOD_ATTR(progress, 0444, goodix_sysfs_update_progress_show, NULL),
|
||||
__EXTMOD_ATTR(result, 0444, goodix_sysfs_update_result_show, NULL),
|
||||
__EXTMOD_ATTR(fwversion, 0444, goodix_sysfs_update_fwversion_show, NULL),
|
||||
__EXTMOD_ATTR(fwsize, 0666, goodix_sysfs_fwsize_show, goodix_sysfs_fwsize_store),
|
||||
__EXTMOD_ATTR(force_update, 0222, NULL, goodix_sysfs_force_update_store),
|
||||
};
|
||||
|
||||
static int goodix_syfs_init(struct goodix_ts_core *core_data,
|
||||
@@ -1230,7 +1232,7 @@ static int goodix_syfs_init(struct goodix_ts_core *core_data,
|
||||
}
|
||||
|
||||
fw_ctrl->attr_fwimage.attr.name = "fwimage";
|
||||
fw_ctrl->attr_fwimage.attr.mode = S_IRUGO | S_IWUGO;
|
||||
fw_ctrl->attr_fwimage.attr.mode = 0666;
|
||||
fw_ctrl->attr_fwimage.size = 0;
|
||||
fw_ctrl->attr_fwimage.write = goodix_sysfs_fwimage_store;
|
||||
ret = sysfs_create_bin_file(&module->kobj, &fw_ctrl->attr_fwimage);
|
||||
@@ -1252,10 +1254,8 @@ static int goodix_fw_update_init(struct goodix_ts_core *core_data,
|
||||
|
||||
if (!module->priv_data) {
|
||||
module->priv_data = kzalloc(sizeof(struct fw_update_ctrl), GFP_KERNEL);
|
||||
if (!module->priv_data) {
|
||||
ts_err("Failed to alloc memory for fwu_ctrl");
|
||||
if (!module->priv_data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
fwu_ctrl = module->priv_data;
|
||||
fwu_ctrl->ts_dev = core_data->ts_dev;
|
||||
@@ -1266,10 +1266,10 @@ static int goodix_fw_update_init(struct goodix_ts_core *core_data,
|
||||
fwu_ctrl->core_data = core_data;
|
||||
|
||||
/* find a valid firmware image name */
|
||||
if (ts_bdata && ts_bdata->fw_name){
|
||||
if (ts_bdata && ts_bdata->fw_name) {
|
||||
strlcpy(fwu_ctrl->fw_name, ts_bdata->fw_name, sizeof(fwu_ctrl->fw_name));
|
||||
ts_info("find goodix firmware:%s\n",ts_bdata->fw_name);
|
||||
}else{
|
||||
ts_info("find goodix firmware:%s\n", ts_bdata->fw_name);
|
||||
} else{
|
||||
strlcpy(fwu_ctrl->fw_name, TS_DEFAULT_FIRMWARE, sizeof(fwu_ctrl->fw_name));
|
||||
ts_info("can't find goodix firmware,use default name\n");
|
||||
}
|
||||
@@ -1309,6 +1309,7 @@ static int goodix_fw_before_resume(struct goodix_ts_core *core_data,
|
||||
struct goodix_ext_module *module)
|
||||
{
|
||||
struct fw_update_ctrl *fwu_ctrl = module->priv_data;
|
||||
|
||||
return fwu_ctrl->allow_resume ?
|
||||
EVT_HANDLED : EVT_CANCEL_RESUME;
|
||||
}
|
||||
@@ -1323,6 +1324,7 @@ static int goodix_fw_irq_event(struct goodix_ts_core *core_data,
|
||||
struct goodix_ext_module *module)
|
||||
{
|
||||
struct fw_update_ctrl *fwu_ctrl = module->priv_data;
|
||||
|
||||
return fwu_ctrl->allow_irq ?
|
||||
EVT_HANDLED : EVT_CANCEL_IRQEVT;
|
||||
}
|
||||
@@ -1331,6 +1333,7 @@ static int goodix_fw_before_reset(struct goodix_ts_core *core_data,
|
||||
struct goodix_ext_module *module)
|
||||
{
|
||||
struct fw_update_ctrl *fwu_ctrl = module->priv_data;
|
||||
|
||||
return fwu_ctrl->allow_reset ?
|
||||
EVT_HANDLED : EVT_CANCEL_RESET;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ static void __do_register_ext_module(struct work_struct *work)
|
||||
struct goodix_ext_module *ext_module;
|
||||
struct list_head *insert_point = &goodix_modules.head;
|
||||
|
||||
ts_info("__do_register_ext_module IN, goodix_modules.core_exit:%d", goodix_modules.core_exit);
|
||||
ts_info("%s IN, goodix_modules.core_exit:%d", __func__, goodix_modules.core_exit);
|
||||
|
||||
/* waitting for core layer */
|
||||
if (!wait_for_completion_timeout(&goodix_modules.core_comp, 25 * HZ)) {
|
||||
@@ -116,13 +116,13 @@ static void __do_register_ext_module(struct work_struct *work)
|
||||
|
||||
list_for_each_entry(ext_module, &goodix_modules.head, list) {
|
||||
/* small value of priority have
|
||||
* higher priority level*/
|
||||
* higher priority level
|
||||
*/
|
||||
if (ext_module->priority >= module->priority) {
|
||||
insert_point = &ext_module->list;
|
||||
break;
|
||||
}
|
||||
} /* else module will be inserted
|
||||
to goodix_modules->head */
|
||||
}
|
||||
}
|
||||
|
||||
if (module->funcs && module->funcs->init) {
|
||||
@@ -168,10 +168,10 @@ int goodix_register_ext_module(struct goodix_ext_module *module)
|
||||
return -EFAULT;
|
||||
}
|
||||
*/
|
||||
ts_info("goodix_register_ext_module IN");
|
||||
ts_info("%s IN", __func__);
|
||||
INIT_WORK(&module->work, __do_register_ext_module);
|
||||
schedule_work(&module->work);
|
||||
ts_info("goodix_register_ext_module OUT");
|
||||
ts_info("%s OUT", __func__);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(goodix_register_ext_module);
|
||||
@@ -187,6 +187,7 @@ int goodix_unregister_ext_module(struct goodix_ext_module *module)
|
||||
{
|
||||
struct goodix_ext_module *ext_module;
|
||||
bool found = false;
|
||||
|
||||
if (!module)
|
||||
return -EINVAL;
|
||||
if (!goodix_modules.initilized)
|
||||
@@ -306,6 +307,7 @@ EXPORT_SYMBOL_GPL(goodix_msg_printf);
|
||||
static int goodix_debugfs_init(void)
|
||||
{
|
||||
struct dentry *r_b;
|
||||
|
||||
goodix_dbg.buf.size = PAGE_SIZE;
|
||||
goodix_dbg.pos = 0;
|
||||
goodix_dbg.buf.data = kzalloc(goodix_dbg.buf.size, GFP_KERNEL);
|
||||
@@ -439,6 +441,7 @@ static ssize_t goodix_ts_reset_store(struct device *dev,
|
||||
return -EINVAL;
|
||||
if (en != 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (ts_dev->hw_ops->reset)
|
||||
ts_dev->hw_ops->reset(ts_dev);
|
||||
return count;
|
||||
@@ -452,6 +455,7 @@ static ssize_t goodix_ts_read_cfg_show(struct device *dev,
|
||||
struct goodix_ts_device *ts_dev = core_data->ts_dev;
|
||||
int ret, i, offset;
|
||||
char *cfg_buf;
|
||||
|
||||
cfg_buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
|
||||
disable_irq(core_data->irq);
|
||||
@@ -515,8 +519,7 @@ static int goodix_ts_convert_0x_data(const u8 *buf, int buf_size,
|
||||
continue;
|
||||
|
||||
if (temp_index >= m_size) {
|
||||
ts_err("exchange cfg data error, overflow,"
|
||||
"temp_index:%d,m_size:%d\n",
|
||||
ts_err("exchange cfg data error, overflow,temp_index:%d,m_size:%d\n",
|
||||
temp_index, m_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -543,10 +546,9 @@ static ssize_t goodix_ts_send_cfg_store(struct device *dev,
|
||||
const struct firmware *cfg_img;
|
||||
struct goodix_ts_config *config = NULL;
|
||||
|
||||
ts_err("%s::enter\n",__func__);
|
||||
ts_err("%s::enter\n", __func__);
|
||||
if (sscanf(buf, "%d", &en) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (en != 1)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -562,10 +564,8 @@ static ssize_t goodix_ts_send_cfg_store(struct device *dev,
|
||||
ts_info("cfg file [%s] is ready", GOODIX_DEFAULT_CFG_NAME);
|
||||
|
||||
config = kzalloc(sizeof(*config), GFP_KERNEL);
|
||||
if (config == NULL) {
|
||||
ts_err("Memory allco err");
|
||||
if (config == NULL)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/*parse cfg data*/
|
||||
if (goodix_ts_convert_0x_data(cfg_img->data, cfg_img->size,
|
||||
@@ -837,14 +837,14 @@ static ssize_t goodix_ts_game_mode_store(struct device *dev,
|
||||
}
|
||||
#endif
|
||||
|
||||
static DEVICE_ATTR(extmod_info, S_IRUGO, goodix_ts_extmod_show, NULL);
|
||||
static DEVICE_ATTR(driver_info, S_IRUGO, goodix_ts_driver_info_show, NULL);
|
||||
static DEVICE_ATTR(chip_info, S_IRUGO, goodix_ts_chip_info_show, NULL);
|
||||
static DEVICE_ATTR(config_data, S_IRUGO, goodix_ts_config_data_show, NULL);
|
||||
static DEVICE_ATTR(reset, S_IWUSR | S_IWGRP, NULL, goodix_ts_reset_store);
|
||||
static DEVICE_ATTR(send_cfg, S_IWUSR | S_IWGRP, NULL, goodix_ts_send_cfg_store);
|
||||
static DEVICE_ATTR(read_cfg, S_IRUGO, goodix_ts_read_cfg_show, NULL);
|
||||
static DEVICE_ATTR(irq_info, S_IRUGO | S_IWUSR | S_IWGRP,
|
||||
static DEVICE_ATTR(extmod_info, 0444, goodix_ts_extmod_show, NULL);
|
||||
static DEVICE_ATTR(driver_info, 0444, goodix_ts_driver_info_show, NULL);
|
||||
static DEVICE_ATTR(chip_info, 0444, goodix_ts_chip_info_show, NULL);
|
||||
static DEVICE_ATTR(config_data, 0444, goodix_ts_config_data_show, NULL);
|
||||
static DEVICE_ATTR(reset, 0220, NULL, goodix_ts_reset_store);
|
||||
static DEVICE_ATTR(send_cfg, 0220, NULL, goodix_ts_send_cfg_store);
|
||||
static DEVICE_ATTR(read_cfg, 0444, goodix_ts_read_cfg_show, NULL);
|
||||
static DEVICE_ATTR(irq_info, 0664,
|
||||
goodix_ts_irq_info_show, goodix_ts_irq_info_store);
|
||||
#ifdef CONFIG_TOUCHSCREEN_GOODIX_GTX8_GAMEMODE
|
||||
static DEVICE_ATTR(game_mode, 0664,
|
||||
@@ -919,6 +919,7 @@ static void release_all_touches(struct goodix_ts_core *core_data)
|
||||
unsigned int type = MT_TOOL_FINGER;
|
||||
struct goodix_ts_device *ts_dev = core_data->ts_dev;
|
||||
int i;
|
||||
|
||||
mutex_lock(&ts_dev->report_mutex);
|
||||
|
||||
for (i = 0; i < GOODIX_MAX_TOUCH; i++) {
|
||||
@@ -950,9 +951,9 @@ static int goodix_ts_input_report(struct input_dev *dev,
|
||||
unsigned int touch_num = touch_data->touch_num;
|
||||
int i, id;
|
||||
|
||||
if (core_data->fod_status){
|
||||
if ((core_data->event_status & 0x20) == 0x20){
|
||||
ts_info("%s:the data sended was error,return\n",__func__);
|
||||
if (core_data->fod_status) {
|
||||
if ((core_data->event_status & 0x20) == 0x20) {
|
||||
ts_info("%s:the data sended was error,return\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -978,12 +979,8 @@ static int goodix_ts_input_report(struct input_dev *dev,
|
||||
coords->overlapping_area = 0;
|
||||
input_report_abs(dev, ABS_MT_WIDTH_MINOR, coords->overlapping_area);
|
||||
input_report_abs(dev, ABS_MT_WIDTH_MAJOR, coords->overlapping_area);
|
||||
if (!__test_and_set_bit(i, &core_data->touch_id)) {
|
||||
if (!__test_and_set_bit(i, &core_data->touch_id))
|
||||
ts_info("[GTP] %s report press:%d", __func__, i);
|
||||
}
|
||||
dev_dbg(core_data->ts_dev->dev, "[GTP] %s report:[%d](%d, %d, %d, %d)", __func__, id,
|
||||
touch_data->coords[0].x, touch_data->coords[0].y,
|
||||
touch_data->coords[0].area, touch_data->coords[0].overlapping_area);
|
||||
id = (++coords)->id;
|
||||
} else {
|
||||
if (__test_and_clear_bit(i, &core_data->touch_id)) {
|
||||
@@ -999,23 +996,20 @@ static int goodix_ts_input_report(struct input_dev *dev,
|
||||
}
|
||||
}
|
||||
|
||||
/*report finger*/
|
||||
/*ts_info("get_event_now :0x%02x, pre_event : %d", get_event_now, pre_event);*/
|
||||
if ((core_data->event_status & 0x88) == 0x88 && core_data->fod_status) {
|
||||
input_report_key(core_data->input_dev, BTN_INFO, 1);
|
||||
/*input_report_key(core_data->input_dev, KEY_INFO, 1);*/
|
||||
core_data->fod_pressed = true;
|
||||
ts_info("BTN_INFO press");
|
||||
} else if (core_data->fod_pressed && (core_data->event_status & 0x88) != 0x88) {
|
||||
input_report_key(core_data->input_dev, BTN_INFO, 1);
|
||||
core_data->fod_pressed = true;
|
||||
ts_info("BTN_INFO press");
|
||||
} else if (core_data->fod_pressed
|
||||
&& (core_data->event_status & 0x88) != 0x88) {
|
||||
if (unlikely(!core_data->fod_test)) {
|
||||
input_report_key(core_data->input_dev, BTN_INFO, 0);
|
||||
/*input_report_key(core_data->input_dev, KEY_INFO, 0);*/
|
||||
ts_info("BTN_INFO release");
|
||||
core_data->fod_pressed = false;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&ts_dev->report_mutex);
|
||||
input_sync(dev);
|
||||
mutex_unlock(&ts_dev->report_mutex);
|
||||
/* check the ghost touch issue */
|
||||
if (!touch_num && core_data->touch_id) {
|
||||
ts_err("touch fw miss the up event");
|
||||
@@ -1042,8 +1036,6 @@ static void goodix_ts_sleep_work(struct work_struct *work)
|
||||
ts_info("pm_resume_completion timeout, i2c is closed");
|
||||
lpm_disable_for_input(false);
|
||||
return;
|
||||
} else {
|
||||
ts_info("pm_resume_completion be completed, handling irq");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1116,7 +1108,7 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data)
|
||||
r = ext_module->funcs->irq_event(core_data, ext_module);
|
||||
/*ts_err("enter %s r=%d\n", __func__, r);*/
|
||||
if (r == EVT_CANCEL_IRQEVT) {
|
||||
ts_err("enter %s EVT_CANCEL_IRQEVT \n", __func__);
|
||||
ts_err("enter %s EVT_CANCEL_IRQEVT\n", __func__);
|
||||
mutex_unlock(&goodix_modules.mutex);
|
||||
lpm_disable_for_input(false);
|
||||
goto handled;
|
||||
@@ -1154,11 +1146,10 @@ int goodix_ts_irq_setup(struct goodix_ts_core *core_data)
|
||||
int r;
|
||||
|
||||
/* if ts_bdata-> irq is invalid */
|
||||
if (ts_bdata->irq <= 0) {
|
||||
if (ts_bdata->irq <= 0)
|
||||
core_data->irq = gpio_to_irq(ts_bdata->irq_gpio);
|
||||
} else {
|
||||
else
|
||||
core_data->irq = ts_bdata->irq;
|
||||
}
|
||||
|
||||
ts_info("IRQ:%u,flags:%d", core_data->irq, (int)ts_bdata->irq_flags);
|
||||
r = devm_request_threaded_irq(&core_data->pdev->dev,
|
||||
@@ -1209,10 +1200,11 @@ EXPORT_SYMBOL(goodix_ts_irq_enable);
|
||||
static int goodix_ts_power_init(struct goodix_ts_core *core_data)
|
||||
{
|
||||
struct goodix_ts_board_data *ts_bdata;
|
||||
ts_bdata = board_data(core_data);
|
||||
|
||||
gpio_direction_output(ts_bdata->reset_gpio, 0);
|
||||
gpio_direction_output(ts_bdata->irq_gpio, 1);
|
||||
ts_bdata = board_data(core_data);
|
||||
|
||||
gpio_direction_output(ts_bdata->reset_gpio, 0);
|
||||
gpio_direction_output(ts_bdata->irq_gpio, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1227,7 +1219,7 @@ int goodix_ts_power_on(struct goodix_ts_core *core_data)
|
||||
struct goodix_ts_board_data *ts_bdata = board_data(core_data);
|
||||
int r = 0;
|
||||
|
||||
ts_err("enter::%s\n",__func__);
|
||||
ts_err("enter::%s\n", __func__);
|
||||
if (core_data->power_on)
|
||||
return 0;
|
||||
gpio_direction_output(ts_bdata->vdd_gpio, 1);
|
||||
@@ -1394,10 +1386,10 @@ static ssize_t gtp_fod_status_store(struct device *dev,
|
||||
|
||||
return count;
|
||||
}
|
||||
static DEVICE_ATTR(fod_status, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
static DEVICE_ATTR(fod_status, (0664),
|
||||
gtp_fod_status_show, gtp_fod_status_store);
|
||||
|
||||
static DEVICE_ATTR(fod_test, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
static DEVICE_ATTR(fod_test, (0664),
|
||||
NULL, gtp_fod_test_store);
|
||||
|
||||
static void goodix_switch_mode_work(struct work_struct *work)
|
||||
@@ -1575,7 +1567,8 @@ int goodix_ts_hw_init(struct goodix_ts_core *core_data)
|
||||
exit:
|
||||
/* if bus communication error occured then
|
||||
* exit driver binding, other errors will
|
||||
* be ignored */
|
||||
* be ignored
|
||||
*/
|
||||
if (r != -EBUS)
|
||||
r = 0;
|
||||
return r;
|
||||
@@ -1635,13 +1628,12 @@ static void goodix_ts_esd_on(struct goodix_ts_core *core)
|
||||
{
|
||||
struct goodix_ts_esd *ts_esd = &core->ts_esd;
|
||||
|
||||
if(core->ts_dev->reg.esd == 0)
|
||||
if (core->ts_dev->reg.esd == 0)
|
||||
return;
|
||||
|
||||
atomic_set(&ts_esd->esd_on, 1);
|
||||
if (!schedule_delayed_work(&ts_esd->esd_work, GOODIX_ESD_CHECK_INTERVAL * HZ)) {
|
||||
if (!schedule_delayed_work(&ts_esd->esd_work, GOODIX_ESD_CHECK_INTERVAL * HZ))
|
||||
ts_info("esd work already in workqueue");
|
||||
}
|
||||
ts_info("esd on");
|
||||
}
|
||||
|
||||
@@ -1754,19 +1746,16 @@ int goodix_ts_suspend(struct goodix_ts_core *core_data)
|
||||
|
||||
r = ext_module->funcs->before_suspend(core_data, ext_module);
|
||||
if (r == EVT_CANCEL_SUSPEND) {
|
||||
if (core_data->double_wakeup && (core_data->aod_status || core_data->fod_status)) {
|
||||
if (core_data->double_wakeup && (core_data->aod_status || core_data->fod_status))
|
||||
atomic_set(&core_data->suspend_stat, TP_GESTURE_DBCLK_FOD);
|
||||
} else if (core_data->double_wakeup && (!core_data->aod_status)) {
|
||||
else if (core_data->double_wakeup && (!core_data->aod_status))
|
||||
atomic_set(&core_data->suspend_stat, TP_GESTURE_DBCLK);
|
||||
} else if (core_data->fod_status && core_data->aod_status) {
|
||||
else if (core_data->fod_status && core_data->aod_status)
|
||||
atomic_set(&core_data->suspend_stat, TP_GESTURE_FOD);
|
||||
}
|
||||
mutex_unlock(&goodix_modules.mutex);
|
||||
ts_info("suspend_stat[%d]", atomic_read(&core_data->suspend_stat));
|
||||
ts_info("Canceled by module:%s", ext_module->name);
|
||||
if(!atomic_read(&core_data->suspend_stat))
|
||||
ts_info("go suspend remaind work\n");
|
||||
else
|
||||
if (atomic_read(&core_data->suspend_stat))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -1892,7 +1881,7 @@ out:
|
||||
*/
|
||||
goodix_ts_blocking_notify(NOTIFY_RESUME, NULL);
|
||||
|
||||
ts_err("core_data->fod_pressed = %d\n",core_data->fod_pressed);
|
||||
ts_err("core_data->fod_pressed = %d\n", core_data->fod_pressed);
|
||||
|
||||
if (!core_data->fod_pressed) {
|
||||
ts_err("resume release all touch");
|
||||
@@ -1910,6 +1899,7 @@ static int goodix_bl_state_chg_callback(struct notifier_block *nb, unsigned long
|
||||
{
|
||||
struct goodix_ts_core *core_data = container_of(nb, struct goodix_ts_core, bl_notifier);
|
||||
unsigned int blank;
|
||||
|
||||
if (val != BACKLIGHT_UPDATED)
|
||||
return NOTIFY_OK;
|
||||
if (data && core_data) {
|
||||
@@ -2009,9 +1999,9 @@ static void goodix_ts_suspend_work(struct work_struct *work)
|
||||
static int goodix_ts_pm_suspend(struct device *dev)
|
||||
{
|
||||
struct goodix_ts_core *core_data = dev_get_drvdata(dev);
|
||||
if (device_may_wakeup(dev) && core_data->gesture_enabled) {
|
||||
|
||||
if (device_may_wakeup(dev) && core_data->gesture_enabled)
|
||||
enable_irq_wake(core_data->irq);
|
||||
}
|
||||
|
||||
core_data->tp_already_suspend = true;
|
||||
reinit_completion(&core_data->pm_resume_completion);
|
||||
@@ -2026,9 +2016,8 @@ static int goodix_ts_pm_resume(struct device *dev)
|
||||
{
|
||||
struct goodix_ts_core *core_data =
|
||||
dev_get_drvdata(dev);
|
||||
if (device_may_wakeup(dev) && core_data->gesture_enabled) {
|
||||
if (device_may_wakeup(dev) && core_data->gesture_enabled)
|
||||
disable_irq_wake(core_data->irq);
|
||||
}
|
||||
|
||||
core_data->tp_already_suspend = false;
|
||||
complete(&core_data->pm_resume_completion);
|
||||
@@ -2157,7 +2146,8 @@ int goodix_generic_noti_callback(struct notifier_block *self,
|
||||
/* Firmware has been updated, we need to reinit
|
||||
* the chip, read the sensor ID and send the
|
||||
* correct config data based on sensor ID.
|
||||
* The input parameters also needs to be updated.*/
|
||||
* The input parameters also needs to be updated.
|
||||
*/
|
||||
r = hw_ops->init(ts_core->ts_dev);
|
||||
if (r < 0)
|
||||
goto exit;
|
||||
@@ -2220,7 +2210,7 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
int r;
|
||||
u8 read_val = 0;
|
||||
|
||||
ts_err("enter::%s\n",__func__);
|
||||
ts_err("enter::%s\n", __func__);
|
||||
ts_device = pdev->dev.platform_data;
|
||||
if (!ts_device || !ts_device->hw_ops ||
|
||||
!ts_device->board_data) {
|
||||
@@ -2229,10 +2219,8 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
core_data = devm_kzalloc(&pdev->dev, sizeof(struct goodix_ts_core), GFP_KERNEL);
|
||||
if (!core_data) {
|
||||
ts_err("Failed to allocate memory for core data");
|
||||
if (!core_data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
goodix_core_data = core_data;
|
||||
|
||||
/* touch core layer is a platform driver */
|
||||
@@ -2246,13 +2234,13 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
|
||||
r = goodix_ts_power_init(core_data);
|
||||
if (r < 0) {
|
||||
pr_err("goodix_ts_power_init fail \n");
|
||||
pr_err("goodix_ts_power_init fail\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
r = goodix_ts_power_on(core_data);
|
||||
if (r < 0) {
|
||||
pr_err("goodix_ts_power_on fail \n");
|
||||
pr_err("goodix_ts_power_on fail\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2269,7 +2257,7 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
/* get GPIO resource */
|
||||
r = goodix_ts_gpio_setup(core_data);
|
||||
if (r < 0) {
|
||||
pr_err("goodix_ts_gpio_setup fail \n");
|
||||
pr_err("goodix_ts_gpio_setup fail\n");
|
||||
goto out;
|
||||
}
|
||||
/*init lock to protect suspend_stat*/
|
||||
@@ -2284,7 +2272,7 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
|
||||
r = ts_device->hw_ops->reset(ts_device);
|
||||
if (r < 0) {
|
||||
pr_err("goodix_hw_ops->reset fail \n");
|
||||
pr_err("goodix_hw_ops->reset fail\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2312,14 +2300,11 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/*unified protocl
|
||||
* start a thread to parse cfg_bin and init IC*/
|
||||
* start a thread to parse cfg_bin and init IC
|
||||
*/
|
||||
r = goodix_start_cfg_bin(core_data);
|
||||
if (!r) {
|
||||
ts_info("***start cfg_bin_proc SUCCESS");
|
||||
} else {
|
||||
ts_err("***start cfg_bin_proc FAILED");
|
||||
if (r)
|
||||
goto out;
|
||||
}
|
||||
|
||||
core_data->power_supply_notifier.notifier_call = gtp_power_supply_event;
|
||||
power_supply_reg_notifier(&core_data->power_supply_notifier);
|
||||
@@ -2369,7 +2354,7 @@ static int goodix_ts_probe(struct platform_device *pdev)
|
||||
|
||||
out:
|
||||
backlight_unregister_notifier(&core_data->bl_notifier);
|
||||
ts_info("goodix_ts_probe OUT, r:%d", r);
|
||||
ts_info("%s OUT, r:%d", __func__, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@@ -604,7 +604,7 @@ struct goodix_ext_attribute {
|
||||
/* external attrs helper macro, used to define external attrs */
|
||||
#define DEFINE_EXTMOD_ATTR(_name, _mode, _show, _store) \
|
||||
static struct goodix_ext_attribute ext_attr_##_name = \
|
||||
__EXTMOD_ATTR(_name, _mode, _show, _store);
|
||||
__EXTMOD_ATTR(_name, _mode, _show, _store)
|
||||
|
||||
/*
|
||||
* get board data pointer
|
||||
@@ -644,6 +644,7 @@ static inline u8 checksum_u8(u8 *data, u32 size)
|
||||
{
|
||||
u8 checksum = 0;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
checksum += data[i];
|
||||
return checksum;
|
||||
@@ -663,6 +664,7 @@ static inline u16 checksum_be16(u8 *data, u32 size)
|
||||
{
|
||||
u16 checksum = 0;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < size; i += 2)
|
||||
checksum += be16_to_cpup((__be16 *)(data + i));
|
||||
return checksum;
|
||||
@@ -672,6 +674,7 @@ static inline u32 checksum_le32(u8 *data, u32 size)
|
||||
{
|
||||
u32 checksum = 0;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < size; i += 4)
|
||||
checksum += le32_to_cpup((__le32 *)(data + i));
|
||||
return checksum;
|
||||
@@ -681,6 +684,7 @@ static inline u32 checksum_be32(u8 *data, u32 size)
|
||||
{
|
||||
u32 checksum = 0;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < size; i += 4)
|
||||
checksum += be32_to_cpup((__be32 *)(data + i));
|
||||
return checksum;
|
||||
@@ -702,7 +706,8 @@ static inline u32 checksum_be32(u8 *data, u32 size)
|
||||
* 2. you want the flow of this event continue, in
|
||||
* this condition, you should return EVT_HANDLED in
|
||||
* the callback function.
|
||||
* */
|
||||
*
|
||||
*/
|
||||
#define EVT_HANDLED 0
|
||||
#define EVT_CONTINUE 0
|
||||
#define EVT_CANCEL 1
|
||||
@@ -774,10 +779,10 @@ int goodix_ts_blocking_notify(enum ts_notify_event evt, void *v);
|
||||
|
||||
|
||||
/**
|
||||
* * goodix_ts_power_on - Turn on power to the touch device
|
||||
* * @core_data: pointer to touch core data
|
||||
* * return: 0 ok, <0 failed
|
||||
* */
|
||||
* goodix_ts_power_on - Turn on power to the touch device
|
||||
* @core_data: pointer to touch core data
|
||||
* return: 0 ok, <0 failed
|
||||
*/
|
||||
int goodix_ts_power_on(struct goodix_ts_core *core_data);
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ static int FP_Event_Gesture;
|
||||
* @gesture_type: store valied gesture type,each bit stand for a gesture
|
||||
* @gesture_data: gesture data
|
||||
* @gesture_ts_cmd: gesture command data
|
||||
*/
|
||||
*/
|
||||
struct gesture_module {
|
||||
atomic_t registered;
|
||||
unsigned int kobj_initialized;
|
||||
@@ -147,9 +147,10 @@ static ssize_t gsx_gesture_enable_store(struct goodix_ext_module *module,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
unsigned int tmp;
|
||||
int ret;
|
||||
int ret, rc;
|
||||
|
||||
if (sscanf(buf, "%u", &tmp) != 1) {
|
||||
rc = kstrtoint(buf, 0, &tmp);
|
||||
if (rc != 0) {
|
||||
ts_info("Parameter illegal");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -230,9 +231,8 @@ int goodix_sync_ic_stat(struct goodix_ts_core *core_data)
|
||||
int tp_stat;
|
||||
int ret = 0;
|
||||
|
||||
if (!core_data) {
|
||||
if (!core_data)
|
||||
ts_err("parameter illegal");
|
||||
}
|
||||
|
||||
mutex_lock(&core_data->work_stat);
|
||||
tp_stat = atomic_read(&core_data->suspend_stat);
|
||||
@@ -257,9 +257,8 @@ int goodix_sync_ic_stat(struct goodix_ts_core *core_data)
|
||||
|
||||
int goodix_check_gesture_stat(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
if (enable)
|
||||
goodix_sync_ic_stat(goodix_core_data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
@@ -359,7 +358,7 @@ static int gsx_gesture_init(struct goodix_ts_core *core_data,
|
||||
goto exit_gesture_init;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(gesture_attrs)/sizeof(gesture_attrs[0]); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(gesture_attrs); i++) {
|
||||
if (sysfs_create_file(&module->kobj,
|
||||
&gesture_attrs[i].attr)) {
|
||||
ts_err("Create sysfs attr file error");
|
||||
@@ -614,18 +613,16 @@ static int goodix_wakeup_and_set_suspend_func(struct goodix_ts_core *core_data)
|
||||
/*start suspend*/
|
||||
do {
|
||||
r = goodix_set_suspend_func(core_data);
|
||||
if (r < 0) {
|
||||
if (r < 0)
|
||||
ts_info("Send doze command failed, retry");
|
||||
}
|
||||
} while (r < 0 && ++retry < 3);
|
||||
|
||||
if (core_data->double_wakeup && (core_data->fod_status || core_data->aod_status)) {
|
||||
if (core_data->double_wakeup && (core_data->fod_status || core_data->aod_status))
|
||||
atomic_set(&core_data->suspend_stat, TP_GESTURE_DBCLK_FOD);
|
||||
} else if (core_data->double_wakeup) {
|
||||
else if (core_data->double_wakeup)
|
||||
atomic_set(&core_data->suspend_stat, TP_GESTURE_DBCLK);
|
||||
} else if (core_data->fod_status || core_data->aod_status) {
|
||||
else if (core_data->fod_status || core_data->aod_status)
|
||||
atomic_set(&core_data->suspend_stat, TP_GESTURE_FOD);
|
||||
}
|
||||
ts_info("suspend_stat[%d]", atomic_read(&core_data->suspend_stat));
|
||||
|
||||
/*finish suspend*/
|
||||
@@ -655,10 +652,10 @@ static int gsx_gesture_before_suspend(struct goodix_ts_core *core_data,
|
||||
}
|
||||
|
||||
if (!core_data->gesture_enabled) {
|
||||
ts_err("enter %s\n", __func__);
|
||||
atomic_set(&core_data->suspended, 1);
|
||||
return EVT_CONTINUE;
|
||||
}
|
||||
ts_err("enter %s\n", __func__);
|
||||
atomic_set(&core_data->suspended, 1);
|
||||
return EVT_CONTINUE;
|
||||
}
|
||||
|
||||
ret = goodix_set_suspend_func(core_data);
|
||||
if (ret != 0) {
|
||||
@@ -700,6 +697,7 @@ static int __init goodix_gsx_gesture_init(void)
|
||||
{
|
||||
/* initialize core_data->ts_dev->gesture_cmd*/
|
||||
int result;
|
||||
|
||||
ts_info("gesture module init");
|
||||
gsx_gesture = kzalloc(sizeof(struct gesture_module), GFP_KERNEL);
|
||||
if (!gsx_gesture)
|
||||
|
||||
@@ -90,7 +90,7 @@ int pre_event;
|
||||
* @node: devicetree node
|
||||
* @board_data: pointer to board data structure
|
||||
* return: 0 - no error, <0 error
|
||||
*/
|
||||
*/
|
||||
static int goodix_parse_dt_resolution(struct device_node *node,
|
||||
struct goodix_ts_board_data *board_data)
|
||||
{
|
||||
@@ -147,14 +147,14 @@ static int goodix_parse_dt_resolution(struct device_node *node,
|
||||
* @dev: pointer to device
|
||||
* @board_data: pointer to board data structure
|
||||
* return: 0 - no error, <0 error
|
||||
*/
|
||||
*/
|
||||
static int goodix_parse_dt(struct device_node *node,
|
||||
struct goodix_ts_board_data *board_data)
|
||||
{
|
||||
struct property *prop;
|
||||
int r;
|
||||
|
||||
ts_err("enter::%s\n",__func__);
|
||||
ts_err("enter::%s\n", __func__);
|
||||
if (!board_data) {
|
||||
ts_err("Invalid board data");
|
||||
return -EINVAL;
|
||||
@@ -223,7 +223,8 @@ static int goodix_parse_dt(struct device_node *node,
|
||||
&board_data->power_on_delay_us);
|
||||
if (!r) {
|
||||
/* 1000ms is too large, maybe you have pass
|
||||
* a wrong value */
|
||||
* a wrong value
|
||||
*/
|
||||
if (board_data->power_on_delay_us > 1000 * 1000) {
|
||||
ts_err("Power on delay time exceed 1s, please check");
|
||||
board_data->power_on_delay_us = 0;
|
||||
@@ -234,7 +235,8 @@ static int goodix_parse_dt(struct device_node *node,
|
||||
&board_data->power_off_delay_us);
|
||||
if (!r) {
|
||||
/* 1000ms is too large, maybe you have pass
|
||||
* a wrong value */
|
||||
* a wrong value
|
||||
*/
|
||||
if (board_data->power_off_delay_us > 1000 * 1000) {
|
||||
ts_err("Power off delay time exceed 1s, please check");
|
||||
board_data->power_off_delay_us = 0;
|
||||
@@ -308,7 +310,7 @@ static int goodix_parse_dt(struct device_node *node,
|
||||
* @board_data: board data
|
||||
* @sensor_id: sensor ID
|
||||
* return: 0 - read ok, < 0 - i2c transter error
|
||||
*/
|
||||
*/
|
||||
static int goodix_parse_customize_params(struct goodix_ts_device *dev,
|
||||
struct goodix_ts_board_data *board_data,
|
||||
unsigned int sensor_id)
|
||||
@@ -374,7 +376,7 @@ static int goodix_parse_acpi_cfg(struct acpi_device *dev,
|
||||
* @data: read buffer
|
||||
* @len: bytes to read
|
||||
* return: 0 - read ok, < 0 - i2c transter error
|
||||
*/
|
||||
*/
|
||||
int goodix_i2c_read_trans(struct goodix_ts_device *dev, unsigned int reg,
|
||||
unsigned char *data, unsigned int len)
|
||||
{
|
||||
@@ -400,11 +402,9 @@ int goodix_i2c_read_trans(struct goodix_ts_device *dev, unsigned int reg,
|
||||
msgs[1].buf = &get_buf[0];
|
||||
} else {
|
||||
msgs[1].buf = kzalloc(I2C_MAX_TRANSFER_SIZE < len
|
||||
? I2C_MAX_TRANSFER_SIZE : len, GFP_KERNEL);
|
||||
if (msgs[1].buf == NULL) {
|
||||
ts_err("Malloc failed");
|
||||
? I2C_MAX_TRANSFER_SIZE : len, GFP_KERNEL);
|
||||
if (msgs[1].buf == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
while (pos != len) {
|
||||
@@ -448,7 +448,7 @@ read_exit:
|
||||
* @data: write buffer
|
||||
* @len: bytes to write
|
||||
* return: 0 - write ok; < 0 - i2c transter error.
|
||||
*/
|
||||
*/
|
||||
int goodix_i2c_write_trans(struct goodix_ts_device *dev, unsigned int reg,
|
||||
unsigned char *data, unsigned int len)
|
||||
{
|
||||
@@ -469,10 +469,8 @@ int goodix_i2c_write_trans(struct goodix_ts_device *dev, unsigned int reg,
|
||||
msg.buf = kmalloc(I2C_MAX_TRANSFER_SIZE < len + TS_ADDR_LENGTH
|
||||
? I2C_MAX_TRANSFER_SIZE : len + TS_ADDR_LENGTH,
|
||||
GFP_KERNEL);
|
||||
if (msg.buf == NULL) {
|
||||
ts_err("Malloc failed");
|
||||
if (msg.buf == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
while (pos != len) {
|
||||
@@ -519,7 +517,7 @@ write_exit:
|
||||
* mode, then you must enable it again.
|
||||
* Between set_doze_false and set_doze_true, do not reset
|
||||
* IC!
|
||||
*/
|
||||
*/
|
||||
static int goodix_set_i2c_doze_mode(struct goodix_ts_device *dev, int enable)
|
||||
{
|
||||
static DEFINE_MUTEX(doze_mode_lock);
|
||||
@@ -560,10 +558,10 @@ static int goodix_set_i2c_doze_mode(struct goodix_ts_device *dev, int enable)
|
||||
usleep_range(1000, 1100);
|
||||
for (i = 0; i < TS_DOZE_DISABLE_RETRY_TIMES; i++) {
|
||||
goodix_i2c_read_trans(dev, TS_REG_DOZE_STAT, &r_data, 1);
|
||||
if (TS_DOZE_CLOSE_OK_DATA == r_data) {
|
||||
if (r_data == TS_DOZE_CLOSE_OK_DATA) {
|
||||
result = 0;
|
||||
goto exit;
|
||||
} else if (0xAA != r_data) {
|
||||
} else if (r_data != 0xAA) {
|
||||
w_data = TS_DOZE_DISABLE_DATA;
|
||||
goodix_i2c_write_trans(dev, TS_REG_DOZE_CTRL, &w_data, 1);
|
||||
}
|
||||
@@ -588,7 +586,7 @@ exit:
|
||||
* @data: write buffer
|
||||
* @len: bytes to write
|
||||
* return: 0 - write ok; < 0 - i2c transter error.
|
||||
*/
|
||||
*/
|
||||
int goodix_i2c_write(struct goodix_ts_device *dev, unsigned int reg,
|
||||
unsigned char *data, unsigned int len)
|
||||
{
|
||||
@@ -618,7 +616,7 @@ int goodix_i2c_write(struct goodix_ts_device *dev, unsigned int reg,
|
||||
* @data: read buffer
|
||||
* @len: bytes to read
|
||||
* return: 0 - read ok, < 0 - i2c transter error
|
||||
*/
|
||||
*/
|
||||
int goodix_i2c_read(struct goodix_ts_device *dev, unsigned int reg,
|
||||
unsigned char *data, unsigned int len)
|
||||
{
|
||||
@@ -646,7 +644,7 @@ int goodix_i2c_read(struct goodix_ts_device *dev, unsigned int reg,
|
||||
* @data: write buffer
|
||||
* @len: bytes to write
|
||||
* return: 0 - write ok; < 0 - i2c transter error.
|
||||
*/
|
||||
*/
|
||||
int goodix_i2c_write_trans_once(struct goodix_ts_device *dev, unsigned int reg,
|
||||
unsigned char *data, unsigned int len)
|
||||
{
|
||||
@@ -765,7 +763,8 @@ static int goodix_read_version(struct goodix_ts_device *dev,
|
||||
}
|
||||
|
||||
/*disable doze mode, just valid for normandy
|
||||
* this func must be used in pairs*/
|
||||
* this func must be used in pairs
|
||||
*/
|
||||
goodix_set_i2c_doze_mode(dev, false);
|
||||
|
||||
/*check checksum*/
|
||||
@@ -854,7 +853,8 @@ static int goodix_read_version(struct goodix_ts_device *dev,
|
||||
|
||||
exit:
|
||||
/*enable doze mode, just valid for normandy
|
||||
* this func must be used in pairs*/
|
||||
* this func must be used in pairs
|
||||
*/
|
||||
goodix_set_i2c_doze_mode(dev, true);
|
||||
|
||||
return r;
|
||||
@@ -1017,6 +1017,7 @@ static int goodix_check_cfg_valid(struct goodix_ts_device *dev, u8 *cfg, u32 len
|
||||
int i, j;
|
||||
int bag_start = 0;
|
||||
int bag_end = 0;
|
||||
|
||||
if (!cfg || length < TS_CFG_HEAD_LEN) {
|
||||
ts_err("cfg is INVALID, len:%d", length);
|
||||
ret = -EINVAL;
|
||||
@@ -1099,11 +1100,6 @@ static int goodix_send_config(struct goodix_ts_device *dev,
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
/*check reg valid*/
|
||||
/* if (!dev->reg.cfg_addr) {
|
||||
ts_err("cfg register is NULL");
|
||||
return -EINVAL;
|
||||
}*/
|
||||
if (!config || !*(config->data)) {
|
||||
ts_err("Null config data");
|
||||
return -EINVAL;
|
||||
@@ -1145,51 +1141,12 @@ static int goodix_send_config(struct goodix_ts_device *dev,
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* goodix_send_config - send config data to device.
|
||||
* @dev: pointer to device
|
||||
* @config: pointer to config data struct to be send
|
||||
* @return: 0 - succeed, < 0 - failed
|
||||
*/
|
||||
static int goodix_send_config(struct goodix_ts_device *dev,
|
||||
struct goodix_ts_config *config)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
if (!config || !config->data) {
|
||||
ts_err("Null config data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ts_info("Send %s,ver:%02xh,size:%d",
|
||||
config->name, config->data[0],
|
||||
config->length);
|
||||
|
||||
mutex_lock(&config->lock);
|
||||
r = goodix_i2c_write(dev, config->reg_base,
|
||||
config->data, config->length);
|
||||
if (r)
|
||||
goto exit;
|
||||
|
||||
/* make sure the firmware accept the config data*/
|
||||
if (config->delay)
|
||||
msleep(config->delay);
|
||||
exit:
|
||||
mutex_unlock(&config->lock);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* goodix_close_hidi2c_mode
|
||||
* Called by touch core module when bootup
|
||||
* @ts_dev: pointer to touch device
|
||||
* return: 0 - no error, <0 error
|
||||
*/
|
||||
*/
|
||||
static int goodix_close_hidi2c_mode(struct goodix_ts_device *ts_dev)
|
||||
{
|
||||
int r = 0;
|
||||
@@ -1207,7 +1164,7 @@ static int goodix_close_hidi2c_mode(struct goodix_ts_device *ts_dev)
|
||||
usleep_range(10000, 11000);
|
||||
}
|
||||
if (try_times >= 10) {
|
||||
ts_info("goodix_close_hidi2c_mode FAILED, 0x8040 is not equal to 0xff");
|
||||
ts_info("%s FAILED, 0x8040 is not equal to 0xff", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1404,7 +1361,7 @@ exit:
|
||||
* Called by touch core module when bootup
|
||||
* @ts_dev: pointer to touch device
|
||||
* return: 0 - no error, <0 error
|
||||
*/
|
||||
*/
|
||||
static int goodix_hw_init(struct goodix_ts_device *ts_dev)
|
||||
{
|
||||
int r;
|
||||
@@ -1415,19 +1372,15 @@ static int goodix_hw_init(struct goodix_ts_device *ts_dev)
|
||||
if (!ts_dev->normal_cfg) {
|
||||
ts_dev->normal_cfg = devm_kzalloc(ts_dev->dev,
|
||||
sizeof(*ts_dev->normal_cfg), GFP_KERNEL);
|
||||
if (!ts_dev->normal_cfg) {
|
||||
ts_err("Failed to alloc memory for normal cfg");
|
||||
if (!ts_dev->normal_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
mutex_init(&ts_dev->normal_cfg->lock);
|
||||
}
|
||||
if (!ts_dev->highsense_cfg) {
|
||||
ts_dev->highsense_cfg = devm_kzalloc(ts_dev->dev,
|
||||
sizeof(*ts_dev->highsense_cfg), GFP_KERNEL);
|
||||
if (!ts_dev->highsense_cfg) {
|
||||
ts_err("Failed to alloc memory for high sense cfg");
|
||||
if (!ts_dev->highsense_cfg)
|
||||
return -ENOMEM;
|
||||
}
|
||||
mutex_init(&ts_dev->highsense_cfg->lock);
|
||||
}
|
||||
|
||||
@@ -1446,13 +1399,14 @@ static int goodix_hw_init(struct goodix_ts_device *ts_dev)
|
||||
|
||||
/* devicetree property like resolution(panel_max_xxx)
|
||||
* may be different between sensors, here we try to parse
|
||||
* parameters form sensor child node */
|
||||
* parameters form sensor child node
|
||||
*/
|
||||
r = goodix_parse_customize_params(ts_dev,
|
||||
ts_dev->board_data,
|
||||
ts_dev->chip_version.sensor_id);
|
||||
if (r < 0)
|
||||
ts_info("Cann't find customized parameters");
|
||||
|
||||
|
||||
ts_dev->normal_cfg->delay = 500;
|
||||
/* send normal-cfg to firmware */
|
||||
r = goodix_send_config(ts_dev, ts_dev->normal_cfg);
|
||||
@@ -1538,7 +1492,7 @@ static int goodix_request_handler(struct goodix_ts_device *dev,
|
||||
unsigned char buffer[1];
|
||||
int r;
|
||||
|
||||
if (dev->reg.fw_request != 0x6F6D){
|
||||
if (dev->reg.fw_request != 0x6F6D) {
|
||||
ts_info("firmware reg is wrong!\n");
|
||||
dev->reg.fw_request = 0x6F6D;
|
||||
}
|
||||
@@ -1584,6 +1538,7 @@ static void goodix_swap_coords(struct goodix_ts_device *dev,
|
||||
{
|
||||
int i, temp;
|
||||
struct goodix_ts_board_data *bdata = dev->board_data;
|
||||
|
||||
for (i = 0; i < touch_num; i++) {
|
||||
if (bdata->swap_axis) {
|
||||
temp = coords->x;
|
||||
@@ -1694,16 +1649,8 @@ static int goodix_remap_trace_id(struct goodix_ts_device *dev,
|
||||
}
|
||||
offset += BYTES_PER_COORD;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*for (i = 0; i < touch_num; i++) {
|
||||
ts_info("remap data%d:0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x",
|
||||
i, coor_buf[i * 8], coor_buf[i * 8 + 1],
|
||||
coor_buf[i * 8 + 2], coor_buf[i * 8 + 3],
|
||||
coor_buf[i * 8 + 4], coor_buf[i * 8 + 5],
|
||||
coor_buf[i * 8 + 6], coor_buf[i * 8 + 7]);
|
||||
}*/
|
||||
}
|
||||
|
||||
/*realign coor data by new trace ID*/
|
||||
for (i = 0; i < touch_num - 1; i++) {
|
||||
@@ -1726,15 +1673,6 @@ static int goodix_remap_trace_id(struct goodix_ts_device *dev,
|
||||
BYTES_PER_COORD);
|
||||
}
|
||||
}
|
||||
|
||||
/*for (i = 0; i < touch_num; i++) {
|
||||
ts_info("final data%d:0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x",
|
||||
i, coor_buf[i * 8], coor_buf[i * 8 + 1],
|
||||
coor_buf[i * 8 + 2], coor_buf[i * 8 + 3],
|
||||
coor_buf[i * 8 + 4], coor_buf[i * 8 + 5],
|
||||
coor_buf[i * 8 + 6], coor_buf[i * 8 + 7]);
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1784,7 +1722,8 @@ static int goodix_touch_handler(struct goodix_ts_device *dev,
|
||||
}
|
||||
|
||||
/* touch_num * BYTES_PER_COORD + 1(touch event state)
|
||||
* + 1(checksum) + 1(key value) */
|
||||
* + 1(checksum) + 1(key value)
|
||||
*/
|
||||
if (dev->ic_type == IC_TYPE_NANJING) {
|
||||
chksum = checksum_u8(&buffer[1],
|
||||
touch_num * BYTES_PER_COORD + 3);
|
||||
@@ -1807,18 +1746,6 @@ static int goodix_touch_handler(struct goodix_ts_device *dev,
|
||||
touch_data->key_value = (touch_data->key_value & 0x0f) |
|
||||
((touch_data->key_value & 0xf0) >> (4 - dev->board_data->tp_key_num));
|
||||
}
|
||||
/*ts_info("$$$$$$coord_sta:0x%02x, have_key:%d, key_value:0x%02x",
|
||||
coord_sta, touch_data->have_key, touch_data->key_value);*/
|
||||
|
||||
/*for (i = 0; i < touch_num; i++) {
|
||||
ts_info("raw coor data%d:0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x",
|
||||
i, buffer[i * 8 + 2], buffer[i * 8 + 3],
|
||||
buffer[i * 8 + 4], buffer[i * 8 + 5],
|
||||
buffer[i * 8 + 6], buffer[i * 8 + 7],
|
||||
buffer[i * 8 + 8], buffer[i * 8 + 9]);
|
||||
}*/
|
||||
|
||||
/*add end*/
|
||||
|
||||
/*remap trace id*/
|
||||
if (dev->ic_type == IC_TYPE_NANJING)
|
||||
@@ -1867,22 +1794,21 @@ static int goodix_touch_handler(struct goodix_ts_device *dev,
|
||||
buffer[i * BYTES_PER_COORD + 7] |
|
||||
(buffer[i * BYTES_PER_COORD + 8] << 8);
|
||||
}
|
||||
} else {/*it's a finger*/
|
||||
coords->id = buffer[i * BYTES_PER_COORD + 2] & 0x0f;
|
||||
coords->x = buffer[i * BYTES_PER_COORD + 3] |
|
||||
(buffer[i * BYTES_PER_COORD + 4] << 8);
|
||||
coords->y = buffer[i * BYTES_PER_COORD + 5] |
|
||||
(buffer[i * BYTES_PER_COORD + 6] << 8);
|
||||
coords->w = coords->p / 16;
|
||||
coords->p = buffer[i * BYTES_PER_COORD + 7] |
|
||||
(buffer[i * BYTES_PER_COORD + 8] << 8);
|
||||
coords->overlapping_area = buffer[8];
|
||||
coords->area = buffer[i * BYTES_PER_COORD + 9];
|
||||
/*ts_debug("EF:[%d](%d, %d)", coords->id, coords->x, coords->y);*/
|
||||
if (touch_data->pen_down == true) {
|
||||
touch_data->pen_down = false;
|
||||
/*ts_info("***pen leave");*/
|
||||
}
|
||||
/*it's a finger*/
|
||||
} else {
|
||||
coords->id = buffer[i * BYTES_PER_COORD + 2] & 0x0f;
|
||||
coords->x = buffer[i * BYTES_PER_COORD + 3] |
|
||||
(buffer[i * BYTES_PER_COORD + 4] << 8);
|
||||
coords->y = buffer[i * BYTES_PER_COORD + 5] |
|
||||
(buffer[i * BYTES_PER_COORD + 6] << 8);
|
||||
coords->w = coords->p / 16;
|
||||
coords->p = buffer[i * BYTES_PER_COORD + 7] |
|
||||
(buffer[i * BYTES_PER_COORD + 8] << 8);
|
||||
coords->overlapping_area = buffer[8];
|
||||
coords->area = buffer[i * BYTES_PER_COORD + 9];
|
||||
/*ts_debug("EF:[%d](%d, %d)", coords->id, coords->x, coords->y);*/
|
||||
if (touch_data->pen_down == true)
|
||||
touch_data->pen_down = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2099,9 +2025,9 @@ static int goodix_i2c_probe(struct i2c_client *client,
|
||||
struct goodix_ts_board_data *ts_bdata = NULL;
|
||||
int r = 0;
|
||||
|
||||
ts_err("enter::%s\n",__func__);
|
||||
ts_err("enter::%s\n", __func__);
|
||||
|
||||
r = i2c_check_functionality(client->adapter,I2C_FUNC_I2C);
|
||||
r = i2c_check_functionality(client->adapter, I2C_FUNC_I2C);
|
||||
if (!r)
|
||||
return -EIO;
|
||||
|
||||
@@ -2118,11 +2044,11 @@ static int goodix_i2c_probe(struct i2c_client *client,
|
||||
return r;
|
||||
}
|
||||
#ifdef CONFIG_ACPI
|
||||
else if (ACPI_COMPANION(&client->dev)) {
|
||||
else if (ACPI_COMPANION(&client->dev)) {
|
||||
r = goodix_parse_acpi(&client->dev, ts_bdata);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
/* use platform data */
|
||||
@@ -2143,7 +2069,7 @@ static int goodix_i2c_probe(struct i2c_client *client,
|
||||
ts_device->dev = &client->dev;
|
||||
ts_device->board_data = ts_bdata;
|
||||
ts_device->hw_ops = &hw_i2c_ops;
|
||||
|
||||
|
||||
|
||||
/* ts core device */
|
||||
goodix_pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
|
||||
@@ -2162,7 +2088,8 @@ static int goodix_i2c_probe(struct i2c_client *client,
|
||||
goodix_pdev->dev.release = goodix_pdev_release;
|
||||
|
||||
/* register platform device, then the goodix_ts_core
|
||||
* module will probe the touch deivce. */
|
||||
* module will probe the touch deivce.
|
||||
*/
|
||||
r = platform_device_register(goodix_pdev);
|
||||
|
||||
ts_info("goodix9886_i2c_probe OUT");
|
||||
|
||||
@@ -296,7 +296,7 @@ err_out:
|
||||
|
||||
*/
|
||||
|
||||
int sync_read_rawdata (unsigned int reg,
|
||||
int sync_read_rawdata(unsigned int reg,
|
||||
unsigned char *data, unsigned int len)
|
||||
|
||||
{
|
||||
@@ -601,6 +601,7 @@ static long goodix_tools_compat_ioctl(struct file *file, unsigned int cmd,
|
||||
static int goodix_tools_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
filp->private_data = goodix_tools_dev;
|
||||
ts_info("tools open");
|
||||
/* Only the first time open device need to register module */
|
||||
|
||||
Reference in New Issue
Block a user