public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/bridge: dw-hdmi-qp: fix multi-channel audio output
@ 2026-02-28 11:28 Christian Hewitt
  2026-03-03  4:21 ` Claude review: " Claude Code Review Bot
  2026-03-03  4:21 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Hewitt @ 2026-02-28 11:28 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Dmitry Baryshkov,
	Cristian Ciocaltea, Detlev Casanova, Douglas Anderson, Andy Yan,
	Sugar Zhang, Luca Ceresoli, Heiko Stuebner, dri-devel,
	linux-rockchip, linux-kernel

From: Jonas Karlman <jonas@kwiboo.se>

Channel Allocation (PB4) and Level Shift Information (PB5) are
configured with values from PB1 and PB2 due to the wrong offset
being used. This results in missing audio channels or incorrect
speaker placement when playing multi-channel audio.

Use the correct offset to fix multi-channel audio output.

Fixes: fd0141d1a8a2 ("drm/bridge: synopsys: Add audio support for dw-hdmi-qp")
Reported-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
Changes in v2:
- Add my SoB as requested in v1 [0]
- Add Cristians review
[0] https://patchwork.kernel.org/project/dri-devel/patch/20251206072718.2039874-1-christianshewitt@gmail.com/

 drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
index ab7fed6214e0..facfb7526928 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@@ -848,7 +848,7 @@ static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi,
 
 	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS0, &header_bytes, 1);
 	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1);
-	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1);
+	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[7], 1);
 
 	/* Enable ACR, AUDI, AMD */
 	dw_hdmi_qp_mod(hdmi,
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Claude review: drm/bridge: dw-hdmi-qp: fix multi-channel audio output
  2026-02-28 11:28 [PATCH v2] drm/bridge: dw-hdmi-qp: fix multi-channel audio output Christian Hewitt
@ 2026-03-03  4:21 ` Claude Code Review Bot
  2026-03-03  4:21 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-03  4:21 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/bridge: dw-hdmi-qp: fix multi-channel audio output
Author: Christian Hewitt <christianshewitt@gmail.com>
Patches: 1
Reviewed: 2026-03-03T14:21:01.926357

---

This is a single patch (v2) that fixes an off-by-3 buffer offset error when writing the HDMI Audio InfoFrame in the `dw-hdmi-qp` bridge driver. The fix is **correct and straightforward**. The commit message is clear, has proper tags (Fixes, Reported-by, Signed-off-by, Reviewed-by), and the change is minimal and targeted.

**Note on applicability to drm-next:** The patch targets the older version of `dw_hdmi_qp_config_audio_infoframe()` which used three individual `regmap_bulk_write()` calls. In the current drm-next tree, this function has been refactored to `dw_hdmi_qp_bridge_write_audio_infoframe()` and now uses the generic `dw_hdmi_qp_write_infoframe()` helper, which iterates over the entire buffer with correct offsets. This means **the bug has already been fixed in drm-next as a side effect of the refactoring**. However, the patch is still valuable for stable backports to kernels that have the original code (commit `fd0141d1a8a2`).

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Claude review: drm/bridge: dw-hdmi-qp: fix multi-channel audio output
  2026-02-28 11:28 [PATCH v2] drm/bridge: dw-hdmi-qp: fix multi-channel audio output Christian Hewitt
  2026-03-03  4:21 ` Claude review: " Claude Code Review Bot
@ 2026-03-03  4:21 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-03  4:21 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**The bug:** The HDMI Audio InfoFrame buffer layout is:
- `buffer[0..2]` = Header bytes (HB0, HB1, HB2)
- `buffer[3]` = PB0 (Checksum)
- `buffer[4]` = PB1, `buffer[5]` = PB2, `buffer[6]` = PB3
- `buffer[7]` = PB4 (Channel Allocation), `buffer[8]` = PB5 (Level Shift), ...

The registers pack these as:
- `PKT_AUDI_CONTENTS0` (0xc20): `{ RSV, HB2, HB1, RSV }`
- `PKT_AUDI_CONTENTS1` (0xc24): `{ PB3, PB2, PB1, PB0 }`
- `PKT_AUDI_CONTENTS2` (0xc28): `{ PB7, PB6, PB5, PB4 }`

The old code:
```c
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1);
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1);  // BUG
```

`&buffer[4]` points to PB1, but `CONTENTS2` expects `{PB7, PB6, PB5, PB4}` which starts at `buffer[7]`. This caused PB4 (Channel Allocation) to receive the value of PB1 (Coding Type / Channel Count), and PB5 (Level Shift) to receive the value of PB2 (Sample Frequency / Sample Size), explaining the reported missing audio channels and incorrect speaker placement.

**The fix:**
```c
-	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1);
+	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[7], 1);
```

Changing to `&buffer[7]` correctly points to PB4, so `CONTENTS2` gets `{PB7, PB6, PB5, PB4}` as intended.

**Verdict:** The fix is correct. The offset arithmetic checks out: CONTENTS1 writes 4 bytes starting at buffer[3] (PB0-PB3), and CONTENTS2 should write the next 4 bytes starting at buffer[7] (PB4-PB7). The gap of 4 between 3 and 7 matches the 4-byte register width. The Fixes tag references the correct commit that introduced the bug.

**One observation for the maintainers:** Since this code has already been refactored in drm-next (replaced with the `dw_hdmi_qp_write_infoframe()` generic helper that handles the offset arithmetic in a loop), this patch is primarily relevant as a stable backport candidate. It may be worth adding a `Cc: stable@vger.kernel.org` tag if one isn't already implied by the Fixes tag, depending on the tree's workflow.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-03  4:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28 11:28 [PATCH v2] drm/bridge: dw-hdmi-qp: fix multi-channel audio output Christian Hewitt
2026-03-03  4:21 ` Claude review: " Claude Code Review Bot
2026-03-03  4:21 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox