[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191224143900.23567-8-miquel.raynal@bootlin.com>
Date: Tue, 24 Dec 2019 15:38:56 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
Sandy Huang <hjc@...k-chips.com>,
Heiko Stuebner <heiko@...ech.de>,
<linux-rockchip@...ts.infradead.org>
Cc: <linux-kernel@...r.kernel.org>, dri-devel@...ts.freedesktop.org,
Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
<devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH v2 07/11] drm/rockchip: lvds: Helpers should return decent values
Return errors instead of returning void from internal helpers. When
these helpers are called, check the returned value and print an error
message in this case.
Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
---
drivers/gpu/drm/rockchip/rockchip_lvds.c | 31 ++++++++++++++++++------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 731aba25bec5..40fa49fe9fa5 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -214,8 +214,8 @@ struct drm_connector_helper_funcs rockchip_lvds_connector_helper_funcs = {
.get_modes = rockchip_lvds_connector_get_modes,
};
-static void rk3288_lvds_grf_config(struct drm_encoder *encoder,
- struct drm_display_mode *mode)
+static int rk3288_lvds_grf_config(struct drm_encoder *encoder,
+ struct drm_display_mode *mode)
{
struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u8 pin_hsync = (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
@@ -240,10 +240,10 @@ static void rk3288_lvds_grf_config(struct drm_encoder *encoder,
val |= (pin_dclk << 8) | (pin_hsync << 9);
val |= (0xffff << 16);
ret = regmap_write(lvds->grf, RK3288_LVDS_GRF_SOC_CON7, val);
- if (ret != 0) {
+ if (ret)
DRM_DEV_ERROR(lvds->dev, "Could not write to GRF: %d\n", ret);
- return;
- }
+
+ return ret;
}
static int rk3288_lvds_set_vop_source(struct rockchip_lvds *lvds,
@@ -287,13 +287,28 @@ static void rk3288_lvds_encoder_enable(struct drm_encoder *encoder)
int ret;
drm_panel_prepare(lvds->panel);
+
ret = rk3288_lvds_poweron(lvds);
if (ret < 0) {
- DRM_DEV_ERROR(lvds->dev, "failed to power on lvds: %d\n", ret);
+ DRM_DEV_ERROR(lvds->dev, "failed to power on LVDS: %d\n", ret);
drm_panel_unprepare(lvds->panel);
+ return;
}
- rk3288_lvds_grf_config(encoder, mode);
- rk3288_lvds_set_vop_source(lvds, encoder);
+
+ ret = rk3288_lvds_grf_config(encoder, mode);
+ if (ret) {
+ DRM_DEV_ERROR(lvds->dev, "failed to configure LVDS: %d\n", ret);
+ drm_panel_unprepare(lvds->panel);
+ return;
+ }
+
+ ret = rk3288_lvds_set_vop_source(lvds, encoder);
+ if (ret) {
+ DRM_DEV_ERROR(lvds->dev, "failed to set VOP source: %d\n", ret);
+ drm_panel_unprepare(lvds->panel);
+ return;
+ }
+
drm_panel_enable(lvds->panel);
}
--
2.20.1
Powered by blists - more mailing lists