Quoting Maxime Ripard (2022-08-15 08:31:24) > @@ -254,6 +255,33 @@ static int raspberrypi_fw_dumb_determine_rate(struct clk_hw *hw, > return 0; > } > > +unsigned long rpi_firmware_clk_get_max_rate(struct clk *clk) > +{ > + const struct raspberrypi_clk_data *data; > + struct raspberrypi_clk *rpi; > + struct clk_hw *hw; > + u32 max_rate; > + int ret; > + > + if (!clk) > + return 0; > + > + hw = __clk_get_hw(clk); Ideally we don't add more users of this API. I should document that :/ It begs the question though, why do we need this API to take a 'struct clk'? Can it simply hardcode the data->id value for the clk you care about and call rpi_firmware_property() directly (or some wrapper of it)? Furthermore, I wonder if even that part needs to be implemented. Why not make a direct call to rpi_firmware_property() and get the max rate? All of that can live in the drm driver. Making it a generic API that takes a 'struct clk' means that it looks like any clk can be passed, when that isn't true. It would be better to restrict it to the one use case so that the scope of the problem doesn't grow. I understand that it duplicates a few lines of code, but that looks like a fair tradeoff vs. exposing an API that can be used for other clks in the future. > + if (!hw) > + return 0; > + > + data = clk_hw_to_data(hw); > + rpi = data->rpi; > + ret = raspberrypi_clock_property(rpi->firmware, data, > + RPI_FIRMWARE_GET_MAX_CLOCK_RATE, > + &max_rate);