Skip to content

drm/panel: waveshare: Add automatic panel recognition for DSI panels - #7553

Open
EngineerWill wants to merge 2 commits into
raspberrypi:rpi-6.18.yfrom
waveshareteam:waveshare-dsi
Open

drm/panel: waveshare: Add automatic panel recognition for DSI panels#7553
EngineerWill wants to merge 2 commits into
raspberrypi:rpi-6.18.yfrom
waveshareteam:waveshare-dsi

Conversation

@EngineerWill

Copy link
Copy Markdown

Add automatic panel recognition support for Waveshare DSI displays,targeting panels such as the 10.1inch DSI LCD (E) that identify themselves at runtime via I2C control registers.

Driver changes (drivers/gpu/drm/panel/panel-waveshare-dsi.c)

  • New ws_panel_i2c_read() helper and ws_panel_auto_detect() function which read screen type, rotation and refresh rate from registers 0xd0/0xd1/0xd3.
  • Selects the matching display mode from 1200x1920 and 1920x1200 configurations at both 30fps (2 DSI lanes) and 60fps (4 DSI lanes).
  • New waveshare,automatic-recognition-panel compatible entry.
  • The detected lane count is applied to the DSI host; a power-off write to register 0xd2 (0x5a) is issued on shutdown.

Overlay changes (vc4-kms-dsi-waveshare-panel)

  • New auto_rec overlay parameter selecting the automatic recognition panel, documented in the overlays README.

@EngineerWill EngineerWill changed the title drm/panel: waveshare: Add automatic panel recognition for DSI panels- #3 drm/panel: waveshare: Add automatic panel recognition for DSI panels Aug 13, 2026

@6by9 6by9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Signed-off-by: Engineer_Will <646689853@qq.com>
This doesn't fulfill the requirement for the kernel certificate of origin - https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
Seeing as there is no desire from Raspberry Pi to upstream this driver then I partly don't care.

"Auto detection" would be the more common name for this rather than "auto recognition".

Seeing as this is only used by Waveshare devices and all support will be from them, I'd be prepared to merge as it is.
Defer for 48 hours so updates can be made if they desire, otherwise merge.

/*
* automatic recognition panel
*/
if (of_device_is_compatible(dev->of_node, "waveshare,automatic-recognition-panel")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could simplify this to if (!_ws_panel_data->mode)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, simplified to if (!_ws_panel_data->mode) as suggested.

{
struct ws_panel *ts = i2c_get_clientdata(i2c);

ws_panel_i2c_write(ts, 0xd2, 0x5a);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems odd as nothing else ever writes register 0xd2.

Note that shutdown is not called on remove. Should the device get unbound and rebound, then it won't get this write (whatever it does).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

  • The write to register 0xd2 (0x5a) resets the device so that configuration changes take effect.
  • Extracted it into a dedicated ws_panel_reset() helper, and it is now called from both ws_panel_remove() and
    ws_panel_shutdown(), so the reset also happens on unbind/rebind, not just at system shutdown.

Add support for Waveshare automatic detection DSI panels which
identify themselves at runtime via I2C registers. The driver reads
screen type, rotation and refresh rate from registers 0xd0-0xd3
to select the appropriate display mode and DSI lane configuration.

Supported configurations include 1200x1920 and 1920x1200 panels
at both 30fps (2 lanes) and 60fps (4 lanes) refresh rates.

Signed-off-by: Goodwill <646689853@qq.com>
Add the auto_detect overlay parameter to select the automatic detection
panel compatible string (waveshare,automatic-detection-panel). This
enables runtime panel detection via I2C for Waveshare DSI displays
that support automatic identification.

Signed-off-by: Goodwill <646689853@qq.com>
@EngineerWill

Copy link
Copy Markdown
Author

Signed-off-by: Engineer_Will <646689853@qq.com> This doesn't fulfill the requirement for the kernel certificate of origin - https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin Seeing as there is no desire from Raspberry Pi to upstream this driver then I partly don't care.

"Auto detection" would be the more common name for this rather than "auto recognition".

Seeing as this is only used by Waveshare devices and all support will be from them, I'd be prepared to merge as it is. Defer for 48 hours so updates can be made if they desire, otherwise merge.

Thanks for the review.
Regarding the sign-off: both the commit author and Signed-off-by are now Goodwill 646689853@qq.com, satisfying the DCO requirement.
Regarding the naming: renamed to "auto detection" throughout — the compatible string is now waveshare,automatic-detection-panel and the overlay parameter is now auto_detect

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.

2 participants