1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00
openmptcprouter/6.12/target/linux/bcm27xx/patches-6.12/950-0511-drm-panel-ili9881-Add-option-to-reconfigure-setup-co.patch
Ycarus (Yannick Chabanois) bdb9b0046f Add bcm27xx 6.12 test support
2024-12-20 14:17:26 +01:00

102 lines
2.9 KiB
Diff

From 03f1e8dfb1d5a3ef4f507f7153ee6ae7500f51d8 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Wed, 18 Sep 2024 16:09:28 +0100
Subject: [PATCH 511/697] drm: panel: ili9881: Add option to reconfigure setup
commands
The driver is typically asking for LP commands, but then tries
to send set_display_[on|off] from enable/disable when the host
will be in HS mode.
It also sends shutdown commands just before it asserts reset and
disables the regulator, which is rather redundant.
Add an option to configure these two choices from the panel_desc.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 32 ++++++++++++++++---
1 file changed, 28 insertions(+), 4 deletions(-)
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -40,12 +40,19 @@ struct ili9881c_instr {
} arg;
};
+enum ili9881_desc_flags {
+ ILI9881_FLAGS_NO_SHUTDOWN_CMDS = BIT(0),
+ ILI9881_FLAGS_PANEL_ON_IN_PREPARE = BIT(1),
+ ILI9881_FLAGS_MAX = BIT(31),
+};
+
struct ili9881c_desc {
const struct ili9881c_instr *init;
const size_t init_length;
const struct drm_display_mode *mode;
const unsigned long mode_flags;
unsigned int lanes;
+ enum ili9881_desc_flags flags;
};
struct ili9881c {
@@ -2120,6 +2127,12 @@ static int ili9881c_prepare(struct drm_p
if (ret)
return ret;
+ if (ctx->desc->flags & ILI9881_FLAGS_PANEL_ON_IN_PREPARE) {
+ msleep(120);
+
+ ret = mipi_dsi_dcs_set_display_on(ctx->dsi);
+ }
+
return 0;
}
@@ -2127,9 +2140,11 @@ static int ili9881c_enable(struct drm_pa
{
struct ili9881c *ctx = panel_to_ili9881c(panel);
- msleep(120);
+ if (!(ctx->desc->flags & ILI9881_FLAGS_PANEL_ON_IN_PREPARE)) {
+ msleep(120);
- mipi_dsi_dcs_set_display_on(ctx->dsi);
+ mipi_dsi_dcs_set_display_on(ctx->dsi);
+ }
return 0;
}
@@ -2138,7 +2153,8 @@ static int ili9881c_disable(struct drm_p
{
struct ili9881c *ctx = panel_to_ili9881c(panel);
- mipi_dsi_dcs_set_display_off(ctx->dsi);
+ if (!(ctx->desc->flags & ILI9881_FLAGS_PANEL_ON_IN_PREPARE))
+ mipi_dsi_dcs_set_display_off(ctx->dsi);
return 0;
}
@@ -2147,7 +2163,13 @@ static int ili9881c_unprepare(struct drm
{
struct ili9881c *ctx = panel_to_ili9881c(panel);
- mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
+ if (!(ctx->desc->flags & ILI9881_FLAGS_NO_SHUTDOWN_CMDS)) {
+ if (ctx->desc->flags & ILI9881_FLAGS_PANEL_ON_IN_PREPARE)
+ mipi_dsi_dcs_set_display_off(ctx->dsi);
+
+ mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
+ }
+
regulator_disable(ctx->power);
gpiod_set_value_cansleep(ctx->reset, 1);
@@ -2510,6 +2532,8 @@ static const struct ili9881c_desc rpi_7i
.mode = &rpi_7inch_default_mode,
.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM,
.lanes = 2,
+ .flags = ILI9881_FLAGS_NO_SHUTDOWN_CMDS |
+ ILI9881_FLAGS_PANEL_ON_IN_PREPARE,
};
static const struct of_device_id ili9881c_of_match[] = {