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

Commit 6e0f241e authored by Shantanu Jain's avatar Shantanu Jain
Browse files

touchscreen: synaptics_dsx: set absolute axes for touchscreen



Android considers that minimum and maximum values of the
ABS_MT_POSITION_X and ABS_MT_POSITION_Y axes define the bounds
of the active area of the device in device-specific surface
units. These axes are stored inside the input_absinfo array of
the registered input devices. For touchscreen devices, these
axes are normally configured during driver's probe time.
However, some usecases would want to shrink or expand this
active area of the touch device on runtime. This patch adds
flexibility to configure these axes for touch screen's
corresponding input device.

Change-Id: I45e02bb93f02365ae44cffb04e8674244e4e372b
Signed-off-by: default avatarShantanu Jain <shjain@codeaurora.org>
parent 9071c08e
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -120,6 +120,12 @@ static int synaptics_rmi4_resume(struct device *dev);
static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count);

static ssize_t synaptics_rmi4_set_abs_x_axis(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count);

static ssize_t synaptics_rmi4_set_abs_y_axis(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count);

static ssize_t synaptics_rmi4_f01_productinfo_show(struct device *dev,
		struct device_attribute *attr, char *buf);

@@ -361,6 +367,12 @@ static struct device_attribute attrs[] = {
	__ATTR(reset, (S_IWUSR | S_IWGRP),
			NULL,
			synaptics_rmi4_f01_reset_store),
	__ATTR(set_abs_x_axis, (S_IWUSR | S_IWGRP),
			NULL,
			synaptics_rmi4_set_abs_x_axis),
	__ATTR(set_abs_y_axis, (S_IWUSR | S_IWGRP),
			NULL,
			synaptics_rmi4_set_abs_y_axis),
	__ATTR(productinfo, S_IRUGO,
			synaptics_rmi4_f01_productinfo_show,
			synaptics_rmi4_store_error),
@@ -663,6 +675,42 @@ static ssize_t synaptics_rmi4_full_pm_cycle_store(struct device *dev,
	return count;
}

static ssize_t synaptics_rmi4_set_abs_x_axis(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned int input;
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);

	if (sscanf(buf, "%u", &input) != 1)
		return -EINVAL;

	if (input == 0)
		return -EINVAL;

	input_set_abs_params(rmi4_data->input_dev, ABS_MT_POSITION_X,
			0, input, 0, 0);

	return count;
}

static ssize_t synaptics_rmi4_set_abs_y_axis(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	unsigned int input;
	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);

	if (sscanf(buf, "%u", &input) != 1)
		return -EINVAL;

	if (input == 0)
		return -EINVAL;

	input_set_abs_params(rmi4_data->input_dev, ABS_MT_POSITION_Y,
			0, input, 0, 0);

	return count;
}

static ssize_t synaptics_rmi4_f01_reset_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{