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

Commit 7f345b84 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: touchscreen: Assign the TP from UEFI or DTSI"

parents 06932bb1 e71f0d70
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -17,10 +17,13 @@
#include "himax_platform.h"
#include "himax_common.h"
#include "himax_ic_core.h"
#include "linux/moduleparam.h"

int i2c_error_count;
int irq_enable_count;

active_tp_setup(himax);

int himax_dev_set(struct himax_ts_data *ts)
{
	int ret = 0;
@@ -787,9 +790,13 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i
{
	int ret = 0;
	struct himax_ts_data *ts;
	struct device_node *dt = client->dev.of_node;

	D("%s:Enter\n", __func__);

	if (himax_check_assigned_tp(dt, "compatible",
		"qcom,i2c-touch-active") < 0)
		goto err_dt_not_match;
	/* Check I2C functionality */
	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		E("%s: i2c check functionality error\n", __func__);
@@ -845,6 +852,7 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i
	kfree(ts);
err_alloc_data_failed:
err_check_functionality_failed:
err_dt_not_match:

	return ret;
}
+8 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@
#include "fts_lib/ftsTest.h"
#include "fts_lib/ftsTime.h"
#include "fts_lib/ftsTool.h"
#include "linux/moduleparam.h"



@@ -134,6 +135,8 @@ static int fts_mode_handler(struct fts_ts_info *info, int force);
static int fts_command(struct fts_ts_info *info, unsigned char cmd);
static int fts_chip_initialization(struct fts_ts_info *info);

active_tp_setup(st);

void touch_callback(unsigned int status)
{
    /* Empty */
@@ -4365,6 +4368,7 @@ static int fts_probe(struct i2c_client *client,
	struct device_node *dp = client->dev.of_node;
	int retval;
	int skip_5_1 = 0;
	struct device_node *dt = client->dev.of_node;

	logError(0, "%s %s: driver probe begin!\n", tag, __func__);

@@ -4372,6 +4376,9 @@ static int fts_probe(struct i2c_client *client,
	openChannel(client);
	logError(0, "%s driver ver. %s (built on)\n", tag, FTS_TS_DRV_VERSION);

	if (st_check_assigned_tp(dt, "compatible",
		"qcom,i2c-touch-active") < 0)
		goto err_dt_not_match;
	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		logError(1, "%s Unsupported I2C functionality\n", tag);
		error = -EIO;
@@ -4698,6 +4705,7 @@ static int fts_probe(struct i2c_client *client,
	kfree(info);

ProbeErrorExit_0:
err_dt_not_match:
	logError(1, "%s Probe Failed!\n", tag);

	return error;
+10 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include <linux/platform_device.h>
#include <linux/input/synaptics_dsx.h>
#include "synaptics_dsx_core.h"
#include "linux/moduleparam.h"

#define SYN_I2C_RETRY_TIMES 10
#define rd_msgs  1
@@ -53,6 +54,8 @@ static struct synaptics_dsx_hw_interface hw_if;

static struct platform_device *synaptics_dsx_i2c_device;

active_tp_setup(synaptics);

#ifdef CONFIG_OF
static int parse_dt(struct device *dev, struct synaptics_dsx_board_data *bdata)
{
@@ -475,7 +478,11 @@ static int synaptics_rmi4_i2c_probe(struct i2c_client *client,
		const struct i2c_device_id *dev_id)
{
	int retval;
	struct device_node *dt = client->dev.of_node;

	if (synaptics_check_assigned_tp(dt, "compatible",
		"qcom,i2c-touch-active") < 0)
		goto err_dt_not_match;
	if (!i2c_check_functionality(client->adapter,
			I2C_FUNC_SMBUS_BYTE_DATA)) {
		dev_err(&client->dev,
@@ -548,6 +555,9 @@ static int synaptics_rmi4_i2c_probe(struct i2c_client *client,
	}

	return 0;

err_dt_not_match:
	return -ENODEV;
}

static int synaptics_rmi4_i2c_remove(struct i2c_client *client)
+70 −0
Original line number Diff line number Diff line
@@ -541,4 +541,74 @@ int input_ff_flush(struct input_dev *dev, struct file *file);
int input_ff_create_memless(struct input_dev *dev, void *data,
		int (*play_effect)(struct input_dev *, void *, struct ff_effect *));

#define active_tp_setup(vendor)\
static char vendor##active_touch[512] = {0};\
int __init vendor##_active_tp_setup(char *str)\
{\
	char *temp;\
	pr_debug("%s, str = [%s]", __func__, str);\
	temp = strnstr(str, "=", strlen(str));\
	if (temp == NULL) {\
		return 0;\
	} \
	pr_debug("%s, temp = [%s]", __func__, temp);\
	temp++;\
	if (strlen(vendor##active_touch) > 0) {\
		strlcat(vendor##active_touch, ";", \
			strlen(vendor##active_touch));\
	} \
	snprintf(vendor##active_touch + strlen(vendor##active_touch), \
		sizeof(vendor##active_touch) - strlen(vendor##active_touch),\
		"%s", temp);\
	pr_debug("%s, active_touch = [%s]", __func__, \
		vendor##active_touch);\
	return 0;\
} \
__setup("touch", vendor##_active_tp_setup);\
\
int vendor##_check_assigned_tp(struct device_node *dt,\
	const char *str_comp, const char *str_act)\
{\
	const char *active_tp;\
	const char *tp_compatible;\
	char *temp;\
	int ret = 0;	\
	pr_debug("%s:active_touch = %s\n", __func__, vendor##active_touch);\
	ret = of_property_read_string(dt, str_comp, &tp_compatible);\
	if (ret < 0) {\
		pr_err(" %s:fail to read %s %d\n", \
			__func__, "compatible", ret);\
		goto exit;\
	} \
	if (strlen(vendor##active_touch) > 0) {\
		temp = strnstr(vendor##active_touch, tp_compatible, \
			strlen(vendor##active_touch));\
		if (temp == NULL) {\
			pr_err(" %s:para not match, %s, %s\n", __func__, \
			tp_compatible, vendor##active_touch);\
			ret = -1;\
			goto exit;\
		} \
	} else {\
		ret = of_property_read_string(dt->parent,\
			str_act, &active_tp);\
		if (ret < 0) {\
			pr_err(" %s:not dedicated active tp\n", __func__);\
			ret = 0;\
			goto exit;\
		} else {\
			temp = strnstr(active_tp, tp_compatible, \
				strlen(active_tp));\
			if (temp == NULL) {\
				pr_err(" %s:no match compatible, %s, %s\n", \
				__func__, tp_compatible, active_tp);\
				ret = -1;\
				goto exit;\
			} \
		} \
	} \
exit:\
	return ret;\
}

#endif