12.01.2022 16:51, Maxime Ripard пишет: > Hi Dmitry, > > On Wed, Jan 12, 2022 at 04:28:41PM +0300, Dmitry Osipenko wrote: >> 14.09.2021 12:35, Maxime Ripard пишет: >>> Hi, >>> >>> This is a follow-up of the discussion here: >>> https://lore.kernel.org/linux-clk/20210319150355.xzw7ikwdaga2dwhv@gilmour/ >>> >>> This implements a mechanism to raise and lower clock rates based on consumer >>> workloads, with an example of such an implementation for the RaspberryPi4 HDMI >>> controller. >>> >>> There's a couple of things worth discussing: >>> >>> - The name is in conflict with clk_request_rate, and even though it feels >>> like the right name to me, we should probably avoid any confusion >>> >>> - The code so far implements a policy of always going for the lowest rate >>> possible. While we don't have an use-case for something else, this should >>> maybe be made more flexible? >> >> Hello Maxime, >> >> On NVIDIA Tegra we use interconnect framework for converting of >> workload-based memory bandwidth requirement to the memory clock rate >> [1]. All Tegra SoCs have two display controllers and other memory >> clients, ICC takes care of summing and updating memory bandwidth for us, >> which in the end results in a freq change of the shared memory controller. >> >> [1] https://git.kernel.org/linus/04d5d5df9 >> >> Not so long time ago me and Thierry Reding were looking at yours v1 and >> back then Thierry suggested that the same ICC approach might work for >> yours case. I'm now looking at the v2 and yours discussion with Stephen >> Boyd, and it appears that ICC is indeed what you really need. Have you >> considered to use ICC? > > The goals seem to be similar indeed, but most of these clocks feed some > internal state machine in those devices and are not related to the > memory bandwidth at all. So there's no real interconnect to model there :/ If you could convert resolution/pclk to BW and BW to the clock rates, then it should be possible to model ICC. BW doesn't necessarily need to be "memory" bandwidth, bandwidth is abstract value expressed in kbytes/sec. The state machine will be ICC provider then, although you'll need to model that machine as a separate device somehow. For example, on Tegra we needed to specify clocks as separate devices to model GENPD [2][3]. [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b1bc04a2ac5 [3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm/boot/dts/tegra30.dtsi?h=next-20220112#n394