linux/drivers/gpu/drm/meson
Martin Blumenstingl 1017560164 drm/meson: use unsigned long long / Hz for frequency types
Christian reports that 4K output using YUV420 encoding fails with the
following error:
  Fatal Error, invalid HDMI vclk freq 593406

Modetest shows the following:
  3840x2160 59.94 3840 4016 4104 4400 2160 2168 2178 2250 593407 flags: xxxx, xxxx,
  drm calculated value -------------------------------------^

This indicates that there's a (1kHz) mismatch between the clock
calculated by the drm framework and the meson driver.

Relevant function call stack:
(drm framework)
  -> meson_encoder_hdmi_atomic_enable()
    -> meson_encoder_hdmi_set_vclk()
      -> meson_vclk_setup()

The video clock requested by the drm framework is 593407kHz. This is
passed by meson_encoder_hdmi_atomic_enable() to
meson_encoder_hdmi_set_vclk() and the following formula is applied:
- the frequency is halved (which would be 296703.5kHz) and rounded down
  to the next full integer, which is 296703kHz
- TMDS clock is calculated (296703kHz * 10)
- video encoder clock is calculated - this needs to match a table from
  meson_vclk.c and so it doubles the previously halved value again
  (resulting in 593406kHz)
- meson_vclk_setup() can't find (either directly, or by deriving it from
  594000kHz * 1000 / 1001 and rounding to the closest integer value -
  which is 593407kHz as originally requested by the drm framework) a
  matching clock in it's internal table and errors out with "invalid
  HDMI vclk freq"

Fix the division precision by switching the whole meson driver to use
unsigned long long (64-bit) Hz values for clock frequencies instead of
unsigned int (32-bit) kHz to fix the rouding error.

Fixes: e5fab2ec9c ("drm/meson: vclk: add support for YUV420 setup")
Reported-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250421201300.778955-3-martin.blumenstingl@googlemail.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250421201300.778955-3-martin.blumenstingl@googlemail.com
2025-04-22 09:23:58 +02:00
..
Kconfig drm/meson: Allow build with COMPILE_TEST=y 2024-10-25 10:25:10 +03:00
Makefile drm/meson: add support for MIPI-DSI transceiver 2023-06-01 16:10:24 +02:00
meson_crtc.c
meson_crtc.h
meson_drv.c drm/meson: use unsigned long long / Hz for frequency types 2025-04-22 09:23:58 +02:00
meson_drv.h drm/meson: use unsigned long long / Hz for frequency types 2025-04-22 09:23:58 +02:00
meson_dw_hdmi.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
meson_dw_hdmi.h
meson_dw_mipi_dsi.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
meson_dw_mipi_dsi.h drm/meson: add support for MIPI-DSI transceiver 2023-06-01 16:10:24 +02:00
meson_encoder_cvbs.c drm/bridge: Pass full state to atomic_disable 2025-02-19 16:59:12 +01:00
meson_encoder_cvbs.h drm/meson: improve encoder probe / initialization error handling 2024-02-19 09:48:41 +01:00
meson_encoder_dsi.c drm/bridge: Pass full state to atomic_disable 2025-02-19 16:59:12 +01:00
meson_encoder_dsi.h drm/meson: improve encoder probe / initialization error handling 2024-02-19 09:48:41 +01:00
meson_encoder_hdmi.c drm/meson: use unsigned long long / Hz for frequency types 2025-04-22 09:23:58 +02:00
meson_encoder_hdmi.h drm/meson: improve encoder probe / initialization error handling 2024-02-19 09:48:41 +01:00
meson_osd_afbcd.c drm/meson: osd_afbcd: Add an exit callback to struct meson_afbcd_ops 2022-01-03 12:28:25 +01:00
meson_osd_afbcd.h drm/meson: osd_afbcd: Add an exit callback to struct meson_afbcd_ops 2022-01-03 12:28:25 +01:00
meson_overlay.c drm/gem: rename struct drm_gem_dma_object.{paddr => dma_addr} 2022-08-03 18:32:27 +02:00
meson_overlay.h
meson_plane.c drm/meson: plane: Add error handling 2024-06-06 10:27:44 +02:00
meson_plane.h
meson_rdma.c
meson_rdma.h
meson_registers.h drm/meson: venc: add ENCL encoder setup for MIPI-DSI output 2023-06-01 16:10:22 +02:00
meson_vclk.c drm/meson: use unsigned long long / Hz for frequency types 2025-04-22 09:23:58 +02:00
meson_vclk.h drm/meson: use unsigned long long / Hz for frequency types 2025-04-22 09:23:58 +02:00
meson_venc.c drm/meson: venc: include linux/bitfield.h 2023-06-02 15:47:52 +02:00
meson_venc.h drm/meson: venc: add ENCL encoder setup for MIPI-DSI output 2023-06-01 16:10:22 +02:00
meson_viu.c drm/meson: Reduce the FIFO lines held when AFBC is not used 2023-01-02 10:58:50 +01:00
meson_viu.h
meson_vpp.c drm/meson: fix 1px pink line on GXM when scaling video overlay 2023-03-06 09:42:01 +01:00
meson_vpp.h drm/meson: venc: add ENCL encoder setup for MIPI-DSI output 2023-06-01 16:10:22 +02:00