Skip to content

Commit 7a62887

Browse files
sresuperna9999
authored andcommitted
drm/panel: sitronix-st7789v: avoid hardcoding invert mode
While the default panel uses invert mode, some panels require non-invert mode instead. Reviewed-by: Michael Riesch <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a4b563b commit 7a62887

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/gpu/drm/panel/panel-sitronix-st7789v.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
struct st7789_panel_info {
113113
const struct drm_display_mode *mode;
114114
u32 bus_format;
115+
bool invert_mode;
115116
};
116117

117118
struct st7789v {
@@ -171,6 +172,7 @@ static const struct drm_display_mode default_mode = {
171172

172173
static const struct st7789_panel_info default_panel = {
173174
.mode = &default_mode,
175+
.invert_mode = true,
174176
.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
175177
};
176178

@@ -321,7 +323,13 @@ static int st7789v_prepare(struct drm_panel *panel)
321323
ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_NVGAMCTRL_VN61(0x1b)));
322324
ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_NVGAMCTRL_VN62(0x28)));
323325

324-
ST7789V_TEST(ret, st7789v_write_command(ctx, MIPI_DCS_ENTER_INVERT_MODE));
326+
if (ctx->info->invert_mode) {
327+
ST7789V_TEST(ret, st7789v_write_command(ctx,
328+
MIPI_DCS_ENTER_INVERT_MODE));
329+
} else {
330+
ST7789V_TEST(ret, st7789v_write_command(ctx,
331+
MIPI_DCS_EXIT_INVERT_MODE));
332+
}
325333

326334
ST7789V_TEST(ret, st7789v_write_command(ctx, ST7789V_RAMCTRL_CMD));
327335
ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RAMCTRL_DM_RGB |

0 commit comments

Comments
 (0)