Skip to content

drm/rp1/rp1_dpi: Move Composite Sync generation into the kernel#6826

Merged
njhollinghurst merged 1 commit intoraspberrypi:rpi-6.12.yfrom
njhollinghurst:rp1-dpi-csync-again
May 12, 2025
Merged

drm/rp1/rp1_dpi: Move Composite Sync generation into the kernel#6826
njhollinghurst merged 1 commit intoraspberrypi:rpi-6.12.yfrom
njhollinghurst:rp1-dpi-csync-again

Conversation

@njhollinghurst
Copy link
Copy Markdown
Contributor

Move RP1 DPI's PIO-assisted Composite Sync generation code, previously released as a separate utility, into the kernel driver. There are 3 variants for progressive, generic interlaced and TV- style interlaced CSync, alongside the existing VSync fixup.

Check that all of GPIOs 1-3 are mapped to DPI, so PIO won't try to snoop on a missing output, or override another device's pins.

Add "force-csync" as both an OF property and a module parameter, for convenience of testing, as few tools set DRM_MODE_FLAG_CSYNC.

Comment thread drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c Outdated
Copy link
Copy Markdown
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

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

I may go through the body of the patch later, but I think the initialisation stuff would be nicer if you invert the logic and have a bitmask of outstanding GPIOs, initialised to 0x7 (or 0xe if you prefer), clearing the bits as they are found.

Comment thread drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.c Outdated
@njhollinghurst njhollinghurst changed the title drm/rp1/rp1_dsi: Move Composite Sync generation into the kernel drm/rp1/rp1_dpi: Move Composite Sync generation into the kernel Apr 30, 2025
@njhollinghurst
Copy link
Copy Markdown
Contributor Author

njhollinghurst commented May 6, 2025

Any views about the OF property and module parameter "force-csync"?

DRM_MODE_FLAG_CSYNC is difficult to use. DRM TV mode helper code and command-line mode parser don't set it even for "PAL" and "NTSC" modes. panel-timings can't set it. Neither can utilities like kmstest. About the only reliable way it could be set would be a custom mode-list or dummy EDID. Although the EDID flag (and, I presume, the DRM one) defines it to mean CSync-on-HSync or CSync-on-Green (which doesn't map perfectly to RP1 hardware, or to VC4).

So an alternative mechanism to enable Composite Sync over DEN arguably needed. I'm not sure we need both OF and module properties? The former could be set by a dtparam. The latter could be changed at runtime.

@njhollinghurst njhollinghurst requested a review from 6by9 May 6, 2025 15:16
@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented May 6, 2025

I have no problem with the idea of the DT property (we're missing an implementation of the overlay parameter to set it), but if you are happy with csync being a system-wide setting then you could just make the override add the module parameter - any string assigned to the bootargs of /chosen is appended, e.g. from the audremap overlays:

	fragment@1 {
		target = <&chosen>;
		__overlay__  {
			bootargs = "snd_bcm2835.enable_headphones=1";
		};
	};

@njhollinghurst
Copy link
Copy Markdown
Contributor Author

Ah yes, I had forgotten that trick.
I think I'll leave them both in for now (as with "default_bus_fmt") but might yet remove the OF one.
I think this is just about ready to squash and de-Draft.

@njhollinghurst njhollinghurst force-pushed the rp1-dpi-csync-again branch from bd33559 to dc49b1f Compare May 7, 2025 10:27
Copy link
Copy Markdown
Contributor

@6by9 6by9 left a comment

Choose a reason for hiding this comment

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

I see nothing too untoward, although upstreaming those changes is going to be almost impossible. Happy to kick that one into the long grass though.

@njhollinghurst
Copy link
Copy Markdown
Contributor Author

I think I'll remove the OF property anyway, as in theory it would still need documenting.

And I don't propose to check in any overlay changes, so as not to raise issues of VC4 compatibility -- not now anyway!

Move RP1 DPI's PIO-assisted Composite Sync generation code,
previously released as a separate utility, into the kernel driver.
There are 3 variants for progressive, generic interlaced and TV-
style interlaced CSync, alongside the existing VSync fixup.

Check that all of GPIOs 1-3 are mapped to DPI, so PIO won't try
to snoop on a missing output, or override another device's pins.

Add "force_csync" module parameter, for convenience of testing,
as few tools can set DRM_MODE_FLAG_CSYNC.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
@njhollinghurst njhollinghurst force-pushed the rp1-dpi-csync-again branch from dc49b1f to c9822be Compare May 7, 2025 16:04
@njhollinghurst njhollinghurst marked this pull request as ready for review May 7, 2025 17:08
@njhollinghurst njhollinghurst merged commit 95ac2a0 into raspberrypi:rpi-6.12.y May 12, 2025
12 checks passed
@igorpecovnik
Copy link
Copy Markdown

K6.14.y compilation breaks with:

   drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c:599:5: error: conflicting types for 'rp1dpi_pio_start'; have 'int(struct rp1_dpi *, const struct drm_display_mode *)'
     599 | int rp1dpi_pio_start(struct rp1_dpi *dpi, const struct drm_display_mode *mode)
         |     ^~~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.c:28:
   drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi.h:93:5: note: previous declaration of 'rp1dpi_pio_start' with type 'int(struct rp1_dpi *, const struct drm_display_mode *, bool)' {aka 'int(struct rp1_dpi *, const struct drm_display_mode *, _Bool)'}
      93 | int rp1dpi_pio_start(struct rp1_dpi *dpi, const struct drm_display_mode *mode,
         |     ^~~~~~~~~~~~~~~~
     CC      net/ipv4/igmp.o
   make[8]: *** [scripts/Makefile.build:222: drivers/gpu/drm/rp1/rp1-dpi/rp1_dpi_pio.o] Error 1
   make[7]: *** [scripts/Makefile.build:472: drivers/gpu/drm/rp1/rp1-dpi] Error 2
   make[6]: *** [scripts/Makefile.build:472: drivers/gpu/drm/rp1] Error 2
   make[5]: *** [scripts/Makefile.build:472: drivers/gpu/drm] Error 2
   make[4]: *** [scripts/Makefile.build:472: drivers/gpu] Error 2

Full logs: https://paste.armbian.com/afuqupofuy

@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented May 13, 2025

You must have a config where CONFIG_RP1_DPI is enabled but not CONFIG_RP1_PIO. We'll patch it up.

@igorpecovnik
Copy link
Copy Markdown

You must have a config where CONFIG_RP1_DPI is enabled but not CONFIG_RP1_PIO. We'll patch it up.

Quite possible, will enable. Still this needs to be done different.

Thanks for prompt response!

@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented May 13, 2025

See #6851. It will be forward-ported to the newer kernels once it is merged to 6.12.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request May 14, 2025
kernel: arm64: dts: bcm2712-rpi: Add uart0_dma parameter
See: raspberrypi/linux#6838

kernel: configs: Enable SENSORS_POWERZ
See: raspberrypi/linux#6845

kernel: wifi: brcmfmac: Include modinfo for 43456 CLM blob
See: raspberrypi/linux#6843

kernel: nvme-pci: Re-enable NVME Host Memory Block (HMB) support
See: raspberrypi/linux#6844

kernel: pisound-micro: Added pin_pull and pin_b_pull sysfs attributes for Pisound Micro
See: raspberrypi/linux#6848

kernel: drm/rp1/rp1_dpi: Move Composite Sync generation into the kernel
See: raspberrypi/linux#6826

kernel: Fix up rp1_dpi_pio for CONFIG_RP1_PIO=n builds
See: raspberrypi/linux#6851
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request May 14, 2025
kernel: arm64: dts: bcm2712-rpi: Add uart0_dma parameter
See: raspberrypi/linux#6838

kernel: configs: Enable SENSORS_POWERZ
See: raspberrypi/linux#6845

kernel: wifi: brcmfmac: Include modinfo for 43456 CLM blob
See: raspberrypi/linux#6843

kernel: nvme-pci: Re-enable NVME Host Memory Block (HMB) support
See: raspberrypi/linux#6844

kernel: pisound-micro: Added pin_pull and pin_b_pull sysfs attributes for Pisound Micro
See: raspberrypi/linux#6848

kernel: drm/rp1/rp1_dpi: Move Composite Sync generation into the kernel
See: raspberrypi/linux#6826

kernel: Fix up rp1_dpi_pio for CONFIG_RP1_PIO=n builds
See: raspberrypi/linux#6851
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.

5 participants