Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/stm/dw_mipi_dsi-stm: convert from round_rate() to determine_rate()

The round_rate() clk ops is deprecated, so migrate this driver from
round_rate() to determine_rate() using the Coccinelle semantic patch
on the cover letter of this series.

Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com>
Link: https://lore.kernel.org/r/20250811-drm-clk-round-rate-v2-6-4a91ccf239cf@redhat.com
Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>

authored by

Brian Masney and committed by
Raphael Gallais-Pou
5ccf442e b1a122f4

+8 -6
+8 -6
drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
··· 274 274 return (unsigned long)pll_out_khz * 1000; 275 275 } 276 276 277 - static long dw_mipi_dsi_clk_round_rate(struct clk_hw *hw, unsigned long rate, 278 - unsigned long *parent_rate) 277 + static int dw_mipi_dsi_clk_determine_rate(struct clk_hw *hw, 278 + struct clk_rate_request *req) 279 279 { 280 280 struct dw_mipi_dsi_stm *dsi = clk_to_dw_mipi_dsi_stm(hw); 281 281 unsigned int idf, ndiv, odf, pll_in_khz, pll_out_khz; ··· 283 283 284 284 DRM_DEBUG_DRIVER("\n"); 285 285 286 - pll_in_khz = (unsigned int)(*parent_rate / 1000); 286 + pll_in_khz = (unsigned int)(req->best_parent_rate / 1000); 287 287 288 288 /* Compute best pll parameters */ 289 289 idf = 0; 290 290 ndiv = 0; 291 291 odf = 0; 292 292 293 - ret = dsi_pll_get_params(dsi, pll_in_khz, rate / 1000, 293 + ret = dsi_pll_get_params(dsi, pll_in_khz, req->rate / 1000, 294 294 &idf, &ndiv, &odf); 295 295 if (ret) 296 296 DRM_WARN("Warning dsi_pll_get_params(): bad params\n"); ··· 298 298 /* Get the adjusted pll out value */ 299 299 pll_out_khz = dsi_pll_get_clkout_khz(pll_in_khz, idf, ndiv, odf); 300 300 301 - return pll_out_khz * 1000; 301 + req->rate = pll_out_khz * 1000; 302 + 303 + return 0; 302 304 } 303 305 304 306 static int dw_mipi_dsi_clk_set_rate(struct clk_hw *hw, unsigned long rate, ··· 353 351 .disable = dw_mipi_dsi_clk_disable, 354 352 .is_enabled = dw_mipi_dsi_clk_is_enabled, 355 353 .recalc_rate = dw_mipi_dsi_clk_recalc_rate, 356 - .round_rate = dw_mipi_dsi_clk_round_rate, 354 + .determine_rate = dw_mipi_dsi_clk_determine_rate, 357 355 .set_rate = dw_mipi_dsi_clk_set_rate, 358 356 }; 359 357