Skip to content

Commit 6a32836

Browse files
cristiccmmind
authored andcommitted
drm/rockchip: dw_hdmi: Use devm_regulator_get_enable()
The regulators are only enabled at bind() and disabled at unbind(), hence replace the boilerplate code by making use of devm_regulator_get_enable() helper. Signed-off-by: Cristian Ciocaltea <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20240813-dw-hdmi-rockchip-cleanup-v1-3-b3e73b5f4fd6@collabora.com
1 parent d2a80cb commit 6a32836

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ struct rockchip_hdmi {
7777
struct clk *ref_clk;
7878
struct clk *grf_clk;
7979
struct dw_hdmi *hdmi;
80-
struct regulator *avdd_0v9;
81-
struct regulator *avdd_1v8;
8280
struct phy *phy;
8381
};
8482

@@ -236,15 +234,13 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
236234
return ret;
237235
}
238236

239-
hdmi->avdd_0v9 = devm_regulator_get(hdmi->dev, "avdd-0v9");
240-
if (IS_ERR(hdmi->avdd_0v9))
241-
return PTR_ERR(hdmi->avdd_0v9);
237+
ret = devm_regulator_get_enable(hdmi->dev, "avdd-0v9");
238+
if (ret)
239+
return ret;
242240

243-
hdmi->avdd_1v8 = devm_regulator_get(hdmi->dev, "avdd-1v8");
244-
if (IS_ERR(hdmi->avdd_1v8))
245-
return PTR_ERR(hdmi->avdd_1v8);
241+
ret = devm_regulator_get_enable(hdmi->dev, "avdd-1v8");
246242

247-
return 0;
243+
return ret;
248244
}
249245

250246
static enum drm_mode_status
@@ -602,18 +598,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
602598
return ret;
603599
}
604600

605-
ret = regulator_enable(hdmi->avdd_0v9);
606-
if (ret) {
607-
drm_err(hdmi, "failed to enable avdd0v9: %d\n", ret);
608-
goto err_avdd_0v9;
609-
}
610-
611-
ret = regulator_enable(hdmi->avdd_1v8);
612-
if (ret) {
613-
drm_err(hdmi, "failed to enable avdd1v8: %d\n", ret);
614-
goto err_avdd_1v8;
615-
}
616-
617601
if (hdmi->chip_data == &rk3568_chip_data) {
618602
regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1,
619603
HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK |
@@ -642,10 +626,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
642626

643627
err_bind:
644628
drm_encoder_cleanup(encoder);
645-
regulator_disable(hdmi->avdd_1v8);
646-
err_avdd_1v8:
647-
regulator_disable(hdmi->avdd_0v9);
648-
err_avdd_0v9:
629+
649630
return ret;
650631
}
651632

@@ -656,9 +637,6 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
656637

657638
dw_hdmi_unbind(hdmi->hdmi);
658639
drm_encoder_cleanup(&hdmi->encoder.encoder);
659-
660-
regulator_disable(hdmi->avdd_1v8);
661-
regulator_disable(hdmi->avdd_0v9);
662640
}
663641

664642
static const struct component_ops dw_hdmi_rockchip_ops = {

0 commit comments

Comments
 (0)