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

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

input: touchscreen: reduce lpm current of avdd reg for ITE tech



Reduce lpm current of avdd regulator for ITE tech touch controller
to save power dissipation in lpm state.

Change-Id: I4b0c532096f1555561ad33e937cb947e85f987cd
Signed-off-by: default avatarShantanu Jain <shjain@codeaurora.org>
parent bda8711c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ Optional properties:
 - ite,low-reset	: boolean, if the controller needs low-state of the reset gpio while
			  initializing, and reset gpio should be made as high-state to reset the
			  controller. It means the controller needs "active-high" reset gpio.
 - ite,avdd-lpm-cur	: avdd lpm current value(mA) in suspend state.

Required properties palm-detect-en feature:
 - ite,palm-detect-keycode	: The keycode that is required to be sent when
@@ -76,5 +77,6 @@ Example:
			ite,num-fingers = <2>;
			ite,reset-delay = <20>;
			ite,low-reset;
			ite,vdd-lpm-cur = <3000>;
		};
	};
+27 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ struct IT7260_ts_platform_data {
	unsigned int disp_maxy;
	unsigned num_of_fingers;
	unsigned int reset_delay;
	unsigned int avdd_lpm_cur;
	bool low_reset;
};

@@ -1493,6 +1494,14 @@ static int IT7260_parse_dt(struct device *dev,
		return rc;
	}

	rc = of_property_read_u32(np, "ite,avdd-lpm-cur", &temp_val);
	if (!rc) {
		pdata->avdd_lpm_cur = temp_val;
	} else if (rc && (rc != -EINVAL)) {
		dev_err(dev, "Unable to read avdd lpm current value %d\n", rc);
		return rc;
	}

	pdata->low_reset = of_property_read_bool(np, "ite,low-reset");

	rc = IT7260_get_dt_coords(dev, "ite,display-coords", pdata);
@@ -1872,6 +1881,15 @@ static int IT7260_ts_resume(struct device *dev)

	if (device_may_wakeup(dev)) {
		if (gl_ts->device_needs_wakeup) {
			/* Set active current for the avdd regulator */
			if (gl_ts->pdata->avdd_lpm_cur) {
				retval = reg_set_optimum_mode_check(gl_ts->avdd,
						IT_I2C_ACTIVE_LOAD_UA);
				if (retval < 0)
					dev_err(dev, "Regulator avdd set_opt failed at resume rc=%d\n",
					retval);
			}

			gl_ts->device_needs_wakeup = false;
			disable_irq_wake(gl_ts->client->irq);
		}
@@ -1910,6 +1928,15 @@ static int IT7260_ts_suspend(struct device *dev)
			/* put the device in low power idle mode */
			IT7260_ts_chipLowPowerMode(PWR_CTL_LOW_POWER_MODE);

			/* Set lpm current for avdd regulator */
			if (gl_ts->pdata->avdd_lpm_cur) {
				retval = reg_set_optimum_mode_check(gl_ts->avdd,
						gl_ts->pdata->avdd_lpm_cur);
				if (retval < 0)
					dev_err(dev, "Regulator avdd set_opt failed at suspend rc=%d\n",
						retval);
			}

			gl_ts->device_needs_wakeup = true;
			enable_irq_wake(gl_ts->client->irq);
		}