From patchwork Fri Jun 28 12:44:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhaoxiong Lv X-Patchwork-Id: 13716080 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 7004AC3064D for ; Fri, 28 Jun 2024 12:45:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 757C910EC2A; Fri, 28 Jun 2024 12:45:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=huaqin-corp-partner-google-com.20230601.gappssmtp.com header.i=@huaqin-corp-partner-google-com.20230601.gappssmtp.com header.b="zrn1fT4S"; dkim-atps=neutral Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94E6C10EC2E for ; Fri, 28 Jun 2024 12:45:03 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f9fb3ca81bso3339365ad.3 for ; Fri, 28 Jun 2024 05:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=huaqin-corp-partner-google-com.20230601.gappssmtp.com; s=20230601; t=1719578703; x=1720183503; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OeseQiv7/DSaLni1dvL6OOnrfuUA5o+HEQL8eICjloc=; b=zrn1fT4SqwHfx7leSQgGKewusrvIL6ME1c0FB+ttjekGzqUTIJy/tc+Y+SaHBAE4OV yKT5MQsnfn5DSXbEa0vHGDFW2gshcPG4Oh7RuXmAFGrrrLAZYreow0OzU6WD7JrpIvyh qTv1IdffkHL8LhCdV9ti8Ikx/OBidSnGhPMKN/apxofjIK38JtQVVKGI3V+uIoJUfG4w wp42SQe1Kvng5QM5HeyMx57p2xsfRADGx1jOzEd6/khLNNj6jeo9C04rXRBNrdvfNDGM 1p4WBVA8Del497Al1Ix+iynuu4iWlfKdS9FkPCBmnF1j4wXFC5WSK4p970ovRodF4ufr /TRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719578703; x=1720183503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OeseQiv7/DSaLni1dvL6OOnrfuUA5o+HEQL8eICjloc=; b=XUA8/dVQ9TubxcHyZWLz8ccKM+bL5Pi5DzQSGO9uhHRN6LJpfWLDTGZ0nw4yxovtNI VHknrSuanLuxJXBs249Byna4kCdn/T6oUC1tPnN+OqIQ6WvRZG+jE2v0WYq2WGZS5Pqo dvAfd54VwSCUS30uHnzJ56F5XhrklsNiz8gpFPOhi/UZXVH0npMoBfI742sbHCtDRea/ MXhi/3t33wUxWc62rocZ3nQoxhuzuwnVJ4Nd1oQGc7fzaVT6l0Y0eOATc14PQMlhjnvY kHvnDbU80hOOviVQDvE5HTl0j8uBIiZ7rz+VSpZM5MXRnD+zNeOIg0DDZsubL3ydTaWD r5MA== X-Gm-Message-State: AOJu0Yw7/tIp1Oq6OMg320x0ykfCzlp8VHx1/U43RxbgwIDBwOiQbiQZ 1r9D/eFK+Za+mrg49Fm9sGZqrm02WCQhM6+01LG3odc95gRjFQ9rEuvWUnhyOjM= X-Google-Smtp-Source: AGHT+IGWadE2l1MOGIvcH+qhTXfxLERu8D+lorl26DB268SY32VCtG8S/9RsP0BCd2bpECNPNyPGVw== X-Received: by 2002:a17:902:dac6:b0:1f9:d279:a870 with SMTP id d9443c01a7336-1fa23fb2949mr156225565ad.25.1719578702961; Fri, 28 Jun 2024 05:45:02 -0700 (PDT) Received: from lvzhaoxiong-KLVC-WXX9.huaqin.com ([116.66.212.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac15695b4sm14346255ad.225.2024.06.28.05.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 05:45:02 -0700 (PDT) From: Zhaoxiong Lv To: dmitry.torokhov@gmail.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jikos@kernel.org, benjamin.tissoires@redhat.co, dianders@google.com, hsinyi@google.com, jagan@edgeble.ai, neil.armstrong@linaro.org, quic_jesszhan@quicinc.com, dmitry.baryshkov@linaro.org Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zhaoxiong Lv Subject: [PATCH v6 1/5] drm/panel: jd9365da: Modify the method of sending commands Date: Fri, 28 Jun 2024 20:44:40 +0800 Message-Id: <20240628124444.28152-2-lvzhaoxiong@huaqin.corp-partner.google.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240628124444.28152-1-lvzhaoxiong@huaqin.corp-partner.google.com> References: <20240628124444.28152-1-lvzhaoxiong@huaqin.corp-partner.google.com> 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently, the init_code of the jd9365da driver is placed in the enable() function and sent, but this seems to take a long time. It takes 17ms to send each instruction (an init code consists of about 200 instructions), so it takes about 3.5s to send the init_code. So we moved the sending of the inti_code to the prepare() function, and each instruction seemed to take only 25μs. We checked the DSI host and found that the difference in command sending time is caused by the different modes of the DSI host in prepare() and enable() functions. Our DSI Host only supports sending cmd in LP mode, The prepare() function can directly send init_code (LP->cmd) in LP mode, but the enable() function is in HS mode and needs to switch to LP mode before sending init code (HS->LP->cmd->HS). Therefore, it takes longer to send the command. Signed-off-by: Zhaoxiong Lv Reviewed-by: Douglas Anderson --- Changes between V6 and V5: - 1. No changes. V5:https://lore.kernel.org/all/20240624141926.5250-2-lvzhaoxiong@huaqin.corp-partner.google.com/ Changes between V5 and V4: - 1. No changes. V4:https://lore.kernel.org/all/20240620080509.18504-2-lvzhaoxiong@huaqin.corp-partner.google.com/ Changes between V4 and V3: - 1. Only move mipi_dsi_dcs_write_buffer from enable() function to prepare() function, - and no longer use mipi_dsi_dcs_write_seq_multi. V3:https://lore.kernel.org/all/20240614145510.22965-2-lvzhaoxiong@huaqin.corp-partner.google.com/ --- .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c index 4879835fe101..a9c483a7b3fa 100644 --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c @@ -52,21 +52,9 @@ static int jadard_enable(struct drm_panel *panel) { struct device *dev = panel->dev; struct jadard *jadard = panel_to_jadard(panel); - const struct jadard_panel_desc *desc = jadard->desc; struct mipi_dsi_device *dsi = jadard->dsi; - unsigned int i; int err; - msleep(10); - - for (i = 0; i < desc->num_init_cmds; i++) { - const struct jadard_init_cmd *cmd = &desc->init_cmds[i]; - - err = mipi_dsi_dcs_write_buffer(dsi, cmd->data, JD9365DA_INIT_CMD_LEN); - if (err < 0) - return err; - } - msleep(120); err = mipi_dsi_dcs_exit_sleep_mode(dsi); @@ -100,6 +88,8 @@ static int jadard_disable(struct drm_panel *panel) static int jadard_prepare(struct drm_panel *panel) { struct jadard *jadard = panel_to_jadard(panel); + const struct jadard_panel_desc *desc = jadard->desc; + unsigned int i; int ret; ret = regulator_enable(jadard->vccio); @@ -117,7 +107,15 @@ static int jadard_prepare(struct drm_panel *panel) msleep(10); gpiod_set_value(jadard->reset, 1); - msleep(120); + msleep(130); + + for (i = 0; i < desc->num_init_cmds; i++) { + const struct jadard_init_cmd *cmd = &desc->init_cmds[i]; + + ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, JD9365DA_INIT_CMD_LEN); + if (ret < 0) + return ret; + } return 0; }