diff --git a/Documentation/devicetree/bindings/input/touchscreen/it7258_ts_i2c.txt b/Documentation/devicetree/bindings/input/touchscreen/it7258_ts_i2c.txt index 832ec34dbbda..3b2c272d7378 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/it7258_ts_i2c.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/it7258_ts_i2c.txt @@ -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>; }; }; diff --git a/drivers/input/touchscreen/it7258_ts_i2c.c b/drivers/input/touchscreen/it7258_ts_i2c.c index 5f1da30ecd88..c60a2b5a94b0 100644 --- a/drivers/input/touchscreen/it7258_ts_i2c.c +++ b/drivers/input/touchscreen/it7258_ts_i2c.c @@ -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); }