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

From: Tomi Valkeinen

Date: Wed Nov 25 2026 - 06:53:52 EST


Hi,

On 25/11/2026 12:15, Màxim Pedraza Padilla wrote:
On Tue, Nov 24, 2026 at 04:38:43PM +0200, Tomi Valkeinen wrote:
I felt that approach was a bit odd (and if I recall right, failed with
my OLDI panel), and in my tidss version I just used the clock rate
directly from the clk_get_rate() (see dispc_vp_readout_mode):

Thanks, good to know I'm not the only one it didn't work for. v2 does the
same: the functional clock rate divided by the LCDC divider, rounded to
the nearest kHz.

What I added is a 1% tolerance on the pixel clock in tilcdc's CRTC
compare hook. When tilcdc_crtc_set_clk() can't get the exact rate, the
clock read back after a commit differs from the mode by a few kHz: here,
asking for 16941 kHz gets 16940.69 kHz from the display PLL. Out of 20
pixel clocks between 16.9 and 45 MHz, four were off by up to 0.015% and
the exact comparison reported them as mismatches.

Since you know tilcdc: do you know why tilcdc_crtc_mode_fixup() flips the
HSYNC polarity? Its comment says the LCDC aligns VS on the second edge of
HS, but I couldn't find that in the AM335x TRM, where IHS directly sets
the polarity of the HSYNC pin. As it is, a panel needing an active low
HSYNC has to leave hsync-active out of its DT timings.
Sorry, I don't remember. It's been quite a while, and that part wasn't my code. The original commit says:

+ * We use adjusted_mode, to fixup sync by aligning both rising
+ * edges and add HSKEW offset to let the slave encoder fix it up.

which sounds like the encoder (I think at that time there was really just a single encoder used) supports hskew, so the encoder then adjusted the syncs horizontally, and also used the correct polarities. You could have a look at the old kernel sources.

If I had to guess, the hack helps on some particular panel/encoder. And breaks some other. If you remove the hack, you get it the other way around =).

Tomi