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

drm/msm/dsi: use bulk clk API

Use clk_bulk_* API instead of hand-coding them. Note, this drops support
for legacy clk naming (e.g. "iface_clk" instead of just "iface"),
however all in-kernel device trees were converted long long ago. The
warning is present there since 2017.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211002012715.691406-1-dmitry.baryshkov@linaro.org
Signed-off-by: Rob Clark <robdclark@chromium.org>

authored by

Dmitry Baryshkov and committed by
Rob Clark
d9fbb54d 658f4c82

+12 -47
+12 -47
drivers/gpu/drm/msm/dsi/dsi_host.c
··· 106 106 phys_addr_t ctrl_size; 107 107 struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; 108 108 109 - struct clk *bus_clks[DSI_BUS_CLK_MAX]; 109 + int num_bus_clks; 110 + struct clk_bulk_data bus_clks[DSI_BUS_CLK_MAX]; 110 111 111 112 struct clk *byte_clk; 112 113 struct clk *esc_clk; ··· 375 374 int i, ret = 0; 376 375 377 376 /* get bus clocks */ 378 - for (i = 0; i < cfg->num_bus_clks; i++) { 379 - msm_host->bus_clks[i] = msm_clk_get(pdev, 380 - cfg->bus_clk_names[i]); 381 - if (IS_ERR(msm_host->bus_clks[i])) { 382 - ret = PTR_ERR(msm_host->bus_clks[i]); 383 - pr_err("%s: Unable to get %s clock, ret = %d\n", 384 - __func__, cfg->bus_clk_names[i], ret); 385 - goto exit; 386 - } 377 + for (i = 0; i < cfg->num_bus_clks; i++) 378 + msm_host->bus_clks[i].id = cfg->bus_clk_names[i]; 379 + msm_host->num_bus_clks = cfg->num_bus_clks; 380 + 381 + ret = devm_clk_bulk_get(&pdev->dev, msm_host->num_bus_clks, msm_host->bus_clks); 382 + if (ret < 0) { 383 + dev_err(&pdev->dev, "Unable to get clocks, ret = %d\n", ret); 384 + goto exit; 387 385 } 388 386 389 387 /* get link and source clocks */ ··· 433 433 return ret; 434 434 } 435 435 436 - static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host) 437 - { 438 - const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg; 439 - int i, ret; 440 - 441 - DBG("id=%d", msm_host->id); 442 - 443 - for (i = 0; i < cfg->num_bus_clks; i++) { 444 - ret = clk_prepare_enable(msm_host->bus_clks[i]); 445 - if (ret) { 446 - pr_err("%s: failed to enable bus clock %d ret %d\n", 447 - __func__, i, ret); 448 - goto err; 449 - } 450 - } 451 - 452 - return 0; 453 - err: 454 - while (--i >= 0) 455 - clk_disable_unprepare(msm_host->bus_clks[i]); 456 - 457 - return ret; 458 - } 459 - 460 - static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host) 461 - { 462 - const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg; 463 - int i; 464 - 465 - DBG(""); 466 - 467 - for (i = cfg->num_bus_clks - 1; i >= 0; i--) 468 - clk_disable_unprepare(msm_host->bus_clks[i]); 469 - } 470 - 471 436 int msm_dsi_runtime_suspend(struct device *dev) 472 437 { 473 438 struct platform_device *pdev = to_platform_device(dev); ··· 443 478 if (!msm_host->cfg_hnd) 444 479 return 0; 445 480 446 - dsi_bus_clk_disable(msm_host); 481 + clk_bulk_disable_unprepare(msm_host->num_bus_clks, msm_host->bus_clks); 447 482 448 483 return 0; 449 484 } ··· 458 493 if (!msm_host->cfg_hnd) 459 494 return 0; 460 495 461 - return dsi_bus_clk_enable(msm_host); 496 + return clk_bulk_prepare_enable(msm_host->num_bus_clks, msm_host->bus_clks); 462 497 } 463 498 464 499 int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)