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

Commit b62cfa43 authored by Shantanu Jain's avatar Shantanu Jain
Browse files

input: touchscreen: add palm gesture sleep feature



Add palm gesture sleep feature for ITE tech touchscreen
driver. When enabled the driver sends a key code to the
user space if a palm is detected. Two optional device-tree
properties are added for this: ite,palm-detect and
ite,palm-detect-keycode.

Change-Id: I0989cb66ab5edb10769ced9d525bd4f6d7adb02b
Signed-off-by: default avatarShantanu Jain <shjain@codeaurora.org>
parent fb4ee289
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ Optional properties:
 - avdd-supply		: Analog power supply needed to power device
 - vdd-supply		: Power source required to pull up i2c bus
 - ite,wakeup		: boolean, use this to support touch-to-wake feature.
 - ite,palm-detect-en	: boolean, use this to send palm-detect-keycode when
			  palm is detected.

Required properties palm-detect-en feature:
 - ite,palm-detect-keycode	: The keycode that is required to be sent when
			  palm is detected by the ITE tech driver.

Example:
	i2c@f9927000 {
@@ -35,5 +41,7 @@ Example:
			ite,reset-gpio = <&msmgpio 16 0x00>;
			ite,irq-gpio = <&msmgpio 17 0x2008>;
			ite,wakeup;
			ite,palm-detect-en;
			ite,palm-detect-keycode = <142>;
		};
	};
+31 −0
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ struct IT7260_ts_platform_data {
	u32 reset_gpio;
	u32 reset_gpio_flags;
	bool wakeup;
	bool palm_detect_en;
	u16 palm_detect_keycode;
};

struct IT7260_ts_data {
@@ -749,6 +751,7 @@ static irqreturn_t IT7260_ts_threaded_handler(int irq, void *devid)
{
	struct PointData pointData;
	uint8_t devStatus;
	bool palm_detected;
	uint8_t pressure = FD_PRESSURE_NONE;
	uint16_t x, y;

@@ -788,6 +791,16 @@ static irqreturn_t IT7260_ts_threaded_handler(int irq, void *devid)
		return IRQ_HANDLED;
	}

	palm_detected = pointData.palm & PD_PALM_FLAG_BIT;
	if (palm_detected && gl_ts->pdata->palm_detect_en) {
		input_report_key(gl_ts->input_dev,
				gl_ts->pdata->palm_detect_keycode, 1);
		input_sync(gl_ts->input_dev);
		input_report_key(gl_ts->input_dev,
				gl_ts->pdata->palm_detect_keycode, 0);
		input_sync(gl_ts->input_dev);
	}

	if ((pointData.flags & PD_FLAGS_HAVE_FINGERS) & 1)
		readFingerData(&x, &y, &pressure, pointData.fd);

@@ -865,6 +878,7 @@ static int IT7260_ts_probe(struct i2c_client *client,
	struct IT7260_ts_platform_data *pdata;
	uint8_t rsp[2];
	int ret = -1;
	u32 temp_val;
	int rc;
	struct dentry *temp;

@@ -980,6 +994,19 @@ static int IT7260_ts_probe(struct i2c_client *client,

	pdata->wakeup = of_property_read_bool(client->dev.of_node,
						"ite,wakeup");
	pdata->palm_detect_en = of_property_read_bool(client->dev.of_node,
						"ite,palm-detect-en");
	if (pdata->palm_detect_en) {
		rc = of_property_read_u32(client->dev.of_node,
					"ite,palm-detect-keycode", &temp_val);
		if (!rc) {
			pdata->palm_detect_keycode = temp_val;
		} else {
			dev_err(&client->dev,
				"Unable to read palm-detect-keycode\n");
			return rc;
		}
	}

	if (!chipIdentifyIT7260()) {
		LOGI("chipIdentifyIT7260 FAIL");
@@ -1018,6 +1045,10 @@ static int IT7260_ts_probe(struct i2c_client *client,
		device_init_wakeup(&client->dev, pdata->wakeup);
	}

	if (pdata->palm_detect_en)
		set_bit(gl_ts->pdata->palm_detect_keycode,
					gl_ts->input_dev->keybit);

	if (input_register_device(input_dev)) {
		LOGE("failed to register input device\n");
		goto err_input_register;