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

Commit 71566426 authored by Alexandra Chin's avatar Alexandra Chin Committed by Abinaya P
Browse files

input: synaptics_i2c_rmi4: Add appropriate reset delays

- Check device status after command reset

Change-Id: Ic083be66ae45c89179dfbecc88543d8c171363cf
Git-commit: 7e811dcd8eaf3fc0df765335d0ef14926f325f64
Git-repo: git://github.com/synaptics-touch/synaptics-dsx-i2c.git


[amaloche@codeaurora.org: only portion of patch taken.
 Custom changes were necessary to add for integration
 with mainline]
Signed-off-by: default avatarAmy Maloche <amaloche@codeaurora.org>
Signed-off-by: default avatarAbinaya P <abinayap@codeaurora.org>
parent 3deb6e64
Loading
Loading
Loading
Loading
+27 −3
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@

#define DRIVER_NAME "synaptics_rmi4_i2c"
#define INPUT_PHYS_NAME "synaptics_rmi4_i2c/input0"

#define RESET_DELAY 100

#define TYPE_B_PROTOCOL

#define NO_0D_WHILE_2D
@@ -68,6 +71,16 @@
#define NO_SLEEP_OFF (0 << 2)
#define NO_SLEEP_ON (1 << 2)

enum device_status {
	STATUS_NO_ERROR = 0x00,
	STATUS_RESET_OCCURRED = 0x01,
	STATUS_INVALID_CONFIG = 0x02,
	STATUS_DEVICE_FAILURE = 0x03,
	STATUS_CONFIG_CRC_FAILURE = 0x04,
	STATUS_FIRMWARE_CRC_FAILURE = 0x05,
	STATUS_CRC_IN_PROGRESS = 0x06
};

#define RMI4_VTG_MIN_UV		2700000
#define RMI4_VTG_MAX_UV		3300000
#define RMI4_ACTIVE_LOAD_UA	15000
@@ -79,7 +92,6 @@
#define RMI4_I2C_LPM_LOAD_UA	10

#define RMI4_GPIO_SLEEP_LOW_US 10000
#define RMI4_GPIO_WAIT_HIGH_MS 25

static int synaptics_rmi4_i2c_read(struct synaptics_rmi4_data *rmi4_data,
		unsigned short addr, unsigned char *data,
@@ -1466,6 +1478,18 @@ static int synaptics_rmi4_query_device(struct synaptics_rmi4_data *rmi4_data)
				if (retval < 0)
					return retval;

				while (status.status_code ==
						STATUS_CRC_IN_PROGRESS) {
					usleep_range(1000, 1001);
					retval = synaptics_rmi4_i2c_read(
						rmi4_data,
						rmi4_data->f01_data_base_addr,
						status.data,
						sizeof(status.data));
					if (retval < 0)
						return retval;
				}

				if (status.flash_prog == 1) {
					pr_notice("%s: In flash prog mode, status = 0x%02x\n",
							__func__,
@@ -1630,7 +1654,7 @@ static int synaptics_rmi4_reset_command(struct synaptics_rmi4_data *rmi4_data)
		return retval;
	}

	msleep(100);
	msleep(RESET_DELAY);
	return retval;
};

@@ -2084,7 +2108,7 @@ static int synaptics_rmi4_probe(struct i2c_client *client,
		gpio_set_value(platform_data->reset_gpio, 0);
		usleep_range(RMI4_GPIO_SLEEP_LOW_US, RMI4_GPIO_SLEEP_LOW_US+1);
		gpio_set_value(platform_data->reset_gpio, 1);
		msleep(RMI4_GPIO_WAIT_HIGH_MS);
		msleep(RESET_DELAY);
	} else
		synaptics_rmi4_reset_command(rmi4_data);