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

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

Merge "input: touchscreen: hxchipset: make VMAP_STACK support fix proper"

parents f6347714 c6bc12ac
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@
#define HX_FINGER_LEAVE	2

#define HX_REPORT_SZ 128
#define HX_CMD_BYTE 1

enum HX_TS_PATH {
	HX_REPORT_COORD = 1,
+22 −18
Original line number Diff line number Diff line
@@ -178,29 +178,32 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe
		{
			.addr = client->addr,
			.flags = 0,
			.len = 1,
			.buf = &command,
			.len = HX_CMD_BYTE,
			.buf = buf,
		},
		{
			.addr = client->addr,
			.flags = I2C_M_RD,
			.len = length,
			.buf = buf,
			.buf = buf + HX_CMD_BYTE,
		}
	};

	if (length > HX_REPORT_SZ * 2) {
		I("%s: data length too large %d\n", __func__, length);
		buf = kmalloc(length, GFP_KERNEL);
	if (length > HX_REPORT_SZ) {
		W("%s: data length too large %d!\n", __func__, length);
		buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL);
		if (!buf) {
			E("%s: failed realloc buf %d\n", __func__, length);
			E("%s: failed realloc buf %d\n", __func__,
							length + HX_CMD_BYTE);
			return -EIO;
		}
		reallocate = true;
		msg[1].buf = buf;
		msg[0].buf = buf;
		msg[1].buf = buf + HX_CMD_BYTE;
	}

	mutex_lock(&ts->rw_lock);
	buf[0] = command;

	for (retry = 0; retry < toRetry; retry++) {
		if (i2c_transfer(client->adapter, msg, 2) == 2)
@@ -216,7 +219,7 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe
		return -EIO;
	}

	memcpy(data, buf, length);
	memcpy(data, buf + HX_CMD_BYTE, length);
	mutex_unlock(&ts->rw_lock);

	if (reallocate)
@@ -236,16 +239,17 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR
		{
			.addr = client->addr,
			.flags = 0,
			.len = length + 1,
			.len = length + HX_CMD_BYTE,
			.buf = buf,
		}
	};

	if (length + 1 > HX_REPORT_SZ * 2) {
		I("%s: data length too large %d\n", __func__, length + 1);
		buf = kmalloc(length + 1, GFP_KERNEL);
	if (length > HX_REPORT_SZ) {
		W("%s: data length too large %d!\n", __func__, length);
		buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL);
		if (!buf) {
			E("%s: failed realloc buf %d\n", __func__, length + 1);
			E("%s: failed realloc buf %d\n", __func__,
							length + HX_CMD_BYTE);
			return -EIO;
		}
		reallocate = true;
@@ -253,7 +257,7 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR

	mutex_lock(&ts->rw_lock);
	buf[0] = command;
	memcpy(buf + 1, data, length);
	memcpy(buf + HX_CMD_BYTE, data, length);

	for (retry = 0; retry < toRetry; retry++) {
		if (i2c_transfer(client->adapter, msg, 1) == 1)
@@ -298,8 +302,8 @@ int himax_bus_master_write(uint8_t *data, uint32_t length, uint8_t toRetry)
		}
	};

	if (length > HX_REPORT_SZ * 2) {
		I("%s: data length too large %d\n", __func__, length);
	if (length > HX_REPORT_SZ) {
		W("%s: data length too large %d!\n", __func__, length);
		buf = kmalloc(length, GFP_KERNEL);
		if (!buf) {
			E("%s: failed realloc buf %d\n", __func__, length);
@@ -797,7 +801,7 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i
	mutex_init(&ts->rw_lock);
	private_ts = ts;

	ts->report_i2c_data = kmalloc(HX_REPORT_SZ * 2, GFP_KERNEL);
	ts->report_i2c_data = kmalloc(HX_REPORT_SZ + HX_CMD_BYTE, GFP_KERNEL);
	if (ts->report_i2c_data == NULL) {
		E("%s: allocate report_i2c_data failed\n", __func__);
		ret = -ENOMEM;