From patchwork Fri Jul 14 01:37:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 702988 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE103C001DF for ; Fri, 14 Jul 2023 01:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233670AbjGNBiE (ORCPT ); Thu, 13 Jul 2023 21:38:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232120AbjGNBiD (ORCPT ); Thu, 13 Jul 2023 21:38:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 153012D60; Thu, 13 Jul 2023 18:38:03 -0700 (PDT) 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 7C1AD61BA2; Fri, 14 Jul 2023 01:38:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A59EBC433C9; Fri, 14 Jul 2023 01:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689298681; bh=LPOwEiLDba7WqkS5e6PMVWcf9bxL4V+UFMcte4xKN7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENVvj5nN3emsfKqKyx1iWqHLTmxPBlBu+UBlk0CVbM6eJB/AHK4ulqq1AzPz8MdzK uaG9auED1JyG44KGnoZ6PwzjBU5bhT7wEnGxyzqy3mm0eH1y/sEdtVTervd51DMX+C uUKloTsfhMRbg56oFkfgCIO6cbtDj/Bg/EsDQxp/JavFzFKXqbbN2zyV+qZzclTz5t XusvMJVYrSr8P09hBrOAwGVbaArjdEeGiri2m2oEkgrEA0HzOKGkjAQFtr44HLiaOQ 7Z14321ihJoc6BmI6UFH9OVI5Oi19HRB2dScVTqP7ByUhvUVoW26YyiaxYhfwBb4Z5 SJBtmL7mSEzbA== Received: by mercury (Postfix, from userid 1000) id CAE161067666; Fri, 14 Jul 2023 03:37:58 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Cc: Gerald Loacker , Michael Riesch , Miquel Raynal , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Krzysztof Kozlowski Subject: [PATCH v3 01/19] dt-bindings: vendor-prefixes: add Inanbo Date: Fri, 14 Jul 2023 03:37:38 +0200 Message-Id: <20230714013756.1546769-2-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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Shenzhen INANBO Electronic Technology Co., Ltd. manufacturers TFT/OLED LCD panels. Reviewed-by: Michael Riesch Acked-by: Krzysztof Kozlowski Signed-off-by: Sebastian Reichel --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index af60bf1a6664..1e2e51401dc5 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -617,6 +617,8 @@ patternProperties: description: Imagination Technologies Ltd. "^imi,.*": description: Integrated Micro-Electronics Inc. + "^inanbo,.*": + description: Shenzhen INANBO Electronic Technology Co., Ltd. "^incircuit,.*": description: In-Circuit GmbH "^indiedroid,.*": From patchwork Fri Jul 14 01:37:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 702983 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DC08C00528 for ; Fri, 14 Jul 2023 01:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234393AbjGNBiR (ORCPT ); Thu, 13 Jul 2023 21:38:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233951AbjGNBiN (ORCPT ); Thu, 13 Jul 2023 21:38:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A6F2D6B; Thu, 13 Jul 2023 18:38:06 -0700 (PDT) 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 B407761BBD; Fri, 14 Jul 2023 01:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58042C433CA; 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=BWX8AXPfJ5gQEAV6Gfsqwd1FF8WXCoKoYTywoJ22YAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQzQ13H+HlDBwkhGckSx6+UVsUTgf01rN2VxwEfLMhsxfJGPZLGnBuvfOxvWSxQks wt91ai0vjK/Pr0I7lWxhituUXXkHgRO12rL0GZn9l+Tlj67Osv4QOkuKXGO9dEUWVG A3vJGVPYi1pHSnDFHLxRxYUCMRAJcAYdGvbveGn1ENNQNNxlWqV+w1fRvE8cR4SVaU UxMc/R6KmA1KYHwtLhDuWXj1J3bAywXFGfyW9wbBfnEbKnDQV81wRveWWhOqXyQB8/ Mue7M4xbPx9oH0g5OLt671GIFyUpkCXnxMpWP7g8yRoCinZ7hLT6D2s5w1ltqRlwVq r6NojQosdpfMA== Received: by mercury (Postfix, from userid 1000) id D82FB1067696; Fri, 14 Jul 2023 03:37:58 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Cc: Gerald Loacker , Michael Riesch , Miquel Raynal , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v3 06/19] drm/panel: sitronix-st7789v: simplify st7789v_spi_write Date: Fri, 14 Jul 2023 03:37:43 +0200 Message-Id: <20230714013756.1546769-7-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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org st7789v_spi_write initializes a message with just a single transfer, spi_sync_transfer can be used for that. Reviewed-by: Michael Riesch Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index 1d43b8cc1647..6290bd49d055 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -129,17 +129,13 @@ static int st7789v_spi_write(struct st7789v *ctx, enum st7789v_prefix prefix, u8 data) { struct spi_transfer xfer = { }; - struct spi_message msg; u16 txbuf = ((prefix & 1) << 8) | data; - spi_message_init(&msg); - xfer.tx_buf = &txbuf; xfer.bits_per_word = 9; xfer.len = sizeof(txbuf); - spi_message_add_tail(&xfer, &msg); - return spi_sync(ctx->spi, &msg); + return spi_sync_transfer(ctx->spi, &xfer, 1); } static int st7789v_write_command(struct st7789v *ctx, u8 cmd) From patchwork Fri Jul 14 01:37:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 702984 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6416C001E0 for ; Fri, 14 Jul 2023 01:38:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234267AbjGNBiO (ORCPT ); Thu, 13 Jul 2023 21:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233787AbjGNBiH (ORCPT ); Thu, 13 Jul 2023 21:38:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C0B2D64; Thu, 13 Jul 2023 18:38:05 -0700 (PDT) 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) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3535961BB8; Fri, 14 Jul 2023 01:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 583B5C433CC; 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=i3ZrSSDxreDrHnbdzjRZb/TFVdFo15zQGfDgEtGHAcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P/KHAdAtEeObqX6VWEDk0ol/pRePLLW+O8wxczMFSV9tDyruFPRh8YIAYg/BOBWMm zQZoMi7hqMriC9HuMMsg4zqjCgcE1JLo2PzoXW17KBWwcTa6aTbKxbd2Kp3nst/n7y TYQlDs8Ih5PVu2M0hMXxZQ67BDEt2yF/mdtXL9fpq4CFSH5RkE7HUNRFj3Hx+lP5U4 IQJVkYeTWW8FCHKSwVZV1vl81N+kRGL9ktzm3u9Kb1YsaxLzPqrF9egRnkDlmbAcXM KE66/6bAfqQZNYB63TLXcat4LNM5OvgQqbh89l2EZrWHRLqybOUOdf8Y4yADPY7hU2 YClOTMMf8/wHQ== Received: by mercury (Postfix, from userid 1000) id DD676106769A; Fri, 14 Jul 2023 03:37:58 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Cc: Gerald Loacker , Michael Riesch , Miquel Raynal , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v3 08/19] drm/panel: sitronix-st7789v: avoid hardcoding mode info Date: Fri, 14 Jul 2023 03:37:45 +0200 Message-Id: <20230714013756.1546769-9-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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Avoid hard-coding the default_mode and supply it from match data. One additional layer of abstraction has been introduced, which will be needed for specifying other panel information (e.g. bus flags) in the next steps. Reviewed-by: Michael Riesch Signed-off-by: Sebastian Reichel --- .../gpu/drm/panel/panel-sitronix-st7789v.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index a6d6155ef45c..24c5bec6ce31 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -108,8 +108,13 @@ return val; \ } while (0) +struct st7789_panel_info { + const struct drm_display_mode *mode; +}; + struct st7789v { struct drm_panel panel; + const struct st7789_panel_info *info; struct spi_device *spi; struct gpio_desc *reset; struct regulator *power; @@ -160,16 +165,21 @@ static const struct drm_display_mode default_mode = { .vtotal = 320 + 8 + 4 + 4, }; +static const struct st7789_panel_info default_panel = { + .mode = &default_mode, +}; + static int st7789v_get_modes(struct drm_panel *panel, struct drm_connector *connector) { + struct st7789v *ctx = panel_to_st7789v(panel); struct drm_display_mode *mode; - mode = drm_mode_duplicate(connector->dev, &default_mode); + mode = drm_mode_duplicate(connector->dev, ctx->info->mode); if (!mode) { - dev_err(panel->dev, "failed to add mode %ux%ux@%u\n", - default_mode.hdisplay, default_mode.vdisplay, - drm_mode_vrefresh(&default_mode)); + dev_err(panel->dev, "failed to add mode %ux%u@%u\n", + ctx->info->mode->hdisplay, ctx->info->mode->vdisplay, + drm_mode_vrefresh(ctx->info->mode)); return -ENOMEM; } @@ -359,6 +369,8 @@ static int st7789v_probe(struct spi_device *spi) spi_set_drvdata(spi, ctx); ctx->spi = spi; + ctx->info = device_get_match_data(&spi->dev); + drm_panel_init(&ctx->panel, dev, &st7789v_drm_funcs, DRM_MODE_CONNECTOR_DPI); @@ -389,13 +401,13 @@ static void st7789v_remove(struct spi_device *spi) } static const struct spi_device_id st7789v_spi_id[] = { - { "st7789v" }, + { "st7789v", (unsigned long) &default_panel }, { } }; MODULE_DEVICE_TABLE(spi, st7789v_spi_id); static const struct of_device_id st7789v_of_match[] = { - { .compatible = "sitronix,st7789v" }, + { .compatible = "sitronix,st7789v", .data = &default_panel }, { } }; MODULE_DEVICE_TABLE(of, st7789v_of_match); From patchwork Fri Jul 14 01:37:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 702985 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23833C04A6A for ; Fri, 14 Jul 2023 01:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234016AbjGNBiP (ORCPT ); Thu, 13 Jul 2023 21:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233799AbjGNBiH (ORCPT ); Thu, 13 Jul 2023 21:38:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC2782D66; Thu, 13 Jul 2023 18:38:05 -0700 (PDT) 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) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 353D161BB9; Fri, 14 Jul 2023 01:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 581D1C433CB; 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=pHG+mTF3Sqq4Dyhp7e3fM2xvT8KCo3Hc4liBMTVZVOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcobtyHoeNyuILr2XEO5I4hFwKoTCvji/RQFFN4rJXcJn8ldgZrRtumRdxsmLzDAl TF3fWQFpUhlCtRfrI8NSYv7VHedxNEz6gAHWN5o7A2XFWwrckHcIctWvEhXjDGHfhR P/l1czEkG1foF2ESTVmjPtnLrbetDqZ1d3fmBPgb2w6ZUTbS4UqibPz25ye8E/27rj 87CAO8XzMhJUo/yciroYpWw3s16fQO+VRNlBe7CHLDtedEciSv+Xx9Lbmb0pD3z9Yg sj4+cTkOpOcbQAHgsms06lQ4praeRHvGBVCPWXDc6+JyhyWi2bMslRc7Aisrm5YQhF 8Rnho0zq6hUlg== Received: by mercury (Postfix, from userid 1000) id E249B10676F2; Fri, 14 Jul 2023 03:37:58 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Cc: Gerald Loacker , Michael Riesch , Miquel Raynal , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v3 10/19] drm/panel: sitronix-st7789v: add media bus format Date: Fri, 14 Jul 2023 03:37:47 +0200 Message-Id: <20230714013756.1546769-11-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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support for describing the media bus format in the panel configuration and expose that to userspace. Since both supported formats (RGB565 and RGB666) are using 6 bits per color also hardcode that information. Reviewed-by: Michael Riesch Signed-off-by: Sebastian Reichel --- .../gpu/drm/panel/panel-sitronix-st7789v.c | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index aa11a1dc0752..d05d7a9caefc 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -10,6 +10,7 @@ #include #include