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/rockchip: dw_hdmi_qp: Simplify clock handling

Make use of the recently introduced devm_clk_bulk_get_all_enabled()
helper to simplify the code a bit.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20241202-dw-hdmi-qp-rk-clk-bulk-v1-1-60a7cc9cd74e@collabora.com

authored by

Cristian Ciocaltea and committed by
Heiko Stuebner
19851fa2 9c22b6ec

+14 -14
+14 -14
drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
··· 251 251 static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master, 252 252 void *data) 253 253 { 254 - static const char * const clk_names[] = { 255 - "pclk", "earc", "aud", "hdp", "hclk_vo1", 256 - "ref" /* keep "ref" last */ 257 - }; 258 254 struct platform_device *pdev = to_platform_device(dev); 259 255 const struct rockchip_hdmi_qp_cfg *cfg; 260 256 struct dw_hdmi_qp_plat_data plat_data; ··· 259 263 struct drm_encoder *encoder; 260 264 struct rockchip_hdmi_qp *hdmi; 261 265 struct resource *res; 262 - struct clk *clk; 266 + struct clk_bulk_data *clks; 263 267 int ret, irq, i; 264 268 u32 val; 265 269 ··· 324 328 return PTR_ERR(hdmi->vo_regmap); 325 329 } 326 330 327 - for (i = 0; i < ARRAY_SIZE(clk_names); i++) { 328 - clk = devm_clk_get_enabled(hdmi->dev, clk_names[i]); 331 + ret = devm_clk_bulk_get_all_enabled(hdmi->dev, &clks); 332 + if (ret < 0) { 333 + drm_err(hdmi, "Failed to get clocks: %d\n", ret); 334 + return ret; 335 + } 329 336 330 - if (IS_ERR(clk)) { 331 - ret = PTR_ERR(clk); 332 - if (ret != -EPROBE_DEFER) 333 - drm_err(hdmi, "Failed to get %s clock: %d\n", 334 - clk_names[i], ret); 335 - return ret; 337 + for (i = 0; i < ret; i++) { 338 + if (!strcmp(clks[i].id, "ref")) { 339 + hdmi->ref_clk = clks[1].clk; 340 + break; 336 341 } 337 342 } 338 - hdmi->ref_clk = clk; 343 + if (!hdmi->ref_clk) { 344 + drm_err(hdmi, "Missing ref clock\n"); 345 + return -EINVAL; 346 + } 339 347 340 348 hdmi->enable_gpio = devm_gpiod_get_optional(hdmi->dev, "enable", 341 349 GPIOD_OUT_HIGH);