Skip to content

Commit

Permalink
drm/panel: st7703: Pick different reset sequence
Browse files Browse the repository at this point in the history
[ Upstream commit d12d635 ]

Switching to a different reset sequence, enabling IOVCC before enabling
VCC.

There also needs to be a delay after enabling the supplies and before
deasserting the reset. The datasheet specifies 1ms after the supplies
reach the required voltage. Use 10-20ms to also give the power supplies
some time to reach the required voltage, too.

This fixes intermittent panel initialization failures and screen
corruption during resume from sleep on panel xingbangda,xbd599 (e.g.
used in PinePhone).

Signed-off-by: Ondrej Jirman <[email protected]>
Signed-off-by: Frank Oltmanns <[email protected]>
Reported-by: Samuel Holland <[email protected]>
Reviewed-by: Guido Günther <[email protected]>
Tested-by: Guido Günther <[email protected]>
Signed-off-by: Guido Günther <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Ondrej Jirman authored and gregkh committed Nov 28, 2023
1 parent 70f831f commit 1afe397
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions drivers/gpu/drm/panel/panel-sitronix-st7703.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,29 +506,30 @@ static int st7703_prepare(struct drm_panel *panel)
return 0;

dev_dbg(ctx->dev, "Resetting the panel\n");
ret = regulator_enable(ctx->vcc);
gpiod_set_value_cansleep(ctx->reset_gpio, 1);

ret = regulator_enable(ctx->iovcc);
if (ret < 0) {
dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret);
dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret);
return ret;
}
ret = regulator_enable(ctx->iovcc);

ret = regulator_enable(ctx->vcc);
if (ret < 0) {
dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret);
goto disable_vcc;
dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret);
regulator_disable(ctx->iovcc);
return ret;
}

gpiod_set_value_cansleep(ctx->reset_gpio, 1);
usleep_range(20, 40);
/* Give power supplies time to stabilize before deasserting reset. */
usleep_range(10000, 20000);

gpiod_set_value_cansleep(ctx->reset_gpio, 0);
msleep(20);
usleep_range(15000, 20000);

ctx->prepared = true;

return 0;

disable_vcc:
regulator_disable(ctx->vcc);
return ret;
}

static const u32 mantix_bus_formats[] = {
Expand Down

0 comments on commit 1afe397

Please sign in to comment.