mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 06:01:53 +02:00
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
This commit is contained in:
parent
9c22b6ece2
commit
19851fa2ba
|
|
@ -251,10 +251,6 @@ MODULE_DEVICE_TABLE(of, dw_hdmi_qp_rockchip_dt_ids);
|
|||
static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
|
||||
void *data)
|
||||
{
|
||||
static const char * const clk_names[] = {
|
||||
"pclk", "earc", "aud", "hdp", "hclk_vo1",
|
||||
"ref" /* keep "ref" last */
|
||||
};
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
const struct rockchip_hdmi_qp_cfg *cfg;
|
||||
struct dw_hdmi_qp_plat_data plat_data;
|
||||
|
|
@ -263,7 +259,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
|
|||
struct drm_encoder *encoder;
|
||||
struct rockchip_hdmi_qp *hdmi;
|
||||
struct resource *res;
|
||||
struct clk *clk;
|
||||
struct clk_bulk_data *clks;
|
||||
int ret, irq, i;
|
||||
u32 val;
|
||||
|
||||
|
|
@ -328,18 +324,22 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
|
|||
return PTR_ERR(hdmi->vo_regmap);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(clk_names); i++) {
|
||||
clk = devm_clk_get_enabled(hdmi->dev, clk_names[i]);
|
||||
ret = devm_clk_bulk_get_all_enabled(hdmi->dev, &clks);
|
||||
if (ret < 0) {
|
||||
drm_err(hdmi, "Failed to get clocks: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
drm_err(hdmi, "Failed to get %s clock: %d\n",
|
||||
clk_names[i], ret);
|
||||
return ret;
|
||||
for (i = 0; i < ret; i++) {
|
||||
if (!strcmp(clks[i].id, "ref")) {
|
||||
hdmi->ref_clk = clks[1].clk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
hdmi->ref_clk = clk;
|
||||
if (!hdmi->ref_clk) {
|
||||
drm_err(hdmi, "Missing ref clock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hdmi->enable_gpio = devm_gpiod_get_optional(hdmi->dev, "enable",
|
||||
GPIOD_OUT_HIGH);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user