Skip to content

Commit

Permalink
Revert "input: touchscreen: gt1x: ignore pin of reset and support pow…
Browse files Browse the repository at this point in the history
…er invert"

This reverts commit 334791b.

Reason for revert:
The following warning appears on rk3588-evb1-lp4-v10 when suspend:
[   31.636037][  T414] unbalanced disables for vcc3v3_lcd0_n
[   31.636166][  T414] WARNING: CPU: 2 PID: 414 at drivers/regulator/core.c:2768 _regulator_disable+0x2e8/0x2f4
[   31.636191][  T414] Modules linked in: bcmdhd dhd_static_buf
[   31.636256][  T414] CPU: 2 PID: 414 Comm: composer@2.1-se Not tainted 5.10.110 radxa#116
[   31.636279][  T414] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[   31.636309][  T414] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[   31.636338][  T414] pc : _regulator_disable+0x2e8/0x2f4
[   31.636366][  T414] lr : _regulator_disable+0x2e8/0x2f4
...
[   31.636950][  T414] Call trace:
[   31.636980][  T414]  _regulator_disable+0x2e8/0x2f4
[   31.637009][  T414]  regulator_disable+0x40/0x84
[   31.637036][  T414]  panel_simple_unprepare+0x78/0xa4
[   31.637064][  T414]  drm_panel_unprepare+0x28/0x48
[   31.637094][  T414]  dw_mipi_dsi2_encoder_disable+0x70/0xbc
[   31.637123][  T414]  drm_atomic_helper_commit_modeset_disables+0x174/0x4d0
[   31.637154][  T414]  rockchip_drm_atomic_helper_commit_tail_rpm+0x44/0x184
[   31.637180][  T414]  commit_tail+0x110/0x200
[   31.637209][  T414]  drm_atomic_helper_commit+0x1f0/0x210
[   31.637238][  T414]  drm_atomic_commit+0x50/0x64
[   31.637268][  T414]  drm_mode_atomic_ioctl+0x620/0x744
[   31.637298][  T414]  drm_ioctl+0x24c/0x3b8
[   31.637328][  T414]  __arm64_sys_ioctl+0x94/0xd0
[   31.637359][  T414]  el0_svc_common+0xc0/0x23c
[   31.637388][  T414]  do_el0_svc+0x28/0x88
[   31.637417][  T414]  el0_svc+0x14/0x24
[   31.637446][  T414]  el0_sync_handler+0x88/0xec
[   31.637474][  T414]  el0_sync+0x1a8/0x1c0

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: Id27946e0ef3a6c320214c961b8e9b02978a15f6b
  • Loading branch information
rkhuangtao authored and stvhay committed Feb 24, 2023
1 parent 739f682 commit db7d94a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 45 deletions.
53 changes: 12 additions & 41 deletions drivers/input/touchscreen/gt1x/gt1x.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ static const struct dev_pm_ops gt1x_ts_pm_ops;
bool gt1x_gt5688;
int gt1x_rst_gpio;
int gt1x_int_gpio;
static bool power_invert;
#endif

static int gt1x_register_powermanger(void);
Expand Down Expand Up @@ -278,11 +277,6 @@ static void gt1x_ts_work_func(struct work_struct *work)
#else
ret = gt1x_touch_event_handler(point_data, input_dev, NULL);
#endif
if (ret < 0) {
#if !GTP_ESD_PROTECT
gt1x_power_reset();
#endif
}

exit_work_func:
if (!gt1x_rawdiff_mode && (ret >= 0 || ret == ERROR_VALUE)) {
Expand Down Expand Up @@ -329,14 +323,9 @@ static int gt1x_parse_dt(struct device *dev)
gt1x_int_gpio = of_get_named_gpio(np, "goodix,irq-gpio", 0);
gt1x_rst_gpio = of_get_named_gpio(np, "goodix,rst-gpio", 0);

if (!gpio_is_valid(gt1x_rst_gpio)) {
GTP_INFO("Invalid GPIO, rst-gpio:%d",
gt1x_rst_gpio);
}

if (!gpio_is_valid(gt1x_int_gpio)) {
GTP_ERROR("Invalid GPIO, irq-gpio:%d",
gt1x_int_gpio);
if (!gpio_is_valid(gt1x_int_gpio) || !gpio_is_valid(gt1x_rst_gpio)) {
GTP_ERROR("Invalid GPIO, irq-gpio:%d, rst-gpio:%d",
gt1x_int_gpio, gt1x_rst_gpio);
return -EINVAL;
}

Expand All @@ -347,9 +336,6 @@ static int gt1x_parse_dt(struct device *dev)
if (PTR_ERR(vdd_ana) == -ENODEV) {
GTP_ERROR("power not specified, ignore power ctrl");
vdd_ana = NULL;
} else {
power_invert = of_property_read_bool(np, "power-invert");
GTP_INFO("Power Invert,%s ", power_invert ? "yes" : "no");
}
}
if (IS_ERR(vdd_ana)) {
Expand Down Expand Up @@ -378,30 +364,18 @@ static int gt1x_parse_dt(struct device *dev)
*/
int gt1x_power_switch(int on)
{
int ret = 0;
int ret;
struct i2c_client *client = gt1x_i2c_client;

if (!client || !vdd_ana)
return -1;

if (on) {
GTP_DEBUG("GTP power on.");
if (power_invert) {
if (regulator_is_enabled(vdd_ana) > 0)
ret = regulator_disable(vdd_ana);
} else {
if (!regulator_is_enabled(vdd_ana))
ret = regulator_enable(vdd_ana);
}
ret = regulator_enable(vdd_ana);
} else {
GTP_DEBUG("GTP power off.");
if (power_invert) {
if (!regulator_is_enabled(vdd_ana))
ret = regulator_enable(vdd_ana);
} else {
if (regulator_is_enabled(vdd_ana) > 0)
ret = regulator_disable(vdd_ana);
}
ret = regulator_disable(vdd_ana);
}
return ret;
}
Expand Down Expand Up @@ -437,17 +411,14 @@ static s32 gt1x_request_io_port(void)
GTP_GPIO_AS_INT(GTP_INT_PORT);
gt1x_i2c_client->irq = GTP_INT_IRQ;

if (gpio_is_valid(gt1x_rst_gpio)) {
ret = gpio_request(GTP_RST_PORT, "GTP_RST_PORT");
if (ret < 0) {
GTP_ERROR("Failed to request GPIO:%d, ERRNO:%d", (s32) GTP_RST_PORT, ret);
gpio_free(GTP_INT_PORT);
return ret;
}

GTP_GPIO_AS_INPUT(GTP_RST_PORT);
ret = gpio_request(GTP_RST_PORT, "GTP_RST_PORT");
if (ret < 0) {
GTP_ERROR("Failed to request GPIO:%d, ERRNO:%d", (s32) GTP_RST_PORT, ret);
gpio_free(GTP_INT_PORT);
return ret;
}

GTP_GPIO_AS_INPUT(GTP_RST_PORT);
return 0;
}

Expand Down
6 changes: 2 additions & 4 deletions drivers/input/touchscreen/gt1x/gt1x_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,10 @@ s32 gt1x_init_panel(void)

void gt1x_select_addr(void)
{
if (gpio_is_valid(gt1x_rst_gpio))
GTP_GPIO_OUTPUT(GTP_RST_PORT, 0);
GTP_GPIO_OUTPUT(GTP_RST_PORT, 0);
GTP_GPIO_OUTPUT(GTP_INT_PORT, gt1x_i2c_client->addr == 0x14);
usleep_range(2000, 3000);
if (gpio_is_valid(gt1x_rst_gpio))
GTP_GPIO_OUTPUT(GTP_RST_PORT, 1);
GTP_GPIO_OUTPUT(GTP_RST_PORT, 1);
usleep_range(2000, 3000);
}

Expand Down

0 comments on commit db7d94a

Please sign in to comment.