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

Commit 08478ca9 authored by Sarada Prasanna Garnayak's avatar Sarada Prasanna Garnayak Committed by Himanshu Aggarwal
Browse files

input: synaptics: add ability to distinguish touch part



The touchscreen controllers are field-swappable on both
customer devices and internal reference devices. For
Synaptics touch controller, package ID is a unique
identifier that is used to uniquely distinguish the touch
controller part. However, it is still possible to flash
these touch controllers with different firmware images. In
such a case, same touch controller's sensor will have
different dimensions depending on the firmware image
flashed in it. The patch adds the ability to identify
the correct sensor dimension for above use case. If
package ID read from device tree matches the package ID
read from touch controller, the driver also checks if
the sensor dimensions read from device tree match those
which are read from the touch controller.

Change-Id: I8423df30c61aaa7696c494aa5f105f169ad9c954
Signed-off-by: default avatarHimanshu Aggarwal <haggarwa@codeaurora.org>
Signed-off-by: default avatarSarada Prasanna Garnayak <c_sgarna@codeaurora.org>
parent 7121cf05
Loading
Loading
Loading
Loading
+35 −11
Original line number Diff line number Diff line
@@ -2597,15 +2597,44 @@ static int synaptics_rmi4_parse_dt_children(struct device *dev,
			rmi4_pdata->package_id = 0x00;
		}

		if (rmi4_pdata->package_id && (rmi4_pdata->package_id !=
					rmi->package_id)) {
		if (rmi4_pdata->package_id) {
			if (rmi4_pdata->package_id != rmi->package_id) {
				dev_err(dev,
				"%s: Synaptics package id don't match %d %d\n",
				__func__,
				rmi4_pdata->package_id, rmi->package_id);

			/* Iterate over next child if package does not match */
				/*
				 * Iterate over next child if package
				 * does not match
				 */
				continue;
			} else {
				/*
				 * If package id read from DT matches the
				 * package id value read from touch controller,
				 * also check if sensor dimensions read from DT
				 * match those read from controller, before
				 * moving further. For this first check if touch
				 * panel coordinates are defined in DT or not.
				 */
				if (of_find_property(child,
					"synaptics,panel-coords", NULL)) {
					synaptics_dsx_get_dt_coords(dev,
						"synaptics,panel-coords",
						rmi4_pdata, child);
					dev_info(dev, "Pmax_x Pmax_y = %d:%d\n",
						rmi4_pdata->panel_maxx,
						rmi4_pdata->panel_maxy);
					dev_info(dev, "Smax_x Smax_y = %d:%d\n",
						rmi4_data->sensor_max_x,
						rmi4_data->sensor_max_y);
					if ((rmi4_pdata->panel_maxx !=
						rmi4_data->sensor_max_x) ||
						(rmi4_pdata->panel_maxy !=
						rmi4_data->sensor_max_y))
						continue;
				}
			}
		}

		rc = synaptics_dsx_get_dt_coords(dev,
@@ -2613,11 +2642,6 @@ static int synaptics_rmi4_parse_dt_children(struct device *dev,
		if (rc && (rc != -EINVAL))
			return rc;

		rc = synaptics_dsx_get_dt_coords(dev,
				 "synaptics,panel-coords", rmi4_pdata, child);
		if (rc && (rc != -EINVAL))
			return rc;

		prop = of_find_property(child, "synaptics,button-map", NULL);
		if (prop) {
			rc = synaptics_dsx_get_button_map(dev, prop,
+26 −5
Original line number Diff line number Diff line
@@ -1753,6 +1753,32 @@ static int synaptics_rmi4_parse_dt_children(struct device *dev,
					rmi->package_id);

				continue;
			} else {
				/*
				 * If package id read from DT matches the
				 * package id value read from touch controller,
				 * also check if sensor dimensions read from DT
				 * match those read from controller, before
				 * moving further. For this first check if touch
				 * panel coordinates are defined in DT or not.
				 */
				if (of_find_property(child,
					"synaptics,panel-coords", NULL)) {
					synaptics_rmi4_get_dt_coords(dev,
						"synaptics,panel-coords",
						rmi4_pdata, child);
					dev_info(dev, "Pmax_x Pmax_y = %d:%d\n",
						rmi4_pdata->panel_maxx,
						rmi4_pdata->panel_maxy);
					dev_info(dev, "Smax_x Smax_y = %d:%d\n",
						rmi4_data->sensor_max_x,
						rmi4_data->sensor_max_y);
					if ((rmi4_pdata->panel_maxx !=
						rmi4_data->sensor_max_x) ||
						(rmi4_pdata->panel_maxy !=
						rmi4_data->sensor_max_y))
						continue;
				}
			}
		}

@@ -1763,11 +1789,6 @@ static int synaptics_rmi4_parse_dt_children(struct device *dev,
		if (rc && (rc != -EINVAL))
			return rc;

		rc = synaptics_rmi4_get_dt_coords(dev, "synaptics,panel-coords",
				rmi4_pdata, child);
		if (rc && (rc != -EINVAL))
			return rc;

		rc = synaptics_rmi4_get_button_map(dev, "synaptics,button-map",
				rmi4_pdata, child);
		if (rc < 0) {