Commit 6a328360 authored by Cristian Ciocaltea's avatar Cristian Ciocaltea Committed by Heiko Stuebner

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: default avatarCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240813-dw-hdmi-rockchip-cleanup-v1-3-b3e73b5f4fd6@collabora.com
parent d2a80cb5
...@@ -77,8 +77,6 @@ struct rockchip_hdmi { ...@@ -77,8 +77,6 @@ struct rockchip_hdmi {
struct clk *ref_clk; struct clk *ref_clk;
struct clk *grf_clk; struct clk *grf_clk;
struct dw_hdmi *hdmi; struct dw_hdmi *hdmi;
struct regulator *avdd_0v9;
struct regulator *avdd_1v8;
struct phy *phy; struct phy *phy;
}; };
...@@ -236,15 +234,13 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) ...@@ -236,15 +234,13 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
return ret; return ret;
} }
hdmi->avdd_0v9 = devm_regulator_get(hdmi->dev, "avdd-0v9"); ret = devm_regulator_get_enable(hdmi->dev, "avdd-0v9");
if (IS_ERR(hdmi->avdd_0v9)) if (ret)
return PTR_ERR(hdmi->avdd_0v9); return ret;
hdmi->avdd_1v8 = devm_regulator_get(hdmi->dev, "avdd-1v8"); ret = devm_regulator_get_enable(hdmi->dev, "avdd-1v8");
if (IS_ERR(hdmi->avdd_1v8))
return PTR_ERR(hdmi->avdd_1v8);
return 0; return ret;
} }
static enum drm_mode_status static enum drm_mode_status
...@@ -602,18 +598,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, ...@@ -602,18 +598,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
return ret; return ret;
} }
ret = regulator_enable(hdmi->avdd_0v9);
if (ret) {
drm_err(hdmi, "failed to enable avdd0v9: %d\n", ret);
goto err_avdd_0v9;
}
ret = regulator_enable(hdmi->avdd_1v8);
if (ret) {
drm_err(hdmi, "failed to enable avdd1v8: %d\n", ret);
goto err_avdd_1v8;
}
if (hdmi->chip_data == &rk3568_chip_data) { if (hdmi->chip_data == &rk3568_chip_data) {
regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1, regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1,
HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK | HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK |
...@@ -642,10 +626,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, ...@@ -642,10 +626,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
err_bind: err_bind:
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
regulator_disable(hdmi->avdd_1v8);
err_avdd_1v8:
regulator_disable(hdmi->avdd_0v9);
err_avdd_0v9:
return ret; return ret;
} }
...@@ -656,9 +637,6 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, ...@@ -656,9 +637,6 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
dw_hdmi_unbind(hdmi->hdmi); dw_hdmi_unbind(hdmi->hdmi);
drm_encoder_cleanup(&hdmi->encoder.encoder); drm_encoder_cleanup(&hdmi->encoder.encoder);
regulator_disable(hdmi->avdd_1v8);
regulator_disable(hdmi->avdd_0v9);
} }
static const struct component_ops dw_hdmi_rockchip_ops = { static const struct component_ops dw_hdmi_rockchip_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment