Skip to content

feat: Add Linux Kernel 7.0 support#84

Open
crazedev04 wants to merge 4 commits into
klogg:masterfrom
crazedev04:feat/kernel-7.0-support
Open

feat: Add Linux Kernel 7.0 support#84
crazedev04 wants to merge 4 commits into
klogg:masterfrom
crazedev04:feat/kernel-7.0-support

Conversation

@crazedev04
Copy link
Copy Markdown

Summary

Adds compatibility with Linux Kernel 7.0 (tested on Nobara/Fedora 43, kernel 7.0.1).

Changes

DRM Bridge (it66121_drv.c)

  • Migrate to devm_drm_bridge_alloc (required by K7.0 DRM subsystem)
  • Auto-detect FL2000 I2C adapter via bus name scan instead of hardcoded bus number
  • Force connector status to connected (HPD detection unreliable over USB)
  • Bypass EDID reading and inject standard CEA modes (VIC 16 for 1080p, VIC 4 for 720p)
  • Move INIT_DELAYED_WORK to probe and add NULL safety checks in remove

PLL Optimization (fl2000_drm.c)

  • Search ALL htotal adjustments and pick minimum ppm error instead of first match
  • Increase htotal search range from 10 to 20
  • Relax PLL tolerance to 3000 ppm to enable 1080p (achieves 213 ppm accuracy)

URB Fix (fl2000.h)

  • Fix false positive "Nonzero urb status" logging when status is actually 0

Testing

  • Tested with FL2000 USB 3.0 to HDMI adapter (1d5c:2000) on Kernel 7.0.1
  • Verified 1920x1080 at 60Hz output on Philips PHL 241V8 monitor
  • Framebuffer write test confirmed pixel streaming works

Add case 0 to fl2000_urb_status switch to prevent logging
successful URB completions as errors.
- Use devm_drm_bridge_alloc (required by K7.0 DRM subsystem)
- Auto-detect FL2000 I2C adapter via bus scan
- Force connector status to connected (HPD unreliable)
- Bypass EDID reading, inject standard CEA modes (VIC 16/4)
- Move INIT_DELAYED_WORK to probe, add NULL checks in remove
- Search ALL htotal adjustments and pick minimum ppm error
- Increase htotal search range from ±10 to ±20
- Relax PLL tolerance to 3000 ppm to enable 1080p
- Enables 1920x1080 output with ~213 ppm clock accuracy
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the IT66121 bridge driver and FL2000 DRM driver to use modern DRM helpers (SHMEM instead of DMA) and improves mode calculation. Key changes include hardcoding standard HDMI modes for the IT66121, implementing auto-detection for the I2C adapter, and refining the PLL optimization loop in the FL2000 driver to find the best match. However, a critical issue was identified in the IT66121 probe function where a potential NULL pointer dereference could occur if the I2C client is not found. Additionally, the loop logic for htotal adjustments in the FL2000 mode calculation is currently broken due to incorrect variable initialization, preventing the optimization from functioning as intended.

Comment thread bridge/it66121_drv.c Outdated
Comment on lines +817 to +820
if (IS_ERR(client)) {
pr_err("Cannot find IT66121 I2C client");
kfree(priv);
return ret;
return (int)PTR_ERR(client);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The check IS_ERR(client) is insufficient because it66121_i2c_init() calls i2c_new_scanned_device(), which returns NULL if no device is found on the bus. If client is NULL, IS_ERR will be false, and the code will proceed to call devm_drm_bridge_alloc() with &client->dev, leading to a NULL pointer dereference. Furthermore, PTR_ERR(NULL) is 0, which would cause the probe function to incorrectly return success even when the hardware is not found.

	if (IS_ERR_OR_NULL(client)) {
		pr_err("Cannot find IT66121 I2C client");
		return client ? (int)PTR_ERR(client) : -ENODEV;
	}

Comment thread fl2000_drm.c
Comment on lines +229 to +230
struct fl2000_pll candidate_pll = {};
u32 candidate_clock;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The loop logic for generating adjustments d is currently ineffective because s is initialized to 0 in the loop header (context line 228). This causes d to remain 0 for all iterations, meaning the PLL optimization only evaluates the original htotal. While the header itself is not modified in this hunk, the added logic for tracking the 'best' match depends on d varying across iterations. Please update the loop header to initialize s = 1 to correctly generate the alternating sequence (0, -1, 1, -2, 2, ...) described in the comments.

- Use IS_ERR_OR_NULL for I2C client check to prevent NULL dereference
- Fix htotal adjustment loop: s=0 caused d to remain 0 (s=1 needed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant