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

Commit 965aac38 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: Use proper conventional functions for debug"

parents 99be17ee 76dfdaf9
Loading
Loading
Loading
Loading
+9 −70
Original line number Diff line number Diff line
@@ -143,8 +143,6 @@ int gtp_i2c_read(struct i2c_client *client, u8 *buf, int len)
	int ret = -EIO;
	int retries = 0;

	GTP_DEBUG_FUNC();

	msgs[0].flags = !I2C_M_RD;
	msgs[0].addr = client->addr;
	msgs[0].len = GTP_ADDR_LENGTH;
@@ -167,7 +165,6 @@ int gtp_i2c_read(struct i2c_client *client, u8 *buf, int len)
		if (DOZE_ENABLED == doze_status)
			return ret;
#endif
		GTP_DEBUG("I2C communication timeout, resetting chip...");
		if (init_done)
			gtp_reset_guitar(ts, 10);
		else
@@ -197,8 +194,6 @@ int gtp_i2c_write(struct i2c_client *client, u8 *buf, int len)
	int ret = -EIO;
	int retries = 0;

	GTP_DEBUG_FUNC();

	msg.flags = !I2C_M_RD;
	msg.addr = client->addr;
	msg.len = len;
@@ -215,7 +210,6 @@ int gtp_i2c_write(struct i2c_client *client, u8 *buf, int len)
		if (DOZE_ENABLED == doze_status)
			return ret;
#endif
		GTP_DEBUG("I2C communication timeout, resetting chip...");
		if (init_done)
			gtp_reset_guitar(ts, 10);
		else
@@ -314,8 +308,6 @@ void gtp_irq_disable(struct goodix_ts_data *ts)
{
	unsigned long irqflags;

	GTP_DEBUG_FUNC();

	spin_lock_irqsave(&ts->irq_lock, irqflags);
	if (!ts->irq_is_disabled) {
		ts->irq_is_disabled = true;
@@ -336,8 +328,6 @@ void gtp_irq_enable(struct goodix_ts_data *ts)
{
	unsigned long irqflags = 0;

	GTP_DEBUG_FUNC();

	spin_lock_irqsave(&ts->irq_lock, irqflags);
	if (ts->irq_is_disabled) {
		enable_irq(ts->client->irq);
@@ -362,7 +352,7 @@ static void gtp_touch_down(struct goodix_ts_data *ts, int id, int x, int y,
		int w)
{
#if GTP_CHANGE_X2Y
	GTP_SWAP(x, y);
	swap(x, y);
#endif

	input_mt_slot(ts->input_dev, id);
@@ -371,8 +361,6 @@ static void gtp_touch_down(struct goodix_ts_data *ts, int id, int x, int y,
	input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
	input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
	input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);

	GTP_DEBUG("ID:%d, X:%d, Y:%d, W:%d", id, x, y, w);
}

/*******************************************************
@@ -387,7 +375,6 @@ static void gtp_touch_up(struct goodix_ts_data *ts, int id)
{
	input_mt_slot(ts->input_dev, id);
	input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, false);
	GTP_DEBUG("Touch id[%2d] release!", id);
}


@@ -428,8 +415,6 @@ static void goodix_ts_work_func(struct work_struct *work)
	u8 doze_buf[3] = {0x81, 0x4B};
#endif

	GTP_DEBUG_FUNC();

	ts = container_of(work, struct goodix_ts_data, work);
#ifdef CONFIG_GT9XX_TOUCHPANEL_UPDATE
	if (ts->enter_update)
@@ -439,7 +424,6 @@ static void goodix_ts_work_func(struct work_struct *work)
#if GTP_SLIDE_WAKEUP
	if (DOZE_ENABLED == doze_status) {
		ret = gtp_i2c_read(ts->client, doze_buf, 3);
		GTP_DEBUG("0x814B = 0x%02X", doze_buf[2]);
		if (ret > 0) {
			if (doze_buf[2] == 0xAA) {
				dev_dbg(&ts->client->dev,
@@ -516,6 +500,7 @@ static void goodix_ts_work_func(struct work_struct *work)

	if (key_value || pre_key) {
		for (i = 0; i < GTP_MAX_KEY_NUM; i++) {

#if GTP_DEBUG_ON
			for (ret = 0; ret < 4; ++ret) {
				if (key_codes[ret] == touch_key_array[i]) {
@@ -537,11 +522,9 @@ static void goodix_ts_work_func(struct work_struct *work)
#endif
	pre_key = key_value;

	GTP_DEBUG("pre_touch:%02x, finger:%02x.", pre_touch, finger);

#if GTP_WITH_PEN
	if (pre_pen && (touch_num == 0)) {
		GTP_DEBUG("Pen touch UP(Slot)!");
		dev_dbg(&ts->client->dev, "Pen touch UP(Slot)!");
		input_report_key(ts->input_dev, BTN_TOOL_PEN, 0);
		input_mt_slot(ts->input_dev, 5);
		input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, -1);
@@ -558,7 +541,8 @@ static void goodix_ts_work_func(struct work_struct *work)
#if GTP_WITH_PEN
			id = coor_data[pos];
			if (id == 128) {
				GTP_DEBUG("Pen touch DOWN(Slot)!");
				dev_dbg(&ts->client->dev,
						"Pen touch DOWN(Slot)!");
				input_x  = coor_data[pos + 1]
					| (coor_data[pos + 2] << 8);
				input_y  = coor_data[pos + 3]
@@ -577,7 +561,8 @@ static void goodix_ts_work_func(struct work_struct *work)
					ABS_MT_POSITION_Y, input_y);
				input_report_abs(ts->input_dev,
					ABS_MT_TOUCH_MAJOR, input_w);
				GTP_DEBUG("Pen/Stylus: (%d, %d)[%d]",
				dev_dbg(&ts->client->dev,
					"Pen/Stylus: (%d, %d)[%d]",
					input_x, input_y, input_w);
				pre_pen = 1;
				pre_touch = 0;
@@ -587,8 +572,6 @@ static void goodix_ts_work_func(struct work_struct *work)
			touch_index |= (0x01<<id);
		}

		GTP_DEBUG("id = %d,touch_index = 0x%x, pre_touch = 0x%x\n",
			id, touch_index, pre_touch);
		for (i = 0; i < GTP_MAX_TOUCH; i++) {
#if GTP_WITH_PEN
			if (pre_pen == 1)
@@ -644,8 +627,6 @@ static enum hrtimer_restart goodix_ts_timer_handler(struct hrtimer *timer)
	struct goodix_ts_data
		*ts = container_of(timer, struct goodix_ts_data, timer);

	GTP_DEBUG_FUNC();

	queue_work(ts->goodix_wq, &ts->work);
	hrtimer_start(&ts->timer, ktime_set(0, (GTP_POLL_TIME + 6) * 1000000),
			HRTIMER_MODE_REL);
@@ -666,8 +647,6 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
{
	struct goodix_ts_data *ts = dev_id;

	GTP_DEBUG_FUNC();

	gtp_irq_disable(ts);

	queue_work(ts->goodix_wq, &ts->work);
@@ -699,8 +678,6 @@ Output:
*******************************************************/
static void gtp_reset_guitar(struct goodix_ts_data *ts, int ms)
{
	GTP_DEBUG_FUNC();

	/* This reset sequence will selcet I2C slave address */
	gpio_direction_output(ts->pdata->reset_gpio, 0);
	msleep(ms);
@@ -741,20 +718,17 @@ static s8 gtp_enter_doze(struct goodix_ts_data *ts)
		(u8)(GTP_REG_SLEEP >> 8),
		(u8)GTP_REG_SLEEP, 8};

	GTP_DEBUG_FUNC();

#if GTP_DBL_CLK_WAKEUP
	i2c_control_buf[2] = 0x09;
#endif
	gtp_irq_disable(ts);

	GTP_DEBUG("entering doze mode...");
	while (retry++ < 5) {
		i2c_control_buf[0] = 0x80;
		i2c_control_buf[1] = 0x46;
		ret = gtp_i2c_write(ts->client, i2c_control_buf, 3);
		if (ret < 0) {
			GTP_DEBUG(
			dev_err(&ts->client->dev,
				"failed to set doze flag into 0x8046, %d",
				retry);
			continue;
@@ -793,8 +767,6 @@ static s8 gtp_enter_sleep(struct goodix_ts_data *ts)
		(u8)(GTP_REG_SLEEP >> 8),
		(u8)GTP_REG_SLEEP, 5};

	GTP_DEBUG_FUNC();

	ret = gpio_direction_output(ts->pdata->irq_gpio, 0);
	usleep(5000);
	while (retry++ < 5) {
@@ -825,8 +797,6 @@ static s8 gtp_wakeup_sleep(struct goodix_ts_data *ts)
	u8 retry = 0;
	s8 ret = -1;

	GTP_DEBUG_FUNC();

#if GTP_POWER_CTRL_SLEEP
	gtp_reset_guitar(ts, 20);

@@ -914,10 +884,6 @@ static int gtp_init_panel(struct goodix_ts_data *ts)
		CFG_GROUP_LEN(cfg_info_group5),
		CFG_GROUP_LEN(cfg_info_group6)};

	GTP_DEBUG("Config Groups\' Lengths: %d, %d, %d, %d, %d, %d",
			cfg_info_len[0], cfg_info_len[1], cfg_info_len[2],
			cfg_info_len[3], cfg_info_len[4], cfg_info_len[5]);

	ret = gtp_i2c_read_dbl_check(ts->client, 0x41E4, opr_buf, 1);
	if (SUCCESS == ret) {
		if (opr_buf[0] != 0xBE) {
@@ -946,8 +912,6 @@ static int gtp_init_panel(struct goodix_ts_data *ts)
			return -EINVAL;
		}
	}
	GTP_DEBUG("Sensor_ID: %d", sensor_id);

	ts->gtp_cfg_len = cfg_info_len[sensor_id];

	if (ts->gtp_cfg_len < GTP_CONFIG_MIN_LENGTH) {
@@ -1035,7 +999,6 @@ static int gtp_init_panel(struct goodix_ts_data *ts)
	}
#endif /* !DRIVER NOT SEND CONFIG */

	GTP_DEBUG_FUNC();
	if ((ts->abs_x_max == 0) && (ts->abs_y_max == 0)) {
		ts->abs_x_max = (config_data[RESOLUTION_LOC + 1] << 8)
				+ config_data[RESOLUTION_LOC];
@@ -1047,10 +1010,6 @@ static int gtp_init_panel(struct goodix_ts_data *ts)
	if (ret < 0)
		dev_err(&client->dev, "%s: Send config error.\n", __func__);

	GTP_DEBUG("X_MAX = %d, Y_MAX = %d, TRIGGER = 0x%02x",
			ts->abs_x_max, ts->abs_y_max,
			ts->int_trigger_type);

	msleep(20);
	return ret;
}
@@ -1142,8 +1101,6 @@ static int gtp_i2c_test(struct i2c_client *client)
	int retry = 5;
	int ret = -EIO;

	GTP_DEBUG_FUNC();

	while (retry--) {
		ret = gtp_i2c_read(client, buf, 3);
		if (ret > 0)
@@ -1232,9 +1189,6 @@ static int gtp_request_irq(struct goodix_ts_data *ts)
	int ret;
	const u8 irq_table[] = GTP_IRQ_TAB;

	GTP_DEBUG("INT trigger type:%x, irq=%d", ts->int_trigger_type,
			ts->client->irq);

	ret = request_irq(ts->client->irq, goodix_ts_irq_handler,
			irq_table[ts->int_trigger_type],
			ts->client->name, ts);
@@ -1274,8 +1228,6 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts)
	int index = 0;
#endif

	GTP_DEBUG_FUNC();

	ts->input_dev = input_allocate_device();
	if (ts->input_dev == NULL) {
		dev_err(&ts->client->dev,
@@ -1309,7 +1261,7 @@ static int gtp_request_input_dev(struct goodix_ts_data *ts)
#endif

#if GTP_CHANGE_X2Y
	GTP_SWAP(ts->abs_x_max, ts->abs_y_max);
	swap(ts->abs_x_max, ts->abs_y_max);
#endif

	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X,
@@ -1869,7 +1821,6 @@ static int goodix_ts_remove(struct i2c_client *client)
{
	struct goodix_ts_data *ts = i2c_get_clientdata(client);

	GTP_DEBUG_FUNC();
#if defined(CONFIG_FB)
	if (fb_unregister_client(&ts->fb_notif))
		dev_err(&client->dev,
@@ -1932,8 +1883,6 @@ static void goodix_ts_suspend(struct goodix_ts_data *ts)
{
	int ret = -1, i;

	GTP_DEBUG_FUNC();

#if GTP_ESD_PROTECT
	ts->gtp_is_suspend = 1;
	gtp_esd_switch(ts->client, SWITCH_OFF);
@@ -1974,8 +1923,6 @@ static void goodix_ts_resume(struct goodix_ts_data *ts)
{
	int ret = -1;

	GTP_DEBUG_FUNC();

	ret = gtp_wakeup_sleep(ts);

#if GTP_SLIDE_WAKEUP
@@ -2104,9 +2051,6 @@ static int gtp_init_ext_watchdog(struct i2c_client *client)
	int ret;
	int retries = 0;

	GTP_DEBUG("Init external watchdog...");
	GTP_DEBUG_FUNC();

	msg.flags = !I2C_M_RD;
	msg.addr  = client->addr;
	msg.len   = 4;
@@ -2139,8 +2083,6 @@ static void gtp_esd_check_func(struct work_struct *work)
	struct goodix_ts_data *ts = NULL;
	u8 test[4] = {0x80, 0x40};

	GTP_DEBUG_FUNC();

	ts = i2c_get_clientdata(i2c_connect_client);

	if (ts->gtp_is_suspend) {
@@ -2156,7 +2098,6 @@ static void gtp_esd_check_func(struct work_struct *work)
	for (i = 0; i < 3; i++) {
		ret = gtp_i2c_read(ts->client, test, 4);

		GTP_DEBUG("0x8040 = 0x%02X, 0x8041 = 0x%02X", test[2], test[3]);
		if ((ret < 0)) {
			/* IC works abnormally..*/
			continue;
@@ -2228,7 +2169,6 @@ static int __init goodix_ts_init(void)
{
	int ret;

	GTP_DEBUG_FUNC();
#if GTP_ESD_PROTECT
	INIT_DELAYED_WORK(&gtp_esd_check_work, gtp_esd_check_func);
	gtp_esd_check_workqueue = create_workqueue("gtp_esd_check");
@@ -2247,7 +2187,6 @@ Output:
********************************************************/
static void __exit goodix_ts_exit(void)
{
	GTP_DEBUG_FUNC();
	i2c_del_driver(&goodix_ts_driver);
}

+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ extern u16 total_len;
/* double-click wakeup, function together with GTP_SLIDE_WAKEUP */
#define GTP_DBL_CLK_WAKEUP		0

#define GTP_DEBUG_ON			1
#define GTP_DEBUG_ON			0
#define GTP_DEBUG_ARRAY_ON		0
#define GTP_DEBUG_FUNC_ON		0