From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/bridge: tc358768: Add support for long command tx via video buffer Date: Thu, 12 Mar 2026 07:14:51 +1000 Message-ID: In-Reply-To: <20260311-tc358768-v2-7-e75a99131bd5@ideasonboard.com> References: <20260311-tc358768-v2-0-e75a99131bd5@ideasonboard.com> <20260311-tc358768-v2-7-e75a99131bd5@ideasonboard.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review The main feature patch. Key observations: 1. **Guard against video-active state**: The check `if (confctl & BIT(6))` correctly tests `PP_en` to ensure long commands aren't sent while video is active. Good defensive check. 2. **Boundary condition for tx_len**: The check `msg->tx_len > 1024` correctly limits the maximum payload. Note however that `msg->tx_len` includes the header, but `packet.payload_length` is what actually gets written to the video buffer. The 1024-byte limit check against `msg->tx_len` is slightly conservative (by the header size) but this is safe and fine in practice. 3. **Sleep estimation**: The sleep calculation `packet.payload_length * 2` microseconds (2us per byte for LP mode) is described as a "safe estimate." For very small packets just over 8 bytes (e.g., 9 bytes), this gives ~18us which should be adequate. For maximum 1024-byte payloads, this gives ~2ms. The `usleep_range(tx_sleep_us, tx_sleep_us * 2)` pattern is proper kernel style. 4. **RstPtr release**: Line 814 releases RstPtr (BIT(14) of PP_MISC) early in `pre_enable()` so the video buffer can be used for DSI commands. In `enable()`, line 1217 clears both FrmStop and RstPtr (`0x3 << 14`), which is fine since RstPtr is already 0 at that point. The lifecycle is coherent. 5. **Missing poll for completion**: The comment says "The TC358768 spec says to wait until the transmission has been finished" but the implementation uses a time-based estimate rather than polling a status register. The cover letter acknowledges this approach. While polling would be more robust, the simple estimate with generous margins is pragmatic and has been tested working on hardware. 6. **DATAFMT register**: For long commands, `TC358768_DATAFMT` is set to `BIT(0)` (txdt_en only), which differs from the video mode setting that also includes `BIT(1) | BIT(2)` (dsitx_en, rdswap_en) and the format-specific bits. This is correct per the datasheet for command-mode buffer transmission. Overall, a clean and well-organized series. No blocking issues found. --- Generated by Claude Code Patch Reviewer