From patchwork Fri Jun 14 19:02:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Hugo X-Patchwork-Id: 10997415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B8C914B6 for ; Sun, 16 Jun 2019 14:02:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F042F286E2 for ; Sun, 16 Jun 2019 14:02:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4C73286EE; Sun, 16 Jun 2019 14:02:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A356D286E2 for ; Sun, 16 Jun 2019 14:02:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA166891D7; Sun, 16 Jun 2019 14:01:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8314088DF5 for ; Fri, 14 Jun 2019 19:02:32 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id l19so2037212pgh.9 for ; Fri, 14 Jun 2019 12:02:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fIRh2XHogKOPzGlSMAfw0Y3R1r0WmYblJh7xr9zVEVM=; b=LsdUZidvTCm+PS8saofYbd28Xalk2Tbkyxlv4WsgI+ohaAsZqFsgXufQt3uvtioLaa zE6UVsmc3a1EPxEnuZrMHuWE9M6GuMlRmUAtsaD4h7tVybyykgWz98hl66n7poSfjdFP sL9xm272yLbPDVW1gLyfguqs2zyr7YyWM9Ewakl+4BtVV5g/CdYTpeikEd2mGyfjB/p/ 0VOa+5hE15pdPvTH125FI5gRwZ+E/asPo4RdiHNcEPbpdkLHVIsmsR0NH7WYItL0O6p0 VAuhSjnw/ICVDHgY44buVbj2eCx9TqZYAoslbc8t3VYh/L/FbzvkSbyLUDkPFU6LZ+uF Is2Q== X-Gm-Message-State: APjAAAVb6ZFnoTi8IYGUx/xwzhzBGzMaxbq8uDn1CfMaMpSL/eNIuO8N TaME5uXNozeMhlKeLmAvdWY= X-Google-Smtp-Source: APXvYqxqU2TQ1aZVb8lHhD8nMe+2Zh0ButW4PhfN5GiSP/wc0SrsCnxeNKFnBk5L6Fx2LidQ8OE7fQ== X-Received: by 2002:a17:90a:c481:: with SMTP id j1mr12504510pjt.96.1560538952188; Fri, 14 Jun 2019 12:02:32 -0700 (PDT) Received: from aw-bldr-10.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id s15sm4503208pfd.183.2019.06.14.12.02.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 12:02:31 -0700 (PDT) From: Jeffrey Hugo To: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org, mark.rutland@arm.com, thierry.reding@gmail.com, sam@ravnborg.org Subject: [PATCH 1/2] dt-bindings: display: truly: Add MSM8998 MTP panel Date: Fri, 14 Jun 2019 12:02:20 -0700 Message-Id: <20190614190220.34568-1-jeffrey.l.hugo@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190614185547.34518-1-jeffrey.l.hugo@gmail.com> References: <20190614185547.34518-1-jeffrey.l.hugo@gmail.com> X-Mailman-Approved-At: Sun, 16 Jun 2019 14:01:48 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fIRh2XHogKOPzGlSMAfw0Y3R1r0WmYblJh7xr9zVEVM=; b=Kwr5imp1sJTDpaaM8ydTfG4xZ3PQB4I2YwQP92gtlJPjp+0ir+jnIGIh/kISuAyuId P0lUpzcW3H2YCFEWjyzrc2tL9dwGF/sb6aT53hdGH2IFP1CrbWmc2HNJHWbXb7UBVRy+ hnZSbIbzuOwZ5VDeCXeJO4UU+qjD8Jm11L/j1Oj+PvgapNlr/FJHOKwxaSLTFN0PXFbh FwnNYlRxm5Gqg7ZOCc4HG/+l6PGbDnbRMgjY39WD1H4b+Gqk3XBsR87Wmc+Y3wyYtcSi jlE+8oS7hWoZaOo6jdUZqfJlqeqc/0i/igvoI17t1D/abAuJR2DISsHfKG1ND7pkXeYU mjHA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Jeffrey Hugo , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, bjorn.andersson@linaro.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The MSM8998 MTP uses the Truly display driver for its panel, but the configuration differs slightly from the existing SDM845. Add a compatible to account for the differences. Signed-off-by: Jeffrey Hugo --- .../devicetree/bindings/display/truly,nt35597.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/display/truly,nt35597.txt b/Documentation/devicetree/bindings/display/truly,nt35597.txt index f39c77ee36ea..fda36c1ad3c3 100644 --- a/Documentation/devicetree/bindings/display/truly,nt35597.txt +++ b/Documentation/devicetree/bindings/display/truly,nt35597.txt @@ -1,10 +1,11 @@ Truly model NT35597 DSI display driver -The Truly NT35597 is a generic display driver, currently only configured -for use in the 2K display on the Qualcomm SDM845 MTP board. +The Truly NT35597 is a generic display driver used for the Qualcomm reference +platforms. Required properties: -- compatible: should be "truly,nt35597-2K-display" +- compatible: should be "truly,nt35597-2K-display" (SDM845) + "truly,nt35597-wqhd-cmd-dsc-display" (MSM8998) - vdda-supply: phandle of the regulator that provides the supply voltage Power IC supply - vdispp-supply: phandle of the regulator that provides the supply voltage From patchwork Fri Jun 14 19:02:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Hugo X-Patchwork-Id: 10997411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 302081398 for ; Sun, 16 Jun 2019 14:02:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FC33286E2 for ; Sun, 16 Jun 2019 14:02:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1321D286EC; Sun, 16 Jun 2019 14:02:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 670D628714 for ; Sun, 16 Jun 2019 14:02:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 418E3891B5; Sun, 16 Jun 2019 14:01:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6010D88DF5 for ; Fri, 14 Jun 2019 19:02:50 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id r7so1988091pfl.3 for ; Fri, 14 Jun 2019 12:02:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q4CwzHvSxPdrHbLfdvEnU6XX5mvUWE4s13V3F5wL12w=; b=cY+iz2ogZpiImjXJJUWUgb/T71WsvBxtZ7ei1r+j1L4KLke8pCWwu5A5dQUjPALQjh ECW2pQtWd7U47CGzsLkAjzdGtQdeXuX1seLjRFQGWAij8bPuSY8vso4aliRxcYSN+lX8 4mOtyvWLb9BF1VgPwlnGJyhDPsim75UDdvQwy6WpFv63CIeZ58qWcHmJsIID1Ji0adoc Dj6jGjSP1UlRRHSjLvUO9zvBXZXlOu0p0csEr6grr7EcgG7uc295oW7KZEsfvIiouJcd n1F/4Wacg21psYP1OEJFFFdkcamT0rD0wQC6BON3viCDjzR26S+D0URYDzLHjRFS2pdK WkMg== X-Gm-Message-State: APjAAAVCnSB0xNt51BuSc3KgtXaxbc+Si+Dvp6eZbZpwsWcp9nssgcuZ Dv9yjYpRJcoahCdz45lZbUY= X-Google-Smtp-Source: APXvYqxq86nvk7En+2k6Qmb/e8xJH64H+1W/yXHf3yXI+rH8Q7VcbhbG90OHDiI6i/RtgLk0xZk3Wg== X-Received: by 2002:a63:ec42:: with SMTP id r2mr38185907pgj.262.1560538969771; Fri, 14 Jun 2019 12:02:49 -0700 (PDT) Received: from aw-bldr-10.qualcomm.com (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id d9sm3507675pgj.34.2019.06.14.12.02.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 12:02:49 -0700 (PDT) From: Jeffrey Hugo To: airlied@linux.ie, daniel@ffwll.ch, thierry.reding@gmail.com, sam@ravnborg.org Subject: [PATCH 2/2] drm/panel: truly: Add MSM8998 MTP support Date: Fri, 14 Jun 2019 12:02:46 -0700 Message-Id: <20190614190246.34617-1-jeffrey.l.hugo@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190614185547.34518-1-jeffrey.l.hugo@gmail.com> References: <20190614185547.34518-1-jeffrey.l.hugo@gmail.com> X-Mailman-Approved-At: Sun, 16 Jun 2019 14:01:48 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q4CwzHvSxPdrHbLfdvEnU6XX5mvUWE4s13V3F5wL12w=; b=qjIapLAZMVuaAJkOeMRv+8i9iLR84SVKaupIVQsaLF0hzsAZYOnverun5g6jQcwYvR z0wRvqyGkeiHYxRTApMjfTIf8Hpf9ZwV1z4LxYcgpedll0fryUO6937UFxqVzo83aO2A oROiCTPfXs9tEFuUvws7SZcpWrsWoR4NyG2s/1k3lXf/isUTJsqYCDTVAuA+qwxM4yCP +iz+2GTUXiamJCLBw2kx0ZrhO8K0lArk7xf3G8q2kLkaXX4TDP9cc7VIfsMV8PRC5O7j sfhjqyIyKtwKI1H5wLGd+idzysSkpM6f6yaq5D4m6Wzr+YwjaPp2JIhtNNfielVHHT2N 346g== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, Jeffrey Hugo , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, bjorn.andersson@linaro.org, robh+dt@kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The MSM8998 MTP is the MSM8998 reference platform, and like the SDM845 MTP it uses the Truly NT35587 Display driver. However, unlike the SDM845 MTP, the instance in the MSM8998 MTP is a single DSI interface, command mode type panel that supports a WQHD resolution and requires DSC compression. Add support for the MSM8998 MTP by extending the driver to handle both configurations. Note that the delay after the reset has been de-asserted has been extended to 100 ms. Through experimentation, it has been determined that the MSM8998 instance requires a 50 ms delay between reset de-assert and sending configuration commands for the display to work. Significantly shorter than that, and timeouts/errors occur signaling a non-working display. Shorter than 50 ms, but in the ball park, results in no "loud" errors, but nothing is displayed. 100 ms is used since double the minimum should guarantee enough delay for the device to finish whatever reset processing seems necessary, while also providing a safe buffer incase the experimental measurement was somehow not accurate enough for everyone. Signed-off-by: Jeffrey Hugo --- drivers/gpu/drm/panel/panel-truly-nt35597.c | 149 +++++++++++++++----- 1 file changed, 112 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c index 77e1311b7c69..5ee76acb8f49 100644 --- a/drivers/gpu/drm/panel/panel-truly-nt35597.c +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c @@ -49,6 +49,8 @@ struct nt35597_config { const struct cmd_set *panel_on_cmds; u32 num_on_cmds; const struct drm_display_mode *dm; + bool dual_dsi; /* true if panel uses two dsi connections */ + bool cmd_type; /* true if panel is command mode type, not video mode */ }; struct truly_nt35597 { @@ -63,6 +65,7 @@ struct truly_nt35597 { struct backlight_device *backlight; struct mipi_dsi_device *dsi[2]; + int num_dsi; const struct nt35597_config *config; bool prepared; @@ -223,12 +226,42 @@ static const struct cmd_set qcom_2k_panel_magic_cmds[] = { { { 0xFB, 0x01 }, 2 }, }; +static const struct cmd_set qcom_wqhd_cmd_dsc_panel_magic_cmds[] = { + { { 0xff, 0x10 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0xba, 0x03 }, 2 }, + { { 0xe5, 0x01 }, 2 }, + { { 0xb0, 0x03 }, 2 }, + { { 0xff, 0x28 }, 2 }, + { { 0x7a, 0x02 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0xff, 0x10 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0xc0, 0x03 }, 2 }, + { { 0xbb, 0x10 }, 2 }, + { { 0xff, 0xe0 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0x6b, 0x3d }, 2 }, + { { 0x6c, 0x3d }, 2 }, + { { 0x6d, 0x3d }, 2 }, + { { 0x6e, 0x3d }, 2 }, + { { 0x6f, 0x3d }, 2 }, + { { 0x35, 0x02 }, 2 }, + { { 0x36, 0x72 }, 2 }, + { { 0x37, 0x10 }, 2 }, + { { 0x08, 0xc0 }, 2 }, + { { 0xff, 0x24 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0xc6, 0x06 }, 2 }, + { { 0xff, 0x10 }, 2 }, +}; + static int truly_dcs_write(struct drm_panel *panel, u32 command) { struct truly_nt35597 *ctx = panel_to_ctx(panel); - int i, ret; + int i, ret = 0; - for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { + for (i = 0; i < ctx->num_dsi; i++) { ret = mipi_dsi_dcs_write(ctx->dsi[i], command, NULL, 0); if (ret < 0) { DRM_DEV_ERROR(ctx->dev, @@ -247,7 +280,7 @@ static int truly_dcs_write_buf(struct drm_panel *panel, int ret = 0; int i; - for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { + for (i = 0; i < ctx->num_dsi; i++) { ret = mipi_dsi_dcs_write_buffer(ctx->dsi[i], buf, size); if (ret < 0) { DRM_DEV_ERROR(ctx->dev, @@ -284,7 +317,7 @@ static int truly_35597_power_on(struct truly_nt35597 *ctx) gpiod_set_value(ctx->reset_gpio, 1); usleep_range(10000, 20000); gpiod_set_value(ctx->reset_gpio, 0); - usleep_range(10000, 20000); + msleep(100); return 0; } @@ -342,7 +375,8 @@ static int truly_nt35597_unprepare(struct drm_panel *panel) return 0; ctx->dsi[0]->mode_flags = 0; - ctx->dsi[1]->mode_flags = 0; + if (ctx->config->dual_dsi) + ctx->dsi[1]->mode_flags = 0; ret = truly_dcs_write(panel, MIPI_DCS_SET_DISPLAY_OFF); if (ret < 0) { @@ -384,10 +418,12 @@ static int truly_nt35597_prepare(struct drm_panel *panel) if (ret < 0) return ret; + config = ctx->config; + ctx->dsi[0]->mode_flags |= MIPI_DSI_MODE_LPM; - ctx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM; + if (config->dual_dsi) + ctx->dsi[1]->mode_flags |= MIPI_DSI_MODE_LPM; - config = ctx->config; panel_on_cmds = config->panel_on_cmds; num_cmds = config->num_on_cmds; @@ -515,8 +551,10 @@ static int truly_nt35597_panel_add(struct truly_nt35597 *ctx) return PTR_ERR(ctx->mode_gpio); } - /* dual port */ - gpiod_set_value(ctx->mode_gpio, 0); + if (config->dual_dsi) + gpiod_set_value(ctx->mode_gpio, 0); + else + gpiod_set_value(ctx->mode_gpio, 1); drm_panel_init(&ctx->panel); ctx->panel.dev = dev; @@ -541,6 +579,21 @@ static const struct drm_display_mode qcom_sdm845_mtp_2k_mode = { .flags = 0, }; +static const struct drm_display_mode qcom_msm8998_mtp_wqhd_mode = { + .name = "1440x2560", + .clock = 113447, + .hdisplay = 1440, + .hsync_start = 1440 + 154, + .hsync_end = 1440 + 154 + 32, + .htotal = 1440 + 154 + 32 + 68, + .vdisplay = 2560, + .vsync_start = 2560 + 8, + .vsync_end = 2560 + 8 + 1, + .vtotal = 2560 + 8 + 1 + 7, + .vrefresh = 60, + .flags = 0, +}; + static const struct nt35597_config nt35597_dir = { .width_mm = 74, .height_mm = 131, @@ -548,13 +601,24 @@ static const struct nt35597_config nt35597_dir = { .dm = &qcom_sdm845_mtp_2k_mode, .panel_on_cmds = qcom_2k_panel_magic_cmds, .num_on_cmds = ARRAY_SIZE(qcom_2k_panel_magic_cmds), + .dual_dsi = true, +}; + +static const struct nt35597_config msm8998_mtp = { + .width_mm = 74, + .height_mm = 131, + .panel_name = "qcom_msm8998_mtp_wqhd_panel", + .dm = &qcom_msm8998_mtp_wqhd_mode, + .panel_on_cmds = qcom_wqhd_cmd_dsc_panel_magic_cmds, + .num_on_cmds = ARRAY_SIZE(qcom_wqhd_cmd_dsc_panel_magic_cmds), + .cmd_type = true, }; static int truly_nt35597_probe(struct mipi_dsi_device *dsi) { struct device *dev = &dsi->dev; struct truly_nt35597 *ctx; - struct mipi_dsi_device *dsi1_device; + struct mipi_dsi_device *dsi1_device = NULL; struct device_node *dsi1; struct mipi_dsi_host *dsi1_host; struct mipi_dsi_device *dsi_dev; @@ -572,13 +636,6 @@ static int truly_nt35597_probe(struct mipi_dsi_device *dsi) if (!ctx) return -ENOMEM; - /* - * This device represents itself as one with two input ports which are - * fed by the output ports of the two DSI controllers . The DSI0 is - * the master controller and has most of the panel related info in its - * child node. - */ - ctx->config = of_device_get_match_data(dev); if (!ctx->config) { @@ -586,25 +643,36 @@ static int truly_nt35597_probe(struct mipi_dsi_device *dsi) return -ENODEV; } - dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1); - if (!dsi1) { - DRM_DEV_ERROR(dev, - "failed to get remote node for dsi1_device\n"); - return -ENODEV; - } + ctx->num_dsi = 1; + /* + * This device represents itself as one with two input ports which are + * fed by the output ports of the two DSI controllers . The DSI0 is + * the master controller and has most of the panel related info in its + * child node. + */ + if (ctx->config->dual_dsi) { + ctx->num_dsi = 2; - dsi1_host = of_find_mipi_dsi_host_by_node(dsi1); - of_node_put(dsi1); - if (!dsi1_host) { - DRM_DEV_ERROR(dev, "failed to find dsi host\n"); - return -EPROBE_DEFER; - } + dsi1 = of_graph_get_remote_node(dsi->dev.of_node, 1, -1); + if (!dsi1) { + DRM_DEV_ERROR(dev, + "failed to get remote node for dsi1_device\n"); + return -ENODEV; + } + + dsi1_host = of_find_mipi_dsi_host_by_node(dsi1); + of_node_put(dsi1); + if (!dsi1_host) { + DRM_DEV_ERROR(dev, "failed to find dsi host\n"); + return -EPROBE_DEFER; + } - /* register the second DSI device */ - dsi1_device = mipi_dsi_device_register_full(dsi1_host, &info); - if (IS_ERR(dsi1_device)) { - DRM_DEV_ERROR(dev, "failed to create dsi device\n"); - return PTR_ERR(dsi1_device); + /* register the second DSI device */ + dsi1_device = mipi_dsi_device_register_full(dsi1_host, &info); + if (IS_ERR(dsi1_device)) { + DRM_DEV_ERROR(dev, "failed to create dsi device\n"); + return PTR_ERR(dsi1_device); + } } mipi_dsi_set_drvdata(dsi, ctx); @@ -619,12 +687,14 @@ static int truly_nt35597_probe(struct mipi_dsi_device *dsi) goto err_panel_add; } - for (i = 0; i < ARRAY_SIZE(ctx->dsi); i++) { + for (i = 0; i < ctx->num_dsi; i++) { dsi_dev = ctx->dsi[i]; dsi_dev->lanes = 4; dsi_dev->format = MIPI_DSI_FMT_RGB888; - dsi_dev->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_LPM | + dsi_dev->mode_flags = MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS; + if (!ctx->config->cmd_type) + dsi_dev->mode_flags |= MIPI_DSI_MODE_VIDEO; ret = mipi_dsi_attach(dsi_dev); if (ret < 0) { DRM_DEV_ERROR(dev, @@ -638,7 +708,8 @@ static int truly_nt35597_probe(struct mipi_dsi_device *dsi) err_dsi_attach: drm_panel_remove(&ctx->panel); err_panel_add: - mipi_dsi_device_unregister(dsi1_device); + if (ctx->config->dual_dsi) + mipi_dsi_device_unregister(dsi1_device); return ret; } @@ -662,6 +733,10 @@ static const struct of_device_id truly_nt35597_of_match[] = { .compatible = "truly,nt35597-2K-display", .data = &nt35597_dir, }, + { + .compatible = "truly,nt35597-wqhd-cmd-dsc-display", + .data = &msm8998_mtp, + }, { } }; MODULE_DEVICE_TABLE(of, truly_nt35597_of_match);