Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecf59c7b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: touchscreen: Convert Goodix driver to dev_pm_ops"

parents 02a76444 203cdf9c
Loading
Loading
Loading
Loading
+41 −24
Original line number Diff line number Diff line
@@ -30,12 +30,28 @@ Optional properties:
				min y, max x and max y values.
 - goodix,i2c-pull-up	: To specify pull up is required.
 - goodix,no-force-update	: To specify force update is allowed.
 - goodix,enable-power-off	: Power off touchscreen during suspend.
 - goodix,button-map	: Button map of key codes. The number of key codes
				depend on panel.
 - goodix,cfg-data	: Touchpanel controller configuration data, ask vendor
				to provide that. Default configuration will be
				used if this property is not present.

 - goodix,cfg-data0	: Touch screen controller config data group 0. Ask vendor
				to provide that.
				Driver supports maximum six config groups. If more than one
				groups are defined, driver will select config group depending
				on hardware configuration. If only config group 0 is defined,
				it will be used for all hardware configurations.
				Touch screen controller will use its onchip default config data
				if this property is not present.
 - goodix,cfg-data1	: Touch screen controller config data group 1. Ask vendor
				to provide that.
 - goodix,cfg-data2	: Touch screen controller config data group 2. Ask vendor
				to provide that.
 - goodix,cfg-data3	: Touch screen controller config data group 3. Ask vendor
				to provide that.
 - goodix,cfg-data4	: Touch screen controller config data group 4. Ask vendor
				to provide that.
 - goodix,cfg-data5	: Touch screen controller config data group 5. Ask vendor
				to provide that.
 - goodix,fw-name	: Touch screen controller firmware file name.
Example:
i2c@f9927000 {
		goodix@5d {
@@ -50,7 +66,7 @@ i2c@f9927000 {
			goodix,display-coords = <0 0 720 1080>;
			goodix,button-map= <158 102 139>;
			goodix,product-id = "915";
			goodix,cfg-data = [
			goodix,cfg-data0 = [
				41 D0 02 00 05 0A 05 01 01 08
				12 58 50 41 03 05 00 00 00 00
				00 00 00 00 00 00 00 8C 2E 0E
@@ -70,5 +86,6 @@ i2c@f9927000 {
				20 21 22 24 26 28 29 2A FF FF
				FF FF FF FF FF FF FF 22 22 22
				22 22 22 FF 07 01];
			goodix,fw_name = "gtp_fw.bin";
		};
};
+75 −77
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ static void tool_set_proc_name(char *procname)

	snprintf(date, 20, "%s", __DATE__);

	/* GTP_DEBUG("compile date: %s", date); */
	/* pr_debug("compile date: %s", date); */

	ret = sscanf(date, "%s %d %d", month, &n_day, &n_year);
	if (!ret)
@@ -89,24 +89,27 @@ 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); */
	/* pr_debug("procname = %s", procname); */
}

static s32 tool_i2c_read_no_extra(u8 *buf, u16 len)
{
	s32 ret = -1;
	s32 i = 0;
	struct i2c_msg msgs[2];

	msgs[0].flags = !I2C_M_RD;
	msgs[0].addr  = gt_client->addr;
	msgs[0].len   = cmd_head.addr_len;
	msgs[0].buf   = &buf[0];

	msgs[1].flags = I2C_M_RD;
	msgs[1].addr  = gt_client->addr;
	msgs[1].len   = len;
	msgs[1].buf   = &buf[GTP_ADDR_LENGTH];
	u8 i = 0;
	struct i2c_msg msgs[2] = {
		{
			.flags = !I2C_M_RD,
			.addr  = gt_client->addr,
			.len   = cmd_head.addr_len,
			.buf   = &buf[0],
		},
		{
			.flags = I2C_M_RD,
			.addr  = gt_client->addr,
			.len   = len,
			.buf   = &buf[GTP_ADDR_LENGTH],
		},
	};

	for (i = 0; i < cmd_head.retry; i++) {
		ret = i2c_transfer(gt_client->adapter, msgs, 2);
@@ -114,19 +117,24 @@ static s32 tool_i2c_read_no_extra(u8 *buf, u16 len)
			break;
	}

	if (i == cmd_head.retry) {
		dev_err(&client->dev, "I2C read retry limit over.\n");
		ret = -EIO;
	}

	return ret;
}

static s32 tool_i2c_write_no_extra(u8 *buf, u16 len)
{
	s32 ret = -1;
	s32 i = 0;
	struct i2c_msg msg;

	msg.flags = !I2C_M_RD;
	msg.addr  = gt_client->addr;
	msg.len   = len;
	msg.buf   = buf;
	u8 i = 0;
	struct i2c_msg msg = {
		.flags = !I2C_M_RD,
		.addr  = gt_client->addr,
		.len   = len,
		.buf   = buf,
	};

	for (i = 0; i < cmd_head.retry; i++) {
		ret = i2c_transfer(gt_client->adapter, &msg, 1);
@@ -134,6 +142,11 @@ static s32 tool_i2c_write_no_extra(u8 *buf, u16 len)
			break;
	}

	if (i == cmd_head.retry) {
		dev_err(&client->dev, "I2C write retry limit over.\n");
		ret = -EIO;
	}

	return ret;
}

@@ -171,11 +184,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!");
	} 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!");
	}
}

@@ -183,7 +196,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!");
}

s32 init_wr_node(struct i2c_client *client)
@@ -196,8 +209,9 @@ s32 init_wr_node(struct i2c_client *client)

	i = 5;
	while ((!cmd_head.data) && i) {
		cmd_head.data = kzalloc(i * DATA_LENGTH_UINT, GFP_KERNEL);
		if (NULL != cmd_head.data)
		cmd_head.data = devm_kzalloc(&client->dev,
				i * DATA_LENGTH_UINT, GFP_KERNEL);
		if (cmd_head.data)
			break;
		i--;
	}
@@ -205,7 +219,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.");
		return FAIL;
	}

@@ -218,7 +232,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!");
		return FAIL;
	}
	GTP_INFO("Create proc entry success!");
@@ -230,7 +244,6 @@ s32 init_wr_node(struct i2c_client *client)

void uninit_wr_node(void)
{
	kfree(cmd_head.data);
	cmd_head.data = NULL;
	unregister_i2c_func();
	remove_proc_entry(procname, NULL);
@@ -248,7 +261,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.",
					src, dst, (s32)ret);
		break;

@@ -297,14 +310,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!");
			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.",
						buf[GTP_ADDR_LENGTH]);
			GTP_DEBUG("flag value:0x%02x.", cmd_head.flag_val);
			pr_debug("flag value:0x%02x.", cmd_head.flag_val);
			break;
		}

@@ -312,7 +325,7 @@ static u8 comfirm(void)
	}

	if (i >= cmd_head.times) {
		GTP_ERROR("Didn't get the flag to continue!");
		pr_err("Didn't get the flag to continue!");
		return FAIL;
	}

@@ -332,32 +345,29 @@ 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.");
		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.", cmd_head.wr);
	pr_debug("flag:0x%02x.", cmd_head.flag);
	pr_debug("flag addr:0x%02x%02x.", 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.", cmd_head.flag_val);
	pr_debug("flag rel:0x%02x.", cmd_head.flag_relation);
	pr_debug("circle  :%d.", (s32)cmd_head.circle);
	pr_debug("times   :%d.", (s32)cmd_head.times);
	pr_debug("retry   :%d.", (s32)cmd_head.retry);
	pr_debug("delay   :%d.", (s32)cmd_head.delay);
	pr_debug("data len:%d.", (s32)cmd_head.data_len);
	pr_debug("addr len:%d.", (s32)cmd_head.addr_len);
	pr_debug("addr:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
	pr_debug("len:%d.", (s32)len);
	pr_debug("buf[20]:0x%02x.", buff[CMD_HEAD_LENGTH]);

	if (cmd_head.data_len > (DATA_LENGTH - GTP_ADDR_LENGTH)) {
		pr_err("data len %d > data buff %d, rejected!\n",
@@ -378,19 +388,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.");

		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 (FAIL == comfirm()) {
				GTP_ERROR("[WRITE]Comfirm fail!");
				pr_err("[WRITE]Comfirm fail!");
				ret = -EINVAL;
				goto exit;
			}
@@ -400,14 +405,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!");
			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);

@@ -418,7 +420,7 @@ 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.");

		if (cmd_head.data_len > sizeof(IC_TYPE)) {
			pr_err("<<-GTP->> data len %d > data buff %d, rejected!\n",
@@ -460,13 +462,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.");
		if (cmd_head.data[GTP_ADDR_LENGTH]) {
			GTP_DEBUG("gtp enter rawdiff.");
			pr_debug("gtp enter rawdiff.");
			ts->gtp_rawdiff_mode = true;
		} else {
			ts->gtp_rawdiff_mode = false;
			GTP_DEBUG("gtp leave rawdiff.");
			pr_debug("gtp leave rawdiff.");
		}
		ret = CMD_HEAD_LENGTH;
		goto exit;
@@ -517,7 +519,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) {
@@ -531,7 +532,7 @@ static s32 goodix_tool_read(char *page, char **start, off_t off, int count,

		if (cmd_head.flag == 1) {
			if (FAIL == comfirm()) {
				GTP_ERROR("[READ]Comfirm fail!");
				pr_err("[READ]Comfirm fail!");
				ret = -EINVAL;
				goto exit;
			}
@@ -541,9 +542,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.", 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.", cmd_head.addr[0],
							cmd_head.addr[1]);

		if (cmd_head.delay)
@@ -559,23 +560,20 @@ 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!");
				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);
		memcpy(page, "GT818", 5);
		page[5] = 0; */

		GTP_DEBUG("Return ic type:%s len:%d.", page,
		pr_debug("Return ic type:%s len:%d.", page,
						(s32)cmd_head.data_len);
		ret = cmd_head.data_len;
		goto exit;
+304 −180

File changed.

Preview size limit exceeded, changes collapsed.

+20 −88
Original line number Diff line number Diff line
@@ -36,6 +36,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>
@@ -45,12 +46,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;
@@ -61,8 +67,11 @@ struct goodix_ts_platform_data {
	u32 panel_maxy;
	bool no_force_update;
	bool i2c_pull_up;
	int gtp_cfg_len;
	u8 *config_data;
	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;
@@ -72,6 +81,8 @@ struct goodix_ts_data {
	struct hrtimer timer;
	struct workqueue_struct *goodix_wq;
	struct work_struct	work;
	char fw_name[GTP_FW_NAME_MAXSIZE];
	struct delayed_work goodix_update_work;
	s32 irq_is_disabled;
	s32 use_irq;
	u16 abs_x_max;
@@ -88,6 +99,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;
@@ -106,7 +119,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
@@ -118,14 +130,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: */
@@ -137,54 +146,6 @@ extern u16 total_len;
 *	VDDIO		NC/300K		4
 *	NC			NC/300K		5
*/
/* Define your own default or for Sensor_ID == 0 config here */
/* The predefined one is just a sample config,
 * which is not suitable for your tp in most cases. */
#define CTP_CFG_GROUP1 {\
	0x41, 0x1C, 0x02, 0xC0, 0x03, 0x0A, 0x05, 0x01, 0x01, 0x0F,\
	0x23, 0x0F, 0x5F, 0x41, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x0A,\
	0x28, 0x00, 0xB8, 0x0B, 0x00, 0x00, 0x00, 0x9A, 0x03, 0x25,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x64, 0x32, 0x00, 0x00,\
	0x00, 0x32, 0x8C, 0x94, 0x05, 0x01, 0x05, 0x00, 0x00, 0x96,\
	0x0C, 0x22, 0xD8, 0x0E, 0x23, 0x56, 0x11, 0x25, 0xFF, 0x13,\
	0x28, 0xA7, 0x15, 0x2E, 0x00, 0x00, 0x10, 0x30, 0x48, 0x00,\
	0x56, 0x4A, 0x3A, 0xFF, 0xFF, 0x16, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x01, 0x1B, 0x14, 0x0D, 0x19, 0x00, 0x00, 0x01, 0x00,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x00, 0x1A, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0E, 0x0C,\
	0x0A, 0x08, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\
	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\
	0xFF, 0xFF, 0x1D, 0x1E, 0x1F, 0x20, 0x22, 0x24, 0x28, 0x29,\
	0x0C, 0x0A, 0x08, 0x00, 0x02, 0x04, 0x05, 0x06, 0x0E, 0xFF,\
	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\
	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,\
	0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x01\
	}

/* Define your config for Sensor_ID == 1 here, if needed */
#define CTP_CFG_GROUP2 {\
	}

/* Define your config for Sensor_ID == 2 here, if needed */
#define CTP_CFG_GROUP3 {\
	}

/* Define your config for Sensor_ID == 3 here, if needed */
#define CTP_CFG_GROUP4 {\
	}

/* Define your config for Sensor_ID == 4 here, if needed */
#define CTP_CFG_GROUP5 {\
	}

/* Define your config for Sensor_ID == 5 here, if needed */
#define CTP_CFG_GROUP6 {\
	}

#define GTP_IRQ_TAB		{\
				IRQ_TYPE_EDGE_RISING,\
@@ -232,43 +193,14 @@ extern u16 total_len;
#define GTP_REG_FW_VERSION	0x8144
#define GTP_REG_PRODUCT_ID	0x8140

#define GTP_I2C_RETRY_3		3
#define GTP_I2C_RETRY_5		5
#define GTP_I2C_RETRY_10	10

#define RESOLUTION_LOC		3
#define TRIGGER_LOC		8

#define CFG_GROUP_LEN(p_cfg_grp) (sizeof(p_cfg_grp) / sizeof(p_cfg_grp[0]))
/* 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);
+352 −393

File changed.

Preview size limit exceeded, changes collapsed.