clk: bcm: rpi: Add a function to retrieve the maximum
The RaspberryPi firmware can be configured by the end user using the config.txt file. Some of these options will affect the kernel capabilities, and we thus need to be able to detect it to operate reliably. One of such parameters is the hdmi_enable_4kp60 parameter that will setup the clocks in a way that is suitable to reach the pixel frequencies required by the 4k at 60Hz and higher modes. If the user forgot to enable it, then those modes will simply not work but are still likely to be picked up by the userspace, which is a poor user-experience. The kernel can't access the config.txt file directly, but one of the effect that parameter has is that the core clock frequency maximum will be much higher. Thus we can infer whether it was enabled or not by querying the firmware for that maximum, and if it isn't prevent any of the modes that wouldn't work. The HDMI driver is already doing this, but was relying on a behaviour of clk_round_rate() that got changed recently, and doesn't return the result we would like anymore. We also considered introducing a CCF function to access the maximum of a given struct clk, but that wouldn't work if the clock is further constrained by another user. It was thus suggested to create a small, ad-hoc function to query the RaspberryPi firmware for the maximum rate a given clock has. Suggested-by:Stephen Boyd <sboyd@kernel.org> Signed-off-by:
Maxime Ripard <maxime@cerno.tech>
Loading