Claude review: drm/mediatek: Use dp_connector helpers to report link training state

Claude Code Review Bot
2026-04-12T00:51:26Z

Patch Review

**Bug -- `bridge.ops` overwrite:**
```c
mtk_dp->bridge.dp_link_train_caps = &dp_link_train_caps;
mtk_dp->bridge.ops = DRM_BRIDGE_OP_DP;

if (mtk_dp->bridge.type == DRM_MODE_CONNECTOR_eDP) {
...
} else {
mtk_dp->bridge.ops = DRM_BRIDGE_OP_DETECT |
DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD;
```
For the non-eDP (regular DP) case, the `else` branch overwrites `bridge.ops` to `DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD`, losing `DRM_BRIDGE_OP_DP`. The fix is to change the else branch to use `|=` or move the `DRM_BRIDGE_OP_DP` assignment after the conditional and use `|=`.

For the eDP case, `DRM_BRIDGE_OP_DP` would stick, but the eDP branch never calls `devm_drm_bridge_add()` directly (it's called from `mtk_dp_edp_link_panel`), and it lacks DETECT/EDID/HPD ops which may cause issues.

**Bug -- uninitialized `dp_link_train` in `mtk_dp_report_link_train()`:**
```c
struct drm_connector_dp_link_train dp_link_train;

dp_link_train.rate = drm_dp_bw_code_to_link_rate(mtk_dp->train_info.link_rate);
dp_link_train.nlanes = mtk_dp->train_info.lane_count;
```
`dsc_en` is never set, and remaining `v_swing[]`/`pre_emph[]` entries (for lanes beyond `lane_count`) are uninitialized. Should be `= {};`.

Note: the `dp_link_train_caps` struct doesn't set `.dsc = true`, so the `dsc_en` property won't be created, and the uninitialized `dsc_en` field in the report won't cause a NULL deref. But the struct should still be zero-initialized for correctness.

**Minor -- untested.** The author explicitly notes this patch is untested. Given the bugs above, it clearly needs testing before non-RFC submission.

---
Generated by Claude Code Patch Reviewer