From patchwork Fri Jul 14 01:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 13312835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC5AEC001E0 for ; Fri, 14 Jul 2023 01:38:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D6A2A10E094; Fri, 14 Jul 2023 01:38:13 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id A4CDB10E0DA for ; Fri, 14 Jul 2023 01:38:05 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 260F961B96; Fri, 14 Jul 2023 01:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57F38C433C9; Fri, 14 Jul 2023 01:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689298684; bh=naWE2eIjBBKz4B0jzEm35l9sKG56Gwsd4NcCsuZtNmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ViZ3Xf2bDb4Ex0evOPyohm+RJpRzM1CaULxqTMG9sM4Rf4V0qwdWNz3ro5yQJombh s5xcWLyK7rE6Ko+WdBwDxOg5pjbxLIklK31DXLIGVJ+F9JBhJ1HDcmHS90uq1WQaS3 PgEnCOd/xgUjU/4P4xQXT3B/+dJVtQpOff+6vI6pHPgE2NP/DLXz2ru8ga6OObZc04 gtDcaNCeQDGHaGAU93qkPLVBvSJ2yHxwXPKtgWcHybBV0VoYCjn26qztzZ9JG4s2Uj nZx/SIPQ/rstuL1a3lJja6k5GZxLBVPeFvqOTgH6CTRgpMShVLJKXK8aqIuWifPpd2 gePG2ekNWgToQ== Received: by mercury (Postfix, from userid 1000) id E509310676F3; Fri, 14 Jul 2023 03:37:58 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Subject: [PATCH v3 11/19] drm/panel: sitronix-st7789v: avoid hardcoding invert mode Date: Fri, 14 Jul 2023 03:37:48 +0200 Message-Id: <20230714013756.1546769-12-sre@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230714013756.1546769-1-sre@kernel.org> References: <20230714013756.1546769-1-sre@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Krzysztof Kozlowski , Gerald Loacker , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , Michael Riesch , Miquel Raynal Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" While the default panel uses invert mode, some panels require non-invert mode instead. Reviewed-by: Michael Riesch Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index d05d7a9caefc..ee84d7a9019e 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -112,6 +112,7 @@ struct st7789_panel_info { const struct drm_display_mode *mode; u32 bus_format; + bool invert_mode; }; struct st7789v { @@ -171,6 +172,7 @@ static const struct drm_display_mode default_mode = { static const struct st7789_panel_info default_panel = { .mode = &default_mode, + .invert_mode = true, .bus_format = MEDIA_BUS_FMT_RGB666_1X18, }; @@ -321,7 +323,13 @@ static int st7789v_prepare(struct drm_panel *panel) ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_NVGAMCTRL_VN61(0x1b))); ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_NVGAMCTRL_VN62(0x28))); - ST7789V_TEST(ret, st7789v_write_command(ctx, MIPI_DCS_ENTER_INVERT_MODE)); + if (ctx->info->invert_mode) { + ST7789V_TEST(ret, st7789v_write_command(ctx, + MIPI_DCS_ENTER_INVERT_MODE)); + } else { + ST7789V_TEST(ret, st7789v_write_command(ctx, + MIPI_DCS_EXIT_INVERT_MODE)); + } ST7789V_TEST(ret, st7789v_write_command(ctx, ST7789V_RAMCTRL_CMD)); ST7789V_TEST(ret, st7789v_write_data(ctx, ST7789V_RAMCTRL_DM_RGB |