Re: [RFC PATCH 3/4] drm/tilcdc: Implement state readout support

From: Màxim Pedraza Padilla

Date: Tue Nov 24 2026 - 09:11:41 EST


On Wed, Nov 18, 2026 at 10:21:14PM +0100, Màxim Pedraza Padilla wrote:
> Makes sense, I'll use the same approach in tilcdc, and see if it can be
> turned into a common helper along the way.

A follow-up on this one, now that I've rebased on v9. I ended up doing
it differently, so I'd rather explain why before sending the next
version.

The tidss approach rounds the clock to the closest standard refresh rate.
Panels driven by tilcdc often don't use one: with the timings from its
datasheet, the panel on this board runs at 56.8 Hz (33.3 MHz), which would
be read back as 60 Hz and 35.19 MHz. The adopted mode would then never
match the panel mode, even with U-Boot programming exactly the same one.

So the readout keeps the actual rate (rounded to the nearest kHz), and
tilcdc's CRTC compare hook accepts a 1% difference on the pixel clock
before calling drm_atomic_helper_crtc_compare_state(). That's what the
leeway is needed for: tilcdc_crtc_set_clk() only gets as close as the
clock tree allows. I checked it with modesets at 20 pixel clocks between
16.9 and 45 MHz: the PLL misses some of them by up to 0.015%, which the
exact comparison reported as mismatches, and they all pass now.

Testing on v9 also found a bug in my readout: re-enabling the CRTC
(ACTIVE=0 then 1) with the adopted framebuffer crashed in set_scanout(),
since it has no GEM object. It now keeps the DMA address the bootloader
programmed.

The rest of the comments are addressed as discussed: the format follows
blue-and-red-wiring, the panel describes its polarity in the DT, and the
initial state comes from your no-more-config-reset patch. With v9 all the
comparison warnings I reported are gone.

I'll send the next version on top of v9 and that patch.

Thanks,
Màxim