public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: staging: media: tegra-video: add CSI support for Tegra20 and Tegra30
Date: Wed, 04 Mar 2026 07:48:09 +1000	[thread overview]
Message-ID: <review-patch15-20260303084239.15007-16-clamor95@gmail.com> (raw)
In-Reply-To: <20260303084239.15007-16-clamor95@gmail.com>

Patch Review

This is the largest patch (~620 lines added to tegra20.c). It adds CSI streaming, MIPI calibration ops, the frame capture refactoring, and Tegra20/30 CSI soc data.

**Bug: `release_buffer` always called with `VB2_BUF_STATE_DONE` even on error:**

```c
exit:
	release_buffer(chan, buf, VB2_BUF_STATE_DONE);
	return err;
```

When `err` is non-zero (syncpoint timeout), the buffer should be released with `VB2_BUF_STATE_ERROR`, not `VB2_BUF_STATE_DONE`. The old code in the pre-patch version correctly used `VB2_BUF_STATE_ERROR`. This will cause corrupted/incomplete frames to be delivered to userspace as if they were valid. The fix should be:

```c
exit:
	release_buffer(chan, buf, err ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
```

**Bug: wrong register written in `tegra20_finish_pad_calibration` exit path:**

```c
pp = tegra20_mipi_read(csi, TEGRA_CSI_CSI_PIXEL_PARSER_STATUS);
cil = tegra20_mipi_read(csi, TEGRA_CSI_CSI_CIL_STATUS);
if (pp | cil) {
    ...
    ret = -EINVAL;
    goto exit;
}

exit:
	tegra20_mipi_write(csi, TEGRA_CSI_CSI_CIL_STATUS, pp);
```

On the error path, `pp` (pixel parser status) is written to `TEGRA_CSI_CSI_CIL_STATUS`. These are W1C (write-1-to-clear) status registers. Writing PP status bits to the CIL status register is incorrect - it should be `cil`, or both registers should be cleared independently:

```c
exit:
	tegra20_mipi_write(csi, TEGRA_CSI_CSI_PIXEL_PARSER_STATUS, pp);
	tegra20_mipi_write(csi, TEGRA_CSI_CSI_CIL_STATUS, cil);
```

**Minor: `tegra20_vi_read`, `tegra20_csi_read`, `tegra20_mipi_read` return `int` instead of `u32`:**

```c
static int __maybe_unused tegra20_vi_read(...)
{
	return readl(chan->vi->iomem + addr);
}
```

`readl()` returns `u32`. Returning `int` can cause sign-extension issues for values with bit 31 set. These should return `u32`.

**Minor: `tegra20_csi_clks` with NULL entry:**

```c
static const char * const tegra20_csi_clks[] = {
	NULL,
};
```

`ARRAY_SIZE` gives 1, so the driver will try to get one clock with name NULL via `devm_clk_bulk_get`. This will try to find the default/unnamed clock for the device. If the Tegra20 CSI DT node doesn't have a `clocks` property, probe will fail. If the intent is "no clocks needed", this should be an empty array or `num_clks` should be 0.

**ERESTARTSYS retry loop:** The `do { } while (err == -ERESTARTSYS)` pattern around `host1x_syncpt_wait` is acknowledged with a TODO comment as a workaround. This is acceptable for staging code, but the dead code check `if (err != -ERESTARTSYS)` after the loop can never be true since the loop only exits when `err != -ERESTARTSYS`.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-03 21:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03  8:42 [PATCH v7 00/15] tegra-video: add CSI support for Tegra20 and Tegra30 Svyatoslav Ryhel
2026-03-03  8:42 ` [PATCH v7 01/15] staging: media: tegra-video: expand VI and VIP support to Tegra30 Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 02/15] staging: media: tegra-video: vi: adjust get_selection operation check Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 03/15] staging: media: tegra-video: vi: add flip controls only if no source controls are provided Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 04/15] staging: media: tegra-video: csi: move CSI helpers to header Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 05/15] gpu: host1x: convert MIPI to use operation function pointers Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 06/15] staging: media: tegra-video: vi: improve logic of source requesting Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 07/15] staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to CSI Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 08/15] staging: media: tegra-video: tegra20: set correct maximum width and height Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 09/15] staging: media: tegra-video: tegra20: add support for second output of VI Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 10/15] staging: media: tegra-video: tegra20: adjust format align calculations Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 11/15] staging: media: tegra-video: tegra20: set VI HW revision Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 12/15] staging: media: tegra-video: tegra20: increase maximum VI clock frequency Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 13/15] staging: media: tegra-video: tegra20: expand format support with RAW8/10 and YUV422/YUV420p 1X16 Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 14/15] staging: media: tegra-video: tegra20: adjust luma buffer stride Svyatoslav Ryhel
2026-03-03 21:48   ` Claude review: " Claude Code Review Bot
2026-03-03  8:42 ` [PATCH v7 15/15] staging: media: tegra-video: add CSI support for Tegra20 and Tegra30 Svyatoslav Ryhel
2026-03-03 21:48   ` Claude Code Review Bot [this message]
2026-03-03 21:48 ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch15-20260303084239.15007-16-clamor95@gmail.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox