From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795028835; b=ESarR6bSL8Bt8IHpVHXOV9dwDVNu/8eNyk5ze3FB0xUc63oitAK1umjBoqFCBwHcTs8k +bW3OPXesKGhIGEP1C24bS24UB0EXOGXJVN7NQEEErBG93LTKvi2N63drTSagvwBS+jaS FjsoYNRuK+OPpDbqXYTm8hM/vQf0ulxB/99Hx7JHn0vm8QnEEKM2dzvsKLdi0OqoCwPpI kRVzRjpnW/MHE5x7SVLggUDjl3Vc58jtppPLgwYbMxmqq9I8RyoOmU5gvVqaskLPYTt9o ggZVLRuZT3LNXbyTq0Ww9AnAwYl/AlBS4mJC+ROqFefqU/L/nIleZp2qx0I8jeGRbww== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795028835; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Xosh4Gep63Ndi5OBHngx/cAe6FHJ6qxQIEn4vQN3eXo=; b=wr8C0PPTYKK5deUTa/kgs4GKqZuHIwGokBjVrvYViRMpCTUbWDDXSfznbzsb+Su96W+s o/lqRIXZfnQ2R1tlIXgj1jasodNRkoR/QUOF5db92hW8hNLHt4jThWKbbyQrwz9h9UDfh JnjEi8hdIeapkBagORVRoCEF2o6UIbaq50JXjGBtxRT4vxy7U7ZjdbpAkLlUmss5b4R/C prEpAEywoAv059muCJGFPMg5Z8HpVczwPSjaVBgJ0m3XzssAZsM5UcsXHoCc0CIdC3y2E vTfAsAyhktQeDlyENk8RXuXV7qo6VOI2CkikqWDhks8aP0pJ1COFFAXdy/fXaYchoqw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nnJkBjpg; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A64A606A337; Wed, 18 Nov 2026 19:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nnJkBjpg Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF0791F000C4; Wed, 18 Nov 2026 19:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795028835; bh=Xosh4Gep63Ndi5OBHngx/cAe6FHJ6qxQIEn4vQN3eXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nnJkBjpgDgkoxHVr4etax31NXVmd6lnn4DvFJsjojw8cxphdr9IAbCmNwnVf813WX gi36UxW3lnCZx0rmg7zQhv0g2NICu1tr/XxHnBBU9/WhPvpduBFy9sS5qB39D+lDUU VEI9gf4Sk5lAL2fuf0AULiG9a4cjOnCU95PW4RX8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andreas Kemnade , Tomi Valkeinen , Sasha Levin Subject: [PATCH 6.12 0136/1756] drm/omap: dsi: avoid sending bta sync all the time in writes Date: Wed, 18 Nov 2026 15:37:43 +0100 Message-ID: <20261118150013.588592824@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150007.957976754@linuxfoundation.org> References: <20261118150007.957976754@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andreas Kemnade [ Upstream commit 20207f78382ff339f3a7f7c5db2c0219b157d32a ] Some chips need configuration commands to be sent first, before they can send data. TC358762 for example needs PPI_LPTXTIMECNT configured and PPI_STARTPPI set to 1 to be able to transmit anything. To be able to configure such chips, do not send bta sync during writes if no acks are requested. Instead just wait for the packet to be sent to avoid FIFO overflows. There might be more to do about acks, but there seem to be virtually no users of that flag. This came to light when fiddling with the Epson Moverio BT-200 display which consists of 2 TC358762 bridges with SPI funneled through to the unknown display chip. With that patch the bridge can be accessed, Reading back registers works, when the above-mentioned registers are set. In Command-Mode update, there was a nop sent, apparently the most relevant part was the bta sync to actually force low power mode. Video mode panel at OMAP4 (BT-200) and video mode at OMAP5 was tested. Fixes: e70965386353e ("drm/omap: dsi: simplify write function") Signed-off-by: Andreas Kemnade Link: https://patch.msgid.link/20260629-vm-upstr-v4-1-9f0c62d8808e@kemnade.info Link: https://patch.msgid.link/20260628-vm-upstr-v3-1-9e9add93378b@kemnade.info Link: https://patch.msgid.link/20260529-vm-upstr-v2-1-24c30671719f@kernel.org Link: https://lore.gitlab.freedesktop.org/drm-ai-reviews/review-patch1-20260529-vm-upstr-v2-1-24c30671719f@kernel.org/ Link: https://patch.msgid.link/20260528-vm-upstr-v1-1-fb93ef8cbe47@kernel.org Link: https://patch.msgid.link/20260804-vm-upstr-v6-1-1bf3748b2fa3@kemnade.info Signed-off-by: Tomi Valkeinen Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/dss/dsi.c | 63 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index b9b013ba80e2e..811c9a4fdec8e 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c @@ -58,9 +58,6 @@ static void dsi_uninit_dispc(struct dsi_data *dsi); static int dsi_vc_send_null(struct dsi_data *dsi, int vc, int channel); -static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi, int vc, - const struct mipi_dsi_msg *msg); - #ifdef DSI_PERF_MEASURE static bool dsi_perf; module_param(dsi_perf, bool, 0644); @@ -2189,28 +2186,45 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int vc, int channel) static int dsi_vc_write_common(struct omap_dss_device *dssdev, int vc, const struct mipi_dsi_msg *msg) { + DECLARE_COMPLETION_ONSTACK(completion); struct dsi_data *dsi = to_dsi_data(dssdev); + u32 err; int r; + /* wait for IRQ for packet transmission confirmation */ + r = dsi_register_isr_vc(dsi, vc, dsi_completion_handler, + &completion, DSI_VC_IRQ_PACKET_SENT); + if (r) + return r; + if (mipi_dsi_packet_format_is_short(msg->type)) r = dsi_vc_send_short(dsi, vc, msg); else r = dsi_vc_send_long(dsi, vc, msg); - if (r < 0) + if ((!r) && wait_for_completion_timeout(&completion, + msecs_to_jiffies(500)) == 0) + r = -EIO; + + dsi_unregister_isr_vc(dsi, vc, dsi_completion_handler, + &completion, DSI_VC_IRQ_PACKET_SENT); + if (r) return r; - /* - * TODO: we do not always have to do the BTA sync, for example - * we can improve performance by setting the update window - * information without sending BTA sync between the commands. - * In that case we can return early. - */ + /* TODO: find out if more needs to be done for MIPI_DSI_MSG_REQ_ACK */ - r = dsi_vc_send_bta_sync(dssdev, vc); - if (r) { - DSSERR("bta sync failed\n"); - return r; + if (msg->flags & MIPI_DSI_MSG_REQ_ACK) { + r = dsi_vc_send_bta_sync(dssdev, vc); + if (r) { + DSSERR("bta sync failed\n"); + return r; + } + } else { + err = dsi_get_errors(dsi); + if (err) { + DSSERR("Error while sending: %x\n", err); + return -EIO; + } } /* RX_FIFO_NOT_EMPTY */ @@ -3228,21 +3242,6 @@ static int _dsi_update(struct dsi_data *dsi) return 0; } -static int _dsi_send_nop(struct dsi_data *dsi, int vc, int channel) -{ - const u8 payload[] = { MIPI_DCS_NOP }; - const struct mipi_dsi_msg msg = { - .channel = channel, - .type = MIPI_DSI_DCS_SHORT_WRITE, - .tx_len = 1, - .tx_buf = payload, - }; - - WARN_ON(!dsi_bus_is_locked(dsi)); - - return _omap_dsi_host_transfer(dsi, vc, &msg); -} - static int dsi_update_channel(struct omap_dss_device *dssdev, int vc) { struct dsi_data *dsi = to_dsi_data(dssdev); @@ -3263,13 +3262,13 @@ static int dsi_update_channel(struct omap_dss_device *dssdev, int vc) DSSDBG("dsi_update_channel: %d", vc); /* - * Send NOP between the frames. If we don't send something here, the + * Transition to LP here. If we don't send something here, the * updates stop working. This is probably related to DSI spec stating * that the DSI host should transition to LP at least once per frame. */ - r = _dsi_send_nop(dsi, VC_CMD, dsi->dsidev->channel); + r = dsi_vc_send_bta_sync(dssdev, VC_CMD); if (r < 0) { - DSSWARN("failed to send nop between frames: %d\n", r); + DSSWARN("failed to send bta sync between frames: %d\n", r); goto err; } -- 2.53.0